dsh-deeppilot 0.8.1 → 0.8.3

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/lib/index.d.ts CHANGED
@@ -30,7 +30,7 @@ declare class PromptDeliveryJournal {
30
30
  }
31
31
  //#endregion
32
32
  //#region src/device-auth.d.ts
33
- declare const DEVICE_SCOPES: readonly ['sessions.read', 'prompt.send', 'sessions.manage', 'interactions.respond', 'notifications.register'];
33
+ declare const DEVICE_SCOPES: readonly ['sessions.read', 'prompt.send', 'sessions.manage', 'interactions.respond', 'notifications.register', 'schedule.manage'];
34
34
  type DeviceScope = (typeof DEVICE_SCOPES)[number];
35
35
  //#endregion
36
36
  //#region src/protocol.d.ts
@@ -233,6 +233,12 @@ interface SessionsApiLike {
233
233
  sessionId: string;
234
234
  agentPreset?: string;
235
235
  }>>;
236
+ fork?(req: RpcRequestLike<{
237
+ sessionId: string;
238
+ atSeq?: number;
239
+ }>): Promise<RpcResponseLike<{
240
+ sessionId: string;
241
+ }>>;
236
242
  models?(req: RpcRequestLike<{
237
243
  sessionId: string;
238
244
  }>): Promise<RpcResponseLike<HostSessionModels>>;
@@ -264,8 +270,8 @@ interface SessionsApiLike {
264
270
  };
265
271
  data: string;
266
272
  }>>;
