@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
@@ -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
  /**
@@ -8,7 +8,8 @@
8
8
  */
9
9
  export { NotisProvider, useNotisRuntime } from './provider';
10
10
  export { useAction, useActionQuery } from './hooks/useAction';
11
- export { useNativeDocuments, useNativeMutation, useNativeDelete, type NativeDeleteManyResult } from './hooks/useNativeDocuments';
11
+ export type { UseActionQueryOptions } from './hooks/useAction';
12
+ export { useNativeDocuments, useNativeMutation, useNativeDelete, type NativeDeleteManyResult, type NativeMutationOptions } from './hooks/useNativeDocuments';
12
13
  export type { NativeField, NativeFilter, NativeQuery, NativeInsert, NativeUpdate, NativeDelete, NativeMutationReceipt } from './nativeData';
13
14
  export type { SpaceDatabaseCreate, SpaceResourceReference } from './space';
14
15
  export type { SpaceActionTemplate, SpaceActionDescriptor, SpaceRuntimeDescriptor, SpaceActionOptions } from './space';
@@ -22,14 +23,22 @@ export { SPACE_VIEW_SPEC_VERSION } from './space';
22
23
  export type { SpaceViewParam, SpaceViewParamType, SpaceViewFilter, SpaceShows, SpaceShownDescriptor, SpaceShownOptions, SpaceShownResult, SpaceMemoryPolicy, SpaceMemorySnapshot, SpaceChrome, SpaceMarkdownInput } from './space';
23
24
  export { SPACE_VIEWER_READ_OPERATIONS } from './space';
24
25
  export { SPACE_CLOUD_COMPUTER_OPERATIONS, spaceCloudComputerAllows } from './space';
