@codexhost/cli-win32-x64 0.29.1 → 0.30.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 +40 -15
- package/app/console-web.js +49 -24
- package/app/desktop-controller.mjs +53 -28
- package/app/host-runtime.mjs +2616 -1978
- package/app/plugins/antigravity/plugin.mjs +40 -15
- package/app/plugins/claude-code/plugin.mjs +40 -15
- package/app/plugins/codebuddy/plugin.mjs +514 -109
- package/app/plugins/codex-usage/plugin.mjs +58 -33
- package/app/plugins/copilot/plugin.mjs +40 -15
- package/app/plugins/cursor-cli/plugin.mjs +40 -15
- package/app/plugins/deepseek-harness/plugin.mjs +40 -15
- package/app/plugins/devin/plugin.mjs +40 -15
- package/app/plugins/grok/plugin.mjs +40 -15
- package/app/plugins/hermes/plugin.mjs +40 -15
- package/app/plugins/kimi-code/plugin.mjs +40 -15
- package/app/plugins/kiro-cli/plugin.mjs +40 -15
- package/app/plugins/omp/plugin.mjs +40 -15
- package/app/plugins/opencode/plugin.mjs +40 -15
- package/app/plugins/pi/plugin.mjs +40 -15
- package/app/plugins/qoder/plugin.mjs +40 -15
- package/app/plugins/qoder-cn/plugin.mjs +40 -15
- package/app/plugins/qwen-code/plugin.mjs +40 -15
- package/app/plugins/workbuddy/plugin.mjs +548 -112
- package/app/plugins/zcode/plugin.mjs +40 -15
- package/app/renderer-extension.js +52 -27
- package/app/web/assets/abnfDiagram-XWFEHMT6-BdinLox4.js +1 -0
- package/app/web/assets/architectureDiagram-CSQXQB3N-DgPBbtvP.js +36 -0
- package/app/web/assets/blockDiagram-BEDRHYPZ-B4ENdwtZ.js +140 -0
- package/app/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
- package/app/web/assets/c4Diagram-M2UUVUY5-DA6Owfyu.js +38 -0
- package/app/web/assets/chunk-2Q5K7J3B-Dvh3qOmo.js +1 -0
- package/app/web/assets/chunk-3GCGMST5-VIkqueym.js +1 -0
- package/app/web/assets/chunk-5VM5RSS4-DTYof_OI.js +15 -0
- package/app/web/assets/chunk-7U7NFRK5-Dp7s2dg0.js +88 -0
- package/app/web/assets/chunk-CNRTWJTD-TKBKxZLU.js +1 -0
- package/app/web/assets/chunk-D5HYT7QG-BRZDovSS.js +1 -0
- package/app/web/assets/chunk-EBZ3SEQC-C9USZ3tT.js +2 -0
- package/app/web/assets/chunk-JWPE2WC7-BrdvVNVo.js +1 -0
- package/app/web/assets/chunk-KTR4FSNJ-C7qwjGba.js +1 -0
- package/app/web/assets/chunk-XXDRQBXY-DlSrRuwN.js +1 -0
- package/app/web/assets/classDiagram-v2-KXABOMEV-BFvB4kwX.js +217 -0
- package/app/web/assets/cose-bilkent-JH36ORCC-UyCAqNvj.js +1 -0
- package/app/web/assets/cynefin-EF2NZ3EQ-CwawUbjJ.js +141 -0
- package/app/web/assets/cynefinDiagram-NJNITYFG-BaWEIQJ0.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-B7ENIjLG.js +4 -0
- package/app/web/assets/diagram-7YQZDPLS-CxRMU8xq.js +41 -0
- package/app/web/assets/diagram-QBROCOUO-qo7sxm4K.js +200 -0
- package/app/web/assets/diagram-RJJCUUZO-CQiGMCMe.js +30 -0
- package/app/web/assets/diagram-WERXNKYE-D0Jps1As.js +24 -0
- package/app/web/assets/diagram-YHHI257C-p4AB8cqK.js +3 -0
- package/app/web/assets/diagram-YR4HJLHV-Bh6JKT04.js +24 -0
- package/app/web/assets/ebnfDiagram-N527522P-DRac0k4W.js +1 -0
- package/app/web/assets/elk-O5DQBFGD-CWTz5SZP.js +27 -0
- package/app/web/assets/erDiagram-K3K3BIDK-DE3w4BEY.js +99 -0
- package/app/web/assets/flowDiagram-Z6JWZHQI-NYs8bi5t.js +213 -0
- package/app/web/assets/ganttDiagram-3PRQTZWP-Bspp9btW.js +292 -0
- package/app/web/assets/gitGraphDiagram-VXDFKS5L-ByGW1uvv.js +106 -0
- package/app/web/assets/graph-D8UmR1vK.js +1 -0
- package/app/web/assets/grid-E2QIVN74-CegebiIw.js +1 -0
- package/app/web/assets/{index-aSHN2MIG.css → index-BbmB5VLj.css} +1 -1
- package/app/web/assets/{index-0TnaYwHS.js → index-DFPOGLS4.js} +80 -80
- package/app/web/assets/infoDiagram-EZ3ZOAHP-CexmsdZx.js +2 -0
- package/app/web/assets/ishikawaDiagram-S3EKX5GW-BbWqKhg6.js +70 -0
- package/app/web/assets/journeyDiagram-POQNLL5X-27YlCe-1.js +139 -0
- package/app/web/assets/kanban-definition-BH5XI6FM-BAhOdeck.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-sGgCbv5y.js +314 -0
- package/app/web/assets/mindmap-definition-WVAN44T4-CsMIX0Lj.js +98 -0
- package/app/web/assets/pegDiagram-D4NLKWP3-Cs3LXqn_.js +1 -0
- package/app/web/assets/pieDiagram-36ENHN4W-DdQsQX9I.js +39 -0
- package/app/web/assets/quadrantDiagram-ZQUDMS73-D1jOKqx_.js +7 -0
- package/app/web/assets/railroadDiagram-JIZHGYPL-XulrgX5n.js +1 -0
- package/app/web/assets/render-VIF2ZAQL-CSsGw-0I.js +2 -0
- package/app/web/assets/requirementDiagram-AXW2TVFA-CT66GXLN.js +84 -0
- package/app/web/assets/sankeyDiagram-FBCJTAIF-CNRKebNY.js +40 -0
- package/app/web/assets/sequenceDiagram-3LA2ROMG-DVl5y64e.js +169 -0
- package/app/web/assets/sizeCapture-2Q2CQKSF-Kg0XxSga.js +1 -0
- package/app/web/assets/stateDiagram-v2-ATKHQDJO-DYQnfMsS.js +291 -0
- package/app/web/assets/swimlanes-YQL5WMAO-Chqt7pxD.js +1 -0
- package/app/web/assets/swimlanesDiagram-UCCPES4V-BfREktNP.js +8 -0
- package/app/web/assets/timeline-definition-7Z437IG3-aHFxjIT6.js +120 -0
- package/app/web/assets/usecaseDiagram-RDK6N6HP-DsC5tFe4.js +370 -0
- package/app/web/assets/vendor-BKfNgqAm.js +666 -0
- package/app/web/assets/vennDiagram-SHRQU5PJ-C65oZxFn.js +34 -0
- package/app/web/assets/wardleyDiagram-F3OXNVQS-HTkq7DT0.js +78 -0
- package/app/web/assets/xychartDiagram-GDYJKCDI-p1LpQ9MH.js +7 -0
- package/app/web/codexhost-settings.js +39 -39
- 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-client-locale/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +17 -17
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +16 -16
- 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 +14 -14
- package/app/web-modules/licenses/DSH-THIRD_PARTY_NOTICES.md +1 -1
- package/app/web-modules/server.mjs +641 -168
- 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
|
@@ -20358,15 +20358,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
20358
20358
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
20359
20359
|
}).strict().superRefine(({ threads }, context) => {
|
|
20360
20360
|
const seen = /* @__PURE__ */ new Set();
|
|
20361
|
-
for (const [index,
|
|
20362
|
-
if (seen.has(
|
|
20361
|
+
for (const [index, thread3] of threads.entries()) {
|
|
20362
|
+
if (seen.has(thread3.threadId)) {
|
|
20363
20363
|
context.addIssue({
|
|
20364
20364
|
code: "custom",
|
|
20365
20365
|
message: "Thread ownership-list results must be unique",
|
|
20366
20366
|
path: ["threads", index, "threadId"]
|
|
20367
20367
|
});
|
|
20368
20368
|
}
|
|
20369
|
-
seen.add(
|
|
20369
|
+
seen.add(thread3.threadId);
|
|
20370
20370
|
}
|
|
20371
20371
|
});
|
|
20372
20372
|
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
@@ -21102,6 +21102,29 @@ var productTelemetryHeartbeatSchema = external_exports.object({
|
|
|
21102
21102
|
message: "Telemetry heartbeat must contain at least one countable field"
|
|
21103
21103
|
});
|
|
21104
21104
|
|
|
21105
|
+
// ../../shared-contracts/dist/native-codex-goal.js
|
|
21106
|
+
var NATIVE_CODEX_GOAL_METHOD = "codexhost/thread/goal";
|
|
21107
|
+
var NATIVE_CODEX_GOAL_MAX_OBJECTIVE_CHARS = 4e3;
|
|
21108
|
+
var thread = { threadId: hostThreadIdSchema };
|
|
21109
|
+
var nativeCodexGoalRequestSchema = external_exports.discriminatedUnion("action", [
|
|
21110
|
+
external_exports.strictObject({ ...thread, action: external_exports.enum(["get", "pause", "resume", "clear"]) }),
|
|
21111
|
+
external_exports.strictObject({
|
|
21112
|
+
...thread,
|
|
21113
|
+
action: external_exports.enum(["create", "edit"]),
|
|
21114
|
+
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.`)
|
|
21115
|
+
})
|
|
21116
|
+
]);
|
|
21117
|
+
var nativeCodexGoalResultSchema = external_exports.object({
|
|
21118
|
+
goal: external_exports.object({
|
|
21119
|
+
threadId: hostThreadIdSchema,
|
|
21120
|
+
objective: external_exports.string(),
|
|
21121
|
+
status: external_exports.enum(["active", "paused", "blocked", "usageLimited", "budgetLimited", "complete"]),
|
|
21122
|
+
tokenBudget: external_exports.int().positive().nullable().default(null),
|
|
21123
|
+
tokensUsed: external_exports.int().nonnegative(),
|
|
21124
|
+
timeUsedSeconds: external_exports.int().nonnegative()
|
|
21125
|
+
}).nullable()
|
|
21126
|
+
});
|
|
21127
|
+
|
|
21105
21128
|
// ../../shared-contracts/dist/client-channel.js
|
|
21106
21129
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
21107
21130
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
@@ -21114,10 +21137,12 @@ var CLIENT_CHANNEL_METHODS = [
|
|
|
21114
21137
|
"codexhost/harness/display-settings/capabilities",
|
|
21115
21138
|
"codexhost/harness/preferences/get",
|
|
21116
21139
|
"codexhost/harness/preferences/patch",
|
|
21140
|
+
"experimentalFeature/list",
|
|
21117
21141
|
"thread/list",
|
|
21118
21142
|
"thread/metadata/update",
|
|
21119
21143
|
"codexhost/thread/catalog/read",
|
|
21120
21144
|
"thread/read",
|
|
21145
|
+
NATIVE_CODEX_GOAL_METHOD,
|
|
21121
21146
|
"thread/resume",
|
|
21122
21147
|
"thread/fork",
|
|
21123
21148
|
"thread/turns/list",
|
|
@@ -23015,7 +23040,7 @@ var identity = external_exports.string().min(1).max(REMOTE_IDENTITY_MAX_LENGTH);
|
|
|
23015
23040
|
var target = {
|
|
23016
23041
|
hostId: identity.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)
|
|
23017
23042
|
};
|
|
23018
|
-
var
|
|
23043
|
+
var thread2 = { ...target, threadId: identity };
|
|
23019
23044
|
var text = external_exports.string().min(1).max(8e3);
|
|
23020
23045
|
var input2 = { text, requestId: identity };
|
|
23021
23046
|
var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
|
|
@@ -23066,7 +23091,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23066
23091
|
serviceTier: external_exports.enum(["priority", "ultrafast"]).optional(),
|
|
23067
23092
|
reasoningEffort: identity.optional()
|
|
23068
23093
|
}),
|
|
23069
|
-
external_exports.strictObject({ kind: external_exports.literal("status"), ...
|
|
23094
|
+
external_exports.strictObject({ kind: external_exports.literal("status"), ...thread2 }),
|
|
23070
23095
|
external_exports.strictObject({
|
|
23071
23096
|
kind: external_exports.literal("list"),
|
|
23072
23097
|
...target,
|
|
@@ -23076,7 +23101,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23076
23101
|
}),
|
|
23077
23102
|
external_exports.strictObject({
|
|
23078
23103
|
kind: external_exports.literal("read"),
|
|
23079
|
-
...
|
|
23104
|
+
...thread2,
|
|
23080
23105
|
page: external_exports.strictObject({
|
|
23081
23106
|
cursor: external_exports.string().min(1).max(8192).nullable(),
|
|
23082
23107
|
epoch: identity.optional(),
|
|
@@ -23086,10 +23111,10 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23086
23111
|
message: "A history continuation requires its connection epoch"
|
|
23087
23112
|
}).optional()
|
|
23088
23113
|
}),
|
|
23089
|
-
external_exports.strictObject({ kind: external_exports.literal("usage"), ...
|
|
23114
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread2, epoch: identity }),
|
|
23090
23115
|
external_exports.strictObject({
|
|
23091
23116
|
kind: external_exports.literal("configure"),
|
|
23092
|
-
...
|
|
23117
|
+
...thread2,
|
|
23093
23118
|
epoch: identity,
|
|
23094
23119
|
modelId: identity.optional(),
|
|
23095
23120
|
serviceTier: harnessModelServiceTierSchema.optional(),
|
|
@@ -23100,15 +23125,15 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23100
23125
|
}),
|
|
23101
23126
|
external_exports.strictObject({
|
|
23102
23127
|
kind: external_exports.literal("prompt"),
|
|
23103
|
-
...
|
|
23128
|
+
...thread2,
|
|
23104
23129
|
epoch: identity,
|
|
23105
23130
|
text,
|
|
23106
23131
|
requestId: identity.optional()
|
|
23107
23132
|
}),
|
|
23108
|
-
external_exports.strictObject({ kind: external_exports.literal("queue"), ...
|
|
23133
|
+
external_exports.strictObject({ kind: external_exports.literal("queue"), ...thread2, epoch: identity }),
|
|
23109
23134
|
external_exports.strictObject({
|
|
23110
23135
|
kind: external_exports.literal("delivery"),
|
|
23111
|
-
...
|
|
23136
|
+
...thread2,
|
|
23112
23137
|
epoch: identity,
|
|
23113
23138
|
action: external_exports.discriminatedUnion("kind", [
|
|
23114
23139
|
external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
|
|
@@ -23122,17 +23147,17 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
23122
23147
|
external_exports.strictObject({ kind: external_exports.literal("sendNow"), itemId: identity })
|
|
23123
23148
|
])
|
|
23124
23149
|
}),
|
|
23125
|
-
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...
|
|
23150
|
+
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread2, epoch: identity, turnId: identity }),
|
|
23126
23151
|
external_exports.strictObject({
|
|
23127
23152
|
kind: external_exports.literal("rename"),
|
|
23128
|
-
...
|
|
23153
|
+
...thread2,
|
|
23129
23154
|
epoch: identity,
|
|
23130
23155
|
name: external_exports.string().min(1).max(512)
|
|
23131
23156
|
}),
|
|
23132
|
-
external_exports.strictObject({ kind: external_exports.literal("archive"), ...
|
|
23157
|
+
external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread2, epoch: identity, archived: external_exports.boolean() }),
|
|
23133
23158
|
external_exports.strictObject({
|
|
23134
23159
|
kind: external_exports.literal("respond"),
|
|
23135
|
-
...
|
|
23160
|
+
...thread2,
|
|
23136
23161
|
epoch: identity,
|
|
23137
23162
|
requestId: external_exports.union([identity, external_exports.number().int()]),
|
|
23138
23163
|
result: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
@@ -25403,7 +25428,8 @@ var CODEBUDDY_CAPABILITIES = {
|
|
|
25403
25428
|
permissionModeScope: "live"
|
|
25404
25429
|
},
|
|
25405
25430
|
history: { fork: true, forkAcrossCwd: false, rollbackLastTurn: true },
|
|
25406
|
-
subagents: { observe: true, readTranscript: true }
|
|
25431
|
+
subagents: { observe: true, readTranscript: true },
|
|
25432
|
+
autonomousTurns: { observe: true }
|
|
25407
25433
|
};
|
|
25408
25434
|
function capabilitiesForProfile(profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
25409
25435
|
return {
|
|
@@ -26748,6 +26774,52 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
26748
26774
|
});
|
|
26749
26775
|
return { turns };
|
|
26750
26776
|
}
|
|
26777
|
+
function compactionEvidenceForTurn(contents, snapshot, turnKey, beforeItems, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
26778
|
+
if (!nativeCommandsEnabled(profile))
|
|
26779
|
+
return [];
|
|
26780
|
+
const turnIndex = snapshot.turns.findIndex((turn) => turn.nativeTurnRef.nativeTurnKey === turnKey);
|
|
26781
|
+
if (turnIndex < 0)
|
|
26782
|
+
return [];
|
|
26783
|
+
const history = nativeDisplayHistoryRows(contents);
|
|
26784
|
+
const start = history.findIndex((row) => row.type === "message" && row.role === "user" && text2(row.id) === turnKey);
|
|
26785
|
+
if (start < 0)
|
|
26786
|
+
return [];
|
|
26787
|
+
const turnKeys = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
26788
|
+
const attributable = /* @__PURE__ */ new Set();
|
|
26789
|
+
for (let index = start - 1; index >= 0; index -= 1) {
|
|
26790
|
+
const row = history[index];
|
|
26791
|
+
if (!row || !isNativeCompactionSummary(row))
|
|
26792
|
+
break;
|
|
26793
|
+
attributable.add(`compact-${text2(row.id)}`);
|
|
26794
|
+
}
|
|
26795
|
+
let nextTurn = history.length;
|
|
26796
|
+
for (let index = start + 1; index < history.length; index += 1) {
|
|
26797
|
+
const row = history[index];
|
|
26798
|
+
if (row?.type === "message" && row.role === "user" && turnKeys.has(text2(row.id))) {
|
|
26799
|
+
nextTurn = index;
|
|
26800
|
+
break;
|
|
26801
|
+
}
|
|
26802
|
+
}
|
|
26803
|
+
let bodyEnd = nextTurn - 1;
|
|
26804
|
+
if (nextTurn < history.length) {
|
|
26805
|
+
while (bodyEnd > start && isNativeCompactionSummary(history[bodyEnd] ?? {}))
|
|
26806
|
+
bodyEnd -= 1;
|
|
26807
|
+
}
|
|
26808
|
+
for (let index = start + 1; index <= bodyEnd; index += 1) {
|
|
26809
|
+
const row = history[index];
|
|
26810
|
+
if (!row)
|
|
26811
|
+
continue;
|
|
26812
|
+
const data = record3(row.providerData);
|
|
26813
|
+
if (isNativeCompactionSummary(row) || row.role === "assistant" && (data.agent === "compact" || data.isCompactInternal === true)) {
|
|
26814
|
+
attributable.add(`compact-${text2(row.id)}`);
|
|
26815
|
+
}
|
|
26816
|
+
}
|
|
26817
|
+
const candidates = [
|
|
26818
|
+
...turnIndex > 0 ? snapshot.turns[turnIndex - 1]?.items ?? [] : [],
|
|
26819
|
+
...snapshot.turns[turnIndex]?.items ?? []
|
|
26820
|
+
];
|
|
26821
|
+
return candidates.filter(({ item }) => item.type === "contextCompaction" && !beforeItems.has(item.itemId) && attributable.has(item.itemId));
|
|
26822
|
+
}
|
|
26751
26823
|
function usageCount(value) {
|
|
26752
26824
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
26753
26825
|
}
|
|
@@ -31502,6 +31574,31 @@ var CODEBUDDY_DELEGATION_INSTRUCTIONS = `This Session runs inside codexhost.
|
|
|
31502
31574
|
When the user requests cross-Harness agent delegation, use the executable at the CODEXHOST_CLI_PATH environment variable through your native shell tool. Start with its --help and harness list commands, then use delegate start and thread send/read/wait/cancel as documented by the CLI. Pass --format compact when reporting results. Keep the inherited CODEXHOST_RUNTIME_ENDPOINT, CODEXHOST_RUNTIME_TOKEN and CODEXHOST_THREAD_ID environment variables for all such calls; they identify this Runtime and parent Thread. Do not print or expose their values, replace the configured executable, or start delegation unless the user's request authorizes it. Native CodeBuddy Agent subagents remain available for CodeBuddy-only work.`;
|
|
31503
31575
|
|
|
31504
31576
|
// ../codebuddy/dist/acp-client.js
|
|
31577
|
+
var sessionEndCarrier = "codexhost.codebuddy/sessionEnd";
|
|
31578
|
+
function carrySessionEnd(message) {
|
|
31579
|
+
if (!("method" in message) || message.method !== "session/update")
|
|
31580
|
+
return message;
|
|
31581
|
+
const params = record3(message.params);
|
|
31582
|
+
const update = record3(params.update);
|
|
31583
|
+
if (update.sessionUpdate !== "session_end")
|
|
31584
|
+
return message;
|
|
31585
|
+
return {
|
|
31586
|
+
...message,
|
|
31587
|
+
params: {
|
|
31588
|
+
...params,
|
|
31589
|
+
update: { sessionUpdate: "session_info_update", _meta: { [sessionEndCarrier]: update } }
|
|
31590
|
+
}
|
|
31591
|
+
};
|
|
31592
|
+
}
|
|
31593
|
+
function restoreSessionEnd(notification) {
|
|
31594
|
+
const update = notification.update;
|
|
31595
|
+
if (update.sessionUpdate !== "session_info_update" || !update._meta?.[sessionEndCarrier])
|
|
31596
|
+
return notification;
|
|
31597
|
+
return {
|
|
31598
|
+
...notification,
|
|
31599
|
+
update: update._meta[sessionEndCarrier]
|
|
31600
|
+
};
|
|
31601
|
+
}
|
|
31505
31602
|
var CodeBuddyAcpClient = class {
|
|
31506
31603
|
options;
|
|
31507
31604
|
operationTimeoutMs;
|
|
@@ -31552,7 +31649,7 @@ var CodeBuddyAcpClient = class {
|
|
|
31552
31649
|
this.#connection = new ClientSideConnection(() => ({
|
|
31553
31650
|
sessionUpdate: async (notification) => {
|
|
31554
31651
|
if (!this.#closing && !this.#failure)
|
|
31555
|
-
options.handlers.update(notification);
|
|
31652
|
+
options.handlers.update(restoreSessionEnd(notification));
|
|
31556
31653
|
},
|
|
31557
31654
|
requestPermission: (request) => !this.#exitFailure && !this.#closing && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
|
|
31558
31655
|
extMethod: async (method, params) => {
|
|
@@ -31562,13 +31659,24 @@ var CodeBuddyAcpClient = class {
|
|
|
31562
31659
|
return { outcome: "cancelled" };
|
|
31563
31660
|
return options.handlers.question(params);
|
|
31564
31661
|
}
|
|
31565
|
-
}),
|
|
31662
|
+
}), this.#protocolStream(invocation.arguments.includes("--serve")));
|
|
31566
31663
|
void this.#connection.closed.then(() => {
|
|
31567
31664
|
this.#fault(new CodeBuddyError("processExited", "ACP connection closed"));
|
|
31568
31665
|
}).catch((error62) => {
|
|
31569
31666
|
this.#fault(error62);
|
|
31570
31667
|
});
|
|
31571
31668
|
}
|
|
31669
|
+
#protocolStream(serve) {
|
|
31670
|
+
const stream = ndJsonStream2(Writable.toWeb(this.#child.stdin), Readable2.toWeb(this.#copyCleanup?.protocolOutput(this.#child.stdout) ?? (serve ? codeBuddyAcpOutput(this.#child.stdout) : this.#child.stdout)));
|
|
31671
|
+
return {
|
|
31672
|
+
writable: stream.writable,
|
|
31673
|
+
readable: stream.readable.pipeThrough(new TransformStream({
|
|
31674
|
+
transform: (message, controller) => {
|
|
31675
|
+
controller.enqueue(carrySessionEnd(message));
|
|
31676
|
+
}
|
|
31677
|
+
}))
|
|
31678
|
+
};
|
|
31679
|
+
}
|
|
31572
31680
|
#fault(error62) {
|
|
31573
31681
|
if (this.#closing || this.#failure)
|
|
31574
31682
|
return;
|
|
@@ -32804,6 +32912,125 @@ var CodeBuddySessionImport = class {
|
|
|
32804
32912
|
}
|
|
32805
32913
|
};
|
|
32806
32914
|
|
|
32915
|
+
// ../codebuddy/dist/session.js
|
|
32916
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
32917
|
+
|
|
32918
|
+
// ../codebuddy/dist/autonomous.js
|
|
32919
|
+
import { Buffer as Buffer3 } from "node:buffer";
|
|
32920
|
+
function readUnsolicitedTurn(update) {
|
|
32921
|
+
if (update.sessionUpdate !== "session_info_update")
|
|
32922
|
+
return;
|
|
32923
|
+
const announcement = record3(record3(update._meta)["codebuddy.ai/unsolicitedTurn"]);
|
|
32924
|
+
return announcement.reason === "background_drain" ? text2(announcement.requestId) || void 0 : void 0;
|
|
32925
|
+
}
|
|
32926
|
+
var AutonomousBufferBudget = class {
|
|
32927
|
+
#frames = 0;
|
|
32928
|
+
#bytes = 0;
|
|
32929
|
+
hold(value) {
|
|
32930
|
+
const bytes = Buffer3.byteLength(JSON.stringify(value), "utf8");
|
|
32931
|
+
if (this.#frames >= 2048 || this.#bytes + bytes > 4 * 1024 * 1024)
|
|
32932
|
+
throw new CodeBuddyError("protocolError", "Native autonomous Turn output exceeded its buffer bound");
|
|
32933
|
+
this.#frames += 1;
|
|
32934
|
+
this.#bytes += bytes;
|
|
32935
|
+
return bytes;
|
|
32936
|
+
}
|
|
32937
|
+
release(frames, bytes) {
|
|
32938
|
+
this.#frames -= frames;
|
|
32939
|
+
this.#bytes -= bytes;
|
|
32940
|
+
}
|
|
32941
|
+
};
|
|
32942
|
+
var CodeBuddyAutonomousFrames = class {
|
|
32943
|
+
budget;
|
|
32944
|
+
#frames = [];
|
|
32945
|
+
#bytes = 0;
|
|
32946
|
+
constructor(budget) {
|
|
32947
|
+
this.budget = budget;
|
|
32948
|
+
}
|
|
32949
|
+
push(frame) {
|
|
32950
|
+
this.#bytes += this.budget.hold(frame);
|
|
32951
|
+
this.#frames.push(frame);
|
|
32952
|
+
}
|
|
32953
|
+
drain() {
|
|
32954
|
+
this.budget.release(this.#frames.length, this.#bytes);
|
|
32955
|
+
this.#bytes = 0;
|
|
32956
|
+
return this.#frames.splice(0);
|
|
32957
|
+
}
|
|
32958
|
+
};
|
|
32959
|
+
var CodeBuddyAutonomousTurns = class {
|
|
32960
|
+
#rounds = [];
|
|
32961
|
+
#budget = new AutonomousBufferBudget();
|
|
32962
|
+
#open;
|
|
32963
|
+
#announcements = 0;
|
|
32964
|
+
get announcements() {
|
|
32965
|
+
return this.#announcements;
|
|
32966
|
+
}
|
|
32967
|
+
announce(requestId) {
|
|
32968
|
+
if (this.#open)
|
|
32969
|
+
throw new CodeBuddyError("protocolError", "Native autonomous Turns overlapped");
|
|
32970
|
+
const announcementBytes = this.#budget.hold({
|
|
32971
|
+
sessionUpdate: "session_info_update",
|
|
32972
|
+
requestId
|
|
32973
|
+
});
|
|
32974
|
+
const identity2 = Promise.withResolvers();
|
|
32975
|
+
const round = {
|
|
32976
|
+
frames: new CodeBuddyAutonomousFrames(this.#budget),
|
|
32977
|
+
identity: identity2.promise,
|
|
32978
|
+
resolveIdentity: identity2.resolve,
|
|
32979
|
+
announcementBytes,
|
|
32980
|
+
ended: false,
|
|
32981
|
+
started: false
|
|
32982
|
+
};
|
|
32983
|
+
this.#announcements += 1;
|
|
32984
|
+
this.#rounds.push(round);
|
|
32985
|
+
this.#open = round;
|
|
32986
|
+
return round;
|
|
32987
|
+
}
|
|
32988
|
+
/** IDs can be reused or change during admission; the connection interval owns the end. */
|
|
32989
|
+
end(requestId) {
|
|
32990
|
+
const round = this.#open;
|
|
32991
|
+
if (!round)
|
|
32992
|
+
return;
|
|
32993
|
+
round.terminalBytes = this.#budget.hold({ sessionUpdate: "session_end", requestId });
|
|
32994
|
+
round.ended = true;
|
|
32995
|
+
this.#open = void 0;
|
|
32996
|
+
return round;
|
|
32997
|
+
}
|
|
32998
|
+
start(round, turnId) {
|
|
32999
|
+
round.started = true;
|
|
33000
|
+
round.resolveIdentity(turnId);
|
|
33001
|
+
}
|
|
33002
|
+
owner() {
|
|
33003
|
+
return this.#open;
|
|
33004
|
+
}
|
|
33005
|
+
hasRounds() {
|
|
33006
|
+
return this.#rounds.length > 0;
|
|
33007
|
+
}
|
|
33008
|
+
interactionIdentity(round, request) {
|
|
33009
|
+
const bytes = this.#budget.hold(request);
|
|
33010
|
+
return round.identity.finally(() => this.#budget.release(1, bytes));
|
|
33011
|
+
}
|
|
33012
|
+
next() {
|
|
33013
|
+
return this.#rounds.find((round) => !round.started);
|
|
33014
|
+
}
|
|
33015
|
+
finish(round) {
|
|
33016
|
+
const index = this.#rounds.indexOf(round);
|
|
33017
|
+
if (index < 0)
|
|
33018
|
+
return;
|
|
33019
|
+
round.frames.drain();
|
|
33020
|
+
this.#budget.release(1, round.announcementBytes);
|
|
33021
|
+
if (round.terminalBytes !== void 0)
|
|
33022
|
+
this.#budget.release(1, round.terminalBytes);
|
|
33023
|
+
this.#rounds.splice(index, 1);
|
|
33024
|
+
if (this.#open === round)
|
|
33025
|
+
this.#open = void 0;
|
|
33026
|
+
round.resolveIdentity(void 0);
|
|
33027
|
+
}
|
|
33028
|
+
close() {
|
|
33029
|
+
for (const round of [...this.#rounds])
|
|
33030
|
+
this.finish(round);
|
|
33031
|
+
}
|
|
33032
|
+
};
|
|
33033
|
+
|
|
32807
33034
|
// ../codebuddy/dist/interactions.js
|
|
32808
33035
|
var CodeBuddyInteractions = class {
|
|
32809
33036
|
emit;
|
|
@@ -33346,6 +33573,7 @@ var CodeBuddySession = class {
|
|
|
33346
33573
|
#ref;
|
|
33347
33574
|
#state = {};
|
|
33348
33575
|
#active;
|
|
33576
|
+
#autonomous = new CodeBuddyAutonomousTurns();
|
|
33349
33577
|
#busy = false;
|
|
33350
33578
|
#closed = false;
|
|
33351
33579
|
#closing;
|
|
@@ -33416,22 +33644,7 @@ var CodeBuddySession = class {
|
|
|
33416
33644
|
}
|
|
33417
33645
|
return;
|
|
33418
33646
|
}
|
|
33419
|
-
|
|
33420
|
-
return;
|
|
33421
|
-
if ((text2(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text2(update.toolCallId)}`)) && this.subagents.update(update))
|
|
33422
|
-
return;
|
|
33423
|
-
if (update.sessionUpdate === "config_option_update" && this.#config)
|
|
33424
|
-
this.#apply(configuration(update.configOptions, this.profile));
|
|
33425
|
-
if (update.sessionUpdate === "usage_update" && typeof update.used === "number" && typeof update.size === "number" && update.size > 0) {
|
|
33426
|
-
this.#context = {
|
|
33427
|
-
contextUsedTokens: update.used,
|
|
33428
|
-
contextWindowTokens: update.size,
|
|
33429
|
-
contextUsagePercent: update.used / update.size * 100
|
|
33430
|
-
};
|
|
33431
|
-
this.#emitUsage();
|
|
33432
|
-
void this.refreshUsage();
|
|
33433
|
-
}
|
|
33434
|
-
this.#active?.output.update(update);
|
|
33647
|
+
this.#dispatchUpdate(update);
|
|
33435
33648
|
} catch (error62) {
|
|
33436
33649
|
if (this.#replay)
|
|
33437
33650
|
this.#replay.fault ??= { error: error62 };
|
|
@@ -33439,8 +33652,12 @@ var CodeBuddySession = class {
|
|
|
33439
33652
|
this.#onFault(error62);
|
|
33440
33653
|
}
|
|
33441
33654
|
},
|
|
33442
|
-
permission: (request) => generation
|
|
33443
|
-
|
|
33655
|
+
permission: (request) => generation !== this.#generation || request.sessionId !== this.#ref?.nativeSessionId ? Promise.resolve({ outcome: { outcome: "cancelled" } }) : this.#interactionTurn(request, (turnId) => this.#interactions.permission(turnId, request), {
|
|
33656
|
+
outcome: { outcome: "cancelled" }
|
|
33657
|
+
}),
|
|
33658
|
+
question: (params) => generation !== this.#generation || params.sessionId !== this.#ref?.nativeSessionId ? Promise.resolve({ outcome: "cancelled" }) : this.#interactionTurn(params, (turnId) => this.#interactions.question(turnId, params), {
|
|
33659
|
+
outcome: "cancelled"
|
|
33660
|
+
})
|
|
33444
33661
|
}
|
|
33445
33662
|
});
|
|
33446
33663
|
}
|
|
@@ -33487,31 +33704,40 @@ var CodeBuddySession = class {
|
|
|
33487
33704
|
const saved = this.input.kind === "resume" && record3(this.input.nativeRef.locator).codebuddyDerived === 1 ? record3(record3(this.input.nativeRef.locator).configuration) : {};
|
|
33488
33705
|
if (this.input.kind === "resume")
|
|
33489
33706
|
this.#ref = this.input.nativeRef;
|
|
33490
|
-
const
|
|
33491
|
-
this.#
|
|
33492
|
-
|
|
33493
|
-
|
|
33494
|
-
|
|
33495
|
-
|
|
33496
|
-
|
|
33497
|
-
|
|
33498
|
-
|
|
33499
|
-
|
|
33500
|
-
|
|
33501
|
-
|
|
33502
|
-
|
|
33503
|
-
|
|
33504
|
-
|
|
33505
|
-
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33509
|
-
|
|
33510
|
-
|
|
33511
|
-
|
|
33512
|
-
|
|
33513
|
-
|
|
33514
|
-
|
|
33707
|
+
const replay = {};
|
|
33708
|
+
this.#replay = replay;
|
|
33709
|
+
const generation = this.#generation;
|
|
33710
|
+
try {
|
|
33711
|
+
const opened = await this.#openClient();
|
|
33712
|
+
this.#ref = nativeSessionRefSchema.parse({
|
|
33713
|
+
harnessId: this.profile.harnessId,
|
|
33714
|
+
nativeSessionId: opened.sessionId,
|
|
33715
|
+
formatVersion: 1,
|
|
33716
|
+
...this.#ref?.locator || this.capabilities.history.fork ? {
|
|
33717
|
+
locator: {
|
|
33718
|
+
...record3(this.#ref?.locator),
|
|
33719
|
+
...this.capabilities.history.fork ? { boundCwd: codeBuddyCanonicalCwd(this.input.cwd) } : {}
|
|
33720
|
+
}
|
|
33721
|
+
} : {}
|
|
33722
|
+
});
|
|
33723
|
+
this.#apply(configuration(opened.configOptions, this.profile), false);
|
|
33724
|
+
if (this.input.kind === "create" && this.input.executionPolicy === "unattended-full-access") {
|
|
33725
|
+
await this.#configure("mode", "fullAccess");
|
|
33726
|
+
} else if (this.input.permissionModeId || text2(saved.mode))
|
|
33727
|
+
await this.#configure("mode", this.input.permissionModeId ?? text2(saved.mode));
|
|
33728
|
+
if (this.input.model || text2(saved.model))
|
|
33729
|
+
await this.#configure("model", this.input.model?.id ?? text2(saved.model));
|
|
33730
|
+
if (this.input.thinkingOptionId || text2(saved.thinking))
|
|
33731
|
+
await this.#configure("thought_level", this.input.thinkingOptionId ?? text2(saved.thinking));
|
|
33732
|
+
this.#assertClient(generation);
|
|
33733
|
+
if (!this.profile.staticCommandCatalog && replay.commands)
|
|
33734
|
+
this.#commands = replay.commands;
|
|
33735
|
+
this.initialState = { ...this.#state };
|
|
33736
|
+
this.initialUsage = this.#usage;
|
|
33737
|
+
} finally {
|
|
33738
|
+
this.#replay = void 0;
|
|
33739
|
+
}
|
|
33740
|
+
this.#flushAutonomous();
|
|
33515
33741
|
}
|
|
33516
33742
|
#emit(event) {
|
|
33517
33743
|
event = configureSubagentEvent(event, this.#subagentConfiguration());
|
|
@@ -33536,6 +33762,140 @@ var CodeBuddySession = class {
|
|
|
33536
33762
|
if (historical || !complete)
|
|
33537
33763
|
this.#emit({ type: "usage.history", complete });
|
|
33538
33764
|
}
|
|
33765
|
+
/** Routes one native frame to the Host Turn, a native drain round, or its buffer. */
|
|
33766
|
+
#dispatchUpdate(update) {
|
|
33767
|
+
const unsolicited = readUnsolicitedTurn(update);
|
|
33768
|
+
if (unsolicited) {
|
|
33769
|
+
this.#autonomous.announce(unsolicited);
|
|
33770
|
+
this.#flushAutonomous();
|
|
33771
|
+
return;
|
|
33772
|
+
}
|
|
33773
|
+
if (update.sessionUpdate === "session_end") {
|
|
33774
|
+
const round = this.#autonomous.end(text2(record3(update._meta)["codebuddy.ai/requestId"]));
|
|
33775
|
+
if (!round)
|
|
33776
|
+
return;
|
|
33777
|
+
if (round.started)
|
|
33778
|
+
void this.#finishAutonomous(round);
|
|
33779
|
+
else
|
|
33780
|
+
this.#flushAutonomous();
|
|
33781
|
+
return;
|
|
33782
|
+
}
|
|
33783
|
+
const route = this.#autonomous.owner();
|
|
33784
|
+
if (route?.started) {
|
|
33785
|
+
if (!this.#replay)
|
|
33786
|
+
this.#applyUpdate(update);
|
|
33787
|
+
return;
|
|
33788
|
+
}
|
|
33789
|
+
if (route) {
|
|
33790
|
+
route.frames.push(update);
|
|
33791
|
+
return;
|
|
33792
|
+
}
|
|
33793
|
+
if (this.#replay)
|
|
33794
|
+
return;
|
|
33795
|
+
this.#applyUpdate(update);
|
|
33796
|
+
}
|
|
33797
|
+
/** An announced native interval owns Interactions before the prior prompt's finally runs. */
|
|
33798
|
+
#interactionTurn(request, run, cancelled) {
|
|
33799
|
+
if (this.#closed || this.#fault)
|
|
33800
|
+
return Promise.resolve(cancelled);
|
|
33801
|
+
const round = this.#autonomous.owner();
|
|
33802
|
+
if (round) {
|
|
33803
|
+
let identity2;
|
|
33804
|
+
try {
|
|
33805
|
+
identity2 = this.#autonomous.interactionIdentity(round, request);
|
|
33806
|
+
} catch (error62) {
|
|
33807
|
+
if (this.#replay)
|
|
33808
|
+
this.#replay.fault ??= { error: error62 };
|
|
33809
|
+
else
|
|
33810
|
+
this.#onFault(error62);
|
|
33811
|
+
return Promise.resolve(cancelled);
|
|
33812
|
+
}
|
|
33813
|
+
return identity2.then((turnId) => {
|
|
33814
|
+
const active3 = this.#active;
|
|
33815
|
+
return turnId && active3?.autonomous?.round === round && !active3.cancelled && !active3.done ? run(turnId) : cancelled;
|
|
33816
|
+
});
|
|
33817
|
+
}
|
|
33818
|
+
const active2 = this.#active;
|
|
33819
|
+
return active2 && !this.#replay && !active2.cancelled && !active2.autonomous && !active2.promptSettled ? run(active2.command.turnId) : Promise.resolve(cancelled);
|
|
33820
|
+
}
|
|
33821
|
+
/** Frames of the active Turn, including a native drain Turn that now owns the Session. */
|
|
33822
|
+
#applyUpdate(update) {
|
|
33823
|
+
if ((text2(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text2(update.toolCallId)}`)) && this.subagents.update(update))
|
|
33824
|
+
return;
|
|
33825
|
+
if (update.sessionUpdate === "config_option_update" && this.#config)
|
|
33826
|
+
this.#apply(configuration(update.configOptions, this.profile));
|
|
33827
|
+
if (update.sessionUpdate === "usage_update" && typeof update.used === "number" && typeof update.size === "number" && update.size > 0) {
|
|
33828
|
+
this.#context = {
|
|
33829
|
+
contextUsedTokens: update.used,
|
|
33830
|
+
contextWindowTokens: update.size,
|
|
33831
|
+
contextUsagePercent: update.used / update.size * 100
|
|
33832
|
+
};
|
|
33833
|
+
this.#emitUsage();
|
|
33834
|
+
void this.refreshUsage();
|
|
33835
|
+
}
|
|
33836
|
+
if (!this.#active?.cancelled)
|
|
33837
|
+
this.#active?.output.update(update);
|
|
33838
|
+
}
|
|
33839
|
+
#flushAutonomous() {
|
|
33840
|
+
if (this.#active || this.#replay || this.#closed || this.#fault)
|
|
33841
|
+
return;
|
|
33842
|
+
const round = this.#autonomous.next();
|
|
33843
|
+
if (!round)
|
|
33844
|
+
return;
|
|
33845
|
+
this.#startAutonomous(round);
|
|
33846
|
+
try {
|
|
33847
|
+
for (const frame of round.frames.drain())
|
|
33848
|
+
this.#applyUpdate(frame);
|
|
33849
|
+
} catch (error62) {
|
|
33850
|
+
this.#onFault(error62);
|
|
33851
|
+
return;
|
|
33852
|
+
}
|
|
33853
|
+
if (round.ended)
|
|
33854
|
+
void this.#finishAutonomous(round);
|
|
33855
|
+
}
|
|
33856
|
+
#startAutonomous(round) {
|
|
33857
|
+
const turnId = hostTurnIdSchema.parse(randomUUID4());
|
|
33858
|
+
const completion = Promise.withResolvers();
|
|
33859
|
+
const active2 = {
|
|
33860
|
+
command: { type: "turn.start", turnId, input: [] },
|
|
33861
|
+
output: new CodeBuddyTurnOutput(turnId, this.input.cwd, (event) => this.#emit(event), this.profile),
|
|
33862
|
+
completion: completion.promise,
|
|
33863
|
+
nativeCommand: false,
|
|
33864
|
+
cancelled: false,
|
|
33865
|
+
done: false,
|
|
33866
|
+
autonomous: { round },
|
|
33867
|
+
settle: () => completion.resolve(void 0)
|
|
33868
|
+
};
|
|
33869
|
+
this.#active = active2;
|
|
33870
|
+
this.#autonomous.start(round, turnId);
|
|
33871
|
+
this.subagents.begin(turnId);
|
|
33872
|
+
this.#emit({ type: "turn.autonomous.started", turnId, input: [] });
|
|
33873
|
+
this.#emit({ type: "turn.started", turnId });
|
|
33874
|
+
}
|
|
33875
|
+
/** Completes the live interval without assigning persisted identity or inferring success. */
|
|
33876
|
+
async #finishAutonomous(round) {
|
|
33877
|
+
const active2 = this.#active;
|
|
33878
|
+
if (!active2?.autonomous || active2.autonomous.round !== round || active2.done)
|
|
33879
|
+
return;
|
|
33880
|
+
try {
|
|
33881
|
+
const outcome = { status: active2.cancelled ? "cancelled" : "succeeded" };
|
|
33882
|
+
if (active2.cancelled) {
|
|
33883
|
+
const recovery = (async () => {
|
|
33884
|
+
await this.#retireClient();
|
|
33885
|
+
if (this.#closed || this.#fault)
|
|
33886
|
+
return;
|
|
33887
|
+
await this.#resumeClient();
|
|
33888
|
+
})();
|
|
33889
|
+
void recovery.catch(() => {
|
|
33890
|
+
});
|
|
33891
|
+
await bounded(Promise.race([recovery, active2.completion]), 3e4, "ACP autonomous cancel recovery");
|
|
33892
|
+
}
|
|
33893
|
+
if (!active2.done && !this.#closed && !this.#fault)
|
|
33894
|
+
this.#finish(active2, outcome);
|
|
33895
|
+
} catch (error62) {
|
|
33896
|
+
this.#onFault(error62);
|
|
33897
|
+
}
|
|
33898
|
+
}
|
|
33539
33899
|
#apply(config2, emit = true) {
|
|
33540
33900
|
if (this.#state.effectiveModel && this.#state.effectiveModel.id !== config2.state.effectiveModel?.id) {
|
|
33541
33901
|
this.#context = {};
|
|
@@ -33587,6 +33947,9 @@ var CodeBuddySession = class {
|
|
|
33587
33947
|
}
|
|
33588
33948
|
}
|
|
33589
33949
|
async #snapshot(historyTimeout) {
|
|
33950
|
+
return (await this.#snapshotWithHistory(historyTimeout)).snapshot;
|
|
33951
|
+
}
|
|
33952
|
+
async #snapshotWithHistory(historyTimeout) {
|
|
33590
33953
|
if (!this.#ref)
|
|
33591
33954
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
33592
33955
|
const read = this.#history(this.#ref);
|
|
@@ -33598,7 +33961,7 @@ var CodeBuddySession = class {
|
|
|
33598
33961
|
this.#hasTurn = true;
|
|
33599
33962
|
this.#usage = historyUsage(history);
|
|
33600
33963
|
this.#meterHistory(history, false);
|
|
33601
|
-
return { ...this.subagents.project(snapshot), state: this.#state };
|
|
33964
|
+
return { snapshot: { ...this.subagents.project(snapshot), state: this.#state }, history };
|
|
33602
33965
|
}
|
|
33603
33966
|
/** Read persisted request usage without waiting for the ACP prompt (including tool waits). */
|
|
33604
33967
|
async refreshUsage() {
|
|
@@ -33633,7 +33996,7 @@ var CodeBuddySession = class {
|
|
|
33633
33996
|
async #readSnapshot() {
|
|
33634
33997
|
if (this.#closed || this.#fault)
|
|
33635
33998
|
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
33636
|
-
if (this.#busy || this.#active)
|
|
33999
|
+
if (this.#busy || this.#replay || this.#active && (!this.#active.autonomous || this.#active.cancelled))
|
|
33637
34000
|
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
33638
34001
|
this.#busy = true;
|
|
33639
34002
|
try {
|
|
@@ -33654,6 +34017,14 @@ var CodeBuddySession = class {
|
|
|
33654
34017
|
return failure2("unsupported", "Command is not available in this Session", this.profile);
|
|
33655
34018
|
return this.#execute(command, invocation);
|
|
33656
34019
|
}
|
|
34020
|
+
/** ACP `session/cancel` carries only the Session ID; send it only while this Turn owns execution. */
|
|
34021
|
+
#ownsNativeExecution(active2) {
|
|
34022
|
+
if (active2.done || this.#needsResume)
|
|
34023
|
+
return false;
|
|
34024
|
+
if (active2.autonomous)
|
|
34025
|
+
return !active2.autonomous.round.ended && this.#autonomous.owner() === active2.autonomous.round;
|
|
34026
|
+
return !active2.promptSettled && !this.#autonomous.hasRounds();
|
|
34027
|
+
}
|
|
33657
34028
|
async #execute(command, invocation) {
|
|
33658
34029
|
if (this.#closed || this.#fault)
|
|
33659
34030
|
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
@@ -33665,27 +34036,29 @@ var CodeBuddySession = class {
|
|
|
33665
34036
|
const active2 = this.#active;
|
|
33666
34037
|
if (!active2 || active2.command.turnId !== command.turnId || !this.#ref)
|
|
33667
34038
|
return failure2("invalidRequest", "Turn is not active", this.profile);
|
|
33668
|
-
if (
|
|
33669
|
-
|
|
33670
|
-
|
|
33671
|
-
|
|
33672
|
-
|
|
33673
|
-
|
|
33674
|
-
|
|
33675
|
-
|
|
33676
|
-
|
|
33677
|
-
|
|
33678
|
-
|
|
33679
|
-
|
|
33680
|
-
|
|
33681
|
-
|
|
33682
|
-
|
|
33683
|
-
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error62) => {
|
|
33684
|
-
if (this.#active === active2 && !this.#needsResume)
|
|
33685
|
-
this.#onFault(error62);
|
|
33686
|
-
});
|
|
34039
|
+
if (active2.cancelled)
|
|
34040
|
+
return { ok: true, value: { cancellationRequested: true } };
|
|
34041
|
+
if (!this.#ownsNativeExecution(active2))
|
|
34042
|
+
return failure2("invalidState", "Turn is already completing", this.profile);
|
|
34043
|
+
active2.cancelled = true;
|
|
34044
|
+
const generation = this.#generation;
|
|
34045
|
+
try {
|
|
34046
|
+
const requested = this.#client.cancel(this.#ref.nativeSessionId);
|
|
34047
|
+
this.#interactions.close();
|
|
34048
|
+
await requested;
|
|
34049
|
+
} catch (error62) {
|
|
34050
|
+
if (generation === this.#generation) {
|
|
34051
|
+
if (this.#active === active2)
|
|
34052
|
+
this.#onFault(error62);
|
|
34053
|
+
return { ok: false, error: nativeError(error62, this.profile) };
|
|
33687
34054
|
}
|
|
33688
34055
|
}
|
|
34056
|
+
if (this.#active === active2 && !this.#closed) {
|
|
34057
|
+
void bounded(active2.completion, 3e4, "ACP cancel acknowledgement").catch((error62) => {
|
|
34058
|
+
if (this.#active === active2 && (active2.autonomous || !this.#needsResume))
|
|
34059
|
+
this.#onFault(error62);
|
|
34060
|
+
});
|
|
34061
|
+
}
|
|
33689
34062
|
return { ok: true, value: { cancellationRequested: true } };
|
|
33690
34063
|
}
|
|
33691
34064
|
if (this.#busy || this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
@@ -33695,8 +34068,14 @@ var CodeBuddySession = class {
|
|
|
33695
34068
|
if (command.type === "turn.start" || command.type === "command.execute") {
|
|
33696
34069
|
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()))
|
|
33697
34070
|
return failure2("invalidRequest", "A nonempty text prompt is required", this.profile);
|
|
33698
|
-
|
|
34071
|
+
const drainBefore = this.#autonomous.announcements;
|
|
34072
|
+
if (this.#needsResume) {
|
|
33699
34073
|
await this.#resumeClient();
|
|
34074
|
+
if (this.#closed || this.#fault)
|
|
34075
|
+
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
34076
|
+
if (this.#active || this.#autonomous.announcements !== drainBefore)
|
|
34077
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
34078
|
+
}
|
|
33700
34079
|
const nativeCommand = command.type === "command.execute" || nativeCommandsEnabled(this.profile) && this.#commands.commands.some((entry) => entry.invocation === invocation);
|
|
33701
34080
|
if (command.type === "command.execute") {
|
|
33702
34081
|
const parsed = commandPrompt(command, this.#commands, this.profile);
|
|
@@ -33709,14 +34088,12 @@ var CodeBuddySession = class {
|
|
|
33709
34088
|
};
|
|
33710
34089
|
}
|
|
33711
34090
|
const snapshot = await this.#snapshot();
|
|
33712
|
-
const before = new Set(snapshot.turns.map((turn) => turn.nativeTurnRef.nativeTurnKey));
|
|
33713
|
-
const beforeItems = new Set(snapshot.turns.flatMap((turn) => turn.items.map((snapshot2) => snapshot2.item.itemId)));
|
|
33714
34091
|
if (this.#closed || this.#fault)
|
|
33715
34092
|
return failure2("invalidState", "Session closed before Turn start", this.profile);
|
|
34093
|
+
if (this.#active || this.#autonomous.announcements !== drainBefore)
|
|
34094
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
33716
34095
|
const active2 = {
|
|
33717
34096
|
command,
|
|
33718
|
-
before,
|
|
33719
|
-
beforeItems,
|
|
33720
34097
|
output: new CodeBuddyTurnOutput(command.turnId, this.input.cwd, (event) => this.#emit(event), this.profile),
|
|
33721
34098
|
nativeCommand,
|
|
33722
34099
|
cancelled: false,
|
|
@@ -33726,11 +34103,16 @@ var CodeBuddySession = class {
|
|
|
33726
34103
|
this.#active = active2;
|
|
33727
34104
|
this.subagents.begin(command.turnId);
|
|
33728
34105
|
this.#emit({ type: "turn.started", turnId: command.turnId });
|
|
33729
|
-
active2.completion = this.#run(active2);
|
|
34106
|
+
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);
|
|
33730
34107
|
return { ok: true, value: { turnId: command.turnId } };
|
|
33731
34108
|
}
|
|
33732
|
-
if (this.#needsResume)
|
|
34109
|
+
if (this.#needsResume) {
|
|
33733
34110
|
await this.#resumeClient();
|
|
34111
|
+
if (this.#closed || this.#fault)
|
|
34112
|
+
return failure2("invalidState", "Session is closed or faulted", this.profile);
|
|
34113
|
+
if (this.#active && (this.#active.cancelled || command.type !== "model.select" && command.type !== "thinking.select"))
|
|
34114
|
+
return failure2("sessionBusy", "Session is executing an operation", this.profile);
|
|
34115
|
+
}
|
|
33734
34116
|
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);
|
|
33735
34117
|
return { ok: true, value: { completed: true } };
|
|
33736
34118
|
} catch (error62) {
|
|
@@ -33739,12 +34121,14 @@ var CodeBuddySession = class {
|
|
|
33739
34121
|
this.#busy = false;
|
|
33740
34122
|
}
|
|
33741
34123
|
}
|
|
33742
|
-
async #run(active2) {
|
|
34124
|
+
async #run(active2, before, beforeItems, drainBefore) {
|
|
33743
34125
|
let cancellationConfirmed = false;
|
|
33744
34126
|
try {
|
|
33745
34127
|
if (!this.#ref)
|
|
33746
34128
|
throw new CodeBuddyError("invalidState", "Session is not open");
|
|
33747
|
-
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n"))
|
|
34129
|
+
const response = await this.#client.prompt(this.#ref.nativeSessionId, active2.command.input.map((item) => item.text).join("\n")).finally(() => {
|
|
34130
|
+
active2.promptSettled = true;
|
|
34131
|
+
});
|
|
33748
34132
|
if (active2.done || this.#closed)
|
|
33749
34133
|
return;
|
|
33750
34134
|
const stop = response.stopReason, meta3 = record3(response._meta);
|
|
@@ -33756,39 +34140,42 @@ var CodeBuddySession = class {
|
|
|
33756
34140
|
};
|
|
33757
34141
|
if (outcome.status === "cancelled") {
|
|
33758
34142
|
active2.cancelled = true;
|
|
33759
|
-
++this.#generation;
|
|
33760
|
-
this.#interactions.close();
|
|
33761
34143
|
try {
|
|
33762
|
-
await this.#
|
|
34144
|
+
await this.#retireClient();
|
|
33763
34145
|
} catch (error62) {
|
|
33764
34146
|
this.#onFault(error62);
|
|
33765
34147
|
return;
|
|
33766
34148
|
}
|
|
33767
34149
|
if (active2.done || this.#closed)
|
|
33768
34150
|
return;
|
|
33769
|
-
this.#needsResume = true;
|
|
33770
34151
|
cancellationConfirmed = true;
|
|
33771
34152
|
}
|
|
33772
|
-
const snapshot = await this.#
|
|
34153
|
+
const { snapshot, history } = await this.#snapshotWithHistory(cancellationConfirmed ? 1e3 : void 0);
|
|
33773
34154
|
if (active2.done || this.#closed)
|
|
33774
34155
|
return;
|
|
33775
|
-
const
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
const
|
|
33779
|
-
if (
|
|
34156
|
+
const drainOverlapped = this.#autonomous.announcements !== drainBefore;
|
|
34157
|
+
const userMessageId = text2(response.userMessageId);
|
|
34158
|
+
const added = snapshot.turns.filter((turn) => !before.has(turn.nativeTurnRef.nativeTurnKey));
|
|
34159
|
+
const persisted = userMessageId ? added.find((turn) => turn.nativeTurnRef.nativeTurnKey === userMessageId) : !drainOverlapped && added.length === 1 ? added[0] : void 0;
|
|
34160
|
+
if (userMessageId && !persisted)
|
|
33780
34161
|
throw new CodeBuddyError("protocolError", "ACP terminal and native history disagree on Turn identity");
|
|
33781
|
-
|
|
34162
|
+
if (!persisted && !active2.nativeCommand && outcome.status === "succeeded")
|
|
34163
|
+
throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
|
|
34164
|
+
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));
|
|
34165
|
+
active2.output.confirmCompaction(compactionItems);
|
|
33782
34166
|
if (active2.nativeCommand)
|
|
33783
|
-
active2.output.replayCommandResult((
|
|
34167
|
+
active2.output.replayCommandResult((persisted?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
|
|
34168
|
+
const nativeTurnRef = persisted?.nativeTurnRef;
|
|
34169
|
+
if (nativeTurnRef)
|
|
34170
|
+
this.#hasTurn = true;
|
|
33784
34171
|
const compactCommand = outcome.status !== "cancelled" && active2.nativeCommand && /^\/compact(?:\s|$)/u.test(active2.command.input.map((item) => item.text).join("\n").trim());
|
|
33785
|
-
const
|
|
33786
|
-
if (compactCommand && (!
|
|
34172
|
+
const persistedOutcome = compactCommand ? persisted?.outcome : void 0;
|
|
34173
|
+
if (compactCommand && (!persistedOutcome || persistedOutcome.status === "unknown"))
|
|
33787
34174
|
throw new CodeBuddyError("protocolError", "Native compaction terminal outcome was not persisted");
|
|
33788
|
-
const terminalOutcome =
|
|
34175
|
+
const terminalOutcome = persistedOutcome && persistedOutcome.status !== "unknown" ? persistedOutcome : outcome;
|
|
33789
34176
|
this.#finish(active2, {
|
|
33790
34177
|
...terminalOutcome,
|
|
33791
|
-
...
|
|
34178
|
+
...persisted?.checkpoint ? { checkpoint: persisted.checkpoint } : {}
|
|
33792
34179
|
}, nativeTurnRef);
|
|
33793
34180
|
if (this.#usage)
|
|
33794
34181
|
this.#emitUsage();
|
|
@@ -33797,6 +34184,13 @@ var CodeBuddySession = class {
|
|
|
33797
34184
|
this.#finish(active2, cancellationConfirmed ? { status: "cancelled" } : { status: "failed", error: nativeError(error62, this.profile) });
|
|
33798
34185
|
}
|
|
33799
34186
|
}
|
|
34187
|
+
async #retireClient() {
|
|
34188
|
+
++this.#generation;
|
|
34189
|
+
this.#interactions.close();
|
|
34190
|
+
this.#autonomous.close();
|
|
34191
|
+
await this.#client.close();
|
|
34192
|
+
this.#needsResume = true;
|
|
34193
|
+
}
|
|
33800
34194
|
/** Runs only under the native operation gate, after the old process has exited. */
|
|
33801
34195
|
async #resumeClient() {
|
|
33802
34196
|
const replay = {};
|
|
@@ -33812,8 +34206,11 @@ var CodeBuddySession = class {
|
|
|
33812
34206
|
if (!this.profile.staticCommandCatalog)
|
|
33813
34207
|
this.#commands = replay.commands ?? { commands: [] };
|
|
33814
34208
|
this.#needsResume = false;
|
|
34209
|
+
this.#replay = void 0;
|
|
34210
|
+
this.#flushAutonomous();
|
|
33815
34211
|
} catch (error62) {
|
|
33816
34212
|
++this.#generation;
|
|
34213
|
+
this.#autonomous.close();
|
|
33817
34214
|
try {
|
|
33818
34215
|
await candidate?.close();
|
|
33819
34216
|
} catch (closeError) {
|
|
@@ -33828,6 +34225,9 @@ var CodeBuddySession = class {
|
|
|
33828
34225
|
if (active2.done)
|
|
33829
34226
|
return;
|
|
33830
34227
|
active2.done = true;
|
|
34228
|
+
active2.settle?.();
|
|
34229
|
+
if (active2.autonomous)
|
|
34230
|
+
this.#autonomous.finish(active2.autonomous.round);
|
|
33831
34231
|
this.subagents.finish(outcome);
|
|
33832
34232
|
this.#interactions.close();
|
|
33833
34233
|
active2.output.finish(outcome.status, outcome.status === "failed" ? outcome.error : void 0);
|
|
@@ -33835,15 +34235,19 @@ var CodeBuddySession = class {
|
|
|
33835
34235
|
type: "turn.completed",
|
|
33836
34236
|
turnId: active2.command.turnId,
|
|
33837
34237
|
outcome,
|
|
34238
|
+
...active2.autonomous ? { ephemeral: true } : {},
|
|
33838
34239
|
...nativeTurnRef ? { nativeTurnRef } : {}
|
|
33839
34240
|
});
|
|
33840
34241
|
if (this.#active === active2)
|
|
33841
34242
|
this.#active = void 0;
|
|
34243
|
+
this.#flushAutonomous();
|
|
33842
34244
|
}
|
|
33843
34245
|
#onFault(error62) {
|
|
33844
34246
|
if (this.#fault || this.#closed)
|
|
33845
34247
|
return;
|
|
33846
34248
|
this.#fault = nativeError(error62, this.profile);
|
|
34249
|
+
this.#replay = void 0;
|
|
34250
|
+
this.#autonomous.close();
|
|
33847
34251
|
if (this.#active)
|
|
33848
34252
|
this.#finish(this.#active, { status: "failed", error: this.#fault });
|
|
33849
34253
|
this.#interactions.close();
|
|
@@ -33858,6 +34262,7 @@ var CodeBuddySession = class {
|
|
|
33858
34262
|
}
|
|
33859
34263
|
async #close() {
|
|
33860
34264
|
this.#closed = true;
|
|
34265
|
+
this.#autonomous.close();
|
|
33861
34266
|
this.#interactions.close();
|
|
33862
34267
|
try {
|
|
33863
34268
|
await this.#client.close();
|
|
@@ -34317,17 +34722,44 @@ var linuxSpec = {
|
|
|
34317
34722
|
command: "workbuddy",
|
|
34318
34723
|
installRoots: { posix: linuxRoots }
|
|
34319
34724
|
};
|
|
34320
|
-
function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable) {
|
|
34725
|
+
function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable, subdirectories = subdirectoryNames) {
|
|
34321
34726
|
const paths = targetPath(platform);
|
|
34322
34727
|
const entries = platform === "win32" ? ["WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy"] : [];
|
|
34323
34728
|
for (const entry of entries) {
|
|
34324
|
-
const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry));
|
|
34729
|
+
const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), subdirectories);
|
|
34325
34730
|
if (bundle)
|
|
34326
34731
|
return bundle;
|
|
34327
34732
|
}
|
|
34328
34733
|
return void 0;
|
|
34329
34734
|
}
|
|
34330
|
-
function
|
|
34735
|
+
function resolveWorkBuddyLauncherLayout(directory, platform, isExecutable, subdirectories) {
|
|
34736
|
+
if (platform !== "win32")
|
|
34737
|
+
return void 0;
|
|
34738
|
+
const paths = targetPath(platform);
|
|
34739
|
+
const versions = paths.join(directory, "versions");
|
|
34740
|
+
let names;
|
|
34741
|
+
try {
|
|
34742
|
+
names = newestFirst(subdirectories(versions));
|
|
34743
|
+
} catch {
|
|
34744
|
+
return void 0;
|
|
34745
|
+
}
|
|
34746
|
+
for (const name of names) {
|
|
34747
|
+
const root = paths.join(versions, name);
|
|
34748
|
+
for (const entry of [
|
|
34749
|
+
"WorkBuddy-app.exe",
|
|
34750
|
+
"WorkBuddy.exe",
|
|
34751
|
+
"WorkBuddy AI.exe",
|
|
34752
|
+
"WorkBuddyAI.exe"
|
|
34753
|
+
]) {
|
|
34754
|
+
const executable = paths.join(root, entry);
|
|
34755
|
+
const cli = paths.join(root, "resources", "app.asar.unpacked", "cli", "bin", "codebuddy");
|
|
34756
|
+
if (isExecutable(executable) && isExecutable(cli))
|
|
34757
|
+
return { executable, cli };
|
|
34758
|
+
}
|
|
34759
|
+
}
|
|
34760
|
+
return void 0;
|
|
34761
|
+
}
|
|
34762
|
+
function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories = subdirectoryNames) {
|
|
34331
34763
|
const specs = platform === "darwin" ? [macSpec] : platform === "win32" ? ["WorkBuddy AI", "WorkBuddy", "WorkBuddyAI"].map((command) => ({
|
|
34332
34764
|
id: "workbuddy",
|
|
34333
34765
|
command,
|
|
@@ -34346,6 +34778,9 @@ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExe
|
|
|
34346
34778
|
const cli = paths.join(resources, "app.asar.unpacked", "cli", "bin", "codebuddy");
|
|
34347
34779
|
if (isExecutable(cli))
|
|
34348
34780
|
return { executable: candidate, cli };
|
|
34781
|
+
const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
|
|
34782
|
+
if (launcher)
|
|
34783
|
+
return launcher;
|
|
34349
34784
|
}
|
|
34350
34785
|
return void 0;
|
|
34351
34786
|
}
|
|
@@ -34418,11 +34853,12 @@ function resolveWorkBuddyLaunch(environment, dependencies = {}) {
|
|
|
34418
34853
|
if (!configured && platform !== "darwin" && platform !== "win32" && platform !== "linux")
|
|
34419
34854
|
throw new CodeBuddyError("notInstalled", "WorkBuddy app discovery is unavailable on this platform; set CODEXHOST_WORKBUDDY_COMMAND for a compatible native runtime");
|
|
34420
34855
|
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
34856
|
+
const subdirectories = dependencies.subdirectories ?? subdirectoryNames;
|
|
34421
34857
|
const configuredDirectory = configured && (dependencies.isDirectory ?? isDirectory)(configured) ? configured : void 0;
|
|
34422
34858
|
const explicitExecutable = configured && !configuredDirectory ? resolveHarnessExecutable(workBuddyDiscoverySpec, { environment, platform, command: configured }, { isExecutable })?.executable : void 0;
|
|
34423
|
-
const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable) : void 0;
|
|
34859
|
+
const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories) : void 0;
|
|
34424
34860
|
const explicitDesktop = explicitExecutable !== void 0 && (platform === "win32" && /^(?:WorkBuddy|WorkBuddy AI|WorkBuddyAI)\.exe$/iu.test(targetPath(platform).basename(explicitExecutable)) || platform === "darwin" && /\/(?:WorkBuddy|WorkBuddy AI)\.app\/Contents\/MacOS\/Electron$/u.test(explicitExecutable) || platform === "linux" && targetPath(platform).basename(explicitExecutable) === "workbuddy");
|
|
34425
|
-
const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable) : explicitDesktop ? explicitBundle : void 0;
|
|
34861
|
+
const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, subdirectories) : explicitDesktop ? explicitBundle : void 0;
|
|
34426
34862
|
const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
|
|
34427
34863
|
if (!executable)
|
|
34428
34864
|
throw new CodeBuddyError("notInstalled", "WorkBuddy AI app or its bundled CLI is unavailable");
|