askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
templates.json · 5.3 KB · 163 lines
| 1 | { |
| 2 | "name": "templates", |
| 3 | "title": "Templates", |
| 4 | "version": 4, |
| 5 | "description": "Reusable, structured-data templates. `body` remains a free-text fallback from v1; a private predecessor-system audit (not part of this repo) showed templates there are chiefly a JSON Schema (`schema`) plus optional AI-assist config, so v2 adds those fields alongside it. Edit history comes from the record changelog.", |
| 6 | "fields": [ |
| 7 | { |
| 8 | "name": "id" |
| 9 | }, |
| 10 | { |
| 11 | "name": "name", |
| 12 | "type": "text", |
| 13 | "required": true, |
| 14 | "label": "Name", |
| 15 | "validation": { |
| 16 | "min_length": 1, |
| 17 | "max_length": 120 |
| 18 | } |
| 19 | }, |
| 20 | { |
| 21 | "name": "description", |
| 22 | "type": "text", |
| 23 | "label": "Description", |
| 24 | "validation": { |
| 25 | "max_length": 300 |
| 26 | } |
| 27 | }, |
| 28 | { |
| 29 | "name": "category", |
| 30 | "type": "text", |
| 31 | "label": "Category" |
| 32 | }, |
| 33 | { |
| 34 | "name": "body", |
| 35 | "type": "textarea", |
| 36 | "required": true, |
| 37 | "label": "Body", |
| 38 | "validation": { |
| 39 | "min_length": 1 |
| 40 | } |
| 41 | }, |
| 42 | { |
| 43 | "name": "schema", |
| 44 | "type": "textarea", |
| 45 | "label": "Schema (JSON)", |
| 46 | "help": "JSON Schema describing this template's structured fields -- the core of a template on the audited predecessor. Stored as a JSON string, same convention as invoice_lines/invoices use plain typed fields and this codebase's field-type contract (docs/schema-forms.md) has no dedicated json type. Kept optional (not required) so v1 template records saved before this field existed stay valid to read and re-save." |
| 47 | }, |
| 48 | { |
| 49 | "name": "ui_schema", |
| 50 | "type": "textarea", |
| 51 | "label": "UI Schema (JSON)", |
| 52 | "help": "Optional form-presentation hints for `schema` above, e.g. field order or widget choice. JSON string, same storage convention as `schema`." |
| 53 | }, |
| 54 | { |
| 55 | "name": "instructions", |
| 56 | "type": "textarea", |
| 57 | "label": "Instructions", |
| 58 | "help": "Human-readable how-to for whoever fills out this template." |
| 59 | }, |
| 60 | { |
| 61 | "name": "ai_prompt", |
| 62 | "type": "textarea", |
| 63 | "label": "AI Prompt", |
| 64 | "help": "Instructions an AI assistant would use to help fill this template. Stored config only -- this codebase has no AI auto-fill engine; nothing reads or executes this field yet." |
| 65 | }, |
| 66 | { |
| 67 | "name": "ai_assistance", |
| 68 | "type": "enum", |
| 69 | "label": "AI Assistance", |
| 70 | "default": "suggestions", |
| 71 | "enum": [ |
| 72 | "none", |
| 73 | "suggestions", |
| 74 | "auto_fill", |
| 75 | "full" |
| 76 | ], |
| 77 | "help": "How much AI help this template calls for, mirroring the audited predecessor's levels. Stored preference only -- deferred infra, same posture as ai_prompt." |
| 78 | }, |
| 79 | { |
| 80 | "name": "handler", |
| 81 | "type": "text", |
| 82 | "label": "Run Handler", |
| 83 | "help": "Which engine executes this template when somebody presses Run: 'echo' renders the body with the form values and returns it (free, no provider); 'ai_text' sends the rendered body to a configured AI provider. Empty means this template is a document, not a job -- action_run_template refuses it by name. Text rather than an enum so a new handler is a new runner capability, not a schema migration of every install." |
| 84 | }, |
| 85 | { |
| 86 | "name": "run_cost_cents", |
| 87 | "type": "integer", |
| 88 | "default": "0", |
| 89 | "label": "Run Price", |
| 90 | "help": "What one run costs the person running it, in integer cents (doctrine #10). This is a PRICE, not a passthrough of the provider's bill: it is stamped onto the run at queue time and held against the wallet before anything executes, so editing it next week changes what the NEXT run costs and restates nothing anybody already paid -- the same act as stamping a rate on a time entry (docs/logic-decisions.md #1). What the run costs US at the provider is recorded on the run separately, so margin is a fold rather than a mystery. 0 means free to run, and free runs touch the wallet not at all." |
| 91 | }, |
| 92 | { |
| 93 | "name": "default_values", |
| 94 | "type": "textarea", |
| 95 | "label": "Default Values (JSON)", |
| 96 | "help": "Values pre-filled into `schema`'s fields when starting from this template. JSON string, same storage convention as `schema`." |
| 97 | }, |
| 98 | { |
| 99 | "name": "example_data", |
| 100 | "type": "textarea", |
| 101 | "label": "Example Data (JSON)", |
| 102 | "help": "A worked example matching `schema`, shown as a sample rather than used as a default. JSON string, same storage convention as `schema`." |
| 103 | }, |
| 104 | { |
| 105 | "name": "tags", |
| 106 | "type": "text", |
| 107 | "label": "Tags", |
| 108 | "help": "Comma-separated tag names" |
| 109 | }, |
| 110 | { |
| 111 | "name": "is_public", |
| 112 | "type": "boolean", |
| 113 | "label": "Public", |
| 114 | "default": "false" |
| 115 | }, |
| 116 | { |
| 117 | "name": "created_at", |
| 118 | "type": "datetime", |
| 119 | "read_only": true, |
| 120 | "label": "Created" |
| 121 | }, |
| 122 | { |
| 123 | "name": "owner_id", |
| 124 | "type": "text", |
| 125 | "label": "Owner" |
| 126 | } |
| 127 | ], |
| 128 | "forms": { |
| 129 | "default": { |
| 130 | "fields": [ |
| 131 | "name", |
| 132 | "description", |
| 133 | "category", |
| 134 | "body", |
| 135 | "schema", |
| 136 | "instructions", |
| 137 | "ai_prompt", |
| 138 | "ai_assistance", |
| 139 | "default_values", |
| 140 | "tags", |
| 141 | "is_public" |
| 142 | ] |
| 143 | } |
| 144 | }, |
| 145 | "views": { |
| 146 | "list_mode": "table", |
| 147 | "list_fields": [ |
| 148 | "name", |
| 149 | "category", |
| 150 | "ai_assistance", |
| 151 | "is_public" |
| 152 | ] |
| 153 | }, |
| 154 | "search": { |
| 155 | "fields": [ |
| 156 | "name", |
| 157 | "description", |
| 158 | "body", |
| 159 | "instructions", |
| 160 | "tags" |
| 161 | ] |
| 162 | } |
| 163 | } |