dsh-deeppilot 0.8.2 → 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>>;
@@ -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,6 +527,7 @@ interface ApiStreamItemLike {
445
527
  interface ApiProxyLike {
446
528
  sessions: SessionsApiLike;
447
529
  workspace?: WorkspaceApiLike;
530
+ schedule?: ScheduleApiLike;
448
531
  host?: HostApiLike;
449
532
  respond(message: {
450
533
  type: 'client-response';
@@ -514,7 +597,59 @@ interface PromptDocument {
514
597
  truncated?: boolean;
515
598
  }
516
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
517
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
+ };
518
653
  declare class HostBridge {
519
654
  private readonly apiProxy;
520
655
  private readonly historyBufferMax;
@@ -536,7 +671,9 @@ declare class HostBridge {
536
671
  private started;
537
672
  private disposed;
538
673
  readonly promptDeliveries: PromptDeliveryJournal;
539
- 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);
540
677
  private pushOutlet;
541
678
  private widgetFingerprint;
542
679
  /**
@@ -554,8 +691,10 @@ declare class HostBridge {
554
691
  notifyAllCategories: boolean;
555
692
  models: boolean;
556
693
  sessionManagement: boolean;
694
+ sessionFork: boolean;
557
695
  sessionRestore: boolean;
558
696
  projectSelection: boolean;
697
+ schedules: boolean;
559
698
  push: boolean;
560
699
  widgetPush: boolean;
561
700
  liveActivityPush: boolean;
@@ -677,6 +816,35 @@ declare class HostBridge {
677
816
  workspaceId?: string;
678
817
  cwd?: string;
679
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
+ }>>;
680
848
  sendPrompt(sessionId: string, text: string, images?: Array<{
681
849
  mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
682
850
  data: string;