@dotobokuri/fleet-console 1.29.0 → 1.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/dist/cli.mjs +82 -63
- package/dist/client/assets/{_baseUniq-DEvADUqz.js → _baseUniq-Dvbxpxj-.js} +1 -1
- package/dist/client/assets/{arc-pB9oYw5d.js → arc-Cqerxs8I.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-D0gUBsh1.js → architectureDiagram-Q4EWVU46-gNhmCKnU.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-9NSt9xrC.js → blockDiagram-DXYQGD6D-CM5HRpKC.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-BS1EhMAN.js → c4Diagram-AHTNJAMY-DxLhQuvg.js} +1 -1
- package/dist/client/assets/channel-DKkQpLWI.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-BKkeF7mF.js → chunk-4BX2VUAB-HX6C_GAC.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-DRp3Dsap.js → chunk-4TB4RGXK-CoBQUhS4.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-De-sLT-H.js → chunk-55IACEB6-DWsWxGBm.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-ByYWvw6c.js → chunk-EDXVE4YY-BXNRu1M4.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-BDpIWnNm.js → chunk-FMBD7UC4-DzKgP1_A.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-qxbtvneQ.js → chunk-OYMX7WX6-aqXdvKUD.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BnkLN840.js → chunk-QZHKN3VN-BbMqaUb0.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-HfizEXdz.js → chunk-YZCP3GAM-D8Mo0nv8.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CQurO5ix.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CQurO5ix.js +1 -0
- package/dist/client/assets/clone-IodjsAGU.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-B4U_tiL9.js → cose-bilkent-S5V4N54A-BOuVjjXz.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-De3dSv-R.js → dagre-KV5264BT-BdUFzAj_.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-CZAF0Kro.js → diagram-5BDNPKRD-C0iFrsGo.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BHyDlHAq.js → diagram-G4DWMVQ6-CGxGeQZt.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-CV93x0hu.js → diagram-MMDJMWI5-Dex5uqlA.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-CTRzVEQp.js → diagram-TYMM5635-O48PEpaS.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-xW-UvBlm.js → erDiagram-SMLLAGMA-B7PGw3YA.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-C21IECUy.js → flowDiagram-DWJPFMVM-CCXWJIMw.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-DVzOf8Xv.js → ganttDiagram-T4ZO3ILL-B26RghpR.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-B-NQC3Ae.js → gitGraphDiagram-UUTBAWPF-BJsjMn6A.js} +1 -1
- package/dist/client/assets/{graph-BDzdWbuy.js → graph-DuEL0RWH.js} +1 -1
- package/dist/client/assets/index-Dj775lUe.css +1 -0
- package/dist/client/assets/index-r6rDZQCs.js +451 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-2KCXFMZg.js → infoDiagram-42DDH7IO-D32dz1SM.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-D4Fvy3ms.js → ishikawaDiagram-UXIWVN3A-4YPQjln0.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-DkXZkeED.js → journeyDiagram-VCZTEJTY-BSvi22HM.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-CTrIp4rv.js → kanban-definition-6JOO6SKY-SozOXS7m.js} +1 -1
- package/dist/client/assets/{layout-DKdT-A2u.js → layout-CNXntIRV.js} +1 -1
- package/dist/client/assets/{linear-Dn21C3ab.js → linear-9RZPFtO4.js} +1 -1
- package/dist/client/assets/{mermaid.core-ho7gOyUr.js → mermaid.core-kwH-UxKY.js} +4 -4
- package/dist/client/assets/{min-DV-zxfLU.js → min-BdN2p8Q_.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-By8nfvJ0.js → mindmap-definition-QFDTVHPH-H-3dJmH9.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B4ndzH1J.js → pieDiagram-DEJITSTG-CspzYvcs.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-CiDb6b3-.js → quadrantDiagram-34T5L4WZ-D1C7e3-s.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-TTr1SzvX.js → requirementDiagram-MS252O5E-BJwKRtMi.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-CUyxk-WA.js → sankeyDiagram-XADWPNL6-7oc42Z3P.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-CyBxBNAZ.js → sequenceDiagram-FGHM5R23-TP5H_DnF.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-Cj4j5FFK.js → stateDiagram-FHFEXIEX-BWnrNgJY.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Cmp8tobq.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-MQzKGbxg.js → timeline-definition-GMOUNBTQ-xXFvCsrr.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-sG3K7NAZ.js → vennDiagram-DHZGUBPP-D5unm_iH.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-ID5rQjqH.js → wardley-RL74JXVD-B-eT02rs.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-AMajCCI5.js → wardleyDiagram-NUSXRM2D-BTQ1Yqmb.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-DUb36W9E.js → xychartDiagram-5P7HB3ND-Bialvg0l.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/file-explorer/routes.mjs +199 -38
- package/dist/fleet-plugins/repository/routes.mjs +405 -31
- package/dist/fleet-plugins/skills/routes.mjs +9 -6
- package/dist/fleet-plugins/terminal/routes.mjs +226 -88
- package/package.json +1 -1
- package/dist/client/assets/channel-BSgCfWXO.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-C3WhxxfZ.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-C3WhxxfZ.js +0 -1
- package/dist/client/assets/clone-DjOK69th.js +0 -1
- package/dist/client/assets/index-BDJVPQd1.css +0 -1
- package/dist/client/assets/index-CjBu8lNT.js +0 -451
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CWhJmDZj.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, path47, handler) {
|
|
30
|
+
ctx.registerRouter(normalizePath(path47), handler);
|
|
31
31
|
}
|
|
32
|
-
function registerWsHandler(ctx,
|
|
33
|
-
ctx.registerWsHandler(normalizePath(
|
|
32
|
+
function registerWsHandler(ctx, path47, handler) {
|
|
33
|
+
ctx.registerWsHandler(normalizePath(path47), 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(path47) {
|
|
39
|
+
if (path47.length === 0 || path47 === "/") return "/";
|
|
40
|
+
return path47;
|
|
41
41
|
}
|
|
42
42
|
var FLEET_DATA_DIR_NAME = ".fleet";
|
|
43
43
|
function getFleetDataDir() {
|
|
@@ -535,15 +535,29 @@ function sanitizeGlobalOptionsData(value) {
|
|
|
535
535
|
if (value.version !== GLOBAL_OPTIONS_VERSION) {
|
|
536
536
|
return { data: createEmptyGlobalOptionsData(), changed: true };
|
|
537
537
|
}
|
|
538
|
+
const kimiModel = sanitizeKimiModel(value.kimiModel);
|
|
538
539
|
const data = {
|
|
539
540
|
version: GLOBAL_OPTIONS_VERSION,
|
|
540
541
|
...typeof value.enableMetaphor === "boolean" ? { enableMetaphor: value.enableMetaphor } : {},
|
|
541
|
-
...value.codexLaunchMode === "acp" || value.codexLaunchMode === "app-server" ? { codexLaunchMode: value.codexLaunchMode } : {}
|
|
542
|
+
...value.codexLaunchMode === "acp" || value.codexLaunchMode === "app-server" ? { codexLaunchMode: value.codexLaunchMode } : {},
|
|
543
|
+
...kimiModel ? { kimiModel } : {}
|
|
542
544
|
};
|
|
543
|
-
const allowedKeys = /* @__PURE__ */ new Set(["version", "enableMetaphor", "codexLaunchMode"]);
|
|
544
|
-
const changed = Object.keys(value).some((key) => !allowedKeys.has(key)) || "enableMetaphor" in value && typeof value.enableMetaphor !== "boolean" || "codexLaunchMode" in value && value.codexLaunchMode !== "acp" && value.codexLaunchMode !== "app-server";
|
|
545
|
+
const allowedKeys = /* @__PURE__ */ new Set(["version", "enableMetaphor", "codexLaunchMode", "kimiModel"]);
|
|
546
|
+
const changed = Object.keys(value).some((key) => !allowedKeys.has(key)) || "enableMetaphor" in value && typeof value.enableMetaphor !== "boolean" || "codexLaunchMode" in value && value.codexLaunchMode !== "acp" && value.codexLaunchMode !== "app-server" || "kimiModel" in value && kimiModel === void 0;
|
|
545
547
|
return { data, changed };
|
|
546
548
|
}
|
|
549
|
+
function sanitizeKimiModel(value) {
|
|
550
|
+
if (!isRecord(value)) {
|
|
551
|
+
return void 0;
|
|
552
|
+
}
|
|
553
|
+
if (typeof value.model !== "string" || value.model.length === 0) {
|
|
554
|
+
return void 0;
|
|
555
|
+
}
|
|
556
|
+
return {
|
|
557
|
+
model: value.model,
|
|
558
|
+
...typeof value.effort === "string" ? { effort: value.effort } : {}
|
|
559
|
+
};
|
|
560
|
+
}
|
|
547
561
|
function isRecord(value) {
|
|
548
562
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
549
563
|
}
|
|
@@ -1612,10 +1626,10 @@ function mergeDefs(...defs) {
|
|
|
1612
1626
|
function cloneDef(schema) {
|
|
1613
1627
|
return mergeDefs(schema._zod.def);
|
|
1614
1628
|
}
|
|
1615
|
-
function getElementAtPath(obj,
|
|
1616
|
-
if (!
|
|
1629
|
+
function getElementAtPath(obj, path47) {
|
|
1630
|
+
if (!path47)
|
|
1617
1631
|
return obj;
|
|
1618
|
-
return
|
|
1632
|
+
return path47.reduce((acc, key) => acc?.[key], obj);
|
|
1619
1633
|
}
|
|
1620
1634
|
function promiseAllObject(promisesObj) {
|
|
1621
1635
|
const keys = Object.keys(promisesObj);
|
|
@@ -2024,11 +2038,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
2024
2038
|
}
|
|
2025
2039
|
return false;
|
|
2026
2040
|
}
|
|
2027
|
-
function prefixIssues(
|
|
2041
|
+
function prefixIssues(path47, issues) {
|
|
2028
2042
|
return issues.map((iss) => {
|
|
2029
2043
|
var _a3;
|
|
2030
2044
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2031
|
-
iss.path.unshift(
|
|
2045
|
+
iss.path.unshift(path47);
|
|
2032
2046
|
return iss;
|
|
2033
2047
|
});
|
|
2034
2048
|
}
|
|
@@ -2175,16 +2189,16 @@ function flattenError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2175
2189
|
}
|
|
2176
2190
|
function formatError(error51, mapper = (issue3) => issue3.message) {
|
|
2177
2191
|
const fieldErrors = { _errors: [] };
|
|
2178
|
-
const processError = (error52,
|
|
2192
|
+
const processError = (error52, path47 = []) => {
|
|
2179
2193
|
for (const issue3 of error52.issues) {
|
|
2180
2194
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
2181
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
2195
|
+
issue3.errors.map((issues) => processError({ issues }, [...path47, ...issue3.path]));
|
|
2182
2196
|
} else if (issue3.code === "invalid_key") {
|
|
2183
|
-
processError({ issues: issue3.issues }, [...
|
|
2197
|
+
processError({ issues: issue3.issues }, [...path47, ...issue3.path]);
|
|
2184
2198
|
} else if (issue3.code === "invalid_element") {
|
|
2185
|
-
processError({ issues: issue3.issues }, [...
|
|
2199
|
+
processError({ issues: issue3.issues }, [...path47, ...issue3.path]);
|
|
2186
2200
|
} else {
|
|
2187
|
-
const fullpath = [...
|
|
2201
|
+
const fullpath = [...path47, ...issue3.path];
|
|
2188
2202
|
if (fullpath.length === 0) {
|
|
2189
2203
|
fieldErrors._errors.push(mapper(issue3));
|
|
2190
2204
|
} else {
|
|
@@ -2211,17 +2225,17 @@ function formatError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2211
2225
|
}
|
|
2212
2226
|
function treeifyError(error51, mapper = (issue3) => issue3.message) {
|
|
2213
2227
|
const result = { errors: [] };
|
|
2214
|
-
const processError = (error52,
|
|
2228
|
+
const processError = (error52, path47 = []) => {
|
|
2215
2229
|
var _a3, _b;
|
|
2216
2230
|
for (const issue3 of error52.issues) {
|
|
2217
2231
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
2218
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
2232
|
+
issue3.errors.map((issues) => processError({ issues }, [...path47, ...issue3.path]));
|
|
2219
2233
|
} else if (issue3.code === "invalid_key") {
|
|
2220
|
-
processError({ issues: issue3.issues }, [...
|
|
2234
|
+
processError({ issues: issue3.issues }, [...path47, ...issue3.path]);
|
|
2221
2235
|
} else if (issue3.code === "invalid_element") {
|
|
2222
|
-
processError({ issues: issue3.issues }, [...
|
|
2236
|
+
processError({ issues: issue3.issues }, [...path47, ...issue3.path]);
|
|
2223
2237
|
} else {
|
|
2224
|
-
const fullpath = [...
|
|
2238
|
+
const fullpath = [...path47, ...issue3.path];
|
|
2225
2239
|
if (fullpath.length === 0) {
|
|
2226
2240
|
result.errors.push(mapper(issue3));
|
|
2227
2241
|
continue;
|
|
@@ -2253,8 +2267,8 @@ function treeifyError(error51, mapper = (issue3) => issue3.message) {
|
|
|
2253
2267
|
}
|
|
2254
2268
|
function toDotPath(_path) {
|
|
2255
2269
|
const segs = [];
|
|
2256
|
-
const
|
|
2257
|
-
for (const seg of
|
|
2270
|
+
const path47 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2271
|
+
for (const seg of path47) {
|
|
2258
2272
|
if (typeof seg === "number")
|
|
2259
2273
|
segs.push(`[${seg}]`);
|
|
2260
2274
|
else if (typeof seg === "symbol")
|
|
@@ -14918,13 +14932,13 @@ function resolveRef(ref, ctx) {
|
|
|
14918
14932
|
if (!ref.startsWith("#")) {
|
|
14919
14933
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14920
14934
|
}
|
|
14921
|
-
const
|
|
14922
|
-
if (
|
|
14935
|
+
const path47 = ref.slice(1).split("/").filter(Boolean);
|
|
14936
|
+
if (path47.length === 0) {
|
|
14923
14937
|
return ctx.rootSchema;
|
|
14924
14938
|
}
|
|
14925
14939
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14926
|
-
if (
|
|
14927
|
-
const key =
|
|
14940
|
+
if (path47[0] === defsKey) {
|
|
14941
|
+
const key = path47[1];
|
|
14928
14942
|
if (!key || !ctx.defs[key]) {
|
|
14929
14943
|
throw new Error(`Reference not found: ${ref}`);
|
|
14930
14944
|
}
|
|
@@ -20204,7 +20218,7 @@ function inferBinName(packageName) {
|
|
|
20204
20218
|
// ../../packages/core-unified-agent/models.json
|
|
20205
20219
|
var models_default = {
|
|
20206
20220
|
version: 1,
|
|
20207
|
-
updatedAt: "2026-07-
|
|
20221
|
+
updatedAt: "2026-07-20T00:00:00Z",
|
|
20208
20222
|
providers: {
|
|
20209
20223
|
claude: {
|
|
20210
20224
|
name: "Claude Code",
|
|
@@ -20223,15 +20237,16 @@ var models_default = {
|
|
|
20223
20237
|
name: "Kimi via Claude Code",
|
|
20224
20238
|
defaultModel: "kimi-for-coding",
|
|
20225
20239
|
models: [
|
|
20226
|
-
{ modelId: "kimi-for-coding", name: "Kimi for Coding", description: "Available on every Kimi Code membership tier (262K context)", effort: { supported: false } },
|
|
20227
|
-
{ modelId: "k3", name: "Kimi K3", description: "Available on Moderato and higher tiers (262K context)", effort: { supported: true, levels: ["max"], default: "
|
|
20228
|
-
{ modelId: "k3[1m]", name: "Kimi K3 [1M]", description: "Available on Allegretto and higher tiers (1M context)", effort: { supported: true, levels: ["max"], default: "
|
|
20229
|
-
{ modelId: "kimi-for-coding-highspeed", name: "Kimi for Coding Highspeed", description: "Available on Allegretto and higher tiers (262K context)", effort: { supported: false } }
|
|
20240
|
+
{ modelId: "kimi-for-coding", name: "Kimi for Coding", description: "Available on every Kimi Code membership tier (262K context)", effort: { supported: false }, contextWindow: 262144 },
|
|
20241
|
+
{ modelId: "k3", name: "Kimi K3", description: "Available on Moderato and higher tiers (262K context)", effort: { supported: true, levels: ["low", "high", "max"], default: "high" }, contextWindow: 262144 },
|
|
20242
|
+
{ modelId: "k3[1m]", name: "Kimi K3 [1M]", description: "Available on Allegretto and higher tiers (1M context)", effort: { supported: true, levels: ["low", "high", "max"], default: "high" }, contextWindow: 1048576 },
|
|
20243
|
+
{ modelId: "kimi-for-coding-highspeed", name: "Kimi for Coding Highspeed", description: "Available on Allegretto and higher tiers (262K context)", effort: { supported: false }, contextWindow: 262144 }
|
|
20230
20244
|
],
|
|
20231
20245
|
modelsMapping: {
|
|
20232
20246
|
haiku: "kimi-for-coding",
|
|
20233
20247
|
sonnet: "kimi-for-coding",
|
|
20234
|
-
opus: "kimi-for-coding"
|
|
20248
|
+
opus: "kimi-for-coding",
|
|
20249
|
+
fable: "kimi-for-coding"
|
|
20235
20250
|
}
|
|
20236
20251
|
},
|
|
20237
20252
|
codex: {
|
|
@@ -20305,6 +20320,8 @@ var ModelEntrySchema = external_exports.object({
|
|
|
20305
20320
|
description: external_exports.string().optional(),
|
|
20306
20321
|
/** spawn 시 실제 CLI 모델 ID를 조립해야 하는 경우의 템플릿 */
|
|
20307
20322
|
spawnModelTemplate: external_exports.string().optional(),
|
|
20323
|
+
/** 모델의 컨텍스트 윈도우 크기 (토큰) */
|
|
20324
|
+
contextWindow: external_exports.number().int().positive().optional(),
|
|
20308
20325
|
/** 모델별 effort 설정 */
|
|
20309
20326
|
effort: EffortSchema
|
|
20310
20327
|
}).check((ctx) => {
|
|
@@ -20373,6 +20390,9 @@ function getProviderModels(cli) {
|
|
|
20373
20390
|
}
|
|
20374
20391
|
return structuredClone(provider);
|
|
20375
20392
|
}
|
|
20393
|
+
function getProviderModelIds(cli) {
|
|
20394
|
+
return getProviderModels(cli).models.map((m) => m.modelId);
|
|
20395
|
+
}
|
|
20376
20396
|
function getEffort(cli, modelId) {
|
|
20377
20397
|
const model = findProviderModel(cli, modelId);
|
|
20378
20398
|
return structuredClone(model.effort);
|
|
@@ -20405,6 +20425,13 @@ function resolveCursorSpawnModel(modelId, effort) {
|
|
|
20405
20425
|
}
|
|
20406
20426
|
return model.spawnModelTemplate.replace("{effort}", resolvedLevel);
|
|
20407
20427
|
}
|
|
20428
|
+
function getEffortLevels(cli, modelId) {
|
|
20429
|
+
const effort = getEffort(cli, modelId);
|
|
20430
|
+
if (!effort.supported) {
|
|
20431
|
+
return null;
|
|
20432
|
+
}
|
|
20433
|
+
return effort.levels;
|
|
20434
|
+
}
|
|
20408
20435
|
function getProviderModelsMapping(cli) {
|
|
20409
20436
|
const provider = registry2.providers[cli];
|
|
20410
20437
|
if (!provider) {
|
|
@@ -20412,6 +20439,10 @@ function getProviderModelsMapping(cli) {
|
|
|
20412
20439
|
}
|
|
20413
20440
|
return provider.modelsMapping ? structuredClone(provider.modelsMapping) : null;
|
|
20414
20441
|
}
|
|
20442
|
+
function getModelContextWindow(cli, modelId) {
|
|
20443
|
+
const model = findProviderModel(cli, modelId);
|
|
20444
|
+
return model.contextWindow ?? null;
|
|
20445
|
+
}
|
|
20415
20446
|
function findProviderModel(cli, modelId) {
|
|
20416
20447
|
const provider = registry2.providers[cli];
|
|
20417
20448
|
if (!provider) {
|
|
@@ -24129,12 +24160,26 @@ function resolveSelectionForCliType(stored, cliType, defaults) {
|
|
|
24129
24160
|
const allowedModels = new Set(provider.models.map((model2) => model2.modelId));
|
|
24130
24161
|
const defaultModelIsValid = !!defaults?.defaultModel && allowedModels.has(defaults.defaultModel);
|
|
24131
24162
|
const storedModelIsValid = !!stored?.model && allowedModels.has(stored.model);
|
|
24132
|
-
const
|
|
24163
|
+
const providerDefault = storedModelIsValid || defaultModelIsValid ? void 0 : readKimiProviderDefaultSelection(cliType, allowedModels);
|
|
24164
|
+
const model = storedModelIsValid ? stored.model : defaultModelIsValid ? defaults.defaultModel : providerDefault?.model ?? provider.defaultModel;
|
|
24133
24165
|
const modelEffort = getEffort(cliType, model);
|
|
24134
24166
|
if (!modelEffort.supported) return { model };
|
|
24135
|
-
const effort = storedModelIsValid && stored?.effort && modelEffort.levels.includes(stored.effort) ? stored.effort : defaults?.defaultEffort && modelEffort.levels.includes(defaults.defaultEffort) ? defaults.defaultEffort : modelEffort.default;
|
|
24167
|
+
const effort = storedModelIsValid && stored?.effort && modelEffort.levels.includes(stored.effort) ? stored.effort : defaults?.defaultEffort && modelEffort.levels.includes(defaults.defaultEffort) ? defaults.defaultEffort : providerDefault?.effort && modelEffort.levels.includes(providerDefault.effort) ? providerDefault.effort : modelEffort.default;
|
|
24136
24168
|
return { model, effort };
|
|
24137
24169
|
}
|
|
24170
|
+
function readKimiProviderDefaultSelection(cliType, allowedModels) {
|
|
24171
|
+
if (cliType !== "claude-kimi") return void 0;
|
|
24172
|
+
try {
|
|
24173
|
+
const kimiModel = createGlobalOptionsStore().load().kimiModel;
|
|
24174
|
+
if (!kimiModel || !allowedModels.has(kimiModel.model)) return void 0;
|
|
24175
|
+
return {
|
|
24176
|
+
model: kimiModel.model,
|
|
24177
|
+
...typeof kimiModel.effort === "string" ? { effort: kimiModel.effort } : {}
|
|
24178
|
+
};
|
|
24179
|
+
} catch {
|
|
24180
|
+
return void 0;
|
|
24181
|
+
}
|
|
24182
|
+
}
|
|
24138
24183
|
|
|
24139
24184
|
// ../../packages/fleet-carriers/src/store/taskforce-config.ts
|
|
24140
24185
|
var taskforce_config_exports = {};
|
|
@@ -32012,7 +32057,10 @@ async function buildConnectOptions(cli, cwd, overrides, systemPrompt, authEnvRes
|
|
|
32012
32057
|
if (overrides.promptIdleTimeout !== void 0) options.promptIdleTimeout = overrides.promptIdleTimeout;
|
|
32013
32058
|
if (systemPrompt) options.systemPrompt = systemPrompt;
|
|
32014
32059
|
if (mcpServers) options.mcpServers = mcpServers;
|
|
32015
|
-
const env = await authEnvResolver(cli
|
|
32060
|
+
const env = await authEnvResolver(cli, {
|
|
32061
|
+
...overrides.model ? { model: overrides.model } : {},
|
|
32062
|
+
...overrides.effort ? { effort: overrides.effort } : {}
|
|
32063
|
+
});
|
|
32016
32064
|
if (Object.keys(env).length) options.env = env;
|
|
32017
32065
|
return options;
|
|
32018
32066
|
}
|
|
@@ -33703,12 +33751,56 @@ function getExecutorMcpTools(registry3, carrierRuntime, carrierId) {
|
|
|
33703
33751
|
return registry3.getExecutorMcpToolsForScope(carrierId, metadataIds);
|
|
33704
33752
|
}
|
|
33705
33753
|
|
|
33754
|
+
// ../../packages/fleet-admiral/src/agent-cli/kimi-model.ts
|
|
33755
|
+
function resolveKimiModelSelection(globalOptionsService) {
|
|
33756
|
+
let stored;
|
|
33757
|
+
try {
|
|
33758
|
+
stored = globalOptionsService?.load().kimiModel;
|
|
33759
|
+
} catch {
|
|
33760
|
+
stored = void 0;
|
|
33761
|
+
}
|
|
33762
|
+
return resolveKimiModelSelectionFromOverride(
|
|
33763
|
+
typeof stored?.model === "string" ? stored.model : void 0,
|
|
33764
|
+
typeof stored?.effort === "string" ? stored.effort : void 0
|
|
33765
|
+
);
|
|
33766
|
+
}
|
|
33767
|
+
function resolveKimiModelSelectionFromOverride(model, effort) {
|
|
33768
|
+
const validIds = getProviderModelIds("claude-kimi");
|
|
33769
|
+
const resolvedModel = model && validIds.includes(model) ? model : getProviderModels("claude-kimi").defaultModel;
|
|
33770
|
+
const levels = getEffortLevels("claude-kimi", resolvedModel);
|
|
33771
|
+
if (!levels) {
|
|
33772
|
+
return { model: resolvedModel };
|
|
33773
|
+
}
|
|
33774
|
+
const effortConfig = getEffort("claude-kimi", resolvedModel);
|
|
33775
|
+
const resolvedEffort = effort && levels.includes(effort) ? effort : effortConfig.supported ? effortConfig.default : void 0;
|
|
33776
|
+
return resolvedEffort ? { model: resolvedModel, effort: resolvedEffort } : { model: resolvedModel };
|
|
33777
|
+
}
|
|
33778
|
+
function buildKimiModelEnv(selection) {
|
|
33779
|
+
const env = {
|
|
33780
|
+
ANTHROPIC_MODEL: selection.model,
|
|
33781
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: selection.model,
|
|
33782
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: selection.model,
|
|
33783
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: selection.model,
|
|
33784
|
+
ANTHROPIC_DEFAULT_FABLE_MODEL: selection.model,
|
|
33785
|
+
CLAUDE_CODE_SUBAGENT_MODEL: selection.model
|
|
33786
|
+
};
|
|
33787
|
+
const contextWindow = getModelContextWindow("claude-kimi", selection.model);
|
|
33788
|
+
if (contextWindow !== null) {
|
|
33789
|
+
env.CLAUDE_CODE_AUTO_COMPACT_WINDOW = String(contextWindow);
|
|
33790
|
+
env.CLAUDE_CODE_MAX_CONTEXT_TOKENS = String(contextWindow);
|
|
33791
|
+
}
|
|
33792
|
+
if (selection.effort) {
|
|
33793
|
+
env.CLAUDE_CODE_EFFORT_LEVEL = selection.effort;
|
|
33794
|
+
}
|
|
33795
|
+
return env;
|
|
33796
|
+
}
|
|
33797
|
+
|
|
33706
33798
|
// ../../packages/fleet-admiral/src/agent-cli/auth.ts
|
|
33707
33799
|
var KIMI_AUTH_PROVIDER_ID = "Claude Code with Moonshot Kimi";
|
|
33708
33800
|
var CLI_TO_AUTH_PROVIDER_ID = {
|
|
33709
33801
|
"claude-kimi": KIMI_AUTH_PROVIDER_ID
|
|
33710
33802
|
};
|
|
33711
|
-
async function resolveAgentCliAuthEnv(cli, authService) {
|
|
33803
|
+
async function resolveAgentCliAuthEnv(cli, authService, selection) {
|
|
33712
33804
|
if (cli !== "claude-kimi") return {};
|
|
33713
33805
|
const token = await authService?.getApiKey(KIMI_AUTH_PROVIDER_ID);
|
|
33714
33806
|
if (!token) {
|
|
@@ -33718,6 +33810,7 @@ async function resolveAgentCliAuthEnv(cli, authService) {
|
|
|
33718
33810
|
}
|
|
33719
33811
|
return {
|
|
33720
33812
|
...CLI_BACKENDS[cli].defaultEnv,
|
|
33813
|
+
...buildKimiModelEnv(selection ?? resolveKimiModelSelection(void 0)),
|
|
33721
33814
|
ANTHROPIC_API_KEY: token
|
|
33722
33815
|
};
|
|
33723
33816
|
}
|
|
@@ -33757,7 +33850,11 @@ function createClaudeFamilyCliDefinition(options) {
|
|
|
33757
33850
|
label: options.label,
|
|
33758
33851
|
async createProfile(profileOptions) {
|
|
33759
33852
|
const { bin, prefixArgs } = resolveBinary("claude", "CLAUDE_BIN", profileOptions.env);
|
|
33760
|
-
const authEnv = await resolveAgentCliAuthEnv(
|
|
33853
|
+
const authEnv = await resolveAgentCliAuthEnv(
|
|
33854
|
+
options.id,
|
|
33855
|
+
profileOptions.authService,
|
|
33856
|
+
options.id === "claude-kimi" ? profileOptions.model ? resolveKimiModelSelectionFromOverride(profileOptions.model) : resolveKimiModelSelection(profileOptions.globalOptionsService) : void 0
|
|
33857
|
+
);
|
|
33761
33858
|
const childEnv = createChildEnv(profileOptions.env, authEnv);
|
|
33762
33859
|
if (options.id === "claude-kimi") {
|
|
33763
33860
|
delete childEnv.ANTHROPIC_AUTH_TOKEN;
|
|
@@ -33853,6 +33950,7 @@ async function resolveAgentCliProfile(env, cwd, options = {}) {
|
|
|
33853
33950
|
authService: options.authService,
|
|
33854
33951
|
cwd,
|
|
33855
33952
|
env,
|
|
33953
|
+
globalOptionsService: options.globalOptionsService,
|
|
33856
33954
|
model: options.model,
|
|
33857
33955
|
resumeSessionId: options.resumeSessionId
|
|
33858
33956
|
});
|
|
@@ -35368,9 +35466,10 @@ function createFleetAgentRuntimeLifecycle(deps) {
|
|
|
35368
35466
|
};
|
|
35369
35467
|
}
|
|
35370
35468
|
function createAuthEnvResolver(globalOptionsService, authService) {
|
|
35371
|
-
return async (cli) => {
|
|
35469
|
+
return async (cli, context) => {
|
|
35372
35470
|
if (cli === "claude-kimi") {
|
|
35373
|
-
|
|
35471
|
+
const selection = context?.model && getProviderModelIds("claude-kimi").includes(context.model) ? resolveKimiModelSelectionFromOverride(context.model, context.effort) : resolveKimiModelSelection(globalOptionsService);
|
|
35472
|
+
return resolveAgentCliAuthEnv(cli, authService, selection);
|
|
35374
35473
|
}
|
|
35375
35474
|
if (cli !== "codex" || !globalOptionsService) return {};
|
|
35376
35475
|
try {
|
|
@@ -42222,6 +42321,8 @@ function clampInteger3(value, fallback, min, max, field) {
|
|
|
42222
42321
|
}
|
|
42223
42322
|
return Math.min(max, Math.max(min, value));
|
|
42224
42323
|
}
|
|
42324
|
+
|
|
42325
|
+
// ../../packages/fleet-wiki/src/tools/read.ts
|
|
42225
42326
|
var DEFAULT_BOUNDARY = FLEET_WIKI_BOUNDARY_GUIDELINES[0];
|
|
42226
42327
|
var TRUNCATION_MARKER2 = "\n\n[truncated by wiki_read max_tokens]";
|
|
42227
42328
|
var MAX_QUERY_TOKENS_FLOOR = 1;
|
|
@@ -42330,7 +42431,7 @@ async function buildReadEntryResult(entry, paths, graph, input) {
|
|
|
42330
42431
|
rawSourceRef: entry.rawSourceRef,
|
|
42331
42432
|
rawSourceRefs,
|
|
42332
42433
|
source: {
|
|
42333
|
-
path:
|
|
42434
|
+
path: `wiki/${entry.id}.md`,
|
|
42334
42435
|
rawSourceRef: entry.rawSourceRef,
|
|
42335
42436
|
rawSourceRefs
|
|
42336
42437
|
},
|
|
@@ -42456,7 +42557,7 @@ function buildRelatedEntries(entry, graph) {
|
|
|
42456
42557
|
deduped.set(candidate.id, {
|
|
42457
42558
|
id: relatedEntry.id,
|
|
42458
42559
|
title: relatedEntry.title,
|
|
42459
|
-
path:
|
|
42560
|
+
path: `wiki/${relatedEntry.id}.md`,
|
|
42460
42561
|
reason: candidate.reason
|
|
42461
42562
|
});
|
|
42462
42563
|
}
|
|
@@ -42808,6 +42909,7 @@ function buildWikiToolSpec(config2, usage, resolver) {
|
|
|
42808
42909
|
var STAGING_PREFIX = "knowledge.migrating-";
|
|
42809
42910
|
var MARKER_NAME = "knowledge.migrated.json";
|
|
42810
42911
|
var MARKER_TEMP_REGEXP = /^knowledge\.migrated\.json\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.tmp$/i;
|
|
42912
|
+
var IGNORED_FSYNC_ERROR_CODES2 = /* @__PURE__ */ new Set(["EPERM", "EINVAL", "ENOSYS"]);
|
|
42811
42913
|
function createWikiWorkspaceResolver(deps) {
|
|
42812
42914
|
return createResolver(deps);
|
|
42813
42915
|
}
|
|
@@ -42992,10 +43094,18 @@ function writeAtomic2(target, contents) {
|
|
|
42992
43094
|
syncFile(temporary);
|
|
42993
43095
|
fs11.renameSync(temporary, target);
|
|
42994
43096
|
}
|
|
43097
|
+
function fsyncBestEffort(fd) {
|
|
43098
|
+
try {
|
|
43099
|
+
fs11.fsyncSync(fd);
|
|
43100
|
+
} catch (error51) {
|
|
43101
|
+
const code = error51.code;
|
|
43102
|
+
if (typeof code !== "string" || !IGNORED_FSYNC_ERROR_CODES2.has(code)) throw error51;
|
|
43103
|
+
}
|
|
43104
|
+
}
|
|
42995
43105
|
function syncFile(target) {
|
|
42996
43106
|
const fd = fs11.openSync(target, "r");
|
|
42997
43107
|
try {
|
|
42998
|
-
|
|
43108
|
+
fsyncBestEffort(fd);
|
|
42999
43109
|
} finally {
|
|
43000
43110
|
fs11.closeSync(fd);
|
|
43001
43111
|
}
|
|
@@ -43004,7 +43114,7 @@ function syncDirectory(target) {
|
|
|
43004
43114
|
if (!shouldSyncDirectoryForTest(process.platform)) return;
|
|
43005
43115
|
const fd = fs11.openSync(target, "r");
|
|
43006
43116
|
try {
|
|
43007
|
-
|
|
43117
|
+
fsyncBestEffort(fd);
|
|
43008
43118
|
} finally {
|
|
43009
43119
|
fs11.closeSync(fd);
|
|
43010
43120
|
}
|
|
@@ -44162,6 +44272,7 @@ async function createAgentCliLaunchSpec(options) {
|
|
|
44162
44272
|
const profile = await options.resolveProfile(options.env, options.cwd, {
|
|
44163
44273
|
authService: options.infraServices.authService,
|
|
44164
44274
|
cliId: options.cliId,
|
|
44275
|
+
globalOptionsService: options.infraServices.globalOptionsService,
|
|
44165
44276
|
resumeSessionId: options.resumeSessionId
|
|
44166
44277
|
});
|
|
44167
44278
|
const globalSettings = readGlobalSettingsSnapshot(options.infraServices);
|
|
@@ -45074,23 +45185,23 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45074
45185
|
backfillAgentOperationLaunchKinds();
|
|
45075
45186
|
rehydrateDormantAgentOperations();
|
|
45076
45187
|
async function handle({ req, res, pathname }) {
|
|
45077
|
-
const
|
|
45078
|
-
if (
|
|
45188
|
+
const path47 = pathname.slice(`${ctx.basePath}/agent`.length) || "/";
|
|
45189
|
+
if (path47 === "/state") {
|
|
45079
45190
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45080
45191
|
ctx.host.http.writeJson(res, 200, { agentClis: await buildAgentCliLaunchMetadata() });
|
|
45081
45192
|
return true;
|
|
45082
45193
|
}
|
|
45083
|
-
if (
|
|
45194
|
+
if (path47 === "/agent-cli/state") {
|
|
45084
45195
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45085
45196
|
ctx.host.http.writeJson(res, 200, { clis: await detector.detect() });
|
|
45086
45197
|
return true;
|
|
45087
45198
|
}
|
|
45088
|
-
if (
|
|
45199
|
+
if (path47 === "/tenants") {
|
|
45089
45200
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45090
45201
|
ctx.host.http.writeJson(res, 200, { tenants: observability.listWorkspaces() });
|
|
45091
45202
|
return true;
|
|
45092
45203
|
}
|
|
45093
|
-
if (
|
|
45204
|
+
if (path47 === "/jobs") {
|
|
45094
45205
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45095
45206
|
const requestedTenantId = new URL(req.url ?? "/", "http://127.0.0.1").searchParams.get("tenant");
|
|
45096
45207
|
const visible = requestedTenantId ? observability.listWorkspaces().filter((workspace) => workspace.tenantId === requestedTenantId) : observability.listWorkspaces();
|
|
@@ -45101,7 +45212,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45101
45212
|
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) })) });
|
|
45102
45213
|
return true;
|
|
45103
45214
|
}
|
|
45104
|
-
if (
|
|
45215
|
+
if (path47 === "/events") {
|
|
45105
45216
|
if (req.method !== "GET") return methodNotAllowed2(res);
|
|
45106
45217
|
const requestedTenantId = new URL(req.url ?? "/", "http://127.0.0.1").searchParams.get("tenant");
|
|
45107
45218
|
const visible = requestedTenantId ? observability.listWorkspaces().filter((workspace) => workspace.tenantId === requestedTenantId) : observability.listWorkspaces();
|
|
@@ -45112,11 +45223,11 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
45112
45223
|
writeAggregateObserverEvents(req, res, visible, observability, (tenantId) => observability.getWorkspace(tenantId), { subscribeAll: true });
|
|
45113
45224
|
return true;
|
|
45114
45225
|
}
|
|
45115
|
-
if (
|
|
45116
|
-
if (
|
|
45117
|
-
const sessionMatch =
|
|
45226
|
+
if (path47 === "/sessions") return handleSessions(req, res);
|
|
45227
|
+
if (path47 === "/capture") return handleCapture(req, res, "");
|
|
45228
|
+
const sessionMatch = path47.match(/^\/sessions\/([^/]+)(?:\/([^/]+))?$/);
|
|
45118
45229
|
if (sessionMatch) return handleSessionItem(req, res, decodeURIComponent(sessionMatch[1] ?? ""), sessionMatch[2] ?? "");
|
|
45119
|
-
if (
|
|
45230
|
+
if (path47 === "/ticket") {
|
|
45120
45231
|
if (req.method !== "POST") return methodNotAllowed2(res);
|
|
45121
45232
|
if (!ctx.host.security.isTerminalAuthorized(req)) {
|
|
45122
45233
|
ctx.host.http.writeJson(res, 401, { error: "Unauthorized" });
|
|
@@ -46224,15 +46335,13 @@ async function settleWithin(promises2, timeoutMs) {
|
|
|
46224
46335
|
}
|
|
46225
46336
|
|
|
46226
46337
|
// ../fleet-plugins/terminal/server/agent-api/analysis-registry.ts
|
|
46227
|
-
var MAX_ANALYSIS_SESSIONS = 4;
|
|
46228
46338
|
var MAX_ANALYSIS_ARTIFACTS = 32;
|
|
46229
|
-
var
|
|
46339
|
+
var MAX_STOPPED_ANALYSIS_ARTIFACTS = 256;
|
|
46230
46340
|
var AnalysisRegistry = class {
|
|
46231
46341
|
entries = /* @__PURE__ */ new Map();
|
|
46232
46342
|
artifacts = /* @__PURE__ */ new Map();
|
|
46233
46343
|
async start(operationId, create) {
|
|
46234
46344
|
if (this.entries.has(operationId)) return "exists";
|
|
46235
|
-
if (this.entries.size >= MAX_ANALYSIS_SESSIONS) return "limit";
|
|
46236
46345
|
let entry;
|
|
46237
46346
|
const session = create((event) => {
|
|
46238
46347
|
if (!entry || entry.stopped) return;
|
|
@@ -46295,6 +46404,7 @@ var AnalysisRegistry = class {
|
|
|
46295
46404
|
this.entries.delete(operationId);
|
|
46296
46405
|
entry.stopped = true;
|
|
46297
46406
|
entry.subscribers.clear();
|
|
46407
|
+
this.pruneStoppedArtifacts();
|
|
46298
46408
|
await this.disposeEntry(entry);
|
|
46299
46409
|
return true;
|
|
46300
46410
|
}
|
|
@@ -46312,16 +46422,18 @@ var AnalysisRegistry = class {
|
|
|
46312
46422
|
break;
|
|
46313
46423
|
}
|
|
46314
46424
|
}
|
|
46315
|
-
|
|
46316
|
-
|
|
46317
|
-
|
|
46318
|
-
|
|
46319
|
-
|
|
46320
|
-
|
|
46321
|
-
|
|
46322
|
-
|
|
46323
|
-
if (
|
|
46324
|
-
this.
|
|
46425
|
+
this.pruneStoppedArtifacts();
|
|
46426
|
+
}
|
|
46427
|
+
pruneStoppedArtifacts() {
|
|
46428
|
+
let stoppedArtifactCount = 0;
|
|
46429
|
+
for (const artifact of this.artifacts.values()) {
|
|
46430
|
+
if (!this.entries.has(artifact.operationId)) stoppedArtifactCount += 1;
|
|
46431
|
+
}
|
|
46432
|
+
for (const [artifactId, artifact] of this.artifacts) {
|
|
46433
|
+
if (stoppedArtifactCount <= MAX_STOPPED_ANALYSIS_ARTIFACTS) break;
|
|
46434
|
+
if (this.entries.has(artifact.operationId)) continue;
|
|
46435
|
+
this.artifacts.delete(artifactId);
|
|
46436
|
+
stoppedArtifactCount -= 1;
|
|
46325
46437
|
}
|
|
46326
46438
|
}
|
|
46327
46439
|
disposeEntry(entry) {
|
|
@@ -46339,7 +46451,6 @@ var ANALYSIS_ERROR_CODES = {
|
|
|
46339
46451
|
captureMissing: "analysis_capture_missing",
|
|
46340
46452
|
transcriptMissing: "analysis_transcript_missing",
|
|
46341
46453
|
catalogInvalid: "analysis_catalog_invalid",
|
|
46342
|
-
sessionLimit: "analysis_session_limit",
|
|
46343
46454
|
sessionExists: "analysis_session_exists",
|
|
46344
46455
|
sessionNotFound: "analysis_session_not_found",
|
|
46345
46456
|
sessionBusy: "analysis_session_busy"
|
|
@@ -46407,19 +46518,20 @@ function registerAnalysisRoutes(ctx, deps = {}) {
|
|
|
46407
46518
|
const readCapture = deps.readCapture ?? readProviderSessionCapture;
|
|
46408
46519
|
const createSession = deps.createSession ?? ((options) => new AnalystSession(options));
|
|
46409
46520
|
const catalog = async () => buildAnalysisCatalog(await detect(), modelsFor);
|
|
46521
|
+
const inFlightStartDeletionMarkers = /* @__PURE__ */ new Set();
|
|
46410
46522
|
registerRouter(ctx, "analysis", async ({ req, res, pathname }) => {
|
|
46411
46523
|
const localPort = req.socket.localPort;
|
|
46412
46524
|
if (!localPort || !ctx.host.security.validateHost(req, localPort) || !ctx.host.security.isTerminalAuthorized(req)) {
|
|
46413
46525
|
writeError(ctx, res, 403, ANALYSIS_ERROR_CODES.catalogInvalid, "Analysis request is not accepted by this host.");
|
|
46414
46526
|
return true;
|
|
46415
46527
|
}
|
|
46416
|
-
const
|
|
46417
|
-
if (
|
|
46418
|
-
const artifactMatch =
|
|
46528
|
+
const path47 = pathname.slice(`${ctx.basePath}/analysis`.length) || "/";
|
|
46529
|
+
if (path47 === "/catalog") return handleCatalog(ctx, req, res, catalog);
|
|
46530
|
+
const artifactMatch = path47.match(/^\/artifacts\/([^/]+)$/);
|
|
46419
46531
|
if (artifactMatch) return handleArtifact(ctx, req, res, decodeURIComponent(artifactMatch[1] ?? ""), registry3);
|
|
46420
|
-
const clearArtifactsMatch =
|
|
46532
|
+
const clearArtifactsMatch = path47.match(/^\/([^/]+)\/artifacts$/);
|
|
46421
46533
|
if (clearArtifactsMatch) return handleClearArtifacts(ctx, req, res, decodeURIComponent(clearArtifactsMatch[1] ?? ""), registry3);
|
|
46422
|
-
const match =
|
|
46534
|
+
const match = path47.match(/^\/([^/]+)\/(ready|start|message|stream|stop)$/);
|
|
46423
46535
|
if (!match) return false;
|
|
46424
46536
|
const operationId = decodeURIComponent(match[1] ?? "");
|
|
46425
46537
|
const action = match[2] ?? "";
|
|
@@ -46429,13 +46541,24 @@ function registerAnalysisRoutes(ctx, deps = {}) {
|
|
|
46429
46541
|
return true;
|
|
46430
46542
|
}
|
|
46431
46543
|
if (action === "ready") return handleReady(ctx, req, res, operation, readCapture);
|
|
46432
|
-
if (action === "start")
|
|
46544
|
+
if (action === "start") {
|
|
46545
|
+
const deletionMarker = { operationId, deleted: false };
|
|
46546
|
+
inFlightStartDeletionMarkers.add(deletionMarker);
|
|
46547
|
+
try {
|
|
46548
|
+
return await handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, deletionMarker);
|
|
46549
|
+
} finally {
|
|
46550
|
+
inFlightStartDeletionMarkers.delete(deletionMarker);
|
|
46551
|
+
}
|
|
46552
|
+
}
|
|
46433
46553
|
if (action === "message") return handleMessage(ctx, req, res, operationId, registry3);
|
|
46434
46554
|
if (action === "stream") return handleStream(ctx, req, res, operationId, registry3);
|
|
46435
46555
|
return handleStop(ctx, req, res, operationId, registry3);
|
|
46436
46556
|
});
|
|
46437
46557
|
const unsubscribeDelete = ctx.host.events.subscribe(OPERATION_DELETED_EVENT_CHANNEL, (payload) => {
|
|
46438
46558
|
if (isOperationDeletedEvent(payload) && payload.pluginId === ctx.pluginId) {
|
|
46559
|
+
for (const marker of inFlightStartDeletionMarkers) {
|
|
46560
|
+
if (marker.operationId === payload.operationId) marker.deleted = true;
|
|
46561
|
+
}
|
|
46439
46562
|
registry3.clearArtifacts(payload.operationId);
|
|
46440
46563
|
void registry3.stop(payload.operationId);
|
|
46441
46564
|
}
|
|
@@ -46699,7 +46822,7 @@ async function handleReady(ctx, req, res, operation, readCapture) {
|
|
|
46699
46822
|
}
|
|
46700
46823
|
return true;
|
|
46701
46824
|
}
|
|
46702
|
-
async function handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession) {
|
|
46825
|
+
async function handleStart(ctx, req, res, operation, registry3, catalog, readCapture, createSession, deletionMarker) {
|
|
46703
46826
|
if (req.method !== "POST") return methodNotAllowed(ctx, res);
|
|
46704
46827
|
if (!isJsonRequest(req)) return unsupportedMediaType(ctx, res);
|
|
46705
46828
|
const body = await ctx.host.http.readJsonBody(req);
|
|
@@ -46723,14 +46846,18 @@ async function handleStart(ctx, req, res, operation, registry3, catalog, readCap
|
|
|
46723
46846
|
writeError(ctx, res, 404, ANALYSIS_ERROR_CODES.sessionNotFound, "Analysis operation was not found.");
|
|
46724
46847
|
return true;
|
|
46725
46848
|
}
|
|
46849
|
+
if (deletionMarker.deleted || !getAgentOperation(ctx, operation.id)) {
|
|
46850
|
+
writeError(ctx, res, 404, ANALYSIS_ERROR_CODES.sessionNotFound, "Analysis operation was not found.");
|
|
46851
|
+
return true;
|
|
46852
|
+
}
|
|
46726
46853
|
try {
|
|
46727
46854
|
const result = await registry3.start(operation.id, (onEvent) => createSession({ cliId: body.cliId, model: body.model, effort: body.effort || void 0, cwd, capturePath: transcriptPath, onEvent: (event) => onEvent(toBrowserEvent(event)) }));
|
|
46728
46855
|
if (result === "exists") writeError(ctx, res, 409, ANALYSIS_ERROR_CODES.sessionExists, "Analysis session already exists.");
|
|
46729
|
-
else if (result === "limit") writeError(ctx, res, 429, ANALYSIS_ERROR_CODES.sessionLimit, "Analysis session limit reached.");
|
|
46730
46856
|
else if (result === "stopped") writeError(ctx, res, 404, ANALYSIS_ERROR_CODES.sessionNotFound, "Analysis session was stopped before it started.");
|
|
46731
46857
|
else ctx.host.http.writeJson(res, 200, { started: true });
|
|
46732
46858
|
} catch {
|
|
46733
|
-
writeError(ctx, res,
|
|
46859
|
+
if (deletionMarker.deleted) writeError(ctx, res, 404, ANALYSIS_ERROR_CODES.sessionNotFound, "Analysis session was stopped before it started.");
|
|
46860
|
+
else writeError(ctx, res, 503, ANALYSIS_ERROR_CODES.catalogInvalid, "Analysis session could not start.");
|
|
46734
46861
|
}
|
|
46735
46862
|
return true;
|
|
46736
46863
|
}
|
|
@@ -47300,7 +47427,8 @@ function registerTerminalSettingsRoutes(ctx, deps) {
|
|
|
47300
47427
|
function toTerminalSettingsState(data) {
|
|
47301
47428
|
return {
|
|
47302
47429
|
enableMetaphor: data.enableMetaphor ?? false,
|
|
47303
|
-
codexLaunchMode: data.codexLaunchMode ?? "app-server"
|
|
47430
|
+
codexLaunchMode: data.codexLaunchMode ?? "app-server",
|
|
47431
|
+
kimiModel: data.kimiModel ?? null
|
|
47304
47432
|
};
|
|
47305
47433
|
}
|
|
47306
47434
|
function isTerminalSettingsBody(value) {
|
|
@@ -47309,7 +47437,17 @@ function isTerminalSettingsBody(value) {
|
|
|
47309
47437
|
if (keys.length !== 1) return false;
|
|
47310
47438
|
const body = value;
|
|
47311
47439
|
if (keys[0] === "enableMetaphor") return typeof body.enableMetaphor === "boolean";
|
|
47312
|
-
|
|
47440
|
+
if (keys[0] === "codexLaunchMode") return body.codexLaunchMode === "acp" || body.codexLaunchMode === "app-server";
|
|
47441
|
+
return keys[0] === "kimiModel" && isKimiModelSetting(body.kimiModel);
|
|
47442
|
+
}
|
|
47443
|
+
function isKimiModelSetting(value) {
|
|
47444
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
47445
|
+
const record4 = value;
|
|
47446
|
+
if (typeof record4.model !== "string" || !getProviderModelIds("claude-kimi").includes(record4.model)) return false;
|
|
47447
|
+
const levels = getEffortLevels("claude-kimi", record4.model);
|
|
47448
|
+
if (record4.effort === void 0) return true;
|
|
47449
|
+
if (!levels || typeof record4.effort !== "string") return false;
|
|
47450
|
+
return levels.includes(record4.effort);
|
|
47313
47451
|
}
|
|
47314
47452
|
function isJsonRequest3(req) {
|
|
47315
47453
|
const contentType = req.headers["content-type"];
|
|
@@ -47338,8 +47476,8 @@ function registerTerminalModelAuthRoutes(ctx, deps) {
|
|
|
47338
47476
|
}
|
|
47339
47477
|
function createTerminalModelAuthRouter(ctx, deps) {
|
|
47340
47478
|
return async function handleTerminalModelAuthRoute({ req, res, pathname }) {
|
|
47341
|
-
const
|
|
47342
|
-
if (
|
|
47479
|
+
const path47 = pathname.slice(`${ctx.basePath}/model-auth`.length) || "/";
|
|
47480
|
+
if (path47 === "/state") {
|
|
47343
47481
|
if (req.method !== "GET") {
|
|
47344
47482
|
ctx.host.http.writeJson(res, 405, { error: "Method not allowed" });
|
|
47345
47483
|
return true;
|
|
@@ -47347,7 +47485,7 @@ function createTerminalModelAuthRouter(ctx, deps) {
|
|
|
47347
47485
|
ctx.host.http.writeJson(res, 200, await buildModelAuthState(deps.authService));
|
|
47348
47486
|
return true;
|
|
47349
47487
|
}
|
|
47350
|
-
const cli = parseProviderPath(
|
|
47488
|
+
const cli = parseProviderPath(path47);
|
|
47351
47489
|
if (!cli) return false;
|
|
47352
47490
|
if (cli !== "claude-kimi") {
|
|
47353
47491
|
ctx.host.http.writeJson(res, 404, { error: "provider_not_found" });
|
|
@@ -47414,8 +47552,8 @@ async function writeMutationState2(ctx, res, deps) {
|
|
|
47414
47552
|
async function findProvider(deps) {
|
|
47415
47553
|
return (await buildModelAuthState(deps.authService)).providers[0] ?? null;
|
|
47416
47554
|
}
|
|
47417
|
-
function parseProviderPath(
|
|
47418
|
-
const parts =
|
|
47555
|
+
function parseProviderPath(path47) {
|
|
47556
|
+
const parts = path47.split("/").filter(Boolean);
|
|
47419
47557
|
if (parts.length !== 2 || parts[0] !== "providers") return null;
|
|
47420
47558
|
try {
|
|
47421
47559
|
return decodeURIComponent(parts[1] ?? "");
|