super-dsh 0.1.0 → 0.1.1

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 (178) hide show
  1. package/agent-agy/bridge/agy_bridge.py +250 -0
  2. package/agent-agy/bridge/gemini_openai_server.mjs +98 -0
  3. package/agent-agy/cordis.patch.yml +49 -0
  4. package/agent-agy/dist/adapter.d.ts +15 -0
  5. package/agent-agy/dist/adapter.js +42 -0
  6. package/agent-agy/dist/agent-preset-agy.d.ts +47 -0
  7. package/agent-agy/dist/agent-preset-agy.js +169 -0
  8. package/agent-agy/dist/agent-preset-projection.d.ts +31 -0
  9. package/agent-agy/dist/agent-preset-projection.js +33 -0
  10. package/agent-agy/dist/agent.d.ts +137 -0
  11. package/agent-agy/dist/agent.js +493 -0
  12. package/agent-agy/dist/agy-cli-client.d.ts +137 -0
  13. package/agent-agy/dist/agy-cli-client.js +301 -0
  14. package/agent-agy/dist/agy-client.d.ts +160 -0
  15. package/agent-agy/dist/agy-client.js +252 -0
  16. package/agent-agy/dist/agy-sessions.d.ts +24 -0
  17. package/agent-agy/dist/agy-sessions.js +116 -0
  18. package/agent-agy/dist/agy-store.d.ts +39 -0
  19. package/agent-agy/dist/agy-store.js +83 -0
  20. package/agent-agy/dist/inbox.d.ts +26 -0
  21. package/agent-agy/dist/inbox.js +53 -0
  22. package/agent-agy/dist/index.d.ts +80 -0
  23. package/agent-agy/dist/index.js +505 -0
  24. package/agent-agy/dist/models.d.ts +41 -0
  25. package/agent-agy/dist/models.js +74 -0
  26. package/agent-agy/dist/world-plugin.d.ts +9 -0
  27. package/agent-agy/dist/world-plugin.js +88 -0
  28. package/agent-agy/package.json +64 -0
  29. package/agent-claude/cordis.patch.yml +42 -0
  30. package/agent-claude/dist/adapter.js +62 -0
  31. package/agent-claude/dist/agent-preset-claude.js +169 -0
  32. package/agent-claude/dist/agent-preset-projection.js +30 -0
  33. package/agent-claude/dist/agent.js +1271 -0
  34. package/agent-claude/dist/claude-client.js +357 -0
  35. package/agent-claude/dist/claude-events.js +223 -0
  36. package/agent-claude/dist/claude-home.js +29 -0
  37. package/agent-claude/dist/commands.js +182 -0
  38. package/agent-claude/dist/content.js +134 -0
  39. package/agent-claude/dist/inbox.js +53 -0
  40. package/agent-claude/dist/index.js +555 -0
  41. package/agent-claude/dist/input-queue.js +64 -0
  42. package/agent-claude/dist/interaction.js +271 -0
  43. package/agent-claude/dist/models.js +158 -0
  44. package/agent-claude/dist/permission.js +120 -0
  45. package/agent-claude/dist/session-id.js +20 -0
  46. package/agent-claude/dist/session-map.js +165 -0
  47. package/agent-claude/dist/world-plugin.js +14 -0
  48. package/agent-claude/package.json +74 -0
  49. package/agent-codex/README.md +74 -0
  50. package/agent-codex/cordis.patch.yml +77 -0
  51. package/agent-codex/dist/adapter.js +55 -0
  52. package/agent-codex/dist/agent-preset-codex.js +171 -0
  53. package/agent-codex/dist/agent-preset-projection.js +37 -0
  54. package/agent-codex/dist/agent.js +1056 -0
  55. package/agent-codex/dist/app-home.js +65 -0
  56. package/agent-codex/dist/codex-client.js +469 -0
  57. package/agent-codex/dist/codex-events.js +297 -0
  58. package/agent-codex/dist/codex-store.js +190 -0
  59. package/agent-codex/dist/inbox.js +53 -0
  60. package/agent-codex/dist/index.js +605 -0
  61. package/agent-codex/dist/models.js +152 -0
  62. package/agent-codex/dist/permission.js +71 -0
  63. package/agent-codex/dist/session-map.js +170 -0
  64. package/agent-codex/dist/spike.js +46 -0
  65. package/agent-codex/dist/world-plugin.js +87 -0
  66. package/agent-codex/package.json +78 -0
  67. package/agent-hermes/README.md +144 -0
  68. package/agent-hermes/cordis.patch.yml +83 -0
  69. package/agent-hermes/dist/adapter.js +83 -0
  70. package/agent-hermes/dist/agent-preset-hermes.js +171 -0
  71. package/agent-hermes/dist/agent-preset-projection.js +34 -0
  72. package/agent-hermes/dist/agent.js +1068 -0
  73. package/agent-hermes/dist/hermes-client.js +953 -0
  74. package/agent-hermes/dist/hermes-events.js +289 -0
  75. package/agent-hermes/dist/hermes-store.js +158 -0
  76. package/agent-hermes/dist/inbox.js +53 -0
  77. package/agent-hermes/dist/index.js +541 -0
  78. package/agent-hermes/dist/models.js +324 -0
  79. package/agent-hermes/dist/permission.js +60 -0
  80. package/agent-hermes/dist/world-plugin.js +92 -0
  81. package/agent-hermes/package.json +76 -0
  82. package/agent-hub/cordis.patch.yml +12 -0
  83. package/agent-hub/dist/agent-roster.d.ts +34 -0
  84. package/agent-hub/dist/agent-roster.js +27 -0
  85. package/agent-hub/dist/carrier.d.ts +43 -0
  86. package/agent-hub/dist/carrier.js +241 -0
  87. package/agent-hub/dist/client-shim.d.ts +28 -0
  88. package/agent-hub/dist/client-shim.js +251 -0
  89. package/agent-hub/dist/envelope.d.ts +54 -0
  90. package/agent-hub/dist/envelope.js +92 -0
  91. package/agent-hub/dist/gateway.d.ts +28 -0
  92. package/agent-hub/dist/gateway.js +18 -0
  93. package/agent-hub/dist/index-pass.d.ts +22 -0
  94. package/agent-hub/dist/index-pass.js +47 -0
  95. package/agent-hub/dist/index.d.ts +29 -0
  96. package/agent-hub/dist/index.js +29 -0
  97. package/agent-hub/dist/labels.d.ts +45 -0
  98. package/agent-hub/dist/labels.js +83 -0
  99. package/agent-hub/dist/ownership.d.ts +37 -0
  100. package/agent-hub/dist/ownership.js +54 -0
  101. package/agent-hub/dist/roster.d.ts +28 -0
  102. package/agent-hub/dist/roster.js +38 -0
  103. package/agent-hub/dist/rpc.d.ts +38 -0
  104. package/agent-hub/dist/rpc.js +52 -0
  105. package/agent-hub/dist/spawn-world.d.ts +46 -0
  106. package/agent-hub/dist/spawn-world.js +72 -0
  107. package/agent-hub/dist/targets.d.ts +33 -0
  108. package/agent-hub/dist/targets.js +30 -0
  109. package/agent-hub/dist/world-entry.d.ts +31 -0
  110. package/agent-hub/dist/world-entry.js +51 -0
  111. package/agent-hub/dist/world-host.d.ts +69 -0
  112. package/agent-hub/dist/world-host.js +44 -0
  113. package/agent-hub/dist/world-join.d.ts +16 -0
  114. package/agent-hub/dist/world-join.js +113 -0
  115. package/agent-hub/dist/world-mount.d.ts +52 -0
  116. package/agent-hub/dist/world-mount.js +52 -0
  117. package/agent-hub/dist/world-mux.d.ts +72 -0
  118. package/agent-hub/dist/world-mux.js +224 -0
  119. package/agent-hub/dist/world-provision.d.ts +16 -0
  120. package/agent-hub/dist/world-provision.js +109 -0
  121. package/agent-hub/dist/world-web-server.d.ts +162 -0
  122. package/agent-hub/dist/world-web-server.js +248 -0
  123. package/agent-hub/lib/client/index.js +242 -0
  124. package/agent-hub/package.json +65 -0
  125. package/agent-omp/README.md +77 -0
  126. package/agent-omp/cordis.patch.yml +92 -0
  127. package/agent-omp/dist/adapter.js +36 -0
  128. package/agent-omp/dist/agent-preset-omp.js +171 -0
  129. package/agent-omp/dist/agent-preset-projection.js +36 -0
  130. package/agent-omp/dist/agent.js +1145 -0
  131. package/agent-omp/dist/app-home.js +86 -0
  132. package/agent-omp/dist/discovery.js +116 -0
  133. package/agent-omp/dist/inbox.js +53 -0
  134. package/agent-omp/dist/index.js +574 -0
  135. package/agent-omp/dist/knobs.js +50 -0
  136. package/agent-omp/dist/lazy-rpc.js +161 -0
  137. package/agent-omp/dist/mobile/gesture.js +148 -0
  138. package/agent-omp/dist/mobile/zoom-guard.js +294 -0
  139. package/agent-omp/dist/mobile-boot.js +38 -0
  140. package/agent-omp/dist/models.js +299 -0
  141. package/agent-omp/dist/omp-cli.js +147 -0
  142. package/agent-omp/dist/omp-disk-discovery.js +178 -0
  143. package/agent-omp/dist/omp-store.js +518 -0
  144. package/agent-omp/dist/pairing.js +45 -0
  145. package/agent-omp/dist/permission.js +96 -0
  146. package/agent-omp/dist/protocol.js +13 -0
  147. package/agent-omp/dist/rpc-types.js +1 -0
  148. package/agent-omp/dist/sdk-client.js +378 -0
  149. package/agent-omp/dist/sidecar-client.js +195 -0
  150. package/agent-omp/dist/store/adapter.js +47 -0
  151. package/agent-omp/dist/store/db.js +210 -0
  152. package/agent-omp/dist/store/index.js +59 -0
  153. package/agent-omp/dist/store/reconcile.js +51 -0
  154. package/agent-omp/dist/store/schema.js +40 -0
  155. package/agent-omp/dist/world-plugin.js +87 -0
  156. package/agent-omp/package.json +97 -0
  157. package/agent-omp/sidecar/main.ts +481 -0
  158. package/agent-pi/README.md +67 -0
  159. package/agent-pi/cordis.patch.yml +80 -0
  160. package/agent-pi/dist/adapter.js +53 -0
  161. package/agent-pi/dist/agent-preset-pi.js +169 -0
  162. package/agent-pi/dist/agent-preset-projection.js +29 -0
  163. package/agent-pi/dist/agent.js +949 -0
  164. package/agent-pi/dist/inbox.js +53 -0
  165. package/agent-pi/dist/index.js +595 -0
  166. package/agent-pi/dist/knobs.js +24 -0
  167. package/agent-pi/dist/models.js +200 -0
  168. package/agent-pi/dist/permission.js +66 -0
  169. package/agent-pi/dist/pi-client.js +224 -0
  170. package/agent-pi/dist/pi-events.js +155 -0
  171. package/agent-pi/dist/pi-home.js +55 -0
  172. package/agent-pi/dist/safe-json.js +25 -0
  173. package/agent-pi/dist/session-map.js +119 -0
  174. package/agent-pi/dist/world-plugin.js +88 -0
  175. package/agent-pi/package.json +77 -0
  176. package/cordis.patch.yml +22 -19
  177. package/package.json +45 -11
  178. package/client.js +0 -4
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The `agentPreset` session projection, owned by the adapter.
3
+ *
4
+ * Upstream registers this fold from the `dsh-agent-presets` package, which our
5
+ * patch disables (the Antigravity provider replaces preset composition
6
+ * wholesale). But the Web UI depends on the projection regardless: the preset
7
+ * hero chip renders only when `session.projectionValues.agentPreset` resolves
8
+ * (presetOf in ui-agent-preset/seat-store.ts), and the session-header label
9
+ * reads it too. Without a registrant the projection is absent for every
10
+ * adapter session and both surfaces stay blank — roster or no roster.
11
+ *
12
+ * Same fold as upstream (packages/preset/agent-presets/src/session.ts):
13
+ * initialized from the creation header, advanced by `agent-preset/selected`
14
+ * events, which this adapter synthesizes (`"agy"`) on every session it
15
+ * prepares. Registered under the provider's own fiber via
16
+ * `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
17
+ * the provider is mounted.
18
+ */
19
+ import { z } from "zod";
20
+ /** Current Session preset, initialized from its header and advanced by selection events. */
21
+ export declare const agyAgentPresetProjection: {
22
+ key: "agentPreset";
23
+ stateSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
24
+ init: (header: import("@deepseek-ai/dsh-session").SessionHeader) => string;
25
+ apply: (state: string | null, event: import("@deepseek-ai/dsh-session").SessionEvent) => string | null;
26
+ wire: {
27
+ viewSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
28
+ view: (state: string | null) => string | null;
29
+ };
30
+ stateVersion: number;
31
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The `agentPreset` session projection, owned by the adapter.
3
+ *
4
+ * Upstream registers this fold from the `dsh-agent-presets` package, which our
5
+ * patch disables (the Antigravity provider replaces preset composition
6
+ * wholesale). But the Web UI depends on the projection regardless: the preset
7
+ * hero chip renders only when `session.projectionValues.agentPreset` resolves
8
+ * (presetOf in ui-agent-preset/seat-store.ts), and the session-header label
9
+ * reads it too. Without a registrant the projection is absent for every
10
+ * adapter session and both surfaces stay blank — roster or no roster.
11
+ *
12
+ * Same fold as upstream (packages/preset/agent-presets/src/session.ts):
13
+ * initialized from the creation header, advanced by `agent-preset/selected`
14
+ * events, which this adapter synthesizes (`"agy"`) on every session it
15
+ * prepares. Registered under the provider's own fiber via
16
+ * `ctx.inject(['sessionProjections'])`, so the key lives exactly as long as
17
+ * the provider is mounted.
18
+ */
19
+ import { z } from "zod";
20
+ const agentPresetSchema = z.union([z.string(), z.null()]);
21
+ /** Current Session preset, initialized from its header and advanced by selection events. */
22
+ export const agyAgentPresetProjection = {
23
+ key: "agentPreset",
24
+ stateSchema: agentPresetSchema,
25
+ // adapter-agy is single-preset: default every session to "agy" so the
26
+ // header chip resolves for scan-native (never-resumed) sessions too.
27
+ init: (header) => header.agentPreset ?? "agy",
28
+ apply: (state, event) => event.type === "agent-preset/selected"
29
+ ? event.data.agentPreset
30
+ : state,
31
+ wire: { viewSchema: agentPresetSchema, view: (state) => state },
32
+ stateVersion: 1,
33
+ };
@@ -0,0 +1,137 @@
1
+ /**
2
+ * AgyAgent — the Dash `Agent` shim over one `AgyBridgeClient` (the Python SDK
3
+ * bridge child; localharness materializes inside it on the first prompt).
4
+ *
5
+ * Projection (bridge → Dash session events):
6
+ * (prompt delivery) → turn/start + user/message
7
+ * chunk (streamed) → assistant stream frames (v2 protocol) accumulated
8
+ * as durable records; the FULL text commits once as
9
+ * assistant/message at `done`
10
+ * tool → (V1: bridge supplies name only — omitted from the
11
+ * log rather than fabricated; event-stream honesty)
12
+ * done → assistant/message + step/end + turn/end {completed}
13
+ * error → turn/end {error} with a stable code
14
+ *
15
+ * Bridge gaps registered explicitly (never fabricated):
16
+ * - token usage: the bridge `done` event carries none → no usage field.
17
+ * - tool fidelity: only a tool name arrives (no call id / args / result) → no
18
+ * tool/call or tool/result events in V1.
19
+ * - steer/cancel: the bridge has no in-turn interrupt; `steer` degrades to a
20
+ * parked follow-up, `cancel` records the cause (applied at the terminal).
21
+ *
22
+ * Onboarding (§17 minimal, consumer-first): when no Gemini API key is known,
23
+ * the first user turn never touches the bridge — the turn is answered locally
24
+ * with a system/message asking for the key; a pasted key is persisted through
25
+ * `onApiKey` (adapter state, world home only) and confirmed in the same turn.
26
+ */
27
+ import type { Context } from "@deepseek-ai/cordis";
28
+ import type { Agent, AgentOptions, AgentStatus, CancelOptions, InboxTarget } from "@deepseek-ai/dsh-agent";
29
+ import { Inbox } from "./inbox.js";
30
+ import type { AgentCancelCause, Session, SessionId, UserMessage } from "@deepseek-ai/dsh-session";
31
+ import type { TokenUsage } from "@deepseek-ai/dsh-llm";
32
+ import type { AgyBridgeClient } from "./agy-client.js";
33
+ /** Structural union of the two live transports (SDK bridge | CLI stream). */
34
+ export type LiveAgyClient = Pick<AgyBridgeClient, "conversationId" | "lastUsage" | "onThinkingDelta" | "onToolEvent" | "setApprovalHandler" | "turn" | "close"> & {
35
+ setSystemMessageHandler?(handler: (text: string) => void): void;
36
+ };
37
+ /** Classify a bridge turn failure into the stable {message, code} UI chip. */
38
+ export declare function classifyTurnError(error: unknown): {
39
+ message: string;
40
+ code: string;
41
+ };
42
+ /** Join the visible text blocks of a Dash user message into the prompt string. */
43
+ export declare function userMessageText(message: UserMessage): string;
44
+ /** Whether a raw user text looks like a pasteable Gemini API key. */
45
+ export declare function looksLikeApiKey(text: string): boolean;
46
+ /** Runtime facts the provider stamps the agent with (mirrors hermes). */
47
+ export interface AgyAgentRuntimeInfo {
48
+ /** Session materialization context for the bridge (first prompt). */
49
+ readonly session: {
50
+ cwd: string;
51
+ };
52
+ /** True when no Gemini API key is known: turns are answered locally. */
53
+ readonly awaitingKey: boolean;
54
+ /** Persist a pasted key (adapter state, world home ONLY). */
55
+ readonly onSaveApiKey: (key: string) => void;
56
+ /** Fired after each bridge turn completes (the provider upserts the conversation id). */
57
+ readonly onTurnDone?: () => void;
58
+ }
59
+ export declare class AgyAgent implements Agent {
60
+ readonly id: SessionId;
61
+ readonly options: AgentOptions;
62
+ readonly session: Session;
63
+ readonly inbox: Inbox;
64
+ readonly ctx: Context;
65
+ private readonly client;
66
+ private readonly loopCtx;
67
+ private readonly scope;
68
+ private readonly dispatch;
69
+ private readonly runtimeInfo;
70
+ private streaming;
71
+ private dashTurn;
72
+ private step;
73
+ private lastTurn;
74
+ private turnOpen;
75
+ private cancelCause;
76
+ private streamBridge;
77
+ private assistantAttemptCounter;
78
+ private assistantStreamRevision;
79
+ private remoteQueue;
80
+ private turnDeadlineTimer;
81
+ private disposed;
82
+ private systemMessageDone;
83
+ private activityDone;
84
+ private resolveActivityDone;
85
+ private readonly onIdleExit;
86
+ constructor(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session, client: LiveAgyClient, onIdleExit?: () => void, runtimeInfo?: AgyAgentRuntimeInfo);
87
+ get status(): AgentStatus;
88
+ send(message: UserMessage, _target: InboxTarget, wakeup: boolean): void;
89
+ followup(message: UserMessage): void;
90
+ /** No native steer surface on the bridge (V1 gap): degrade to a parked follow-up. */
91
+ steer(message: UserMessage): void;
92
+ inject(message: UserMessage): void;
93
+ /** The bridge has no in-turn interrupt (V1 gap): record the cause; applied at the terminal. */
94
+ cancel(cause: AgentCancelCause, _options?: CancelOptions): void;
95
+ whenIdle(): Promise<void>;
96
+ runMaintenance<T>(task: (signal: AbortSignal) => Promise<T>): Promise<T>;
97
+ dispose(): Promise<void>;
98
+ private deliver;
99
+ private deliverPrompt;
100
+ private sessionIdentityCommitted;
101
+ /** Stamp the single-preset selection once per session (projection seed). */
102
+ private bootstrapSessionIdentity;
103
+ private startTurn;
104
+ private appendSystemNotice;
105
+ private appendAssistantMessage;
106
+ private ensureStreamBridge;
107
+ private abandonStreamBridge;
108
+ private reserveTurn;
109
+ private closeTurn;
110
+ private closeStep;
111
+ private commitStepStart;
112
+ /** One-shot system stamp: the onboarding notice rides the first turn. */
113
+ private markRunning;
114
+ private markIdle;
115
+ private beginActivity;
116
+ private endActivity;
117
+ /** Flush ONE parked follow-up as a fresh prompt (never submit while busy). */
118
+ private flushFollowUps;
119
+ private pendingThinking;
120
+ /** Calls from this turn still lacking a result (SDK 0.1.17 exposes none). */
121
+ private unpairedCalls;
122
+ private armTurnDeadline;
123
+ private clearTurnDeadline;
124
+ }
125
+ /**
126
+ * Map the bridge's best-effort usage event into Dash `TokenUsage`. The bridge
127
+ * derives it from `conversation.last_turn_usage` AFTER the stream — when it is
128
+ * absent there is NO usage field (never fabricated). `thinking_tokens` rides
129
+ * along only when it is a subset of `output_tokens` (the DSH fold rejects a
130
+ * larger value outright).
131
+ */
132
+ export declare function convertAgyUsage(usage: {
133
+ input_tokens: number;
134
+ output_tokens: number;
135
+ thinking_tokens: number;
136
+ total_tokens: number;
137
+ } | undefined): TokenUsage | undefined;