267
- /** DSH 0.1.7+: complete projection baseline for one session; null when the session is gone. */
268
- projections?(req: RpcRequestLike<{
273
+ /** Complete projection baseline for one session; null when it is gone. */
274
+ projections(req: RpcRequestLike<{
269
275
  sessionId: string;
270
276
  }>): Promise<RpcResponseLike<{
271
277
  asOfSeq: number;
@@ -294,6 +300,82 @@ interface WorkspaceApiLike {
294
300
  archivedSessionIds: string[];
295
301
  }>>;
296
302
  }
303
+ type ScheduleKind = 'after' | 'at' | 'every' | 'daily' | 'weekly' | 'cron';
304
+ interface ScheduleTaskViewLike {
305
+ id: string;
306
+ kind: ScheduleKind;
307
+ title: string;
308
+ prompt: string;
309
+ scheduledAt: string;
310
+ state: 'scheduled' | 'overdue';
311
+ deliveryMode: 'host';
312
+ afterSeconds?: number;
313
+ everySeconds?: number;
314
+ time?: string;
315
+ timeZone?: string;
316
+ weekdays?: number[];
317
+ expression?: string;
318
+ }
319
+ interface ScheduleHistoryViewLike {
320
+ id: string;
321
+ records: Array<{
322
+ scheduledAt: string;
323
+ deliveredAt: string;
324
+ messageId: string;
325
+ prompt?: string;
326
+ }>;
327
+ earlierRecordsUnavailable: boolean;
328
+ earlierRecordsPruned?: boolean;
329
+ retention: {
330
+ days: number;
331
+ records: number;
332
+ };
333
+ nextBefore?: string;
334
+ }
335
+ interface ScheduleApiLike {
336
+ list(req: RpcRequestLike<{
337
+ sessionId: string;
338
+ }>): Promise<RpcResponseLike<{
339
+ sessionId: string;
340
+ tasks: ScheduleTaskViewLike[];
341
+ }>>;
342
+ history(req: RpcRequestLike<{
343
+ sessionId: string;
344
+ id: string;
345
+ limit: number;
346
+ before?: string;
347
+ }>): Promise<RpcResponseLike<{
348
+ sessionId: string;
349
+ history: ScheduleHistoryViewLike;
350
+ }>>;
351
+ create(req: RpcRequestLike<{
352
+ sessionId: string;
353
+ title: string;
354
+ prompt: string;
355
+ [key: string]: unknown;
356
+ }>): Promise<RpcResponseLike<ScheduleTaskViewLike>>;
357
+ update(req: RpcRequestLike<{
358
+ sessionId: string;
359
+ id: string;
360
+ expected: unknown;
361
+ title?: string;
362
+ prompt?: string;
363
+ change?: unknown;
364
+ }>): Promise<RpcResponseLike<{
365
+ id: string;
366
+ updated: boolean;
367
+ record?: ScheduleTaskViewLike;
368
+ code?: string;
369
+ }>>;
370
+ delete(req: RpcRequestLike<{
371
+ sessionId: string;
372
+ id: string;
373
+ }>): Promise<RpcResponseLike<{
374
+ id: string;
375
+ deleted: boolean;
376
+ code?: string;
377
+ }>>;
378
+ }
297
379
  interface HostApiLike {
298
380
  listDirectory?(req: RpcRequestLike<{
299
381
  path?: string;
@@ -445,13 +527,8 @@ interface ApiStreamItemLike {
445
527
  interface ApiProxyLike {
446
528
  sessions: SessionsApiLike;
447
529
  workspace?: WorkspaceApiLike;
530
+ schedule?: ScheduleApiLike;
448
531
  host?: HostApiLike;
449
- /**
450
- * DSH 0.1.7 added `session.projections`. Absent/false keeps the bridge on
451
- * its existing list-row projection hints — the call is gated on this flag so
452
- * older hosts never see a failing RPC.
453
- */
454
- supportsProjections?: boolean;
455
532
  respond(message: {
456
533
  type: 'client-response';
457
534
  rpcId: string;
@@ -520,7 +597,59 @@ interface PromptDocument {
520
597
  truncated?: boolean;
521
598
  }
522
599
  //#endregion
600
+ //#region src/mutation-journal.d.ts
601
+ type MutationErrorCode = 'E_PROTOCOL' | 'E_NOT_FOUND' | 'E_BUSY' | 'E_UNSUPPORTED' | 'E_INTERNAL';
602
+ type MutationOperationResult<T> = {
603
+ ok: true;
604
+ value: T;
605
+ } | {
606
+ ok: false;
607
+ code: MutationErrorCode;
608
+ message?: string;
609
+ };
610
+ type MutationDispatchResult<T> = {
611
+ ok: true;
612
+ value?: T;
613
+ replayed?: boolean;
614
+ } | {
615
+ ok: false;
616
+ code: MutationErrorCode;
617
+ message?: string;
618
+ replayed?: boolean;
619
+ };
620
+ /**
621
+ * Small durable at-most-once journal for non-prompt mutations.
622
+ *
623
+ * Only a hash of the request content is persisted. The successful value is
624
+ * kept in memory for the current process so a concurrent retry can receive the
625
+ * same response; after a restart a replay is acknowledged and the client
626
+ * refetches the authoritative resource. This avoids duplicating reminder
627
+ * prompts or conversation data in a second journal.
628
+ */
629
+ declare class MutationJournal {
630
+ private readonly path?;
631
+ private readonly persistValues;
632
+ private readonly entries;
633
+ private readonly inFlight;
634
+ private healthy;
635
+ constructor(path?: string | undefined, persistValues?: boolean);
636
+ private key;
637
+ private expired;
638
+ private save;
639
+ dispatch<T>(deviceId: string, id: string, content: unknown, operation: () => Promise<MutationOperationResult<T>>): Promise<MutationDispatchResult<T>>;
640
+ }
641
+ //#endregion
523
642
  //#region src/host-bridge.d.ts
643
+ type ScheduleBridgeResult<T> = {
644
+ ok: true;
645
+ value: T;
646
+ replayed?: boolean;
647
+ } | {
648
+ ok: false;
649
+ kind: 'unsupported' | 'not-found' | 'invalid' | 'conflict' | 'busy' | 'internal';
650
+ message: string;
651
+ replayed?: boolean;
652
+ };
524
653
  declare class HostBridge {
525
654
  private readonly apiProxy;
526
655
  private readonly historyBufferMax;
@@ -542,7 +671,9 @@ declare class HostBridge {
542
671
  private started;
543
672
  private disposed;
544
673
  readonly promptDeliveries: PromptDeliveryJournal;
545
- constructor(apiProxy: ApiProxyLike, historyBufferMax?: number, deliveryJournalPath?: string);
674
+ readonly scheduleMutations: MutationJournal;
675
+ readonly forkMutations: MutationJournal;
676
+ constructor(apiProxy: ApiProxyLike, historyBufferMax?: number, deliveryJournalPath?: string, scheduleJournalPath?: string, forkJournalPath?: string);
546
677
  private pushOutlet;
547
678
  private widgetFingerprint;
548
679
  /**
@@ -560,8 +691,10 @@ declare class HostBridge {
560
691
  notifyAllCategories: boolean;
561
692
  models: boolean;
562
693
  sessionManagement: boolean;
694
+ sessionFork: boolean;
563
695
  sessionRestore: boolean;
564
696
  projectSelection: boolean;
697
+ schedules: boolean;
565
698
  push: boolean;
566
699
  widgetPush: boolean;
567
700
  liveActivityPush: boolean;
@@ -639,7 +772,7 @@ declare class HostBridge {
639
772
  /** Tail history for an opened session; pushes s2c.session.tail to the sink. */
640
773
  openSession(sink: BridgeSink, sessionId: string, tailCount: number): Promise<boolean>;
641
774
  /**
642
- * Pull one session's projection baseline (DSH 0.1.7+) and fold every key
775
+ * Pull one session's projection baseline and fold every key
643
776
  * through applyProjection — unknown keys are ignored there, `null` means the
644
777
  * session no longer exists, and any failure degrades to a diagnostic: opening
645
778
  * a session must never fail because a baseline could not be read.
@@ -683,6 +816,35 @@ declare class HostBridge {
683
816
  workspaceId?: string;
684
817
  cwd?: string;
685
818
  }): Promise<string | null>;
819
+ forkSession(deviceId: string, payload: {
820
+ clientRequestId: string;
821
+ sessionId: string;
822
+ atSeq?: number;
823
+ }): Promise<ScheduleBridgeResult<{
824
+ sessionId: string;
825
+ }>>;
826
+ listSchedules(sessionId: string): Promise<ScheduleBridgeResult<ScheduleTaskViewLike[]>>;
827
+ scheduleHistory(sessionId: string, id: string, limit: number, before?: string): Promise<ScheduleBridgeResult<ScheduleHistoryViewLike>>;
828
+ createSchedule(deviceId: string, payload: Record<string, unknown> & {
829
+ sessionId: string;
830
+ clientRequestId: string;
831
+ title: string;
832
+ prompt: string;
833
+ }): Promise<ScheduleBridgeResult<ScheduleTaskViewLike>>;
834
+ updateSchedule(deviceId: string, payload: Record<string, unknown> & {
835
+ sessionId: string;
836
+ id: string;
837
+ clientRequestId: string;
838
+ expected: unknown;
839
+ }): Promise<ScheduleBridgeResult<ScheduleTaskViewLike>>;
840
+ deleteSchedule(deviceId: string, payload: {
841
+ sessionId: string;
842
+ id: string;
843
+ clientRequestId: string;
844
+ }): Promise<ScheduleBridgeResult<{
845
+ id: string;
846
+ deleted: true;
847
+ }>>;
686
848
  sendPrompt(sessionId: string, text: string, images?: Array<{
687
849
  mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
688
850
  data: string;
@@ -744,18 +906,18 @@ interface Config {
744
906
  };
745
907
  }
746
908
  declare const Config: z<Schemastery.ObjectS<NoInfer<{
747
- enabled: z<boolean, boolean, "defined">;
909
+ enabled: z<boolean, boolean, "volatile-defined">;
748
910
  devicesPath: z<string, string, "defined">;
749
911
  historyBufferMax: z<number, number, "defined">;
750
- debug: z<boolean, boolean, "defined">;
751
- local: z<Schemastery.ObjectS<NoInfer<{
912
+ debug: z<boolean, boolean, "volatile-defined">;
913
+ local: z<NoInfer<Schemastery.ObjectS<NoInfer<{
752
914
  enabled: z<boolean, boolean, "defined">;
753
915
  port: z<number, number, "defined">;
754
- }>>, Schemastery.ObjectT<NoInfer<{
916
+ }>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
755
917
  enabled: z<boolean, boolean, "defined">;
756
918
  port: z<number, number, "defined">;
757
- }>>, "defined">;
758
- remote: z<Schemastery.ObjectS<NoInfer<{
919
+ }>>>, "volatile-defined">;
920
+ remote: z<NoInfer<Schemastery.ObjectS<NoInfer<{
759
921
  enabled: z<boolean, boolean, "defined">;
760
922
  provider: z<"tailscale-funnel", "tailscale-funnel", "defined">;
761
923
  hostname: z<string, string, "defined">;
@@ -763,7 +925,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
763
925
  helperPath: z<string, string, "defined">;
764
926
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000, "defined">;
765
927
  maxConnectionsPerSource: z<number, number, "defined">;
766
- }>>, Schemastery.ObjectT<NoInfer<{
928
+ }>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
767
929
  enabled: z<boolean, boolean, "defined">;
768
930
  provider: z<"tailscale-funnel", "tailscale-funnel", "defined">;
769
931
  hostname: z<string, string, "defined">;
@@ -771,7 +933,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
771
933
  helperPath: z<string, string, "defined">;
772
934
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000, "defined">;
773
935
  maxConnectionsPerSource: z<number, number, "defined">;
774
- }>>, "defined">;
936
+ }>>>, "volatile-defined">;
775
937
  push: z<Schemastery.ObjectS<NoInfer<{
776
938
  provider: z<"apns" | "none" | "relay", "apns" | "none" | "relay", "defined">;
777
939
  contentMode: z<"generic" | "preview", "generic" | "preview", "defined">;
@@ -792,18 +954,18 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
792
954
  relayToken: z<string, string, "defined">;
793
955
  }>>, "defined">;
794
956
  }>>, Schemastery.ObjectT<NoInfer<{
795
- enabled: z<boolean, boolean, "defined">;
957
+ enabled: z<boolean, boolean, "volatile-defined">;
796
958
  devicesPath: z<string, string, "defined">;
797
959
  historyBufferMax: z<number, number, "defined">;
798
- debug: z<boolean, boolean, "defined">;
799
- local: z<Schemastery.ObjectS<NoInfer<{
960
+ debug: z<boolean, boolean, "volatile-defined">;
961
+ local: z<NoInfer<Schemastery.ObjectS<NoInfer<{
800
962
  enabled: z<boolean, boolean, "defined">;
801
963
  port: z<number, number, "defined">;
802
- }>>, Schemastery.ObjectT<NoInfer<{
964
+ }>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
803
965
  enabled: z<boolean, boolean, "defined">;
804
966
  port: z<number, number, "defined">;
805
- }>>, "defined">;
806
- remote: z<Schemastery.ObjectS<NoInfer<{
967
+ }>>>, "volatile-defined">;
968
+ remote: z<NoInfer<Schemastery.ObjectS<NoInfer<{
807
969
  enabled: z<boolean, boolean, "defined">;
808
970
  provider: z<"tailscale-funnel", "tailscale-funnel", "defined">;
809
971
  hostname: z<string, string, "defined">;
@@ -811,7 +973,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
811
973
  helperPath: z<string, string, "defined">;
812
974
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000, "defined">;
813
975
  maxConnectionsPerSource: z<number, number, "defined">;
814
- }>>, Schemastery.ObjectT<NoInfer<{
976
+ }>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
815
977
  enabled: z<boolean, boolean, "defined">;
816
978
  provider: z<"tailscale-funnel", "tailscale-funnel", "defined">;
817
979
  hostname: z<string, string, "defined">;
@@ -819,7 +981,7 @@ declare const Config: z<Schemastery.ObjectS<NoInfer<{
819
981
  helperPath: z<string, string, "defined">;
820
982
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000, "defined">;
821
983
  maxConnectionsPerSource: z<number, number, "defined">;
822
- }>>, "defined">;
984
+ }>>>, "volatile-defined">;
823
985
  push: z<Schemastery.ObjectS<NoInfer<{
824
986
  provider: z<"apns" | "none" | "relay", "apns" | "none" | "relay", "defined">;
825
987
  contentMode: z<"generic" | "preview", "generic" | "preview", "defined">;
@@ -867,8 +1029,8 @@ declare function shouldReEnrollRelayToken(transport: 'apns' | 'relay', outcome:
867
1029
  * devices) and loopback Funnel-origin listeners. The web UI and the rest of
868
1030
  * DSH's API are never exposed by these listeners.
869
1031
  *
870
- * Data plane: an in-process HostBridge consumes a local compatibility façade
871
- * over DSH 0.1.2 Session/Workspace controllers, mirrors session summaries,
1032
+ * Data plane: an in-process HostBridge consumes a local adapter over DSH
1033
+ * Session/Workspace controllers, mirrors session summaries,
872
1034
  * tracks pending approvals/questions, and fans projected protocol-v2 pushes
873
1035
  * out to every connected device.
874
1036
  *