@notis_ai/cli 0.2.32 → 0.2.34

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 (95) hide show
  1. package/README.md +75 -11
  2. package/dist/agent-hooks/notis-agent-hook.mjs +4407 -905
  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 +102 -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/NotisSelectionBoundary.tsx +13 -5
  13. package/dist/sdk/src/components/SelectionActionBar.tsx +45 -8
  14. package/dist/sdk/src/components/SpaceTextComments.tsx +293 -0
  15. package/dist/sdk/src/components/selectionRange.ts +65 -0
  16. package/dist/sdk/src/config.ts +3 -1
  17. package/dist/sdk/src/functions.ts +218 -0
  18. package/dist/sdk/src/hooks/useAgentQueue.ts +17 -28
  19. package/dist/sdk/src/hooks/useCollectionInteractions.ts +66 -9
  20. package/dist/sdk/src/hooks/useConnection.ts +102 -0
  21. package/dist/sdk/src/hooks/useFunction.ts +42 -0
  22. package/dist/sdk/src/hooks/useNotisSettings.ts +101 -0
  23. package/dist/sdk/src/index.ts +16 -4
  24. package/dist/sdk/src/interactions/shortcuts.tsx +6 -1
  25. package/dist/sdk/src/interactions/swipeDownToDismiss.ts +158 -0
  26. package/dist/sdk/src/interactions/textBoxTwoState.ts +174 -0
  27. package/dist/sdk/src/interactions.ts +17 -0
  28. package/dist/sdk/src/runtime.ts +16 -1
  29. package/dist/sdk/src/space.ts +401 -33
  30. package/dist/sdk/src/ui/comments/passageModel.ts +99 -0
  31. package/dist/sdk/src/ui/comments/textHighlights.ts +33 -0
  32. package/dist/skill-sync/index.js +262 -31
  33. package/dist/skill-sync-worker.mjs +515 -127
  34. package/dist/space-harness/host.js +389 -154
  35. package/dist/space-sdk/dist/chunk-3NPBCE6E.js +3 -0
  36. package/dist/space-sdk/dist/index.js +3 -3
  37. package/dist/space-sdk/dist/ui.js +16 -11
  38. package/dist/space-sdk/src/config.ts +3 -1
  39. package/dist/space-sdk/src/functions.ts +218 -0
  40. package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +2 -13
  41. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +7 -0
  42. package/dist/space-sdk/src/hooks/useConnection.d.ts +42 -0
  43. package/dist/space-sdk/src/hooks/useFunction.d.ts +20 -0
  44. package/dist/space-sdk/src/hooks/useNotisSettings.d.ts +48 -0
  45. package/dist/space-sdk/src/index.d.ts +10 -4
  46. package/dist/space-sdk/src/interactions/shortcuts.d.ts +5 -0
  47. package/dist/space-sdk/src/runtime.d.ts +14 -1
  48. package/dist/space-sdk/src/space.ts +401 -33
  49. package/dist/space-sdk/src/tailwind-candidates.d.ts +400 -204
  50. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +90 -15
  51. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +4 -1
  52. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +4 -2
  53. package/dist/space-sdk/src/ui/comments/commentDrafts.d.ts +63 -0
  54. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +59 -88
  55. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +32 -1
  56. package/dist/space-sdk/src/ui/comments/handover.d.ts +34 -0
  57. package/dist/space-sdk/src/ui/comments/hostComments.d.ts +13 -9
  58. package/dist/space-sdk/src/ui/comments/hostPanel.d.ts +113 -0
  59. package/dist/space-sdk/src/ui/comments/index.d.ts +7 -2
  60. package/dist/space-sdk/src/ui/comments/paneOutlet.d.ts +33 -0
  61. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +71 -27
  62. package/dist/space-sdk/src/ui/comments/passageModel.d.ts +12 -36
  63. package/dist/space-sdk/src/ui/comments/reviewRun.d.ts +190 -0
  64. package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +26 -4
  65. package/dist/space-sdk/src/ui/comments/useComments.d.ts +116 -77
  66. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +8 -4
  67. package/dist/space-sdk/src/ui/index.d.ts +1 -1
  68. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +3 -4
  69. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +27 -8
  70. package/dist/view-renderer/dist/host.js +450 -215
  71. package/package.json +3 -3
  72. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -2
  73. package/skills/notis-spaces/cli.md +3 -3
  74. package/src/cli.js +2 -1
  75. package/src/command-specs/index.js +3 -0
  76. package/src/command-specs/repository-secrets.js +171 -0
  77. package/src/command-specs/spaces.js +3 -3
  78. package/src/runtime/agent-credential.js +175 -0
  79. package/src/runtime/agent-identity.js +95 -19
  80. package/src/runtime/app-platform.js +8 -0
  81. package/src/runtime/auth-recovery.js +14 -0
  82. package/src/runtime/profiles.js +74 -2
  83. package/src/runtime/skill-sync/cloud-client.ts +33 -3
  84. package/src/runtime/skill-sync/index.ts +4 -3
  85. package/src/runtime/skill-sync/symlink-manager.ts +354 -35
  86. package/src/runtime/skill-sync/types.ts +14 -2
  87. package/src/runtime/space-functions.js +213 -0
  88. package/src/runtime/space-platform.js +12 -3
  89. package/src/runtime/space-source.js +116 -13
  90. package/src/runtime/space-test-server.js +22 -4
  91. package/src/runtime/space-verification.js +3 -1
  92. package/src/runtime/transport.js +15 -0
  93. package/dist/sdk/src/components/NotisCommentBoundary.tsx +0 -132
  94. package/dist/space-sdk/dist/chunk-I4Z4UFGB.js +0 -3
  95. package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -26
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * The comment pane and its pieces, rendered from a `useComments` controller:
3
3
  *
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
4
+ * - `CommentPane`: the comments of the view in the host Comments panel beside the chat (one header row with New comment,
5
+ * the filter and the "..." menu holding Copy changes, the new comment box with its To chip, the thread cards and the
6
+ * Undo toast). It draws nothing inside the Space, and nothing at all while the host shows no
7
7
  * comments (`hostComments`). Threads come flat, newest first; on the Space home (no scope) they group by page. Pass
