@deksden-com/dd-flow-cli 0.9.0-beta.134 → 0.9.0-beta.135

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 (110) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +31 -0
  3. package/dist/build-info.json +7 -7
  4. package/dist/harness-runtime/OPENCODE-LICENSE.txt +24 -0
  5. package/dist/harness-runtime/bin/dd-opencode.mjs +1 -1
  6. package/dist/harness-runtime/lib/codex-capacity-policy.mjs +13 -0
  7. package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +193 -39
  8. package/dist/harness-runtime/lib/dd-opencode.mjs +295 -100
  9. package/dist/harness-runtime/lib/delegation-instructions.mjs +3 -3
  10. package/dist/harness-runtime/lib/managed-daemon.mjs +1 -1
  11. package/dist/harness-runtime/lib/native-hook-command.d.mts +2 -2
  12. package/dist/harness-runtime/lib/native-hook-command.mjs +4 -4
  13. package/dist/harness-runtime/lib/opencode-plugin.mjs +60 -0
  14. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-1y4a697q.js +81 -0
  15. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-2ny4vxct.js +92 -0
  16. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-6mptkzbc.js +0 -0
  17. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-7x67cf1q.js +52 -0
  18. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-9rqn6x4v.js +16 -0
  19. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-9vdz0zwn.js +1661 -0
  20. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ecs5ftka.js +1466 -0
  21. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-frbwqjmf.js +145 -0
  22. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-gne7h7mq.js +50 -0
  23. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-gx9wnkzr.js +105 -0
  24. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-m2eywc8w.js +0 -0
  25. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-nwcpakzx.js +12 -0
  26. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-q4g3afnw.js +623 -0
  27. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-qav6mfdz.js +0 -0
  28. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-sxt88q69.js +12 -0
  29. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-t1xa31vm.js +39 -0
  30. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ve4aws36.js +103 -0
  31. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vmytr4q8.js +4 -0
  32. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vt9jbch8.js +36 -0
  33. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vyas3vgt.js +0 -0
  34. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-wjyeq25y.js +30 -0
  35. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-xgnj2w4v.js +20 -0
  36. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-y2etg5bs.js +9 -0
  37. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ydhz1zrh.js +238 -0
  38. package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-z6qdwcsf.js +62 -0
  39. package/dist/harness-runtime/vendor/opencode-client/contract.d.ts +1 -0
  40. package/dist/harness-runtime/vendor/opencode-client/contract.js +12 -0
  41. package/dist/harness-runtime/vendor/opencode-client/effect/api/api.d.ts +2806 -0
  42. package/dist/harness-runtime/vendor/opencode-client/effect/api/api.js +0 -0
  43. package/dist/harness-runtime/vendor/opencode-client/effect/api.d.ts +4 -0
  44. package/dist/harness-runtime/vendor/opencode-client/effect/api.js +0 -0
  45. package/dist/harness-runtime/vendor/opencode-client/effect/client.d.ts +2530 -0
  46. package/dist/harness-runtime/vendor/opencode-client/effect/client.js +15 -0
  47. package/dist/harness-runtime/vendor/opencode-client/effect/generated/client-error.d.ts +7 -0
  48. package/dist/harness-runtime/vendor/opencode-client/effect/generated/client-error.js +6 -0
  49. package/dist/harness-runtime/vendor/opencode-client/effect/generated/client.d.ts +2529 -0
  50. package/dist/harness-runtime/vendor/opencode-client/effect/generated/client.js +8 -0
  51. package/dist/harness-runtime/vendor/opencode-client/effect/generated/index.d.ts +2 -0
  52. package/dist/harness-runtime/vendor/opencode-client/effect/generated/index.js +12 -0
  53. package/dist/harness-runtime/vendor/opencode-client/effect/index.d.ts +35 -0
  54. package/dist/harness-runtime/vendor/opencode-client/effect/index.js +75 -0
  55. package/dist/harness-runtime/vendor/opencode-client/effect/rpc.d.ts +20 -0
  56. package/dist/harness-runtime/vendor/opencode-client/effect/rpc.js +11 -0
  57. package/dist/harness-runtime/vendor/opencode-client/effect/service.d.ts +90 -0
  58. package/dist/harness-runtime/vendor/opencode-client/effect/service.js +187 -0
  59. package/dist/harness-runtime/vendor/opencode-client/package.json +84 -0
  60. package/dist/harness-runtime/vendor/opencode-client/promise/api.d.ts +21 -0
  61. package/dist/harness-runtime/vendor/opencode-client/promise/api.js +0 -0
  62. package/dist/harness-runtime/vendor/opencode-client/promise/client.d.ts +252 -0
  63. package/dist/harness-runtime/vendor/opencode-client/promise/client.js +14 -0
  64. package/dist/harness-runtime/vendor/opencode-client/promise/generated/client-error.d.ts +8 -0
  65. package/dist/harness-runtime/vendor/opencode-client/promise/generated/client-error.js +6 -0
  66. package/dist/harness-runtime/vendor/opencode-client/promise/generated/client.d.ts +259 -0
  67. package/dist/harness-runtime/vendor/opencode-client/promise/generated/client.js +7 -0
  68. package/dist/harness-runtime/vendor/opencode-client/promise/generated/index.d.ts +3 -0
  69. package/dist/harness-runtime/vendor/opencode-client/promise/generated/index.js +79 -0
  70. package/dist/harness-runtime/vendor/opencode-client/promise/generated/types.d.ts +8932 -0
  71. package/dist/harness-runtime/vendor/opencode-client/promise/generated/types.js +70 -0
  72. package/dist/harness-runtime/vendor/opencode-client/promise/index.d.ts +6 -0
  73. package/dist/harness-runtime/vendor/opencode-client/promise/index.js +83 -0
  74. package/dist/harness-runtime/vendor/opencode-client/promise/rpc.d.ts +32 -0
  75. package/dist/harness-runtime/vendor/opencode-client/promise/rpc.js +7 -0
  76. package/dist/harness-runtime/vendor/opencode-client/promise/service.d.ts +24 -0
  77. package/dist/harness-runtime/vendor/opencode-client/promise/service.js +187 -0
  78. package/dist/harness-runtime/vendor/opencode-client/pty-handoff.d.ts +12 -0
  79. package/dist/harness-runtime/vendor/opencode-client/pty-handoff.js +14 -0
  80. package/dist/harness-runtime/vendor/opencode-client/rpc-runtime.d.ts +20 -0
  81. package/dist/harness-runtime/vendor/opencode-client/rpc-runtime.js +14 -0
  82. package/dist/harness-runtime/vendor/opencode-client/service-contender.d.ts +37 -0
  83. package/dist/harness-runtime/vendor/opencode-client/service-contender.js +10 -0
  84. package/dist/harness-runtime/vendor/opencode-client/service-probe.d.ts +70 -0
  85. package/dist/harness-runtime/vendor/opencode-client/service-probe.js +16 -0
  86. package/dist/harness-runtime/vendor/opencode-client/service-timing.d.ts +12 -0
  87. package/dist/harness-runtime/vendor/opencode-client/service-timing.js +10 -0
  88. package/dist/harness-runtime/vendor/opencode-client/service-version.d.ts +2 -0
  89. package/dist/harness-runtime/vendor/opencode-client/service-version.js +6 -0
  90. package/dist/harness-runtime/vendor/opencode-client/service.d.ts +52 -0
  91. package/dist/harness-runtime/vendor/opencode-client/service.js +1 -0
  92. package/dist/harness-runtime/vendor/opencode-client/shared-events.d.ts +11 -0
  93. package/dist/harness-runtime/vendor/opencode-client/shared-events.js +8 -0
  94. package/dist/harness-runtime/vendor/opencode-client/solid/connection.d.ts +37 -0
  95. package/dist/harness-runtime/vendor/opencode-client/solid/connection.js +10 -0
  96. package/dist/harness-runtime/vendor/opencode-client/solid/data.d.ts +211 -0
  97. package/dist/harness-runtime/vendor/opencode-client/solid/data.js +18 -0
  98. package/dist/harness-runtime/vendor/opencode-client/solid/index.d.ts +3 -0
  99. package/dist/harness-runtime/vendor/opencode-client/solid/index.js +32 -0
  100. package/dist/harness-runtime/vendor/opencode-client/solid/pty.d.ts +22 -0
  101. package/dist/harness-runtime/vendor/opencode-client/solid/pty.js +8 -0
  102. package/dist/harness-runtime/vendor/opencode-plugin.mjs +3 -0
  103. package/dist/services/engines.js +22 -24
  104. package/dist/services/eval-snapshots.js +1 -1
  105. package/dist/services/external-work-launch.js +1 -1
  106. package/dist/services/hooks.js +1 -1
  107. package/dist/services/merge-server.js +1 -1
  108. package/dist/services/run-controller-recovery.js +2 -2
  109. package/dist/services/run-controller.js +2 -2
  110. package/package.json +4 -1
