@notis_ai/cli 0.2.33 → 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 (56) hide show
  1. package/README.md +1 -2
  2. package/dist/agent-hooks/notis-agent-hook.mjs +82 -19
  3. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  4. package/dist/base-skills/notis-cli/SKILL.md +1 -1
  5. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  6. package/dist/base-skills/notis-spaces/references/comments.md +11 -3
  7. package/dist/sdk/src/components/NotisSelectionBoundary.tsx +13 -5
  8. package/dist/sdk/src/components/SelectionActionBar.tsx +3 -1
  9. package/dist/sdk/src/components/SpaceTextComments.tsx +13 -4
  10. package/dist/sdk/src/components/selectionRange.ts +65 -0
  11. package/dist/sdk/src/config.ts +1 -1
  12. package/dist/sdk/src/functions.ts +17 -2
  13. package/dist/sdk/src/hooks/useCollectionInteractions.ts +59 -7
  14. package/dist/sdk/src/index.ts +4 -3
  15. package/dist/sdk/src/interactions/shortcuts.tsx +6 -1
  16. package/dist/sdk/src/interactions/swipeDownToDismiss.ts +158 -0
  17. package/dist/sdk/src/interactions/textBoxTwoState.ts +174 -0
  18. package/dist/sdk/src/interactions.ts +17 -0
  19. package/dist/sdk/src/space.ts +73 -5
  20. package/dist/skill-sync/index.js +23 -1
  21. package/dist/skill-sync-worker.mjs +62 -3
  22. package/dist/space-harness/host.js +351 -237
  23. package/dist/space-sdk/dist/chunk-3NPBCE6E.js +3 -0
  24. package/dist/space-sdk/dist/index.js +2 -2
  25. package/dist/space-sdk/dist/ui.js +16 -12
  26. package/dist/space-sdk/src/config.ts +1 -1
  27. package/dist/space-sdk/src/functions.ts +17 -2
  28. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +5 -0
  29. package/dist/space-sdk/src/index.d.ts +3 -3
  30. package/dist/space-sdk/src/interactions/shortcuts.d.ts +5 -0
  31. package/dist/space-sdk/src/space.ts +73 -5
  32. package/dist/space-sdk/src/tailwind-candidates.d.ts +234 -71
  33. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +86 -14
  34. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +4 -1
  35. package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +0 -6
  36. package/dist/space-sdk/src/ui/comments/commentDrafts.d.ts +63 -0
  37. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +4 -0
  38. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +23 -1
  39. package/dist/space-sdk/src/ui/comments/handover.d.ts +34 -0
  40. package/dist/space-sdk/src/ui/comments/hostPanel.d.ts +113 -0
  41. package/dist/space-sdk/src/ui/comments/index.d.ts +6 -1
  42. package/dist/space-sdk/src/ui/comments/paneOutlet.d.ts +33 -0
  43. package/dist/space-sdk/src/ui/comments/paneParts.d.ts +54 -32
  44. package/dist/space-sdk/src/ui/comments/reviewRun.d.ts +190 -0
  45. package/dist/space-sdk/src/ui/comments/useComments.d.ts +52 -3
  46. package/dist/view-renderer/dist/host.js +413 -299
  47. package/package.json +3 -3
  48. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +1 -1
  49. package/src/runtime/agent-identity.js +3 -4
  50. package/src/runtime/app-platform.js +1 -1
  51. package/src/runtime/profiles.js +59 -2
  52. package/src/runtime/skill-sync/cloud-client.ts +33 -3
  53. package/src/runtime/skill-sync/index.ts +1 -1
  54. package/src/runtime/skill-sync/types.ts +4 -1
  55. package/src/runtime/space-functions.js +5 -3
  56. package/dist/space-sdk/dist/chunk-4GWS2IFO.js +0 -3
