@notis_ai/cli 0.2.0-beta.16.1 → 0.2.0-beta.161.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.
- package/README.md +435 -133
- package/bin/check-runtime.js +15 -0
- package/bin/notis.js +2 -0
- package/config/notis_app_boundary_rules.json +50 -0
- package/config/notis_app_design_rules.json +135 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +19008 -0
- package/dist/base-skills/notis-apps/SKILL.md +70 -0
- package/dist/base-skills/notis-apps/references/architecture.md +164 -0
- package/dist/base-skills/notis-apps/references/context.md +81 -0
- package/dist/base-skills/notis-apps/references/design.md +165 -0
- package/dist/base-skills/notis-apps/references/reading.md +89 -0
- package/dist/base-skills/notis-apps/references/release.md +99 -0
- package/dist/base-skills/notis-apps/references/sdk.md +62 -0
- package/dist/base-skills/notis-apps/references/troubleshooting.md +23 -0
- package/dist/base-skills/notis-cli/SKILL.md +140 -0
- package/dist/base-skills/notis-cli/references/app-delivery.md +18 -0
- package/dist/base-skills/notis-cli/references/native-databases.md +20 -0
- package/dist/base-skills/notis-cli/references/tool-examples.md +56 -0
- package/dist/base-skills/notis-cli/references/troubleshooting.md +39 -0
- package/dist/base-skills/notis-query/SKILL.md +67 -0
- package/dist/base-skills/notis-query/references/database-discovery.md +59 -0
- package/dist/base-skills/notis-query/references/documents.md +50 -0
- package/dist/base-skills/notis-query/references/query.md +543 -0
- package/dist/skill-sync/index.js +1626 -0
- package/dist/skill-sync/index.js.map +7 -0
- package/dist/skill-sync-worker.mjs +2990 -0
- package/package.json +18 -7
- package/skills/notis-apps/cli.md +313 -0
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +39 -0
- package/skills/notis-onboarding/BRIEF.md +129 -0
- package/skills/notis-query/cli.md +39 -0
- package/src/agent-hook-entry.js +5 -0
- package/src/cli.js +294 -25
- package/src/command-specs/agents.js +392 -0
- package/src/command-specs/apps.js +1470 -202
- package/src/command-specs/auth.js +114 -137
- package/src/command-specs/diagnostics.js +729 -0
- package/src/command-specs/handover.js +374 -0
- package/src/command-specs/helpers.js +84 -82
- package/src/command-specs/index.js +25 -6
- package/src/command-specs/meta.js +150 -18
- package/src/command-specs/onboarding.js +290 -0
- package/src/command-specs/profile.js +358 -0
- package/src/command-specs/reports.js +86 -0
- package/src/command-specs/skills.js +75 -0
- package/src/command-specs/smoke.js +386 -0
- package/src/command-specs/tools.js +455 -139
- package/src/runtime/agent-browser.js +632 -0
- package/src/runtime/agent-memory-state.js +126 -0
- package/src/runtime/agent-setup.js +383 -0
- package/src/runtime/app-boundary-validator.js +404 -0
- package/src/runtime/app-changelog.js +79 -0
- package/src/runtime/app-platform.js +2633 -210
- package/src/runtime/app-registry-scaffolds.js +367 -0
- package/src/runtime/app-test-server.js +292 -0
- package/src/runtime/assets/store-screenshot-dark.png +0 -0
- package/src/runtime/auth-recovery.js +110 -0
- package/src/runtime/base-skills.d.ts +20 -0
- package/src/runtime/base-skills.js +167 -0
- package/src/runtime/channel.js +133 -0
- package/src/runtime/delegated-context.js +68 -0
- package/src/runtime/errors.js +1 -0
- package/src/runtime/git.js +233 -0
- package/src/runtime/login-listener.js +15 -0
- package/src/runtime/oauth.js +2622 -0
- package/src/runtime/output.js +37 -5
- package/src/runtime/ports.js +31 -0
- package/src/runtime/profiles.js +906 -55
- package/src/runtime/skill-sync/cloud-client.ts +99 -0
- package/src/runtime/skill-sync/index.ts +697 -0
- package/src/runtime/skill-sync/local-scanner.ts +1046 -0
- package/src/runtime/skill-sync/symlink-manager.ts +433 -0
- package/src/runtime/skill-sync/sync-plan.ts +22 -0
- package/src/runtime/skill-sync/types.ts +110 -0
- package/src/runtime/skill-sync/write-cloud-skill.ts +50 -0
- package/src/runtime/skill-sync-service.js +109 -0
- package/src/runtime/store-screenshot.js +143 -0
- package/src/runtime/sync-skills.d.ts +37 -0
- package/src/runtime/sync-skills.js +231 -0
- package/src/runtime/telemetry.js +92 -0
- package/src/runtime/transport.js +324 -45
- package/src/skill-sync-worker-entry.js +2 -0
- package/src/skill-sync-worker.js +50 -0
- package/template/.harness/index.html.tmpl +430 -0
- package/template/CHANGELOG.md +5 -0
- package/template/app/globals.css +28 -3
- package/template/app/layout.tsx +6 -3
- package/template/app/page.tsx +49 -42
- package/template/components/page-heading.tsx +23 -0
- package/template/components/ui/badge.tsx +7 -4
- package/template/components/ui/button.tsx +1 -1
- package/template/components/ui/card.tsx +24 -11
- package/template/components/ui/native-select.tsx +24 -0
- package/template/notis.config.ts +24 -6
- package/template/package-lock.json +3642 -0
- package/template/package.json +19 -16
- package/template/packages/{notis-sdk → sdk}/package.json +14 -4
- package/template/packages/sdk/src/agentContext.ts +36 -0
- package/template/packages/sdk/src/components/DocumentEditor.tsx +103 -0
- package/template/packages/sdk/src/components/Markdown.tsx +60 -0
- package/template/packages/sdk/src/components/MarkdownEditor.tsx +121 -0
- package/template/packages/sdk/src/components/MultiSelectActionBar.tsx +285 -0
- package/template/packages/sdk/src/components/MultiSelectCheckbox.tsx +97 -0
- package/template/packages/sdk/src/components/MultiSelectDragOverlay.tsx +39 -0
- package/template/packages/sdk/src/components/NotisCommentBoundary.tsx +172 -0
- package/template/packages/sdk/src/components/NotisSelectionBoundary.tsx +59 -0
- package/template/packages/sdk/src/components/ShortcutHints.tsx +56 -0
- package/template/packages/sdk/src/components/Skeleton.tsx +24 -0
- package/template/packages/sdk/src/config.ts +257 -0
- package/template/packages/sdk/src/documents.ts +256 -0
- package/template/packages/sdk/src/hooks/useActiveResource.ts +19 -0
- package/template/packages/sdk/src/hooks/useAgentContext.ts +23 -0
- package/template/packages/sdk/src/hooks/useCloudComputer.ts +64 -0
- package/template/packages/sdk/src/hooks/useCollectionInteractions.ts +836 -0
- package/template/packages/sdk/src/hooks/useDatabaseSchema.ts +49 -0
- package/template/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
- package/template/packages/sdk/src/hooks/useDocument.ts +43 -0
- package/template/packages/sdk/src/hooks/useDocuments.ts +84 -0
- package/template/packages/sdk/src/hooks/useHandover.ts +78 -0
- package/template/packages/sdk/src/hooks/useLongPressSelection.ts +79 -0
- package/template/packages/sdk/src/hooks/useMultiSelect.ts +95 -0
- package/template/packages/{notis-sdk → sdk}/src/hooks/useNotis.ts +10 -4
- package/template/packages/{notis-sdk → sdk}/src/hooks/useNotisNavigation.ts +11 -8
- package/template/packages/sdk/src/hooks/useQuery.ts +71 -0
- package/template/packages/sdk/src/hooks/useTool.ts +65 -0
- package/template/packages/sdk/src/hooks/useToolQuery.ts +12 -0
- package/template/packages/sdk/src/hooks/useTopBarSearch.ts +81 -0
- package/template/packages/sdk/src/hooks/useUpsertDocument.ts +95 -0
- package/template/packages/sdk/src/index.ts +161 -0
- package/template/packages/sdk/src/interactions/actions.ts +59 -0
- package/template/packages/sdk/src/interactions/shortcuts.tsx +694 -0
- package/template/packages/sdk/src/interactions/visibility.ts +13 -0
- package/template/packages/sdk/src/interactions.ts +45 -0
- package/template/packages/sdk/src/provider.tsx +44 -0
- package/template/packages/sdk/src/queryCache.ts +170 -0
- package/template/packages/sdk/src/runtime.ts +451 -0
- package/template/packages/sdk/src/styles.css +247 -0
- package/template/packages/sdk/src/tailwind.ts +66 -0
- package/template/packages/sdk/src/vite.ts +73 -0
- package/template/packages/{notis-sdk → sdk}/tsconfig.json +1 -0
- package/template/postcss.config.mjs +1 -1
- package/template/tailwind.config.ts +1 -6
- package/template/tsconfig.json +1 -0
- package/src/command-specs/db.js +0 -163
- package/src/runtime/app-preview-server.js +0 -312
- package/template/packages/notis-sdk/src/config.ts +0 -48
- package/template/packages/notis-sdk/src/helpers.ts +0 -131
- package/template/packages/notis-sdk/src/hooks/useAppState.ts +0 -50
- package/template/packages/notis-sdk/src/hooks/useCollectionItem.ts +0 -58
- package/template/packages/notis-sdk/src/hooks/useDatabase.ts +0 -87
- package/template/packages/notis-sdk/src/hooks/useDocument.ts +0 -61
- package/template/packages/notis-sdk/src/hooks/useTool.ts +0 -49
- package/template/packages/notis-sdk/src/hooks/useUpsertDocument.ts +0 -57
- package/template/packages/notis-sdk/src/index.ts +0 -47
- package/template/packages/notis-sdk/src/provider.tsx +0 -44
- package/template/packages/notis-sdk/src/runtime.ts +0 -159
- package/template/packages/notis-sdk/src/styles.css +0 -123
- package/template/packages/notis-sdk/src/vite.ts +0 -54
- /package/template/packages/{notis-sdk → sdk}/src/hooks/useBackend.ts +0 -0
- /package/template/packages/{notis-sdk → sdk}/src/hooks/useTools.ts +0 -0
- /package/template/packages/{notis-sdk → sdk}/src/ui.ts +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,247 @@
|
|
|
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
|
+
/* Framework-neutral styles: the app owns its Tailwind entry point. This file
|
|
12
|
+
* is also consumed in shadow roots and by apps on older Tailwind versions. */
|
|
13
|
+
@layer base {
|
|
14
|
+
* {
|
|
15
|
+
border-color: hsl(var(--border));
|
|
16
|
+
}
|
|
17
|
+
[data-notis-app-root] {
|
|
18
|
+
color: hsl(var(--foreground));
|
|
19
|
+
display: block;
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@layer components {
|
|
25
|
+
.notis-app-shell {
|
|
26
|
+
margin-inline: auto;
|
|
27
|
+
width: 100%;
|
|
28
|
+
max-width: var(--portal-page-max-width);
|
|
29
|
+
padding: 1.5rem 1rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Flat panel: no border or shadow around items. */
|
|
33
|
+
.notis-app-surface {
|
|
34
|
+
border-radius: 1rem;
|
|
35
|
+
background-color: hsl(var(--muted));
|
|
36
|
+
color: hsl(var(--card-foreground));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.list-row {
|
|
40
|
+
border-radius: 0.75rem;
|
|
41
|
+
background-color: hsl(var(--muted));
|
|
42
|
+
padding: 0.75rem 1rem;
|
|
43
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
44
|
+
transition-duration: 150ms;
|
|
45
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.list-row-selected {
|
|
49
|
+
background-color: hsl(var(--primary) / 0.06);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Split pages are full-bleed; only the list pane carries a hairline. */
|
|
53
|
+
.notis-app-split {
|
|
54
|
+
display: flex;
|
|
55
|
+
height: 100%;
|
|
56
|
+
min-height: 0;
|
|
57
|
+
width: 100%;
|
|
58
|
+
max-width: none;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.notis-app-pane-list {
|
|
63
|
+
width: 100%;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
background-color: hsl(var(--muted) / 0.4);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.notis-app-pane-detail {
|
|
69
|
+
min-width: 0;
|
|
70
|
+
flex: 1 1 0%;
|
|
71
|
+
background-color: hsl(var(--background));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.notis-app-section {
|
|
75
|
+
padding: 1.25rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (min-width: 768px) {
|
|
79
|
+
.notis-app-shell { padding-block: 2rem; }
|
|
80
|
+
.notis-app-section { padding: 1.5rem; }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (min-width: 1024px) {
|
|
84
|
+
.list-row { background-color: transparent; }
|
|
85
|
+
.list-row:hover { background-color: hsl(var(--muted) / 0.6); }
|
|
86
|
+
.list-row-selected,
|
|
87
|
+
.list-row-selected:hover { background-color: hsl(var(--primary) / 0.06); }
|
|
88
|
+
.notis-app-split { flex-direction: row; }
|
|
89
|
+
.notis-app-pane-list {
|
|
90
|
+
width: 20rem;
|
|
91
|
+
border-right-width: 1px;
|
|
92
|
+
border-right-color: hsl(var(--border));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (min-width: 1280px) {
|
|
97
|
+
.notis-app-pane-list { width: 24rem; }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* Markdown value-type rendering (see the `Markdown` component). Plain CSS on
|
|
103
|
+
* theme variables so it works inside the portal shadow root and the dev
|
|
104
|
+
* harness without depending on the app's Tailwind content scan.
|
|
105
|
+
*/
|
|
106
|
+
.notis-markdown {
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
line-height: 1.65;
|
|
109
|
+
color: hsl(var(--foreground));
|
|
110
|
+
overflow-wrap: break-word;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.notis-markdown--sm {
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
line-height: 1.55;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.notis-markdown > :first-child {
|
|
119
|
+
margin-top: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.notis-markdown > :last-child {
|
|
123
|
+
margin-bottom: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.notis-markdown p {
|
|
127
|
+
margin: 0.625em 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.notis-markdown h1,
|
|
131
|
+
.notis-markdown h2,
|
|
132
|
+
.notis-markdown h3,
|
|
133
|
+
.notis-markdown h4,
|
|
134
|
+
.notis-markdown h5,
|
|
135
|
+
.notis-markdown h6 {
|
|
136
|
+
margin: 1.25em 0 0.5em;
|
|
137
|
+
font-weight: 650;
|
|
138
|
+
letter-spacing: -0.01em;
|
|
139
|
+
line-height: 1.3;
|
|
140
|
+
color: hsl(var(--foreground));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.notis-markdown h1 { font-size: 1.5em; }
|
|
144
|
+
.notis-markdown h2 { font-size: 1.25em; }
|
|
145
|
+
.notis-markdown h3 { font-size: 1.1em; }
|
|
146
|
+
.notis-markdown h4,
|
|
147
|
+
.notis-markdown h5,
|
|
148
|
+
.notis-markdown h6 { font-size: 1em; }
|
|
149
|
+
|
|
150
|
+
.notis-markdown ul,
|
|
151
|
+
.notis-markdown ol {
|
|
152
|
+
margin: 0.625em 0;
|
|
153
|
+
padding-left: 1.5em;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.notis-markdown ul { list-style-type: disc; }
|
|
157
|
+
.notis-markdown ol { list-style-type: decimal; }
|
|
158
|
+
|
|
159
|
+
.notis-markdown li {
|
|
160
|
+
margin: 0.25em 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.notis-markdown li > ul,
|
|
164
|
+
.notis-markdown li > ol {
|
|
165
|
+
margin: 0.25em 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.notis-markdown ul.contains-task-list {
|
|
169
|
+
list-style: none;
|
|
170
|
+
padding-left: 0.375em;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.notis-markdown li.task-list-item input[type='checkbox'] {
|
|
174
|
+
margin-right: 0.5em;
|
|
175
|
+
accent-color: hsl(var(--primary));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.notis-markdown blockquote {
|
|
179
|
+
margin: 0.75em 0;
|
|
180
|
+
padding: 0.125em 0 0.125em 0.875em;
|
|
181
|
+
border-left: 3px solid hsl(var(--border));
|
|
182
|
+
color: hsl(var(--muted-foreground));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.notis-markdown a {
|
|
186
|
+
color: hsl(var(--primary));
|
|
187
|
+
text-decoration: underline;
|
|
188
|
+
text-decoration-color: hsl(var(--primary) / 0.35);
|
|
189
|
+
text-underline-offset: 2px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.notis-markdown a:hover {
|
|
193
|
+
text-decoration-color: hsl(var(--primary));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.notis-markdown code {
|
|
197
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
198
|
+
font-size: 0.875em;
|
|
199
|
+
padding: 0.125em 0.375em;
|
|
200
|
+
border-radius: 0.25rem;
|
|
201
|
+
background: hsl(var(--muted));
|
|
202
|
+
color: hsl(var(--foreground));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.notis-markdown pre {
|
|
206
|
+
margin: 0.75em 0;
|
|
207
|
+
padding: 0.75em 1em;
|
|
208
|
+
border-radius: 0.5rem;
|
|
209
|
+
background: hsl(var(--muted));
|
|
210
|
+
overflow-x: auto;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.notis-markdown pre code {
|
|
214
|
+
padding: 0;
|
|
215
|
+
background: transparent;
|
|
216
|
+
font-size: 0.875em;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.notis-markdown hr {
|
|
220
|
+
margin: 1.25em 0;
|
|
221
|
+
border: 0;
|
|
222
|
+
border-top: 1px solid hsl(var(--border));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.notis-markdown img {
|
|
226
|
+
max-width: 100%;
|
|
227
|
+
border-radius: 0.5rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.notis-markdown table {
|
|
231
|
+
margin: 0.75em 0;
|
|
232
|
+
width: 100%;
|
|
233
|
+
border-collapse: collapse;
|
|
234
|
+
font-size: 0.95em;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.notis-markdown th,
|
|
238
|
+
.notis-markdown td {
|
|
239
|
+
padding: 0.375em 0.75em;
|
|
240
|
+
border: 1px solid hsl(var(--border));
|
|
241
|
+
text-align: left;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.notis-markdown th {
|
|
245
|
+
background: hsl(var(--muted));
|
|
246
|
+
font-weight: 600;
|
|
247
|
+
}
|