deepspace 0.19.5 → 0.21.0

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 (43) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{chunk-A7UFIOWO.js → chunk-KDCDRHBA.js} +7 -2
  3. package/dist/chunk-KDCDRHBA.js.map +1 -0
  4. package/dist/cli.js +219 -94
  5. package/dist/cli.js.map +1 -1
  6. package/dist/documentation-client-core.d.ts +3 -2
  7. package/dist/documentation-client-core.js +1 -1
  8. package/dist/documentation-default-renderer.cjs +48 -48
  9. package/dist/documentation-react.d.ts +2 -1
  10. package/dist/documentation-react.js +1 -1
  11. package/dist/documentation-runtime.js +7 -7
  12. package/dist/documentation-server-core.d.ts +3 -2
  13. package/dist/documentation-server-core.js +1 -1
  14. package/dist/documentation.d.ts +40 -12
  15. package/dist/documentation.js +40 -7
  16. package/dist/documentation.js.map +1 -1
  17. package/dist/index.d.ts +225 -21
  18. package/dist/index.js +262 -112
  19. package/dist/index.js.map +1 -1
  20. package/dist/{public-CFAj1hL2.d.ts → public-DenQ1TsZ.d.ts} +36 -11
  21. package/dist/server.d.ts +46 -29
  22. package/dist/server.js +1041 -254
  23. package/dist/server.js.map +1 -1
  24. package/dist/testing-mcp.d.ts +69 -0
  25. package/dist/testing-mcp.js +99 -0
  26. package/dist/testing-mcp.js.map +1 -0
  27. package/dist/testing.d.ts +17 -20
  28. package/dist/testing.js +47 -25
  29. package/dist/testing.js.map +1 -1
  30. package/dist/worker.d.ts +73 -32
  31. package/dist/worker.js +1094 -244
  32. package/dist/worker.js.map +1 -1
  33. package/features/ai-chat/feature.json +2 -2
  34. package/features/ai-chat/src/AiChatPage.tsx +56 -21
  35. package/features/ai-chat/src/ChatPanel.tsx +33 -10
  36. package/features/ai-chat/src/__tests__/ChatPanel.lifecycle.test.tsx +156 -0
  37. package/features/cron/src/CronLogPage.tsx +107 -69
  38. package/features/file-attachments/feature.json +2 -1
  39. package/features/file-manager/feature.json +2 -1
  40. package/features/file-manager/src/FileManagerPage.tsx +227 -194
  41. package/features/integration-test/src/IntegrationTestPage.tsx +54 -34
  42. package/package.json +5 -1
  43. package/dist/chunk-A7UFIOWO.js.map +0 -1
