439 lines · 10.9 KB · JSONRaw
{ "format_version": 1, "id": "comment", "name": "Question", "plural": "Questions", "builtin": true, "visibility": "owner", "date": "created_at", "title": "body", "columns": [ { "key": "record_kind", "name": "On", "type": "choice", "choices": [ "todo", "event", "note", "journal", "person", "location", "page", "meeting", "document", "news_edition", "memory", "call", "session" ], "readonly": true }, { "key": "record_id", "name": "Record", "type": "text", "readonly": true }, { "key": "parent_id", "type": "link", "link_to": "comment", "readonly": true }, { "key": "body", "name": "Question", "type": "longtext", "readonly": true, "required": true }, { "key": "author_kind", "type": "text", "readonly": true }, { "key": "author_user_id", "type": "text", "readonly": true }, { "key": "author_label", "name": "Asked by", "type": "text", "readonly": true }, { "key": "anchor", "type": "longtext", "readonly": true }, { "key": "resolved_at", "name": "Settled", "type": "date", "readonly": true }, { "key": "resolved_by_kind", "type": "text", "readonly": true }, { "key": "resolved_by_label", "type": "text", "readonly": true }, { "key": "kind", "type": "text", "readonly": true }, { "key": "trashed_at", "type": "date", "format": "calendar-datetime", "readonly": true }, { "key": "about", "name": "About", "type": "text", "readonly": true }, { "key": "status", "type": "choice", "choices": [ "open", "answered", "closed" ], "labels": { "open": "Open", "answered": "Answered", "closed": "Closed" } }, { "key": "answer", "name": "Your answer", "type": "longtext" }, { "key": "created_at", "name": "Asked", "type": "date", "readonly": true } ], "instructions": "A question is a comment an assistant left on one of the owner's records, waiting on the owner. The list holds only the open ones, oldest first. The owner answers in their own words — that answer is the closing reply the assistant reads under its question — or closes it without an answer, which posts the reply \"Closed by the owner without a change.\" A question the assistant settled itself before the owner replied reads as closed too. Settled questions leave the list; ask for them with where {status} or where {resolved_at}. Ask only what the owner alone can answer, one question per comment, on the record it is about.", "tables": [ { "name": "cotton_comments", "columns": [ { "name": "id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n id TEXT PRIMARY KEY", "position": 0 }, { "name": "workspace_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n workspace_id TEXT NOT NULL", "position": 1 }, { "name": "record_kind", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n record_kind TEXT NOT NULL", "position": 2 }, { "name": "record_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n record_id TEXT NOT NULL", "position": 3 }, { "name": "parent_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n parent_id TEXT", "position": 4 }, { "name": "body", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n body TEXT NOT NULL", "position": 5 }, { "name": "author_kind", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n author_kind TEXT NOT NULL", "position": 6 }, { "name": "author_user_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n author_user_id TEXT", "position": 7 }, { "name": "author_label", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n author_label TEXT", "position": 8 }, { "name": "anchor", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n anchor TEXT", "position": 9 }, { "name": "resolved_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n resolved_at TEXT", "position": 10 }, { "name": "resolved_by_kind", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n resolved_by_kind TEXT", "position": 11 }, { "name": "resolved_by_label", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n resolved_by_label TEXT", "position": 12 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 13 }, { "name": "updated_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n updated_at TEXT NOT NULL", "position": 14 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 15 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 16 }, { "name": "kind", "type": "TEXT", "default": "'note'", "nullable": false, "primary_key": false, "declaration": "\n kind TEXT NOT NULL DEFAULT 'note'", "position": 17 }, { "name": "trashed_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": " trashed_at TEXT", "position": 18 } ], "constraints": [ { "declaration": "\n CHECK (kind IN ('question', 'note'))", "position": 19 }, { "declaration": "\n CHECK ((author_kind = 'agent') = (author_label IS NOT NULL))", "position": 20 }, { "declaration": "\n CHECK (author_kind IN ('user', 'agent'))", "position": 21 }, { "declaration": "\n CHECK (length(trim(body)) > 0)", "position": 22 }, { "declaration": "\n CHECK (record_kind IN ('todo', 'event', 'note', 'journal', 'person', 'location', 'page', 'meeting', 'document', 'news_edition', 'memory', 'call', 'decision'))", "position": 23 }, { "declaration": "\n CHECK (resolved_by_kind IN ('user', 'agent'))", "position": 24 }, { "declaration": "\n CHECK ((resolved_at IS NULL) = (resolved_by_kind IS NULL))", "position": 25 }, { "declaration": "\n CHECK ((author_kind = 'user') = (author_user_id IS NOT NULL))", "position": 26 }, { "declaration": "\n FOREIGN KEY (parent_id) REFERENCES cotton_comments(id)", "position": 27 }, { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 28 } ], "prefix": "CREATE TABLE \"cotton_comments\" (", "suffix": ")", "indexes": [ "CREATE INDEX idx_cotton_comments_open ON cotton_comments (workspace_id, created_at DESC) WHERE resolved_at IS NULL", "CREATE INDEX idx_cotton_comments_parent ON cotton_comments (parent_id) WHERE parent_id IS NOT NULL", "CREATE INDEX idx_cotton_comments_record ON cotton_comments (record_kind, record_id, created_at)", "CREATE INDEX IF NOT EXISTS idx_cotton_comments_author ON cotton_comments (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] } ], "picture": null, "engine": "comments", "project": null, "order": null, "slip": { "title": "body", "subtitle": null, "trailing": "about", "photo": null, "toggle": null, "answers": { "column": "status", "values": { "closed": "Close without an answer" }, "when": [ "open" ] }, "reply": { "column": "answer", "label": "Answer", "placeholder": "Your answer, in your own words" } }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "body", "about" ] }, { "heading": "Your answer", "columns": [ "answer", "status" ] }, { "heading": "Details", "columns": [ "author_label", "created_at", "resolved_at" ] } ], "archived": "resolved_at", "archived_in_core": true, "sort": { "column": "created_at" }, "group": { "column": "status", "sections": [ { "heading": "Asked of you", "values": [ "open" ] } ] }, "empty": { "title": "Nothing is waiting on you.", "message": "When an assistant asks you something, the question lands here." }, "delete": false, "opens": { "column": "record_id", "table_column": "record_kind" }}