@notis_ai/cli 0.2.29 → 0.2.31

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 (113) hide show
  1. package/README.md +26 -8
  2. package/dist/agent-hooks/notis-agent-hook.mjs +38399 -10883
  3. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  4. package/dist/base-skills/notis-cli/SKILL.md +11 -0
  5. package/dist/base-skills/notis-cli/references/native-databases.md +1 -1
  6. package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
  7. package/dist/base-skills/notis-query/references/query.md +6 -4
  8. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  9. package/dist/base-skills/notis-spaces/SKILL.md +8 -3
  10. package/dist/base-skills/notis-spaces/references/architecture.md +4 -1
  11. package/dist/base-skills/notis-spaces/references/design.md +7 -1
  12. package/dist/base-skills/notis-spaces/references/fixtures.md +27 -2
  13. package/dist/base-skills/notis-spaces/references/release.md +6 -5
  14. package/dist/base-skills/notis-spaces/references/sdk.md +172 -48
  15. package/dist/base-skills/notis-spaces/references/troubleshooting.md +3 -0
  16. package/dist/base-skills/notis-spaces/references/views.md +20 -0
  17. package/dist/sdk/src/hooks/useNativeDocuments.ts +50 -12
  18. package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
  19. package/dist/sdk/src/index.ts +7 -2
  20. package/dist/sdk/src/runtime.ts +8 -1
  21. package/dist/sdk/src/space.ts +233 -1
  22. package/dist/sdk/src/tailwind.ts +53 -3
  23. package/dist/sdk/src/ui/icons.tsx +1 -0
  24. package/dist/sdk/src/words/types.ts +28 -0
  25. package/dist/skill-sync/index.js +10 -90
  26. package/dist/skill-sync-worker.mjs +232 -120
  27. package/dist/space-harness/host.js +309 -96
  28. package/dist/space-sdk/dist/chunk-3DFOGU26.js +3 -0
  29. package/dist/space-sdk/dist/index.js +4 -2
  30. package/dist/space-sdk/dist/ui.js +19 -14
  31. package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +23 -0
  32. package/dist/space-sdk/src/hooks/useThreadItem.d.ts +28 -0
  33. package/dist/space-sdk/src/index.d.ts +4 -2
  34. package/dist/space-sdk/src/runtime.d.ts +8 -1
  35. package/dist/space-sdk/src/space.ts +233 -1
  36. package/dist/space-sdk/src/tailwind-candidates.d.ts +765 -16
  37. package/dist/space-sdk/src/tailwind.ts +53 -3
  38. package/dist/space-sdk/src/ui/actions/useToast.d.ts +2 -0
  39. package/dist/space-sdk/src/ui/blocks/DataTable.d.ts +19 -4
  40. package/dist/space-sdk/src/ui/blocks/Meter.d.ts +12 -3
  41. package/dist/space-sdk/src/ui/blocks/Tabs.d.ts +7 -1
  42. package/dist/space-sdk/src/ui/blocks/index.d.ts +1 -1
  43. package/dist/space-sdk/src/ui/charts/CalendarHeatmap.d.ts +69 -0
  44. package/dist/space-sdk/src/ui/charts/Chart.d.ts +18 -3
  45. package/dist/space-sdk/src/ui/charts/chartData.d.ts +19 -0
  46. package/dist/space-sdk/src/ui/charts/heatmapData.d.ts +81 -0
  47. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +56 -10
  48. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +16 -7
  49. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +59 -0
  50. package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +5 -2
  51. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +103 -8
  52. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +82 -0
  53. package/dist/space-sdk/src/ui/comments/hostComments.d.ts +37 -0
  54. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  55. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +119 -0
  56. package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +75 -0
  57. package/dist/space-sdk/src/ui/comments/useComments.d.ts +147 -15
  58. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +24 -8
  59. package/dist/space-sdk/src/ui/index.d.ts +6 -3
  60. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +6 -1
  61. package/dist/space-sdk/src/ui/list/Row.d.ts +11 -1
  62. package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +8 -2
  63. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +2 -0
  64. package/dist/space-sdk/src/ui/period/dateWords.d.ts +9 -0
  65. package/dist/space-sdk/src/ui/period/periods.d.ts +15 -2
  66. package/dist/space-sdk/src/ui/styles.d.ts +27 -5
  67. package/dist/space-sdk/src/words/types.ts +28 -0
  68. package/dist/view-renderer/dist/host.js +379 -166
  69. package/dist/view-renderer/src/dom.js +3 -2
  70. package/dist/view-renderer/src/errors.js +9 -0
  71. package/dist/view-renderer/src/host.tsx +18 -8
  72. package/dist/view-renderer/src/remote-broker.js +3 -1
  73. package/dist/view-renderer/src/renderer.js +87 -17
  74. package/dist/view-renderer/src/skeleton.js +70 -18
  75. package/package.json +5 -4
  76. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -1
  77. package/skills/notis-query/cli.md +3 -0
  78. package/skills/notis-spaces/cli.md +8 -8
  79. package/src/cli.js +10 -2
  80. package/src/command-specs/computer.js +21 -1
  81. package/src/command-specs/profile.js +12 -5
  82. package/src/command-specs/spaces.js +101 -31
  83. package/src/command-specs/tools.js +3 -0
  84. package/src/runtime/agent-identity.js +187 -0
  85. package/src/runtime/api-hosts.generated.js +35 -0
  86. package/src/runtime/api-hosts.js +109 -0
  87. package/src/runtime/app-platform.js +68 -24
  88. package/src/runtime/channel.js +3 -7
  89. package/src/runtime/http-agent.js +53 -0
  90. package/src/runtime/native-record-files.js +11 -0
  91. package/src/runtime/oauth.js +97 -5
  92. package/src/runtime/profiles.js +200 -41
  93. package/src/runtime/skill-sync/cloud-client.ts +0 -10
  94. package/src/runtime/skill-sync/index.ts +13 -15
  95. package/src/runtime/skill-sync/local-scanner.ts +0 -67
  96. package/src/runtime/skill-sync/types.ts +1 -0
  97. package/src/runtime/skill-sync/write-cloud-skill.ts +7 -23
  98. package/src/runtime/skill-sync-service.js +4 -5
  99. package/src/runtime/space-dependencies.js +66 -0
  100. package/src/runtime/space-fixture-broker.js +23 -8
  101. package/src/runtime/space-platform.js +49 -3
  102. package/src/runtime/space-source.js +76 -2
  103. package/src/runtime/space-test-server.js +125 -10
  104. package/src/runtime/space-verification.js +106 -42
  105. package/src/runtime/space-view-manifest.js +38 -5
  106. package/src/runtime/telemetry.js +14 -1
  107. package/src/runtime/transport.js +31 -4
  108. package/src/runtime/upsell.js +3 -6
  109. package/src/runtime/view-render.js +6 -1
  110. package/src/skill-sync-worker.js +13 -2
  111. package/src/space-harness-host.ts +6 -3
  112. package/template/tailwind.config.ts +2 -35
  113. package/dist/space-sdk/dist/chunk-BFGB6XXC.js +0 -5
