@notis_ai/cli 0.2.25 → 0.2.26

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 (157) 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 +2784 -541
  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/design.md +37 -18
  15. package/dist/base-skills/notis-spaces/references/reading.md +8 -1
  16. package/dist/base-skills/notis-spaces/references/reports.md +6 -6
  17. package/dist/base-skills/notis-spaces/references/sdk.md +71 -7
  18. package/dist/base-skills/notis-spaces/references/store.md +22 -13
  19. package/dist/base-skills/notis-spaces/references/views.md +99 -6
  20. package/dist/sdk/package.json +3 -0
  21. package/dist/sdk/src/cloudComputerWords.ts +53 -0
  22. package/dist/sdk/src/components/Audience.tsx +76 -0
  23. package/dist/sdk/src/components/DocumentPage.tsx +15 -4
  24. package/dist/sdk/src/components/MarkdownEditor.tsx +44 -14
  25. package/dist/sdk/src/components/MultiSelectActionBar.tsx +16 -5
  26. package/dist/sdk/src/components/Skeleton.tsx +162 -6
  27. package/dist/sdk/src/hooks/useAction.ts +12 -2
  28. package/dist/sdk/src/hooks/useAgentQueue.ts +125 -0
  29. package/dist/sdk/src/hooks/useCloudComputerJob.ts +142 -0
  30. package/dist/sdk/src/hooks/useCloudComputerService.ts +388 -0
  31. package/dist/sdk/src/hooks/useCloudComputerShell.ts +95 -7
  32. package/dist/sdk/src/hooks/useCollectionInteractions.ts +40 -2
  33. package/dist/sdk/src/hooks/useItemThread.ts +58 -0
  34. package/dist/sdk/src/hooks/useMarqueeSelection.ts +6 -1
  35. package/dist/sdk/src/hooks/useNativeDocuments.ts +61 -8
  36. package/dist/sdk/src/hooks/useNotisNavigation.ts +31 -8
  37. package/dist/sdk/src/hooks/useQuery.ts +67 -10
  38. package/dist/sdk/src/hooks/useViewParams.ts +47 -11
  39. package/dist/sdk/src/index.ts +31 -4
  40. package/dist/sdk/src/interactions.ts +2 -0
  41. package/dist/sdk/src/nativeData.ts +2 -0
  42. package/dist/sdk/src/optimisticRows.ts +329 -0
  43. package/dist/sdk/src/perf.ts +188 -0
  44. package/dist/sdk/src/provider.tsx +2 -1
  45. package/dist/sdk/src/queryCache.ts +366 -17
  46. package/dist/sdk/src/runtime.ts +55 -4
  47. package/dist/sdk/src/skeleton.ts +103 -0
  48. package/dist/sdk/src/space.ts +662 -28
  49. package/dist/sdk/src/spacePublicUI.ts +36 -0
  50. package/dist/sdk/src/ui/engine/step.ts +54 -0
  51. package/dist/sdk/src/ui/icons.tsx +3 -1
  52. package/dist/sdk/src/words/shell.ts +1 -0
  53. package/dist/skill-sync/index.js +7 -2
  54. package/dist/skill-sync-worker.mjs +40 -26
  55. package/dist/space-harness/host.js +272 -105
  56. package/dist/space-sdk/dist/chunk-BWHAORT4.js +5 -0
  57. package/dist/space-sdk/dist/index.js +9 -4
  58. package/dist/space-sdk/dist/ui.js +12 -12
  59. package/dist/space-sdk/package.json +3 -0
  60. package/dist/space-sdk/src/cloudComputerWords.d.ts +34 -0
  61. package/dist/space-sdk/src/components/Audience.d.ts +46 -0
  62. package/dist/space-sdk/src/components/DocumentPage.d.ts +3 -1
  63. package/dist/space-sdk/src/components/MarkdownEditor.d.ts +21 -0
  64. package/dist/space-sdk/src/components/MultiSelectActionBar.d.ts +5 -1
  65. package/dist/space-sdk/src/components/Skeleton.d.ts +7 -2
  66. package/dist/space-sdk/src/hooks/useAction.d.ts +8 -1
  67. package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +61 -0
  68. package/dist/space-sdk/src/hooks/useCloudComputerJob.d.ts +35 -0
  69. package/dist/space-sdk/src/hooks/useCloudComputerService.d.ts +75 -0
  70. package/dist/space-sdk/src/hooks/useCloudComputerShell.d.ts +36 -3
  71. package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +6 -0
  72. package/dist/space-sdk/src/hooks/useItemThread.d.ts +32 -0
  73. package/dist/space-sdk/src/hooks/useMarqueeSelection.d.ts +2 -1
  74. package/dist/space-sdk/src/hooks/useNativeDocumentBody.d.ts +1 -0
  75. package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +20 -5
  76. package/dist/space-sdk/src/hooks/useNotisNavigation.d.ts +11 -2
  77. package/dist/space-sdk/src/hooks/useQuery.d.ts +24 -2
  78. package/dist/space-sdk/src/hooks/useViewParams.d.ts +2 -0
  79. package/dist/space-sdk/src/index.d.ts +24 -4
  80. package/dist/space-sdk/src/nativeData.d.ts +6 -0
  81. package/dist/space-sdk/src/queryCache.d.ts +97 -2
  82. package/dist/space-sdk/src/runtime.d.ts +53 -4
  83. package/dist/space-sdk/src/skeleton.d.ts +42 -0
  84. package/dist/space-sdk/src/space.ts +662 -28
  85. package/dist/space-sdk/src/tailwind-candidates.d.ts +754 -5
  86. package/dist/space-sdk/src/ui/cloud/CloudComputerFrame.d.ts +29 -0
  87. package/dist/space-sdk/src/ui/cloud/CloudComputerWaking.d.ts +20 -0
  88. package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +15 -2
  89. package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +50 -0
  90. package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +64 -0
  91. package/dist/space-sdk/src/ui/comments/commentModel.d.ts +49 -1
  92. package/dist/space-sdk/src/ui/comments/commentWords.d.ts +26 -0
  93. package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
  94. package/dist/space-sdk/src/ui/comments/passageModel.d.ts +82 -0
  95. package/dist/space-sdk/src/ui/comments/useComments.d.ts +34 -4
  96. package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +67 -0
  97. package/dist/space-sdk/src/ui/engine/index.d.ts +2 -2
  98. package/dist/space-sdk/src/ui/engine/step.d.ts +9 -0
  99. package/dist/space-sdk/src/ui/fields/fields.d.ts +2 -1
  100. package/dist/space-sdk/src/ui/index.d.ts +4 -0
  101. package/dist/space-sdk/src/ui/layout/Panels.d.ts +9 -2
  102. package/dist/space-sdk/src/ui/layout/SidePane.d.ts +42 -0
  103. package/dist/space-sdk/src/ui/layout/index.d.ts +2 -1
  104. package/dist/space-sdk/src/ui/layout/panelMath.d.ts +11 -2
  105. package/dist/space-sdk/src/ui/list/ListReader.d.ts +38 -7
  106. package/dist/space-sdk/src/ui/list/Row.d.ts +4 -0
  107. package/dist/space-sdk/src/ui/list/SelectionBar.d.ts +9 -4
  108. package/dist/space-sdk/src/ui/list/useListKeys.d.ts +4 -0
  109. package/dist/space-sdk/src/words/shell.ts +1 -0
  110. package/dist/view-renderer/dist/host.js +355 -188
  111. package/dist/view-renderer/dist/theme.css +1 -1
  112. package/dist/view-renderer/src/host.tsx +4 -1
  113. package/dist/view-renderer/src/index.js +3 -0
  114. package/dist/view-renderer/src/pool.js +8 -4
  115. package/dist/view-renderer/src/renderer.js +92 -23
  116. package/dist/view-renderer/src/skeleton.js +450 -0
  117. package/package.json +4 -4
  118. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +8 -4
  119. package/skills/notis-onboarding/BRIEF.md +15 -9
  120. package/skills/notis-spaces/cli.md +43 -4
  121. package/src/command-specs/auth.js +5 -3
  122. package/src/command-specs/cc.js +410 -0
  123. package/src/command-specs/computer.js +320 -0
  124. package/src/command-specs/diagnostics.js +2 -13
  125. package/src/command-specs/documents.js +22 -4
  126. package/src/command-specs/index.js +7 -0
  127. package/src/command-specs/onboarding.js +127 -7
  128. package/src/command-specs/skills.js +2 -2
  129. package/src/command-specs/spaces.js +162 -30
  130. package/src/command-specs/tools.js +26 -8
  131. package/src/command-specs/views.js +4 -1
  132. package/src/runtime/agent-setup.js +20 -2
  133. package/src/runtime/app-boundary-validator.js +2 -1
  134. package/src/runtime/app-platform.js +13 -0
  135. package/src/runtime/auth-recovery.js +5 -0
  136. package/src/runtime/channel.js +16 -2
  137. package/src/runtime/cloud-transfer.js +587 -0
  138. package/src/runtime/computer-ssh.js +127 -0
  139. package/src/runtime/oauth.js +50 -4
  140. package/src/runtime/skill-sync/index.ts +20 -1
  141. package/src/runtime/skill-sync/local-scanner.ts +1 -0
  142. package/src/runtime/skill-sync/types.ts +2 -0
  143. package/src/runtime/space-audience.js +94 -0
  144. package/src/runtime/space-collection-scaffold.js +2 -1
  145. package/src/runtime/space-fixture-broker.js +2 -1
  146. package/src/runtime/space-lock.js +1 -4
  147. package/src/runtime/space-platform.js +18 -2
  148. package/src/runtime/space-source.js +105 -7
  149. package/src/runtime/space-test-server.js +13 -2
  150. package/src/runtime/space-verification.js +99 -6
  151. package/src/runtime/space-view-manifest.js +22 -4
  152. package/src/runtime/sync-skills.js +24 -20
  153. package/src/runtime/transport.js +19 -0
  154. package/src/runtime/view-render.js +2 -2
  155. package/template/.harness/index.html.tmpl +1 -1
  156. package/dist/skill-sync/index.js.map +0 -7
  157. package/dist/space-sdk/dist/chunk-SVZATGZB.js +0 -5
