oh-my-opencode 4.14.0 → 4.14.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/.agents/skills/codex-qa/references/isolation.md +1 -1
- package/README.md +1 -1
- package/dist/cli/doctor/framework/types.d.ts +2 -0
- package/dist/cli/index.js +149 -1426
- package/dist/cli-node/index.js +149 -1426
- package/dist/index.js +4255 -714
- package/dist/plugin/native-skills.d.ts +9 -0
- package/dist/plugin/system-transform.d.ts +1 -1
- package/dist/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/dist/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/dist/skills/lcx-doctor/SKILL.md +48 -13
- package/dist/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/dist/skills/lcx-report-bug/SKILL.md +44 -13
- package/dist/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/dist/skills/visual-qa/SKILL.md +5 -5
- package/dist/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/dist/skills/visual-qa/scripts/cli.test.ts +7 -2
- package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +10 -2
- package/dist/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/dist/tools/delegate-task/skill-resolver.d.ts +1 -0
- package/dist/tools/delegate-task/types.d.ts +2 -0
- package/dist/tools/skill/types.d.ts +1 -0
- package/package.json +26 -13
- package/packages/git-bash-mcp/dist/cli.js +2 -0
- package/packages/lsp-daemon/dist/cli.js +15 -4
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +1 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +9 -3
- package/packages/lsp-daemon/dist/index.js +15 -4
- package/packages/lsp-daemon/dist/paths.d.ts +1 -0
- package/packages/lsp-daemon/dist/paths.js +6 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +4 -7
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +1 -1
- package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +123 -10
- package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +123 -10
- package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
- package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +126 -9
- package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +141 -0
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +90 -25
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +56 -0
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +2 -5
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +65 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +6 -1
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +8 -106
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +4 -17
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/SKILL.md +17 -5
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team-state.mjs +63 -1
- package/packages/omo-codex/plugin/components/teammode/skills/teammode/scripts/team.mjs +80 -50
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +4 -12
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +7 -33
- package/packages/omo-codex/plugin/components/ulw-loop/directive.md +4 -12
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +4 -2
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +4 -4
- package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +7 -7
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +3 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-doc.test.ts +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +7 -6
- package/packages/omo-codex/plugin/package-lock.json +16 -56
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +48 -13
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +44 -13
- package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/omo-codex/plugin/skills/teammode/SKILL.md +17 -5
- package/packages/omo-codex/plugin/skills/teammode/scripts/team-state.mjs +63 -1
- package/packages/omo-codex/plugin/skills/teammode/scripts/team.mjs +80 -50
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +4 -4
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +5 -5
- package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/packages/omo-codex/plugin/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +38 -2
- package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +12 -11
- package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +99 -1
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +62 -8
- package/packages/omo-codex/plugin/test/node-install-surface.test.mjs +1 -0
- package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +102 -0
- package/packages/omo-codex/plugin/test/teammode-safety-fixture.mjs +41 -1
- package/packages/omo-codex/plugin/test/teammode-safety.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +6 -0
- package/packages/omo-codex/scripts/install-cache-copy.test.mjs +28 -0
- package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +43 -3
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +103 -28
- package/packages/omo-codex/scripts/install-local-entrypoint.test.mjs +21 -2
- package/packages/omo-codex/scripts/install-local.test.mjs +0 -1
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +44 -13
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +48 -13
- package/packages/shared-skills/skills/lcx-doctor/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +44 -13
- package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +1 -1
- package/packages/shared-skills/skills/visual-qa/SKILL.md +5 -5
- package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +5 -4
- package/packages/shared-skills/skills/visual-qa/scripts/cli.test.ts +7 -2
- package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +10 -2
- package/packages/shared-skills/skills/visual-qa/scripts/visual-qa.mjs +530 -0
- package/dist/cli/sparkshell-appserver-websocket.d.ts +0 -4
- package/dist/cli/sparkshell-appserver.d.ts +0 -16
- package/dist/cli/sparkshell-condense.d.ts +0 -10
- package/dist/cli/sparkshell-parse.d.ts +0 -24
- package/dist/cli/sparkshell-session-context.d.ts +0 -20
- package/dist/cli/sparkshell-spark.d.ts +0 -23
- package/dist/cli/sparkshell.d.ts +0 -33
- package/dist/shared/sparkshell-awareness.d.ts +0 -5
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +0 -106
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +0 -355
|
@@ -18,4 +18,5 @@ export interface EnsureDaemonOptions {
|
|
|
18
18
|
export declare function ensureDaemonRunning(paths: DaemonPaths, deps?: EnsureDaemonDeps, options?: EnsureDaemonOptions): Promise<void>;
|
|
19
19
|
export declare function probeSocket(socketPath: string, timeoutMs?: number): Promise<boolean>;
|
|
20
20
|
export declare function spawnDaemonProcess(paths: DaemonPaths): void;
|
|
21
|
+
export declare function resolveDaemonCliPath(env?: NodeJS.ProcessEnv): string;
|
|
21
22
|
export declare function defaultEnsureDaemonDeps(): EnsureDaemonDeps;
|
|
@@ -8,6 +8,7 @@ import { tryAcquireLock, unlinkQuietly } from "./lock.js";
|
|
|
8
8
|
const PROBE_TIMEOUT_MS = 500;
|
|
9
9
|
const DEFAULT_READY_TIMEOUT_MS = 5_000;
|
|
10
10
|
const DEFAULT_POLL_INTERVAL_MS = 100;
|
|
11
|
+
const CODEX_LSP_DAEMON_CLI_ENV = "CODEX_LSP_DAEMON_CLI";
|
|
11
12
|
export class DaemonUnreachableError extends Error {
|
|
12
13
|
constructor(socketPath) {
|
|
13
14
|
super(`LSP daemon did not become reachable at ${socketPath}`);
|
|
@@ -68,7 +69,7 @@ export function spawnDaemonProcess(paths) {
|
|
|
68
69
|
mkdirSync(dirname(paths.log), { recursive: true });
|
|
69
70
|
const logFd = openSync(paths.log, "a");
|
|
70
71
|
try {
|
|
71
|
-
const cliPath =
|
|
72
|
+
const cliPath = resolveDaemonCliPath();
|
|
72
73
|
const child = spawn(execPath, [cliPath, "daemon"], {
|
|
73
74
|
detached: true,
|
|
74
75
|
stdio: ["ignore", logFd, logFd],
|
|
@@ -79,6 +80,12 @@ export function spawnDaemonProcess(paths) {
|
|
|
79
80
|
closeSync(logFd);
|
|
80
81
|
}
|
|
81
82
|
}
|
|
83
|
+
export function resolveDaemonCliPath(env = process.env) {
|
|
84
|
+
const override = env[CODEX_LSP_DAEMON_CLI_ENV]?.trim();
|
|
85
|
+
if (override)
|
|
86
|
+
return override;
|
|
87
|
+
return fileURLToPath(new URL("./cli.js", import.meta.url));
|
|
88
|
+
}
|
|
82
89
|
export function defaultEnsureDaemonDeps() {
|
|
83
90
|
return {
|
|
84
91
|
probe: (socketPath) => probeSocket(socketPath),
|
|
@@ -89,8 +96,7 @@ export function defaultEnsureDaemonDeps() {
|
|
|
89
96
|
},
|
|
90
97
|
spawnDaemon: (paths) => spawnDaemonProcess(paths),
|
|
91
98
|
sleep: (ms) => new Promise((resolve) => {
|
|
92
|
-
|
|
93
|
-
timer.unref?.();
|
|
99
|
+
setTimeout(resolve, ms);
|
|
94
100
|
}),
|
|
95
101
|
now: () => Date.now(),
|
|
96
102
|
};
|
|
@@ -1485,6 +1485,7 @@ function unlinkQuietly(path) {
|
|
|
1485
1485
|
var PROBE_TIMEOUT_MS = 500;
|
|
1486
1486
|
var DEFAULT_READY_TIMEOUT_MS = 5000;
|
|
1487
1487
|
var DEFAULT_POLL_INTERVAL_MS = 100;
|
|
1488
|
+
var CODEX_LSP_DAEMON_CLI_ENV = "CODEX_LSP_DAEMON_CLI";
|
|
1488
1489
|
|
|
1489
1490
|
class DaemonUnreachableError extends Error {
|
|
1490
1491
|
constructor(socketPath) {
|
|
@@ -1545,7 +1546,7 @@ function spawnDaemonProcess(paths) {
|
|
|
1545
1546
|
mkdirSync2(dirname2(paths.log), { recursive: true });
|
|
1546
1547
|
const logFd = openSync2(paths.log, "a");
|
|
1547
1548
|
try {
|
|
1548
|
-
const cliPath =
|
|
1549
|
+
const cliPath = resolveDaemonCliPath();
|
|
1549
1550
|
const child = spawn2(execPath, [cliPath, "daemon"], {
|
|
1550
1551
|
detached: true,
|
|
1551
1552
|
stdio: ["ignore", logFd, logFd]
|
|
@@ -1555,6 +1556,12 @@ function spawnDaemonProcess(paths) {
|
|
|
1555
1556
|
closeSync2(logFd);
|
|
1556
1557
|
}
|
|
1557
1558
|
}
|
|
1559
|
+
function resolveDaemonCliPath(env = process.env) {
|
|
1560
|
+
const override = env[CODEX_LSP_DAEMON_CLI_ENV]?.trim();
|
|
1561
|
+
if (override)
|
|
1562
|
+
return override;
|
|
1563
|
+
return fileURLToPath(new URL("./cli.js", import.meta.url));
|
|
1564
|
+
}
|
|
1558
1565
|
function defaultEnsureDaemonDeps() {
|
|
1559
1566
|
return {
|
|
1560
1567
|
probe: (socketPath) => probeSocket(socketPath),
|
|
@@ -1565,8 +1572,7 @@ function defaultEnsureDaemonDeps() {
|
|
|
1565
1572
|
},
|
|
1566
1573
|
spawnDaemon: (paths) => spawnDaemonProcess(paths),
|
|
1567
1574
|
sleep: (ms) => new Promise((resolve2) => {
|
|
1568
|
-
|
|
1569
|
-
timer.unref?.();
|
|
1575
|
+
setTimeout(resolve2, ms);
|
|
1570
1576
|
}),
|
|
1571
1577
|
now: () => Date.now()
|
|
1572
1578
|
};
|
|
@@ -1579,6 +1585,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
1579
1585
|
import { join as join2 } from "node:path";
|
|
1580
1586
|
var requireFromHere = createRequire(import.meta.url);
|
|
1581
1587
|
var MAX_SOCKET_PATH_LENGTH = 100;
|
|
1588
|
+
var CODEX_LSP_DAEMON_VERSION_ENV = "CODEX_LSP_DAEMON_VERSION";
|
|
1582
1589
|
function resolveDaemonVersion(requireFn = requireFromHere) {
|
|
1583
1590
|
for (const candidate of ["./package.json", "../package.json"]) {
|
|
1584
1591
|
try {
|
|
@@ -1600,7 +1607,7 @@ function daemonBaseDir(env = process.env) {
|
|
|
1600
1607
|
const home = codexHome && codexHome.length > 0 ? codexHome : join2(homedir(), ".codex");
|
|
1601
1608
|
return join2(home, "codex-lsp", "daemon");
|
|
1602
1609
|
}
|
|
1603
|
-
function daemonPaths(env = process.env, version = resolveDaemonVersion()) {
|
|
1610
|
+
function daemonPaths(env = process.env, version = resolveDaemonVersionFromEnv(env) ?? resolveDaemonVersion()) {
|
|
1604
1611
|
const dir = join2(daemonBaseDir(env), `v${version}`);
|
|
1605
1612
|
return {
|
|
1606
1613
|
version,
|
|
@@ -1611,6 +1618,10 @@ function daemonPaths(env = process.env, version = resolveDaemonVersion()) {
|
|
|
1611
1618
|
log: join2(dir, "daemon.log")
|
|
1612
1619
|
};
|
|
1613
1620
|
}
|
|
1621
|
+
function resolveDaemonVersionFromEnv(env = process.env) {
|
|
1622
|
+
const version = env[CODEX_LSP_DAEMON_VERSION_ENV]?.trim();
|
|
1623
|
+
return version && version.length > 0 ? version : null;
|
|
1624
|
+
}
|
|
1614
1625
|
function resolveSocketPath(dir, version) {
|
|
1615
1626
|
const digest = createHash("sha256").update(dir).digest("hex").slice(0, 16);
|
|
1616
1627
|
if (process.platform === "win32") {
|
|
@@ -9,3 +9,4 @@ export interface DaemonPaths {
|
|
|
9
9
|
export declare function resolveDaemonVersion(requireFn?: (id: string) => unknown): string;
|
|
10
10
|
export declare function daemonBaseDir(env?: NodeJS.ProcessEnv): string;
|
|
11
11
|
export declare function daemonPaths(env?: NodeJS.ProcessEnv, version?: string): DaemonPaths;
|
|
12
|
+
export declare function resolveDaemonVersionFromEnv(env?: NodeJS.ProcessEnv): string | null;
|
|
@@ -4,6 +4,7 @@ import { homedir, tmpdir } from "node:os";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
const requireFromHere = createRequire(import.meta.url);
|
|
6
6
|
const MAX_SOCKET_PATH_LENGTH = 100;
|
|
7
|
+
const CODEX_LSP_DAEMON_VERSION_ENV = "CODEX_LSP_DAEMON_VERSION";
|
|
7
8
|
export function resolveDaemonVersion(requireFn = requireFromHere) {
|
|
8
9
|
for (const candidate of ["./package.json", "../package.json"]) {
|
|
9
10
|
try {
|
|
@@ -26,7 +27,7 @@ export function daemonBaseDir(env = process.env) {
|
|
|
26
27
|
const home = codexHome && codexHome.length > 0 ? codexHome : join(homedir(), ".codex");
|
|
27
28
|
return join(home, "codex-lsp", "daemon");
|
|
28
29
|
}
|
|
29
|
-
export function daemonPaths(env = process.env, version = resolveDaemonVersion()) {
|
|
30
|
+
export function daemonPaths(env = process.env, version = resolveDaemonVersionFromEnv(env) ?? resolveDaemonVersion()) {
|
|
30
31
|
const dir = join(daemonBaseDir(env), `v${version}`);
|
|
31
32
|
return {
|
|
32
33
|
version,
|
|
@@ -37,6 +38,10 @@ export function daemonPaths(env = process.env, version = resolveDaemonVersion())
|
|
|
37
38
|
log: join(dir, "daemon.log"),
|
|
38
39
|
};
|
|
39
40
|
}
|
|
41
|
+
export function resolveDaemonVersionFromEnv(env = process.env) {
|
|
42
|
+
const version = env[CODEX_LSP_DAEMON_VERSION_ENV]?.trim();
|
|
43
|
+
return version && version.length > 0 ? version : null;
|
|
44
|
+
}
|
|
40
45
|
function resolveSocketPath(dir, version) {
|
|
41
46
|
const digest = createHash("sha256").update(dir).digest("hex").slice(0, 16);
|
|
42
47
|
if (process.platform === "win32") {
|
|
@@ -1307,10 +1307,9 @@ function posixRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
1307
1307
|
"#!/bin/sh",
|
|
1308
1308
|
`# ${RUNTIME_WRAPPER_MARKER}`,
|
|
1309
1309
|
`export CODEX_HOME="\${CODEX_HOME:-${escapedCodexHome}}"`,
|
|
1310
|
-
'export OMO_SPARKSHELL_APP_SERVER_SOCKET="${OMO_SPARKSHELL_APP_SERVER_SOCKET:-$CODEX_HOME/app-server-control/app-server-control.sock}"',
|
|
1311
1310
|
'if [ "$1" = "ulw-loop" ] && [ -x "' + escapedUlwLoopBin + '" ]; then',
|
|
1312
1311
|
" shift",
|
|
1313
|
-
' exec "' + escapedUlwLoopBin + '" "$@"',
|
|
1312
|
+
' exec "' + escapedUlwLoopBin + '" ulw-loop "$@"',
|
|
1314
1313
|
"fi",
|
|
1315
1314
|
`if [ "\${OMO_RUNTIME:-}" = "node" ] && [ -f "${nodeCli}" ]; then`,
|
|
1316
1315
|
` exec node "${nodeCli}" "$@"`,
|
|
@@ -1349,11 +1348,10 @@ function windowsRuntimeWrapper(cliPath, codexHome, binDir, nodeCliPath) {
|
|
|
1349
1348
|
"@echo off",
|
|
1350
1349
|
`rem ${RUNTIME_WRAPPER_MARKER}`,
|
|
1351
1350
|
`if not defined CODEX_HOME set "CODEX_HOME=${codexHome}"`,
|
|
1352
|
-
'if not defined OMO_SPARKSHELL_APP_SERVER_SOCKET set "OMO_SPARKSHELL_APP_SERVER_SOCKET=%CODEX_HOME%\\app-server-control\\app-server-control.sock"',
|
|
1353
1351
|
...windowsNodeDiscoveryLines(),
|
|
1354
1352
|
`if "%~1"=="ulw-loop" if exist "${ulwLoopBin}" (`,
|
|
1355
1353
|
" shift /1",
|
|
1356
|
-
` "${ulwLoopBin}" %*`,
|
|
1354
|
+
` "${ulwLoopBin}" ulw-loop %*`,
|
|
1357
1355
|
" exit /b %ERRORLEVEL%",
|
|
1358
1356
|
")",
|
|
1359
1357
|
`if "%OMO_RUNTIME%"=="node" if defined OMO_NODE_BINARY if exist "${nodeCliPath}" (`,
|
|
@@ -2050,7 +2048,7 @@ function ensureMarketplaceBlock(config, marketplaceName, source) {
|
|
|
2050
2048
|
}
|
|
2051
2049
|
|
|
2052
2050
|
// ../src/install/codex-config-permissions.ts
|
|
2053
|
-
var AUTONOMOUS_FEATURES = ["multi_agent", "
|
|
2051
|
+
var AUTONOMOUS_FEATURES = ["multi_agent", "unified_exec", "goals"];
|
|
2054
2052
|
function ensureAutonomousPermissions(config) {
|
|
2055
2053
|
let next = replaceOrInsertRootSetting(config, "approval_policy", JSON.stringify("never"));
|
|
2056
2054
|
next = replaceOrInsertRootSetting(next, "sandbox_mode", JSON.stringify("danger-full-access"));
|
|
@@ -2470,7 +2468,6 @@ async function updateCodexConfig(input) {
|
|
|
2470
2468
|
config = ensureFeatureEnabled(config, "plugins");
|
|
2471
2469
|
config = ensureFeatureEnabled(config, "plugin_hooks");
|
|
2472
2470
|
config = ensureFeatureEnabled(config, "multi_agent");
|
|
2473
|
-
config = ensureFeatureEnabled(config, "child_agents_md");
|
|
2474
2471
|
config = removeUnsupportedCodexMultiAgentModeConfig(config);
|
|
2475
2472
|
config = ensureCodexReasoningConfig(config, await readCodexModelCatalog(input.repoRoot));
|
|
2476
2473
|
config = ensureCodexMultiAgentV2Config(config);
|
|
@@ -2947,7 +2944,7 @@ async function linkRuntimeWrapperStep(options, binDir, degraded) {
|
|
|
2947
2944
|
reason: "marketplace payload has no dist/cli"
|
|
2948
2945
|
});
|
|
2949
2946
|
await appendBootstrapLog(options.pluginData, options.now ?? Date.now(), "omo-cli-degraded", {
|
|
2950
|
-
warning: `Warning: skipped the omo runtime wrapper because ${cliPath} is missing; omo
|
|
2947
|
+
warning: `Warning: skipped the omo runtime wrapper because ${cliPath} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`
|
|
2951
2948
|
});
|
|
2952
2949
|
} catch (error) {
|
|
2953
2950
|
degraded.push({
|
|
@@ -225,7 +225,7 @@ async function linkRuntimeWrapperStep(
|
|
|
225
225
|
reason: "marketplace payload has no dist/cli",
|
|
226
226
|
});
|
|
227
227
|
await appendBootstrapLog(options.pluginData, options.now ?? Date.now(), "omo-cli-degraded", {
|
|
228
|
-
warning: `Warning: skipped the omo runtime wrapper because ${cliPath} is missing; omo
|
|
228
|
+
warning: `Warning: skipped the omo runtime wrapper because ${cliPath} is missing; omo ulw-loop commands will be unavailable until a package shipping dist/cli is installed`,
|
|
229
229
|
});
|
|
230
230
|
} catch (error) {
|
|
231
231
|
degraded.push({
|
|
@@ -2589,6 +2589,9 @@ class CodegraphBridgeStdioError extends Error {
|
|
|
2589
2589
|
this.streamName = streamName;
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
|
+
var CODEGRAPH_NODE_DESCRIPTION = "Inspect one named symbol or file. In symbol mode, includeCode=true includes leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces return structural outlines with member lists by design. For container source, request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit.";
|
|
2593
|
+
var CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION = "Symbol mode: include leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces intentionally return structural outlines with members; request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit for source.";
|
|
2594
|
+
var CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE = "Container symbols intentionally return structural outlines with members. For source, request a specific member symbol or call codegraph_node in file mode with symbolsOnly=false plus offset/limit around the symbol location.";
|
|
2592
2595
|
async function runBridgedCodegraphProcess(command, args, options) {
|
|
2593
2596
|
const invocation = resolveServeProcessInvocation(command, args);
|
|
2594
2597
|
const child = spawn2(invocation.command, invocation.args, {
|
|
@@ -2602,7 +2605,7 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2602
2605
|
throw new CodegraphBridgeStdioError("stdin");
|
|
2603
2606
|
if (childOutput === null)
|
|
2604
2607
|
throw new CodegraphBridgeStdioError("stdout");
|
|
2605
|
-
const
|
|
2608
|
+
const pendingResponses = new Map;
|
|
2606
2609
|
let defaultResponseMode = "framed";
|
|
2607
2610
|
const childExit = new Promise((resolveExit, reject) => {
|
|
2608
2611
|
child.once("error", reject);
|
|
@@ -2615,10 +2618,10 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2615
2618
|
});
|
|
2616
2619
|
});
|
|
2617
2620
|
const bridgeDone = Promise.all([
|
|
2618
|
-
forwardClientToCodegraph(options.input, childInput,
|
|
2621
|
+
forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
|
|
2619
2622
|
defaultResponseMode = mode;
|
|
2620
2623
|
}),
|
|
2621
|
-
forwardCodegraphToClient(childOutput, options.output,
|
|
2624
|
+
forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode)
|
|
2622
2625
|
]);
|
|
2623
2626
|
const destroyChildPipes = () => {
|
|
2624
2627
|
childInput.destroy();
|
|
@@ -2627,7 +2630,7 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2627
2630
|
childExit.then(destroyChildPipes, destroyChildPipes);
|
|
2628
2631
|
return Promise.race([childExit, bridgeDone.then(() => childExit)]);
|
|
2629
2632
|
}
|
|
2630
|
-
async function forwardClientToCodegraph(input, childInput,
|
|
2633
|
+
async function forwardClientToCodegraph(input, childInput, pendingResponses, setDefaultResponseMode) {
|
|
2631
2634
|
for await (const message of readStdioJsonRpcMessages(input)) {
|
|
2632
2635
|
if (message.kind === "parse_error") {
|
|
2633
2636
|
continue;
|
|
@@ -2635,23 +2638,29 @@ async function forwardClientToCodegraph(input, childInput, responseModes, setDef
|
|
|
2635
2638
|
const responseMode = message.responseMode;
|
|
2636
2639
|
setDefaultResponseMode(responseMode);
|
|
2637
2640
|
const key = responseModeKey(message.payload);
|
|
2638
|
-
if (key !== null)
|
|
2639
|
-
|
|
2641
|
+
if (key !== null) {
|
|
2642
|
+
pendingResponses.set(key, {
|
|
2643
|
+
method: jsonRpcMethod(message.payload),
|
|
2644
|
+
responseMode,
|
|
2645
|
+
toolName: jsonRpcToolName(message.payload)
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2640
2648
|
await writeLine(childInput, JSON.stringify(message.payload));
|
|
2641
2649
|
}
|
|
2642
2650
|
childInput.end();
|
|
2643
2651
|
}
|
|
2644
|
-
async function forwardCodegraphToClient(childOutput, output,
|
|
2652
|
+
async function forwardCodegraphToClient(childOutput, output, pendingResponses, defaultResponseMode) {
|
|
2645
2653
|
for await (const message of readStdioJsonRpcMessages(childOutput)) {
|
|
2646
2654
|
if (message.kind === "parse_error") {
|
|
2647
2655
|
writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
|
|
2648
2656
|
continue;
|
|
2649
2657
|
}
|
|
2650
2658
|
const key = responseModeKey(message.payload);
|
|
2651
|
-
const
|
|
2659
|
+
const pendingResponse = key === null ? undefined : pendingResponses.get(key);
|
|
2660
|
+
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
|
|
2652
2661
|
if (key !== null)
|
|
2653
|
-
|
|
2654
|
-
writeStdioJsonRpcResponse(output, message.payload, responseMode);
|
|
2662
|
+
pendingResponses.delete(key);
|
|
2663
|
+
writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
|
|
2655
2664
|
}
|
|
2656
2665
|
}
|
|
2657
2666
|
function responseModeKey(payload) {
|
|
@@ -2660,6 +2669,110 @@ function responseModeKey(payload) {
|
|
|
2660
2669
|
const id = jsonRpcId(payload["id"]);
|
|
2661
2670
|
return `${typeof id}:${String(id)}`;
|
|
2662
2671
|
}
|
|
2672
|
+
function jsonRpcMethod(payload) {
|
|
2673
|
+
if (!isPlainRecord(payload))
|
|
2674
|
+
return null;
|
|
2675
|
+
const method = payload["method"];
|
|
2676
|
+
return typeof method === "string" ? method : null;
|
|
2677
|
+
}
|
|
2678
|
+
function jsonRpcToolName(payload) {
|
|
2679
|
+
if (jsonRpcMethod(payload) !== "tools/call" || !isPlainRecord(payload))
|
|
2680
|
+
return null;
|
|
2681
|
+
const params = payload["params"];
|
|
2682
|
+
if (!isPlainRecord(params))
|
|
2683
|
+
return null;
|
|
2684
|
+
const name = params["name"];
|
|
2685
|
+
return typeof name === "string" ? name : null;
|
|
2686
|
+
}
|
|
2687
|
+
function clarifyCodegraphResponse(payload, pendingResponse) {
|
|
2688
|
+
if (pendingResponse?.method === "tools/list")
|
|
2689
|
+
return clarifyCodegraphToolsList(payload);
|
|
2690
|
+
if (pendingResponse?.method === "tools/call" && pendingResponse.toolName === "codegraph_node") {
|
|
2691
|
+
return clarifyCodegraphNodeCallResult(payload);
|
|
2692
|
+
}
|
|
2693
|
+
return payload;
|
|
2694
|
+
}
|
|
2695
|
+
function clarifyCodegraphToolsList(payload) {
|
|
2696
|
+
if (!isPlainRecord(payload))
|
|
2697
|
+
return payload;
|
|
2698
|
+
const result = payload["result"];
|
|
2699
|
+
if (!isPlainRecord(result) || !Array.isArray(result["tools"]))
|
|
2700
|
+
return payload;
|
|
2701
|
+
let changed = false;
|
|
2702
|
+
const tools = result["tools"].map((tool) => {
|
|
2703
|
+
if (!isPlainRecord(tool) || tool["name"] !== "codegraph_node")
|
|
2704
|
+
return tool;
|
|
2705
|
+
if (!hasCodegraphNodeContractMetadata(tool))
|
|
2706
|
+
return tool;
|
|
2707
|
+
changed = true;
|
|
2708
|
+
return clarifyCodegraphNodeTool(tool);
|
|
2709
|
+
});
|
|
2710
|
+
if (!changed)
|
|
2711
|
+
return payload;
|
|
2712
|
+
return { ...payload, result: { ...result, tools } };
|
|
2713
|
+
}
|
|
2714
|
+
function clarifyCodegraphNodeTool(tool) {
|
|
2715
|
+
const clarified = {
|
|
2716
|
+
...tool,
|
|
2717
|
+
description: CODEGRAPH_NODE_DESCRIPTION
|
|
2718
|
+
};
|
|
2719
|
+
const inputSchema = tool["inputSchema"];
|
|
2720
|
+
if (isPlainRecord(inputSchema))
|
|
2721
|
+
clarified["inputSchema"] = clarifyCodegraphNodeInputSchema(inputSchema);
|
|
2722
|
+
return clarified;
|
|
2723
|
+
}
|
|
2724
|
+
function hasCodegraphNodeContractMetadata(tool) {
|
|
2725
|
+
if (typeof tool["description"] === "string")
|
|
2726
|
+
return true;
|
|
2727
|
+
const inputSchema = tool["inputSchema"];
|
|
2728
|
+
if (!isPlainRecord(inputSchema))
|
|
2729
|
+
return false;
|
|
2730
|
+
const properties = inputSchema["properties"];
|
|
2731
|
+
return isPlainRecord(properties) && isPlainRecord(properties["includeCode"]);
|
|
2732
|
+
}
|
|
2733
|
+
function clarifyCodegraphNodeInputSchema(inputSchema) {
|
|
2734
|
+
const properties = inputSchema["properties"];
|
|
2735
|
+
if (!isPlainRecord(properties))
|
|
2736
|
+
return inputSchema;
|
|
2737
|
+
const includeCode = properties["includeCode"];
|
|
2738
|
+
if (!isPlainRecord(includeCode))
|
|
2739
|
+
return inputSchema;
|
|
2740
|
+
return {
|
|
2741
|
+
...inputSchema,
|
|
2742
|
+
properties: {
|
|
2743
|
+
...properties,
|
|
2744
|
+
includeCode: {
|
|
2745
|
+
...includeCode,
|
|
2746
|
+
description: CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
};
|
|
2750
|
+
}
|
|
2751
|
+
function clarifyCodegraphNodeCallResult(payload) {
|
|
2752
|
+
if (!isPlainRecord(payload))
|
|
2753
|
+
return payload;
|
|
2754
|
+
const result = payload["result"];
|
|
2755
|
+
if (!isPlainRecord(result) || !Array.isArray(result["content"]))
|
|
2756
|
+
return payload;
|
|
2757
|
+
let changed = false;
|
|
2758
|
+
const content = result["content"].map((item) => {
|
|
2759
|
+
if (!isPlainRecord(item) || item["type"] !== "text" || typeof item["text"] !== "string")
|
|
2760
|
+
return item;
|
|
2761
|
+
const text = clarifyContainerOutlineGuidance(item["text"]);
|
|
2762
|
+
if (text === item["text"])
|
|
2763
|
+
return item;
|
|
2764
|
+
changed = true;
|
|
2765
|
+
return { ...item, text };
|
|
2766
|
+
});
|
|
2767
|
+
if (!changed)
|
|
2768
|
+
return payload;
|
|
2769
|
+
return { ...payload, result: { ...result, content } };
|
|
2770
|
+
}
|
|
2771
|
+
function clarifyContainerOutlineGuidance(text) {
|
|
2772
|
+
if (!text.includes("Structural outline only"))
|
|
2773
|
+
return text;
|
|
2774
|
+
return text.replace(/Structural outline only[^\n]*(?:\n[^\n]*(?:Read|read)[^\n]*)?/g, CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE);
|
|
2775
|
+
}
|
|
2663
2776
|
async function writeLine(output, line) {
|
|
2664
2777
|
if (output.write(`${line}
|
|
2665
2778
|
`))
|
|
@@ -2022,6 +2022,9 @@ class CodegraphBridgeStdioError extends Error {
|
|
|
2022
2022
|
this.streamName = streamName;
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
|
+
var CODEGRAPH_NODE_DESCRIPTION = "Inspect one named symbol or file. In symbol mode, includeCode=true includes leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces return structural outlines with member lists by design. For container source, request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit.";
|
|
2026
|
+
var CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION = "Symbol mode: include leaf-symbol source when available. Container symbols such as classes, interfaces, structs, enums, modules, and namespaces intentionally return structural outlines with members; request a specific member symbol or use file mode with symbolsOnly=false plus offset/limit for source.";
|
|
2027
|
+
var CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE = "Container symbols intentionally return structural outlines with members. For source, request a specific member symbol or call codegraph_node in file mode with symbolsOnly=false plus offset/limit around the symbol location.";
|
|
2025
2028
|
async function runBridgedCodegraphProcess(command, args, options) {
|
|
2026
2029
|
const invocation = resolveServeProcessInvocation(command, args);
|
|
2027
2030
|
const child = spawn(invocation.command, invocation.args, {
|
|
@@ -2035,7 +2038,7 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2035
2038
|
throw new CodegraphBridgeStdioError("stdin");
|
|
2036
2039
|
if (childOutput === null)
|
|
2037
2040
|
throw new CodegraphBridgeStdioError("stdout");
|
|
2038
|
-
const
|
|
2041
|
+
const pendingResponses = new Map;
|
|
2039
2042
|
let defaultResponseMode = "framed";
|
|
2040
2043
|
const childExit = new Promise((resolveExit, reject) => {
|
|
2041
2044
|
child.once("error", reject);
|
|
@@ -2048,10 +2051,10 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2048
2051
|
});
|
|
2049
2052
|
});
|
|
2050
2053
|
const bridgeDone = Promise.all([
|
|
2051
|
-
forwardClientToCodegraph(options.input, childInput,
|
|
2054
|
+
forwardClientToCodegraph(options.input, childInput, pendingResponses, (mode) => {
|
|
2052
2055
|
defaultResponseMode = mode;
|
|
2053
2056
|
}),
|
|
2054
|
-
forwardCodegraphToClient(childOutput, options.output,
|
|
2057
|
+
forwardCodegraphToClient(childOutput, options.output, pendingResponses, () => defaultResponseMode)
|
|
2055
2058
|
]);
|
|
2056
2059
|
const destroyChildPipes = () => {
|
|
2057
2060
|
childInput.destroy();
|
|
@@ -2060,7 +2063,7 @@ async function runBridgedCodegraphProcess(command, args, options) {
|
|
|
2060
2063
|
childExit.then(destroyChildPipes, destroyChildPipes);
|
|
2061
2064
|
return Promise.race([childExit, bridgeDone.then(() => childExit)]);
|
|
2062
2065
|
}
|
|
2063
|
-
async function forwardClientToCodegraph(input, childInput,
|
|
2066
|
+
async function forwardClientToCodegraph(input, childInput, pendingResponses, setDefaultResponseMode) {
|
|
2064
2067
|
for await (const message of readStdioJsonRpcMessages(input)) {
|
|
2065
2068
|
if (message.kind === "parse_error") {
|
|
2066
2069
|
continue;
|
|
@@ -2068,23 +2071,29 @@ async function forwardClientToCodegraph(input, childInput, responseModes, setDef
|
|
|
2068
2071
|
const responseMode = message.responseMode;
|
|
2069
2072
|
setDefaultResponseMode(responseMode);
|
|
2070
2073
|
const key = responseModeKey(message.payload);
|
|
2071
|
-
if (key !== null)
|
|
2072
|
-
|
|
2074
|
+
if (key !== null) {
|
|
2075
|
+
pendingResponses.set(key, {
|
|
2076
|
+
method: jsonRpcMethod(message.payload),
|
|
2077
|
+
responseMode,
|
|
2078
|
+
toolName: jsonRpcToolName(message.payload)
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2073
2081
|
await writeLine(childInput, JSON.stringify(message.payload));
|
|
2074
2082
|
}
|
|
2075
2083
|
childInput.end();
|
|
2076
2084
|
}
|
|
2077
|
-
async function forwardCodegraphToClient(childOutput, output,
|
|
2085
|
+
async function forwardCodegraphToClient(childOutput, output, pendingResponses, defaultResponseMode) {
|
|
2078
2086
|
for await (const message of readStdioJsonRpcMessages(childOutput)) {
|
|
2079
2087
|
if (message.kind === "parse_error") {
|
|
2080
2088
|
writeStdioJsonRpcResponse(output, errorResponse(null, -32700, "Parse error", message.message), defaultResponseMode());
|
|
2081
2089
|
continue;
|
|
2082
2090
|
}
|
|
2083
2091
|
const key = responseModeKey(message.payload);
|
|
2084
|
-
const
|
|
2092
|
+
const pendingResponse = key === null ? undefined : pendingResponses.get(key);
|
|
2093
|
+
const responseMode = pendingResponse?.responseMode ?? defaultResponseMode();
|
|
2085
2094
|
if (key !== null)
|
|
2086
|
-
|
|
2087
|
-
writeStdioJsonRpcResponse(output, message.payload, responseMode);
|
|
2095
|
+
pendingResponses.delete(key);
|
|
2096
|
+
writeStdioJsonRpcResponse(output, clarifyCodegraphResponse(message.payload, pendingResponse), responseMode);
|
|
2088
2097
|
}
|
|
2089
2098
|
}
|
|
2090
2099
|
function responseModeKey(payload) {
|
|
@@ -2093,6 +2102,110 @@ function responseModeKey(payload) {
|
|
|
2093
2102
|
const id = jsonRpcId(payload["id"]);
|
|
2094
2103
|
return `${typeof id}:${String(id)}`;
|
|
2095
2104
|
}
|
|
2105
|
+
function jsonRpcMethod(payload) {
|
|
2106
|
+
if (!isPlainRecord(payload))
|
|
2107
|
+
return null;
|
|
2108
|
+
const method = payload["method"];
|
|
2109
|
+
return typeof method === "string" ? method : null;
|
|
2110
|
+
}
|
|
2111
|
+
function jsonRpcToolName(payload) {
|
|
2112
|
+
if (jsonRpcMethod(payload) !== "tools/call" || !isPlainRecord(payload))
|
|
2113
|
+
return null;
|
|
2114
|
+
const params = payload["params"];
|
|
2115
|
+
if (!isPlainRecord(params))
|
|
2116
|
+
return null;
|
|
2117
|
+
const name = params["name"];
|
|
2118
|
+
return typeof name === "string" ? name : null;
|
|
2119
|
+
}
|
|
2120
|
+
function clarifyCodegraphResponse(payload, pendingResponse) {
|
|
2121
|
+
if (pendingResponse?.method === "tools/list")
|
|
2122
|
+
return clarifyCodegraphToolsList(payload);
|
|
2123
|
+
if (pendingResponse?.method === "tools/call" && pendingResponse.toolName === "codegraph_node") {
|
|
2124
|
+
return clarifyCodegraphNodeCallResult(payload);
|
|
2125
|
+
}
|
|
2126
|
+
return payload;
|
|
2127
|
+
}
|
|
2128
|
+
function clarifyCodegraphToolsList(payload) {
|
|
2129
|
+
if (!isPlainRecord(payload))
|
|
2130
|
+
return payload;
|
|
2131
|
+
const result = payload["result"];
|
|
2132
|
+
if (!isPlainRecord(result) || !Array.isArray(result["tools"]))
|
|
2133
|
+
return payload;
|
|
2134
|
+
let changed = false;
|
|
2135
|
+
const tools = result["tools"].map((tool) => {
|
|
2136
|
+
if (!isPlainRecord(tool) || tool["name"] !== "codegraph_node")
|
|
2137
|
+
return tool;
|
|
2138
|
+
if (!hasCodegraphNodeContractMetadata(tool))
|
|
2139
|
+
return tool;
|
|
2140
|
+
changed = true;
|
|
2141
|
+
return clarifyCodegraphNodeTool(tool);
|
|
2142
|
+
});
|
|
2143
|
+
if (!changed)
|
|
2144
|
+
return payload;
|
|
2145
|
+
return { ...payload, result: { ...result, tools } };
|
|
2146
|
+
}
|
|
2147
|
+
function clarifyCodegraphNodeTool(tool) {
|
|
2148
|
+
const clarified = {
|
|
2149
|
+
...tool,
|
|
2150
|
+
description: CODEGRAPH_NODE_DESCRIPTION
|
|
2151
|
+
};
|
|
2152
|
+
const inputSchema = tool["inputSchema"];
|
|
2153
|
+
if (isPlainRecord(inputSchema))
|
|
2154
|
+
clarified["inputSchema"] = clarifyCodegraphNodeInputSchema(inputSchema);
|
|
2155
|
+
return clarified;
|
|
2156
|
+
}
|
|
2157
|
+
function hasCodegraphNodeContractMetadata(tool) {
|
|
2158
|
+
if (typeof tool["description"] === "string")
|
|
2159
|
+
return true;
|
|
2160
|
+
const inputSchema = tool["inputSchema"];
|
|
2161
|
+
if (!isPlainRecord(inputSchema))
|
|
2162
|
+
return false;
|
|
2163
|
+
const properties = inputSchema["properties"];
|
|
2164
|
+
return isPlainRecord(properties) && isPlainRecord(properties["includeCode"]);
|
|
2165
|
+
}
|
|
2166
|
+
function clarifyCodegraphNodeInputSchema(inputSchema) {
|
|
2167
|
+
const properties = inputSchema["properties"];
|
|
2168
|
+
if (!isPlainRecord(properties))
|
|
2169
|
+
return inputSchema;
|
|
2170
|
+
const includeCode = properties["includeCode"];
|
|
2171
|
+
if (!isPlainRecord(includeCode))
|
|
2172
|
+
return inputSchema;
|
|
2173
|
+
return {
|
|
2174
|
+
...inputSchema,
|
|
2175
|
+
properties: {
|
|
2176
|
+
...properties,
|
|
2177
|
+
includeCode: {
|
|
2178
|
+
...includeCode,
|
|
2179
|
+
description: CODEGRAPH_NODE_INCLUDE_CODE_DESCRIPTION
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
function clarifyCodegraphNodeCallResult(payload) {
|
|
2185
|
+
if (!isPlainRecord(payload))
|
|
2186
|
+
return payload;
|
|
2187
|
+
const result = payload["result"];
|
|
2188
|
+
if (!isPlainRecord(result) || !Array.isArray(result["content"]))
|
|
2189
|
+
return payload;
|
|
2190
|
+
let changed = false;
|
|
2191
|
+
const content = result["content"].map((item) => {
|
|
2192
|
+
if (!isPlainRecord(item) || item["type"] !== "text" || typeof item["text"] !== "string")
|
|
2193
|
+
return item;
|
|
2194
|
+
const text = clarifyContainerOutlineGuidance(item["text"]);
|
|
2195
|
+
if (text === item["text"])
|
|
2196
|
+
return item;
|
|
2197
|
+
changed = true;
|
|
2198
|
+
return { ...item, text };
|
|
2199
|
+
});
|
|
2200
|
+
if (!changed)
|
|
2201
|
+
return payload;
|
|
2202
|
+
return { ...payload, result: { ...result, content } };
|
|
2203
|
+
}
|
|
2204
|
+
function clarifyContainerOutlineGuidance(text) {
|
|
2205
|
+
if (!text.includes("Structural outline only"))
|
|
2206
|
+
return text;
|
|
2207
|
+
return text.replace(/Structural outline only[^\n]*(?:\n[^\n]*(?:Read|read)[^\n]*)?/g, CODEGRAPH_CONTAINER_OUTLINE_GUIDANCE);
|
|
2208
|
+
}
|
|
2096
2209
|
async function writeLine(output, line) {
|
|
2097
2210
|
if (output.write(`${line}
|
|
2098
2211
|
`))
|