@notis_ai/cli 0.2.32 → 0.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +74 -9
  2. package/dist/agent-hooks/notis-agent-hook.mjs +4330 -891
  3. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  4. package/dist/base-skills/notis-cli/SKILL.md +7 -3
  5. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  6. package/dist/base-skills/notis-spaces/SKILL.md +5 -3
  7. package/dist/base-skills/notis-spaces/references/comments.md +94 -0
  8. package/dist/base-skills/notis-spaces/references/context.md +20 -19
  9. package/dist/base-skills/notis-spaces/references/design.md +3 -2
  10. package/dist/base-skills/notis-spaces/references/sdk.md +135 -83
  11. package/dist/base-skills/notis-spaces/references/store.md +24 -1
  12. package/dist/sdk/src/components/SelectionActionBar.tsx +42 -7
  13. package/dist/sdk/src/components/SpaceTextComments.tsx +284 -0
  14. package/dist/sdk/src/config.ts +3 -1
  15. package/dist/sdk/src/functions.ts +203 -0
  16. package/dist/sdk/src/hooks/useAgentQueue.ts +17 -28
  17. package/dist/sdk/src/hooks/useCollectionInteractions.ts +7 -2
  18. package/dist/sdk/src/hooks/useConnection.ts +102 -0
  19. package/dist/sdk/src/hooks/useFunction.ts +42 -0
  20. package/dist/sdk/src/hooks/useNotisSettings.ts +101 -0
  21. package/dist/sdk/src/index.ts +15 -4
  22. package/dist/sdk/src/runtime.ts +16 -1
  23. package/dist/sdk/src/space.ts +333 -33
  24. package/dist/sdk/src/ui/comments/passageModel.ts +99 -0
  25. package/dist/sdk/src/ui/comments/textHighlights.ts +33 -0
  26. package/dist/skill-sync/index.js +239 -30
  27. package/dist/skill-sync-worker.mjs +453 -124
  28. package/dist/space-harness/host.js +213 -92
  29. package/dist/space-sdk/dist/chunk-4GWS2IFO.js +3 -0
  30. package/dist/space-sdk/dist/index.js +3 -3
  31. package/dist/space-sdk/dist/ui.js +8 -7
  32. package/dist/space-sdk/src/config.ts +3 -1
  33. package/dist/space-sdk/src/functions.ts +203 -0
  34. package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +2 -13
  35. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +2 -0
  36. package/dist/space-sdk/src/hooks/useConnection.d.ts +42 -0
  37. package/dist/space-sdk/src/hooks/useFunction.d.ts +20 -0
  38. package/dist/space-sdk/src/hooks/useNotisSettings.d.ts +48 -0
  39. package/dist/space-sdk/src/index.d.ts +10 -4
  40. package/dist/space-sdk/src/runtime.d.ts +14 -1
  41. package/dist/space-sdk/src/space.ts +333 -33
  42. package/dist/space-sdk/src/tailwind-candidates.d.ts +185 -152
  43. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +7 -4
  44. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +10 -2
  45. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +55 -88
  46. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +9 -0
  47. package/dist/space-sdk/src/ui/comments/hostComments.d.ts +13 -9
  48. package/dist/space-sdk/src/ui/comments/index.d.ts +1 -1
  49. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +27 -5
  50. package/dist/space-sdk/src/ui/comments/passageModel.d.ts +12 -36
  51. package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +26 -4
  52. package/dist/space-sdk/src/ui/comments/useComments.d.ts +64 -74
  53. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +8 -4
  54. package/dist/space-sdk/src/ui/index.d.ts +1 -1
  55. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +3 -4
  56. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +27 -8
  57. package/dist/view-renderer/dist/host.js +280 -159
  58. package/package.json +3 -3
  59. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -2
  60. package/skills/notis-spaces/cli.md +3 -3
  61. package/src/cli.js +2 -1
  62. package/src/command-specs/index.js +3 -0
  63. package/src/command-specs/repository-secrets.js +171 -0
  64. package/src/command-specs/spaces.js +3 -3
  65. package/src/runtime/agent-credential.js +175 -0
  66. package/src/runtime/agent-identity.js +92 -15
  67. package/src/runtime/app-platform.js +8 -0
  68. package/src/runtime/auth-recovery.js +14 -0
  69. package/src/runtime/profiles.js +15 -0
  70. package/src/runtime/skill-sync/index.ts +3 -2
  71. package/src/runtime/skill-sync/symlink-manager.ts +354 -35
  72. package/src/runtime/skill-sync/types.ts +10 -1
  73. package/src/runtime/space-functions.js +211 -0
  74. package/src/runtime/space-platform.js +12 -3
  75. package/src/runtime/space-source.js +116 -13
  76. package/src/runtime/space-test-server.js +22 -4
  77. package/src/runtime/space-verification.js +3 -1
  78. package/src/runtime/transport.js +15 -0
  79. package/dist/sdk/src/components/NotisCommentBoundary.tsx +0 -132
  80. package/dist/space-sdk/dist/chunk-I4Z4UFGB.js +0 -3
  81. package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -26
@@ -1 +1 @@
1
- {"schema":1,"stamp":1794771946,"commit":"b5902cc7f64ba2ed2615c903c6e88a58d588bf5f"}
1
+ {"schema":1,"stamp":1795375614,"commit":"f09e2798430a8975fc45a48f786a4c155368285f"}
@@ -59,14 +59,18 @@ Two rules follow from the dev credential being scoped to that local backend:
59
59
 
60
60
  ## Declare who you are before writing
61
61
 
