@dotobokuri/fleet-console 1.25.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +41 -18
- package/dist/client/assets/{_baseUniq-CftO_qma.js → _baseUniq-tUJy1-kT.js} +1 -1
- package/dist/client/assets/{arc-CIUNumHO.js → arc-CGw4Qvmn.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-TpVISJv_.js → architectureDiagram-Q4EWVU46-2k-upKST.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-iHi0B0P6.js → blockDiagram-DXYQGD6D-B6tV45QW.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CYAcFDrF.js → c4Diagram-AHTNJAMY-Cvz-gvmw.js} +1 -1
- package/dist/client/assets/channel-CwKYdtaM.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-B3Nh-xBT.js → chunk-4BX2VUAB-D1HAKsna.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CDbmqVYQ.js → chunk-4TB4RGXK-CPQ1WwIY.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DRXIVd03.js → chunk-55IACEB6-EBDrBpcM.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-b05C0dVN.js → chunk-EDXVE4YY-DXkVIMxQ.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-ByrEd9CG.js → chunk-FMBD7UC4-Hh-pXKlX.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-BpEVT-V-.js → chunk-OYMX7WX6-BTKoQCZt.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CfdhAAA9.js → chunk-QZHKN3VN-t_NFg8Nt.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-Fdx8QRTs.js → chunk-YZCP3GAM-CbbNY-Y7.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-BMulJ6hF.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-BMulJ6hF.js +1 -0
- package/dist/client/assets/clone-D76WC0Bz.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-D8w9KovE.js → cose-bilkent-S5V4N54A-ClR8SWe0.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-D4fw7rTF.js → dagre-KV5264BT-CkHFxgvb.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-BRFcBwDM.js → diagram-5BDNPKRD-sq8RZZQY.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BKzuEau8.js → diagram-G4DWMVQ6-C6HCLzDf.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DkqP7aZ4.js → diagram-MMDJMWI5-BI9jyS0c.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-NelXGAN3.js → diagram-TYMM5635-BfWdzF7z.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-DHH5btR9.js → erDiagram-SMLLAGMA-Cw8mj3en.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-BmqHUJoi.js → flowDiagram-DWJPFMVM-DXiFqtKz.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-BtmWEvNP.js → ganttDiagram-T4ZO3ILL-CFNR4A1x.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-B64kk9Nb.js → gitGraphDiagram-UUTBAWPF-vYNjJsh8.js} +1 -1
- package/dist/client/assets/{graph-CEjP0hvY.js → graph-CGkhzltD.js} +1 -1
- package/dist/client/assets/index-BmhFrtGr.css +1 -0
- package/dist/client/assets/index-CZYuPH8_.js +395 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-CaTXrw5R.js → infoDiagram-42DDH7IO-C4lcu1mS.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-D9-Ds_71.js → ishikawaDiagram-UXIWVN3A-D2E79gEK.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-Cv4qWOhs.js → journeyDiagram-VCZTEJTY-CMJAA45g.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-CWBLcIpD.js → kanban-definition-6JOO6SKY-BYnBQou2.js} +1 -1
- package/dist/client/assets/{layout-D8eNRDnf.js → layout-CyfFEQ40.js} +1 -1
- package/dist/client/assets/{linear-lDifS_HV.js → linear-C2wjQAuy.js} +1 -1
- package/dist/client/assets/{mermaid.core-DcGkHMSR.js → mermaid.core-CKMZH6J-.js} +4 -4
- package/dist/client/assets/{min-Dz_jFvYt.js → min-B0B_lTwc.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-F3RmDOG-.js → mindmap-definition-QFDTVHPH-DDP_qkv3.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B1fDKBcl.js → pieDiagram-DEJITSTG-Cknm2rtj.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D93hlO3O.js → quadrantDiagram-34T5L4WZ-DZARSnQm.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-B4wj4AQL.js → requirementDiagram-MS252O5E-Bm_GIARG.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZRwx77Xd.js → sankeyDiagram-XADWPNL6-BUCr78fU.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-COMMRNyM.js → sequenceDiagram-FGHM5R23-Coq-jYr8.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-CpBccMyi.js → stateDiagram-FHFEXIEX-CIZCg5tw.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-I40ud2eo.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-C44EI_-o.js → timeline-definition-GMOUNBTQ-CxRr-mP_.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-BiBJbCdD.js → vennDiagram-DHZGUBPP-CWWV2O4a.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-Dm5-kWNd.js → wardley-RL74JXVD-CwkNZigV.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BjbesihY.js → wardleyDiagram-NUSXRM2D-CMF3BkPH.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-5P6xhAMr.js → xychartDiagram-5P7HB3ND-C1MudNRb.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/file-explorer/routes.mjs +1 -1
- package/dist/fleet-plugins/terminal/routes.mjs +370 -513
- package/package.json +1 -1
- package/dist/client/assets/channel-B-2UBgQ_.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DiaCSZq-.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DiaCSZq-.js +0 -1
- package/dist/client/assets/clone-Dq4F-r1q.js +0 -1
- package/dist/client/assets/index-B3gs6ohi.js +0 -380
- package/dist/client/assets/index-DDfl_vPx.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-UCYrbaKP.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as fs2 from 'fs';
|
|
3
3
|
import fs2__default, { existsSync, readFileSync, accessSync, constants, mkdtempSync, writeFileSync, mkdirSync, rmSync, chmodSync, renameSync, readdirSync, openSync, closeSync, realpathSync, fstatSync, lstatSync, unlinkSync, statSync } from 'fs';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as path28 from 'path';
|
|
5
|
+
import path28__default, { dirname } from 'path';
|
|
6
6
|
import * as os3 from 'os';
|
|
7
7
|
import os3__default, { homedir } from 'os';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import crypto3, { randomUUID, createHash } from 'crypto';
|
|
9
|
+
import process4 from 'process';
|
|
10
10
|
import { EventEmitter } from 'events';
|
|
11
11
|
import { mkdir, writeFile, access, readFile, stat, readdir, appendFile, rename, rm } from 'fs/promises';
|
|
12
12
|
import { execFile, spawn, execSync, spawnSync } from 'child_process';
|
|
@@ -40,7 +40,7 @@ function normalizePath(path44) {
|
|
|
40
40
|
}
|
|
41
41
|
var FLEET_DATA_DIR_NAME = ".fleet";
|
|
42
42
|
function getFleetDataDir() {
|
|
43
|
-
return
|
|
43
|
+
return path28.join(os3.homedir(), FLEET_DATA_DIR_NAME);
|
|
44
44
|
}
|
|
45
45
|
var SECURE_DIR_MODE = 448;
|
|
46
46
|
var SECURE_FILE_MODE = 384;
|
|
@@ -128,7 +128,7 @@ function cleanupTempFiles(dir, prefix, minAgeMs, now) {
|
|
|
128
128
|
if (!entry.startsWith(prefix)) {
|
|
129
129
|
continue;
|
|
130
130
|
}
|
|
131
|
-
const tempPath =
|
|
131
|
+
const tempPath = path28.join(dir, entry);
|
|
132
132
|
try {
|
|
133
133
|
const stat3 = fs2.lstatSync(tempPath);
|
|
134
134
|
if (stat3?.isFile() && !stat3.isSymbolicLink() && now - stat3.mtimeMs >= minAgeMs) {
|
|
@@ -234,7 +234,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
|
|
|
234
234
|
hostname: os3.hostname(),
|
|
235
235
|
startedAt
|
|
236
236
|
};
|
|
237
|
-
const ownerPath =
|
|
237
|
+
const ownerPath = path28.join(lockDir, ownerFileName);
|
|
238
238
|
try {
|
|
239
239
|
fs2.writeFileSync(ownerPath, JSON.stringify(owner), { encoding: "utf-8", mode: 384 });
|
|
240
240
|
} catch (error51) {
|
|
@@ -243,7 +243,7 @@ function writeLockOwner(lockDir, ownerFileName, startedAt) {
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
function readLockOwner(lockDir, ownerFileName) {
|
|
246
|
-
const ownerPath =
|
|
246
|
+
const ownerPath = path28.join(lockDir, ownerFileName);
|
|
247
247
|
try {
|
|
248
248
|
return sanitizeLockOwner(JSON.parse(fs2.readFileSync(ownerPath, "utf-8")));
|
|
249
249
|
} catch (error51) {
|
|
@@ -320,7 +320,7 @@ function readAuthStoreFile(filePath) {
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
// ../../packages/core-infra/src/auth/auth-storage.ts
|
|
323
|
-
var DEFAULT_AUTH_PATH =
|
|
323
|
+
var DEFAULT_AUTH_PATH = path28.join(getFleetDataDir(), "auth.json");
|
|
324
324
|
var AUTH_LOCK_OWNER_FILE_NAME = "owner.json";
|
|
325
325
|
var AUTH_LOCK_TIMEOUT_MS = 5e3;
|
|
326
326
|
function createAuthService(deps = {}) {
|
|
@@ -376,7 +376,7 @@ function createAuthService(deps = {}) {
|
|
|
376
376
|
}
|
|
377
377
|
},
|
|
378
378
|
async setApiKey(providerId, key) {
|
|
379
|
-
const dir =
|
|
379
|
+
const dir = path28.dirname(authPath);
|
|
380
380
|
ensureSafeDirectory(dir);
|
|
381
381
|
withAuthLock(authPath, lockDir, () => {
|
|
382
382
|
const data = fs2.existsSync(authPath) ? readAuthStoreFile(authPath) : {};
|
|
@@ -411,7 +411,7 @@ function createDurableJsonStore(deps) {
|
|
|
411
411
|
const now = deps.now ?? (() => Date.now());
|
|
412
412
|
const mode = SECURE_FILE_MODE ;
|
|
413
413
|
const minAgeMs = deps.tempCleanupMinAgeMs ?? DEFAULT_TEMP_FILE_MIN_AGE_MS;
|
|
414
|
-
const dir =
|
|
414
|
+
const dir = path28.dirname(deps.filePath);
|
|
415
415
|
return {
|
|
416
416
|
path: deps.filePath,
|
|
417
417
|
load() {
|
|
@@ -495,8 +495,8 @@ var LOCK_OWNER_FILE_NAME = "owner";
|
|
|
495
495
|
var TEMP_FILE_PREFIX = `.tmp-${GLOBAL_OPTIONS_FILE_NAME}-`;
|
|
496
496
|
function createGlobalOptionsStore(deps = {}) {
|
|
497
497
|
const dataDir = deps.dataDir ?? getFleetDataDir();
|
|
498
|
-
const optionsPath =
|
|
499
|
-
const lockDir =
|
|
498
|
+
const optionsPath = path28.join(dataDir, GLOBAL_OPTIONS_FILE_NAME);
|
|
499
|
+
const lockDir = path28.join(dataDir, LOCK_DIR_NAME);
|
|
500
500
|
const store2 = createDurableJsonStore({
|
|
501
501
|
filePath: optionsPath,
|
|
502
502
|
lockDir,
|
|
@@ -18884,7 +18884,7 @@ function createChildEnv(env, overlay) {
|
|
|
18884
18884
|
return child;
|
|
18885
18885
|
}
|
|
18886
18886
|
function wrapWindowsShim(resolved, env, platform) {
|
|
18887
|
-
if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(
|
|
18887
|
+
if (platform !== "win32" || !WINDOWS_SHIM_EXTENSIONS.has(path28__default.extname(resolved).toLowerCase())) {
|
|
18888
18888
|
return { bin: resolved, prefixArgs: [] };
|
|
18889
18889
|
}
|
|
18890
18890
|
rejectCmdExpansionSensitiveShim(resolved);
|
|
@@ -18902,13 +18902,13 @@ function forceWindowsArgQuoting(value) {
|
|
|
18902
18902
|
return `${value} `;
|
|
18903
18903
|
}
|
|
18904
18904
|
function findOnPath(bin, pathValue, pathExts, platform) {
|
|
18905
|
-
const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR :
|
|
18906
|
-
if (hasPathSeparator(bin, platform) ||
|
|
18905
|
+
const pathSeparator = platform === "win32" ? WINDOWS_PATH_SEPARATOR : path28__default.delimiter;
|
|
18906
|
+
if (hasPathSeparator(bin, platform) || path28__default.isAbsolute(bin)) {
|
|
18907
18907
|
return resolveWithExtensions(bin, pathExts, platform);
|
|
18908
18908
|
}
|
|
18909
18909
|
for (const entry of pathValue.split(pathSeparator)) {
|
|
18910
18910
|
const searchDir = entry.length === 0 ? "." : entry;
|
|
18911
|
-
const candidate = resolveWithExtensions(
|
|
18911
|
+
const candidate = resolveWithExtensions(path28__default.join(searchDir, bin), pathExts, platform);
|
|
18912
18912
|
if (candidate) {
|
|
18913
18913
|
return candidate;
|
|
18914
18914
|
}
|
|
@@ -18916,7 +18916,7 @@ function findOnPath(bin, pathValue, pathExts, platform) {
|
|
|
18916
18916
|
return void 0;
|
|
18917
18917
|
}
|
|
18918
18918
|
function resolveWithExtensions(candidate, pathExts, platform) {
|
|
18919
|
-
if (platform !== "win32" ||
|
|
18919
|
+
if (platform !== "win32" || path28__default.extname(candidate).length > 0) {
|
|
18920
18920
|
return isAccessibleExecutable(candidate, platform) ? candidate : void 0;
|
|
18921
18921
|
}
|
|
18922
18922
|
for (const ext of pathExts) {
|
|
@@ -21662,12 +21662,12 @@ var CodexAppServerConnection = class extends BaseConnection {
|
|
|
21662
21662
|
);
|
|
21663
21663
|
}
|
|
21664
21664
|
findRolloutPathForThreadId(threadId) {
|
|
21665
|
-
const codexHome = this.codexHome ?? this.env.CODEX_HOME ??
|
|
21665
|
+
const codexHome = this.codexHome ?? this.env.CODEX_HOME ?? path28.join(this.env.HOME ?? "", ".codex");
|
|
21666
21666
|
if (!codexHome) {
|
|
21667
21667
|
return null;
|
|
21668
21668
|
}
|
|
21669
21669
|
for (const rootName of ["sessions", "archived_sessions"]) {
|
|
21670
|
-
const found = findRolloutPath(
|
|
21670
|
+
const found = findRolloutPath(path28.join(codexHome, rootName), threadId);
|
|
21671
21671
|
if (found) {
|
|
21672
21672
|
return found;
|
|
21673
21673
|
}
|
|
@@ -21778,7 +21778,7 @@ function findRolloutPath(root, threadId) {
|
|
|
21778
21778
|
return null;
|
|
21779
21779
|
}
|
|
21780
21780
|
for (const entry of fs2.readdirSync(root, { withFileTypes: true })) {
|
|
21781
|
-
const entryPath =
|
|
21781
|
+
const entryPath = path28.join(root, entry.name);
|
|
21782
21782
|
if (entry.isDirectory()) {
|
|
21783
21783
|
const found = findRolloutPath(entryPath, threadId);
|
|
21784
21784
|
if (found) {
|
|
@@ -23498,7 +23498,7 @@ function readRawCarriersOrDefaultStore() {
|
|
|
23498
23498
|
return readCarriers();
|
|
23499
23499
|
}
|
|
23500
23500
|
function getCarriersFilePath() {
|
|
23501
|
-
return
|
|
23501
|
+
return path28.join(resolveStoreDir(), FILENAME);
|
|
23502
23502
|
}
|
|
23503
23503
|
function updateCarriers(mutator) {
|
|
23504
23504
|
withStoreLock(() => {
|
|
@@ -23512,7 +23512,7 @@ function updateCarriers(mutator) {
|
|
|
23512
23512
|
function withStoreLock(operation) {
|
|
23513
23513
|
const dir = resolveStoreDir();
|
|
23514
23514
|
ensureSafeDirectory(dir);
|
|
23515
|
-
const lockDir =
|
|
23515
|
+
const lockDir = path28.join(dir, LOCK_DIRNAME);
|
|
23516
23516
|
return withDirectoryLock(
|
|
23517
23517
|
{ lockDir, ownerFileName: LOCK_OWNER_FILENAME },
|
|
23518
23518
|
operation
|
|
@@ -23525,7 +23525,7 @@ function readCarriers() {
|
|
|
23525
23525
|
return readCarriersFromDir(resolveStoreDir());
|
|
23526
23526
|
}
|
|
23527
23527
|
function readCarriersFromDir(dir) {
|
|
23528
|
-
const filePath =
|
|
23528
|
+
const filePath = path28.join(dir, FILENAME);
|
|
23529
23529
|
let fd;
|
|
23530
23530
|
try {
|
|
23531
23531
|
const stat3 = fs2.lstatSync(filePath);
|
|
@@ -23554,7 +23554,7 @@ function recordLastLocalWriteFingerprint(filePath, generation) {
|
|
|
23554
23554
|
}
|
|
23555
23555
|
function writeCarriers(s) {
|
|
23556
23556
|
const dir = resolveStoreDir();
|
|
23557
|
-
const filePath =
|
|
23557
|
+
const filePath = path28.join(dir, FILENAME);
|
|
23558
23558
|
const next = serializeFleetCarriers(s);
|
|
23559
23559
|
writeAtomicSync(filePath, `${JSON.stringify(next, null, 2)}
|
|
23560
23560
|
`, { fsync: false, mode: 420 });
|
|
@@ -23579,7 +23579,7 @@ function sanitizeFleetCarriers(value) {
|
|
|
23579
23579
|
}
|
|
23580
23580
|
function unlinkStaleSubagentModeFile(dir) {
|
|
23581
23581
|
try {
|
|
23582
|
-
fs2.unlinkSync(
|
|
23582
|
+
fs2.unlinkSync(path28.join(dir, STALE_SUBAGENT_MODE_FILENAME));
|
|
23583
23583
|
} catch {
|
|
23584
23584
|
}
|
|
23585
23585
|
}
|
|
@@ -24783,14 +24783,14 @@ var DispatchContextRegistry = class {
|
|
|
24783
24783
|
}
|
|
24784
24784
|
};
|
|
24785
24785
|
function normalizeBinding(input) {
|
|
24786
|
-
if (!
|
|
24786
|
+
if (!path28__default.isAbsolute(input.cwd)) throw new Error("Dispatch cwd must be absolute.");
|
|
24787
24787
|
const backends = [...input.backends].map((backend) => ({ cliType: backend.cliType, protocol: backend.protocol })).sort((left, right) => left.cliType.localeCompare(right.cliType));
|
|
24788
24788
|
if (backends.length === 0 || new Set(backends.map((backend) => backend.cliType)).size !== backends.length) {
|
|
24789
24789
|
throw new Error("Dispatch binding must contain each backend exactly once.");
|
|
24790
24790
|
}
|
|
24791
24791
|
return Object.freeze({
|
|
24792
24792
|
carrierId: input.carrierId,
|
|
24793
|
-
cwd:
|
|
24793
|
+
cwd: path28__default.normalize(input.cwd),
|
|
24794
24794
|
shape: input.shape,
|
|
24795
24795
|
backends: Object.freeze(backends)
|
|
24796
24796
|
});
|
|
@@ -30588,7 +30588,7 @@ function specToMcpTool(spec) {
|
|
|
30588
30588
|
}
|
|
30589
30589
|
function installExecutorToolCallRouter(runtime, sessionToken, ctx) {
|
|
30590
30590
|
runtime.server.setOnToolCallArrived(sessionToken, (toolName, args) => {
|
|
30591
|
-
const toolCallId =
|
|
30591
|
+
const toolCallId = crypto3.randomUUID();
|
|
30592
30592
|
void runtime.registry.invoke(toolName, args, { cwd: ctx.cwd, sessionLabel: ctx.sessionLabel, toolCallId, signal: ctx.signal }).then((result) => runtime.server.resolveNextToolCall(sessionToken, toolCallId, result)).catch((err) => {
|
|
30593
30593
|
runtime.server.resolveNextToolCall(sessionToken, toolCallId, {
|
|
30594
30594
|
content: [{ type: "text", text: err instanceof Error ? err.message : String(err) }],
|
|
@@ -30976,7 +30976,7 @@ function createInProcessMcpServer(deps = {}) {
|
|
|
30976
30976
|
if (activeStopPromise) await activeStopPromise;
|
|
30977
30977
|
if (activeServer && activeServerUrl) return activeServerUrl;
|
|
30978
30978
|
if (activeStartPromise) return activeStartPromise;
|
|
30979
|
-
activeOpaquePath = `/${
|
|
30979
|
+
activeOpaquePath = `/${crypto3.randomUUID()}`;
|
|
30980
30980
|
activeStartPromise = new Promise((resolve2, reject) => {
|
|
30981
30981
|
const srv = http.createServer(handleRequest);
|
|
30982
30982
|
srv.timeout = MCP_SERVER_TIMEOUT_MS;
|
|
@@ -31233,7 +31233,7 @@ function createExecutorMcpSession(deps, toolTimeoutSeconds, request) {
|
|
|
31233
31233
|
throw new Error("Executor session cwd is required");
|
|
31234
31234
|
}
|
|
31235
31235
|
assertNonEmptyExecutorTools(request.serverName, request.specs);
|
|
31236
|
-
const token =
|
|
31236
|
+
const token = crypto3.randomUUID();
|
|
31237
31237
|
registerExecutorSessionTools(runtime.runtime, token, [...request.specs]);
|
|
31238
31238
|
installExecutorToolCallRouter(runtime.runtime, token, {
|
|
31239
31239
|
cwd,
|
|
@@ -31271,7 +31271,7 @@ function issueSessionToken(deps, sessionTokensByLabel, request) {
|
|
|
31271
31271
|
for (const { name, runtime } of deps.runtimes) {
|
|
31272
31272
|
const tools = runtime.registry.getAllAgentTools();
|
|
31273
31273
|
assertNonEmptyExecutorTools(name, tools);
|
|
31274
|
-
const token =
|
|
31274
|
+
const token = crypto3.randomUUID();
|
|
31275
31275
|
registerExecutorSessionTools(runtime, token, tools);
|
|
31276
31276
|
installExecutorToolCallRouter(runtime, token, { cwd, sessionLabel: label, signal: request.signal });
|
|
31277
31277
|
tokens.push({ name, token });
|
|
@@ -32705,7 +32705,7 @@ function resolveDispatchCwd(rawCwd, fallbackCwd) {
|
|
|
32705
32705
|
if (rawCwd === void 0) return { ok: true, cwd: fallbackCwd };
|
|
32706
32706
|
const trimmed = rawCwd.trim();
|
|
32707
32707
|
if (trimmed.length === 0) return { ok: true, cwd: fallbackCwd };
|
|
32708
|
-
if (!
|
|
32708
|
+
if (!path28__default.isAbsolute(trimmed)) {
|
|
32709
32709
|
return {
|
|
32710
32710
|
ok: false,
|
|
32711
32711
|
error: `Invalid cwd "${rawCwd}": must be an absolute path. Provide an absolute directory or omit cwd to use the host session cwd.`
|
|
@@ -33318,7 +33318,13 @@ var codexCli = {
|
|
|
33318
33318
|
async createProfile(options) {
|
|
33319
33319
|
const { bin, prefixArgs } = resolveBinary("codex", "CODEX_BIN", options.env);
|
|
33320
33320
|
return {
|
|
33321
|
-
args: [
|
|
33321
|
+
args: [
|
|
33322
|
+
...prefixArgs,
|
|
33323
|
+
...buildResumeArgs(options.resumeSessionId),
|
|
33324
|
+
...buildCodexPlatformArgs(process.platform),
|
|
33325
|
+
"--no-alt-screen",
|
|
33326
|
+
...buildModelArgs2(options.model)
|
|
33327
|
+
],
|
|
33322
33328
|
bin,
|
|
33323
33329
|
binPrefixArgs: prefixArgs,
|
|
33324
33330
|
cwd: options.cwd,
|
|
@@ -33327,6 +33333,7 @@ var codexCli = {
|
|
|
33327
33333
|
label: "Codex",
|
|
33328
33334
|
messagePolicy: {
|
|
33329
33335
|
bracketedPaste: true,
|
|
33336
|
+
conptyPasteBurst: true,
|
|
33330
33337
|
lineTerminator: "\r",
|
|
33331
33338
|
multilineStrategy: "paste-mode"
|
|
33332
33339
|
},
|
|
@@ -33336,6 +33343,10 @@ var codexCli = {
|
|
|
33336
33343
|
};
|
|
33337
33344
|
}
|
|
33338
33345
|
};
|
|
33346
|
+
var WINDOWS_EDITOR_NEWLINE_OVERRIDE = "tui.keymap.editor.insert_newline=['ctrl-j','ctrl-m','enter','shift-enter','alt-enter','ctrl-enter']";
|
|
33347
|
+
function buildCodexPlatformArgs(platform) {
|
|
33348
|
+
return platform === "win32" ? ["-c", WINDOWS_EDITOR_NEWLINE_OVERRIDE] : [];
|
|
33349
|
+
}
|
|
33339
33350
|
function buildResumeArgs(resumeSessionId) {
|
|
33340
33351
|
return resumeSessionId === void 0 ? [] : ["resume", resumeSessionId];
|
|
33341
33352
|
}
|
|
@@ -33343,39 +33354,11 @@ function buildModelArgs2(model) {
|
|
|
33343
33354
|
return model === void 0 ? [] : ["--model", model];
|
|
33344
33355
|
}
|
|
33345
33356
|
|
|
33346
|
-
// ../../packages/fleet-admiral/src/agent-cli/cursor/cursor.ts
|
|
33347
|
-
var cursorCli = {
|
|
33348
|
-
id: "cursor",
|
|
33349
|
-
label: "Cursor",
|
|
33350
|
-
async createProfile(options) {
|
|
33351
|
-
const { bin, prefixArgs } = resolveBinary("cursor-agent", "CURSOR_AGENT_BIN", options.env);
|
|
33352
|
-
return {
|
|
33353
|
-
args: [...prefixArgs, ...buildModelArgs3(options.model)],
|
|
33354
|
-
bin,
|
|
33355
|
-
binPrefixArgs: prefixArgs,
|
|
33356
|
-
cwd: options.cwd,
|
|
33357
|
-
env: createChildEnv(options.env, {}),
|
|
33358
|
-
id: "cursor",
|
|
33359
|
-
label: "Cursor",
|
|
33360
|
-
messagePolicy: {
|
|
33361
|
-
bracketedPaste: true,
|
|
33362
|
-
lineTerminator: "\r",
|
|
33363
|
-
multilineStrategy: "paste-mode"
|
|
33364
|
-
},
|
|
33365
|
-
terminalName: "xterm-256color"
|
|
33366
|
-
};
|
|
33367
|
-
}
|
|
33368
|
-
};
|
|
33369
|
-
function buildModelArgs3(model) {
|
|
33370
|
-
return model === void 0 ? [] : ["--model", model];
|
|
33371
|
-
}
|
|
33372
|
-
|
|
33373
33357
|
// ../../packages/fleet-admiral/src/agent-cli/registry.ts
|
|
33374
33358
|
var DEFAULT_CLI_ID = "claude";
|
|
33375
33359
|
var DEFINITIONS = {
|
|
33376
33360
|
claude: claudeCli,
|
|
33377
|
-
codex: codexCli
|
|
33378
|
-
cursor: cursorCli
|
|
33361
|
+
codex: codexCli
|
|
33379
33362
|
};
|
|
33380
33363
|
async function resolveAgentCliProfile(env, cwd, options = {}) {
|
|
33381
33364
|
const id = resolveAgentCliId(env, options);
|
|
@@ -33420,10 +33403,6 @@ var AGENT_CLI_INJECTION_CAPABILITIES = {
|
|
|
33420
33403
|
codex: {
|
|
33421
33404
|
builderId: "codex-native",
|
|
33422
33405
|
enabled: true
|
|
33423
|
-
},
|
|
33424
|
-
cursor: {
|
|
33425
|
-
builderId: "cursor-native",
|
|
33426
|
-
enabled: true
|
|
33427
33406
|
}
|
|
33428
33407
|
};
|
|
33429
33408
|
function getAgentCliInjectionCapability(cliId) {
|
|
@@ -33439,7 +33418,7 @@ function createSessionCaptureHookExec(deps) {
|
|
|
33439
33418
|
deps.provider
|
|
33440
33419
|
] : [deps.entryPath, "hook", "capture-session", deps.provider];
|
|
33441
33420
|
return {
|
|
33442
|
-
command: deps.execPath ??
|
|
33421
|
+
command: deps.execPath ?? process4.execPath,
|
|
33443
33422
|
args
|
|
33444
33423
|
};
|
|
33445
33424
|
}
|
|
@@ -33478,6 +33457,8 @@ function requireSystemPromptFile(context) {
|
|
|
33478
33457
|
if (context.systemPromptFile) return context.systemPromptFile;
|
|
33479
33458
|
throw new Error("Claude system prompt file is required for native injection");
|
|
33480
33459
|
}
|
|
33460
|
+
|
|
33461
|
+
// ../../packages/fleet-admiral/src/agent-cli/builders/toml.ts
|
|
33481
33462
|
var TOML_BASIC_STRING_ESCAPE_PATTERN = /[\u0000-\u001f"\\\u007f]/g;
|
|
33482
33463
|
var TOML_MULTILINE_CONTROL_PATTERN = new RegExp("[\\u0000-\\u0008\\u000b-\\u001f\\u007f]", "g");
|
|
33483
33464
|
var TOML_MULTILINE_QUOTE_RUN_PATTERN = /"+/g;
|
|
@@ -33521,7 +33502,7 @@ function escapeTomlMultilineString(value) {
|
|
|
33521
33502
|
function buildPosixShellCommand(values) {
|
|
33522
33503
|
return values.map(posixShellQuote).join(" ");
|
|
33523
33504
|
}
|
|
33524
|
-
function buildHostShellCommand(values, platform =
|
|
33505
|
+
function buildHostShellCommand(values, platform = process.platform) {
|
|
33525
33506
|
if (platform === "win32") return values.map(windowsShellQuote).join(" ");
|
|
33526
33507
|
return buildPosixShellCommand(values);
|
|
33527
33508
|
}
|
|
@@ -33571,24 +33552,6 @@ function requireCodexProfileName(context) {
|
|
|
33571
33552
|
throw new Error("Codex profile name is required for native injection");
|
|
33572
33553
|
}
|
|
33573
33554
|
|
|
33574
|
-
// ../../packages/fleet-admiral/src/agent-cli/builders/cursor.ts
|
|
33575
|
-
function buildCursorNativeArgs(context) {
|
|
33576
|
-
return [
|
|
33577
|
-
...buildResumeArgs4(context.resumeSessionId),
|
|
33578
|
-
...context.pluginRoots.flatMap((pluginRoot) => [
|
|
33579
|
-
"--plugin-dir",
|
|
33580
|
-
pluginRoot
|
|
33581
|
-
]),
|
|
33582
|
-
"--sandbox",
|
|
33583
|
-
"disabled",
|
|
33584
|
-
"--force",
|
|
33585
|
-
...context.mcpServers.length > 0 ? ["--approve-mcps"] : []
|
|
33586
|
-
];
|
|
33587
|
-
}
|
|
33588
|
-
function buildResumeArgs4(resumeSessionId) {
|
|
33589
|
-
return resumeSessionId === void 0 ? [] : ["--resume", resumeSessionId];
|
|
33590
|
-
}
|
|
33591
|
-
|
|
33592
33555
|
// ../../packages/fleet-admiral/src/agent-cli/assets.generated.ts
|
|
33593
33556
|
var EMBEDDED_AGENT_CLI_SKILL_ASSETS = [
|
|
33594
33557
|
{ relativePath: "assumption-audit/SKILL.md", content: "---\nname: assumption-audit\ndescription: Resolve decision-shaped blocking gaps one at a time \u2014 Context Confidence gate failures during an active protocol, or pre-engagement requirements ambiguity routed by the Command Integrity Standing Order.\n---\n\nUse this auxiliary skill only when a decision-shaped blocking gap has been found: either the active protocol or Context Confidence re-entry path surfaced it, or the Command Integrity Standing Order routed a pre-engagement requirements ambiguity here before a protocol mode loads. This skill is not a protocol mode, does not replace the active protocol, and cannot declare the planning boundary passed by itself.\n\nFor each unresolved blocking gap, triage the gap before questioning:\n\n- **Scout-shaped**: the answer should come from direct file reads, focused reconnaissance, carrier scouting, or another verifiable evidence source. Send the workflow back to that evidence-gathering path instead of asking the user to decide.\n- **Decision-shaped**: the answer depends on preference, scope, risk appetite, product intent, or authority that evidence alone cannot settle. Ask exactly one question for this gap.\n- **Escalation-shaped**: the answer requires authority beyond the current operator, changes the mission boundary, repeatedly fails to resolve, or would weaken the active protocol's required gate. Escalate to the user.\n\nWhen a gap is decision-shaped, ask one question at a time. Present your recommended answer first, then give one or two concrete alternatives when useful. Walk decision dependencies one branch at a time until the current gap is resolved; do not bundle unrelated gaps into the same question.\n\nAfter the gap is answered, report the resolved decision in one short line and return control to the caller: the active protocol or Context Confidence Standing Order on re-entry, or the Protocol Gate when invoked pre-engagement. An active workflow must re-evaluate confidence and re-apply the required planning boundary gate before planning proceeds.\n" },
|
|
@@ -33612,7 +33575,7 @@ function writePrivateJson(filePath, value, rootBase) {
|
|
|
33612
33575
|
function writePrivateFile(filePath, content, rootBase) {
|
|
33613
33576
|
const resolvedBase = ensureRootBase(rootBase);
|
|
33614
33577
|
ensurePathWithinRoot(resolvedBase, filePath);
|
|
33615
|
-
ensureDirectorySegments(resolvedBase,
|
|
33578
|
+
ensureDirectorySegments(resolvedBase, path28__default.dirname(filePath));
|
|
33616
33579
|
writeFileNoFollow(filePath, content);
|
|
33617
33580
|
chmodBestEffort(filePath, FILE_MODE);
|
|
33618
33581
|
}
|
|
@@ -33659,20 +33622,20 @@ function writeFileNoFollow(filePath, content) {
|
|
|
33659
33622
|
}
|
|
33660
33623
|
}
|
|
33661
33624
|
function ensureRootBase(rootBase) {
|
|
33662
|
-
const resolvedBase =
|
|
33663
|
-
const anchor = findExistingDirectoryAnchor(
|
|
33625
|
+
const resolvedBase = path28__default.resolve(rootBase);
|
|
33626
|
+
const anchor = findExistingDirectoryAnchor(path28__default.dirname(resolvedBase));
|
|
33664
33627
|
ensureDirectorySegments(anchor, resolvedBase);
|
|
33665
33628
|
assertDirectorySafe(resolvedBase, "Plugin root base");
|
|
33666
33629
|
return resolvedBase;
|
|
33667
33630
|
}
|
|
33668
33631
|
function assertRootBaseSafe(rootBase) {
|
|
33669
|
-
const resolvedBase =
|
|
33670
|
-
assertExistingSegmentsSafe(findExistingDirectoryAnchor(
|
|
33632
|
+
const resolvedBase = path28__default.resolve(rootBase);
|
|
33633
|
+
assertExistingSegmentsSafe(findExistingDirectoryAnchor(path28__default.dirname(resolvedBase)), resolvedBase);
|
|
33671
33634
|
assertDirectorySafe(resolvedBase, "Plugin root base");
|
|
33672
33635
|
return resolvedBase;
|
|
33673
33636
|
}
|
|
33674
33637
|
function findExistingDirectoryAnchor(targetPath) {
|
|
33675
|
-
const resolvedTarget =
|
|
33638
|
+
const resolvedTarget = path28__default.resolve(targetPath);
|
|
33676
33639
|
let current = resolvedTarget;
|
|
33677
33640
|
while (true) {
|
|
33678
33641
|
try {
|
|
@@ -33680,7 +33643,7 @@ function findExistingDirectoryAnchor(targetPath) {
|
|
|
33680
33643
|
return current;
|
|
33681
33644
|
} catch (error51) {
|
|
33682
33645
|
if (error51 instanceof Error && "code" in error51 && error51.code === "ENOENT") {
|
|
33683
|
-
const parent =
|
|
33646
|
+
const parent = path28__default.dirname(current);
|
|
33684
33647
|
if (parent === current) throw error51;
|
|
33685
33648
|
current = parent;
|
|
33686
33649
|
continue;
|
|
@@ -33699,17 +33662,17 @@ function assertDirectorySafe(dirPath, label) {
|
|
|
33699
33662
|
}
|
|
33700
33663
|
}
|
|
33701
33664
|
function ensurePathWithinRoot(resolvedBase, candidatePath) {
|
|
33702
|
-
const resolvedCandidate =
|
|
33703
|
-
const relative =
|
|
33704
|
-
if (relative === "" || !relative.startsWith("..") && !
|
|
33665
|
+
const resolvedCandidate = path28__default.resolve(candidatePath);
|
|
33666
|
+
const relative = path28__default.relative(resolvedBase, resolvedCandidate);
|
|
33667
|
+
if (relative === "" || !relative.startsWith("..") && !path28__default.isAbsolute(relative)) return;
|
|
33705
33668
|
throw new Error(`Plugin path escapes root base: ${candidatePath}`);
|
|
33706
33669
|
}
|
|
33707
33670
|
function ensureDirectorySegments(resolvedBase, dirPath) {
|
|
33708
|
-
const target =
|
|
33709
|
-
const relative =
|
|
33671
|
+
const target = path28__default.resolve(dirPath);
|
|
33672
|
+
const relative = path28__default.relative(resolvedBase, target);
|
|
33710
33673
|
let current = resolvedBase;
|
|
33711
|
-
for (const segment of relative.split(
|
|
33712
|
-
current =
|
|
33674
|
+
for (const segment of relative.split(path28__default.sep).filter(Boolean)) {
|
|
33675
|
+
current = path28__default.join(current, segment);
|
|
33713
33676
|
try {
|
|
33714
33677
|
const stat3 = lstatSync(current);
|
|
33715
33678
|
if (stat3.isSymbolicLink()) {
|
|
@@ -33730,11 +33693,11 @@ function ensureDirectorySegments(resolvedBase, dirPath) {
|
|
|
33730
33693
|
}
|
|
33731
33694
|
}
|
|
33732
33695
|
function assertExistingSegmentsSafe(resolvedBase, targetPath) {
|
|
33733
|
-
const target =
|
|
33734
|
-
const relative =
|
|
33696
|
+
const target = path28__default.resolve(targetPath);
|
|
33697
|
+
const relative = path28__default.relative(resolvedBase, target);
|
|
33735
33698
|
let current = resolvedBase;
|
|
33736
|
-
for (const segment of relative.split(
|
|
33737
|
-
current =
|
|
33699
|
+
for (const segment of relative.split(path28__default.sep).filter(Boolean)) {
|
|
33700
|
+
current = path28__default.join(current, segment);
|
|
33738
33701
|
const stat3 = lstatSync(current);
|
|
33739
33702
|
if (stat3.isSymbolicLink()) {
|
|
33740
33703
|
throw new Error(`Plugin path segment is a symlink: ${current}`);
|
|
@@ -33746,67 +33709,16 @@ function assertExistingSegmentsSafe(resolvedBase, targetPath) {
|
|
|
33746
33709
|
}
|
|
33747
33710
|
}
|
|
33748
33711
|
function assertExistingParentSegmentsSafe(resolvedBase, targetPath) {
|
|
33749
|
-
assertExistingSegmentsSafe(resolvedBase,
|
|
33712
|
+
assertExistingSegmentsSafe(resolvedBase, path28__default.dirname(targetPath));
|
|
33750
33713
|
}
|
|
33751
33714
|
function assertSegmentRealpathWithinRoot(resolvedBase, segmentPath) {
|
|
33752
33715
|
const baseRealpath = realpathSync(resolvedBase);
|
|
33753
33716
|
const segmentRealpath = realpathSync(segmentPath);
|
|
33754
|
-
const relative =
|
|
33755
|
-
if (relative === "" || !relative.startsWith("..") && !
|
|
33717
|
+
const relative = path28__default.relative(baseRealpath, segmentRealpath);
|
|
33718
|
+
if (relative === "" || !relative.startsWith("..") && !path28__default.isAbsolute(relative)) return;
|
|
33756
33719
|
throw new Error(`Plugin path segment escapes root base: ${segmentPath}`);
|
|
33757
33720
|
}
|
|
33758
33721
|
|
|
33759
|
-
// ../../packages/fleet-admiral/src/agent-cli/doctrine-hook.ts
|
|
33760
|
-
var DOCTRINE_FILE_NAME = "doctrine.md";
|
|
33761
|
-
var DOCTRINE_HOOK_SCRIPT_NAME = "inject-doctrine.mjs";
|
|
33762
|
-
var CURSOR_DOCTRINE_PREAMBLE = `# Fleet Runtime Doctrine for Cursor Agent
|
|
33763
|
-
|
|
33764
|
-
You are running as Cursor Agent inside Fleet. This context was injected through a Fleet sessionStart hook. Treat the embedded Fleet system prompt below as your active Fleet runtime doctrine.
|
|
33765
|
-
|
|
33766
|
-
Priority and interpretation:
|
|
33767
|
-
|
|
33768
|
-
- Follow higher-priority platform, system, developer, and direct user instructions first.
|
|
33769
|
-
- Within Cursor rules, project instructions, and other same-layer guidance, this Fleet doctrine is the governing instruction set for Fleet identity, roles, workflow, carrier operations, and reporting.
|
|
33770
|
-
- Treat Fleet identity and role names from the embedded prompt as the identity anchor for this session. Do not replace them with generic Cursor Agent identity when answering, planning, or delegating.
|
|
33771
|
-
- Do not treat this document as optional background or reference material. Apply it continuously when deciding who you are, how Fleet roles are named, which protocol applies, and how to report work.
|
|
33772
|
-
- Do not merely summarize or acknowledge the embedded prompt. Execute the operational requirements it defines, including protocol selection, evidence thresholds, carrier routing, and result reporting.
|
|
33773
|
-
- If other same-layer Cursor rules conflict with this doctrine, preserve the Fleet doctrine unless the user's latest explicit instruction requires a narrower task-specific exception.
|
|
33774
|
-
- When unsure whether a Fleet instruction applies, prefer following the Fleet doctrine and briefly surface the uncertainty instead of silently ignoring it.
|
|
33775
|
-
|
|
33776
|
-
## Embedded Fleet System Prompt
|
|
33777
|
-
|
|
33778
|
-
The following block is the Fleet system prompt content adapted for Cursor hook injection. It is intentionally embedded verbatim after this wrapper.
|
|
33779
|
-
|
|
33780
|
-
<fleet-system-prompt>
|
|
33781
|
-
`;
|
|
33782
|
-
var CURSOR_DOCTRINE_FOOTER = `
|
|
33783
|
-
</fleet-system-prompt>
|
|
33784
|
-
`;
|
|
33785
|
-
var INJECT_DOCTRINE_HOOK_SCRIPT = `import fs from "node:fs";
|
|
33786
|
-
import path from "node:path";
|
|
33787
|
-
import { fileURLToPath } from "node:url";
|
|
33788
|
-
|
|
33789
|
-
const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
33790
|
-
const doctrine = fs.readFileSync(path.join(pluginRoot, "${DOCTRINE_FILE_NAME}"), "utf8");
|
|
33791
|
-
process.stdout.write(JSON.stringify({ additional_context: doctrine }));
|
|
33792
|
-
`;
|
|
33793
|
-
function formatCursorDoctrine(doctrine) {
|
|
33794
|
-
return `${CURSOR_DOCTRINE_PREAMBLE}${doctrine}${CURSOR_DOCTRINE_FOOTER}`;
|
|
33795
|
-
}
|
|
33796
|
-
function renderCursorDoctrineHookAssets(pluginRoot, doctrine, hookCommandRoot = pluginRoot) {
|
|
33797
|
-
writePrivateFile(
|
|
33798
|
-
path29__default.join(pluginRoot, DOCTRINE_FILE_NAME),
|
|
33799
|
-
formatCursorDoctrine(doctrine),
|
|
33800
|
-
pluginRoot
|
|
33801
|
-
);
|
|
33802
|
-
const scriptPath = path29__default.join(hookCommandRoot, "hooks", DOCTRINE_HOOK_SCRIPT_NAME);
|
|
33803
|
-
writePrivateFile(path29__default.join(pluginRoot, "hooks", DOCTRINE_HOOK_SCRIPT_NAME), INJECT_DOCTRINE_HOOK_SCRIPT, pluginRoot);
|
|
33804
|
-
return {
|
|
33805
|
-
command: process.execPath,
|
|
33806
|
-
args: [scriptPath]
|
|
33807
|
-
};
|
|
33808
|
-
}
|
|
33809
|
-
|
|
33810
33722
|
// ../../packages/fleet-admiral/src/agent-cli/plugin/fleet.ts
|
|
33811
33723
|
var assetBundle = {
|
|
33812
33724
|
description: "Fleet carrier delegation and wiki evidence plugin",
|
|
@@ -33818,16 +33730,8 @@ var assetBundle = {
|
|
|
33818
33730
|
};
|
|
33819
33731
|
function renderAssetPluginRoot(pluginRoot, bundle, options) {
|
|
33820
33732
|
renderEmbeddedSkillAssets(pluginRoot);
|
|
33821
|
-
const doctrineHookExec = options.cliId === "cursor" && options.doctrine !== void 0 ? renderCursorDoctrineHookAssets(
|
|
33822
|
-
pluginRoot,
|
|
33823
|
-
options.doctrine,
|
|
33824
|
-
options.installedPluginRoot ?? pluginRoot
|
|
33825
|
-
) : void 0;
|
|
33826
33733
|
if (options.cliId === "claude") {
|
|
33827
|
-
writePrivateJson(
|
|
33828
|
-
}
|
|
33829
|
-
if (options.cliId === "cursor") {
|
|
33830
|
-
renderCursorPluginRoot(pluginRoot, options, doctrineHookExec);
|
|
33734
|
+
writePrivateJson(path28__default.join(pluginRoot, "hooks", "hooks.json"), claudeHooks(options), pluginRoot);
|
|
33831
33735
|
}
|
|
33832
33736
|
}
|
|
33833
33737
|
function claudeHooks(options) {
|
|
@@ -33868,53 +33772,9 @@ function claudeCommandHook(hookExec) {
|
|
|
33868
33772
|
type: "command"
|
|
33869
33773
|
};
|
|
33870
33774
|
}
|
|
33871
|
-
function renderCursorPluginRoot(pluginRoot, options, doctrineHookExec) {
|
|
33872
|
-
if ((options.mcpServers ?? []).length > 0) {
|
|
33873
|
-
writePrivateJson(path29__default.join(pluginRoot, "mcp.json"), cursorMcpConfig(options.mcpServers ?? []), pluginRoot);
|
|
33874
|
-
}
|
|
33875
|
-
const hooks = cursorHooks(options, doctrineHookExec);
|
|
33876
|
-
if (hooks !== void 0) {
|
|
33877
|
-
writePrivateJson(path29__default.join(pluginRoot, "hooks", "hooks.json"), hooks, pluginRoot);
|
|
33878
|
-
}
|
|
33879
|
-
}
|
|
33880
|
-
function cursorMcpConfig(servers) {
|
|
33881
|
-
return {
|
|
33882
|
-
mcpServers: Object.fromEntries(
|
|
33883
|
-
servers.map((server) => [server.name, {
|
|
33884
|
-
type: "http",
|
|
33885
|
-
url: server.endpointUrl,
|
|
33886
|
-
headers: {
|
|
33887
|
-
Authorization: `Bearer ${server.bearerToken}`
|
|
33888
|
-
}
|
|
33889
|
-
}])
|
|
33890
|
-
)
|
|
33891
|
-
};
|
|
33892
|
-
}
|
|
33893
|
-
function cursorHooks(options, doctrineHookExec) {
|
|
33894
|
-
const sessionStartExecs = [doctrineHookExec, options.captureSessionHookExec].filter((exec) => exec !== void 0);
|
|
33895
|
-
const beforeSubmitPromptExecs = [options.turnStartHookExec, options.autoNameHookExec].filter((exec) => exec !== void 0);
|
|
33896
|
-
const stopExecs = [options.turnEndHookExec].filter((exec) => exec !== void 0);
|
|
33897
|
-
if (sessionStartExecs.length === 0 && beforeSubmitPromptExecs.length === 0 && stopExecs.length === 0) return void 0;
|
|
33898
|
-
return {
|
|
33899
|
-
version: 1,
|
|
33900
|
-
hooks: {
|
|
33901
|
-
...sessionStartExecs.length > 0 ? {
|
|
33902
|
-
sessionStart: sessionStartExecs.map((exec) => cursorCommandHook(exec))
|
|
33903
|
-
} : {},
|
|
33904
|
-
...beforeSubmitPromptExecs.length > 0 ? { beforeSubmitPrompt: beforeSubmitPromptExecs.map((exec) => cursorCommandHook(exec)) } : {},
|
|
33905
|
-
...stopExecs.length > 0 ? { stop: stopExecs.map((exec) => cursorCommandHook(exec)) } : {}
|
|
33906
|
-
}
|
|
33907
|
-
};
|
|
33908
|
-
}
|
|
33909
|
-
function cursorCommandHook(hookExec, extraArgs = []) {
|
|
33910
|
-
return {
|
|
33911
|
-
type: "command",
|
|
33912
|
-
command: buildHostShellCommand([hookExec.command, ...hookExec.args, ...extraArgs])
|
|
33913
|
-
};
|
|
33914
|
-
}
|
|
33915
33775
|
function renderEmbeddedSkillAssets(pluginRoot) {
|
|
33916
33776
|
for (const asset of EMBEDDED_AGENT_CLI_SKILL_ASSETS) {
|
|
33917
|
-
writePrivateFile(
|
|
33777
|
+
writePrivateFile(path28__default.join(pluginRoot, "skills", asset.relativePath), asset.content, pluginRoot);
|
|
33918
33778
|
}
|
|
33919
33779
|
}
|
|
33920
33780
|
var CONFIG_FILE_NAME = "config.toml";
|
|
@@ -33929,7 +33789,7 @@ function neutralizeCodexFleetPluginConfig(options) {
|
|
|
33929
33789
|
mutateCodexConfigWithRetry(options, 0);
|
|
33930
33790
|
}
|
|
33931
33791
|
function mutateCodexConfigWithRetry(options, attempt) {
|
|
33932
|
-
const configPath =
|
|
33792
|
+
const configPath = path28__default.join(options.codexHome, CONFIG_FILE_NAME);
|
|
33933
33793
|
const targetPath = resolveRealConfigPath(configPath);
|
|
33934
33794
|
const snapshot = readConfigSnapshot(targetPath);
|
|
33935
33795
|
const nextContent = patchCodexConfig(snapshot.content, options);
|
|
@@ -33950,7 +33810,7 @@ function resolveRealConfigPath(configPath) {
|
|
|
33950
33810
|
} catch (error51) {
|
|
33951
33811
|
if (!isNodeError(error51, "ENOENT")) throw error51;
|
|
33952
33812
|
try {
|
|
33953
|
-
return
|
|
33813
|
+
return path28__default.join(realpathSync(path28__default.dirname(configPath)), path28__default.basename(configPath));
|
|
33954
33814
|
} catch (dirError) {
|
|
33955
33815
|
if (isNodeError(dirError, "ENOENT")) return configPath;
|
|
33956
33816
|
throw dirError;
|
|
@@ -33987,9 +33847,9 @@ function readConfigSnapshot(configPath) {
|
|
|
33987
33847
|
}
|
|
33988
33848
|
}
|
|
33989
33849
|
function writeConfigIfUnchanged(configPath, snapshot, content) {
|
|
33990
|
-
mkdirSync(
|
|
33850
|
+
mkdirSync(path28__default.dirname(configPath), { recursive: true, mode: 448 });
|
|
33991
33851
|
assertConfigUnchanged(configPath, snapshot);
|
|
33992
|
-
const tempPath =
|
|
33852
|
+
const tempPath = path28__default.join(path28__default.dirname(configPath), `.${path28__default.basename(configPath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`);
|
|
33993
33853
|
let fd;
|
|
33994
33854
|
try {
|
|
33995
33855
|
fd = openSync(tempPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, CONFIG_FILE_MODE);
|
|
@@ -34237,7 +34097,7 @@ function ensureCodexPluginRegisteredOrThrow(registration, command, runCommand) {
|
|
|
34237
34097
|
pluginKey
|
|
34238
34098
|
});
|
|
34239
34099
|
writePrivateFile(registration.hashPath, `${registration.contentHash}
|
|
34240
|
-
`,
|
|
34100
|
+
`, path28__default.dirname(registration.hashPath));
|
|
34241
34101
|
}
|
|
34242
34102
|
function assertCommandSucceeded(label, result) {
|
|
34243
34103
|
if (result.status === 0) return;
|
|
@@ -34245,7 +34105,7 @@ function assertCommandSucceeded(label, result) {
|
|
|
34245
34105
|
throw new Error(`${label} failed${detail.length > 0 ? `: ${detail}` : ""}`);
|
|
34246
34106
|
}
|
|
34247
34107
|
function resolveCodexHome(env) {
|
|
34248
|
-
return env.CODEX_HOME ??
|
|
34108
|
+
return env.CODEX_HOME ?? path28__default.join(env.HOME ?? os3__default.homedir(), ".codex");
|
|
34249
34109
|
}
|
|
34250
34110
|
function findMarketplaceEntries(result, marketplaceName) {
|
|
34251
34111
|
return parseMarketplaceEntries(result).filter((entry) => entry.name === marketplaceName);
|
|
@@ -34261,7 +34121,7 @@ function parseMarketplaceEntries(result) {
|
|
|
34261
34121
|
return entries;
|
|
34262
34122
|
}
|
|
34263
34123
|
function normalizeMarketplaceRoot(rootPath, cwd) {
|
|
34264
|
-
const resolved =
|
|
34124
|
+
const resolved = path28__default.resolve(cwd, rootPath);
|
|
34265
34125
|
try {
|
|
34266
34126
|
return realpathSync(resolved);
|
|
34267
34127
|
} catch (error51) {
|
|
@@ -34285,7 +34145,7 @@ function readHash(hashPath) {
|
|
|
34285
34145
|
}
|
|
34286
34146
|
function removeFlatMarketplaceResidue(projectMarketplaceRoot) {
|
|
34287
34147
|
for (const entry of FLAT_MARKETPLACE_FS_RESIDUE_ENTRIES) {
|
|
34288
|
-
removePrivatePath(
|
|
34148
|
+
removePrivatePath(path28__default.join(projectMarketplaceRoot, entry), projectMarketplaceRoot);
|
|
34289
34149
|
}
|
|
34290
34150
|
}
|
|
34291
34151
|
|
|
@@ -34298,7 +34158,6 @@ var MARKETPLACE_MANAGED_ENTRIES = [
|
|
|
34298
34158
|
".agents",
|
|
34299
34159
|
".claude-plugin",
|
|
34300
34160
|
".codex-plugin",
|
|
34301
|
-
".cursor-plugin",
|
|
34302
34161
|
"hooks",
|
|
34303
34162
|
"skills",
|
|
34304
34163
|
"agents",
|
|
@@ -34311,6 +34170,7 @@ var MARKETPLACE_PRUNE_ENTRIES = [
|
|
|
34311
34170
|
".agents",
|
|
34312
34171
|
".claude-plugin",
|
|
34313
34172
|
".codex-plugin",
|
|
34173
|
+
// 기존 Cursor marketplace 산출물은 Fleet이 관리하던 잔재이므로 다음 렌더에서 제거한다.
|
|
34314
34174
|
".cursor-plugin",
|
|
34315
34175
|
"hooks",
|
|
34316
34176
|
"skills",
|
|
@@ -34345,7 +34205,7 @@ async function createAgentCliPlugin(options) {
|
|
|
34345
34205
|
cleanup,
|
|
34346
34206
|
codexRegistrations: options.cliId === "codex" ? renderableBundles.map(({ bundle, target }, index) => ({
|
|
34347
34207
|
contentHash: contentHashes.get(target.root),
|
|
34348
|
-
hashPath:
|
|
34208
|
+
hashPath: path28__default.join(target.root, bundle.hashFileName),
|
|
34349
34209
|
marketplaceDir: target.root,
|
|
34350
34210
|
marketplaceName: target.name,
|
|
34351
34211
|
pluginName: bundle.name,
|
|
@@ -34362,7 +34222,7 @@ function resolveRenderablePluginBundles(fleetRoot) {
|
|
|
34362
34222
|
function homeMarketplaceTarget(fleetRoot) {
|
|
34363
34223
|
return {
|
|
34364
34224
|
name: FLEET_MARKETPLACE_NAME,
|
|
34365
|
-
root:
|
|
34225
|
+
root: path28__default.join(fleetRoot, MARKETPLACE_DIR_NAME)
|
|
34366
34226
|
};
|
|
34367
34227
|
}
|
|
34368
34228
|
function groupRenderableBundlesByMarketplace(bundles) {
|
|
@@ -34378,24 +34238,23 @@ function groupRenderableBundlesByMarketplace(bundles) {
|
|
|
34378
34238
|
return groups;
|
|
34379
34239
|
}
|
|
34380
34240
|
function renderPluginRoot(pluginRoot, bundle, options) {
|
|
34381
|
-
const parentRoot =
|
|
34241
|
+
const parentRoot = path28__default.dirname(pluginRoot);
|
|
34382
34242
|
ensurePrivateDir(parentRoot, parentRoot);
|
|
34383
34243
|
const stageParent = createStagingDir(parentRoot);
|
|
34384
|
-
const stagedPluginRoot =
|
|
34244
|
+
const stagedPluginRoot = path28__default.join(stageParent, path28__default.basename(pluginRoot));
|
|
34385
34245
|
try {
|
|
34386
34246
|
ensurePrivateDir(stagedPluginRoot, stagedPluginRoot);
|
|
34387
|
-
writePrivateJson(
|
|
34247
|
+
writePrivateJson(path28__default.join(stagedPluginRoot, ".claude-plugin", "plugin.json"), claudeManifest(bundle), stagedPluginRoot);
|
|
34388
34248
|
switch (bundle.source) {
|
|
34389
34249
|
case "asset":
|
|
34390
34250
|
if (options.cliId === "claude") {
|
|
34391
|
-
ensurePrivateDir(
|
|
34251
|
+
ensurePrivateDir(path28__default.join(stagedPluginRoot, "agents"), stagedPluginRoot);
|
|
34392
34252
|
}
|
|
34393
|
-
ensurePrivateDir(
|
|
34394
|
-
renderAssetPluginRoot(stagedPluginRoot, bundle,
|
|
34253
|
+
ensurePrivateDir(path28__default.join(stagedPluginRoot, "skills"), stagedPluginRoot);
|
|
34254
|
+
renderAssetPluginRoot(stagedPluginRoot, bundle, options);
|
|
34395
34255
|
break;
|
|
34396
34256
|
}
|
|
34397
|
-
writePrivateJson(
|
|
34398
|
-
writePrivateJson(path29__default.join(stagedPluginRoot, ".cursor-plugin", "plugin.json"), cursorManifest(bundle, stagedPluginRoot), stagedPluginRoot);
|
|
34257
|
+
writePrivateJson(path28__default.join(stagedPluginRoot, ".codex-plugin", "plugin.json"), codexManifest(bundle, stagedPluginRoot), stagedPluginRoot);
|
|
34399
34258
|
removePrivatePath(pluginRoot, parentRoot);
|
|
34400
34259
|
renameSync(stagedPluginRoot, pluginRoot);
|
|
34401
34260
|
} finally {
|
|
@@ -34407,13 +34266,12 @@ function renderMarketplaceRoot(target, bundles) {
|
|
|
34407
34266
|
ensurePrivateDir(marketplaceRoot, marketplaceRoot);
|
|
34408
34267
|
const stagedRoot = createStagingDir(marketplaceRoot);
|
|
34409
34268
|
try {
|
|
34410
|
-
writePrivateJson(
|
|
34411
|
-
writePrivateJson(
|
|
34412
|
-
writePrivateJson(path29__default.join(stagedRoot, ".cursor-plugin", "marketplace.json"), cursorMarketplace(target, bundles), stagedRoot);
|
|
34269
|
+
writePrivateJson(path28__default.join(stagedRoot, ".agents", "plugins", "marketplace.json"), codexMarketplace(target, bundles), stagedRoot);
|
|
34270
|
+
writePrivateJson(path28__default.join(stagedRoot, ".claude-plugin", "marketplace.json"), claudeMarketplace(target, bundles), stagedRoot);
|
|
34413
34271
|
pruneMarketplaceRoot(target);
|
|
34414
34272
|
pruneStalePluginDirs(target, bundles);
|
|
34415
34273
|
for (const entry of readdirSync(stagedRoot)) {
|
|
34416
|
-
renameSync(
|
|
34274
|
+
renameSync(path28__default.join(stagedRoot, entry), path28__default.join(marketplaceRoot, entry));
|
|
34417
34275
|
}
|
|
34418
34276
|
} finally {
|
|
34419
34277
|
cleanupPrivateRoot(stagedRoot, marketplaceRoot);
|
|
@@ -34421,22 +34279,22 @@ function renderMarketplaceRoot(target, bundles) {
|
|
|
34421
34279
|
}
|
|
34422
34280
|
function pruneMarketplaceRoot(target) {
|
|
34423
34281
|
for (const entry of MARKETPLACE_PRUNE_ENTRIES) {
|
|
34424
|
-
removePrivatePath(
|
|
34282
|
+
removePrivatePath(path28__default.join(target.root, entry), target.root);
|
|
34425
34283
|
}
|
|
34426
34284
|
}
|
|
34427
34285
|
function pruneStalePluginDirs(target, bundles) {
|
|
34428
|
-
const pluginsDir =
|
|
34286
|
+
const pluginsDir = path28__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME);
|
|
34429
34287
|
if (!existsSync(pluginsDir)) return;
|
|
34430
34288
|
const activeDirectoryNames = new Set(bundles.map((bundle) => bundle.directoryName));
|
|
34431
34289
|
for (const entry of readdirSync(pluginsDir)) {
|
|
34432
34290
|
if (activeDirectoryNames.has(entry)) continue;
|
|
34433
|
-
removePrivatePath(
|
|
34291
|
+
removePrivatePath(path28__default.join(pluginsDir, entry), target.root);
|
|
34434
34292
|
}
|
|
34435
34293
|
}
|
|
34436
34294
|
function buildContentHash(target) {
|
|
34437
|
-
const hash2 =
|
|
34295
|
+
const hash2 = crypto3.createHash("sha256");
|
|
34438
34296
|
for (const filePath of listRenderableFiles(target)) {
|
|
34439
|
-
const relativePath =
|
|
34297
|
+
const relativePath = path28__default.relative(target.root, filePath);
|
|
34440
34298
|
hash2.update(relativePath);
|
|
34441
34299
|
hash2.update("\0");
|
|
34442
34300
|
hash2.update(readFileSync(filePath));
|
|
@@ -34445,14 +34303,14 @@ function buildContentHash(target) {
|
|
|
34445
34303
|
return hash2.digest("hex");
|
|
34446
34304
|
}
|
|
34447
34305
|
function createStagingDir(rootPath) {
|
|
34448
|
-
const stageRoot = mkdtempSync(
|
|
34306
|
+
const stageRoot = mkdtempSync(path28__default.join(rootPath, `.fleet-stage-${process.pid}-${Date.now()}-`));
|
|
34449
34307
|
return stageRoot;
|
|
34450
34308
|
}
|
|
34451
34309
|
function listRenderableFiles(target) {
|
|
34452
34310
|
const files = [];
|
|
34453
34311
|
const ancestorRealDirs = /* @__PURE__ */ new Set();
|
|
34454
34312
|
for (const entry of MARKETPLACE_MANAGED_ENTRIES) {
|
|
34455
|
-
const entryPath =
|
|
34313
|
+
const entryPath = path28__default.join(target.root, entry);
|
|
34456
34314
|
if (!existsSync(entryPath)) continue;
|
|
34457
34315
|
collectRenderableFiles(target.root, entryPath, files, ancestorRealDirs);
|
|
34458
34316
|
}
|
|
@@ -34463,8 +34321,8 @@ function collectRenderableFiles(rootPath, currentPath, files, ancestorRealDirs)
|
|
|
34463
34321
|
if (ancestorRealDirs.has(realDir)) return;
|
|
34464
34322
|
ancestorRealDirs.add(realDir);
|
|
34465
34323
|
for (const entry of readdirSync(currentPath)) {
|
|
34466
|
-
const entryPath =
|
|
34467
|
-
const relativePath =
|
|
34324
|
+
const entryPath = path28__default.join(currentPath, entry);
|
|
34325
|
+
const relativePath = path28__default.relative(rootPath, entryPath);
|
|
34468
34326
|
if (HASH_IGNORED_RELATIVE_PATHS.has(relativePath)) continue;
|
|
34469
34327
|
const stat3 = lstatSync(entryPath);
|
|
34470
34328
|
if (stat3.isSymbolicLink()) {
|
|
@@ -34529,19 +34387,8 @@ function claudeMarketplace(target, bundles) {
|
|
|
34529
34387
|
}))
|
|
34530
34388
|
};
|
|
34531
34389
|
}
|
|
34532
|
-
function cursorMarketplace(target, bundles) {
|
|
34533
|
-
return {
|
|
34534
|
-
name: target.name,
|
|
34535
|
-
owner: "fleet",
|
|
34536
|
-
plugins: bundles.map((bundle) => ({
|
|
34537
|
-
name: bundle.name,
|
|
34538
|
-
description: bundle.description,
|
|
34539
|
-
source: marketplacePluginPath(target, bundle)
|
|
34540
|
-
}))
|
|
34541
|
-
};
|
|
34542
|
-
}
|
|
34543
34390
|
function pluginRootForTarget(target, bundle) {
|
|
34544
|
-
return
|
|
34391
|
+
return path28__default.join(target.root, PLUGIN_BUNDLES_DIR_NAME, bundle.directoryName);
|
|
34545
34392
|
}
|
|
34546
34393
|
function marketplacePluginPath(target, bundle) {
|
|
34547
34394
|
return `./${PLUGIN_BUNDLES_DIR_NAME}/${bundle.directoryName}`;
|
|
@@ -34554,36 +34401,14 @@ function codexManifest(bundle, pluginRoot) {
|
|
|
34554
34401
|
skills: "./skills/"
|
|
34555
34402
|
};
|
|
34556
34403
|
}
|
|
34557
|
-
function cursorManifest(bundle, pluginRoot) {
|
|
34558
|
-
return {
|
|
34559
|
-
name: bundle.name,
|
|
34560
|
-
version: cursorManifestVersion(bundle, pluginRoot),
|
|
34561
|
-
description: bundle.description
|
|
34562
|
-
};
|
|
34563
|
-
}
|
|
34564
|
-
function cursorManifestVersion(bundle, pluginRoot) {
|
|
34565
|
-
const hash2 = crypto4.createHash("sha256");
|
|
34566
|
-
hash2.update(bundle.name);
|
|
34567
|
-
hash2.update("\0");
|
|
34568
|
-
hash2.update(bundle.description);
|
|
34569
|
-
hash2.update("\0");
|
|
34570
|
-
for (const filePath of listCursorEffectivePluginFiles(pluginRoot)) {
|
|
34571
|
-
const relativePath = path29__default.relative(pluginRoot, filePath);
|
|
34572
|
-
hash2.update(relativePath);
|
|
34573
|
-
hash2.update("\0");
|
|
34574
|
-
hash2.update(readFileSync(filePath));
|
|
34575
|
-
hash2.update("\0");
|
|
34576
|
-
}
|
|
34577
|
-
return `0.0.0+${hash2.digest("hex").slice(0, 12)}`;
|
|
34578
|
-
}
|
|
34579
34404
|
function codexManifestVersion(bundle, pluginRoot) {
|
|
34580
|
-
const hash2 =
|
|
34405
|
+
const hash2 = crypto3.createHash("sha256");
|
|
34581
34406
|
hash2.update(bundle.name);
|
|
34582
34407
|
hash2.update("\0");
|
|
34583
34408
|
hash2.update(bundle.description);
|
|
34584
34409
|
hash2.update("\0");
|
|
34585
34410
|
for (const filePath of listCodexEffectivePluginFiles(pluginRoot)) {
|
|
34586
|
-
const relativePath =
|
|
34411
|
+
const relativePath = path28__default.relative(pluginRoot, filePath);
|
|
34587
34412
|
hash2.update(relativePath);
|
|
34588
34413
|
hash2.update("\0");
|
|
34589
34414
|
hash2.update(readFileSync(filePath));
|
|
@@ -34592,28 +34417,12 @@ function codexManifestVersion(bundle, pluginRoot) {
|
|
|
34592
34417
|
return `0.0.0+${hash2.digest("hex").slice(0, 12)}`;
|
|
34593
34418
|
}
|
|
34594
34419
|
function listCodexEffectivePluginFiles(pluginRoot) {
|
|
34595
|
-
const skillsPath =
|
|
34420
|
+
const skillsPath = path28__default.join(pluginRoot, "skills");
|
|
34596
34421
|
if (!existsSync(skillsPath)) return [];
|
|
34597
34422
|
const files = [];
|
|
34598
34423
|
collectRenderableFiles(pluginRoot, skillsPath, files, /* @__PURE__ */ new Set());
|
|
34599
34424
|
return files.sort();
|
|
34600
34425
|
}
|
|
34601
|
-
function listCursorEffectivePluginFiles(pluginRoot) {
|
|
34602
|
-
const files = [];
|
|
34603
|
-
for (const entry of ["skills", "hooks", "doctrine.md", "mcp.json"]) {
|
|
34604
|
-
const entryPath = path29__default.join(pluginRoot, entry);
|
|
34605
|
-
if (!existsSync(entryPath)) continue;
|
|
34606
|
-
const stat3 = lstatSync(entryPath);
|
|
34607
|
-
if (stat3.isFile()) {
|
|
34608
|
-
files.push(entryPath);
|
|
34609
|
-
continue;
|
|
34610
|
-
}
|
|
34611
|
-
if (stat3.isDirectory()) {
|
|
34612
|
-
collectRenderableFiles(pluginRoot, entryPath, files, /* @__PURE__ */ new Set());
|
|
34613
|
-
}
|
|
34614
|
-
}
|
|
34615
|
-
return files.sort();
|
|
34616
|
-
}
|
|
34617
34426
|
function claudeManifest(bundle) {
|
|
34618
34427
|
return {
|
|
34619
34428
|
name: bundle.name,
|
|
@@ -34636,7 +34445,7 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
34636
34445
|
}
|
|
34637
34446
|
const enableMetaphor = options.enableMetaphor ?? false;
|
|
34638
34447
|
const endpoint = await options.dedicatedMcpSession.getEndpoint();
|
|
34639
|
-
const tokenLabel = options.mcpSessionLabel ?? `agent:${profile.id}:${
|
|
34448
|
+
const tokenLabel = options.mcpSessionLabel ?? `agent:${profile.id}:${crypto3.randomUUID()}`;
|
|
34640
34449
|
const tokens = await options.dedicatedMcpSession.issueSessionToken({ cwd: profile.cwd, label: tokenLabel });
|
|
34641
34450
|
const mcpServers = buildAgentCliMcpServerConfigs(endpoint.servers, tokens);
|
|
34642
34451
|
const doctrine = options.buildSystemPrompt(enableMetaphor);
|
|
@@ -34648,9 +34457,7 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
34648
34457
|
codexCommandRunner: options.codexCommandRunner,
|
|
34649
34458
|
cwd: profile.cwd,
|
|
34650
34459
|
dataDir: options.dataDir,
|
|
34651
|
-
doctrine,
|
|
34652
34460
|
rootDir: options.pluginRootDir,
|
|
34653
|
-
mcpServers,
|
|
34654
34461
|
captureSessionHookExec: options.captureSessionHookExec,
|
|
34655
34462
|
turnStartHookExec: options.turnStartHookExec,
|
|
34656
34463
|
turnEndHookExec: options.turnEndHookExec,
|
|
@@ -34674,8 +34481,8 @@ async function injectAgentCliProfile(profile, options) {
|
|
|
34674
34481
|
env: { ...profile.env }
|
|
34675
34482
|
}, requireCodexCommandRunner(options.codexCommandRunner), options.withMarketplaceLock, {
|
|
34676
34483
|
homeMarketplaceName: FLEET_MARKETPLACE_NAME,
|
|
34677
|
-
homeMarketplaceRoot:
|
|
34678
|
-
projectMarketplaceRoot:
|
|
34484
|
+
homeMarketplaceRoot: path28__default.join(options.pluginRootDir ?? options.dataDir ?? getFleetDataDir(), "marketplace"),
|
|
34485
|
+
projectMarketplaceRoot: path28__default.join(profile.cwd, ".fleet")
|
|
34679
34486
|
});
|
|
34680
34487
|
if (cleanupWarning !== void 0) {
|
|
34681
34488
|
launchWarnings.push(`Deprecated Codex plugin cleanup failed: ${cleanupWarning}`);
|
|
@@ -34738,19 +34545,19 @@ function buildAgentCliMcpServerConfigs(endpoints, tokens) {
|
|
|
34738
34545
|
});
|
|
34739
34546
|
}
|
|
34740
34547
|
function writeSystemPromptFile(cliId, systemPrompt, onCleanup) {
|
|
34741
|
-
const tempDir = mkdtempSync(
|
|
34548
|
+
const tempDir = mkdtempSync(path28__default.join(os3__default.tmpdir(), `fleet-${cliId}-`));
|
|
34742
34549
|
onCleanup(() => rmBestEffort(tempDir));
|
|
34743
|
-
const filePath =
|
|
34550
|
+
const filePath = path28__default.join(tempDir, "system-prompt.md");
|
|
34744
34551
|
writeFileSync(filePath, systemPrompt, { encoding: "utf8", flag: "wx", mode: SYSTEM_PROMPT_FILE_MODE });
|
|
34745
34552
|
chmodBestEffort2(filePath, SYSTEM_PROMPT_FILE_MODE);
|
|
34746
34553
|
return filePath;
|
|
34747
34554
|
}
|
|
34748
34555
|
function writeCodexFleetProfile(env, doctrine, pluginKeys, hookExecs) {
|
|
34749
|
-
const codexHome = env.CODEX_HOME ??
|
|
34556
|
+
const codexHome = env.CODEX_HOME ?? path28__default.join(env.HOME ?? os3__default.homedir(), ".codex");
|
|
34750
34557
|
mkdirSync(codexHome, { recursive: true });
|
|
34751
34558
|
pruneLegacyCodexFleetProfiles(codexHome);
|
|
34752
34559
|
const profileName = CODEX_FLEET_PROFILE_NAME;
|
|
34753
|
-
const profilePath =
|
|
34560
|
+
const profilePath = path28__default.join(codexHome, CODEX_FLEET_PROFILE_FILE_NAME);
|
|
34754
34561
|
const hookTrustState = readCodexFleetHookTrustState(profilePath);
|
|
34755
34562
|
writeFileNoFollow2(profilePath, [
|
|
34756
34563
|
CODEX_FLEET_PROFILE_MARKER,
|
|
@@ -34790,7 +34597,7 @@ function codexHooksConfig(hookExecs) {
|
|
|
34790
34597
|
}
|
|
34791
34598
|
function codexHookHandlersInline(execs) {
|
|
34792
34599
|
const handlers = execs.map((exec) => {
|
|
34793
|
-
const command =
|
|
34600
|
+
const command = buildHostShellCommand([exec.command, ...exec.args]);
|
|
34794
34601
|
return `{ type = "command", command = "${escapeTomlBasicString(command)}" }`;
|
|
34795
34602
|
}).join(", ");
|
|
34796
34603
|
return `[{ hooks = [${handlers}] }]`;
|
|
@@ -34854,7 +34661,7 @@ function pruneLegacyCodexFleetProfiles(codexHome) {
|
|
|
34854
34661
|
}
|
|
34855
34662
|
for (const entry of entries) {
|
|
34856
34663
|
if (!CODEX_LEGACY_FLEET_PROFILE_FILE_NAME_PATTERN.test(entry)) continue;
|
|
34857
|
-
const filePath =
|
|
34664
|
+
const filePath = path28__default.join(codexHome, entry);
|
|
34858
34665
|
if (!isLegacyFleetCodexProfile(filePath)) continue;
|
|
34859
34666
|
unlinkBestEffort2(filePath);
|
|
34860
34667
|
}
|
|
@@ -34901,8 +34708,6 @@ function buildAgentCliArgs(builderId, context) {
|
|
|
34901
34708
|
return buildClaudeNativeArgs(context);
|
|
34902
34709
|
case "codex-native":
|
|
34903
34710
|
return buildCodexNativeArgs(context);
|
|
34904
|
-
case "cursor-native":
|
|
34905
|
-
return buildCursorNativeArgs(context);
|
|
34906
34711
|
}
|
|
34907
34712
|
}
|
|
34908
34713
|
function mergeAgentCliArgs(profile, builderId, context, injectedArgs) {
|
|
@@ -35077,6 +34882,7 @@ function buildReservedExternalMcpServerIds(injectedIds) {
|
|
|
35077
34882
|
|
|
35078
34883
|
// ../../packages/fleet-admiral/src/agent-runtime/reminder-router.ts
|
|
35079
34884
|
var DEFAULT_BRACKETED_PASTE = false;
|
|
34885
|
+
var DEFAULT_CONPTY_PASTE_BURST = false;
|
|
35080
34886
|
var DEFAULT_LINE_TERMINATOR = "\r";
|
|
35081
34887
|
var DEFAULT_MULTILINE_STRATEGY = "literal";
|
|
35082
34888
|
var BRACKETED_PASTE_START = "\x1B[200~";
|
|
@@ -35084,7 +34890,28 @@ var BRACKETED_PASTE_END = "\x1B[201~";
|
|
|
35084
34890
|
var C1_BRACKETED_PASTE_END = "\x9B201~";
|
|
35085
34891
|
var CONTROL_CHARS_EXCEPT_INPUT_WHITESPACE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F\x80-\x9F]/g;
|
|
35086
34892
|
var LINE_BREAK_PATTERN = /[\r\n]/;
|
|
34893
|
+
var WINDOWS_CONPTY_SUBMIT_DELAY_MS = 250;
|
|
34894
|
+
function createDelayedPtyWriter() {
|
|
34895
|
+
const submitTails = /* @__PURE__ */ new Map();
|
|
34896
|
+
return {
|
|
34897
|
+
enqueue(sessionKey, write, chunks) {
|
|
34898
|
+
const hasDelay = chunks.some((chunk) => chunk.submitDelayMs !== void 0);
|
|
34899
|
+
if (!hasDelay || sessionKey === void 0) {
|
|
34900
|
+
void writeChunksWithDelay(write, chunks);
|
|
34901
|
+
return;
|
|
34902
|
+
}
|
|
34903
|
+
const prev = submitTails.get(sessionKey) ?? Promise.resolve();
|
|
34904
|
+
const tail = prev.then(() => writeChunksWithDelay(write, chunks)).catch(() => {
|
|
34905
|
+
});
|
|
34906
|
+
submitTails.set(sessionKey, tail);
|
|
34907
|
+
void tail.then(() => {
|
|
34908
|
+
if (submitTails.get(sessionKey) === tail) submitTails.delete(sessionKey);
|
|
34909
|
+
});
|
|
34910
|
+
}
|
|
34911
|
+
};
|
|
34912
|
+
}
|
|
35087
34913
|
function createCarrierResultReminderRouter(deps) {
|
|
34914
|
+
const writer = deps.writer ?? createDelayedPtyWriter();
|
|
35088
34915
|
return deps.streamRegister((event) => {
|
|
35089
34916
|
if (event.type !== "job:finalized") return;
|
|
35090
34917
|
if (typeof event.systemReminder !== "string") return;
|
|
@@ -35093,35 +34920,61 @@ function createCarrierResultReminderRouter(deps) {
|
|
|
35093
34920
|
const sink = deps.resolveSink(event);
|
|
35094
34921
|
if (!sink) return;
|
|
35095
34922
|
const policy = deps.resolvePolicy?.(event) ?? {};
|
|
35096
|
-
|
|
35097
|
-
|
|
35098
|
-
}
|
|
34923
|
+
const chunks = formatCarrierResultReminderMessage(policy, reminder, deps.platform);
|
|
34924
|
+
writer.enqueue(deps.resolveSessionKey?.(event), (data) => sink.write(data), chunks);
|
|
35099
34925
|
});
|
|
35100
34926
|
}
|
|
35101
34927
|
function sanitizeCarrierResultReminder(text) {
|
|
35102
34928
|
return text.split(BRACKETED_PASTE_END).join("").split(C1_BRACKETED_PASTE_END).join("").replace(CONTROL_CHARS_EXCEPT_INPUT_WHITESPACE, "");
|
|
35103
34929
|
}
|
|
35104
|
-
function formatCarrierResultReminderMessage(policy, text) {
|
|
34930
|
+
function formatCarrierResultReminderMessage(policy, text, platform = process.platform) {
|
|
35105
34931
|
const resolvedPolicy = resolveMessagePolicy(policy);
|
|
35106
|
-
|
|
35107
|
-
return appliedPolicy.submit === void 0 || appliedPolicy.submit.length === 0 ? [appliedPolicy.payload] : [appliedPolicy.payload, appliedPolicy.submit];
|
|
34932
|
+
return applyMessagePolicy(text, resolvedPolicy, platform);
|
|
35108
34933
|
}
|
|
35109
34934
|
function resolveMessagePolicy(policy) {
|
|
35110
34935
|
return {
|
|
35111
34936
|
bracketedPaste: policy.bracketedPaste ?? DEFAULT_BRACKETED_PASTE,
|
|
34937
|
+
conptyPasteBurst: policy.conptyPasteBurst ?? DEFAULT_CONPTY_PASTE_BURST,
|
|
35112
34938
|
lineTerminator: policy.lineTerminator ?? DEFAULT_LINE_TERMINATOR,
|
|
35113
34939
|
multilineStrategy: policy.multilineStrategy ?? DEFAULT_MULTILINE_STRATEGY
|
|
35114
34940
|
};
|
|
35115
34941
|
}
|
|
35116
|
-
function applyMessagePolicy(text, policy) {
|
|
34942
|
+
function applyMessagePolicy(text, policy, platform) {
|
|
35117
34943
|
const usePasteMode = policy.bracketedPaste || policy.multilineStrategy === "paste-mode" && LINE_BREAK_PATTERN.test(text);
|
|
35118
|
-
if (
|
|
35119
|
-
return
|
|
34944
|
+
if (policy.conptyPasteBurst && platform === "win32" && usePasteMode) {
|
|
34945
|
+
return [
|
|
34946
|
+
{ data: text },
|
|
34947
|
+
{ data: policy.lineTerminator, submitDelayMs: WINDOWS_CONPTY_SUBMIT_DELAY_MS }
|
|
34948
|
+
];
|
|
35120
34949
|
}
|
|
35121
|
-
return {
|
|
35122
|
-
|
|
35123
|
-
|
|
35124
|
-
|
|
34950
|
+
return [{
|
|
34951
|
+
data: usePasteMode ? `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}${policy.lineTerminator}` : `${text}${policy.lineTerminator}`
|
|
34952
|
+
}];
|
|
34953
|
+
}
|
|
34954
|
+
function writeChunksWithDelay(write, chunks) {
|
|
34955
|
+
return new Promise((resolve2) => {
|
|
34956
|
+
let index = 0;
|
|
34957
|
+
const writeNext = () => {
|
|
34958
|
+
const chunk = chunks[index++];
|
|
34959
|
+
if (!chunk) {
|
|
34960
|
+
resolve2();
|
|
34961
|
+
return;
|
|
34962
|
+
}
|
|
34963
|
+
const commit = () => {
|
|
34964
|
+
try {
|
|
34965
|
+
write(chunk.data);
|
|
34966
|
+
} catch {
|
|
34967
|
+
}
|
|
34968
|
+
writeNext();
|
|
34969
|
+
};
|
|
34970
|
+
if (chunk.submitDelayMs === void 0) {
|
|
34971
|
+
commit();
|
|
34972
|
+
} else {
|
|
34973
|
+
setTimeout(commit, chunk.submitDelayMs);
|
|
34974
|
+
}
|
|
34975
|
+
};
|
|
34976
|
+
writeNext();
|
|
34977
|
+
});
|
|
35125
34978
|
}
|
|
35126
34979
|
|
|
35127
34980
|
// ../../packages/fleet-wiki/src/boundaries.ts
|
|
@@ -35319,7 +35172,7 @@ function extractLegacyMarkdownWikiLinks(body, wikiDir, basePath) {
|
|
|
35319
35172
|
}
|
|
35320
35173
|
function resolveLegacyWikiTarget(target, wikiDir, basePath) {
|
|
35321
35174
|
if (!target || target.startsWith("#")) return null;
|
|
35322
|
-
if (
|
|
35175
|
+
if (path28__default.isAbsolute(target)) return null;
|
|
35323
35176
|
if (/^[a-z][a-z0-9+.-]*:/i.test(target)) return null;
|
|
35324
35177
|
const withoutFragment = target.split("#", 1)[0]?.split("?", 1)[0] ?? "";
|
|
35325
35178
|
if (!withoutFragment.endsWith(".md")) return null;
|
|
@@ -35329,12 +35182,12 @@ function resolveLegacyWikiTarget(target, wikiDir, basePath) {
|
|
|
35329
35182
|
} catch {
|
|
35330
35183
|
return null;
|
|
35331
35184
|
}
|
|
35332
|
-
const resolved =
|
|
35333
|
-
const relative =
|
|
35334
|
-
if (!relative || relative.startsWith("..") ||
|
|
35185
|
+
const resolved = path28__default.resolve(path28__default.dirname(basePath), decodedTarget);
|
|
35186
|
+
const relative = path28__default.relative(wikiDir, resolved);
|
|
35187
|
+
if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) return null;
|
|
35335
35188
|
return {
|
|
35336
35189
|
target,
|
|
35337
|
-
entryId:
|
|
35190
|
+
entryId: path28__default.basename(relative, ".md")
|
|
35338
35191
|
};
|
|
35339
35192
|
}
|
|
35340
35193
|
|
|
@@ -35594,18 +35447,18 @@ Always read \`schema/wiki-schema.md\` directly before composing or revising entr
|
|
|
35594
35447
|
`;
|
|
35595
35448
|
async function ensureWorkspaceSchema(paths) {
|
|
35596
35449
|
await mkdir(paths.schemaDir, { recursive: true });
|
|
35597
|
-
await writeDefaultFileIfMissing(
|
|
35598
|
-
await writeDefaultFileIfMissing(
|
|
35450
|
+
await writeDefaultFileIfMissing(path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME), DEFAULT_WORKSPACE_SCHEMA_AGENTS);
|
|
35451
|
+
await writeDefaultFileIfMissing(path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME), DEFAULT_WORKSPACE_WIKI_SCHEMA);
|
|
35599
35452
|
await writeDefaultFileIfMissing(buildTemplatePath(paths, "prd"), DEFAULT_TEMPLATE_PRD);
|
|
35600
35453
|
return readWorkspaceSchemaSummary(paths);
|
|
35601
35454
|
}
|
|
35602
35455
|
async function ensureWorkspaceDoctrine(paths) {
|
|
35603
35456
|
await mkdir(paths.root, { recursive: true });
|
|
35604
|
-
await writeDefaultFileIfMissing(
|
|
35457
|
+
await writeDefaultFileIfMissing(path28__default.join(paths.root, WORKSPACE_KNOWLEDGE_AGENTS_FILENAME), DEFAULT_WORKSPACE_KNOWLEDGE_AGENTS);
|
|
35605
35458
|
}
|
|
35606
35459
|
async function readWorkspaceSchemaSummary(paths) {
|
|
35607
|
-
const agentsPath =
|
|
35608
|
-
const wikiSchemaPath =
|
|
35460
|
+
const agentsPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
|
|
35461
|
+
const wikiSchemaPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_FILENAME);
|
|
35609
35462
|
const wikiSchemaContent = await tryReadFile(wikiSchemaPath);
|
|
35610
35463
|
const templates = await scanTemplates(paths);
|
|
35611
35464
|
if (wikiSchemaContent === null) {
|
|
@@ -35644,7 +35497,7 @@ async function scanTemplates(paths) {
|
|
|
35644
35497
|
if (!entry.name.startsWith(WORKSPACE_TEMPLATE_PREFIX) || !entry.name.endsWith(WORKSPACE_TEMPLATE_SUFFIX)) continue;
|
|
35645
35498
|
const id = entry.name.slice(WORKSPACE_TEMPLATE_PREFIX.length, -WORKSPACE_TEMPLATE_SUFFIX.length);
|
|
35646
35499
|
if (!id) continue;
|
|
35647
|
-
const filePath =
|
|
35500
|
+
const filePath = path28__default.join(paths.schemaDir, entry.name);
|
|
35648
35501
|
try {
|
|
35649
35502
|
const parsed = parseTemplateMarkdown(await readFile(filePath, "utf8"));
|
|
35650
35503
|
templates.push({
|
|
@@ -35678,7 +35531,7 @@ async function validateTemplateCompliance(paths, templateId, body) {
|
|
|
35678
35531
|
}
|
|
35679
35532
|
}
|
|
35680
35533
|
function inferTemplateIdFromTarget(target, knownTemplateIds) {
|
|
35681
|
-
const basename =
|
|
35534
|
+
const basename = path28__default.basename(target, ".md");
|
|
35682
35535
|
const ids = knownTemplateIds ?? DEFAULT_TEMPLATE_IDS;
|
|
35683
35536
|
const sorted = [...ids].sort((a, b) => b.length - a.length);
|
|
35684
35537
|
for (const id of sorted) {
|
|
@@ -35707,7 +35560,7 @@ function extractSchemaSummary(content) {
|
|
|
35707
35560
|
return lines.find((line) => line.length > 0 && !line.startsWith("#")) ?? "Workspace schema is present.";
|
|
35708
35561
|
}
|
|
35709
35562
|
function buildTemplatePath(paths, id) {
|
|
35710
|
-
return
|
|
35563
|
+
return path28__default.join(paths.schemaDir, `${WORKSPACE_TEMPLATE_PREFIX}${id}${WORKSPACE_TEMPLATE_SUFFIX}`);
|
|
35711
35564
|
}
|
|
35712
35565
|
function parseTemplateMarkdown(content) {
|
|
35713
35566
|
const normalized = content.replace(/\r\n/g, "\n");
|
|
@@ -35734,16 +35587,16 @@ function isAlreadyExistsError(error51) {
|
|
|
35734
35587
|
|
|
35735
35588
|
// ../../packages/fleet-wiki/src/paths.ts
|
|
35736
35589
|
function resolveMemoryPaths(cwd) {
|
|
35737
|
-
const root =
|
|
35590
|
+
const root = path28__default.join(cwd, KNOWLEDGE_ROOT_DIRNAME);
|
|
35738
35591
|
return {
|
|
35739
35592
|
root,
|
|
35740
|
-
rawDir:
|
|
35741
|
-
wikiDir:
|
|
35742
|
-
schemaDir:
|
|
35743
|
-
queueDir:
|
|
35744
|
-
archiveDir:
|
|
35745
|
-
conflictsDir:
|
|
35746
|
-
indexFile:
|
|
35593
|
+
rawDir: path28__default.join(root, RAW_DIRNAME),
|
|
35594
|
+
wikiDir: path28__default.join(root, WIKI_DIRNAME),
|
|
35595
|
+
schemaDir: path28__default.join(root, SCHEMA_DIRNAME),
|
|
35596
|
+
queueDir: path28__default.join(root, QUEUE_DIRNAME),
|
|
35597
|
+
archiveDir: path28__default.join(root, ARCHIVE_DIRNAME),
|
|
35598
|
+
conflictsDir: path28__default.join(root, CONFLICTS_DIRNAME),
|
|
35599
|
+
indexFile: path28__default.join(root, INDEX_FILENAME)
|
|
35747
35600
|
};
|
|
35748
35601
|
}
|
|
35749
35602
|
async function ensureMemoryRoot(paths) {
|
|
@@ -35758,10 +35611,10 @@ async function ensureMemoryRoot(paths) {
|
|
|
35758
35611
|
await ensureWorkspaceDoctrine(paths);
|
|
35759
35612
|
}
|
|
35760
35613
|
function getIndexMarkdownFile(paths) {
|
|
35761
|
-
return
|
|
35614
|
+
return path28__default.join(paths.wikiDir, INDEX_MD_FILENAME);
|
|
35762
35615
|
}
|
|
35763
35616
|
function getLogFile(paths) {
|
|
35764
|
-
return
|
|
35617
|
+
return path28__default.join(paths.root, LOG_MD_FILENAME);
|
|
35765
35618
|
}
|
|
35766
35619
|
|
|
35767
35620
|
// ../../packages/fleet-wiki/src/log.ts
|
|
@@ -35925,12 +35778,12 @@ async function readWikiEntry(id, paths) {
|
|
|
35925
35778
|
const index = await loadIndex(paths);
|
|
35926
35779
|
const indexed = index[id];
|
|
35927
35780
|
if (indexed) {
|
|
35928
|
-
const resolved =
|
|
35929
|
-
const rel =
|
|
35930
|
-
if (!rel || rel.startsWith("..") ||
|
|
35781
|
+
const resolved = path28__default.resolve(paths.root, indexed.path);
|
|
35782
|
+
const rel = path28__default.relative(paths.wikiDir, resolved);
|
|
35783
|
+
if (!rel || rel.startsWith("..") || path28__default.isAbsolute(rel)) return null;
|
|
35931
35784
|
return readMarkdownFile(resolved);
|
|
35932
35785
|
}
|
|
35933
|
-
const fallbackPath =
|
|
35786
|
+
const fallbackPath = path28__default.join(paths.wikiDir, `${id}.md`);
|
|
35934
35787
|
if (await pathExists(fallbackPath)) {
|
|
35935
35788
|
return readMarkdownFile(fallbackPath);
|
|
35936
35789
|
}
|
|
@@ -35941,20 +35794,20 @@ async function readWikiEntry(id, paths) {
|
|
|
35941
35794
|
async function writeWikiEntryAtTarget(entry, target, paths) {
|
|
35942
35795
|
await ensureMemoryRoot(paths);
|
|
35943
35796
|
assertSafeEntryId(entry.id);
|
|
35944
|
-
const absoluteTarget =
|
|
35945
|
-
const relativeTarget =
|
|
35946
|
-
if (!relativeTarget || relativeTarget.startsWith("..") ||
|
|
35797
|
+
const absoluteTarget = path28__default.resolve(paths.root, target);
|
|
35798
|
+
const relativeTarget = path28__default.relative(paths.wikiDir, absoluteTarget);
|
|
35799
|
+
if (!relativeTarget || relativeTarget.startsWith("..") || path28__default.isAbsolute(relativeTarget)) {
|
|
35947
35800
|
throw new Error(`[fleet-wiki] wiki target escapes wiki/: ${target}`);
|
|
35948
35801
|
}
|
|
35949
35802
|
if (!absoluteTarget.endsWith(".md")) {
|
|
35950
35803
|
throw new Error(`[fleet-wiki] wiki target must end with .md: ${target}`);
|
|
35951
35804
|
}
|
|
35952
|
-
if (
|
|
35805
|
+
if (path28__default.basename(absoluteTarget, ".md") !== entry.id) {
|
|
35953
35806
|
throw new Error("wiki patch body id must match target filename");
|
|
35954
35807
|
}
|
|
35955
|
-
await mkdir(
|
|
35808
|
+
await mkdir(path28__default.dirname(absoluteTarget), { recursive: true });
|
|
35956
35809
|
await writeMarkdownAtomic(absoluteTarget, serializeWikiEntry(entry), paths);
|
|
35957
|
-
return
|
|
35810
|
+
return path28__default.join("wiki", relativeTarget).replaceAll(path28__default.sep, "/");
|
|
35958
35811
|
}
|
|
35959
35812
|
async function writeRawSourceEntry(entry, paths) {
|
|
35960
35813
|
await ensureMemoryRoot(paths);
|
|
@@ -35973,11 +35826,11 @@ async function writeRawSourceEntry(entry, paths) {
|
|
|
35973
35826
|
},
|
|
35974
35827
|
entry.content
|
|
35975
35828
|
);
|
|
35976
|
-
await writeMarkdownAtomic(
|
|
35829
|
+
await writeMarkdownAtomic(path28__default.join(paths.root, relativePath), content, paths);
|
|
35977
35830
|
return relativePath;
|
|
35978
35831
|
}
|
|
35979
35832
|
async function readRawSourceEntry(rawSourceRef, paths) {
|
|
35980
|
-
const absolutePath =
|
|
35833
|
+
const absolutePath = path28__default.resolve(paths.root, rawSourceRef);
|
|
35981
35834
|
assertWithinRawDir(absolutePath, paths);
|
|
35982
35835
|
const parsed = parseMarkdown(await readFile(absolutePath, "utf8"));
|
|
35983
35836
|
return {
|
|
@@ -36165,11 +36018,11 @@ function stripLeadingFrontmatter(body) {
|
|
|
36165
36018
|
return stripped ? next : body;
|
|
36166
36019
|
}
|
|
36167
36020
|
function computeContentHash(content) {
|
|
36168
|
-
return
|
|
36021
|
+
return crypto3.createHash("sha256").update(content, "utf8").digest("hex").slice(0, 8);
|
|
36169
36022
|
}
|
|
36170
36023
|
function assertWithinRawDir(absolutePath, paths) {
|
|
36171
|
-
const relative =
|
|
36172
|
-
if (!relative || relative.startsWith("..") ||
|
|
36024
|
+
const relative = path28__default.relative(paths.rawDir, absolutePath);
|
|
36025
|
+
if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
|
|
36173
36026
|
throw new Error(`[fleet-wiki] raw source ref escapes raw/: ${absolutePath}`);
|
|
36174
36027
|
}
|
|
36175
36028
|
}
|
|
@@ -36225,7 +36078,7 @@ function parseWikiEntry(content) {
|
|
|
36225
36078
|
async function listWikiRecords(paths) {
|
|
36226
36079
|
return listMarkdownEntriesRecursive(paths.wikiDir, paths, (content, filePath) => ({
|
|
36227
36080
|
entry: parseWikiEntry(content),
|
|
36228
|
-
path:
|
|
36081
|
+
path: path28__default.relative(paths.root, filePath).replaceAll(path28__default.sep, "/")
|
|
36229
36082
|
}));
|
|
36230
36083
|
}
|
|
36231
36084
|
async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
|
|
@@ -36238,7 +36091,7 @@ async function listMarkdownEntriesRecursive(dirPath, paths, parser) {
|
|
|
36238
36091
|
}
|
|
36239
36092
|
const sortedEntries = entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
36240
36093
|
for (const entry of sortedEntries) {
|
|
36241
|
-
const filePath =
|
|
36094
|
+
const filePath = path28__default.join(dirPath, entry.name);
|
|
36242
36095
|
if (entry.isDirectory()) {
|
|
36243
36096
|
items.push(...await listMarkdownEntriesRecursive(filePath, paths, parser));
|
|
36244
36097
|
continue;
|
|
@@ -36376,9 +36229,9 @@ async function writeJsonAtomic(filePath, value, paths) {
|
|
|
36376
36229
|
}
|
|
36377
36230
|
async function writeAtomic(filePath, content, paths) {
|
|
36378
36231
|
await ensureMemoryRoot(paths);
|
|
36379
|
-
const tempPath =
|
|
36380
|
-
|
|
36381
|
-
`.tmp-${process.pid}-${Date.now()}-${
|
|
36232
|
+
const tempPath = path28__default.join(
|
|
36233
|
+
path28__default.dirname(filePath),
|
|
36234
|
+
`.tmp-${process.pid}-${Date.now()}-${crypto3.randomUUID()}-${os3__default.hostname()}`
|
|
36382
36235
|
);
|
|
36383
36236
|
await writeFile(tempPath, content, "utf8");
|
|
36384
36237
|
await rename(tempPath, filePath);
|
|
@@ -36424,7 +36277,7 @@ async function enhancedSearch(paths, options) {
|
|
|
36424
36277
|
for (const entry of entries) {
|
|
36425
36278
|
if (!index[entry.id]) {
|
|
36426
36279
|
index[entry.id] = {
|
|
36427
|
-
path:
|
|
36280
|
+
path: path28__default.join("wiki", `${entry.id}.md`),
|
|
36428
36281
|
title: entry.title,
|
|
36429
36282
|
tags: entry.tags,
|
|
36430
36283
|
updated: entry.updated
|
|
@@ -36560,7 +36413,7 @@ function toEnhancedHit(entry, signals) {
|
|
|
36560
36413
|
score: enhancedScore,
|
|
36561
36414
|
reason: signals.legacyReason ?? "body",
|
|
36562
36415
|
excerpt,
|
|
36563
|
-
path:
|
|
36416
|
+
path: path28__default.join("wiki", `${entry.id}.md`),
|
|
36564
36417
|
tags: entry.tags,
|
|
36565
36418
|
updated: entry.updated,
|
|
36566
36419
|
version: entry.version,
|
|
@@ -36756,7 +36609,7 @@ function toRankedHit(entry, reason, detail, graphBoost, backlinksById) {
|
|
|
36756
36609
|
score: basePriority * 100 + statusPriority * 10 + graphScore + (detail.tagBoost ?? 0),
|
|
36757
36610
|
reason,
|
|
36758
36611
|
excerpt,
|
|
36759
|
-
path:
|
|
36612
|
+
path: path28__default.join("wiki", `${entry.id}.md`),
|
|
36760
36613
|
tags: entry.tags,
|
|
36761
36614
|
updated: entry.updated,
|
|
36762
36615
|
version: entry.version,
|
|
@@ -37184,15 +37037,15 @@ var PATCH_SET_DIRNAME = "_sets";
|
|
|
37184
37037
|
var PATCH_SET_META_FILENAME = PATCH_META_FILENAME;
|
|
37185
37038
|
function getPatchSetDir(paths, patchSetId) {
|
|
37186
37039
|
assertSafePatchSetId(patchSetId);
|
|
37187
|
-
const patchSetDir =
|
|
37188
|
-
const relative =
|
|
37189
|
-
if (!relative || relative.startsWith("..") ||
|
|
37040
|
+
const patchSetDir = path28__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId);
|
|
37041
|
+
const relative = path28__default.relative(path28__default.join(paths.queueDir, PATCH_SET_DIRNAME), patchSetDir);
|
|
37042
|
+
if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
|
|
37190
37043
|
throw new Error(`[fleet-wiki] patch set id escapes queue/_sets: ${patchSetId}`);
|
|
37191
37044
|
}
|
|
37192
37045
|
return patchSetDir;
|
|
37193
37046
|
}
|
|
37194
37047
|
function getPatchSetMetaFile(paths, patchSetId) {
|
|
37195
|
-
return
|
|
37048
|
+
return path28__default.join(getPatchSetDir(paths, patchSetId), PATCH_SET_META_FILENAME);
|
|
37196
37049
|
}
|
|
37197
37050
|
function buildPatchSetId(createdAt, sourceRef) {
|
|
37198
37051
|
const compact = createdAt.replace(/[:.]/g, "-");
|
|
@@ -37225,7 +37078,7 @@ async function createConflict(input, paths) {
|
|
|
37225
37078
|
await ensureMemoryRoot(paths);
|
|
37226
37079
|
const now = input.now ?? /* @__PURE__ */ new Date();
|
|
37227
37080
|
const conflictId = buildConflictId(now, input.wikiId, input.reason, input.proposed);
|
|
37228
|
-
const conflictDir =
|
|
37081
|
+
const conflictDir = path28__default.join(paths.conflictsDir, conflictId);
|
|
37229
37082
|
await mkdir(conflictDir, { recursive: true });
|
|
37230
37083
|
const meta3 = {
|
|
37231
37084
|
id: conflictId,
|
|
@@ -37245,13 +37098,13 @@ async function createConflict(input, paths) {
|
|
|
37245
37098
|
currentHash: input.currentHash,
|
|
37246
37099
|
warnings: input.warnings
|
|
37247
37100
|
};
|
|
37248
|
-
await writeJsonFile(
|
|
37249
|
-
await writePatchFile(
|
|
37101
|
+
await writeJsonFile(path28__default.join(conflictDir, CONFLICT_META_FILENAME), meta3, paths);
|
|
37102
|
+
await writePatchFile(path28__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME), input.proposed, paths);
|
|
37250
37103
|
if (input.current !== void 0) {
|
|
37251
|
-
await writePatchFile(
|
|
37104
|
+
await writePatchFile(path28__default.join(conflictDir, CONFLICT_CURRENT_FILENAME), input.current, paths);
|
|
37252
37105
|
}
|
|
37253
37106
|
if (input.rawSource !== void 0) {
|
|
37254
|
-
await writePatchFile(
|
|
37107
|
+
await writePatchFile(path28__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME), input.rawSource, paths);
|
|
37255
37108
|
}
|
|
37256
37109
|
return {
|
|
37257
37110
|
meta: meta3,
|
|
@@ -37265,7 +37118,7 @@ async function listConflicts(paths) {
|
|
|
37265
37118
|
const metas = [];
|
|
37266
37119
|
for (const id of ids) {
|
|
37267
37120
|
try {
|
|
37268
|
-
metas.push(await readJsonFile2(
|
|
37121
|
+
metas.push(await readJsonFile2(path28__default.join(paths.conflictsDir, id, CONFLICT_META_FILENAME)));
|
|
37269
37122
|
} catch {
|
|
37270
37123
|
continue;
|
|
37271
37124
|
}
|
|
@@ -37274,13 +37127,13 @@ async function listConflicts(paths) {
|
|
|
37274
37127
|
}
|
|
37275
37128
|
async function readConflict(conflictId, paths) {
|
|
37276
37129
|
const conflictDir = resolveConflictDir(conflictId, paths);
|
|
37277
|
-
const meta3 = await readJsonFile2(
|
|
37278
|
-
const currentPath =
|
|
37279
|
-
const rawSourcePath =
|
|
37130
|
+
const meta3 = await readJsonFile2(path28__default.join(conflictDir, CONFLICT_META_FILENAME));
|
|
37131
|
+
const currentPath = path28__default.join(conflictDir, CONFLICT_CURRENT_FILENAME);
|
|
37132
|
+
const rawSourcePath = path28__default.join(conflictDir, CONFLICT_RAW_SOURCE_FILENAME);
|
|
37280
37133
|
return {
|
|
37281
37134
|
meta: meta3,
|
|
37282
37135
|
current: await pathExists(currentPath) ? await readPatchFile(currentPath) : void 0,
|
|
37283
|
-
proposed: await readPatchFile(
|
|
37136
|
+
proposed: await readPatchFile(path28__default.join(conflictDir, CONFLICT_PROPOSED_FILENAME)),
|
|
37284
37137
|
rawSource: await pathExists(rawSourcePath) ? await readPatchFile(rawSourcePath) : void 0
|
|
37285
37138
|
};
|
|
37286
37139
|
}
|
|
@@ -37299,9 +37152,9 @@ function sanitizeConflictToken(value) {
|
|
|
37299
37152
|
return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "unknown";
|
|
37300
37153
|
}
|
|
37301
37154
|
function resolveConflictDir(conflictId, paths) {
|
|
37302
|
-
const conflictDir =
|
|
37303
|
-
const relative =
|
|
37304
|
-
if (!relative || relative.startsWith("..") ||
|
|
37155
|
+
const conflictDir = path28__default.resolve(paths.conflictsDir, conflictId);
|
|
37156
|
+
const relative = path28__default.relative(paths.conflictsDir, conflictDir);
|
|
37157
|
+
if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
|
|
37305
37158
|
throw new Error(`[fleet-wiki] conflict id escapes conflicts/: ${conflictId}`);
|
|
37306
37159
|
}
|
|
37307
37160
|
return conflictDir;
|
|
@@ -37339,11 +37192,11 @@ async function validatePatch(patch, paths) {
|
|
|
37339
37192
|
if (!target || !summary || !proposer || !created) throw new Error("patch frontmatter is incomplete");
|
|
37340
37193
|
if (summary.length > 120) throw new Error("patch summary exceeds 120 chars");
|
|
37341
37194
|
assertCanonicalPatchTarget(target);
|
|
37342
|
-
const absoluteTarget =
|
|
37343
|
-
if (!absoluteTarget.startsWith(`${paths.root}${
|
|
37195
|
+
const absoluteTarget = path28__default.resolve(paths.root, target);
|
|
37196
|
+
if (!absoluteTarget.startsWith(`${paths.root}${path28__default.sep}`) && absoluteTarget !== paths.root) {
|
|
37344
37197
|
throw new Error("patch target escapes wiki root");
|
|
37345
37198
|
}
|
|
37346
|
-
if (!absoluteTarget.startsWith(`${paths.wikiDir}${
|
|
37199
|
+
if (!absoluteTarget.startsWith(`${paths.wikiDir}${path28__default.sep}`)) throw new Error("wiki patch must target wiki/");
|
|
37347
37200
|
assertNoSymlinkPathComponents(target, paths);
|
|
37348
37201
|
if (op === "create_wiki" && await pathExists(absoluteTarget)) {
|
|
37349
37202
|
throw new Error(
|
|
@@ -37364,19 +37217,19 @@ async function applyPatch(patch, paths) {
|
|
|
37364
37217
|
async function enqueuePatch(patch, paths, metaOverrides) {
|
|
37365
37218
|
await ensureMemoryRoot(paths);
|
|
37366
37219
|
const patchId = buildPatchId(patch.frontmatter.created, patch.frontmatter.summary, patch.frontmatter.target, patch.body);
|
|
37367
|
-
const queueDir =
|
|
37220
|
+
const queueDir = path28__default.join(paths.queueDir, patchId);
|
|
37368
37221
|
if (await pathExists(queueDir)) {
|
|
37369
37222
|
throw new Error(`[fleet-wiki] patch id collision: ${patchId} - this should never happen with target+body hashing`);
|
|
37370
37223
|
}
|
|
37371
37224
|
await mkdir(queueDir, { recursive: true });
|
|
37372
|
-
await writePatchFile(
|
|
37225
|
+
await writePatchFile(path28__default.join(queueDir, PATCH_FILENAME), serializePatch(patch), paths);
|
|
37373
37226
|
const meta3 = {
|
|
37374
37227
|
id: patchId,
|
|
37375
37228
|
status: "pending",
|
|
37376
37229
|
createdAt: patch.frontmatter.created,
|
|
37377
37230
|
...metaOverrides
|
|
37378
37231
|
};
|
|
37379
|
-
await writeJsonFile(
|
|
37232
|
+
await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), meta3, paths);
|
|
37380
37233
|
await appendLog(paths, "patch enqueued", {
|
|
37381
37234
|
patch_id: patchId,
|
|
37382
37235
|
patch_set_id: meta3.patch_set_id ?? null,
|
|
@@ -37394,7 +37247,7 @@ async function listQueue(paths) {
|
|
|
37394
37247
|
for (const id of ids) {
|
|
37395
37248
|
if (id === "_sets") continue;
|
|
37396
37249
|
try {
|
|
37397
|
-
const meta3 = await readJsonFile2(
|
|
37250
|
+
const meta3 = await readJsonFile2(path28__default.join(paths.queueDir, id, PATCH_META_FILENAME));
|
|
37398
37251
|
results.push({ id, meta: meta3 });
|
|
37399
37252
|
} catch {
|
|
37400
37253
|
continue;
|
|
@@ -37419,17 +37272,17 @@ async function resolveQueueSelection(id, paths) {
|
|
|
37419
37272
|
}
|
|
37420
37273
|
async function showQueue(id, paths) {
|
|
37421
37274
|
const selection = await resolveQueueSelection(id, paths);
|
|
37422
|
-
const queueDir =
|
|
37423
|
-
const patch = await parsePatch(await readPatchFile(
|
|
37424
|
-
const meta3 = await readJsonFile2(
|
|
37275
|
+
const queueDir = path28__default.join(paths.queueDir, selection.id);
|
|
37276
|
+
const patch = await parsePatch(await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME)));
|
|
37277
|
+
const meta3 = await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME));
|
|
37425
37278
|
return { patch, meta: meta3 };
|
|
37426
37279
|
}
|
|
37427
37280
|
async function rewriteQueuedPatch(id, paths, patch, meta3, expectedPatchHash) {
|
|
37428
37281
|
assertSafeQueueId(id);
|
|
37429
37282
|
return withPatchEditLock(paths, id, async () => {
|
|
37430
|
-
const queueDir =
|
|
37283
|
+
const queueDir = path28__default.join(paths.queueDir, id);
|
|
37431
37284
|
if (expectedPatchHash !== void 0) {
|
|
37432
|
-
const currentMarkdown = await readPatchFile(
|
|
37285
|
+
const currentMarkdown = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
|
|
37433
37286
|
const currentHash = computeContentHash(currentMarkdown);
|
|
37434
37287
|
if (currentHash !== expectedPatchHash) {
|
|
37435
37288
|
throw new Error(`[fleet-wiki] wiki_patch_edit stale base_patch_hash: expected ${currentHash}, got ${expectedPatchHash}`);
|
|
@@ -37438,8 +37291,8 @@ async function rewriteQueuedPatch(id, paths, patch, meta3, expectedPatchHash) {
|
|
|
37438
37291
|
const patchMarkdown = serializePatch(patch);
|
|
37439
37292
|
const patchHash = computeContentHash(patchMarkdown);
|
|
37440
37293
|
const nextMeta = { ...meta3, lastEditHash: patchHash };
|
|
37441
|
-
await writePatchFile(
|
|
37442
|
-
await writeJsonFile(
|
|
37294
|
+
await writePatchFile(path28__default.join(queueDir, PATCH_FILENAME), patchMarkdown, paths);
|
|
37295
|
+
await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), nextMeta, paths);
|
|
37443
37296
|
return patchHash;
|
|
37444
37297
|
});
|
|
37445
37298
|
}
|
|
@@ -37463,8 +37316,8 @@ async function approvePatch(id, paths) {
|
|
|
37463
37316
|
rawSourceRef: meta3.rawSourceRef,
|
|
37464
37317
|
warnings: meta3.warnings
|
|
37465
37318
|
});
|
|
37466
|
-
const queueDir =
|
|
37467
|
-
await writeJsonFile(
|
|
37319
|
+
const queueDir = path28__default.join(paths.queueDir, id);
|
|
37320
|
+
await writeJsonFile(path28__default.join(queueDir, PATCH_META_FILENAME), {
|
|
37468
37321
|
...meta3,
|
|
37469
37322
|
conflictId
|
|
37470
37323
|
}, paths);
|
|
@@ -37500,7 +37353,7 @@ async function approvePatchSet(patchSetId, paths) {
|
|
|
37500
37353
|
const failed = [];
|
|
37501
37354
|
const missing = [];
|
|
37502
37355
|
for (const patchId of patchSet.patchIds) {
|
|
37503
|
-
const queueDir =
|
|
37356
|
+
const queueDir = path28__default.join(paths.queueDir, patchId);
|
|
37504
37357
|
if (!await pathExists(queueDir)) {
|
|
37505
37358
|
missing.push(patchId);
|
|
37506
37359
|
continue;
|
|
@@ -37566,7 +37419,7 @@ ${patch.body}`;
|
|
|
37566
37419
|
}
|
|
37567
37420
|
async function normalizeWikiEntryPatch(entry, target, paths) {
|
|
37568
37421
|
assertSafeEntryId(entry.id);
|
|
37569
|
-
if (entry.id !==
|
|
37422
|
+
if (entry.id !== path28__default.basename(target, ".md")) {
|
|
37570
37423
|
throw new Error("wiki patch body id must match target filename");
|
|
37571
37424
|
}
|
|
37572
37425
|
const inlineRawSourceRef = extractInlineRawSourceRef(entry.body);
|
|
@@ -37609,9 +37462,9 @@ function buildPatchId(createdAt, summary, target, body) {
|
|
|
37609
37462
|
}
|
|
37610
37463
|
async function validatePatchBase(patch, meta3, paths) {
|
|
37611
37464
|
if (patch.frontmatter.op !== "update_wiki" || !meta3?.baseVersion && !meta3?.baseHash) return;
|
|
37612
|
-
const wikiId =
|
|
37465
|
+
const wikiId = path28__default.basename(patch.frontmatter.target, ".md");
|
|
37613
37466
|
const currentEntry = await readWikiEntry(wikiId, paths);
|
|
37614
|
-
const currentPath =
|
|
37467
|
+
const currentPath = path28__default.join(paths.root, patch.frontmatter.target);
|
|
37615
37468
|
const currentMarkdown = await pathExists(currentPath) ? await readPatchFile(currentPath) : void 0;
|
|
37616
37469
|
if (meta3.baseVersion !== void 0 && currentEntry?.version !== meta3.baseVersion) {
|
|
37617
37470
|
throw new Error(
|
|
@@ -37670,17 +37523,17 @@ function assertCanonicalPatchTarget(target) {
|
|
|
37670
37523
|
if (target.endsWith("/")) {
|
|
37671
37524
|
throw new Error("patch target must not end with a slash");
|
|
37672
37525
|
}
|
|
37673
|
-
if (target.startsWith("/") ||
|
|
37526
|
+
if (target.startsWith("/") || path28__default.posix.isAbsolute(target) || path28__default.win32.isAbsolute(target)) {
|
|
37674
37527
|
throw new Error("patch target must be relative");
|
|
37675
37528
|
}
|
|
37676
|
-
if (
|
|
37529
|
+
if (path28__default.posix.normalize(target) !== target) {
|
|
37677
37530
|
throw new Error("patch target must not contain dot segments or redundant separators");
|
|
37678
37531
|
}
|
|
37679
37532
|
}
|
|
37680
37533
|
function canonicalApprovalLockKey(paths, target) {
|
|
37681
37534
|
const wikiRoot = realpathSync(paths.wikiDir);
|
|
37682
|
-
const relativeTarget =
|
|
37683
|
-
const targetPath =
|
|
37535
|
+
const relativeTarget = path28__default.posix.relative("wiki", target);
|
|
37536
|
+
const targetPath = path28__default.join(wikiRoot, ...relativeTarget.split("/"));
|
|
37684
37537
|
return `${wikiRoot}\0${targetPath}`.toLowerCase();
|
|
37685
37538
|
}
|
|
37686
37539
|
function canonicalPatchEditLockKey(paths, patchId) {
|
|
@@ -37696,7 +37549,7 @@ function assertNoSymlinkPathComponents(target, paths) {
|
|
|
37696
37549
|
throw error51;
|
|
37697
37550
|
}
|
|
37698
37551
|
for (const part of parts) {
|
|
37699
|
-
current =
|
|
37552
|
+
current = path28__default.join(current, part);
|
|
37700
37553
|
try {
|
|
37701
37554
|
if (lstatSync(current).isSymbolicLink()) {
|
|
37702
37555
|
throw new Error("patch target must not include symlink path components");
|
|
@@ -37711,8 +37564,8 @@ function assertSafeRawSourceRef(rawSourceRef, paths) {
|
|
|
37711
37564
|
if (!rawSourceRef.startsWith("raw/")) {
|
|
37712
37565
|
throw new Error("raw source provenance must point into raw/");
|
|
37713
37566
|
}
|
|
37714
|
-
const absoluteRef =
|
|
37715
|
-
if (!absoluteRef.startsWith(`${paths.rawDir}${
|
|
37567
|
+
const absoluteRef = path28__default.resolve(paths.root, rawSourceRef);
|
|
37568
|
+
if (!absoluteRef.startsWith(`${paths.rawDir}${path28__default.sep}`)) {
|
|
37716
37569
|
throw new Error("raw source provenance must point into raw/");
|
|
37717
37570
|
}
|
|
37718
37571
|
}
|
|
@@ -37728,14 +37581,14 @@ function classifyPatchConflict(error51) {
|
|
|
37728
37581
|
}
|
|
37729
37582
|
async function recordPatchConflict(patch, paths, reason, options) {
|
|
37730
37583
|
const now = /* @__PURE__ */ new Date();
|
|
37731
|
-
const targetPath =
|
|
37584
|
+
const targetPath = path28__default.join(paths.root, patch.frontmatter.target);
|
|
37732
37585
|
const current = await pathExists(targetPath) ? await readPatchFile(targetPath) : void 0;
|
|
37733
37586
|
const currentEntry = current ? parseStoredWikiEntry(current) : void 0;
|
|
37734
37587
|
const proposedEntry = parsePatchBodyEntry(patch.body);
|
|
37735
37588
|
const record2 = await createConflict({
|
|
37736
37589
|
reason,
|
|
37737
37590
|
target: patch.frontmatter.target,
|
|
37738
|
-
wikiId: proposedEntry?.id ??
|
|
37591
|
+
wikiId: proposedEntry?.id ?? path28__default.basename(patch.frontmatter.target, ".md"),
|
|
37739
37592
|
title: proposedEntry?.title,
|
|
37740
37593
|
proposer: patch.frontmatter.proposer,
|
|
37741
37594
|
rawSourceRef: options?.rawSourceRef,
|
|
@@ -37831,11 +37684,11 @@ function parseInlineArray(value) {
|
|
|
37831
37684
|
return inner.split(",").map((item) => item.trim().replace(/^"(.*)"$/, "$1"));
|
|
37832
37685
|
}
|
|
37833
37686
|
async function archiveQueueEntry(id, paths, meta3) {
|
|
37834
|
-
const fromDir =
|
|
37835
|
-
const toDir =
|
|
37687
|
+
const fromDir = path28__default.join(paths.queueDir, id);
|
|
37688
|
+
const toDir = path28__default.join(paths.archiveDir, id);
|
|
37836
37689
|
await removePath(toDir);
|
|
37837
37690
|
await movePath(fromDir, toDir);
|
|
37838
|
-
await writeJsonFile(
|
|
37691
|
+
await writeJsonFile(path28__default.join(toDir, PATCH_META_FILENAME), meta3, paths);
|
|
37839
37692
|
}
|
|
37840
37693
|
function buildQueueIdHelp(prefix, availableIds) {
|
|
37841
37694
|
if (availableIds.length === 0) {
|
|
@@ -38047,7 +37900,7 @@ async function resolveCompileSource(input, paths, now) {
|
|
|
38047
37900
|
}
|
|
38048
37901
|
async function buildCompileProposals(input, paths, now, resolvedSource) {
|
|
38049
37902
|
const sourceTarget = `wiki/sources/${resolvedSource.sourcePageId}.md`;
|
|
38050
|
-
const sourceExists = await pathExists(
|
|
37903
|
+
const sourceExists = await pathExists(path28__default.join(paths.root, sourceTarget));
|
|
38051
37904
|
const existingEntries = await listWiki(paths);
|
|
38052
37905
|
const sourcePageTitle = resolvedSource.sourceTitle?.trim() || `Source ${resolvedSource.sourcePageId}`;
|
|
38053
37906
|
const existingSourceEntry = existingEntries.find((entry) => entry.id === resolvedSource.sourcePageId);
|
|
@@ -38069,7 +37922,7 @@ async function buildCompileProposals(input, paths, now, resolvedSource) {
|
|
|
38069
37922
|
target: sourceTarget,
|
|
38070
37923
|
summary: truncateSummary(`Compile source page ${sourcePageTitle}`),
|
|
38071
37924
|
entry: sourceEntry,
|
|
38072
|
-
baseHash: sourceExists ? computeContentHash(await readPatchFile(
|
|
37925
|
+
baseHash: sourceExists ? computeContentHash(await readPatchFile(path28__default.join(paths.root, sourceTarget))) : void 0,
|
|
38073
37926
|
baseVersion: existingSourceEntry?.version
|
|
38074
37927
|
}];
|
|
38075
37928
|
const relatedCandidates = await discoverRelatedEntryCandidates(paths, resolvedSource.sourceContent, resolvedSource.sourceTitle);
|
|
@@ -38089,7 +37942,7 @@ async function buildCompileProposals(input, paths, now, resolvedSource) {
|
|
|
38089
37942
|
rawSourceRefs: mergeRawSourceRefs(existing.rawSourceRefs, existing.rawSourceRef, { ref: resolvedSource.rawSourceRef }),
|
|
38090
37943
|
body: appendSourceCompileNote(existing.body, resolvedSource.sourcePageId, resolvedSource.rawSourceRef)
|
|
38091
37944
|
},
|
|
38092
|
-
baseHash: computeContentHash(await readPatchFile(
|
|
37945
|
+
baseHash: computeContentHash(await readPatchFile(path28__default.join(paths.wikiDir, `${existing.id}.md`))),
|
|
38093
37946
|
baseVersion: existing.version
|
|
38094
37947
|
});
|
|
38095
37948
|
}
|
|
@@ -38224,13 +38077,13 @@ async function readClaims(entryId, paths) {
|
|
|
38224
38077
|
}
|
|
38225
38078
|
}
|
|
38226
38079
|
function getClaimsDir(paths) {
|
|
38227
|
-
return
|
|
38080
|
+
return path28__default.join(paths.wikiDir, CLAIMS_DIRNAME);
|
|
38228
38081
|
}
|
|
38229
38082
|
function getClaimsFile(paths, entryId) {
|
|
38230
38083
|
assertSafeEntryId(entryId);
|
|
38231
|
-
const claimsFile =
|
|
38232
|
-
const relative =
|
|
38233
|
-
if (!relative || relative.startsWith("..") ||
|
|
38084
|
+
const claimsFile = path28__default.join(getClaimsDir(paths), `${entryId}.json`);
|
|
38085
|
+
const relative = path28__default.relative(getClaimsDir(paths), claimsFile);
|
|
38086
|
+
if (!relative || relative.startsWith("..") || path28__default.isAbsolute(relative)) {
|
|
38234
38087
|
throw new Error(`[fleet-wiki] claims sidecar escapes wiki/.claims: ${entryId}`);
|
|
38235
38088
|
}
|
|
38236
38089
|
return claimsFile;
|
|
@@ -38321,7 +38174,7 @@ function assertSafeClaimRawRef(ref) {
|
|
|
38321
38174
|
if (!ref.startsWith("raw/")) {
|
|
38322
38175
|
throw new Error(`claim sourceRef must point into raw/: ${ref}`);
|
|
38323
38176
|
}
|
|
38324
|
-
if (ref.includes("..") ||
|
|
38177
|
+
if (ref.includes("..") || path28__default.isAbsolute(ref)) {
|
|
38325
38178
|
throw new Error(`claim sourceRef escapes raw/: ${ref}`);
|
|
38326
38179
|
}
|
|
38327
38180
|
}
|
|
@@ -38399,22 +38252,22 @@ async function runDryDock(paths, options = {}) {
|
|
|
38399
38252
|
}
|
|
38400
38253
|
for (const fileName of await listFileNames(paths.rawDir)) {
|
|
38401
38254
|
if (!fileName.endsWith(".md")) continue;
|
|
38402
|
-
const filePath =
|
|
38255
|
+
const filePath = path28__default.join(paths.rawDir, fileName);
|
|
38403
38256
|
issues.push(...safetyIssues(await readPatchFile(filePath), filePath));
|
|
38404
38257
|
}
|
|
38405
38258
|
for (const queueId of await listDirectoryNames(paths.queueDir)) {
|
|
38406
38259
|
if (queueId === PATCH_SET_DIRNAME) continue;
|
|
38407
|
-
const queueDir =
|
|
38260
|
+
const queueDir = path28__default.join(paths.queueDir, queueId);
|
|
38408
38261
|
try {
|
|
38409
|
-
const patchContent = await readPatchFile(
|
|
38410
|
-
issues.push(...safetyIssues(patchContent,
|
|
38411
|
-
await readJsonFile2(
|
|
38262
|
+
const patchContent = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
|
|
38263
|
+
issues.push(...safetyIssues(patchContent, path28__default.join(queueDir, PATCH_FILENAME)));
|
|
38264
|
+
await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME));
|
|
38412
38265
|
} catch {
|
|
38413
38266
|
issues.push(issue2("malformed_queue", "error", "\uC190\uC0C1\uB41C queue \uC5D4\uD2B8\uB9AC", queueDir));
|
|
38414
38267
|
}
|
|
38415
38268
|
}
|
|
38416
|
-
for (const patchSetId of await listDirectoryNames(
|
|
38417
|
-
const patchSetMetaFile =
|
|
38269
|
+
for (const patchSetId of await listDirectoryNames(path28__default.join(paths.queueDir, PATCH_SET_DIRNAME))) {
|
|
38270
|
+
const patchSetMetaFile = path28__default.join(paths.queueDir, PATCH_SET_DIRNAME, patchSetId, PATCH_META_FILENAME);
|
|
38418
38271
|
let patchSet;
|
|
38419
38272
|
try {
|
|
38420
38273
|
patchSet = await readPatchSet(paths, patchSetId);
|
|
@@ -38423,8 +38276,8 @@ async function runDryDock(paths, options = {}) {
|
|
|
38423
38276
|
continue;
|
|
38424
38277
|
}
|
|
38425
38278
|
for (const patchId of patchSet.patchIds) {
|
|
38426
|
-
const queueMetaFile =
|
|
38427
|
-
const archiveMetaFile =
|
|
38279
|
+
const queueMetaFile = path28__default.join(paths.queueDir, patchId, PATCH_META_FILENAME);
|
|
38280
|
+
const archiveMetaFile = path28__default.join(paths.archiveDir, patchId, PATCH_META_FILENAME);
|
|
38428
38281
|
if (!await pathExists(queueMetaFile) && !await pathExists(archiveMetaFile)) {
|
|
38429
38282
|
issues.push(
|
|
38430
38283
|
issue2(
|
|
@@ -38461,7 +38314,7 @@ async function runDryDock(paths, options = {}) {
|
|
|
38461
38314
|
"conflict_unresolved",
|
|
38462
38315
|
"warning",
|
|
38463
38316
|
`\uBBF8\uD574\uACB0 conflict: ${conflict.reason} (${conflict.target})`,
|
|
38464
|
-
|
|
38317
|
+
path28__default.join(paths.conflictsDir, conflict.id, "meta.json")
|
|
38465
38318
|
)
|
|
38466
38319
|
);
|
|
38467
38320
|
}
|
|
@@ -38474,7 +38327,7 @@ async function runDryDock(paths, options = {}) {
|
|
|
38474
38327
|
"unresolved_conflict",
|
|
38475
38328
|
"warning",
|
|
38476
38329
|
"\uC190\uC0C1\uB41C conflict \uC5D4\uD2B8\uB9AC",
|
|
38477
|
-
|
|
38330
|
+
path28__default.join(paths.conflictsDir, conflictId, "meta.json")
|
|
38478
38331
|
)
|
|
38479
38332
|
);
|
|
38480
38333
|
}
|
|
@@ -38531,8 +38384,8 @@ async function claimIssues(paths, wikiIds) {
|
|
|
38531
38384
|
const claimsDir = getClaimsDir(paths);
|
|
38532
38385
|
for (const fileName of await listFileNames(claimsDir)) {
|
|
38533
38386
|
if (!fileName.endsWith(".json")) continue;
|
|
38534
|
-
const filePath =
|
|
38535
|
-
const entryIdFromFile =
|
|
38387
|
+
const filePath = path28__default.join(claimsDir, fileName);
|
|
38388
|
+
const entryIdFromFile = path28__default.basename(fileName, ".json");
|
|
38536
38389
|
let raw;
|
|
38537
38390
|
try {
|
|
38538
38391
|
raw = await readJsonFile2(filePath);
|
|
@@ -38611,7 +38464,7 @@ function toSemanticEntry(filePath, frontmatter, body) {
|
|
|
38611
38464
|
async function schemaIssues(paths) {
|
|
38612
38465
|
const issues = [];
|
|
38613
38466
|
const schema = await readWorkspaceSchemaSummary(paths);
|
|
38614
|
-
const agentsPath =
|
|
38467
|
+
const agentsPath = path28__default.join(paths.schemaDir, WORKSPACE_SCHEMA_AGENTS_FILENAME);
|
|
38615
38468
|
if (!await pathExists(schema.wikiSchemaPath)) {
|
|
38616
38469
|
issues.push(issue2("schema_missing", "warning", `Workspace schema file is missing: schema/${WORKSPACE_SCHEMA_FILENAME}`, schema.wikiSchemaPath));
|
|
38617
38470
|
} else {
|
|
@@ -38931,7 +38784,7 @@ function parseOptionalIsoDate(value) {
|
|
|
38931
38784
|
return Number.isFinite(timestamp) ? timestamp : null;
|
|
38932
38785
|
}
|
|
38933
38786
|
function hashBodyForComparison(body) {
|
|
38934
|
-
return
|
|
38787
|
+
return crypto3.createHash("sha256").update(body.replace(/\s+/g, " ").trim(), "utf8").digest("hex").slice(0, 8);
|
|
38935
38788
|
}
|
|
38936
38789
|
function hasConflictingStatuses(entries) {
|
|
38937
38790
|
const statuses = new Set(entries.map((entry) => entry.status).filter((status) => status !== "unknown"));
|
|
@@ -38998,7 +38851,7 @@ async function listWikiMarkdownFiles(dirPath) {
|
|
|
38998
38851
|
const files = [];
|
|
38999
38852
|
const sortedEntries = entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
39000
38853
|
for (const entry of sortedEntries) {
|
|
39001
|
-
const filePath =
|
|
38854
|
+
const filePath = path28__default.join(dirPath, entry.name);
|
|
39002
38855
|
if (entry.isDirectory()) {
|
|
39003
38856
|
files.push(...await listWikiMarkdownFiles(filePath));
|
|
39004
38857
|
continue;
|
|
@@ -39082,7 +38935,7 @@ async function planIngest(input, paths, now) {
|
|
|
39082
38935
|
const target = `wiki/${input.id}.md`;
|
|
39083
38936
|
const proposer = input.proposer ?? "tool:wiki_ingest";
|
|
39084
38937
|
const currentEntry = await readWikiEntry(input.id, paths);
|
|
39085
|
-
const currentMarkdown = currentEntry ? await readPatchFile(
|
|
38938
|
+
const currentMarkdown = currentEntry ? await readPatchFile(path28__default.join(paths.wikiDir, `${input.id}.md`)) : void 0;
|
|
39086
38939
|
const currentHash = currentMarkdown ? computeContentHash(currentMarkdown) : void 0;
|
|
39087
38940
|
const rawSource = buildRawSourceEntry(input, now);
|
|
39088
38941
|
await ensureWorkspaceSchema(paths);
|
|
@@ -39761,11 +39614,11 @@ async function editQueuedPatch(input, paths) {
|
|
|
39761
39614
|
};
|
|
39762
39615
|
}
|
|
39763
39616
|
async function readQueuedPatchSnapshot(paths, patchId) {
|
|
39764
|
-
const queueDir =
|
|
39765
|
-
const markdown = await readPatchFile(
|
|
39617
|
+
const queueDir = path28__default.join(paths.queueDir, patchId);
|
|
39618
|
+
const markdown = await readPatchFile(path28__default.join(queueDir, PATCH_FILENAME));
|
|
39766
39619
|
return {
|
|
39767
39620
|
patch: await parsePatch(markdown),
|
|
39768
|
-
meta: await readJsonFile2(
|
|
39621
|
+
meta: await readJsonFile2(path28__default.join(queueDir, PATCH_META_FILENAME)),
|
|
39769
39622
|
patchHash: computeContentHash(markdown)
|
|
39770
39623
|
};
|
|
39771
39624
|
}
|
|
@@ -40527,7 +40380,7 @@ ${input.answer ?? ""}`)}`;
|
|
|
40527
40380
|
assertSafeEntryId(targetId);
|
|
40528
40381
|
const subdir = input.targetType === "synthesis" ? "synthesis" : "queries";
|
|
40529
40382
|
const target = `wiki/${subdir}/${targetId}.md`;
|
|
40530
|
-
const absoluteTarget =
|
|
40383
|
+
const absoluteTarget = path28__default.join(paths.root, target);
|
|
40531
40384
|
const exists = await pathExists(absoluteTarget);
|
|
40532
40385
|
const existingEntry = exists ? await readWikiEntry(targetId, paths) : null;
|
|
40533
40386
|
if (exists && !existingEntry) {
|
|
@@ -40609,7 +40462,7 @@ function assertSafeRawRef(rawRef) {
|
|
|
40609
40462
|
if (!rawRef.startsWith("raw/")) {
|
|
40610
40463
|
throw new Error(`[fleet-wiki] wiki_query raw source ref must point into raw/: ${rawRef}`);
|
|
40611
40464
|
}
|
|
40612
|
-
if (rawRef.includes("..") ||
|
|
40465
|
+
if (rawRef.includes("..") || path28__default.isAbsolute(rawRef)) {
|
|
40613
40466
|
throw new Error(`[fleet-wiki] wiki_query raw source ref escapes raw/: ${rawRef}`);
|
|
40614
40467
|
}
|
|
40615
40468
|
}
|
|
@@ -40728,7 +40581,7 @@ async function buildReadEntryResult(entry, paths, graph, input) {
|
|
|
40728
40581
|
rawSourceRef: entry.rawSourceRef,
|
|
40729
40582
|
rawSourceRefs,
|
|
40730
40583
|
source: {
|
|
40731
|
-
path:
|
|
40584
|
+
path: path28__default.join("wiki", `${entry.id}.md`),
|
|
40732
40585
|
rawSourceRef: entry.rawSourceRef,
|
|
40733
40586
|
rawSourceRefs
|
|
40734
40587
|
},
|
|
@@ -40854,7 +40707,7 @@ function buildRelatedEntries(entry, graph) {
|
|
|
40854
40707
|
deduped.set(candidate.id, {
|
|
40855
40708
|
id: relatedEntry.id,
|
|
40856
40709
|
title: relatedEntry.title,
|
|
40857
|
-
path:
|
|
40710
|
+
path: path28__default.join("wiki", `${relatedEntry.id}.md`),
|
|
40858
40711
|
reason: candidate.reason
|
|
40859
40712
|
});
|
|
40860
40713
|
}
|
|
@@ -41127,7 +40980,7 @@ var DEFAULT_TICKET_TTL_MS = 1e4;
|
|
|
41127
40980
|
function createPluginTerminalTicketRegistry(deps = {}) {
|
|
41128
40981
|
const ttlMs = deps.ttlMs ?? DEFAULT_TICKET_TTL_MS;
|
|
41129
40982
|
const now = deps.now ?? Date.now;
|
|
41130
|
-
const randomTicket = deps.randomTicket ?? (() =>
|
|
40983
|
+
const randomTicket = deps.randomTicket ?? (() => crypto3.randomBytes(32).toString("base64url"));
|
|
41131
40984
|
const tickets = /* @__PURE__ */ new Map();
|
|
41132
40985
|
function issue3(context) {
|
|
41133
40986
|
prune();
|
|
@@ -41161,18 +41014,18 @@ function resolveConsolePackageRequire(currentFile, fallback) {
|
|
|
41161
41014
|
function findConsolePackageRequire(currentFile) {
|
|
41162
41015
|
const explicitRoot = process.env.FLEET_CONSOLE_PACKAGE_ROOT;
|
|
41163
41016
|
if (explicitRoot) {
|
|
41164
|
-
const explicitPackageJson =
|
|
41017
|
+
const explicitPackageJson = path28__default.join(explicitRoot, "package.json");
|
|
41165
41018
|
if (isFleetConsolePackage(explicitPackageJson)) return createRequire(explicitPackageJson);
|
|
41166
41019
|
}
|
|
41167
|
-
let dir =
|
|
41020
|
+
let dir = path28__default.dirname(currentFile);
|
|
41168
41021
|
while (true) {
|
|
41169
|
-
const packageJson =
|
|
41022
|
+
const packageJson = path28__default.join(dir, "package.json");
|
|
41170
41023
|
if (isFleetConsolePackage(packageJson)) return createRequire(packageJson);
|
|
41171
|
-
const nestedConsolePackage =
|
|
41024
|
+
const nestedConsolePackage = path28__default.join(dir, "runtime", "fleet-console", "package.json");
|
|
41172
41025
|
if (isFleetConsolePackage(nestedConsolePackage)) return createRequire(nestedConsolePackage);
|
|
41173
|
-
const siblingConsolePackage =
|
|
41026
|
+
const siblingConsolePackage = path28__default.join(dir, "..", "..", "fleet-console", "package.json");
|
|
41174
41027
|
if (isFleetConsolePackage(siblingConsolePackage)) return createRequire(siblingConsolePackage);
|
|
41175
|
-
const parent =
|
|
41028
|
+
const parent = path28__default.dirname(dir);
|
|
41176
41029
|
if (parent === dir) return null;
|
|
41177
41030
|
dir = parent;
|
|
41178
41031
|
}
|
|
@@ -41208,10 +41061,10 @@ var DEFAULT_TERMINAL_CWD_FALLBACK = os3__default.homedir;
|
|
|
41208
41061
|
var TERMINAL_TERM = "xterm-256color";
|
|
41209
41062
|
var require2 = createRequire(import.meta.url);
|
|
41210
41063
|
function createShellTerminalLaunchResolver(deps = {}) {
|
|
41211
|
-
const baseCwd = deps.cwd ??
|
|
41212
|
-
const env = deps.env ??
|
|
41064
|
+
const baseCwd = deps.cwd ?? process4.cwd();
|
|
41065
|
+
const env = deps.env ?? process4.env;
|
|
41213
41066
|
const homedir3 = deps.homedir ?? DEFAULT_TERMINAL_CWD_FALLBACK;
|
|
41214
|
-
const platform = deps.platform ??
|
|
41067
|
+
const platform = deps.platform ?? process4.platform;
|
|
41215
41068
|
return async (selectedCwd) => {
|
|
41216
41069
|
const cwd = selectedCwd || baseCwd || homedir3();
|
|
41217
41070
|
const shell = resolveWindowsLaunchBinary(resolveUserShell(env, platform), [], env, platform, "user shell");
|
|
@@ -41222,7 +41075,7 @@ function startTerminalShell(launch, size) {
|
|
|
41222
41075
|
const testStartShell = globalThis.__fleetTerminalStartShell;
|
|
41223
41076
|
if (testStartShell) return testStartShell(launch, size);
|
|
41224
41077
|
const { spawn: spawnPty } = loadNodePty();
|
|
41225
|
-
const useConptyDll = resolveUseConptyDll(
|
|
41078
|
+
const useConptyDll = resolveUseConptyDll(process4.platform, process4.env);
|
|
41226
41079
|
return spawnPty(launch.bin, [...launch.args], {
|
|
41227
41080
|
cols: size.cols,
|
|
41228
41081
|
rows: size.rows,
|
|
@@ -41238,11 +41091,26 @@ function resolveUseConptyDll(platform, env) {
|
|
|
41238
41091
|
return override !== "0" && override !== "false";
|
|
41239
41092
|
}
|
|
41240
41093
|
function loadNodePty() {
|
|
41241
|
-
|
|
41094
|
+
const nodePtyRequire = loadNodePtyRequire(fileURLToPath(import.meta.url));
|
|
41095
|
+
ensureNodePtySpawnHelpersExecutable(path28__default.dirname(nodePtyRequire.resolve("node-pty/package.json")));
|
|
41096
|
+
return nodePtyRequire("node-pty");
|
|
41242
41097
|
}
|
|
41243
41098
|
function loadNodePtyRequire(currentFile) {
|
|
41244
41099
|
return resolveConsolePackageRequire(currentFile, require2);
|
|
41245
41100
|
}
|
|
41101
|
+
function ensureNodePtySpawnHelpersExecutable(packageRoot, platform = process4.platform, architecture = process4.arch) {
|
|
41102
|
+
if (platform !== "darwin") return;
|
|
41103
|
+
for (const directory of ["build/Release", "build/Debug", `prebuilds/darwin-${architecture}`]) {
|
|
41104
|
+
const helper = path28__default.join(packageRoot, directory, "spawn-helper");
|
|
41105
|
+
try {
|
|
41106
|
+
const stat3 = lstatSync(helper);
|
|
41107
|
+
if (!stat3.isFile() || stat3.isSymbolicLink() || (stat3.mode & 73) === 73) continue;
|
|
41108
|
+
chmodSync(helper, stat3.mode | 73);
|
|
41109
|
+
} catch (error51) {
|
|
41110
|
+
if (error51.code !== "ENOENT") throw error51;
|
|
41111
|
+
}
|
|
41112
|
+
}
|
|
41113
|
+
}
|
|
41246
41114
|
function resolveUserShell(env, platform) {
|
|
41247
41115
|
if (env.SHELL) return env.SHELL;
|
|
41248
41116
|
if (platform === "win32") return env.ComSpec || "powershell.exe";
|
|
@@ -42014,7 +41882,7 @@ function captureSession(options) {
|
|
|
42014
41882
|
function readProviderSessionCapture(fleetSessionId, deps = {}) {
|
|
42015
41883
|
if (!isSafeCaptureId(fleetSessionId)) return null;
|
|
42016
41884
|
const capturesDir = deps.capturesDir ?? defaultCapturePaths().capturesDir;
|
|
42017
|
-
const filePath =
|
|
41885
|
+
const filePath = path28__default.join(capturesDir, `${fleetSessionId}.json`);
|
|
42018
41886
|
try {
|
|
42019
41887
|
const parsed = JSON.parse(fs2__default.readFileSync(filePath, "utf8"));
|
|
42020
41888
|
return sanitizeProviderSession(parsed);
|
|
@@ -42026,7 +41894,7 @@ function unlinkProviderSessionCapture(fleetSessionId, deps = {}) {
|
|
|
42026
41894
|
if (!isSafeCaptureId(fleetSessionId)) return false;
|
|
42027
41895
|
const capturesDir = deps.capturesDir ?? defaultCapturePaths().capturesDir;
|
|
42028
41896
|
try {
|
|
42029
|
-
fs2__default.unlinkSync(
|
|
41897
|
+
fs2__default.unlinkSync(path28__default.join(capturesDir, `${fleetSessionId}.json`));
|
|
42030
41898
|
return true;
|
|
42031
41899
|
} catch {
|
|
42032
41900
|
return false;
|
|
@@ -42034,12 +41902,12 @@ function unlinkProviderSessionCapture(fleetSessionId, deps = {}) {
|
|
|
42034
41902
|
}
|
|
42035
41903
|
function captureSessionStrict(options) {
|
|
42036
41904
|
const provider = parseProvider(options.provider);
|
|
42037
|
-
const fleetSessionId = readFleetSessionId(options.env ??
|
|
41905
|
+
const fleetSessionId = readFleetSessionId(options.env ?? process4.env);
|
|
42038
41906
|
const input = parseHookInput(options.input ?? "");
|
|
42039
41907
|
const providerSession = toProviderSession(provider, input, options.now ?? (() => /* @__PURE__ */ new Date()));
|
|
42040
41908
|
const capturesDir = (options.paths ?? defaultCapturePaths()).capturesDir;
|
|
42041
|
-
const finalPath =
|
|
42042
|
-
const tempPath =
|
|
41909
|
+
const finalPath = path28__default.join(capturesDir, `${fleetSessionId}.json`);
|
|
41910
|
+
const tempPath = path28__default.join(capturesDir, `${CAPTURE_TEMP_PREFIX}${fleetSessionId}.${process4.pid}.${Date.now()}.tmp`);
|
|
42043
41911
|
fs2__default.mkdirSync(capturesDir, { recursive: true, mode: 448 });
|
|
42044
41912
|
fs2__default.writeFileSync(tempPath, `${JSON.stringify(providerSession, null, 2)}
|
|
42045
41913
|
`, { mode: 384 });
|
|
@@ -42047,13 +41915,13 @@ function captureSessionStrict(options) {
|
|
|
42047
41915
|
return { path: finalPath, providerSession };
|
|
42048
41916
|
}
|
|
42049
41917
|
function parseProvider(value) {
|
|
42050
|
-
if (
|
|
41918
|
+
if (value === "claude" || value === "codex") return value;
|
|
42051
41919
|
throw new Error("invalid_provider");
|
|
42052
41920
|
}
|
|
42053
41921
|
function readFleetSessionId(env) {
|
|
42054
41922
|
const value = env.FLEET_CONSOLE_SESSION_ID;
|
|
42055
41923
|
if (!value) throw new Error("missing_fleet_session_id");
|
|
42056
|
-
if (
|
|
41924
|
+
if (path28__default.basename(value) !== value || value.includes(path28__default.sep) || value.includes(path28__default.posix.sep)) {
|
|
42057
41925
|
throw new Error("invalid_fleet_session_id");
|
|
42058
41926
|
}
|
|
42059
41927
|
return value;
|
|
@@ -42067,10 +41935,10 @@ function parseHookInput(input) {
|
|
|
42067
41935
|
throw new Error("invalid_hook_input");
|
|
42068
41936
|
}
|
|
42069
41937
|
function toProviderSession(provider, input, now) {
|
|
42070
|
-
|
|
41938
|
+
if (typeof input.session_id !== "string" || input.session_id.length === 0) throw new Error("missing_provider_session_id");
|
|
42071
41939
|
return {
|
|
42072
41940
|
provider,
|
|
42073
|
-
sessionId,
|
|
41941
|
+
sessionId: input.session_id,
|
|
42074
41942
|
...typeof input.transcript_path === "string" && input.transcript_path.length > 0 ? { transcriptPath: input.transcript_path } : {},
|
|
42075
41943
|
...typeof input.source === "string" && input.source.length > 0 ? { source: input.source } : {},
|
|
42076
41944
|
capturedAt: now().toISOString()
|
|
@@ -42079,7 +41947,7 @@ function toProviderSession(provider, input, now) {
|
|
|
42079
41947
|
function sanitizeProviderSession(value) {
|
|
42080
41948
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
42081
41949
|
const candidate = value;
|
|
42082
|
-
if (
|
|
41950
|
+
if (candidate.provider !== "claude" && candidate.provider !== "codex" || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return null;
|
|
42083
41951
|
return {
|
|
42084
41952
|
provider: candidate.provider,
|
|
42085
41953
|
sessionId: candidate.sessionId,
|
|
@@ -42088,20 +41956,11 @@ function sanitizeProviderSession(value) {
|
|
|
42088
41956
|
capturedAt: candidate.capturedAt
|
|
42089
41957
|
};
|
|
42090
41958
|
}
|
|
42091
|
-
function readProviderSessionId(input) {
|
|
42092
|
-
for (const value of [input.session_id, input.conversation_id, input.chat_id]) {
|
|
42093
|
-
if (typeof value === "string" && value.length > 0) return value;
|
|
42094
|
-
}
|
|
42095
|
-
throw new Error("missing_provider_session_id");
|
|
42096
|
-
}
|
|
42097
|
-
function isProvider(value) {
|
|
42098
|
-
return value === "claude" || value === "codex" || value === "cursor";
|
|
42099
|
-
}
|
|
42100
41959
|
function isSafeCaptureId(value) {
|
|
42101
|
-
return value.length > 0 &&
|
|
41960
|
+
return value.length > 0 && path28__default.basename(value) === value && !value.includes(path28__default.sep) && !value.includes(path28__default.posix.sep);
|
|
42102
41961
|
}
|
|
42103
41962
|
function defaultCapturePaths() {
|
|
42104
|
-
return { capturesDir:
|
|
41963
|
+
return { capturesDir: path28__default.join(getFleetDataDir(), CONSOLE_DATA_DIR_NAME, CONSOLE_CAPTURES_DIR_NAME) };
|
|
42105
41964
|
}
|
|
42106
41965
|
var JAVASCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cjs", ".js", ".mjs"]);
|
|
42107
41966
|
var TYPESCRIPT_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cts", ".mts", ".ts", ".tsx"]);
|
|
@@ -42116,7 +41975,7 @@ function buildConsoleAutoNameHookCommand(entry) {
|
|
|
42116
41975
|
return buildConsoleCliHookExec(entry, ["hook", "auto-name"]);
|
|
42117
41976
|
}
|
|
42118
41977
|
function buildConsoleCaptureHookCommand(entry, cliId) {
|
|
42119
|
-
const extension =
|
|
41978
|
+
const extension = path28__default.extname(entry.entryPath);
|
|
42120
41979
|
if (JAVASCRIPT_ENTRY_EXTENSIONS.has(extension)) {
|
|
42121
41980
|
return createSessionCaptureHookExec({
|
|
42122
41981
|
entryPath: entry.entryPath,
|
|
@@ -42139,7 +41998,6 @@ function buildConsoleCaptureHookCommand(entry, cliId) {
|
|
|
42139
41998
|
}
|
|
42140
41999
|
function toCaptureProvider(cliId) {
|
|
42141
42000
|
if (cliId === "codex") return "codex";
|
|
42142
|
-
if (cliId === "cursor") return "cursor";
|
|
42143
42001
|
return "claude";
|
|
42144
42002
|
}
|
|
42145
42003
|
function runCodexCommand(command) {
|
|
@@ -42152,11 +42010,11 @@ function runCodexCommand(command) {
|
|
|
42152
42010
|
}
|
|
42153
42011
|
function withConsoleMarketplaceLock(target, fn) {
|
|
42154
42012
|
const lockDir = `${target}${MARKETPLACE_LOCK_DIR_SUFFIX}`;
|
|
42155
|
-
mkdirSync(
|
|
42013
|
+
mkdirSync(path28__default.dirname(lockDir), { recursive: true });
|
|
42156
42014
|
return withDirectoryLock({ lockDir }, fn);
|
|
42157
42015
|
}
|
|
42158
42016
|
function buildConsoleCliHookExec(entry, trailingArgs) {
|
|
42159
|
-
const extension =
|
|
42017
|
+
const extension = path28__default.extname(entry.entryPath);
|
|
42160
42018
|
if (JAVASCRIPT_ENTRY_EXTENSIONS.has(extension)) {
|
|
42161
42019
|
return {
|
|
42162
42020
|
command: entry.execPath,
|
|
@@ -42182,12 +42040,12 @@ var CONSOLE_ENTRY_PATH = fileURLToPath(import.meta.url);
|
|
|
42182
42040
|
var HOOK_ENTRY_EXTENSIONS = /* @__PURE__ */ new Set([".cjs", ".cts", ".js", ".mjs", ".mts", ".ts", ".tsx"]);
|
|
42183
42041
|
var require4 = createRequire(import.meta.url);
|
|
42184
42042
|
function createAgentTerminalLaunchResolver(deps = {}) {
|
|
42185
|
-
const baseCwd = deps.cwd ??
|
|
42186
|
-
const env = deps.env ??
|
|
42187
|
-
const execPath = deps.execPath ??
|
|
42043
|
+
const baseCwd = deps.cwd ?? process4.cwd();
|
|
42044
|
+
const env = deps.env ?? process4.env;
|
|
42045
|
+
const execPath = deps.execPath ?? process4.execPath;
|
|
42188
42046
|
const homedir3 = deps.homedir ?? DEFAULT_TERMINAL_CWD_FALLBACK2;
|
|
42189
|
-
const platform = deps.platform ??
|
|
42190
|
-
const entryPath = resolveHookEntryPath(deps.entryPath ??
|
|
42047
|
+
const platform = deps.platform ?? process4.platform;
|
|
42048
|
+
const entryPath = resolveHookEntryPath(deps.entryPath ?? process4.argv[1]);
|
|
42191
42049
|
const tsxLoaderPath = deps.tsxLoaderPath ?? resolveOptionalPackage("tsx");
|
|
42192
42050
|
const dataDir = deps.dataDir ?? getFleetDataDir();
|
|
42193
42051
|
const infraServices = deps.infraServices ?? createInfraServices();
|
|
@@ -42240,7 +42098,7 @@ function resolveHookEntryPath(candidate) {
|
|
|
42240
42098
|
return CONSOLE_ENTRY_PATH;
|
|
42241
42099
|
}
|
|
42242
42100
|
function hasHookEntryExtension(entryPath) {
|
|
42243
|
-
return HOOK_ENTRY_EXTENSIONS.has(
|
|
42101
|
+
return HOOK_ENTRY_EXTENSIONS.has(path28__default.extname(entryPath));
|
|
42244
42102
|
}
|
|
42245
42103
|
async function createAgentCliLaunchSpec(options) {
|
|
42246
42104
|
const cleanupStack = [];
|
|
@@ -42462,7 +42320,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
42462
42320
|
return terminalSessionsById.get(sessionId)?.cwd ?? workspacesByCliRunId.get(sessionId)?.session.cwd ?? null;
|
|
42463
42321
|
}
|
|
42464
42322
|
function createPendingTerminalSession(input) {
|
|
42465
|
-
if (!
|
|
42323
|
+
if (!path28__default.isAbsolute(input.cwd)) throw new Error("Terminal session cwd must be absolute");
|
|
42466
42324
|
const createdAt = input.createdAt ?? now();
|
|
42467
42325
|
const canonicalCwd = canonicalizeTheaterPath(input.cwd);
|
|
42468
42326
|
const theaterId = workspaceHash(canonicalCwd);
|
|
@@ -42470,7 +42328,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
42470
42328
|
sessionId: input.sessionId,
|
|
42471
42329
|
cwd: input.cwd,
|
|
42472
42330
|
canonicalCwd,
|
|
42473
|
-
cwdLabel:
|
|
42331
|
+
cwdLabel: path28__default.basename(input.cwd) || input.cwd,
|
|
42474
42332
|
cliId: input.cliId,
|
|
42475
42333
|
createdAt,
|
|
42476
42334
|
theaterId,
|
|
@@ -42485,7 +42343,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
42485
42343
|
sessionId: operation.sessionId,
|
|
42486
42344
|
cwd: operation.cwd,
|
|
42487
42345
|
canonicalCwd: canonicalizeTheaterPath(operation.cwd),
|
|
42488
|
-
cwdLabel:
|
|
42346
|
+
cwdLabel: path28__default.basename(operation.cwd) || operation.cwd,
|
|
42489
42347
|
label: operation.label,
|
|
42490
42348
|
labelSource: operation.labelSource,
|
|
42491
42349
|
cliId: operation.cliId,
|
|
@@ -42711,10 +42569,10 @@ function toTerminalSessionInfo(state) {
|
|
|
42711
42569
|
};
|
|
42712
42570
|
}
|
|
42713
42571
|
function defaultWorkspaceHash(canonicalCwd) {
|
|
42714
|
-
return
|
|
42572
|
+
return crypto3.createHash("sha256").update(canonicalCwd).digest("hex").slice(0, 12);
|
|
42715
42573
|
}
|
|
42716
42574
|
function defaultCanonicalizeTheaterPath(cwd) {
|
|
42717
|
-
const resolved =
|
|
42575
|
+
const resolved = path28__default.resolve(cwd);
|
|
42718
42576
|
try {
|
|
42719
42577
|
return fs2__default.realpathSync.native(resolved);
|
|
42720
42578
|
} catch {
|
|
@@ -42980,8 +42838,10 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
42980
42838
|
if (!sessionId) return;
|
|
42981
42839
|
observability.appendTerminalRuntimeEvent(sessionId, withSignatureCli(event, runtime.carrierRuntime.registry));
|
|
42982
42840
|
});
|
|
42841
|
+
const reminderWriter = createDelayedPtyWriter();
|
|
42983
42842
|
const unsubscribeReminder = createCarrierResultReminderRouter({
|
|
42984
42843
|
streamRegister: runtime.carrierRuntime.jobs.streaming.register,
|
|
42844
|
+
writer: reminderWriter,
|
|
42985
42845
|
resolveSink: (event) => {
|
|
42986
42846
|
const sessionId = resolveCarrierEventOrigin(event, jobOriginById);
|
|
42987
42847
|
return sessionId ? { write: (data) => terminalRuntime.write(sessionId, data) } : void 0;
|
|
@@ -42989,7 +42849,9 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
42989
42849
|
resolvePolicy: (event) => {
|
|
42990
42850
|
const sessionId = resolveCarrierEventOrigin(event, jobOriginById);
|
|
42991
42851
|
return sessionId ? terminalRuntime.getMessagePolicy(sessionId) ?? {} : {};
|
|
42992
|
-
}
|
|
42852
|
+
},
|
|
42853
|
+
// 세션별 지연 제출 직렬화 키: 같은 터미널 세션으로 동시 도착한 리마인더가 뒤섞이지 않도록 한다.
|
|
42854
|
+
resolveSessionKey: (event) => resolveCarrierEventOrigin(event, jobOriginById) ?? void 0
|
|
42993
42855
|
});
|
|
42994
42856
|
const unsubscribeRename = ctx.host.events.subscribe(OPERATION_RENAMED_EVENT_CHANNEL, (payload) => {
|
|
42995
42857
|
if (!isOperationRenamedEvent(payload)) return;
|
|
@@ -43138,14 +43000,14 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
43138
43000
|
ctx.host.http.writeJson(res, 409, { error: "agent_cli_unavailable" });
|
|
43139
43001
|
return;
|
|
43140
43002
|
}
|
|
43141
|
-
const sessionId =
|
|
43003
|
+
const sessionId = crypto3.randomUUID();
|
|
43142
43004
|
const session = observability.createPendingTerminalSession({ sessionId, cwd, cliId });
|
|
43143
43005
|
ctx.host.operations.create({
|
|
43144
43006
|
id: session.sessionId,
|
|
43145
43007
|
theaterId,
|
|
43146
43008
|
type: AGENT_OPERATION_TYPE,
|
|
43147
43009
|
pluginId: ctx.pluginId,
|
|
43148
|
-
title: session.label ??
|
|
43010
|
+
title: session.label ?? path28__default.basename(cwd),
|
|
43149
43011
|
payload: toOperationPayload(cwd, session),
|
|
43150
43012
|
createdAt: session.createdAt
|
|
43151
43013
|
});
|
|
@@ -43256,7 +43118,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
43256
43118
|
if (result?.renamed) {
|
|
43257
43119
|
observability.notifySessionUpdated(result.session);
|
|
43258
43120
|
const autoNameCwd = readPayloadString(ctx.host.operations.get(sessionId)?.payload ?? {}, "cwd") ?? result.session.cwdLabel;
|
|
43259
|
-
ctx.host.operations.patch(sessionId, { title: result.session.label ??
|
|
43121
|
+
ctx.host.operations.patch(sessionId, { title: result.session.label ?? path28__default.basename(autoNameCwd) });
|
|
43260
43122
|
}
|
|
43261
43123
|
ctx.host.http.writeJson(res, 200, { ok: true, renamed: result?.renamed === true });
|
|
43262
43124
|
return true;
|
|
@@ -43270,8 +43132,8 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
43270
43132
|
return true;
|
|
43271
43133
|
}
|
|
43272
43134
|
const result = captureSession({
|
|
43273
|
-
diagnostics:
|
|
43274
|
-
env: { ...
|
|
43135
|
+
diagnostics: process4.stderr,
|
|
43136
|
+
env: { ...process4.env, FLEET_CONSOLE_SESSION_ID: sessionId },
|
|
43275
43137
|
input: body.input,
|
|
43276
43138
|
paths: ctx.host.paths,
|
|
43277
43139
|
provider: body.provider
|
|
@@ -43290,7 +43152,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
43290
43152
|
}
|
|
43291
43153
|
async function buildAgentCliLaunchMetadata() {
|
|
43292
43154
|
const metadata = getAgentCliMetadata();
|
|
43293
|
-
if ((
|
|
43155
|
+
if ((process4.env.FLEET_TERMINAL_CMD ?? "").trim().length > 0) {
|
|
43294
43156
|
return metadata.map((meta3) => ({ id: meta3.id, label: meta3.label, available: true, signedIn: true }));
|
|
43295
43157
|
}
|
|
43296
43158
|
const detected = await detector.detect();
|
|
@@ -43343,9 +43205,7 @@ function createAgentApi(ctx, terminalRuntime, deps) {
|
|
|
43343
43205
|
const safeLabel = sanitizeCarrierResultReminder(label.replace(/[\r\n\t]+/g, " ")).trim();
|
|
43344
43206
|
if (safeLabel.length === 0) return;
|
|
43345
43207
|
const policy = terminalRuntime.getMessagePolicy(sessionId) ?? {};
|
|
43346
|
-
|
|
43347
|
-
terminalRuntime.write(sessionId, chunk);
|
|
43348
|
-
}
|
|
43208
|
+
reminderWriter.enqueue(sessionId, (data) => terminalRuntime.write(sessionId, data), formatCarrierResultReminderMessage(policy, `${renameCommand} ${safeLabel}`));
|
|
43349
43209
|
}
|
|
43350
43210
|
function injectOperation(operation) {
|
|
43351
43211
|
const cwd = readPayloadString(operation.payload, "cwd") ?? ctx.host.paths.resolveTheaterPath(operation.theaterId) ?? "";
|
|
@@ -43421,7 +43281,7 @@ function readProviderSession(value) {
|
|
|
43421
43281
|
const providerSession = value?.providerSession;
|
|
43422
43282
|
if (!providerSession || typeof providerSession !== "object") return void 0;
|
|
43423
43283
|
const candidate = providerSession;
|
|
43424
|
-
if (
|
|
43284
|
+
if (candidate.provider !== "claude" && candidate.provider !== "codex" || typeof candidate.sessionId !== "string" || typeof candidate.capturedAt !== "string") return void 0;
|
|
43425
43285
|
return {
|
|
43426
43286
|
provider: candidate.provider,
|
|
43427
43287
|
sessionId: candidate.sessionId,
|
|
@@ -43430,9 +43290,6 @@ function readProviderSession(value) {
|
|
|
43430
43290
|
...typeof candidate.source === "string" ? { source: candidate.source } : {}
|
|
43431
43291
|
};
|
|
43432
43292
|
}
|
|
43433
|
-
function isProvider2(value) {
|
|
43434
|
-
return value === "claude" || value === "codex" || value === "cursor";
|
|
43435
|
-
}
|
|
43436
43293
|
function resolveCarrierEventOrigin(event, jobOriginById) {
|
|
43437
43294
|
if (event.originSessionId) {
|
|
43438
43295
|
jobOriginById.set(event.jobId, event.originSessionId);
|