@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
@@ -1,7 +1,7 @@
1
1
  export { defineSpace, defineSpaces } from './space';
2
2
  export type { SpaceDefinition, SpacesWorkspace, SpaceActionTemplate, SpaceResourceReference, SpaceDatabaseCreate, SpaceStore } from './space';
3
3
  export type { SpaceViewParam, SpaceViewParamType, SpaceShows, SpaceMemoryPolicy, SpaceMemorySnapshot, SpaceChrome, SpaceMarkdownInput } from './space';
4
- export { threadHookInput, threadSettleInput, commentOptionInput } from './functions';
4
+ export { threadHookInput, threadIdleInput, threadSettleInput, commentOptionInput } from './functions';
5
5
  export type { SpaceFunctionDeclaration, SpaceFunctionHandler, SpaceFunctionContext } from './functions';
6
6
 
7
7
  /**
@@ -39,7 +39,7 @@ export type SpaceFunctionRole = 'public' | 'viewer' | 'editor' | 'key';
39
39
  /** Notis's built-in thread actions a function may run, only on a thread one of the Space's items is attached to. */
40
40
  export type SpaceThreadOperation = 'archive' | 'unarchive' | 'read' | 'unread' | 'star' | 'unstar' | 'later' | 'back';
41
41
  /** The built-in thread actions a Space can follow with a function (`threadHooks`). */
42
- export type SpaceThreadHookEvent = SpaceThreadOperation | 'delete';
42
+ export type SpaceThreadHookEvent = SpaceThreadOperation | 'delete' | 'idle';
43
43
 
44
44
  export interface SpaceFunctionUses {
45
45
  /** This Space's declared `actions`, run through the sealed action pipeline with the caller as the actor. */
@@ -95,6 +95,17 @@ export const threadHookInput = {
95
95
  },
96
96
  } satisfies SpaceFunctionDeclaration['input'];
97
97
 
98
+ /** Input for the idle hook after the thread finishes its current work. */
99
+ export const threadIdleInput = {
100
+ ...threadHookInput,
101
+ required: [...threadHookInput.required, 'run_id'],
102
+ properties: {
103
+ ...threadHookInput.properties,
104
+ event: { type: 'string', enum: ['idle'] },
105
+ run_id: { type: 'string' },
106
+ },
107
+ } satisfies SpaceFunctionDeclaration['input'];
108
+
98
109
  /**
99
110
  * The `input` of the function a thread item kind settles with (`threadItems.<kind>.settle`): copy it as written.
100
111
  * Notis runs it once when an item of that kind first reaches a final state, with the item and its thread.
@@ -137,13 +148,17 @@ export interface SpaceFunctionThread {
137
148
  }
138
149
  /** What a thread hook's function receives: the built-in action that just happened, and who did it. */
139
150
  export interface SpaceThreadHookInput {
140
- event: SpaceThreadHookEvent;
151
+ event: Exclude<SpaceThreadHookEvent, 'idle'>;
141
152
  /** The person, one of their agents, or Notis itself (an automatic change, or another function's thread action). */
142
153
  actor: 'person' | 'agent' | 'notis';
143
154
  thread: SpaceFunctionThread;
144
155
  /** This Space's items attached to the thread. */
145
156
  items: SpaceFunctionThreadItem[];
146
157
  }
158
+ export interface SpaceThreadIdleInput extends Omit<SpaceThreadHookInput, 'event'> {
159
+ event: 'idle';
160
+ run_id: string;
161
+ }
147
162
  /** What a thread item kind's settle function receives: the item that reached a final state, and its thread. */