62
- When you are an agent (Claude Code, Codex, a script) and not the person typing, name yourself so what you write is yours, not the person's: a comment then shows your name as its author, never counts as the person's comment and never wakes you up. Pick a fresh lowercase imaginary rock-band name (lowercase letters and digits in at least two words joined by hyphens, 3 to 60 characters, such as `fred-and-the-machine`, shown as "Fred And The Machine") and set it once per session:
62
+ When you are an agent (Claude Code, Codex, a script) and not the person typing, name yourself so what you write is yours, not the person's: a comment then shows your name as its author, never counts as the person's comment and never wakes you up. Pick a fresh lowercase imaginary rock-band name of your own (lowercase letters and digits in at least two words joined by hyphens, 3 to 60 characters, such as `fred-and-the-machine`, shown as "Fred And The Machine"); every sub-agent picks its own, so the person sees which one wrote, and a harness or product name (`claude-code`, `codex`, `cursor-agent`, `notis-agent`, `t3-code`, `assistant`, `bot`...) is refused (`invalid_agent_identity`). Set it once per session with your own unique id and the name of the thread you work in:
63
63
 
64
64
  ```bash
65
65
  export NOTIS_AGENT_NAME="fred-and-the-machine" # your band name
66
- export NOTIS_AGENT_THREAD="<Notis thread id>" # optional
66
+ export NOTIS_AGENT_ID="<your session id>" # your own unique id, such as your T3 thread or Codex session id
67
+ export NOTIS_AGENT_THREAD_NAME="PR #3851" # the thread you work in, shown after your name (80 characters at most)
68
+ export NOTIS_AGENT_THREAD="<Notis thread id>" # only when you work for one of the person's Notis threads
67
69
  ```
68
70
 
