@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,37 +1,32 @@
1
1
  /**
2
- * The comment controller: reads a Comments database through the view's declared list, follows its live feed, writes
3
- * through the normal native mutations and keeps every change on screen at once (optimistic patches and drafts) until
4
- * the server rows carry it. `CommentPane`, `CommentPins`, `CommentToolBar` and `CommentThreadCard` render from it.
2
+ * The comment controller: reads the page's comments from the Space's one comment store through the host Comments
3
+ * transport (`runtime.spaceComments`), lists them again whenever the host says they may have changed, writes through
4
+ * the same transport and keeps every change on screen at once (optimistic patches and drafts) until the stored row
5
+ * comes back. `CommentPane`, `CommentPins` and `CommentToolBar` render from it.
5
6
  *
6
- * People archive (Status `Resolved`, shown Done) and delete at once with a 6-second Undo toast and Z (SPC-124,
7
- * SPC-133); agents never archive through it. Deleting a first comment deletes its thread; a later one leaves a "Comment
8
- * deleted" line (SPC-127). Rights come from the host's viewer (SPC-128): you edit and delete your own comments, and a
9
- * whole thread or someone else's comment needs Space edit rights. Without a viewer nothing can be edited or deleted.
10
- * Under the host Comments panel a comment is written as the viewer (their name in Author, which the server stamps too)
11
- * and nothing can be sent until the viewer is known (`canWrite`).
7
+ * People archive (shown Done) and delete at once with a 6-second Undo toast and Z (SPC-124, SPC-133); agents never
8
+ * archive through it. Deleting a first comment deletes its thread; a later one leaves a "Comment deleted" line
9
+ * (SPC-127). Rights come from the host's viewer (SPC-128): you edit and delete your own comments, and a whole thread or
10
+ * someone else's comment needs Space edit rights. Without a viewer nothing can be sent, edited or deleted. Without the
11
+ * transport (comments off, a Site, a link, a preview, an older host) there are no comments at all.
12
12
  */
13
13
  import { type MouseEvent as ReactMouseEvent, type PointerEvent as ReactPointerEvent } from 'react';
14
- import { type SpaceCommentViewer } from '../../space';
14
+ import { type SpaceCommentAnchor, type SpaceCommentViewer } from '../../space';
15
15
  import { type Locale, type Words } from '../../words';
16
16
  import { type ToastController } from '../actions/useToast';
17
- import { type CommentAnchor, type CommentColumns, type CommentDigestOptions, type CommentGroup, type CommentRecord, type CommentScope, type CommentThread } from './commentModel';
17
+ import { type CommentAnchor, type CommentDigestOptions, type CommentGroup, type CommentMode, type CommentPassage, type CommentRecord, type CommentScope, type CommentThread } from './commentModel';
18
18
  import { type CommentWordKey, type CommentWords } from './commentWords';
19
19
  import { type CommentRouting } from './useCommentRouting';
20
20
  /** Which threads the pane lists: the current anchor's, or every thread in the scope. */
21
21
  export type CommentAnchorFilter = 'anchor' | 'all';
22
- /** Open threads (default), archived ones (Done, stored as `Resolved`) or both (SPC-126): what the pane shows. */
22
+ /** Open threads (default), archived ones (Done) or both (SPC-126): what the pane shows. */
23
23
  export type CommentStatusView = 'open' | 'done' | 'all';
24
24
  /** A status filter as `setStatusFilter` takes it: 'resolved' is an older name of 'done' and reads as 'done'. */
25
25
  export type CommentStatusFilter = CommentStatusView | 'resolved';
26
- /**
27
- * What a new comment points at (SPC-118): words of the text, a point or a box on an anchor, some items (records or
28
- * rows), a moment of a recording, or the whole page (no anchor).
29
- */
30
- export type CommentMode = 'text' | 'point' | 'box' | 'items' | 'time' | 'page';
31
26
  /**
32
27
  * A new comment being written: on an anchor, with a pin (x and y, 0 to 1), a zone (w and h too, 0 to 1 of the
33
28
  * anchor's size) or neither (on the whole anchor; `anchorKey` null: on the whole page). `items` lists the record keys
34
- * (records or rows) of an items comment, `time` the seconds of a time comment.
29
+ * (records or rows) of an items comment, `time` the seconds of a time comment, `text` the words of a text comment.
35
30
  */
