@notis_ai/cli 0.2.13 → 0.2.14

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 (53) hide show
  1. package/README.md +45 -3
  2. package/dist/scaffolds/notis-database/packages/sdk/src/config.ts +40 -2
  3. package/dist/scaffolds/notis-database/packages/sdk/src/documents.ts +21 -0
  4. package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useCloudComputer.ts +97 -0
  5. package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  6. package/dist/scaffolds/notis-database/packages/sdk/src/hooks/useHandover.ts +75 -0
  7. package/dist/scaffolds/notis-database/packages/sdk/src/index.ts +17 -0
  8. package/dist/scaffolds/notis-database/packages/sdk/src/runtime.ts +132 -1
  9. package/dist/scaffolds/notis-journal/packages/sdk/src/config.ts +40 -2
  10. package/dist/scaffolds/notis-journal/packages/sdk/src/documents.ts +21 -0
  11. package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useCloudComputer.ts +97 -0
  12. package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  13. package/dist/scaffolds/notis-journal/packages/sdk/src/hooks/useHandover.ts +75 -0
  14. package/dist/scaffolds/notis-journal/packages/sdk/src/index.ts +17 -0
  15. package/dist/scaffolds/notis-journal/packages/sdk/src/runtime.ts +132 -1
  16. package/dist/scaffolds/notis-journal/src/mock-runtime.ts +2 -0
  17. package/dist/scaffolds/notis-notes/packages/sdk/src/config.ts +40 -2
  18. package/dist/scaffolds/notis-notes/packages/sdk/src/documents.ts +21 -0
  19. package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useCloudComputer.ts +97 -0
  20. package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  21. package/dist/scaffolds/notis-notes/packages/sdk/src/hooks/useHandover.ts +75 -0
  22. package/dist/scaffolds/notis-notes/packages/sdk/src/index.ts +17 -0
  23. package/dist/scaffolds/notis-notes/packages/sdk/src/runtime.ts +132 -1
  24. package/dist/scaffolds/notis-random/packages/sdk/src/config.ts +40 -2
  25. package/dist/scaffolds/notis-random/packages/sdk/src/documents.ts +21 -0
  26. package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useCloudComputer.ts +97 -0
  27. package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  28. package/dist/scaffolds/notis-random/packages/sdk/src/hooks/useHandover.ts +75 -0
  29. package/dist/scaffolds/notis-random/packages/sdk/src/index.ts +17 -0
  30. package/dist/scaffolds/notis-random/packages/sdk/src/runtime.ts +132 -1
  31. package/package.json +1 -1
  32. package/skills/notis-apps/SKILL.md +11 -7
  33. package/skills/notis-apps/cli.md +8 -3
  34. package/src/command-specs/apps.js +238 -50
  35. package/src/command-specs/handover.js +374 -0
  36. package/src/command-specs/index.js +3 -0
  37. package/src/command-specs/tools.js +6 -0
  38. package/src/runtime/app-dev-server.js +17 -8
  39. package/src/runtime/app-platform.js +218 -6
  40. package/src/runtime/delegated-context.js +68 -0
  41. package/src/runtime/git.js +233 -0
  42. package/src/runtime/transport.js +19 -2
  43. package/template/.harness/index.html.tmpl +116 -47
  44. package/template/packages/sdk/src/config.ts +52 -0
  45. package/template/packages/sdk/src/documents.ts +21 -0
  46. package/template/packages/sdk/src/hooks/useCloudComputer.ts +97 -0
  47. package/template/packages/sdk/src/hooks/useDatabaseSubscription.ts +76 -0
  48. package/template/packages/sdk/src/hooks/useHandover.ts +75 -0
  49. package/template/packages/sdk/src/index.ts +17 -0
  50. package/template/packages/sdk/src/runtime.ts +132 -1
  51. package/template/metadata/screenshot-1.png +0 -0
  52. package/template/metadata/screenshot-2.png +0 -0
  53. package/template/metadata/screenshot-3.png +0 -0
@@ -25,7 +25,21 @@ export type DatabasePropertyType =
25
25
  | 'status'
26
26
  | 'relation'
27
27
  | 'formula'
28
- | 'files';
28
+ | 'files'
29
+ | 'secret';
30
+
31
+ /**
32
+ * The value of a `secret` property. The platform stores a pointer to a
33
+ * credential held elsewhere and never the credential itself, so there is
34
+ * deliberately nothing here to read the secret material from — only whether
35
+ * one is attached, which credential it is, and its lifecycle state.
36
+ */
37
+ export interface SecretPropertyValue {
38
+ present: boolean;
39
+ reference: string | null;
40
+ status: string | null;
41
+ metadata: Record<string, unknown> | null;
42
+ }
29
43
 
