dsh-deeppilot 0.4.0 → 0.5.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.
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { IncomingMessage } from "node:http";
2
1
  import z from "@deepseek-ai/schemastery";
3
2
  import { Context } from "@deepseek-ai/cordis";
4
3
  //#region src/protocol.d.ts
@@ -26,6 +25,51 @@ interface SessionSummary {
26
25
  workspaceId?: string | null;
27
26
  workspacePath?: string | null;
28
27
  }
28
+ type MessageRole = 'user' | 'assistant' | 'tool' | 'system' | 'error';
29
+ type ToolState = 'running' | 'ok' | 'error';
30
+ /** Provenance of host-injected context; present only on `role: "system"` rows.
31
+ * Mirrors the durable DSH message source (`dsh-llm` MessageSource): `label`
32
+ * names the producer (plugin name, skill name, instruction paths…), `form` is
33
+ * the semantic ContextForm vocabulary ('instructions' | 'catalog' | 'snapshot'
34
+ * | 'notice' | 'relay' | 'recall'). Both degrade gracefully — clients must
35
+ * tolerate absent fields and unknown values. */
36
+ interface MessageContextInfo {
37
+ label?: string;
38
+ form?: string;
39
+ }
40
+ /** One image carried by a user message. `attachmentId` keys the read-back RPC
41
+ * (c2s.session.attachment); width/height let clients reserve layout space. */
42
+ interface MessageAttachment {
43
+ kind: 'image';
44
+ name?: string;
45
+ mediaType?: string;
46
+ attachmentId?: string;
47
+ width?: number;
48
+ height?: number;
49
+ }
50
+ interface MessageProjection {
51
+ /** Durable row identity; unique within one session/page. */
52
+ seq: number;
53
+ role: MessageRole;
54
+ text?: string;
55
+ /** Reasoning ("thinking") text accompanying the answer, when present. */
56
+ thinking?: string;
57
+ streaming?: boolean;
58
+ tool?: {
59
+ name: string;
60
+ state: ToolState;
61
+ summary: string;
62
+ };
63
+ attachments?: MessageAttachment[];
64
+ /** Present only on system rows: provenance of the injected context.
65
+ * The DSH host logs synthetic agent.inject() content (runtime-context
66
+ * snapshots, background-job notices, workspace instructions…) as user-role
67
+ * messages whose `source.kind` is not 'user'; those project here as
68
+ * `role: "system"` so clients never show them as human prompts. */
69
+ context?: MessageContextInfo;
70
+ ts: number;
71
+ truncated?: boolean;
72
+ }
29
73
  type NotifyCategory = 'turn.completed' | 'approval.required' | 'question.asked' | 'session.error';
30
74
  /**
31
75
  * One offline-push-worthy event (same facts as s2c.notify / pending frames,
@@ -452,7 +496,11 @@ declare class HostBridge {
452
496
  pendingSnapshot(): PendingSnapshotPayload;
453
497
  /** Tail history for an opened session; pushes s2c.session.tail to the sink. */
454
498
  openSession(sink: BridgeSink, sessionId: string, tailCount: number): Promise<boolean>;
455
- historyPage(sink: BridgeSink, sessionId: string, beforeSeq: number, limit: number): Promise<boolean>;
499
+ historyPage(sessionId: string, beforeSeq: number, limit: number): Promise<{
500
+ sessionId: string;
501
+ messages: MessageProjection[];
502
+ hasMore: boolean;
503
+ } | null>;
456
504
  /** Result of one attachment read-back for the phone. */
