@codexhost/cli-win32-x64 0.29.2 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +94 -20
- package/app/console-web.js +123 -31
- package/app/desktop-controller.mjs +113 -37
- package/app/host-runtime.mjs +3963 -2280
- package/app/plugins/antigravity/plugin.mjs +94 -20
- package/app/plugins/claude-code/plugin.mjs +105 -28
- package/app/plugins/codebuddy/plugin.mjs +767 -202
- package/app/plugins/codex-usage/plugin.mjs +112 -38
- package/app/plugins/copilot/plugin.mjs +94 -20
- package/app/plugins/cursor-cli/plugin.mjs +94 -20
- package/app/plugins/deepseek-harness/plugin.mjs +94 -20
- package/app/plugins/devin/plugin.mjs +94 -20
- package/app/plugins/grok/plugin.mjs +94 -20
- package/app/plugins/hermes/plugin.mjs +94 -20
- package/app/plugins/kimi-code/plugin.mjs +94 -20
- package/app/plugins/kiro-cli/plugin.mjs +94 -20
- package/app/plugins/omp/plugin.mjs +94 -20
- package/app/plugins/opencode/plugin.mjs +94 -20
- package/app/plugins/pi/plugin.mjs +94 -20
- package/app/plugins/qoder/plugin.mjs +94 -20
- package/app/plugins/qoder-cn/plugin.mjs +94 -20
- package/app/plugins/qwen-code/plugin.mjs +94 -20
- package/app/plugins/workbuddy/plugin.mjs +798 -202
- package/app/plugins/zcode/plugin.mjs +94 -20
- package/app/renderer-extension.js +702 -440
- package/app/web/assets/abnfDiagram-XWFEHMT6-Bqy7uOSy.js +1 -0
- package/app/web/assets/architectureDiagram-CSQXQB3N-6aaP1YoM.js +36 -0
- package/app/web/assets/blockDiagram-BEDRHYPZ-B4QSFXe0.js +140 -0
- package/app/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
- package/app/web/assets/c4Diagram-M2UUVUY5-BYE-C8Gq.js +38 -0
- package/app/web/assets/chunk-2Q5K7J3B-CiEM-GTd.js +1 -0
- package/app/web/assets/chunk-3GCGMST5-hzY9BiB1.js +1 -0
- package/app/web/assets/chunk-5VM5RSS4-DYXznY0H.js +15 -0
- package/app/web/assets/chunk-7U7NFRK5-Bzw5MDPr.js +88 -0
- package/app/web/assets/chunk-CNRTWJTD-DMbxMfi3.js +1 -0
- package/app/web/assets/chunk-D5HYT7QG-By0ZVBtD.js +1 -0
- package/app/web/assets/chunk-EBZ3SEQC-Yyu_sMV7.js +2 -0
- package/app/web/assets/chunk-JWPE2WC7-DDzqxIPT.js +1 -0
- package/app/web/assets/chunk-KTR4FSNJ-GlKqhtpl.js +1 -0
- package/app/web/assets/chunk-XXDRQBXY-DNc-CvYu.js +1 -0
- package/app/web/assets/classDiagram-v2-KXABOMEV-4_PFS2N_.js +217 -0
- package/app/web/assets/cose-bilkent-JH36ORCC-BE3foHUY.js +1 -0
- package/app/web/assets/cynefin-EF2NZ3EQ-D2PqrYZ3.js +141 -0
- package/app/web/assets/cynefinDiagram-NJNITYFG-DOObpTbq.js +62 -0
- package/app/web/assets/cytoscape.esm-Cm0uQArZ.js +332 -0
- package/app/web/assets/d3-scale-4DPf7zan.js +1 -0
- package/app/web/assets/dagre-KIHZ2IZ3-Znm2jin9.js +4 -0
- package/app/web/assets/diagram-7YQZDPLS-ByZMD-uA.js +41 -0
- package/app/web/assets/diagram-QBROCOUO-BiRShpnN.js +200 -0
- package/app/web/assets/diagram-RJJCUUZO-D9wLVoK2.js +30 -0
- package/app/web/assets/diagram-WERXNKYE-BSbIh-yC.js +24 -0
- package/app/web/assets/diagram-YHHI257C-DMWrHMc8.js +3 -0
- package/app/web/assets/diagram-YR4HJLHV-C4sBAFb1.js +24 -0
- package/app/web/assets/ebnfDiagram-N527522P-BZLloaoQ.js +1 -0
- package/app/web/assets/elk-O5DQBFGD-Da3e5tn5.js +27 -0
- package/app/web/assets/erDiagram-K3K3BIDK-B2lKAIZF.js +99 -0
- package/app/web/assets/flowDiagram-Z6JWZHQI-q2EY_kmB.js +213 -0
- package/app/web/assets/ganttDiagram-3PRQTZWP-BGrNZ20b.js +292 -0
- package/app/web/assets/gitGraphDiagram-VXDFKS5L-DIZNXREy.js +106 -0
- package/app/web/assets/graph-D8UmR1vK.js +1 -0
- package/app/web/assets/grid-E2QIVN74-0cUkPG69.js +1 -0
- package/app/web/assets/{index-aSHN2MIG.css → index-BbmB5VLj.css} +1 -1
- package/app/web/assets/{index-0TnaYwHS.js → index-PN7K-15_.js} +78 -78
- package/app/web/assets/infoDiagram-EZ3ZOAHP-BHhUTQCn.js +2 -0
- package/app/web/assets/ishikawaDiagram-S3EKX5GW-DPOxtl4c.js +70 -0
- package/app/web/assets/journeyDiagram-POQNLL5X-D8RyXckG.js +139 -0
- package/app/web/assets/kanban-definition-BH5XI6FM-COJv3Hyh.js +89 -0
- package/app/web/assets/langs/{graphql-ChAeyPkT.js → graphql-D6Z3qcRW.js} +1 -1
- package/app/web/assets/langs/{http-BvreBIbD.js → http-XiU9G9In.js} +1 -1
- package/app/web/assets/langs/{php-D8omCIuJ.js → php-DL3xwS-7.js} +1 -1
- package/app/web/assets/langs/{rst-Do7RLLCS.js → rst-DudRVJ9g.js} +1 -1
- package/app/web/assets/langs/{ruby-rH_O_vse.js → ruby-_FqsfqJi.js} +1 -1
- package/app/web/assets/langs/{svelte-xZy73wAj.js → svelte-ClsVJoBT.js} +1 -1
- package/app/web/assets/langs/{vue-C4DW8agZ.js → vue-BiKMXCyK.js} +1 -1
- package/app/web/assets/mermaid.core-DYdcDKIt.js +314 -0
- package/app/web/assets/mindmap-definition-WVAN44T4-DnYIM4ja.js +98 -0
- package/app/web/assets/pegDiagram-D4NLKWP3-Ds3GAEJ6.js +1 -0
- package/app/web/assets/pieDiagram-36ENHN4W-BhLUJGEB.js +39 -0
- package/app/web/assets/quadrantDiagram-ZQUDMS73-DwtX-IxK.js +7 -0
- package/app/web/assets/railroadDiagram-JIZHGYPL-D2vmTTnJ.js +1 -0
- package/app/web/assets/render-VIF2ZAQL-DGU1ql-Z.js +2 -0
- package/app/web/assets/requirementDiagram-AXW2TVFA-u3j1sKkI.js +84 -0
- package/app/web/assets/sankeyDiagram-FBCJTAIF-k-An9VHW.js +40 -0
- package/app/web/assets/sequenceDiagram-3LA2ROMG-DUjbYb4R.js +169 -0
- package/app/web/assets/sizeCapture-2Q2CQKSF-DATTL7FZ.js +1 -0
- package/app/web/assets/stateDiagram-v2-ATKHQDJO-cCJX5M2u.js +291 -0
- package/app/web/assets/swimlanes-YQL5WMAO-B7grWEWt.js +1 -0
- package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +8 -0
- package/app/web/assets/timeline-definition-7Z437IG3-BhsLa6l1.js +120 -0
- package/app/web/assets/usecaseDiagram-RDK6N6HP-CkPQYmQw.js +370 -0
- package/app/web/assets/vendor-BKfNgqAm.js +666 -0
- package/app/web/assets/vennDiagram-SHRQU5PJ-CufZSwvw.js +34 -0
- package/app/web/assets/wardleyDiagram-F3OXNVQS-CSkfpFOA.js +78 -0
- package/app/web/assets/xychartDiagram-GDYJKCDI-BhZf9scK.js +7 -0
- package/app/web/codexhost-settings.js +57 -57
- package/app/web/index.html +3 -3
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +12 -12
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -72
- package/app/web-modules/licenses/DSH-THIRD_PARTY_NOTICES.md +1 -1
- package/app/web-modules/server.mjs +724 -259
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/vendor-C9g2bw8s.js +0 -410
|
@@ -1328,10 +1328,10 @@ function mergeDefs(...defs) {
|
|
|
1328
1328
|
function cloneDef(schema) {
|
|
1329
1329
|
return mergeDefs(schema._zod.def);
|
|
1330
1330
|
}
|
|
1331
|
-
function getElementAtPath(obj,
|
|
1332
|
-
if (!
|
|
1331
|
+
function getElementAtPath(obj, path13) {
|
|
1332
|
+
if (!path13)
|
|
1333
1333
|
return obj;
|
|
1334
|
-
return
|
|
1334
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
1335
1335
|
}
|
|
1336
1336
|
function promiseAllObject(promisesObj) {
|
|
1337
1337
|
const keys = Object.keys(promisesObj);
|
|
@@ -1671,11 +1671,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
return false;
|
|
1673
1673
|
}
|
|
1674
|
-
function prefixIssues(
|
|
1674
|
+
function prefixIssues(path13, issues) {
|
|
1675
1675
|
return issues.map((iss) => {
|
|
1676
1676
|
var _a3;
|
|
1677
1677
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1678
|
-
iss.path.unshift(
|
|
1678
|
+
iss.path.unshift(path13);
|
|
1679
1679
|
return iss;
|
|
1680
1680
|
});
|
|
1681
1681
|
}
|
|
@@ -2137,16 +2137,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2137
2137
|
}
|
|
2138
2138
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
2139
2139
|
const fieldErrors = { _errors: [] };
|
|
2140
|
-
const processError = (error63,
|
|
2140
|
+
const processError = (error63, path13 = []) => {
|
|
2141
2141
|
for (const issue2 of error63.issues) {
|
|
2142
2142
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2143
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2143
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
2144
2144
|
} else if (issue2.code === "invalid_key") {
|
|
2145
|
-
processError({ issues: issue2.issues }, [...
|
|
2145
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
2146
2146
|
} else if (issue2.code === "invalid_element") {
|
|
2147
|
-
processError({ issues: issue2.issues }, [...
|
|
2147
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
2148
2148
|
} else {
|
|
2149
|
-
const fullpath = [...
|
|
2149
|
+
const fullpath = [...path13, ...issue2.path];
|
|
2150
2150
|
if (fullpath.length === 0) {
|
|
2151
2151
|
fieldErrors._errors.push(mapper(issue2));
|
|
2152
2152
|
} else {
|
|
@@ -2185,17 +2185,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2185
2185
|
}
|
|
2186
2186
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
2187
2187
|
const result = { errors: [] };
|
|
2188
|
-
const processError = (error63,
|
|
2188
|
+
const processError = (error63, path13 = []) => {
|
|
2189
2189
|
var _a3;
|
|
2190
2190
|
for (const issue2 of error63.issues) {
|
|
2191
2191
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2192
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2192
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
2193
2193
|
} else if (issue2.code === "invalid_key") {
|
|
2194
|
-
processError({ issues: issue2.issues }, [...
|
|
2194
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
2195
2195
|
} else if (issue2.code === "invalid_element") {
|
|
2196
|
-
processError({ issues: issue2.issues }, [...
|
|
2196
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
2197
2197
|
} else {
|
|
2198
|
-
const fullpath = [...
|
|
2198
|
+
const fullpath = [...path13, ...issue2.path];
|
|
2199
2199
|
if (fullpath.length === 0) {
|
|
2200
2200
|
result.errors.push(mapper(issue2));
|
|
2201
2201
|
continue;
|
|
@@ -2234,8 +2234,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
2234
2234
|
}
|
|
2235
2235
|
function toDotPath(_path) {
|
|
2236
2236
|
const segs = [];
|
|
2237
|
-
const
|
|
2238
|
-
for (const seg of
|
|
2237
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2238
|
+
for (const seg of path13) {
|
|
2239
2239
|
if (typeof seg === "number")
|
|
2240
2240
|
segs.push(`[${seg}]`);
|
|
2241
2241
|
else if (typeof seg === "symbol")
|
|
@@ -19373,13 +19373,13 @@ function resolveRef(ref, ctx) {
|
|
|
19373
19373
|
if (!ref.startsWith("#")) {
|
|
19374
19374
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19375
19375
|
}
|
|
19376
|
-
const
|
|
19377
|
-
if (
|
|
19376
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
19377
|
+
if (path13.length === 0) {
|
|
19378
19378
|
return ctx.rootSchema;
|
|
19379
19379
|
}
|
|
19380
19380
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19381
|
-
if (
|
|
19382
|
-
const key =
|
|
19381
|
+
if (path13[0] === defsKey) {
|
|
19382
|
+
const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
|
|
19383
19383
|
if (!key || !ctx.defs[key]) {
|
|
19384
19384
|
throw new Error(`Reference not found: ${ref}`);
|
|
19385
19385
|
}
|
|
@@ -20858,15 +20858,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
20858
20858
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
20859
20859
|
}).strict().superRefine(({ threads }, context) => {
|
|
20860
20860
|
const seen = /* @__PURE__ */ new Set();
|
|
20861
|
-
for (const [index,
|
|
20862
|
-
if (seen.has(
|
|
20861
|
+
for (const [index, thread3] of threads.entries()) {
|
|
20862
|
+
if (seen.has(thread3.threadId)) {
|
|
20863
20863
|
context.addIssue({
|
|
20864
20864
|
code: "custom",
|
|
20865
20865
|
message: "Thread ownership-list results must be unique",
|
|
20866
20866
|
path: ["threads", index, "threadId"]
|
|
20867
20867
|
});
|
|
20868
20868
|
}
|
|
20869
|
-
seen.add(
|
|
20869
|
+
seen.add(thread3.threadId);
|
|
20870
20870
|
}
|
|
20871
20871
|
});
|
|
20872
20872
|
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
@@ -21064,7 +21064,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
|
|
|
21064
21064
|
default: external_exports.string().optional()
|
|
21065
21065
|
})
|
|
21066
21066
|
]).superRefine((field2, ctx) => {
|
|
21067
|
-
const issue2 = (
|
|
21067
|
+
const issue2 = (path13, message) => ctx.addIssue({ code: "custom", path: [path13], message });
|
|
21068
21068
|
if (field2.type === "number" || field2.type === "range") {
|
|
21069
21069
|
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
21070
21070
|
if (min > max)
|
|
@@ -21170,16 +21170,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
|
|
|
21170
21170
|
var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
|
|
21171
21171
|
var hostExtensionDigestSchema = desktopExtensionHashSchema;
|
|
21172
21172
|
var hostExtensionActivationIdSchema = external_exports.uuid();
|
|
21173
|
-
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((
|
|
21173
|
+
var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path13) => path13.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
|
|
21174
21174
|
var legacy = desktopExtensionManifestSchema.shape;
|
|
21175
21175
|
var localized = (max, min = 0) => external_exports.strictObject({
|
|
21176
21176
|
en: external_exports.string().trim().min(min).max(max),
|
|
21177
21177
|
"zh-CN": external_exports.string().trim().min(min).max(max)
|
|
21178
21178
|
});
|
|
21179
|
-
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((
|
|
21179
|
+
var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path13) => path13.endsWith(suffix), `Expected a ${suffix} file`);
|
|
21180
21180
|
var moduleEntry = resourceWithSuffix(".mjs");
|
|
21181
21181
|
var style = resourceWithSuffix(".css").optional();
|
|
21182
|
-
var hostExtensionCanonicalPath = (
|
|
21182
|
+
var hostExtensionCanonicalPath = (path13) => path13.normalize("NFC").toLowerCase();
|
|
21183
21183
|
var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
21184
21184
|
manifestVersion: external_exports.literal(2),
|
|
21185
21185
|
id: hostExtensionIdSchema,
|
|
@@ -21189,8 +21189,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
|
|
|
21189
21189
|
details: localized(16384).optional(),
|
|
21190
21190
|
author: legacy.author,
|
|
21191
21191
|
repository: legacy.repository,
|
|
21192
|
-
icon: legacy.icon.refine((
|
|
21193
|
-
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((
|
|
21192
|
+
icon: legacy.icon.refine((path13) => path13 === void 0 || hostExtensionResourcePathSchema.safeParse(path13).success),
|
|
21193
|
+
screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path13) => hostExtensionResourcePathSchema.safeParse(path13).success)),
|
|
21194
21194
|
categories: legacy.categories,
|
|
21195
21195
|
settingsSchema: legacy.settingsSchema,
|
|
21196
21196
|
slots: legacy.slots.removeDefault().optional(),
|
|
@@ -21312,7 +21312,7 @@ var active = {
|
|
|
21312
21312
|
digest: hostExtensionDigestSchema
|
|
21313
21313
|
};
|
|
21314
21314
|
var optionalActivation = { ...id, activationId: active.activationId.optional() };
|
|
21315
|
-
var filePath = external_exports.string().min(1).max(4096).refine((
|
|
21315
|
+
var filePath = external_exports.string().min(1).max(4096).refine((path13) => /^(?:\/|[a-z]:[/\\])/iu.test(path13) && !path13.includes("\0") && !path13.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
|
|
21316
21316
|
var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
|
|
21317
21317
|
function base643(maxBytes) {
|
|
21318
21318
|
return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
|
|
@@ -21602,9 +21602,71 @@ var productTelemetryHeartbeatSchema = external_exports.object({
|
|
|
21602
21602
|
message: "Telemetry heartbeat must contain at least one countable field"
|
|
21603
21603
|
});
|
|
21604
21604
|
|
|
21605
|
+
// ../../shared-contracts/dist/native-codex-goal.js
|
|
21606
|
+
var NATIVE_CODEX_GOAL_METHOD = "codexhost/thread/goal";
|
|
21607
|
+
var NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS = 4e3;
|
|
21608
|
+
var thread = { threadId: hostThreadIdSchema };
|
|
21609
|
+
var nativeCodexGoalRequestSchema = external_exports.discriminatedUnion("action", [
|
|
21610
|
+
external_exports.strictObject({ ...thread, action: external_exports.enum(["get", "pause", "resume", "clear"]) }),
|
|
21611
|
+
external_exports.strictObject({
|
|
21612
|
+
...thread,
|
|
21613
|
+
action: external_exports.enum(["create", "edit"]),
|
|
21614
|
+
objective: external_exports.string().trim().min(1).refine((objective) => Array.from(objective).length <= NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS, `A goal objective can have up to ${NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS} characters.`)
|
|
21615
|
+
})
|
|
21616
|
+
]);
|
|
21617
|
+
var nativeCodexGoalResultSchema = external_exports.object({
|
|
21618
|
+
goal: external_exports.object({
|
|
21619
|
+
threadId: hostThreadIdSchema,
|
|
21620
|
+
objective: external_exports.string(),
|
|
21621
|
+
status: external_exports.enum(["active", "paused", "blocked", "usageLimited", "budgetLimited", "complete"]),
|
|
21622
|
+
tokenBudget: external_exports.int().positive().nullable().default(null),
|
|
21623
|
+
tokensUsed: external_exports.int().nonnegative(),
|
|
21624
|
+
timeUsedSeconds: external_exports.int().nonnegative()
|
|
21625
|
+
}).nullable()
|
|
21626
|
+
});
|
|
21627
|
+
|
|
21605
21628
|
// ../../shared-contracts/dist/client-channel.js
|
|
21606
21629
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
21607
21630
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
21631
|
+
var THREAD_SECTION_CAPABILITY = "threadSectionsV1";
|
|
21632
|
+
var threadSectionName = external_exports.string().trim().min(1);
|
|
21633
|
+
var threadSectionId = external_exports.string().min(1);
|
|
21634
|
+
var threadSectionAppearance = external_exports.object({
|
|
21635
|
+
icon: external_exports.string().nullable(),
|
|
21636
|
+
color: external_exports.string().nullable()
|
|
21637
|
+
});
|
|
21638
|
+
var clientThreadSectionAppearanceSchema = threadSectionAppearance.nullable();
|
|
21639
|
+
var CLIENT_THREAD_SECTION_MUTATIONS = {
|
|
21640
|
+
create: {
|
|
21641
|
+
method: "codexhost/thread/sections/create",
|
|
21642
|
+
params: external_exports.object({ name: threadSectionName }).strict()
|
|
21643
|
+
},
|
|
21644
|
+
update: {
|
|
21645
|
+
method: "codexhost/thread/sections/update",
|
|
21646
|
+
params: external_exports.object({
|
|
21647
|
+
sectionId: threadSectionId,
|
|
21648
|
+
name: threadSectionName,
|
|
21649
|
+
appearance: threadSectionAppearance.strict().nullable().optional()
|
|
21650
|
+
}).strict()
|
|
21651
|
+
},
|
|
21652
|
+
delete: {
|
|
21653
|
+
method: "codexhost/thread/sections/delete",
|
|
21654
|
+
params: external_exports.object({ sectionId: threadSectionId }).strict()
|
|
21655
|
+
}
|
|
21656
|
+
};
|
|
21657
|
+
var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnion("status", [
|
|
21658
|
+
external_exports.object({ status: external_exports.literal("unknown") }),
|
|
21659
|
+
external_exports.object({
|
|
21660
|
+
status: external_exports.literal("confirmed"),
|
|
21661
|
+
sectionId: threadSectionId,
|
|
21662
|
+
section: external_exports.object({
|
|
21663
|
+
id: threadSectionId,
|
|
21664
|
+
name: external_exports.string().min(1),
|
|
21665
|
+
appearance: clientThreadSectionAppearanceSchema
|
|
21666
|
+
}).nullable(),
|
|
21667
|
+
syncPending: external_exports.boolean()
|
|
21668
|
+
})
|
|
21669
|
+
]);
|
|
21608
21670
|
var CLIENT_CHANNEL_METHODS = [
|
|
21609
21671
|
"codexhost/skills/list",
|
|
21610
21672
|
"codexhost/voice/status",
|
|
@@ -21614,10 +21676,12 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
21614
21676
|
"codexhost/harness/display-settings/capabilities",
|
|
21615
21677
|
"codexhost/harness/preferences/get",
|
|
21616
21678
|
"codexhost/harness/preferences/patch",
|
|
21679
|
+
"experimentalFeature/list",
|
|
21617
21680
|
"thread/list",
|
|
21618
21681
|
"thread/metadata/update",
|
|
21619
21682
|
"codexhost/thread/catalog/read",
|
|
21620
21683
|
"thread/read",
|
|
21684
|
+
NATIVE_CODEX_GOAL_METHOD,
|
|
21621
21685
|
"thread/resume",
|
|
21622
21686
|
"thread/fork",
|
|
21623
21687
|
"thread/turns/list",
|
|
@@ -21649,6 +21713,9 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
21649
21713
|
"codexhost/thread/pins/list",
|
|
21650
21714
|
"codexhost/thread/sections/list",
|
|
21651
21715
|
"codexhost/thread/sections/move",
|
|
21716
|
+
CLIENT_THREAD_SECTION_MUTATIONS.create.method,
|
|
21717
|
+
CLIENT_THREAD_SECTION_MUTATIONS.update.method,
|
|
21718
|
+
CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
|
|
21652
21719
|
"codexhost/thread/pins/set",
|
|
21653
21720
|
"codexhost/harness/plugins/list",
|
|
21654
21721
|
"codexhost/harness/inspect",
|
|
@@ -21699,16 +21766,21 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
21699
21766
|
"codexhost/sessions/loaded/list"
|
|
21700
21767
|
];
|
|
21701
21768
|
var clientThreadSectionsSchema = external_exports.object({
|
|
21769
|
+
[THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
|
|
21770
|
+
complete: external_exports.literal(false).optional(),
|
|
21702
21771
|
sections: external_exports.array(external_exports.object({
|
|
21703
21772
|
id: external_exports.string().min(1),
|
|
21704
21773
|
name: external_exports.string().min(1),
|
|
21774
|
+
appearance: clientThreadSectionAppearanceSchema.optional(),
|
|
21705
21775
|
threads: external_exports.array(jsonObjectSchema)
|
|
21706
|
-
})
|
|
21707
|
-
})
|
|
21776
|
+
}))
|
|
21777
|
+
});
|
|
21708
21778
|
var clientThreadSectionMoveSchema = external_exports.object({
|
|
21709
21779
|
threadId: external_exports.string().min(1).max(1024),
|
|
21710
|
-
sectionId: external_exports.string().min(1).max(1024).nullable()
|
|
21711
|
-
|
|
21780
|
+
sectionId: external_exports.string().min(1).max(1024).nullable(),
|
|
21781
|
+
beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
|
|
21782
|
+
expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
|
|
21783
|
+
}).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
|
|
21712
21784
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
21713
21785
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
21714
21786
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -21755,6 +21827,7 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
|
|
|
21755
21827
|
harnessId: external_exports.string().min(1)
|
|
21756
21828
|
}),
|
|
21757
21829
|
external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
|
|
21830
|
+
external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
|
|
21758
21831
|
external_exports.object({
|
|
21759
21832
|
type: external_exports.literal("preferences-changed"),
|
|
21760
21833
|
cursor: clientChannelCursorSchema,
|
|
@@ -21921,7 +21994,8 @@ var clientChannelDescriptorSchema = external_exports.object({
|
|
|
21921
21994
|
startedAt: external_exports.number(),
|
|
21922
21995
|
epoch: external_exports.string().uuid(),
|
|
21923
21996
|
capabilities: external_exports.object({
|
|
21924
|
-
peerDelegation: external_exports.literal(1).optional()
|
|
21997
|
+
peerDelegation: external_exports.literal(1).optional(),
|
|
21998
|
+
threadReferenceContext: external_exports.literal(1).optional()
|
|
21925
21999
|
}).optional()
|
|
21926
22000
|
});
|
|
21927
22001
|
var clientChannelResponseSchema = external_exports.object({
|
|
@@ -23515,7 +23589,7 @@ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
|
23515
23589
|
var target = {
|
|
23516
23590
|
hostId: identity.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)
|
|
23517
23591
|
};
|
|
23518
|
-
var
|
|
23592
|
+
var thread2 = { ...target, threadId: identity };
|
|
23519
23593
|
var text = external_exports.string().min(1).max(8e3);
|
|
23520
23594
|
var input2 = { text, requestId: identity };
|
|
23521
23595
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
@@ -23566,7 +23640,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23566
23640
|
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
23567
23641
|
reasoningEffort: identity.optional()
|
|
23568
23642
|
}),
|
|
23569
|
-
external_exports.strictObject({ kind: external_exports.literal("status"), ...
|
|
23643
|
+
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread2 }),
|
|
23570
23644
|
external_exports.strictObject({
|
|
23571
23645
|
kind: external_exports.literal("list"),
|
|
23572
23646
|
...target,
|
|
@@ -23576,7 +23650,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23576
23650
|
}),
|
|
23577
23651
|
external_exports.strictObject({
|
|
23578
23652
|
kind: external_exports.literal("read"),
|
|
23579
|
-
...
|
|
23653
|
+
...thread2,
|
|
23580
23654
|
page: external_exports.strictObject({
|
|
23581
23655
|
cursor: external_exports.string().min(1).max(8192).nullable(),
|
|
23582
23656
|
epoch: identity.optional(),
|
|
@@ -23586,10 +23660,10 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23586
23660
|
message: "A history continuation requires its connection epoch"
|
|
23587
23661
|
}).optional()
|
|
23588
23662
|
}),
|
|
23589
|
-
external_exports.strictObject({ kind: external_exports.literal("usage"), ...
|
|
23663
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread2, epoch: identity }),
|
|
23590
23664
|
external_exports.strictObject({
|
|
23591
23665
|
kind: external_exports.literal("configure"),
|
|
23592
|
-
...
|
|
23666
|
+
...thread2,
|
|
23593
23667
|
epoch: identity,
|
|
23594
23668
|
modelId: identity.optional(),
|
|
23595
23669
|
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
@@ -23600,15 +23674,15 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23600
23674
|
}),
|
|
23601
23675
|
external_exports.strictObject({
|
|
23602
23676
|
kind: external_exports.literal("prompt"),
|
|
23603
|
-
...
|
|
23677
|
+
...thread2,
|
|
23604
23678
|
epoch: identity,
|
|
23605
23679
|
text,
|
|
23606
23680
|
requestId: identity.optional()
|
|
23607
23681
|
}),
|
|
23608
|
-
external_exports.strictObject({ kind: external_exports.literal("queue"), ...
|
|
23682
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread2, epoch: identity }),
|
|
23609
23683
|
external_exports.strictObject({
|
|
23610
23684
|
kind: external_exports.literal("delivery"),
|
|
23611
|
-
...
|
|
23685
|
+
...thread2,
|
|
23612
23686
|
epoch: identity,
|
|
23613
23687
|
action: external_exports.discriminatedUnion("kind", [
|
|
23614
23688
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
@@ -23622,17 +23696,17 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23622
23696
|
external_exports.strictObject({ kind: external_exports.literal("sendNow"), itemId: identity })
|
|
23623
23697
|
])
|
|
23624
23698
|
}),
|
|
23625
|
-
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...
|
|
23699
|
+
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread2, epoch: identity, turnId: identity }),
|
|
23626
23700
|
external_exports.strictObject({
|
|
23627
23701
|
kind: external_exports.literal("rename"),
|
|
23628
|
-
...
|
|
23702
|
+
...thread2,
|
|
23629
23703
|
epoch: identity,
|
|
23630
23704
|
name: external_exports.string().min(1).max(512)
|
|
23631
23705
|
}),
|
|
23632
|
-
external_exports.strictObject({ kind: external_exports.literal("archive"), ...
|
|
23706
|
+
external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread2, epoch: identity, archived: external_exports.boolean() }),
|
|
23633
23707
|
external_exports.strictObject({
|
|
23634
23708
|
kind: external_exports.literal("respond"),
|
|
23635
|
-
...
|
|
23709
|
+
...thread2,
|
|
23636
23710
|
epoch: identity,
|
|
23637
23711
|
requestId: external_exports.union([identity, external_exports.number().int()]),
|
|
23638
23712
|
result: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
@@ -24627,7 +24701,8 @@ var CODEBUDDY_CAPABILITIES = {
|
|
|
24627
24701
|
permissionModeScope: "live"
|
|
24628
24702
|
},
|
|
24629
24703
|
history: { fork: true, forkAcrossCwd: false, rollbackLastTurn: true },
|
|
24630
|
-
subagents: { observe: true, readTranscript: true }
|
|
24704
|
+
subagents: { observe: true, readTranscript: true },
|
|
24705
|
+
autonomousTurns: { observe: true }
|
|
24631
24706
|
};
|
|
24632
24707
|
function capabilitiesForProfile(profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
24633
24708
|
return {
|
|
@@ -24823,16 +24898,16 @@ var Diff = class {
|
|
|
24823
24898
|
}
|
|
24824
24899
|
}
|
|
24825
24900
|
}
|
|
24826
|
-
addToPath(
|
|
24827
|
-
const last =
|
|
24901
|
+
addToPath(path13, added, removed, oldPosInc, options) {
|
|
24902
|
+
const last = path13.lastComponent;
|
|
24828
24903
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
24829
24904
|
return {
|
|
24830
|
-
oldPos:
|
|
24905
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
24831
24906
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
24832
24907
|
};
|
|
24833
24908
|
} else {
|
|
24834
24909
|
return {
|
|
24835
|
-
oldPos:
|
|
24910
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
24836
24911
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
24837
24912
|
};
|
|
24838
24913
|
}
|
|
@@ -25892,6 +25967,52 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
25892
25967
|
});
|
|
25893
25968
|
return { turns };
|
|
25894
25969
|
}
|
|
25970
|
+
function compactionEvidenceForTurn(contents, snapshot, turnKey, beforeItems, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
25971
|
+
if (!nativeCommandsEnabled(profile))
|
|
25972
|
+
return [];
|
|
25973
|
+
const turnIndex = snapshot.turns.findIndex((turn) => turn.nativeTurnRef.nativeTurnKey === turnKey);
|
|
25974
|
+
if (turnIndex < 0)
|
|
25975
|
+
return [];
|
|
25976
|
+
const history = nativeDisplayHistoryRows(contents);
|
|
25977
|
+
const start = history.findIndex((row) => row.type === "message" && row.role === "user" && text2(row.id) === turnKey);
|
|
25978
|
+
if (start < 0)
|
|
25979
|
+
return [];
|
|
25980
|
+
const turnKeys = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
25981
|
+
const attributable = /* @__PURE__ */ new Set();
|
|
25982
|
+
for (let index = start - 1; index >= 0; index -= 1) {
|
|
25983
|
+
const row = history[index];
|
|
25984
|
+
if (!row || !isNativeCompactionSummary(row))
|
|
25985
|
+
break;
|
|
25986
|
+
attributable.add(`compact-${text2(row.id)}`);
|
|
25987
|
+
}
|
|
25988
|
+
let nextTurn = history.length;
|
|
25989
|
+
for (let index = start + 1; index < history.length; index += 1) {
|
|
25990
|
+
const row = history[index];
|
|
25991
|
+
if (row?.type === "message" && row.role === "user" && turnKeys.has(text2(row.id))) {
|
|
25992
|
+
nextTurn = index;
|
|
25993
|
+
break;
|
|
25994
|
+
}
|
|
25995
|
+
}
|
|
25996
|
+
let bodyEnd = nextTurn - 1;
|
|
25997
|
+
if (nextTurn < history.length) {
|
|
25998
|
+
while (bodyEnd > start && isNativeCompactionSummary(history[bodyEnd] ?? {}))
|
|
25999
|
+
bodyEnd -= 1;
|
|
26000
|
+
}
|
|
26001
|
+
for (let index = start + 1; index <= bodyEnd; index += 1) {
|
|
26002
|
+
const row = history[index];
|
|
26003
|
+
if (!row)
|
|
26004
|
+
continue;
|
|
26005
|
+
const data = record3(row.providerData);
|
|
26006
|
+
if (isNativeCompactionSummary(row) || row.role === "assistant" && (data.agent === "compact" || data.isCompactInternal === true)) {
|
|
26007
|
+
attributable.add(`compact-${text2(row.id)}`);
|
|
26008
|
+
}
|
|
26009
|
+
}
|
|
26010
|
+
const candidates = [
|
|
26011
|
+
...turnIndex > 0 ? snapshot.turns[turnIndex - 1]?.items ?? [] : [],
|
|
26012
|
+
...snapshot.turns[turnIndex]?.items ?? []
|
|
26013
|
+
];
|
|
26014
|
+
return candidates.filter(({ item }) => item.type === "contextCompaction" && !beforeItems.has(item.itemId) && attributable.has(item.itemId));
|
|
26015
|
+
}
|
|
25895
26016
|
function usageCount(value) {
|
|
25896
26017
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
25897
26018
|
}
|
|
@@ -26045,7 +26166,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
|
|
|
26045
26166
|
import { stat as stat3 } from "node:fs/promises";
|
|
26046
26167
|
|
|
26047
26168
|
// dist/acp-client.js
|
|
26048
|
-
import {
|
|
26169
|
+
import { spawn } from "node:child_process";
|
|
26049
26170
|
import { Readable as Readable2, Writable } from "node:stream";
|
|
26050
26171
|
|
|
26051
26172
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -30279,7 +30400,103 @@ var CodeBuddyCopyCleanup = class {
|
|
|
30279
30400
|
}
|
|
30280
30401
|
};
|
|
30281
30402
|
|
|
30403
|
+
// dist/process-termination.js
|
|
30404
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
30405
|
+
import path8 from "node:path";
|
|
30406
|
+
var WINDOWS_TASKKILL_TIMEOUT_MS = 45e3;
|
|
30407
|
+
var MAX_DIAGNOSTIC_LENGTH = 400;
|
|
30408
|
+
var taskkillQueue = Promise.resolve();
|
|
30409
|
+
function windowsTaskkillPath(env = process.env) {
|
|
30410
|
+
const root = env.SystemRoot ?? env.SYSTEMROOT;
|
|
30411
|
+
return root && path8.win32.isAbsolute(root) ? path8.win32.join(root, "System32", "taskkill.exe") : "taskkill";
|
|
30412
|
+
}
|
|
30413
|
+
function compactDiagnostic(value) {
|
|
30414
|
+
const sanitized = sanitizeDiagnosticTail(value).replace(/\s+/gu, " ").trim();
|
|
30415
|
+
return sanitized.length <= MAX_DIAGNOSTIC_LENGTH ? sanitized : `${sanitized.slice(0, MAX_DIAGNOSTIC_LENGTH)}...`;
|
|
30416
|
+
}
|
|
30417
|
+
function formatTaskkillError(error62, stderr) {
|
|
30418
|
+
const info = typeof error62 === "object" && error62 !== null ? error62 : {};
|
|
30419
|
+
const parts = [
|
|
30420
|
+
...info.code != null ? [`code=${String(info.code)}`] : [],
|
|
30421
|
+
...info.signal ? [`signal=${info.signal}`] : [],
|
|
30422
|
+
`killed=${Boolean(info.killed)}`
|
|
30423
|
+
];
|
|
30424
|
+
const rawStderr = typeof stderr === "string" ? stderr : Buffer.isBuffer(stderr) ? stderr.toString("utf8") : typeof info.stderr === "string" ? info.stderr : "";
|
|
30425
|
+
const detail = compactDiagnostic(rawStderr);
|
|
30426
|
+
if (detail)
|
|
30427
|
+
parts.push(`stderr=${detail}`);
|
|
30428
|
+
else {
|
|
30429
|
+
const message = compactDiagnostic(error62 instanceof Error ? error62.message : String(error62));
|
|
30430
|
+
if (message)
|
|
30431
|
+
parts.push(`error=${message}`);
|
|
30432
|
+
}
|
|
30433
|
+
return `taskkill failed (${parts.join(", ")})`;
|
|
30434
|
+
}
|
|
30435
|
+
async function terminateWindowsProcessTree(child, exited, timeoutMs = WINDOWS_TASKKILL_TIMEOUT_MS) {
|
|
30436
|
+
const exitedNow = () => child.exitCode !== null || child.signalCode !== null;
|
|
30437
|
+
if (!child.pid || exitedNow())
|
|
30438
|
+
return void 0;
|
|
30439
|
+
const deadline = Date.now() + timeoutMs;
|
|
30440
|
+
const previous = taskkillQueue;
|
|
30441
|
+
const slot = Promise.withResolvers();
|
|
30442
|
+
taskkillQueue = previous.then(() => slot.promise);
|
|
30443
|
+
let timer;
|
|
30444
|
+
const status = await Promise.race([
|
|
30445
|
+
previous.then(() => "ready"),
|
|
30446
|
+
exited.then(() => "exited"),
|
|
30447
|
+
new Promise((resolve) => {
|
|
30448
|
+
timer = setTimeout(() => resolve("timeout"), Math.max(0, deadline - Date.now()));
|
|
30449
|
+
})
|
|
30450
|
+
]).finally(() => clearTimeout(timer));
|
|
30451
|
+
if (status === "exited" || exitedNow()) {
|
|
30452
|
+
slot.resolve();
|
|
30453
|
+
return void 0;
|
|
30454
|
+
}
|
|
30455
|
+
const remainingMs = deadline - Date.now();
|
|
30456
|
+
if (status === "timeout" || remainingMs <= 0) {
|
|
30457
|
+
slot.resolve();
|
|
30458
|
+
return `taskkill timed out waiting in termination queue after ${timeoutMs}ms`;
|
|
30459
|
+
}
|
|
30460
|
+
const execution = new Promise((resolve) => {
|
|
30461
|
+
try {
|
|
30462
|
+
execFile2(windowsTaskkillPath(), ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: remainingMs }, (error62, _stdout, stderr) => {
|
|
30463
|
+
slot.resolve();
|
|
30464
|
+
resolve(error62 ? formatTaskkillError(error62, stderr) : void 0);
|
|
30465
|
+
});
|
|
30466
|
+
} catch (error62) {
|
|
30467
|
+
slot.resolve();
|
|
30468
|
+
resolve(formatTaskkillError(error62));
|
|
30469
|
+
}
|
|
30470
|
+
});
|
|
30471
|
+
return Promise.race([execution, exited.then(() => void 0)]);
|
|
30472
|
+
}
|
|
30473
|
+
|
|
30282
30474
|
// dist/acp-client.js
|
|
30475
|
+
var sessionEndCarrier = "codexhost.codebuddy/sessionEnd";
|
|
30476
|
+
function carrySessionEnd(message) {
|
|
30477
|
+
if (!("method" in message) || message.method !== "session/update")
|
|
30478
|
+
return message;
|
|
30479
|
+
const params = record3(message.params);
|
|
30480
|
+
const update = record3(params.update);
|
|
30481
|
+
if (update.sessionUpdate !== "session_end")
|
|
30482
|
+
return message;
|
|
30483
|
+
return {
|
|
30484
|
+
...message,
|
|
30485
|
+
params: {
|
|
30486
|
+
...params,
|
|
30487
|
+
update: { sessionUpdate: "session_info_update", _meta: { [sessionEndCarrier]: update } }
|
|
30488
|
+
}
|
|
30489
|
+
};
|
|
30490
|
+
}
|
|
30491
|
+
function restoreSessionEnd(notification) {
|
|
30492
|
+
const update = notification.update;
|
|
30493
|
+
if (update.sessionUpdate !== "session_info_update" || !update._meta?.[sessionEndCarrier])
|
|
30494
|
+
return notification;
|
|
30495
|
+
return {
|
|
30496
|
+
...notification,
|
|
30497
|
+
update: update._meta[sessionEndCarrier]
|
|
30498
|
+
};
|
|
30499
|
+
}
|
|
30283
30500
|
var CodeBuddyAcpClient = class {
|
|
30284
30501
|
options;
|
|
30285
30502
|
operationTimeoutMs;
|
|
@@ -30288,6 +30505,9 @@ var CodeBuddyAcpClient = class {
|
|
|
30288
30505
|
#child;
|
|
30289
30506
|
#connection;
|
|
30290
30507
|
#exited;
|
|
30508
|
+
#exitedSettled = false;
|
|
30509
|
+
#closeRequested = false;
|
|
30510
|
+
#stdinEnded = false;
|
|
30291
30511
|
#closing;
|
|
30292
30512
|
#failure;
|
|
30293
30513
|
#exitFailure;
|
|
@@ -30312,14 +30532,17 @@ var CodeBuddyAcpClient = class {
|
|
|
30312
30532
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
30313
30533
|
detached: process.platform !== "win32"
|
|
30314
30534
|
});
|
|
30315
|
-
this.#exited = new Promise((resolve) => this.#child.once("close", () =>
|
|
30535
|
+
this.#exited = new Promise((resolve) => this.#child.once("close", () => {
|
|
30536
|
+
this.#exitedSettled = true;
|
|
30537
|
+
resolve();
|
|
30538
|
+
}));
|
|
30316
30539
|
this.#child.stderr.on("data", () => {
|
|
30317
30540
|
});
|
|
30318
30541
|
this.#child.on("error", (error62) => {
|
|
30319
30542
|
this.#fault(error62);
|
|
30320
30543
|
});
|
|
30321
30544
|
this.#child.once("exit", (code, signal) => {
|
|
30322
|
-
if (this.#
|
|
30545
|
+
if (this.#closeRequested || this.#failure)
|
|
30323
30546
|
return;
|
|
30324
30547
|
const error62 = new CodeBuddyError("processExited", `ACP process exited (${code ?? signal ?? "unknown"})`);
|
|
30325
30548
|
this.#exitFailure = error62;
|
|
@@ -30329,26 +30552,37 @@ var CodeBuddyAcpClient = class {
|
|
|
30329
30552
|
});
|
|
30330
30553
|
this.#connection = new ClientSideConnection(() => ({
|
|
30331
30554
|
sessionUpdate: async (notification) => {
|
|
30332
|
-
if (!this.#
|
|
30333
|
-
options.handlers.update(notification);
|
|
30555
|
+
if (!this.#closeRequested && !this.#failure)
|
|
30556
|
+
options.handlers.update(restoreSessionEnd(notification));
|
|
30334
30557
|
},
|
|
30335
|
-
requestPermission: (request) => !this.#exitFailure && !this.#
|
|
30558
|
+
requestPermission: (request) => !this.#exitFailure && !this.#closeRequested && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
|
|
30336
30559
|
extMethod: async (method, params) => {
|
|
30337
30560
|
if (method !== "_codebuddy.ai/question")
|
|
30338
30561
|
throw RequestError.methodNotFound(method);
|
|
30339
|
-
if (this.#exitFailure || this.#
|
|
30562
|
+
if (this.#exitFailure || this.#closeRequested || this.#failure)
|
|
30340
30563
|
return { outcome: "cancelled" };
|
|
30341
30564
|
return options.handlers.question(params);
|
|
30342
30565
|
}
|
|
30343
|
-
}),
|
|
30566
|
+
}), this.#protocolStream(invocation.arguments.includes("--serve")));
|
|
30344
30567
|
void this.#connection.closed.then(() => {
|
|
30345
30568
|
this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
|
|
30346
30569
|
}).catch((error62) => {
|
|
30347
30570
|
this.#fault(error62);
|
|
30348
30571
|
});
|
|
30349
30572
|
}
|
|
30573
|
+
#protocolStream(serve) {
|
|
30574
|
+
const stream = ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (serve ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout)));
|
|
30575
|
+
return {
|
|
30576
|
+
writable: stream.writable,
|
|
30577
|
+
readable: stream.readable.pipeThrough(new TransformStream({
|
|
30578
|
+
transform: (message, controller) => {
|
|
30579
|
+
controller.enqueue(carrySessionEnd(message));
|
|
30580
|
+
}
|
|
30581
|
+
}))
|
|
30582
|
+
};
|
|
30583
|
+
}
|
|
30350
30584
|
#fault(error62) {
|
|
30351
|
-
if (this.#
|
|
30585
|
+
if (this.#closeRequested || this.#failure)
|
|
30352
30586
|
return;
|
|
30353
30587
|
clearTimeout(this.#exitDrainTimer);
|
|
30354
30588
|
this.#failure = error62;
|
|
@@ -30362,7 +30596,7 @@ var CodeBuddyAcpClient = class {
|
|
|
30362
30596
|
throw this.#failure;
|
|
30363
30597
|
if (this.#exitFailure)
|
|
30364
30598
|
throw this.#exitFailure;
|
|
30365
|
-
if (this.#
|
|
30599
|
+
if (this.#closeRequested)
|
|
30366
30600
|
throw new CodeBuddyError("invalidState", "ACP client is closed");
|
|
30367
30601
|
const work = Promise.race([operation(), this.#failed]);
|
|
30368
30602
|
return label ? bounded(work, timeout, label, (error62) => this.#fault(error62)) : work;
|
|
@@ -30415,16 +30649,29 @@ var CodeBuddyAcpClient = class {
|
|
|
30415
30649
|
throw new CodeBuddyError("protocolError", "Native question is no longer pending");
|
|
30416
30650
|
}
|
|
30417
30651
|
close() {
|
|
30652
|
+
this.#closeRequested = true;
|
|
30418
30653
|
clearTimeout(this.#exitDrainTimer);
|
|
30419
30654
|
this.#rejectFailure(new CodeBuddyError("invalidState", "ACP client is closed"));
|
|
30420
|
-
this.#closing
|
|
30421
|
-
|
|
30655
|
+
if (this.#closing)
|
|
30656
|
+
return this.#closing;
|
|
30657
|
+
const closing = this.#closeProcess().catch((error62) => {
|
|
30658
|
+
if (this.#closing === closing)
|
|
30659
|
+
this.#closing = void 0;
|
|
30660
|
+
throw error62;
|
|
30661
|
+
});
|
|
30662
|
+
this.#closing = closing;
|
|
30663
|
+
return closing;
|
|
30422
30664
|
}
|
|
30423
30665
|
async #closeProcess() {
|
|
30424
|
-
this.#
|
|
30425
|
-
const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
|
|
30426
|
-
if (exited)
|
|
30666
|
+
if (this.#exitedSettled)
|
|
30427
30667
|
return;
|
|
30668
|
+
if (!this.#stdinEnded) {
|
|
30669
|
+
this.#stdinEnded = true;
|
|
30670
|
+
this.#child.stdin.end();
|
|
30671
|
+
const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
|
|
30672
|
+
if (exited)
|
|
30673
|
+
return;
|
|
30674
|
+
}
|
|
30428
30675
|
if (this.#child.exitCode !== null || this.#child.signalCode !== null) {
|
|
30429
30676
|
this.#child.stdout.destroy();
|
|
30430
30677
|
this.#child.stderr.destroy();
|
|
@@ -30432,23 +30679,31 @@ var CodeBuddyAcpClient = class {
|
|
|
30432
30679
|
return;
|
|
30433
30680
|
}
|
|
30434
30681
|
const pid = this.#child.pid;
|
|
30682
|
+
let terminationDetail;
|
|
30435
30683
|
if (pid && process.platform === "win32") {
|
|
30436
|
-
|
|
30684
|
+
terminationDetail = await terminateWindowsProcessTree(this.#child, this.#exited);
|
|
30437
30685
|
} else if (pid) {
|
|
30438
30686
|
try {
|
|
30439
30687
|
process.kill(-pid, "SIGKILL");
|
|
30440
30688
|
} catch {
|
|
30441
30689
|
}
|
|
30442
30690
|
}
|
|
30443
|
-
|
|
30691
|
+
try {
|
|
30692
|
+
await bounded(this.#exited, 3e3, "ACP process exit");
|
|
30693
|
+
} catch (error62) {
|
|
30694
|
+
if (terminationDetail && error62 instanceof CodeBuddyError) {
|
|
30695
|
+
throw new CodeBuddyError(error62.code, `${error62.message} (${terminationDetail})`);
|
|
30696
|
+
}
|
|
30697
|
+
throw error62;
|
|
30698
|
+
}
|
|
30444
30699
|
}
|
|
30445
30700
|
};
|
|
30446
30701
|
|
|
30447
30702
|
// dist/derivation.js
|
|
30448
30703
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
30449
|
-
import {
|
|
30704
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
30450
30705
|
import { lstat as lstat2, mkdir, readFile as readFile3, realpath as realpath5, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
30451
|
-
import
|
|
30706
|
+
import path9 from "node:path";
|
|
30452
30707
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
30453
30708
|
|
|
30454
30709
|
// dist/child-provenance.js
|
|
@@ -30685,8 +30940,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
|
|
|
30685
30940
|
windowsVerbatimArguments: invocation.windowsVerbatimArguments,
|
|
30686
30941
|
detached: process.platform !== "win32"
|
|
30687
30942
|
});
|
|
30943
|
+
const exited = new Promise((resolve2) => child.once("close", () => resolve2()));
|
|
30688
30944
|
let output2 = "", bytes = 0, failed = false;
|
|
30689
30945
|
let termination = Promise.resolve();
|
|
30946
|
+
let terminationDetail;
|
|
30690
30947
|
const stop = () => {
|
|
30691
30948
|
if (failed)
|
|
30692
30949
|
return;
|
|
@@ -30695,11 +30952,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
|
|
|
30695
30952
|
child.stdout.destroy();
|
|
30696
30953
|
child.stderr.destroy();
|
|
30697
30954
|
} else if (process.platform === "win32" && child.pid) {
|
|
30698
|
-
termination =
|
|
30699
|
-
|
|
30955
|
+
termination = terminateWindowsProcessTree(child, exited).then((detail) => {
|
|
30956
|
+
terminationDetail = detail;
|
|
30957
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
30700
30958
|
child.kill();
|
|
30701
|
-
done();
|
|
30702
|
-
});
|
|
30703
30959
|
});
|
|
30704
30960
|
} else if (child.pid) {
|
|
30705
30961
|
try {
|
|
@@ -30729,7 +30985,8 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
|
|
|
30729
30985
|
clearTimeout(timer);
|
|
30730
30986
|
signal.removeEventListener("abort", stop);
|
|
30731
30987
|
if (failed || signal.aborted || code !== 0) {
|
|
30732
|
-
|
|
30988
|
+
const message = terminationDetail ? `Native history copy failed or was interrupted (${terminationDetail})` : "Native history copy failed or was interrupted";
|
|
30989
|
+
reject(new CodeBuddyError("nativeFailure", message));
|
|
30733
30990
|
return;
|
|
30734
30991
|
}
|
|
30735
30992
|
try {
|
|
@@ -30805,14 +31062,14 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
|
|
|
30805
31062
|
const targetFile = codeBuddyPrimaryHistoryPath(targetCwd, ref, environment, profile);
|
|
30806
31063
|
if (sameResolvedPath(sourceFile, targetFile))
|
|
30807
31064
|
return void 0;
|
|
30808
|
-
const targetDirectory =
|
|
30809
|
-
const projectsDirectory =
|
|
31065
|
+
const targetDirectory = path9.dirname(targetFile);
|
|
31066
|
+
const projectsDirectory = path9.dirname(targetDirectory);
|
|
30810
31067
|
await mkdir(targetDirectory, { recursive: true });
|
|
30811
31068
|
const [realProjects, realTargetDirectory] = await Promise.all([
|
|
30812
31069
|
realpath5(projectsDirectory),
|
|
30813
31070
|
realpath5(targetDirectory)
|
|
30814
31071
|
]);
|
|
30815
|
-
if (!sameResolvedPath(realTargetDirectory,
|
|
31072
|
+
if (!sameResolvedPath(realTargetDirectory, path9.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
|
|
30816
31073
|
throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
|
|
30817
31074
|
const expected = Buffer.from(contents, "utf8");
|
|
30818
31075
|
await writeFile2(targetFile, expected, { flag: "wx", mode: 384 });
|
|
@@ -30922,7 +31179,7 @@ function assertChildRanges(rows2, child) {
|
|
|
30922
31179
|
}
|
|
30923
31180
|
}
|
|
30924
31181
|
async function plainDirectory(parent, name) {
|
|
30925
|
-
const directory =
|
|
31182
|
+
const directory = path9.join(parent, name);
|
|
30926
31183
|
await mkdir(directory, { mode: 448 }).catch((error62) => {
|
|
30927
31184
|
if (record3(error62).code !== "EEXIST")
|
|
30928
31185
|
throw error62;
|
|
@@ -30968,18 +31225,18 @@ async function copyInheritedChildren(options) {
|
|
|
30968
31225
|
if (!references.length)
|
|
30969
31226
|
return { descriptors: [], created: [] };
|
|
30970
31227
|
const sourceHistoryFile = await realpath5(options.sourceHistoryFile);
|
|
30971
|
-
const sourceProject =
|
|
30972
|
-
if (!sameResolvedPath(sourceHistoryFile,
|
|
31228
|
+
const sourceProject = path9.dirname(sourceHistoryFile);
|
|
31229
|
+
if (!sameResolvedPath(sourceHistoryFile, path9.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
|
|
30973
31230
|
throw new CodeBuddyError("invalidRequest", "Unexpected source history location");
|
|
30974
|
-
const sourceDirectory =
|
|
31231
|
+
const sourceDirectory = path9.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
|
|
30975
31232
|
const sourceDirectoryInfo = await lstat2(sourceDirectory);
|
|
30976
31233
|
if (!sourceDirectoryInfo.isDirectory() || sourceDirectoryInfo.isSymbolicLink())
|
|
30977
31234
|
throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
|
|
30978
31235
|
if (!sameResolvedPath(await realpath5(sourceDirectory), sourceDirectory))
|
|
30979
31236
|
throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
|
|
30980
31237
|
const targetHistoryFile = await realpath5(options.targetHistoryFile);
|
|
30981
|
-
const targetProject =
|
|
30982
|
-
if (!sameResolvedPath(targetHistoryFile,
|
|
31238
|
+
const targetProject = path9.dirname(targetHistoryFile);
|
|
31239
|
+
if (!sameResolvedPath(targetHistoryFile, path9.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
|
|
30983
31240
|
throw new CodeBuddyError("invalidRequest", "Unexpected target history location");
|
|
30984
31241
|
const targetSessionDirectory = await plainDirectory(targetProject, options.targetRef.nativeSessionId);
|
|
30985
31242
|
const targetDirectory = await plainDirectory(targetSessionDirectory, "subagents");
|
|
@@ -30987,7 +31244,7 @@ async function copyInheritedChildren(options) {
|
|
|
30987
31244
|
const created = [];
|
|
30988
31245
|
try {
|
|
30989
31246
|
for (const reference of references) {
|
|
30990
|
-
const sourceFile =
|
|
31247
|
+
const sourceFile = path9.join(sourceDirectory, `${reference.childId}.jsonl`);
|
|
30991
31248
|
const sourceInfo = await lstat2(sourceFile);
|
|
30992
31249
|
if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink())
|
|
30993
31250
|
throw new CodeBuddyError("invalidRequest", "Redirected source Subagent transcript");
|
|
@@ -31006,7 +31263,7 @@ async function copyInheritedChildren(options) {
|
|
|
31006
31263
|
throw new CodeBuddyError("protocolError", "Missing Agent result child range");
|
|
31007
31264
|
const prefix = await codeBuddyChildPrefixThrough(source.contents, last, validated);
|
|
31008
31265
|
const expected = Buffer.from(prefix.contents, "utf8");
|
|
31009
|
-
const targetFile =
|
|
31266
|
+
const targetFile = path9.join(targetDirectory, `${reference.childId}.jsonl`);
|
|
31010
31267
|
const copy = await persistChildCopy(targetFile, expected);
|
|
31011
31268
|
if (copy)
|
|
31012
31269
|
created.push(copy);
|
|
@@ -31246,7 +31503,7 @@ async function deriveCodeBuddySession(options) {
|
|
|
31246
31503
|
// dist/session-import.js
|
|
31247
31504
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
31248
31505
|
import { opendir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
|
|
31249
|
-
import
|
|
31506
|
+
import path10 from "node:path";
|
|
31250
31507
|
import { createInterface as createInterface2 } from "node:readline";
|
|
31251
31508
|
|
|
31252
31509
|
// ../../harness-adapter/dist/session-import.js
|
|
@@ -31409,7 +31666,7 @@ async function readFacts(file2, signal) {
|
|
|
31409
31666
|
return null;
|
|
31410
31667
|
}
|
|
31411
31668
|
const row = record3(parsed);
|
|
31412
|
-
if (typeof row.cwd === "string" &&
|
|
31669
|
+
if (typeof row.cwd === "string" && path10.isAbsolute(row.cwd))
|
|
31413
31670
|
cwd ??= row.cwd;
|
|
31414
31671
|
if (typeof row.timestamp === "number" && Number.isFinite(row.timestamp))
|
|
31415
31672
|
updatedAt = row.timestamp;
|
|
@@ -31482,7 +31739,7 @@ var CodeBuddySessionImport = class {
|
|
|
31482
31739
|
/** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
|
|
31483
31740
|
async #activeSessions(signal) {
|
|
31484
31741
|
const active2 = /* @__PURE__ */ new Set();
|
|
31485
|
-
const directory =
|
|
31742
|
+
const directory = path10.join(this.#root(), "sessions");
|
|
31486
31743
|
const markers = await opendir(directory).catch((error62) => {
|
|
31487
31744
|
if (isMissingFileError(error62) || record3(error62).code === "ENOTDIR")
|
|
31488
31745
|
return null;
|
|
@@ -31495,7 +31752,7 @@ var CodeBuddySessionImport = class {
|
|
|
31495
31752
|
if (!marker.isFile() || !marker.name.endsWith(".json"))
|
|
31496
31753
|
continue;
|
|
31497
31754
|
try {
|
|
31498
|
-
const file2 =
|
|
31755
|
+
const file2 = path10.join(directory, marker.name);
|
|
31499
31756
|
if ((await stat2(file2)).size > MAX_MARKER_BYTES)
|
|
31500
31757
|
continue;
|
|
31501
31758
|
const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
|
|
@@ -31511,7 +31768,7 @@ var CodeBuddySessionImport = class {
|
|
|
31511
31768
|
}
|
|
31512
31769
|
/** Session ID to every project file claiming it. Enumerated links are not followed. */
|
|
31513
31770
|
async #sessionFiles(signal) {
|
|
31514
|
-
const root =
|
|
31771
|
+
const root = path10.join(this.#root(), "projects");
|
|
31515
31772
|
const found = /* @__PURE__ */ new Map();
|
|
31516
31773
|
const info = await optionalLstat(root);
|
|
31517
31774
|
if (!info)
|
|
@@ -31522,7 +31779,7 @@ var CodeBuddySessionImport = class {
|
|
|
31522
31779
|
signal.throwIfAborted();
|
|
31523
31780
|
if (!project2.isDirectory())
|
|
31524
31781
|
continue;
|
|
31525
|
-
const projectDirectory =
|
|
31782
|
+
const projectDirectory = path10.join(root, project2.name);
|
|
31526
31783
|
const entries = await opendir(projectDirectory).catch((error62) => {
|
|
31527
31784
|
if (isMissingFileError(error62))
|
|
31528
31785
|
return null;
|
|
@@ -31536,7 +31793,7 @@ var CodeBuddySessionImport = class {
|
|
|
31536
31793
|
if (!nativeSessionId)
|
|
31537
31794
|
continue;
|
|
31538
31795
|
const files = found.get(nativeSessionId) ?? [];
|
|
31539
|
-
files.push(
|
|
31796
|
+
files.push(path10.join(projectDirectory, entry.name));
|
|
31540
31797
|
found.set(nativeSessionId, files);
|
|
31541
31798
|
}
|
|
31542
31799
|
}
|
|
@@ -31551,7 +31808,7 @@ var CodeBuddySessionImport = class {
|
|
|
31551
31808
|
const facts = await readFacts(file2, signal);
|
|
31552
31809
|
if (!facts)
|
|
31553
31810
|
return null;
|
|
31554
|
-
const cwd =
|
|
31811
|
+
const cwd = path10.resolve(facts.cwd);
|
|
31555
31812
|
if (!(await stat2(cwd)).isDirectory())
|
|
31556
31813
|
return null;
|
|
31557
31814
|
const nativeRef = nativeSessionRefSchema.parse({
|
|
@@ -31561,7 +31818,7 @@ var CodeBuddySessionImport = class {
|
|
|
31561
31818
|
});
|
|
31562
31819
|
signal.throwIfAborted();
|
|
31563
31820
|
const history = await codeBuddyNativeHistory(cwd, nativeRef, this.#environment, this.#profile);
|
|
31564
|
-
if (
|
|
31821
|
+
if (path10.resolve(history.file) !== path10.resolve(file2))
|
|
31565
31822
|
return null;
|
|
31566
31823
|
const candidate = sessionImportCandidate({
|
|
31567
31824
|
nativeSessionId,
|
|
@@ -31582,6 +31839,125 @@ var CodeBuddySessionImport = class {
|
|
|
31582
31839
|
}
|
|
31583
31840
|
};
|
|
31584
31841
|
|
|
31842
|
+
// dist/session.js
|
|
31843
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
31844
|
+
|
|
31845
|
+
// dist/autonomous.js
|
|
31846
|
+
import { Buffer as Buffer3 } from "node:buffer";
|
|
31847
|
+
function readUnsolicitedTurn(update) {
|
|
31848
|
+
if (update.sessionUpdate !== "session_info_update")
|
|
31849
|
+
return;
|
|
31850
|
+
const announcement = record3(record3(update._meta)["codebuddy.ai/unsolicitedTurn"]);
|
|
31851
|
+
return announcement.reason === "background_drain" ? text2(announcement.requestId) || void 0 : void 0;
|
|
31852
|
+
}
|
|
31853
|
+
var AutonomousBufferBudget = class {
|
|
31854
|
+
#frames = 0;
|
|
31855
|
+
#bytes = 0;
|
|
31856
|
+
hold(value) {
|
|
31857
|
+
const bytes = Buffer3.byteLength(JSON.stringify(value), "utf8");
|
|
31858
|
+
if (this.#frames >= 2048 || this.#bytes + bytes > 4 * 1024 * 1024)
|
|
31859
|
+
throw new CodeBuddyError("protocolError", "Native autonomous Turn output exceeded its buffer bound");
|
|
31860
|
+
this.#frames += 1;
|
|
31861
|
+
this.#bytes += bytes;
|
|
31862
|
+
return bytes;
|
|
31863
|
+
}
|
|
31864
|
+
release(frames, bytes) {
|
|
31865
|
+
this.#frames -= frames;
|
|
31866
|
+
this.#bytes -= bytes;
|
|
31867
|
+
}
|
|
31868
|
+
};
|
|
31869
|
+
var CodeBuddyAutonomousFrames = class {
|
|
31870
|
+
budget;
|
|
31871
|
+
#frames = [];
|
|
31872
|
+
#bytes = 0;
|
|
31873
|
+
constructor(budget) {
|
|
31874
|
+
this.budget = budget;
|
|
31875
|
+
}
|
|
31876
|
+
push(frame) {
|
|
31877
|
+
this.#bytes += this.budget.hold(frame);
|
|
31878
|
+
this.#frames.push(frame);
|
|
31879
|
+
}
|
|
31880
|
+
drain() {
|
|
31881
|
+
this.budget.release(this.#frames.length, this.#bytes);
|
|
31882
|
+
this.#bytes = 0;
|
|
31883
|
+
return this.#frames.splice(0);
|
|
31884
|
+
}
|
|
31885
|
+
};
|
|
31886
|
+
var CodeBuddyAutonomousTurns = class {
|
|
31887
|
+
#rounds = [];
|
|
31888
|
+
#budget = new AutonomousBufferBudget();
|
|
31889
|
+
#open;
|
|
31890
|
+
#announcements = 0;
|
|
31891
|
+
get announcements() {
|
|
31892
|
+
return this.#announcements;
|
|
31893
|
+
}
|
|
31894
|
+
announce(requestId) {
|
|
31895
|
+
if (this.#open)
|
|
31896
|
+
throw new CodeBuddyError("protocolError", "Native autonomous Turns overlapped");
|
|
31897
|
+
const announcementBytes = this.#budget.hold({
|
|
31898
|
+
sessionUpdate: "session_info_update",
|
|
31899
|
+
requestId
|
|
31900
|
+
});
|
|
31901
|
+
const identity2 = Promise.withResolvers();
|
|
31902
|
+
const round = {
|
|
31903
|
+
frames: new CodeBuddyAutonomousFrames(this.#budget),
|
|
31904
|
+
identity: identity2.promise,
|
|
31905
|
+
resolveIdentity: identity2.resolve,
|
|
31906
|
+
announcementBytes,
|
|
31907
|
+
ended: false,
|
|
31908
|
+
started: false
|
|
31909
|
+
};
|
|
31910
|
+
this.#announcements += 1;
|
|
31911
|
+
this.#rounds.push(round);
|
|
31912
|
+
this.#open = round;
|
|
31913
|
+
return round;
|
|
31914
|
+
}
|
|
31915
|
+
/** IDs can be reused or change during admission; the connection interval owns the end. */
|
|
31916
|
+
end(requestId) {
|
|
31917
|
+
const round = this.#open;
|
|
31918
|
+
if (!round)
|
|
31919
|
+
return;
|
|
31920
|
+
round.terminalBytes = this.#budget.hold({ sessionUpdate: "session_end", requestId });
|
|
31921
|
+
round.ended = true;
|
|
31922
|
+
this.#open = void 0;
|
|
31923
|
+
return round;
|
|
31924
|
+
}
|
|
31925
|
+
start(round, turnId) {
|
|
31926
|
+
round.started = true;
|
|
31927
|
+
round.resolveIdentity(turnId);
|
|
31928
|
+
}
|
|
31929
|
+
owner() {
|
|
31930
|
+
return this.#open;
|
|
31931
|
+
}
|
|
31932
|
+
hasRounds() {
|
|
31933
|
+
return this.#rounds.length > 0;
|
|
31934
|
+
}
|
|
31935
|
+
interactionIdentity(round, request) {
|
|
31936
|
+
const bytes = this.#budget.hold(request);
|
|
31937
|
+
return round.identity.finally(() => this.#budget.release(1, bytes));
|
|
31938
|
+
}
|
|
31939
|
+
next() {
|
|
31940
|
+
return this.#rounds.find((round) => !round.started);
|
|
31941
|
+
}
|
|
31942
|
+
finish(round) {
|
|
31943
|
+
const index = this.#rounds.indexOf(round);
|
|
31944
|
+
if (index < 0)
|
|
31945
|
+
return;
|
|
31946
|
+
round.frames.drain();
|
|
31947
|
+
this.#budget.release(1, round.announcementBytes);
|
|
31948
|
+
if (round.terminalBytes !== void 0)
|
|
31949
|
+
this.#budget.release(1, round.terminalBytes);
|
|
31950
|
+
this.#rounds.splice(index, 1);
|
|
31951
|
+
if (this.#open === round)
|
|
31952
|
+
this.#open = void 0;
|
|
31953
|
+
round.resolveIdentity(void 0);
|
|
31954
|
+
}
|
|
31955
|
+
close() {
|
|
31956
|
+
for (const round of [...this.#rounds])
|
|
31957
|
+
this.finish(round);
|
|
31958
|
+
}
|
|
31959
|
+
};
|
|
31960
|
+
|
|
31585
31961
|
// dist/interactions.js
|
|
31586
31962
|
var CodeBuddyInteractions = class {
|
|
31587
31963
|
emit;
|
|
@@ -31725,7 +32101,7 @@ var CodeBuddyInteractions = class {
|
|
|
31725
32101
|
|
|
31726
32102
|
// dist/subagent-history.js
|
|
31727
32103
|
import { readdir as readdir3, realpath as realpath6 } from "node:fs/promises";
|
|
31728
|
-
import
|
|
32104
|
+
import path11 from "node:path";
|
|
31729
32105
|
var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
31730
32106
|
var MAX_CACHED_CHILDREN = 16;
|
|
31731
32107
|
var CodeBuddyChildObserver = class {
|
|
@@ -31789,8 +32165,8 @@ var CodeBuddyChildObserver = class {
|
|
|
31789
32165
|
}
|
|
31790
32166
|
async #directory() {
|
|
31791
32167
|
const history = await this.#parentHistory();
|
|
31792
|
-
const project2 =
|
|
31793
|
-
const expected =
|
|
32168
|
+
const project2 = path11.dirname(await realpath6(history.file));
|
|
32169
|
+
const expected = path11.join(project2, this.parent.nativeSessionId, "subagents");
|
|
31794
32170
|
const actual = await realpath6(expected);
|
|
31795
32171
|
this.#assertOpen();
|
|
31796
32172
|
if (!equalPath2(actual, expected))
|
|
@@ -31800,7 +32176,7 @@ var CodeBuddyChildObserver = class {
|
|
|
31800
32176
|
async #child(directory, childId) {
|
|
31801
32177
|
if (!validCodeBuddyChildId(childId))
|
|
31802
32178
|
throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
|
|
31803
|
-
const file2 =
|
|
32179
|
+
const file2 = path11.join(directory, `${childId}.jsonl`);
|
|
31804
32180
|
const before = await codeBuddyFileVersion(file2);
|
|
31805
32181
|
if (!equalPath2(before.realFile, file2))
|
|
31806
32182
|
throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
|
|
@@ -32124,8 +32500,10 @@ var CodeBuddySession = class {
|
|
|
32124
32500
|
#ref;
|
|
32125
32501
|
#state = {};
|
|
32126
32502
|
#active;
|
|
32503
|
+
#autonomous = new CodeBuddyAutonomousTurns();
|
|
32127
32504
|
#busy = false;
|
|
32128
32505
|
#closed = false;
|
|
32506
|
+
#closeNotified = false;
|
|
32129
32507
|
#closing;
|
|
32130
32508
|
#fault;
|
|
32131
32509
|
#hasTurn = false;
|
|
@@ -32194,22 +32572,7 @@ var CodeBuddySession = class {
|
|
|
32194
32572
|
}
|
|
32195
32573
|
return;
|
|
32196
32574
|
}
|
|
32197
|
-
|
|
32198
|
-
return;
|
|
32199
|
-
if ((text2(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text2(update.toolCallId)}`)) && this.subagents.update(update))
|
|
32200
|
-
return;
|
|
32201
|
-
if (update.sessionUpdate === "config_option_update" && this.#config)
|
|
32202
|
-
this.#apply(configuration(update.configOptions, this.profile));
|
|
32203
|
-
if (update.sessionUpdate === "usage_update" && typeof update.used === "number" && typeof update.size === "number" && update.size > 0) {
|
|
32204
|
-
this.#context = {
|
|
32205
|
-
contextUsedTokens: update.used,
|
|
32206
|
-
contextWindowTokens: update.size,
|
|
32207
|
-
contextUsagePercent: update.used / update.size * 100
|
|
32208
|
-
};
|
|
32209
|
-
this.#emitUsage();
|
|
32210
|
-
void this.refreshUsage();
|
|
32211
|
-
}
|
|
32212
|
-
this.#active?.output.update(update);
|
|
32575
|
+
this.#dispatchUpdate(update);
|
|
32213
32576
|
} catch (error62) {
|
|
32214
32577
|
if (this.#replay)
|
|
32215
32578
|
this.#replay.fault ??= { error: error62 };
|
|
@@ -32217,8 +32580,12 @@ var CodeBuddySession = class {
|
|
|
32217
32580
|
this.#onFault(error62);
|
|
32218
32581
|
}
|
|
32219
32582
|
},
|
|
32220
|
-
permission: (request) => generation
|
|
32221
|
-
|
|
32583
|
+
permission: (request) => generation !== this.#generation || request.sessionId !== this.#ref?.nativeSessionId ? Promise.resolve({ outcome: { outcome: "cancelled" } }) : this.#interactionTurn(request, (turnId) => this.#interactions.permission(turnId, request), {
|
|
32584
|
+
outcome: { outcome: "cancelled" }
|
|
32585
|
+
}),
|
|
32586
|
+
question: (params) => generation !== this.#generation || params.sessionId !== this.#ref?.nativeSessionId ? Promise.resolve({ outcome: "cancelled" }) : this.#interactionTurn(params, (turnId) => this.#interactions.question(turnId, params), {
|
|
32587
|
+
outcome: "cancelled"
|
|
32588
|
+
})
|
|
32222
32589
|
}
|
|
32223
32590
|
});
|
|
32224
32591
|
}
|
|
@@ -32265,31 +32632,40 @@ var CodeBuddySession = class {
|
|
|
32265
32632
|
const saved = this.input.kind === "resume" && record3(this.input.nativeRef.locator).codebuddyDerived === 1 ? record3(record3(this.input.nativeRef.locator).configuration) : {};
|
|
32266
32633
|
if (this.input.kind === "resume")
|
|
32267
32634
|
this.#ref = this.input.nativeRef;
|
|
32268
|
-
const
|
|
32269
|
-
this.#
|
|
32270
|
-
|
|
32271
|
-
|
|
32272
|
-
|
|
32273
|
-
|
|
32274
|
-
|
|
32275
|
-
|
|
32276
|
-
|
|
32277
|
-
|
|
32278
|
-
|
|
32279
|
-
|
|
32280
|
-
|
|
32281
|
-
|
|
32282
|
-
|
|
32283
|
-
|
|
32284
|
-
|
|
32285
|
-
|
|
32286
|
-
|
|
32287
|
-
|
|
32288
|
-
|
|
32289
|
-
|
|
32290
|
-
|
|
32291
|
-
|
|
32292
|
-
|
|
32635
|
+
const replay = {};
|
|
32636
|
+
this.#replay = replay;
|
|
32637
|
+
const generation = this.#generation;
|
|
32638
|
+
try {
|
|
32639
|
+
const opened = await this.#openClient();
|
|
32640
|
+
this.#ref = nativeSessionRefSchema.parse({
|
|
32641
|
+
harnessId: this.profile.harnessId,
|
|
32642
|
+
nativeSessionId: opened.sessionId,
|
|
32643
|
+
formatVersion: 1,
|
|
32644
|
+
...this.#ref?.locator || this.capabilities.history.fork ? {
|
|
32645
|
+
locator: {
|
|
32646
|
+
...record3(this.#ref?.locator),
|
|
32647
|
+
...this.capabilities.history.fork ? { boundCwd: codeBuddyCanonicalCwd(this.input.cwd) } : {}
|
|
32648
|
+
}
|
|
32649
|
+
} : {}
|
|
32650
|
+
});
|
|
32651
|
+
this.#apply(configuration(opened.configOptions, this.profile), false);
|
|
32652
|
+
if (this.input.kind === "create" && this.input.executionPolicy === "unattended-full-access") {
|
|
32653
|
+
await this.#configure("mode", "fullAccess");
|
|
32654
|
+
} else if (this.input.permissionModeId || text2(saved.mode))
|
|
32655
|
+
await this.#configure("mode", this.input.permissionModeId ?? text2(saved.mode));
|
|
32656
|
+
if (this.input.model || text2(saved.model))
|
|
32657
|
+
await this.#configure("model", this.input.model?.id ?? text2(saved.model));
|
|
32658
|
+
if (this.input.thinkingOptionId || text2(saved.thinking))
|
|
32659
|
+
await this.#configure("thought_level", this.input.thinkingOptionId ?? text2(saved.thinking));
|
|
32660
|
+
this.#assertClient(generation);
|
|
32661
|
+
if (!this.profile.staticCommandCatalog && replay.commands)
|
|
32662
|
+
this.#commands = replay.commands;
|
|
32663
|
+
this.initialState = { ...this.#state };
|
|
32664
|
+
this.initialUsage = this.#usage;
|
|
32665
|
+
} finally {
|
|
32666
|
+
this.#replay = void 0;
|
|
32667
|
+
}
|
|
32668
|
+
this.#flushAutonomous();
|
|
32293
32669
|
}
|
|
32294
32670
|
#emit(event) {
|
|
32295
32671
|
event = configureSubagentEvent(event, this.#subagentConfiguration());
|
|
@@ -32314,6 +32690,140 @@ var CodeBuddySession = class {
|
|
|
32314
32690
|
if (historical || !complete)
|
|
32315
32691
|
this.#emit({ type: "usage.history", complete });
|
|
32316
32692
|
}
|
|
32693
|
+
/** Routes one native frame to the Host Turn, a native drain round, or its buffer. */
|
|
32694
|
+
#dispatchUpdate(update) {
|
|
32695
|
+
const unsolicited = readUnsolicitedTurn(update);
|
|
32696
|
+
if (unsolicited) {
|
|
32697
|
+
this.#autonomous.announce(unsolicited);
|
|
32698
|
+
this.#flushAutonomous();
|
|
32699
|
+
return;
|
|
32700
|
+
}
|
|
32701
|
+
if (update.sessionUpdate === "session_end") {
|
|
32702
|
+
const round = this.#autonomous.end(text2(record3(update._meta)["codebuddy.ai/requestId"]));
|
|
32703
|
+
if (!round)
|
|
32704
|
+
return;
|
|
32705
|
+
if (round.started)
|
|
32706
|
+
void this.#finishAutonomous(round);
|
|
32707
|
+
else
|
|
32708
|
+
this.#flushAutonomous();
|
|
32709
|
+
return;
|
|
32710
|
+
}
|
|
32711
|
+
const route = this.#autonomous.owner();
|
|
32712
|
+
if (route?.started) {
|
|
32713
|
+
if (!this.#replay)
|
|
32714
|
+
this.#applyUpdate(update);
|
|
32715
|
+
return;
|
|
32716
|
+
}
|
|
32717
|
+
if (route) {
|
|
32718
|
+
route.frames.push(update);
|
|
32719
|
+
return;
|
|
32720
|
+
}
|
|
32721
|
+
if (this.#replay)
|
|
32722
|
+
return;
|
|
32723
|
+
this.#applyUpdate(update);
|
|
32724
|
+
}
|
|
32725
|
+
/** An announced native interval owns Interactions before the prior prompt's finally runs. */
|
|
32726
|
+
#interactionTurn(request, run, cancelled) {
|
|
32727
|
+
if (this.#closed || this.#fault)
|
|
32728
|
+
return Promise.resolve(cancelled);
|
|
32729
|
+
const round = this.#autonomous.owner();
|
|
32730
|
+
if (round) {
|
|
32731
|
+
let identity2;
|
|
32732
|
+
try {
|
|
32733
|
+
identity2 = this.#autonomous.interactionIdentity(round, request);
|
|
32734
|
+
} catch (error62) {
|
|
32735
|
+
if (this.#replay)
|
|
32736
|
+
this.#replay.fault ??= { error: error62 };
|
|
32737
|
+
else
|
|
32738
|
+
this.#onFault(error62);
|
|
32739
|
+
return Promise.resolve(cancelled);
|
|
32740
|
+
}
|
|
32741
|
+
return identity2.then((turnId) => {
|
|
32742
|
+
const active3 = this.#active;
|
|
32743
|
+
return turnId && active3?.autonomous?.round === round && !active3.cancelled && !active3.done ? run(turnId) : cancelled;
|
|
32744
|
+
});
|
|
32745
|
+
}
|
|
32746
|
+
const active2 = this.#active;
|
|
32747
|
+
return active2 && !this.#replay && !active2.cancelled && !active2.autonomous && !active2.promptSettled ? run(active2.command.turnId) : Promise.resolve(cancelled);
|
|
32748
|
+
}
|
|
32749
|
+
/** Frames of the active Turn, including a native drain Turn that now owns the Session. */
|
|
32750
|
+
#applyUpdate(update) {
|
|
32751
|
+
if ((text2(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text2(update.toolCallId)}`)) && this.subagents.update(update))
|
|
32752
|
+
return;
|
|
32753
|
+
if (update.sessionUpdate === "config_option_update" && this.#config)
|
|
32754
|
+
this.#apply(configuration(update.configOptions, this.profile));
|
|
32755
|
+
if (update.sessionUpdate === "usage_update" && typeof update.used === "number" && typeof update.size === "number" && update.size > 0) {
|
|
32756
|
+
this.#context = {
|
|
32757
|
+
contextUsedTokens: update.used,
|
|
32758
|
+
contextWindowTokens: update.size,
|
|
32759
|
+
contextUsagePercent: update.used / update.size * 100
|
|
32760
|
+
};
|
|
32761
|
+
this.#emitUsage();
|
|
32762
|
+
void this.refreshUsage();
|
|
32763
|
+
}
|
|
32764
|
+
if (!this.#active?.cancelled)
|
|
32765
|
+
this.#active?.output.update(update);
|
|
32766
|
+
}
|
|
32767
|
+
#flushAutonomous() {
|
|
32768
|
+
if (this.#active || this.#replay || this.#closed || this.#fault)
|
|
32769
|
+
return;
|
|
32770
|
+
const round = this.#autonomous.next();
|
|
32771
|
+
if (!round)
|
|
32772
|
+
return;
|
|
32773
|
+
this.#startAutonomous(round);
|
|
32774
|
+
try {
|
|
32775
|
+
for (const frame of round.frames.drain())
|
|
32776
|
+
this.#applyUpdate(frame);
|
|
32777
|
+
} catch (error62) {
|
|
32778
|
+
this.#onFault(error62);
|
|
32779
|
+
return;
|
|
32780
|
+
}
|
|
32781
|
+
if (round.ended)
|
|
32782
|
+
void this.#finishAutonomous(round);
|
|
32783
|
+
}
|
|
32784
|
+
#startAutonomous(round) {
|
|
32785
|
+
const turnId = hostTurnIdSchema.parse(randomUUID3());
|
|
32786
|
+
const completion = Promise.withResolvers();
|
|
32787
|
+
const active2 = {
|
|
32788
|
+
command: { type: "turn.start", turnId, input: [] },
|
|
32789
|
+
output: new CodeBuddyTurnOutput(turnId, this.input.cwd, (event) => this.#emit(event), this.profile),
|
|
32790
|
+
completion: completion.promise,
|
|
32791
|
+
nativeCommand: false,
|
|
32792
|
+
cancelled: false,
|
|
32793
|
+
done: false,
|
|
32794
|
+
autonomous: { round },
|
|
32795
|
+
settle: () => completion.resolve(void 0)
|
|
32796
|
+
};
|
|
32797
|
+
this.#active = active2;
|
|
32798
|
+
this.#autonomous.start(round, turnId);
|
|
32799
|
+
this.subagents.begin(turnId);
|
|
32800
|
+
this.#emit({ type: "turn.autonomous.started", turnId, input: [] });
|
|
32801
|
+
this.#emit({ type: "turn.started", turnId });
|
|
32802
|
+
}
|
|
32803
|
+
/** Completes the live interval without assigning persisted identity or inferring success. */
|
|
32804
|
+
async #finishAutonomous(round) {
|
|
32805
|
+
const active2 = this.#active;
|
|
32806
|
+
if (!active2?.autonomous || active2.autonomous.round !== round || active2.done)
|
|
32807
|
+
return;
|
|
32808
|
+
try {
|
|
32809
|
+
const outcome = { status: active2.cancelled ? "cancelled" : "succeeded" };
|
|
32810
|
+
if (active2.cancelled) {
|
|
32811
|
+
const recovery = (async () => {
|
|
32812
|
+
await this.#retireClient();
|
|
32813
|
+
if (this.#closed || this.#fault)
|
|
32814
|
+
return;
|
|
32815
|
+
await this.#resumeClient();
|
|
32816
|
+
})();
|
|
32817
|
+
void recovery.catch(() => {
|
|
32818
|
+
});
|
|
32819
|
+
await bounded(Promise.race([recovery, active2.completion]), 3e4, "ACP autonomous cancel recovery");
|
|
32820
|
+
}
|
|
32821
|
+
if (!active2.done && !this.#closed && !this.#fault)
|
|
32822
|
+
this.#finish(active2, outcome);
|
|
32823
|
+
} catch (error62) {
|
|
32824
|
+
this.#onFault(error62);
|
|
32825
|
+
}
|
|
32826
|
+
}
|
|
32317
32827
|
#apply(config2, emit = true) {
|
|
32318
32828
|
if (this.#state.effectiveModel && this.#state.effectiveModel.id !== config2.state.effectiveModel?.id) {
|
|
32319
32829
|
this.#context = {};
|
|
@@ -32365,6 +32875,9 @@ var CodeBuddySession = class {
|
|
|
32365
32875
|
}
|
|
32366
32876
|
}
|
|
32367
32877
|
async #snapshot(historyTimeout) {
|
|
32878
|
+
return (await this.#snapshotWithHistory(historyTimeout)).snapshot;
|
|
32879
|
+
}
|
|
32880
|
+
async #snapshotWithHistory(historyTimeout) {
|
|
32368
32881
|
if (!this.#ref)
|
|
32369
32882
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
32370
32883
|
const read = this.#history(this.#ref);
|
|
@@ -32376,7 +32889,7 @@ var CodeBuddySession = class {
|
|
|
32376
32889
|
this.#hasTurn = true;
|
|
32377
32890
|
this.#usage = historyUsage(history);
|
|
32378
32891
|
this.#meterHistory(history, false);
|
|
32379
|
-
return { ...this.subagents.project(snapshot), state: this.#state };
|
|
32892
|
+
return { snapshot: { ...this.subagents.project(snapshot), state: this.#state }, history };
|
|
32380
32893
|
}
|
|
32381
32894
|
/** Read persisted request usage without waiting for the ACP prompt (including tool waits). */
|
|
32382
32895
|
async refreshUsage() {
|
|
@@ -32411,7 +32924,7 @@ var CodeBuddySession = class {
|
|
|
32411
32924
|
async #readSnapshot() {
|
|
32412
32925
|
if (this.#closed || this.#fault)
|
|
32413
32926
|
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
32414
|
-
if (this.#busy || this.#active)
|
|
32927
|
+
if (this.#busy || this.#replay || this.#active && (!this.#active.autonomous || this.#active.cancelled))
|
|
32415
32928
|
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
32416
32929
|
this.#busy = true;
|
|
32417
32930
|
try {
|
|
@@ -32432,6 +32945,14 @@ var CodeBuddySession = class {
|
|
|
32432
32945
|
return failure2("unsupported", "Command is not available in this Session", this.profile);
|
|
32433
32946
|
return this.#execute(command, invocation);
|
|
32434
32947
|
}
|
|
32948
|
+
/** ACP `session/cancel` carries only the Session ID; send it only while this Turn owns execution. */
|
|
32949
|
+
#ownsNativeExecution(active2) {
|
|
32950
|
+
if (active2.done || this.#needsResume)
|
|
32951
|
+
return false;
|
|
32952
|
+
if (active2.autonomous)
|
|
32953
|
+
return !active2.autonomous.round.ended && this.#autonomous.owner() === active2.autonomous.round;
|
|
32954
|
+
return !active2.promptSettled && !this.#autonomous.hasRounds();
|
|
32955
|
+
}
|
|
32435
32956
|
async #execute(command, invocation) {
|
|
32436
32957
|
if (this.#closed || this.#fault)
|
|
32437
32958
|
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
@@ -32443,27 +32964,29 @@ var CodeBuddySession = class {
|
|
|
32443
32964
|
const active2 = this.#active;
|
|
32444
32965
|
if (!active2 || active2.command.turnId !== command.turnId || !this.#ref)
|
|
32445
32966
|
return failure2("invalidRequest", "Turn is not active", this.profile);
|
|
32446
|
-
if (
|
|
32447
|
-
|
|
32448
|
-
|
|
32449
|
-
|
|
32450
|
-
|
|
32451
|
-
|
|
32452
|
-
|
|
32453
|
-
|
|
32454
|
-
|
|
32455
|
-
|
|
32456
|
-
|
|
32457
|
-
|
|
32458
|
-
|
|
32459
|
-
|
|
32460
|
-
|
|
32461
|
-
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error62) => {
|
|
32462
|
-
if (this.#active === active2 && !this.#needsResume)
|
|
32463
|
-
this.#onFault(error62);
|
|
32464
|
-
});
|
|
32967
|
+
if (active2.cancelled)
|
|
32968
|
+
return { ok: true, value: { cancellationRequested: true } };
|
|
32969
|
+
if (!this.#ownsNativeExecution(active2))
|
|
32970
|
+
return failure2("invalidState", "Turn is already completing", this.profile);
|
|
32971
|
+
active2.cancelled = true;
|
|
32972
|
+
const generation = this.#generation;
|
|
32973
|
+
try {
|
|
32974
|
+
const requested = this.#client.cancel(this.#ref.nativeSessionId);
|
|
32975
|
+
this.#interactions.close();
|
|
32976
|
+
await requested;
|
|
32977
|
+
} catch (error62) {
|
|
32978
|
+
if (generation === this.#generation) {
|
|
32979
|
+
if (this.#active === active2)
|
|
32980
|
+
this.#onFault(error62);
|
|
32981
|
+
return { ok: false, error: nativeError(error62, this.profile) };
|
|
32465
32982
|
}
|
|
32466
32983
|
}
|
|
32984
|
+
if (this.#active === active2 && !this.#closed) {
|
|
32985
|
+
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error62) => {
|
|
32986
|
+
if (this.#active === active2 && (active2.autonomous || !this.#needsResume))
|
|
32987
|
+
this.#onFault(error62);
|
|
32988
|
+
});
|
|
32989
|
+
}
|
|
32467
32990
|
return { ok: true, value: { cancellationRequested: true } };
|
|
32468
32991
|
}
|
|
32469
32992
|
if (this.#busy || this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
@@ -32473,8 +32996,14 @@ var CodeBuddySession = class {
|
|
|
32473
32996
|
if (command.type === "turn.start" || command.type === "command.execute") {
|
|
32474
32997
|
if (!command.turnId.trim() || command.type === "turn.start" && (!command.input.length || command.input.some((item) => item.type !== "text") || !command.input.map((item) => item.text).join("").trim()))
|
|
32475
32998
|
return failure2("invalidRequest", "A nonempty text prompt is required", this.profile);
|
|
32476
|
-
|
|
32999
|
+
const drainBefore = this.#autonomous.announcements;
|
|
33000
|
+
if (this.#needsResume) {
|
|
32477
33001
|
await this.#resumeClient();
|
|
33002
|
+
if (this.#closed || this.#fault)
|
|
33003
|
+
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
33004
|
+
if (this.#active || this.#autonomous.announcements !== drainBefore)
|
|
33005
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
33006
|
+
}
|
|
32478
33007
|
const nativeCommand = command.type === "command.execute" || nativeCommandsEnabled(this.profile) && this.#commands.commands.some((entry) => entry.invocation === invocation);
|
|
32479
33008
|
if (command.type === "command.execute") {
|
|
32480
33009
|
const parsed = commandPrompt(command, this.#commands, this.profile);
|
|
@@ -32487,14 +33016,12 @@ var CodeBuddySession = class {
|
|
|
32487
33016
|
};
|
|
32488
33017
|
}
|
|
32489
33018
|
const snapshot = await this.#snapshot();
|
|
32490
|
-
const before = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
32491
|
-
const beforeItems = new Set(snapshot.turns.flatMap((turn) => turn.items.map((snapshot2) => snapshot2.item.itemId)));
|
|
32492
33019
|
if (this.#closed || this.#fault)
|
|
32493
33020
|
return failure2("invalidState", "Session closed before Turn start", this.profile);
|
|
33021
|
+
if (this.#active || this.#autonomous.announcements !== drainBefore)
|
|
33022
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
32494
33023
|
const active2 = {
|
|
32495
33024
|
command,
|
|
32496
|
-
before,
|
|
32497
|
-
beforeItems,
|
|
32498
33025
|
output: new CodeBuddyTurnOutput(command.turnId, this.input.cwd, (event) => this.#emit(event), this.profile),
|
|
32499
33026
|
nativeCommand,
|
|
32500
33027
|
cancelled: false,
|
|
@@ -32504,11 +33031,16 @@ var CodeBuddySession = class {
|
|
|
32504
33031
|
this.#active = active2;
|
|
32505
33032
|
this.subagents.begin(command.turnId);
|
|
32506
33033
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
32507
|
-
active2.completion = this.#run(active2);
|
|
33034
|
+
active2.completion = this.#run(active2, new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey)), new Set(snapshot.turns.flatMap((turn) => turn.items.map(({ item }) => item.itemId))), drainBefore);
|
|
32508
33035
|
return { ok: true, value: { turnId: command.turnId } };
|
|
32509
33036
|
}
|
|
32510
|
-
if (this.#needsResume)
|
|
33037
|
+
if (this.#needsResume) {
|
|
32511
33038
|
await this.#resumeClient();
|
|
33039
|
+
if (this.#closed || this.#fault)
|
|
33040
|
+
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
33041
|
+
if (this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
33042
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
33043
|
+
}
|
|
32512
33044
|
await this.#configure(command.type === "model.select" ? "model" : command.type === "thinking.select" ? "thought_level" : "mode", command.type === "model.select" ? command.model.id : command.type === "thinking.select" ? command.thinkingOptionId : command.permissionModeId);
|
|
32513
33045
|
return { ok: true, value: { completed: true } };
|
|
32514
33046
|
} catch (error62) {
|
|
@@ -32517,12 +33049,14 @@ var CodeBuddySession = class {
|
|
|
32517
33049
|
this.#busy = false;
|
|
32518
33050
|
}
|
|
32519
33051
|
}
|
|
32520
|
-
async #run(active2) {
|
|
33052
|
+
async #run(active2, before, beforeItems, drainBefore) {
|
|
32521
33053
|
let cancellationConfirmed = false;
|
|
32522
33054
|
try {
|
|
32523
33055
|
if (!this.#ref)
|
|
32524
33056
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
32525
|
-
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n"))
|
|
33057
|
+
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n")).finally(() => {
|
|
33058
|
+
active2.promptSettled = true;
|
|
33059
|
+
});
|
|
32526
33060
|
if (active2.done || this.#closed)
|
|
32527
33061
|
return;
|
|
32528
33062
|
const stop = response.stopReason, meta3 = record3(response._meta);
|
|
@@ -32534,39 +33068,42 @@ var CodeBuddySession = class {
|
|
|
32534
33068
|
};
|
|
32535
33069
|
if (outcome.status === "cancelled") {
|
|
32536
33070
|
active2.cancelled = true;
|
|
32537
|
-
++this.#generation;
|
|
32538
|
-
this.#interactions.close();
|
|
32539
33071
|
try {
|
|
32540
|
-
await this.#
|
|
33072
|
+
await this.#retireClient();
|
|
32541
33073
|
} catch (error62) {
|
|
32542
33074
|
this.#onFault(error62);
|
|
32543
33075
|
return;
|
|
32544
33076
|
}
|
|
32545
33077
|
if (active2.done || this.#closed)
|
|
32546
33078
|
return;
|
|
32547
|
-
this.#needsResume = true;
|
|
32548
33079
|
cancellationConfirmed = true;
|
|
32549
33080
|
}
|
|
32550
|
-
const snapshot = await this.#
|
|
33081
|
+
const { snapshot, history } = await this.#snapshotWithHistory(cancellationConfirmed ? 1e3 : void 0);
|
|
32551
33082
|
if (active2.done || this.#closed)
|
|
32552
33083
|
return;
|
|
32553
|
-
const
|
|
32554
|
-
|
|
32555
|
-
|
|
32556
|
-
const
|
|
32557
|
-
if (
|
|
33084
|
+
const drainOverlapped = this.#autonomous.announcements !== drainBefore;
|
|
33085
|
+
const userMessageId = text2(response.userMessageId);
|
|
33086
|
+
const added = snapshot.turns.filter((turn) => !before.has(turn.nativeTurnRef.nativeTurnKey));
|
|
33087
|
+
const persisted = userMessageId ? added.find((turn) => turn.nativeTurnRef.nativeTurnKey === userMessageId) : !drainOverlapped && added.length === 1 ? added[0] : void 0;
|
|
33088
|
+
if (userMessageId && !persisted)
|
|
32558
33089
|
throw new CodeBuddyError("protocolError", "ACP terminal and native history disagree on Turn identity");
|
|
32559
|
-
|
|
33090
|
+
if (!persisted && !active2.nativeCommand && outcome.status === "succeeded")
|
|
33091
|
+
throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
|
|
33092
|
+
const compactionItems = persisted ? compactionEvidenceForTurn(history, snapshot, persisted.nativeTurnRef.nativeTurnKey, beforeItems, this.profile) : drainOverlapped ? [] : snapshot.turns.flatMap((turn) => turn.items).filter(({ item }) => !beforeItems.has(item.itemId));
|
|
33093
|
+
active2.output.confirmCompaction(compactionItems);
|
|
32560
33094
|
if (active2.nativeCommand)
|
|
32561
|
-
active2.output.replayCommandResult((
|
|
33095
|
+
active2.output.replayCommandResult((persisted?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
33096
|
+
const nativeTurnRef = persisted?.nativeTurnRef;
|
|
33097
|
+
if (nativeTurnRef)
|
|
33098
|
+
this.#hasTurn = true;
|
|
32562
33099
|
const compactCommand = outcome.status !== "cancelled" && active2.nativeCommand && /^\/compact(?:\s|$)/u.test(active2.command.input.map((item) => item.text).join("\n").trim());
|
|
32563
|
-
const
|
|
32564
|
-
if (compactCommand && (!
|
|
33100
|
+
const persistedOutcome = compactCommand ? persisted?.outcome : void 0;
|
|
33101
|
+
if (compactCommand && (!persistedOutcome || persistedOutcome.status === "unknown"))
|
|
32565
33102
|
throw new CodeBuddyError("protocolError", "Native compaction terminal outcome was not persisted");
|
|
32566
|
-
const terminalOutcome =
|
|
33103
|
+
const terminalOutcome = persistedOutcome && persistedOutcome.status !== "unknown" ? persistedOutcome : outcome;
|
|
32567
33104
|
this.#finish(active2, {
|
|
32568
33105
|
...terminalOutcome,
|
|
32569
|
-
...
|
|
33106
|
+
...persisted?.checkpoint ? { checkpoint: persisted.checkpoint } : {}
|
|
32570
33107
|
}, nativeTurnRef);
|
|
32571
33108
|
if (this.#usage)
|
|
32572
33109
|
this.#emitUsage();
|
|
@@ -32575,6 +33112,13 @@ var CodeBuddySession = class {
|
|
|
32575
33112
|
this.#finish(active2, cancellationConfirmed ? { status: "cancelled" } : { status: "failed", error: nativeError(error62, this.profile) });
|
|
32576
33113
|
}
|
|
32577
33114
|
}
|
|
33115
|
+
async #retireClient() {
|
|
33116
|
+
++this.#generation;
|
|
33117
|
+
this.#interactions.close();
|
|
33118
|
+
this.#autonomous.close();
|
|
33119
|
+
await this.#client.close();
|
|
33120
|
+
this.#needsResume = true;
|
|
33121
|
+
}
|
|
32578
33122
|
/** Runs only under the native operation gate, after the old process has exited. */
|
|
32579
33123
|
async #resumeClient() {
|
|
32580
33124
|
const replay = {};
|
|
@@ -32590,8 +33134,11 @@ var CodeBuddySession = class {
|
|
|
32590
33134
|
if (!this.profile.staticCommandCatalog)
|
|
32591
33135
|
this.#commands = replay.commands ?? { commands: [] };
|
|
32592
33136
|
this.#needsResume = false;
|
|
33137
|
+
this.#replay = void 0;
|
|
33138
|
+
this.#flushAutonomous();
|
|
32593
33139
|
} catch (error62) {
|
|
32594
33140
|
++this.#generation;
|
|
33141
|
+
this.#autonomous.close();
|
|
32595
33142
|
try {
|
|
32596
33143
|
await candidate?.close();
|
|
32597
33144
|
} catch (closeError) {
|
|
@@ -32606,6 +33153,9 @@ var CodeBuddySession = class {
|
|
|
32606
33153
|
if (active2.done)
|
|
32607
33154
|
return;
|
|
32608
33155
|
active2.done = true;
|
|
33156
|
+
active2.settle?.();
|
|
33157
|
+
if (active2.autonomous)
|
|
33158
|
+
this.#autonomous.finish(active2.autonomous.round);
|
|
32609
33159
|
this.subagents.finish(outcome);
|
|
32610
33160
|
this.#interactions.close();
|
|
32611
33161
|
active2.output.finish(outcome.status, outcome.status === "failed" ? outcome.error : void 0);
|
|
@@ -32613,15 +33163,19 @@ var CodeBuddySession = class {
|
|
|
32613
33163
|
type: "turn.completed",
|
|
32614
33164
|
turnId: active2.command.turnId,
|
|
32615
33165
|
outcome,
|
|
33166
|
+
...active2.autonomous ? { ephemeral: true } : {},
|
|
32616
33167
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
32617
33168
|
});
|
|
32618
33169
|
if (this.#active === active2)
|
|
32619
33170
|
this.#active = void 0;
|
|
33171
|
+
this.#flushAutonomous();
|
|
32620
33172
|
}
|
|
32621
33173
|
#onFault(error62) {
|
|
32622
33174
|
if (this.#fault || this.#closed)
|
|
32623
33175
|
return;
|
|
32624
33176
|
this.#fault = nativeError(error62, this.profile);
|
|
33177
|
+
this.#replay = void 0;
|
|
33178
|
+
this.#autonomous.close();
|
|
32625
33179
|
if (this.#active)
|
|
32626
33180
|
this.#finish(this.#active, { status: "failed", error: this.#fault });
|
|
32627
33181
|
this.#interactions.close();
|
|
@@ -32631,11 +33185,19 @@ var CodeBuddySession = class {
|
|
|
32631
33185
|
this.#channel.end();
|
|
32632
33186
|
}
|
|
32633
33187
|
close() {
|
|
32634
|
-
this.#closing
|
|
32635
|
-
|
|
33188
|
+
if (this.#closing)
|
|
33189
|
+
return this.#closing;
|
|
33190
|
+
const closing = this.#close().catch((error62) => {
|
|
33191
|
+
if (this.#closing === closing)
|
|
33192
|
+
this.#closing = void 0;
|
|
33193
|
+
throw error62;
|
|
33194
|
+
});
|
|
33195
|
+
this.#closing = closing;
|
|
33196
|
+
return closing;
|
|
32636
33197
|
}
|
|
32637
33198
|
async #close() {
|
|
32638
33199
|
this.#closed = true;
|
|
33200
|
+
this.#autonomous.close();
|
|
32639
33201
|
this.#interactions.close();
|
|
32640
33202
|
try {
|
|
32641
33203
|
await this.#client.close();
|
|
@@ -32648,7 +33210,10 @@ var CodeBuddySession = class {
|
|
|
32648
33210
|
} finally {
|
|
32649
33211
|
this.subagents.close();
|
|
32650
33212
|
this.#channel.end();
|
|
32651
|
-
this
|
|
33213
|
+
if (!this.#closeNotified) {
|
|
33214
|
+
this.#closeNotified = true;
|
|
33215
|
+
this.onClose();
|
|
33216
|
+
}
|
|
32652
33217
|
}
|
|
32653
33218
|
}
|
|
32654
33219
|
};
|
|
@@ -32873,8 +33438,8 @@ function createCodeBuddyInstallation(environment) {
|
|
|
32873
33438
|
}
|
|
32874
33439
|
|
|
32875
33440
|
// ../../harness-broker/dist/client.js
|
|
32876
|
-
import { execFile as
|
|
32877
|
-
import { randomUUID as
|
|
33441
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
33442
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
32878
33443
|
import { lstat as lstat4, readFile as readFile5 } from "node:fs/promises";
|
|
32879
33444
|
import net, {} from "node:net";
|
|
32880
33445
|
|
|
@@ -33484,18 +34049,18 @@ function createBrokerSessionImportCapability(input3) {
|
|
|
33484
34049
|
|
|
33485
34050
|
// ../../harness-broker/dist/paths.js
|
|
33486
34051
|
import os2 from "node:os";
|
|
33487
|
-
import
|
|
34052
|
+
import path12 from "node:path";
|
|
33488
34053
|
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
33489
34054
|
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
33490
34055
|
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
33491
34056
|
const home = environment.HOME || os2.homedir();
|
|
33492
|
-
return
|
|
34057
|
+
return path12.join(home, ".codexhost", "harness-broker");
|
|
33493
34058
|
}
|
|
33494
34059
|
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
33495
34060
|
harnessPluginIdSchema.parse(harnessId);
|
|
33496
34061
|
if (harnessId !== "claude-code")
|
|
33497
|
-
return
|
|
33498
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ??
|
|
34062
|
+
return path12.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
34063
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path12.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
33499
34064
|
}
|
|
33500
34065
|
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
33501
34066
|
harnessPluginIdSchema.parse(harnessId);
|
|
@@ -33503,7 +34068,7 @@ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
|
33503
34068
|
}
|
|
33504
34069
|
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
33505
34070
|
const home = environment.HOME || os2.homedir();
|
|
33506
|
-
return
|
|
34071
|
+
return path12.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
33507
34072
|
}
|
|
33508
34073
|
|
|
33509
34074
|
// ../../harness-broker/dist/client.js
|
|
@@ -33633,7 +34198,7 @@ function describeBrokerFailure(error62, harnessId) {
|
|
|
33633
34198
|
}
|
|
33634
34199
|
function runLaunchctl(arguments_) {
|
|
33635
34200
|
return new Promise((resolve) => {
|
|
33636
|
-
|
|
34201
|
+
execFile3("/bin/launchctl", arguments_, { timeout: 1e4 }, (error62) => resolve(!error62));
|
|
33637
34202
|
});
|
|
33638
34203
|
}
|
|
33639
34204
|
async function startBrokerLaunchAgent(harnessId, environment) {
|
|
@@ -33743,7 +34308,7 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
33743
34308
|
throw new Error("Aqua Harness broker request limit exceeded");
|
|
33744
34309
|
}
|
|
33745
34310
|
this.#inputSequence += 1;
|
|
33746
|
-
const id2 =
|
|
34311
|
+
const id2 = randomUUID4();
|
|
33747
34312
|
const response = new Promise((resolve, reject) => {
|
|
33748
34313
|
const timeout = setTimeout(() => {
|
|
33749
34314
|
this.#pending.delete(id2);
|