25
- export type { SpaceCloudComputerLevel, SpaceCloudComputerOperation, SpaceCloudComputerStatus, SpaceCloudComputerRelease, SpaceCloudComputerRunInput, SpaceCloudComputerRunResult, SpaceCloudComputerUploadInput, SpaceCloudComputerUploadResult, SpaceCloudComputerTransport } from './space';
26
+ export { spaceCloudComputerAccess } from './space';
27
+ export type { SpaceCloudComputerLevel, SpaceCloudComputerOperation, SpaceCloudComputerStatus, SpaceCloudComputerRelease, 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';
26
28
  export type { SpaceViewerReadFamily, SpaceViewerReadOperation, SpaceViewerReadInput, SpaceViewerReadResult, SpaceViewerLink, SpaceViewerDatabase, SpaceViewerDatabaseSchema, SpaceViewerSkill, SpaceViewerSkillPage } from './space';
29
+ export type { SpaceAgentDeclaration, SpaceItemThread, SpaceAgentQueue, SpaceAgentsStatus, SpaceThreadsTransport } from './space';
27
30
  export { SpaceActionError, SpaceNavigationCancelled, isSpaceNavigationCancelled } from './space';
31
+ export { spaceAudience, spaceMarksEditorsOnly, publicSpaceDescriptor, withoutEditorColumns } from './space';
32
+ export type { SpaceAudience, SpaceEditorsOnly, SpaceResourceColumns, EditorOnlyColumns, AudienceRow } from './space';
33
+ export { useAudience, Editors, Public, ViewAsPublic, AUDIENCE_WORDS } from './components/Audience';
34
+ export type { UseAudienceResult, ViewAsPublicProps } from './components/Audience';
35
+ export { SpaceFileError, SPACE_FILE_EXTENSIONS, SPACE_FILE_MAX_BYTES } from './space';
36
+ export type { SpaceFileUploadInput, SpaceFileUploadResult, SpaceFileReference, SpaceFilesCheck, SpaceFilesTransport } from './space';
28
37
  export type { SpaceActionFailureDetails } from './space';
29
38
  export { useQuery, useQueryClient } from './hooks/useQuery';
30
39
  export type { UseQueryOptions, UseQueryResult } from './hooks/useQuery';
31
- export { createQueryClient, createPrefetchQueue, queryKey } from './queryCache';
32
- export type { NotisQueryClient, QuerySnapshot, QueryFetchOptions, HiddenRecords } from './queryCache';
40
+ export { createQueryClient, createPrefetchQueue, queryKey, optimisticRowState, OPTIMISTIC_ROW } from './queryCache';
41
+ export type { NotisQueryClient, QuerySnapshot, QueryFetchOptions, HiddenRecords, RowsDescriptor, RowsRead, RowChange, OptimisticWrite, OptimisticRowState } from './queryCache';
33
42
  export { useNotis } from './hooks/useNotis';
34
43
  export { useDocuments } from './hooks/useDocuments';
35
44
  export type { UseDocumentsOptions, UseDocumentsResult } from './hooks/useDocuments';
@@ -48,8 +57,17 @@ export { useHandover } from './hooks/useHandover';
48
57
  export type { UseHandoverResult } from './hooks/useHandover';
49
58
  export { useCloudComputer } from './hooks/useCloudComputer';
50
59
  export type { UseCloudComputerResult } from './hooks/useCloudComputer';
60
+ export { useItemThread } from './hooks/useItemThread';
61
+ export type { UseItemThreadResult } from './hooks/useItemThread';
62
+ export { useAgentQueue, AGENT_QUEUE_WORDS } from './hooks/useAgentQueue';
63
+ export type { UseAgentQueueResult, AgentQueueStatus } from './hooks/useAgentQueue';
51
64
  export { useCloudComputerShell } from './hooks/useCloudComputerShell';
52
65
  export type { UseCloudComputerShellResult } from './hooks/useCloudComputerShell';
66
+ export { useCloudComputerService, SERVICE_PULSE_MS } from './hooks/useCloudComputerService';
67
+ export type { CloudComputerServiceStatus, UseCloudComputerServiceOptions, UseCloudComputerServiceResult } from './hooks/useCloudComputerService';
68
+ export { useCloudComputerJob } from './hooks/useCloudComputerJob';
69
+ export type { UseCloudComputerJobOptions, UseCloudComputerJobResult } from './hooks/useCloudComputerJob';
70
+ export { CLOUD_COMPUTER_WORDS, cloudComputerPriceWords, formatHourlyPrice } from './cloudComputerWords';
53
71
  export { useNotisNavigation } from './hooks/useNotisNavigation';
54
72
  export { useTopBarSearch } from './hooks/useTopBarSearch';
55
73
  export { useTopBarTitleLeaf } from './hooks/useTopBarTitleLeaf';
@@ -88,6 +106,8 @@ export type { CollectionAction, CollectionActionContext, CollectionActionIntent,
88
106
  export type { AppDescriptor, CloudComputerCliAuthFacts, CloudComputerFacts, CloudComputerSandboxFacts, ContextAttributeValue, ContextResource, ContextSelection, CollectionItem, CollectionItemDetail, DatabaseDescriptor, DatabaseProperty, DatabasePropertyOption, DatabasePropertyType, DocumentContentType, DocumentRecord, HandoverPayload, HandoverResult, NotisDocumentEditorProps, NotisDocumentPageProps, NotisDocumentPageCrumb, NotisDocumentPageMenuItem, NotisDocumentPageParts, NotisRecordProps, NotisRecordPropertiesProps, NotisHtmlFrameProps, NotisHtmlFramePresentAction, NotisReportFrameProps, NotisShareControlProps, NotisSpacePageFrameProps, NotisMarkdownEditorProps, NotisMarkdownEditorSavePayload, NotisMarkdownEditorSaveResult, NotisRuntime, RuntimeResource, NotisRuntimeContext, NotisRuntimeUI, QueryFilter, RouteDescriptor, SecretPropertyValue, SubscribeDatabaseOptions, ToolDescriptor, ToolCallOptions, ToolInputSchema, } from './runtime';
89
107
  export { useToolQuery } from './hooks/useToolQuery';
90
108
  export { Skeleton, SKELETON_WORDS, ViewSkeleton } from './components/Skeleton';
109
+ export { isNotisSpaceSkeleton, pickSkeletonEntry, SPACE_SKELETON_SCHEMA } from './skeleton';
110
+ export type { NotisSkeletonEntry, NotisSkeletonLocale, NotisSkeletonRow, NotisSkeletonWidth, NotisSpaceSkeleton, SkeletonBone } from './skeleton';
91
111
  export { useLongPressSelection } from './hooks/useLongPressSelection';
92
112
  export { isInteractionElementVisible } from './interactions/visibility';
93
113
  export type { AgentContextContent, AgentContextItem, ContextAttachment } from './agentContext';
@@ -34,6 +34,12 @@ export interface NativeQuery {
34
34
  };
35
35
  page_size?: number;
36
36
  offset?: number;
37
+ /** Return only these properties; the title column follows the title property. */
38
+ properties?: Array<{
39
+ property_id: string;
40
+ } | {
41
+ property: string;
42
+ }>;
37
43
  }
38
44
  export interface NativeInsert {
39
45
  columns?: {
@@ -10,13 +10,90 @@ export interface QuerySnapshot<T = unknown> {
10
10
  export interface QueryFetchOptions {
11
11
  staleTimeMs?: number;
12
12
  force?: boolean;
13
+ /** What rows the read holds, so a write to that database shows in it at once (see `optimistic`). */
14
+ rows?: RowsDescriptor;
13
15
  }
16
+ /** The rows a read holds: its database binding and where the rows sit in its answer. */
17
+ export interface RowsDescriptor {
18
+ binding: string;
19
+ /** The answer field holding the rows ('documents', 'rows'), or '' when the answer is the list itself. */
20
+ at: string;
21
+ /** 'native': rows as the native query returns them; 'document': normalized `DocumentRecord`s. */
22
+ shape: 'native' | 'document';
23
+ /** The query whose filter and sorts the rows follow, when the page sends it (never a Space's private filter). */
24
+ query?: unknown;
25
+ /** A Space `shows` list name: its filter stays on the server, so a new row shows there only when asked. */
26
+ list?: string;
27
+ }
28
+ /** One read a change applies to: its descriptor and cache key. */
29
+ export interface RowsRead extends RowsDescriptor {
30
+ key: string;
31
+ }
32
+ type Row = Record<string, unknown>;
33
+ /**
34
+ * How one write changes the rows of one database binding, read by read. `project` returns the row as that read
35
+ * should show it, or `undefined` to leave the read alone; `keeps` says whether the read still holds it (else it
36
+ * leaves, and a later write to it can bring it back). `insert` asks for the row in reads that do not hold it yet
37
+ * (given `undefined`), placed where `position` puts it, else at the top. `related` gives every row the reads of the
38
+ * database returned, to learn property types and options from. `exact` says the row shows the whole write, so it
39
+ * can take the revision the write made.
40
+ */
41
+ export interface RowChange {
42
+ binding: string;
43
+ /** The row's key; a temporary one for a row being created, replaced on `commit`. */
44
+ recordKey: string;
45
+ insert?: boolean;
46
+ project(row: Row | undefined, read: RowsRead, related: () => readonly Row[]): Row | undefined;
47
+ keeps?(row: Row, read: RowsRead, related: () => readonly Row[]): boolean;
48
+ exact?(row: Row): boolean;
49
+ /** Where the row goes among `rows` (without it): a sorted place, or -1 to keep its place. */
50
+ position?(rows: readonly Row[], row: Row, read: RowsRead, related: () => readonly Row[]): number;
51
+ }
52
+ /**
53
+ * The native rows behind a read whose rows are reshaped (`useNativeDocuments` flattens them), kept on its answer
54
+ * under this symbol (never serialized) so writes learn property types and options from them.
55
+ */
56
+ export declare const NATIVE_ROWS: unique symbol;
57
+ /** Marks a row shown ahead of the server while its write runs (a symbol: never sent, never serialized). */
58
+ export declare const OPTIMISTIC_ROW: unique symbol;
59
+ export interface OptimisticRowState {
60
+ /** When the write started (ms, the client's clock). */
61
+ since: number;
62
+ /** A row being created: its key is temporary, so it cannot be opened or changed yet. */
63
+ creating: boolean;
64
+ }
65
+ /** The saving state of a row the cache shows ahead of the server, or null once confirmed. */
66
+ export declare function optimisticRowState(row: unknown): OptimisticRowState | null;
67
+ /** A write shown before the server answers. */
68
+ export interface OptimisticWrite {
69
+ /**
70
+ * It succeeded: the change stays shown until every read that could still hold older rows reads again. A new row's
71
+ * temporary key becomes `recordKey` (and its id `id`); the rows take the `revision` the write made.
72
+ */
73
+ commit(confirmed?: {
74
+ recordKey?: string;
75
+ id?: string;
76
+ revision?: number;
77
+ }): void;
78
+ /** It failed: only this write's change goes away. */
79
+ rollback(): void;
80
+ }
81
+ /**
82
+ * A read. `publish` (given by current clients) shows a first part of the answer while the rest loads, such as the
83
+ * first page of a read of every page: the snapshot then holds it, still fetching, until the read answers.
84
+ */
85
+ export type QueryRead<T> = (publish?: (partial: T) => void) => Promise<T>;
14
86
  export interface NotisQueryClient {
15
87
  getSnapshot<T>(key: string): QuerySnapshot<T>;
16
88
  subscribe(key: string, listener: () => void): () => void;
17
- fetch<T>(key: string, read: () => Promise<T>, options?: QueryFetchOptions): Promise<T>;
18
- prefetch<T>(key: string, read: () => Promise<T>, options?: QueryFetchOptions): Promise<T>;
89
+ fetch<T>(key: string, read: QueryRead<T>, options?: QueryFetchOptions): Promise<T>;
90
+ prefetch<T>(key: string, read: QueryRead<T>, options?: QueryFetchOptions): Promise<T>;
19
91
  invalidate(key?: string): void;
92
+ /**
93
+ * Host-only: takes one key's answer away and shows `error` instead, without reading it again (a host that showed
94
+ * an earlier answer ahead of its source, and the source then failed). The read's `refetch` asks again.
95
+ */
96
+ fail?(key: string, error: Error): void;
20
97
  clear(): void;
21
98
  /** Host-only: permanently retire a revoked security scope. */
22
99
  dispose?(): void;
@@ -27,19 +104,37 @@ export interface NotisQueryClient {
27
104
  * holds them is read again; `restore` shows them again (a failed or undone delete).
28
105
  */
29
106
  hideRecords?(recordKeys: readonly string[]): HiddenRecords;
107
+ /** Shows a write in every cached read of its database at once, layered over the server's rows (see `RowChange`). */
108
+ optimistic?(changes: readonly RowChange[]): OptimisticWrite;
30
109
  }
31
110
  export interface HiddenRecords {
32
111
  commit(recordKeys?: readonly string[]): void;
33
112
  restore(recordKeys?: readonly string[]): void;
34
113
  }
114
+ export declare function recordKeyOf(item: unknown): string | undefined;
35
115
  /** Stable keys distinguish filters, pagination, and resource identities. */
36
116
  export declare function queryKey(value: unknown): string;
37
117
  /** One shared queue can bound descriptor and data speculation together. */
38
118
  export declare function createPrefetchQueue(concurrency?: number): <T>(read: () => Promise<T>) => Promise<T>;
119
+ /** An answer a host kept from an earlier visit: shown at once, then read again on first use (it is never fresh). */
120
+ export interface QuerySeed {
121
+ data: unknown;
122
+ rows?: RowsDescriptor;
123
+ }
39
124
  export declare function createQueryClient(options?: {
40
125
  maxEntries?: number;
41
126
  now?: () => number;
42
127
  schedule?: ReturnType<typeof createPrefetchQueue>;
43
128
  /** Bounds idempotent reads only; never retries the underlying callback. */
44
129
  readTimeoutMs?: number;
130
+ /**
131
+ * Answers the host kept from an earlier visit of the same access scope, by key: shown at once and read again on
132
+ * first use. A read that fails takes its kept answer away instead of showing it with the error.
133
+ */
134
+ seed?: ReadonlyMap<string, QuerySeed>;
135
+ /** Told every answer a read returned (the host may keep it for a later visit). */
136
+ onAnswer?: (key: string, data: unknown, rows?: RowsDescriptor) => void;
137
+ /** Told every read that failed (the host forgets what it kept for it). */
138
+ onFailure?: (key: string, error: Error) => void;
45
139
  }): NotisQueryClient;
140
+ export {};
@@ -9,7 +9,8 @@ import type { AgentContextContent, AgentContextItem, AgentContextSource } from '
9
9
  */
10
10
  import type { ComponentType, ReactNode } from 'react';
11
11
  import type { NotisQueryClient } from './queryCache';
12
- import type { SpaceRuntimeDescriptor, SpaceActionOptions, SpaceDocumentBodyRequest, SpaceDocumentBodyResult, SpaceViewerReadOperation, SpaceShownOptions, SpaceCloudComputerTransport } from './space';
12
+ import type { NotisSpaceSkeleton } from './skeleton';
13
+ import type { SpaceRuntimeDescriptor, SpaceActionOptions, SpaceDocumentBodyRequest, SpaceDocumentBodyResult, SpaceViewerReadOperation, SpaceShownOptions, SpaceCloudComputerTransport, SpaceFilesTransport, SpaceThreadsTransport } from './space';
13
14
  export type DatabasePropertyType = 'title' | 'rich_text' | 'text' | 'number' | 'checkbox' | 'date' | 'select' | 'multi_select' | 'status' | 'relation' | 'formula' | 'files' | 'secret';
14
15
  /**
15
16
  * The value of a `secret` property. The platform stores a pointer to a
@@ -132,6 +133,17 @@ export interface QueryFilter {
132
133
  }>;
133
134
  page_size?: number;
134
135
  }
136
+ /**
137
+ * The host's answer to `navigate`: nothing when it took the navigation, or a typed refusal when it did not
138
+ * (`context_inactive`: the view the call came from is retained, covered or pending, so its navigation is dropped).
139
+ * The hooks turn a refusal into a warned, settled rejection; it is never an uncaught error.
140
+ */
141
+ export interface NotisNavigationRefusal {
142
+ refused: 'context_inactive';
143
+ message: string;
144
+ }
145
+ export type NotisNavigationAnswer = void | NotisNavigationRefusal;
146
+ export declare function isNotisNavigationRefusal(value: unknown): value is NotisNavigationRefusal;
135
147
  export interface NotisRuntimeContext {
136
148
  /** Host UI language. */
137
149
  locale?: 'en' | 'fr';
@@ -148,6 +160,8 @@ export interface NotisRuntimeContext {
148
160
  collectionItem?: CollectionItemDetail | null;
149
161
  /** App-owned resource requested through the route's `?resource=<id>` link. */
150
162
  resourceId?: string | null;
163
+ /** Loading bones measured from this release at build time; `ViewSkeleton` draws them. Absent until the host has them. */
164
+ readonly skeleton?: NotisSpaceSkeleton;
151
165
  }
152
166
  export type ContextAttributeValue = string | number | boolean | null;
153
167
  /**
@@ -404,8 +418,20 @@ export interface NotisRuntimeUI {
404
418
  ReportFrame?: ComponentType<NotisReportFrameProps>;
405
419
  ShareControl?: ComponentType<NotisShareControlProps>;
406
420
  SpacePageFrame?: ComponentType<NotisSpacePageFrameProps>;
407
- /** Starts reading a record (and the page's code) before it opens, for example when a list row is hovered. */
408
- prefetchRecord?: (recordKey: string) => void;
421
+ /**
422
+ * Starts reading a record (and the page's code) before it opens, for example when a list row is hovered. Without
423
+ * `hint` (a Space's own call) the read always starts after a short hover delay; with it (the toolkit list does
424
+ * this for its rows) the host reads only where the Space opens records as document pages, at once for the
425
+ * cursor row and soon after for its neighbours, and may paint `title` while the record loads.
426
+ */
427
+ prefetchRecord?: (recordKey: string, hint?: RecordPrefetchHint) => void;
428
+ }
429
+ /** Why the toolkit reads a record ahead (see `NotisRuntimeUI.prefetchRecord`). */
430
+ export interface RecordPrefetchHint {
431
+ /** 'cursor': the keyboard cursor is on its row; 'neighbour': next to it; 'hover': a pointer over it. */
432
+ intent: 'cursor' | 'neighbour' | 'hover';
433
+ /** The row's title, shown in the page while the record loads. */
434
+ title?: string | null;
409
435
  }
410
436
  /**
411
437
  * Options for `NotisRuntime.subscribeDatabase`.
@@ -444,10 +470,17 @@ export interface HandoverPayload {
444
470
  * background calls still open an editable draft.
445
471
  */
446
472
  autoSend?: boolean;
473
+ /**
474
+ * Space only: start a new chat instead of continuing the item's thread. By default the handover continues
475
+ * the thread the Space's thread rule matches (the same one the side chat and agent wake-ups use).
476
+ */
477
+ newChat?: boolean;
447
478
  }
448
479
  export interface HandoverResult {
449
480
  /** `drafted` when the user still has to press send, `sent` when it went straight through. */
450
481
  status: 'drafted' | 'sent';
482
+ /** The thread the handover continued, when the host continued one. */
483
+ threadId?: string | null;
451
484
  }
452
485
  /**
453
486
  * The user's cloud computer, as far as an app may see it.
@@ -519,6 +552,11 @@ export interface NotisRuntime {
519
552
  * signed-in Editor. Absent on Sites and older hosts.
520
553
  */
521
554
  shown?<TResult = unknown>(name: string, params?: Record<string, unknown>, options?: SpaceShownOptions): Promise<TResult>;
555
+ /**
556
+ * Space-only: an editor switches View as the public on (`'public'`) or off (`null`). The host repaints the Space
557
+ * with `space.viewAs` set; it never adds rights. Absent where the viewer is not an editor and on older hosts.
558
+ */
559
+ setSpaceViewAs?(mode: 'public' | null): void;
522
560
  /** Space-only unsent Manager draft; distinct from legacy App activation. */
523
561
  draftHandover?(payload: HandoverPayload): Promise<HandoverResult>;
524
562
  /**
@@ -526,6 +564,17 @@ export interface NotisRuntime {
526
564
  * viewer allows it. Absent on Sites, links, verification harnesses and older hosts.
527
565
  */
528
566
  spaceCloudComputer?: SpaceCloudComputerTransport;
567
+ /**
568
+ * Space-only files attached from a view to a database's files column (comment pictures): the signed-in Editor's
569
+ * own upload into Notis's private EU storage. Absent on Sites, previews, verification harnesses and older hosts.
570
+ */
571
+ spaceFiles?: SpaceFilesTransport;
572
+ /**
573
+ * Space-only thread resolver and agents' queue: the thread an item continues (shared by the side chat,
574
+ * `useHandover` and agent wake-ups) and each declared agent's latest wake-up. Absent on Sites, links and
575
+ * older hosts.
576
+ */
577
+ spaceThreads?: SpaceThreadsTransport;
529
578
  /** Authenticated runtime identity; app below is presentation metadata only. */
530
579
  resource?: RuntimeResource;
531
580
  /** Optional host-scoped in-memory read cache. Older hosts remain supported. */
@@ -587,7 +636,7 @@ export interface NotisRuntime {
587
636
  navigate?: (payload: {
588
637
  kind: string;
589
638
  [key: string]: unknown;
590
- }) => void | Promise<void>;
639
+ }) => NotisNavigationAnswer | Promise<NotisNavigationAnswer>;
591
640
  registerTopBarSearch?: (config: {
592
641
  onChange: (value: string) => void;
593
642
  placeholder?: string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Captured loading skeletons (`notis-space-skeleton/v1`). `notis spaces verify` measures the final view at build
3
+ * time into bones and ships them beside the bundle; the host passes them as `NotisRuntimeContext.skeleton` and
4
+ * `ViewSkeleton` draws the region named by its `skeletonKey`.
5
+ */
6
+ /**
7
+ * One rectangle: `[x, y, w, h, r, t]`. x and w are percent of the region width, y and h px from the region (or row)
8
+ * top, r the corner radius in px, t the type: 0 leaf, 1 filled container, 2 four-side box (outline), 3 divider.
9
+ */
10
+ export type SkeletonBone = [number, number, number, number, number, 0 | 1 | 2 | 3];
11
+ /** A row template stacked from `y` until the visible pane is filled. Its bones are relative to the row top. */
12
+ export interface NotisSkeletonRow {
13
+ y: number;
14
+ h: number;
15
+ bones: SkeletonBone[];
16
+ repeat: 'fill';
17
+ }
18
+ /** The bones of one region at one width and one locale. */
19
+ export interface NotisSkeletonEntry {
20
+ height: number;
21
+ bones: SkeletonBone[];
22
+ rows?: NotisSkeletonRow[];
23
+ }
24
+ export type NotisSkeletonWidth = '390' | '1440';
25
+ export type NotisSkeletonLocale = 'en' | 'fr';
26
+ export interface NotisSpaceSkeleton {
27
+ schema: 'notis-space-skeleton/v1';
28
+ /** sha256 hex of the `bundle/app.js` the bones were measured from. */
29
+ sourceHash: string;
30
+ regions: Record<string, Partial<Record<NotisSkeletonWidth, Partial<Record<NotisSkeletonLocale, NotisSkeletonEntry>>>>>;
31
+ }
32
+ export declare const SPACE_SKELETON_SCHEMA = "notis-space-skeleton/v1";
33
+ /**
34
+ * A light shape check of a captured skeleton: the schema tag, the region, width and locale keys, and numeric bones.
35
+ * The server validates strictly at publish; this only keeps a malformed file from reaching the drawing code.
36
+ */
37
+ export declare function isNotisSpaceSkeleton(value: unknown): value is NotisSpaceSkeleton;
38
+ /**
39
+ * The entry a region draws: the width bucket asked for, else the other one; the locale asked for, else the other one.
40
+ * Null when the region has no entry at all.
41
+ */
42
+ export declare function pickSkeletonEntry(skeleton: NotisSpaceSkeleton | null | undefined, key: string, width: NotisSkeletonWidth, locale: NotisSkeletonLocale): NotisSkeletonEntry | null;