@notis_ai/cli 0.2.0-beta.16.1 → 0.2.0-beta.160.1

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 (154) hide show
  1. package/README.md +433 -133
  2. package/config/notis_app_boundary_rules.json +50 -0
  3. package/config/notis_app_design_rules.json +135 -0
  4. package/dist/agent-hooks/notis-agent-hook.mjs +18672 -0
  5. package/dist/base-skills/notis-apps/SKILL.md +70 -0
  6. package/dist/base-skills/notis-apps/references/architecture.md +164 -0
  7. package/dist/base-skills/notis-apps/references/context.md +81 -0
  8. package/dist/base-skills/notis-apps/references/design.md +165 -0
  9. package/dist/base-skills/notis-apps/references/reading.md +89 -0
  10. package/dist/base-skills/notis-apps/references/release.md +99 -0
  11. package/dist/base-skills/notis-apps/references/sdk.md +62 -0
  12. package/dist/base-skills/notis-apps/references/troubleshooting.md +23 -0
  13. package/dist/base-skills/notis-cli/SKILL.md +140 -0
  14. package/dist/base-skills/notis-cli/references/app-delivery.md +18 -0
  15. package/dist/base-skills/notis-cli/references/native-databases.md +20 -0
  16. package/dist/base-skills/notis-cli/references/tool-examples.md +56 -0
  17. package/dist/base-skills/notis-cli/references/troubleshooting.md +39 -0
  18. package/dist/base-skills/notis-query/SKILL.md +67 -0
  19. package/dist/base-skills/notis-query/references/database-discovery.md +59 -0
  20. package/dist/base-skills/notis-query/references/documents.md +50 -0
  21. package/dist/base-skills/notis-query/references/query.md +543 -0
  22. package/dist/skill-sync/index.js +1626 -0
  23. package/dist/skill-sync/index.js.map +7 -0
  24. package/dist/skill-sync-worker.mjs +2990 -0
  25. package/package.json +16 -6
  26. package/skills/notis-apps/cli.md +313 -0
  27. package/skills/notis-cli/AGENT_INSTRUCTIONS.md +39 -0
  28. package/skills/notis-onboarding/BRIEF.md +129 -0
  29. package/skills/notis-query/cli.md +39 -0
  30. package/src/agent-hook-entry.js +5 -0
  31. package/src/cli.js +294 -25
  32. package/src/command-specs/agents.js +392 -0
  33. package/src/command-specs/apps.js +1470 -202
  34. package/src/command-specs/auth.js +114 -137
  35. package/src/command-specs/diagnostics.js +716 -0
  36. package/src/command-specs/handover.js +374 -0
  37. package/src/command-specs/helpers.js +84 -82
  38. package/src/command-specs/index.js +25 -6
  39. package/src/command-specs/meta.js +150 -18
  40. package/src/command-specs/onboarding.js +290 -0
  41. package/src/command-specs/profile.js +358 -0
  42. package/src/command-specs/reports.js +86 -0
  43. package/src/command-specs/skills.js +75 -0
  44. package/src/command-specs/smoke.js +386 -0
  45. package/src/command-specs/tools.js +455 -139
  46. package/src/runtime/agent-browser.js +632 -0
  47. package/src/runtime/agent-memory-state.js +126 -0
  48. package/src/runtime/agent-setup.js +383 -0
  49. package/src/runtime/app-boundary-validator.js +404 -0
  50. package/src/runtime/app-changelog.js +79 -0
  51. package/src/runtime/app-platform.js +2633 -210
  52. package/src/runtime/app-registry-scaffolds.js +367 -0
  53. package/src/runtime/app-test-server.js +292 -0
  54. package/src/runtime/assets/store-screenshot-dark.png +0 -0
  55. package/src/runtime/auth-recovery.js +110 -0
  56. package/src/runtime/base-skills.d.ts +20 -0
  57. package/src/runtime/base-skills.js +167 -0
  58. package/src/runtime/channel.js +133 -0
  59. package/src/runtime/delegated-context.js +68 -0
  60. package/src/runtime/errors.js +1 -0
  61. package/src/runtime/git.js +233 -0
  62. package/src/runtime/login-listener.js +15 -0
  63. package/src/runtime/oauth.js +2622 -0
  64. package/src/runtime/output.js +37 -5
  65. package/src/runtime/ports.js +31 -0
  66. package/src/runtime/profiles.js +906 -55
  67. package/src/runtime/skill-sync/cloud-client.ts +99 -0
  68. package/src/runtime/skill-sync/index.ts +697 -0
  69. package/src/runtime/skill-sync/local-scanner.ts +1046 -0
  70. package/src/runtime/skill-sync/symlink-manager.ts +433 -0
  71. package/src/runtime/skill-sync/sync-plan.ts +22 -0
  72. package/src/runtime/skill-sync/types.ts +110 -0
  73. package/src/runtime/skill-sync/write-cloud-skill.ts +50 -0
  74. package/src/runtime/skill-sync-service.js +109 -0
  75. package/src/runtime/store-screenshot.js +143 -0
  76. package/src/runtime/sync-skills.d.ts +37 -0
  77. package/src/runtime/sync-skills.js +231 -0
  78. package/src/runtime/telemetry.js +92 -0
  79. package/src/runtime/transport.js +324 -45
  80. package/src/skill-sync-worker-entry.js +2 -0
  81. package/src/skill-sync-worker.js +50 -0
  82. package/template/.harness/index.html.tmpl +430 -0
  83. package/template/CHANGELOG.md +5 -0
  84. package/template/app/layout.tsx +5 -2
  85. package/template/app/page.tsx +49 -42
  86. package/template/components/page-heading.tsx +23 -0
  87. package/template/components/ui/badge.tsx +7 -4
  88. package/template/components/ui/card.tsx +24 -11
  89. package/template/components/ui/native-select.tsx +24 -0
  90. package/template/notis.config.ts +24 -6
  91. package/template/package-lock.json +4137 -0
  92. package/template/package.json +5 -5
  93. package/template/packages/{notis-sdk → sdk}/package.json +13 -3
  94. package/template/packages/sdk/src/agentContext.ts +36 -0
  95. package/template/packages/sdk/src/components/DocumentEditor.tsx +103 -0
  96. package/template/packages/sdk/src/components/Markdown.tsx +60 -0
  97. package/template/packages/sdk/src/components/MarkdownEditor.tsx +121 -0
  98. package/template/packages/sdk/src/components/MultiSelectActionBar.tsx +285 -0
  99. package/template/packages/sdk/src/components/MultiSelectCheckbox.tsx +97 -0
  100. package/template/packages/sdk/src/components/MultiSelectDragOverlay.tsx +39 -0
  101. package/template/packages/sdk/src/components/NotisCommentBoundary.tsx +172 -0
  102. package/template/packages/sdk/src/components/NotisSelectionBoundary.tsx +59 -0
  103. package/template/packages/sdk/src/components/ShortcutHints.tsx +56 -0
  104. package/template/packages/sdk/src/components/Skeleton.tsx +24 -0
  105. package/template/packages/sdk/src/config.ts +257 -0
  106. package/template/packages/sdk/src/documents.ts +256 -0
  107. package/template/packages/sdk/src/hooks/useActiveResource.ts +19 -0
  108. package/template/packages/sdk/src/hooks/useAgentContext.ts +23 -0
  109. package/template/packages/sdk/src/hooks/useCloudComputer.ts +64 -0
  110. package/template/packages/sdk/src/hooks/useCollectionInteractions.ts +836 -0
  111. package/template/packages/sdk/src/hooks/useDatabaseSchema.ts +49 -0
  112. package/template/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  113. package/template/packages/sdk/src/hooks/useDocument.ts +43 -0
  114. package/template/packages/sdk/src/hooks/useDocuments.ts +84 -0
  115. package/template/packages/sdk/src/hooks/useHandover.ts +78 -0
  116. package/template/packages/sdk/src/hooks/useLongPressSelection.ts +79 -0
  117. package/template/packages/sdk/src/hooks/useMultiSelect.ts +95 -0
  118. package/template/packages/{notis-sdk → sdk}/src/hooks/useNotis.ts +10 -4
  119. package/template/packages/{notis-sdk → sdk}/src/hooks/useNotisNavigation.ts +11 -8
  120. package/template/packages/sdk/src/hooks/useQuery.ts +71 -0
  121. package/template/packages/sdk/src/hooks/useTool.ts +65 -0
  122. package/template/packages/sdk/src/hooks/useToolQuery.ts +12 -0
  123. package/template/packages/sdk/src/hooks/useTopBarSearch.ts +81 -0
  124. package/template/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
  125. package/template/packages/sdk/src/index.ts +161 -0
  126. package/template/packages/sdk/src/interactions/actions.ts +59 -0
  127. package/template/packages/sdk/src/interactions/shortcuts.tsx +694 -0
  128. package/template/packages/sdk/src/interactions/visibility.ts +13 -0
  129. package/template/packages/sdk/src/interactions.ts +45 -0
  130. package/template/packages/sdk/src/provider.tsx +44 -0
  131. package/template/packages/sdk/src/queryCache.ts +170 -0
  132. package/template/packages/sdk/src/runtime.ts +451 -0
  133. package/template/packages/sdk/src/styles.css +213 -0
  134. package/template/packages/sdk/src/tailwind.ts +56 -0
  135. package/template/packages/{notis-sdk → sdk}/src/vite.ts +5 -1
  136. package/template/tailwind.config.ts +1 -0
  137. package/src/command-specs/db.js +0 -163
  138. package/src/runtime/app-preview-server.js +0 -312
  139. package/template/packages/notis-sdk/src/config.ts +0 -48
  140. package/template/packages/notis-sdk/src/helpers.ts +0 -131
  141. package/template/packages/notis-sdk/src/hooks/useAppState.ts +0 -50
  142. package/template/packages/notis-sdk/src/hooks/useCollectionItem.ts +0 -58
  143. package/template/packages/notis-sdk/src/hooks/useDatabase.ts +0 -87
  144. package/template/packages/notis-sdk/src/hooks/useDocument.ts +0 -61
  145. package/template/packages/notis-sdk/src/hooks/useTool.ts +0 -49
  146. package/template/packages/notis-sdk/src/hooks/useUpsertDocument.ts +0 -57
  147. package/template/packages/notis-sdk/src/index.ts +0 -47
  148. package/template/packages/notis-sdk/src/provider.tsx +0 -44
  149. package/template/packages/notis-sdk/src/runtime.ts +0 -159
  150. package/template/packages/notis-sdk/src/styles.css +0 -123
  151. /package/template/packages/{notis-sdk → sdk}/src/hooks/useBackend.ts +0 -0
  152. /package/template/packages/{notis-sdk → sdk}/src/hooks/useTools.ts +0 -0
  153. /package/template/packages/{notis-sdk → sdk}/src/ui.ts +0 -0
  154. /package/template/packages/{notis-sdk → sdk}/tsconfig.json +0 -0
