@dotobokuri/fleet-console 1.37.0 → 1.38.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/AGENTS.md +1 -1
- package/dist/cli.mjs +53 -1
- package/dist/client/assets/PretendardVariable.subset.0-BHUkWNFR.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.1-C-__qv6_.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.10-DzSWztS8.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.11-CqVmlKJn.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.12-BHuZSgT0.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.13-C42mj_j2.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.14-Bl512uUX.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.15-D04iXIE3.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.16-BQUnS2GX.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.17-BfZSA-Xc.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.18-CwAxMC3C.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.19-CJu4Zcdo.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.2-dCZkyKLw.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.20-Ig1-z3n5.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.21-yKPEdLXC.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.22-CSqxKoOs.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.23-DK80wi0t.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.24-CmkE8Q8D.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.25-CsoWBIZB.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.26-Sozl8dw8.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.27-CT6nuW9L.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.28-CpO0Y96p.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.29-D6hjrUWm.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.3-Dqw33sf4.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.30-CWDM1c0J.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.31-CdmyZ5mm.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.32-CGnFWD2i.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.33--0OT__YQ.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.34-CaCS33Md.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.35-DWFYRGLp.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.36-Dn5IBRQB.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.37-BD6FyOtY.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.38-D4hu443z.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.39-B_7wfth9.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.4-Bvh2YGoc.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.40-BDaOfdUe.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.41-BUACvzZC.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.42-Dp-5mnyL.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.43-DHdpry7N.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.44-qHopVhdd.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.45-BniyRFfm.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.46-BMRq7xC-.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.47-B-cWO2pw.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.48-Ct-fWrPO.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.49-BblQVys9.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.5-K_MNGNCe.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.50-C8IyFH7L.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.51-Bxd0gTAs.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.52-CNgqKOOJ.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.53-BSRnyb-u.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.54-Dt2-cQkx.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.55-jFgflYjX.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.56-BwZdvJZQ.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.57-BwFDg-Fs.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.58-DlucQts_.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.59-CMkWjhdo.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.6-Bxhohlcm.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.60-CeHezjjf.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.61-PUuTnod4.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.62-DGSAWCfb.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.63-B35xsm4O.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.64-CTbrgYF9.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.65-B66rjuyf.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.66-C3HqaDeY.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.67-BmuXdlDy.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.68-DS9B48d0.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.69-YT16ymcp.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.7-E2HaA55t.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.70-BUXiAGMT.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.71-DuPZj8us.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.72-pYYGrEQR.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.73-DMrK970F.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.74-D4tQnymK.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.75-CxKdrRNf.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.76-DhPm2b_q.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.77-DwaxqOC8.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.78-DhqRbBzT.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.79-XpoyPP38.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.8-CRbJhhyA.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.80-DsV9Qp_h.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.81-BZzF9Hb3.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.82-BgAHe30u.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.83-DF-zBLLe.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.84-Brb8EsYQ.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.85-Byo_x2hf.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.86-XG7lTN_6.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.87-Lzui2vbK.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.88-CqX6JSgh.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.89-DOzqWPpX.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.9-Btb3bmS6.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.90-BF7RiZjm.woff2 +0 -0
- package/dist/client/assets/PretendardVariable.subset.91-Csm0YNoH.woff2 +0 -0
- package/dist/client/assets/{_baseUniq-5ZwChDah.js → _baseUniq-DjwZK6Tv.js} +1 -1
- package/dist/client/assets/{arc-E1tMbaFV.js → arc-CsNVntqy.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-B4NlSadA.js → architectureDiagram-Q4EWVU46-Bi8y-wkL.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-CD-YIRsr.js → blockDiagram-DXYQGD6D-BB2SFu76.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CnQqEr8G.js → c4Diagram-AHTNJAMY-BBxhzDJZ.js} +1 -1
- package/dist/client/assets/channel-Ddn4Rope.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-CBwcU6wi.js → chunk-4BX2VUAB-CHPrg3nb.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-dvTB68tB.js → chunk-4TB4RGXK-DLvawyNq.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-BbJgnSb2.js → chunk-55IACEB6-CLptp70m.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-BZmdugC4.js → chunk-EDXVE4YY-DS0cHoGJ.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DHvrxUgj.js → chunk-FMBD7UC4-DHhgFtRl.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-DMBZS2Tk.js → chunk-OYMX7WX6-CK20Lrh5.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-hdwn0yqd.js → chunk-QZHKN3VN-BWu1gka4.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-CbP-7sbL.js → chunk-YZCP3GAM-Ce_uXK7W.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-qu46c_rd.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-qu46c_rd.js +1 -0
- package/dist/client/assets/clone-DDNlSib4.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-CAe4GCGZ.js → cose-bilkent-S5V4N54A-lmqr4Zox.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-DMEJwcre.js → dagre-KV5264BT-Cqf_UZn0.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-CUNTFHbl.js → diagram-5BDNPKRD-B0F2kqdZ.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BUR44CTL.js → diagram-G4DWMVQ6-Y5Zcbc98.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DH10do5_.js → diagram-MMDJMWI5-B-vHgBZG.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-CRLToeE6.js → diagram-TYMM5635-BfBWDsiG.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-Ds8X0gDu.js → erDiagram-SMLLAGMA-CB6H1ShS.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-G_d_Gmcs.js → flowDiagram-DWJPFMVM-BX9hx0Y6.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CRvHF2tU.js → ganttDiagram-T4ZO3ILL-CHQBgJ4X.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-jDeSbU3q.js → gitGraphDiagram-UUTBAWPF-kbhc2fZE.js} +1 -1
- package/dist/client/assets/{graph-5k0aoPuF.js → graph-yw0uXaMX.js} +1 -1
- package/dist/client/assets/index-B1Ew8y-o.css +1 -0
- package/dist/client/assets/index-CWK41DSi.js +452 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-YiEXq-b7.js → infoDiagram-42DDH7IO-BunmSTvD.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DIGUlQBC.js → ishikawaDiagram-UXIWVN3A-pI7F4-Qw.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-CVUsiYfG.js → journeyDiagram-VCZTEJTY-CncxtERF.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-C7Lu50vq.js → kanban-definition-6JOO6SKY-CuD4mvBd.js} +1 -1
- package/dist/client/assets/{layout-GNwZ2tq4.js → layout-DGY5fGik.js} +1 -1
- package/dist/client/assets/{linear-kMYE-PoA.js → linear-BYUWMe2Y.js} +1 -1
- package/dist/client/assets/{mermaid.core-DpzJvKxo.js → mermaid.core-Drc--ixx.js} +4 -4
- package/dist/client/assets/{min-D1uUUV6U.js → min-CJlVQqXb.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-Ck5YjDOb.js → mindmap-definition-QFDTVHPH-BAzsMkbE.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-ClEJYViq.js → pieDiagram-DEJITSTG-DHoVF7we.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D8UalGfe.js → quadrantDiagram-34T5L4WZ-DGVM0S1B.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-oPDnadqP.js → requirementDiagram-MS252O5E-Djmc_jRD.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-sfj8jPj8.js → sankeyDiagram-XADWPNL6-B09zCkQb.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-CdNxeg0P.js → sequenceDiagram-FGHM5R23-BrFxwAwj.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-BlhUqqQz.js → stateDiagram-FHFEXIEX-xzpsyAQ4.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CxkWw9en.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-B5BYCKye.js → timeline-definition-GMOUNBTQ-Kl-ES34i.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-BMpktFuz.js → vennDiagram-DHZGUBPP-w_yD8Rg6.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-CW3mIBOT.js → wardley-RL74JXVD-CaZiB9zS.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BKMwHoHK.js → wardleyDiagram-NUSXRM2D-CjUg4N9u.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-YCKgsPhn.js → xychartDiagram-5P7HB3ND-DsY1zkO5.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/terminal/routes.mjs +371 -95
- package/package.json +1 -1
- package/dist/client/assets/channel-CmNg3R9J.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-C4gcV_Y_.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-C4gcV_Y_.js +0 -1
- package/dist/client/assets/clone-Dkpldca2.js +0 -1
- package/dist/client/assets/index-BwZOsc1k.js +0 -452
- package/dist/client/assets/index-BwqqI28y.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DKsRFi9q.js +0 -1
|
@@ -26,18 +26,18 @@ var __export = (target, all) => {
|
|
|
26
26
|
function definePlugin(definition) {
|
|
27
27
|
return definition;
|
|
28
28
|
}
|
|
29
|
-
function registerRouter(ctx,
|
|
30
|
-
ctx.registerRouter(normalizePath(
|
|
29
|
+
function registerRouter(ctx, path48, handler) {
|
|
30
|
+
ctx.registerRouter(normalizePath(path48), handler);
|
|
31
31
|
}
|
|
32
|
-
function registerWsHandler(ctx,
|
|
33
|
-
ctx.registerWsHandler(normalizePath(
|
|
32
|
+
function registerWsHandler(ctx, path48, handler) {
|
|
33
|
+
ctx.registerWsHandler(normalizePath(path48), handler);
|
|
34
34
|
}
|
|
35
35
|
function registerLaunchCatalog(ctx, provider) {
|
|
36
36
|
return ctx.host.operations.registerLaunchCatalog(ctx.pluginId, provider);
|
|
37
37
|
}
|
|
38
|
-
function normalizePath(
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
38
|
+
function normalizePath(path48) {
|
|
39
|
+
if (path48.length === 0 || path48 === "/") return "/";
|
|
40
|
+
return path48;
|
|
41
41
|
}
|
|
42
42
|
var FLEET_DATA_DIR_NAME = ".fleet";
|
|
43
43
|
function getFleetDataDir() {
|
|
@@ -1650,10 +1650,10 @@ function mergeDefs(...defs) {
|
|
|
1650
1650
|
function cloneDef(schema) {
|
|
1651
1651
|
return mergeDefs(schema._zod.def);
|
|
1652
1652
|
}
|
|
1653
|
-
function getElementAtPath(obj,
|
|
1654
|
-
if (!
|
|
1653
|
+
function getElementAtPath(obj, path48) {
|
|
1654
|
+
if (!path48)
|
|
1655
1655
|
return obj;
|
|
1656
|
-
return
|
|
1656
|
+
return path48.reduce((acc, key) => acc?.[key], obj);
|
|
1657
1657
|
}
|
|
1658
1658
|
function promiseAllObject(promisesObj) {
|
|
1659
1659
|
const keys = Object.keys(promisesObj);
|
|
@@ -2062,11 +2062,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
2062
2062
|
}
|
|
2063
2063
|
return false;
|
|
2064
2064
|
}
|
|
2065
|
-
function prefixIssues(
|
|
2065
|
+
function prefixIssues(path48, issues) {
|
|
2066
2066
|
return issues.map((iss) => {
|
|
2067
2067
|
var _a3;
|
|
2068
2068
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2069
|
-
iss.path.unshift(
|
|
2069
|
+
iss.path.unshift(path48);
|
|
2070
2070
|
return iss;
|
|
2071
2071
|
});
|
|
2072
2072
|
}
|
|
@@ -2213,16 +2213,16 @@ function flattenError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
function formatError(error51, mapper = (issue3) => issue3.message) {
|
|
2215
2215
|
const fieldErrors = { _errors: [] };
|
|
2216
|
-
const processError = (error52,
|
|
2216
|
+
const processError = (error52, path48 = []) => {
|
|
2217
2217
|
for (const issue3 of error52.issues) {
|
|
2218
2218
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
2219
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
2219
|
+
issue3.errors.map((issues) => processError({ issues }, [...path48, ...issue3.path]));
|
|
2220
2220
|
} else if (issue3.code === "invalid_key") {
|
|
2221
|
-
processError({ issues: issue3.issues }, [...
|
|
2221
|
+
processError({ issues: issue3.issues }, [...path48, ...issue3.path]);
|
|
2222
2222
|
} else if (issue3.code === "invalid_element") {
|
|
2223
|
-
processError({ issues: issue3.issues }, [...
|
|
2223
|
+
processError({ issues: issue3.issues }, [...path48, ...issue3.path]);
|
|
2224
2224
|
} else {
|
|
2225
|
-
const fullpath = [...
|
|
2225
|
+
const fullpath = [...path48, ...issue3.path];
|
|
2226
2226
|
if (fullpath.length === 0) {
|
|
2227
2227
|
fieldErrors._errors.push(mapper(issue3));
|
|
2228
2228
|
} else {
|
|
@@ -2249,17 +2249,17 @@ function formatError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2249
2249
|
}
|
|
2250
2250
|
function treeifyError(error51, mapper = (issue3) => issue3.message) {
|
|
2251
2251
|
const result = { errors: [] };
|
|
2252
|
-
const processError = (error52,
|
|
2252
|
+
const processError = (error52, path48 = []) => {
|
|
2253
2253
|
var _a3, _b;
|
|
2254
2254
|
for (const issue3 of error52.issues) {
|
|
2255
2255
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
2256
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
2256
|
+
issue3.errors.map((issues) => processError({ issues }, [...path48, ...issue3.path]));
|
|
2257
2257
|
} else if (issue3.code === "invalid_key") {
|
|
2258
|
-
processError({ issues: issue3.issues }, [...
|
|
2258
|
+
processError({ issues: issue3.issues }, [...path48, ...issue3.path]);
|
|
2259
2259
|
} else if (issue3.code === "invalid_element") {
|
|
2260
|
-
processError({ issues: issue3.issues }, [...
|
|
2260
|
+
processError({ issues: issue3.issues }, [...path48, ...issue3.path]);
|
|
2261
2261
|
} else {
|
|
2262
|
-
const fullpath = [...
|
|
2262
|
+
const fullpath = [...path48, ...issue3.path];
|
|
2263
2263
|
if (fullpath.length === 0) {
|
|
2264
2264
|
result.errors.push(mapper(issue3));
|
|
2265
2265
|
continue;
|
|
@@ -2291,8 +2291,8 @@ function treeifyError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
function toDotPath(_path) {
|
|
2293
2293
|
const segs = [];
|
|
2294
|
-
const
|
|
2295
|
-
for (const seg of
|
|
2294
|
+
const path48 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2295
|
+
for (const seg of path48) {
|
|
2296
2296
|
if (typeof seg === "number")
|
|
2297
2297
|
segs.push(`[${seg}]`);
|
|
2298
2298
|
else if (typeof seg === "symbol")
|
|
@@ -14956,13 +14956,13 @@ function resolveRef(ref, ctx) {
|
|
|
14956
14956
|
if (!ref.startsWith("#")) {
|
|
14957
14957
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14958
14958
|
}
|
|
14959
|
-
const
|
|
14960
|
-
if (
|
|
14959
|
+
const path48 = ref.slice(1).split("/").filter(Boolean);
|
|
14960
|
+
if (path48.length === 0) {
|
|
14961
14961
|
return ctx.rootSchema;
|
|
14962
14962
|
}
|
|
14963
14963
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14964
|
-
if (
|
|
14965
|
-
const key =
|
|
14964
|
+
if (path48[0] === defsKey) {
|
|
14965
|
+
const key = path48[1];
|
|
14966
14966
|
if (!key || !ctx.defs[key]) {
|
|
14967
14967
|
throw new Error(`Reference not found: ${ref}`);
|
|
14968
14968
|
}
|
|
@@ -31419,7 +31419,7 @@ function engineExecuteOneShot(opts) {
|
|
|
31419
31419
|
model: opts.model,
|
|
31420
31420
|
promptIdleTimeout: opts.promptIdleTimeout,
|
|
31421
31421
|
effort
|
|
31422
|
-
}, opts.connectSystemPrompt, opts.authEnvResolver, mcpSetup?.mcpServers));
|
|
31422
|
+
}, opts.connectSystemPrompt, opts.authEnvResolver, opts.agentCliLaunchResolver, mcpSetup?.mcpServers));
|
|
31423
31423
|
if (opts.resumeSessionId) connectOpts.sessionId = opts.resumeSessionId;
|
|
31424
31424
|
const connectResult = await raceAbort(raceProviderFailure(client2.connect(connectOpts)), opts.signal);
|
|
31425
31425
|
await raceProviderFailure(applyResolvedEffort(client2, opts.cliType, model, effort));
|
|
@@ -31596,7 +31596,7 @@ async function setupExecutorMcp(cwd, signal, scopeId, reservedIds = [], serverBi
|
|
|
31596
31596
|
throw error51;
|
|
31597
31597
|
}
|
|
31598
31598
|
}
|
|
31599
|
-
async function buildConnectOptions(cli, cwd, overrides, systemPrompt, authEnvResolver, mcpServers) {
|
|
31599
|
+
async function buildConnectOptions(cli, cwd, overrides, systemPrompt, authEnvResolver, agentCliLaunchResolver, mcpServers) {
|
|
31600
31600
|
const options = { cwd, cli, autoApprove: true, clientInfo: CLIENT_INFO, timeout: 0, strictMcp: true, archiveSessionOnDisconnect: true };
|
|
31601
31601
|
if (overrides.model) options.model = overrides.model;
|
|
31602
31602
|
if (overrides.effort) options.effort = overrides.effort;
|
|
@@ -31607,7 +31607,14 @@ async function buildConnectOptions(cli, cwd, overrides, systemPrompt, authEnvRes
|
|
|
31607
31607
|
...overrides.model ? { model: overrides.model } : {},
|
|
31608
31608
|
...overrides.effort ? { effort: overrides.effort } : {}
|
|
31609
31609
|
});
|
|
31610
|
-
|
|
31610
|
+
const launch = await agentCliLaunchResolver?.(cli, {
|
|
31611
|
+
env,
|
|
31612
|
+
...overrides.model ? { model: overrides.model } : {},
|
|
31613
|
+
...overrides.effort ? { effort: overrides.effort } : {}
|
|
31614
|
+
});
|
|
31615
|
+
if (launch?.cliPath) options.cliPath = launch.cliPath;
|
|
31616
|
+
const mergedEnv = launch?.env ? { ...env, ...launch.env } : env;
|
|
31617
|
+
if (Object.keys(mergedEnv).length) options.env = mergedEnv;
|
|
31611
31618
|
return options;
|
|
31612
31619
|
}
|
|
31613
31620
|
function assertAuthEnvResolver(value) {
|
|
@@ -31964,6 +31971,7 @@ async function launchTaskForceJob(options) {
|
|
|
31964
31971
|
const handle = executeOneShot({
|
|
31965
31972
|
scopeId: carrierId,
|
|
31966
31973
|
authEnvResolver: deps.authEnvResolver,
|
|
31974
|
+
agentCliLaunchResolver: deps.agentCliLaunchResolver,
|
|
31967
31975
|
reservedExternalMcpServerIds: deps.reservedExternalMcpServerIds,
|
|
31968
31976
|
cliType,
|
|
31969
31977
|
request,
|
|
@@ -32463,6 +32471,7 @@ function buildCarrierDispatchToolSpec(registry3, deps, services) {
|
|
|
32463
32471
|
const handle = executeOneShot({
|
|
32464
32472
|
scopeId: carrierId,
|
|
32465
32473
|
authEnvResolver: deps.authEnvResolver,
|
|
32474
|
+
agentCliLaunchResolver: deps.agentCliLaunchResolver,
|
|
32466
32475
|
reservedExternalMcpServerIds: deps.reservedExternalMcpServerIds,
|
|
32467
32476
|
cliType: trackModelInfo.cliType,
|
|
32468
32477
|
request,
|
|
@@ -32889,6 +32898,7 @@ function createCarrierRuntime() {
|
|
|
32889
32898
|
const registry3 = createCarrierRegistry();
|
|
32890
32899
|
const dispatchContexts = new DispatchContextRegistry();
|
|
32891
32900
|
const inFlight = /* @__PURE__ */ new Set();
|
|
32901
|
+
let agentCliLaunchResolver;
|
|
32892
32902
|
let accepting = true;
|
|
32893
32903
|
const admission = {
|
|
32894
32904
|
get accepting() {
|
|
@@ -32917,12 +32927,23 @@ function createCarrierRuntime() {
|
|
|
32917
32927
|
dispatchServices,
|
|
32918
32928
|
dispatch: boundDispatch,
|
|
32919
32929
|
buildDispatchToolSpec(deps) {
|
|
32920
|
-
return boundDispatch.buildToolSpecs(
|
|
32930
|
+
return boundDispatch.buildToolSpecs({
|
|
32931
|
+
...deps,
|
|
32932
|
+
// host가 lifecycle 생성 뒤 resolver를 주입해도 이미 등록된 단일 dispatch 도구가
|
|
32933
|
+
// 실행 직전 최신 resolver를 읽도록 runtime 소유 closure로 연결한다.
|
|
32934
|
+
agentCliLaunchResolver: async (cli, context) => {
|
|
32935
|
+
const resolver = agentCliLaunchResolver ?? deps.agentCliLaunchResolver;
|
|
32936
|
+
return resolver ? resolver(cli, context) : {};
|
|
32937
|
+
}
|
|
32938
|
+
});
|
|
32921
32939
|
},
|
|
32922
32940
|
jobs: boundCarrierJobs,
|
|
32923
32941
|
personas: personas_exports,
|
|
32924
32942
|
store: { initStore },
|
|
32925
32943
|
stream: boundStream,
|
|
32944
|
+
setAgentCliLaunchResolver(resolver) {
|
|
32945
|
+
agentCliLaunchResolver = resolver;
|
|
32946
|
+
},
|
|
32926
32947
|
trackInFlight: dispatchServices.trackInFlight,
|
|
32927
32948
|
async cleanup() {
|
|
32928
32949
|
accepting = false;
|
|
@@ -32930,6 +32951,7 @@ function createCarrierRuntime() {
|
|
|
32930
32951
|
await Promise.allSettled(tasks.map((task) => task.cancel()));
|
|
32931
32952
|
await Promise.allSettled(tasks.map((task) => task.completion));
|
|
32932
32953
|
inFlight.clear();
|
|
32954
|
+
agentCliLaunchResolver = void 0;
|
|
32933
32955
|
dispatchContexts.dispose();
|
|
32934
32956
|
},
|
|
32935
32957
|
registerCarrierDefaults() {
|
|
@@ -42898,10 +42920,10 @@ function createShellTerminalLaunchResolver(deps = {}) {
|
|
|
42898
42920
|
const env = deps.env ?? process4.env;
|
|
42899
42921
|
const homedir2 = deps.homedir ?? DEFAULT_TERMINAL_CWD_FALLBACK;
|
|
42900
42922
|
const platform = deps.platform ?? process4.platform;
|
|
42901
|
-
return async (selectedCwd) => {
|
|
42923
|
+
return async (selectedCwd, context) => {
|
|
42902
42924
|
const cwd = selectedCwd || baseCwd || homedir2();
|
|
42903
42925
|
const shell = resolveWindowsLaunchBinary(resolveUserShell(env, platform), [], env, platform, "user shell");
|
|
42904
|
-
return { bin: shell.bin, args: shell.args, cwd, env: buildShellLaunchEnv(env), terminalName: TERMINAL_TERM };
|
|
42926
|
+
return { bin: shell.bin, args: shell.args, cwd, env: buildShellLaunchEnv(env, context?.colorScheme), terminalName: TERMINAL_TERM };
|
|
42905
42927
|
};
|
|
42906
42928
|
}
|
|
42907
42929
|
function startTerminalShell(launch, size) {
|
|
@@ -42959,10 +42981,13 @@ function resolveWindowsLaunchBinary(bin, args, env, platform, label) {
|
|
|
42959
42981
|
}
|
|
42960
42982
|
return { bin: resolved.bin, args: [...resolved.prefixArgs, ...args] };
|
|
42961
42983
|
}
|
|
42962
|
-
function buildShellLaunchEnv(env) {
|
|
42984
|
+
function buildShellLaunchEnv(env, colorScheme) {
|
|
42963
42985
|
return {
|
|
42964
42986
|
...stripConsoleInternalEnv(env),
|
|
42965
|
-
TERM: TERMINAL_TERM
|
|
42987
|
+
TERM: TERMINAL_TERM,
|
|
42988
|
+
// COLORFGBG는 배경을 질의하지 않는 CLI/TUI를 위한 고전적 극성 힌트다("fg;bg" ANSI 인덱스).
|
|
42989
|
+
// 값이 없으면 변수 자체를 싣지 않아 사용자 셸 환경의 기존 값을 훼손하지 않는다.
|
|
42990
|
+
...colorScheme ? { COLORFGBG: colorScheme === "light" ? "0;15" : "15;0" } : {}
|
|
42966
42991
|
};
|
|
42967
42992
|
}
|
|
42968
42993
|
|
|
@@ -43166,7 +43191,8 @@ function createTerminalSessionManager(deps) {
|
|
|
43166
43191
|
...context.theaterId ? { theaterId: context.theaterId } : {},
|
|
43167
43192
|
...context.kind ? { kind: context.kind } : {},
|
|
43168
43193
|
...context.cliId ? { cliId: context.cliId } : {},
|
|
43169
|
-
...context.resumeSessionId ? { resumeSessionId: context.resumeSessionId } : {}
|
|
43194
|
+
...context.resumeSessionId ? { resumeSessionId: context.resumeSessionId } : {},
|
|
43195
|
+
...context.colorScheme ? { colorScheme: context.colorScheme } : {}
|
|
43170
43196
|
});
|
|
43171
43197
|
let pty;
|
|
43172
43198
|
let ptyFds = [];
|
|
@@ -43659,41 +43685,198 @@ function hashablePath(entry) {
|
|
|
43659
43685
|
if (!filePath || filePath.includes("\n")) return null;
|
|
43660
43686
|
return filePath;
|
|
43661
43687
|
}
|
|
43688
|
+
var AGENT_CLI_PATHS_STORAGE_KEY = "agent-cli-paths";
|
|
43689
|
+
var AGENT_CLI_COMMANDS = ["claude", "codex", "opencode", "cursor-agent"];
|
|
43690
|
+
var OVERRIDE_ENV_BY_COMMAND = {
|
|
43691
|
+
claude: "CLAUDE_BIN",
|
|
43692
|
+
codex: "CODEX_BIN",
|
|
43693
|
+
"cursor-agent": "CURSOR_AGENT_BIN"
|
|
43694
|
+
};
|
|
43695
|
+
var agentCliPathsWriteTail = Promise.resolve();
|
|
43696
|
+
function createAgentCliPathStore(storage, pluginId) {
|
|
43697
|
+
return {
|
|
43698
|
+
read: async () => normalizeAgentCliPaths(
|
|
43699
|
+
await storage.readJson(pluginId, AGENT_CLI_PATHS_STORAGE_KEY)
|
|
43700
|
+
),
|
|
43701
|
+
writePath: (cliCommand, executablePath) => serializeAgentCliPathsWrite(async () => {
|
|
43702
|
+
const current = normalizeAgentCliPaths(await storage.readJson(pluginId, AGENT_CLI_PATHS_STORAGE_KEY));
|
|
43703
|
+
const paths = { ...current.paths };
|
|
43704
|
+
const normalized = executablePath ?? "";
|
|
43705
|
+
if (normalized.length === 0) delete paths[cliCommand];
|
|
43706
|
+
else paths[cliCommand] = normalized;
|
|
43707
|
+
const next = { version: 1, paths };
|
|
43708
|
+
await storage.writeJson(pluginId, AGENT_CLI_PATHS_STORAGE_KEY, next);
|
|
43709
|
+
return next;
|
|
43710
|
+
})
|
|
43711
|
+
};
|
|
43712
|
+
}
|
|
43713
|
+
function serializeAgentCliPathsWrite(write) {
|
|
43714
|
+
const result = agentCliPathsWriteTail.then(write);
|
|
43715
|
+
agentCliPathsWriteTail = result.then(
|
|
43716
|
+
() => void 0,
|
|
43717
|
+
() => void 0
|
|
43718
|
+
);
|
|
43719
|
+
return result;
|
|
43720
|
+
}
|
|
43721
|
+
function normalizeAgentCliPaths(value) {
|
|
43722
|
+
if (!isRecord4(value) || value.version !== 1 || !isRecord4(value.paths)) {
|
|
43723
|
+
return { version: 1, paths: {} };
|
|
43724
|
+
}
|
|
43725
|
+
const paths = {};
|
|
43726
|
+
for (const command of AGENT_CLI_COMMANDS) {
|
|
43727
|
+
const candidate = value.paths[command];
|
|
43728
|
+
if (typeof candidate === "string" && candidate.length > 0) paths[command] = candidate;
|
|
43729
|
+
}
|
|
43730
|
+
return { version: 1, paths };
|
|
43731
|
+
}
|
|
43732
|
+
function resolveAgentCliBinary(options) {
|
|
43733
|
+
const platform = options.platform ?? process.platform;
|
|
43734
|
+
const envName = OVERRIDE_ENV_BY_COMMAND[options.cliCommand];
|
|
43735
|
+
const envOverride = envName ? options.env[envName]?.trim() : void 0;
|
|
43736
|
+
if (envOverride) {
|
|
43737
|
+
const searchedPathEntries2 = path30__default.isAbsolute(envOverride) ? [] : readPathEntries(options.env, platform);
|
|
43738
|
+
const resolved2 = resolveBinarySafely(envOverride, options.env, platform);
|
|
43739
|
+
if (!resolved2) {
|
|
43740
|
+
return { resolved: void 0, source: "env", error: "path_not_found", launchPath: envOverride, searchedPathEntries: searchedPathEntries2 };
|
|
43741
|
+
}
|
|
43742
|
+
const error52 = validateResolvedFile(resolved2, platform);
|
|
43743
|
+
return { resolved: error52 ? void 0 : resolved2, source: "env", error: error52, launchPath: envOverride, searchedPathEntries: searchedPathEntries2 };
|
|
43744
|
+
}
|
|
43745
|
+
const userPath = options.userPaths[options.cliCommand];
|
|
43746
|
+
if (userPath) {
|
|
43747
|
+
const checked = resolveConfiguredPath(userPath, options.env, platform);
|
|
43748
|
+
return { ...checked, source: "user", launchPath: userPath, searchedPathEntries: [] };
|
|
43749
|
+
}
|
|
43750
|
+
const searchedPathEntries = readPathEntries(options.env, platform);
|
|
43751
|
+
const resolved = resolveBinarySafely(options.cliCommand, options.env, platform);
|
|
43752
|
+
if (!resolved) return { resolved: void 0, source: null, error: null, launchPath: void 0, searchedPathEntries };
|
|
43753
|
+
const error51 = validateResolvedFile(resolved, platform);
|
|
43754
|
+
return {
|
|
43755
|
+
resolved: error51 ? void 0 : resolved,
|
|
43756
|
+
source: error51 ? null : "path",
|
|
43757
|
+
error: error51,
|
|
43758
|
+
launchPath: void 0,
|
|
43759
|
+
searchedPathEntries
|
|
43760
|
+
};
|
|
43761
|
+
}
|
|
43762
|
+
function validateUserAgentCliPath(executablePath, env, platform = process.platform) {
|
|
43763
|
+
const checked = resolveConfiguredPath(executablePath, env, platform);
|
|
43764
|
+
return { ...checked, source: "user", launchPath: executablePath, searchedPathEntries: [] };
|
|
43765
|
+
}
|
|
43766
|
+
function agentCliCommandForId(cliId) {
|
|
43767
|
+
if (cliId === "claude" || cliId === "claude-kimi") return "claude";
|
|
43768
|
+
if (cliId === "codex") return "codex";
|
|
43769
|
+
if (cliId === "opencode-go") return "opencode";
|
|
43770
|
+
if (cliId === "cursor") return "cursor-agent";
|
|
43771
|
+
return null;
|
|
43772
|
+
}
|
|
43773
|
+
function applyAgentCliPathEnvOverlay(env, cliId, userPaths) {
|
|
43774
|
+
const cliCommand = agentCliCommandForId(cliId);
|
|
43775
|
+
if (!cliCommand) return env;
|
|
43776
|
+
const envName = OVERRIDE_ENV_BY_COMMAND[cliCommand];
|
|
43777
|
+
const userPath = userPaths[cliCommand];
|
|
43778
|
+
if (!envName || !userPath || (env[envName]?.trim().length ?? 0) > 0) return env;
|
|
43779
|
+
return { ...env, [envName]: userPath };
|
|
43780
|
+
}
|
|
43781
|
+
function buildAgentCliClientEnvOverlay(env, cliId, userPaths) {
|
|
43782
|
+
const cliCommand = agentCliCommandForId(cliId);
|
|
43783
|
+
if (cliCommand !== "claude") return void 0;
|
|
43784
|
+
const userPath = userPaths[cliCommand];
|
|
43785
|
+
if (!userPath || (env.CLAUDE_BIN?.trim().length ?? 0) > 0) return void 0;
|
|
43786
|
+
return { CLAUDE_BIN: userPath };
|
|
43787
|
+
}
|
|
43788
|
+
function createCarrierAgentCliLaunchResolver(readAgentCliPaths, baseEnv = process.env) {
|
|
43789
|
+
return async (cliId, context) => {
|
|
43790
|
+
const userPaths = await readAgentCliPaths();
|
|
43791
|
+
const cliCommand = agentCliCommandForId(cliId);
|
|
43792
|
+
if (!cliCommand) throw new Error("agent_cli_unavailable");
|
|
43793
|
+
const effectiveEnv = { ...baseEnv, ...context.env };
|
|
43794
|
+
const resolution = resolveAgentCliBinary({ cliCommand, env: effectiveEnv, userPaths });
|
|
43795
|
+
if (!resolution.resolved) throw new Error("agent_cli_unavailable");
|
|
43796
|
+
const env = buildAgentCliClientEnvOverlay(effectiveEnv, cliId, userPaths);
|
|
43797
|
+
return {
|
|
43798
|
+
cliPath: resolution.launchPath,
|
|
43799
|
+
...env ? { env } : {}
|
|
43800
|
+
};
|
|
43801
|
+
};
|
|
43802
|
+
}
|
|
43803
|
+
function resolveConfiguredPath(executablePath, env, platform) {
|
|
43804
|
+
if (executablePath.includes("\0") || executablePath.startsWith("~") || !path30__default.isAbsolute(executablePath)) {
|
|
43805
|
+
return { resolved: void 0, error: "path_not_absolute" };
|
|
43806
|
+
}
|
|
43807
|
+
let stats;
|
|
43808
|
+
try {
|
|
43809
|
+
stats = fs11__default.statSync(executablePath);
|
|
43810
|
+
} catch {
|
|
43811
|
+
return { resolved: void 0, error: "path_not_found" };
|
|
43812
|
+
}
|
|
43813
|
+
if (!stats.isFile()) return { resolved: void 0, error: "path_not_file" };
|
|
43814
|
+
if (platform !== "win32") {
|
|
43815
|
+
try {
|
|
43816
|
+
fs11__default.accessSync(executablePath, fs11__default.constants.X_OK);
|
|
43817
|
+
} catch {
|
|
43818
|
+
return { resolved: void 0, error: "path_not_executable" };
|
|
43819
|
+
}
|
|
43820
|
+
}
|
|
43821
|
+
const resolved = resolveBinarySafely(executablePath, env, platform);
|
|
43822
|
+
return resolved ? { resolved, error: null } : { resolved: void 0, error: "path_not_executable" };
|
|
43823
|
+
}
|
|
43824
|
+
function resolveBinarySafely(command, env, platform) {
|
|
43825
|
+
try {
|
|
43826
|
+
return resolvePathBinary(command, env, { platform });
|
|
43827
|
+
} catch {
|
|
43828
|
+
return void 0;
|
|
43829
|
+
}
|
|
43830
|
+
}
|
|
43831
|
+
function validateResolvedFile(resolved, platform) {
|
|
43832
|
+
const resolvedPath = platform === "win32" && resolved.prefixArgs[3] === "call" ? resolved.prefixArgs[4]?.trim() ?? resolved.bin : resolved.bin;
|
|
43833
|
+
try {
|
|
43834
|
+
const stats = fs11__default.statSync(resolvedPath);
|
|
43835
|
+
if (!stats.isFile()) return "path_not_file";
|
|
43836
|
+
if (platform !== "win32") fs11__default.accessSync(resolvedPath, fs11__default.constants.X_OK);
|
|
43837
|
+
return null;
|
|
43838
|
+
} catch (error51) {
|
|
43839
|
+
if (isNodeError2(error51) && error51.code === "EACCES") return "path_not_executable";
|
|
43840
|
+
return "path_not_found";
|
|
43841
|
+
}
|
|
43842
|
+
}
|
|
43843
|
+
function readPathEntries(env, platform) {
|
|
43844
|
+
const value = platform === "win32" ? env.Path ?? env.PATH ?? "" : env.PATH ?? "";
|
|
43845
|
+
const separator = platform === "win32" ? ";" : path30__default.delimiter;
|
|
43846
|
+
return value.split(separator).filter((entry) => entry.length > 0);
|
|
43847
|
+
}
|
|
43848
|
+
function isRecord4(value) {
|
|
43849
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43850
|
+
}
|
|
43851
|
+
function isNodeError2(error51) {
|
|
43852
|
+
return error51 instanceof Error && "code" in error51;
|
|
43853
|
+
}
|
|
43854
|
+
|
|
43855
|
+
// ../fleet-plugins/terminal/server/agent-api/agent-cli-detect.ts
|
|
43662
43856
|
var BINARY_DISPLAY_NAMES = {
|
|
43663
43857
|
claude: "Claude Code",
|
|
43664
43858
|
codex: "Codex CLI",
|
|
43665
43859
|
opencode: "OpenCode",
|
|
43666
43860
|
"cursor-agent": "Cursor Agent"
|
|
43667
43861
|
};
|
|
43668
|
-
var OVERRIDE_ENV_BY_COMMAND = {
|
|
43669
|
-
claude: "CLAUDE_BIN",
|
|
43670
|
-
codex: "CODEX_BIN",
|
|
43671
|
-
"cursor-agent": "CURSOR_AGENT_BIN"
|
|
43672
|
-
};
|
|
43673
43862
|
var VERSION_PROBE_TIMEOUT_MS = 5e3;
|
|
43674
43863
|
var SEMVER_PATTERN = /(\d+\.\d+\.\d+)/;
|
|
43675
43864
|
function createAgentCliDetector(deps) {
|
|
43676
43865
|
return {
|
|
43677
43866
|
detect: async () => {
|
|
43678
43867
|
const commands = distinctBinaryCommands();
|
|
43679
|
-
|
|
43868
|
+
const userPaths = await (deps.readUserPaths?.() ?? Promise.resolve({}));
|
|
43869
|
+
return Promise.all(commands.map((command) => detectOne(command, userPaths, deps)));
|
|
43680
43870
|
}
|
|
43681
43871
|
};
|
|
43682
43872
|
}
|
|
43683
|
-
function createDefaultAgentCliDetector() {
|
|
43873
|
+
function createDefaultAgentCliDetector(readUserPaths = async () => ({}), env = process.env) {
|
|
43684
43874
|
return createAgentCliDetector({
|
|
43685
|
-
|
|
43875
|
+
env,
|
|
43876
|
+
readUserPaths,
|
|
43686
43877
|
runVersion: (bin, args) => execFileVersion(bin, args)
|
|
43687
43878
|
});
|
|
43688
43879
|
}
|
|
43689
|
-
function resolveCommandWithOverride(command, env) {
|
|
43690
|
-
const overrideName = OVERRIDE_ENV_BY_COMMAND[command];
|
|
43691
|
-
const override = overrideName ? env[overrideName] : void 0;
|
|
43692
|
-
if (override && override.trim().length > 0) {
|
|
43693
|
-
return resolvePathBinary(override, env);
|
|
43694
|
-
}
|
|
43695
|
-
return resolvePathBinary(command, env);
|
|
43696
|
-
}
|
|
43697
43880
|
function distinctBinaryCommands() {
|
|
43698
43881
|
const seen = /* @__PURE__ */ new Set();
|
|
43699
43882
|
const commands = [];
|
|
@@ -43705,12 +43888,13 @@ function distinctBinaryCommands() {
|
|
|
43705
43888
|
}
|
|
43706
43889
|
return commands;
|
|
43707
43890
|
}
|
|
43708
|
-
async function detectOne(command, deps) {
|
|
43709
|
-
const
|
|
43891
|
+
async function detectOne(command, userPaths, deps) {
|
|
43892
|
+
const customResolution = deps.resolve?.(command, userPaths);
|
|
43893
|
+
const resolved = deps.resolve ? toResolvedBinary(customResolution) : resolveAgentCliBinary({ cliCommand: command, env: deps.env ?? process.env, userPaths }).resolved;
|
|
43710
43894
|
const available = resolved !== void 0;
|
|
43711
43895
|
let version2 = null;
|
|
43712
43896
|
if (resolved) {
|
|
43713
|
-
version2 = await
|
|
43897
|
+
version2 = await probeAgentCliVersion(resolved, deps.runVersion);
|
|
43714
43898
|
}
|
|
43715
43899
|
return {
|
|
43716
43900
|
id: command,
|
|
@@ -43719,14 +43903,26 @@ async function detectOne(command, deps) {
|
|
|
43719
43903
|
version: version2
|
|
43720
43904
|
};
|
|
43721
43905
|
}
|
|
43722
|
-
|
|
43906
|
+
function toResolvedBinary(resolution) {
|
|
43907
|
+
if (!resolution) return void 0;
|
|
43908
|
+
return "resolved" in resolution ? resolution.resolved : resolution;
|
|
43909
|
+
}
|
|
43910
|
+
async function probeAgentCliVersion(resolved, runVersion = execFileVersion) {
|
|
43723
43911
|
try {
|
|
43724
|
-
const output = await
|
|
43912
|
+
const output = await runVersion(resolved.bin, [...resolved.prefixArgs, "--version"]);
|
|
43725
43913
|
return output.match(SEMVER_PATTERN)?.[1] ?? null;
|
|
43726
43914
|
} catch {
|
|
43727
43915
|
return null;
|
|
43728
43916
|
}
|
|
43729
43917
|
}
|
|
43918
|
+
async function validateAgentCliPathForSave(executablePath, env = process.env, runVersion = execFileVersion) {
|
|
43919
|
+
const resolution = validateUserAgentCliPath(executablePath, env);
|
|
43920
|
+
if (resolution.error || !resolution.resolved) {
|
|
43921
|
+
return { error: resolution.error ?? "path_not_found", version: null };
|
|
43922
|
+
}
|
|
43923
|
+
const version2 = await probeAgentCliVersion(resolution.resolved, runVersion);
|
|
43924
|
+
return version2 ? { error: null, version: version2 } : { error: "probe_failed", version: null };
|
|
43925
|
+
}
|
|
43730
43926
|
function execFileVersion(bin, args) {
|
|
43731
43927
|
return new Promise((resolve3, reject) => {
|
|
43732
43928
|
execFile(
|
|
@@ -44063,7 +44259,10 @@ function createAgentTerminalLaunchResolver(deps = {}) {
|
|
|
44063
44259
|
const cwd = selectedCwd || baseCwd || homedir2();
|
|
44064
44260
|
const testLaunch = globalThis.__fleetTerminalLaunch;
|
|
44065
44261
|
if (testLaunch) return testLaunch(cwd, context);
|
|
44066
|
-
|
|
44262
|
+
let launchEnv = buildLaunchEnv(env, cwd, context?.sessionId, context?.colorScheme);
|
|
44263
|
+
if (deps.readAgentCliPaths) {
|
|
44264
|
+
launchEnv = applyAgentCliPathEnvOverlay(launchEnv, context?.cliId, await deps.readAgentCliPaths());
|
|
44265
|
+
}
|
|
44067
44266
|
const override = parseTerminalCommand(env.FLEET_TERMINAL_CMD);
|
|
44068
44267
|
if (override) {
|
|
44069
44268
|
const resolvedOverride = resolveWindowsLaunchBinary2(
|
|
@@ -44209,11 +44408,13 @@ function parseTerminalCommand(command) {
|
|
|
44209
44408
|
if (!bin) return null;
|
|
44210
44409
|
return { bin, args };
|
|
44211
44410
|
}
|
|
44212
|
-
function buildLaunchEnv(env, cwd, sessionId) {
|
|
44411
|
+
function buildLaunchEnv(env, cwd, sessionId, colorScheme) {
|
|
44213
44412
|
return {
|
|
44214
44413
|
...stripConsoleInternalEnv(env),
|
|
44215
44414
|
...sessionId ? { FLEET_CONSOLE_SESSION_ID: sessionId, INIT_CWD: cwd, PWD: cwd } : {},
|
|
44216
|
-
TERM: TERMINAL_TERM2
|
|
44415
|
+
TERM: TERMINAL_TERM2,
|
|
44416
|
+
// 배경을 질의하지 않는 agent CLI를 위한 고전적 테마 극성 힌트 — spawn 시점 값에 고정된다.
|
|
44417
|
+
...colorScheme ? { COLORFGBG: colorScheme === "light" ? "0;15" : "15;0" } : {}
|
|
44217
44418
|
};
|
|
44218
44419
|
}
|
|
44219
44420
|
function resolveOptionalPackage(id) {
|
|
@@ -45163,6 +45364,8 @@ function buildAgentPlanToolRegistrations(dataDir) {
|
|
|
45163
45364
|
}
|
|
45164
45365
|
function createAgentApi(ctx, terminalRuntime, deps) {
|
|
45165
45366
|
const wikiToolSpecs = createTerminalWikiToolSpecs(ctx.host.paths.fleetDataDir);
|
|
45367
|
+
const agentCliPathStore = createAgentCliPathStore(ctx.host.storage, ctx.pluginId);
|
|
45368
|
+
const readAgentCliPaths = async () => (await agentCliPathStore.read()).paths;
|
|
45166
45369
|
const runtime = createFleetAgentRuntimeLifecycle({
|
|
45167
45370
|
authService: deps.authService,
|
|
45168
45371
|
dataDir: ctx.host.paths.fleetDataDir,
|
|
@@ -45174,11 +45377,12 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45174
45377
|
wikiToolSpecs,
|
|
45175
45378
|
...buildAgentPlanToolRegistrations(ctx.host.paths.fleetDataDir)
|
|
45176
45379
|
});
|
|
45380
|
+
runtime.carrierRuntime.setAgentCliLaunchResolver(createCarrierAgentCliLaunchResolver(readAgentCliPaths));
|
|
45177
45381
|
const observability = createConsoleObservabilityStore({
|
|
45178
45382
|
canonicalizeTheaterPath: ctx.host.paths.canonicalizeTheaterPath,
|
|
45179
45383
|
workspaceHash: ctx.host.paths.workspaceHash
|
|
45180
45384
|
});
|
|
45181
|
-
const detector = createDefaultAgentCliDetector();
|
|
45385
|
+
const detector = createDefaultAgentCliDetector(readAgentCliPaths);
|
|
45182
45386
|
const pendingRuntimeSessions = /* @__PURE__ */ new Map();
|
|
45183
45387
|
const identityRefreshes = /* @__PURE__ */ new Map();
|
|
45184
45388
|
const jobOriginById = /* @__PURE__ */ new Map();
|
|
@@ -45187,6 +45391,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45187
45391
|
agentRuntime: runtime,
|
|
45188
45392
|
dataDir: ctx.host.paths.fleetDataDir,
|
|
45189
45393
|
infraServices: deps,
|
|
45394
|
+
readAgentCliPaths,
|
|
45190
45395
|
resolveServerBindings: (launchContext) => {
|
|
45191
45396
|
const operationId = launchContext?.operationId;
|
|
45192
45397
|
if (!operationId) return void 0;
|
|
@@ -45284,23 +45489,49 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45284
45489
|
registerCleanup: (cleanup2) => ctx.host.lifecycle.registerCleanup(cleanup2)
|
|
45285
45490
|
});
|
|
45286
45491
|
async function handle({ req, res, pathname }) {
|
|
45287
|
-
const
|
|
45288
|
-
if (
|
|
45492
|
+
const path48 = pathname.slice(`${ctx.basePath}/agent`.length) || "/";
|
|
45493
|
+
if (path48 === "/state") {
|
|
45289
45494
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45290
45495
|
ctx.host.http.writeJson(res, 200, { agentClis: await buildAgentCliLaunchMetadata() });
|
|
45291
45496
|
return true;
|
|
45292
45497
|
}
|
|
45293
|
-
if (
|
|
45498
|
+
if (path48 === "/agent-cli/state") {
|
|
45294
45499
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45295
45500
|
ctx.host.http.writeJson(res, 200, { clis: await detector.detect() });
|
|
45296
45501
|
return true;
|
|
45297
45502
|
}
|
|
45298
|
-
if (
|
|
45503
|
+
if (path48 === "/agent-cli/diagnostics") {
|
|
45504
|
+
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45505
|
+
if (!ctx.host.security.isTerminalAuthorized(req)) return unauthorized(res);
|
|
45506
|
+
ctx.host.http.writeJson(res, 200, await buildAgentCliDiagnostics());
|
|
45507
|
+
return true;
|
|
45508
|
+
}
|
|
45509
|
+
if (path48 === "/agent-cli/path") {
|
|
45510
|
+
if (req.method !== "PUT") return methodNotAllowed2(res);
|
|
45511
|
+
if (!ctx.host.security.isTerminalAuthorized(req)) return unauthorized(res);
|
|
45512
|
+
const body = await ctx.host.http.readJsonBody(req);
|
|
45513
|
+
if (!body || typeof body.cliCommand !== "string" || !AGENT_CLI_COMMANDS.includes(body.cliCommand) || body.path !== null && typeof body.path !== "string") {
|
|
45514
|
+
ctx.host.http.writeJson(res, 400, { error: "path_not_absolute" });
|
|
45515
|
+
return true;
|
|
45516
|
+
}
|
|
45517
|
+
const executablePath = body.path ?? "";
|
|
45518
|
+
if (executablePath.length > 0) {
|
|
45519
|
+
const validation = await validateAgentCliPathForSave(executablePath, process4.env);
|
|
45520
|
+
if (validation.error) {
|
|
45521
|
+
ctx.host.http.writeJson(res, 400, { error: validation.error });
|
|
45522
|
+
return true;
|
|
45523
|
+
}
|
|
45524
|
+
}
|
|
45525
|
+
await agentCliPathStore.writePath(body.cliCommand, executablePath);
|
|
45526
|
+
ctx.host.http.writeJson(res, 200, { ok: true });
|
|
45527
|
+
return true;
|
|
45528
|
+
}
|
|
45529
|
+
if (path48 === "/tenants") {
|
|
45299
45530
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45300
45531
|
ctx.host.http.writeJson(res, 200, { tenants: observability.listWorkspaces() });
|
|
45301
45532
|
return true;
|
|
45302
45533
|
}
|
|
45303
|
-
if (
|
|
45534
|
+
if (path48 === "/jobs") {
|
|
45304
45535
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45305
45536
|
const requestedTenantId = new URL(req.url ?? "/", "http://127.0.0.1").searchParams.get("tenant");
|
|
45306
45537
|
const visible = requestedTenantId ? observability.listWorkspaces().filter((workspace) => workspace.tenantId === requestedTenantId) : observability.listWorkspaces();
|
|
@@ -45311,7 +45542,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45311
45542
|
ctx.host.http.writeJson(res, 200, { tenants: visible.map((workspace) => ({ tenantId: workspace.tenantId, tenantLabel: workspace.tenantLabel, jobs: observability.listJobs(workspace.tenantId), truncation: observability.getTruncation(workspace.tenantId) })) });
|
|
45312
45543
|
return true;
|
|
45313
45544
|
}
|
|
45314
|
-
if (
|
|
45545
|
+
if (path48 === "/events") {
|
|
45315
45546
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45316
45547
|
const requestedTenantId = new URL(req.url ?? "/", "http://127.0.0.1").searchParams.get("tenant");
|
|
45317
45548
|
const visible = requestedTenantId ? observability.listWorkspaces().filter((workspace) => workspace.tenantId === requestedTenantId) : observability.listWorkspaces();
|
|
@@ -45322,11 +45553,11 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45322
45553
|
writeAggregateObserverEvents(req, res, visible, observability, (tenantId) => observability.getWorkspace(tenantId), { subscribeAll: true });
|
|
45323
45554
|
return true;
|
|
45324
45555
|
}
|
|
45325
|
-
if (
|
|
45326
|
-
if (
|
|
45327
|
-
const sessionMatch =
|
|
45556
|
+
if (path48 === "/sessions") return handleSessions(req, res);
|
|
45557
|
+
if (path48 === "/capture") return handleCapture(req, res, "");
|
|
45558
|
+
const sessionMatch = path48.match(/^\/sessions\/([^/]+)(?:\/([^/]+))?$/);
|
|
45328
45559
|
if (sessionMatch) return handleSessionItem(req, res, decodeURIComponent(sessionMatch[1] ?? ""), sessionMatch[2] ?? "");
|
|
45329
|
-
if (
|
|
45560
|
+
if (path48 === "/ticket") {
|
|
45330
45561
|
if (req.method !== "POST") return methodNotAllowed2(res);
|
|
45331
45562
|
if (!ctx.host.security.isTerminalAuthorized(req)) {
|
|
45332
45563
|
ctx.host.http.writeJson(res, 401, { error: "Unauthorized" });
|
|
@@ -45351,6 +45582,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45351
45582
|
ctx.host.http.writeJson(res, 404, { error: "theater_not_found" });
|
|
45352
45583
|
return true;
|
|
45353
45584
|
}
|
|
45585
|
+
const colorScheme = body?.colorScheme === "light" || body?.colorScheme === "dark" ? body.colorScheme : void 0;
|
|
45354
45586
|
ctx.host.http.writeJson(res, 200, terminalRuntime.issueTicket({
|
|
45355
45587
|
cwd,
|
|
45356
45588
|
sessionId: operation.id,
|
|
@@ -45358,7 +45590,8 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45358
45590
|
operationType: operation.type,
|
|
45359
45591
|
pluginId: operation.pluginId,
|
|
45360
45592
|
theaterId: operation.theaterId,
|
|
45361
|
-
cliId: readPayloadString(operation.payload, "cliId") ?? void 0
|
|
45593
|
+
cliId: readPayloadString(operation.payload, "cliId") ?? void 0,
|
|
45594
|
+
...colorScheme ? { colorScheme } : {}
|
|
45362
45595
|
}));
|
|
45363
45596
|
return true;
|
|
45364
45597
|
}
|
|
@@ -45599,6 +45832,20 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45599
45832
|
const authStatuses = await getAgentCliAuthStatuses(deps.authService);
|
|
45600
45833
|
return combineAgentCliLaunchMetadata(metadata, detected, authStatuses);
|
|
45601
45834
|
}
|
|
45835
|
+
async function buildAgentCliDiagnostics() {
|
|
45836
|
+
const userPaths = await readAgentCliPaths();
|
|
45837
|
+
return {
|
|
45838
|
+
entries: AGENT_CLI_COMMANDS.map((cliCommand) => {
|
|
45839
|
+
const resolution = resolveAgentCliBinary({ cliCommand, env: process4.env, userPaths });
|
|
45840
|
+
return {
|
|
45841
|
+
cliCommand,
|
|
45842
|
+
configuredPath: userPaths[cliCommand] ?? null,
|
|
45843
|
+
resolutionSource: resolution.source,
|
|
45844
|
+
searchedPathEntries: resolution.searchedPathEntries
|
|
45845
|
+
};
|
|
45846
|
+
})
|
|
45847
|
+
};
|
|
45848
|
+
}
|
|
45602
45849
|
async function buildLaunchKinds() {
|
|
45603
45850
|
const metadata = await buildAgentCliLaunchMetadata();
|
|
45604
45851
|
return buildAgentCliLaunchKinds(metadata, AGENT_OPERATION_TYPE);
|
|
@@ -46380,7 +46627,7 @@ var AnalystSession = class {
|
|
|
46380
46627
|
}
|
|
46381
46628
|
this.bridge(client2);
|
|
46382
46629
|
try {
|
|
46383
|
-
await client2.connect({ cwd: this.options.cwd, model: this.options.model, effort: this.options.effort, autoApprove: true, fsAccess: false, yoloMode: true, strictMcp: this.options.cliId === "claude" || this.options.cliId === "claude-kimi", systemPrompt: resolveAnalystSystemPrompt(this.options.language), mcpServers: [{ type: "http", name: ANALYST_MCP_SERVER, url: url2, headers: [{ name: "Authorization", value: `Bearer ${this.token}` }] }] });
|
|
46630
|
+
await client2.connect({ cwd: this.options.cwd, cliPath: this.options.cliPath, env: this.options.env ? { ...this.options.env } : void 0, model: this.options.model, effort: this.options.effort, autoApprove: true, fsAccess: false, yoloMode: true, strictMcp: this.options.cliId === "claude" || this.options.cliId === "claude-kimi", systemPrompt: resolveAnalystSystemPrompt(this.options.language), mcpServers: [{ type: "http", name: ANALYST_MCP_SERVER, url: url2, headers: [{ name: "Authorization", value: `Bearer ${this.token}` }] }] });
|
|
46384
46631
|
} catch (error51) {
|
|
46385
46632
|
if (this.disposed) await (this.disposeFlight ?? Promise.resolve());
|
|
46386
46633
|
else await client2.disconnect().catch(() => void 0);
|
|
@@ -46669,7 +46916,7 @@ function analysisError(code, message) {
|
|
|
46669
46916
|
return { error: { code, message } };
|
|
46670
46917
|
}
|
|
46671
46918
|
function isAnalysisSelection(catalog, value) {
|
|
46672
|
-
if (!
|
|
46919
|
+
if (!isRecord5(value) || !hasExactKeys(value, ["cliId", "model", "effort", "language"]) || typeof value.cliId !== "string" || typeof value.model !== "string" || value.effort !== void 0 && typeof value.effort !== "string" || value.language !== void 0 && value.language !== "en" && value.language !== "ko") return false;
|
|
46673
46920
|
const cli = catalog.clis.find((candidate) => candidate.cliId === value.cliId);
|
|
46674
46921
|
if (!cli?.available) return false;
|
|
46675
46922
|
const model = cli.models.find((candidate) => candidate.id === value.model);
|
|
@@ -46678,9 +46925,9 @@ function isAnalysisSelection(catalog, value) {
|
|
|
46678
46925
|
return typeof value.effort === "string" && value.effort.length > 0 && model.effortLevels.includes(value.effort);
|
|
46679
46926
|
}
|
|
46680
46927
|
function isMessageBody(value) {
|
|
46681
|
-
return
|
|
46928
|
+
return isRecord5(value) && hasExactKeys(value, ["text"]) && typeof value.text === "string" && value.text.trim().length > 0;
|
|
46682
46929
|
}
|
|
46683
|
-
function
|
|
46930
|
+
function isRecord5(value) {
|
|
46684
46931
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
46685
46932
|
}
|
|
46686
46933
|
function hasExactKeys(value, keys) {
|
|
@@ -46699,7 +46946,9 @@ var ARTIFACT_CANVAS_STYLE_PROPERTIES = /* @__PURE__ */ new Set(["background-colo
|
|
|
46699
46946
|
var ARTIFACT_BODY_CANVAS_STYLE_PROPERTIES = /* @__PURE__ */ new Set([...ARTIFACT_CANVAS_STYLE_PROPERTIES, "margin"]);
|
|
46700
46947
|
function registerAnalysisRoutes(ctx, deps = {}) {
|
|
46701
46948
|
const registry3 = new AnalysisRegistry();
|
|
46702
|
-
const
|
|
46949
|
+
const env = deps.env ?? process.env;
|
|
46950
|
+
const readAgentCliPaths = deps.readAgentCliPaths;
|
|
46951
|
+
const detect = deps.detect ?? createDefaultAgentCliDetector(readAgentCliPaths ?? (async () => ({})), env).detect;
|
|
46703
46952
|
const modelsFor = deps.modelsFor ?? getProviderModels;
|
|
46704
46953
|
const readCapture = deps.readCapture ?? readProviderSessionCapture;
|
|
46705
46954
|
const createSession = deps.createSession ?? ((options) => new AnalystSession(options));
|
|
@@ -46711,14 +46960,14 @@ function registerAnalysisRoutes(ctx, deps = {}) {
|
|
|
46711
46960
|
writeError(ctx, res, 403, ANALYSIS_ERROR_CODES.catalogInvalid, "Analysis request is not accepted by this host.");
|
|
46712
46961
|
return true;
|
|
46713
46962
|
}
|
|
46714
|
-
const
|
|
46715
|
-
if (
|
|
46716
|
-
if (
|
|
46717
|
-
const artifactMatch =
|
|
46963
|
+
const path48 = pathname.slice(`${ctx.basePath}/analysis`.length) || "/";
|
|
46964
|
+
if (path48 === "/catalog") return handleCatalog(ctx, req, res, catalog);
|
|
46965
|
+
if (path48 === "/stream") return handleGlobalStream(ctx, req, res, registry3);
|
|
46966
|
+
const artifactMatch = path48.match(/^\/artifacts\/([^/]+)$/);
|
|
46718
46967
|
if (artifactMatch) return handleArtifact(ctx, req, res, decodeURIComponent(artifactMatch[1] ?? ""), registry3);
|
|
46719
|
-
const clearArtifactsMatch =
|
|
46968
|
+
const clearArtifactsMatch = path48.match(/^\/([^/]+)\/artifacts$/);
|
|
46720
46969
|
if (clearArtifactsMatch) return handleClearArtifacts(ctx, req, res, decodeURIComponent(clearArtifactsMatch[1] ?? ""), registry3);
|
|
46721
|
-
const match =
|
|
46970
|
+
const match = path48.match(/^\/([^/]+)\/(ready|start|message|stream|stop)$/);
|
|
46722
46971
|
if (!match) return false;
|
|
46723
46972
|
const operationId = decodeURIComponent(match[1] ?? "");
|
|
46724
46973
|
const action = match[2] ?? "";
|
|
@@ -46732,7 +46981,7 @@ function registerAnalysisRoutes(ctx, deps = {}) {
|
|
|
46732
46981
|
const deletionMarker = { operationId, deleted: false };
|
|
46733
46982
|
inFlightStartDeletionMarkers.add(deletionMarker);
|
|
46734
46983
|
try {
|
|
46735
|
-
return await handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, deletionMarker);
|
|
46984
|
+
return await handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, readAgentCliPaths, env, deletionMarker);
|
|
46736
46985
|
} finally {
|
|
46737
46986
|
inFlightStartDeletionMarkers.delete(deletionMarker);
|
|
46738
46987
|
}
|
|
@@ -47014,7 +47263,7 @@ async function handleReady(ctx, req, res, operation, readCapture) {
|
|
|
47014
47263
|
}
|
|
47015
47264
|
return true;
|
|
47016
47265
|
}
|
|
47017
|
-
async function handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, deletionMarker) {
|
|
47266
|
+
async function handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, readAgentCliPaths, env, deletionMarker) {
|
|
47018
47267
|
if (req.method !== "POST") return methodNotAllowed(ctx, res);
|
|
47019
47268
|
if (!isJsonRequest2(req)) return unsupportedMediaType(ctx, res);
|
|
47020
47269
|
const body = await ctx.host.http.readJsonBody(req);
|
|
@@ -47043,7 +47292,27 @@ async function handleStart(ctx, req, res, operation, registry3, catalog, readCap
|
|
|
47043
47292
|
return true;
|
|
47044
47293
|
}
|
|
47045
47294
|
try {
|
|
47046
|
-
|
|
47295
|
+
let launchOptions = {};
|
|
47296
|
+
if (readAgentCliPaths) {
|
|
47297
|
+
const userPaths = await readAgentCliPaths();
|
|
47298
|
+
const cliCommand = agentCliCommandForId(body.cliId);
|
|
47299
|
+
const resolution = cliCommand ? resolveAgentCliBinary({ cliCommand, env, userPaths }) : null;
|
|
47300
|
+
if (!resolution?.resolved) throw new Error("analysis_cli_unavailable");
|
|
47301
|
+
launchOptions = {
|
|
47302
|
+
cliPath: resolution.launchPath,
|
|
47303
|
+
env: buildAgentCliClientEnvOverlay(env, body.cliId, userPaths)
|
|
47304
|
+
};
|
|
47305
|
+
}
|
|
47306
|
+
const result = await registry3.start(operation.id, (onEvent) => createSession({
|
|
47307
|
+
cliId: body.cliId,
|
|
47308
|
+
...launchOptions,
|
|
47309
|
+
model: body.model,
|
|
47310
|
+
effort: body.effort || void 0,
|
|
47311
|
+
language: body.language,
|
|
47312
|
+
cwd,
|
|
47313
|
+
capturePath: transcriptPath,
|
|
47314
|
+
onEvent: (event) => onEvent(toBrowserEvent(event))
|
|
47315
|
+
}));
|
|
47047
47316
|
if (result === "exists") writeError(ctx, res, 409, ANALYSIS_ERROR_CODES.sessionExists, "Analysis session already exists.");
|
|
47048
47317
|
else if (result === "stopped") writeError(ctx, res, 404, ANALYSIS_ERROR_CODES.sessionNotFound, "Analysis session was stopped before it started.");
|
|
47049
47318
|
else ctx.host.http.writeJson(res, 200, { started: true });
|
|
@@ -47615,6 +47884,7 @@ function registerGlobalShellRoutes(ctx, runtime) {
|
|
|
47615
47884
|
ctx.host.http.writeJson(res, 503, { error: "Terminal session capacity exhausted" });
|
|
47616
47885
|
return true;
|
|
47617
47886
|
}
|
|
47887
|
+
const colorScheme = body?.colorScheme === "light" || body?.colorScheme === "dark" ? body.colorScheme : void 0;
|
|
47618
47888
|
ctx.host.http.writeJson(res, 200, runtime.issueTicket({
|
|
47619
47889
|
cwd: theaterPath,
|
|
47620
47890
|
sessionId: operationId,
|
|
@@ -47622,7 +47892,8 @@ function registerGlobalShellRoutes(ctx, runtime) {
|
|
|
47622
47892
|
operationType: GLOBAL_SHELL_OPERATION_TYPE,
|
|
47623
47893
|
pluginId: ctx.pluginId,
|
|
47624
47894
|
theaterId,
|
|
47625
|
-
kind: "shell"
|
|
47895
|
+
kind: "shell",
|
|
47896
|
+
...colorScheme ? { colorScheme } : {}
|
|
47626
47897
|
}));
|
|
47627
47898
|
return true;
|
|
47628
47899
|
});
|
|
@@ -47650,8 +47921,8 @@ function registerTerminalModelAuthRoutes(ctx, deps) {
|
|
|
47650
47921
|
}
|
|
47651
47922
|
function createTerminalModelAuthRouter(ctx, deps) {
|
|
47652
47923
|
return async function handleTerminalModelAuthRoute({ req, res, pathname }) {
|
|
47653
|
-
const
|
|
47654
|
-
if (
|
|
47924
|
+
const path48 = pathname.slice(`${ctx.basePath}/model-auth`.length) || "/";
|
|
47925
|
+
if (path48 === "/state") {
|
|
47655
47926
|
if (req.method !== "GET") {
|
|
47656
47927
|
ctx.host.http.writeJson(res, 405, { error: "Method not allowed" });
|
|
47657
47928
|
return true;
|
|
@@ -47659,7 +47930,7 @@ function createTerminalModelAuthRouter(ctx, deps) {
|
|
|
47659
47930
|
ctx.host.http.writeJson(res, 200, await buildModelAuthState(deps.authService));
|
|
47660
47931
|
return true;
|
|
47661
47932
|
}
|
|
47662
|
-
const cli = parseProviderPath(
|
|
47933
|
+
const cli = parseProviderPath(path48);
|
|
47663
47934
|
if (!cli) return false;
|
|
47664
47935
|
if (cli !== "claude-kimi") {
|
|
47665
47936
|
ctx.host.http.writeJson(res, 404, { error: "provider_not_found" });
|
|
@@ -47726,8 +47997,8 @@ async function writeMutationState2(ctx, res, deps) {
|
|
|
47726
47997
|
async function findProvider(deps) {
|
|
47727
47998
|
return (await buildModelAuthState(deps.authService)).providers[0] ?? null;
|
|
47728
47999
|
}
|
|
47729
|
-
function parseProviderPath(
|
|
47730
|
-
const parts =
|
|
48000
|
+
function parseProviderPath(path48) {
|
|
48001
|
+
const parts = path48.split("/").filter(Boolean);
|
|
47731
48002
|
if (parts.length !== 2 || parts[0] !== "providers") return null;
|
|
47732
48003
|
try {
|
|
47733
48004
|
return decodeURIComponent(parts[1] ?? "");
|
|
@@ -47796,6 +48067,7 @@ function registerShellRoutes(ctx, runtime) {
|
|
|
47796
48067
|
ctx.host.http.writeJson(res, 503, { error: "Terminal session capacity exhausted" });
|
|
47797
48068
|
return true;
|
|
47798
48069
|
}
|
|
48070
|
+
const colorScheme = body?.colorScheme === "light" || body?.colorScheme === "dark" ? body.colorScheme : void 0;
|
|
47799
48071
|
ctx.host.http.writeJson(res, 200, runtime.issueTicket({
|
|
47800
48072
|
cwd: theaterPath,
|
|
47801
48073
|
sessionId: operationId,
|
|
@@ -47803,7 +48075,8 @@ function registerShellRoutes(ctx, runtime) {
|
|
|
47803
48075
|
operationType: operation.type,
|
|
47804
48076
|
pluginId: operation.pluginId,
|
|
47805
48077
|
theaterId: operation.theaterId,
|
|
47806
|
-
kind: "shell"
|
|
48078
|
+
kind: "shell",
|
|
48079
|
+
...colorScheme ? { colorScheme } : {}
|
|
47807
48080
|
}));
|
|
47808
48081
|
return true;
|
|
47809
48082
|
});
|
|
@@ -47880,7 +48153,10 @@ var routes_default = definePlugin({
|
|
|
47880
48153
|
registerTerminalSettingsRoutes(ctx, { globalOptionsService: infraServices.globalOptionsService });
|
|
47881
48154
|
registerTerminalModelAuthRoutes(ctx, { authService: infraServices.authService });
|
|
47882
48155
|
registerCarrierSettingsRoutes(ctx, { registry: carrierRegistry });
|
|
47883
|
-
|
|
48156
|
+
const agentCliPathStore = createAgentCliPathStore(ctx.host.storage, ctx.pluginId);
|
|
48157
|
+
registerAnalysisRoutes(ctx, {
|
|
48158
|
+
readAgentCliPaths: async () => (await agentCliPathStore.read()).paths
|
|
48159
|
+
});
|
|
47884
48160
|
const agentLaunchKinds = registerAgentRoutes(ctx, runtime, {
|
|
47885
48161
|
authService: infraServices.authService,
|
|
47886
48162
|
globalOptionsService: infraServices.globalOptionsService
|