8
8
  * `order` and `groupBy` to list them your way.
9
9
  * - `CommentPins`: the numbered pins and zones on the anchor element. Put it inside the element the comments sit on (a
@@ -11,12 +11,13 @@
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
- * 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`).
17
+ * once with Undo, as the viewer's rights allow. It starts with where it sits (the quoted words, or "Whole page", a point,
18
+ * the items, a moment), with Done and "..." at its top right. Each comment names who wrote it on two lines beside the
19
+ * avatar; an agent's avatar carries its app's logo, and its name opens a card with what it ran on. A band name reads
20
+ * "Fred And The Machine" (`agentDisplayName`). Where a reply goes is said once, by the reply box.
20
21
  *
21
22
  * Files: with an Attachments files column and a host that uploads (`runtime.spaceFiles`), a new comment and a reply take
22
23
  * pictures and files: paste, drop on the box or the paperclip (`commentFiles`). Otherwise the boxes take text only.
@@ -28,8 +29,9 @@
28
29
  import React, { type KeyboardEvent as ReactKeyboardEvent } from 'react';
29
30
  import type { KeySpec } from '../../words';
30
31
  import { type CommentRecord, type CommentThread } from './commentModel';
32
+ import { type CommentFilesState } from './commentFiles';
31
33
  import { type CommentListOptions } from './paneParts';
32
- import type { CommentController } from './useComments';
34
+ import type { CommentController, CommentFile } from './useComments';
33
35
  export interface CommentAvatarProps {
34
36
  author: string;
35
37
  /** The person using the Space: their avatar is filled, everyone else's is quiet. */
@@ -54,17 +56,89 @@ export declare function sendsOnEnter(event: ReactKeyboardEvent<HTMLTextAreaEleme
54
56
  export interface CommentThreadCardProps {
55
57
  controller: CommentController;
56
58
  thread: CommentThread;
57
- /** Name the anchor in the card's meta line (when the pane lists every anchor). */
59
+ /** Name the anchor where the card says where it sits (when the pane lists every anchor). */
58
60
  showAnchor?: boolean;
61
+ /** The words a passage pane quotes for this thread (default: the comment's own passage), and whether they are gone. */
62
+ passageQuote?: string | null;
63
+ passageGone?: boolean;
64
+ /** Where the thread sits when it quotes no words (default: its point, its moment, its items or "Whole page"). */
65
+ placeLabel?: string | null;
66
+ /** A press on the card. Default: `controller.selectThread(thread)`. */
67
+ onSelect?(thread: CommentThread): void;
59
68
  }
60
- export declare function CommentThreadCard({ controller, thread, showAnchor }: CommentThreadCardProps): React.JSX.Element;
61
- export interface NewCommentBoxProps {
69
+ /** The options of the first question of a thread still waiting for a pick, for the card's Enter and 1 to 9 keys. */
70
+ export declare function commentWaitingChoices(thread: CommentThread): {
71
+ comment: CommentRecord;
72
+ options: string[];
73
+ recommended: string | null;
74
+ } | null;
75
+ /**
76
+ * Who holds a comment thread, as its reply box names it ("Reply to Claude"): the agent outside Notis that holds it, else
77
+ * what runs the thread a reply goes to. Null while that is not known or names nothing (the box then reads "Reply").
78
+ */
79
+ export declare function commentThreadHolder(controller: CommentController, thread: CommentThread): {
80
+ who: string;
81
+ outside: boolean;
82
+ harness: string | null;
83
+ to: string;
84
+ } | null;
85
+ /**
86
+ * One comment thread as a card, the same in every comments list:
87
+ *
88
+ * - First, where it sits: the quoted words on one or two lines ("Passage changed" once they are gone from the page), or
89
+ * "Whole page", "Point 1 on <item>", the items, the moment.
90
+ * - Done (a check; Unarchive on an archived thread) and "..." at the top right: Copy link, Change who it goes to, Edit
91
+ * and Delete. Quiet until the card is hovered, focused or selected; always shown on a touch screen.
92
+ * - Each comment starts with two lines beside its avatar: the name, then the agent's thread and the time in a quieter
93
+ * line. Its words, pictures and question take the card's full width under that block. A reply keeps Copy link, Edit
94
+ * and Delete in one "..." of its own.
95
+ * - No mark on a comment not read yet. The person's latest word in a thread an agent outside Notis holds carries the
96
+ * chat bubble's check after its time: one until that agent has read it, two after.
97
+ * - Where a reply goes is said once, by the reply box ("Reply to The Paper Lanterns").
98
+ *
99
+ * While the card is selected and a question of it waits, Enter picks the recommended option and 1 to 9 an option by
100
+ * its position (the number after the last option is Other).
101
+ */
102
+ export declare function CommentThreadCard({ controller, thread, showAnchor, passageQuote, passageGone, placeLabel, onSelect }: CommentThreadCardProps): React.JSX.Element;
103
+ export interface NewCommentFrameProps {
62
104
  controller: CommentController;
105
+ /** The box's accessible name: what the new comment is on ("New comment on Slide 2"). */
106
+ label: string;
107
+ /** The words it quotes, or where it sits when it quotes none ("Whole page", the items, a moment). */
108
+ quote: string | null;
109
+ place: string | null;
110
+ /** Changes when the box starts another comment: it takes the caret and scrolls into view again. */
111
+ where: string | null;
112
+ body: string;
113
+ setBody(text: string): void;
114
+ files: CommentFilesState;
115
+ /** Saves the comment with its uploaded files. True once saved. */
116
+ save(text: string, files: CommentFile[]): Promise<boolean>;
117
+ /** Drops the new comment. */
118
+ cancel(): void;
119
+ /** The last save failed: the box says so. */
120
+ failed?: boolean;
121
+ sending?: boolean;
122
+ /**
123
+ * Where the box's draft is kept (`commentDrafts`): the files the host's composer holds are kept there too, so they
124
+ * come back after the pane was away or a save failed. Without it they live in the composer only.
125
+ */
126
+ draftKey?: string | null;
63
127
  }
64
128
  /**
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).
129
+ * The box of a new comment, the same for a pin, items, a moment, the whole page and quoted words. It is the chat box's
130
+ * parts: where it goes is its first pill ("To Deck polish", which opens the picker), then the words it quotes or its
131
+ * place, inside the text field; no title, no grey quote box and no Cancel button. Escape drops an empty box (with text,
132
+ * the first Escape leaves the field); a touch screen, which has no Escape, has a small cross on the pill line.
133
+ *
134
+ * The host draws its own composer in the box when it draws comment boxes (`useHostComposer`); otherwise the pane keeps
135
+ * this plain box with the same parts, where an @ typed first opens the thread picker.
67
136
  */
137
+ export declare function NewCommentFrame({ controller, label, quote, place, where, body, setBody, files, save, cancel, failed, sending, draftKey }: NewCommentFrameProps): React.JSX.Element;
138
+ export interface NewCommentBoxProps {
139
+ controller: CommentController;
140
+ }
141
+ /** The box for the comment `controller.draftPin` started: a pin, a zone, items, a moment or the whole page. */
68
142
  export declare function NewCommentBox({ controller }: NewCommentBoxProps): React.JSX.Element | null;
69
143
  export interface CommentPinsProps {
70
144
  controller: CommentController;
@@ -94,8 +168,9 @@ export interface CommentToolBarProps {
94
168
  /**
95
169
  * 'overlay' (default): the bar floats over the top left of its positioned parent (the page card), with an inset, and
96
170
  * 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.
171
+ * 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
172
+ * the layer root (as menus do), so no parent that clips its overflow hides it (SPC-464). 'inline': it sits in the
173
+ * flow where the Space puts it.
99
174
  */
100
175
  place?: 'overlay' | 'inline';
101
176
  className?: string;
@@ -44,7 +44,10 @@ export interface PassageCommentPaneProps extends Omit<CommentListOptions, 'order
44
44
  * the order of the fields and their words), as panes beside a document often want.
45
45
  */
46
46
  order?: CommentOrder | 'reading';
47
- /** Closes the pane: shows a close button in its heading. */
47
+ /**
48
+ * Kept for Spaces written before the host drew the Comments panel: the panel's own header row has the close button,
49
+ * so the pane draws none and never calls this.
50
+ */
48
51
  onClose?(): void;
49
52
  /** The heading. Default "Comments". */
50
53
  title?: 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 {
@@ -49,8 +50,9 @@ export declare function CommentAgentRuntimeCard({ name, view }: {
49
50
  }): React.JSX.Element;
50
51
  /**
51
52
  * 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.
53
+ * reaches it; its accessible name says everything the card shows). An agent outside Notis has no recorded runtime: its
54
+ * harness logo shows when it said which harness runs it (SPC-537), named on hover. Nothing on a person's comment or an
55
+ * agent with neither.
54
56
  */
55
57
  export declare function CommentAgentBadge({ controller, comment }: {
56
58
  controller: CommentController;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Comment drafts kept for the session: the text of a new comment, a reply or an answer, its
3
+ * attached files (the pane's own chips, or the files the host's composer holds) and where a new comment goes. A comment box unmounts whenever the page's comments leave the host panel
4
+ * (another Space opens, a record page covers the view, a brief replaces the deck); what was typed comes back when the
5
+ * box shows again. Keys name the Space, the comments table and page (`draftScope`) and the box (a thread's reply, the
6
+ * new comment, an ask's answer). A send that saves, Cancel, and Escape on an empty box forget their draft.
7
+ *
8
+ * The store sits on `globalThis`, so two copies of the SDK in one page (two Space bundles) share it.
9
+ *
10
+ * In memory unless the host gives a place to keep them (`keepCommentDraftsIn`, the Portal's per-person draft storage):
11
+ * then the text, where a new comment goes and who it goes to also survive a reload of the browser, as a chat draft
12
+ * does. Files are never stored: a file's bytes stay in the page that picked it. The place is shared by every tab of
13
+ * the person: a tab writes only the drafts it changed, so a draft being written in another tab stays.
14
+ */
15
+ /** A file attached to a draft: kept whole, so a picture's preview and an upload cut short can start again. */
16
+ export interface StoredCommentFile {
17
+ name: string;
18
+ file: File;
19
+ state: 'uploading' | 'ready' | 'failed';
20
+ uploaded: unknown;
21
+ error: string | null;
22
+ retryable: boolean;
23
+ }
24
+ export interface StoredCommentDraft {
25
+ text?: string;
26
+ files?: readonly StoredCommentFile[];
27
+ /** The files the host's own composer holds for this box (`useHostComposer`): not uploaded yet, they go up on Send. */
28
+ hostFiles?: readonly File[];
29
+ /** Where a new comment goes (its pin, a passage): kept only while the draft has text or files. */
30
+ place?: unknown;
31
+ }
32
+ /** Where the host keeps the drafts between page loads: one string under one key (`Storage`'s shape). */
33
+ export interface CommentDraftStorage {
34
+ getItem(key: string): string | null;
35
+ setItem(key: string, value: string): void;
36
+ removeItem(key: string): void;
37
+ }
38
+ /** Writes the drafts to the host's storage now (the page is going away). */
39
+ export declare function flushCommentDrafts(): void;
40
+ /**
41
+ * The host gives the drafts a place between page loads (null: in memory only, and the drafts of the person before
42
+ * are forgotten). What the storage holds comes back at once; a draft this page already holds wins over a stored one.
43
+ */
44
+ export declare function keepCommentDraftsIn(storage: CommentDraftStorage | null): void;
45
+ /** True when a draft holds something worth bringing back. */
46
+ export declare function hasDraftContent(draft: StoredCommentDraft | undefined): boolean;
47
+ export declare function readCommentDraft(key: string | null | undefined): StoredCommentDraft | undefined;
48
+ /** Merges `change` into the draft at `key`; a draft left with nothing in it is forgotten. */
49
+ export declare function writeCommentDraft(key: string | null | undefined, change: Partial<StoredCommentDraft>): void;
50
+ export declare function forgetCommentDraft(key: string | null | undefined): void;
51
+ /** Forgets every draft (tests). */
52
+ export declare function clearCommentDrafts(): void;
53
+ /** The files the host's composer held in the box at `key` when it went away, to attach again. */
54
+ export declare function readHostDraftFiles(key: string | null | undefined): readonly File[];
55
+ /** Keeps the files the host's composer holds in the box at `key`; none forgets them (sent, removed, dropped). */
56
+ export declare function writeHostDraftFiles(key: string | null | undefined, files: readonly File[]): void;
57
+ /** The draft key of one box under a controller's `draftScope`, or null when the controller keeps no drafts. */
58
+ export declare function commentDraftKey(scope: string | null | undefined, box: string): string | null;
59
+ /**
60
+ * The text of a comment box, kept in the session store under `key` (null: kept in the box only). It comes back when
61
+ * the box mounts again, and follows `key` when the box moves to another draft.
62
+ */
63
+ export declare function useCommentDraftText(key: string | null): [string, (value: string) => void];
@@ -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;
@@ -95,6 +56,10 @@ export interface CommentRecord {
95
56
  example: boolean;
96
57
  createdAt: string | null;
97
58
  attachments: CommentAttachment[];
59
+ /** A choice question's option its asker recommends: one of `options`, null when it names none. */
60
+ recommended?: string | null;
61
+ /** A choice question's line under an option, by option; an option without one is absent. */
62
+ optionDetails?: Readonly<Record<string, string>>;
98
63
  /** When the author edited the text, from the Edited at column (null: never, or the table has no such column). */
99
64
  editedAt?: string | null;
100
65
  /** Seconds into a recording, for a comment in time mode. */
@@ -113,6 +78,12 @@ export interface CommentRecord {
113
78
  */
114
79
  createdByYou?: boolean | null;
115
80
  createdBy?: string | null;
81
+ /** What the comment points at (its mode in the store). */
82
+ mode?: CommentMode;
83
+ /** The words a text comment sits on; null for other modes. */
84
+ passage?: CommentPassage | null;
85
+ /** The view slug it was written on. */
86
+ view?: string | null;
116
87
  }
117
88
  /**
118
89
  * What an agent ran on, as the server recorded it (`agent.runtime`): the harness (`provider`: notis, codex,
@@ -136,6 +107,12 @@ export interface CommentAgent {
136
107
  threadId: string | null;
137
108
  rowId: string | null;
138
109
  runtime?: CommentAgentRuntime | null;
110
+ /** An agent outside Notis (declared on a Notis CLI call): the thread it said it works in ("PR #3851"). */
111
+ threadName?: string | null;
112
+ /** An agent outside Notis: the harness that runs it (claude_code, codex, cursor_agent...), for its logo. */
113
+ harness?: string | null;
114
+ /** True for an agent outside Notis (SPC-535): a thread it holds wakes nobody in Notis. */
115
+ outside?: boolean;
139
116
  }
140
117
  /**
141
118
  * How an author or agent name shows: a band name (lowercase words and digits joined by hyphens, the name agents
@@ -171,11 +148,9 @@ export interface CommentThread {
171
148
  replies: CommentRecord[];
172
149
  anchor: CommentAnchor | undefined;
173
150
  }
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
151
  /** An http(s) link without credentials, or a site path: anything else (script URLs, `//host`) opens nothing. */
177
152
  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. */
153
+ /** A files value (`{ name, url }` items, `{ name, file: { url } }`, `{ name, external: { url } }` or URLs) as the pictures and files a comment shows. */
179
154
  export declare function commentAttachmentList(value: unknown): CommentAttachment[];
180
155
  /** The picture a choice option names (same label, any case), when there is one. */
181
156
  export declare function commentAttachmentFor(option: string, attachments: readonly CommentAttachment[]): CommentAttachment | undefined;
@@ -187,29 +162,28 @@ export type CommentBodyPart = {
187
162
  label: string;
188
163
  };
189
164
  export declare function commentBodyParts(body: string): CommentBodyPart[];
165
+ /** The store's status as the pane names it: open, archived, deleted read as Open, Resolved (shown Done), Deleted. */
166
+ export declare function commentStatusOf(status: SpaceCommentStatus | string | null | undefined): CommentStatus;
167
+ /** The pane's status as the store names it. */
168
+ export declare function storeStatusOf(status: CommentStatus): SpaceCommentStatus;
190
169
  /**
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`.
170
+ * One store row (`SpaceCommentRow`) as the comment the pane renders. An agent's comment reads as the agent (its stamped
171
+ * name); a person's as the name the server set for them. A store `change` of `edited` reads as the comment's own
172
+ * change (created or replied) with `editedAt`, so Copy changes reports it as an edit.
200
173
  */
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[];
174
+ export declare function commentFromRow(input: SpaceCommentRow | Readonly<Record<string, unknown>>): CommentRecord;
208
175
  /** Time in ms; a date without an offset is read as UTC so ordering stays stable. */
209
176
  export declare function commentTimeOf(value: string | null | undefined): number;
210
177
  /** True when the comment belongs to `scope` (by id or record key). No scope: every comment belongs. */
211
178
  export declare function inCommentScope(comment: CommentRecord, scope: Pick<CommentScope, 'id' | 'recordKey'> | null | undefined): boolean;
212
179
  export declare function commentAnchorOf(comment: CommentRecord, anchors: readonly CommentAnchor[]): CommentAnchor | undefined;
180
+ /** Every anchor the comment is on, in anchor order (an items comment is on several). */
181
+ export declare function commentAnchorsOf(comment: CommentRecord, anchors: readonly CommentAnchor[]): CommentAnchor[];
182
+ /**
183
+ * True when a comment on `anchorIds` shows under the anchor `key`: an items comment shows under each of its items
184
+ * (SPC-463). A null key is the comments on no anchor.
185
+ */
186
+ export declare function isCommentOnAnchor(anchorIds: readonly string[], key: string | null | undefined, anchors: readonly CommentAnchor[]): boolean;
213
187
  /**
214
188
  * Threads in anchor order, then by creation. Deleted replies stay in place (the card reads "Comment deleted" there so
215
189
  * the replies around it still read); deleted roots stay too (filter them to hide the whole thread).
@@ -258,11 +232,8 @@ export interface CommentDigestOptions {
258
232
  scopeNoun?: string;
259
233
  /** What an anchor is called ("Slide"): "Slide 3" and "Unknown slide". */
260
234
  anchorNoun?: string;
261
- /** The table agents insert replies into. Default "Comments". */
262
- table?: string;
263
235
  /** The reader whose answers and status changes the digest reports. Default "Flo". */
264
236
  me?: string;
265
- columns?: Partial<CommentColumns>;
266
237
  }
