@ycodium-ai/agent-dsh 0.2.4343 → 0.2.4351
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/dist/index.js +91 -15
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7371,7 +7371,7 @@ var require_dist = __commonJS({
|
|
|
7371
7371
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
7372
7372
|
|
|
7373
7373
|
// ../../packages/plugin-api/src/version.ts
|
|
7374
|
-
var PLUGIN_API_VERSION =
|
|
7374
|
+
var PLUGIN_API_VERSION = 110;
|
|
7375
7375
|
|
|
7376
7376
|
// src/index.ts
|
|
7377
7377
|
import * as NodeOS6 from "node:os";
|
|
@@ -7635,9 +7635,11 @@ var AcpExecutorRequestError = class extends AcpExecutorError {
|
|
|
7635
7635
|
}
|
|
7636
7636
|
};
|
|
7637
7637
|
var AcpConnectionClosedError = class extends Error {
|
|
7638
|
+
reason;
|
|
7638
7639
|
constructor(message = "ACP connection closed", options) {
|
|
7639
|
-
super(message, options);
|
|
7640
|
+
super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
|
|
7640
7641
|
this.name = "AcpConnectionClosedError";
|
|
7642
|
+
this.reason = options?.reason ?? "closed";
|
|
7641
7643
|
}
|
|
7642
7644
|
};
|
|
7643
7645
|
async function withStartupStderr(error62, stderrTail) {
|
|
@@ -7647,9 +7649,65 @@ async function withStartupStderr(error62, stderrTail) {
|
|
|
7647
7649
|
return new AcpConnectionClosedError(`${error62.message}
|
|
7648
7650
|
Agent stderr (last lines):
|
|
7649
7651
|
${tail}`, {
|
|
7650
|
-
cause: error62
|
|
7652
|
+
cause: error62,
|
|
7653
|
+
reason: error62.reason
|
|
7651
7654
|
});
|
|
7652
7655
|
}
|
|
7656
|
+
var AGENT_EXIT_STDERR_MAX_CHARS = 800;
|
|
7657
|
+
var AGENT_EXIT_SETTLE_MS = 500;
|
|
7658
|
+
var AcpAgentExitedError = class extends AcpConnectionClosedError {
|
|
7659
|
+
exitCode;
|
|
7660
|
+
constructor(message, exitCode, cause) {
|
|
7661
|
+
super(message, { cause, reason: "input-ended" });
|
|
7662
|
+
this.name = "AcpAgentExitedError";
|
|
7663
|
+
this.exitCode = exitCode;
|
|
7664
|
+
}
|
|
7665
|
+
};
|
|
7666
|
+
var REDACTION_MARKERS = ["[redacted]", "[pairing-url]"];
|
|
7667
|
+
var lastLines = (text, maxChars) => {
|
|
7668
|
+
if (text.length <= maxChars) return text;
|
|
7669
|
+
let start = text.length - maxChars;
|
|
7670
|
+
if (text[start - 1] !== "\n") {
|
|
7671
|
+
const lineEnd = text.indexOf("\n", start);
|
|
7672
|
+
if (lineEnd !== -1 && lineEnd < text.length - 1) return text.slice(lineEnd + 1);
|
|
7673
|
+
const code = text.charCodeAt(start);
|
|
7674
|
+
if (code >= 56320 && code <= 57343) start += 1;
|
|
7675
|
+
for (const marker of REDACTION_MARKERS) {
|
|
7676
|
+
const at = text.lastIndexOf(marker, start);
|
|
7677
|
+
if (at !== -1 && at < start && start < at + marker.length) start = at + marker.length;
|
|
7678
|
+
}
|
|
7679
|
+
}
|
|
7680
|
+
return text.slice(start);
|
|
7681
|
+
};
|
|
7682
|
+
var settledExitCode = async (exited) => {
|
|
7683
|
+
if (exited === void 0) return void 0;
|
|
7684
|
+
let timer;
|
|
7685
|
+
try {
|
|
7686
|
+
return await Promise.race([
|
|
7687
|
+
exited.catch(() => void 0),
|
|
7688
|
+
new Promise((resolve4) => {
|
|
7689
|
+
timer = setTimeout(() => resolve4(void 0), AGENT_EXIT_SETTLE_MS);
|
|
7690
|
+
})
|
|
7691
|
+
]);
|
|
7692
|
+
} finally {
|
|
7693
|
+
clearTimeout(timer);
|
|
7694
|
+
}
|
|
7695
|
+
};
|
|
7696
|
+
async function describeAgentExit(input2) {
|
|
7697
|
+
const [exitCode, tail] = await Promise.all([
|
|
7698
|
+
settledExitCode(input2.exited),
|
|
7699
|
+
input2.stderrTail === void 0 ? "" : Promise.resolve().then(input2.stderrTail).catch(() => "")
|
|
7700
|
+
]);
|
|
7701
|
+
const head = exitCode === void 0 ? "The agent closed its connection." : exitCode === null ? "The agent process exited without an exit code." : `The agent process exited with code ${exitCode}.`;
|
|
7702
|
+
const excerpt = lastLines(tail.trim(), AGENT_EXIT_STDERR_MAX_CHARS);
|
|
7703
|
+
return new AcpAgentExitedError(
|
|
7704
|
+
excerpt.length === 0 ? head : `${head}
|
|
7705
|
+
Agent stderr (last lines):
|
|
7706
|
+
${excerpt}`,
|
|
7707
|
+
exitCode,
|
|
7708
|
+
input2.cause
|
|
7709
|
+
);
|
|
7710
|
+
}
|
|
7653
7711
|
|
|
7654
7712
|
// ../../packages/ycodium-acp-executor/src/event-stream.ts
|
|
7655
7713
|
var UnboundedEventStream = class {
|
|
@@ -32608,7 +32666,8 @@ function createAcpConnection(options) {
|
|
|
32608
32666
|
options.onInboundFailure?.(error62);
|
|
32609
32667
|
void shutdown(
|
|
32610
32668
|
new AcpConnectionClosedError(
|
|
32611
|
-
`ACP inbound handling failed: ${error62 instanceof Error ? error62.message : String(error62)}
|
|
32669
|
+
`ACP inbound handling failed: ${error62 instanceof Error ? error62.message : String(error62)}`,
|
|
32670
|
+
{ reason: "inbound-failed" }
|
|
32612
32671
|
)
|
|
32613
32672
|
);
|
|
32614
32673
|
};
|
|
@@ -32653,19 +32712,21 @@ function createAcpConnection(options) {
|
|
|
32653
32712
|
} finally {
|
|
32654
32713
|
endInboundBatch();
|
|
32655
32714
|
}
|
|
32656
|
-
await shutdown(
|
|
32715
|
+
await shutdown(
|
|
32716
|
+
new AcpConnectionClosedError("ACP input stream ended", { reason: "input-ended" })
|
|
32717
|
+
);
|
|
32657
32718
|
});
|
|
32658
32719
|
};
|
|
32659
32720
|
const onError = (error62) => {
|
|
32660
32721
|
enqueueInbound(async () => {
|
|
32661
32722
|
await shutdown(
|
|
32662
|
-
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP input stream error")
|
|
32723
|
+
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP input stream error", { reason: "stream-error" })
|
|
32663
32724
|
);
|
|
32664
32725
|
});
|
|
32665
32726
|
};
|
|
32666
32727
|
const onWritableError = (error62) => {
|
|
32667
32728
|
void shutdown(
|
|
32668
|
-
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP output stream error")
|
|
32729
|
+
error62 instanceof Error ? error62 : new AcpConnectionClosedError("ACP output stream error", { reason: "stream-error" })
|
|
32669
32730
|
);
|
|
32670
32731
|
};
|
|
32671
32732
|
options.readable.on("data", onData);
|
|
@@ -32728,7 +32789,8 @@ function createAcpConnection(options) {
|
|
|
32728
32789
|
awaitInboundIdle,
|
|
32729
32790
|
abandonPending,
|
|
32730
32791
|
close,
|
|
32731
|
-
closed
|
|
32792
|
+
closed,
|
|
32793
|
+
closeError: () => closedError
|
|
32732
32794
|
};
|
|
32733
32795
|
}
|
|
32734
32796
|
|
|
@@ -33137,7 +33199,8 @@ var ACP_FAILURE_CATEGORIES = [
|
|
|
33137
33199
|
"auth",
|
|
33138
33200
|
"model-unavailable",
|
|
33139
33201
|
"transport",
|
|
33140
|
-
"unknown"
|
|
33202
|
+
"unknown",
|
|
33203
|
+
"process-exit"
|
|
33141
33204
|
];
|
|
33142
33205
|
var isAcpFailureCategory = (value) => ACP_FAILURE_CATEGORIES.some((category) => category === value);
|
|
33143
33206
|
var readAcpFailureCategory = (error62) => {
|
|
@@ -33147,11 +33210,14 @@ var readAcpFailureCategory = (error62) => {
|
|
|
33147
33210
|
};
|
|
33148
33211
|
var withFailureCategory = (error62, category) => category === void 0 ? error62 : Object.assign(error62, { failureCategory: category });
|
|
33149
33212
|
var failureCategoryField = (category) => category === void 0 ? {} : { failureCategory: category };
|
|
33150
|
-
var
|
|
33213
|
+
var acpClosedConnectionCategory = (closeError, sessionEstablished, disposed) => {
|
|
33214
|
+
if (!sessionEstablished || disposed) return void 0;
|
|
33215
|
+
return closeError instanceof AcpConnectionClosedError && closeError.reason === "input-ended" ? "process-exit" : "transport";
|
|
33216
|
+
};
|
|
33151
33217
|
var acpPromptFailureCategory = (error62, input2) => {
|
|
33152
33218
|
const signaled = readAcpFailureCategory(error62);
|
|
33153
33219
|
if (signaled !== void 0) return signaled;
|
|
33154
|
-
return error62 instanceof AcpConnectionClosedError ?
|
|
33220
|
+
return error62 instanceof AcpConnectionClosedError ? acpClosedConnectionCategory(error62, input2.sessionEstablished, input2.disposed) : void 0;
|
|
33155
33221
|
};
|
|
33156
33222
|
|
|
33157
33223
|
// ../../packages/ycodium-acp-executor/src/tool-subagents.ts
|
|
@@ -33166,7 +33232,7 @@ var sealedHidden = (entry) => ({
|
|
|
33166
33232
|
});
|
|
33167
33233
|
function toolSubagentSettlementOfTurn(state, failureCategory) {
|
|
33168
33234
|
if (state === "cancelled") return "turn-interrupted";
|
|
33169
|
-
return state === "failed" && failureCategory === "
|
|
33235
|
+
return state === "failed" && failureCategory === "process-exit" ? "session-ended" : "turn-ended";
|
|
33170
33236
|
}
|
|
33171
33237
|
var sameFacts = (a, b) => a.title === b.title && a.description === b.description && a.summary === b.summary && a.role === b.role && a.model === b.model && a.effort === b.effort && a.rosterKind === b.rosterKind;
|
|
33172
33238
|
function linkage(taskId, toolCallId, facts) {
|
|
@@ -33783,14 +33849,19 @@ function createExecutorPrompt({
|
|
|
33783
33849
|
},
|
|
33784
33850
|
record2
|
|
33785
33851
|
);
|
|
33786
|
-
} catch (
|
|
33852
|
+
} catch (caught) {
|
|
33787
33853
|
if (shared.disposed) {
|
|
33788
33854
|
throw new AcpExecutorDisposedError();
|
|
33789
33855
|
}
|
|
33790
|
-
const failureCategory = acpPromptFailureCategory(
|
|
33856
|
+
const failureCategory = acpPromptFailureCategory(caught, {
|
|
33791
33857
|
sessionEstablished: shared.startResult !== void 0,
|
|
33792
33858
|
disposed: shared.disposed
|
|
33793
33859
|
});
|
|
33860
|
+
const error62 = failureCategory === "process-exit" && !interruptedTurnIds.has(turnId) ? await describeAgentExit({
|
|
33861
|
+
cause: caught,
|
|
33862
|
+
exited: options.exited,
|
|
33863
|
+
stderrTail: options.stderrTail
|
|
33864
|
+
}) : caught;
|
|
33794
33865
|
if (!interruptedTurnIds.has(turnId)) {
|
|
33795
33866
|
const errorMessage = error62 instanceof Error && error62.message.trim() || "ACP prompt failed";
|
|
33796
33867
|
if (settle2({
|
|
@@ -35615,7 +35686,11 @@ function createAcpExecutor(options) {
|
|
|
35615
35686
|
settleAllUserInputs();
|
|
35616
35687
|
abortPendingSettlement(
|
|
35617
35688
|
"connection closed",
|
|
35618
|
-
|
|
35689
|
+
acpClosedConnectionCategory(
|
|
35690
|
+
connection.closeError(),
|
|
35691
|
+
shared.startResult !== void 0,
|
|
35692
|
+
shared.disposed
|
|
35693
|
+
)
|
|
35619
35694
|
);
|
|
35620
35695
|
shared.promptWaiters.splice(0).forEach((wake) => wake());
|
|
35621
35696
|
},
|
|
@@ -36947,6 +37022,7 @@ var createDshInstance = (config2, host) => {
|
|
|
36947
37022
|
readable: readable2,
|
|
36948
37023
|
writable,
|
|
36949
37024
|
stderrTail,
|
|
37025
|
+
exited: handle.exited,
|
|
36950
37026
|
cwd,
|
|
36951
37027
|
threadId: input2.threadId,
|
|
36952
37028
|
provider: DSH_DRIVER_KIND,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-dsh",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4351",
|
|
4
4
|
"description": "DeepSeek Harness executor: dsh CLI over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
24
|
"yaml": "^2.9.0",
|
|
25
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
26
|
-
"ycodium-executor
|
|
27
|
-
"ycodium-
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.4351",
|
|
26
|
+
"ycodium-acp-executor": "0.2.4351",
|
|
27
|
+
"ycodium-executor-testing": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|