30
44
  export interface DatabasePropertyOption {
31
45
  id?: string | null;
@@ -188,6 +202,84 @@ export interface NotisRuntimeUI {
188
202
  // NotisRuntime
189
203
  // ---------------------------------------------------------------------------
190
204
 
205
+ /**
206
+ * Options for `NotisRuntime.subscribeDatabase`.
207
+ */
208
+ export interface SubscribeDatabaseOptions {
209
+ /**
210
+ * Called with `true` once a live change feed is attached, and with `false`
211
+ * when it drops or is torn down. Hosts without a change feed (dev harness,
212
+ * screenshot stub, vite preview) never call it, so `live` stays false there.
213
+ */
214
+ onStatusChange?: (live: boolean) => void;
215
+ }
216
+
217
+ /**
218
+ * Work an app hands to the Notis manager chat through `NotisRuntime.handover`.
219
+ */
220
+ export interface HandoverPayload {
221
+ /** The message the manager should act on. */
222
+ prompt: string;
223
+ /**
224
+ * Key of a skill declared in `notis.config.ts` -> `skills[].key`. The host
225
+ * rejects a key this app does not declare. Omit to hand over plain work.
226
+ */
227
+ skill?: string;
228
+ /**
229
+ * Accepted for forward compatibility. The portal never submits a composer on
230
+ * the user's behalf today, so every handover resolves `drafted`; `sent` is
231
+ * reserved for a host that can genuinely dispatch the run.
232
+ */
233
+ autoSend?: boolean;
234
+ }
235
+
236
+ export interface HandoverResult {
237
+ /** `drafted` when the user still has to press send, `sent` when it went straight through. */
238
+ status: 'drafted' | 'sent';
239
+ }
240
+
241
+ /**
242
+ * The user's cloud computer, as far as an app may see it.
243
+ *
244
+ * `exists` is false when the user has never had a sandbox provisioned. A
245
+ * `status` of anything other than `'running'` means the VM is asleep; reading
246
+ * these facts never wakes it.
247
+ */
248
+ export interface CloudComputerSandboxFacts {
249
+ exists: boolean;
250
+ status: string | null;
251
+ provider: string | null;
252
+ created_at: string | null;
253
+ updated_at: string | null;
254
+ }
255
+
256
+ /**
257
+ * Whether a CLI inside the cloud computer is signed in.
258
+ *
259
+ * `authenticated: null` means *unknown*, never *signed out*: the sandbox was
260
+ * not running, or the probe could not answer. `reason` says which
261
+ * (`'sandbox_not_running'`, `'no_sandbox'`, `'sandbox_status_unknown'`,
262
+ * `'probe_failed'`, `'not_signed_in'`).
263
+ */
264
+ export interface CloudComputerCliAuthFacts {
265
+ authenticated: boolean | null;
266
+ account: string | null;
267
+ checked_at: string | null;
268
+ reason: string | null;
269
+ }
270
+
271
+ export interface CloudComputerFacts {
272
+ /**
273
+ * False when this host cannot answer at all — no cloud computer on the user's
274
+ * plan, or the platform could not resolve the facts. Render whatever the app
275
+ * did before rather than an error.
276
+ */
277
+ available: boolean;
278
+ reason?: string | null;
279
+ sandbox: CloudComputerSandboxFacts | null;
280
+ cli_auth: { gh: CloudComputerCliAuthFacts };
281
+ }
282
+
191
283
  export interface NotisRuntime {
192
284
  app: AppDescriptor;
193
285
  route: RouteDescriptor;
@@ -195,6 +287,45 @@ export interface NotisRuntime {
195
287
  context: NotisRuntimeContext;
196
288
  ui?: NotisRuntimeUI;
197
289
 
290
+ /**
291
+ * Subscribe to changes on an app-owned database. Returns an unsubscribe.
292
+ *
293
+ * The change notification is only a signal — it carries no rows. Consumers
294
+ * react by refetching through the normal tool path, so app scoping,
295
+ * permissions and billing are unchanged. Use the `useDatabaseSubscription`
296
+ * hook rather than calling this directly.
297
+ */
298
+ subscribeDatabase?(
299
+ slug: string,
300
+ onChange: () => void,
301
+ options?: SubscribeDatabaseOptions,
302
+ ): () => void;
303
+
304
+ /**
305
+ * Hand a piece of work to the Notis manager chat. The app cannot run an
306
+ * agent itself: it describes the job, and the manager surface owns progress,
307
+ * billing, cancellation and the transcript. Results come back to the app
308
+ * through its own databases (see `useDatabaseSubscription`).
309
+ *
310
+ * Use the `useHandover` hook rather than calling this directly. Hosts
311
+ * without a manager chat (the dev harness, the vite preview) leave it
312
+ * undefined, so keep whatever fallback the app already offers.
313
+ */
314
+ handover?(payload: HandoverPayload): Promise<HandoverResult>;
315
+
316
+ /**
317
+ * Read-only facts about the user's cloud computer. Requires
318
+ * `capabilities.cloudComputer: 'read'` in `notis.config.ts` plus the user's
319
+ * approval; resolving it never creates, resumes or commands a sandbox.
320
+ *
321
+ * Use the `useCloudComputer` hook rather than calling this directly. Hosts
322
+ * without a cloud computer (the dev harness, the vite preview) answer
323
+ * `{ available: false }`, so keep whatever fallback the app already has.
324
+ * `{ refresh: true }` bypasses the host's short answer cache — the hook's
325
+ * refresh() sends it so a just-completed sign-in becomes visible.
326
+ */
327
+ cloudComputerFacts?(options?: { refresh?: boolean }): Promise<CloudComputerFacts>;
328
+
198
329
  navigate?: (payload: { kind: string; [key: string]: unknown }) => void;
199
330
 
200
331
  registerTopBarSearch?: (
Binary file
Binary file
Binary file