@notis_ai/cli 0.2.28 → 0.2.30

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 (72) hide show
  1. package/README.md +25 -8
  2. package/dist/agent-hooks/notis-agent-hook.mjs +1476 -712
  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-spaces/.notis-base-skill.json +1 -1
  6. package/dist/base-skills/notis-spaces/references/release.md +6 -5
  7. package/dist/base-skills/notis-spaces/references/sdk.md +86 -14
  8. package/dist/sdk/src/components/NotisCommentBoundary.tsx +29 -96
  9. package/dist/sdk/src/components/NotisSelectionBoundary.tsx +3 -8
  10. package/dist/sdk/src/components/SelectionActionBar.tsx +144 -23
  11. package/dist/sdk/src/components/selectionId.ts +6 -0
  12. package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
  13. package/dist/sdk/src/index.ts +6 -1
  14. package/dist/sdk/src/runtime.ts +13 -1
  15. package/dist/sdk/src/space.ts +230 -0
  16. package/dist/skill-sync-worker.mjs +185 -30
  17. package/dist/space-harness/host.js +260 -114
  18. package/dist/space-sdk/dist/{chunk-BFGB6XXC.js → chunk-6GJ2BS7B.js} +1 -3
  19. package/dist/space-sdk/dist/index.js +4 -2
  20. package/dist/space-sdk/dist/ui.js +19 -14
  21. package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -10
  22. package/dist/space-sdk/src/hooks/useThreadItem.d.ts +28 -0
  23. package/dist/space-sdk/src/index.d.ts +3 -1
  24. package/dist/space-sdk/src/runtime.d.ts +13 -1
  25. package/dist/space-sdk/src/space.ts +230 -0
  26. package/dist/space-sdk/src/tailwind-candidates.d.ts +505 -22
  27. package/dist/space-sdk/src/ui/actions/useToast.d.ts +2 -0
  28. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +56 -10
  29. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +16 -7
  30. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +59 -0
  31. package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +5 -2
  32. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +103 -8
  33. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +82 -0
  34. package/dist/space-sdk/src/ui/comments/hostComments.d.ts +37 -0
  35. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  36. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +119 -0
  37. package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +75 -0
  38. package/dist/space-sdk/src/ui/comments/useComments.d.ts +165 -15
  39. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +24 -8
  40. package/dist/space-sdk/src/ui/index.d.ts +2 -1
  41. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +6 -1
  42. package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +8 -2
  43. package/dist/space-sdk/src/ui/styles.d.ts +27 -5
  44. package/dist/view-renderer/dist/host.js +330 -184
  45. package/dist/view-renderer/src/host.tsx +6 -3
  46. package/dist/view-renderer/src/renderer.js +62 -3
  47. package/package.json +3 -3
  48. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -1
  49. package/skills/notis-spaces/cli.md +8 -8
  50. package/src/cli.js +10 -2
  51. package/src/command-specs/computer.js +21 -1
  52. package/src/command-specs/profile.js +12 -5
  53. package/src/command-specs/spaces.js +57 -23
  54. package/src/command-specs/tools.js +1 -1
  55. package/src/runtime/agent-identity.js +187 -0
  56. package/src/runtime/api-hosts.js +92 -0
  57. package/src/runtime/app-platform.js +74 -11
  58. package/src/runtime/channel.js +3 -7
  59. package/src/runtime/oauth.js +95 -4
  60. package/src/runtime/profiles.js +200 -41
  61. package/src/runtime/skill-sync-service.js +4 -5
  62. package/src/runtime/space-fixture-broker.js +23 -2
  63. package/src/runtime/space-platform.js +2 -0
  64. package/src/runtime/space-source.js +66 -1
  65. package/src/runtime/space-test-server.js +20 -4
  66. package/src/runtime/space-verification.js +66 -10
  67. package/src/runtime/telemetry.js +14 -1
  68. package/src/runtime/transport.js +12 -0
  69. package/src/runtime/upsell.js +3 -6
  70. package/src/runtime/view-render.js +3 -1
  71. package/src/skill-sync-worker.js +13 -2
  72. package/src/space-harness-host.ts +6 -3