36
31
  export interface CommentDraftPin {
37
32
  anchorKey: string | null;
@@ -41,6 +36,7 @@ export interface CommentDraftPin {
41
36
  h: number | null;
42
37
  items?: readonly CommentAnchor[] | null;
43
38
  time?: number | null;
39
+ text?: CommentPassage | null;
44
40
  }
45
41
  /** The zone being dragged on an anchor, 0 to 1 of its size. */
46
42
  export interface CommentDragZone {
@@ -58,13 +54,16 @@ export interface CommentZoneHandlers {
58
54
  onPointerCancel(event: ReactPointerEvent<HTMLElement>): void;
59
55
  }
60
56
  /**
61
- * A file uploaded for a comment that is not sent yet: `name` and `url` go into the Attachments column, `previewUrl`
62
- * shows it until the saved comment is read back.
57
+ * A file uploaded for a comment that is not sent yet: what the host's upload returned (`path`, `type` and `size` go
58
+ * back with the comment), `previewUrl` shows it until the saved comment is read back.
63
59
  */
64
60
  export interface CommentFile {
65
61
  name: string;
66
62
  url: string;
67
63
  previewUrl?: string | null;
64
+ path?: string | null;
65
+ type?: string | null;
66
+ size?: number | null;
68
67
  }
69
68
  /** Whether new comments and replies can carry pictures and files. */
70
69
  export type CommentAttachMode = 'on' | 'off' | 'checking';
@@ -75,9 +74,9 @@ export interface CommentActions {
75
74
  * when a reply waits for someone). True once saved.
76
75
  */
77
76
  reply(thread: CommentThread, body: string, files?: readonly CommentFile[], answers?: CommentRecord): Promise<boolean>;
78
- /** Answers a check or choice ask. */
79
- answer(root: CommentRecord, answer: string): void;
80
- /** Writes the status without a toast. People archive with `archive` and `unarchive`. */
77
+ /** Answers a check or choice ask with one of its options. The answer shows at once; true once saved, false when refused. */
78
+ answer(root: CommentRecord, answer: string): Promise<boolean>;
79
+ /** Archives (Resolved) or brings back (Open) a thread without a toast. People archive with `archive` and `unarchive`. */
81
80
  setStatus(root: CommentRecord, status: 'Open' | 'Resolved'): void;
82
81
  /** Archives an open thread (Done) with a 6-second Undo toast; Z undoes. */
83
82
  archive(root: CommentRecord): void;
@@ -90,14 +89,10 @@ export interface CommentActions {
90
89
  remove(comment: CommentRecord): void;
91
90
  /** Same as `remove` on a thread's first comment. */
92
91
  askDelete(root: CommentRecord): void;
93
- /**
94
- * Saves new text for your own comment and marks it edited (Edited at, which Copy changes reports). Change keeps what
95
- * it said (an archive or an answer is never overwritten); without an Edited at column Change and Changed at mark the
96
- * edit unless they say resolved or answered. True once saved (or unchanged).
97
- */
92
+ /** Saves new text for your own comment (the server marks it edited, which Copy changes reports). True once saved. */
98
93
  edit(comment: CommentRecord, body: string): Promise<boolean>;
99
94
  /**
100
- * Copies the link that opens this page with the thread revealed (`comment=<root key>`, as a push or a chat pill
95
+ * Copies the link that opens this page with the thread revealed (`comment=<root id>`, as a push or a chat pill
101
96
  * opens it): the host's address for it (`commentLink`), else the page's own address with that param. A toast says
102
97
  * Link copied, or that it could not be copied. `host` (the card) holds the selection copy when the clipboard API is
103
98
  * refused. True once copied.
@@ -106,47 +101,35 @@ export interface CommentActions {
106
101
  notify(words: Words | string): void;
107
102
  }
108
103
  export interface UseCommentsOptions {
109
- /** The list the view declares in `shows` for the Comments database. Default 'comments'. */
110
- list?: string;
111
- /** The database alias the list reads and writes (insert and update actions). Default 'comments'. */
112
- database?: string;
113
- /** The record the comments belong to. Null: every comment is shown and none is written with a scope. */
104
+ /**
105
+ * The page (record) the comments belong to: they are read from and written on it. Default: the page the host shows
106
+ * (`spaceComments.page`), else the Space home. Null: the Space home, which lists every comment of the Space grouped
107
+ * by page and writes new ones on no page.
108
+ */
114
109
  scope?: CommentScope | null;
115
110
  /** The records threads sit on, in order. Empty: comments are not anchored. */
116
111
  anchors?: readonly CommentAnchor[];
117
112
  /** The anchor on screen (its record key): the pane's "this item" filter and where pins are placed. */
118
113
  anchorKey?: string | null;
119
- /**
120
- * The person using the Space; their comments count as changes and never as new activity. Default: the viewer's
121
- * first name from the host, and when the Author column refuses it (a choice list without that name) "Person",
122
- * then no author. Pass it to sign comments with a fixed name. Ignored under the host Comments panel: the viewer's
123
- * name is used, for reading and writing.
124
- */
125
- me?: string;
126
- /** Authors the Author select knows; anyone else reads as `fallbackAuthor`. Default: any name. */
127
- authors?: readonly string[];
128
- fallbackAuthor?: string;
129
- columns?: Partial<CommentColumns>;
130
114
  /** Wording of the digest Copy changes puts on the clipboard. */
131
115
  digest?: CommentDigestOptions;
132
116
  /** Saves the checkpoint after a copy (for example the scope's "Last turn at"). A throw rolls the checkpoint back. */
133
117
  onCheckpoint?(at: string): Promise<void>;
134
118
  /** The Space's own wording on top of the defaults. */
135
119
  words?: Partial<Record<CommentWordKey, Words>>;
136
- pageSize?: number;
137
- /** Follow the database's live feed where the host has one. Default true. */
120
+ /** Lists the comments again whenever the host says they may have changed. Default true. */
138
121
  live?: boolean;
139
122
  /** Called when a thread is picked (a pin, a card): the Space can move to its anchor and open its panel. */
140
123
  onSelectThread?(thread: CommentThread): void;
141
124
  /**
142
- * Open this comment's thread (a root or a reply key) once it is read, and scroll to it. Default: the `comment` view
125
+ * Open this comment's thread (a root or a reply id) once it is read, and scroll to it. Default: the `comment` view
143
126
  * param of a link (`useCommentFocusParam`); null turns that off.
144
127
  */
145
128
  focusKey?: string | null;
146
129
  /**
147
130
  * The comment modes the Space offers (SPC-118), in the order the New comment menu and the tool bar list them.
148
- * Default: point (and box with zone columns) when there are anchors, items and time when their call-backs are given,
149
- * and the whole page. 'items' needs `onStartItems`, 'time' needs `currentTime`.
131
+ * Default: text, then point and box when there are anchors, items and time when their call-backs are given, and the
132
+ * whole page. 'items' needs `onStartItems`, 'time' needs `currentTime`.
150
133
  */
151
134
  modes?: readonly CommentMode[];
152
135
  /**
@@ -156,10 +139,25 @@ export interface UseCommentsOptions {
156
139
  onStartItems?(): void;
157
140
  /** Time mode: the current moment of the recording, in seconds. The new comment is written at that moment. */
158
141
  currentTime?(): number | null | undefined;
159
- /** Names of the pages (scope records, by id or record key) the Space home groups comments under. */
142
+ /** Names of the pages (scope records, by record key) the Space home groups comments under. */
160
143
  scopeNames?: Readonly<Record<string, string>>;
144
+ /**
145
+ * A comment a link names, when the caller opens it itself (`focusKey` null): where the controller covers a whole
146
+ * Space its thread is read whatever its status, so the caller finds it among `threads`.
147
+ */
148
+ linkKey?: string | null;
149
+ /**
150
+ * Only these comment threads (the ids of their first comments): the others of the scope are not listed, counted or
151
+ * walked. For a host that shows a part of a Space's comments (those linked to one conversation). Default: every
152
+ * thread of the scope.
153
+ */
154
+ only?: readonly string[] | null;
161
155
  }
162
- export interface CommentController {
156
+ /**
157
+ * The comment controller. Its actions are on `actions` and, the same functions, on the controller itself
158
+ * (`controller.answer`, `controller.reply`, ...): a page that draws its own controls may call either (SPC-1465).
159
+ */
160
+ export interface CommentController extends CommentActions {
163
161
  comments: CommentRecord[];
164
162
  /** Threads in the scope, deleted ones left out, in anchor order. */
165
163
  threads: CommentThread[];
@@ -171,8 +169,8 @@ export interface CommentController {
171
169
  isNew(comment: CommentRecord): boolean;
172
170
  threadsOn(anchorKey: string | null | undefined): CommentThread[];
173
171
  /**
174
- * The thread's pin number (1-based), 0 when it has none: per page (scope record), in the order its first comments
175
- * were written, deleted ones keeping theirs, so a number never moves and reads the same on the page and the Space home.
172
+ * The thread's pin number (1-based), 0 when it has none: per page, in the order its first comments were written,
173
+ * deleted ones keeping theirs, so a number never moves and reads the same on the page and the Space home.
176
174
  */
177
175
  numberOf(thread: CommentThread): number;
178
176
  scope: CommentScope | null;
@@ -189,9 +187,22 @@ export interface CommentController {
189
187
  counts: Readonly<Record<CommentStatusView, number>>;
190
188
  /** Threads per anchor filter ("This item", "All items"), for the current status filter. */
191
189
  scopeCounts: Readonly<Record<CommentAnchorFilter, number>>;
190
+ /**
191
+ * "Waiting for you" is on: the pane lists only the open threads that wait for the viewer (`waits`), for the current
192
+ * anchor filter. Picking Open, Done or All turns it off; turning it on goes back to open threads.
193
+ */
194
+ waitingFilter: boolean;
195
+ setWaitingFilter(on: boolean): void;
196
+ /**
197
+ * Whether an open thread waits for the viewer: the host's own list when it gave one (a mention, an agent's question,
198
+ * a reply in a thread they started or replied to), else an agent's unanswered question.
199
+ */
200
+ waits(thread: CommentThread): boolean;
201
+ /** The open threads that wait for the viewer, for the current anchor filter: the one number the filter shows. */
202
+ waitingCount: number;
192
203
  /** True when the controller covers the whole Space (no scope record): the pane groups threads by page. */
193
204
  wholeSpace: boolean;
194
- /** The page a thread sits on, for grouping on the Space home: its scope record, else its anchor, else the Space. */
205
+ /** The page a thread sits on, for grouping on the Space home: its page, else its anchor, else the Space. */
195
206
  groupOf(thread: CommentThread): CommentGroup | null;
196
207
  threadKey: string | null;
197
208
  setThreadKey(key: string | null): void;
@@ -214,7 +225,7 @@ export interface CommentController {
214
225
  canEdit(comment: CommentRecord): boolean;
215
226
  /** Whether the viewer may delete it: their own comment; a whole thread or someone else's needs Space edit rights. */
216
227
  canDelete(comment: CommentRecord): boolean;
217
- /** False while the host's viewer is not known: Send stays off, so no comment is written under a wrong name. */
228
+ /** False while the host's viewer is not known (or there is no comment store): Send stays off. */
218
229
  canWrite: boolean;
219
230
  /** Threads, Goes to and the To chip (SPC-113, SPC-114, SPC-117). */
220
231
  routing: CommentRouting;
@@ -227,6 +238,13 @@ export interface CommentController {
227
238
  cancelMode(): void;
228
239
  /** Items mode: starts a new comment on these anchors (records or rows). */
229
240
  startItems(items: readonly CommentAnchor[]): void;
241
+ /** Text mode: starts a new comment on these words (of `anchorKey`'s record when given). */
242
+ placeText(passage: CommentPassage, anchorKey?: string | null): void;
243
+ /**
244
+ * Starts a new comment on a place the host names (Comment on a text selection, `SpaceCommentSource.start`). True
245
+ * when this controller took it.
246
+ */
247
+ startAnchor(anchor: SpaceCommentAnchor): boolean;
230
248
  /** Whether the page comment tool bar shows (`CommentToolBar`, C toggles it). */
231
249
  toolBar: boolean;
232
250
  setToolBar(on: boolean): void;
@@ -236,8 +254,8 @@ export interface CommentController {
236
254
  toggleCommenting(): void;
237
255
  draftPin: CommentDraftPin | null;
238
256
  /**
239
- * Names this page's comments (the Space, the table and the scope record) for the drafts the boxes keep while they are
240
- * away (`commentDrafts`): a reply, a new comment and an answer come back with what was typed and attached.
257
+ * Names this page's comments (the Space and the page) for the drafts the boxes keep while they are away
258
+ * (`commentDrafts`): a reply, a new comment and an answer come back with what was typed and attached.
241
259
  */
242
260
  draftScope: string;
243
261
  /**
@@ -247,7 +265,7 @@ export interface CommentController {
247
265
  placePin(anchorKey: string | null, x: number | null, y: number | null, w?: number | null, h?: number | null): void;
248
266
  /** In Add comment mode, drops a pin where the anchor element was clicked. True when a pin was placed. */
249
267
  placePinFromEvent(event: ReactMouseEvent<HTMLElement>, anchorKey: string | null): boolean;
250
- /** True when the table has zone columns: a drag in Add comment mode marks a zone instead of dropping a pin. */
268
+ /** True: a drag in Add comment mode marks a zone instead of dropping a pin. */
251
269
  zones: boolean;
252
270
  /** The zone being dragged, while the button is held. */
253
271
  dragZone: CommentDragZone | null;
@@ -257,6 +275,11 @@ export interface CommentController {
257
275
  cancelPin(): void;
258
276
  /** Saves the new comment with the files already uploaded for it. True once saved. */
259
277
  sendNew(body: string, files?: readonly CommentFile[]): Promise<boolean>;
278
+ /**
279
+ * Saves a new thread on `place` (a passage's own box), selects it and links it to where it goes. The new comment's
280
+ * id once saved, else null (the failure toast showed).
281
+ */
282
+ sendAt(place: CommentDraftPin, body: string, files?: readonly CommentFile[]): Promise<string | null>;
260
283
  /** @deprecated Delete happens at once with Undo (SPC-133): always null. */
261
284
  deleting: CommentRecord | null;
262
285
  /** @deprecated Nothing to cancel: delete happens at once with Undo. */
@@ -264,8 +287,8 @@ export interface CommentController {
264
287
  /** @deprecated Deletes `comment` at once with Undo (`actions.remove`); without one it does nothing. */
265
288
  confirmDelete(comment?: CommentRecord): Promise<void>;
266
289
  /**
267
- * 'on' when people can attach pictures and files: the table has the Attachments column and the host uploads files
268
- * (signed-in Editors in Notis; never on a Site, a link or a preview). 'off' leaves the pane text only.
290
+ * 'on' when people can attach pictures and files: the host uploads files for comments (signed-in people in Notis;
291
+ * never on a Site, a link or a preview). 'off' leaves the pane text only.
269
292
  */
270
293
  attach: CommentAttachMode;
271
294
  /** The largest file the host takes, in bytes. */
@@ -280,7 +303,7 @@ export interface CommentController {
280
303
  /** Copies the digest and records the checkpoint. `host` is the Space's own element, for the selection fallback. */
281
304
  copyChanges(host: HTMLElement | null): Promise<boolean>;
282
305
  copying: boolean;
283
- /** Record keys with a write in flight. */
306
+ /** Comment ids with a write in flight. */
284
307
  busy: ReadonlySet<string>;
285
308
  now: number;
286
309
  toaster: ToastController;
@@ -288,39 +311,55 @@ export interface CommentController {
288
311
  /** A word in the reader's language, with `{n}`-style values filled. */
289
312
  say(key: CommentWordKey, vars?: Readonly<Record<string, string | number>>): string;
290
313
  locale: Locale;
314
+ /** The viewer's name ('' while unknown). */
291
315
  me: string;
292
- /**
293
- * Runs one comment write signed by the viewer: with the default author, a write the Author column refuses as a
294
- * choice is tried again as "Person", then without an author, and the author that worked is kept for the session.
295
- */
316
+ /** @deprecated The server signs every comment with the viewer: runs `write` with the viewer's name. */
296
317
  signed<T>(write: (author: string | null) => Promise<T>): Promise<T>;
297
318
  /** Opens an agent's thread in the side chat; undefined on hosts without one. */
298
319
  openThread?: (threadId: string) => void;
320
+ /**
321
+ * Opens the thread's page with the thread shown on it; undefined beside the page itself (the host gives it where it
322
+ * draws comments away from their page, `spaceComments.showOnPage`).
323
+ */
324
+ showOnPage?: (rootKey: string) => void;
299
325
  loading: boolean;
300
326
  hasData: boolean;
301
327
  error: Error | null;
302
328
  refetch(): Promise<unknown>;
329
+ /**
330
+ * How many changes Copy changes would copy. Where the pane holds a part of the Space (its home), the host counts
331
+ * them; default `changes.length`.
332
+ */
333
+ changeCount?: number;
334
+ /**
335
+ * True while older Done threads are left to read, where the pane shows a whole Space and its Filter shows Done
336
+ * threads: they come a page at a time. The pane asks for the next page (`loadMore`) when its list's end is in view.
337
+ */
338
+ hasMore?: boolean;
339
+ /** Reads the next page of Done threads. Does nothing while a page is on its way. */
340
+ loadMore?(): void;
341
+ /** True while Done threads the Filter asked for are on their way: the list says it is loading, never "No comments". */
342
+ loadingMore?: boolean;
303
343
  }
304
344
  /** How long a delete's Undo toast stays on a touch screen (a coarse pointer, or a phone-width window). */
305
345
  export declare const DELETE_UNDO_TOUCH_MS = 8000;
306
346
  /**
307
347
  * The link that opens the page with one comment thread revealed: the host's (`commentLink`, a full address that names
308
- * the thread's own page, possibly later as a promise), else the page's own address with `comment=<root key>` (any
348
+ * the thread's own page, possibly later as a promise), else the page's own address with `comment=<root id>` (any
309
349
  * earlier comment param replaced). Null when neither is known.
310
350
  */
311
351
  export declare function commentLinkFor(host: {
312
352
  commentLink?(input: {
313
- rootKey: string;
314
- database?: string;
353
+ rootId: string;
315
354
  }): string | null | Promise<string | null>;
316
- } | null | undefined, rootKey: string, database?: string): string | null | Promise<string | null>;
317
- /** The neutral author a Comments database's choice list can offer for anyone it does not name. */
318
- export declare const COMMENT_PERSON_AUTHOR = "Person";
355
+ } | null | undefined, rootKey: string): string | null | Promise<string | null>;
319
356
  /**
320
- * Who signs the viewer's comments, in the order to try: a fixed `me` alone; else the viewer's first name (when the
321
- * known `authors` include it, or none are given), then "Person". Never a name that belongs to someone else.
357
+ * Where a new comment sits, in the store's words, from the draft the box shows: words of the text, items, a moment, a
358
+ * zone, a point, a whole anchor (a page comment on that anchor) or the whole page.
322
359
  */
323
- export declare function commentAuthorCandidates(fixed: string | undefined, viewerName: string | null, authors?: readonly string[]): string[];
324
- /** The Author column refused the name: it is a choice list without that option. */
325
- export declare function isRefusedChoice(error: unknown): boolean;
360
+ export declare function commentAnchorOfDraft(pin: CommentDraftPin | null | undefined): SpaceCommentAnchor;
361
+ /** The draft a place named by the host opens (the reverse of `commentAnchorOfDraft`). */
362
+ export declare function commentDraftOfAnchor(anchor: SpaceCommentAnchor, anchors?: readonly CommentAnchor[]): CommentDraftPin;
363
+ /** How many Done threads a pane that shows a whole Space asks for at a time. */
364
+ export declare const COMMENT_DONE_PAGE = 50;
326
365
  export declare function useComments(options?: UseCommentsOptions): CommentController;
@@ -5,16 +5,15 @@
5
5
  * the old quote), and the reading order. `CommentableText`, `CommentableRichText` and `PassageCommentPane` render from
6
6
  * it. Its modes default to text (a selection) and the whole page.
7
7
  */
8
- import { type CommentThread } from './commentModel';
8
+ import type { SpaceCommentAnchor } from '../../space';
9
+ import type { CommentThread } from './commentModel';
9
10
  import { type CommentController, type CommentFile, type UseCommentsOptions } from './useComments';
10
- import { type PassageAnchor, type PassageColumns, type PassageField } from './passageModel';
11
+ import { type PassageAnchor, type PassageField } from './passageModel';
11
12
  /** Where a thread was opened: its highlight in the text, its card or its quote in the pane, or a link to one comment. */
12
13
  export type PassageOpenedFrom = 'passage' | 'pane' | 'quote' | 'link';
13
14
  export interface UsePassageCommentsOptions extends Omit<UseCommentsOptions, 'anchors' | 'anchorKey' | 'onSelectThread'> {
14
15
  /** The text properties comments can sit on, in reading order. */
15
16
  fields: readonly PassageField[];
16
- /** Column names of the passage (Field, Quote, Prefix, Suffix by default). */
17
- passageColumns?: Partial<PassageColumns>;
18
17
  /**
19
18
  * Each field's value as edited on screen, by field key: a thread whose words are no longer there reads Text
20
19
  * changed, and threads list in reading order. A field left out is never marked changed.
@@ -53,6 +52,11 @@ export interface PassageCommentController {
53
52
  /** The comment being placed or written on the page (the New comment menu): the same as `controller.draftPin`. */
54
53
  draftPin: CommentController['draftPin'];
55
54
  startDraft(passage: PassageAnchor): void;
55
+ /**
56
+ * Starts a new comment on a place the host names (Comment on a selection): words in one of `fields` open this
57
+ * controller's own box on them, anything else the page's new comment. True when it was taken.
58
+ */
59
+ startAnchor(anchor: SpaceCommentAnchor): boolean;
56
60
  cancelDraft(): void;
57
61
  /**
58
62
  * Saves the draft with its text and the pictures and files attached to it (SPC-131: paste, drop or the paperclip),
@@ -23,7 +23,7 @@ export type { AdoptToolkitOptions, ToolkitCascade } from './styles';
23
23
  export { COMPARES, DEFAULT_COMPARE, DEFAULT_PRESET, EXTRA_PRESETS, PRESETS, compareRange, customPeriod, dayCount, formatPeriodParam, fromIsoDay, isCompareId, isPresetId, normalizePeriod, parsePeriodParam, periodRanges, presetRange, samePeriod, toIsoDay, } from './period/periods';
24
24
  export type { CompareId, DateRange as PeriodRange, Period, PresetId } from './period/periods';
25
25
  export { dayNumberLabel, formatDateRange, formatDayHeading, formatDelta, formatDuration, formatLongDay, formatMonthYear, formatNumber, formatShortDay, formatValue, intlLocale, weekdayNames, } from './period/dateFormat';
26
- export type { Delta, DeltaTone, FormatDurationOptions } from './period/dateFormat';
26
+ export type { DayHeadingOptions, Delta, DeltaTone, FormatDurationOptions, InSentenceOptions } from './period/dateFormat';
27
27
  export { CALENDAR_WORDS, CHART_WORDS, COMPARE_WORDS, HEATMAP_WORDS, PERIOD_WORDS, PRESET_WORDS, TIMELINE_WORDS, VS_WORDS, } from './period/dateWords';
28
28
  export { usePeriod } from './period/usePeriod';
29
29
  export type { UsePeriodOptions, UsePeriodResult } from './period/usePeriod';
@@ -24,10 +24,9 @@ export interface SidePaneProps {
24
24
  /** The page. */
25
25
  children: ReactNode;
26
26
  /**
27
- * The pane, always shown: beside the page while both fit, after it otherwise. A retired comment pane
28
- * (`CommentPane`, `PassageCommentPane`) shows nothing here: the host Comments panel lists its threads. Only a
29
- * direct `<CommentPane />` or `<PassageCommentPane />` element passed as `pane` is detected; one wrapped in another
30
- * element or component keeps its pane column like any other pane.
27
+ * The pane, always shown: beside the page while both fit, after it otherwise. Comments are not a pane: they
28
+ * show in the host Comments panel. A direct `<CommentPane />` or `<PassageCommentPane />` passed here (Spaces built
29
+ * before the single comment store) renders nothing, so the page takes the whole row.
31
30
  */
32
31
  pane: ReactNode;
33
32
  /** The page never gets narrower than this beside the pane. */
@@ -17,19 +17,38 @@ export declare function formatDay(fmt: Intl.DateTimeFormat, date: Date, locale:
17
17
  * share shows once ("Oct 1 to 15, 2026" / "1er au 15 oct. 2026"). One day reads as that day.
18
18
  */
19
19
  export declare function formatDateRange(range: DateRange, locale: Locale, options?: Intl.DateTimeFormatOptions): string;
20
- /** One day, long: "Monday, January 5, 2026" / "Lundi 5 janvier 2026". */
21
- export declare function formatLongDay(date: Date, locale: Locale): string;
20
+ export interface InSentenceOptions {
21
+ /**
22
+ * The words sit inside a sentence ("depuis le jeudi 19 novembre 2026"): French keeps its weekdays and months in
23
+ * lower case, English stays capitalised ("since Thursday, November 19, 2026"). Default false: the text starts a
24
+ * heading, a title or a label, so its first letter is upper case in both languages.
25
+ */
26
+ inSentence?: boolean;
27
+ }
28
+ export interface DayHeadingOptions extends InSentenceOptions {
29
+ /** The year left out of the heading. Default the current year. */
30
+ thisYear?: number;
31
+ }
32
+ /**
33
+ * One day, long: "Monday, January 5, 2026" / "Lundi 5 janvier 2026". Inside a sentence pass `{ inSentence: true }`:
34
+ * "publiée le lundi 5 janvier 2026".
35
+ */
36
+ export declare function formatLongDay(date: Date, locale: Locale, options?: InSentenceOptions): string;
22
37
  /**
23
38
  * A day heading (the agenda, meeting days): "Monday, October 19" / "Lundi 19 octobre", with the year when it is not
24
- * `thisYear` ("Friday, January 1, 2027").
39
+ * `thisYear` ("Friday, January 1, 2027"). The third argument is `thisYear` or `{ thisYear, inSentence }`; inside a
40
+ * sentence it reads "au plus haut le lundi 19 octobre".
25
41
  */
26
- export declare function formatDayHeading(date: Date, locale: Locale, thisYear?: number): string;
42
+ export declare function formatDayHeading(date: Date, locale: Locale, thisYearOrOptions?: number | DayHeadingOptions): string;
27
43
  /** One day, short: "Jan 5" / "5 janv.". */
28
44
  export declare function formatShortDay(date: Date, locale: Locale): string;
29
- /** "January 2026" / "Janvier 2026". */
30
- export declare function formatMonthYear(date: Date, locale: Locale): string;
31
- /** Seven weekday names starting Monday. `narrow` for the day picker, `short` for grids. */
32
- export declare function weekdayNames(locale: Locale, width?: 'narrow' | 'short' | 'long'): string[];
45
+ /** "January 2026" / "Janvier 2026"; inside a sentence (`{ inSentence: true }`) "depuis octobre 2026". */
46
+ export declare function formatMonthYear(date: Date, locale: Locale, options?: InSentenceOptions): string;
47
+ /**
48
+ * Seven weekday names starting Monday. `narrow` for the day picker, `short` for grids, both column heads. A `long`
49
+ * name inside a sentence takes `{ inSentence: true }`: "le mercredi".
50
+ */
51
+ export declare function weekdayNames(locale: Locale, width?: 'narrow' | 'short' | 'long', options?: InSentenceOptions): string[];
33
52
  /** The number in a month cell: the first of a month carries the month name ("Feb 1" / "1er févr."). */
34
53
  export declare function dayNumberLabel(date: Date, locale: Locale, short?: boolean): string;
35
54
  /** A number in the locale ("1,020" / "1 020"). */