@@ -0,0 +1,190 @@
1
+ /**
2
+ * The review run: one comment after the other. With "Waiting for you" on, the pane lists the comment threads that wait
3
+ * for the viewer; an answer, Done or a sent reply takes the next step, and J and K move between cards. The host (the
4
+ * Portal) knows what the pane cannot: whether a run is going, how many wait in its scope, whether another page follows
5
+ * this one and what the person's setting says. They share this module (`@notis/sdk/ui` is one instance for both).
6
+ *
7
+ * - The host tells the pane (`setReviewRunHost`): a run is going, the count in its scope, whether another page with
8
+ * waiting comments follows, and the setting "Move to the next one after sending".
9
+ * - The pane tells the host what it shows (`publishReviewRunPane`): the cards listed in order, the one selected; and
10
+ * what happened (`emitReviewRunEvent`): a card was selected, answered, the page's last card was passed, the run left
11
+ * (Escape, or "Waiting for you" turned off). The host also ends the run when its panel is closed.
12
+ * - The host moves the pane (`reviewRunCommands`): next and previous, the last card, the filter.
13
+ * - On a phone the host shows comments as a sheet over the page and says its height (`sheet`): the pane then draws the
14
+ * selected card alone (half), the list (full) or nothing (low). This holds with or without a run going.
15
+ *
16
+ * One step. Done always moves on. An option picked and a sent reply move on when the setting is on: the card leaves the
17
+ * list and the next one is selected. With the setting off the answer stays in view on its card, which stays listed
18
+ * (it no longer counts as waiting), and next (the bar, J) goes on.
19
+ *
20
+ * Keys, the same as in a conversation: J and K next and previous, Enter the recommended option, 1 to 9 an option by
21
+ * its position, R reply, E Done, Z undo, Escape leaves the run (the panel stays as it is). They are read on the window
22
+ * while a run is going, so they still work once the focus fell back to the page's body (a card that just left the list
23
+ * no longer holds it). They are the run's only with the focus in the Comments panel or on the body: a page that holds
24
+ * the focus keeps its own keys, and a panel that is closed or shows Chat takes none. Out of a run, only with the focus
25
+ * in the pane.
26
+ */
27
+ import { type RefObject } from 'react';
28
+ import type { CommentRecord, CommentThread } from './commentModel';
29
+ import type { CommentController } from './useComments';
30
+ export interface ReviewRunHost {
31
+ /** A run is going: the pane keeps "Waiting for you" on, selects a card and takes the keys from the page's body too. */
32
+ active: boolean;
33
+ /** Goes up by one each time a run starts or crosses to this page: the pane selects its first waiting card again. */
34
+ startToken: number;
35
+ /** The card a crossing asked for (the next page's first waiting one), else the list's first. */
36
+ startKey: string | null;
37
+ /** What waits in the run's scope (this Space, or everywhere from the Spaces root); null: not read yet. */
38
+ scopeCount: number | null;
39
+ /** Another page with waiting comments follows this one. */
40
+ hasNext: boolean;
41
+ /** The person's setting "Move to the next one after sending": an answer or a sent reply moves on. */
42
+ advance: boolean;
43
+ /**
44
+ * On a phone the host shows comments as a sheet over the page, and says the height it rests at: at 'half' the pane
45
+ * shows the selected card alone, at 'low' nothing (the host draws its one line), at 'full' the list. Null: no sheet.
46
+ */
47
+ sheet: ReviewRunSheet | null;
48
+ }
49
+ /** The three heights a phone's comments sheet rests at. */
50
+ export type ReviewRunSheet = 'low' | 'half' | 'full';
51
+ export declare function reviewRunHost(): ReviewRunHost;
52
+ export declare function setReviewRunHost(next: Partial<ReviewRunHost>): void;
53
+ export declare function subscribeReviewRunHost(listener: () => void): () => void;
54
+ export declare function useReviewRunHost(): ReviewRunHost;
55
+ export interface ReviewRunPaneState {
56
+ /** "Waiting for you" is on. */
57
+ waiting: boolean;
58
+ /** The cards listed, in the list's order (their threads' first comments). */
59
+ keys: readonly string[];
60
+ /** The listed cards that still wait (an answered card that stays listed is not one of them). */
61
+ waitingKeys: readonly string[];
62
+ selected: string | null;
63
+ /** A new comment is being written. */
64
+ drafting: boolean;
65
+ /** What the selected card is about, in a few words: the words it quotes, else its place, else how it starts. */
66
+ words?: string | null;
67
+ }
68
+ export declare function reviewRunPane(): ReviewRunPaneState | null;
69
+ export declare function publishReviewRunPane(next: ReviewRunPaneState | null): void;
70
+ export declare function subscribeReviewRunPane(listener: () => void): () => void;
71
+ export type ReviewRunEvent =
72
+ /** A card was selected by the run (a key, the bar, an answer that moved on): the page shows where it sits. */
73
+ {
74
+ type: 'selected';
75
+ key: string;
76
+ direction: 'next' | 'previous';
77
+ by: 'start' | 'step' | 'answer';
78
+ }
79
+ /** A card no longer waits: answered, marked done, or replied to. */
80
+ | {
81
+ type: 'answered';
82
+ key: string;
83
+ }
84
+ /** A card waits again: Undo brought it back, or the server refused its answer. */
85
+ | {
86
+ type: 'restored';
87
+ key: string;
88
+ }
89
+ /** The list's last card was passed. `advance`: an answer did it (the setting is on), not next or J. */
90
+ | {
91
+ type: 'end';
92
+ advance: boolean;
93
+ }
94
+ /** The run is left: Escape (the panel stays as it is), or "Waiting for you" turned off (its chip, another filter). */
95
+ | {
96
+ type: 'leave';
97
+ };
98
+ export declare function emitReviewRunEvent(event: ReviewRunEvent): void;
99
+ export declare function subscribeReviewRunEvents(listener: (event: ReviewRunEvent) => void): () => void;
100
+ export interface ReviewRunCommands {
101
+ /** Selects the next (1) or previous (-1) card. False at the list's end. */
102
+ step(delta: 1 | -1): boolean;
103
+ /** Selects the list's last card. */
104
+ last(): boolean;
105
+ /** Turns "Waiting for you" on or off. */
106
+ setWaiting(on: boolean): void;
107
+ }
108
+ export declare function registerReviewRunCommands(next: ReviewRunCommands): () => void;
109
+ export declare function reviewRunCommands(): ReviewRunCommands | null;
110
+ /**
111
+ * How long an answer given here outweighs the host's list of what waits. The server files an answer a few seconds
112
+ * later (up to about 24); after that its own list is the truth again (a new question in the same thread waits again).
113
+ */
114
+ export declare const REVIEW_RUN_ANSWER_HOLD_MS = 45000;
115
+ /** A thread answered in this run: `kept` when its card stays listed with the answer (the setting is off). */
116
+ export declare function markReviewRunAnswered(key: string, kept: boolean, now?: number): void;
117
+ /** Undo: the thread waits again. */
118
+ export declare function unmarkReviewRunAnswered(key: string): void;
119
+ /** Forgets every answer held here (a run that starts, "Waiting for you" turned off). */
120
+ export declare function resetReviewRunAnswered(): void;
121
+ /** Whether the thread was answered here a moment ago: it no longer waits, whatever the host's list says. */
122
+ export declare function reviewRunAnswered(key: string, now?: number): boolean;
123
+ /** Whether the thread's card stays listed under "Waiting for you" though it was answered (the setting is off). */
124
+ export declare function reviewRunKept(key: string): boolean;
125
+ export declare function subscribeReviewRunAnswered(listener: () => void): () => void;
126
+ /** Re-renders the caller when an answer is marked or undone; returns a number that changes with it. */
127
+ export declare function useReviewRunAnswered(): number;
128
+ export type ReviewRunAction = {
129
+ kind: 'answered' | 'replied' | 'done';
130
+ key: string;
131
+ /** An option picked: whether its write was saved. A refused answer was never given: the thread waits again. */
132
+ saved?: Promise<boolean>;
133
+ };
134
+ /**
135
+ * A card says what the person just did on it. True when a pane's run took it (it moves on, or keeps the card); false
136
+ * when none did and the card acts alone (Done then archives the thread itself).
137
+ */
138
+ export declare function notifyReviewRunAction(action: ReviewRunAction): boolean;
139
+ /**
140
+ * A reply is being sent from a comment box, until the returned call-back runs: the run's keys stand still meanwhile.
141
+ * The box's field is switched off while it sends and may lose the focus to the page, where a second Enter would
142
+ * otherwise pick the card's recommended option.
143
+ */
144
+ export declare function holdReviewRunKeys(): () => void;
145
+ /** How long the next card takes to come into place, as the next conversation does. */
146
+ export declare const REVIEW_RUN_TRAVEL_MS = 320;
147
+ /**
148
+ * A card comes into place the way the next conversation does: from below for next, from above for previous, over
149
+ * REVIEW_RUN_TRAVEL_MS; a fade alone for reduced motion.
150
+ */
151
+ export declare function cardComesIntoPlace(card: HTMLElement, direction: 'next' | 'previous'): void;
152
+ /** The card that takes the place of one that left the list: the key at the index `before` held it, when nothing else changed. */
153
+ export declare function cardThatTookThePlace(before: readonly string[], after: readonly string[]): string | null;
154
+ /**
155
+ * After an answer that moves on, Done or Delete, the next card comes into place: the card that takes the place of the
156
+ * one that left slides up into it. A list that changes any other way (a filter, a new comment, Undo) does not move.
157
+ */
158
+ export declare function useNextCardComesIntoPlace(rootRef: RefObject<HTMLElement | null>, scope: unknown): void;
159
+ /** How long after a run starts a list that fills in may still change which card is first. */
160
+ export declare const START_SETTLE_MS = 6000;
161
+ export interface ReviewRunPaneOptions {
162
+ controller: CommentController;
163
+ rootRef: RefObject<HTMLElement | null>;
164
+ /** The threads the pane can list (for the keys and the first card). */
165
+ threads: readonly CommentThread[];
166
+ /** A new comment is being written: the run's keys stand still. */
167
+ drafting: boolean;
168
+ /** The options of a thread's question still waiting for a pick, and the recommended one. */
169
+ asking(thread: CommentThread): {
170
+ comment: CommentRecord;
171
+ options: string[];
172
+ recommended: string | null;
173
+ } | null;
174
+ }
175
+ export interface ReviewRunPaneView {
176
+ /** "Waiting for you" is on in the host panel's main pane: the run's rules apply. */
177
+ running: boolean;
178
+ /** Attributes for the pane's root element. */
179
+ attrs: Record<string, string | undefined>;
180
+ /** The count the "n waiting" chip shows while a run is going; null: the chip reads "Waiting for you". */
181
+ count: number | null;
182
+ }
183
+ /**
184
+ * Whether a run going in the pane at `root` may take a key: the focus is in the Comments panel (the pane, its bar, a
185
+ * box of it) or nowhere (the page's body). An element of the page that holds the focus keeps its keys.
186
+ */
187
+ export declare function reviewRunHoldsKeys(root: HTMLElement): boolean;
188
+ /** Done on a card outside a run: archives it, then selects the card that takes its place, so E archives it in turn. */
189
+ export declare function archiveThenNext(controller: CommentController, root: CommentThread['root'], card: HTMLElement | null): void;
190
+ export declare function useReviewRunPane({ controller, rootRef, threads, drafting, asking }: ReviewRunPaneOptions): ReviewRunPaneView;
@@ -74,8 +74,8 @@ export interface CommentActions {
74
74
  * when a reply waits for someone). True once saved.