@@ -24,6 +24,8 @@ export interface ToastOptions {
24
24
  undo?: UndoFn | null;
25
25
  /** A muted second line under the words. */
26
26
  reason?: Words | string | null;
27
+ /** How long it stays, in ms (default ACTION_TOAST_MS); Dismiss still hides it sooner. */
28
+ durationMs?: number;
27
29
  }
28
30
  export interface UseToastOptions {
29
31
  /** An Undo threw or rejected (the toast already says so). */
@@ -1,22 +1,34 @@
1
1
  /**
2
2
  * The comment pane and its pieces, rendered from a `useComments` controller:
3
3
  *
4
- * - `CommentPane`: the side panel (filters, Copy changes, the new comment box, the thread cards, the delete
5
- * confirmation and the toast).
4
+ * - `CommentPane`: the comments of the view in the host Comments panel beside the chat (the filter menu with Open, Done
5
+ * and All, the New comment button listing the Space's modes, Copy changes, the new comment box with its To chip, the
6
+ * thread cards and the Undo toast). It draws nothing inside the Space, and nothing at all while the host shows no
7
+ * comments (`hostComments`). Threads come flat, newest first; on the Space home (no scope) they group by page. Pass
8
+ * `order` and `groupBy` to list them your way.
6
9
  * - `CommentPins`: the numbered pins and zones on the anchor element. Put it inside the element the comments sit on (a
7
10
  * slide, a section) and give that element `position: relative`. With `controller.commenting` on it covers the element:
8
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
9
12
  * item" starts a comment on the whole anchor, with no pin.
13
+ * - `CommentToolBar`: the comment tool bar on the page, one button per mode, toggled with C (SPC-118).
10
14
  * - `CommentThreadCard`, `NewCommentBox` and `CommentAvatar` for Spaces that lay the pane out themselves.
11
15
  *
16
+ * A card archives (E) and unarchives (Shift+E) with an Undo toast (Z), edits your own comments in place and deletes at
17
+ * once with Undo, as the viewer's rights allow. At its top, "Thread <title>" names the thread that owns it (or "Goes to"
18
+ * the thread a reply would go to). Each signature names who wrote the comment; an agent's carries its harness logo, with
19
+ * what it ran on in a hover card (`CommentAgentBadge`). A band name reads "Fred And The Machine" (`agentDisplayName`).
20
+ *
12
21
  * Files: with an Attachments files column and a host that uploads (`runtime.spaceFiles`), a new comment and a reply take
13
22
  * pictures and files: paste, drop on the box or the paperclip (`commentFiles`). Otherwise the boxes take text only.
14
23
  *
15
24
  * Keyboard: Enter sends a reply or a new comment and Shift+Enter adds a line; Escape in an empty new comment drops it
16
- * (with text, the first Escape leaves the field); Escape leaves Add comment mode; a thread card selects with Enter.
25
+ * (with text, the first Escape leaves the field); Escape leaves a comment mode; a thread card selects with Enter; with
26
+ * focus in the pane, E archives the focused thread and Shift+E unarchives it.
17
27
  */
18
28
  import React, { type KeyboardEvent as ReactKeyboardEvent } from 'react';
29
+ import type { KeySpec } from '../../words';
19
30
  import { type CommentRecord, type CommentThread } from './commentModel';
31
+ import { type CommentListOptions } from './paneParts';
20
32
  import type { CommentController } from './useComments';
21
33
  export interface CommentAvatarProps {
22
34
  author: string;
@@ -25,8 +37,9 @@ export interface CommentAvatarProps {
25
37
  className?: string;
26
38
  }
27
39
  /**
28
- * The signature of a comment an agent wrote, like a message one thread sends another: "From {name}", a link to the
29
- * agent's thread for the person whose agent it is.
40
+ * "From {name}", a link to the agent's thread for the person whose agent it is: the source of a comment an agent wrote,
41
+ * for a Space that lays its cards out itself. The pane's cards no longer show it: the thread that owns a comment thread
42
+ * is named once at its top, and each signature names only who wrote.
30
43
  */
31
44
  export declare function CommentAgentSource({ controller, comment }: {
32
45
  controller: CommentController;
@@ -34,6 +47,8 @@ export declare function CommentAgentSource({ controller, comment }: {
34
47
  }): React.JSX.Element | null;
35
48
  /** The author's initial. Decorative: the author's name is always written next to it. */
36
49
  export declare function CommentAvatar({ author, me, className }: CommentAvatarProps): React.JSX.Element;
50
+ /** The start of a comment's text for a button's name: about 40 characters, cut at a word. */
51
+ export declare function commentExcerpt(comment: Pick<CommentRecord, 'body' | 'attachments'>): string;
37
52
  /** Enter sends a comment; Shift+Enter, and Enter while composing an accented letter, add to the text. */
38
53
  export declare function sendsOnEnter(event: ReactKeyboardEvent<HTMLTextAreaElement>): boolean;
39
54
  export interface CommentThreadCardProps {
@@ -46,21 +61,52 @@ export declare function CommentThreadCard({ controller, thread, showAnchor }: Co
46
61
  export interface NewCommentBoxProps {
47
62
  controller: CommentController;
48
63
  }
49
- /** The box for the comment `controller.draftPin` started. Takes focus when it opens. */
64
+ /**
65
+ * The box for the comment `controller.draftPin` started. Takes focus when it opens. Its To chip names the thread the
66
+ * comment goes to (the best match, or the one picked with the chip or by typing @ first).
67
+ */
50
68
  export declare function NewCommentBox({ controller }: NewCommentBoxProps): React.JSX.Element | null;
51
69
  export interface CommentPinsProps {
52
70
  controller: CommentController;
53
71
  /** The anchor the pins sit on. Default: `controller.anchorKey`. */
54
72
  anchorKey?: string | null;
55
- /** A pin was pressed. Default: `controller.selectThread`. */
73
+ /**
74
+ * A pin was pressed. Default: `controller.revealThread` (the thread is selected and the host shows its Comments
75
+ * panel). A Space that handles it calls `controller.revealThread` itself to keep that.
76
+ */
56
77
  onOpen?(thread: CommentThread): void;
57
78
  }
58
79
  /**
59
80
  * Numbered pins at each thread's x and y on the anchor element, the zones threads mark, and the pin or zone of the
60
81
  * comment being written. In Add comment mode it also covers the element to take the click or drag that places one.
61
82
  */
62
- export declare function CommentPins({ controller, anchorKey, onOpen }: CommentPinsProps): React.JSX.Element;
63
- export interface CommentPaneProps {
83
+ export declare function CommentPins(props: CommentPinsProps): React.JSX.Element | null;
84
+ export interface CommentToolBarProps {
85
+ controller: CommentController;
86
+ /**
87
+ * The key that shows and hides the tool bar. Default 'c' (SPC-118), registered as a Notis key while the tool bar is
88
+ * mounted, so it wins over Notis's own C (new chat) on this page. False: no key, the Space toggles
89
+ * `controller.setToolBar` itself.
90
+ */
91
+ toggleKey?: KeySpec | false;
92
+ /** Always show the bar (it then has no close button). Default: shown while `controller.toolBar` is on. */
93
+ pinned?: boolean;
94
+ /**
95
+ * 'overlay' (default): the bar floats over the top left of its positioned parent (the page card), with an inset, and
96
+ * 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
+ */
100
+ place?: 'overlay' | 'inline';
101
+ className?: string;
102
+ }
103
+ /**
104
+ * The comment tool bar on the page (SPC-118): one button per mode the Space offers (`controller.modes`). A mode shows
105
+ * "Point at something to comment" (or its own hint) until you point; Escape cancels. C shows and hides it. Put it where
106
+ * the Space wants it on the page; it draws nothing while the host shows no comments.
107
+ */
108
+ export declare function CommentToolBar(props: CommentToolBarProps): React.JSX.Element | null;
109
+ export interface CommentPaneProps extends CommentListOptions {
64
110
  controller: CommentController;
65
111
  /** The heading. Default "Comments". */
66
112
  title?: string;
@@ -68,4 +114,4 @@ export interface CommentPaneProps {
68
114
  showCopy?: boolean;
69
115
  className?: string;
70
116
  }
71
- export declare function CommentPane({ controller, title, showCopy, className }: CommentPaneProps): React.JSX.Element;
117
+ export declare const CommentPane: (props: CommentPaneProps) => React.ReactPortal | null;
@@ -6,12 +6,16 @@
6
6
  * - `CommentableRichText`: around rich text (the Markdown editor, or rendered Markdown). It highlights every thread's
7
7
  * passage, follows the text as it is edited and laid out, offers Comment on a selection, and a click on a highlight
8
8
  * opens its thread.
9
- * - `PassageCommentPane`: the standard comment pane for these threads: each card shows its field and quote (Text
10
- * changed when the words are gone), the Open and Resolved filter, the new comment box, replies, Resolve and Delete.
11
- * Put it in a `SidePane` beside the record.
9
+ * - `PassageCommentPane`: the standard comment pane for these threads: each card shows its field and quote (Passage
10
+ * changed, with the old quote, when the words are gone; the thread stays open), the filter menu (Open, Done, All),
11
+ * the New comment button (on words, on the whole page), the new comment box with its To chip, replies, Archive,
12
+ * Edit and Delete with Undo. Threads come newest first; `order="reading"` lists them in reading order instead. It
13
+ * draws in the host Comments panel beside the chat, never inside the Space (`hostComments`).
12
14
  */
13
15
  import React, { type ReactNode } from 'react';
14
16
  import { type Words } from '../../words';
17
+ import type { CommentOrder } from './commentModel';
18
+ import { type CommentListOptions } from './paneParts';
15
19
  import type { PassageCommentController } from './usePassageComments';
16
20
  export interface CommentableTextProps {
17
21
  comments: PassageCommentController;
@@ -23,7 +27,7 @@ export interface CommentableTextProps {
23
27
  children: ReactNode;
24
28
  className?: string;
25
29
  }
26
- export declare function CommentableText({ comments, field, value, children, className }: CommentableTextProps): React.JSX.Element;
30
+ export declare function CommentableText(props: CommentableTextProps): React.JSX.Element;
27
31
  export interface CommentableRichTextProps {
28
32
  comments: PassageCommentController;
29
33
  /** The field's key, as declared in `fields`. */
@@ -32,9 +36,14 @@ export interface CommentableRichTextProps {
32
36
  children: ReactNode;
33
37
  className?: string;
34
38
  }
35
- export declare function CommentableRichText({ comments, field, children, className }: CommentableRichTextProps): React.JSX.Element;
36
- export interface PassageCommentPaneProps {
39
+ export declare function CommentableRichText(props: CommentableRichTextProps): React.JSX.Element;
40
+ export interface PassageCommentPaneProps extends Omit<CommentListOptions, 'order'> {
37
41
  comments: PassageCommentController;
42
+ /**
43
+ * The order of the threads. Default 'newest' (SPC-116). 'reading' keeps reading order (open threads first, each in
44
+ * the order of the fields and their words), as panes beside a document often want.
45
+ */
46
+ order?: CommentOrder | 'reading';
38
47
  /** Closes the pane: shows a close button in its heading. */
39
48
  onClose?(): void;
40
49
  /** The heading. Default "Comments". */
@@ -47,4 +56,4 @@ export interface PassageCommentPaneProps {
47
56
  onGroup?(group: string): void;
48
57
  className?: string;
49
58
  }
50
- export declare function PassageCommentPane({ comments, onClose, title, groups, onGroup, className }: PassageCommentPaneProps): React.JSX.Element;
59
+ export declare const PassageCommentPane: (props: PassageCommentPaneProps) => React.ReactPortal | null;
@@ -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';