@dotobokuri/fleet-console 1.17.1 → 1.18.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 +5 -5
- package/dist/cli.d.ts +0 -2
- package/dist/cli.mjs +1055 -2270
- package/dist/client/assets/{_baseUniq-B7sqIsqm.js → _baseUniq-DFEDX4NY.js} +1 -1
- package/dist/client/assets/{arc-CvtYLN8U.js → arc-CGwMrR6o.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-rlI7pNrR.js → architectureDiagram-Q4EWVU46-BqLyvIOK.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-nwx9BNRz.js → blockDiagram-DXYQGD6D-DoiPMLdv.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CRL_0Ism.js → c4Diagram-AHTNJAMY-DfGxDkah.js} +1 -1
- package/dist/client/assets/channel-DlT8zCVq.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-DEkncDR3.js → chunk-4BX2VUAB-3zXv74oY.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-Bnot0Ti1.js → chunk-4TB4RGXK-MkXUmjUE.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-EgKmMTlI.js → chunk-55IACEB6-mhkgqlI_.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-BKiKnVQE.js → chunk-EDXVE4YY-B0_ZDihs.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-BRC398vL.js → chunk-FMBD7UC4-BQAuE4pL.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-D82gQaXN.js → chunk-OYMX7WX6-CY8Eyj9X.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BYdI5fky.js → chunk-QZHKN3VN-CaZoMwKH.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-BhBgOoc0.js → chunk-YZCP3GAM-DV1YOEUH.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-B-UN9f9r.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-B-UN9f9r.js +1 -0
- package/dist/client/assets/clone-CDPRFCO0.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-J8dfEdWD.js → cose-bilkent-S5V4N54A-Cy3v0C_N.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-zGd_6_Kv.js → dagre-KV5264BT-CGJ6x_VR.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-BQpQGgZ3.js → diagram-5BDNPKRD-MyyXeHKQ.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BbgPVITm.js → diagram-G4DWMVQ6-D52Q2132.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-lJsMf0Ic.js → diagram-MMDJMWI5-DCypusCr.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-BpEKTzOh.js → diagram-TYMM5635-c5UBqE9-.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-CHHVwJ_a.js → erDiagram-SMLLAGMA-BlF0Lxy7.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-Cun8a4NF.js → flowDiagram-DWJPFMVM-lo8xyzfx.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CGCwH_yf.js → ganttDiagram-T4ZO3ILL-BXVZMpon.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-BkY4qdoV.js → gitGraphDiagram-UUTBAWPF-DB1A6uYk.js} +1 -1
- package/dist/client/assets/{graph-HbRzXQtt.js → graph-Ck2AX1p2.js} +1 -1
- package/dist/client/assets/index-Cf9MmpwN.css +1 -0
- package/dist/client/assets/index-DWgndVkX.js +404 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-B21Xtz8v.js → infoDiagram-42DDH7IO-NEVE42fw.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DiABngEH.js → ishikawaDiagram-UXIWVN3A-MbFr_8pL.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-BKZ-Uivu.js → journeyDiagram-VCZTEJTY-Sq2ja3q8.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-CoJzTtsH.js → kanban-definition-6JOO6SKY-C63qPhtK.js} +1 -1
- package/dist/client/assets/{layout-D5tmQpxt.js → layout-CFEuVj4N.js} +1 -1
- package/dist/client/assets/{linear-B_riNOXk.js → linear-B626G8Op.js} +1 -1
- package/dist/client/assets/{mermaid.core-CyRCP3U3.js → mermaid.core-BT7SVKBR.js} +4 -4
- package/dist/client/assets/{min-Cn8LZZXB.js → min-MbEOApMw.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-BN_7mZUt.js → mindmap-definition-QFDTVHPH-DMpht5Mg.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-DPP2-sYA.js → pieDiagram-DEJITSTG-B4XS0haZ.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-CQ_oo-f9.js → quadrantDiagram-34T5L4WZ-CReo5Ajb.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-BkGq7nxD.js → requirementDiagram-MS252O5E-A50aqG-K.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-BVcoktBR.js → sankeyDiagram-XADWPNL6-471VOdlW.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-B5rr_VYJ.js → sequenceDiagram-FGHM5R23-BAvOyUC-.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-BV8RqzB9.js → stateDiagram-FHFEXIEX-gCtZrvR-.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Bdb0YU66.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-CJ8TM-3t.js → timeline-definition-GMOUNBTQ-CTHf-uxq.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-BETSq-Pu.js → vennDiagram-DHZGUBPP-5gvXi0dO.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-CyT2qapq.js → wardley-RL74JXVD-XR-qQTWZ.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-CWHaiUEG.js → wardleyDiagram-NUSXRM2D-EwPsMHdt.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-oVPlZ_Yn.js → xychartDiagram-5P7HB3ND-CePwuUb7.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/diff/routes.mjs +76 -21
- package/dist/fleet-plugins/skills/routes.mjs +7 -118
- package/dist/fleet-plugins/terminal/routes.mjs +281 -974
- package/package.json +1 -1
- package/dist/client/assets/channel-Ct9EqqyG.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-CPMS8Qpo.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-CPMS8Qpo.js +0 -1
- package/dist/client/assets/clone-C5XNYXHD.js +0 -1
- package/dist/client/assets/index-CfNSyAUJ.css +0 -1
- package/dist/client/assets/index-CzCMC0e-.js +0 -402
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Bx_fpQWQ.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as fs8 from 'fs';
|
|
3
|
-
import fs8__default, {
|
|
3
|
+
import fs8__default, { mkdtempSync, writeFileSync, mkdirSync, existsSync, rmSync, chmodSync, renameSync, readdirSync, readFileSync, constants, openSync, closeSync, realpathSync, fstatSync, lstatSync, unlinkSync, statSync } from 'fs';
|
|
4
4
|
import * as path27 from 'path';
|
|
5
5
|
import path27__default, { dirname } from 'path';
|
|
6
6
|
import * as os3 from 'os';
|
|
7
7
|
import os3__default from 'os';
|
|
8
|
+
import crypto3, { createHash, randomUUID } from 'crypto';
|
|
9
|
+
import process4 from 'process';
|
|
8
10
|
import { EventEmitter } from 'events';
|
|
9
11
|
import { mkdir, writeFile, access, readFile, stat, readdir, appendFile, rename, rm } from 'fs/promises';
|
|
10
12
|
import { execFile, execSync, spawn, spawnSync } from 'child_process';
|
|
11
13
|
import { Writable, Readable } from 'stream';
|
|
12
|
-
import crypto3, { createHash, randomUUID } from 'crypto';
|
|
13
|
-
import process4 from 'process';
|
|
14
14
|
import http from 'http';
|
|
15
15
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
16
16
|
import { createRequire } from 'module';
|
|
@@ -556,6 +556,43 @@ function updateGlobalOptions(store2, mutate) {
|
|
|
556
556
|
return store2.update(mutate);
|
|
557
557
|
}
|
|
558
558
|
|
|
559
|
+
// ../../packages/fleet-infra/src/index.ts
|
|
560
|
+
function createInfraServices(deps = {}) {
|
|
561
|
+
const globalOptionsService = createGlobalOptionsService();
|
|
562
|
+
const authService = createAuthService({ authPath: deps.authPath ?? DEFAULT_AUTH_PATH });
|
|
563
|
+
return {
|
|
564
|
+
authService,
|
|
565
|
+
globalOptionsService
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// ../../packages/fleet-carriers/src/dispatch/framework.ts
|
|
570
|
+
var framework_exports = {};
|
|
571
|
+
__export(framework_exports, {
|
|
572
|
+
CarrierRegistry: () => CarrierRegistry,
|
|
573
|
+
clearRegisteredCarriers: () => clearRegisteredCarriers,
|
|
574
|
+
createCarrierRegistry: () => createCarrierRegistry,
|
|
575
|
+
emitStreamEvent: () => emitStreamEvent,
|
|
576
|
+
getAllCliTypes: () => getAllCliTypes,
|
|
577
|
+
getCarrierConfig: () => getCarrierConfig,
|
|
578
|
+
getCarrierSourceDisplayName: () => getCarrierSourceDisplayName,
|
|
579
|
+
getRegisteredCarrierConfig: () => getRegisteredCarrierConfig,
|
|
580
|
+
getRegisteredOrder: () => getRegisteredOrder,
|
|
581
|
+
normalizeEffort: () => normalizeEffort,
|
|
582
|
+
notifyStatusUpdate: () => notifyStatusUpdate,
|
|
583
|
+
registerCarrier: () => registerCarrier,
|
|
584
|
+
registerStreamHandler: () => registerStreamHandler,
|
|
585
|
+
resetCarrierRegistryForTests: () => resetCarrierRegistryForTests,
|
|
586
|
+
resolveAgentCliType: () => resolveAgentCliType2,
|
|
587
|
+
resolveCarrierDisplayName: () => resolveCarrierDisplayName,
|
|
588
|
+
resolveValidatedEffort: () => resolveValidatedEffort,
|
|
589
|
+
setTaskForceConfiguredCarriers: () => setTaskForceConfiguredCarriers,
|
|
590
|
+
toCarrierJobStatus: () => toCarrierJobStatus,
|
|
591
|
+
toTrackFinalStatus: () => toTrackFinalStatus,
|
|
592
|
+
unregisterStreamHandler: () => unregisterStreamHandler,
|
|
593
|
+
updateCarrierCliType: () => updateCarrierCliType
|
|
594
|
+
});
|
|
595
|
+
|
|
559
596
|
// ../../node_modules/.pnpm/zod@4.4.1/node_modules/zod/v4/classic/external.js
|
|
560
597
|
var external_exports = {};
|
|
561
598
|
__export(external_exports, {
|
|
@@ -17941,7 +17978,7 @@ var AcpConnection = class extends BaseConnection {
|
|
|
17941
17978
|
}
|
|
17942
17979
|
/** Claude 계열 브릿지인지 여부를 단일 판별 지점으로 유지합니다. */
|
|
17943
17980
|
isClaudeBackend() {
|
|
17944
|
-
return this.cliType === "claude"
|
|
17981
|
+
return this.cliType === "claude";
|
|
17945
17982
|
}
|
|
17946
17983
|
/** Claude bridge만 native system prompt append를 지원하므로 이 경로만 사용합니다. */
|
|
17947
17984
|
getClaudeSystemPrompt(systemPrompt) {
|
|
@@ -18439,7 +18476,7 @@ function inferBinName(packageName) {
|
|
|
18439
18476
|
// ../../packages/core-unified-agent/models.json
|
|
18440
18477
|
var models_default = {
|
|
18441
18478
|
version: 1,
|
|
18442
|
-
updatedAt: "2026-
|
|
18479
|
+
updatedAt: "2026-07-04T00:00:00Z",
|
|
18443
18480
|
providers: {
|
|
18444
18481
|
claude: {
|
|
18445
18482
|
name: "Claude Code with Anthropic",
|
|
@@ -18454,48 +18491,6 @@ var models_default = {
|
|
|
18454
18491
|
{ modelId: "claude-opus-4-8[1m]", name: "Claude Opus 4.8 [1M]", effort: { supported: true, levels: ["low", "medium", "high", "xhigh", "max"], default: "high" } }
|
|
18455
18492
|
]
|
|
18456
18493
|
},
|
|
18457
|
-
"claude-zai": {
|
|
18458
|
-
name: "Claude Code with Z.AI GLM",
|
|
18459
|
-
defaultModel: "opus",
|
|
18460
|
-
models: [
|
|
18461
|
-
{ modelId: "haiku", name: "GLM-4.5 Air (Haiku slot)", effort: { supported: false } },
|
|
18462
|
-
{ modelId: "sonnet", name: "GLM-5 Turbo (Sonnet slot)", effort: { supported: false } },
|
|
18463
|
-
{ modelId: "opus", name: "GLM-5.1 (Opus slot)", effort: { supported: false } }
|
|
18464
|
-
],
|
|
18465
|
-
modelsMapping: {
|
|
18466
|
-
haiku: "glm-4.5-air",
|
|
18467
|
-
sonnet: "glm-5-turbo",
|
|
18468
|
-
opus: "glm-5.1"
|
|
18469
|
-
}
|
|
18470
|
-
},
|
|
18471
|
-
"claude-kimi": {
|
|
18472
|
-
name: "Claude Code with Moonshot Kimi",
|
|
18473
|
-
defaultModel: "opus",
|
|
18474
|
-
models: [
|
|
18475
|
-
{ modelId: "haiku", name: "Kimi K2.7 Code (Haiku slot)", effort: { supported: false } },
|
|
18476
|
-
{ modelId: "sonnet", name: "Kimi K2.7 Code (Sonnet slot)", effort: { supported: false } },
|
|
18477
|
-
{ modelId: "opus", name: "Kimi K2.7 Code (Opus slot)", effort: { supported: false } }
|
|
18478
|
-
],
|
|
18479
|
-
modelsMapping: {
|
|
18480
|
-
haiku: "kimi-k2.7-code",
|
|
18481
|
-
sonnet: "kimi-k2.7-code",
|
|
18482
|
-
opus: "kimi-k2.7-code"
|
|
18483
|
-
}
|
|
18484
|
-
},
|
|
18485
|
-
"claude-glm": {
|
|
18486
|
-
name: "Claude Code with ZhipuAI GLM",
|
|
18487
|
-
defaultModel: "opus",
|
|
18488
|
-
models: [
|
|
18489
|
-
{ modelId: "haiku", name: "GLM-4.5-Air (Haiku slot)", effort: { supported: false } },
|
|
18490
|
-
{ modelId: "sonnet", name: "GLM-4.7 (Sonnet slot)", effort: { supported: false } },
|
|
18491
|
-
{ modelId: "opus", name: "GLM-5.1 (Opus slot)", effort: { supported: false } }
|
|
18492
|
-
],
|
|
18493
|
-
modelsMapping: {
|
|
18494
|
-
haiku: "glm-4.5-air",
|
|
18495
|
-
sonnet: "glm-4.7",
|
|
18496
|
-
opus: "glm-5.1"
|
|
18497
|
-
}
|
|
18498
|
-
},
|
|
18499
18494
|
codex: {
|
|
18500
18495
|
name: "OpenAI Codex CLI",
|
|
18501
18496
|
defaultModel: "gpt-5.4",
|
|
@@ -18513,7 +18508,9 @@ var models_default = {
|
|
|
18513
18508
|
{ modelId: "opencode-go/deepseek-v4-pro", name: "DeepSeek V4 Pro", effort: { supported: false } },
|
|
18514
18509
|
{ modelId: "opencode-go/glm-5", name: "GLM-5", effort: { supported: false } },
|
|
18515
18510
|
{ modelId: "opencode-go/glm-5.1", name: "GLM-5.1", effort: { supported: false } },
|
|
18516
|
-
{ modelId: "opencode-go/
|
|
18511
|
+
{ modelId: "opencode-go/glm-5.2", name: "GLM-5.2", effort: { supported: false } },
|
|
18512
|
+
{ modelId: "opencode-go/kimi-k2.6", name: "Kimi K2.6 (3x limits)", effort: { supported: false } },
|
|
18513
|
+
{ modelId: "opencode-go/kimi-k2.7-code", name: "Kimi K2.7 Code", effort: { supported: false } }
|
|
18517
18514
|
]
|
|
18518
18515
|
},
|
|
18519
18516
|
cursor: {
|
|
@@ -18526,9 +18523,9 @@ var models_default = {
|
|
|
18526
18523
|
{ modelId: "gemini-3.1-pro", name: "Gemini 3.1 Pro", effort: { supported: false } },
|
|
18527
18524
|
{ modelId: "gemini-3-flash", name: "Gemini 3 Flash", effort: { supported: false } },
|
|
18528
18525
|
{ modelId: "gemini-3.5-flash", name: "Gemini 3.5 Flash", effort: { supported: false } },
|
|
18529
|
-
{ modelId: "
|
|
18530
|
-
{ modelId: "
|
|
18531
|
-
{ modelId: "claude-4
|
|
18526
|
+
{ modelId: "kimi-k2.7-code", name: "Kimi K2.7 Code", effort: { supported: false } },
|
|
18527
|
+
{ modelId: "glm-5.2", name: "GLM 5.2", spawnModelTemplate: "glm-5.2-{effort}", effort: { supported: true, levels: ["high", "max"], default: "max" } },
|
|
18528
|
+
{ modelId: "claude-opus-4-8-thinking", name: "Claude Opus 4.8 Thinking", spawnModelTemplate: "claude-opus-4-8-thinking-{effort}", effort: { supported: true, levels: ["low", "medium", "high", "xhigh", "max"], default: "xhigh" } }
|
|
18532
18529
|
]
|
|
18533
18530
|
}
|
|
18534
18531
|
}
|
|
@@ -18699,77 +18696,6 @@ var CLI_BACKENDS = {
|
|
|
18699
18696
|
usesNpxBridge: true,
|
|
18700
18697
|
defaultMaxTokens: 16384
|
|
18701
18698
|
},
|
|
18702
|
-
"claude-zai": {
|
|
18703
|
-
id: "claude-zai",
|
|
18704
|
-
cliCommand: "claude",
|
|
18705
|
-
protocol: "acp",
|
|
18706
|
-
authRequired: true,
|
|
18707
|
-
npxPackage: "@agentclientprotocol/claude-agent-acp@0.33.1",
|
|
18708
|
-
modes: [
|
|
18709
|
-
{ id: "default", label: "Default" },
|
|
18710
|
-
{ id: "plan", label: "Plan" },
|
|
18711
|
-
{ id: "bypassPermissions", label: "YOLO" }
|
|
18712
|
-
],
|
|
18713
|
-
supportsSessionClose: true,
|
|
18714
|
-
supportsSessionLoad: true,
|
|
18715
|
-
requiresModelAtSpawn: false,
|
|
18716
|
-
usesNpxBridge: true,
|
|
18717
|
-
defaultMaxTokens: 16384,
|
|
18718
|
-
defaultEnv: {
|
|
18719
|
-
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
|
18720
|
-
API_TIMEOUT_MS: "3000000"
|
|
18721
|
-
}
|
|
18722
|
-
},
|
|
18723
|
-
"claude-kimi": {
|
|
18724
|
-
id: "claude-kimi",
|
|
18725
|
-
cliCommand: "claude",
|
|
18726
|
-
protocol: "acp",
|
|
18727
|
-
authRequired: true,
|
|
18728
|
-
npxPackage: "@agentclientprotocol/claude-agent-acp@0.33.1",
|
|
18729
|
-
modes: [
|
|
18730
|
-
{ id: "default", label: "Default" },
|
|
18731
|
-
{ id: "plan", label: "Plan" },
|
|
18732
|
-
{ id: "bypassPermissions", label: "YOLO" }
|
|
18733
|
-
],
|
|
18734
|
-
supportsSessionClose: true,
|
|
18735
|
-
supportsSessionLoad: true,
|
|
18736
|
-
requiresModelAtSpawn: false,
|
|
18737
|
-
usesNpxBridge: true,
|
|
18738
|
-
defaultMaxTokens: 16384,
|
|
18739
|
-
defaultEnv: {
|
|
18740
|
-
ANTHROPIC_BASE_URL: "https://api.kimi.com/coding/",
|
|
18741
|
-
ENABLE_TOOL_SEARCH: "false",
|
|
18742
|
-
ANTHROPIC_MODEL: "kimi-k2.7-code",
|
|
18743
|
-
CLAUDE_CODE_SUBAGENT_MODEL: "kimi-k2.7-code",
|
|
18744
|
-
API_TIMEOUT_MS: "3000000"
|
|
18745
|
-
}
|
|
18746
|
-
},
|
|
18747
|
-
"claude-glm": {
|
|
18748
|
-
id: "claude-glm",
|
|
18749
|
-
cliCommand: "claude",
|
|
18750
|
-
protocol: "acp",
|
|
18751
|
-
authRequired: true,
|
|
18752
|
-
npxPackage: "@agentclientprotocol/claude-agent-acp@0.33.1",
|
|
18753
|
-
modes: [
|
|
18754
|
-
{ id: "default", label: "Default" },
|
|
18755
|
-
{ id: "plan", label: "Plan" },
|
|
18756
|
-
{ id: "bypassPermissions", label: "YOLO" }
|
|
18757
|
-
],
|
|
18758
|
-
supportsSessionClose: true,
|
|
18759
|
-
supportsSessionLoad: true,
|
|
18760
|
-
requiresModelAtSpawn: false,
|
|
18761
|
-
usesNpxBridge: true,
|
|
18762
|
-
defaultMaxTokens: 16384,
|
|
18763
|
-
defaultEnv: {
|
|
18764
|
-
ANTHROPIC_BASE_URL: "https://open.bigmodel.cn/api/anthropic",
|
|
18765
|
-
// ZhipuAI Claude Code 권장 슬롯 매핑 — 직접 launch(Native PTY) 경로에서도
|
|
18766
|
-
// haiku/sonnet/opus 별칭이 GLM 모델로 해석되도록 env로 고정한다.
|
|
18767
|
-
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.5-air",
|
|
18768
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.7",
|
|
18769
|
-
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-5.1",
|
|
18770
|
-
API_TIMEOUT_MS: "3000000"
|
|
18771
|
-
}
|
|
18772
|
-
},
|
|
18773
18699
|
codex: {
|
|
18774
18700
|
id: "codex",
|
|
18775
18701
|
cliCommand: "codex",
|
|
@@ -18864,9 +18790,6 @@ function getBackendConfig(cli) {
|
|
|
18864
18790
|
function getYoloModeId(cli) {
|
|
18865
18791
|
switch (cli) {
|
|
18866
18792
|
case "claude":
|
|
18867
|
-
case "claude-zai":
|
|
18868
|
-
case "claude-kimi":
|
|
18869
|
-
case "claude-glm":
|
|
18870
18793
|
return "bypassPermissions";
|
|
18871
18794
|
case "opencode-go":
|
|
18872
18795
|
return "build";
|
|
@@ -21768,9 +21691,6 @@ var UnifiedAgent = {
|
|
|
21768
21691
|
createClient(cli) {
|
|
21769
21692
|
switch (cli) {
|
|
21770
21693
|
case "claude":
|
|
21771
|
-
case "claude-zai":
|
|
21772
|
-
case "claude-kimi":
|
|
21773
|
-
case "claude-glm":
|
|
21774
21694
|
return new UnifiedClaudeAgentClient(cli);
|
|
21775
21695
|
case "codex":
|
|
21776
21696
|
return new UnifiedCodexAgentClient();
|
|
@@ -21790,7 +21710,7 @@ var UnifiedAgent = {
|
|
|
21790
21710
|
const preferred = await new CliDetector().getPreferred();
|
|
21791
21711
|
if (!preferred) {
|
|
21792
21712
|
throw new Error(
|
|
21793
|
-
"\uC0AC\uC6A9 \uAC00\uB2A5\uD55C CLI\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. claude,
|
|
21713
|
+
"\uC0AC\uC6A9 \uAC00\uB2A5\uD55C CLI\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. claude, codex, opencode-go, cursor \uC911 \uD558\uB098\uB97C \uC124\uCE58\uD574\uC8FC\uC138\uC694."
|
|
21794
21714
|
);
|
|
21795
21715
|
}
|
|
21796
21716
|
return this.createClient(preferred.cli);
|
|
@@ -21805,211 +21725,6 @@ var UnifiedAgent = {
|
|
|
21805
21725
|
}
|
|
21806
21726
|
};
|
|
21807
21727
|
|
|
21808
|
-
// ../../packages/fleet-infra/src/auth/messages.ts
|
|
21809
|
-
function formatMissingAuthKeyMessage(input) {
|
|
21810
|
-
const cliHint = input.cli ? `cli '${input.cli}'` : "selected CLI";
|
|
21811
|
-
return `Auth token not found for ${cliHint} (providerId: '${input.providerId}'). Run \`fleet auth login\` to register one.`;
|
|
21812
|
-
}
|
|
21813
|
-
function formatAuthValidationFailureMessage(input) {
|
|
21814
|
-
const detail = input.detail ? ` Detail: ${input.detail}` : "";
|
|
21815
|
-
if (input.status === "unauthorized") {
|
|
21816
|
-
return `Auth token was rejected (providerId: '${input.providerId}'). Check the token and try again.${detail}`;
|
|
21817
|
-
}
|
|
21818
|
-
if (input.status === "forbidden") {
|
|
21819
|
-
return `Auth token is not allowed for this provider (providerId: '${input.providerId}'). Check the token permissions.${detail}`;
|
|
21820
|
-
}
|
|
21821
|
-
if (input.status === "timeout") {
|
|
21822
|
-
return `Auth token validation timed out (providerId: '${input.providerId}'). Check the connection and try again.${detail}`;
|
|
21823
|
-
}
|
|
21824
|
-
if (input.status === "network") {
|
|
21825
|
-
return `Auth token validation failed due to a network error (providerId: '${input.providerId}'). Check the connection and try again.${detail}`;
|
|
21826
|
-
}
|
|
21827
|
-
if (input.status === "server") {
|
|
21828
|
-
return `Auth token validation failed because the provider returned an error (providerId: '${input.providerId}'). Try again later.${detail}`;
|
|
21829
|
-
}
|
|
21830
|
-
return `Auth token validation failed (providerId: '${input.providerId}'). Check the token and try again.${detail}`;
|
|
21831
|
-
}
|
|
21832
|
-
|
|
21833
|
-
// ../../packages/fleet-infra/src/auth/validation.ts
|
|
21834
|
-
var DEFAULT_AUTH_VALIDATION_TIMEOUT_MS = 5e3;
|
|
21835
|
-
async function validateAnthropicCompatibleApiKey(request) {
|
|
21836
|
-
const controller = new AbortController();
|
|
21837
|
-
const timeout = setTimeout(() => {
|
|
21838
|
-
controller.abort();
|
|
21839
|
-
}, request.timeoutMs ?? DEFAULT_AUTH_VALIDATION_TIMEOUT_MS);
|
|
21840
|
-
try {
|
|
21841
|
-
const response = await fetch(buildMessagesUrl(request.baseUrl), {
|
|
21842
|
-
method: "POST",
|
|
21843
|
-
headers: {
|
|
21844
|
-
"anthropic-version": "2023-06-01",
|
|
21845
|
-
"content-type": "application/json",
|
|
21846
|
-
"x-api-key": request.apiKey
|
|
21847
|
-
},
|
|
21848
|
-
body: JSON.stringify({
|
|
21849
|
-
model: "claude-3-5-haiku-20241022",
|
|
21850
|
-
max_tokens: 1,
|
|
21851
|
-
messages: [
|
|
21852
|
-
{
|
|
21853
|
-
role: "user",
|
|
21854
|
-
content: "ping"
|
|
21855
|
-
}
|
|
21856
|
-
]
|
|
21857
|
-
}),
|
|
21858
|
-
signal: controller.signal
|
|
21859
|
-
});
|
|
21860
|
-
if (response.ok) {
|
|
21861
|
-
return { providerId: request.providerId, status: "success" };
|
|
21862
|
-
}
|
|
21863
|
-
if (response.status === 401) {
|
|
21864
|
-
return { providerId: request.providerId, status: "unauthorized" };
|
|
21865
|
-
}
|
|
21866
|
-
if (response.status === 403) {
|
|
21867
|
-
return { providerId: request.providerId, status: "forbidden" };
|
|
21868
|
-
}
|
|
21869
|
-
if (response.status >= 500) {
|
|
21870
|
-
return {
|
|
21871
|
-
providerId: request.providerId,
|
|
21872
|
-
status: "server",
|
|
21873
|
-
detail: `HTTP ${response.status}`
|
|
21874
|
-
};
|
|
21875
|
-
}
|
|
21876
|
-
return {
|
|
21877
|
-
providerId: request.providerId,
|
|
21878
|
-
status: "unknown",
|
|
21879
|
-
detail: `HTTP ${response.status}`
|
|
21880
|
-
};
|
|
21881
|
-
} catch (error51) {
|
|
21882
|
-
if (isAbortError(error51)) {
|
|
21883
|
-
return { providerId: request.providerId, status: "timeout" };
|
|
21884
|
-
}
|
|
21885
|
-
return {
|
|
21886
|
-
providerId: request.providerId,
|
|
21887
|
-
status: "network",
|
|
21888
|
-
detail: error51 instanceof Error ? error51.message : String(error51)
|
|
21889
|
-
};
|
|
21890
|
-
} finally {
|
|
21891
|
-
clearTimeout(timeout);
|
|
21892
|
-
}
|
|
21893
|
-
}
|
|
21894
|
-
function isAuthValidationSuccess(result) {
|
|
21895
|
-
return result.status === "success";
|
|
21896
|
-
}
|
|
21897
|
-
function createAuthValidationError(result) {
|
|
21898
|
-
return new Error(formatAuthValidationFailureMessage(result));
|
|
21899
|
-
}
|
|
21900
|
-
function buildMessagesUrl(baseUrl) {
|
|
21901
|
-
return `${baseUrl.replace(/\/+$/, "")}/v1/messages`;
|
|
21902
|
-
}
|
|
21903
|
-
function isAbortError(error51) {
|
|
21904
|
-
return error51 instanceof DOMException && error51.name === "AbortError";
|
|
21905
|
-
}
|
|
21906
|
-
|
|
21907
|
-
// ../../packages/fleet-infra/src/auth/auth-providers.ts
|
|
21908
|
-
var CLI_TO_AUTH_PROVIDER_ID = {
|
|
21909
|
-
"claude-zai": "Claude Code with Z.AI GLM",
|
|
21910
|
-
"claude-kimi": "Claude Code with Moonshot Kimi",
|
|
21911
|
-
"claude-glm": "Claude Code with ZhipuAI GLM"
|
|
21912
|
-
};
|
|
21913
|
-
var CLAUDE_ZAI_PROVIDER_ID = "Claude Code with Z.AI GLM";
|
|
21914
|
-
var CLAUDE_KIMI_PROVIDER_ID = "Claude Code with Moonshot Kimi";
|
|
21915
|
-
var CLAUDE_GLM_PROVIDER_ID = "Claude Code with ZhipuAI GLM";
|
|
21916
|
-
var AUTH_PROVIDER_DEFINITIONS = {
|
|
21917
|
-
"claude-zai": {
|
|
21918
|
-
providerId: CLAUDE_ZAI_PROVIDER_ID,
|
|
21919
|
-
baseUrl: CLI_BACKENDS["claude-zai"].defaultEnv.ANTHROPIC_BASE_URL,
|
|
21920
|
-
env: CLI_BACKENDS["claude-zai"].defaultEnv
|
|
21921
|
-
},
|
|
21922
|
-
"claude-kimi": {
|
|
21923
|
-
providerId: CLAUDE_KIMI_PROVIDER_ID,
|
|
21924
|
-
baseUrl: CLI_BACKENDS["claude-kimi"].defaultEnv.ANTHROPIC_BASE_URL,
|
|
21925
|
-
env: CLI_BACKENDS["claude-kimi"].defaultEnv
|
|
21926
|
-
},
|
|
21927
|
-
"claude-glm": {
|
|
21928
|
-
providerId: CLAUDE_GLM_PROVIDER_ID,
|
|
21929
|
-
baseUrl: CLI_BACKENDS["claude-glm"].defaultEnv.ANTHROPIC_BASE_URL,
|
|
21930
|
-
env: CLI_BACKENDS["claude-glm"].defaultEnv
|
|
21931
|
-
}
|
|
21932
|
-
};
|
|
21933
|
-
async function resolveAuthEnv(cli, deps) {
|
|
21934
|
-
const provider = AUTH_PROVIDER_DEFINITIONS[cli];
|
|
21935
|
-
if (!provider) return {};
|
|
21936
|
-
const auth = deps?.authService ?? createAuthService({ authPath: DEFAULT_AUTH_PATH });
|
|
21937
|
-
const token = await auth.getApiKey(provider.providerId);
|
|
21938
|
-
if (!token) {
|
|
21939
|
-
throw new Error(formatMissingAuthKeyMessage({ cli, providerId: provider.providerId }));
|
|
21940
|
-
}
|
|
21941
|
-
const validation = await validateAnthropicCompatibleApiKey({
|
|
21942
|
-
providerId: provider.providerId,
|
|
21943
|
-
apiKey: token,
|
|
21944
|
-
baseUrl: provider.baseUrl
|
|
21945
|
-
});
|
|
21946
|
-
if (!isAuthValidationSuccess(validation)) {
|
|
21947
|
-
const failure = {
|
|
21948
|
-
providerId: validation.providerId,
|
|
21949
|
-
status: validation.status,
|
|
21950
|
-
detail: validation.detail
|
|
21951
|
-
};
|
|
21952
|
-
throw createAuthValidationError(failure);
|
|
21953
|
-
}
|
|
21954
|
-
return { ...provider.env, ANTHROPIC_AUTH_TOKEN: token };
|
|
21955
|
-
}
|
|
21956
|
-
async function validateAuthKeyForCli(cli, apiKey) {
|
|
21957
|
-
const provider = AUTH_PROVIDER_DEFINITIONS[cli];
|
|
21958
|
-
if (!provider) {
|
|
21959
|
-
return { providerId: cli, status: "success" };
|
|
21960
|
-
}
|
|
21961
|
-
const validation = await validateAnthropicCompatibleApiKey({
|
|
21962
|
-
providerId: provider.providerId,
|
|
21963
|
-
apiKey,
|
|
21964
|
-
baseUrl: provider.baseUrl
|
|
21965
|
-
});
|
|
21966
|
-
if (isAuthValidationSuccess(validation)) {
|
|
21967
|
-
return { providerId: validation.providerId, status: "success" };
|
|
21968
|
-
}
|
|
21969
|
-
return {
|
|
21970
|
-
providerId: validation.providerId,
|
|
21971
|
-
status: validation.status,
|
|
21972
|
-
detail: validation.detail
|
|
21973
|
-
};
|
|
21974
|
-
}
|
|
21975
|
-
|
|
21976
|
-
// ../../packages/fleet-infra/src/index.ts
|
|
21977
|
-
function createInfraServices(deps = {}) {
|
|
21978
|
-
const globalOptionsService = createGlobalOptionsService();
|
|
21979
|
-
const authService = createAuthService({ authPath: deps.authPath ?? DEFAULT_AUTH_PATH });
|
|
21980
|
-
return {
|
|
21981
|
-
authService,
|
|
21982
|
-
globalOptionsService
|
|
21983
|
-
};
|
|
21984
|
-
}
|
|
21985
|
-
|
|
21986
|
-
// ../../packages/fleet-carriers/src/dispatch/framework.ts
|
|
21987
|
-
var framework_exports = {};
|
|
21988
|
-
__export(framework_exports, {
|
|
21989
|
-
CarrierRegistry: () => CarrierRegistry,
|
|
21990
|
-
clearRegisteredCarriers: () => clearRegisteredCarriers,
|
|
21991
|
-
createCarrierRegistry: () => createCarrierRegistry,
|
|
21992
|
-
emitStreamEvent: () => emitStreamEvent,
|
|
21993
|
-
getAllCliTypes: () => getAllCliTypes,
|
|
21994
|
-
getCarrierConfig: () => getCarrierConfig,
|
|
21995
|
-
getCarrierSourceDisplayName: () => getCarrierSourceDisplayName,
|
|
21996
|
-
getRegisteredCarrierConfig: () => getRegisteredCarrierConfig,
|
|
21997
|
-
getRegisteredOrder: () => getRegisteredOrder,
|
|
21998
|
-
normalizeEffort: () => normalizeEffort,
|
|
21999
|
-
notifyStatusUpdate: () => notifyStatusUpdate,
|
|
22000
|
-
registerCarrier: () => registerCarrier,
|
|
22001
|
-
registerStreamHandler: () => registerStreamHandler,
|
|
22002
|
-
resetCarrierRegistryForTests: () => resetCarrierRegistryForTests,
|
|
22003
|
-
resolveAgentCliType: () => resolveAgentCliType2,
|
|
22004
|
-
resolveCarrierDisplayName: () => resolveCarrierDisplayName,
|
|
22005
|
-
resolveValidatedEffort: () => resolveValidatedEffort,
|
|
22006
|
-
setTaskForceConfiguredCarriers: () => setTaskForceConfiguredCarriers,
|
|
22007
|
-
toCarrierJobStatus: () => toCarrierJobStatus,
|
|
22008
|
-
toTrackFinalStatus: () => toTrackFinalStatus,
|
|
22009
|
-
unregisterStreamHandler: () => unregisterStreamHandler,
|
|
22010
|
-
updateCarrierCliType: () => updateCarrierCliType
|
|
22011
|
-
});
|
|
22012
|
-
|
|
22013
21728
|
// ../../packages/fleet-carriers/src/constants.ts
|
|
22014
21729
|
var CLI_PROVIDER_DISPLAY_NAMES = Object.fromEntries(
|
|
22015
21730
|
Object.keys(CLI_BACKENDS).map((cliType) => [
|
|
@@ -22034,21 +21749,17 @@ var store_exports = {};
|
|
|
22034
21749
|
__export(store_exports, {
|
|
22035
21750
|
applyAgentCliTypeSelectionUpdate: () => applyAgentCliTypeSelectionUpdate,
|
|
22036
21751
|
buildHealedCarriers: () => buildHealedCarriers,
|
|
22037
|
-
filterCarrierAgentModesToRegisteredIds: () => filterCarrierAgentModesToRegisteredIds,
|
|
22038
21752
|
getAgentCliSelection: () => getAgentCliSelection,
|
|
22039
21753
|
getCarriersFilePath: () => getCarriersFilePath,
|
|
22040
21754
|
getConfiguredTaskForceBackends: () => getConfiguredTaskForceBackends,
|
|
22041
21755
|
getConfiguredTaskForceBackendsFromSnapshot: () => getConfiguredTaskForceBackendsFromSnapshot,
|
|
22042
21756
|
getConfiguredTaskForceCarrierIds: () => getConfiguredTaskForceCarrierIds,
|
|
22043
21757
|
getConfiguredTaskForceCarrierIdsFromSnapshot: () => getConfiguredTaskForceCarrierIdsFromSnapshot,
|
|
22044
|
-
getEnabledCarrierSubagentIds: () => getEnabledCarrierSubagentIds,
|
|
22045
21758
|
getTaskForceModelConfig: () => getTaskForceModelConfig,
|
|
22046
21759
|
initStore: () => initStore,
|
|
22047
|
-
isCarrierAgentModeSubagent: () => isCarrierAgentModeSubagent,
|
|
22048
21760
|
loadCarrierDisplayNameOverrides: () => loadCarrierDisplayNameOverrides,
|
|
22049
21761
|
loadCarrierStates: () => loadCarrierStates,
|
|
22050
21762
|
normalizeCarrierDisplayNameInput: () => normalizeCarrierDisplayNameInput,
|
|
22051
|
-
readCarrierAgentModeSnapshot: () => readCarrierAgentModeSnapshot,
|
|
22052
21763
|
readCarriersSnapshot: () => readCarriersSnapshot,
|
|
22053
21764
|
readFileBackedCarriersSnapshot: () => readFileBackedCarriersSnapshot,
|
|
22054
21765
|
readRawCarriers: () => readRawCarriers,
|
|
@@ -22060,7 +21771,6 @@ __export(store_exports, {
|
|
|
22060
21771
|
resolveCarrierState: () => resolveCarrierState,
|
|
22061
21772
|
sanitizeCarrierDisplayName: () => sanitizeCarrierDisplayName,
|
|
22062
21773
|
saveAgentCliSelection: () => saveAgentCliSelection,
|
|
22063
|
-
setCarrierAgentMode: () => setCarrierAgentMode,
|
|
22064
21774
|
store: () => store,
|
|
22065
21775
|
updateAgentCliSelection: () => updateAgentCliSelection,
|
|
22066
21776
|
updateAgentCliTypeOverride: () => updateAgentCliTypeOverride,
|
|
@@ -22101,9 +21811,6 @@ function sanitizeFreeformText(value) {
|
|
|
22101
21811
|
function isRecord2(value) {
|
|
22102
21812
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22103
21813
|
}
|
|
22104
|
-
function sanitizeAgentMode(value) {
|
|
22105
|
-
return value === "cli" || value === "subagent" ? value : void 0;
|
|
22106
|
-
}
|
|
22107
21814
|
function sanitizeAgentCliType(value) {
|
|
22108
21815
|
return typeof value === "string" && value in CLI_BACKENDS ? value : void 0;
|
|
22109
21816
|
}
|
|
@@ -22153,13 +21860,11 @@ function sanitizeTaskforce(value) {
|
|
|
22153
21860
|
}
|
|
22154
21861
|
function sanitizeCarrierState(value) {
|
|
22155
21862
|
if (!isRecord2(value)) return void 0;
|
|
22156
|
-
const agentMode = sanitizeAgentMode(value.agentMode);
|
|
22157
21863
|
const agentCliType = sanitizeAgentCliType(value.agentCliType);
|
|
22158
21864
|
const agentCli = sanitizeAgentCli(value.agentCli);
|
|
22159
21865
|
const taskforce = sanitizeTaskforce(value.taskforce);
|
|
22160
21866
|
const displayName = sanitizeFreeformText(value.displayName);
|
|
22161
21867
|
const result = {};
|
|
22162
|
-
if (agentMode) result.agentMode = agentMode;
|
|
22163
21868
|
if (agentCliType) result.agentCliType = agentCliType;
|
|
22164
21869
|
if (Object.keys(agentCli).length > 0) result.agentCli = agentCli;
|
|
22165
21870
|
if (Object.keys(taskforce).length > 0) result.taskforce = taskforce;
|
|
@@ -24229,7 +23934,6 @@ function resolveCarriersRecord(raw, defaultsByCarrier, resolve2) {
|
|
|
24229
23934
|
function buildResolvedCarrierState(state, defaults, agentCliType, taskforce) {
|
|
24230
23935
|
const agentCli = sanitizeAgentCli(state.agentCli);
|
|
24231
23936
|
return {
|
|
24232
|
-
agentMode: state.agentMode ?? defaults?.defaultAgentMode ?? "cli",
|
|
24233
23937
|
agentCliType,
|
|
24234
23938
|
agentCli: {
|
|
24235
23939
|
...agentCli,
|
|
@@ -24255,57 +23959,6 @@ function resolveSelectionForCliType(stored, cliType, defaults) {
|
|
|
24255
23959
|
return { model, effort };
|
|
24256
23960
|
}
|
|
24257
23961
|
|
|
24258
|
-
// ../../packages/fleet-carriers/src/store/subagent-mode.ts
|
|
24259
|
-
var subagent_mode_exports = {};
|
|
24260
|
-
__export(subagent_mode_exports, {
|
|
24261
|
-
filterCarrierAgentModesToRegisteredIds: () => filterCarrierAgentModesToRegisteredIds,
|
|
24262
|
-
getEnabledCarrierSubagentIds: () => getEnabledCarrierSubagentIds,
|
|
24263
|
-
isCarrierAgentModeSubagent: () => isCarrierAgentModeSubagent,
|
|
24264
|
-
readCarrierAgentModeSnapshot: () => readCarrierAgentModeSnapshot,
|
|
24265
|
-
setCarrierAgentMode: () => setCarrierAgentMode
|
|
24266
|
-
});
|
|
24267
|
-
function readCarrierAgentModeSnapshot(defaultsByCarrier = {}) {
|
|
24268
|
-
const raw = readRawCarriers();
|
|
24269
|
-
const carriers = buildHealedCarriers(defaultsByCarrier);
|
|
24270
|
-
return {
|
|
24271
|
-
agentModes: Object.fromEntries(
|
|
24272
|
-
Object.entries(carriers).filter(([, state]) => state.agentMode === "subagent").map(([id]) => [id, "subagent"])
|
|
24273
|
-
),
|
|
24274
|
-
generation: raw._meta?.generation ?? 0
|
|
24275
|
-
};
|
|
24276
|
-
}
|
|
24277
|
-
function isCarrierAgentModeSubagent(carrierId, defaultAgentMode = "cli") {
|
|
24278
|
-
const rawMode = readRawCarriers().carriers?.[carrierId]?.agentMode;
|
|
24279
|
-
return (rawMode ?? defaultAgentMode) === "subagent";
|
|
24280
|
-
}
|
|
24281
|
-
function setCarrierAgentMode(carrierId, enabled, defaultAgentMode = "cli") {
|
|
24282
|
-
const sanitizedCarrierId = sanitizeConfigKey(carrierId);
|
|
24283
|
-
if (!sanitizedCarrierId) return;
|
|
24284
|
-
const nextAgentMode = enabled ? "subagent" : "cli";
|
|
24285
|
-
updateCarriers((states) => {
|
|
24286
|
-
const carriers = { ...states.carriers ?? {} };
|
|
24287
|
-
const current = carriers[sanitizedCarrierId] ?? {};
|
|
24288
|
-
const next = { ...current };
|
|
24289
|
-
if (nextAgentMode === defaultAgentMode) delete next.agentMode;
|
|
24290
|
-
else next.agentMode = nextAgentMode;
|
|
24291
|
-
carriers[sanitizedCarrierId] = next;
|
|
24292
|
-
states.carriers = carriers;
|
|
24293
|
-
});
|
|
24294
|
-
}
|
|
24295
|
-
function filterCarrierAgentModesToRegisteredIds(snapshot, registeredCarrierIds) {
|
|
24296
|
-
const allowed = new Set(registeredCarrierIds);
|
|
24297
|
-
return {
|
|
24298
|
-
agentModes: Object.fromEntries(
|
|
24299
|
-
Object.entries(snapshot.agentModes).filter(([carrierId]) => allowed.has(carrierId))
|
|
24300
|
-
),
|
|
24301
|
-
generation: snapshot.generation
|
|
24302
|
-
};
|
|
24303
|
-
}
|
|
24304
|
-
function getEnabledCarrierSubagentIds(snapshot, registeredCarrierIds) {
|
|
24305
|
-
const filtered = registeredCarrierIds ? filterCarrierAgentModesToRegisteredIds(snapshot, registeredCarrierIds) : snapshot;
|
|
24306
|
-
return Object.keys(filtered.agentModes).sort();
|
|
24307
|
-
}
|
|
24308
|
-
|
|
24309
23962
|
// ../../packages/fleet-carriers/src/store/taskforce-config.ts
|
|
24310
23963
|
var taskforce_config_exports = {};
|
|
24311
23964
|
__export(taskforce_config_exports, {
|
|
@@ -24430,13 +24083,11 @@ function isTaskForceCliType(value) {
|
|
|
24430
24083
|
// ../../packages/fleet-carriers/src/store/index.ts
|
|
24431
24084
|
var store = {
|
|
24432
24085
|
...state_io_exports,
|
|
24433
|
-
...subagent_mode_exports,
|
|
24434
24086
|
...models_exports,
|
|
24435
24087
|
...taskforce_config_exports,
|
|
24436
24088
|
...cli_types_exports,
|
|
24437
24089
|
...display_names_exports,
|
|
24438
24090
|
stateIo: state_io_exports,
|
|
24439
|
-
subagentMode: subagent_mode_exports,
|
|
24440
24091
|
models: models_exports,
|
|
24441
24092
|
taskforceConfig: taskforce_config_exports,
|
|
24442
24093
|
cliTypes: cli_types_exports,
|
|
@@ -24487,7 +24138,6 @@ function registerCarrier(registry3, config2) {
|
|
|
24487
24138
|
existing.defaultModel = config2.defaultModel;
|
|
24488
24139
|
existing.defaultEffort = config2.defaultEffort;
|
|
24489
24140
|
existing.carrierMetadata = config2.carrierMetadata;
|
|
24490
|
-
existing.subagent = config2.subagent;
|
|
24491
24141
|
} else {
|
|
24492
24142
|
gs.modes.set(config2.id, { config: config2 });
|
|
24493
24143
|
}
|
|
@@ -24631,14 +24281,8 @@ var CHRONICLE_DEFAULTS = {
|
|
|
24631
24281
|
agent: {
|
|
24632
24282
|
dispatch: {
|
|
24633
24283
|
defaultCliType: "claude",
|
|
24634
|
-
defaultAgentMode: "subagent",
|
|
24635
24284
|
defaultModel: "sonnet",
|
|
24636
24285
|
defaultEffort: "low"
|
|
24637
|
-
},
|
|
24638
|
-
nativeSubagents: {
|
|
24639
|
-
byHost: {
|
|
24640
|
-
claude: { defaultModel: "sonnet", defaultEffort: "low" }
|
|
24641
|
-
}
|
|
24642
24286
|
}
|
|
24643
24287
|
}
|
|
24644
24288
|
};
|
|
@@ -24731,14 +24375,8 @@ var GENESIS_DEFAULTS = {
|
|
|
24731
24375
|
agent: {
|
|
24732
24376
|
dispatch: {
|
|
24733
24377
|
defaultCliType: "claude",
|
|
24734
|
-
defaultAgentMode: "subagent",
|
|
24735
24378
|
defaultModel: "sonnet",
|
|
24736
24379
|
defaultEffort: "medium"
|
|
24737
|
-
},
|
|
24738
|
-
nativeSubagents: {
|
|
24739
|
-
byHost: {
|
|
24740
|
-
claude: { defaultModel: "sonnet", defaultEffort: "medium" }
|
|
24741
|
-
}
|
|
24742
24380
|
}
|
|
24743
24381
|
}
|
|
24744
24382
|
};
|
|
@@ -24806,14 +24444,8 @@ var KIROV_DEFAULTS = {
|
|
|
24806
24444
|
agent: {
|
|
24807
24445
|
dispatch: {
|
|
24808
24446
|
defaultCliType: "claude",
|
|
24809
|
-
defaultAgentMode: "subagent",
|
|
24810
24447
|
defaultModel: "opus[1m]",
|
|
24811
24448
|
defaultEffort: "xhigh"
|
|
24812
|
-
},
|
|
24813
|
-
nativeSubagents: {
|
|
24814
|
-
byHost: {
|
|
24815
|
-
claude: { defaultModel: "opus[1m]", defaultEffort: "xhigh" }
|
|
24816
|
-
}
|
|
24817
24449
|
}
|
|
24818
24450
|
}
|
|
24819
24451
|
};
|
|
@@ -24876,14 +24508,8 @@ var NIMITZ_DEFAULTS = {
|
|
|
24876
24508
|
agent: {
|
|
24877
24509
|
dispatch: {
|
|
24878
24510
|
defaultCliType: "claude",
|
|
24879
|
-
defaultAgentMode: "subagent",
|
|
24880
24511
|
defaultModel: "opus[1m]",
|
|
24881
24512
|
defaultEffort: "max"
|
|
24882
|
-
},
|
|
24883
|
-
nativeSubagents: {
|
|
24884
|
-
byHost: {
|
|
24885
|
-
claude: { defaultModel: "opus[1m]", defaultEffort: "xhigh" }
|
|
24886
|
-
}
|
|
24887
24513
|
}
|
|
24888
24514
|
}
|
|
24889
24515
|
};
|
|
@@ -24947,14 +24573,8 @@ var OHIO_DEFAULTS = {
|
|
|
24947
24573
|
agent: {
|
|
24948
24574
|
dispatch: {
|
|
24949
24575
|
defaultCliType: "claude",
|
|
24950
|
-
defaultAgentMode: "subagent",
|
|
24951
24576
|
defaultModel: "sonnet",
|
|
24952
24577
|
defaultEffort: "low"
|
|
24953
|
-
},
|
|
24954
|
-
nativeSubagents: {
|
|
24955
|
-
byHost: {
|
|
24956
|
-
claude: { defaultModel: "sonnet", defaultEffort: "low" }
|
|
24957
|
-
}
|
|
24958
24578
|
}
|
|
24959
24579
|
}
|
|
24960
24580
|
};
|
|
@@ -25019,14 +24639,8 @@ var SENTINEL_DEFAULTS = {
|
|
|
25019
24639
|
agent: {
|
|
25020
24640
|
dispatch: {
|
|
25021
24641
|
defaultCliType: "claude",
|
|
25022
|
-
defaultAgentMode: "subagent",
|
|
25023
24642
|
defaultModel: "sonnet",
|
|
25024
24643
|
defaultEffort: "max"
|
|
25025
|
-
},
|
|
25026
|
-
nativeSubagents: {
|
|
25027
|
-
byHost: {
|
|
25028
|
-
claude: { defaultModel: "sonnet", defaultEffort: "xhigh" }
|
|
25029
|
-
}
|
|
25030
24644
|
}
|
|
25031
24645
|
}
|
|
25032
24646
|
};
|
|
@@ -25082,14 +24696,8 @@ var TEMPEST_DEFAULTS = {
|
|
|
25082
24696
|
agent: {
|
|
25083
24697
|
dispatch: {
|
|
25084
24698
|
defaultCliType: "claude",
|
|
25085
|
-
defaultAgentMode: "subagent",
|
|
25086
24699
|
defaultModel: "sonnet",
|
|
25087
24700
|
defaultEffort: "medium"
|
|
25088
|
-
},
|
|
25089
|
-
nativeSubagents: {
|
|
25090
|
-
byHost: {
|
|
25091
|
-
claude: { defaultModel: "sonnet", defaultEffort: "medium" }
|
|
25092
|
-
}
|
|
25093
24701
|
}
|
|
25094
24702
|
}
|
|
25095
24703
|
};
|
|
@@ -25144,14 +24752,8 @@ var VANGUARD_DEFAULTS = {
|
|
|
25144
24752
|
agent: {
|
|
25145
24753
|
dispatch: {
|
|
25146
24754
|
defaultCliType: "claude",
|
|
25147
|
-
defaultAgentMode: "subagent",
|
|
25148
24755
|
defaultModel: "haiku",
|
|
25149
24756
|
defaultEffort: "low"
|
|
25150
|
-
},
|
|
25151
|
-
nativeSubagents: {
|
|
25152
|
-
byHost: {
|
|
25153
|
-
claude: { defaultModel: "haiku", defaultEffort: "low" }
|
|
25154
|
-
}
|
|
25155
24757
|
}
|
|
25156
24758
|
}
|
|
25157
24759
|
};
|
|
@@ -25216,24 +24818,14 @@ function registerDefaultCarriers(registry3) {
|
|
|
25216
24818
|
}
|
|
25217
24819
|
function buildDefaultCarrierConfig(registration) {
|
|
25218
24820
|
const { defaults, metadata } = registration;
|
|
25219
|
-
const claudeSubagentDefaults = defaults.agent.nativeSubagents?.byHost?.claude;
|
|
25220
24821
|
return {
|
|
25221
24822
|
id: defaults.id,
|
|
25222
24823
|
defaultCliType: defaults.agent.dispatch.defaultCliType,
|
|
25223
|
-
defaultAgentMode: defaults.agent.dispatch.defaultAgentMode,
|
|
25224
24824
|
defaultEffort: defaults.agent.dispatch.defaultEffort,
|
|
25225
24825
|
defaultModel: defaults.agent.dispatch.defaultModel,
|
|
25226
24826
|
slot: defaults.slot,
|
|
25227
24827
|
displayName: defaults.displayName,
|
|
25228
|
-
carrierMetadata: metadata
|
|
25229
|
-
subagent: {
|
|
25230
|
-
provider: "claude",
|
|
25231
|
-
defaultModel: claudeSubagentDefaults?.defaultModel,
|
|
25232
|
-
defaultEffort: claudeSubagentDefaults?.defaultEffort,
|
|
25233
|
-
byHost: {
|
|
25234
|
-
claude: claudeSubagentDefaults
|
|
25235
|
-
}
|
|
25236
|
-
}
|
|
24828
|
+
carrierMetadata: metadata
|
|
25237
24829
|
};
|
|
25238
24830
|
}
|
|
25239
24831
|
|
|
@@ -25366,7 +24958,7 @@ var StatusOverlayController = class {
|
|
|
25366
24958
|
function buildCarrierModelDefaults(config2, cliType) {
|
|
25367
24959
|
if (!config2) return {};
|
|
25368
24960
|
if (cliType === "claude") {
|
|
25369
|
-
return
|
|
24961
|
+
return {
|
|
25370
24962
|
...config2.defaultModel ? { defaultModel: config2.defaultModel } : {},
|
|
25371
24963
|
...config2.defaultEffort ? { defaultEffort: config2.defaultEffort } : {}
|
|
25372
24964
|
};
|
|
@@ -30501,6 +30093,79 @@ function getGuardState() {
|
|
|
30501
30093
|
return guardState;
|
|
30502
30094
|
}
|
|
30503
30095
|
|
|
30096
|
+
// ../../packages/fleet-carriers/src/jobs/report-extract.ts
|
|
30097
|
+
var REPORT_OPEN = "<report>";
|
|
30098
|
+
var REPORT_CLOSE = "</report>";
|
|
30099
|
+
function extractFinalReport(text) {
|
|
30100
|
+
let openIdx = text.lastIndexOf(REPORT_OPEN);
|
|
30101
|
+
while (openIdx !== -1) {
|
|
30102
|
+
const bodyStart = openIdx + REPORT_OPEN.length;
|
|
30103
|
+
const closeIdx = text.indexOf(REPORT_CLOSE, bodyStart);
|
|
30104
|
+
if (closeIdx !== -1) {
|
|
30105
|
+
const body = text.slice(bodyStart, closeIdx).trim();
|
|
30106
|
+
if (body) return body;
|
|
30107
|
+
}
|
|
30108
|
+
openIdx = openIdx === 0 ? -1 : text.lastIndexOf(REPORT_OPEN, openIdx - 1);
|
|
30109
|
+
}
|
|
30110
|
+
return null;
|
|
30111
|
+
}
|
|
30112
|
+
|
|
30113
|
+
// ../../packages/fleet-carriers/src/jobs/workspace-manifest.ts
|
|
30114
|
+
var WORKSPACE_CHANGE_LIMIT = 200;
|
|
30115
|
+
var WORKSPACE_CHANGE_CLEARED_STATUS = "cleared";
|
|
30116
|
+
async function captureWorkspaceSnapshot(scanner, cwd) {
|
|
30117
|
+
if (!scanner) return null;
|
|
30118
|
+
try {
|
|
30119
|
+
return await scanner.snapshot(cwd);
|
|
30120
|
+
} catch {
|
|
30121
|
+
return null;
|
|
30122
|
+
}
|
|
30123
|
+
}
|
|
30124
|
+
async function captureJobWindowManifest(scanner, cwd, baseline) {
|
|
30125
|
+
if (!scanner) return void 0;
|
|
30126
|
+
const end = await captureWorkspaceSnapshot(scanner, cwd);
|
|
30127
|
+
return buildWorkspaceManifest(baseline, end);
|
|
30128
|
+
}
|
|
30129
|
+
function buildWorkspaceManifest(baseline, end) {
|
|
30130
|
+
if (!baseline || !end) return void 0;
|
|
30131
|
+
const baselineByPath = new Map(baseline.map((entry) => [entry.path, normalizeSnapshotEntry(entry)]));
|
|
30132
|
+
const endChanges = end.map(normalizeSnapshotEntry).filter((entry) => hasWindowChange(baselineByPath.get(entry.path), entry)).map(toManifestEntry);
|
|
30133
|
+
const endPaths = new Set(end.map((entry) => entry.path));
|
|
30134
|
+
const clearedChanges = [...baselineByPath.values()].filter((entry) => !endPaths.has(entry.path)).map((entry) => ({ status: WORKSPACE_CHANGE_CLEARED_STATUS, path: entry.path }));
|
|
30135
|
+
const changes = [...endChanges, ...clearedChanges];
|
|
30136
|
+
const truncated = changes.length > WORKSPACE_CHANGE_LIMIT;
|
|
30137
|
+
const capped = changes.slice(0, WORKSPACE_CHANGE_LIMIT);
|
|
30138
|
+
return {
|
|
30139
|
+
changes: capped,
|
|
30140
|
+
truncated
|
|
30141
|
+
};
|
|
30142
|
+
}
|
|
30143
|
+
function buildStatLine(changeCount, truncated) {
|
|
30144
|
+
const suffix = changeCount === 1 ? "file" : "files";
|
|
30145
|
+
return `${truncated ? `${WORKSPACE_CHANGE_LIMIT}+` : String(changeCount)} ${suffix} (window-approx)`;
|
|
30146
|
+
}
|
|
30147
|
+
function normalizeSnapshotEntry(entry) {
|
|
30148
|
+
return {
|
|
30149
|
+
status: entry.status.trim(),
|
|
30150
|
+
path: entry.path,
|
|
30151
|
+
contentHash: entry.contentHash?.trim()
|
|
30152
|
+
};
|
|
30153
|
+
}
|
|
30154
|
+
function toManifestEntry(entry) {
|
|
30155
|
+
return {
|
|
30156
|
+
status: entry.status,
|
|
30157
|
+
path: entry.path
|
|
30158
|
+
};
|
|
30159
|
+
}
|
|
30160
|
+
function hasWindowChange(baseline, end) {
|
|
30161
|
+
if (!baseline) return true;
|
|
30162
|
+
if (baseline.status !== end.status) return true;
|
|
30163
|
+
if (baseline.contentHash && end.contentHash) {
|
|
30164
|
+
return baseline.contentHash !== end.contentHash;
|
|
30165
|
+
}
|
|
30166
|
+
return false;
|
|
30167
|
+
}
|
|
30168
|
+
|
|
30504
30169
|
// ../../packages/fleet-carriers/src/jobs/dispatch.ts
|
|
30505
30170
|
var CARRIER_RESULT_PUSH_PREFIX = "[carrier:result]";
|
|
30506
30171
|
var CARRIER_JOBS_DOCTRINE = {
|
|
@@ -30533,11 +30198,12 @@ var REMINDER_WHITESPACE = /\s+/g;
|
|
|
30533
30198
|
var ACTIVE_STATUS_NOTICE = "Job is still running. The [carrier:result] push will be delivered automatically when it finishes \u2014 do not call carrier_jobs again until that push arrives. Stop calling tools now and return control to the user; the push wakes the agent even after this response ends.";
|
|
30534
30199
|
var ACTIVE_CANCEL_NOTICE = "Cancel did not apply: the job is still running normally, not hung. Long-running carrier jobs are expected \u2014 do not retry cancel without an explicit user request to abort. The [carrier:result] push will arrive automatically; stop calling tools and return control to the user.";
|
|
30535
30200
|
function buildCarrierResultSystemReminder(input) {
|
|
30201
|
+
const changes = input.summary.workspaceChanges ? buildStatLine(input.summary.workspaceChanges.changes.length, input.summary.workspaceChanges.truncated) : "unavailable";
|
|
30536
30202
|
const lines = [`- ${input.jobId}: ${sanitizeReminderText(input.summary.summary)}`];
|
|
30537
30203
|
const metadata = [
|
|
30538
30204
|
`kind=${input.kind}`,
|
|
30539
30205
|
`status=${input.status}`,
|
|
30540
|
-
`changes=${sanitizeReminderText(
|
|
30206
|
+
`changes=${sanitizeReminderText(changes)}`,
|
|
30541
30207
|
input.label ? `label=${sanitizeReminderText(input.label)}` : void 0,
|
|
30542
30208
|
input.taskforceBackend ? `backend=${sanitizeReminderText(input.taskforceBackend)}` : void 0,
|
|
30543
30209
|
input.error ? `error=${sanitizeReminderText(input.error)}` : void 0
|
|
@@ -30564,8 +30230,8 @@ function buildCarrierJobsSchema() {
|
|
|
30564
30230
|
})),
|
|
30565
30231
|
format: typebox_exports.Optional(typebox_exports.Unsafe({
|
|
30566
30232
|
type: "string",
|
|
30567
|
-
enum: ["summary", "full"],
|
|
30568
|
-
description:
|
|
30233
|
+
enum: ["summary", "full", "raw"],
|
|
30234
|
+
description: `Optional result detail level. "full" returns the final report (extracted deterministically from the carrier's <report> block; falls back to the raw archive when absent). "summary" returns metadata only. "raw" returns the unprocessed full archive (debugging/audit). Defaults to "full" when omitted.`
|
|
30569
30235
|
}))
|
|
30570
30236
|
});
|
|
30571
30237
|
}
|
|
@@ -30586,7 +30252,6 @@ function buildCarrierJobsToolSpec() {
|
|
|
30586
30252
|
function dispatchCarrierJobsAction(params, now = Date.now()) {
|
|
30587
30253
|
if (params.action === "list") {
|
|
30588
30254
|
return {
|
|
30589
|
-
action: "list",
|
|
30590
30255
|
ok: true,
|
|
30591
30256
|
active: listActiveJobs(),
|
|
30592
30257
|
recent: listJobSummaries(now)
|
|
@@ -30595,7 +30260,6 @@ function dispatchCarrierJobsAction(params, now = Date.now()) {
|
|
|
30595
30260
|
const jobIdError = validateJobId(params.job_id);
|
|
30596
30261
|
if (jobIdError) {
|
|
30597
30262
|
return {
|
|
30598
|
-
action: params.action,
|
|
30599
30263
|
job_id: params.job_id,
|
|
30600
30264
|
ok: false,
|
|
30601
30265
|
error: jobIdError
|
|
@@ -30606,7 +30270,6 @@ function dispatchCarrierJobsAction(params, now = Date.now()) {
|
|
|
30606
30270
|
if (params.action === "result") return resultResponse(jobId, normalizeFormat(params.format), now);
|
|
30607
30271
|
if (params.action === "cancel") return cancelResponse(jobId, now);
|
|
30608
30272
|
return {
|
|
30609
|
-
action: String(params.action),
|
|
30610
30273
|
job_id: jobId,
|
|
30611
30274
|
ok: false,
|
|
30612
30275
|
error: "unsupported action"
|
|
@@ -30634,7 +30297,6 @@ function statusResponse(jobId, now) {
|
|
|
30634
30297
|
const summary = getJobSummary(jobId, now);
|
|
30635
30298
|
const availability = getAvailability(jobId, summary, now);
|
|
30636
30299
|
return {
|
|
30637
|
-
action: "status",
|
|
30638
30300
|
job_id: jobId,
|
|
30639
30301
|
ok: Boolean(active || summary || availability.full_available),
|
|
30640
30302
|
status: active?.status ?? summary?.status ?? "not_found",
|
|
@@ -30649,8 +30311,6 @@ function resultResponse(jobId, format, now) {
|
|
|
30649
30311
|
const availability = getAvailability(jobId, summary, now);
|
|
30650
30312
|
if (active) {
|
|
30651
30313
|
return {
|
|
30652
|
-
action: "result",
|
|
30653
|
-
format,
|
|
30654
30314
|
job_id: jobId,
|
|
30655
30315
|
ok: false,
|
|
30656
30316
|
status: active.status,
|
|
@@ -30663,8 +30323,6 @@ function resultResponse(jobId, format, now) {
|
|
|
30663
30323
|
}
|
|
30664
30324
|
if (format === "summary") {
|
|
30665
30325
|
return {
|
|
30666
|
-
action: "result",
|
|
30667
|
-
format,
|
|
30668
30326
|
job_id: jobId,
|
|
30669
30327
|
ok: Boolean(summary),
|
|
30670
30328
|
status: summary?.status ?? "not_found",
|
|
@@ -30677,17 +30335,31 @@ function resultResponse(jobId, format, now) {
|
|
|
30677
30335
|
const isTaskForceJob = jobId.startsWith("taskforce:");
|
|
30678
30336
|
const isSubOpJob = isTaskForceJob;
|
|
30679
30337
|
const serializeOpts = isSubOpJob ? { perSubOpMaxBytes: CARRIER_JOBS_PER_SUBOP_BYTE_CAP, maxBytes: CARRIER_JOBS_GLOBAL_BYTE_CAP } : { maxBytes: CARRIER_JOBS_FULL_RESULT_BYTE_CAP };
|
|
30680
|
-
|
|
30338
|
+
let fullResult;
|
|
30339
|
+
let results;
|
|
30340
|
+
if (archive) {
|
|
30341
|
+
if (isTaskForceJob) {
|
|
30342
|
+
results = serializeTaskForceResultsByBackend(archive, format);
|
|
30343
|
+
} else if (format === "raw") {
|
|
30344
|
+
fullResult = serializeJobArchive(archive, serializeOpts);
|
|
30345
|
+
} else {
|
|
30346
|
+
const rawSerialized = serializeJobArchive(archive);
|
|
30347
|
+
const reportBody = extractFinalReport(rawSerialized);
|
|
30348
|
+
if (reportBody !== null) {
|
|
30349
|
+
fullResult = capTextBytes(reportBody, CARRIER_JOBS_FULL_RESULT_BYTE_CAP);
|
|
30350
|
+
} else {
|
|
30351
|
+
fullResult = serializeJobArchive(archive, serializeOpts);
|
|
30352
|
+
}
|
|
30353
|
+
}
|
|
30354
|
+
}
|
|
30681
30355
|
return {
|
|
30682
|
-
action: "result",
|
|
30683
|
-
format,
|
|
30684
30356
|
job_id: jobId,
|
|
30685
30357
|
ok: Boolean(archive),
|
|
30686
30358
|
status: archive?.status ?? summary?.status ?? "not_found",
|
|
30687
30359
|
summary: summary ?? void 0,
|
|
30688
30360
|
...availability,
|
|
30689
30361
|
full_result: isTaskForceJob ? void 0 : fullResult,
|
|
30690
|
-
results: archive && isTaskForceJob ?
|
|
30362
|
+
results: archive && isTaskForceJob ? results : void 0,
|
|
30691
30363
|
error: archive ? void 0 : "full result unavailable or expired"
|
|
30692
30364
|
};
|
|
30693
30365
|
}
|
|
@@ -30696,7 +30368,6 @@ function cancelResponse(jobId, now) {
|
|
|
30696
30368
|
const active = getActiveJob(jobId);
|
|
30697
30369
|
const summary = getJobSummary(jobId, now);
|
|
30698
30370
|
return {
|
|
30699
|
-
action: "cancel",
|
|
30700
30371
|
job_id: jobId,
|
|
30701
30372
|
ok: result.cancelled,
|
|
30702
30373
|
cancelled: result.cancelled,
|
|
@@ -30710,7 +30381,6 @@ function cancelResponse(jobId, now) {
|
|
|
30710
30381
|
function getAvailability(jobId, summary, now) {
|
|
30711
30382
|
const fullAvailable = hasFinalizedJobArchive(jobId, now);
|
|
30712
30383
|
return {
|
|
30713
|
-
summary_available: Boolean(summary),
|
|
30714
30384
|
full_available: fullAvailable,
|
|
30715
30385
|
full_invalidated: !hasJobArchive(jobId, now) && Boolean(summary)
|
|
30716
30386
|
};
|
|
@@ -30721,9 +30391,10 @@ function validateJobId(jobId) {
|
|
|
30721
30391
|
return null;
|
|
30722
30392
|
}
|
|
30723
30393
|
function normalizeFormat(format) {
|
|
30724
|
-
|
|
30394
|
+
if (format === "summary" || format === "raw") return format;
|
|
30395
|
+
return "full";
|
|
30725
30396
|
}
|
|
30726
|
-
function serializeTaskForceResultsByBackend(archive) {
|
|
30397
|
+
function serializeTaskForceResultsByBackend(archive, format) {
|
|
30727
30398
|
const grouped = /* @__PURE__ */ new Map();
|
|
30728
30399
|
const orderedKeys = [];
|
|
30729
30400
|
for (const block of archive.blocks) {
|
|
@@ -30737,13 +30408,30 @@ function serializeTaskForceResultsByBackend(archive) {
|
|
|
30737
30408
|
const results = {};
|
|
30738
30409
|
for (const cliType of orderedKeys) {
|
|
30739
30410
|
const blocks = grouped.get(cliType);
|
|
30740
|
-
|
|
30741
|
-
|
|
30742
|
-
{ maxBytes: CARRIER_JOBS_PER_SUBOP_BYTE_CAP }
|
|
30743
|
-
|
|
30411
|
+
const subArchive = { ...archive, blocks };
|
|
30412
|
+
if (format === "raw") {
|
|
30413
|
+
results[cliType] = serializeJobArchive(subArchive, { maxBytes: CARRIER_JOBS_PER_SUBOP_BYTE_CAP });
|
|
30414
|
+
} else {
|
|
30415
|
+
const rawSerialized = serializeJobArchive(subArchive);
|
|
30416
|
+
const reportBody = extractFinalReport(rawSerialized);
|
|
30417
|
+
if (reportBody !== null) {
|
|
30418
|
+
results[cliType] = capTextBytes(reportBody, CARRIER_JOBS_PER_SUBOP_BYTE_CAP);
|
|
30419
|
+
} else {
|
|
30420
|
+
results[cliType] = serializeJobArchive(subArchive, { maxBytes: CARRIER_JOBS_PER_SUBOP_BYTE_CAP });
|
|
30421
|
+
}
|
|
30422
|
+
}
|
|
30744
30423
|
}
|
|
30745
30424
|
return results;
|
|
30746
30425
|
}
|
|
30426
|
+
function capTextBytes(text, maxBytes) {
|
|
30427
|
+
if (Buffer.byteLength(text, "utf8") <= maxBytes) return text;
|
|
30428
|
+
const buf = Buffer.from(text, "utf8");
|
|
30429
|
+
const marker = "\n\n[truncated]";
|
|
30430
|
+
const markerBytes = Buffer.byteLength(marker, "utf8");
|
|
30431
|
+
let end = Math.max(0, maxBytes - markerBytes);
|
|
30432
|
+
while (end > 0 && (buf[end] & 192) === 128) end--;
|
|
30433
|
+
return buf.subarray(0, end).toString("utf8") + marker;
|
|
30434
|
+
}
|
|
30747
30435
|
|
|
30748
30436
|
// ../../packages/fleet-carriers/src/jobs/sanitize.ts
|
|
30749
30437
|
var sanitize_exports = {};
|
|
@@ -30839,84 +30527,17 @@ function isEscIntermediate(code) {
|
|
|
30839
30527
|
return code >= 32 && code <= 47;
|
|
30840
30528
|
}
|
|
30841
30529
|
|
|
30842
|
-
// ../../packages/fleet-carriers/src/jobs/workspace-manifest.ts
|
|
30843
|
-
var WORKSPACE_CHANGE_ATTRIBUTION = "window-approximate";
|
|
30844
|
-
var WORKSPACE_CHANGE_LIMIT = 200;
|
|
30845
|
-
var WORKSPACE_CHANGE_CLEARED_STATUS = "cleared";
|
|
30846
|
-
async function captureWorkspaceSnapshot(scanner, cwd) {
|
|
30847
|
-
if (!scanner) return null;
|
|
30848
|
-
try {
|
|
30849
|
-
return await scanner.snapshot(cwd);
|
|
30850
|
-
} catch {
|
|
30851
|
-
return null;
|
|
30852
|
-
}
|
|
30853
|
-
}
|
|
30854
|
-
async function captureJobWindowManifest(scanner, cwd, baseline) {
|
|
30855
|
-
if (!scanner) {
|
|
30856
|
-
return unavailableWorkspaceManifest("scanner-not-configured");
|
|
30857
|
-
}
|
|
30858
|
-
const end = await captureWorkspaceSnapshot(scanner, cwd);
|
|
30859
|
-
return buildWorkspaceManifest(baseline, end);
|
|
30860
|
-
}
|
|
30861
|
-
function buildWorkspaceManifest(baseline, end, reason) {
|
|
30862
|
-
if (!baseline || !end) {
|
|
30863
|
-
return unavailableWorkspaceManifest("snapshot-unavailable");
|
|
30864
|
-
}
|
|
30865
|
-
const baselineByPath = new Map(baseline.map((entry) => [entry.path, normalizeSnapshotEntry(entry)]));
|
|
30866
|
-
const endChanges = end.map(normalizeSnapshotEntry).filter((entry) => hasWindowChange(baselineByPath.get(entry.path), entry)).map(toManifestEntry);
|
|
30867
|
-
const endPaths = new Set(end.map((entry) => entry.path));
|
|
30868
|
-
const clearedChanges = [...baselineByPath.values()].filter((entry) => !endPaths.has(entry.path)).map((entry) => ({ status: WORKSPACE_CHANGE_CLEARED_STATUS, path: entry.path }));
|
|
30869
|
-
const changes = [...endChanges, ...clearedChanges];
|
|
30870
|
-
const truncated = changes.length > WORKSPACE_CHANGE_LIMIT;
|
|
30871
|
-
const capped = changes.slice(0, WORKSPACE_CHANGE_LIMIT);
|
|
30872
|
-
return {
|
|
30873
|
-
attribution: WORKSPACE_CHANGE_ATTRIBUTION,
|
|
30874
|
-
available: true,
|
|
30875
|
-
changes: capped,
|
|
30876
|
-
statLine: buildStatLine(changes.length, truncated),
|
|
30877
|
-
truncated
|
|
30878
|
-
};
|
|
30879
|
-
}
|
|
30880
|
-
function unavailableWorkspaceManifest(reason) {
|
|
30881
|
-
return {
|
|
30882
|
-
attribution: WORKSPACE_CHANGE_ATTRIBUTION,
|
|
30883
|
-
available: false,
|
|
30884
|
-
reason,
|
|
30885
|
-
changes: [],
|
|
30886
|
-
statLine: "unavailable",
|
|
30887
|
-
truncated: false
|
|
30888
|
-
};
|
|
30889
|
-
}
|
|
30890
|
-
function normalizeSnapshotEntry(entry) {
|
|
30891
|
-
return {
|
|
30892
|
-
status: entry.status.trim(),
|
|
30893
|
-
path: entry.path,
|
|
30894
|
-
contentHash: entry.contentHash?.trim()
|
|
30895
|
-
};
|
|
30896
|
-
}
|
|
30897
|
-
function toManifestEntry(entry) {
|
|
30898
|
-
return {
|
|
30899
|
-
status: entry.status,
|
|
30900
|
-
path: entry.path
|
|
30901
|
-
};
|
|
30902
|
-
}
|
|
30903
|
-
function hasWindowChange(baseline, end) {
|
|
30904
|
-
if (!baseline) return true;
|
|
30905
|
-
if (baseline.status !== end.status) return true;
|
|
30906
|
-
if (baseline.contentHash && end.contentHash) {
|
|
30907
|
-
return baseline.contentHash !== end.contentHash;
|
|
30908
|
-
}
|
|
30909
|
-
return false;
|
|
30910
|
-
}
|
|
30911
|
-
function buildStatLine(changeCount, truncated) {
|
|
30912
|
-
const suffix = changeCount === 1 ? "file" : "files";
|
|
30913
|
-
return `${truncated ? `${WORKSPACE_CHANGE_LIMIT}+` : String(changeCount)} ${suffix} (window-approx)`;
|
|
30914
|
-
}
|
|
30915
|
-
|
|
30916
30530
|
// ../../packages/fleet-carriers/src/dispatch/prompt.ts
|
|
30917
30531
|
var CARRIER_FLEET_BACKGROUND = String.raw`You are an autonomous agent (Carrier) operating within a coordinated multi-agent Fleet system. The Admiral, your superior, dispatches specialized tasks to you and synthesizes your output for the user. Below is your identity, operational permissions, behavioral principles, and required output format. Your assigned task arrives in the user message channel below.`;
|
|
30532
|
+
var COMMON_RESPONSE_PROTOCOL = `<response_protocol>
|
|
30533
|
+
Keep progress narration concise \u2014 at most one line per meaningful step. No verbose play-by-play or step-by-step essays (short streaming lines are acceptable for the live observation channel).
|
|
30534
|
+
|
|
30535
|
+
When the mission is complete, wrap the entire final output in a <report>...</report> tag and emit it exactly once, at the very end. The Admiral retrieves only the report block, so everything you need to convey \u2014 results, evidence, file paths, caveats \u2014 must be inside it. Your persona's output_format structure applies inside the report block as usual.
|
|
30536
|
+
|
|
30537
|
+
Do not mention or demonstrate the literal opening and closing report tag anywhere in the body outside that final block.
|
|
30538
|
+
</response_protocol>`;
|
|
30918
30539
|
function buildCarrierSystemPrompt(metadata) {
|
|
30919
|
-
const parts = [CARRIER_FLEET_BACKGROUND];
|
|
30540
|
+
const parts = [CARRIER_FLEET_BACKGROUND, COMMON_RESPONSE_PROTOCOL];
|
|
30920
30541
|
if (metadata) {
|
|
30921
30542
|
parts.push(`<your_identity>
|
|
30922
30543
|
${metadata.title}
|
|
@@ -31376,7 +30997,6 @@ function buildCarrierDispatchToolSpec(registry3, deps) {
|
|
|
31376
30997
|
});
|
|
31377
30998
|
}
|
|
31378
30999
|
const metadata = config2.carrierMetadata;
|
|
31379
|
-
const isNativeSubagentMode = isCarrierAgentModeSubagent(carrierId, config2.defaultAgentMode);
|
|
31380
31000
|
if (metadata) {
|
|
31381
31001
|
const blockValidation = validateRequiredRequestBlocks(metadata, request, carrierId);
|
|
31382
31002
|
if (!blockValidation.ok) {
|
|
@@ -31387,7 +31007,7 @@ function buildCarrierDispatchToolSpec(registry3, deps) {
|
|
|
31387
31007
|
});
|
|
31388
31008
|
}
|
|
31389
31009
|
}
|
|
31390
|
-
if (
|
|
31010
|
+
if (getConfiguredTaskForceBackends(carrierId).length >= 2) {
|
|
31391
31011
|
return launchTaskForceJob({
|
|
31392
31012
|
registry: registry3,
|
|
31393
31013
|
carrierId,
|
|
@@ -31622,7 +31242,6 @@ function resolveCarrierTrackModelInfo(registry3, carrierId) {
|
|
|
31622
31242
|
const modelConfig = loadCarrierStates({
|
|
31623
31243
|
[carrierId]: carrierConfig ? {
|
|
31624
31244
|
cliType,
|
|
31625
|
-
...carrierConfig.defaultAgentMode ? { defaultAgentMode: carrierConfig.defaultAgentMode } : {},
|
|
31626
31245
|
...carrierConfig.defaultEffort ? { defaultEffort: carrierConfig.defaultEffort } : {},
|
|
31627
31246
|
...carrierConfig.defaultModel ? { defaultModel: carrierConfig.defaultModel } : {}
|
|
31628
31247
|
} : cliType
|
|
@@ -31710,72 +31329,6 @@ function formatRequestBlocksGuide(meta3) {
|
|
|
31710
31329
|
});
|
|
31711
31330
|
}
|
|
31712
31331
|
|
|
31713
|
-
// ../../packages/fleet-carriers/src/subagents/index.ts
|
|
31714
|
-
var subagents_exports = {};
|
|
31715
|
-
__export(subagents_exports, {
|
|
31716
|
-
CLAUDE_SUBAGENT_COLORS: () => CLAUDE_SUBAGENT_COLORS,
|
|
31717
|
-
buildClaudeSubagentDefinition: () => buildClaudeSubagentDefinition,
|
|
31718
|
-
buildClaudeSubagentDefinitions: () => buildClaudeSubagentDefinitions,
|
|
31719
|
-
buildClaudeSubagentName: () => buildClaudeSubagentName
|
|
31720
|
-
});
|
|
31721
|
-
|
|
31722
|
-
// ../../packages/fleet-carriers/src/subagents/claude.ts
|
|
31723
|
-
var NAME_SEGMENT_SPLIT_PATTERN = /[^a-zA-Z0-9]+/;
|
|
31724
|
-
var CLAUDE_MAX_EFFORT = "xhigh";
|
|
31725
|
-
var CLAUDE_SUBAGENT_COLORS = {
|
|
31726
|
-
nimitz: "blue",
|
|
31727
|
-
vanguard: "cyan",
|
|
31728
|
-
chronicle: "green",
|
|
31729
|
-
genesis: "orange",
|
|
31730
|
-
kirov: "purple",
|
|
31731
|
-
ohio: "yellow",
|
|
31732
|
-
sentinel: "red",
|
|
31733
|
-
tempest: "pink"
|
|
31734
|
-
};
|
|
31735
|
-
function buildClaudeSubagentDefinitions(options) {
|
|
31736
|
-
const enabled = new Set(options.enabledCarrierIds);
|
|
31737
|
-
return options.carrierConfigs.filter((config2) => enabled.has(config2.id)).map((config2) => buildClaudeSubagentDefinition(config2));
|
|
31738
|
-
}
|
|
31739
|
-
function buildClaudeSubagentDefinition(config2) {
|
|
31740
|
-
const color = CLAUDE_SUBAGENT_COLORS[config2.id];
|
|
31741
|
-
const effort = getClaudeEffort(config2);
|
|
31742
|
-
const model = getClaudeModel(config2);
|
|
31743
|
-
const definition = {
|
|
31744
|
-
carrierId: config2.id,
|
|
31745
|
-
...color ? { color } : {},
|
|
31746
|
-
description: buildDescription(config2),
|
|
31747
|
-
...effort ? { effort } : {},
|
|
31748
|
-
...model ? { model } : {},
|
|
31749
|
-
name: buildClaudeSubagentName(config2.id),
|
|
31750
|
-
prompt: buildCarrierSystemPrompt(config2.carrierMetadata)
|
|
31751
|
-
};
|
|
31752
|
-
return definition;
|
|
31753
|
-
}
|
|
31754
|
-
function buildClaudeSubagentName(carrierId) {
|
|
31755
|
-
const lowerCaseName = carrierId.split(NAME_SEGMENT_SPLIT_PATTERN).filter((segment) => segment.length > 0).map((segment) => segment.toLowerCase()).join("");
|
|
31756
|
-
return lowerCaseName || "carrier";
|
|
31757
|
-
}
|
|
31758
|
-
function buildDescription(config2) {
|
|
31759
|
-
const metadata = config2.carrierMetadata;
|
|
31760
|
-
const parts = [
|
|
31761
|
-
config2.displayName,
|
|
31762
|
-
metadata?.title,
|
|
31763
|
-
metadata?.summary,
|
|
31764
|
-
metadata?.whenToUse?.length ? `Use for: ${metadata.whenToUse.join(", ")}.` : void 0
|
|
31765
|
-
];
|
|
31766
|
-
return parts.filter((part) => typeof part === "string" && part.trim().length > 0).join(" - ").replace(/\s+/g, " ").trim();
|
|
31767
|
-
}
|
|
31768
|
-
function getClaudeEffort(config2) {
|
|
31769
|
-
const effort = config2.subagent?.byHost?.claude?.defaultEffort ?? config2.subagent?.defaultEffort;
|
|
31770
|
-
return clampClaudeEffort(effort);
|
|
31771
|
-
}
|
|
31772
|
-
function getClaudeModel(config2) {
|
|
31773
|
-
return config2.subagent?.byHost?.claude?.defaultModel ?? config2.subagent?.defaultModel;
|
|
31774
|
-
}
|
|
31775
|
-
function clampClaudeEffort(effort) {
|
|
31776
|
-
return effort === "max" ? CLAUDE_MAX_EFFORT : effort;
|
|
31777
|
-
}
|
|
31778
|
-
|
|
31779
31332
|
// ../../packages/fleet-carriers/src/index.ts
|
|
31780
31333
|
var dispatch = {
|
|
31781
31334
|
...framework_exports,
|
|
@@ -31814,7 +31367,6 @@ function createCarrierRuntime() {
|
|
|
31814
31367
|
dispatch,
|
|
31815
31368
|
jobs: boundCarrierJobs,
|
|
31816
31369
|
personas: personas_exports,
|
|
31817
|
-
subagents: subagents_exports,
|
|
31818
31370
|
store: store_exports,
|
|
31819
31371
|
stream: boundStream,
|
|
31820
31372
|
registerCarrierDefaults() {
|
|
@@ -32090,6 +31642,10 @@ Disposition (report one line): ${"`"}inspection: pass${"`"} | ${"`"}inspection:
|
|
|
32090
31642
|
deviations corrected by the Admiral${"`"} | ${"`"}inspection: rejected — re-dispatched
|
|
32091
31643
|
with findings${"`"}. Small deviations the Admiral corrects directly during
|
|
32092
31644
|
integration; systematic deviations route back to the owning carrier.
|
|
31645
|
+
"Small/harmless" is a claim that needs evidence, not an eyeball impression:
|
|
31646
|
+
before so classifying a deviation, confirm it changes no observable behavior,
|
|
31647
|
+
contract, or output and is unreachable by any real execution path; if
|
|
31648
|
+
unconfirmed, treat it as a defect, not a small deviation.
|
|
32093
31649
|
Proportionality: full-diff reading for doctrine/prompt/structural changes;
|
|
32094
31650
|
stat + targeted sampling for large mechanical changes. Read-only jobs skip
|
|
32095
31651
|
this gate — their claims route through Deep Dive instead.
|
|
@@ -32239,12 +31795,11 @@ function createClaudeFamilyCliDefinition(options) {
|
|
|
32239
31795
|
label: options.label,
|
|
32240
31796
|
async createProfile(profileOptions) {
|
|
32241
31797
|
const { bin, prefixArgs } = resolveBinary("claude", "CLAUDE_BIN", profileOptions.env);
|
|
32242
|
-
const authEnv = options.authCli && profileOptions.authEnvResolver ? await profileOptions.authEnvResolver(options.authCli, { authService: profileOptions.authService }) : {};
|
|
32243
31798
|
return {
|
|
32244
31799
|
args: [...prefixArgs, ...buildModelArgs(profileOptions.model)],
|
|
32245
31800
|
bin,
|
|
32246
31801
|
cwd: profileOptions.cwd,
|
|
32247
|
-
env: createChildEnv(profileOptions.env,
|
|
31802
|
+
env: createChildEnv(profileOptions.env, {}),
|
|
32248
31803
|
id: options.id,
|
|
32249
31804
|
label: options.label,
|
|
32250
31805
|
messagePolicy: {
|
|
@@ -32269,20 +31824,6 @@ var claudeCli = createClaudeFamilyCliDefinition({
|
|
|
32269
31824
|
label: "Claude"
|
|
32270
31825
|
});
|
|
32271
31826
|
|
|
32272
|
-
// ../../packages/fleet-admiral/src/agent-cli/claude-glm/claude-glm.ts
|
|
32273
|
-
var claudeGlmCli = createClaudeFamilyCliDefinition({
|
|
32274
|
-
authCli: "claude-glm",
|
|
32275
|
-
id: "claude-glm",
|
|
32276
|
-
label: "Claude GLM"
|
|
32277
|
-
});
|
|
32278
|
-
|
|
32279
|
-
// ../../packages/fleet-admiral/src/agent-cli/claude-kimi/claude-kimi.ts
|
|
32280
|
-
var claudeKimiCli = createClaudeFamilyCliDefinition({
|
|
32281
|
-
authCli: "claude-kimi",
|
|
32282
|
-
id: "claude-kimi",
|
|
32283
|
-
label: "Claude Kimi"
|
|
32284
|
-
});
|
|
32285
|
-
|
|
32286
31827
|
// ../../packages/fleet-admiral/src/agent-cli/codex/codex.ts
|
|
32287
31828
|
var codexCli = {
|
|
32288
31829
|
id: "codex",
|
|
@@ -32319,15 +31860,11 @@ function buildModelArgs2(model) {
|
|
|
32319
31860
|
var DEFAULT_CLI_ID = "claude";
|
|
32320
31861
|
var DEFINITIONS = {
|
|
32321
31862
|
claude: claudeCli,
|
|
32322
|
-
"claude-kimi": claudeKimiCli,
|
|
32323
|
-
"claude-glm": claudeGlmCli,
|
|
32324
31863
|
codex: codexCli
|
|
32325
31864
|
};
|
|
32326
31865
|
async function resolveAgentCliProfile(env, cwd, options = {}) {
|
|
32327
31866
|
const id = resolveAgentCliId(env, options);
|
|
32328
31867
|
return DEFINITIONS[id].createProfile({
|
|
32329
|
-
authEnvResolver: options.authEnvResolver,
|
|
32330
|
-
authService: options.authService,
|
|
32331
31868
|
cwd,
|
|
32332
31869
|
env,
|
|
32333
31870
|
model: options.model,
|
|
@@ -32365,14 +31902,6 @@ var AGENT_CLI_INJECTION_CAPABILITIES = {
|
|
|
32365
31902
|
builderId: "claude-native",
|
|
32366
31903
|
enabled: true
|
|
32367
31904
|
},
|
|
32368
|
-
"claude-kimi": {
|
|
32369
|
-
builderId: "claude-native",
|
|
32370
|
-
enabled: true
|
|
32371
|
-
},
|
|
32372
|
-
"claude-glm": {
|
|
32373
|
-
builderId: "claude-native",
|
|
32374
|
-
enabled: true
|
|
32375
|
-
},
|
|
32376
31905
|
codex: {
|
|
32377
31906
|
builderId: "codex-native",
|
|
32378
31907
|
enabled: true
|
|
@@ -32396,34 +31925,6 @@ function createSessionCaptureHookExec(deps) {
|
|
|
32396
31925
|
};
|
|
32397
31926
|
}
|
|
32398
31927
|
|
|
32399
|
-
// ../../packages/fleet-admiral/src/agent-cli/carrier-defaults.ts
|
|
32400
|
-
function buildHostCarrierModelDefaults(config2) {
|
|
32401
|
-
const cliType = resolveAgentCliType2(config2.id, config2.defaultCliType);
|
|
32402
|
-
const cliDefaults = buildCarrierModelDefaults(config2, cliType);
|
|
32403
|
-
return {
|
|
32404
|
-
cliType,
|
|
32405
|
-
...config2.defaultAgentMode ? { defaultAgentMode: config2.defaultAgentMode } : {},
|
|
32406
|
-
...cliDefaults.defaultEffort ? { defaultEffort: cliDefaults.defaultEffort } : {},
|
|
32407
|
-
...cliDefaults.defaultModel ? { defaultModel: cliDefaults.defaultModel } : {}
|
|
32408
|
-
};
|
|
32409
|
-
}
|
|
32410
|
-
function buildClaudeNativeSubagentPlan(registry3) {
|
|
32411
|
-
const carrierIds = getRegisteredOrder(registry3);
|
|
32412
|
-
const carrierConfigs = carrierIds.map((carrierId) => getCarrierConfig(registry3, carrierId)).filter((config2) => config2 !== void 0);
|
|
32413
|
-
const defaultsByCarrier = Object.fromEntries(
|
|
32414
|
-
carrierConfigs.map((config2) => [config2.id, buildHostCarrierModelDefaults(config2)])
|
|
32415
|
-
);
|
|
32416
|
-
const enabledCarrierIds = getEnabledCarrierSubagentIds(
|
|
32417
|
-
readCarrierAgentModeSnapshot(defaultsByCarrier),
|
|
32418
|
-
carrierIds
|
|
32419
|
-
);
|
|
32420
|
-
return {
|
|
32421
|
-
carrierConfigs,
|
|
32422
|
-
definitions: buildClaudeSubagentDefinitions({ carrierConfigs, enabledCarrierIds }),
|
|
32423
|
-
enabledCarrierIds
|
|
32424
|
-
};
|
|
32425
|
-
}
|
|
32426
|
-
|
|
32427
31928
|
// ../../packages/fleet-admiral/src/agent-cli/builders/claude.ts
|
|
32428
31929
|
function buildClaudeNativeArgs(context) {
|
|
32429
31930
|
const systemPromptArg = context.replaceSystemPrompt ? "--system-prompt-file" : "--append-system-prompt-file";
|
|
@@ -32523,10 +32024,7 @@ function buildCodexNativeArgs(context) {
|
|
|
32523
32024
|
"-c",
|
|
32524
32025
|
'approval_policy="never"',
|
|
32525
32026
|
"-c",
|
|
32526
|
-
'sandbox_mode="danger-full-access"'
|
|
32527
|
-
// hook 신뢰 프롬프트("Hooks need review")를 fleet 관리 세션에서 건너뛴다. bypass_hook_trust는
|
|
32528
|
-
// config 키가 아니라 전용 CLI 플래그이므로 -c override가 아닌 플래그로 전달해야 한다.
|
|
32529
|
-
"--dangerously-bypass-hook-trust"
|
|
32027
|
+
'sandbox_mode="danger-full-access"'
|
|
32530
32028
|
];
|
|
32531
32029
|
for (const server of context.mcpServers) {
|
|
32532
32030
|
const prefix = `mcp_servers.${server.name}`;
|
|
@@ -32717,50 +32215,26 @@ function assertSegmentRealpathWithinRoot(resolvedBase, segmentPath) {
|
|
|
32717
32215
|
}
|
|
32718
32216
|
|
|
32719
32217
|
// ../../packages/fleet-admiral/src/agent-cli/plugin/fleet.ts
|
|
32720
|
-
var CLAUDE_AGENT_FILE_STEM_ALLOWLIST = /^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$/;
|
|
32721
32218
|
var assetBundle = {
|
|
32722
32219
|
description: "Fleet carrier delegation and wiki evidence plugin",
|
|
32723
32220
|
directoryName: "fleet",
|
|
32724
32221
|
displayName: "Fleet",
|
|
32725
32222
|
hashFileName: ".fleet-codex-plugin.hash",
|
|
32726
|
-
includeClaudeAgents: true,
|
|
32727
32223
|
name: "fleet",
|
|
32728
32224
|
source: "asset"
|
|
32729
32225
|
};
|
|
32730
32226
|
function renderAssetPluginRoot(pluginRoot, bundle, options) {
|
|
32731
32227
|
renderEmbeddedSkillAssets(pluginRoot);
|
|
32732
|
-
if (
|
|
32733
|
-
for (const subagent of options.claudeDefinitions) {
|
|
32734
|
-
const fileStem = parseClaudeAgentFileStem(subagent.name);
|
|
32735
|
-
writePrivateFile(path27__default.join(pluginRoot, "agents", `${fileStem}.md`), claudeAgentFile(subagent), pluginRoot);
|
|
32736
|
-
}
|
|
32737
|
-
}
|
|
32738
|
-
if (options.cliId === "claude" || options.cliId === "claude-kimi" || options.cliId === "claude-glm") {
|
|
32228
|
+
if (options.cliId === "claude") {
|
|
32739
32229
|
writePrivateJson(path27__default.join(pluginRoot, "hooks", "hooks.json"), claudeHooks(options), pluginRoot);
|
|
32740
32230
|
}
|
|
32741
32231
|
}
|
|
32742
|
-
function validateClaudeAgentFileStems(subagents) {
|
|
32743
|
-
for (const subagent of subagents) {
|
|
32744
|
-
parseClaudeAgentFileStem(subagent.name);
|
|
32745
|
-
}
|
|
32746
|
-
}
|
|
32747
|
-
function parseClaudeAgentFileStem(name) {
|
|
32748
|
-
if (CLAUDE_AGENT_FILE_STEM_ALLOWLIST.test(name) && path27__default.basename(name) === name) return name;
|
|
32749
|
-
throw new Error(`Invalid Claude agent file name: ${name}`);
|
|
32750
|
-
}
|
|
32751
32232
|
function claudeHooks(options) {
|
|
32752
|
-
const hookExec = options.hookExec;
|
|
32753
|
-
if (!hookExec) {
|
|
32754
|
-
throw new Error("Fleet Claude session hook command is required");
|
|
32755
|
-
}
|
|
32756
32233
|
const userPromptSubmitExecs = [options.captureSessionHookExec, options.turnStartHookExec, options.autoNameHookExec].filter((exec) => exec !== void 0);
|
|
32757
32234
|
const stopExecs = [options.turnEndHookExec].filter((exec) => exec !== void 0);
|
|
32758
32235
|
const inputWaitingExec = options.inputWaitingHookExec;
|
|
32759
32236
|
return {
|
|
32760
32237
|
hooks: {
|
|
32761
|
-
SessionStart: [{
|
|
32762
|
-
hooks: [claudeCommandHook(hookExec)]
|
|
32763
|
-
}],
|
|
32764
32238
|
...userPromptSubmitExecs.length > 0 ? {
|
|
32765
32239
|
UserPromptSubmit: [{
|
|
32766
32240
|
hooks: userPromptSubmitExecs.map(claudeCommandHook)
|
|
@@ -32785,9 +32259,6 @@ function claudeHooks(options) {
|
|
|
32785
32259
|
};
|
|
32786
32260
|
}
|
|
32787
32261
|
function claudeCommandHook(hookExec) {
|
|
32788
|
-
if (!hookExec) {
|
|
32789
|
-
throw new Error("Fleet Claude session hook command is required");
|
|
32790
|
-
}
|
|
32791
32262
|
return {
|
|
32792
32263
|
// exec 형식: command는 직접 spawn되는 실행 파일, args는 셸 토크나이징 없이 그대로 전달된다.
|
|
32793
32264
|
// Windows cmd/powershell의 따옴표 규칙과 무관하게 동작하며 공백 포함 경로도 안전하다.
|
|
@@ -32796,23 +32267,6 @@ function claudeCommandHook(hookExec) {
|
|
|
32796
32267
|
type: "command"
|
|
32797
32268
|
};
|
|
32798
32269
|
}
|
|
32799
|
-
function claudeAgentFile(subagent) {
|
|
32800
|
-
const frontmatter = [
|
|
32801
|
-
"---",
|
|
32802
|
-
`name: ${yamlScalar(subagent.name)}`,
|
|
32803
|
-
`description: ${yamlScalar(subagent.description)}`,
|
|
32804
|
-
...subagent.model ? [`model: ${yamlScalar(subagent.model)}`] : [],
|
|
32805
|
-
...subagent.effort ? [`effort: ${yamlScalar(subagent.effort)}`] : [],
|
|
32806
|
-
...subagent.color ? [`color: ${yamlScalar(subagent.color)}`] : [],
|
|
32807
|
-
"background: true",
|
|
32808
|
-
"---",
|
|
32809
|
-
""
|
|
32810
|
-
];
|
|
32811
|
-
return [...frontmatter, subagent.prompt, ""].join("\n");
|
|
32812
|
-
}
|
|
32813
|
-
function yamlScalar(value) {
|
|
32814
|
-
return JSON.stringify(value);
|
|
32815
|
-
}
|
|
32816
32270
|
function renderEmbeddedSkillAssets(pluginRoot) {
|
|
32817
32271
|
for (const asset of EMBEDDED_AGENT_CLI_SKILL_ASSETS) {
|
|
32818
32272
|
writePrivateFile(path27__default.join(pluginRoot, "skills", asset.relativePath), asset.content, pluginRoot);
|
|
@@ -33223,7 +32677,6 @@ async function createAgentCliPlugin(options) {
|
|
|
33223
32677
|
const marketplaceBundles = groupRenderableBundlesByMarketplace(renderableBundles);
|
|
33224
32678
|
const pluginRoots = /* @__PURE__ */ new Map();
|
|
33225
32679
|
const contentHashes = /* @__PURE__ */ new Map();
|
|
33226
|
-
validateClaudeAgentFileStems(options.claudeDefinitions);
|
|
33227
32680
|
for (const marketplace of marketplaceBundles) {
|
|
33228
32681
|
await options.withMarketplaceLock(marketplace.target.root, () => {
|
|
33229
32682
|
for (const { bundle, target } of marketplace.bundles) {
|
|
@@ -33468,9 +32921,11 @@ function claudeManifest(bundle) {
|
|
|
33468
32921
|
}
|
|
33469
32922
|
|
|
33470
32923
|
// ../../packages/fleet-admiral/src/agent-cli/injection.ts
|
|
33471
|
-
var
|
|
33472
|
-
var
|
|
33473
|
-
var
|
|
32924
|
+
var CODEX_FLEET_PROFILE_NAME = "fleet";
|
|
32925
|
+
var CODEX_FLEET_PROFILE_FILE_NAME = `${CODEX_FLEET_PROFILE_NAME}.config.toml`;
|
|
32926
|
+
var CODEX_LEGACY_FLEET_PROFILE_FILE_NAME_PATTERN = /^fleet-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.config\.toml$/;
|
|
32927
|
+
var CODEX_FLEET_PROFILE_MARKER = "# Fleet-managed Codex profile";
|
|
32928
|
+
var CODEX_LEGACY_FLEET_PROFILE_MARKER = "# Fleet-managed Codex session profile";
|
|
33474
32929
|
var SYSTEM_PROMPT_FILE_MODE = 384;
|
|
33475
32930
|
async function injectAgentCliProfile(profile, options) {
|
|
33476
32931
|
const capability = getAgentCliInjectionCapability(profile.id);
|
|
@@ -33479,16 +32934,14 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
33479
32934
|
}
|
|
33480
32935
|
const injectTone = options.enableMetaphor ?? false;
|
|
33481
32936
|
const endpoint = await options.dedicatedMcpSession.getEndpoint();
|
|
33482
|
-
const startupDefinitions = buildStartupNativeDefinitions(profile.id, options.carrierRuntime);
|
|
33483
32937
|
const tokenLabel = options.mcpSessionLabel ?? `agent:${profile.id}:${crypto3.randomUUID()}`;
|
|
33484
32938
|
const tokens = await options.dedicatedMcpSession.issueSessionToken({ cwd: profile.cwd, label: tokenLabel });
|
|
33485
32939
|
const mcpServers = buildAgentCliMcpServerConfigs(endpoint.servers, tokens);
|
|
33486
32940
|
const doctrine = options.buildSystemPrompt(injectTone);
|
|
33487
32941
|
const tempCleanups = [];
|
|
33488
32942
|
try {
|
|
33489
|
-
const systemPromptFile = profile.id === "claude"
|
|
32943
|
+
const systemPromptFile = profile.id === "claude" ? writeSystemPromptFile(profile.id, doctrine, (cleanup2) => tempCleanups.push(cleanup2)) : void 0;
|
|
33490
32944
|
const plugin = await createAgentCliPlugin({
|
|
33491
|
-
claudeDefinitions: startupDefinitions.host === "claude" ? startupDefinitions.definitions : [],
|
|
33492
32945
|
cliId: profile.id,
|
|
33493
32946
|
codexCommandRunner: options.codexCommandRunner,
|
|
33494
32947
|
cwd: profile.cwd,
|
|
@@ -33499,7 +32952,6 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
33499
32952
|
turnEndHookExec: options.turnEndHookExec,
|
|
33500
32953
|
inputWaitingHookExec: options.inputWaitingHookExec,
|
|
33501
32954
|
autoNameHookExec: options.autoNameHookExec,
|
|
33502
|
-
hookExec: startupDefinitions.host === "claude" ? requireHookExec(options.hookExec) : void 0,
|
|
33503
32955
|
withMarketplaceLock: options.withMarketplaceLock
|
|
33504
32956
|
});
|
|
33505
32957
|
const codexPluginKeys = plugin.codexRegistrations.map((registration) => `${registration.pluginName}@${registration.marketplaceName}`);
|
|
@@ -33508,7 +32960,7 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
33508
32960
|
turnStartHookExec: options.turnStartHookExec,
|
|
33509
32961
|
turnEndHookExec: options.turnEndHookExec,
|
|
33510
32962
|
autoNameHookExec: options.autoNameHookExec
|
|
33511
|
-
}
|
|
32963
|
+
}) : void 0;
|
|
33512
32964
|
const launchWarnings = [];
|
|
33513
32965
|
if (profile.id === "codex") {
|
|
33514
32966
|
const cleanupWarning = await cleanupDeprecatedCodexPluginState({
|
|
@@ -33569,15 +33021,6 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
33569
33021
|
throw error51;
|
|
33570
33022
|
}
|
|
33571
33023
|
}
|
|
33572
|
-
function buildStartupNativeDefinitions(cliId, carrierRuntime) {
|
|
33573
|
-
const host = getNativeSubagentHost(cliId);
|
|
33574
|
-
if (host === "none") return { host, definitions: [] };
|
|
33575
|
-
return { host, definitions: buildClaudeNativeSubagentPlan(carrierRuntime.registry).definitions };
|
|
33576
|
-
}
|
|
33577
|
-
function getNativeSubagentHost(cliId) {
|
|
33578
|
-
if (cliId === "claude" || cliId === "claude-kimi" || cliId === "claude-glm") return "claude";
|
|
33579
|
-
return "none";
|
|
33580
|
-
}
|
|
33581
33024
|
function buildAgentCliMcpServerConfigs(endpoints, tokens) {
|
|
33582
33025
|
return endpoints.map((endpoint) => {
|
|
33583
33026
|
const token = tokens.find((entry) => entry.name === endpoint.name)?.token;
|
|
@@ -33599,13 +33042,13 @@ function writeSystemPromptFile(cliId, systemPrompt, onCleanup) {
|
|
|
33599
33042
|
chmodBestEffort2(filePath, SYSTEM_PROMPT_FILE_MODE);
|
|
33600
33043
|
return filePath;
|
|
33601
33044
|
}
|
|
33602
|
-
function writeCodexFleetProfile(env, doctrine, pluginKeys, hookExecs
|
|
33045
|
+
function writeCodexFleetProfile(env, doctrine, pluginKeys, hookExecs) {
|
|
33603
33046
|
const codexHome = env.CODEX_HOME ?? path27__default.join(env.HOME ?? os3__default.homedir(), ".codex");
|
|
33604
33047
|
mkdirSync(codexHome, { recursive: true });
|
|
33605
|
-
|
|
33606
|
-
const profileName =
|
|
33607
|
-
const profilePath = path27__default.join(codexHome,
|
|
33608
|
-
|
|
33048
|
+
pruneLegacyCodexFleetProfiles(codexHome);
|
|
33049
|
+
const profileName = CODEX_FLEET_PROFILE_NAME;
|
|
33050
|
+
const profilePath = path27__default.join(codexHome, CODEX_FLEET_PROFILE_FILE_NAME);
|
|
33051
|
+
const hookTrustState = readCodexFleetHookTrustState(profilePath);
|
|
33609
33052
|
writeFileNoFollow2(profilePath, [
|
|
33610
33053
|
CODEX_FLEET_PROFILE_MARKER,
|
|
33611
33054
|
// doctrine를 멀티라인 TOML 문자열로 직렬화해 실제 줄바꿈을 보존(pretty)한다.
|
|
@@ -33614,12 +33057,16 @@ function writeCodexFleetProfile(env, doctrine, pluginKeys, hookExecs, onCleanup)
|
|
|
33614
33057
|
escapeTomlMultilineString(doctrine),
|
|
33615
33058
|
`"""`,
|
|
33616
33059
|
"",
|
|
33060
|
+
"[features]",
|
|
33061
|
+
"hooks = true",
|
|
33062
|
+
"",
|
|
33617
33063
|
...pluginKeys.flatMap((pluginKey) => [
|
|
33618
33064
|
`[plugins."${escapeTomlBasicString2(pluginKey)}"]`,
|
|
33619
33065
|
"enabled = true",
|
|
33620
33066
|
""
|
|
33621
33067
|
]),
|
|
33622
|
-
...codexHooksConfig(hookExecs)
|
|
33068
|
+
...codexHooksConfig(hookExecs),
|
|
33069
|
+
...hookTrustState
|
|
33623
33070
|
].join("\n"));
|
|
33624
33071
|
chmodBestEffort2(profilePath, SYSTEM_PROMPT_FILE_MODE);
|
|
33625
33072
|
return { profileName, profilePath };
|
|
@@ -33654,27 +33101,67 @@ function writeFileNoFollow2(filePath, content) {
|
|
|
33654
33101
|
closeSync(fd);
|
|
33655
33102
|
}
|
|
33656
33103
|
}
|
|
33657
|
-
function
|
|
33104
|
+
function readCodexFleetHookTrustState(profilePath) {
|
|
33105
|
+
try {
|
|
33106
|
+
const content = readFileNoFollow(profilePath);
|
|
33107
|
+
if ((content.split(/\r?\n/, 1)[0] ?? "") !== CODEX_FLEET_PROFILE_MARKER) return [];
|
|
33108
|
+
return extractCodexHookTrustStateSections(content);
|
|
33109
|
+
} catch {
|
|
33110
|
+
return [];
|
|
33111
|
+
}
|
|
33112
|
+
}
|
|
33113
|
+
function readFileNoFollow(filePath) {
|
|
33114
|
+
const fd = openSync(filePath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
33115
|
+
try {
|
|
33116
|
+
return readFileSync(fd, "utf8");
|
|
33117
|
+
} finally {
|
|
33118
|
+
closeSync(fd);
|
|
33119
|
+
}
|
|
33120
|
+
}
|
|
33121
|
+
function extractCodexHookTrustStateSections(content) {
|
|
33122
|
+
const sections = [];
|
|
33123
|
+
let current;
|
|
33124
|
+
for (const line of content.split(/\r?\n/)) {
|
|
33125
|
+
if (/^\[hooks\.state\./.test(line)) {
|
|
33126
|
+
if (current !== void 0) pushCodexHookTrustStateSection(sections, current);
|
|
33127
|
+
current = [line];
|
|
33128
|
+
continue;
|
|
33129
|
+
}
|
|
33130
|
+
if (current === void 0) continue;
|
|
33131
|
+
if (/^\s*\[/.test(line)) {
|
|
33132
|
+
pushCodexHookTrustStateSection(sections, current);
|
|
33133
|
+
current = void 0;
|
|
33134
|
+
continue;
|
|
33135
|
+
}
|
|
33136
|
+
current.push(line);
|
|
33137
|
+
}
|
|
33138
|
+
if (current !== void 0) pushCodexHookTrustStateSection(sections, current);
|
|
33139
|
+
return sections;
|
|
33140
|
+
}
|
|
33141
|
+
function pushCodexHookTrustStateSection(sections, section) {
|
|
33142
|
+
sections.push(...section);
|
|
33143
|
+
if (section[section.length - 1] !== "") sections.push("");
|
|
33144
|
+
}
|
|
33145
|
+
function pruneLegacyCodexFleetProfiles(codexHome) {
|
|
33658
33146
|
let entries;
|
|
33659
33147
|
try {
|
|
33660
33148
|
entries = readdirSync(codexHome);
|
|
33661
33149
|
} catch {
|
|
33662
33150
|
return;
|
|
33663
33151
|
}
|
|
33664
|
-
const now = Date.now();
|
|
33665
33152
|
for (const entry of entries) {
|
|
33666
|
-
if (!
|
|
33153
|
+
if (!CODEX_LEGACY_FLEET_PROFILE_FILE_NAME_PATTERN.test(entry)) continue;
|
|
33667
33154
|
const filePath = path27__default.join(codexHome, entry);
|
|
33668
|
-
if (!
|
|
33155
|
+
if (!isLegacyFleetCodexProfile(filePath)) continue;
|
|
33669
33156
|
unlinkBestEffort2(filePath);
|
|
33670
33157
|
}
|
|
33671
33158
|
}
|
|
33672
|
-
function
|
|
33159
|
+
function isLegacyFleetCodexProfile(filePath) {
|
|
33673
33160
|
try {
|
|
33674
33161
|
const stat3 = lstatSync(filePath);
|
|
33675
33162
|
if (!stat3.isFile() || stat3.isSymbolicLink()) return false;
|
|
33676
|
-
|
|
33677
|
-
return
|
|
33163
|
+
const firstLine = readFirstLine(filePath);
|
|
33164
|
+
return firstLine === CODEX_LEGACY_FLEET_PROFILE_MARKER;
|
|
33678
33165
|
} catch {
|
|
33679
33166
|
return false;
|
|
33680
33167
|
}
|
|
@@ -33701,10 +33188,6 @@ function unlinkBestEffort2(targetPath) {
|
|
|
33701
33188
|
} catch {
|
|
33702
33189
|
}
|
|
33703
33190
|
}
|
|
33704
|
-
function requireHookExec(hookExec) {
|
|
33705
|
-
if (hookExec) return hookExec;
|
|
33706
|
-
throw new Error("Fleet session hook executable is required for Claude native injection");
|
|
33707
|
-
}
|
|
33708
33191
|
function requireCodexCommandRunner(codexCommandRunner) {
|
|
33709
33192
|
if (codexCommandRunner) return codexCommandRunner;
|
|
33710
33193
|
throw new Error("Codex plugin registration requires an injected command runner");
|
|
@@ -33825,7 +33308,7 @@ function registerExecutorPort(mcpRegistry, carrierRuntime, isActive) {
|
|
|
33825
33308
|
}
|
|
33826
33309
|
function registerFleetAgentRuntimeTools(mcpRegistry, carrierRuntime, deps) {
|
|
33827
33310
|
registerAgentToolDefaults(mcpRegistry, carrierRuntime, {
|
|
33828
|
-
authEnvResolver:
|
|
33311
|
+
authEnvResolver: async () => ({}),
|
|
33829
33312
|
reservedExternalMcpServerIds: buildReservedExternalMcpServerIds(deps.reservedExternalMcpServerIds),
|
|
33830
33313
|
workspaceChangeScanner: deps.workspaceChangeScanner
|
|
33831
33314
|
});
|
|
@@ -40668,9 +40151,8 @@ function execFileVersion(bin, args) {
|
|
|
40668
40151
|
}
|
|
40669
40152
|
|
|
40670
40153
|
// ../fleet-plugins/terminal/server/agent-api/agent-cli-launch-kinds.ts
|
|
40671
|
-
var UNSUPPORTED_AGENT_CLI_IDS = /* @__PURE__ */ new Set(["claude-kimi", "claude-glm"]);
|
|
40672
40154
|
function buildAgentCliLaunchKinds(metadata, operationType) {
|
|
40673
|
-
return metadata.
|
|
40155
|
+
return metadata.map((cli) => {
|
|
40674
40156
|
const disabledReason = resolveDisabledReason(cli);
|
|
40675
40157
|
return {
|
|
40676
40158
|
id: cli.id,
|
|
@@ -40693,10 +40175,7 @@ function combineAgentCliLaunchMetadata(metadata, installStatuses, authStatuses)
|
|
|
40693
40175
|
return metadata.map((meta3) => ({
|
|
40694
40176
|
id: meta3.id,
|
|
40695
40177
|
label: meta3.label,
|
|
40696
|
-
// claude 계열 3종은 같은 `claude` 바이너리를 공유하므로 cliCommand로 설치 여부를 판정한다.
|
|
40697
40178
|
available: availableByCommand.get(CLI_BACKENDS[meta3.id].cliCommand) ?? false,
|
|
40698
|
-
// model-auth 게이트 대상(claude-kimi/glm)만 실제 로그인 상태를 반영하고,
|
|
40699
|
-
// 자체 인증 CLI(claude/codex)는 Fleet이 로그인 여부를 알 수 없으므로 게이트하지 않는다(true).
|
|
40700
40179
|
signedIn: signedInByCli.has(meta3.id) ? signedInByCli.get(meta3.id) ?? false : true
|
|
40701
40180
|
}));
|
|
40702
40181
|
}
|
|
@@ -40874,12 +40353,6 @@ function defaultCapturePaths() {
|
|
|
40874
40353
|
var JAVASCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cjs", ".js", ".mjs"]);
|
|
40875
40354
|
var TYPESCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cts", ".mts", ".ts", ".tsx"]);
|
|
40876
40355
|
var MARKETPLACE_LOCK_DIR_SUFFIX = ".lock";
|
|
40877
|
-
function buildConsoleHookCommand(entry) {
|
|
40878
|
-
if (entry === void 0) {
|
|
40879
|
-
throw new Error("Fleet Console session hook command requires the current console entry path");
|
|
40880
|
-
}
|
|
40881
|
-
return buildConsoleCliHookExec(entry, ["hook", "subagents-context"]);
|
|
40882
|
-
}
|
|
40883
40356
|
function buildConsoleTurnHookCommand(entry, phase) {
|
|
40884
40357
|
return buildConsoleCliHookExec(entry, ["hook", phase === "start" ? "turn-start" : "turn-end"]);
|
|
40885
40358
|
}
|
|
@@ -40972,7 +40445,6 @@ function createAgentTerminalLaunchResolver(deps = {}) {
|
|
|
40972
40445
|
const agentRuntime = deps.agentRuntime;
|
|
40973
40446
|
const injectProfile = deps.injectProfile ?? injectAgentCliProfile;
|
|
40974
40447
|
const resolveProfile = deps.resolveProfile ?? resolveAgentCliProfile;
|
|
40975
|
-
const authEnvResolver = (cli) => resolveAuthEnv(cli, { authService: infraServices.authService });
|
|
40976
40448
|
const hookEntry = { entryPath, execPath, ...tsxLoaderPath ? { tsxLoaderPath } : {} };
|
|
40977
40449
|
return async (selectedCwd, context) => {
|
|
40978
40450
|
const cwd = selectedCwd || baseCwd || homedir3();
|
|
@@ -40992,7 +40464,6 @@ function createAgentTerminalLaunchResolver(deps = {}) {
|
|
|
40992
40464
|
}
|
|
40993
40465
|
const sessionId = context?.sessionId ?? "default";
|
|
40994
40466
|
return createAgentCliLaunchSpec({
|
|
40995
|
-
authEnvResolver,
|
|
40996
40467
|
agentRuntime,
|
|
40997
40468
|
cwd,
|
|
40998
40469
|
dataDir,
|
|
@@ -41030,15 +40501,12 @@ async function createAgentCliLaunchSpec(options) {
|
|
|
41030
40501
|
throw new Error("Fleet Console agent runtime is unavailable.");
|
|
41031
40502
|
}
|
|
41032
40503
|
const profile = await options.resolveProfile(options.env, options.cwd, {
|
|
41033
|
-
authEnvResolver: options.authEnvResolver,
|
|
41034
|
-
authService: options.infraServices.authService,
|
|
41035
40504
|
cliId: options.cliId,
|
|
41036
40505
|
resumeSessionId: options.resumeSessionId
|
|
41037
40506
|
});
|
|
41038
40507
|
const globalSettings = readGlobalSettingsSnapshot(options.infraServices);
|
|
41039
40508
|
const injectedProfile = await options.injectProfile(profile, {
|
|
41040
40509
|
buildSystemPrompt: (injectTone) => createSystemPromptBuilder({ carrierRuntime: agentRuntime.carrierRuntime }).build(injectTone),
|
|
41041
|
-
carrierRuntime: agentRuntime.carrierRuntime,
|
|
41042
40510
|
codexCommandRunner: runCodexCommand,
|
|
41043
40511
|
dataDir: options.dataDir,
|
|
41044
40512
|
dedicatedMcpSession: agentRuntime.dedicatedMcpSession,
|
|
@@ -41048,7 +40516,6 @@ async function createAgentCliLaunchSpec(options) {
|
|
|
41048
40516
|
turnEndHookExec: buildConsoleTurnHookCommand(options.hookEntry, "end"),
|
|
41049
40517
|
inputWaitingHookExec: buildConsoleAttentionHookCommand(options.hookEntry),
|
|
41050
40518
|
autoNameHookExec: buildConsoleAutoNameHookCommand(options.hookEntry),
|
|
41051
|
-
hookExec: buildConsoleHookCommand(options.hookEntry),
|
|
41052
40519
|
onCleanup: (cleanup) => cleanupStack.push(cleanup),
|
|
41053
40520
|
replaceSystemPrompt: globalSettings.replaceSystemPrompt,
|
|
41054
40521
|
resumeSessionId: options.resumeSessionId,
|
|
@@ -41276,7 +40743,6 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
41276
40743
|
cwdLabel: path27__default.basename(operation.cwd) || operation.cwd,
|
|
41277
40744
|
label: operation.label,
|
|
41278
40745
|
labelSource: operation.labelSource,
|
|
41279
|
-
autoNamePromptSeen: operation.autoNamePromptSeen,
|
|
41280
40746
|
cliId: operation.cliId,
|
|
41281
40747
|
cliLabel: operation.cliLabel,
|
|
41282
40748
|
createdAt: operation.createdAt,
|
|
@@ -41298,7 +40764,6 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
41298
40764
|
cwd: session.cwd,
|
|
41299
40765
|
...session.label ? { label: session.label } : {},
|
|
41300
40766
|
...session.labelSource ? { labelSource: session.labelSource } : {},
|
|
41301
|
-
...session.autoNamePromptSeen ? { autoNamePromptSeen: true } : {},
|
|
41302
40767
|
...session.cliId ? { cliId: session.cliId } : {},
|
|
41303
40768
|
...session.cliLabel ? { cliLabel: session.cliLabel } : {},
|
|
41304
40769
|
createdAt: session.createdAt,
|
|
@@ -41345,11 +40810,9 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
41345
40810
|
if (label.length === 0) {
|
|
41346
40811
|
delete session.label;
|
|
41347
40812
|
delete session.labelSource;
|
|
41348
|
-
delete session.autoNamePromptSeen;
|
|
41349
40813
|
} else {
|
|
41350
40814
|
session.label = label;
|
|
41351
40815
|
session.labelSource = "user";
|
|
41352
|
-
session.autoNamePromptSeen = true;
|
|
41353
40816
|
}
|
|
41354
40817
|
return toTerminalSessionInfo(session);
|
|
41355
40818
|
}
|
|
@@ -41357,17 +40820,16 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
41357
40820
|
const session = terminalSessionsById.get(sessionId);
|
|
41358
40821
|
if (!session) return null;
|
|
41359
40822
|
const effectiveSource = session.labelSource ?? (session.label ? "user" : void 0);
|
|
41360
|
-
if (effectiveSource === "user"
|
|
41361
|
-
return { session: toTerminalSessionInfo(session),
|
|
40823
|
+
if (effectiveSource === "user") {
|
|
40824
|
+
return { session: toTerminalSessionInfo(session), renamed: false };
|
|
41362
40825
|
}
|
|
41363
|
-
session.autoNamePromptSeen = true;
|
|
41364
40826
|
const next = label?.trim().slice(0, 200) ?? "";
|
|
41365
40827
|
if (next.length === 0 || next === session.label) {
|
|
41366
|
-
return { session: toTerminalSessionInfo(session),
|
|
40828
|
+
return { session: toTerminalSessionInfo(session), renamed: false };
|
|
41367
40829
|
}
|
|
41368
40830
|
session.label = next;
|
|
41369
40831
|
session.labelSource = "auto";
|
|
41370
|
-
return { session: toTerminalSessionInfo(session),
|
|
40832
|
+
return { session: toTerminalSessionInfo(session), renamed: true };
|
|
41371
40833
|
}
|
|
41372
40834
|
function notifySessionUpdated(session) {
|
|
41373
40835
|
const event = { type: "session:updated", session };
|
|
@@ -41539,7 +41001,8 @@ function normalizeEventPayload(event) {
|
|
|
41539
41001
|
label: safeString(obj.label),
|
|
41540
41002
|
startedAt: safeNumber(obj.startedAt),
|
|
41541
41003
|
activeJobToolCallId: safeOptionalString(obj.activeJobToolCallId),
|
|
41542
|
-
tracks: Array.isArray(obj.tracks) ? obj.tracks.map(normalizeTrackMeta) : []
|
|
41004
|
+
tracks: Array.isArray(obj.tracks) ? obj.tracks.map(normalizeTrackMeta) : [],
|
|
41005
|
+
signatureCli: safeOptionalString(obj.signatureCli)
|
|
41543
41006
|
};
|
|
41544
41007
|
case "job:finalized":
|
|
41545
41008
|
return {
|
|
@@ -41721,26 +41184,6 @@ function withAgentSecurityHeaders(headers) {
|
|
|
41721
41184
|
};
|
|
41722
41185
|
}
|
|
41723
41186
|
|
|
41724
|
-
// ../fleet-plugins/terminal/server/model-auth-state.ts
|
|
41725
|
-
var TERMINAL_MODEL_AUTH_PROVIDERS = [
|
|
41726
|
-
{ cli: "claude-kimi", displayName: "Moonshot Kimi" },
|
|
41727
|
-
{ cli: "claude-glm", displayName: "ZhipuAI GLM" }
|
|
41728
|
-
];
|
|
41729
|
-
async function buildModelAuthState(authService) {
|
|
41730
|
-
const signedInIds = new Set(await authService.listProviderIds());
|
|
41731
|
-
return {
|
|
41732
|
-
providers: TERMINAL_MODEL_AUTH_PROVIDERS.map((provider) => toProviderState(provider, signedInIds))
|
|
41733
|
-
};
|
|
41734
|
-
}
|
|
41735
|
-
function toProviderState(provider, signedInIds) {
|
|
41736
|
-
const providerId = CLI_TO_AUTH_PROVIDER_ID[provider.cli] ?? provider.cli;
|
|
41737
|
-
return {
|
|
41738
|
-
cli: provider.cli,
|
|
41739
|
-
displayName: provider.displayName,
|
|
41740
|
-
signedIn: signedInIds.has(providerId)
|
|
41741
|
-
};
|
|
41742
|
-
}
|
|
41743
|
-
|
|
41744
41187
|
// ../fleet-plugins/terminal/server/agent.ts
|
|
41745
41188
|
var AGENT_OPERATION_TYPE = "agent";
|
|
41746
41189
|
var OPERATION_RENAMED_EVENT_CHANNEL = "operation:renamed";
|
|
@@ -41757,9 +41200,7 @@ function registerAgentRoutes(ctx, terminalRuntime, deps) {
|
|
|
41757
41200
|
}
|
|
41758
41201
|
function createAgentApi(ctx, terminalRuntime, deps) {
|
|
41759
41202
|
const dataDir = ctx.host.paths.dataDir;
|
|
41760
|
-
const authEnvResolver = (cli) => resolveAuthEnv(cli, { authService: deps.authService });
|
|
41761
41203
|
const runtime = createFleetAgentRuntimeLifecycle({
|
|
41762
|
-
authEnvResolver,
|
|
41763
41204
|
dataDir,
|
|
41764
41205
|
onMcpServerStartError: (error51) => {
|
|
41765
41206
|
console.error("[fleet-console] Failed to start MCP server", error51);
|
|
@@ -41785,7 +41226,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
41785
41226
|
const unsubscribeStream = runtime.carrierRuntime.jobs.streaming.register((event) => {
|
|
41786
41227
|
const sessionId = resolveCarrierEventOrigin(event, jobOriginById);
|
|
41787
41228
|
if (!sessionId) return;
|
|
41788
|
-
observability.appendTerminalRuntimeEvent(sessionId, event);
|
|
41229
|
+
observability.appendTerminalRuntimeEvent(sessionId, withSignatureCli(event, runtime.carrierRuntime.registry));
|
|
41789
41230
|
});
|
|
41790
41231
|
const unsubscribeReminder = createCarrierResultReminderRouter({
|
|
41791
41232
|
streamRegister: runtime.carrierRuntime.jobs.streaming.register,
|
|
@@ -41801,6 +41242,16 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
41801
41242
|
const unsubscribeRename = ctx.host.events.subscribe(OPERATION_RENAMED_EVENT_CHANNEL, (payload) => {
|
|
41802
41243
|
if (!isOperationRenamedEvent(payload)) return;
|
|
41803
41244
|
if (payload.pluginId !== TERMINAL_PLUGIN_ID || payload.type !== AGENT_OPERATION_TYPE) return;
|
|
41245
|
+
const updated = observability.renameTerminalSession(payload.operationId, payload.title);
|
|
41246
|
+
if (updated) {
|
|
41247
|
+
observability.notifySessionUpdated(updated);
|
|
41248
|
+
const operation = ctx.host.operations.get(payload.operationId);
|
|
41249
|
+
if (operation) {
|
|
41250
|
+
const cwd = readPayloadString(operation.payload, "cwd") || ctx.host.paths.resolveTheaterPath(operation.theaterId) || "";
|
|
41251
|
+
const providerSession = readProviderSession(operation.payload);
|
|
41252
|
+
ctx.host.operations.patch(payload.operationId, { title: updated.label ?? updated.cwdLabel, payload: toOperationPayload(cwd, updated, providerSession) });
|
|
41253
|
+
}
|
|
41254
|
+
}
|
|
41804
41255
|
injectRenameCommand(payload.operationId, payload.title);
|
|
41805
41256
|
});
|
|
41806
41257
|
rehydrateDormantAgentOperations();
|
|
@@ -41926,24 +41377,6 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
41926
41377
|
ctx.host.http.writeJson(res, 200, { ok: true });
|
|
41927
41378
|
return true;
|
|
41928
41379
|
}
|
|
41929
|
-
if (req.method === "PATCH") {
|
|
41930
|
-
const body = await ctx.host.http.readJsonBody(req);
|
|
41931
|
-
if (!body || body.label !== void 0 && typeof body.label !== "string") {
|
|
41932
|
-
ctx.host.http.writeJson(res, 400, { error: "invalid_session_label" });
|
|
41933
|
-
return true;
|
|
41934
|
-
}
|
|
41935
|
-
const updated = observability.renameTerminalSession(sessionId, body.label ?? "");
|
|
41936
|
-
if (!updated) {
|
|
41937
|
-
ctx.host.http.writeJson(res, 404, { error: "session_not_found" });
|
|
41938
|
-
return true;
|
|
41939
|
-
}
|
|
41940
|
-
observability.notifySessionUpdated(updated);
|
|
41941
|
-
const renamedCwd = readPayloadString(ctx.host.operations.get(sessionId)?.payload ?? {}, "cwd") ?? updated.cwdLabel;
|
|
41942
|
-
ctx.host.operations.patch(sessionId, { title: updated.label ?? path27__default.basename(renamedCwd) });
|
|
41943
|
-
injectRenameCommand(sessionId, updated.label);
|
|
41944
|
-
ctx.host.http.writeJson(res, 200, updated);
|
|
41945
|
-
return true;
|
|
41946
|
-
}
|
|
41947
41380
|
return methodNotAllowed(res);
|
|
41948
41381
|
}
|
|
41949
41382
|
async function createSession(cwd, theaterId, cliId, res) {
|
|
@@ -42107,11 +41540,8 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
42107
41540
|
if ((process4.env.FLEET_TERMINAL_CMD ?? "").trim().length > 0) {
|
|
42108
41541
|
return metadata.map((meta3) => ({ id: meta3.id, label: meta3.label, available: true, signedIn: true }));
|
|
42109
41542
|
}
|
|
42110
|
-
const
|
|
42111
|
-
|
|
42112
|
-
buildModelAuthState(deps.authService)
|
|
42113
|
-
]);
|
|
42114
|
-
return combineAgentCliLaunchMetadata(metadata, detected, modelAuth.providers);
|
|
41543
|
+
const detected = await detector.detect();
|
|
41544
|
+
return combineAgentCliLaunchMetadata(metadata, detected, []);
|
|
42115
41545
|
}
|
|
42116
41546
|
async function buildLaunchKinds() {
|
|
42117
41547
|
const metadata = await buildAgentCliLaunchMetadata();
|
|
@@ -42271,135 +41701,14 @@ function readHookPrompt(value) {
|
|
|
42271
41701
|
return void 0;
|
|
42272
41702
|
}
|
|
42273
41703
|
}
|
|
42274
|
-
|
|
42275
|
-
|
|
42276
|
-
|
|
42277
|
-
|
|
42278
|
-
|
|
42279
|
-
|
|
42280
|
-
|
|
42281
|
-
}
|
|
42282
|
-
}
|
|
42283
|
-
function createTerminalModelAuthRouter(ctx, deps) {
|
|
42284
|
-
return async function handleTerminalModelAuthRoute({ req, res, pathname }) {
|
|
42285
|
-
const path42 = pathname.slice(`${ctx.basePath}/model-auth`.length) || "/";
|
|
42286
|
-
if (path42 === "/state") {
|
|
42287
|
-
if (req.method !== "GET") {
|
|
42288
|
-
ctx.host.http.writeJson(res, 405, { error: "Method not allowed" });
|
|
42289
|
-
return true;
|
|
42290
|
-
}
|
|
42291
|
-
ctx.host.http.writeJson(res, 200, await buildModelAuthState(deps.authService));
|
|
42292
|
-
return true;
|
|
42293
|
-
}
|
|
42294
|
-
const cli = parseProviderPath(path42);
|
|
42295
|
-
if (!cli) return false;
|
|
42296
|
-
const provider = await findProvider(deps, cli);
|
|
42297
|
-
if (!provider) {
|
|
42298
|
-
ctx.host.http.writeJson(res, 404, { error: "provider_not_found" });
|
|
42299
|
-
return true;
|
|
42300
|
-
}
|
|
42301
|
-
if (req.method === "PUT") {
|
|
42302
|
-
await signInProvider(ctx, req, res, deps, provider);
|
|
42303
|
-
return true;
|
|
42304
|
-
}
|
|
42305
|
-
if (req.method === "DELETE") {
|
|
42306
|
-
await signOutProvider(ctx, req, res, deps, provider);
|
|
42307
|
-
return true;
|
|
42308
|
-
}
|
|
42309
|
-
ctx.host.http.writeJson(res, 405, { error: "Method not allowed" });
|
|
42310
|
-
return true;
|
|
42311
|
-
};
|
|
42312
|
-
}
|
|
42313
|
-
async function signInProvider(ctx, req, res, deps, provider) {
|
|
42314
|
-
if (!ctx.host.security.isTerminalAuthorized(req)) {
|
|
42315
|
-
ctx.host.http.writeJson(res, 401, { error: "unauthorized" });
|
|
42316
|
-
return;
|
|
42317
|
-
}
|
|
42318
|
-
if (!isJsonRequest(req)) {
|
|
42319
|
-
ctx.host.http.writeJson(res, 415, { error: "unsupported_media_type" });
|
|
42320
|
-
return;
|
|
42321
|
-
}
|
|
42322
|
-
const body = await ctx.host.http.readJsonBody(req);
|
|
42323
|
-
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
42324
|
-
ctx.host.http.writeJson(res, 400, { error: "invalid_json" });
|
|
42325
|
-
return;
|
|
42326
|
-
}
|
|
42327
|
-
if (Object.keys(body).length !== 1 || typeof body.apiKey !== "string") {
|
|
42328
|
-
ctx.host.http.writeJson(res, 400, { error: "invalid_api_key" });
|
|
42329
|
-
return;
|
|
42330
|
-
}
|
|
42331
|
-
const apiKey = body.apiKey.trim();
|
|
42332
|
-
if (apiKey.length === 0) {
|
|
42333
|
-
ctx.host.http.writeJson(res, 400, { error: "invalid_api_key" });
|
|
42334
|
-
return;
|
|
42335
|
-
}
|
|
42336
|
-
const providerId = CLI_TO_AUTH_PROVIDER_ID[provider.cli];
|
|
42337
|
-
if (!providerId) {
|
|
42338
|
-
ctx.host.http.writeJson(res, 500, { error: "provider_unavailable" });
|
|
42339
|
-
return;
|
|
42340
|
-
}
|
|
42341
|
-
const validation = await deps.validateApiKey(provider.cli, apiKey);
|
|
42342
|
-
if (validation.status !== "success") {
|
|
42343
|
-
const status = UPSTREAM_FAILURE_STATUSES.has(validation.status) ? 502 : 400;
|
|
42344
|
-
ctx.host.http.writeJson(res, status, {
|
|
42345
|
-
error: formatSignInFailureMessage(provider.displayName, validation.status),
|
|
42346
|
-
status: validation.status
|
|
42347
|
-
});
|
|
42348
|
-
return;
|
|
42349
|
-
}
|
|
42350
|
-
await deps.authService.setApiKey(providerId, apiKey);
|
|
42351
|
-
await writeMutationState(ctx, res, deps);
|
|
42352
|
-
}
|
|
42353
|
-
async function signOutProvider(ctx, req, res, deps, provider) {
|
|
42354
|
-
if (!ctx.host.security.isTerminalAuthorized(req)) {
|
|
42355
|
-
ctx.host.http.writeJson(res, 401, { error: "unauthorized" });
|
|
42356
|
-
return;
|
|
42357
|
-
}
|
|
42358
|
-
const providerId = CLI_TO_AUTH_PROVIDER_ID[provider.cli];
|
|
42359
|
-
if (!providerId) {
|
|
42360
|
-
ctx.host.http.writeJson(res, 500, { error: "provider_unavailable" });
|
|
42361
|
-
return;
|
|
42362
|
-
}
|
|
42363
|
-
await deps.authService.deleteApiKey(providerId);
|
|
42364
|
-
await writeMutationState(ctx, res, deps);
|
|
42365
|
-
}
|
|
42366
|
-
async function writeMutationState(ctx, res, deps) {
|
|
42367
|
-
ctx.host.http.writeJson(res, 200, { state: await buildModelAuthState(deps.authService) });
|
|
42368
|
-
}
|
|
42369
|
-
async function findProvider(deps, cli) {
|
|
42370
|
-
return (await buildModelAuthState(deps.authService)).providers.find((provider) => provider.cli === cli) ?? null;
|
|
42371
|
-
}
|
|
42372
|
-
function parseProviderPath(path42) {
|
|
42373
|
-
const parts = path42.split("/").filter(Boolean);
|
|
42374
|
-
if (parts.length !== 2 || parts[0] !== "providers") return null;
|
|
42375
|
-
return safeDecodeURIComponent(parts[1] ?? "");
|
|
42376
|
-
}
|
|
42377
|
-
function safeDecodeURIComponent(value) {
|
|
42378
|
-
try {
|
|
42379
|
-
return decodeURIComponent(value);
|
|
42380
|
-
} catch {
|
|
42381
|
-
return null;
|
|
42382
|
-
}
|
|
42383
|
-
}
|
|
42384
|
-
function isJsonRequest(req) {
|
|
42385
|
-
const contentType = req.headers["content-type"];
|
|
42386
|
-
return typeof contentType === "string" && contentType.toLowerCase().split(";")[0]?.trim() === "application/json";
|
|
42387
|
-
}
|
|
42388
|
-
function formatSignInFailureMessage(displayName, status) {
|
|
42389
|
-
switch (status) {
|
|
42390
|
-
case "unauthorized":
|
|
42391
|
-
return `${displayName} rejected the API key. Check the key and try again.`;
|
|
42392
|
-
case "forbidden":
|
|
42393
|
-
return `The API key is not allowed for ${displayName}. Check its permissions.`;
|
|
42394
|
-
case "timeout":
|
|
42395
|
-
return `Validating the ${displayName} API key timed out. Check your connection and try again.`;
|
|
42396
|
-
case "network":
|
|
42397
|
-
return `Could not reach ${displayName} to validate the API key. Check your connection and try again.`;
|
|
42398
|
-
case "server":
|
|
42399
|
-
return `${displayName} returned an error while validating the API key. Try again later.`;
|
|
42400
|
-
default:
|
|
42401
|
-
return `Could not validate the ${displayName} API key. Check the key and try again.`;
|
|
42402
|
-
}
|
|
41704
|
+
function withSignatureCli(event, registry3) {
|
|
41705
|
+
if (typeof event !== "object" || event === null) return event;
|
|
41706
|
+
const obj = event;
|
|
41707
|
+
if (obj.type !== "job:registered" || typeof obj.ownerCarrierId !== "string") return event;
|
|
41708
|
+
const config2 = getCarrierConfig(registry3, obj.ownerCarrierId);
|
|
41709
|
+
if (!config2) return event;
|
|
41710
|
+
const signatureCli = resolveAgentCliType2(obj.ownerCarrierId, config2.defaultCliType);
|
|
41711
|
+
return { ...obj, signatureCli };
|
|
42403
41712
|
}
|
|
42404
41713
|
|
|
42405
41714
|
// ../fleet-plugins/terminal/server/settings-routes.ts
|
|
@@ -42414,7 +41723,7 @@ function registerTerminalSettingsRoutes(ctx, deps) {
|
|
|
42414
41723
|
ctx.host.http.writeJson(res, 401, { error: "unauthorized" });
|
|
42415
41724
|
return true;
|
|
42416
41725
|
}
|
|
42417
|
-
if (!
|
|
41726
|
+
if (!isJsonRequest(req)) {
|
|
42418
41727
|
ctx.host.http.writeJson(res, 415, { error: "unsupported_media_type" });
|
|
42419
41728
|
return true;
|
|
42420
41729
|
}
|
|
@@ -42447,7 +41756,7 @@ function isTerminalSettingsBody(value) {
|
|
|
42447
41756
|
const body = value;
|
|
42448
41757
|
return typeof body.replaceSystemPrompt === "boolean" && typeof body.enableMetaphor === "boolean";
|
|
42449
41758
|
}
|
|
42450
|
-
function
|
|
41759
|
+
function isJsonRequest(req) {
|
|
42451
41760
|
const contentType = req.headers["content-type"];
|
|
42452
41761
|
return typeof contentType === "string" && contentType.toLowerCase().split(";")[0]?.trim() === "application/json";
|
|
42453
41762
|
}
|
|
@@ -42538,9 +41847,7 @@ var routes_default = definePlugin({
|
|
|
42538
41847
|
ctx.host.lifecycle.registerCleanup(unsubscribeDelete);
|
|
42539
41848
|
registerShellRoutes(ctx, runtime);
|
|
42540
41849
|
registerTerminalSettingsRoutes(ctx, { globalOptionsService: infraServices.globalOptionsService });
|
|
42541
|
-
registerTerminalModelAuthRoutes(ctx, { authService: infraServices.authService });
|
|
42542
41850
|
const agentLaunchKinds = registerAgentRoutes(ctx, runtime, {
|
|
42543
|
-
authService: infraServices.authService,
|
|
42544
41851
|
globalOptionsService: infraServices.globalOptionsService
|
|
42545
41852
|
});
|
|
42546
41853
|
registerLaunchCatalog(ctx, async () => [...await agentLaunchKinds(), SHELL_LAUNCH_KIND]);
|