@@ -0,0 +1,451 @@
1
+ import type { AgentContextContent, AgentContextItem, AgentContextSource } from './agentContext';
2
+ /**
3
+ * NotisRuntime is the bridge between app code running in the browser and the
4
+ * Notis platform. The portal owns the runtime and injects it through
5
+ * `NotisProvider` when the app is rendered.
6
+ *
7
+ * App code should never reach for globals. Use the hooks from `@notis/sdk`
8
+ * (useTool, useNotis, etc.) which read from the NotisProvider context.
9
+ */
10
+
11
+ import type { ComponentType } from 'react';
12
+ import type { NotisQueryClient } from './queryCache';
13
+
14
+ // ---------------------------------------------------------------------------
15
+ // Database types
16
+ // ---------------------------------------------------------------------------
17
+
18
+ export type DatabasePropertyType =
19
+ | 'title'
20
+ | 'rich_text'
21
+ | 'text'
22
+ | 'number'
23
+ | 'checkbox'
24
+ | 'date'
25
+ | 'select'
26
+ | 'multi_select'
27
+ | 'status'
28
+ | 'relation'
29
+ | 'formula'
30
+ | 'files'
31
+ | 'secret';
32
+
33
+ /**
34
+ * The value of a `secret` property. The platform stores a pointer to a
35
+ * credential held elsewhere and never the credential itself, so there is
36
+ * deliberately nothing here to read the secret material from — only whether
37
+ * one is attached, which credential it is, and its lifecycle state.
38
+ */
39
+ export interface SecretPropertyValue {
40
+ present: boolean;
41
+ reference: string | null;
42
+ status: string | null;
43
+ metadata: Record<string, unknown> | null;
44
+ }
45
+
46
+ export interface DatabasePropertyOption {
47
+ id?: string | null;
48
+ name: string;
49
+ color?: string | null;
50
+ order?: number;
51
+ }
52
+
53
+ export interface DatabaseProperty {
54
+ id?: string | null;
55
+ name: string;
56
+ type: DatabasePropertyType;
57
+ description?: string | null;
58
+ options?: DatabasePropertyOption[];
59
+ }
60
+
61
+ export interface DatabaseDescriptor {
62
+ slug: string;
63
+ title: string;
64
+ description?: string | null;
65
+ icon?: string | null;
66
+ properties: DatabaseProperty[];
67
+ }
68
+
69
+ /**
70
+ * A document's content is typed. `markdown` documents carry rich text as
71
+ * BlockNote JSON (canonical) with a derived markdown projection; `file`
72
+ * documents carry an uploaded file whose format is in `fileType`
73
+ * (pdf, xlsx, pptx, ...). Future content types (canvas, ...) extend this
74
+ * union without changing the component contracts.
75
+ */
76
+ export type DocumentContentType = 'markdown' | 'file' | 'view';
77
+
78
+ export interface DocumentRecord {
79
+ id: string;
80
+ title: string;
81
+ properties: Record<string, unknown>;
82
+ url?: string | null;
83
+ icon?: string | null;
84
+ cover?: string | null;
85
+ databaseSlug?: string;
86
+ contentType?: DocumentContentType | null;
87
+ fileType?: string | null;
88
+ contentBlocknote?: Array<Record<string, unknown>> | null;
89
+ contentMarkdown?: string | null;
90
+ plainText?: string | null;
91
+ viewType?: string | null;
92
+ viewState?: Record<string, unknown> | null;
93
+ viewRevision?: number | null;
94
+ createdAt?: string | null;
95
+ lastEditedTime?: string | null;
96
+ }
97
+
98
+ // ---------------------------------------------------------------------------
99
+ // Tool types
100
+ // ---------------------------------------------------------------------------
101
+
102
+ export type ToolInputSchema = Record<string, unknown>;
103
+
104
+ export interface ToolDescriptor {
105
+ name: string;
106
+ description?: string;
107
+ inputSchema?: ToolInputSchema;
108
+ }
109
+
110
+ export interface ToolCallOptions {
111
+ /** Explicitly identifies an idempotent read; never set on a mutation. */
112
+ readOnly?: boolean;
113
+ /**
114
+ * Coalesce an identical in-flight call. Only opt in for idempotent reads;
115
+ * mutations must execute once per invocation.
116
+ */
117
+ dedupe?: boolean;
118
+ }
119
+
120
+ // ---------------------------------------------------------------------------
121
+ // Route types
122
+ // ---------------------------------------------------------------------------
123
+
124
+ export interface RouteDescriptor {
125
+ slug: string;
126
+ path: string;
127
+ name: string;
128
+ icon?: string | null;
129
+ parentSlug?: string | null;
130
+ default?: boolean;
131
+ resourceDeepLinks?: boolean;
132
+ collection?: {
133
+ database: string;
134
+ titleProperty: string;
135
+ parentProperty?: string | null;
136
+ sidebar?: {
137
+ mode: 'flat-list' | 'tree';
138
+ allowCreate: boolean;
139
+ } | null;
140
+ } | null;
141
+ }
142
+
143
+ export interface CollectionItem {
144
+ id: string;
145
+ title: string;
146
+ icon?: string | null;
147
+ }
148
+
149
+ export interface CollectionItemDetail extends CollectionItem {
150
+ properties: Record<string, unknown>;
151
+ }
152
+
153
+ // ---------------------------------------------------------------------------
154
+ // App descriptor
155
+ // ---------------------------------------------------------------------------
156
+
157
+ export interface AppDescriptor {
158
+ id: string;
159
+ name: string;
160
+ icon?: string | null;
161
+ description?: string | null;
162
+ }
163
+
164
+ export interface QueryFilter {
165
+ filters?: Array<{
166
+ property: string;
167
+ operator: string;
168
+ type?: string;
169
+ value: unknown;
170
+ }>;
171
+ sorts?: Array<{
172
+ property: string;
173
+ direction: 'asc' | 'desc';
174
+ }>;
175
+ page_size?: number;
176
+ }
177
+
178
+ export interface NotisRuntimeContext {
179
+ collectionItem?: CollectionItemDetail | null;
180
+ /** App-owned resource requested through the route's `?resource=<id>` link. */
181
+ resourceId?: string | null;
182
+ /**
183
+ * Set when the app is being rendered by the screenshot harness (`notis apps
184
+ * screenshot`) for the named listing scenario. Lets apps and SDK components
185
+ * hide dev-only chrome from listing images.
186
+ */
187
+ screenshotScenario?: string | null;
188
+ }
189
+
190
+ // ---------------------------------------------------------------------------
191
+ // App context shared with Notis
192
+ // ---------------------------------------------------------------------------
193
+
194
+ export type ContextAttributeValue = string | number | boolean | null;
195
+
196
+ /**
197
+ * The specific thing currently in focus inside an app view. The host stamps
198
+ * app/view provenance onto this value before it reaches chat, so apps only
199
+ * describe their own resource rather than impersonating another surface.
200
+ */
201
+ export interface ContextResource extends AgentContextContent {
202
+ additionalContext?: Record<string, unknown>;
203
+ id: string;
204
+ kind: string;
205
+ label: string;
206
+ url?: string | null;
207
+ revision?: string | null;
208
+ attributes?: Record<string, ContextAttributeValue>;
209
+ snapshot?: {
210
+ format: 'text' | 'markdown';
211
+ content: string;
212
+ } | null;
213
+ }
214
+
215
+ /** A quote copied from an app, kept separate from the user's prompt. */
216
+ export interface ContextSelection extends AgentContextContent {
217
+ source?: AgentContextSource;
218
+ id: string;
219
+ text: string;
220
+ resource?: ContextResource | null;
221
+ }
222
+
223
+ // ---------------------------------------------------------------------------
224
+ // Host-provided UI
225
+ // ---------------------------------------------------------------------------
226
+
227
+ /**
228
+ * Props for the host-provided document editor. The host implementation
229
+ * dispatches on the document's content type (markdown -> rich text editor,
230
+ * file -> matching viewer/editor), so this contract stays stable as new
231
+ * content types ship.
232
+ */
233
+ export interface NotisDocumentEditorProps {
234
+ documentId: string;
235
+ /** 'full' renders icon/title/cover above the content; 'body' renders content only. */
236
+ variant?: 'full' | 'body';
237
+ readOnly?: boolean;
238
+ className?: string;
239
+ onDirtyChange?: (dirty: boolean) => void;
240
+ onSavingChange?: (saving: boolean) => void;
241
+ }
242
+
243
+ export interface NotisMarkdownEditorSavePayload {
244
+ markdown: string;
245
+ expectedRevision?: string | null;
246
+ }
247
+
248
+ export interface NotisMarkdownEditorSaveResult {
249
+ revision?: string | null;
250
+ }
251
+
252
+ /**
253
+ * Storage-neutral host markdown editor. The app owns persistence through
254
+ * `onSave`; the host only supplies Notis' editing experience.
255
+ */
256
+ export interface NotisMarkdownEditorProps {
257
+ /** Stable identity of the edited resource. Changing it starts a fresh editor. */
258
+ resourceKey?: string;
259
+ value: string;
260
+ revision?: string | null;
261
+ readOnly?: boolean;
262
+ autosaveMs?: number;
263
+ placeholder?: string;
264
+ className?: string;
265
+ onChange?: (markdown: string) => void;
266
+ /** Persist an uploaded media/file block and return its durable URL. */
267
+ onUploadFile?: (file: File) => Promise<string>;
268
+ onSave?: (
269
+ payload: NotisMarkdownEditorSavePayload,
270
+ ) => Promise<NotisMarkdownEditorSaveResult | void>;
271
+ onDirtyChange?: (dirty: boolean) => void;
272
+ onSavingChange?: (saving: boolean) => void;
273
+ }
274
+
275
+ /**
276
+ * Components the host (portal) injects through the runtime. Apps consume them
277
+ * via the SDK wrappers (e.g. `DocumentEditor`), which fall back gracefully
278
+ * when a host component is unavailable (standalone dev harness, snapshots).
279
+ */
280
+ export interface NotisRuntimeUI {
281
+ DocumentEditor?: ComponentType<NotisDocumentEditorProps>;
282
+ MarkdownEditor?: ComponentType<NotisMarkdownEditorProps>;
283
+ }
284
+
285
+ // ---------------------------------------------------------------------------
286
+ // NotisRuntime
287
+ // ---------------------------------------------------------------------------
288
+
289
+ /**
290
+ * Options for `NotisRuntime.subscribeDatabase`.
291
+ */
292
+ export interface SubscribeDatabaseOptions {
293
+ /**
294
+ * Called with `true` once a live change feed is attached, and with `false`
295
+ * when it drops or is torn down. Hosts without a change feed (dev harness,
296
+ * screenshot stub, vite preview) never call it, so `live` stays false there.
297
+ */
298
+ onStatusChange?: (live: boolean) => void;
299
+ }
300
+
301
+ /**
302
+ * Work an app hands to the Notis manager chat through `NotisRuntime.handover`.
303
+ */
304
+ export interface HandoverPayload {
305
+ /** Optional starter message. Omit it to open a context-only composer. */
306
+ prompt?: string;
307
+ /**
308
+ * Key of a skill declared in `notis.config.ts` -> `skills[].key`. The host
309
+ * rejects a key this app does not declare. Omit to hand over plain work.
310
+ */
311
+ skill?: string;
312
+ /**
313
+ * Accepted for forward compatibility. The portal never submits a composer on
314
+ * the user's behalf today, so every handover resolves `drafted`; `sent` is
315
+ * reserved for a host that can genuinely dispatch the run.
316
+ */
317
+ autoSend?: boolean;
318
+ }
319
+
320
+ export interface HandoverResult {
321
+ /** `drafted` when the user still has to press send, `sent` when it went straight through. */
322
+ status: 'drafted' | 'sent';
323
+ }
324
+
325
+ /**
326
+ * The user's cloud computer, as far as an app may see it.
327
+ *
328
+ * `exists` is false when the user has never had a sandbox provisioned. A
329
+ * `status` of anything other than `'running'` means the VM is asleep; reading
330
+ * these facts never wakes it.
331
+ */
332
+ export interface CloudComputerSandboxFacts {
333
+ exists: boolean;
334
+ status: string | null;
335
+ provider: string | null;
336
+ created_at: string | null;
337
+ updated_at: string | null;
338
+ }
339
+
340
+ /**
341
+ * Whether a CLI inside the cloud computer is signed in.
342
+ *
343
+ * `authenticated: null` means *unknown*, never *signed out*: the sandbox was
344
+ * not running, or the probe could not answer. `reason` says which
345
+ * (`'sandbox_not_running'`, `'no_sandbox'`, `'sandbox_status_unknown'`,
346
+ * `'probe_failed'`, `'not_signed_in'`).
347
+ */
348
+ export interface CloudComputerCliAuthFacts {
349
+ authenticated: boolean | null;
350
+ account: string | null;
351
+ checked_at: string | null;
352
+ reason: string | null;
353
+ }
354
+
355
+ export interface CloudComputerFacts {
356
+ /**
357
+ * False when this host cannot answer at all — no cloud computer on the user's
358
+ * plan, or the platform could not resolve the facts. Render whatever the app
359
+ * did before rather than an error.
360
+ */
361
+ available: boolean;
362
+ reason?: string | null;
363
+ sandbox: CloudComputerSandboxFacts | null;
364
+ cli_auth: { gh: CloudComputerCliAuthFacts };
365
+ }
366
+
367
+ export interface NotisRuntime {
368
+ /** Optional host-scoped in-memory read cache. Older hosts remain supported. */
369
+ queryClient?: NotisQueryClient;
370
+ app: AppDescriptor;
371
+ route: RouteDescriptor;
372
+ databases: DatabaseDescriptor[];
373
+ context: NotisRuntimeContext;
374
+ ui?: NotisRuntimeUI;
375
+
376
+ /** Publish or clear the focused resource inside the current app view. */
377
+ contextSource?: AgentContextSource;
378
+ publishActiveResource?(resource: ContextResource | null): void;
379
+
380
+ /** Remember a copied quote so the host can recover it across iframe paste. */
381
+ captureContextSelection?(selection: ContextSelection): void;
382
+ addContext?(item: AgentContextItem): Promise<boolean>;
383
+ updateContext?(item: AgentContextItem): Promise<boolean>;
384
+ removeContext?(id: string): Promise<boolean>;
385
+
386
+ /**
387
+ * Subscribe to changes on an app-owned database. Returns an unsubscribe.
388
+ *
389
+ * The change notification is only a signal — it carries no rows. Consumers
390
+ * react by refetching through the normal tool path, so app scoping,
391
+ * permissions and billing are unchanged. Use the `useDatabaseSubscription`
392
+ * hook rather than calling this directly.
393
+ */
394
+ subscribeDatabase?(
395
+ slug: string,
396
+ onChange: () => void,
397
+ options?: SubscribeDatabaseOptions,
398
+ ): () => void;
399
+
400
+ /**
401
+ * Hand a piece of work to the Notis manager chat. The app cannot run an
402
+ * agent itself: it describes the job, and the manager surface owns progress,
403
+ * billing, cancellation and the transcript. Results come back to the app
404
+ * through its own databases (see `useDatabaseSubscription`).
405
+ *
406
+ * Use the `useHandover` hook rather than calling this directly. Hosts
407
+ * without a manager chat (the dev harness, the vite preview) leave it
408
+ * undefined, so keep whatever fallback the app already offers.
409
+ */
410
+ handover?(payload: HandoverPayload): Promise<HandoverResult>;
411
+
412
+ /**
413
+ * Read-only facts about the user's cloud computer. Requires
414
+ * `capabilities.cloudComputer: 'read'` in `notis.config.ts` plus the user's
415
+ * approval; resolving it never creates, resumes or commands a sandbox.
416
+ *
417
+ * Use the `useCloudComputer` hook rather than calling this directly. Hosts
418
+ * without a cloud computer (the dev harness, the vite preview) answer
419
+ * `{ available: false }`, so keep whatever fallback the app already has.
420
+ * `{ refresh: true }` bypasses the host's short answer cache — the hook's
421
+ * refresh() sends it so a just-completed sign-in becomes visible.
422
+ */
423
+ cloudComputerFacts?(options?: { refresh?: boolean }): Promise<CloudComputerFacts>;
424
+
425
+ navigate?: (payload: { kind: string; [key: string]: unknown }) => void;
426
+
427
+ registerTopBarSearch?: (
428
+ config:
429
+ | {
430
+ onChange: (value: string) => void;
431
+ placeholder?: string;
432
+ onSubmit?: () => void | Promise<void>;
433
+ }
434
+ | null,
435
+ ) => void;
436
+ setTopBarSearchValue?: (value: string) => void;
437
+ setTopBarSearchLoading?: (loading: boolean) => void;
438
+
439
+ listTools(): Promise<ToolDescriptor[]>;
440
+ callTool<TResult = unknown>(
441
+ name: string,
442
+ args?: Record<string, unknown>,
443
+ options?: ToolCallOptions,
444
+ ): Promise<TResult>;
445
+
446
+ request(path: string, options?: {
447
+ method?: string;
448
+ headers?: Record<string, string>;
449
+ body?: unknown;
450
+ }): Promise<unknown>;
451
+ }
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Notis theme CSS variables.
3
+ *
4
+ * Import this in your app layout:
5
+ *
6
+ * import '@notis/sdk/styles.css';
7
+ *
8
+ * The portal injects the live Notis theme variables at render time.
9
+ */
10
+
11
+ @tailwind base;
12
+ @tailwind components;
13
+ @tailwind utilities;
14
+
15
+ @layer base {
16
+ * {
17
+ @apply border-border;
18
+ }
19
+ [data-notis-app-root] {
20
+ color: hsl(var(--foreground));
21
+ display: block;
22
+ min-height: 100%;
23
+ }
24
+ }
25
+
26
+ @layer components {
27
+ .notis-app-shell {
28
+ @apply mx-auto w-full max-w-[var(--portal-page-max-width)] px-4 py-6 md:px-4 md:py-8;
29
+ }
30
+
31
+ /* Flat panel. No border, no shadow: the design bar allows a single hairline
32
+ * between sections and nothing around items. */
33
+ .notis-app-surface {
34
+ @apply rounded-2xl bg-muted text-card-foreground;
35
+ }
36
+
37
+ /* List rows: hover and selection are carried by background tint only. Rows
38
+ * read as tinted panels on mobile and as transparent rows on desktop. */
39
+ .list-row {
40
+ @apply rounded-xl bg-muted px-4 py-3 transition-colors lg:bg-transparent lg:hover:bg-muted/60;
41
+ }
42
+
43
+ .list-row-selected {
44
+ @apply bg-primary/[0.06] lg:bg-primary/[0.06] lg:hover:bg-primary/[0.06];
45
+ }
46
+
47
+ /* Split (list + detail) pages are full-bleed: use these instead of
48
+ * .notis-app-shell. The list pane is tinted and carries the one allowed
49
+ * hairline; the detail pane sits on the plain background. */
50
+ .notis-app-split {
51
+ @apply flex h-full min-h-0 w-full max-w-none flex-col lg:flex-row;
52
+ }
53
+
54
+ .notis-app-pane-list {
55
+ @apply w-full shrink-0 bg-muted/40 lg:w-80 lg:border-r lg:border-border xl:w-96;
56
+ }
57
+
58
+ .notis-app-pane-detail {
59
+ @apply min-w-0 flex-1 bg-background;
60
+ }
61
+
62
+ .notis-app-section {
63
+ @apply p-5 md:p-6;
64
+ }
65
+ }
66
+
67
+ /*
68
+ * Markdown value-type rendering (see the `Markdown` component). Plain CSS on
69
+ * theme variables so it works inside the portal shadow root and the dev
70
+ * harness without depending on the app's Tailwind content scan.
71
+ */
72
+ .notis-markdown {
73
+ font-size: 14px;
74
+ line-height: 1.65;
75
+ color: hsl(var(--foreground));
76
+ overflow-wrap: break-word;
77
+ }
78
+
79
+ .notis-markdown--sm {
80
+ font-size: 13px;
81
+ line-height: 1.55;
82
+ }
83
+
84
+ .notis-markdown > :first-child {
85
+ margin-top: 0;
86
+ }
87
+
88
+ .notis-markdown > :last-child {
89
+ margin-bottom: 0;
90
+ }
91
+
92
+ .notis-markdown p {
93
+ margin: 0.625em 0;
94
+ }
95
+
96
+ .notis-markdown h1,
97
+ .notis-markdown h2,
98
+ .notis-markdown h3,
99
+ .notis-markdown h4,
100
+ .notis-markdown h5,
101
+ .notis-markdown h6 {
102
+ margin: 1.25em 0 0.5em;
103
+ font-weight: 650;
104
+ letter-spacing: -0.01em;
105
+ line-height: 1.3;
106
+ color: hsl(var(--foreground));
107
+ }
108
+
109
+ .notis-markdown h1 { font-size: 1.5em; }
110
+ .notis-markdown h2 { font-size: 1.25em; }
111
+ .notis-markdown h3 { font-size: 1.1em; }
112
+ .notis-markdown h4,
113
+ .notis-markdown h5,
114
+ .notis-markdown h6 { font-size: 1em; }
115
+
116
+ .notis-markdown ul,
117
+ .notis-markdown ol {
118
+ margin: 0.625em 0;
119
+ padding-left: 1.5em;
120
+ }
121
+
122
+ .notis-markdown ul { list-style-type: disc; }
123
+ .notis-markdown ol { list-style-type: decimal; }
124
+
125
+ .notis-markdown li {
126
+ margin: 0.25em 0;
127
+ }
128
+
129
+ .notis-markdown li > ul,
130
+ .notis-markdown li > ol {
131
+ margin: 0.25em 0;
132
+ }
133
+
134
+ .notis-markdown ul.contains-task-list {
135
+ list-style: none;
136
+ padding-left: 0.375em;
137
+ }
138
+
139
+ .notis-markdown li.task-list-item input[type='checkbox'] {
140
+ margin-right: 0.5em;
141
+ accent-color: hsl(var(--primary));
142
+ }
143
+
144
+ .notis-markdown blockquote {
145
+ margin: 0.75em 0;
146
+ padding: 0.125em 0 0.125em 0.875em;
147
+ border-left: 3px solid hsl(var(--border));
148
+ color: hsl(var(--muted-foreground));
149
+ }
150
+
151
+ .notis-markdown a {
152
+ color: hsl(var(--primary));
153
+ text-decoration: underline;
154
+ text-decoration-color: hsl(var(--primary) / 0.35);
155
+ text-underline-offset: 2px;
156
+ }
157
+
158
+ .notis-markdown a:hover {
159
+ text-decoration-color: hsl(var(--primary));
160
+ }
161
+
162
+ .notis-markdown code {
163
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
164
+ font-size: 0.875em;
165
+ padding: 0.125em 0.375em;
166
+ border-radius: 0.25rem;
167
+ background: hsl(var(--muted));
168
+ color: hsl(var(--foreground));
169
+ }
170
+
171
+ .notis-markdown pre {
172
+ margin: 0.75em 0;
173
+ padding: 0.75em 1em;
174
+ border-radius: 0.5rem;
175
+ background: hsl(var(--muted));
176
+ overflow-x: auto;
177
+ }
178
+
179
+ .notis-markdown pre code {
180
+ padding: 0;
181
+ background: transparent;
182
+ font-size: 0.875em;
183
+ }
184
+
185
+ .notis-markdown hr {
186
+ margin: 1.25em 0;
187
+ border: 0;
188
+ border-top: 1px solid hsl(var(--border));
189
+ }
190
+
191
+ .notis-markdown img {
192
+ max-width: 100%;
193
+ border-radius: 0.5rem;
194
+ }
195
+
196
+ .notis-markdown table {
197
+ margin: 0.75em 0;
198
+ width: 100%;
199
+ border-collapse: collapse;
200
+ font-size: 0.95em;
201
+ }
202
+
203
+ .notis-markdown th,
204
+ .notis-markdown td {
205
+ padding: 0.375em 0.75em;
206
+ border: 1px solid hsl(var(--border));
207
+ text-align: left;
208
+ }
209
+
210
+ .notis-markdown th {
211
+ background: hsl(var(--muted));
212
+ font-weight: 600;
213
+ }