148
163
  export interface SpaceThreadSettleInput {
149
164
  item: SpaceFunctionThreadItem;
@@ -64,6 +64,11 @@ export interface UseCollectionInteractionsOptions<T> {
64
64
  shortcutPriority?: number;
65
65
  resolveNextId?: (context: CollectionNavigationContext<T>) => string | null;
66
66
  onActiveItemChange?: (id: string | null) => void;
67
+ /**
68
+ * For a view that draws only part of its items (the rows on screen): brings an item into view so it is drawn.
69
+ * Called when the item to focus has no element; the controller then focuses it as soon as it is drawn.
70
+ */
71
+ revealItem?: (id: string) => void;
67
72
  actions?: CollectionAction<T>[];
68
73
  }
69
74
  export interface CollectionInteractionController<T> {
@@ -26,7 +26,7 @@ export { SPACE_CLOUD_COMPUTER_OPERATIONS, spaceCloudComputerAllows } from './spa
26
26
  export { spaceCloudComputerAccess } from './space';
27
27
  export type { SpaceCloudComputerLevel, SpaceCloudComputerOperation, SpaceCloudComputerStatus, SpaceCloudComputerRelease, SpaceCloudComputerCopy, SpaceCloudComputerRunInput, SpaceCloudComputerRunResult, SpaceCloudComputerUploadInput, SpaceCloudComputerUploadResult, SpaceCloudComputerTransport, SpaceCloudComputerDeclaration, SpaceCloudComputerService, SpaceCloudComputerJobOperation, SpaceCloudComputerJobInput, SpaceCloudComputerJobStatus, SpaceCloudComputerJobLogs, SpaceCloudComputerJobResult, SpaceCloudComputerLeaseInput, SpaceCloudComputerLeaseResult, SpaceCloudComputerFolder, JobState, SpaceCloudComputerAccessInput, SpaceCloudComputerAccessResult, SpaceCloudComputerMediaLink, SpaceCloudComputerFrameCode, SpaceCloudComputerTransferOperation, SpaceCloudComputerFileUpload, SpaceCloudComputerUploadProgress, SpaceCloudComputerFileUploadResult, SpaceCloudComputerImportInput, SpaceCloudComputerImportResult } from './space';
28
28
  export type { SpaceViewerReadFamily, SpaceViewerReadOperation, SpaceViewerReadInput, SpaceViewerReadResult, SpaceViewerLink, SpaceViewerDatabase, SpaceViewerDatabaseSchema, SpaceViewerSkill, SpaceViewerSkillPage } from './space';
29
- export type { SpaceAgentDeclaration, SpaceItemThread, SpaceAgentQueue, SpaceAgentsStatus, SpaceThreadsTransport, SpaceThreadItemText, SpaceThreadItemCondition, SpaceThreadItemState, SpaceThreadItemConfirm, SpaceThreadItemAction, SpaceThreadItemKind, SpaceThreadItem, SpaceThreadItemRun, SpaceThreadItemTransport, SpaceCommentSource, SpaceCommentsTransport, SpaceCommentViewer, SpaceCommentThreadRef, SpaceCommentThreadPick, SpaceCommentAnchor, SpaceCommentAttachment, SpaceCommentChange, SpaceCommentFile, SpaceCommentInsert, SpaceCommentMode, SpaceCommentNeeds, SpaceCommentPage, SpaceCommentPageKey, SpaceCommentReply, SpaceCommentRow, SpaceCommentStatus } from './space';
29
+ export type { SpaceAgentDeclaration, SpaceItemThread, SpaceAgentQueue, SpaceAgentsStatus, SpaceThreadsTransport, SpaceThreadItemText, SpaceThreadItemCondition, SpaceThreadItemState, SpaceThreadItemConfirm, SpaceThreadItemAction, SpaceThreadItemKind, SpaceThreadItem, SpaceThreadItemRun, SpaceThreadItemTransport, SpaceCommentSource, SpaceCommentsTransport, SpaceCommentViewer, SpaceCommentThreadRef, SpaceCommentThreadPick, SpaceCommentAnchor, SpaceCommentAttachment, SpaceCommentChange, SpaceCommentFile, SpaceCommentInsert, SpaceCommentMode, SpaceCommentNeeds, SpaceCommentPage, SpaceCommentPageKey, SpaceCommentReply, SpaceCommentRow, SpaceCommentStatus, SpaceCommentThreadsAnswer, SpaceCommentThreadsInput } from './space';
30
30
  export { SpaceActionError, SpaceNavigationCancelled, isSpaceNavigationCancelled } from './space';
31
31
  export { spaceAudience, spaceMarksEditorsOnly, publicSpaceDescriptor, withoutEditorColumns } from './space';
32
32
  export type { SpaceAudience, SpaceEditorsOnly, SpaceResourceColumns, EditorOnlyColumns, AudienceRow } from './space';
@@ -64,8 +64,8 @@ export { useItemThread } from './hooks/useItemThread';
64
64
  export type { UseItemThreadResult } from './hooks/useItemThread';
65
65
  export { useThreadItem } from './hooks/useThreadItem';
66
66
  export { useFunction, useFunctionQuery } from './hooks/useFunction';
67
- export { threadHookInput, threadSettleInput, commentOptionInput } from './functions';
68
- export type { SpaceFunctionDeclaration, SpaceFunctionHandler, SpaceFunctionContext, SpaceFunctionKind, SpaceFunctionExposure, SpaceFunctionRole, SpaceFunctionUses, SpaceThreadOperation, SpaceThreadHookEvent, SpaceThreadHookInput, SpaceThreadSettleInput, SpaceCommentOption, SpaceCommentOptionInput, SpaceFunctionThread, SpaceFunctionThreadItem, SpaceFunctionCloudComputer, SpaceFunctionDescriptor, SpaceFunctionCallOptions } from './functions';
67
+ export { threadHookInput, threadIdleInput, threadSettleInput, commentOptionInput } from './functions';
68
+ export type { SpaceFunctionDeclaration, SpaceFunctionHandler, SpaceFunctionContext, SpaceFunctionKind, SpaceFunctionExposure, SpaceFunctionRole, SpaceFunctionUses, SpaceThreadOperation, SpaceThreadHookEvent, SpaceThreadHookInput, SpaceThreadIdleInput, SpaceThreadSettleInput, SpaceCommentOption, SpaceCommentOptionInput, SpaceFunctionThread, SpaceFunctionThreadItem, SpaceFunctionCloudComputer, SpaceFunctionDescriptor, SpaceFunctionCallOptions } from './functions';
69
69
  export type { UseThreadItemResult } from './hooks/useThreadItem';
70
70
  export { useAgentQueue, AGENT_QUEUE_WORDS } from './hooks/useAgentQueue';
71
71
  export type { UseAgentQueueResult, AgentQueueStatus } from './hooks/useAgentQueue';
@@ -11,6 +11,11 @@ export interface ShortcutDefinition {
11
11
  allowRepeat?: boolean;
12
12
  preventDefault?: boolean;
13
13
  stopPropagation?: boolean;
14
+ /**
15
+ * Set by a collection that binds its clear key only while something is selected: the binding itself says the
16
+ * selection is not empty, whichever items are drawn (a windowed list draws only the rows on screen).
17
+ */
18
+ whileSelected?: boolean;
14
19
  onTrigger: (event: KeyboardEvent) => void | Promise<void>;
15
20
  }
16
21
  export interface UseShortcutsOptions {
@@ -318,6 +318,10 @@ export interface SpaceCommentRow {
318
318
  status: SpaceCommentStatus;
319
319
  needs: SpaceCommentNeeds;
320
320
  options: string[];
321
+ /** A choice question's option its asker recommends (one of `options`). Absent or null: none. */
322
+ recommended?: string | null;
323
+ /** A choice question's line under an option, by option. Absent: none. */
324
+ option_details?: Readonly<Record<string, string>>;
321
325
  answer: string | null;
322
326
  answered_at: string | null;
323
327
  answer_to: string | null;
@@ -342,6 +346,46 @@ export interface SpaceCommentRow {
342
346
  */
343
347
  export type SpaceCommentPageKey = string | null | 'all';
344
348
 
349
+ /**
350
+ * Which comment threads of the Space a pane reads (`SpaceCommentsTransport.threads`). The open threads always come,
351
+ * whole. Deleted threads never come.
352
+ */
353
+ export interface SpaceCommentThreadsInput {
354
+ /**
355
+ * How many Done threads the pane wants too, newest first (0 or absent: none). The host reads them a page at a time
356
+ * and answers every one it holds; `moreDone` says whether older ones are left.
357
+ */
358
+ done?: number;
359
+ /**
360
+ * Only these threads (the ids of their first comments), whatever their status: nothing else of the Space is read.
361
+ * For a host that shows a part of a Space's comments (those linked to one conversation).
362
+ */
363
+ only?: readonly string[] | null;
364
+ /** Comments whose threads come too, whatever their status and their place in the list (a link to one comment). */
365
+ include?: readonly string[];
366
+ }
367
+
368
+ /** What a bounded read answers. */
369
+ export interface SpaceCommentThreadsAnswer {
370
+ /** The comments of the threads read, in no particular order: every thread whole. */
371
+ comments: SpaceCommentRow[];
372
+ revision: number;
373
+ /**
374
+ * How many threads the Space holds by status, counted by the server (deleted ones left out), so a pane that holds a
375
+ * part of the Space still knows the totals. Null with `only`, and while the server has not said.
376
+ */
377
+ counts: { open: number; done: number } | null;
378
+ /**
379
+ * The pin number of the first comments that sit on a point or a zone, by comment id, counted by the server among
380
+ * every first comment of their page (deleted ones keep theirs).
381
+ */
382
+ numbers: Readonly<Record<string, number>>;
383
+ /** How many comments Copy changes would report with no checkpoint, counted by the server. Null when not known. */
384
+ changes: number | null;
385
+ /** True while Done threads older than the ones answered are left to read. */
386
+ moreDone: boolean;
387
+ }
388
+
345
389
  /** The page the host shows: its record (null on the Space home), the view slug, and its name when known. */
346
390
  export interface SpaceCommentPage { recordKey: string | null; view?: string | null; name?: string | null }
347
391
 
@@ -352,6 +396,9 @@ export interface SpaceCommentInsert extends SpaceCommentAnchor {
352
396
  body: string;
353
397
  needs?: SpaceCommentNeeds;
354
398
  options?: readonly string[];
399
+ /** With `needs: 'choice'`: the option recommended, and a line under an option (by option). */
400
+ recommended?: string | null;
401
+ option_details?: Readonly<Record<string, string>>;
355
402
  attachments?: readonly SpaceCommentFile[];
356
403
  id?: string;
357
404
  request_id: string;
@@ -367,6 +414,8 @@ export interface SpaceCommentReply {
367
414
  answer_to?: string | null;
368
415
  needs?: SpaceCommentNeeds;
369
416
  options?: readonly string[];
417
+ recommended?: string | null;
418
+ option_details?: Readonly<Record<string, string>>;
370
419
  attachments?: readonly SpaceCommentFile[];
371
420
  id?: string;
372
421
  request_id: string;
@@ -375,12 +424,11 @@ export interface SpaceCommentReply {
375
424
  /**
376
425
  * Space-only host Comments panel and comment store: the comment threads of the page sit in the host's right panel,
377
426
  * beside the chat, instead of a pane inside the Space, and every read and write goes through the host to the Space's
378
- * one comment store (`portal_comments`). Absent while comments are off for the viewer (`unified_comments`), on Sites,
379
- * links, previews and older hosts: a Space then shows no comments at all (no pane, no pins, no highlights, no Comment
380
- * on a selection; Cite stays).
427
+ * one comment store (`portal_comments`). Absent on Sites, links, previews and older hosts: a Space then shows no
428
+ * comments at all (no pane, no pins, no highlights, no Comment on a selection; Cite stays).
381
429
  *
382
430
  * Every write resolves with the stored row (the server stamps author, dates, `change` and `revision`) or rejects with
383
- * an Error whose `code` is the server's (`feature_disabled`, `revision_conflict`, `comment_not_found`, ...).
431
+ * an Error whose `code` is the server's (`comment_forbidden`, `revision_conflict`, `comment_not_found`, ...).
384
432
  */
385
433
  export interface SpaceCommentsTransport {
386
434
  /** Lists a source in the Comments panel until the returned call-back runs. */
@@ -402,6 +450,14 @@ export interface SpaceCommentsTransport {
402
450
  * asks the server for changes only merges them into its copy and answers with the whole page.
403
451
  */
404
452
  list(input: { page: SpaceCommentPageKey; since_revision?: number }): Promise<{ comments: SpaceCommentRow[]; revision: number }>;
453
+ /**
454
+ * A bounded read of the Space's comment threads, for a pane that shows the whole Space: only the threads it lists,
455
+ * each whole (its first comment and its replies), instead of every comment of the Space (`list` with 'all'). See
456
+ * `SpaceCommentThreadsInput`. The host keeps its own copy and asks the server only for what the copy lacks and for
457
+ * what changed since. Resolves null when the server cannot answer this read: the reader then uses `list`. Absent
458
+ * on older hosts: `list` is used. `subscribe` with 'all' says when to read again.
459
+ */
460
+ threads?(input: SpaceCommentThreadsInput): Promise<SpaceCommentThreadsAnswer | null>;
405
461
  /**
406
462
  * Calls `listener` whenever the comments of `page` may have changed (a write here or elsewhere, the window coming
407
463
  * back into focus, the host's poll): the reader lists them again. Returns the call-back that stops it.
@@ -463,6 +519,12 @@ export interface SpaceCommentsTransport {
463
519
  link?(input: { rootId: string; pick: SpaceCommentThreadPick; primary?: boolean }): Promise<SpaceCommentThreadRef | null>;
464
520
  /** Opens a manager thread in the chat (the panel switches to Chat). */
465
521
  openThread?(threadId: string): void;
522
+ /**
523
+ * Opens the page of one comment thread with that thread shown on it, for a host that draws the comments where their
524
+ * page is not open (every Space's open comments, a conversation's comments): each card's "..." then offers Show on
525
+ * page. Absent beside the page itself, where a tap on the card already shows its place.
526
+ */
527
+ showOnPage?(input: { rootId: string }): void;
466
528
  /**
467
529
  * The link that opens the Space page of one comment thread with it revealed (`comment=<root id>`, the link a push
468
530
  * or a chat pill opens), as a full address another person can open: Copy link on a thread card copies it. The host
@@ -477,6 +539,12 @@ export interface SpaceCommentsTransport {
477
539
  * does not cover the page ignores it.
478
540
  */
479
541
  showPage?(): void;
542
+ /**
543
+ * Names the mounted view this transport serves, the same object for its whole life. When a newer version of the
544
+ * view takes its place, the host hands what the comments show (the selected thread, the filters, a new comment
545
+ * being placed) from the old view's token to the new one's (`handOverCommentState`). Absent: nothing is handed.
546
+ */
547
+ viewToken?: object;
480
548
  }
481
549
  /**
482
550
  * The viewer as comments see them. `id` (their user id), when the host gives it, tells their comments by the row's
@@ -1020,7 +1088,7 @@ export interface SpaceDefinition {
1020
1088
  /**
1021
1089
  * The function that runs after a built-in thread action (archive, read, star, Later, delete and their opposites)
1022
1090
  * on a thread one of this Space's items is attached to. The action itself never waits for it. Its `input` is
1023
- * `threadHookInput`.
1091
+ * `threadHookInput`, or `threadIdleInput` for the idle hook.
1024
1092
  */
1025
1093
  threadHooks?: Partial<Record<import('./functions').SpaceThreadHookEvent, string>>;
1026
1094
  /**