75
75
  */
76
76
  reply(thread: CommentThread, body: string, files?: readonly CommentFile[], answers?: CommentRecord): Promise<boolean>;
77
- /** Answers a check or choice ask. */
78
- answer(root: CommentRecord, answer: string): void;
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
79
  /** Archives (Resolved) or brings back (Open) a thread without a toast. People archive with `archive` and `unarchive`. */
80
80
  setStatus(root: CommentRecord, status: 'Open' | 'Resolved'): void;
81
81
  /** Archives an open thread (Done) with a 6-second Undo toast; Z undoes. */
@@ -141,8 +141,23 @@ export interface UseCommentsOptions {
141
141
  currentTime?(): number | null | undefined;
142
142
  /** Names of the pages (scope records, by record key) the Space home groups comments under. */
143
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;
144
155
  }
145
- 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 {
146
161
  comments: CommentRecord[];
147
162
  /** Threads in the scope, deleted ones left out, in anchor order. */
148
163
  threads: CommentThread[];
@@ -172,6 +187,19 @@ export interface CommentController {
172
187
  counts: Readonly<Record<CommentStatusView, number>>;
173
188
  /** Threads per anchor filter ("This item", "All items"), for the current status filter. */
174
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;
175
203
  /** True when the controller covers the whole Space (no scope record): the pane groups threads by page. */
176
204
  wholeSpace: boolean;
177
205
  /** The page a thread sits on, for grouping on the Space home: its page, else its anchor, else the Space. */
@@ -289,10 +317,29 @@ export interface CommentController {
289
317
  signed<T>(write: (author: string | null) => Promise<T>): Promise<T>;
290
318
  /** Opens an agent's thread in the side chat; undefined on hosts without one. */
291
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;
292
325
  loading: boolean;
293
326
  hasData: boolean;
294
327
  error: Error | null;
295
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;
296
343
  }
297
344
  /** How long a delete's Undo toast stays on a touch screen (a coarse pointer, or a phone-width window). */
298
345
  export declare const DELETE_UNDO_TOUCH_MS = 8000;
@@ -313,4 +360,6 @@ export declare function commentLinkFor(host: {
313
360
  export declare function commentAnchorOfDraft(pin: CommentDraftPin | null | undefined): SpaceCommentAnchor;
314
361
  /** The draft a place named by the host opens (the reverse of `commentAnchorOfDraft`). */
315
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;
316
365
  export declare function useComments(options?: UseCommentsOptions): CommentController;