@notis_ai/cli 0.2.25 → 0.2.27

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 (163) hide show
  1. package/README.md +186 -5
  2. package/config/notis_app_design_rules.json +36 -14
  3. package/config/portal-route-roots.json +1 -0
  4. package/dist/agent-hooks/notis-agent-hook.mjs +2866 -553
  5. package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
  6. package/dist/base-skills/notis-cli/references/intelligence.md +1 -1
  7. package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
  8. package/dist/base-skills/notis-query/SKILL.md +0 -1
  9. package/dist/base-skills/notis-query/references/documents.md +7 -0
  10. package/dist/base-skills/notis-query/references/query.md +1 -0
  11. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  12. package/dist/base-skills/notis-spaces/SKILL.md +96 -24
  13. package/dist/base-skills/notis-spaces/references/architecture.md +4 -3
  14. package/dist/base-skills/notis-spaces/references/context.md +3 -0
  15. package/dist/base-skills/notis-spaces/references/design.md +37 -18
  16. package/dist/base-skills/notis-spaces/references/reading.md +8 -1
  17. package/dist/base-skills/notis-spaces/references/reports.md +6 -6
  18. package/dist/base-skills/notis-spaces/references/sdk.md +71 -7
  19. package/dist/base-skills/notis-spaces/references/store.md +22 -13
  20. package/dist/base-skills/notis-spaces/references/views.md +99 -6
  21. package/dist/sdk/package.json +3 -0
  22. package/dist/sdk/src/cloudComputerWords.ts +53 -0
  23. package/dist/sdk/src/components/Audience.tsx +76 -0
  24. package/dist/sdk/src/components/DocumentPage.tsx +15 -4
  25. package/dist/sdk/src/components/MarkdownEditor.tsx +44 -14
  26. package/dist/sdk/src/components/MultiSelectActionBar.tsx +16 -5
  27. package/dist/sdk/src/components/NotisSelectionBoundary.tsx +79 -25
  28. package/dist/sdk/src/components/Skeleton.tsx +162 -6
  29. package/dist/sdk/src/hooks/useAction.ts +12 -2
  30. package/dist/sdk/src/hooks/useAgentQueue.ts +125 -0
  31. package/dist/sdk/src/hooks/useCloudComputerJob.ts +142 -0
  32. package/dist/sdk/src/hooks/useCloudComputerService.ts +388 -0
  33. package/dist/sdk/src/hooks/useCloudComputerShell.ts +95 -7
  34. package/dist/sdk/src/hooks/useCollectionInteractions.ts +40 -2
  35. package/dist/sdk/src/hooks/useItemThread.ts +58 -0
  36. package/dist/sdk/src/hooks/useMarqueeSelection.ts +6 -1
  37. package/dist/sdk/src/hooks/useNativeDocuments.ts +61 -8
  38. package/dist/sdk/src/hooks/useNotisNavigation.ts +31 -8
  39. package/dist/sdk/src/hooks/useQuery.ts +67 -10
  40. package/dist/sdk/src/hooks/useViewParams.ts +47 -11
  41. package/dist/sdk/src/index.ts +31 -4
  42. package/dist/sdk/src/interactions.ts +2 -0
  43. package/dist/sdk/src/nativeData.ts +2 -0
  44. package/dist/sdk/src/optimisticRows.ts +329 -0
  45. package/dist/sdk/src/perf.ts +188 -0
  46. package/dist/sdk/src/provider.tsx +2 -1
  47. package/dist/sdk/src/queryCache.ts +366 -17
  48. package/dist/sdk/src/runtime.ts +55 -4
  49. package/dist/sdk/src/skeleton.ts +103 -0
  50. package/dist/sdk/src/space.ts +662 -28
  51. package/dist/sdk/src/spacePublicUI.ts +36 -0
  52. package/dist/sdk/src/ui/engine/step.ts +54 -0
  53. package/dist/sdk/src/ui/icons.tsx +3 -1
  54. package/dist/sdk/src/words/shell.ts +1 -0
  55. package/dist/skill-sync/index.js +88 -13
  56. package/dist/skill-sync-worker.mjs +127 -38
  57. package/dist/space-harness/host.js +272 -105
  58. package/dist/space-sdk/dist/chunk-BWHAORT4.js +5 -0
  59. package/dist/space-sdk/dist/index.js +9 -4
  60. package/dist/space-sdk/dist/ui.js +12 -12
  61. package/dist/space-sdk/package.json +3 -0
  62. package/dist/space-sdk/src/cloudComputerWords.d.ts +34 -0
  63. package/dist/space-sdk/src/components/Audience.d.ts +46 -0
  64. package/dist/space-sdk/src/components/DocumentPage.d.ts +3 -1
  65. package/dist/space-sdk/src/components/MarkdownEditor.d.ts +21 -0
  66. package/dist/space-sdk/src/components/MultiSelectActionBar.d.ts +5 -1
  67. package/dist/space-sdk/src/components/NotisSelectionBoundary.d.ts +19 -2
  68. package/dist/space-sdk/src/components/Skeleton.d.ts +7 -2
  69. package/dist/space-sdk/src/hooks/useAction.d.ts +8 -1
  70. package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +61 -0
  71. package/dist/space-sdk/src/hooks/useCloudComputerJob.d.ts +35 -0
  72. package/dist/space-sdk/src/hooks/useCloudComputerService.d.ts +75 -0
  73. package/dist/space-sdk/src/hooks/useCloudComputerShell.d.ts +36 -3
  74. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +6 -0
  75. package/dist/space-sdk/src/hooks/useItemThread.d.ts +32 -0
  76. package/dist/space-sdk/src/hooks/useMarqueeSelection.d.ts +2 -1
  77. package/dist/space-sdk/src/hooks/useNativeDocumentBody.d.ts +1 -0
  78. package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +20 -5
  79. package/dist/space-sdk/src/hooks/useNotisNavigation.d.ts +11 -2
  80. package/dist/space-sdk/src/hooks/useQuery.d.ts +24 -2
  81. package/dist/space-sdk/src/hooks/useViewParams.d.ts +2 -0
  82. package/dist/space-sdk/src/index.d.ts +24 -4
  83. package/dist/space-sdk/src/nativeData.d.ts +6 -0
  84. package/dist/space-sdk/src/queryCache.d.ts +97 -2
  85. package/dist/space-sdk/src/runtime.d.ts +53 -4
  86. package/dist/space-sdk/src/skeleton.d.ts +42 -0
  87. package/dist/space-sdk/src/space.ts +662 -28
  88. package/dist/space-sdk/src/tailwind-candidates.d.ts +761 -6
  89. package/dist/space-sdk/src/ui/cloud/CloudComputerFrame.d.ts +29 -0
  90. package/dist/space-sdk/src/ui/cloud/CloudComputerWaking.d.ts +20 -0
  91. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +15 -2
  92. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +50 -0
  93. package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +64 -0
  94. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +49 -1
  95. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +26 -0
  96. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  97. package/dist/space-sdk/src/ui/comments/passageModel.d.ts +82 -0
  98. package/dist/space-sdk/src/ui/comments/useComments.d.ts +34 -4
  99. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +67 -0
  100. package/dist/space-sdk/src/ui/engine/index.d.ts +2 -2
  101. package/dist/space-sdk/src/ui/engine/step.d.ts +9 -0
  102. package/dist/space-sdk/src/ui/fields/fields.d.ts +2 -1
  103. package/dist/space-sdk/src/ui/index.d.ts +4 -0
  104. package/dist/space-sdk/src/ui/layout/Panels.d.ts +9 -2
  105. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +42 -0
  106. package/dist/space-sdk/src/ui/layout/index.d.ts +2 -1
  107. package/dist/space-sdk/src/ui/layout/panelMath.d.ts +11 -2
  108. package/dist/space-sdk/src/ui/list/ListReader.d.ts +38 -7
  109. package/dist/space-sdk/src/ui/list/Row.d.ts +4 -0
  110. package/dist/space-sdk/src/ui/list/SelectionBar.d.ts +9 -4
  111. package/dist/space-sdk/src/ui/list/useListKeys.d.ts +4 -0
  112. package/dist/space-sdk/src/words/shell.ts +1 -0
  113. package/dist/view-renderer/dist/host.js +355 -188
  114. package/dist/view-renderer/dist/theme.css +1 -1
  115. package/dist/view-renderer/src/dom.js +15 -2
  116. package/dist/view-renderer/src/host.tsx +4 -1
  117. package/dist/view-renderer/src/index.js +3 -0
  118. package/dist/view-renderer/src/pool.js +8 -4
  119. package/dist/view-renderer/src/renderer.js +92 -23
  120. package/dist/view-renderer/src/skeleton.js +450 -0
  121. package/package.json +4 -4
  122. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +8 -4
  123. package/skills/notis-onboarding/BRIEF.md +15 -9
  124. package/skills/notis-spaces/cli.md +43 -4
  125. package/src/command-specs/auth.js +5 -3
  126. package/src/command-specs/cc.js +410 -0
  127. package/src/command-specs/computer.js +320 -0
  128. package/src/command-specs/diagnostics.js +2 -13
  129. package/src/command-specs/documents.js +22 -4
  130. package/src/command-specs/index.js +7 -0
  131. package/src/command-specs/onboarding.js +127 -7
  132. package/src/command-specs/skills.js +2 -2
  133. package/src/command-specs/spaces.js +162 -30
  134. package/src/command-specs/tools.js +26 -8
  135. package/src/command-specs/views.js +4 -1
  136. package/src/runtime/agent-setup.js +20 -2
  137. package/src/runtime/app-boundary-validator.js +2 -1
  138. package/src/runtime/app-platform.js +13 -0
  139. package/src/runtime/auth-recovery.js +5 -0
  140. package/src/runtime/channel.js +16 -2
  141. package/src/runtime/cloud-transfer.js +587 -0
  142. package/src/runtime/computer-ssh.js +127 -0
  143. package/src/runtime/oauth.js +50 -4
  144. package/src/runtime/skill-sync/cloud-client.ts +98 -15
  145. package/src/runtime/skill-sync/index.ts +42 -4
  146. package/src/runtime/skill-sync/local-scanner.ts +1 -0
  147. package/src/runtime/skill-sync/types.ts +6 -0
  148. package/src/runtime/space-audience.js +94 -0
  149. package/src/runtime/space-collection-scaffold.js +2 -1
  150. package/src/runtime/space-fixture-broker.js +2 -1
  151. package/src/runtime/space-lock.js +1 -4
  152. package/src/runtime/space-platform.js +18 -2
  153. package/src/runtime/space-source.js +105 -7
  154. package/src/runtime/space-test-server.js +13 -2
  155. package/src/runtime/space-verification.js +99 -6
  156. package/src/runtime/space-view-manifest.js +22 -4
  157. package/src/runtime/sync-skills.js +24 -20
  158. package/src/runtime/transport.js +19 -0
  159. package/src/runtime/view-render.js +2 -2
  160. package/src/skill-sync-worker.js +5 -1
  161. package/template/.harness/index.html.tmpl +1 -1
  162. package/dist/skill-sync/index.js.map +0 -7
  163. package/dist/space-sdk/dist/chunk-SVZATGZB.js +0 -5