267
238
  /** True when the comment marks a zone (a pin with a width and a height), not a point. */
268
239
  export declare function isCommentZone(comment: Pick<CommentRecord, 'x' | 'y' | 'w' | 'h'> | null | undefined): boolean;
@@ -13,6 +13,27 @@ export declare const COMMENT_WORDS: Readonly<{
13
13
  resolvedFilter: Words;
14
14
  filter: Words;
15
15
  filterLabel: Words;
16
+ waitingForYou: Words;
17
+ waitingCount: Words;
18
+ emptyWaiting: Words;
19
+ removeFilter: Words;
20
+ paneMore: Words;
21
+ markDone: Words;
22
+ threadMore: Words;
23
+ threadMoreNamed: Words;
24
+ replyMore: Words;
25
+ replyMoreNamed: Words;
26
+ changeWho: Words;
27
+ placeWholePage: Words;
28
+ placePoint: Words;
29
+ placePointOn: Words;
30
+ placeTime: Words;
31
+ recommended: Words;
32
+ otherOption: Words;
33
+ otherOptionHint: Words;
34
+ notis: Words;
35
+ toWho: Words;
36
+ discardComment: Words;
16
37
  status: Words;
17
38
  scope: Words;
18
39
  copy: Words;
@@ -37,6 +58,7 @@ export declare const COMMENT_WORDS: Readonly<{
37
58
  unarchiveThread: Words;
38
59
  deleteThreadNamed: Words;
39
60
  copyLinkNamed: Words;
61
+ copyReplyLinkNamed: Words;
40
62
  deleteReplyOf: Words;
41
63
  deleteYourReply: Words;
42
64
  editRootNamed: Words;
@@ -45,6 +67,7 @@ export declare const COMMENT_WORDS: Readonly<{
45
67
  unarchived: Words;
46
68
  delete: Words;
47
69
  copyLink: Words;
70
+ showOnPage: Words;
48
71
  linkCopied: Words;
49
72
  linkCopyFailed: Words;
50
73
  deleteThread: Words;
@@ -120,7 +143,6 @@ export declare const COMMENT_WORDS: Readonly<{
120
143
  textChanged: Words;
121
144
  textChangedHint: Words;
122
145
  selectToComment: Words;
123
- emptyPassages: Words;
124
146
  inGroup: Words;
125
147
  closeComments: Words;
126
148
  readError: Words;
@@ -128,12 +150,19 @@ export declare const COMMENT_WORDS: Readonly<{
128
150
  ownerThread: Words;
129
151
  goesToNew: Words;
130
152
  goesToNewHarness: Words;
153
+ outsideNotis: Words;
154
+ outsideAgentTitle: Words;
155
+ replyToWho: Words;
156
+ outsideUnread: Words;
157
+ outsideRead: Words;
158
+ agentHarness: Words;
131
159
  goesToLoading: Words;
132
160
  change: Words;
133
161
  changeThread: Words;
134
162
  openLinkedThread: Words;
135
163
  toThread: Words;
136
164
  toNew: Words;
165
+ toPick: Words;
137
166
  toNewHarness: Words;
138
167
  pickThread: Words;
139
168
  linking: Words;
@@ -158,7 +187,9 @@ export declare const COMMENT_WORDS: Readonly<{
158
187
  newCommentItems: Words;
159
188
  newCommentItem: Words;
160
189
  newCommentTime: Words;
190
+ newCommentText: Words;
161
191
  itemsLabel: Words;
192
+ moreItems: Words;
162
193
  }>;
163
194
  export type CommentWordKey = keyof typeof COMMENT_WORDS;
164
195
  export type CommentWords = Readonly<Record<CommentWordKey, Words>>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Handing what a page's comments show from one mounted view to the view that takes its place.
3
+ *
4
+ * When a Space is published again the host mounts the new version beside the one on screen and swaps the two once the
5
+ * new one is ready. Comments do not depend on the page's version, so the reader's selected thread, filters, the new
6
+ * comment being placed and who it goes to must not go back to their defaults at the swap. That state is plain React
7
+ * state inside each view (`useComments`, `useCommentRouting`, `usePassageComments`, the pane's own key), so the host
8
+ * names each view with a token on its comments transport (`SpaceCommentsTransport.viewToken`) and, at the swap, calls
9
+ * `handOverCommentState(old, next)`: every hook of the new view takes the state of the hook with the same id in the
10
+ * old one. Hooks that mount a moment later (the host's own pane) take it as their first state, for a few seconds.
11
+ *
12
+ * Nothing here runs without a token: a pane on a host that names no view keeps its state to itself, as before.
13
+ */
14
+ /** How long a hook that mounts after the swap still takes the old view's state as its own first state. */
15
+ export declare const COMMENT_HANDOVER_CLAIM_MS = 10000;
16
+ /** Copies the comment state of the view named `from` to the view named `to` (see the file's note). */
17
+ export declare function handOverCommentState(from: object, to: object): void;
18
+ /** The state handed to the view named `group` under `id` a moment ago, for a hook's first state; else undefined. */
19
+ export declare function inheritedCommentState<S>(group: object | null | undefined, id: string | null | undefined): S | undefined;
20
+ /**
21
+ * Lists the calling hook under `id` in the view named `group` while it is mounted: `take` reads its state for the
22
+ * view that replaces this one, `give` receives the state of the view this one replaces.
23
+ */
24
+ export declare function useCommentHandover<S>(group: object | null | undefined, id: string | null | undefined, take: () => S, give: (state: S) => void): void;
25
+ /** The token the host names the calling view with (`SpaceCommentsTransport.viewToken`), or null. */
26
+ export declare function useCommentViewToken(): object | null;
27
+ /**
28
+ * The key the host draws a pane under (`usePaneOutlet`): its own, or the key of the pane it replaces when a new
29
+ * version of the view took the old one's place, so React keeps the pane's elements. `kind` tells a pane on pins from
30
+ * a pane on passages.
31
+ */
32
+ export declare function useHandedPaneKey(controller: {
33
+ draftScope: string;
34
+ }, kind: string): string;
@@ -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;