@@ -0,0 +1,52 @@
1
+ /** Connection details for a local OpenCode service. */
2
+ export type Endpoint = {
3
+ /** Base URL of the service. */
4
+ readonly url: string;
5
+ /** Authentication required by the service, when configured. */
6
+ readonly auth?: {
7
+ /** HTTP authentication scheme. */
8
+ readonly type: "basic";
9
+ /** Basic authentication username. */
10
+ readonly username: string;
11
+ /** Basic authentication password. */
12
+ readonly password: string;
13
+ };
14
+ };
15
+ /** Options used to discover the local OpenCode service. */
16
+ export type DiscoverOptions = {
17
+ /** Absolute registration file path. Defaults to the XDG state directory. */
18
+ readonly file?: string;
19
+ /** Required exact service version or compatibility predicate. */
20
+ readonly version?: string | ((version: string) => boolean);
21
+ };
22
+ /** Reason ensuring the service requires a new process. */
23
+ export type EnsureReason = "missing" | "version-mismatch";
24
+ /** Options used to ensure the local OpenCode service is running. */
25
+ export type EnsureOptions = DiscoverOptions & {
26
+ /** Service command and arguments. Defaults to `opencode serve --service`. */
27
+ readonly command?: ReadonlyArray<string>;
28
+ /** Environment variables added to the inherited service process environment. */
29
+ readonly env?: Readonly<Record<string, string>>;
30
+ /** Called once before spawning a new service process. */
31
+ readonly onStart?: (reason: EnsureReason, previousVersion?: string) => void;
32
+ };
33
+ /** Options used to stop the local OpenCode service. */
34
+ export type StopOptions = {
35
+ /** Absolute registration file path. Defaults to the XDG state directory. */
36
+ readonly file?: string;
37
+ /** How to handle persistent terminals before stopping the service. */
38
+ readonly pty?: "clear" | "handoff";
39
+ };
40
+ /** Contents of the local service registration file. */
41
+ export type Info = {
42
+ /** Unique service instance identifier. */
43
+ readonly id?: string;
44
+ /** OpenCode version served by the process. */
45
+ readonly version?: string;
46
+ /** Base URL advertised by the service. */
47
+ readonly url: string;
48
+ /** Operating system process identifier. */
49
+ readonly pid: number;
50
+ /** Private service password, when authentication is enabled. */
51
+ readonly password?: string;
52
+ };
@@ -0,0 +1 @@
1
+ import"./chunks/service-probe-qav6mfdz.js";
@@ -0,0 +1,11 @@
1
+ export * as SharedEvents from "./shared-events.js";
2
+ export type SubscribeOptions = {
3
+ readonly signal?: AbortSignal;
4
+ /** Reports transport activity on the shared stream, including keepalive frames that carry no event. */
5
+ readonly onActivity?: () => void;
6
+ };
7
+ export declare function make<A extends {
8
+ readonly type: string;
9
+ }>(connect: (signal: AbortSignal, onActivity: () => void) => AsyncIterable<A>): {
10
+ subscribe(options?: SubscribeOptions): AsyncIterable<A>;
11
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ make7,
3
+ exports_shared_events
4
+ } from "./chunks/service-probe-frbwqjmf.js";
5
+ export {
6
+ exports_shared_events as SharedEvents,
7
+ make7 as make
8
+ };
@@ -0,0 +1,37 @@
1
+ import type { OpenCodeClient, OpenCodeEvent } from "../promise";
2
+ export type ClientConnectionStatus = "connected" | "connecting" | "reconnecting";
3
+ export type ClientConnectionEvent = {
4
+ readonly type: "client.connection";
5
+ readonly created: number;
6
+ readonly data: {
7
+ readonly status: "connecting" | "connected" | "disconnected" | "reconnecting";
8
+ readonly attempt: number;
9
+ readonly error?: string;
10
+ };
11
+ };
12
+ export type ClientConnectionOptions = {
13
+ readonly reconnect?: (signal: AbortSignal) => Promise<OpenCodeClient>;
14
+ readonly onEvent: (event: OpenCodeEvent) => void;
15
+ readonly flushInterval?: number;
16
+ readonly pageLifecycle?: boolean;
17
+ /**
18
+ * Abort and reconnect a stream that receives no bytes for this long. The server writes a keepalive
19
+ * comment every 15 seconds, so a quiet but healthy stream never trips this.
20
+ */
21
+ readonly idleTimeout?: number;
22
+ readonly log?: {
23
+ readonly debug?: (message: string, data?: Readonly<Record<string, unknown>>) => void;
24
+ readonly info?: (message: string, data?: Readonly<Record<string, unknown>>) => void;
25
+ };
26
+ };
27
+ export declare const defaultIdleTimeout = 45000;
28
+ export declare const foregroundIdleThreshold = 20000;
29
+ export declare function createClientConnection(initialApi: OpenCodeClient, options: ClientConnectionOptions): {
30
+ status: () => ClientConnectionStatus;
31
+ attempt: () => number;
32
+ error: () => string | undefined;
33
+ internal: {
34
+ history: () => ClientConnectionEvent[];
35
+ resync: (reason: string) => void;
36
+ };
37
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ defaultIdleTimeout2,
3
+ foregroundIdleThreshold2,
4
+ createClientConnection2
5
+ } from "../chunks/service-probe-ydhz1zrh.js";
6
+ export {
7
+ createClientConnection2 as createClientConnection,
8
+ defaultIdleTimeout2 as defaultIdleTimeout,
9
+ foregroundIdleThreshold2 as foregroundIdleThreshold
10
+ };
@@ -0,0 +1,211 @@
1
+ import type { AgentInfo, CommandInfo, ConfigEntry, SessionFormCancelInput, FormInfo, SessionFormReplyInput, IntegrationInfo, LocationRef, McpResource, McpServer, ModelInfo, ModelRef, PermissionSavedInfo, PermissionRequest, PermissionReplyInput, Project, ProviderInfo, ReferenceInfo, SessionMessageInfo, SessionInfo, SessionInboxInfo, SessionInboxCompaction, ShellInfo, SkillInfo, VcsInfo, OpenCodeEvent, OpenCodeClient, WebSearchProvider } from "../promise";
2
+ import { type SessionPromptInput } from "../promise";
3
+ export type DataSessionStatus = "idle" | "running";
4
+ /**
5
+ * Where a pending user prompt stands relative to the runner: `starting` is promoted at the next idle boundary,
6
+ * `steering` waits for the next step boundary of an execution that already delivered input, `stranded` outlived an
7
+ * execution that ended without delivering it, and `queued` waits for every steer to drain.
8
+ */
9
+ export type DataPendingStatus = "starting" | "steering" | "stranded" | "queued";
10
+ type OpenCodeEventMap = {
11
+ [Type in OpenCodeEvent["type"]]: Extract<OpenCodeEvent, {
12
+ type: Type;
13
+ }>;
14
+ };
15
+ export type CreateDataInput = {
16
+ readonly api: () => OpenCodeClient;
17
+ readonly directory: string;
18
+ /** Raw-message window used for an initial transcript read. Older pages retain their normal size. */
19
+ readonly initialMessageLimit?: () => number;
20
+ readonly event: {
21
+ readonly on: <Type extends OpenCodeEvent["type"]>(type: Type, handler: (event: OpenCodeEventMap[Type]) => void) => () => void;
22
+ readonly listen: (handler: (event: {
23
+ name: OpenCodeEvent["type"];
24
+ details: OpenCodeEvent;
25
+ }) => void) => () => void;
26
+ };
27
+ readonly connection?: {
28
+ readonly status: () => "connected" | "connecting" | "reconnecting";
29
+ };
30
+ /** Receives failed event-driven reads. Explicit reads still reject to their caller. */
31
+ readonly onError?: (error: unknown) => void;
32
+ };
33
+ export declare const settleMs = 150;
34
+ export type FormWithLocation = FormInfo & {
35
+ readonly location?: LocationRef;
36
+ };
37
+ type ShellWithLocation = ShellInfo & {
38
+ readonly location: LocationRef;
39
+ };
40
+ export declare function locationKey(location: LocationRef): string;
41
+ export declare function createData(config: CreateDataInput): {
42
+ on: <Type extends OpenCodeEvent["type"]>(type: Type, handler: (event: OpenCodeEventMap[Type]) => void) => () => void;
43
+ listen: (handler: (event: {
44
+ name: OpenCodeEvent["type"];
45
+ details: OpenCodeEvent;
46
+ }) => void) => () => void;
47
+ session: {
48
+ list(): SessionInfo[];
49
+ get(sessionID: string): SessionInfo;
50
+ creating(sessionID: string): boolean;
51
+ remember(info: SessionInfo): void;
52
+ setStatus(sessionID: string, status: DataSessionStatus): void;
53
+ root(sessionID: string): string;
54
+ family(sessionID: string): string[];
55
+ /** Clear heavy cached data for the root and all known descendants. */
56
+ evict(sessionID: string): void;
57
+ cost(sessionID: string): number;
58
+ status(sessionID: string): DataSessionStatus;
59
+ active(): string[];
60
+ input: {
61
+ list(sessionID: string): string[];
62
+ has(sessionID: string, inboxID: string): boolean;
63
+ };
64
+ pending: {
65
+ list(sessionID: string): SessionInboxInfo[];
66
+ status(sessionID: string, inboxID: string): DataPendingStatus | undefined;
67
+ sync(sessionID: string): Promise<void>;
68
+ invalidate(sessionID: string): void;
69
+ };
70
+ create(input: {
71
+ id?: string;
72
+ title?: string;
73
+ agent?: string;
74
+ model?: ModelRef;
75
+ location?: LocationRef;
76
+ projectID?: string;
77
+ }): {
78
+ id: string;
79
+ request: Promise<SessionInfo>;
80
+ };
81
+ compact(input: {
82
+ sessionID: string;
83
+ model?: ModelRef;
84
+ }): Promise<SessionInboxCompaction>;
85
+ prompt(input: SessionPromptInput & {
86
+ gate?: Promise<unknown>;
87
+ prepare?: () => Promise<unknown>;
88
+ }): Promise<import("../promise").SessionInboxUser>;
89
+ sync(sessionID: string, options?: {
90
+ children?: boolean;
91
+ }): Promise<void>;
92
+ invalidate(sessionID: string): void;
93
+ message: {
94
+ list(sessionID: string): SessionMessageInfo[];
95
+ get(sessionID: string, messageID: string): SessionMessageInfo | undefined;
96
+ sync(sessionID: string): Promise<void>;
97
+ more(sessionID: string): boolean;
98
+ loading(sessionID: string): boolean;
99
+ loadMore(sessionID: string, options?: {
100
+ all?: boolean;
101
+ signal?: AbortSignal;
102
+ /** Runs synchronously inside the store-publication batch. */
103
+ beforePublish?: () => void;
104
+ }): Promise<void>;
105
+ invalidate(sessionID: string): void;
106
+ };
107
+ permission: {
108
+ list(sessionID: string): PermissionRequest[];
109
+ sessions(): string[];
110
+ sync(sessionID: string): Promise<void>;
111
+ invalidate(sessionID: string): void;
112
+ reply(input: PermissionReplyInput): Promise<void>;
113
+ };
114
+ form: {
115
+ list(sessionID: string, ref?: LocationRef): FormWithLocation[] | undefined;
116
+ sessions(): string[];
117
+ sync(sessionID: string, ref?: LocationRef): Promise<void>;
118
+ invalidate(sessionID: string, ref?: LocationRef): void;
119
+ reply(input: SessionFormReplyInput, ref?: LocationRef): Promise<void>;
120
+ cancel(input: SessionFormCancelInput, ref?: LocationRef): Promise<void>;
121
+ };
122
+ };
123
+ project: {
124
+ list(): Project[];
125
+ get(projectID: string): Project;
126
+ sync(): Promise<void>;
127
+ invalidate(): void;
128
+ permission: {
129
+ list(projectID: string): PermissionSavedInfo[];
130
+ sync(projectID: string): Promise<void>;
131
+ invalidate(projectID: string): void;
132
+ };
133
+ };
134
+ shell: {
135
+ list(location?: LocationRef): ShellWithLocation[];
136
+ listBySession(sessionID: string): ShellWithLocation[];
137
+ get(id: string): ShellWithLocation | undefined;
138
+ sync: (ref?: LocationRef) => Promise<void>;
139
+ invalidate: (ref?: LocationRef) => void;
140
+ };
141
+ location: {
142
+ info(ref?: LocationRef): import("../promise").LocationPublicInfo | undefined;
143
+ default(): LocationRef;
144
+ syncInfo(ref?: LocationRef): Promise<void>;
145
+ sync(ref?: LocationRef): Promise<void>;
146
+ invalidate(ref?: LocationRef): void;
147
+ vcs: {
148
+ info: (ref?: LocationRef) => VcsInfo | undefined;
149
+ sync: (ref?: LocationRef) => Promise<void>;
150
+ invalidate: (ref?: LocationRef) => void;
151
+ };
152
+ agent: {
153
+ list: (ref?: LocationRef) => AgentInfo[] | undefined;
154
+ sync: (ref?: LocationRef) => Promise<void>;
155
+ invalidate: (ref?: LocationRef) => void;
156
+ };
157
+ command: {
158
+ list: (ref?: LocationRef) => CommandInfo[] | undefined;
159
+ sync: (ref?: LocationRef) => Promise<void>;
160
+ invalidate: (ref?: LocationRef) => void;
161
+ };
162
+ config: {
163
+ list: (ref?: LocationRef) => ConfigEntry[] | undefined;
164
+ sync: (ref?: LocationRef) => Promise<void>;
165
+ invalidate: (ref?: LocationRef) => void;
166
+ };
167
+ integration: {
168
+ list: (ref?: LocationRef) => IntegrationInfo[] | undefined;
169
+ sync: (ref?: LocationRef) => Promise<void>;
170
+ invalidate: (ref?: LocationRef) => void;
171
+ };
172
+ mcp: {
173
+ server: {
174
+ list: (ref?: LocationRef) => McpServer[] | undefined;
175
+ sync: (ref?: LocationRef) => Promise<void>;
176
+ invalidate: (ref?: LocationRef) => void;
177
+ };
178
+ resource: {
179
+ list: (ref?: LocationRef) => McpResource[] | undefined;
180
+ sync: (ref?: LocationRef) => Promise<void>;
181
+ invalidate: (ref?: LocationRef) => void;
182
+ };
183
+ };
184
+ model: {
185
+ list: (ref?: LocationRef) => ModelInfo[] | undefined;
186
+ sync: (ref?: LocationRef) => Promise<void>;
187
+ invalidate: (ref?: LocationRef) => void;
188
+ };
189
+ provider: {
190
+ list: (ref?: LocationRef) => ProviderInfo[] | undefined;
191
+ sync: (ref?: LocationRef) => Promise<void>;
192
+ invalidate: (ref?: LocationRef) => void;
193
+ };
194
+ reference: {
195
+ list: (ref?: LocationRef) => ReferenceInfo[] | undefined;
196
+ sync: (ref?: LocationRef) => Promise<void>;
197
+ invalidate: (ref?: LocationRef) => void;
198
+ };
199
+ websearch: {
200
+ list(location?: LocationRef): WebSearchProvider[] | undefined;
201
+ refresh(ref?: LocationRef): Promise<void>;
202
+ };
203
+ skill: {
204
+ list: (ref?: LocationRef) => SkillInfo[] | undefined;
205
+ sync: (ref?: LocationRef) => Promise<void>;
206
+ invalidate: (ref?: LocationRef) => void;
207
+ };
208
+ };
209
+ };
210
+ export type Data = ReturnType<typeof createData>;
211
+ export {};
@@ -0,0 +1,18 @@
1
+ import {
2
+ settleMs2,
3
+ locationKey2,
4
+ createData2
5
+ } from "../chunks/service-probe-9vdz0zwn.js";
6
+ import"../chunks/service-probe-m2eywc8w.js";
7
+ import"../chunks/service-probe-wjyeq25y.js";
8
+ import"../chunks/service-probe-vyas3vgt.js";
9
+ import"../chunks/service-probe-ecs5ftka.js";
10
+ import"../chunks/service-probe-1y4a697q.js";
11
+ import"../chunks/service-probe-nwcpakzx.js";
12
+ import"../chunks/service-probe-vt9jbch8.js";
13
+ import"../chunks/service-probe-frbwqjmf.js";
14
+ export {
15
+ createData2 as createData,
16
+ locationKey2 as locationKey,
17
+ settleMs2 as settleMs
18
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./data";
2
+ export * from "./connection";
3
+ export * from "./pty";
@@ -0,0 +1,32 @@
1
+ import"../chunks/service-probe-nwcpakzx.js";
2
+ import"../chunks/service-probe-ecs5ftka.js";
3
+ import"../chunks/service-probe-vt9jbch8.js";
4
+ import"../chunks/service-probe-vyas3vgt.js";
5
+ import"../chunks/service-probe-frbwqjmf.js";
6
+ import"../chunks/service-probe-1y4a697q.js";
7
+ import"../chunks/service-probe-wjyeq25y.js";
8
+ import"../chunks/service-probe-m2eywc8w.js";
9
+ import {
10
+ settleMs2,
11
+ locationKey2,
12
+ createData2
13
+ } from "../chunks/service-probe-9vdz0zwn.js";
14
+ import {
15
+ defaultIdleTimeout2,
16
+ foregroundIdleThreshold2,
17
+ createClientConnection2
18
+ } from "../chunks/service-probe-ydhz1zrh.js";
19
+ import {
20
+ createPtyClient2,
21
+ createPersistentPtyClient2
22
+ } from "../chunks/service-probe-gne7h7mq.js";
23
+ export {
24
+ createClientConnection2 as createClientConnection,
25
+ createData2 as createData,
26
+ createPersistentPtyClient2 as createPersistentPtyClient,
27
+ createPtyClient2 as createPtyClient,
28
+ defaultIdleTimeout2 as defaultIdleTimeout,
29
+ foregroundIdleThreshold2 as foregroundIdleThreshold,
30
+ locationKey2 as locationKey,
31
+ settleMs2 as settleMs
32
+ };
@@ -0,0 +1,22 @@
1
+ import type { ExperimentalPersistentPtyConnectTokenInput, OpenCodeClient, PtyConnectTokenInput } from "../promise";
2
+ export type PtyClientOptions = {
3
+ readonly url: string;
4
+ readonly openSocket?: (url: URL) => WebSocket;
5
+ };
6
+ export type PtyConnectInput = {
7
+ readonly ptyID: PtyConnectTokenInput["ptyID"];
8
+ readonly location?: PtyConnectTokenInput["location"];
9
+ readonly cursor?: number;
10
+ };
11
+ export type PersistentPtyConnectInput = {
12
+ readonly ptyID: ExperimentalPersistentPtyConnectTokenInput["ptyID"];
13
+ readonly cursor: number;
14
+ readonly attachmentID: string;
15
+ readonly takeover?: boolean;
16
+ };
17
+ export declare function createPtyClient(api: OpenCodeClient, options: PtyClientOptions): {
18
+ connect(input: PtyConnectInput): Promise<WebSocket>;
19
+ };
20
+ export declare function createPersistentPtyClient(api: OpenCodeClient, options: PtyClientOptions): {
21
+ connect(input: PersistentPtyConnectInput): Promise<WebSocket>;
22
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ createPtyClient2,
3
+ createPersistentPtyClient2
4
+ } from "../chunks/service-probe-gne7h7mq.js";
5
+ export {
6
+ createPersistentPtyClient2 as createPersistentPtyClient,
7
+ createPtyClient2 as createPtyClient
8
+ };
@@ -0,0 +1,3 @@
1
+ export function define(plugin) {
2
+ return plugin;
3
+ }
@@ -19,7 +19,6 @@ import { allRunEngineBindings, locateRunRoot, readRunEngineBinding, runEngineBin
19
19
  export const engineManifestSchemaId = "dd-flow/engine-manifest@1";
20
20
  const routerNativeFamilies = new Set(["engine", "version", "schema"]);
21
21
  const sourceFile = fileURLToPath(import.meta.url);
22
- const packageRequire = createRequire(sourceFile);
23
22
  export function isEngineMode(env) {
24
23
  return env.DD_FLOW_ENGINE_MODE === "1";
25
24
  }
@@ -716,7 +715,7 @@ function copyPackageSnapshot(packageRoot, target) {
716
715
  }
717
716
  }
718
717
  /** The same source inventory drives validation and copying; no staging writes. */
719
- function packageSnapshotFiles(packageRoot) {
718
+ export function packageSnapshotFiles(packageRoot) {
720
719
  const files = new Map();
721
720
  const collect = (source, relative, skipNodeModules = false) => {
722
721
  if (!fs.statSync(source).isDirectory()) {
@@ -739,8 +738,9 @@ function packageSnapshotFiles(packageRoot) {
739
738
  continue;
740
739
  collect(from, item);
741
740
  }
742
- const queue = [{ sourceRoot: packageRoot, targetRoot: "", ancestors: new Set() }];
743
- const copied = new Set();
741
+ const queue = [{ sourceRoot: packageRoot, targetRoot: "" }];
742
+ const placed = new Map();
743
+ const virtualRoot = path.resolve(path.sep, "dd-flow-snapshot");
744
744
  while (queue.length > 0) {
745
745
  const current = queue.shift();
746
746
  if (!current)
@@ -749,15 +749,19 @@ function packageSnapshotFiles(packageRoot) {
749
749
  const sourceRoot = resolvePackageRoot(dependency, current.sourceRoot);
750
750
  if (!sourceRoot)
751
751
  throw new AppError("engine_install_failed", `Cannot resolve runtime dependency: ${dependency}`, 1);
752
- const targetRoot = path.join(current.targetRoot, "node_modules", dependency);
753
- const copyKey = `${sourceRoot}\n${targetRoot}`;
754
- if (copied.has(copyKey))
752
+ // Standard Node lookup permits hoisting identical selected packages.
753
+ // Copying a shared DAG under every parent makes SDK snapshots grow
754
+ // exponentially; conflicting versions still need their own local slot.
755
+ const search = createRequire(path.join(virtualRoot, current.targetRoot, "package.json")).resolve.paths(dependency) ?? [];
756
+ const candidates = search.filter(directory => directory.startsWith(`${virtualRoot}${path.sep}`))
757
+ .map(directory => path.relative(virtualRoot, path.join(directory, dependency)));
758
+ const existing = candidates.find(candidate => placed.has(candidate));
759
+ if (existing && placed.get(existing) === sourceRoot)
755
760
  continue;
756
- copied.add(copyKey);
761
+ const targetRoot = existing ? path.join(current.targetRoot, "node_modules", dependency) : path.join("node_modules", dependency);
762
+ placed.set(targetRoot, sourceRoot);
757
763
  collect(sourceRoot, targetRoot, true);
758
- if (current.ancestors.has(sourceRoot))
759
- continue;
760
- queue.push({ sourceRoot, targetRoot, ancestors: new Set([...current.ancestors, sourceRoot]) });
764
+ queue.push({ sourceRoot, targetRoot });
761
765
  }
762
766
  }
763
767
  return files;
@@ -806,20 +810,14 @@ function readProductionDependencies(packageRoot) {
806
810
  }
807
811
  }
808
812
  function resolvePackageRoot(name, from) {
809
- try {
810
- let current = path.dirname(packageRequire.resolve(name, { paths: [from] }));
811
- while (true) {
812
- if (fs.existsSync(path.join(current, "package.json")))
813
- return fs.realpathSync(current);
814
- const parent = path.dirname(current);
815
- if (parent === current)
816
- return null;
817
- current = parent;
818
- }
819
- }
820
- catch {
821
- return null;
813
+ // Inspect package roots through Node's lookup paths, not the require entry:
814
+ // production dependencies can expose only an ESM import condition.
815
+ for (const directory of createRequire(path.join(from, "package.json")).resolve.paths(name) ?? []) {
816
+ const candidate = path.join(directory, name);
817
+ if (fs.existsSync(path.join(candidate, "package.json")))
818
+ return fs.realpathSync(candidate);
822
819
  }
820
+ return null;
823
821
  }
824
822
  function inferInstallSource(packageRoot, ddFlowHome) {
825
823
  const normalized = path.resolve(packageRoot);
@@ -998,7 +998,7 @@ function nativeDaemonFile(file) {
998
998
  return false;
999
999
  try {
1000
1000
  const state = JSON.parse(fs.readFileSync(file, "utf8"));
1001
- return typeof state.daemon_id === "string" && /^dd-(codex|zcode|grok|agy|opencode|droid)\/daemon-state@1$/.test(String(state.schema_id));
1001
+ return typeof state.daemon_id === "string" && (/^dd-(codex|zcode|grok|agy|opencode|droid)\/daemon-state@1$/.test(String(state.schema_id)) || state.schema_id === "dd-opencode/daemon-state@2");
1002
1002
  }
1003
1003
  catch {
1004
1004
  return false;
@@ -123,7 +123,7 @@ export async function launchExternalWork(context, input) {
123
123
  prompted = await call(["session", "prompt", "--session-id", sessionId, "--prompt-file", promptFile, ...common], null);
124
124
  }
125
125
  catch (error) {
126
- if (runtimeHarness(resolved.worker) !== "codex-desktop")
126
+ if (!["codex-desktop", "opencode-server"].includes(runtimeHarness(resolved.worker)))
127
127
  throw error;
128
128
  const retained = context.db.get("SELECT adapter_receipt_json FROM work_launches WHERE operation_id = ?", [operationId]);
129
129
  const capacityIntents = retained?.adapter_receipt_json ? JSON.parse(retained.adapter_receipt_json).capacity_intents ?? [] : [];
@@ -843,7 +843,7 @@ function handleControlledToolEvent(context, input, event, harness) {
843
843
  });
844
844
  return { ok: true, observed: inserted, duplicate: !inserted, event_key: baseKey, phase, harness, session: nativeSessionIdentity(harness, providerSessionId), ...(nativeParentId ? { parent_session: nativeSessionIdentity(harness, nativeParentId) } : {}) };
845
845
  }
846
- if (!command || !(droid ? ["Execute"] : ["bash", "Bash", "run_command", "run_terminal_command", "RunTerminalCommand"]).includes(toolName)) {
846
+ if (!command || !(droid ? ["Execute"] : ["bash", "Bash", "shell", "run_command", "run_terminal_command", "RunTerminalCommand"]).includes(toolName)) {
847
847
  return { ok: true, observed: false, reason: command ? "non_bash_tool" : "event_not_participating" };
848
848
  }
849
849
  const lifecycle = lifecycleFacts(command);
@@ -164,7 +164,7 @@ async function dispatch(context, input) {
164
164
  prompted = await adapterCall(["session", "prompt", "--session-id", sessionId, "--prompt-file", promptFile, ...common], null, `MERGE ${input.request.merge_request_id} Session ${sessionId} is still running`);
165
165
  }
166
166
  catch (error) {
167
- if (runtimeHarness(input.profile) !== "codex-desktop")
167
+ if (!["codex-desktop", "opencode-server"].includes(runtimeHarness(input.profile)))
168
168
  throw error;
169
169
  const capacityIntents = (retained.capacity_intents ?? []);
170
170
  const capacityFailures = (retained.capacity_failures ?? []);
@@ -211,10 +211,10 @@ export async function resumeControllerSession(context, row, manifest, state, ass
211
211
  receipt = await sendAck(dispatch.operation_id, dispatch.prompt);
212
212
  }
213
213
  catch (error) {
214
- if (runtimeHarness(session.profile) !== "codex-desktop")
214
+ if (!["codex-desktop", "opencode-server"].includes(runtimeHarness(session.profile)))
215
215
  throw error;
216
216
  const continuationText = `Continue the same retained Session and recovery generation. First inspect the current RUN recovery state; only if the exact ACK still awaits acceptance, execute the exact standalone acceptance command below once. Never deliver it again after acceptance. Then stop at the original Stage or Work-graph boundary.\n\n${dispatch.prompt}`;
217
- const inspect = (args, operationId) => runHarnessAdapter({ executable: manifest.adapters["codex-desktop"].executable,
217
+ const inspect = (args, operationId) => runHarnessAdapter({ executable: manifest.adapters[runtimeHarness(session.profile)].executable,
218
218
  args, env: controllerEnvironment(executionContext, manifest, session), runtimeOwner: session.owner, operationId, timeoutMs: 30_000 });
219
219
  const resumed = await continueCodexCapacity({ error, sessionId: session.id, operationId: dispatch.operation_id, allowSettledDescendants: true, continuationText,
220
220
  retainedIntents: () => {
@@ -578,12 +578,12 @@ async function executeController(context, row, manifest, state, assertOwnership,
578
578
  receipt = await send(text, firstOperationId);
579
579
  }
580
580
  catch (error) {
581
- if (runtimeHarness(session.profile) !== "codex-desktop")
581
+ if (!["codex-desktop", "opencode-server"].includes(runtimeHarness(session.profile)))
582
582
  throw error;
583
583
  const resumeCommand = hitl ? text.split("\n\n")[1] : undefined;
584
584
  if (hitl && !resumeCommand?.includes(" stage resume "))
585
585
  throw error;
586
- const inspect = (args, id) => runHarnessAdapter({ executable: manifest.adapters["codex-desktop"].executable,
586
+ const inspect = (args, id) => runHarnessAdapter({ executable: manifest.adapters[runtimeHarness(session.profile)].executable,
587
587
  args, env: controllerEnvironment(context, manifest, session), runtimeOwner: session.owner, operationId: id, timeoutMs: 30_000, signal: cancellation.signal });
588
588
  const resumed = await continueCodexCapacity({ error, sessionId: session.id, operationId: firstOperationId, signal: cancellation.signal, allowSettledDescendants: true, atomicIntent: true,
589
589
  retainedIntents: () => context.db.all("SELECT receipt_json FROM run_controller_operations WHERE controller_id = ? AND generation = ?", [row.controller_id, row.generation])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deksden-com/dd-flow-cli",
3
- "version": "0.9.0-beta.134",
3
+ "version": "0.9.0-beta.135",
4
4
  "description": "Mechanical runtime CLI for dd-flow workflows.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.23.0",
@@ -41,6 +41,8 @@
41
41
  "release:publish": "node scripts/publish-release.mjs"
42
42
  },
43
43
  "devDependencies": {
44
+ "@opencode/client": "2.0.28",
45
+ "@opencode/plugin": "2.0.28",
44
46
  "@changesets/cli": "^2.31.0",
45
47
  "@eslint/js": "^9.39.1",
46
48
  "@types/node": "^24.10.1",
@@ -51,6 +53,7 @@
51
53
  },
52
54
  "dependencies": {
53
55
  "ajv": "^8.20.0",
56
+ "jsonc-parser": "3.3.1",
54
57
  "shell-quote": "^1.10.0",
55
58
  "smol-toml": "^1.6.1",
56
59
  "tree-sitter": "0.25.1",