@@ -0,0 +1,59 @@
1
+ /**
2
+ * What an agent that wrote a comment ran on, beside its name, like the chat timeline's runtime badge
3
+ * (portal/src/components/manager/RuntimeBadge.tsx): the harness logo, small and grey, and on hover or keyboard focus a
4
+ * card with the name, the logo, the intelligence bars and the speed glyph, "<Harness> / <Provider>" (Notis runs on
5
+ * OpenAI or Claude, by its model) and one line each for intelligence, speed and model. Nothing without a recorded
6
+ * runtime (`CommentAgent.runtime`).
7
+ *
8
+ * The logos are drawn inline in the text colour (the Space runtime has no Portal files: a Shadow DOM page, a Site).
9
+ */
10
+ import React from 'react';
11
+ import type { CommentAgentRuntime, CommentRecord } from './commentModel';
12
+ import type { CommentController } from './useComments';
13
+ /** Who runs an agent: Notis, or a coding engine named by its runtime provider. */
14
+ export type CommentHarness = 'notis' | 'codex' | 'claude_code' | 'kimi' | 'grok' | 'opencode_go' | 'muse' | 'cursor_agent' | 'kiro' | 'antigravity';
15
+ type ModelProvider = 'openai' | 'claude';
16
+ type Level = 'low' | 'medium' | 'high';
17
+ type Speed = 'flex' | 'normal' | 'priority';
18
+ /** The harness names the Portal shows (portal/src/lib/codingEngines.ts labels). */
19
+ export declare const COMMENT_HARNESS_NAMES: Readonly<Record<CommentHarness, string>>;
20
+ /** Notis runs on OpenAI or Claude; the recorded model says which (the timeline's modelProviderOf). */
21
+ export declare function commentModelProvider(model: string | null | undefined): ModelProvider | undefined;
22
+ export interface CommentAgentRuntimeView {
23
+ harness?: CommentHarness;
24
+ modelProvider?: ModelProvider;
25
+ level?: Level;
26
+ speed?: Speed;
27
+ /** "Codex", "Claude": the harness, when it is not the agent's own name. */
28
+ runHarness?: string;
29
+ /** "OpenAI" or "Claude" for Notis. */
30
+ runProvider?: string;
31
+ /** "Notis / OpenAI": who runs it, each part once. */
32
+ runtimeName: string;
33
+ /** One line each for intelligence, speed and model. */
34
+ details: string[];
35
+ /** Everything in words, for the logo's accessible name: "Fred · Codex · Intelligence: High · Speed: Fast". */
36
+ label: string;
37
+ }
38
+ /** What the badge and its card say, worked out the way the chat timeline does (RuntimeBadge useRuntimeBadge). */
39
+ export declare function commentAgentRuntimeView(say: CommentController['say'], name: string, runtime: CommentAgentRuntime): CommentAgentRuntimeView;
40
+ /** A harness mark in the text colour. Decorative: the badge carries the name. */
41
+ export declare function CommentHarnessLogo({ harness, className }: {
42
+ harness: CommentHarness;
43
+ className?: string;
44
+ }): React.JSX.Element;
45
+ /** The hover card: who wrote, then who runs it, then one line per intelligence, speed and model. */
46
+ export declare function CommentAgentRuntimeCard({ name, view }: {
47
+ name: string;
48
+ view: CommentAgentRuntimeView;
49
+ }): React.JSX.Element;
50
+ /**
51
+ * 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.
54
+ */
55
+ export declare function CommentAgentBadge({ controller, comment }: {
56
+ controller: CommentController;
57
+ comment: CommentRecord;
58
+ }): React.JSX.Element | null;
59
+ export {};
@@ -44,8 +44,11 @@ export interface CommentFilesState {
44
44
  onDrop(event: DragEvent<HTMLElement>): void;
45
45
  };