@@ -2,6 +2,9 @@
2
2
  "name": "@notis/sdk",
3
3
  "version": "0.2.0",
4
4
  "type": "module",
5
+ "sideEffects": [
6
+ "*.css"
7
+ ],
5
8
  "exports": {
6
9
  ".": {
7
10
  "types": "./src/index.d.ts",
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The words of the Cloud Computer hooks and `CloudComputerWaking`, in English and French. `{seconds}` is a wait in
3
+ * seconds and `{price}` an hourly price already formatted for the reader's language.
4
+ */
5
+ import { type Locale, type Words } from './words';
6
+ export declare const CLOUD_COMPUTER_WORDS: Readonly<{
7
+ starting: Words;
8
+ startingHint: Words;
9
+ restoring: Words;
10
+ restoringHint: Words;
11
+ restoringTimedOut: Words;
12
+ failedTitle: Words;
13
+ failedGeneric: Words;
14
+ timedOut: Words;
15
+ noAnswer: Words;
16
+ retry: Words;
17
+ approvalTitle: Words;
18
+ approvalHint: Words;
19
+ allow: Words;
20
+ retryIn: Words;
21
+ priceInfo: Words;
22
+ price: Words;
23
+ unavailable: Words;
24
+ noGate: Words;
25
+ notOffered: Words;
26
+ frameTitle: Words;
27
+ frameOpening: Words;
28
+ frameFailed: Words;
29
+ }>;
30
+ export type CloudComputerWordKey = keyof typeof CLOUD_COMPUTER_WORDS;
31
+ /** "$0.14" in English, "0,14 $" in French; three decimals under one cent. */
32
+ export declare function formatHourlyPrice(usd: number, locale: Locale): string;
33
+ /** "About $0.14 per hour while it runs, from your credit." in both languages, or null when the price is unknown. */
34
+ export declare function cloudComputerPriceWords(hourlyUsd: number | null | undefined): Words | null;
@@ -0,0 +1,46 @@
1
+ import { type CSSProperties, type ReactElement, type ReactNode } from 'react';
2
+ import { type SpaceAudience } from '../space';
3
+ /** The words of the view-as switch, in English and French. */
4
+ export declare const AUDIENCE_WORDS: Readonly<{
5
+ viewAsPublic: {
6
+ en: string;
7
+ fr: string;
8
+ };
9
+ backToEditing: {
10
+ en: string;
11
+ fr: string;
12
+ };
13
+ }>;
14
+ export interface UseAudienceResult {
15
+ /** Who the page is drawn for. `public` while an editor views the Space as the public. */
16
+ audience: SpaceAudience;
17
+ /** An editor is viewing this Space as the public. */
18
+ viewingAsPublic: boolean;
19
+ /** The viewer is an editor and this host can switch View as the public on and off. */
20
+ canViewAsPublic: boolean;
21
+ /** Switch View as the public on or off; does nothing where `canViewAsPublic` is false. */
22
+ setViewingAsPublic(on: boolean): void;
23
+ }
24
+ /**
25
+ * Who the Space is drawn for: its editors or the public (Site and link visitors, signed-in people who cannot edit).
26
+ * Outside a Space, and on servers that predate audiences, the answer is `public`. The server enforces the same
27
+ * split, so this only decides what differs on screen.
28
+ */
29
+ export declare function useAudience(): UseAudienceResult;
30
+ /** Shown to the Space's editors only (never while they view it as the public). */
31
+ export declare function Editors({ children }: {
32
+ children?: ReactNode;
33
+ }): ReactElement | null;
34
+ /** Shown to the public only, and to editors viewing the Space as the public. */
35
+ export declare function Public({ children }: {
36
+ children?: ReactNode;
37
+ }): ReactElement | null;
38
+ export interface ViewAsPublicProps {
39
+ className?: string;
40
+ style?: CSSProperties;
41
+ }
42
+ /**
43
+ * The View as the public switch, placed by the Space's own page. Editors only: renders nothing for the public and
44
+ * on hosts that cannot switch. The host's Share menu offers the same switch when the page does not place it.
45
+ */
46
+ export declare function ViewAsPublic({ className, style }: ViewAsPublicProps): ReactElement | null;
@@ -21,10 +21,12 @@ export declare const DOCUMENT_PAGE_GUTTER: {
21
21
  * same column width and gutter, so the page replaces it without a layout shift. Hosts show it while the
22
22
  * record and the editor load; a Space can show it while its own data decides which record opens.
23
23
  */
24
- export declare function DocumentPageSkeleton({ width, className, label }: {
24
+ export declare function DocumentPageSkeleton({ width, className, label, title }: {
25
25
  width?: NotisDocumentPageProps['width'];
26
26
  className?: string;
27
27
  label?: string;
28
+ /** The record's title when already known (from the list row that opened it): shown in place of its bar. */
29
+ title?: string | null;
28
30
  }): ReactElement;
29
31
  /**
30
32
  * The full page of one record that is the main content of a Space view, such as a note: breadcrumb,
@@ -7,5 +7,26 @@ export declare const MARKDOWN_EDITOR_WORDS: Readonly<{
7
7
  fr: string;
8
8
  };
9
9
  }>;
10
+ /** What `useMarkdownEditorDraft` gives an editor: the text to show, and what to call on a change or a save key. */
11
+ export interface MarkdownEditorDraft {
12
+ draft: string;
13
+ /** The editor's text changed (typed, pasted, a block edited). */
14
+ change: (markdown: string) => void;
15
+ /** Saves now (Cmd-S), when there is something to save. */
16
+ save: () => Promise<void>;
17
+ }
18
+ /**
19
+ * The editing state every MarkdownEditor shares, the host's and the fallback's: takes a new `value` while nothing
20
+ * is typed, autosaves `autosaveMs` after the last change through `onSave` (with the revision it opened or last
21
+ * saved), saves again when typing went on during a save, and saves what is left when the editor goes away.
22
+ */
23
+ export declare function useMarkdownEditorDraft({ value, revision, readOnly, autosaveMs, onChange, onSave, onDirtyChange, onSavingChange, }: NotisMarkdownEditorProps): MarkdownEditorDraft;
24
+ /** The plain EN/FR textarea for a draft: the fallback outside Notis, and the host's when its editor cannot open. */
25
+ export declare function MarkdownTextArea({ state, readOnly, placeholder, className }: {
26
+ state: MarkdownEditorDraft;
27
+ readOnly?: boolean;
28
+ placeholder?: string;
29
+ className?: string;
30
+ }): import("react").JSX.Element;
10
31
  /** Use Notis' editor while leaving persistence entirely under app control; outside Notis a plain EN/FR textarea stands in. */
11
32
  export declare function MarkdownEditor(props: NotisMarkdownEditorProps): ReactElement;
@@ -16,6 +16,10 @@ export interface MultiSelectActionBarProps {
16
16
  singular: string;
17
17
  plural: string;
18
18
  };
19
+ /** Complete count text in the caller's language, including plural agreement. */
20
+ selectionLabel?: string;
21
+ /** Accessible toolbar name in the caller's language. */
22
+ toolbarLabel?: string;
19
23
  /** Optional extra class on the outer container (composed alongside the inline styles). */
20
24
  className?: string;
21
25
  /** Optional override for the bar's positioning style. Defaults to bottom-center floating. */
@@ -28,4 +32,4 @@ export interface MultiSelectActionBarProps {
28
32
  isAvailable?: () => boolean;
29
33
  onClearSelection?: () => void;
30
34
  }
31
- export declare function MultiSelectActionBar({ selectedCount, actions, itemLabel, className, style, shortcutsEnabled, shortcutScope, collectionOwnerId, isAvailable, onClearSelection, }: MultiSelectActionBarProps): ReactElement | null;
35
+ export declare function MultiSelectActionBar({ selectedCount, actions, itemLabel, selectionLabel, toolbarLabel, className, style, shortcutsEnabled, shortcutScope, collectionOwnerId, isAvailable, onClearSelection, }: MultiSelectActionBarProps): ReactElement | null;
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from 'react';
1
+ import { type CSSProperties } from 'react';
2
2
  import { type Locale, type Words } from '../words/types';
3
3
  /** What a loading placeholder says to screen readers. */
4
4
  export declare const SKELETON_WORDS: Readonly<{
@@ -13,11 +13,16 @@ export declare function Skeleton({ className, style }: {
13
13
  style?: CSSProperties;
14
14
  }): import("react").JSX.Element;
15
15
  /** A whole view loading: a title bar and table, cards, graph or detail placeholders, named for screen readers in the Space's language. */
16
- export declare function ViewSkeleton({ variant, rows, label, locale }: {
16
+ export declare function ViewSkeleton({ variant, rows, label, locale, skeletonKey }: {
17
17
  variant?: 'table' | 'cards' | 'graph' | 'detail';
18
18
  rows?: number;
19
19
  /** What loads, said to screen readers ("Loading meetings"). Default "Loading content". */
20
20
  label?: Words | string;
21
21
  /** Default the Space's locale. */
22
22
  locale?: Locale;
23
+ /**
24
+ * The region this skeleton stands for. When the release carries bones measured for it at build time, they are drawn
25
+ * instead of `variant`, which is only the fallback. Give each separately loading region its own key. Default "main".
26
+ */
27
+ skeletonKey?: string;
23
28
  }): import("react").JSX.Element;
@@ -5,4 +5,11 @@ export declare function useAction<TInput extends Record<string, unknown> = Recor
5
5
  loading: boolean;
6
6
  error: Error | null;
7
7
  };
8
- export declare function useActionQuery<TResult = unknown>(actionId: string, inputs: Record<string, unknown>, options?: UseQueryOptions): UseQueryResult<TResult>;
8
+ export interface UseActionQueryOptions extends UseQueryOptions {
9
+ /**
10
+ * Always the provider's current answer, even while the view opens (a check made right before a send, say): see
11
+ * `SpaceActionOptions.fresh`. A fresh read keeps its own cached answer, apart from the same read without it.
12
+ */
13
+ fresh?: boolean;
14
+ }
15
+ export declare function useActionQuery<TResult = unknown>(actionId: string, inputs: Record<string, unknown>, options?: UseActionQueryOptions): UseQueryResult<TResult>;
@@ -0,0 +1,61 @@
1
+ import { type Words } from '../words/types';
2
+ import type { SpaceAgentQueue } from '../space';
3
+ /** What the viewer sees of one agent's latest wake-up. `idle`: nothing woke it yet. */
4
+ export type AgentQueueStatus = SpaceAgentQueue['status'];
5
+ export declare const AGENT_QUEUE_WORDS: Readonly<{
6
+ idle: Words;
7
+ queued: Words;
8
+ working: Words;
9
+ waiting: Words;
10
+ failed: Words;
11
+ done: Words;
12
+ approvalRequired: Words;
13
+ approve: Words;
14
+ openThread: Words;
15
+ unavailable: Words;
16
+ }>;
17
+ export interface UseAgentQueueResult {
18
+ status: AgentQueueStatus;
19
+ /** The status in the viewer's language. */
20
+ label: string;
21
+ /** The thread the agent works in for this scope; null until it first woke. */
22
+ threadId: string | null;
23
+ /** Items waiting in the quiet window (or for approval). */
24
+ pending: number;
25
+ /** True until the viewer allows this version's agents; offer `approve()`. */
26
+ approvalRequired: boolean;
27
+ /** Ask the viewer's permission for this Space version's agents. Held comments then wake their thread. */
28
+ approve: () => Promise<boolean>;
29
+ /** Open the agent's thread in the side chat. Resolves false when there is none or the host has no side chat. */
30
+ openThread: () => Promise<boolean>;
31
+ /** The link label in the viewer's language. */
32
+ openLabel: string;
33
+ /** Why to allow (`approvalRequired`) and the Allow button, in the viewer's language. */
34
+ approvalLabel: string;
35
+ approveLabel: string;
36
+ loading: boolean;
37
+ error: Error | null;
38
+ /** False on hosts without agents (Sites, links, the dev harness). */
39
+ available: boolean;
40
+ refresh: () => Promise<Error | null>;
41
+ }
42
+ /**
43
+ * One declared agent's latest wake-up for the signed-in viewer: Queued (in the 20 second quiet window),
44
+ * Working, Waiting for you, Failed or Done, with a link to its thread.
45
+ *
46
+ * ```tsx
47
+ * const queue = useAgentQueue('editor', deckKey);
48
+ * return (
49
+ * <span>
50
+ * {queue.label}
51
+ * {queue.approvalRequired ? <Button onClick={() => void queue.approve()}>{queue.approveLabel}</Button> : null}
52
+ * {queue.threadId ? <Button onClick={() => void queue.openThread()}>{queue.openLabel}</Button> : null}
53
+ * </span>
54
+ * );
55
+ * ```
56
+ *
57
+ * `scope` narrows to one item scope (the `Deck` column, or a root comment's key); omit it for the
58
+ * agent's latest wake-up anywhere in the Space. While the page is visible the status is read again every
59
+ * 4 seconds while the agent is queued or working, and every 15 seconds otherwise.
60
+ */
61
+ export declare function useAgentQueue(agentId: string, scope?: string | null): UseAgentQueueResult;
@@ -0,0 +1,35 @@
1
+ import type { SpaceCloudComputerJobStatus } from '../space';
2
+ export interface UseCloudComputerJobOptions {
3
+ /** How often a running job is read, in ms (default 2000, at least 500). */
4
+ pollMs?: number;
5
+ /** The most log characters kept, the newest ones (default 200000). */
6
+ maxLogChars?: number;
7
+ }
8
+ export interface UseCloudComputerJobResult {
9
+ /** The job's last known state, or null before the first read (and without a job id). */
10
+ job: SpaceCloudComputerJobStatus | null;
11
+ /** The output read so far (its newest `maxLogChars` characters). */
12
+ log: string;
13
+ /** True until the job ended and its whole output was read. */
14
+ running: boolean;
15
+ /** The last read that failed; reading goes on. */
16
+ error: Error | null;
17
+ /** False on hosts without jobs (Sites, links, verification harnesses, older hosts) or without `cloudComputer: 'shell'`. */
18
+ available: boolean;
19
+ /** Stop the job. */
20
+ cancel(): Promise<SpaceCloudComputerJobStatus | null>;
21
+ /** Read again now (and resume after repeated failures). */
22
+ refresh(): void;
23
+ }
24
+ /**
25
+ * Follow a background job started with `useCloudComputerShell().run(command, { detach: true })`: its state, and its
26
+ * output appended as it arrives, until the job ends. Reading pauses while the page is hidden.
27
+ *
28
+ * ```tsx
29
+ * const shell = useCloudComputerShell();
30
+ * const [jobId, setJobId] = useState<string | null>(null);
31
+ * const { job, log, running } = useCloudComputerJob(jobId);
32
+ * // start: setJobId((await shell.run('npm run build', { detach: true, cwd: { space: '' } })).job_id ?? null);
33
+ * ```
34
+ */
35
+ export declare function useCloudComputerJob(jobId: string | null | undefined, options?: UseCloudComputerJobOptions): UseCloudComputerJobResult;
@@ -0,0 +1,75 @@
1
+ import type { SpaceCloudComputerFrameCode, SpaceCloudComputerLeaseResult, SpaceCloudComputerMediaLink } from '../space';
2
+ export type CloudComputerServiceStatus = 'unavailable' | 'idle' | 'starting' | 'ready' | 'failed';
3
+ export interface UseCloudComputerServiceOptions {
4
+ /**
5
+ * How long a start may take before the hook says it failed, in seconds (default 90). While the machine says the
6
+ * service process runs and is getting ready (`launching`), the wait starts over on each answer.
7
+ */
8
+ waitSeconds?: number;
9
+ }
10
+ export interface UseCloudComputerServiceResult {
11
+ /** The declared service id, or null. */
12
+ id: string | null;
13
+ /**
14
+ * `unavailable`: this host offers no services (Sites, links, verification harnesses, older hosts) or the Space does
15
+ * not declare this one. `idle`: not asked yet. `starting`, `ready`, or `failed` (see `error`).
16
+ */
17
+ status: CloudComputerServiceStatus;
18
+ /** The last lease answer. */
19
+ lease: SpaceCloudComputerLeaseResult | null;
20
+ /**
21
+ * True while `starting` because the machine runs but is still restoring its files after a pause (it can take
22
+ * minutes); `CloudComputerWaking` says so instead of the usual start words.
23
+ */
24
+ restoring: boolean;
25
+ /** What went wrong while `failed`: the server's message when it gave one. */
26
+ error: Error | null;
27
+ /** The service address for `path` (`/` by default), or null until the gate serves it. */
28
+ url(path?: string): string | null;
29
+ /** `fetch` on the service with its pass. Throws while there is no gate yet. */
30
+ fetch(path: string, init?: RequestInit): Promise<Response>;
31
+ /**
32
+ * A link a media element (video, audio, img) can open without a header, seeking included: one file for ten minutes.
33
+ * Null until the service is ready and the link is issued; the hook asks for it on first use, re-renders when it
34
+ * arrives and swaps in a fresh link two minutes before the old one ends (keep the play position when `src` changes).
35
+ */
36
+ mediaUrl(path: string): string | null;
37
+ /** The same links on demand, up to 50 paths at once. Throws while the service is not ready or the host predates them. */
38
+ media(paths: string[]): Promise<SpaceCloudComputerMediaLink[]>;
39
+ /**
40
+ * A one-time code for a frame of the service (see `CloudComputerFrame`), landing on `path`. A root path (`/`) serves
41
+ * the service from the gate root, so an app built for its own origin runs unchanged.
42
+ */
43
+ frameCode(path?: string): Promise<SpaceCloudComputerFrameCode>;
44
+ /** Ask again at once and restart the bounded wait. */
45
+ retry(): void;
46
+ /**
47
+ * True while `failed` because the viewer has not allowed this Space's current code on their Cloud Computer yet:
48
+ * offer `allow()` instead of Try again (`CloudComputerWaking` does).
49
+ */
50
+ approvalRequired: boolean;
51
+ /** Open the host's approval prompt; once the viewer allows it, the service starts at once. */
52
+ allow(): Promise<void>;
53
+ /** The cloud computer's price while it runs, when known. */
54
+ price: SpaceCloudComputerLeaseResult['price'] | null;
55
+ /** The bounded wait in seconds. */
56
+ waitSeconds: number;
57
+ }
58
+ /** A visible view renews its lease this often; the server holds a lease for 120 s. */
59
+ export declare const SERVICE_PULSE_MS = 30000;
60
+ /**
61
+ * A service the Space declares in `cloudComputer.services`, kept running on the signed-in viewer's own cloud computer
62
+ * while this page is on screen.
63
+ *
64
+ * ```tsx
65
+ * const preview = useCloudComputerService('preview');
66
+ * if (preview.status !== 'ready') return <CloudComputerWaking service={preview}>{null}</CloudComputerWaking>;
67
+ * const answer = await preview.fetch('/api/items');
68
+ * ```
69
+ *
70
+ * While the page is visible it renews the service's lease at once and every 30 s, which starts the service when needed;
71
+ * hidden or unmounted, it stops and tells the host once, so the cloud computer stops about two minutes later. A start
72
+ * that takes longer than `waitSeconds` without the machine saying the service is launching turns `failed`; `retry()` asks again. Hosts without services answer
73
+ * `unavailable` and never ask anything.
74
+ */
75
+ export declare function useCloudComputerService(id: string | null | undefined, options?: UseCloudComputerServiceOptions): UseCloudComputerServiceResult;
@@ -1,4 +1,4 @@
1
- import type { SpaceCloudComputerLevel, SpaceCloudComputerRunResult, SpaceCloudComputerStatus, SpaceCloudComputerUploadInput, SpaceCloudComputerUploadResult } from '../space';
1
+ import type { SpaceCloudComputerFileUpload, SpaceCloudComputerFileUploadResult, SpaceCloudComputerImportResult, SpaceCloudComputerUploadProgress, SpaceCloudComputerJobLogs, SpaceCloudComputerJobStatus, SpaceCloudComputerLevel, SpaceCloudComputerRunResult, SpaceCloudComputerStatus, SpaceCloudComputerUploadInput, SpaceCloudComputerUploadResult } from '../space';
2
2
  export interface UseCloudComputerShellResult {
3
3
  /**
4
4
  * The level this Space declares (`'read'` or `'shell'`) when this host offers the cloud computer,
@@ -16,8 +16,33 @@ export interface UseCloudComputerShellResult {
16
16
  * Pass the same `requestId` when the page retries this run itself: a run is never repeated for one key.
17
17
  */
18
18
  run(command: string, options?: RunOptions): Promise<SpaceCloudComputerRunResult>;
19
- /** Write one file (at most 1 MiB) straight to the cloud computer; it never travels by URL or chat. */
19
+ /** A background job started with `run(command, { detach: true })`: its state and exit code. */
20
+ jobStatus(jobId: string): Promise<SpaceCloudComputerJobStatus>;
21
+ /** Up to `maxBytes` (default 65536, at most 200000) of the job's output from byte `offset` (default 0). */
22
+ jobLogs(jobId: string, options?: {
23
+ offset?: number;
24
+ maxBytes?: number;
25
+ }): Promise<SpaceCloudComputerJobLogs>;
26
+ /** Stop a background job; answers its state once stopped. */
27
+ cancelJob(jobId: string): Promise<SpaceCloudComputerJobStatus>;
28
+ /**
29
+ * Write one file straight to the cloud computer; it never travels by URL or chat. With `{ path, content }`: text
30
+ * or base64, at most 1 MiB, at a machine path. With `{ file, dest: { space: 'files/clip.mp4' } }`: a `File` or
31
+ * `Blob` of any size into the Space folder; above 1 MiB its parts go from the browser to the machine directly,
32
+ * `uploadProgress` follows it, and the machine checks its sha256 before it replaces the file.
33
+ */
20
34
  upload(file: SpaceCloudComputerUploadInput): Promise<SpaceCloudComputerUploadResult>;
35
+ upload(file: SpaceCloudComputerFileUpload): Promise<SpaceCloudComputerFileUploadResult>;
36
+ /** The `{ file }` upload in progress (the latest one when several run), else null. */
37
+ uploadProgress: SpaceCloudComputerUploadProgress | null;
38
+ /** Have the cloud computer download a public URL itself into the Space folder; a rerun resumes a cut download. */
39
+ importUrl(url: string, dest: {
40
+ space: string;
41
+ }, options?: {
42
+ sha256?: string;
43
+ overwrite?: boolean;
44
+ requestId?: string;
45
+ }): Promise<SpaceCloudComputerImportResult>;
21
46
  /**
22
47
  * Ask the host to show its approval prompt, for either declared level. Only the person's click in
23
48
  * that prompt approves; once allowed, every `useCloudComputer()` reads the facts again.
@@ -25,8 +50,16 @@ export interface UseCloudComputerShellResult {
25
50
  requestApproval(): Promise<SpaceCloudComputerStatus | null>;
26
51
  refresh(): Promise<void>;
27
52
  }
53
+ /**
54
+ * `cwd`: a machine path, or `{ space: 'rel' }` inside the Space folder (`{ space: '' }` is its root); without it a run
55
+ * starts in /vercel/sandbox. `detach`: start a background job and answer at once with `job_id` (follow it with
56
+ * `useCloudComputerJob`); `timeoutMs` then bounds the job, up to 6 hours.
57
+ */
28
58
  type RunOptions = {
29
- cwd?: string;
59
+ cwd?: string | {
60
+ space: string;
61
+ };
62
+ detach?: boolean;
30
63
  timeoutMs?: number;
31
64
  maxOutputLength?: number;
32
65
  requestId?: string;
@@ -2,6 +2,7 @@ import { type KeyboardEvent as ReactKeyboardEvent, type MouseEvent as ReactMouse
2
2
  import { type CollectionAction, type ResolvedCollectionAction } from '../interactions/actions';
3
3
  import { type ShortcutScope } from '../interactions/shortcuts';
4
4
  import type { MultiSelectActionBarProps } from '../components/MultiSelectActionBar';
5
+ import { type TravelDirection } from '../ui/engine/step';
5
6
  import { useLongPressSelection } from './useLongPressSelection';
6
7
  import { type SelectionMarqueeRect } from './useMarqueeSelection';
7
8
  export declare const COLLECTION_ITEM_ATTRIBUTE = "data-notis-collection-item-id";
@@ -75,6 +76,11 @@ export interface CollectionInteractionController<T> {
75
76
  lastClickedId: string | null;
76
77
  dragRect: SelectionMarqueeRect | null;
77
78
  actions: ResolvedCollectionAction[];
79
+ /**
80
+ * The way the active item last moved (J/K, the arrows, a click further up or down); 'next' until it moves. A page
81
+ * that removes the active item continues this way (iOS Photos), else the other way at the edge.
82
+ */
83
+ travelDirection: () => TravelDirection;
78
84
  getActionBarProps: () => Pick<MultiSelectActionBarProps, 'selectedCount' | 'actions' | 'collectionOwnerId' | 'isAvailable' | 'shortcutsEnabled' | 'onClearSelection'>;
79
85
  isSelected: (id: string) => boolean;
80
86
  getSelectedItems: () => T[];
@@ -0,0 +1,32 @@
1
+ import type { SpaceItemThread } from '../space';
2
+ export interface UseItemThreadResult {
3
+ /** The matched thread, or null while reading or when nothing matches yet. */
4
+ thread: SpaceItemThread | null;
5
+ loading: boolean;
6
+ error: Error | null;
7
+ /**
8
+ * Open the item's thread in the side chat, with an optional unsent draft. When nothing matches yet it
9
+ * opens a new chat with the draft; the first message creates the thread and links it to the item.
10
+ * Resolves false on hosts without a side chat.
11
+ */
12
+ open: (options?: {
13
+ draft?: string;
14
+ }) => Promise<boolean>;
15
+ /** False on hosts without the resolver (Sites, links, the dev harness): keep the Space's own fallback. */
16
+ available: boolean;
17
+ refresh: () => Promise<Error | null>;
18
+ }
19
+ /**
20
+ * The thread an item continues, from the Space's thread rule: the same thread the side chat, `useHandover`
21
+ * and the Space's agents use.
22
+ *
23
+ * ```tsx
24
+ * const { thread, open } = useItemThread(recordKey);
25
+ * return <Button onClick={() => void open()}>{thread?.thread_id ? 'Continue the chat' : 'Ask Notis'}</Button>;
26
+ * ```
27
+ *
28
+ * Omit `recordKey` for the Space itself. With the `best_match` rule a record's own thread wins, then the
29
+ * current view with its params, then the view, then the Space; with `space` there is one thread per Space
30
+ * and person.
31
+ */
32
+ export declare function useItemThread(recordKey?: string | null): UseItemThreadResult;
@@ -3,7 +3,8 @@
3
3
  * (`useCollectionInteractions`) and the toolkit list (`ListReader`), so both run the same code.
4
4
  *
5
5
  * - A press starts a marquee only on empty space inside the container: not on an item, not on a control
6
- * (button, link, field). A press on a control does nothing here; a press on an item is left to the item.
6
+ * (button, link, field). A press on a control does nothing here; a press on an item is left to the item. A press
7
+ * outside the container's DOM (a portaled menu or popover React bubbles through it) is not on its space either.
7
8
  * - The marquee shows once the pointer moved past `threshold` px; the text selection is cleared then.
8
9
  * - While dragging, every selectable item the rectangle intersects is selected, live (`onSelect`, in DOM order;
9
10
  * the last one is the anchor).
@@ -10,6 +10,7 @@ export declare function useNativeDocumentBody(binding: string, recordKey: string
10
10
  hasData: boolean;
11
11
  loading: boolean;
12
12
  isFetching: boolean;
13
+ isPreviousData?: boolean;
13
14
  error: Error | null;
14
15
  refetch: () => Promise<Error | null>;
15
16
  body: SpaceDocumentBodyRead | undefined;
@@ -23,12 +23,27 @@ export declare function useNativeDocuments(binding: string, options?: {
23
23
  schemaRevision?: number;
24
24
  live: boolean;
25
25
  };
26
- /** Explicit insert/update/trash; update never silently creates a missing row. */
26
+ /** Options of one native write. */
27
+ export interface NativeMutationOptions {
28
+ schemaRevision: number;
29
+ requestId: string;
30
+ /**
31
+ * Inserts: the Space `shows` lists the new row shows in before the server answers (their filters stay on the
32
+ * server). By default the view's only list over this database, if it has exactly one.
33
+ */
34
+ showIn?: string | readonly string[];
35
+ /** One step of a batch that refreshes the lists itself at the end. */
36
+ deferRefresh?: boolean;
37
+ }
38
+ /**
39
+ * Explicit insert/update/trash; update never silently creates a missing row.
40
+ *
41
+ * The write shows in every cached read of the database at once: an edited row changes where it is (and moves to its
42
+ * sorted place, or leaves a read whose filter the page sent and no longer keeps it), a new row joins the reads whose
43
+ * filter it passes and the `showIn` lists, a trashed row leaves. A failed write puts the server's rows back.
44
+ */
27
45
  export declare function useNativeMutation<TOperation extends 'insert' | 'update' | 'delete'>(binding: string, operation: TOperation): {
28
- mutate: (input: TOperation extends 'insert' ? NativeInsert : TOperation extends 'update' ? NativeUpdate : NativeDelete, options: {
29
- schemaRevision: number;
30
- requestId: string;
31
- }) => Promise<NativeMutationReceipt>;
46
+ mutate: (input: TOperation extends 'insert' ? NativeInsert : TOperation extends 'update' ? NativeUpdate : NativeDelete, options: NativeMutationOptions) => Promise<NativeMutationReceipt>;
32
47
  loading: boolean;
33
48
  error: Error | null;
34
49
  };
@@ -1,3 +1,4 @@
1
+ import { type NotisNavigationAnswer } from '../runtime';
1
2
  export interface SpaceNavigationOptions {
2
3
  recordKey?: string | null;
3
4
  /** Declared view parameters. The destination authorizes records and drops unknown names. */
@@ -15,9 +16,9 @@ interface NavigationActions {
15
16
  /** Navigate to a route within the app by its path. */
16
17
  toRoute: (path: string, options?: {
17
18
  resourceId?: string | null;
18
- }) => void;
19
+ }) => Promise<void>;
19
20
  /** Navigate to the app's default route. */
20
- toApp: () => void;
21
+ toApp: () => Promise<void>;
21
22
  }
22
23
  /**
23
24
  * Navigation helpers for Spaces and app routes.
@@ -29,5 +30,13 @@ interface NavigationActions {
29
30
  * nav.toSpace(spaceId, { recordKey });
30
31
  * ```
31
32
  */
33
+ /**
34
+ * A navigation the host refuses (its Manager draft context ended, the Space closed, the view is retained or covered)
35
+ * is reported and returned to the caller, never left as an unhandled rejection: navigation is fire-and-forget in
36
+ * most Spaces (PostHog "This Space context is no longer active." unhandled on app-nightly, 2026-10-30, and again
37
+ * from toSpace and setParams: health:2026-11-06:space-navigation). The host refuses by throwing or by answering a
38
+ * typed refusal; both settle the same way, and a caller that awaits still sees the refusal.
39
+ */
40
+ export declare function settledNavigation(navigate: () => NotisNavigationAnswer | Promise<NotisNavigationAnswer>): Promise<void>;
32
41
  export declare function useNotisNavigation(): NavigationActions;
33
42
  export {};
@@ -1,22 +1,44 @@
1
+ import { type QueryRead, type RowsDescriptor } from '../queryCache';
1
2
  export interface UseQueryOptions {
2
3
  /** Required acknowledgement: only idempotent reads may run on mount or prefetch. */
3
4
  readOnly: true;
4
5
  enabled?: boolean;
5
6
  staleTimeMs?: number;
7
+ /**
8
+ * The native rows this read answers with, so a write to that database shows in it at once: `binding` is the
9
+ * database binding, `at` the answer field holding the rows ('' when the answer is the list). Rows are native
10
+ * rows unless `shape` says 'document'; give `query` (the native query the read runs) to let a write add a new
11
+ * row, move a row to its sorted place, or take out a row its filter no longer keeps.
12
+ */
13
+ rows?: {
14
+ binding: string;
15
+ at?: string;
16
+ shape?: RowsDescriptor['shape'];
17
+ query?: unknown;
18
+ list?: string;
19
+ };
20
+ /**
21
+ * When the key changes (a filter, a search, a tab), keep answering with the last key's result, from the same
22
+ * cache and access scope, until the new one is read: `isPreviousData` is then true and `loading` false. Default
23
+ * true for reads that declare `rows` (lists), false otherwise (a read keyed by one record must not show another).
24
+ */
25
+ keepPrevious?: boolean;
6
26
  }
7
27
  export interface UseQueryResult<T> {
8
28
  data: T | undefined;
9
29
  hasData: boolean;
10
30
  loading: boolean;
11
31
  isFetching: boolean;
32
+ /** `data` is the previous key's result, shown while this key is read (see `keepPrevious`). */
33
+ isPreviousData?: boolean;
12
34
  error: Error | null;
13
35
  /** Reads again; resolves to the read's localized error, or null when it succeeded (never rejects). */
14
36
  refetch: () => Promise<Error | null>;
15
37
  }
16
38
  /** Cached read callback; scope and lifetime are provided by the host, never by app globals. */
17
- export declare function useQuery<T>(key: readonly unknown[], read: () => Promise<T>, options: UseQueryOptions): UseQueryResult<T>;
39
+ export declare function useQuery<T>(key: readonly unknown[], read: (publish?: (partial: NoInfer<T>) => void) => Promise<T>, options: UseQueryOptions): UseQueryResult<T>;
18
40
  /** Opt-in preparation for small, known read queries. Never use for writes or full-database crawls. */
19
41
  export declare function useQueryClient(): {
20
42
  invalidate(key?: readonly unknown[]): void;
21
- prefetch<T>(key: readonly unknown[], read: () => Promise<T>, options: UseQueryOptions): Promise<T | undefined>;
43
+ prefetch<T>(key: readonly unknown[], read: QueryRead<T>, options: UseQueryOptions): Promise<T | undefined>;
22
44
  };
@@ -60,6 +60,8 @@ export interface UseShownOptions extends SpaceShownOptions {
60
60
  }
61
61
  /** The most pages `useShown({ allPages: true })` reads. */
62
62
  export declare const SHOWN_ALL_PAGES_MAX = 50;
63
+ /** The most other tabs (enum values) of a shown list read ahead, and how long after it shows. */
64
+ export declare const SHOWN_SIBLING_TABS_MAX = 4;
63
65
  /** True when a declared list has an authorized host reader (Editor or exact record Site). */
64
66
  export declare function useShownAvailable(name: string): boolean;
65
67
  /**