@@ -0,0 +1,29 @@
1
+ /**
2
+ * CloudComputerFrame: a Space service shown in a frame, on the viewer's own Cloud Computer. It keeps the service
3
+ * running while it is on screen (through `CloudComputerWaking` until the service is ready), then signs the frame in to
4
+ * the machine's gate with a one-time code: no pass ever sits in the frame's address, and the session is the frame's own
5
+ * (an HttpOnly cookie on the gate). The service is served from the gate root, so an app built for its own origin
6
+ * (absolute paths, a dev server's reload socket) runs unchanged.
7
+ */
8
+ import React from 'react';
9
+ import { type UseCloudComputerServiceResult } from '../../hooks/useCloudComputerService';
10
+ import type { Words } from '../../words';
11
+ export interface CloudComputerFrameProps {
12
+ /** A declared service id (the component keeps it running), or the result of `useCloudComputerService`. */
13
+ service: string | UseCloudComputerServiceResult;
14
+ /** Where the frame opens in the service (default `/`). Changing it opens the frame again. */
15
+ path?: string;
16
+ /** The frame's accessible name (default "Cloud Computer service"). */
17
+ title?: Words | string;
18
+ /** The iframe `allow` list (default autoplay, fullscreen and the clipboard). */
19
+ allow?: string;
20
+ /** With a service id: how long a start may take before it shows as failed, in seconds (default 90). */
21
+ waitSeconds?: number;
22
+ className?: string;
23
+ }
24
+ /**
25
+ * The gate's sign-in page says it is ready while it loads. A frame that loaded without saying so never will (the
26
+ * browser refused to frame it, or the machine answered an error page): after this long it shows that it failed.
27
+ */
28
+ export declare const FRAME_GREETING_MS = 8000;
29
+ export declare function CloudComputerFrame({ service, path, title, allow, waitSeconds, className }: CloudComputerFrameProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CloudComputerWaking: what a page that needs a Cloud Computer service shows until the service is ready. Ready, it
3
+ * renders its children; starting, a quiet spinner (restoring its files after a pause says so); failed, what went wrong and Try again, or Allow when only the viewer's
4
+ * approval is missing; on a host without the Cloud Computer, a short notice. An info button tells the hourly price when
5
+ * the host knows it.
6
+ */
7
+ import React, { type ReactNode } from 'react';
8
+ import { type UseCloudComputerServiceResult } from '../../hooks/useCloudComputerService';
9
+ export interface CloudComputerWakingProps {
10
+ /** A declared service id (the component keeps it running), or the result of `useCloudComputerService`. */
11
+ service: string | UseCloudComputerServiceResult;
12
+ /** What shows once the service is ready. */
13
+ children?: ReactNode;
14
+ /** With a service id: how long a start may take before it shows as failed, in seconds (default 90). */
15
+ waitSeconds?: number;
16
+ /** After a failure, Try again is offered after this many seconds (default 5). */
17
+ retryDelaySeconds?: number;
18
+ className?: string;
19
+ }
20
+ export declare function CloudComputerWaking({ service, children, waitSeconds, retryDelaySeconds, className }: CloudComputerWakingProps): React.JSX.Element;
@@ -9,11 +9,14 @@
9
9
  * item" starts a comment on the whole anchor, with no pin.
10
10
  * - `CommentThreadCard`, `NewCommentBox` and `CommentAvatar` for Spaces that lay the pane out themselves.
11
11
  *
12
+ * Files: with an Attachments files column and a host that uploads (`runtime.spaceFiles`), a new comment and a reply take
13
+ * pictures and files: paste, drop on the box or the paperclip (`commentFiles`). Otherwise the boxes take text only.
14
+ *
12
15
  * Keyboard: Enter sends a reply or a new comment and Shift+Enter adds a line; Escape in an empty new comment drops it
13
16
  * (with text, the first Escape leaves the field); Escape leaves Add comment mode; a thread card selects with Enter.
14
17
  */
15
- import React from 'react';
16
- import { type CommentThread } from './commentModel';
18
+ import React, { type KeyboardEvent as ReactKeyboardEvent } from 'react';
19
+ import { type CommentRecord, type CommentThread } from './commentModel';
17
20
  import type { CommentController } from './useComments';
18
21
  export interface CommentAvatarProps {
19
22
  author: string;
@@ -21,8 +24,18 @@ export interface CommentAvatarProps {
21
24
  me?: string;
22
25
  className?: string;
23
26
  }
27
+ /**
28
+ * The signature of a comment an agent wrote, like a message one thread sends another: "From {name}", a link to the
29
+ * agent's thread for the person whose agent it is.
30
+ */
31
+ export declare function CommentAgentSource({ controller, comment }: {
32
+ controller: CommentController;
33
+ comment: CommentRecord;
34
+ }): React.JSX.Element | null;
24
35
  /** The author's initial. Decorative: the author's name is always written next to it. */
25
36
  export declare function CommentAvatar({ author, me, className }: CommentAvatarProps): React.JSX.Element;
37
+ /** Enter sends a comment; Shift+Enter, and Enter while composing an accented letter, add to the text. */
38
+ export declare function sendsOnEnter(event: ReactKeyboardEvent<HTMLTextAreaElement>): boolean;
26
39
  export interface CommentThreadCardProps {
27
40
  controller: CommentController;
28
41
  thread: CommentThread;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Comments on passages of a record's text, rendered from a `usePassageComments` controller:
3
+ *
4
+ * - `CommentableText`: around a text input or textarea. Selecting words offers Comment; the field is tinted while it
5
+ * holds open threads, with a count that opens the first one; an opened thread selects its words.
6
+ * - `CommentableRichText`: around rich text (the Markdown editor, or rendered Markdown). It highlights every thread's
7
+ * passage, follows the text as it is edited and laid out, offers Comment on a selection, and a click on a highlight
8
+ * opens its thread.
9
+ * - `PassageCommentPane`: the standard comment pane for these threads: each card shows its field and quote (Text
10
+ * changed when the words are gone), the Open and Resolved filter, the new comment box, replies, Resolve and Delete.
11
+ * Put it in a `SidePane` beside the record.
12
+ */
13
+ import React, { type ReactNode } from 'react';
14
+ import { type Words } from '../../words';
15
+ import type { PassageCommentController } from './usePassageComments';
16
+ export interface CommentableTextProps {
17
+ comments: PassageCommentController;
18
+ /** The field's key, as declared in `fields`. */
19
+ field: string;
20
+ /** The field's value as edited on screen. */
21
+ value: string;
22
+ /** The field: anything holding one text input or textarea (`FieldText`, `FieldLongText`). */
23
+ children: ReactNode;
24
+ className?: string;
25
+ }
26
+ export declare function CommentableText({ comments, field, value, children, className }: CommentableTextProps): React.JSX.Element;
27
+ export interface CommentableRichTextProps {
28
+ comments: PassageCommentController;
29
+ /** The field's key, as declared in `fields`. */
30
+ field: string;
31
+ /** The text: `MarkdownEditor`, `Markdown`, or any element holding it. */
32
+ children: ReactNode;
33
+ className?: string;
34
+ }
35
+ export declare function CommentableRichText({ comments, field, children, className }: CommentableRichTextProps): React.JSX.Element;
36
+ export interface PassageCommentPaneProps {
37
+ comments: PassageCommentController;
38
+ /** Closes the pane: shows a close button in its heading. */
39
+ onClose?(): void;
40
+ /** The heading. Default "Comments". */
41
+ title?: string;
42
+ /**
43
+ * Names of the other groups (for example `{ FR: w('the French copy', 'la version française') }`) and how to show
44
+ * one: the pane then says how many open threads each other group holds, as a link to it.
45
+ */
46
+ groups?: Readonly<Record<string, Words>>;
47
+ onGroup?(group: string): void;
48
+ className?: string;
49
+ }
50
+ export declare function PassageCommentPane({ comments, onClose, title, groups, onGroup, className }: PassageCommentPaneProps): React.JSX.Element;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Pictures and files attached to a comment before it is sent: paste a picture, drop files on the box or pick them with
3
+ * the paperclip. Each file uploads at once (`controller.uploadFile`) and shows as a chip with its progress and a remove
4
+ * control; Send waits for every chip to be ready. A failed upload keeps the chip (Remove, and Try again when another try
5
+ * can help) and never the typed text. The comment row is written only on Send, with the uploaded references in its Attachments column.
6
+ */
7
+ import React, { type ClipboardEvent, type DragEvent } from 'react';
8
+ import type { CommentController, CommentFile } from './useComments';
9
+ /** Files one comment carries at most. */
10
+ export declare const COMMENT_MAX_FILES = 10;
11
+ export interface CommentFileDraft {
12
+ id: string;
13
+ name: string;
14
+ /** A local picture shown while it uploads (an object URL), or null for other files. */
15
+ thumb: string | null;
16
+ state: 'uploading' | 'ready' | 'failed';
17
+ /** 0 to 100 while uploading. */
18
+ percent: number;
19
+ file: File;
20
+ uploaded: CommentFile | null;
21
+ error: string | null;
22
+ /** False when trying the same file again cannot help (too large, a refused kind, empty, no upload here). */
23
+ retryable: boolean;
24
+ }
25
+ export interface CommentFilesState {
26
+ drafts: CommentFileDraft[];
27
+ /** The uploaded files, in order, once none is still uploading or failed. */
28
+ ready: CommentFile[];
29
+ uploading: boolean;
30
+ failed: boolean;
31
+ /** Something the box can send with: no upload running and none failed. */
32
+ settled: boolean;
33
+ add(files: Iterable<File>): void;
34
+ remove(id: string): void;
35
+ retry(id: string): void;
36
+ /** Forget every chip (after Send). */
37
+ clear(): void;
38
+ dragging: boolean;
39
+ /** Paste and drop handlers for the box. */
40
+ boxHandlers: {
41
+ onPaste(event: ClipboardEvent<HTMLElement>): void;
42
+ onDragOver(event: DragEvent<HTMLElement>): void;
43
+ onDragLeave(event: DragEvent<HTMLElement>): void;
44
+ onDrop(event: DragEvent<HTMLElement>): void;
45
+ };
46
+ }
47
+ /** The attachment queue of one comment box. */
48
+ export declare function useCommentFiles(controller: CommentController): CommentFilesState;
49
+ /** The paperclip that opens the file picker. Renders nothing when the pane is text only. */
50
+ export declare function CommentAttachButton({ controller, files, disabled }: {
51
+ controller: CommentController;
52
+ files: CommentFilesState;
53
+ disabled?: boolean;
54
+ }): React.JSX.Element | null;
55
+ /** The chips of the files attached to a box: a thumbnail or a file icon, the name, progress, and remove. */
56
+ export declare function CommentFileChips({ controller, files }: {
57
+ controller: CommentController;
58
+ files: CommentFilesState;
59
+ }): React.JSX.Element | null;
60
+ /** The "Drop to attach" veil over a box while files are dragged over it. */
61
+ export declare function CommentDropVeil({ controller, files }: {
62
+ controller: CommentController;
63
+ files: CommentFilesState;
64
+ }): React.JSX.Element | null;
@@ -18,11 +18,14 @@
18
18
  * | Change | select | The last change made here: created, replied, answered, resolved, reopened, deleted. |
19
19
  * | Changed at | date | When that change was made; the digest lists changes after the checkpoint. |
20
20
  * | Example | checkbox | A sample comment shown with an Example badge. |
21
+ * | Attachments | files | Pictures and files the author shows with the comment (optional). |
21
22
  *
22
23
  * Every column name can be renamed with `CommentColumns`; the defaults are the Slides names, so a Space that copies
23
24
  * the Slides table needs no mapping and no migration. Zones are opt-in: a table that adds W and H number columns
24
25
  * passes `{ w: 'W', h: 'H' }`. Without them (`w` and `h` null, the default) a drag on the anchor places a pin where it
25
- * started, and nothing writes a column the table does not have.
26
+ * started, and nothing writes a column the table does not have. Attachments are shown when the table has the files
27
+ * column; the pane also lets people attach pictures and files to a new comment or a reply when the host can upload
28
+ * them (`runtime.spaceFiles`). A table without the column shows none and takes text only.
26
29
  */
27
30
  export type CommentRow = Record<string, unknown>;
28
31
  export type CommentNeeds = 'none' | 'check' | 'choice' | 'input';
@@ -48,6 +51,8 @@ export interface CommentColumns {
48
51
  change: string;
49
52
  changedAt: string;
50
53
  example: string;
54
+ /** The files column read for pictures and files shown with a comment. Null: the table has none. */
55
+ attachments: string | null;
51
56
  }
52
57
  export declare const COMMENT_COLUMNS: Readonly<CommentColumns>;
53
58
  export declare function commentColumns(columns?: Partial<CommentColumns>): CommentColumns;
@@ -73,6 +78,28 @@ export interface CommentRecord {
73
78
  changedAt: string | null;
74
79
  example: boolean;
75
80
  createdAt: string | null;
81
+ attachments: CommentAttachment[];
82
+ /**
83
+ * The agent that wrote this comment, from the server's write record (never the Author column): its name and,
84
+ * for the person whose agent it is, the thread it works in. Absent on comments a person wrote.
85
+ */
86
+ agent?: CommentAgent | null;
87
+ }
88
+ /** An agent author, as the server stamped it. `threadId` is only given to the agent's owner. */
89
+ export interface CommentAgent {
90
+ name: string;
91
+ threadId: string | null;
92
+ rowId: string | null;
93
+ }
94
+ /**
95
+ * A picture or file shown with a comment. `label` is the name without its extension: a choice option with the same
96
+ * label is answered from under that picture ("Before.png" and "After.png" with Options "Before | After").
97
+ */
98
+ export interface CommentAttachment {
99
+ name: string;
100
+ label: string;
101
+ url: string;
102
+ image: boolean;
76
103
  }
77
104
  /** The record a thread sits on (a slide, a section). `order` numbers it in the digest and the card meta. */
78
105
  export interface CommentAnchor {
@@ -93,6 +120,27 @@ export interface CommentThread {
93
120
  replies: CommentRecord[];
94
121
  anchor: CommentAnchor | undefined;
95
122
  }
123
+ /** The text of one column of a comment row (text, select, number or date), '' when empty or missing. */
124
+ export declare function commentText(row: CommentRow, name: string | null): string;
125
+ /** An http(s) link without credentials, or a site path: anything else (script URLs, `//host`) opens nothing. */
126
+ export declare function safeCommentUrl(value: string): string | null;
127
+ /** A files value (`{ name, url }` items, the other shapes above, or URLs) as the pictures and files a comment shows. */
128
+ export declare function commentAttachmentList(value: unknown): CommentAttachment[];
129
+ /** The picture a choice option names (same label, any case), when there is one. */
130
+ export declare function commentAttachmentFor(option: string, attachments: readonly CommentAttachment[]): CommentAttachment | undefined;
131
+ /** A comment's text in pieces: plain text, and http(s) links with a short label (host and path). */
132
+ export type CommentBodyPart = {
133
+ text: string;
134
+ } | {
135
+ href: string;
136
+ label: string;
137
+ };
138
+ export declare function commentBodyParts(body: string): CommentBodyPart[];
139
+ /**
140
+ * Whether the rows show the files column: true or false from the first row that carries properties, null when no row
141
+ * does (an empty table). A list row carries every property of its database by name, filled or empty.
142
+ */
143
+ export declare function commentRowsHaveColumn(rows: readonly CommentRow[], name: string | null): boolean | null;
96
144
  /** One Comments row as a comment. An author outside `authors` (when given) reads as `fallbackAuthor`. */
97
145
  export declare function readCommentRow(row: CommentRow, options?: {
98
146
  columns?: Partial<CommentColumns>;
@@ -40,6 +40,8 @@ export declare const COMMENT_WORDS: Readonly<{
40
40
  looksGood: Words;
41
41
  undo: Words;
42
42
  attach: Words;
43
+ attachments: Words;
44
+ enlarge: Words;
43
45
  paste: Words;
44
46
  sent: Words;
45
47
  example: Words;
@@ -48,9 +50,33 @@ export declare const COMMENT_WORDS: Readonly<{
48
50
  emptyResolved: Words;
49
51
  saveError: Words;
50
52
  textOnly: Words;
53
+ attachFiles: Words;
54
+ dropFiles: Words;
55
+ fileUploading: Words;
56
+ fileReady: Words;
57
+ fileRemove: Words;
58
+ fileRetry: Words;
59
+ fileTooLarge: Words;
60
+ fileType: Words;
61
+ fileEmpty: Words;
62
+ fileFailed: Words;
63
+ fileTooMany: Words;
64
+ filesUnavailable: Words;
51
65
  newActivity: Words;
66
+ fromAgent: Words;
67
+ openAgentThread: Words;
52
68
  pin: Words;
53
69
  zone: Words;
70
+ comment: Words;
71
+ commentOnSelection: Words;
72
+ openFieldComments: Words;
73
+ textChanged: Words;
74
+ textChangedHint: Words;
75
+ selectToComment: Words;
76
+ emptyPassages: Words;
77
+ inGroup: Words;
78
+ closeComments: Words;
79
+ readError: Words;
54
80
  }>;
55
81
  export type CommentWordKey = keyof typeof COMMENT_WORDS;
56
82
  export type CommentWords = Readonly<Record<CommentWordKey, Words>>;
@@ -2,3 +2,7 @@ export * from './commentModel';
2
2
  export * from './commentWords';
3
3
  export * from './useComments';
4
4
  export * from './CommentPane';
5
+ export * from './commentFiles';
6
+ export * from './passageModel';
7
+ export * from './usePassageComments';
8
+ export * from './PassageComments';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Comments on a passage of a record's text (pure; no React). A thread can sit on words of a property (a subject, a
3
+ * Markdown body) instead of a pin: the comment row keeps which field it is on, the quoted words and a few words
4
+ * before and after them. The quote is found again in the text as it is now, white space ignored, the surrounding
5
+ * words telling apart several matches; when the quoted words are gone the thread reads Text changed.
6
+ *
7
+ * The Comments table needs these columns besides the `CommentColumns` ones:
8
+ *
9
+ * | Column | Type | Meaning |
10
+ * | ------ | ---- | ----------------------------------------------------------------------- |
11
+ * | Field | text or select | Which field the passage is in (the field's key by default). |
12
+ * | Quote | text | The selected words (white space collapsed, at most 1000 characters). |
13
+ * | Prefix | text | Up to 40 characters before the quote, to tell apart repeated words. |
14
+ * | Suffix | text | Up to 40 characters after it. |
15
+ *
16
+ * Every name can be changed with `PassageColumns`. A field can also be named by several columns (`values`), for
17
+ * example a Field and a Language column for the same property in two languages.
18
+ */
19
+ import type { Words } from '../../words';
20
+ import { type CommentRow } from './commentModel';
21
+ /** The words a thread sits on, with the words around them. */
22
+ export interface TextPassage {
23
+ quote: string;
24
+ prefix: string;
25
+ suffix: string;
26
+ }
27
+ /** A passage in one field of the record. */
28
+ export interface PassageAnchor extends TextPassage {
29
+ field: string;
30
+ }
31
+ /** A text property comments can sit on. */
32
+ export interface PassageField {
33
+ /** The Space's own name for the field (`subject`, `bodyEn`). */
34
+ key: string;
35
+ /** Its name in the pane, above each quote. */
36
+ label: Words;
37
+ /**
38
+ * The values that name this field on a comment row: written with each new comment, and a row whose columns hold
39
+ * all of them is on this field. Default `{ [columns.field]: key }`.
40
+ */
41
+ values?: Readonly<Record<string, string>>;
42
+ /** Fields shown together, such as one language. The pane lists the threads of the group on screen. */
43
+ group?: string;
44
+ /** The value is Markdown: Text changed and the reading order look at its words, not its syntax. */
45
+ markdown?: boolean;
46
+ }
47
+ export interface PassageColumns {
48
+ field: string;
49
+ quote: string;
50
+ prefix: string;
51
+ suffix: string;
52
+ }
53
+ export declare const PASSAGE_COLUMNS: Readonly<PassageColumns>;
54
+ export declare function passageColumns(columns?: Partial<PassageColumns>): PassageColumns;
55
+ /** Characters kept before and after a quote. */
56
+ export declare const PASSAGE_CONTEXT = 40;
57
+ /** The longest quote kept. */
58
+ export declare const PASSAGE_MAX_QUOTE = 1000;
59
+ /** The column values naming a field on a comment row. */
60
+ export declare function passageFieldValues(field: PassageField, columns?: PassageColumns): Readonly<Record<string, string>>;
61
+ /**
62
+ * Finds a passage in `text`, white space ignored (line breaks and block gaps move with edits). With several matches,
63
+ * the one whose surrounding words best match the stored prefix and suffix. Offsets in `text`, or null when the quoted
64
+ * words are gone.
65
+ */
66
+ export declare function locatePassage(text: string, passage: TextPassage): {
67
+ start: number;
68
+ end: number;
69
+ } | null;
70
+ /** The passage between two offsets of `text`, with its prefix and suffix; null when only white space is selected. */
71
+ export declare function passageAt(text: string, start: number, end: number): TextPassage | null;
72
+ /** The words a reader sees in Markdown source: link and image targets, HTML tags and markup characters left out. */
73
+ export declare function markdownReadableText(source: string): string;
74
+ /**
75
+ * Where a passage starts in a field's value, or null when its words are no longer there. For Markdown the words are
76
+ * looked for in what a reader sees (the offset is then proportional), then in the source itself.
77
+ */
78
+ export declare function passageOffset(value: string, passage: TextPassage, markdown?: boolean): number | null;
79
+ /** The passage a comment row sits on, with its field, or null when it has none or its field is not declared. */
80
+ export declare function readPassage(row: CommentRow, fields: readonly PassageField[], columns?: PassageColumns): PassageAnchor | null;
81
+ /** The properties a new comment on `passage` writes besides its body, author and status. */
82
+ export declare function passageProperties(passage: PassageAnchor, field: PassageField, columns?: PassageColumns): Record<string, unknown>;
@@ -38,9 +38,23 @@ export interface CommentZoneHandlers {
38
38
  onPointerUp(event: ReactPointerEvent<HTMLElement>): void;
39
39
  onPointerCancel(event: ReactPointerEvent<HTMLElement>): void;
40
40
  }
41
+ /**
42
+ * A file uploaded for a comment that is not sent yet: `name` and `url` go into the Attachments column, `previewUrl`
43
+ * shows it until the saved comment is read back.
44
+ */
45
+ export interface CommentFile {
46
+ name: string;
47
+ url: string;
48
+ previewUrl?: string | null;
49
+ }
50
+ /** Whether new comments and replies can carry pictures and files. */
51
+ export type CommentAttachMode = 'on' | 'off' | 'checking';
41
52
  export interface CommentActions {
42
- /** Adds a reply. A reply reopens a resolved thread and answers an open input ask. True once saved. */
43
- reply(thread: CommentThread, body: string): Promise<boolean>;
53
+ /**
54
+ * Adds a reply, with the files already uploaded for it. A reply reopens a resolved thread and answers an open input
55
+ * ask. True once saved.
56
+ */
57
+ reply(thread: CommentThread, body: string, files?: readonly CommentFile[]): Promise<boolean>;
44
58
  /** Answers a check or choice ask. */
45
59
  answer(root: CommentRecord, answer: string): void;
46
60
  setStatus(root: CommentRecord, status: 'Open' | 'Resolved'): void;
@@ -121,8 +135,22 @@ export interface CommentController {
121
135
  /** In Add comment mode: a click on the element drops a pin, a press and drag marks a zone. */
122
136
  zoneHandlers(anchorKey: string | null): CommentZoneHandlers;
123
137
  cancelPin(): void;
124
- /** Saves the new comment. True once saved. */
125
- sendNew(body: string): Promise<boolean>;
138
+ /** Saves the new comment with the files already uploaded for it. True once saved. */
139
+ sendNew(body: string, files?: readonly CommentFile[]): Promise<boolean>;
140
+ /**
141
+ * 'on' when people can attach pictures and files: the table has the Attachments column and the host uploads files
142
+ * (signed-in Editors in Notis; never on a Site, a link or a preview). 'off' leaves the pane text only.
143
+ */
144
+ attach: CommentAttachMode;
145
+ /** The largest file the host takes, in bytes. */
146
+ maxFileBytes: number;
147
+ /** Uploads one file for a comment not sent yet. Throws a `SpaceFileError` with a code the pane words. */
148
+ uploadFile(file: File, options?: {
149
+ onProgress?(sent: number, total: number): void;
150
+ signal?: AbortSignal;
151
+ }): Promise<CommentFile>;
152
+ /** A shown picture failed to load (its signed address expired): reads the comments again, at most twice a minute. */
153
+ refreshFiles(): void;
126
154
  deleting: CommentRecord | null;
127
155
  cancelDelete(): void;
128
156
  confirmDelete(): Promise<void>;
@@ -138,6 +166,8 @@ export interface CommentController {
138
166
  say(key: CommentWordKey, vars?: Readonly<Record<string, string | number>>): string;
139
167
  locale: Locale;
140
168
  me: string;
169
+ /** Opens an agent's thread in the side chat; undefined on hosts without one. */
170
+ openThread?: (threadId: string) => void;
141
171
  loading: boolean;
142
172
  hasData: boolean;
143
173
  error: Error | null;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The controller for comments on passages of a record's text: a `useComments` controller (reading, live feed,
3
+ * replies, Resolve, Delete) plus where each thread sits (its field and quoted words), the comment being written on a
4
+ * selection, which threads read Text changed, and the reading order. `CommentableText`, `CommentableRichText` and
5
+ * `PassageCommentPane` render from it.
6
+ */
7
+ import { type CommentThread } from './commentModel';
8
+ import { type CommentController, type UseCommentsOptions } from './useComments';
9
+ import { type PassageAnchor, type PassageColumns, type PassageField } from './passageModel';
10
+ /** Where a thread was opened: its highlight in the text, its card or its quote in the pane, or a link to one comment. */
11
+ export type PassageOpenedFrom = 'passage' | 'pane' | 'quote' | 'link';
12
+ export interface UsePassageCommentsOptions extends Omit<UseCommentsOptions, 'anchors' | 'anchorKey' | 'onSelectThread'> {
13
+ /** The text properties comments can sit on, in reading order. */
14
+ fields: readonly PassageField[];
15
+ /** Column names of the passage (Field, Quote, Prefix, Suffix by default). */
16
+ passageColumns?: Partial<PassageColumns>;
17
+ /**
18
+ * Each field's value as edited on screen, by field key: a thread whose words are no longer there reads Text
19
+ * changed, and threads list in reading order. A field left out is never marked changed.
20
+ */
21
+ values?: Readonly<Record<string, string>>;
22
+ /** The group of fields on screen (a language). Null: every field. */
23
+ group?: string | null;
24
+ /** A thread was opened. Show its field (switch to its group, open the pane) before its passage flashes. */
25
+ onOpen?(thread: CommentThread, passage: PassageAnchor | undefined, from: PassageOpenedFrom): void;
26
+ /** A selection started a new comment: show the pane, which holds its box. */
27
+ onDraft?(passage: PassageAnchor): void;
28
+ /** Open the thread of this comment (a root or a reply) once it is read: a link to one comment. */
29
+ focusKey?: string | null;
30
+ }
31
+ export interface PassageCommentController {
32
+ /** The underlying comment controller: thread cards, Resolve, Delete, the status filter and the toast. */
33
+ controller: CommentController;
34
+ fields: readonly PassageField[];
35
+ field(key: string): PassageField | undefined;
36
+ /** The passage a thread's first comment sits on; undefined for a comment on the whole record. */
37
+ passageOf(rootKey: string): PassageAnchor | undefined;
38
+ group: string | null;
39
+ /** Threads of a group (default: the group on screen; null: all), open ones first, each in reading order. */
40
+ threads(group?: string | null): CommentThread[];
41
+ /** Threads on one field, in reading order. */
42
+ threadsOn(field: string): CommentThread[];
43
+ /** Open threads of a group (default: the group on screen; null: all). */
44
+ openCount(group?: string | null): number;
45
+ /** Whether a thread's quoted words are gone from its field. */
46
+ isChanged(rootKey: string): boolean;
47
+ /** The comment being written on a selection. */
48
+ draft: PassageAnchor | null;
49
+ startDraft(passage: PassageAnchor): void;
50
+ cancelDraft(): void;
51
+ /** Saves the draft. True once saved; its thread is then selected. */
52
+ send(body: string): Promise<boolean>;
53
+ sending: boolean;
54
+ /** The last send failed. */
55
+ failed: boolean;
56
+ /** The thread whose passage flashes, whether to scroll to it, and a count that changes on each flash. */
57
+ flash: {
58
+ key: string;
59
+ scroll: boolean;
60
+ n: number;
61
+ } | null;
62
+ open(thread: CommentThread, from: PassageOpenedFrom): void;
63
+ openKey(rootKey: string, from: PassageOpenedFrom): void;
64
+ /** Rich text on screen reports which passages it shows: Text changed then follows what is rendered. */
65
+ reportFound(field: string, keys: ReadonlySet<string> | null): void;
66
+ }
67
+ export declare function usePassageComments(options: UsePassageCommentsOptions): PassageCommentController;
@@ -9,6 +9,6 @@ export { KeyboardEngine, ShortcutScope } from './KeyboardEngine';
9
9
  export type { KeyboardEngineProps, ShortcutScopeProps } from './KeyboardEngine';
10
10
  export { HelpSheet } from './HelpSheet';
11
11
  export type { HelpSheetProps } from './HelpSheet';
12
- export { stepCursor } from './step';
13
- export type { StepOptions } from './step';
12
+ export { continuationOf, stepCursor, travelBetween } from './step';
13
+ export type { StepOptions, TravelDirection } from './step';
14
14
  export type { EngineHost, EngineSettings, HelpEntry, OwnerKind, ScopeHandle, ShortcutDef, ShortcutGroup, } from './types';
@@ -9,3 +9,12 @@ export interface StepOptions {
9
9
  * spinning back to the top. No cursor: J lands on the first item, K on the last.
10
10
  */
11
11
  export declare function stepCursor(ids: readonly string[], cursor: string | null | undefined, delta: number, options?: StepOptions): string | null;
12
+ /** The way the cursor last moved through a list. A removal continues that way (iOS Photos). */
13
+ export type TravelDirection = 'next' | 'previous';
14
+ /** The way a move from `from` to `to` went in `ids`; null when either is not in the list or nothing moved. */
15
+ export declare function travelBetween(ids: readonly string[], from: string | null | undefined, to: string | null | undefined): TravelDirection | null;
16
+ /**
17
+ * The id that takes `gone`'s place after it left `previous` (`now` holds the ids still listed): the nearest one still
18
+ * there in the travel direction, else the nearest the other way. Null when none is left.
19
+ */
20
+ export declare function continuationOf(previous: readonly string[], now: readonly string[] | ReadonlySet<string>, gone: string, direction?: TravelDirection): string | null;
@@ -12,7 +12,8 @@
12
12
  * until the next save, a cancel or a clean form. Save shows Saving while the returned promise runs.
13
13
  *
14
14
  * The bar is sticky at the bottom. Only while it sits in the corner of the floating Notis button (bottom right of the
15
- * window, from the host's --notis-fab-safe-* vars) does it keep Save clear of the button (data-fab).
15
+ * window, from the host's --notis-fab-safe-* vars) does it keep Save clear of the button (data-fab). The field holding
16
+ * focus never stays under the bar: the reader scrolls it clear when the bar appears, on focus and while typing.
16
17
  */
17
18
  import { type ReactNode } from 'react';
18
19
  import { type Words } from '../../words';
@@ -52,3 +52,7 @@ export { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, ComposedChart, Lab
52
52
  export * from './fields';
53
53
  export * from './comments';
54
54
  export * from './present';
55
+ export { CloudComputerWaking } from './cloud/CloudComputerWaking';
56
+ export type { CloudComputerWakingProps } from './cloud/CloudComputerWaking';
57
+ export { CloudComputerFrame } from './cloud/CloudComputerFrame';
58
+ export type { CloudComputerFrameProps } from './cloud/CloudComputerFrame';
@@ -6,6 +6,13 @@
6
6
  * the open item, as navigation decides. The open item then slides over the list and comes
7
7
  * back with Back (and Esc when `onBack` is given).
8
8
  *
9
+ * Side by side, the reader's edge works like the chat edge. Dragging it wider pushes the list
10
+ * down to its minimum, then the reader slides over the list, leaving an 80px strip of it
11
+ * (`clampChosenWidth`). A 200ms rest of the pointer on that strip, or keyboard focus moving
12
+ * into the list, gives the list its minimum back until the pointer returns to the reader
13
+ * (`coverReveal`, the chat's own rule). The default width only pushes: without a chosen width
14
+ * the reader never covers the list.
15
+ *
9
16
  * The switch is a container query on the Panels element (`nui-panels`, 680px for the
10
17
  * defaults), not a viewport query and not the host's `data-chat-narrowed` flag: a Space
11
18
  * renders in a shadow root, where ancestor attribute variants never reach, and its width is
@@ -17,9 +24,9 @@ export type PanelsMode = 'split' | 'stacked';
17
24
  export interface PanelsState {
18
25
  /** `split`: list and reader side by side. `stacked`: one pane, the reader over the list. */
19
26
  mode: PanelsMode;
20
- /** The reader width on screen in split mode, inside the container. */
27
+ /** The reader width on screen in split mode, inside the container (narrower while the covered list is revealed). */
21
28
  readerWidth: number;
22
- /** Choose a reader width (clamped to the container, stored under `storageKey`). */
29
+ /** Choose a reader width (clamped to the container, stored under `storageKey`). Past the list minimum it slides over the list. */
23
30
  setReaderWidth(px: number): void;
24
31
  /** A reader is open. */
25
32
  readerOpen: boolean;