@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
@@ -11,7 +11,7 @@
11
11
  * a click drops a pin, a press and drag marks a zone (when the table has zone columns). The pane's "Comment on this
12
12
  * item" starts a comment on the whole anchor, with no pin.
13
13
  * - `CommentToolBar`: the comment tool bar on the page, one button per mode, toggled with C (SPC-118).
14
- * - `CommentThreadCard`, `NewCommentBox` and `CommentAvatar` for Spaces that lay the pane out themselves.
14
+ * - `CommentThreadCard`, `NewCommentBox` and `CommentAvatar`: the pane's own pieces, also drawn by the passage pane.
15
15
  *
16
16
  * A card archives (E) and unarchives (Shift+E) with an Undo toast (Z), edits your own comments in place and deletes at
17
17
  * once with Undo, as the viewer's rights allow. At its top, "Thread <title>" names the thread that owns it (or "Goes to"
@@ -56,8 +56,10 @@ export interface CommentThreadCardProps {
56
56
  thread: CommentThread;
57
57
  /** Name the anchor in the card's meta line (when the pane lists every anchor). */
58
58
  showAnchor?: boolean;
59
+ /** Show the quoted words of a text comment under its head. Default true; a passage pane shows them itself. */
60
+ quote?: boolean;
59
61
  }
60
- export declare function CommentThreadCard({ controller, thread, showAnchor }: CommentThreadCardProps): React.JSX.Element;
62
+ export declare function CommentThreadCard({ controller, thread, showAnchor, quote }: CommentThreadCardProps): React.JSX.Element;
61
63
  export interface NewCommentBoxProps {
62
64
  controller: CommentController;
63
65
  }