46
46
  }
47
- /** The attachment queue of one comment box. */
48
- export declare function useCommentFiles(controller: CommentController): CommentFilesState;
47
+ /**
48
+ * The attachment queue of one comment box. With `draftKey` the chips are kept in the session store while the box is
49
+ * away (the page's comments left the panel) and come back with it; an upload cut short by that starts again.
50
+ */
51
+ export declare function useCommentFiles(controller: CommentController, draftKey?: string | null): CommentFilesState;
49
52
  /** The paperclip that opens the file picker. Renders nothing when the pane is text only. */
50
53
  export declare function CommentAttachButton({ controller, files, disabled }: {
51
54
  controller: CommentController;
@@ -12,20 +12,30 @@
12
12
  * | W, H | number | A zone from the pin, 0 to 1 of the anchor's width and height. Empty: a point. |
13
13
  * | Status | select | Open, Resolved or Deleted (a delete keeps the row for the digest). |
14
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 `|`. |
15
+ * | Options | text | The choices of a choice ask, separated by `|` or new lines. |
16
16
  * | Answer | text | The reader's answer to the ask. |
17
17
  * | Answered at | date | When the answer was given. |
18
18
  * | Change | select | The last change made here: created, replied, answered, resolved, reopened, deleted. |
19
19
  * | Changed at | date | When that change was made; the digest lists changes after the checkpoint. |
20
20
  * | Example | checkbox | A sample comment shown with an Example badge. |
21
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`). |
22
25
  *
23
26
  * Every column name can be renamed with `CommentColumns`; the defaults are the Slides names, so a Space that copies
24
27
  * the Slides table needs no mapping and no migration. Zones are opt-in: a table that adds W and H number columns
25
28
  * passes `{ w: 'W', h: 'H' }`. Without them (`w` and `h` null, the default) a drag on the anchor places a pin where it
26
29
  * started, and nothing writes a column the table does not have. Attachments are shown when the table has the files
27
30
  * column; the pane also lets people attach pictures and files to a new comment or a reply when the host can upload
28
- * them (`runtime.spaceFiles`). A table without the column shows none and takes text only.
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).
29
39
  */
30
40
  export type CommentRow = Record<string, unknown>;
31
41
  export type CommentNeeds = 'none' | 'check' | 'choice' | 'input';
@@ -53,6 +63,12 @@ export interface CommentColumns {
53
63
  example: string;
54
64
  /** The files column read for pictures and files shown with a comment. Null: the table has none. */
55
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;
56
72
  }
57
73
  export declare const COMMENT_COLUMNS: Readonly<CommentColumns>;
58
74
  export declare function commentColumns(columns?: Partial<CommentColumns>): CommentColumns;
@@ -79,18 +95,53 @@ export interface CommentRecord {
79
95
  example: boolean;
80
96
  createdAt: string | null;
81
97
  attachments: CommentAttachment[];
98
+ /** When the author edited the text, from the Edited at column (null: never, or the table has no such column). */
99
+ editedAt?: string | null;
100
+ /** Seconds into a recording, for a comment in time mode. */
101
+ time?: number | null;
102
+ /** On a reply that answers an ask, the ask's record key, from the Answer to column (null: none). */
103
+ answerTo?: string | null;
82
104
  /**
83
105
  * The agent that wrote this comment, from the server's write record (never the Author column): its name and,
84
106
  * for the person whose agent it is, the thread it works in. Absent on comments a person wrote.
85
107
  */
86
108
  agent?: CommentAgent | null;
109
+ /**
110
+ * Who created the row, from the server and never from the Author text (a renamed person keeps their comments):
111
+ * `createdByYou` is the server's answer for the signed-in viewer (`created_by_you`), `createdBy` the creator's user
112
+ * id (`created_by`), compared with the viewer's `id`. Null when the row does not say: the Author name decides then.
113
+ */
114
+ createdByYou?: boolean | null;
115
+ createdBy?: string | null;
116
+ }
117
+ /**
118
+ * What an agent ran on, as the server recorded it (`agent.runtime`): the harness (`provider`: notis, codex,
119
+ * claude_code, kimi, grok, opencode_go, muse, cursor_agent, kiro or antigravity), its name (`label`), the model, the
120
+ * intelligence level or reasoning effort and the speed. Each part is null when it was not recorded.
121
+ */
122
+ export interface CommentAgentRuntime {
123
+ provider: string | null;
124
+ label: string | null;
125
+ model: string | null;
126
+ intelligence: string | null;
127
+ effort: string | null;
128
+ speed: string | null;
87
129
  }
88
- /** An agent author, as the server stamped it. `threadId` is only given to the agent's owner. */
130
+ /**
131
+ * An agent author, as the server stamped it. `threadId` is only given to the agent's owner; `runtime` (when the
132
+ * server recorded it) is what it ran on, for the logo and the hover card beside its name.
133
+ */
89
134
  export interface CommentAgent {
90
135
  name: string;
91
136
  threadId: string | null;
92
137
  rowId: string | null;
138
+ runtime?: CommentAgentRuntime | null;
93
139
  }
140
+ /**
141
+ * How an author or agent name shows: a band name (lowercase words and digits joined by hyphens, the name agents
142
+ * declare) with its hyphens as spaces and each word capitalised; any other name as it is, so it is safe to call twice.
143
+ */
144
+ export declare function agentDisplayName(name: string): string;
94
145
  /**
95
146
  * A picture or file shown with a comment. `label` is the name without its extension: a choice option with the same
96
147
  * label is answered from under that picture ("Before.png" and "After.png" with Options "Before | After").
@@ -141,7 +192,12 @@ export declare function commentBodyParts(body: string): CommentBodyPart[];
141
192
  * does (an empty table). A list row carries every property of its database by name, filled or empty.
142
193
  */
143
194
  export declare function commentRowsHaveColumn(rows: readonly CommentRow[], name: string | null): boolean | null;
144
- /** One Comments row as a comment. An author outside `authors` (when given) reads as `fallbackAuthor`. */
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`.
200
+ */
145
201
  export declare function readCommentRow(row: CommentRow, options?: {
146
202
  columns?: Partial<CommentColumns>;
147
203
  authors?: readonly string[];
@@ -154,9 +210,46 @@ export declare function commentTimeOf(value: string | null | undefined): number;
154
210
  /** True when the comment belongs to `scope` (by id or record key). No scope: every comment belongs. */
155
211
  export declare function inCommentScope(comment: CommentRecord, scope: Pick<CommentScope, 'id' | 'recordKey'> | null | undefined): boolean;
156
212
  export declare function commentAnchorOf(comment: CommentRecord, anchors: readonly CommentAnchor[]): CommentAnchor | undefined;
157
- /** Threads in anchor order, then by creation; deleted replies are left out. Deleted roots stay (filter them to hide). */
213
+ /**
214
+ * Threads in anchor order, then by creation. Deleted replies stay in place (the card reads "Comment deleted" there so
215
+ * the replies around it still read); deleted roots stay too (filter them to hide the whole thread).
216
+ */
158
217
  export declare function commentThreads(comments: readonly CommentRecord[], anchors: readonly CommentAnchor[]): CommentThread[];
159
- /** Changes after the checkpoint: `me`'s comments and replies, and every answer or status change. */
218
+ /** The time of a thread's latest comment that is not deleted (its root's time when every reply is gone). */
219
+ export declare function commentThreadActivity(thread: CommentThread): number;
220
+ /**
221
+ * How a comment pane orders its threads (SPC-116): 'newest' (default) puts the newest thread first, by when its first
222
+ * comment was written, so a reply never makes the list jump; 'oldest' the reverse, 'anchor' keeps anchor order then
223
+ * creation (a deck read slide by slide), or the Space's own comparator (`commentThreadActivity` sorts by the latest
224
+ * comment).
225
+ */
226
+ export type CommentOrder = 'newest' | 'oldest' | 'anchor' | ((a: CommentThread, b: CommentThread) => number);
227
+ /** The threads in `order`. Stable: threads the order cannot tell apart keep their anchor order. */
228
+ export declare function orderCommentThreads(threads: readonly CommentThread[], order?: CommentOrder): CommentThread[];
229
+ /**
230
+ * A thread's replies as the card shows them: each reply, and one "Comment deleted" line for each run of deleted
231
+ * replies in a row (SPC-127).
232
+ */
233
+ export declare function commentReplyRuns(replies: readonly CommentRecord[]): Array<{
234
+ deleted: false;
235
+ reply: CommentRecord;
236
+ } | {
237
+ deleted: true;
238
+ replies: CommentRecord[];
239
+ }>;
240
+ /** A heading the pane groups threads under: threads with the same key sit together, under `label`. */
241
+ export interface CommentGroup {
242
+ key: string;
243
+ label: string;
244
+ }
245
+ /** Threads under their group headings, groups in the order their first thread comes. Null: the thread sits ungrouped. */
246
+ export declare function groupCommentThreads(threads: readonly CommentThread[], groupBy: (thread: CommentThread) => CommentGroup | null): Array<{
247
+ group: CommentGroup | null;
248
+ threads: CommentThread[];
249
+ }>;
250
+ /** A moment in a recording: "0:24", "12:05", "1:02:03". */
251
+ export declare function formatCommentTime(seconds: number): string;
252
+ /** Changes after the checkpoint: `me`'s comments, replies and edits, and every answer or status change. */
160
253
  export declare function commentChangesSince(comments: readonly CommentRecord[], checkpoint: string | null | undefined, me?: string): CommentRecord[];
161
254
  export interface CommentDigestOptions {
162
255
  /** First line, before the scope name. Default "Slide comments". */
@@ -175,7 +268,8 @@ export interface CommentDigestOptions {
175
268
  export declare function isCommentZone(comment: Pick<CommentRecord, 'x' | 'y' | 'w' | 'h'> | null | undefined): boolean;
176
269
  /**
177
270
  * The compact digest pasted into an agent's chat: every change since the scope's checkpoint, with where it is, what
178
- * changed and the thread state. Always English: it is read by agents, not shown to people.
271
+ * changed and the thread state. Always English: it is read by agents, not shown to people. `since` (default the scope's
272
+ * checkpoint) tells an edit from Edited at: a comment written before it and edited after reads "edited".
179
273
  */
180
274
  export declare function commentDigest(input: {
181
275
  scope: CommentScope | null;
@@ -183,6 +277,7 @@ export declare function commentDigest(input: {
183
277
  anchors: readonly CommentAnchor[];
184
278
  changes: readonly CommentRecord[];
185
279
  nowIso: string;
280
+ since?: string | null;
186
281
  }, options?: CommentDigestOptions): string;
187
282
  /** Local fields shown until the server row reaches `revision` (null while the write is in flight). */
188
283
  export interface CommentPatch {
@@ -200,6 +295,6 @@ export declare function newCommentId(): string;
200
295
  /** "2 min ago", "il y a 3 h": short relative time in the reader's language. */
201
296
  export declare function commentRelativeTime(iso: string | null, locale: string, now: number): string;
202
297
  /** Clipboard API first; the selection copy runs inside `host` (the Space's own element), never on the page body. */
203
- export declare function writeCommentClipboard(text: string, host: HTMLElement | null): Promise<boolean>;
298
+ export declare function writeCommentClipboard(text: string | Promise<string | null>, host: HTMLElement | null): Promise<boolean>;
204
299
  /** Bring an element into view inside its nearest scrolling box only; the page around the Space never moves. */
205
300
  export declare function scrollCommentIntoView(element: HTMLElement): void;
@@ -7,9 +7,12 @@ export declare const COMMENT_WORDS: Readonly<{
7
7
  comments: Words;
8
8
  thisAnchor: Words;
9
9
  all: Words;
10
+ allItems: Words;
10
11
  open: Words;
11
12
  resolved: Words;
12
13
  resolvedFilter: Words;
14
+ filter: Words;
15
+ filterLabel: Words;
13
16
  status: Words;
14
17
  scope: Words;
15
18
  copy: Words;
@@ -30,9 +33,36 @@ export declare const COMMENT_WORDS: Readonly<{
30
33
  cancel: Words;
31
34
  resolve: Words;
32
35
  reopen: Words;
36
+ archiveThread: Words;
37
+ unarchiveThread: Words;
38
+ deleteThreadNamed: Words;
39
+ copyLinkNamed: Words;
40
+ deleteReplyOf: Words;
41
+ deleteYourReply: Words;
42
+ editRootNamed: Words;
43
+ editReplyNamed: Words;
44
+ archived: Words;
45
+ unarchived: Words;
33
46
  delete: Words;
47
+ copyLink: Words;
48
+ linkCopied: Words;
49
+ linkCopyFailed: Words;
50
+ deleteThread: Words;
51
+ deleteComment: Words;
52
+ threadDeleted: Words;
53
+ commentDeleted: Words;
54
+ commentDeletedToast: Words;
55
+ edit: Words;
56
+ editRoot: Words;
57
+ editReply: Words;
58
+ editComment: Words;
59
+ save: Words;
60
+ edited: Words;
34
61
  deleteTitle: Words;
35
62
  deleteBody: Words;
63
+ askCheck: Words;
64
+ askChoice: Words;
65
+ askInput: Words;
36
66
  needs: Words;
37
67
  needCheck: Words;
38
68
  needChoice: Words;
@@ -44,11 +74,16 @@ export declare const COMMENT_WORDS: Readonly<{
44
74
  enlarge: Words;
45
75
  paste: Words;
46
76
  sent: Words;
77
+ answeredInput: Words;
47
78
  example: Words;
48
79
  emptyAnchor: Words;
49
80
  emptyAll: Words;
50
81
  emptyResolved: Words;
82
+ loadingComments: Words;
51
83
  saveError: Words;
84
+ deletePartial: Words;
85
+ answerPlaceholder: Words;
86
+ sendAnswer: Words;
52
87
  textOnly: Words;
53
88
  attachFiles: Words;
54
89
  dropFiles: Words;
@@ -65,6 +100,18 @@ export declare const COMMENT_WORDS: Readonly<{
65
100
  newActivity: Words;
66
101
  fromAgent: Words;
67
102
  openAgentThread: Words;
103
+ runtimeIntelligence: Words;
104
+ runtimeEffort: Words;
105
+ runtimeIntelligenceUnavailable: Words;
106
+ runtimeSpeed: Words;
107
+ runtimeSpeedUnavailable: Words;
108
+ runtimeModel: Words;
109
+ runtimeModeLow: Words;
110
+ runtimeModeMedium: Words;
111
+ runtimeModeHigh: Words;
112
+ runtimeSpeedPriority: Words;
113
+ runtimeSpeedNormal: Words;
114
+ runtimeSpeedFlex: Words;
68
115
  pin: Words;
69
116
  zone: Words;
70
117
  comment: Words;
@@ -77,6 +124,41 @@ export declare const COMMENT_WORDS: Readonly<{
77
124
  inGroup: Words;
78
125
  closeComments: Words;
79
126
  readError: Words;
127
+ goesTo: Words;
128
+ ownerThread: Words;
129
+ goesToNew: Words;
130
+ goesToNewHarness: Words;
131
+ goesToLoading: Words;
132
+ change: Words;
133
+ changeThread: Words;
134
+ openLinkedThread: Words;
135
+ toThread: Words;
136
+ toNew: Words;
137
+ toNewHarness: Words;
138
+ pickThread: Words;
139
+ linking: Words;
140
+ pageN: Words;
141
+ wholeSpace: Words;
142
+ newCommentMenu: Words;
143
+ modeText: Words;
144
+ modePoint: Words;
145
+ modeBox: Words;
146
+ modeItems: Words;
147
+ modeTime: Words;
148
+ modePage: Words;
149
+ hintPoint: Words;
150
+ hintBox: Words;
151
+ hintText: Words;
152
+ hintItems: Words;
153
+ hintCancel: Words;
154
+ toolBar: Words;
155
+ closeToolBar: Words;
156
+ toggleToolBar: Words;
157
+ newCommentPage: Words;
158
+ newCommentItems: Words;
159
+ newCommentItem: Words;
160
+ newCommentTime: Words;
161
+ itemsLabel: Words;
80
162
  }>;
81
163
  export type CommentWordKey = keyof typeof COMMENT_WORDS;
82
164
  export type CommentWords = Readonly<Record<CommentWordKey, Words>>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The bridge from a Space's comment controllers to the host Comments panel (SPC-113 to SPC-131). The pane no longer
3
+ * sits inside a Space: `CommentPane` and `PassageCommentPane` attach their controller here and draw their threads into
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.
6
+ *
7
+ * While the host has no Comments panel for the viewer (comments off, a Site, a link, a preview) the Space shows no
8
+ * comments at all: `useHostComments()` is false and the pins and highlights stay hidden.
9
+ */
10
+ import type { SpaceCommentSource } from '../../space';
11
+ /** True when the host shows comments for this viewer: pins, highlights and the Comment button may show. */
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>`. */
14
+ export declare const COMMENT_FOCUS_PARAM = "comment";
15
+ /**
16
+ * The comment a link asks to show: the `comment` view param the host puts on the Space page URL (a push opens
17
+ * `...?comment=<root_key>`), or null. Read raw, so a Space need not declare the param. `useComments` and
18
+ * `usePassageComments` read it by default (their `focusKey`) and focus and scroll to that thread once it is read.
19
+ * Null while the host shows no comments (`useHostComments` false): a Space's own `comment` param is then its own.
20
+ */
21
+ export declare function useCommentFocusParam(): string | null;
22
+ /**
23
+ * Keeps `controller` listed in the host Comments panel while the calling component is mounted, and returns the panel
24
+ * element to draw its threads in (null while the panel does not show them). `options` carries what the pane was given
25
+ * (a title, the groups of a passage pane). `watch` lists what the host reads (the threads, the new comment, the
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.
28
+ *
29
+ * The source object stays the same for the life of the component. A new transport object from the host (its viewer
30
+ * resolving) lists that same source again without taking the panel element away, so the pane, a reply being typed and
31
+ * the list's scroll stay as they are.
32
+ */
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;
@@ -2,7 +2,11 @@ export * from './commentModel';
2
2
  export * from './commentWords';
3
3
  export * from './useComments';
4
4
  export * from './CommentPane';
5
+ export { COMMENT_HARNESS_NAMES, CommentAgentBadge, commentAgentRuntimeView, type CommentAgentRuntimeView, type CommentHarness, } from './agentRuntime';
5
6
  export * from './commentFiles';
6
7
  export * from './passageModel';
7
8
  export * from './usePassageComments';
8
9
  export * from './PassageComments';
10
+ export { COMMENT_FOCUS_PARAM, useCommentFocusParam, useHostComments } from './hostComments';
11
+ export { useCommentRouting, type CommentRouting } from './useCommentRouting';
12
+ export type { CommentListOptions } from './paneParts';
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Pieces both comment panes share (the pins pane `CommentPane` and the passage pane `PassageCommentPane`): the filter
3
+ * menu (Open, Done, All with counts), the New comment button listing the Space's modes, the hint a mode shows, the
4
+ * To chip of a new comment, the Goes to line under a reply, the ordered and grouped list, and E / Shift+E.
5
+ */
6
+ import React, { type ReactNode, type RefObject } from 'react';
7
+ import { type CommentGroup, type CommentOrder, type CommentThread } from './commentModel';
8
+ import type { SpaceCommentThreadRef } from '../../space';
9
+ import type { CommentWordKey } from './commentWords';
10
+ import type { CommentController, CommentMode, CommentStatusView } from './useComments';
11
+ export declare const COMMENT_MODE_ICON: Readonly<Record<CommentMode, string>>;
12
+ export declare const COMMENT_MODE_WORD: Readonly<Record<CommentMode, CommentWordKey>>;
13
+ /** Open (default), Done and All, each with its count, behind one menu (SPC-126). */
14
+ export declare function CommentFilterMenu({ controller, counts }: {
15
+ controller: CommentController;
16
+ /** The counts shown. Default: the controller's, for its anchor filter. */
17
+ counts?: Readonly<Record<CommentStatusView, number>>;
18
+ }): React.JSX.Element;
19
+ /** The pane header's New comment button: one mode starts at once, several open a menu of the Space's modes. */
20
+ export declare function NewCommentMenu({ controller }: {
21
+ controller: CommentController;
22
+ }): React.JSX.Element | null;
23
+ /**
24
+ * What the tool bar says before a mode starts: the hint of the first mode that waits for you to point (no "Point at"
25
+ * on a Space without point mode), or nothing when every mode opens the box at once (time, page).
26
+ */
27
+ export declare function commentIdleHint(controller: CommentController): CommentWordKey | null;
28
+ /** The short hint a mode shows until you point at something, with how to cancel it. */
29
+ export declare function CommentModeHint({ controller, className }: {
30
+ controller: CommentController;
31
+ className?: string;
32
+ }): React.JSX.Element | null;
33
+ /** A harness id as people read it: "claude" reads "Claude". */
34
+ export declare function commentHarnessName(harness: string | null | undefined): string;
35
+ /**
36
+ * How a thread a comment goes to is named: its title, or "a new Claude thread" for a new-thread pick or a pending link
37
+ * (no thread yet, the first wake starts it), or "a new thread" without one.
38
+ */
39
+ export declare function commentThreadName(controller: CommentController, thread: SpaceCommentThreadRef | {
40
+ newThread: string;
41
+ } | null): {
42
+ title: string;
43
+ to: string;
44
+ pending: boolean;
45
+ };
46
+ /**
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
49
+ * ends with an ellipsis (never cut mid-word without one); its title attribute has it in full.
50
+ */
51
+ export declare function CommentToChip({ controller }: {
52
+ controller: CommentController;
53
+ }): React.JSX.Element | null;
54
+ /**
55
+ * For a new comment's text box: an @ typed in the empty box opens the thread picker instead of writing the @. A pick
56
+ * leaves the box empty; dismissing the picker (Escape) puts the @ back with the caret after it, so "@Alice" still
57
+ * mentions someone. `setValue` writes the box's text.
58
+ */
59
+ export declare function useAtThreadPicker(controller: CommentController): (value: string, field: HTMLElement, setValue?: (value: string) => void) => string;
60
+ /**
61
+ * At the top of a comment thread's card, the thread that owns it: "Thread <title>" (its first linked thread), else
62
+ * "Goes to <best match>" or "Goes to a new thread", with Change, which opens the @ thread picker and links the pick
63
+ * (SPC-114). The signatures below it name only who wrote each comment. Nothing when the host does not link threads;
64
+ * "Goes to" and a quiet placeholder (no name, no Change) while where it goes is still being read.
65
+ */
66
+ export declare function CommentGoesTo({ controller, thread }: {
67
+ controller: CommentController;
68
+ thread: CommentThread;
69
+ }): 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. */
71
+ export declare function commentPlaceMeta(controller: CommentController, thread: CommentThread): string[];
72
+ export interface CommentListOptions {
73
+ /**
74
+ * The order of the threads (SPC-116). Default 'newest': the newest thread first, by when its first comment was
75
+ * written (a reply never moves a thread). 'oldest', 'anchor' (the order of the anchors, then creation) or the
76
+ * Space's own comparator.
77
+ */
78
+ order?: CommentOrder;
79
+ /**
80
+ * Group headings. Default: by page when the controller covers the whole Space (no scope record), else none. Pass a
81
+ * function to group your way (by slide, by time, by status), or false for a flat list.
82
+ */
83
+ groupBy?: ((thread: CommentThread) => CommentGroup | null) | false;
84
+ }
85
+ /** The threads in order, under group headings when there is more than one group. */
86
+ export declare function CommentThreadList({ controller, threads, order, groupBy, children }: CommentListOptions & {
87
+ controller: CommentController;
88
+ threads: readonly CommentThread[];
89
+ children: (thread: CommentThread) => ReactNode;
90
+ }): React.JSX.Element;
91
+ /**
92
+ * Scrolls the selected thread's card into view inside the pane's own scroller (C7): when a deep link or the page picks
93
+ * a thread (`threadKey`, and each `revealRequest`). While the panel is hidden (no height) or the card is not drawn
94
+ * yet, it waits; once both are there it reveals the card and keeps it in view while the panel finishes opening
95
+ * (`revealInScroller`: measured against the scroller, again on each resize and frame until the layout settles, then on
96
+ * each change of the card's size for a while, as its pictures load). The page around the panel never moves.
97
+ */
98
+ export declare function useThreadScroller(controller: CommentController, scrollRef: RefObject<HTMLElement | null>): void;
99
+ /**
100
+ * Keeps focus in the pane when the focused card leaves the list (archived with E, deleted): it moves to the card that
101
+ * took its place, else the pane, instead of falling to the page body, so Z and the next keys still reach the pane.
102
+ */
103
+ export declare function usePaneFocusKeeper(rootRef: RefObject<HTMLElement | null>, listKey: unknown): void;
104
+ /**
105
+ * A pane's own shortcut owner: E archives and Shift+E unarchives the focused (or selected) thread while focus is in
106
+ * the pane, and the Undo toast's Z belongs to this pane, so two panes on one page never clash.
107
+ */
108
+ export declare function CommentPaneKeys({ controller, rootRef, children }: {
109
+ controller: CommentController;
110
+ rootRef: RefObject<HTMLElement | null>;
111
+ children: ReactNode;
112
+ }): React.JSX.Element;
113
+ /**
114
+ * Placeholders where the threads come while the first read of the comments has not settled (C4): a page opened in a
115
+ * new tab shows that it is loading, never "No comments" for a moment before its threads arrive.
116
+ */
117
+ export declare function CommentListLoading({ controller }: {
118
+ controller: Pick<CommentController, 'say'>;
119
+ }): React.JSX.Element;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Where comment threads go (SPC-113, SPC-114, SPC-117): the manager threads each comment thread is linked to, the
3
+ * best-match thread a new comment goes to, and the host @ thread picker. Everything comes from the host Comments
4
+ * transport (`runtime.spaceComments`); a host without `links` shows no Goes to line, one without `bestMatch` no To chip.
5
+ *
6
+ * Links are read once per root and kept, at most `LINK_BATCH` roots per request: a root counts as read only once its
7
+ * answer came back, an answer that arrives after the screen moved on is still kept, and a failed read is tried again. A
8
+ * new transport object from the host (its viewer resolving) reads nothing again. A root is read again after a reply is
9
+ * sent and while its first link is a pending new thread (5 s, 15 s and 45 s later), until it names a real thread.
10
+ *
11
+ * A pick (Change, or the To chip of a new comment) shows at once, marked saving, and goes back with the error notice
12
+ * when the link fails.
13
+ *
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
16
+ * of each page are kept for the session, per viewer and Space, so a page shown again names its threads at once while
17
+ * they are read again.
18
+ */
19
+ import type { SpaceCommentThreadPick, SpaceCommentThreadRef } from '../../space';
20
+ export interface CommentRouting {
21
+ /** True when the host links comment threads to threads: each card shows its Goes to line. */
22
+ links: boolean;
23
+ /** The threads a comment thread is linked to; the first is where a reply goes. */
24
+ 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). */
26
+ goesTo(rootKey: string): SpaceCommentThreadRef | null;
27
+ /** The best-match thread for a new comment on this page (THR-024); null: none, or the host has no best match. */
28
+ bestMatch: SpaceCommentThreadRef | null;
29
+ /** True when the host answers best matches: the new comment box shows its To chip. */
30
+ hasBestMatch: boolean;
31
+ /** The thread the next new comment goes to, when picked with the chip or @; null: the best match. */
32
+ newPick: SpaceCommentThreadPick | null;
33
+ /** True when the host has the @ thread picker. */
34
+ canPick: boolean;
35
+ /** True when the host can link a comment thread to a thread: the Goes to line shows Change. */
36
+ canLink: boolean;
37
+ /** Opens the picker for the next new comment, under `anchor`. Resolves with the pick, or null when dismissed. */
38
+ pickForNew(anchor: HTMLElement): Promise<SpaceCommentThreadPick | null>;
39
+ clearPick(): void;
40
+ /** Change: opens the picker for a thread's replies and links the pick as where they go. */
41
+ change(rootKey: string, anchor: HTMLElement): Promise<void>;
42
+ /** Links a new comment thread, once its first comment is saved, to the pick or the best match. */
43
+ linkNew(rootKey: string): Promise<void>;
44
+ /** True while a pick for this thread is being linked: its Goes to line already names it. */
45
+ saving(rootKey: string): boolean;
46
+ /** Reads where this thread goes again, 5 s, 15 s and 45 s from now, until it names a real thread (after a reply). */
47
+ reread(rootKey: string): void;
48
+ /**
49
+ * False while where this thread goes is still being read (its links, or with none the page's best match): the Goes
50
+ * to line shows a neutral loading state instead of a destination. Absent: always known.
51
+ */
52
+ known?(rootKey: string): boolean;
53
+ /** Opens a manager thread in the chat; undefined on hosts without it. */
54
+ open?: (threadId: string) => void;
55
+ }
56
+ /** The most roots one links request asks for: more are split into several requests. */
57
+ export declare const LINK_BATCH = 200;
58
+ /** Forgets every kept answer (tests). */
59
+ export declare function clearCommentRoutingCache(): void;
60
+ export declare function useCommentRouting(input: {
61
+ database: string;
62
+ /** Root record keys of the threads on screen (drafts left out): their links are read in one batch. */
63
+ rootKeys: readonly string[];
64
+ /** The record the page shows, for the best match. */
65
+ recordKey: string | null;
66
+ /**
67
+ * The page's draft scope (`useComments` draftScope): a pick for the next new comment is kept per page, like the
68
+ * comment's text, so a pick made on one record never links another record's comment.
69
+ */
70
+ draftScope?: string | null;
71
+ /** Opens a thread when the host Comments transport has no `openThread` (the side chat transport). */
72
+ fallbackOpen?: (threadId: string) => void;
73
+ /** Called when a thread someone picked could not be linked, so they hear it instead of a silent "a new thread". */
74
+ onLinkFailed?: () => void;
75
+ }): CommentRouting;