69
- or pass `--agent-name` and `--agent-thread` on a single command (a flag wins over its variable). The CLI generates one id for each name the first time it is used on the computer and keeps sending it, so you edit or delete only your own comments; set `NOTIS_AGENT_ID` (or `--agent-id`) only to override it. Name a Notis thread only when you work for one of the person's Notis threads: replies to your comments then wake that thread; anything else is kept as a label. Declarations take effect where the person has unified comments on (being rolled out); elsewhere Notis ignores them and writes count as the person's, as before. With unified comments on, every comment written through the CLI needs the name, even one the person types: without it the write is refused (`agent_name_required`), and a name sent without an id is refused too (`agent_id_required`). Other writes with the person's own sign-in and no name are the person's. A name that breaks the rule is sent as written and the server refuses the call (`invalid_agent_identity`) where unified comments are on, reads included; elsewhere it is ignored. A declaration names you; it never gives access to anything more. The Notis assistant itself never writes comments (`orchestrator_comments_refused`): it starts a sub-agent for comment work, signed with that sub-agent's band name.
71
+ or pass `--agent-name`, `--agent-id`, `--agent-thread-name` and `--agent-thread` on a single command (a flag wins over its variable). Without `NOTIS_AGENT_ID` the CLI generates one id for each name the first time it is used on the computer and keeps sending it; the id is what makes your comments yours to edit or delete. The CLI also sends the harness that runs it (Claude Code, Codex, Cursor), detected from that harness's own variables, so your comments show its logo; `NOTIS_AGENT_HARNESS` overrides it. A comment thread you wrote in last is held by you: when the person replies or answers there, Notis wakes no agent of its own, so read the replies yourself when you check (`waiting`, `list` or `thread` of `LOCAL_NOTIS_SPACE_COMMENT_THREADS`); until you read them the person sees "<your name> has not read it yet". Name a Notis thread only when you work for one of the person's Notis threads: replies to your comments then wake that thread; anything else is kept as a label. Declarations take effect where the person has unified comments on (being rolled out); elsewhere Notis ignores them and writes count as the person's, as before. With unified comments on, every comment written through the CLI needs the name, even one the person types: without it the write is refused (`agent_name_required`), and a name sent without an id is refused too (`agent_id_required`). Other writes with the person's own sign-in and no name are the person's. A name that breaks the rule is sent as written and the server refuses the call (`invalid_agent_identity`) where unified comments are on, reads included; elsewhere it is ignored. A declaration names you; it never gives access to anything more. The Notis assistant itself never writes comments (`orchestrator_comments_refused`): it starts a sub-agent for comment work, signed with that sub-agent's band name.
72
+
73
+ Space comments are not database rows: read and write them only with `LOCAL_NOTIS_SPACE_COMMENT_THREADS` (for example `notis tools exec LOCAL_NOTIS_SPACE_COMMENT_THREADS --arguments '{"protocol":2,"operation":"list","space":"<space id>","page":"all"}'`, then `reply` with the root's `comment_id` and a `body`), never with `LOCAL_NOTIS_DATABASE_QUERY` or an upsert. Check its schema with `--get-schema` first. Agents never archive comments.
70
74
 
71
75
  ## Critical rule for missing tools
72
76
 
@@ -1 +1 @@
1
- {"schema":1,"stamp":1794969379,"commit":"73f9e76d42341e84ac32ae1a25ee7f2a8e51052e"}
1
+ {"schema":1,"stamp":1795375614,"commit":"f09e2798430a8975fc45a48f786a4c155368285f"}
@@ -2,8 +2,8 @@
2
2
  name: notis-spaces
3
3
  description: Explain Notis Spaces, sharing, resource links and lifecycle; build or update their views and linked Skills, inspect a saved view with its current data, choose whether text, a view, a Notes page or a Space answers a request, or install or update a Space from the Store or a pasted Space share link (check it, ask, then install).
4
4
  mcp_resource: true
5
- mcp_tool_patterns: ["LOCAL_NOTIS_MANAGE_SPACE", "LOCAL_NOTIS_SPACE_VERSIONS", "LOCAL_NOTIS_DOCUMENT_VERSIONS", "LOCAL_NOTIS_FIND_VIEWS", "LOCAL_NOTIS_RENDER_VIEW"]
6
- mcp_references: ["references/release.md", "references/architecture.md", "references/design.md", "references/sdk.md", "references/fixtures.md", "references/views.md", "references/memory.md", "references/troubleshooting.md", "references/reading.md", "references/context.md", "references/reports.md", "references/store.md"]
5
+ mcp_tool_patterns: ["LOCAL_NOTIS_MANAGE_SPACE", "LOCAL_NOTIS_SPACE_VERSIONS", "LOCAL_NOTIS_DOCUMENT_VERSIONS", "LOCAL_NOTIS_FIND_VIEWS", "LOCAL_NOTIS_RENDER_VIEW", "LOCAL_NOTIS_SPACE_FUNCTIONS"]
6
+ mcp_references: ["references/release.md", "references/architecture.md", "references/design.md", "references/sdk.md", "references/comments.md", "references/fixtures.md", "references/views.md", "references/memory.md", "references/troubleshooting.md", "references/reading.md", "references/context.md", "references/reports.md", "references/store.md"]
7
7
  ---
8
8
 
9
9
  # Notis Spaces
@@ -93,7 +93,7 @@ user asked, and quote their words in `user_words`. The CLI equivalents are
93
93
  | Check a view in a browser with `agent-browser` (open it, click, compare 390 and 1440 px) | The notis-browser-control skill (hosted guide: `notis://docs/notis-browser-control`): which runtime, the profile, the saved state |
94
94
  | Save or revise a Notes report or interactive report | [Reports](references/reports.md) |
95
95
  | Choose a memory policy | [Memory](references/memory.md) |
96
- | Data hooks, record pages and the toolkit pieces | [SDK](references/sdk.md); rows and counts (`useNativeDocuments`, `useNativeCount`): [Records and declared reads](references/sdk.md#records-and-declared-reads) |
96
+ | Data hooks, record pages and the toolkit pieces | [SDK](references/sdk.md); rows and counts (`useNativeDocuments`, `useNativeCount`): [Records and declared reads](references/sdk.md#records-and-declared-reads); comments on a page and the agents that answer them: [Comments](references/comments.md) |
97
97
  | Explain resources, sharing and lifecycle | [Platform boundaries](references/architecture.md) |
98
98
  | Diagnose a failed check or release | [Troubleshooting](references/troubleshooting.md) |
99
99
  | Publish or share a Space or its update in the Store | [Store publishing](references/store.md): you only prepare the submission and send its page; the person publishes there. No tool publishes |
@@ -272,6 +272,8 @@ and the same shape for `install` and `update` below.
272
272
  `notis skills read --target '<onboarding_skill.target as JSON>'`. Never ask again
273
273
  for what you already know about the person. During Notis onboarding the Skill
274
274
  never asks for the basics again and never completes onboarding: Notis does.
275
+ An update never repeats the Space's setup: its `onboarding_skill` is null
276
+ unless the new version adds the Space's first onboarding Skill.
275
277
 
276
278
  If the answer is `plan_required`, installing with Notis needs a plan or the free
277
279
  trial. Offer its `subscribe_url`, or installing it with another agent through the
@@ -0,0 +1,94 @@
1
+ # Comments in Space views
2
+
3
+ The comment pieces of the SDK ([SDK reference](sdk.md)) and the agents that answer comments.
4
+
5
+ ## Comment pieces
6
+
7
+ Every Space page has comments: Notis stores them itself, one store for all
8
+ Spaces, and lists them in the host Comments panel beside the chat. Never
9
+ create, bind or declare a Comments database, never add comment columns, and
10
+ never write comment rows with native writes or `useNativeMutation`. Selected
11
+ words on any page offer Cite and Comment without any code. Comments exist on
12
+ Space pages only (Notes pages included). While comments are off for the
13
+ viewer, or on a Site, a link or a preview, every comment piece renders
14
+ nothing: never build a fallback comment list or your own comment box.
15
+
16
+ Add comment code only when comments should sit on something more than words
17
+ of the page: `useComments` with `CommentPane`, `CommentPins` and
18
+ `CommentToolBar`.
19
+
20
+ ```tsx
21
+ const comments = useComments({
22
+ anchors: slides.map(s => ({ id: s.id, recordKey: s.recordKey, order: s.order, title: s.title })),
23
+ anchorKey: slide?.recordKey ?? null,
24
+ words: { anchorLabel: { en: 'Slide {n}', fr: 'Diapo {n}' } }, // names "New comment on Slide 2"
25
+ });
26
+ // <CommentPins controller={comments} anchorKey={slide.recordKey} /> over the stage
27
+ // <CommentToolBar controller={comments} /> <CommentPane controller={comments} />
28
+ ```
29
+
30
+ - `useComments` takes no database. `scope` is the page (record) the comments
31
+ belong to; leave it out to use the record the page has open (a record page,
32
+ or the record a declared record param such as `page` names, the `main` one
33
+ first), or the Space home. It takes no database, columns or author options.
34
+ - Mount `<CommentPane controller={comments} />` once anywhere in the view: it
35
+ draws in the host panel, not where it is mounted.
36
+ - The host and the server own the rest: who wrote a comment (never set an
37
+ author or let people pick one), archive (shown Done) and delete with Undo,
38
+ editing your own comment, the Open/Done/All filter, the Goes to line and To
39
+ chip that name the thread a comment goes to, attachments (pictures and
40
+ files on every comment, nothing to add), `comment=` links, waiting counts
41
+ and push. On someone else's comment people only archive, reopen, delete
42
+ (with edit rights) or answer it.
43
+ - `modes`: any of `text`, `point`, `box`, `items`, `time`, `page` (listed in
44
+ that order). Default: `point` and `box` when there are anchors, `items`
45
+ when you pass `onStartItems`, `time` when you pass `currentTime`, and
46
+ `page`. `<CommentToolBar controller={comments} />` puts one button per mode
47
+ on the page, toggled with C (`toggleKey`, or `pinned` to keep it shown);
48
+ Escape cancels a mode; on a phone it draws above the card in the layer root,
49
+ so a parent's hidden overflow never clips it. `onStartItems()`: show your own
50
+ picker, then call `comments.startItems(anchors)`; the comment names its
51
+ items and shows under each of them. `currentTime()`: the recording's moment in
52
+ seconds.
53
+ - `order` on the pane: `'newest'` (default), `'oldest'`, `'anchor'` or a
54
+ comparator. `groupBy`: a function returning `{ key, label }` per thread,
55
+ or false. A controller on the Space home groups by page, named by
56
+ `scopeNames`; a scoped one is flat.
57
+ - `focusKey` defaults to the `comment` view param, so a link with
58
+ `comment=<root id>` opens that thread; null turns it off.
59
+
60
+ ## Agents and comments
61
+
62
+ Space agents wake on comments with `on: 'comments'` in the Space source; it
63
+ needs no resource and takes no `columns`:
64
+
65
+ ```ts
66
+ agents: [{ id: 'editor', on: 'comments', event: 'created', thread: 'best_match',
67
+ runtime: 'notis', skill: 'address-feedback', wake: 'all' }]
68
+ ```
69
+
70
+ `event` is `created` (default) or `changed`, `wake` is `all` or `sent` (only
71
+ replies to and answers of the agent's own comments), `thread` is `best_match`
72
+ or `space`, `runtime` is `notis` or `cloud_computer`, `skill` names a linked
73
+ Skill. `on: { database: <alias> }` is for agents that watch a real
74
+ database's rows, never comments.
75
+
76
+ Agents read and write comments only with `LOCAL_NOTIS_SPACE_COMMENT_THREADS`
77
+ (`protocol` 2; operations `list`, `thread`, `comment`, `reply`, `edit`, `delete`,
78
+ `restore`, `answer`, `links`, `link`, `unlink`, `waiting`, `best_match`,
79
+ `viewer`, `page_link`; parameters `space`, `page` (a record key, `home` or
80
+ `all`), `view`, `anchor`, `comment_id`, `body`, `needs`, `options`,
81
+ `answer_to`, `answer`, `files`). Never query or upsert comments through a
82
+ database tool. Agents never archive: that is the people's. An agent's
83
+ comment is signed with its band name and never wakes it; the Notis
84
+ assistant never writes comments itself (`orchestrator_comments_refused`)
85
+ and starts a sub-agent for comment work. Through the Notis CLI, every
86
+ comment needs the writing agent's band name (`NOTIS_AGENT_NAME` or
87
+ `--agent-name`, such as `fred-and-the-machine`, never a harness or product
88
+ name; see the notis-cli skill), or it is refused (`agent_name_required`),
89
+ plus its own id (`NOTIS_AGENT_ID`) and the name of the thread it works in
90
+ (`NOTIS_AGENT_THREAD_NAME`). A comment thread such an agent outside Notis
91
+ wrote in last stays with it: replies there wake no Notis agent, the Goes to
92
+ line names it "outside Notis", and the card says when it has not read the
93
+ latest reply yet. A comment's files open from the
94
+ `url` its read returns, for an hour; read it again for a fresh one.
@@ -1,8 +1,10 @@
1
1
  # Sharing context with the agent
2
2
 
3
- Context is a generic SDK capability. An app can share a selected passage, a comment,
3
+ Context is a generic SDK capability. An app can share a selected passage, a note,
4
4
  an image point, chart state, loaded records or any other JSON-serializable reference.
5
- It is not a feedback database or an instruction to execute work.
5
+ It is not a feedback database or an instruction to execute work. Space comments
6
+ are a different thing: Notis stores them and lists them in the host Comments panel
7
+ ([Comments](comments.md)); a context pill never becomes a comment.
6
8
 
7
9
  ## Live context versus explicit pills
8
10
 
@@ -14,8 +16,9 @@ It is not a feedback database or an instruction to execute work.
14
16
  - `update(item)` replaces an existing unsent snapshot with the same app-scoped ID.
15
17
  - `remove(id)` detaches an existing unsent pill. These operations return whether a pill
16
18
  was actually changed. Sent snapshots are immutable. A missing update/remove returns false.
17
- - Apps own annotation storage, markers and sidebars. Chat owns composer drafts. Removing
18
- a chat pill never deletes an app annotation, and annotations are not invisibly attached.
19
+ - Apps own their own markers and any annotation data that is not a comment. Chat owns
20
+ composer drafts. Removing a chat pill never deletes app data or a comment, and neither
21
+ is invisibly attached.
19
22
 
20
23
  ## Generic item
21
24
 
@@ -54,23 +57,21 @@ pipeline and persists the resulting media URLs. Context attachments share a 50 M
54
57
  budget and the message's 10-file limit. A failed fetch/upload fails the send and retains
55
58
  the draft. Refresh expiring attachment URLs with `update` before sending when needed.
56
59
 
57
- ## Nearby comments and ordinary copy/paste
60
+ ## Selected text, Cite and Comment
58
61
 
59
- ```tsx
60
- <NotisCommentBoundary resource={currentResource} commentClassName="my-comment-style">
61
- <Article />
62
- </NotisCommentBoundary>
63
- ```
62
+ Every Space page offers a bar on selected text with no code: **Cite** adds the words
63
+ as a selected-text pill to the chat composer (it sends nothing), and, where comments
64
+ are on for the viewer, **Comment** opens the host Comments panel with the passage
65
+ ready to comment on. That comment is stored by Notis, not by the app, and agents
66
+ reach it through `LOCAL_NOTIS_SPACE_COMMENT_THREADS` ([Comments](comments.md)).
67
+ Never build your own comment box or selection bar for this.
64
68
 
65
- Selecting text reveals Comment. The action stays clickable; its nearby editor remains
66
- open independently of browser selection. Submit adds a context pill. It does not create
67
- an annotation record, poll a store, send a message or clear an app's annotation data.
68
- Use `renderComment(props)` to replace the optional standard editor. `NotisCommentBox`
69
- is also exported as a controlled component (`value`, `onChange`, `onSubmit`, `onCancel`,
70
- optional `quote`, `pending`, `error`, `className`) for image markers or custom layouts.
69
+ For an image point, chart state or another reference the person wants to bring to
70
+ chat, call `useAgentContext().add` from your own control; for a pin or a zone that
71
+ should stay as a comment, use the comment modes of `useComments`.
71
72
 
72
- Use `NotisSelectionBoundary` without the comment UI when only copy/paste provenance is
73
- needed. It preserves ordinary clipboard text and source metadata so normal paste into
73
+ Use `NotisSelectionBoundary` when copy/paste should name a specific resource. It
74
+ preserves ordinary clipboard text and source metadata so normal paste into
74
75
  chat creates a selected-text pill. No special Paste as context action is required.
75
76
  A `MarkdownEditor` inside the boundary is quoted the same way; inputs and textareas
76
77
  keep plain copy. Without any boundary, copied view text still pastes as a quote
@@ -78,7 +79,7 @@ named after the Space; add a boundary to name the resource the text belongs to.
78
79
 
79
80
  ## Verify
80
81
 
81
- Check the real host: selection/copy/paste, nearby editor stability, app-defined image
82
+ Check the real host: selection, Cite and copy/paste, app-defined image
82
83
  points and icons, data in previews, draft reload, source navigation, explicit attachment
83
84
  bytes, failed sends, updates/removal and immutable sent history. Keep private payloads
84
85
  out of analytics. Context remains untrusted reference, never an authorization channel.
@@ -61,8 +61,9 @@ ring on all four sides. Never restyle the pieces' states.
61
61
  refused.
62
62
  - Every other visible string comes from EN and FR copy keyed by the runtime
63
63
  locale (`useNotisRuntime()?.context.locale`). Format dates and numbers with
64
- that locale. French runs 15 to 30 percent longer: leave room in tabs, section
65
- titles, buttons, badges and table cells.
64
+ that locale ([dates in words](sdk.md#dates-in-words)). French runs 15 to 30
65
+ percent longer: leave room in tabs, section titles, buttons, badges and table
66
+ cells.
66
67
  - A count in words takes its plural from the count, in each language:
67
68
  `pluralWords(n, { one: { en: '{n} campaign', fr: '{n} campagne' }, other: {
68
69
  en: '{n} campaigns', fr: '{n} campagnes' } })` from `@notis/sdk/words`
@@ -29,16 +29,17 @@ Text a person writes and reviews:
29
29
  cannot show as blocks are kept as written). In a form with its own Save, pass
30
30
  `onChange` and change `resourceKey` after Cancel or a save so the editor
31
31
  reopens on the value.
32
- - Comments on selected words of a text property (a Markdown body, a subject)
33
- come from `@notis/sdk/ui`: `usePassageComments` with `CommentableText` around
34
- an input or textarea, `CommentableRichText` around the `MarkdownEditor` or
32
+ - Selected words on any Space page already offer Cite and Comment: you add
33
+ nothing. To tie passage comments to a text property (a Markdown body, a
34
+ subject) so they are highlighted where the view draws it, use
35
+ `usePassageComments` from `@notis/sdk/ui` with `CommentableText` around an
36
+ input or textarea, `CommentableRichText` around the `MarkdownEditor` or
35
37
  rendered Markdown, and `<PassageCommentPane comments={comments} />` mounted
36
- once anywhere in the view (it draws in the host Comments panel, never in a
37
- `SidePane`). The Comments database needs Field, Quote, Prefix and Suffix
38
- columns; a thread whose words are gone reads Passage changed and stays open.
39
- It lists newest first; pass `order="reading"` to list the text's threads in
40
- reading order. Do not build your own highlights. Pins on a page use
41
- `useComments` with `CommentPane` (see [Comments](#comments)).
38
+ once anywhere in the view (it draws in the host Comments panel). A thread
39
+ whose words are gone reads Passage changed and stays open. Pass
40
+ `order="reading"` to list the text's threads in reading order. Do not build
41
+ your own highlights. Pins on a page use `useComments` with `CommentPane`
42
+ (see [Comments](#comments)).
42
43
 
43
44
  ## Toolkit pieces
44
45
 
@@ -109,8 +110,9 @@ rather than from a copy.
109
110
  button, `viewerActions` adds viewer buttons (class `nui-viewer-btn`) and
110
111
  `onNotice` hears copy and download results. Use `ImageViewer` alone for a
111
112
  picture that opens full screen. Do not build your own lightbox.
112
- - **Comments**: `useComments` with `CommentPane` and `CommentPins` give comment
113
- threads on a Comments database; see [Comments](#comments).
113
+ - **Comments**: `useComments` with `CommentPane` and `CommentPins` add pins,
114
+ zones, items and moments to the comments every Space page has; see
115
+ [Comments](#comments).
114
116
  - **Presenting on a second screen**: `useAudienceScreen({ onAction, onClose,
115
117
  title })` works like PowerPoint. `secondScreen` says whether another screen
116
118
  is connected; call `open(anchor)` from the Present press itself. It answers
@@ -231,9 +233,6 @@ question, a note) wraps and its rows grow, and `wrapHeaders` puts long headers
231
233
  The primary column never gets under its `minWidth` (120 px by default): the last
232
234
  columns that do not fit hide on their own.
233
235
 
234
- `formatDuration(ms, locale, { units, smallest })` writes "1 h 31 min" (FR "4 j 6
235
- h").
236
-
237
236
  `CalendarHeatmap` is a GitHub-style grid of days coloured by value (a habit,
238
237
  journal entries, a mood): `data` rows with `dateKey` and `valueKey` (default
239
238
  `date` and `value`; `valueKey={null}` counts rows), `from` and `to` (default
@@ -243,74 +242,31 @@ for good to bad data (`higherIsBetter={false}` swaps the colours), `levels`,
243
242
  with `key` the ISO day, plus `value` and the day's `rows`), `title`, `legend`,
244
243
  `weekStartsOn`. It brings its tooltips, keys and data table.
245
244
 
245
+ ### Dates in words
246
+
247
+ Write dates and durations with the `@notis/sdk/ui` helpers and the runtime
248
+ locale: `formatLongDay(date, locale)` ("Monday, January 5, 2026" / "Lundi 5
249
+ janvier 2026"), `formatDayHeading(date, locale)` ("Lundi 19 octobre", the year
250
+ only when it is not this year), `formatShortDay`, `formatMonthYear`,
251
+ `formatDateRange` ("17 mai au 15 juin 2026", never a dash), `weekdayNames(locale,
252
+ width)` and `formatDuration(ms, locale, { units, smallest })` ("1 h 31 min", FR
253
+ "4 j 6 h").
254
+
255
+ By default `formatLongDay`, `formatDayHeading`, `formatMonthYear` and
256
+ `weekdayNames` start with a capital: they head a title, a group, a column or a
257
+ label. French writes weekdays and months in lower case everywhere else, so a
258
+ date inside a sentence passes `{ inSentence: true }`: `formatLongDay(date,
259
+ locale, { inSentence: true })`, `formatMonthYear(date, locale, { inSentence:
260
+ true })`, `formatDayHeading(date, locale, { thisYear, inSentence: true })` and
261
+ `weekdayNames(locale, 'long', { inSentence: true })` (the width always comes
262
+ first). With it French
263
+ reads "Publiée le lundi 9 novembre 2026" and English keeps its capitals
264
+ ("Published on Monday, November 9, 2026"). Never capitalise a French date in the
265
+ middle of a sentence ("depuis le Jeudi 19 novembre").
266
+
246
267
  ## Comments
247
268
 
248
- `useComments` with `CommentPane` and `CommentPins` give comment
249
- threads on a Comments database (pins, zones, replies, asks, Archive, Delete,
250
- Edit, Copy changes). The pane draws in the host Comments panel beside the
251
- chat, not where it is mounted: mount `<CommentPane controller={comments} />`
252
- once anywhere in the view and never wrap it in `SidePane` (a `SidePane` given
253
- a comment pane shows its page alone). While comments are off for the viewer,
254
- or on a Site, a link or a preview, the pane, pins and tool bar render nothing:
255
- never build a fallback comment list. The host owns archive (Status
256
- `Resolved`, shown Done), delete with Undo, editing your own comment, the
257
- Open/Done/All filter, the Goes to line and To chip that name the thread a
258
- comment goes to, `comment=` links and push; the server checks who may change
259
- a comment and writes `Author` itself (the person's name, or the agent's on
260
- an agent's comment, adding the select choice when it is missing), so never
261
- set `Author` from the view or let people pick it. On someone else's comment
262
- people only archive, reopen, delete (with edit rights) or answer it: every
263
- other column is its author's, and agents change only what they wrote. Every
264
- Comments table is followed for waiting comments and push, with or without
265
- `agents`, and a person's comments, replies and answers go to the thread they
266
- name even in a Space that declares no `agents`: an answer, or a reply in a
267
- thread an agent started, goes back to that agent's own thread and subagent,
268
- and editing a comment wakes an agent only when it replied after the comment.
269
- A reply under a deleted comment is refused (`comment_not_found`). Every
270
- comment written through the Notis CLI needs the writing agent's band name
271
- (`NOTIS_AGENT_NAME` or `--agent-name`, such as `fred-and-the-machine`; the
272
- rule and the id the CLI keeps per name are in the notis-cli skill): the
273
- comment is then that agent's, signed "Fred And The Machine", and never wakes
274
- it. Without a name it is refused (`agent_name_required`), even for a person
275
- typing the CLI, and a view never writes comments with a Cloud Computer
276
- credential. The Notis assistant never writes comments itself
277
- (`orchestrator_comments_refused`): it starts a sub-agent for comment work,
278
- which signs with its own band name. On a host without the Comments panel a
279
- comment is signed with the viewer's first name; when the Comments
280
- database's Author is a choice list, give it a `Person` option, which signs
281
- anyone it does not name (without it the comment saves with no author). Pass
282
- `me` only to sign with a fixed name. For comments on a whole record with
283
- nothing to pin on, pass no `anchors` and `columns.anchor: null`: the pane
284
- offers New comment itself.
285
-
286
- Options:
287
- - `order` on the pane: `'newest'` (default), `'oldest'`, `'anchor'` or a
288
- comparator. `groupBy`: a function returning `{ key, label }` per thread,
289
- or false. A controller with no `scope` (the Space home) groups by page,
290
- named by `scopeNames` on `useComments`; a scoped one is flat.
291
- - `modes` on `useComments`: any of `text`, `point`, `box`, `items`, `time`,
292
- `page` (listed in that order). Default: `point` (plus `box` with zone
293
- columns) when there are anchors, `items` when you pass `onStartItems`,
294
- `time` when you pass `currentTime`, and `page`. The pane's New comment
295
- button lists them; `<CommentToolBar controller={comments} />` puts one
296
- button per mode on the page, toggled with C (`toggleKey`, or `pinned` to
297
- keep it shown), and Escape cancels a mode.
298
- - `onStartItems()`: show your own picker (checkboxes, a selection), then call
299
- `comments.startItems(anchors)`. `currentTime()`: the recording's moment in
300
- seconds; name a Time column with `columns: { time: 'Time' }` to store it.
301
- - `focusKey` defaults to the `comment` view param, so a link with
302
- `comment=<root key>` opens that thread; null turns it off. Give the table
303
- an `Edited at` date column so edited comments say edited, and an
304
- `Answer to` text column so an answer to an agent's question reaches only
305
- the agent that asked (the server adds it to an existing table on the first
306
- answer, so there is nothing to do by hand).
307
-
308
- To let people attach pictures and files to a comment or a reply
309
- (paste, drop or the paperclip), give the Comments database a files column
310
- named `Attachments` (or pass `columns.attachments`); there is nothing to add
311
- in the view. Without the column the pane takes text only. Files open from
312
- the rows for an hour, for whoever may read the row; an agent downloads one
313
- from the `url` its query returns, or queries again for a fresh one.
269
+ Every Space page has comments, stored by Notis and listed in the host Comments panel; never create a Comments database. The comment pieces (`useComments`, `CommentPane`, `CommentPins`, `CommentToolBar`) and the agents that answer comments (`on: 'comments'`, `LOCAL_NOTIS_SPACE_COMMENT_THREADS`) are in [Comments](comments.md).
314
270
 
315
271
  ## Records and declared reads
316
272
 
@@ -405,6 +361,16 @@ there is no alias to declare and no destination request, and each call adds a
405
361
  history entry unless you pass `{replace: true}`. `ListReader` with `openParam` and
406
362
  `usePeriod` already write this way.
407
363
 
364
+ To send the viewer to their repository secrets (a Space cannot write secrets
365
+ itself), call `useNotisSettings().openSettings({ page: 'cloud-computer',
366
+ section: 'repository-secrets', repository: 'my-repo', add: 'env_file' })` from a
367
+ click (`add` is `env_file` or `variable`, both optional). Settings opens over the
368
+ Space with that repository's Add form open; the person types or chooses the name
369
+ and the value. Check `available` first: it is false on a Site, a link, a release
370
+ preview and in verify, so show a plain link to
371
+ `/manage?settings=cloud&settings_section=repository-secrets&settings_repository=my-repo&settings_add=env_file`
372
+ or nothing there.
373
+
408
374
  ## Viewer-only exploration
409
375
 
410
376
  `viewerReads: ['databases', 'skills']` permits read-only inspection of what the
@@ -439,6 +405,25 @@ view a Space as the public (`<ViewAsPublic />`, the Share menu); agents check th
439
405
  same with `LOCAL_NOTIS_RENDER_VIEW` and `view_as: "public"` (CLI
440
406
  `notis views render <link> --view-as public`). Actions still run as the Editor.
441
407
 
408
+ ## What ships to the Store
409
+
410
+ Only the root Space's own `defineSpace` declares `store`: its own source key and
411
+ each sub-Space that goes to the Store, each with the aliases of the linked items
412
+ that go with it. Everything unlisted stays private, and the Store refuses to
413
+ publish until the list exists ([Store publishing](store.md#list-what-ships-first)).
414
+
415
+ ```ts
416
+ export default defineSpace({
417
+ name: 'Coding',
418
+ store: { ships: { coding: ['repositories'], workspaces: ['workspaces', 'new-workspace'] } },
419
+ // ...
420
+ });
421
+ ```
422
+
423
+ A listed sub-Space needs its parent listed, and a listed view lists every
424
+ database it reads or writes: `notis spaces build` refuses otherwise, naming the
425
+ view and the database.
426
+
442
427
  ## The viewer's cloud computer
443
428
 
444
429
  `cloudComputer: 'shell'` (or `'read'` for facts only) lets a page run one command
@@ -462,6 +447,73 @@ again. Keep a fallback (a Manager draft) for Sites, previews offline and viewers
462
447
  who do not allow it. Declare it only when the page's core controls run on the
463
448
  cloud computer.
464
449
 
450
+ ## Connected apps
451
+
452
+ `useConnection('github')` answers the signed-in viewer's own account in a connected
453
+ app (`connected`, `account`, `status`) with no declaration, and `connect()` opens
454
+ the Portal's connect flow: call it straight from the button's click (the host
455
+ refuses otherwise); it resolves true once the account works. It answers
456
+ `available: false` on Sites, links and in verification; keep a link to
457
+ Integrations there. The connected app never signs `gh` in on the Cloud Computer:
458
+ to connect GitHub in one visible step, show one card that calls `connect()`, then
459
+ runs GitHub CLI's device code on the Cloud Computer and shows the code and link
460
+ inline. Never ask for a GitHub token in a page.
461
+
462
+ ## Functions
463
+
464
+ `functions` in `defineSpace` gives the Space its own server-side code, for logic one
465
+ declared action cannot express: several actions in a row, a decision between them, a
466
+ command on the caller's cloud computer, or a built-in thread action. Each function
467
+ declares `description`, `kind` (`read` changes nothing, `write` changes the Space's
468
+ data, `action` reaches outside), a closed `input` schema, an optional `output`,
469
+ `expose` (`page`, `api`, `agents`; leave it out for a function only an item action,
470
+ a thread hook or a comment option runs), `access` (`public`, `viewer`, `editor`,
471
+ `key`; `editor` when left out), `uses` and `handler`, the path of a file whose
472
+ default export is `async (input, ctx) => result`.
473
+
474
+ The handler has no network and no secrets. It reaches only `ctx`:
475
+ `ctx.actions.<id>(inputs)` for the actions named in `uses.actions`,
476
+ `ctx.cloudComputer.facts()` and `.run({ command, cwd, timeoutMs })` with
477
+ `uses.cloudComputer`, and `ctx.threads.archive(threadId)` (also `unarchive`, `read`,
478
+ `unread`, `star`, `unstar`, `later(threadId, until)`, `back`) for the operations
479
+ named in `uses.threads`, only on a thread one of the Space's items is attached to.
480
+ `ctx.caller.role` tells who calls. Throw an `Error` to refuse: its message is shown
481
+ to the reader as written, so write it for them. A run lasts at most 60 seconds.
482
+
483
+ Call one from a view with `const { call, loading, error, available } =
484
+ useFunction('name')`, then `await call(input)`; `useFunctionQuery('name', input)`
485
+ for a `read`. Keep a fallback when `available` is false (verify, an older host).
486
+ Agents list and call the functions exposed to `agents` with
487
+ `LOCAL_NOTIS_SPACE_FUNCTIONS`.
488
+
489
+ Three more places run a function:
490
+
491
+ - A thread item action: `actions: { settle: { label, function: 'settle_workspace',
492
+ arguments: { thread: '{item.thread}' } } }` instead of `tool`. The handler also
493
+ gets `ctx.item` (the item and its thread).
494
+ - `threadHooks: { archive: 'on_archive' }`: after the person, an agent or Notis
495
+ archives (or `unarchive`, `read`, `unread`, `star`, `unstar`, `later`, `back`,
496
+ `delete`) a thread that holds one of the Space's items. The function's `input` is
497
+ `threadHookInput` from `@notis/sdk`: `{ event, actor, thread, items }`. A hook runs
498
+ after the action and cannot stop it; make it safe to run twice.
499
+ - `settle: { function: 'settle_workspace' }` on a thread item kind: when a read of
500
+ an item first lands in a `final` state (merged, closed), Notis runs the function
501
+ once per item and Space revision, as the thread's owner, in the background. Its
502
+ `input` is `threadSettleInput` from `@notis/sdk`: `{ item, thread }`; `ctx.item` is
503
+ set too and `ctx.via` is `thread_settle`. The kind needs a `final` state. To settle
504
+ the thread, declare `uses: { threads: ['archive'] }` and call
505
+ `ctx.threads.archive(input.thread.id)`. That archive does not run this Space's own
506
+ `archive` hook, so do the hook's cleanup in the settle too. Keep it under 60 s: start
507
+ long work detached on the cloud computer. A failure is only logged.
508
+ - A hook or a settle that uses the cloud computer runs only when the thread's owner
509
+ allowed the Space's current revision. Without that, nothing fails: the item needs
510
+ the person, with **Allow** in the thread's panel, and the run happens once they
511
+ allow (from the panel or the Space's page). A waiting settle brings the thread back
512
+ to the inbox. Every Store update needs a new approval, so expect this after an update.
513
+ - `commentOptions: { approve: { label: 'Approve', function: 'approve_change' } }`:
514
+ when a person picks that label among a choice comment's options (an agent's own
515
+ answer never runs it). The function's `input` is `commentOptionInput`.
516
+
465
517
  ## Visual data and Markdown
466
518
 
467
519
  Give a chart its numbers through `RenderChartData` (the toolkit's `Chart`,
@@ -491,9 +543,9 @@ extracts tables, lists, controls and visible document/HTML content automatically
491
543
  `DocumentPage` breadcrumb moves into the top bar on wide
492
544
  screens and stays in the page only on narrow ones, so never draw your own
493
545
  title or breadcrumb row. Do not duplicate host chrome.
494
- - `useActiveResource` publishes the current resource; `useAgentContext`,
495
- `NotisSelectionBoundary`, `NotisCommentBoundary` and `NotisCommentBox` support
496
- explicit reference context. [Context sharing](context.md) owns the contract.
546
+ - `useActiveResource` publishes the current resource; `useAgentContext` and
547
+ `NotisSelectionBoundary` support explicit reference context.
548
+ [Context sharing](context.md) owns the contract.
497
549
  - `Dialog` supplies a themed modal with focus handling; while it is open, only
498
550
  its own keys and Escape work. For a confirmation (delete, discard), pass
499
551
  `nativeOnTouch` and mark the buttons `data-dialog-confirm` and
@@ -16,11 +16,34 @@ link. A link or team listing goes live as soon as the user presses Share; a
16
16
  public listing goes to the sandbox reviewer, and Notis messages the user with
17
17
  its result.
18
18
 
19
+ ## List what ships first
20
+
21
+ Only what the root's source lists goes to the Store; everything else stays in
22
+ the user's account, including anything they link later. Before preparing, the
23
+ root's own `defineSpace` declares `store: { ships: { <source key>: [<alias>, ...] } }`
24
+ with its own source key and each sub-Space that ships, each with the aliases
25
+ of the linked items (databases, Skills, automations, pages) that go with it.
26
+ Ask the user which sub-Spaces and items to share when it is not obvious, and
27
+ keep personal ones out. Deploy the root, then prepare. Without the list
28
+ `store_prepare` is refused with `store_ships_undeclared` (an update of a
29
+ listing already in the Store too); `store_ships_unknown` names a key or alias
30
+ the Space does not have, `store_ships_ambiguous` a key two sub-Spaces share
31
+ (a copy built from the same source: give each its own key), and
32
+ `store_ships_parent_private` a listed sub-Space whose parent is not listed,
33
+ and `store_ships_main_view_private` a listed database whose record view sits in
34
+ a Space or link that stays private (list that view and its link too).
35
+ Every Space between the root and a shipped one needs published source: a
36
+ folder made in the Portal has no key to list, so deploy it from source first. A listed view must list every database it reads or
37
+ writes, or the scan raises a red `view_database_private` finding. Spaces inside
38
+ records travel with their record and are never listed.
39
+
19
40
  ## The flow
20
41
 
21
42
  All steps use `LOCAL_NOTIS_MANAGE_SPACE`. Each answer is the submission view:
22
43
  status, listing text, locales, sample rows and counts, screenshots, findings,
23
- `can_publish`, `blocked_reason` and `link`.
44
+ `ships` (`shipped` and `private`: the Spaces and linked items that go to the
45
+ Store and the ones that stay private), `can_publish`, `blocked_reason` and `link`.
46
+ Tell the user both lists before sending the link.
24
47
 
25
48
  1. **Prepare.** Call `store_prepare {space_id, request_id}` with the root of the
26
49
  tree to publish and a stable request ID. Notis copies the tree into the