@deksden-com/dd-flow-cli 0.9.0-beta.134 → 0.9.0-beta.136
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/CHANGELOG.md +12 -0
- package/README.md +33 -0
- package/dist/build-info.json +7 -7
- package/dist/cli/command-inputs.js +1 -0
- package/dist/cli/command-metadata.js +144 -0
- package/dist/cli/command-option-descriptions.js +186 -0
- package/dist/cli/completion-cli.js +70 -0
- package/dist/cli/completion.js +57 -0
- package/dist/cli/error-output.js +52 -0
- package/dist/cli/executor-onboarding.js +71 -0
- package/dist/cli/harnesses.js +84 -0
- package/dist/cli/models.js +39 -0
- package/dist/cli/operator-profiles.js +61 -0
- package/dist/cli/output-options.js +35 -0
- package/dist/cli/response-file.js +69 -0
- package/dist/cli/run-cli.js +5 -0
- package/dist/cli/setup.js +147 -0
- package/dist/harness-runtime/OPENCODE-LICENSE.txt +24 -0
- package/dist/harness-runtime/bin/dd-opencode.mjs +1 -1
- package/dist/harness-runtime/lib/codex-capacity-policy.mjs +13 -0
- package/dist/harness-runtime/lib/dd-opencode-daemon.mjs +193 -39
- package/dist/harness-runtime/lib/dd-opencode.mjs +295 -100
- package/dist/harness-runtime/lib/delegation-instructions.mjs +3 -3
- package/dist/harness-runtime/lib/managed-daemon.mjs +1 -1
- package/dist/harness-runtime/lib/native-hook-command.d.mts +2 -2
- package/dist/harness-runtime/lib/native-hook-command.mjs +4 -4
- package/dist/harness-runtime/lib/opencode-plugin.mjs +60 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-1y4a697q.js +81 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-2ny4vxct.js +92 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-6mptkzbc.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-7x67cf1q.js +52 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-9rqn6x4v.js +16 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-9vdz0zwn.js +1661 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ecs5ftka.js +1466 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-frbwqjmf.js +145 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-gne7h7mq.js +50 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-gx9wnkzr.js +105 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-m2eywc8w.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-nwcpakzx.js +12 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-q4g3afnw.js +623 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-qav6mfdz.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-sxt88q69.js +12 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-t1xa31vm.js +39 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ve4aws36.js +103 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vmytr4q8.js +4 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vt9jbch8.js +36 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-vyas3vgt.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-wjyeq25y.js +30 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-xgnj2w4v.js +20 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-y2etg5bs.js +9 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-ydhz1zrh.js +238 -0
- package/dist/harness-runtime/vendor/opencode-client/chunks/service-probe-z6qdwcsf.js +62 -0
- package/dist/harness-runtime/vendor/opencode-client/contract.d.ts +1 -0
- package/dist/harness-runtime/vendor/opencode-client/contract.js +12 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/api/api.d.ts +2806 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/api/api.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/api.d.ts +4 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/api.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/client.d.ts +2530 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/client.js +15 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/client-error.d.ts +7 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/client-error.js +6 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/client.d.ts +2529 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/client.js +8 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/index.d.ts +2 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/generated/index.js +12 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/index.d.ts +35 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/index.js +75 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/rpc.d.ts +20 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/rpc.js +11 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/service.d.ts +90 -0
- package/dist/harness-runtime/vendor/opencode-client/effect/service.js +187 -0
- package/dist/harness-runtime/vendor/opencode-client/package.json +84 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/api.d.ts +21 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/api.js +0 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/client.d.ts +252 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/client.js +14 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/client-error.d.ts +8 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/client-error.js +6 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/client.d.ts +259 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/client.js +7 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/index.d.ts +3 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/index.js +79 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/types.d.ts +8932 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/generated/types.js +70 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/index.d.ts +6 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/index.js +83 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/rpc.d.ts +32 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/rpc.js +7 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/service.d.ts +24 -0
- package/dist/harness-runtime/vendor/opencode-client/promise/service.js +187 -0
- package/dist/harness-runtime/vendor/opencode-client/pty-handoff.d.ts +12 -0
- package/dist/harness-runtime/vendor/opencode-client/pty-handoff.js +14 -0
- package/dist/harness-runtime/vendor/opencode-client/rpc-runtime.d.ts +20 -0
- package/dist/harness-runtime/vendor/opencode-client/rpc-runtime.js +14 -0
- package/dist/harness-runtime/vendor/opencode-client/service-contender.d.ts +37 -0
- package/dist/harness-runtime/vendor/opencode-client/service-contender.js +10 -0
- package/dist/harness-runtime/vendor/opencode-client/service-probe.d.ts +70 -0
- package/dist/harness-runtime/vendor/opencode-client/service-probe.js +16 -0
- package/dist/harness-runtime/vendor/opencode-client/service-timing.d.ts +12 -0
- package/dist/harness-runtime/vendor/opencode-client/service-timing.js +10 -0
- package/dist/harness-runtime/vendor/opencode-client/service-version.d.ts +2 -0
- package/dist/harness-runtime/vendor/opencode-client/service-version.js +6 -0
- package/dist/harness-runtime/vendor/opencode-client/service.d.ts +52 -0
- package/dist/harness-runtime/vendor/opencode-client/service.js +1 -0
- package/dist/harness-runtime/vendor/opencode-client/shared-events.d.ts +11 -0
- package/dist/harness-runtime/vendor/opencode-client/shared-events.js +8 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/connection.d.ts +37 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/connection.js +10 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/data.d.ts +211 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/data.js +18 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/index.d.ts +3 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/index.js +32 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/pty.d.ts +22 -0
- package/dist/harness-runtime/vendor/opencode-client/solid/pty.js +8 -0
- package/dist/harness-runtime/vendor/opencode-plugin.mjs +3 -0
- package/dist/services/cli-operation-classifier.js +4 -0
- package/dist/services/cli-upgrade-allowlist.js +27 -0
- package/dist/services/discovery/agy-discovery.js +2 -0
- package/dist/services/discovery/codex-discovery.js +2 -0
- package/dist/services/discovery/droid-discovery.js +2 -0
- package/dist/services/discovery/grok-discovery.js +2 -0
- package/dist/services/discovery/opencode-discovery.js +2 -0
- package/dist/services/discovery/static.js +31 -0
- package/dist/services/discovery/zcode-discovery.js +2 -0
- package/dist/services/engines.js +23 -25
- package/dist/services/eval-snapshots.js +1 -1
- package/dist/services/executor-onboarding.js +56 -0
- package/dist/services/external-work-launch.js +1 -1
- package/dist/services/harness-discovery.js +29 -0
- package/dist/services/harness-doctor.js +75 -0
- package/dist/services/harness-probe-effects.js +51 -0
- package/dist/services/harness-version-probe.js +100 -0
- package/dist/services/hooks.js +1 -1
- package/dist/services/hybrid-contracts.js +455 -0
- package/dist/services/installation-lock.js +92 -0
- package/dist/services/managed-processes.js +30 -0
- package/dist/services/merge-server.js +1 -1
- package/dist/services/model-catalog.js +109 -0
- package/dist/services/model-discovery.js +46 -0
- package/dist/services/operator-profiles.js +236 -0
- package/dist/services/release-archive-producer.js +52 -0
- package/dist/services/release-archive.js +143 -0
- package/dist/services/release-cache.js +142 -0
- package/dist/services/release-compatibility.js +18 -0
- package/dist/services/release-download.js +67 -0
- package/dist/services/release-envelope.js +104 -0
- package/dist/services/release-manifest.js +45 -0
- package/dist/services/release-payload.js +114 -0
- package/dist/services/release-producer.js +63 -0
- package/dist/services/release-provenance.js +160 -0
- package/dist/services/release-registry.js +66 -0
- package/dist/services/release-source.js +194 -0
- package/dist/services/run-controller-recovery.js +2 -2
- package/dist/services/run-controller.js +3 -2
- package/dist/services/run-health.js +149 -0
- package/dist/services/runs.js +61 -13
- package/dist/services/setup.js +377 -0
- package/dist/storage/database.js +18 -3
- package/dist/storage/writer-contract.js +8 -0
- package/package.json +4 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./service-probe-9rqn6x4v.js";
|
|
4
|
+
|
|
5
|
+
// src/rpc-runtime.ts
|
|
6
|
+
var exports_rpc_runtime = {};
|
|
7
|
+
__export(exports_rpc_runtime, {
|
|
8
|
+
RpcRuntime: () => exports_rpc_runtime,
|
|
9
|
+
event: () => event2,
|
|
10
|
+
eventType: () => eventType2,
|
|
11
|
+
read: () => read2,
|
|
12
|
+
readError: () => readError2
|
|
13
|
+
});
|
|
14
|
+
import { RpcError, RpcInternalError } from "@opencode/protocol/errors";
|
|
15
|
+
import { Effect, Schema } from "effect";
|
|
16
|
+
function read2(schema, value) {
|
|
17
|
+
return Schema.isSchema(schema) ? Schema.decodeUnknownEffect(schema)(value) : Effect.succeed(value);
|
|
18
|
+
}
|
|
19
|
+
function readError2(method, error) {
|
|
20
|
+
if (!(error instanceof RpcError) && !(error instanceof RpcInternalError))
|
|
21
|
+
return Effect.fail(error);
|
|
22
|
+
if (!method.errors || !Object.hasOwn(method.errors, error.type)) {
|
|
23
|
+
return Effect.fail(error.data === undefined ? { type: error.type, message: error.message } : { type: error.type, message: error.message, data: error.data });
|
|
24
|
+
}
|
|
25
|
+
return read2(method.errors[error.type], error.data).pipe(Effect.catch((cause) => Effect.die(cause)), Effect.flatMap((data) => Effect.fail(data === undefined ? { type: error.type, message: error.message } : { type: error.type, message: error.message, data })));
|
|
26
|
+
}
|
|
27
|
+
var event2 = Effect.fn("Client.Rpc.event")(function* (definition, name, schema, event) {
|
|
28
|
+
const data = yield* read2(schema.schema, event.data);
|
|
29
|
+
return {
|
|
30
|
+
...event,
|
|
31
|
+
type: eventType2(definition, name),
|
|
32
|
+
data
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
function eventType2(definition, name) {
|
|
36
|
+
return `rpc.${definition.id}.${name}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { read2, readError2, event2, eventType2, exports_rpc_runtime };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/service-contender.ts
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
var stderrLimit = 8 * 1024;
|
|
4
|
+
function spawnServiceContender2(command, args, env) {
|
|
5
|
+
const child = spawn(command, args, {
|
|
6
|
+
detached: true,
|
|
7
|
+
windowsHide: true,
|
|
8
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
9
|
+
env: { ...process.env, ...env }
|
|
10
|
+
});
|
|
11
|
+
let error;
|
|
12
|
+
let closed = false;
|
|
13
|
+
let stderr = Buffer.alloc(0);
|
|
14
|
+
const onStderr = (chunk) => {
|
|
15
|
+
const tail = chunk.subarray(-stderrLimit);
|
|
16
|
+
stderr = tail.length === stderrLimit ? Buffer.from(tail) : Buffer.concat([stderr.subarray(-(stderrLimit - tail.length)), tail]);
|
|
17
|
+
};
|
|
18
|
+
child.stderr?.on("data", onStderr);
|
|
19
|
+
if (child.stderr !== null && "unref" in child.stderr && typeof child.stderr.unref === "function")
|
|
20
|
+
child.stderr.unref();
|
|
21
|
+
child.once("error", (cause) => {
|
|
22
|
+
error = new Error("Failed to start server", { cause });
|
|
23
|
+
});
|
|
24
|
+
child.once("close", () => {
|
|
25
|
+
closed = true;
|
|
26
|
+
});
|
|
27
|
+
child.unref();
|
|
28
|
+
return {
|
|
29
|
+
child,
|
|
30
|
+
error: () => error,
|
|
31
|
+
closed: () => closed,
|
|
32
|
+
stderr: () => stderr.toString("utf8").trim(),
|
|
33
|
+
release: () => {
|
|
34
|
+
child.stderr?.off("data", onStderr);
|
|
35
|
+
child.stderr?.resume();
|
|
36
|
+
stderr = Buffer.alloc(0);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function contenderPool2(timing) {
|
|
41
|
+
const contenders = new Set;
|
|
42
|
+
let failure;
|
|
43
|
+
let spawnDelay = timing.spawnDelay;
|
|
44
|
+
let lastSpawn = 0;
|
|
45
|
+
return {
|
|
46
|
+
failure: () => failure,
|
|
47
|
+
serviceAnswered() {
|
|
48
|
+
spawnDelay = timing.spawnDelay;
|
|
49
|
+
},
|
|
50
|
+
evict(pid) {
|
|
51
|
+
for (const item of contenders) {
|
|
52
|
+
if (item.child.pid === pid || contenderFinished2(item)) {
|
|
53
|
+
item.release();
|
|
54
|
+
contenders.delete(item);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
failure = undefined;
|
|
58
|
+
lastSpawn = 0;
|
|
59
|
+
},
|
|
60
|
+
recruitNow() {
|
|
61
|
+
lastSpawn = Date.now() - spawnDelay;
|
|
62
|
+
},
|
|
63
|
+
reap() {
|
|
64
|
+
const finished = [...contenders].filter(contenderFinished2);
|
|
65
|
+
failure ??= finished.map(contenderFailure).find((error) => error !== undefined);
|
|
66
|
+
if (finished.some((item) => item.child.exitCode === 0))
|
|
67
|
+
spawnDelay = Math.min(spawnDelay * 2, timing.maxSpawnDelay);
|
|
68
|
+
finished.forEach((item) => contenders.delete(item));
|
|
69
|
+
return contenders.size === 0 ? failure : undefined;
|
|
70
|
+
},
|
|
71
|
+
shouldRecruit(registered) {
|
|
72
|
+
if (lastSpawn === 0 && registered)
|
|
73
|
+
lastSpawn = Date.now();
|
|
74
|
+
return failure === undefined && contenders.size < 2 && Date.now() - lastSpawn >= spawnDelay;
|
|
75
|
+
},
|
|
76
|
+
add(contender) {
|
|
77
|
+
contenders.add(contender);
|
|
78
|
+
lastSpawn = Date.now();
|
|
79
|
+
},
|
|
80
|
+
releaseAll() {
|
|
81
|
+
contenders.forEach((contender) => contender.release());
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function contenderFailure(contender) {
|
|
86
|
+
const error = contender.error();
|
|
87
|
+
if (error !== undefined)
|
|
88
|
+
return error;
|
|
89
|
+
if (contender.child.exitCode !== null && contender.child.exitCode !== 0)
|
|
90
|
+
return startupError(`Server process exited with code ${contender.child.exitCode}`, contender.stderr());
|
|
91
|
+
if (contender.child.signalCode !== null)
|
|
92
|
+
return startupError(`Server process terminated by ${contender.child.signalCode}`, contender.stderr());
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
function contenderFinished2(contender) {
|
|
96
|
+
return contender.error() !== undefined || contender.closed();
|
|
97
|
+
}
|
|
98
|
+
function startupError(message, stderr) {
|
|
99
|
+
return new Error(stderr ? `${message}
|
|
100
|
+
${stderr}` : message);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { spawnServiceContender2, contenderPool2, contenderFinished2 };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// src/contract.ts
|
|
2
|
+
import { ClientApi as ClientApi2, effectOmitEndpoints as effectOmitEndpoints2, groupNames as groupNames2, promiseOmitEndpoints as promiseOmitEndpoints2 } from "@opencode/protocol/client";
|
|
3
|
+
|
|
4
|
+
export { ClientApi2, effectOmitEndpoints2, groupNames2, promiseOmitEndpoints2 };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// src/promise/generated/types.ts
|
|
2
|
+
var isInvalidRequestError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InvalidRequestError";
|
|
3
|
+
var isUnauthorizedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnauthorizedError";
|
|
4
|
+
var isLocationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "LocationNotFoundError";
|
|
5
|
+
var isServiceUnavailableError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ServiceUnavailableError";
|
|
6
|
+
var isAgentNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "AgentNotFoundError";
|
|
7
|
+
var isInvalidCursorError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InvalidCursorError";
|
|
8
|
+
var isSessionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionNotFoundError";
|
|
9
|
+
var isConflictError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ConflictError";
|
|
10
|
+
var isUnknownError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnknownError";
|
|
11
|
+
var isMessageNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "MessageNotFoundError";
|
|
12
|
+
var isCommandNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandNotFoundError";
|
|
13
|
+
var isCommandExecutionError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandExecutionError";
|
|
14
|
+
var isSkillNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SkillNotFoundError";
|
|
15
|
+
var isSessionBusyError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionBusyError";
|
|
16
|
+
var isInstructionEntryValueTooLargeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InstructionEntryValueTooLargeError";
|
|
17
|
+
var isFormNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormNotFoundError";
|
|
18
|
+
var isFormInvalidAnswerError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormInvalidAnswerError";
|
|
19
|
+
var isFormAlreadySettledError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormAlreadySettledError";
|
|
20
|
+
var isProviderNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProviderNotFoundError";
|
|
21
|
+
var isIntegrationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationNotFoundError";
|
|
22
|
+
var isIntegrationAttemptNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationAttemptNotFoundError";
|
|
23
|
+
var isIntegrationMethodNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationMethodNotFoundError";
|
|
24
|
+
var isMcpServerNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "McpServerNotFoundError";
|
|
25
|
+
var isProjectNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProjectNotFoundError";
|
|
26
|
+
var isPermissionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PermissionNotFoundError";
|
|
27
|
+
var isFileNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FileNotFoundError";
|
|
28
|
+
var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
|
|
29
|
+
var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
|
|
30
|
+
var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
|
|
31
|
+
var isForbiddenError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ForbiddenError";
|
|
32
|
+
var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
|
|
33
|
+
var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "WorktreeError";
|
|
34
|
+
var isVcsInitNotSupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VcsInitNotSupportedError";
|
|
35
|
+
|
|
36
|
+
export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isConflictError2, isUnknownError2, isMessageNotFoundError2, isCommandNotFoundError2, isCommandExecutionError2, isSkillNotFoundError2, isSessionBusyError2, isInstructionEntryValueTooLargeError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isProviderNotFoundError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isProjectNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isForbiddenError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
make7
|
|
3
|
+
} from "./service-probe-frbwqjmf.js";
|
|
4
|
+
import {
|
|
5
|
+
make6
|
|
6
|
+
} from "./service-probe-ecs5ftka.js";
|
|
7
|
+
import {
|
|
8
|
+
makeRpc2
|
|
9
|
+
} from "./service-probe-1y4a697q.js";
|
|
10
|
+
import {
|
|
11
|
+
__export
|
|
12
|
+
} from "./service-probe-9rqn6x4v.js";
|
|
13
|
+
|
|
14
|
+
// src/promise/client.ts
|
|
15
|
+
var exports_client3 = {};
|
|
16
|
+
__export(exports_client3, {
|
|
17
|
+
OpenCode: () => exports_client3,
|
|
18
|
+
make: () => make5
|
|
19
|
+
});
|
|
20
|
+
function make5(options) {
|
|
21
|
+
const raw = make6(options);
|
|
22
|
+
const events = make7((signal, onActivity) => raw.event.subscribe({ signal, onActivity }));
|
|
23
|
+
return {
|
|
24
|
+
...raw,
|
|
25
|
+
rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
|
|
26
|
+
event: events
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { make5, exports_client3 };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/service-timing.ts
|
|
2
|
+
var timings = new WeakMap;
|
|
3
|
+
var defaultEnsureTiming2 = {
|
|
4
|
+
pollInterval: 25,
|
|
5
|
+
requestTimeout: 2000,
|
|
6
|
+
spawnDelay: 5000,
|
|
7
|
+
maxSpawnDelay: 30000,
|
|
8
|
+
promiseTimeout: 120000,
|
|
9
|
+
stopPollInterval: 50,
|
|
10
|
+
stopPollAttempts: 100
|
|
11
|
+
};
|
|
12
|
+
function ensureTiming2(options) {
|
|
13
|
+
return timings.get(options) ?? defaultEnsureTiming2;
|
|
14
|
+
}
|
|
15
|
+
function withEnsureTiming2(options, overrides) {
|
|
16
|
+
timings.set(options, { ...defaultEnsureTiming2, ...overrides });
|
|
17
|
+
return options;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { defaultEnsureTiming2, ensureTiming2, withEnsureTiming2 };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// src/solid/connection.ts
|
|
2
|
+
import { batch, onCleanup } from "solid-js";
|
|
3
|
+
import { createStore } from "solid-js/store";
|
|
4
|
+
var connectTimeout = 2000;
|
|
5
|
+
var reconnectDelay = 1000;
|
|
6
|
+
var connectionHistoryLimit = 50;
|
|
7
|
+
var defaultIdleTimeout2 = 45000;
|
|
8
|
+
var foregroundIdleThreshold2 = 20000;
|
|
9
|
+
function createClientConnection2(initialApi, options) {
|
|
10
|
+
const abort = new AbortController;
|
|
11
|
+
const history = [];
|
|
12
|
+
const idleTimeout = options.idleTimeout ?? defaultIdleTimeout2;
|
|
13
|
+
const [connection, setConnection] = createStore({ status: "connecting", attempt: 0 });
|
|
14
|
+
let api = initialApi;
|
|
15
|
+
let pending = [];
|
|
16
|
+
let flushTimer;
|
|
17
|
+
let stream;
|
|
18
|
+
let current;
|
|
19
|
+
let run;
|
|
20
|
+
let started = false;
|
|
21
|
+
let generation = 0;
|
|
22
|
+
let lastActivity = 0;
|
|
23
|
+
let forced = false;
|
|
24
|
+
function record(status, attempt, error) {
|
|
25
|
+
history.push({ type: "client.connection", created: Date.now(), data: { status, attempt, error } });
|
|
26
|
+
if (history.length > connectionHistoryLimit)
|
|
27
|
+
history.shift();
|
|
28
|
+
}
|
|
29
|
+
function publish(event) {
|
|
30
|
+
pending.push(event);
|
|
31
|
+
if (flushTimer)
|
|
32
|
+
return;
|
|
33
|
+
flushTimer = setTimeout(() => {
|
|
34
|
+
flushTimer = undefined;
|
|
35
|
+
const events = pending;
|
|
36
|
+
pending = [];
|
|
37
|
+
batch(() => events.forEach(options.onEvent));
|
|
38
|
+
}, options.flushInterval ?? 10);
|
|
39
|
+
}
|
|
40
|
+
async function connect(signal, attempt) {
|
|
41
|
+
let connectedAt;
|
|
42
|
+
const request = new AbortController;
|
|
43
|
+
current = request;
|
|
44
|
+
const cancel = () => request.abort(signal.reason);
|
|
45
|
+
const timeout = setTimeout(() => request.abort(new Error("Timed out connecting to server")), connectTimeout);
|
|
46
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
47
|
+
let watchdog;
|
|
48
|
+
const touch = () => {
|
|
49
|
+
lastActivity = Date.now();
|
|
50
|
+
if (connectedAt === undefined)
|
|
51
|
+
return;
|
|
52
|
+
clearTimeout(watchdog);
|
|
53
|
+
watchdog = setTimeout(() => request.abort(new Error("Event stream stalled")), idleTimeout);
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
record(attempt === 0 ? "connecting" : "reconnecting", attempt);
|
|
57
|
+
options.log?.info?.("event stream connecting", { attempt });
|
|
58
|
+
const iterator = api.event.subscribe({ signal: request.signal, onActivity: touch })[Symbol.asyncIterator]();
|
|
59
|
+
const first = await iterator.next();
|
|
60
|
+
if (signal.aborted)
|
|
61
|
+
return { error: undefined, connectedAt };
|
|
62
|
+
if (first.done)
|
|
63
|
+
return {
|
|
64
|
+
error: request.signal.reason instanceof Error ? request.signal.reason : new Error("Event stream disconnected"),
|
|
65
|
+
connectedAt
|
|
66
|
+
};
|
|
67
|
+
if (first.value.type !== "server.connected")
|
|
68
|
+
return { error: new Error("Event stream did not start with server.connected"), connectedAt };
|
|
69
|
+
clearTimeout(timeout);
|
|
70
|
+
record("connected", attempt);
|
|
71
|
+
connectedAt = Date.now();
|
|
72
|
+
touch();
|
|
73
|
+
options.log?.info?.("event stream connected");
|
|
74
|
+
publish(first.value);
|
|
75
|
+
setConnection({ status: "connected", attempt: 0, error: undefined });
|
|
76
|
+
while (!signal.aborted) {
|
|
77
|
+
const event = await iterator.next();
|
|
78
|
+
if (signal.aborted)
|
|
79
|
+
return { error: undefined, connectedAt };
|
|
80
|
+
if (event.done)
|
|
81
|
+
return {
|
|
82
|
+
error: request.signal.reason instanceof Error ? request.signal.reason : new Error("Event stream disconnected"),
|
|
83
|
+
connectedAt
|
|
84
|
+
};
|
|
85
|
+
touch();
|
|
86
|
+
if ("durable" in event.value && event.value.durable)
|
|
87
|
+
options.log?.debug?.("event", {
|
|
88
|
+
type: event.value.type,
|
|
89
|
+
aggregateID: event.value.durable.aggregateID,
|
|
90
|
+
seq: event.value.durable.seq
|
|
91
|
+
});
|
|
92
|
+
publish(event.value);
|
|
93
|
+
}
|
|
94
|
+
return { error: undefined, connectedAt };
|
|
95
|
+
} catch (error) {
|
|
96
|
+
return { error, connectedAt };
|
|
97
|
+
} finally {
|
|
98
|
+
request.abort();
|
|
99
|
+
if (current === request)
|
|
100
|
+
current = undefined;
|
|
101
|
+
clearTimeout(timeout);
|
|
102
|
+
clearTimeout(watchdog);
|
|
103
|
+
signal.removeEventListener("abort", cancel);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function runStream(active) {
|
|
107
|
+
let attempt = 0;
|
|
108
|
+
while (!abort.signal.aborted && started && generation === active) {
|
|
109
|
+
setConnection({ status: attempt === 0 ? "connecting" : "reconnecting", attempt });
|
|
110
|
+
const controller = new AbortController;
|
|
111
|
+
stream = controller;
|
|
112
|
+
const cancel = () => controller.abort(abort.signal.reason);
|
|
113
|
+
abort.signal.addEventListener("abort", cancel);
|
|
114
|
+
const result = await connect(controller.signal, attempt);
|
|
115
|
+
abort.signal.removeEventListener("abort", cancel);
|
|
116
|
+
if (abort.signal.aborted || !started || generation !== active)
|
|
117
|
+
return;
|
|
118
|
+
if (result.connectedAt !== undefined && Date.now() - result.connectedAt >= reconnectDelay)
|
|
119
|
+
attempt = 0;
|
|
120
|
+
attempt += 1;
|
|
121
|
+
const message = errorMessage(result.error);
|
|
122
|
+
record("disconnected", attempt, message);
|
|
123
|
+
options.log?.info?.("event stream disconnected", { attempt, error: message });
|
|
124
|
+
setConnection({ status: "reconnecting", attempt, error: message });
|
|
125
|
+
if (options.reconnect) {
|
|
126
|
+
const next = await options.reconnect(controller.signal).catch((error) => {
|
|
127
|
+
if (!controller.signal.aborted)
|
|
128
|
+
options.log?.info?.("server resolution failed", { attempt, error: errorMessage(error) });
|
|
129
|
+
});
|
|
130
|
+
if (abort.signal.aborted || controller.signal.aborted || !started || generation !== active)
|
|
131
|
+
return;
|
|
132
|
+
if (next) {
|
|
133
|
+
api = next;
|
|
134
|
+
if (attempt === 1)
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (forced) {
|
|
139
|
+
forced = false;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
await wait(reconnectDelay, controller.signal);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function start() {
|
|
146
|
+
if (started)
|
|
147
|
+
return run;
|
|
148
|
+
started = true;
|
|
149
|
+
forced = false;
|
|
150
|
+
const active = ++generation;
|
|
151
|
+
const previous = run;
|
|
152
|
+
const current = (async () => {
|
|
153
|
+
if (previous)
|
|
154
|
+
await previous;
|
|
155
|
+
await runStream(active);
|
|
156
|
+
})().finally(() => {
|
|
157
|
+
if (run !== current)
|
|
158
|
+
return;
|
|
159
|
+
run = undefined;
|
|
160
|
+
});
|
|
161
|
+
run = current;
|
|
162
|
+
return run;
|
|
163
|
+
}
|
|
164
|
+
function stop() {
|
|
165
|
+
if (!started)
|
|
166
|
+
return;
|
|
167
|
+
started = false;
|
|
168
|
+
generation += 1;
|
|
169
|
+
stream?.abort();
|
|
170
|
+
setConnection({ status: "connecting", attempt: 0, error: undefined });
|
|
171
|
+
}
|
|
172
|
+
function resync(reason) {
|
|
173
|
+
if (!started || connection.status !== "connected")
|
|
174
|
+
return;
|
|
175
|
+
options.log?.info?.("event stream resync", { reason, idle: Date.now() - lastActivity });
|
|
176
|
+
forced = true;
|
|
177
|
+
current?.abort(new Error(reason));
|
|
178
|
+
}
|
|
179
|
+
if (options.pageLifecycle) {
|
|
180
|
+
const pagehide = () => stop();
|
|
181
|
+
const pageshow = () => void start();
|
|
182
|
+
const visibility = () => {
|
|
183
|
+
if (document.visibilityState !== "visible")
|
|
184
|
+
return;
|
|
185
|
+
if (Date.now() - lastActivity < foregroundIdleThreshold2)
|
|
186
|
+
return;
|
|
187
|
+
resync("Page returned to the foreground after the event stream went quiet");
|
|
188
|
+
};
|
|
189
|
+
const online = () => resync("Network connection restored");
|
|
190
|
+
window.addEventListener("pagehide", pagehide);
|
|
191
|
+
window.addEventListener("pageshow", pageshow);
|
|
192
|
+
window.addEventListener("online", online);
|
|
193
|
+
document.addEventListener("visibilitychange", visibility);
|
|
194
|
+
onCleanup(() => {
|
|
195
|
+
window.removeEventListener("pagehide", pagehide);
|
|
196
|
+
window.removeEventListener("pageshow", pageshow);
|
|
197
|
+
window.removeEventListener("online", online);
|
|
198
|
+
document.removeEventListener("visibilitychange", visibility);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
start();
|
|
202
|
+
onCleanup(() => {
|
|
203
|
+
stop();
|
|
204
|
+
abort.abort();
|
|
205
|
+
if (flushTimer)
|
|
206
|
+
clearTimeout(flushTimer);
|
|
207
|
+
pending = [];
|
|
208
|
+
});
|
|
209
|
+
return {
|
|
210
|
+
status: () => connection.status,
|
|
211
|
+
attempt: () => connection.attempt,
|
|
212
|
+
error: () => connection.error,
|
|
213
|
+
internal: {
|
|
214
|
+
history: () => history.slice(),
|
|
215
|
+
resync
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function errorMessage(error) {
|
|
220
|
+
if (error === undefined)
|
|
221
|
+
return;
|
|
222
|
+
if (error instanceof Error)
|
|
223
|
+
return error.message;
|
|
224
|
+
return String(error);
|
|
225
|
+
}
|
|
226
|
+
function wait(delay, signal) {
|
|
227
|
+
return new Promise((resolve) => {
|
|
228
|
+
const timer = setTimeout(done, delay);
|
|
229
|
+
signal.addEventListener("abort", done, { once: true });
|
|
230
|
+
function done() {
|
|
231
|
+
clearTimeout(timer);
|
|
232
|
+
signal.removeEventListener("abort", done);
|
|
233
|
+
resolve();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { defaultIdleTimeout2, foregroundIdleThreshold2, createClientConnection2 };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
read2,
|
|
3
|
+
readError2,
|
|
4
|
+
event2,
|
|
5
|
+
eventType2
|
|
6
|
+
} from "./service-probe-t1xa31vm.js";
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./service-probe-9rqn6x4v.js";
|
|
10
|
+
|
|
11
|
+
// src/effect/rpc.ts
|
|
12
|
+
var exports_rpc = {};
|
|
13
|
+
__export(exports_rpc, {
|
|
14
|
+
RpcClientRuntime: () => exports_rpc,
|
|
15
|
+
aborted: () => aborted2,
|
|
16
|
+
make: () => make4
|
|
17
|
+
});
|
|
18
|
+
import { Effect, Stream } from "effect";
|
|
19
|
+
function make4(call, subscribe) {
|
|
20
|
+
return (definition) => {
|
|
21
|
+
const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
|
|
22
|
+
name,
|
|
23
|
+
(input, options) => {
|
|
24
|
+
const result = Effect.gen(function* () {
|
|
25
|
+
const response = yield* call({
|
|
26
|
+
rpcID: definition.id,
|
|
27
|
+
method: name,
|
|
28
|
+
input,
|
|
29
|
+
location: options?.location
|
|
30
|
+
}, options);
|
|
31
|
+
return yield* read2(method.output, response.output);
|
|
32
|
+
}).pipe(Effect.catch((error) => readError2(method, error)));
|
|
33
|
+
const signal = options?.signal;
|
|
34
|
+
if (!signal)
|
|
35
|
+
return result;
|
|
36
|
+
return Effect.suspend(() => signal.aborted ? Effect.interrupt : Effect.raceFirst(result, Effect.andThen(aborted2(signal), Effect.interrupt)));
|
|
37
|
+
}
|
|
38
|
+
]));
|
|
39
|
+
return Object.assign(methods, {
|
|
40
|
+
events: {
|
|
41
|
+
subscribe: (name) => {
|
|
42
|
+
const type = eventType2(definition, name);
|
|
43
|
+
if (!Object.hasOwn(definition.events, name))
|
|
44
|
+
return Stream.fail(new Error(`Unknown RPC event: ${type}`));
|
|
45
|
+
const schema = definition.events[name];
|
|
46
|
+
return subscribe().pipe(Stream.filter((event) => event.type === type), Stream.mapEffect((event) => event2(definition, name, schema, event)));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function aborted2(signal) {
|
|
53
|
+
return Effect.callback((resume) => {
|
|
54
|
+
if (signal.aborted)
|
|
55
|
+
return resume(Effect.void);
|
|
56
|
+
const abort = () => resume(Effect.void);
|
|
57
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
58
|
+
return Effect.sync(() => signal.removeEventListener("abort", abort));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { make4, aborted2, exports_rpc };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ClientApi, effectOmitEndpoints, groupNames, promiseOmitEndpoints } from "@opencode/protocol/client";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientApi2,
|
|
3
|
+
effectOmitEndpoints2,
|
|
4
|
+
groupNames2,
|
|
5
|
+
promiseOmitEndpoints2
|
|
6
|
+
} from "./chunks/service-probe-vmytr4q8.js";
|
|
7
|
+
export {
|
|
8
|
+
ClientApi2 as ClientApi,
|
|
9
|
+
effectOmitEndpoints2 as effectOmitEndpoints,
|
|
10
|
+
groupNames2 as groupNames,
|
|
11
|
+
promiseOmitEndpoints2 as promiseOmitEndpoints
|
|
12
|
+
};
|