package/dist/worker.d.ts CHANGED
@@ -60,6 +60,7 @@ declare const MSG: {
60
60
  readonly CRON_PAUSE: "cron.pause";
61
61
  readonly CRON_RESUME: "cron.resume";
62
62
  readonly CRON_STATUS: "cron.status";
63
+ readonly CRON_ACK: "cron.ack";
63
64
  readonly JOB_ENQUEUE: "job.enqueue";
64
65
  readonly JOB_CANCEL: "job.cancel";
65
66
  readonly JOB_RETRY: "job.retry";
@@ -223,10 +224,13 @@ type ClientMessage = BaseMessage<typeof MSG.SUBSCRIBE, {
223
224
  props: Record<string, unknown>;
224
225
  }> | BaseMessage<typeof MSG.CANVAS_VIEWPORT, unknown> | BaseMessage<typeof MSG.CANVAS_UNDO, EmptyPayload> | BaseMessage<typeof MSG.CANVAS_REDO, EmptyPayload> | BaseMessage<typeof MSG.CRON_TRIGGER, {
225
226
  taskName: string;
227
+ requestId?: string;
226
228
  }> | BaseMessage<typeof MSG.CRON_PAUSE, {
227
229
  taskName: string;
230
+ requestId?: string;
228
231
  }> | BaseMessage<typeof MSG.CRON_RESUME, {
229
232
  taskName: string;
233
+ requestId?: string;
230
234
  }> | BaseMessage<typeof MSG.JOB_ENQUEUE, {
231
235
  requestId: string;
232
236
  type: string;
@@ -313,6 +317,16 @@ type ServerMessage = BaseMessage<typeof MSG.QUERY_RESULT, {
313
317
  }> | BaseMessage<typeof MSG.CRON_STATUS, {
314
318
  tasks: unknown;
315
319
  recentHistory: unknown;
320
+ }> | BaseMessage<typeof MSG.CRON_ACK, {
321
+ requestId: string;
322
+ taskName: string;
323
+ ok: true;
324
+ } | {
325
+ requestId: string;
326
+ taskName?: string;
327
+ ok: false;
328
+ reason: 'read_only' | 'unknown_task' | 'failed';
329
+ error?: string;
316
330
  }> | BaseMessage<typeof MSG.JOB_UPDATE, {
317
331
  kind: 'snapshot' | 'enqueued' | 'progress' | 'succeeded' | 'failed' | 'canceled' | 'retried';
318
332
  job?: unknown;
@@ -453,22 +467,25 @@ declare const clientBuild: {
453
467
  readonly type: "canvas.redo";
454
468
  readonly payload: EmptyPayload;
455
469
  };
456
- cronTrigger: (taskName: string) => {
470
+ cronTrigger: (taskName: string, requestId?: string) => {
457
471
  readonly type: "cron.trigger";
458
472
  readonly payload: {
459
473
  readonly taskName: string;
474
+ readonly requestId: string | undefined;
460
475
  };
461
476
  };
462
- cronPause: (taskName: string) => {
477
+ cronPause: (taskName: string, requestId?: string) => {
463
478
  readonly type: "cron.pause";
464
479
  readonly payload: {
465
480
  readonly taskName: string;
481
+ readonly requestId: string | undefined;
466
482
  };
467
483
  };
468
- cronResume: (taskName: string) => {
484
+ cronResume: (taskName: string, requestId?: string) => {
469
485
  readonly type: "cron.resume";
470
486
  readonly payload: {
471
487
  readonly taskName: string;
488
+ readonly requestId: string | undefined;
472
489
  };
473
490
  };
474
491
  jobEnqueue: (requestId: string, type: string, payload?: unknown, maxAttempts?: number) => {
@@ -666,6 +683,24 @@ declare const serverBuild: {
666
683
  readonly recentHistory: unknown;
667
684
  };
668
685
  };
686
+ cronAckSuccess: (requestId: string, taskName: string) => {
687
+ readonly type: "cron.ack";
688
+ readonly payload: {
689
+ readonly requestId: string;
690
+ readonly taskName: string;
691
+ readonly ok: true;
692
+ };
693
+ };
694
+ cronAckFailure: (requestId: string, reason: "read_only" | "unknown_task" | "failed", error?: string, taskName?: string) => {
695
+ readonly type: "cron.ack";
696
+ readonly payload: {
697
+ readonly requestId: string;
698
+ readonly taskName: string | undefined;
699
+ readonly ok: false;
700
+ readonly reason: "read_only" | "unknown_task" | "failed";
701
+ readonly error: string | undefined;
702
+ };
703
+ };
669
704
  jobSnapshot: (jobs: unknown[]) => {
670
705
  readonly type: "job.update";
671
706
  readonly payload: {
@@ -1594,12 +1629,22 @@ declare abstract class CronRoom<E = Record<string, unknown>> extends BaseRoom<E>
1594
1629
  type: string;
1595
1630
  [key: string]: unknown;
1596
1631
  }): Promise<void>;
1632
+ private dispatchMessage;
1597
1633
  protected onAlarm(): Promise<void>;
1598
1634
  private executeTask;
1599
1635
  private scheduleNextAlarm;
1600
1636
  private getTaskStates;
1601
1637
  private getRecentHistory;
1602
1638
  private broadcastStatus;
1639
+ /**
1640
+ * Receipt for a mutation frame, addressed only to its sender. Receipts
1641
+ * are opt-in by correlation id: frames without a `requestId` keep the
1642
+ * fire-and-forget contract, so the (untyped) `requestId` from the wire
1643
+ * is the single gate here rather than a check at every call site.
1644
+ * Frames go through the shared `serverBuild` constructors so the wire
1645
+ * shape is enforced by the protocol types, not re-spelled here.
1646
+ */
1647
+ private ackMutation;
1603
1648
  /**
1604
1649
  * Execute a scheduled task by name.
1605
1650
  * Called both by the alarm scheduler and manual trigger.
@@ -2848,13 +2893,9 @@ declare const UPLOAD_PART_BYTES: number;
2848
2893
  /**
2849
2894
  * The highest part number the server accepts.
2850
2895
  *
2851
- * The handler holds no per-session state, so this — not the declared total —
2852
- * is what bounds an in-flight upload. It is computed against
2853
- * {@link UPLOAD_PART_BYTES}, which is why the server refuses a part larger
2854
- * than that even though a whole small file may be 25 MiB: admitting 25 MiB
2855
- * parts would make the real in-flight bound 52 × 25 MiB = 1300 MiB while the
2856
- * advertised ceiling stayed 1 GiB. With both numbers agreeing, a session's
2857
- * worst case is 52 × 20 MiB = 1040 MiB — the ceiling plus one part.
2896
+ * The server derives the only valid part number and byte length from the
2897
+ * declared total and {@link UPLOAD_PART_BYTES}. The maximum part count is
2898
+ * therefore the exact number needed to reach the file ceiling.
2858
2899
  *
2859
2900
  * R2 allows 10,000 parts, so this is far inside what the API permits.
2860
2901
  */
@@ -2909,6 +2950,25 @@ declare function storageQuotaMessage(incomingBytes: number, usedBytes: number, l
2909
2950
  declare const MAX_DEPLOY_ASSET_FILE_BYTES: number;
2910
2951
  declare function formatBytes(bytes: number): string;
2911
2952
 
2953
+ /**
2954
+ * Everything the files handler needs to enforce one account allocation.
2955
+ *
2956
+ * `quotaKey` is required because an exact scan followed by an uncoordinated
2957
+ * write cannot enforce a limit under concurrency. Callers that do not want a
2958
+ * quota omit `storage`; callers that do want one must name its serialized
2959
+ * summary.
2960
+ */
2961
+ interface StorageAdmission {
2962
+ /** The app prefix receiving this request's write. */
2963
+ prefix: string;
2964
+ /** Internal R2 key for the account's ETag-serialized usage summary. */
2965
+ quotaKey: string;
2966
+ /** Resolve the account's limit. `null` fails writes closed. */
2967
+ limitBytes: () => Promise<number | null>;
2968
+ /** Resolve the other app prefixes in the account. `null` fails closed. */
2969
+ siblingPrefixes?: () => Promise<string[] | null>;
2970
+ }
2971
+
2912
2972
  /**
2913
2973
  * Shared Scoped R2 Files Handler
2914
2974
  *
@@ -2952,6 +3012,7 @@ interface ScopeContext {
2952
3012
  }
2953
3013
  type PrefixResult = {
2954
3014
  prefix: string;
3015
+ excludedPrefixes?: readonly string[];
2955
3016
  error?: undefined;
2956
3017
  } | {
2957
3018
  prefix?: undefined;
@@ -2974,32 +3035,12 @@ interface ScopedR2Config {
2974
3035
  * mount. The handler is the enforcer; the mount only knows whose limit
2975
3036
  * applies.
2976
3037
  */
2977
- interface StorageAdmission {
2978
- /** This app's own prefix — the one the incoming write lands under. */
2979
- prefix: string;
2980
- /**
2981
- * Resolve the owner's limit in bytes. `null` means the lookup failed;
2982
- * writes then fail closed (503) rather than admitting unmetered storage.
2983
- */
2984
- limitBytes: () => Promise<number | null>;
2985
- /**
2986
- * The OTHER app prefixes this owner's storage spans, if any.
2987
- *
2988
- * The limit is per ACCOUNT, not per app: an owner's allocation is the total
2989
- * across everything they own, so admission has to see the siblings too. `[]`
2990
- * for an owner with one app, which is the common case and costs exactly what
2991
- * it did when this was a per-app limit.
2992
- *
2993
- * Returning `null` means the owner's apps could not be enumerated. Like a
2994
- * failed limit lookup that fails the write closed rather than admitting a
2995
- * write against an allocation we cannot measure.
2996
- */
2997
- siblingPrefixes?: () => Promise<string[] | null>;
2998
- }
2999
3038
  interface ScopedR2Auth {
3000
3039
  userId: string | null;
3001
3040
  /** Absent = no quota on this mount (e.g. an app's own bucket). */
3002
3041
  storage?: StorageAdmission;
3042
+ /** Account-wide quota details are private to an authorized owner surface. */
3043
+ includeStorageUsage?: boolean;
3003
3044
  }
3004
3045
  type ScopedR2Handler = (request: Request, url: URL, bucket: R2Bucket, auth: ScopedR2Auth) => Promise<Response>;
3005
3046
  declare function isFilesVerbPath(method: string, subpath: string): boolean;