@@ -94,8 +96,9 @@ export interface CommentToolBarProps {
94
96
  /**
95
97
  * 'overlay' (default): the bar floats over the top left of its positioned parent (the page card), with an inset, and
96
98
  * never moves the content below it. At phone width (480 px or less) it sits just above the card instead, and the
97
- * card moves down by the bar's height to make that room, so it never covers the card or its pins. 'inline': it sits
98
- * in the flow where the Space puts it.
99
+ * card moves down by the bar's height to make that room, so it never covers the card or its pins; there it draws in
100
+ * the layer root (as menus do), so no parent that clips its overflow hides it (SPC-464). 'inline': it sits in the
101
+ * flow where the Space puts it.
99
102
  */
100
103
  place?: 'overlay' | 'inline';
101
104
  className?: string;
@@ -17,6 +17,7 @@ type Level = 'low' | 'medium' | 'high';
17
17
  type Speed = 'flex' | 'normal' | 'priority';
18
18
  /** The harness names the Portal shows (portal/src/lib/codingEngines.ts labels). */
19
19
  export declare const COMMENT_HARNESS_NAMES: Readonly<Record<CommentHarness, string>>;
20
+ export declare function isHarness(value: string | null | undefined): value is CommentHarness;
20
21
  /** Notis runs on OpenAI or Claude; the recorded model says which (the timeline's modelProviderOf). */
21
22
  export declare function commentModelProvider(model: string | null | undefined): ModelProvider | undefined;
22
23
  export interface CommentAgentRuntimeView {
@@ -47,10 +48,17 @@ export declare function CommentAgentRuntimeCard({ name, view }: {
47
48
  name: string;
48
49
  view: CommentAgentRuntimeView;
49
50
  }): React.JSX.Element;
51
+ /**
52
+ * After an agent outside Notis's name on its comment: the thread it said it works in ("PR #3851"), quiet (SPC-537).
53
+ */
54
+ export declare function CommentAgentThreadName({ comment }: {
55
+ comment: CommentRecord;
56
+ }): React.JSX.Element | null;
50
57
  /**
51
58
  * After an agent's name on its comment: the harness logo, with the runtime card on hover and on keyboard focus (Tab
52
- * reaches it; its accessible name says everything the card shows). Nothing on a person's comment or an agent with no
53
- * recorded runtime.
59
+ * reaches it; its accessible name says everything the card shows). An agent outside Notis has no recorded runtime: its
60
+ * harness logo shows when it said which harness runs it (SPC-537), named on hover. Nothing on a person's comment or an
61
+ * agent with neither.
54
62
  */
55
63
  export declare function CommentAgentBadge({ controller, comment }: {
56
64
  controller: CommentController;
@@ -1,77 +1,38 @@
1
1
  /**
2
- * Comment threads on a Space database (pure; no React). The table shape is the Notis Slides Comments table:
2
+ * Comment threads of a Space (pure; no React). Comments live in the Space's one comment store, read and written
3
+ * through the host (`runtime.spaceComments`, contract: `SpaceCommentRow`). `commentFromRow` reads a store row as the
4
+ * `CommentRecord` the pane renders:
3
5
  *
4
- * | Column | Type | Meaning |
5
- * | ----------- | -------------------- | --------------------------------------------------------------------- |
6
- * | Body | title | The comment text. |
7
- * | Deck | relation | The scope the comment belongs to (a deck, a page, a review). |
8
- * | Slide | relation | The anchor record it is on (a slide, a section). Empty: on the scope. |
9
- * | Thread | text | Empty on a thread's first comment; the root's record key on a reply. |
10
- * | Author | select | Who wrote it (Flo, Claude, Notis, or any name). |
11
- * | X, Y | number | The pin, 0 to 1 across and down the anchor. Empty: on the whole anchor. |
12
- * | W, H | number | A zone from the pin, 0 to 1 of the anchor's width and height. Empty: a point. |
13
- * | Status | select | Open, Resolved or Deleted (a delete keeps the row for the digest). |
14
- * | Needs | select | none, check, choice or input: what the author asks of the reader. |
15
- * | Options | text | The choices of a choice ask, separated by `|` or new lines. |
16
- * | Answer | text | The reader's answer to the ask. |
17
- * | Answered at | date | When the answer was given. |
18
- * | Change | select | The last change made here: created, replied, answered, resolved, reopened, deleted. |
19
- * | Changed at | date | When that change was made; the digest lists changes after the checkpoint. |
20
- * | Example | checkbox | A sample comment shown with an Example badge. |
21
- * | Attachments | files | Pictures and files the author shows with the comment (optional). |
22
- * | Edited at | date | When the author last edited the text (optional): the card says edited. |
23
- * | Answer to | text | On a reply that answers an ask: the ask's record key (optional). |
24
- * | Time | number | Seconds into a recording, for comments in time mode (opt-in, `time`). |
6
+ * | Store field | CommentRecord | Meaning |
7
+ * | ----------------- | ------------------ | ------------------------------------------------------------------- |
8
+ * | id | id, recordKey | The comment. |
9
+ * | page_key | scopeIds | The page (record) it belongs to; empty on the Space home. |
10
+ * | anchor_keys | anchorIds | The records it is on (a slide, a section; several for items). |
11
+ * | thread_root_id | thread | Empty on a thread's first comment; the root's id on a reply. |
12
+ * | status | status | open, archived, deleted read as Open, Resolved (shown Done), Deleted. |
13
+ * | x, y, w, h | x, y, w, h | A pin (x, y) or a zone (w, h too), 0 to 1 of the anchor. |
14
+ * | time_start | time | Seconds into a recording (time mode). |
15
+ * | field, quote, ... | passage | The words a text comment sits on. |
25
16
  *
26
- * Every column name can be renamed with `CommentColumns`; the defaults are the Slides names, so a Space that copies
27
- * the Slides table needs no mapping and no migration. Zones are opt-in: a table that adds W and H number columns
28
- * passes `{ w: 'W', h: 'H' }`. Without them (`w` and `h` null, the default) a drag on the anchor places a pin where it
29
- * started, and nothing writes a column the table does not have. Attachments are shown when the table has the files
30
- * column; the pane also lets people attach pictures and files to a new comment or a reply when the host can upload
31
- * them (`runtime.spaceFiles`). A table without the column shows none and takes text only. Edited at is written only
32
- * when the table has it (the edit itself always saves); Time is opt-in like zones (`{ time: 'Time' }`), and without it
33
- * a time-mode comment starts its text with the moment ("0:24 ..."). Answer to is written only when the table has it:
34
- * the reply that shows the answer to an agent's input ask names that ask, so the server sends it to the asking agent
35
- * only and counts it as the answer, not a new reply; without the column the reply is an ordinary reply.
36
- *
37
- * Status `Resolved` is shown as Done (archived, SPC-124); `Deleted` keeps the row: a deleted first comment hides its
38
- * whole thread, a deleted later one reads "Comment deleted" in place (SPC-127).
17
+ * `Resolved` is shown as Done (archived, SPC-124); `Deleted` keeps the row: a deleted first comment hides its whole
18
+ * thread, a deleted later one reads "Comment deleted" in place (SPC-127).
39
19
  */
40
- export type CommentRow = Record<string, unknown>;
20
+ import type { SpaceCommentRow, SpaceCommentStatus } from '../../space';
41
21
  export type CommentNeeds = 'none' | 'check' | 'choice' | 'input';
42
22
  export type CommentStatus = 'Open' | 'Resolved' | 'Deleted';
43
23
  export type CommentChange = 'created' | 'replied' | 'answered' | 'resolved' | 'reopened' | 'deleted';
44
- /** Column names of the Comments table. `scope` or `anchor` set to null: the table has no such column. */
45
- export interface CommentColumns {
46
- body: string;
47
- scope: string | null;
48
- anchor: string | null;
49
- thread: string;
50
- author: string;
51
- x: string;
52
- y: string;
53
- /** The zone's width and height. Null: the table has no zone columns, and comments are points only. */
54
- w: string | null;
55
- h: string | null;
56
- status: string;
57
- needs: string;
58
- options: string;
59
- answer: string;
60
- answeredAt: string;
61
- change: string;
62
- changedAt: string;
63
- example: string;
64
- /** The files column read for pictures and files shown with a comment. Null: the table has none. */
65
- attachments: string | null;
66
- /** When the author last edited the text. Written only when the table has it. */
67
- editedAt: string | null;
68
- /** Seconds into a recording (time mode). Null: the table has none, and the moment starts the text. */
69
- time: string | null;
70
- /** On a reply that answers an ask, the ask's record key. Written only when the table has it. */
71
- answerTo: string | null;
24
+ /**
25
+ * What a new comment points at (SPC-118): words of the text, a point or a box on an anchor, some items (records or
26
+ * rows), a moment of a recording, or the whole page (no anchor).
27
+ */
28
+ export type CommentMode = 'text' | 'point' | 'box' | 'items' | 'time' | 'page';
29
+ /** The words a text comment sits on; `field` names the field of the page they are in, when one does. */
30
+ export interface CommentPassage {
31
+ quote: string;
32
+ prefix: string;
33
+ suffix: string;
34
+ field?: string | null;
72
35
  }
73
- export declare const COMMENT_COLUMNS: Readonly<CommentColumns>;
74
- export declare function commentColumns(columns?: Partial<CommentColumns>): CommentColumns;
75
36
  export interface CommentRecord {
76
37
  id: string;
77
38
  recordKey: string;
@@ -113,6 +74,12 @@ export interface CommentRecord {
113
74
  */
114
75
  createdByYou?: boolean | null;
115
76
  createdBy?: string | null;
77
+ /** What the comment points at (its mode in the store). */
78
+ mode?: CommentMode;
79
+ /** The words a text comment sits on; null for other modes. */
80
+ passage?: CommentPassage | null;
81
+ /** The view slug it was written on. */
82
+ view?: string | null;
116
83
  }
117
84
  /**
118
85
  * What an agent ran on, as the server recorded it (`agent.runtime`): the harness (`provider`: notis, codex,
@@ -136,6 +103,12 @@ export interface CommentAgent {
136
103
  threadId: string | null;
137
104
  rowId: string | null;
138
105
  runtime?: CommentAgentRuntime | null;
106
+ /** An agent outside Notis (declared on a Notis CLI call): the thread it said it works in ("PR #3851"). */
107
+ threadName?: string | null;
108
+ /** An agent outside Notis: the harness that runs it (claude_code, codex, cursor_agent...), for its logo. */
109
+ harness?: string | null;
110
+ /** True for an agent outside Notis (SPC-535): a thread it holds wakes nobody in Notis. */
111
+ outside?: boolean;
139
112
  }
140
113
  /**
141
114
  * How an author or agent name shows: a band name (lowercase words and digits joined by hyphens, the name agents
@@ -171,11 +144,9 @@ export interface CommentThread {
171
144
  replies: CommentRecord[];
172
145
  anchor: CommentAnchor | undefined;
173
146
  }
174
- /** The text of one column of a comment row (text, select, number or date), '' when empty or missing. */
175
- export declare function commentText(row: CommentRow, name: string | null): string;
176
147
  /** An http(s) link without credentials, or a site path: anything else (script URLs, `//host`) opens nothing. */
177
148
  export declare function safeCommentUrl(value: string): string | null;
178
- /** A files value (`{ name, url }` items, the other shapes above, or URLs) as the pictures and files a comment shows. */
149
+ /** A files value (`{ name, url }` items, `{ name, file: { url } }`, `{ name, external: { url } }` or URLs) as the pictures and files a comment shows. */
179
150
  export declare function commentAttachmentList(value: unknown): CommentAttachment[];
180
151
  /** The picture a choice option names (same label, any case), when there is one. */
181
152
  export declare function commentAttachmentFor(option: string, attachments: readonly CommentAttachment[]): CommentAttachment | undefined;
@@ -187,29 +158,28 @@ export type CommentBodyPart = {
187
158
  label: string;
188
159
  };
189
160
  export declare function commentBodyParts(body: string): CommentBodyPart[];
161
+ /** The store's status as the pane names it: open, archived, deleted read as Open, Resolved (shown Done), Deleted. */
162
+ export declare function commentStatusOf(status: SpaceCommentStatus | string | null | undefined): CommentStatus;
163
+ /** The pane's status as the store names it. */
164
+ export declare function storeStatusOf(status: CommentStatus): SpaceCommentStatus;
190
165
  /**
191
- * Whether the rows show the files column: true or false from the first row that carries properties, null when no row
192
- * does (an empty table). A list row carries every property of its database by name, filled or empty.
193
- */
194
- export declare function commentRowsHaveColumn(rows: readonly CommentRow[], name: string | null): boolean | null;
195
- /**
196
- * One Comments row as a comment. A row an agent wrote always reads as that agent (its Author, else the stamped agent
197
- * name), whatever `authors` holds. A row the server says a person created (`created_by_you` or `created_by`) reads as
198
- * its Author, the name the server set for that person, so a Space member reads as themselves. Any other row outside
199
- * `authors` (when given), or with no Author, reads as `fallbackAuthor`.
166
+ * One store row (`SpaceCommentRow`) as the comment the pane renders. An agent's comment reads as the agent (its stamped
167
+ * name); a person's as the name the server set for them. A store `change` of `edited` reads as the comment's own
168
+ * change (created or replied) with `editedAt`, so Copy changes reports it as an edit.
200
169
  */
201
- export declare function readCommentRow(row: CommentRow, options?: {
202
- columns?: Partial<CommentColumns>;
203
- authors?: readonly string[];
204
- fallbackAuthor?: string;
205
- }): CommentRecord;
206
- /** The rows of a list answer (`{ rows }`), skipping anything that is not an object. */
207
- export declare function commentRowsOf(value: unknown): CommentRow[];
170
+ export declare function commentFromRow(input: SpaceCommentRow | Readonly<Record<string, unknown>>): CommentRecord;
208
171
  /** Time in ms; a date without an offset is read as UTC so ordering stays stable. */
209
172
  export declare function commentTimeOf(value: string | null | undefined): number;
210
173
  /** True when the comment belongs to `scope` (by id or record key). No scope: every comment belongs. */
211
174
  export declare function inCommentScope(comment: CommentRecord, scope: Pick<CommentScope, 'id' | 'recordKey'> | null | undefined): boolean;
212
175
  export declare function commentAnchorOf(comment: CommentRecord, anchors: readonly CommentAnchor[]): CommentAnchor | undefined;
176
+ /** Every anchor the comment is on, in anchor order (an items comment is on several). */
177
+ export declare function commentAnchorsOf(comment: CommentRecord, anchors: readonly CommentAnchor[]): CommentAnchor[];
178
+ /**
179
+ * True when a comment on `anchorIds` shows under the anchor `key`: an items comment shows under each of its items
180
+ * (SPC-463). A null key is the comments on no anchor.
181
+ */
182
+ export declare function isCommentOnAnchor(anchorIds: readonly string[], key: string | null | undefined, anchors: readonly CommentAnchor[]): boolean;
213
183
  /**
214
184
  * Threads in anchor order, then by creation. Deleted replies stay in place (the card reads "Comment deleted" there so
215
185
  * the replies around it still read); deleted roots stay too (filter them to hide the whole thread).
@@ -258,11 +228,8 @@ export interface CommentDigestOptions {
258
228
  scopeNoun?: string;
259
229
  /** What an anchor is called ("Slide"): "Slide 3" and "Unknown slide". */
260
230
  anchorNoun?: string;
261
- /** The table agents insert replies into. Default "Comments". */
262
- table?: string;
263
231
  /** The reader whose answers and status changes the digest reports. Default "Flo". */
264
232
  me?: string;
265
- columns?: Partial<CommentColumns>;
266
233
  }
267
234
  /** True when the comment marks a zone (a pin with a width and a height), not a point. */
268
235
  export declare function isCommentZone(comment: Pick<CommentRecord, 'x' | 'y' | 'w' | 'h'> | null | undefined): boolean;
@@ -37,6 +37,7 @@ export declare const COMMENT_WORDS: Readonly<{
37
37
  unarchiveThread: Words;
38
38
  deleteThreadNamed: Words;
39
39
  copyLinkNamed: Words;
40
+ copyReplyLinkNamed: Words;
40
41
  deleteReplyOf: Words;
41
42
  deleteYourReply: Words;
42
43
  editRootNamed: Words;
@@ -128,12 +129,18 @@ export declare const COMMENT_WORDS: Readonly<{
128
129
  ownerThread: Words;
129
130
  goesToNew: Words;
130
131
  goesToNewHarness: Words;
132
+ outsideNotis: Words;
133
+ outsideAgentTitle: Words;
134
+ replyToWho: Words;
135
+ outsideUnread: Words;
136
+ agentHarness: Words;
131
137
  goesToLoading: Words;
132
138
  change: Words;
133
139
  changeThread: Words;
134
140
  openLinkedThread: Words;
135
141
  toThread: Words;
136
142
  toNew: Words;
143
+ toPick: Words;
137
144
  toNewHarness: Words;
138
145
  pickThread: Words;
139
146
  linking: Words;
@@ -158,7 +165,9 @@ export declare const COMMENT_WORDS: Readonly<{
158
165
  newCommentItems: Words;
159
166
  newCommentItem: Words;
160
167
  newCommentTime: Words;
168
+ newCommentText: Words;
161
169
  itemsLabel: Words;
170
+ moreItems: Words;
162
171
  }>;
163
172
  export type CommentWordKey = keyof typeof COMMENT_WORDS;
164
173
  export type CommentWords = Readonly<Record<CommentWordKey, Words>>;
@@ -2,15 +2,15 @@
2
2
  * The bridge from a Space's comment controllers to the host Comments panel (SPC-113 to SPC-131). The pane no longer
3
3
  * sits inside a Space: `CommentPane` and `PassageCommentPane` attach their controller here and draw their threads into
4
4
  * the element the host hands them, in its right panel beside the chat (a React portal: the controller, its uploads,
5
- * toasts and keys stay with the Space). A `SidePane` given one of them shows its page alone.
5
+ * toasts and keys stay with the Space).
6
6
  *
7
7
  * While the host has no Comments panel for the viewer (comments off, a Site, a link, a preview) the Space shows no
8
8
  * comments at all: `useHostComments()` is false and the pins and highlights stay hidden.
9
9
  */
10
- import type { SpaceCommentSource } from '../../space';
10
+ import type { SpaceCommentAnchor, SpaceCommentSource } from '../../space';
11
11
  /** True when the host shows comments for this viewer: pins, highlights and the Comment button may show. */
12
12
  export declare function useHostComments(): boolean;
13
- /** The view param a link to one comment carries (a push, a chat pill): `comment=<root record key>`. */
13
+ /** The view param a link to one comment carries (a push, a chat pill): `comment=<root comment id>`. */
14
14
  export declare const COMMENT_FOCUS_PARAM = "comment";
15
15
  /**
16
16
  * The comment a link asks to show: the `comment` view param the host puts on the Space page URL (a push opens
@@ -24,14 +24,18 @@ export declare function useCommentFocusParam(): string | null;
24
24
  * element to draw its threads in (null while the panel does not show them). `options` carries what the pane was given
25
25
  * (a title, the groups of a passage pane). `watch` lists what the host reads (the threads, the new comment, the
26
26
  * selected thread): the host hears of a render only when one of them changed, never on each pointer move of a drag.
27
- * `current().revealRequest` is the controller's (C8): the host hears of each increase.
27
+ * `current().revealRequest` is the controller's (C8): the host hears of each increase. A text selection's Comment
28
+ * (`startComment`) reaches the controller through the source's `start`: its `startAnchor`, unless `start` is given.
28
29
  *
29
30
  * The source object stays the same for the life of the component. A new transport object from the host (its viewer
30
31
  * resolving) lists that same source again without taking the panel element away, so the pane, a reply being typed and
31
32
  * the list's scroll stay as they are.
32
33
  */
33
- export declare function useHostCommentSource(kind: SpaceCommentSource['kind'], controller: unknown, options?: Readonly<Record<string, unknown>>, watch?: readonly unknown[]): HTMLElement | null;
34
- /** Marks a pane that draws in the host Comments panel: a `SidePane` given one shows its page alone. */
35
- export declare function markRetiredPane<T extends object>(component: T): T;
36
- /** Whether `node` is a pane element drawn in the host panel (`<CommentPane />`, `<PassageCommentPane />`). */
37
- export declare function isRetiredPane(node: unknown): boolean;
34
+ export declare function useHostCommentSource(kind: SpaceCommentSource['kind'], controller: unknown, options?: Readonly<Record<string, unknown>>, watch?: readonly unknown[], start?: (anchor: SpaceCommentAnchor) => boolean): HTMLElement | null;
35
+ /** Marks a pane component that draws in the host Comments panel and renders nothing in the page. */
36
+ export declare function markHostPane<T extends object>(component: T): T;
37
+ /**
38
+ * Whether `node` is a `<CommentPane />` or `<PassageCommentPane />` element. Spaces built before the single comment
39
+ * store pass one as a `SidePane` pane; it renders nothing there, so `SidePane` shows the page alone.
40
+ */
41
+ export declare function isHostPane(node: unknown): boolean;
@@ -1,7 +1,7 @@
1
1
  export * from './commentModel';
2
2
  export * from './commentWords';
3
3
  export * from './useComments';
4
- export * from './CommentPane';
4
+ export { CommentAgentSource, CommentPane, CommentPins, CommentToolBar, commentExcerpt, sendsOnEnter, type CommentPaneProps, type CommentPinsProps, type CommentToolBarProps, } from './CommentPane';
5
5
  export { COMMENT_HARNESS_NAMES, CommentAgentBadge, commentAgentRuntimeView, type CommentAgentRuntimeView, type CommentHarness, } from './agentRuntime';
6
6
  export * from './commentFiles';
7
7
  export * from './passageModel';
@@ -4,10 +4,11 @@
4
4
  * To chip of a new comment, the Goes to line under a reply, the ordered and grouped list, and E / Shift+E.
5
5
  */
6
6
  import React, { type ReactNode, type RefObject } from 'react';
7
- import { type CommentGroup, type CommentOrder, type CommentThread } from './commentModel';
7
+ import { type CommentAnchor, type CommentGroup, type CommentOrder, type CommentThread } from './commentModel';
8
8
  import type { SpaceCommentThreadRef } from '../../space';
9
9
  import type { CommentWordKey } from './commentWords';
10
- import type { CommentController, CommentMode, CommentStatusView } from './useComments';
10
+ import type { CommentMode } from './commentModel';
11
+ import type { CommentController, CommentStatusView } from './useComments';
11
12
  export declare const COMMENT_MODE_ICON: Readonly<Record<CommentMode, string>>;
12
13
  export declare const COMMENT_MODE_WORD: Readonly<Record<CommentMode, CommentWordKey>>;
13
14
  /** Open (default), Done and All, each with its count, behind one menu (SPC-126). */
@@ -44,8 +45,8 @@ export declare function commentThreadName(controller: CommentController, thread:
44
45
  pending: boolean;
45
46
  };
46
47
  /**
47
- * The "To <thread>" chip of a new comment (SPC-117): the thread picked, else the best match, else "To a new thread".
48
- * A click opens the @ thread picker, at any time. Nothing on a host without best matches or the picker. A long name
48
+ * The "To <thread>" chip of a new comment (SPC-117): the thread picked, else the best match, else "To a new thread";
49
+ * "Choose a thread" when the best match could not be read. A click opens the @ thread picker, at any time. Nothing on a host without best matches or the picker. A long name
49
50
  * ends with an ellipsis (never cut mid-word without one); its title attribute has it in full.
50
51
  */
51
52
  export declare function CommentToChip({ controller }: {
@@ -57,6 +58,11 @@ export declare function CommentToChip({ controller }: {
57
58
  * mentions someone. `setValue` writes the box's text.
58
59
  */
59
60
  export declare function useAtThreadPicker(controller: CommentController): (value: string, field: HTMLElement, setValue?: (value: string) => void) => string;
61
+ /**
62
+ * Whether a card shows its Thread line (CommentGoesTo renders one): the line that carries the thread's buttons under
63
+ * unified comments. Mirrors CommentGoesTo's own conditions, so the buttons fall back to the name line when it shows none.
64
+ */
65
+ export declare function commentGoesToShows(controller: CommentController, thread: CommentThread): boolean;
60
66
  /**
61
67
  * At the top of a comment thread's card, the thread that owns it: "Thread <title>" (its first linked thread), else
62
68
  * "Goes to <best match>" or "Goes to a new thread", with Change, which opens the @ thread picker and links the pick
@@ -67,7 +73,23 @@ export declare function CommentGoesTo({ controller, thread }: {
67
73
  controller: CommentController;
68
74
  thread: CommentThread;
69
75
  }): React.JSX.Element | null;
70
- /** A thread's place, for the card meta line: a moment ("0:24") and how many items it is on. */
76
+ /** The name of the agent outside Notis a `claimed` ref names, as its comments sign it. */
77
+ export declare function commentOutsideName(ref: SpaceCommentThreadRef): string;
78
+ /** The agent outside Notis that holds this comment thread (SPC-535), when the Goes to line names one; else null. */
79
+ export declare function commentOutsideClaim(controller: CommentController, thread: CommentThread): SpaceCommentThreadRef | null;
80
+ /**
81
+ * SPC-536: whether the agent outside Notis that holds this thread has not read the person's latest word yet: someone
82
+ * replied or answered after the agent last wrote, and the agent has not read the thread since (`readAt`, recorded
83
+ * when it reads comments through the CLI or replies).
84
+ */
85
+ export declare function commentOutsideUnread(thread: CommentThread, claim: SpaceCommentThreadRef): boolean;
86
+ /**
87
+ * The items a comment is on, named (SPC-463): each item's title, else its anchor label ("Task 2"), the first three
88
+ * then "+N" for the rest. `total` counts items the Space no longer lists too; with none of them listed it reads
89
+ * "3 items".
90
+ */
91
+ export declare function commentItemNames(controller: Pick<CommentController, 'say'>, items: readonly CommentAnchor[], total?: number): string;
92
+ /** A thread's place, for the card meta line: a moment ("0:24") and the items it is on, named. */
71
93
  export declare function commentPlaceMeta(controller: CommentController, thread: CommentThread): string[];
72
94
  export interface CommentListOptions {
73
95
  /**
@@ -1,23 +1,11 @@
1
1
  /**
2
- * Comments on a passage of a record's text (pure; no React). A thread can sit on words of a property (a subject, a
3
- * Markdown body) instead of a pin: the comment row keeps which field it is on, the quoted words and a few words
4
- * before and after them. The quote is found again in the text as it is now, white space ignored, the surrounding
5
- * words telling apart several matches; when the quoted words are gone the thread reads Text changed.
6
- *
7
- * The Comments table needs these columns besides the `CommentColumns` ones:
8
- *
9
- * | Column | Type | Meaning |
10
- * | ------ | ---- | ----------------------------------------------------------------------- |
11
- * | Field | text or select | Which field the passage is in (the field's key by default). |
12
- * | Quote | text | The selected words (white space collapsed, at most 1000 characters). |
13
- * | Prefix | text | Up to 40 characters before the quote, to tell apart repeated words. |
14
- * | Suffix | text | Up to 40 characters after it. |
15
- *
16
- * Every name can be changed with `PassageColumns`. A field can also be named by several columns (`values`), for
17
- * example a Field and a Language column for the same property in two languages.
2
+ * Comments on a passage of a page's text (pure; no React). A thread can sit on words (a subject, a Markdown body, any
3
+ * text of the page) instead of a pin: the comment keeps the quoted words, a few words before and after them, and the
4
+ * field they are in when the Space names one (`field`). The quote is found again in the text as it is now, white
5
+ * space ignored, the surrounding words telling apart several matches; when the quoted words are gone the thread reads
6
+ * Passage changed (it stays open with its old quote).
18
7
  */
19
8
  import type { Words } from '../../words';
20
- import { type CommentRow } from './commentModel';
21
9
  /** The words a thread sits on, with the words around them. */
22
10
  export interface TextPassage {
23
11
  quote: string;
@@ -34,30 +22,22 @@ export interface PassageField {
34
22
  key: string;
35
23
  /** Its name in the pane, above each quote. */
36
24
  label: Words;
37
- /**
38
- * The values that name this field on a comment row: written with each new comment, and a row whose columns hold
39
- * all of them is on this field. Default `{ [columns.field]: key }`.
40
- */
41
- values?: Readonly<Record<string, string>>;
42
25
  /** Fields shown together, such as one language. The pane lists the threads of the group on screen. */
43
26
  group?: string;
44
27
  /** The value is Markdown: Text changed and the reading order look at its words, not its syntax. */
45
28
  markdown?: boolean;
46
29
  }
47
- export interface PassageColumns {
48
- field: string;
49
- quote: string;
50
- prefix: string;
51
- suffix: string;
52
- }
53
- export declare const PASSAGE_COLUMNS: Readonly<PassageColumns>;
54
- export declare function passageColumns(columns?: Partial<PassageColumns>): PassageColumns;
30
+ /**
31
+ * The Space page's selection bar hands a selection in a Space's own commentable rich text to that text with this DOM
32
+ * event (detail: `{ range }`), so one bar shows Cite and Comment together and the text draws no button of its own.
33
+ */
34
+ export declare const PASSAGE_COMMENT_EVENT = "notis-passage-comment";
35
+ /** On the Space page root while its selection bar takes comments: own rich text then leaves Comment to the bar. */
36
+ export declare const SELECTION_BAR_COMMENTS_ATTR = "data-notis-bar-comments";
55
37
  /** Characters kept before and after a quote. */
56
38
  export declare const PASSAGE_CONTEXT = 40;
57
39
  /** The longest quote kept. */
58
40
  export declare const PASSAGE_MAX_QUOTE = 1000;
59
- /** The column values naming a field on a comment row. */
60
- export declare function passageFieldValues(field: PassageField, columns?: PassageColumns): Readonly<Record<string, string>>;
61
41
  /**
62
42
  * Finds a passage in `text`, white space ignored (line breaks and block gaps move with edits). With several matches,
63
43
  * the one whose surrounding words best match the stored prefix and suffix. Offsets in `text`, or null when the quoted
@@ -76,7 +56,3 @@ export declare function markdownReadableText(source: string): string;
76
56
  * looked for in what a reader sees (the offset is then proportional), then in the source itself.
77
57
  */
78
58
  export declare function passageOffset(value: string, passage: TextPassage, markdown?: boolean): number | null;
79
- /** The passage a comment row sits on, with its field, or null when it has none or its field is not declared. */
80
- export declare function readPassage(row: CommentRow, fields: readonly PassageField[], columns?: PassageColumns): PassageAnchor | null;
81
- /** The properties a new comment on `passage` writes besides its body, author and status. */
82
- export declare function passageProperties(passage: PassageAnchor, field: PassageField, columns?: PassageColumns): Record<string, unknown>;
@@ -12,7 +12,11 @@
12
12
  * when the link fails.
13
13
  *
14
14
  * Until a root's links came back (and, with none, the page's best match), its Goes to line names nothing: `known` is
15
- * false, never a guess that turns into another thread a moment later. The last links of each root and the best match
15
+ * false, never a guess that turns into another thread a moment later. When those reads fail and nothing is kept,
16
+ * `lost` is true and the line shows nothing, never "a new thread"; a failed best match keeps the last one known.
17
+ *
18
+ * The server may name an agent's thread ahead of the links (`via`, SPC-458, SPC-459): it is where a reply goes, so
19
+ * `goesTo` names it, but it is no link (`linksOf` leaves it out). The last links of each root and the best match
16
20
  * of each page are kept for the session, per viewer and Space, so a page shown again names its threads at once while
17
21
  * they are read again.
18
22
  */
@@ -20,12 +24,22 @@ import type { SpaceCommentThreadPick, SpaceCommentThreadRef } from '../../space'
20
24
  export interface CommentRouting {
21
25
  /** True when the host links comment threads to threads: each card shows its Goes to line. */
22
26
  links: boolean;
23
- /** The threads a comment thread is linked to; the first is where a reply goes. */
27
+ /** The threads a comment thread is linked to; the first is where a reply goes unless an agent's thread takes it. */
24
28
  linksOf(rootKey: string): readonly SpaceCommentThreadRef[];
25
- /** Where a reply on this thread goes: its first link, else the best match (no link yet), else null (a new thread). */
29
+ /**
30
+ * Where a reply on this thread goes: the agent's thread the server names ahead of the links (`via`), else its first
31
+ * link, else the best match (no link yet), else null (a new thread).
32
+ */
26
33
  goesTo(rootKey: string): SpaceCommentThreadRef | null;
27
34
  /** The best-match thread for a new comment on this page (THR-024); null: none, or the host has no best match. */
28
35
  bestMatch: SpaceCommentThreadRef | null;
36
+ /** True when this page's best match could not be read and none is kept: the To chip names no thread. */
37
+ bestMatchLost?: boolean;
38
+ /**
39
+ * True when where this thread goes could not be read (its links, or with none the best match) and nothing is kept:
40
+ * the Goes to line shows nothing rather than a destination it does not know (never "a new thread").
41
+ */
42
+ lost?(rootKey: string): boolean;
29
43
  /** True when the host answers best matches: the new comment box shows its To chip. */
30
44
  hasBestMatch: boolean;
31
45
  /** The thread the next new comment goes to, when picked with the chip or @; null: the best match. */
@@ -57,8 +71,16 @@ export interface CommentRouting {
57
71
  export declare const LINK_BATCH = 200;
58
72
  /** Forgets every kept answer (tests). */
59
73
  export declare function clearCommentRoutingCache(): void;
74
+ /**
75
+ * A comment thread an agent outside Notis holds (the server's `claimed` ref, SPC-535): a reply stays with that agent
76
+ * and wakes nobody in Notis until the viewer hands it to a thread with Change.
77
+ */
78
+ export declare function outsideClaim(ref: SpaceCommentThreadRef | null | undefined): boolean;
79
+ /** A reply that wakes an agent another person runs (the server's `elsewhere` ref): no thread of the viewer's is named. */
80
+ export declare function elsewhere(ref: SpaceCommentThreadRef | null | undefined): boolean;
60
81
  export declare function useCommentRouting(input: {
61
- database: string;
82
+ /** @deprecated Comments live in one store: only splits the session cache. */
83
+ database?: string;
62
84
  /** Root record keys of the threads on screen (drafts left out): their links are read in one batch. */
63
85
  rootKeys: readonly string[];
64
86
  /** The record the page shows, for the best match. */