457
505
  attachmentData(sessionId: string, attachmentId: string): Promise<{
458
506
  mediaType?: string;
@@ -498,9 +546,7 @@ declare class HostBridge {
498
546
  interface Config {
499
547
  /** Master switch; when false the plugin activates and does nothing. */
500
548
  enabled?: boolean;
501
- /** Pairing token file (0600); generated on first boot when missing. */
502
- authTokenPath?: string;
503
- /** Paired-device registry JSON path. */
549
+ /** Protocol-v2 device registry JSON path. */
504
550
  devicesPath?: string;
505
551
  /** Replay ring buffer bound (frames) per deployment. */
506
552
  historyBufferMax?: number;
@@ -514,6 +560,8 @@ interface Config {
514
560
  statePath?: string;
515
561
  helperPath?: string;
516
562
  funnelPort?: 443 | 8443 | 10000;
563
+ /** Concurrent Funnel WebSockets allowed from one public source address. */
564
+ maxConnectionsPerSource?: number;
517
565
  };
518
566
  /**
519
567
  * Offline push (F-9). `apns` sends directly from the Mac with the user's
@@ -540,7 +588,6 @@ interface Config {
540
588
  }
541
589
  declare const Config: z<Schemastery.ObjectS<{
542
590
  enabled: z<boolean, boolean>;
543
- authTokenPath: z<string, string>;
544
591
  devicesPath: z<string, string>;
545
592
  historyBufferMax: z<number, number>;
546
593
  debug: z<boolean, boolean>;
@@ -551,6 +598,7 @@ declare const Config: z<Schemastery.ObjectS<{
551
598
  statePath: z<string, string>;
552
599
  helperPath: z<string, string>;
553
600
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000>;
601
+ maxConnectionsPerSource: z<number, number>;
554
602
  }>, Schemastery.ObjectT<{
555
603
  enabled: z<boolean, boolean>;
556
604
  provider: z<"tailscale-funnel", "tailscale-funnel">;
@@ -558,6 +606,7 @@ declare const Config: z<Schemastery.ObjectS<{
558
606
  statePath: z<string, string>;
559
607
  helperPath: z<string, string>;
560
608
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000>;
609
+ maxConnectionsPerSource: z<number, number>;
561
610
  }>>;
562
611
  push: z<Schemastery.ObjectS<{
563
612
  provider: z<"none" | "apns" | "relay", "none" | "apns" | "relay">;
@@ -578,7 +627,6 @@ declare const Config: z<Schemastery.ObjectS<{
578
627
  }>>;
579
628
  }>, Schemastery.ObjectT<{
580
629
  enabled: z<boolean, boolean>;
581
- authTokenPath: z<string, string>;
582
630
  devicesPath: z<string, string>;
583
631
  historyBufferMax: z<number, number>;
584
632
  debug: z<boolean, boolean>;
@@ -589,6 +637,7 @@ declare const Config: z<Schemastery.ObjectS<{
589
637
  statePath: z<string, string>;
590
638
  helperPath: z<string, string>;
591
639
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000>;
640
+ maxConnectionsPerSource: z<number, number>;
592
641
  }>, Schemastery.ObjectT<{
593
642
  enabled: z<boolean, boolean>;
594
643
  provider: z<"tailscale-funnel", "tailscale-funnel">;
@@ -596,6 +645,7 @@ declare const Config: z<Schemastery.ObjectS<{
596
645
  statePath: z<string, string>;
597
646
  helperPath: z<string, string>;
598
647
  funnelPort: z<443 | 8443 | 10000, 443 | 8443 | 10000>;
648
+ maxConnectionsPerSource: z<number, number>;
599
649
  }>>;
600
650
  push: z<Schemastery.ObjectS<{
601
651
  provider: z<"none" | "apns" | "relay", "none" | "apns" | "relay">;
@@ -616,10 +666,6 @@ declare const Config: z<Schemastery.ObjectS<{
616
666
  }>>;
617
667
  }>>;
618
668
  //#endregion
619
- //#region src/phone-http.d.ts
620
- /** Authorization is preferred; the query form remains for older app builds. */
621
- declare function requestToken(req: Pick<IncomingMessage, 'url' | 'headers'>): string | null;
622
- //#endregion
623
669
  //#region src/push-policy.d.ts
624
670
  /** Prune only when the provider supplies an authoritative token-lifecycle verdict. */
625
671
  declare function shouldPrunePushToken(outcome: 'sent' | 'invalid-token' | 'failed', reason?: string): boolean;
@@ -642,17 +688,18 @@ declare function shouldReEnrollRelayToken(transport: 'apns' | 'relay', outcome:
642
688
  * optional health probe (/phone/health) on the existing web server. The web
643
689
  * UI is never touched.
644
690
  *
645
- * Data plane: an in-process HostBridge consumes apiProxy.events.mux()/host()
646
- * streams, mirrors session summaries, tracks pending approvals/questions,
647
- * and fans projected protocol-v1 pushes out to every connected device.
691
+ * Data plane: an in-process HostBridge consumes a local compatibility façade
692
+ * over DSH 0.1.2 Session/Workspace controllers, mirrors session summaries,
693
+ * tracks pending approvals/questions, and fans projected protocol-v2 pushes
694
+ * out to every connected device.
648
695
  *
649
696
  * Protocol: PROTOCOL.md is normative; src/protocol.ts and the private app's
650
- * Swift models mirror that v1 contract.
697
+ * Swift models mirror that v2 contract.
651
698
  */
652
699
  declare const name = "deeppilot";
653
700
  /** No eager service requirement: profiles without a web stack simply skip. */
654
701
  declare const inject: string[];
655
702
  declare function apply(ctx: Context, options: unknown): void;
656
703
  //#endregion
657
- export { Config, HostBridge, apply, inject, name, requestToken, shouldPrunePushToken, shouldReEnrollRelayToken };
704
+ export { Config, HostBridge, apply, inject, name, shouldPrunePushToken, shouldReEnrollRelayToken };
658
705
  //# sourceMappingURL=index.d.ts.map