@rzx/ohs 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frontend/index.js +1 -1
- package/dist/frontend/index.js.map +1 -1
- package/dist/index.js +678 -446
- package/dist/index.js.map +20 -19
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -89,6 +89,7 @@ function externalToolMetadata(metadata) {
|
|
|
89
89
|
const reserved = new Set([
|
|
90
90
|
"pluginUi",
|
|
91
91
|
"uiAction",
|
|
92
|
+
"toolResultReadable",
|
|
92
93
|
"toolUseId",
|
|
93
94
|
"toolName",
|
|
94
95
|
"toolCallId",
|
|
@@ -19224,12 +19225,15 @@ function readWorkspaceChangesMetadata(value) {
|
|
|
19224
19225
|
for (const file of value.files) {
|
|
19225
19226
|
if (!record4(file) || !relativePath(file.path) || paths.has(file.path) || file.oldPath !== undefined && !relativePath(file.oldPath) || !count(file.lines) || typeof file.status !== "string" || !["added", "modified", "deleted", "renamed", "copied", "unknown"].includes(file.status))
|
|
19226
19227
|
return;
|
|
19228
|
+
if (!lineSplit(file))
|
|
19229
|
+
return;
|
|
19227
19230
|
paths.add(file.path);
|
|
19228
19231
|
files.push({
|
|
19229
19232
|
path: file.path,
|
|
19230
19233
|
status: file.status,
|
|
19231
19234
|
lines: file.lines,
|
|
19232
|
-
...typeof file.oldPath === "string" ? { oldPath: file.oldPath } : {}
|
|
19235
|
+
...typeof file.oldPath === "string" ? { oldPath: file.oldPath } : {},
|
|
19236
|
+
...typeof file.additions === "number" ? { additions: file.additions, deletions: file.deletions } : {}
|
|
19233
19237
|
});
|
|
19234
19238
|
}
|
|
19235
19239
|
if (value.fileCount < files.length || !value.truncated && value.fileCount !== files.length || files.reduce((sum, file) => sum + file.lines, 0) > value.totalLines)
|
|
@@ -19253,6 +19257,11 @@ function record4(value) {
|
|
|
19253
19257
|
function count(value) {
|
|
19254
19258
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
19255
19259
|
}
|
|
19260
|
+
function lineSplit(file) {
|
|
19261
|
+
if (file.additions === undefined && file.deletions === undefined)
|
|
19262
|
+
return true;
|
|
19263
|
+
return count(file.additions) && count(file.deletions) && file.additions + file.deletions === file.lines;
|
|
19264
|
+
}
|
|
19256
19265
|
function textPath(value) {
|
|
19257
19266
|
return typeof value === "string" && value.length > 0 && value.length <= WORKSPACE_CHANGE_MAX_PATH_LENGTH && !/[\u0000-\u001f\u007f]/.test(value);
|
|
19258
19267
|
}
|
|
@@ -352503,7 +352512,122 @@ var init_executor = __esm(() => {
|
|
|
352503
352512
|
defaultShellExecutor = new DefaultShellExecutor;
|
|
352504
352513
|
});
|
|
352505
352514
|
|
|
352515
|
+
// ../../packages/tools/src/terminal/terminal-tools.ts
|
|
352516
|
+
function resolveHost(context) {
|
|
352517
|
+
if (!context.terminal)
|
|
352518
|
+
return failed2("This host does not provide persistent terminals.");
|
|
352519
|
+
if (!context.sessionId)
|
|
352520
|
+
return failed2("Persistent terminals require a durable session.");
|
|
352521
|
+
return { host: context.terminal, sessionId: context.sessionId };
|
|
352522
|
+
}
|
|
352523
|
+
function terminalResult(action, value) {
|
|
352524
|
+
return {
|
|
352525
|
+
content: [
|
|
352526
|
+
{
|
|
352527
|
+
type: "text",
|
|
352528
|
+
text: JSON.stringify({ kind: "terminal", action, ...value })
|
|
352529
|
+
}
|
|
352530
|
+
]
|
|
352531
|
+
};
|
|
352532
|
+
}
|
|
352533
|
+
function optionalString3(value) {
|
|
352534
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
352535
|
+
}
|
|
352536
|
+
function optionalNumber3(value) {
|
|
352537
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
352538
|
+
}
|
|
352539
|
+
function failed2(error) {
|
|
352540
|
+
return {
|
|
352541
|
+
content: [
|
|
352542
|
+
{
|
|
352543
|
+
type: "text",
|
|
352544
|
+
text: error instanceof Error ? error.message : String(error)
|
|
352545
|
+
}
|
|
352546
|
+
],
|
|
352547
|
+
isError: true
|
|
352548
|
+
};
|
|
352549
|
+
}
|
|
352550
|
+
var terminalOpenTool, terminalTools;
|
|
352551
|
+
var init_terminal_tools = __esm(() => {
|
|
352552
|
+
terminalOpenTool = {
|
|
352553
|
+
name: "TerminalOpen",
|
|
352554
|
+
description: "Open a visible terminal in this session's working directory. For dev servers and watchers, provide command to run the service directly: its exit then updates terminal status. Do not daemonize the command or detach its child process. Use JobRead/JobWait to inspect output, JobSend for input, and JobCancel to stop it, with the returned jobId. Without command, opens an interactive shell. Prefer Shell for short commands and BackgroundShellCreate for finite builds or installs.",
|
|
352555
|
+
inputSchema: {
|
|
352556
|
+
type: "object",
|
|
352557
|
+
properties: {
|
|
352558
|
+
command: { type: "string", description: "Service command to run in the session directory. For a subdirectory, include the shell-appropriate cd in the command. Omit to open an interactive shell." },
|
|
352559
|
+
name: {
|
|
352560
|
+
type: "string",
|
|
352561
|
+
description: "Short label shown in the terminal panel"
|
|
352562
|
+
},
|
|
352563
|
+
cols: {
|
|
352564
|
+
type: "number",
|
|
352565
|
+
description: "Initial terminal columns",
|
|
352566
|
+
default: 100
|
|
352567
|
+
},
|
|
352568
|
+
rows: {
|
|
352569
|
+
type: "number",
|
|
352570
|
+
description: "Initial terminal rows",
|
|
352571
|
+
default: 30
|
|
352572
|
+
},
|
|
352573
|
+
shell: { type: "string", description: "Optional shell executable" }
|
|
352574
|
+
}
|
|
352575
|
+
},
|
|
352576
|
+
async execute(input, context) {
|
|
352577
|
+
if (context.abortSignal?.aborted)
|
|
352578
|
+
return { ...failed2("Terminal interrupted before starting."), failureKind: "interrupted", executionState: "not_started" };
|
|
352579
|
+
if (input.command !== undefined && (typeof input.command !== "string" || !input.command.trim())) {
|
|
352580
|
+
return { ...failed2("command must be a non-empty string."), failureKind: "invalid_input", executionState: "not_started" };
|
|
352581
|
+
}
|
|
352582
|
+
const resolved = resolveHost(context);
|
|
352583
|
+
if ("content" in resolved)
|
|
352584
|
+
return resolved;
|
|
352585
|
+
const command = optionalString3(input.command);
|
|
352586
|
+
try {
|
|
352587
|
+
const terminal = await resolved.host.open({
|
|
352588
|
+
sessionId: resolved.sessionId,
|
|
352589
|
+
cwd: context.cwd,
|
|
352590
|
+
name: optionalString3(input.name) ?? (command ? command.slice(0, 80) : undefined),
|
|
352591
|
+
cols: optionalNumber3(input.cols),
|
|
352592
|
+
rows: optionalNumber3(input.rows),
|
|
352593
|
+
shell: optionalString3(input.shell),
|
|
352594
|
+
...command ? { command } : {}
|
|
352595
|
+
});
|
|
352596
|
+
return { ...terminalResult("open", { terminal, jobId: terminal.id }), executionState: "completed", compactSummary: `TerminalOpen completed: jobId=${terminal.id}` };
|
|
352597
|
+
} catch (error) {
|
|
352598
|
+
return { ...failed2(error), failureKind: "unknown_outcome", executionState: "unknown" };
|
|
352599
|
+
}
|
|
352600
|
+
}
|
|
352601
|
+
};
|
|
352602
|
+
terminalTools = [terminalOpenTool];
|
|
352603
|
+
});
|
|
352604
|
+
|
|
352605
|
+
// ../../packages/tools/src/terminal/service-command.ts
|
|
352606
|
+
function isPersistentServiceCommand(command) {
|
|
352607
|
+
let text = command.trim().toLowerCase();
|
|
352608
|
+
const changeDirectory = /^(?:cd(?:\s+\/d)?|set-location(?:\s+-(?:path|literalpath))?)\s+(?:"[^"]*"|'[^']*'|[^\s;&|'"<>]+)\s*(?:;|&&|\r?\n)\s*/;
|
|
352609
|
+
while (changeDirectory.test(text))
|
|
352610
|
+
text = text.replace(changeDirectory, "");
|
|
352611
|
+
text = text.replace(/\s+2>&1\s*$/, "");
|
|
352612
|
+
if (/[;&|\r\n]/.test(text))
|
|
352613
|
+
return false;
|
|
352614
|
+
if (/(?:^|\s)(?:--help|--version|-h)(?:\s|$)/.test(text))
|
|
352615
|
+
return false;
|
|
352616
|
+
if (/^docker(?:\s+compose|-compose)\s+up\b/.test(text)) {
|
|
352617
|
+
return !/(?:^|\s)(?:-d|--detach)(?:\s|$)/.test(text);
|
|
352618
|
+
}
|
|
352619
|
+
return [
|
|
352620
|
+
/^(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve|watch)(?:\s|$)/,
|
|
352621
|
+
/^(?:(?:npx|bunx|pnpm\s+exec)\s+)?(?:vite|next|nuxt|astro|webpack|rollup|parcel|tsc)\b.*(?:\b(?:dev|start|serve|watch)\b|(?:^|\s)(?:-w|--watch)(?:\s|$))/,
|
|
352622
|
+
/^(?:(?:npx|bunx|pnpm\s+exec)\s+)?vite(?:\s+(?!(?:build|optimize)(?:\s|$))|$)/,
|
|
352623
|
+
/^(?:python[\d.]*|py)(?:\s+-\d(?:\.\d+)?)?\s+-m\s+http\.server\b/,
|
|
352624
|
+
/^(?:(?:python[\d.]*|py)\s+-m\s+)?(?:uvicorn|gunicorn)\b/,
|
|
352625
|
+
/^flask\s+(?:--app\s+\S+\s+)?run\b/
|
|
352626
|
+
].some((pattern) => pattern.test(text));
|
|
352627
|
+
}
|
|
352628
|
+
|
|
352506
352629
|
// ../../packages/tools/src/shell/shell.ts
|
|
352630
|
+
import { resolve as resolve23 } from "node:path";
|
|
352507
352631
|
function createShellTool(shellOrExecutor, executor = defaultShellExecutor) {
|
|
352508
352632
|
const shell = isShellExecutor(shellOrExecutor) ? undefined : shellOrExecutor;
|
|
352509
352633
|
const effectiveExecutor = isShellExecutor(shellOrExecutor) ? shellOrExecutor : executor;
|
|
@@ -352531,6 +352655,19 @@ function createShellTool(shellOrExecutor, executor = defaultShellExecutor) {
|
|
|
352531
352655
|
const command = typeof input.command === "string" ? input.command.trim() : "";
|
|
352532
352656
|
const descriptor = context.environment?.info.shellDescriptor ?? shell;
|
|
352533
352657
|
const hasExplicitTimeout = input.timeout !== undefined;
|
|
352658
|
+
if (command && !hasExplicitTimeout && context.terminal && context.sessionId && isPersistentServiceCommand(command)) {
|
|
352659
|
+
const workdir = typeof input.workdir === "string" ? input.workdir.trim() : "";
|
|
352660
|
+
const resolvedWorkdir = workdir && context.environment ? await context.environment.paths.resolve(workdir, "execute") : undefined;
|
|
352661
|
+
if (resolvedWorkdir && resolvedWorkdir.mountPurpose !== "workspace")
|
|
352662
|
+
return workdirDenied(resolvedWorkdir.executionPath);
|
|
352663
|
+
const atSessionRoot = resolvedWorkdir ? resolvedWorkdir.executionPath === context.environment.workspace.executionRoot : !workdir || resolve23(context.cwd, workdir) === resolve23(context.cwd);
|
|
352664
|
+
if (!atSessionRoot) {
|
|
352665
|
+
return { content: [{ type: "text", text: "Use TerminalOpen with command for this service. Include a shell-appropriate cd to the requested subdirectory in command; terminals are scoped to the session directory." }], isError: true, failureKind: "invalid_input", executionState: "not_started" };
|
|
352666
|
+
}
|
|
352667
|
+
if (context.abortSignal?.aborted)
|
|
352668
|
+
return interruptedBeforeStart();
|
|
352669
|
+
return terminalOpenTool.execute({ command, name: summarizeCommand(command) }, context);
|
|
352670
|
+
}
|
|
352534
352671
|
const background = Boolean(command && !hasExplicitTimeout && shouldCreateBackgroundShell(command, context));
|
|
352535
352672
|
if (background) {
|
|
352536
352673
|
try {
|
|
@@ -352771,7 +352908,7 @@ function descriptorHostLauncher(descriptor) {
|
|
|
352771
352908
|
return descriptor.dialect === "bash" ? { kind: "bash", bin: descriptor.executable } : { kind: "posix-sh" };
|
|
352772
352909
|
}
|
|
352773
352910
|
function createShellDescription(shell) {
|
|
352774
|
-
const background = "For
|
|
352911
|
+
const background = "For persistent services such as dev servers and watchers, use TerminalOpen with command when available, then inspect with JobRead/JobWait and stop with JobCancel. For finite long-running work such as installs, builds, and migrations, use BackgroundShellCreate, then follow the returned handle. Do not claim completion or service readiness without evidence.";
|
|
352775
352912
|
const powershellQuoting = `This tool already runs PowerShell: execute scripts directly. If another powershell/pwsh process is needed, use a single-quoted -Command script or a script block; double-quoted scripts expand $variables in the outer shell. A here-string opener (@' or @") must be followed by a newline before any content; put its matching terminator ('@ or "@) on its own line.`;
|
|
352776
352913
|
if (!shell)
|
|
352777
352914
|
return `Execute a short-lived command using the execution environment's resolved shell. ${background}`;
|
|
@@ -353003,6 +353140,7 @@ var init_shell2 = __esm(() => {
|
|
|
353003
353140
|
init_src5();
|
|
353004
353141
|
init_src6();
|
|
353005
353142
|
init_executor();
|
|
353143
|
+
init_terminal_tools();
|
|
353006
353144
|
shellTool = createShellTool();
|
|
353007
353145
|
});
|
|
353008
353146
|
// ../../packages/tools/src/shell/index.ts
|
|
@@ -353038,18 +353176,21 @@ function createBackgroundShellTool(shell) {
|
|
|
353038
353176
|
}
|
|
353039
353177
|
const description = readRequiredString(input.description, "description");
|
|
353040
353178
|
if ("error" in description)
|
|
353041
|
-
return
|
|
353179
|
+
return failed3(description.error);
|
|
353042
353180
|
const command = readRequiredString(input.command, "command");
|
|
353043
353181
|
if ("error" in command)
|
|
353044
|
-
return
|
|
353182
|
+
return failed3(command.error);
|
|
353183
|
+
if (context.terminal && context.sessionId && isPersistentServiceCommand(command.value)) {
|
|
353184
|
+
return terminalOpenTool.execute({ command: command.value, name: description.value }, context);
|
|
353185
|
+
}
|
|
353045
353186
|
if (!context.sessionId)
|
|
353046
|
-
return { ...
|
|
353187
|
+
return { ...failed3("Background shell jobs require a durable session."), failureKind: "configuration" };
|
|
353047
353188
|
if (!context.backgroundShell)
|
|
353048
|
-
return { ...
|
|
353189
|
+
return { ...failed3("Background shell host is not configured."), failureKind: "configuration" };
|
|
353049
353190
|
if (!context.toolCallId)
|
|
353050
|
-
return { ...
|
|
353191
|
+
return { ...failed3("Background shell request identity is not configured."), failureKind: "configuration" };
|
|
353051
353192
|
if (context.abortSignal?.aborted) {
|
|
353052
|
-
return { ...
|
|
353193
|
+
return { ...failed3("Shell interrupted before the command started."), failureKind: "interrupted" };
|
|
353053
353194
|
}
|
|
353054
353195
|
try {
|
|
353055
353196
|
const created = await context.backgroundShell.create({
|
|
@@ -353076,7 +353217,7 @@ function createBackgroundShellTool(shell) {
|
|
|
353076
353217
|
compactSummary: `BackgroundShellCreate completed: jobId=${created.jobId}`
|
|
353077
353218
|
};
|
|
353078
353219
|
} catch (error) {
|
|
353079
|
-
return { ...
|
|
353220
|
+
return { ...failed3(error instanceof Error ? error.message : String(error)), failureKind: "unknown_outcome", executionState: "unknown" };
|
|
353080
353221
|
}
|
|
353081
353222
|
}
|
|
353082
353223
|
};
|
|
@@ -353084,12 +353225,13 @@ function createBackgroundShellTool(shell) {
|
|
|
353084
353225
|
function readRequiredString(value, name) {
|
|
353085
353226
|
return typeof value === "string" && value.trim() ? { value: value.trim() } : { error: `${name} is required.` };
|
|
353086
353227
|
}
|
|
353087
|
-
function
|
|
353228
|
+
function failed3(message) {
|
|
353088
353229
|
return { content: [{ type: "text", text: message }], isError: true, failureKind: "invalid_input", executionState: "not_started" };
|
|
353089
353230
|
}
|
|
353090
353231
|
var backgroundShellCreateTool;
|
|
353091
353232
|
var init_background_shell_tools = __esm(() => {
|
|
353092
353233
|
init_shell3();
|
|
353234
|
+
init_terminal_tools();
|
|
353093
353235
|
backgroundShellCreateTool = createBackgroundShellTool();
|
|
353094
353236
|
});
|
|
353095
353237
|
|
|
@@ -353595,88 +353737,6 @@ var init_web = __esm(() => {
|
|
|
353595
353737
|
init_types();
|
|
353596
353738
|
});
|
|
353597
353739
|
|
|
353598
|
-
// ../../packages/tools/src/terminal/terminal-tools.ts
|
|
353599
|
-
function resolveHost(context) {
|
|
353600
|
-
if (!context.terminal)
|
|
353601
|
-
return failed3("This host does not provide persistent terminals.");
|
|
353602
|
-
if (!context.sessionId)
|
|
353603
|
-
return failed3("Persistent terminals require a durable session.");
|
|
353604
|
-
return { host: context.terminal, sessionId: context.sessionId };
|
|
353605
|
-
}
|
|
353606
|
-
function terminalResult(action, value) {
|
|
353607
|
-
return {
|
|
353608
|
-
content: [
|
|
353609
|
-
{
|
|
353610
|
-
type: "text",
|
|
353611
|
-
text: JSON.stringify({ kind: "terminal", action, ...value })
|
|
353612
|
-
}
|
|
353613
|
-
]
|
|
353614
|
-
};
|
|
353615
|
-
}
|
|
353616
|
-
function optionalString3(value) {
|
|
353617
|
-
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
353618
|
-
}
|
|
353619
|
-
function optionalNumber3(value) {
|
|
353620
|
-
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
353621
|
-
}
|
|
353622
|
-
function failed3(error) {
|
|
353623
|
-
return {
|
|
353624
|
-
content: [
|
|
353625
|
-
{
|
|
353626
|
-
type: "text",
|
|
353627
|
-
text: error instanceof Error ? error.message : String(error)
|
|
353628
|
-
}
|
|
353629
|
-
],
|
|
353630
|
-
isError: true
|
|
353631
|
-
};
|
|
353632
|
-
}
|
|
353633
|
-
var terminalOpenTool, terminalTools;
|
|
353634
|
-
var init_terminal_tools = __esm(() => {
|
|
353635
|
-
terminalOpenTool = {
|
|
353636
|
-
name: "TerminalOpen",
|
|
353637
|
-
description: "Open a persistent interactive terminal in this session's working directory. Prefer Shell for a single non-interactive command; use this for long-running or interactive processes.",
|
|
353638
|
-
inputSchema: {
|
|
353639
|
-
type: "object",
|
|
353640
|
-
properties: {
|
|
353641
|
-
name: {
|
|
353642
|
-
type: "string",
|
|
353643
|
-
description: "Short label shown in the terminal panel"
|
|
353644
|
-
},
|
|
353645
|
-
cols: {
|
|
353646
|
-
type: "number",
|
|
353647
|
-
description: "Initial terminal columns",
|
|
353648
|
-
default: 100
|
|
353649
|
-
},
|
|
353650
|
-
rows: {
|
|
353651
|
-
type: "number",
|
|
353652
|
-
description: "Initial terminal rows",
|
|
353653
|
-
default: 30
|
|
353654
|
-
},
|
|
353655
|
-
shell: { type: "string", description: "Optional shell executable" }
|
|
353656
|
-
}
|
|
353657
|
-
},
|
|
353658
|
-
async execute(input, context) {
|
|
353659
|
-
const resolved = resolveHost(context);
|
|
353660
|
-
if ("content" in resolved)
|
|
353661
|
-
return resolved;
|
|
353662
|
-
try {
|
|
353663
|
-
const terminal = await resolved.host.open({
|
|
353664
|
-
sessionId: resolved.sessionId,
|
|
353665
|
-
cwd: context.cwd,
|
|
353666
|
-
name: optionalString3(input.name),
|
|
353667
|
-
cols: optionalNumber3(input.cols),
|
|
353668
|
-
rows: optionalNumber3(input.rows),
|
|
353669
|
-
shell: optionalString3(input.shell)
|
|
353670
|
-
});
|
|
353671
|
-
return terminalResult("open", { terminal });
|
|
353672
|
-
} catch (error) {
|
|
353673
|
-
return failed3(error);
|
|
353674
|
-
}
|
|
353675
|
-
}
|
|
353676
|
-
};
|
|
353677
|
-
terminalTools = [terminalOpenTool];
|
|
353678
|
-
});
|
|
353679
|
-
|
|
353680
353740
|
// ../../packages/tools/src/terminal/index.ts
|
|
353681
353741
|
var init_terminal = __esm(() => {
|
|
353682
353742
|
init_terminal_tools();
|
|
@@ -357993,7 +358053,7 @@ var init_schema_v1 = __esm(() => {
|
|
|
357993
358053
|
|
|
357994
358054
|
// ../../packages/plugins/src/paths.ts
|
|
357995
358055
|
import { lstat as lstat3, realpath as realpath3 } from "node:fs/promises";
|
|
357996
|
-
import { basename as basename7, dirname as dirname15, isAbsolute as isAbsolute8, join as join27, posix as posix6, relative as relative8, resolve as
|
|
358056
|
+
import { basename as basename7, dirname as dirname15, isAbsolute as isAbsolute8, join as join27, posix as posix6, relative as relative8, resolve as resolve24, win32 as win325 } from "node:path";
|
|
357997
358057
|
function isWithin(root, candidate) {
|
|
357998
358058
|
const difference = relative8(root, candidate);
|
|
357999
358059
|
return difference === "" || !difference.startsWith(`..${win325.sep}`) && !difference.startsWith(`..${posix6.sep}`) && difference !== ".." && !isAbsolute8(difference) && !win325.isAbsolute(difference);
|
|
@@ -358014,11 +358074,11 @@ async function resolveNativePluginPath(root, declaredPath) {
|
|
|
358014
358074
|
}
|
|
358015
358075
|
let realRoot;
|
|
358016
358076
|
try {
|
|
358017
|
-
realRoot = await realpath3(
|
|
358077
|
+
realRoot = await realpath3(resolve24(root));
|
|
358018
358078
|
} catch (error) {
|
|
358019
358079
|
throw new NativePluginPathError("root_unavailable", `Native plugin root is unavailable: ${String(error)}`, declaredPath);
|
|
358020
358080
|
}
|
|
358021
|
-
const lexicalTarget =
|
|
358081
|
+
const lexicalTarget = resolve24(realRoot, declaredPath);
|
|
358022
358082
|
if (!isWithin(realRoot, lexicalTarget)) {
|
|
358023
358083
|
throw new NativePluginPathError("path_outside_root", `Native component path leaves the plugin root: ${declaredPath}`, declaredPath);
|
|
358024
358084
|
}
|
|
@@ -358109,7 +358169,7 @@ var init_ui_schema = __esm(() => {
|
|
|
358109
358169
|
// ../../packages/plugins/src/components/ui.ts
|
|
358110
358170
|
import { createHash as createHash12 } from "node:crypto";
|
|
358111
358171
|
import { lstat as lstat4, open as open7, realpath as realpath4 } from "node:fs/promises";
|
|
358112
|
-
import { join as join28, relative as relative9, resolve as
|
|
358172
|
+
import { join as join28, relative as relative9, resolve as resolve25, sep as sep6 } from "node:path";
|
|
358113
358173
|
async function readNativeUiDocument(root, component) {
|
|
358114
358174
|
const { bytes } = await readUiBytes(root, component.declaredEntry, PLUGIN_UI_LIMITS.htmlBytes);
|
|
358115
358175
|
const sha256 = createHash12("sha256").update(bytes).digest("hex");
|
|
@@ -358121,7 +358181,7 @@ async function readNativeUiDocument(root, component) {
|
|
|
358121
358181
|
async function readUiBytes(root, declaredPath, limit) {
|
|
358122
358182
|
const realRoot = await realpath4(root);
|
|
358123
358183
|
const path = await resolveNativePluginPath(realRoot, declaredPath);
|
|
358124
|
-
const lexicalPath =
|
|
358184
|
+
const lexicalPath = resolve25(realRoot, declaredPath);
|
|
358125
358185
|
let parent = realRoot;
|
|
358126
358186
|
for (const segment of relative9(realRoot, lexicalPath).split(sep6)) {
|
|
358127
358187
|
parent = join28(parent, segment);
|
|
@@ -358738,7 +358798,7 @@ var init_load_native_plugin = __esm(() => {
|
|
|
358738
358798
|
// ../../packages/plugins/src/installation/cache.ts
|
|
358739
358799
|
import { createHash as createHash13, randomUUID as randomUUID22 } from "node:crypto";
|
|
358740
358800
|
import { cp, lstat as lstat6, mkdir as mkdir10, readFile as readFile15, readdir as readdir6, realpath as realpath6, rename as rename6, rm as rm6 } from "node:fs/promises";
|
|
358741
|
-
import { basename as basename9, dirname as dirname16, join as join31, relative as relative10, resolve as
|
|
358801
|
+
import { basename as basename9, dirname as dirname16, join as join31, relative as relative10, resolve as resolve26 } from "node:path";
|
|
358742
358802
|
async function filesUnder(root, current = root) {
|
|
358743
358803
|
const files = [];
|
|
358744
358804
|
for (const entry of (await readdir6(current, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
@@ -358763,7 +358823,7 @@ async function computePluginBehaviorDigest(root) {
|
|
|
358763
358823
|
return hash.digest("hex");
|
|
358764
358824
|
}
|
|
358765
358825
|
function comparablePath(path) {
|
|
358766
|
-
const resolved =
|
|
358826
|
+
const resolved = resolve26(path);
|
|
358767
358827
|
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
358768
358828
|
}
|
|
358769
358829
|
async function assertRegularPluginCacheSnapshot(target) {
|
|
@@ -358894,7 +358954,7 @@ var init_store3 = __esm(() => {
|
|
|
358894
358954
|
|
|
358895
358955
|
// ../../packages/plugins/src/installation/installer.ts
|
|
358896
358956
|
import { realpath as realpath7 } from "node:fs/promises";
|
|
358897
|
-
import { resolve as
|
|
358957
|
+
import { resolve as resolve27 } from "node:path";
|
|
358898
358958
|
function requestedPluginPermissions(manifest) {
|
|
358899
358959
|
const result = new Set;
|
|
358900
358960
|
for (const [category, permissions] of Object.entries(manifest.permissions ?? {})) {
|
|
@@ -358921,7 +358981,7 @@ async function installLocalNativePlugin(input) {
|
|
|
358921
358981
|
code: "plugin_scope_not_supported",
|
|
358922
358982
|
message: `Native Plugins can only be installed for the user; received scope '${String(suppliedScope)}'`
|
|
358923
358983
|
}] };
|
|
358924
|
-
const sourcePath = await realpath7(
|
|
358984
|
+
const sourcePath = await realpath7(resolve27(input.sourcePath));
|
|
358925
358985
|
const validation = await validateNativePlugin(sourcePath);
|
|
358926
358986
|
if (validation.status === "invalid" || !validation.plugin)
|
|
358927
358987
|
return { status: "invalid", diagnostics: validation.diagnostics };
|
|
@@ -362456,7 +362516,7 @@ var init_personal_prompt_files = __esm(() => {
|
|
|
362456
362516
|
// ../../packages/personalization/src/index.ts
|
|
362457
362517
|
import { createHash as createHash14, randomUUID as randomUUID24 } from "node:crypto";
|
|
362458
362518
|
import { existsSync as existsSync19, mkdirSync as mkdirSync13, readFileSync as readFileSync12, renameSync as renameSync6, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
362459
|
-
import { basename as basename10, join as join35, resolve as
|
|
362519
|
+
import { basename as basename10, join as join35, resolve as resolve28 } from "node:path";
|
|
362460
362520
|
import { homedir as homedir7 } from "node:os";
|
|
362461
362521
|
import { isIP } from "node:net";
|
|
362462
362522
|
function hasFactSource(fact) {
|
|
@@ -362531,7 +362591,7 @@ function factsToRulesMarkdown(facts) {
|
|
|
362531
362591
|
}
|
|
362532
362592
|
function getLocalRulesDir(cwd) {
|
|
362533
362593
|
const base = process.env.VYKOR_CONFIG_DIR ?? join35(homedir7(), ".vykor");
|
|
362534
|
-
const project =
|
|
362594
|
+
const project = resolve28(cwd);
|
|
362535
362595
|
const digest = createHash14("sha1").update(project).digest("hex").slice(0, 12);
|
|
362536
362596
|
return join35(base, "local_rules", "projects", `${basename10(project)}-${digest}`);
|
|
362537
362597
|
}
|
|
@@ -362848,7 +362908,7 @@ var init_ledger_segments = __esm(() => {
|
|
|
362848
362908
|
|
|
362849
362909
|
// ../../packages/prompts/src/index.ts
|
|
362850
362910
|
import { readFile as readFile18, access as access3, readdir as readdir8 } from "node:fs/promises";
|
|
362851
|
-
import { join as join36, resolve as
|
|
362911
|
+
import { join as join36, resolve as resolve29, dirname as dirname20 } from "node:path";
|
|
362852
362912
|
import { platform as platform3, machine, homedir as homedir8, hostname } from "node:os";
|
|
362853
362913
|
function invariantGuidance(includeBackgroundShell) {
|
|
362854
362914
|
return includeBackgroundShell ? INVARIANT_GUIDANCE : INVARIANT_GUIDANCE.replace(`${LONG_RUNNING_SHELL_GUIDANCE}
|
|
@@ -363041,7 +363101,7 @@ function buildDelegationSection() {
|
|
|
363041
363101
|
`);
|
|
363042
363102
|
}
|
|
363043
363103
|
async function discoverClaudeMdFiles(cwd) {
|
|
363044
|
-
const current =
|
|
363104
|
+
const current = resolve29(cwd);
|
|
363045
363105
|
const results = [];
|
|
363046
363106
|
const seen = new Set;
|
|
363047
363107
|
const directories = [];
|
|
@@ -363133,7 +363193,7 @@ function renderPromptLayers(layers) {
|
|
|
363133
363193
|
|
|
363134
363194
|
`);
|
|
363135
363195
|
}
|
|
363136
|
-
var DEFAULT_IDENTITY = "You are Vykor, an open-source AI coding assistant CLI. You are an interactive agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.", LONG_RUNNING_SHELL_GUIDANCE = " - Use Shell only for short-lived commands.
|
|
363196
|
+
var DEFAULT_IDENTITY = "You are Vykor, an open-source AI coding assistant CLI. You are an interactive agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.", LONG_RUNNING_SHELL_GUIDANCE = " - Use Shell only for short-lived commands. Start persistent services such as dev servers and watchers with TerminalOpen(command, name) when available so the user can see output and stop them in the terminal. Run the service in the foreground of that terminal; do not detach it with nohup, shell backgrounding, or Start-Process. Follow the returned jobId with JobRead or JobWait to verify readiness, JobSend for input, and JobCancel to stop it. For finite long-running work such as installs, builds, and migrations, use BackgroundShellCreate and follow progress with JobWait or JobRead. When terminals are unavailable, use BackgroundShellCreate for services. At handoff, mention any services left running and their terminal entry; do not stop them unless requested.", INVARIANT_GUIDANCE, BASE_SYSTEM_PROMPT, MAX_CHARS_PER_FILE = 12000;
|
|
363137
363197
|
var init_src16 = __esm(() => {
|
|
363138
363198
|
init_src();
|
|
363139
363199
|
init_src6();
|
|
@@ -363232,7 +363292,7 @@ import { randomUUID as randomUUID26 } from "node:crypto";
|
|
|
363232
363292
|
import { randomUUID as randomUUID32 } from "node:crypto";
|
|
363233
363293
|
import { randomUUID as randomUUID42 } from "node:crypto";
|
|
363234
363294
|
import { createHash as createHash15 } from "node:crypto";
|
|
363235
|
-
import { basename as basename11, join as join38, resolve as
|
|
363295
|
+
import { basename as basename11, join as join38, resolve as resolve30 } from "node:path";
|
|
363236
363296
|
import { homedir as homedir10 } from "node:os";
|
|
363237
363297
|
import { randomUUID as randomUUID52 } from "node:crypto";
|
|
363238
363298
|
import {
|
|
@@ -363399,10 +363459,10 @@ import { access as access32, mkdir as mkdir92, readFile as readFile102, readdir
|
|
|
363399
363459
|
import { join as join292 } from "node:path";
|
|
363400
363460
|
import { createHash as createHash16, randomUUID as randomUUID33 } from "node:crypto";
|
|
363401
363461
|
import { existsSync as existsSync172, mkdirSync as mkdirSync122, readFileSync as readFileSync112, renameSync as renameSync62, unlinkSync as unlinkSync52, writeFileSync as writeFileSync102 } from "node:fs";
|
|
363402
|
-
import { basename as basename92, join as join302, resolve as
|
|
363462
|
+
import { basename as basename92, join as join302, resolve as resolve262 } from "node:path";
|
|
363403
363463
|
import { homedir as homedir62 } from "node:os";
|
|
363404
363464
|
import { readFile as readFile112, access as access4, readdir as readdir62 } from "node:fs/promises";
|
|
363405
|
-
import { join as join312, resolve as
|
|
363465
|
+
import { join as join312, resolve as resolve272, dirname as dirname142 } from "node:path";
|
|
363406
363466
|
import { platform as platform42, machine as machine2, homedir as homedir72, hostname as hostname2 } from "node:os";
|
|
363407
363467
|
import { randomUUID as randomUUID82 } from "node:crypto";
|
|
363408
363468
|
import { randomUUID as randomUUID72 } from "node:crypto";
|
|
@@ -363463,6 +363523,7 @@ import { createHash as createHash112 } from "node:crypto";
|
|
|
363463
363523
|
import { extname as extname2, posix as posix42, win32 as win3232 } from "node:path";
|
|
363464
363524
|
import { createHash as createHash122 } from "node:crypto";
|
|
363465
363525
|
import { posix as posix52, win32 as win3242 } from "node:path";
|
|
363526
|
+
import { resolve as resolve252 } from "node:path";
|
|
363466
363527
|
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
363467
363528
|
import { createHash as createHash132, randomUUID as randomUUID30 } from "node:crypto";
|
|
363468
363529
|
import { randomUUID as randomUUID322 } from "node:crypto";
|
|
@@ -363475,25 +363536,26 @@ import { createHash as createHash152 } from "node:crypto";
|
|
|
363475
363536
|
import { posix as posix62, win32 as win3252 } from "node:path";
|
|
363476
363537
|
import { fork } from "node:child_process";
|
|
363477
363538
|
import { randomUUID as randomUUID34 } from "node:crypto";
|
|
363539
|
+
import { join as join322 } from "node:path";
|
|
363478
363540
|
import { randomUUID as randomUUID35 } from "node:crypto";
|
|
363479
363541
|
import { lstat as lstat52, readFile as readFile122, realpath as realpath52 } from "node:fs/promises";
|
|
363480
|
-
import { join as
|
|
363542
|
+
import { join as join352 } from "node:path";
|
|
363481
363543
|
import { lstat as lstat32, realpath as realpath32 } from "node:fs/promises";
|
|
363482
|
-
import { basename as basename102, dirname as dirname152, isAbsolute as isAbsolute92, join as
|
|
363544
|
+
import { basename as basename102, dirname as dirname152, isAbsolute as isAbsolute92, join as join332, posix as posix72, relative as relative102, resolve as resolve282, win32 as win3262 } from "node:path";
|
|
363483
363545
|
import { createHash as createHash17 } from "node:crypto";
|
|
363484
363546
|
import { lstat as lstat42, open as open72, realpath as realpath42 } from "node:fs/promises";
|
|
363485
|
-
import { join as
|
|
363547
|
+
import { join as join342, relative as relative112, resolve as resolve292, sep as sep72 } from "node:path";
|
|
363486
363548
|
import { readdir as readdir72, readFile as readFile132, stat as stat72 } from "node:fs/promises";
|
|
363487
|
-
import { basename as basename112, join as
|
|
363549
|
+
import { basename as basename112, join as join362 } from "node:path";
|
|
363488
363550
|
import { readFile as readFile142 } from "node:fs/promises";
|
|
363489
363551
|
import { readFile as readFile152 } from "node:fs/promises";
|
|
363490
363552
|
import { stat as stat82 } from "node:fs/promises";
|
|
363491
363553
|
import { createHash as createHash18, randomUUID as randomUUID36 } from "node:crypto";
|
|
363492
363554
|
import { cp as cp2, lstat as lstat62, mkdir as mkdir102, readFile as readFile162, readdir as readdir82, realpath as realpath62, rename as rename62, rm as rm72 } from "node:fs/promises";
|
|
363493
|
-
import { basename as basename12, dirname as dirname162, join as
|
|
363555
|
+
import { basename as basename12, dirname as dirname162, join as join372, relative as relative12, resolve as resolve302 } from "node:path";
|
|
363494
363556
|
import { mkdir as mkdir112, readFile as readFile172, rename as rename72, rm as rm82, writeFile as writeFile72 } from "node:fs/promises";
|
|
363495
363557
|
import { randomUUID as randomUUID37 } from "node:crypto";
|
|
363496
|
-
import { join as
|
|
363558
|
+
import { join as join382 } from "node:path";
|
|
363497
363559
|
import process7 from "node:process";
|
|
363498
363560
|
import { PassThrough as PassThrough22 } from "node:stream";
|
|
363499
363561
|
import { EventEmitter as EventEmitter22 } from "node:events";
|
|
@@ -363503,7 +363565,7 @@ import { createHash as createHash19 } from "node:crypto";
|
|
|
363503
363565
|
import { randomUUID as randomUUID39 } from "node:crypto";
|
|
363504
363566
|
import { stat as stat92 } from "node:fs/promises";
|
|
363505
363567
|
import { existsSync as existsSync182 } from "node:fs";
|
|
363506
|
-
import { delimiter as delimiter22, isAbsolute as isAbsolute10, join as
|
|
363568
|
+
import { delimiter as delimiter22, isAbsolute as isAbsolute10, join as join392 } from "node:path";
|
|
363507
363569
|
function isNonNegativeInt(value) {
|
|
363508
363570
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
363509
363571
|
}
|
|
@@ -363556,14 +363618,14 @@ function nextModelRetryDelay2(input) {
|
|
|
363556
363618
|
function waitForModelRetry2(ms, signal) {
|
|
363557
363619
|
if (signal?.aborted)
|
|
363558
363620
|
return Promise.reject(signal.reason);
|
|
363559
|
-
return new Promise((
|
|
363621
|
+
return new Promise((resolve31, reject) => {
|
|
363560
363622
|
const onAbort = () => {
|
|
363561
363623
|
clearTimeout(timer);
|
|
363562
363624
|
reject(signal?.reason);
|
|
363563
363625
|
};
|
|
363564
363626
|
const timer = setTimeout(() => {
|
|
363565
363627
|
signal?.removeEventListener("abort", onAbort);
|
|
363566
|
-
|
|
363628
|
+
resolve31();
|
|
363567
363629
|
}, ms);
|
|
363568
363630
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
363569
363631
|
});
|
|
@@ -363720,6 +363782,7 @@ function externalToolMetadata2(metadata) {
|
|
|
363720
363782
|
const reserved = /* @__PURE__ */ new Set([
|
|
363721
363783
|
"pluginUi",
|
|
363722
363784
|
"uiAction",
|
|
363785
|
+
"toolResultReadable",
|
|
363723
363786
|
"toolUseId",
|
|
363724
363787
|
"toolName",
|
|
363725
363788
|
"toolCallId",
|
|
@@ -363761,6 +363824,13 @@ function defaultRecoveryHint2(result2) {
|
|
|
363761
363824
|
}
|
|
363762
363825
|
}
|
|
363763
363826
|
function formatToolResultForModel2(result2) {
|
|
363827
|
+
if (result2.metadata?.toolResultReadable === true) {
|
|
363828
|
+
const { toolResultReadable: _readable, ...metadata } = result2.metadata;
|
|
363829
|
+
return [
|
|
363830
|
+
{ type: "text", text: `Tool-Result-Id: ${result2.toolUseId}` },
|
|
363831
|
+
...formatToolResultForModel2({ ...result2, metadata })
|
|
363832
|
+
];
|
|
363833
|
+
}
|
|
363764
363834
|
if (!result2.isError && result2.executionState !== "unknown")
|
|
363765
363835
|
return result2.content;
|
|
363766
363836
|
const facts = toolFeedbackFields2(result2);
|
|
@@ -365411,7 +365481,7 @@ function getConfigFilePath2() {
|
|
|
365411
365481
|
return resolvePaths2().configFilePath;
|
|
365412
365482
|
}
|
|
365413
365483
|
function getProjectConfigDir2(projectRoot) {
|
|
365414
|
-
return join38(
|
|
365484
|
+
return join38(resolve30(projectRoot ?? process.cwd()), PROJECT_CONFIG_DIR_NAME2);
|
|
365415
365485
|
}
|
|
365416
365486
|
function getProjectSettingsFilePath2(projectRoot) {
|
|
365417
365487
|
return join38(getProjectConfigDir2(projectRoot), "settings.json");
|
|
@@ -365450,7 +365520,7 @@ function getMemoryDir2(projectRoot) {
|
|
|
365450
365520
|
return resolvePaths2(projectRoot).memoryDir;
|
|
365451
365521
|
}
|
|
365452
365522
|
function getProjectMemoryDir2(projectRoot) {
|
|
365453
|
-
const root =
|
|
365523
|
+
const root = resolve30(projectRoot ?? process.cwd());
|
|
365454
365524
|
const key = process.platform === "win32" ? root.toLowerCase() : root;
|
|
365455
365525
|
const digest2 = createHash15("sha1").update(key).digest("hex").slice(0, 12);
|
|
365456
365526
|
return join38(getDataDir2(), "memory", `${basename11(root)}-${digest2}`);
|
|
@@ -365491,7 +365561,7 @@ async function writeJsonFileAtomically2(targetPath, value, operations = nodeFile
|
|
|
365491
365561
|
}
|
|
365492
365562
|
}
|
|
365493
365563
|
function defaultSleep2(ms) {
|
|
365494
|
-
return new Promise((
|
|
365564
|
+
return new Promise((resolve31) => setTimeout(resolve31, ms));
|
|
365495
365565
|
}
|
|
365496
365566
|
async function withSettingsFileLock2(operation, options = {}) {
|
|
365497
365567
|
const lockPath2 = options.lockPath ?? `${getConfigFilePath2()}.lock`;
|
|
@@ -366054,7 +366124,7 @@ async function retryWithBackoff2(fn, maxRetries = 3, baseDelay = 1000, options)
|
|
|
366054
366124
|
const jitter = Math.random() * 1000;
|
|
366055
366125
|
delay2 = Math.min(baseDelay * 2 ** attempt + jitter, maxDelay);
|
|
366056
366126
|
}
|
|
366057
|
-
await new Promise((
|
|
366127
|
+
await new Promise((resolve31) => setTimeout(resolve31, delay2));
|
|
366058
366128
|
}
|
|
366059
366129
|
}
|
|
366060
366130
|
throw lastError;
|
|
@@ -366414,13 +366484,13 @@ async function terminateProcessTree2(child, signal = "SIGTERM") {
|
|
|
366414
366484
|
return false;
|
|
366415
366485
|
if (process.platform !== "win32")
|
|
366416
366486
|
return signalProcessTree2(child, signal);
|
|
366417
|
-
return await new Promise((
|
|
366487
|
+
return await new Promise((resolve31) => {
|
|
366418
366488
|
let settled = false;
|
|
366419
366489
|
const finish = (stopped) => {
|
|
366420
366490
|
if (settled)
|
|
366421
366491
|
return;
|
|
366422
366492
|
settled = true;
|
|
366423
|
-
|
|
366493
|
+
resolve31(stopped);
|
|
366424
366494
|
};
|
|
366425
366495
|
try {
|
|
366426
366496
|
const killer = spawn4("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
@@ -368368,10 +368438,10 @@ async function runRunnerAttempt2(start, timeoutMs) {
|
|
|
368368
368438
|
try {
|
|
368369
368439
|
const winner = await Promise.race([
|
|
368370
368440
|
resultPromise.then((value) => ({ timedOut: false, value })),
|
|
368371
|
-
new Promise((
|
|
368441
|
+
new Promise((resolve31) => {
|
|
368372
368442
|
timeout = setTimeout(() => {
|
|
368373
368443
|
controller.abort(new WorkflowTaskTimeoutError2(timeoutMs));
|
|
368374
|
-
|
|
368444
|
+
resolve31({ timedOut: true });
|
|
368375
368445
|
}, timeoutMs);
|
|
368376
368446
|
timeout.unref?.();
|
|
368377
368447
|
})
|
|
@@ -368380,8 +368450,8 @@ async function runRunnerAttempt2(start, timeoutMs) {
|
|
|
368380
368450
|
return winner.value;
|
|
368381
368451
|
const settled = await Promise.race([
|
|
368382
368452
|
resultPromise.then((value) => ({ confirmed: true, value }), () => ({ confirmed: true })),
|
|
368383
|
-
new Promise((
|
|
368384
|
-
graceTimer = setTimeout(() =>
|
|
368453
|
+
new Promise((resolve31) => {
|
|
368454
|
+
graceTimer = setTimeout(() => resolve31({ confirmed: false }), CLEANUP_GRACE_MS3);
|
|
368385
368455
|
graceTimer.unref?.();
|
|
368386
368456
|
})
|
|
368387
368457
|
]);
|
|
@@ -368445,10 +368515,10 @@ async function runWorkflow2(spec, runner, options = {}) {
|
|
|
368445
368515
|
});
|
|
368446
368516
|
} catch {}
|
|
368447
368517
|
};
|
|
368448
|
-
await new Promise((
|
|
368518
|
+
await new Promise((resolve31) => {
|
|
368449
368519
|
const maybeResolve = () => {
|
|
368450
368520
|
if (results.size === plan.tasks.length)
|
|
368451
|
-
|
|
368521
|
+
resolve31();
|
|
368452
368522
|
};
|
|
368453
368523
|
const skipTask = (taskId, reason) => {
|
|
368454
368524
|
if (results.has(taskId) || running.has(taskId))
|
|
@@ -372344,8 +372414,8 @@ function defaultTasksDir2() {
|
|
|
372344
372414
|
}
|
|
372345
372415
|
}
|
|
372346
372416
|
function writeToStdin2(stdin, payload) {
|
|
372347
|
-
return new Promise((
|
|
372348
|
-
stdin.write(payload, (err) => err ? reject(err) :
|
|
372417
|
+
return new Promise((resolve31, reject) => {
|
|
372418
|
+
stdin.write(payload, (err) => err ? reject(err) : resolve31());
|
|
372349
372419
|
});
|
|
372350
372420
|
}
|
|
372351
372421
|
function encodeWorkerPayload2(data) {
|
|
@@ -372387,7 +372457,7 @@ function terminateProcess2(child, graceMs) {
|
|
|
372387
372457
|
function waitForProcessExit3(child, timeoutMs) {
|
|
372388
372458
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
372389
372459
|
return Promise.resolve(true);
|
|
372390
|
-
return new Promise((
|
|
372460
|
+
return new Promise((resolve31) => {
|
|
372391
372461
|
let settled = false;
|
|
372392
372462
|
const finish = (exited) => {
|
|
372393
372463
|
if (settled)
|
|
@@ -372395,7 +372465,7 @@ function waitForProcessExit3(child, timeoutMs) {
|
|
|
372395
372465
|
settled = true;
|
|
372396
372466
|
clearTimeout(timer);
|
|
372397
372467
|
child.removeListener("exit", onExit);
|
|
372398
|
-
|
|
372468
|
+
resolve31(exited);
|
|
372399
372469
|
};
|
|
372400
372470
|
const onExit = () => finish(true);
|
|
372401
372471
|
const timer = setTimeout(() => finish(false), timeoutMs);
|
|
@@ -375417,7 +375487,7 @@ function factsToRulesMarkdown2(facts) {
|
|
|
375417
375487
|
}
|
|
375418
375488
|
function getLocalRulesDir2(cwd) {
|
|
375419
375489
|
const base = process.env.VYKOR_CONFIG_DIR ?? join302(homedir62(), ".vykor");
|
|
375420
|
-
const project =
|
|
375490
|
+
const project = resolve262(cwd);
|
|
375421
375491
|
const digest2 = createHash16("sha1").update(project).digest("hex").slice(0, 12);
|
|
375422
375492
|
return join302(base, "local_rules", "projects", `${basename92(project)}-${digest2}`);
|
|
375423
375493
|
}
|
|
@@ -375706,7 +375776,7 @@ function buildDelegationSection2() {
|
|
|
375706
375776
|
`);
|
|
375707
375777
|
}
|
|
375708
375778
|
async function discoverClaudeMdFiles2(cwd) {
|
|
375709
|
-
const current =
|
|
375779
|
+
const current = resolve272(cwd);
|
|
375710
375780
|
const results = [];
|
|
375711
375781
|
const seen = /* @__PURE__ */ new Set;
|
|
375712
375782
|
const directories = [];
|
|
@@ -376336,13 +376406,13 @@ function childFailureData(identity, externalSignal, error2, sessionId, runId, co
|
|
|
376336
376406
|
};
|
|
376337
376407
|
}
|
|
376338
376408
|
function deferred() {
|
|
376339
|
-
let
|
|
376409
|
+
let resolve31;
|
|
376340
376410
|
let reject;
|
|
376341
376411
|
const promise = new Promise((done, fail) => {
|
|
376342
|
-
|
|
376412
|
+
resolve31 = done;
|
|
376343
376413
|
reject = fail;
|
|
376344
376414
|
});
|
|
376345
|
-
return { promise, resolve:
|
|
376415
|
+
return { promise, resolve: resolve31, reject };
|
|
376346
376416
|
}
|
|
376347
376417
|
function createAssembledAgent(options) {
|
|
376348
376418
|
return new DefaultVykorAgent(options.runtime, options.session, options.mcpConnections, options.retainMcpConnectionsForRun ?? (() => () => {
|
|
@@ -376386,8 +376456,8 @@ async function awaitFrameworkChildTask2(children, taskId, timeoutMs) {
|
|
|
376386
376456
|
try {
|
|
376387
376457
|
return await Promise.race([
|
|
376388
376458
|
completion,
|
|
376389
|
-
new Promise((
|
|
376390
|
-
timer = setTimeout(() =>
|
|
376459
|
+
new Promise((resolve31) => {
|
|
376460
|
+
timer = setTimeout(() => resolve31({ status: "running", output: "", timedOut: true }), Math.max(0, timeoutMs));
|
|
376391
376461
|
})
|
|
376392
376462
|
]);
|
|
376393
376463
|
} finally {
|
|
@@ -378652,10 +378722,10 @@ function awaitWithAbort2(task, signal) {
|
|
|
378652
378722
|
return task;
|
|
378653
378723
|
if (signal.aborted)
|
|
378654
378724
|
return Promise.reject(abortedError2(signal.reason));
|
|
378655
|
-
return new Promise((
|
|
378725
|
+
return new Promise((resolve31, reject) => {
|
|
378656
378726
|
const onAbort = () => reject(abortedError2(signal.reason));
|
|
378657
378727
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
378658
|
-
task.then(
|
|
378728
|
+
task.then(resolve31, reject).finally(() => {
|
|
378659
378729
|
signal.removeEventListener("abort", onAbort);
|
|
378660
378730
|
});
|
|
378661
378731
|
});
|
|
@@ -381322,7 +381392,7 @@ function normalizeRgPath2(path) {
|
|
|
381322
381392
|
return path.replace(/^\.[\\/]/, "");
|
|
381323
381393
|
}
|
|
381324
381394
|
function runHostProcess2(command, args, options) {
|
|
381325
|
-
return new Promise((
|
|
381395
|
+
return new Promise((resolve31) => {
|
|
381326
381396
|
const child = execFileSync2;
|
|
381327
381397
|
try {
|
|
381328
381398
|
const stdout = child(command, args, {
|
|
@@ -381331,10 +381401,10 @@ function runHostProcess2(command, args, options) {
|
|
|
381331
381401
|
timeout: 30000,
|
|
381332
381402
|
stdio: ["ignore", "pipe", "ignore"]
|
|
381333
381403
|
}).toString();
|
|
381334
|
-
|
|
381404
|
+
resolve31({ exitCode: 0, stdout, stderr: "" });
|
|
381335
381405
|
} catch (error2) {
|
|
381336
381406
|
const err = error2;
|
|
381337
|
-
|
|
381407
|
+
resolve31({
|
|
381338
381408
|
exitCode: typeof err.status === "number" ? err.status : -1,
|
|
381339
381409
|
stdout: err.stdout?.toString() ?? "",
|
|
381340
381410
|
stderr: err.stderr?.toString() ?? ""
|
|
@@ -382718,6 +382788,62 @@ function serializeRunnerError2(error2) {
|
|
|
382718
382788
|
}
|
|
382719
382789
|
return { name: "Error", message: String(error2) };
|
|
382720
382790
|
}
|
|
382791
|
+
function resolveHost3(context) {
|
|
382792
|
+
if (!context.terminal)
|
|
382793
|
+
return failed22("This host does not provide persistent terminals.");
|
|
382794
|
+
if (!context.sessionId)
|
|
382795
|
+
return failed22("Persistent terminals require a durable session.");
|
|
382796
|
+
return { host: context.terminal, sessionId: context.sessionId };
|
|
382797
|
+
}
|
|
382798
|
+
function terminalResult2(action2, value) {
|
|
382799
|
+
return {
|
|
382800
|
+
content: [
|
|
382801
|
+
{
|
|
382802
|
+
type: "text",
|
|
382803
|
+
text: JSON.stringify({ kind: "terminal", action: action2, ...value })
|
|
382804
|
+
}
|
|
382805
|
+
]
|
|
382806
|
+
};
|
|
382807
|
+
}
|
|
382808
|
+
function optionalString4(value) {
|
|
382809
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
382810
|
+
}
|
|
382811
|
+
function optionalNumber5(value) {
|
|
382812
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
382813
|
+
}
|
|
382814
|
+
function failed22(error2) {
|
|
382815
|
+
return {
|
|
382816
|
+
content: [
|
|
382817
|
+
{
|
|
382818
|
+
type: "text",
|
|
382819
|
+
text: error2 instanceof Error ? error2.message : String(error2)
|
|
382820
|
+
}
|
|
382821
|
+
],
|
|
382822
|
+
isError: true
|
|
382823
|
+
};
|
|
382824
|
+
}
|
|
382825
|
+
function isPersistentServiceCommand2(command) {
|
|
382826
|
+
let text3 = command.trim().toLowerCase();
|
|
382827
|
+
const changeDirectory = /^(?:cd(?:\s+\/d)?|set-location(?:\s+-(?:path|literalpath))?)\s+(?:"[^"]*"|'[^']*'|[^\s;&|'"<>]+)\s*(?:;|&&|\r?\n)\s*/;
|
|
382828
|
+
while (changeDirectory.test(text3))
|
|
382829
|
+
text3 = text3.replace(changeDirectory, "");
|
|
382830
|
+
text3 = text3.replace(/\s+2>&1\s*$/, "");
|
|
382831
|
+
if (/[;&|\r\n]/.test(text3))
|
|
382832
|
+
return false;
|
|
382833
|
+
if (/(?:^|\s)(?:--help|--version|-h)(?:\s|$)/.test(text3))
|
|
382834
|
+
return false;
|
|
382835
|
+
if (/^docker(?:\s+compose|-compose)\s+up\b/.test(text3)) {
|
|
382836
|
+
return !/(?:^|\s)(?:-d|--detach)(?:\s|$)/.test(text3);
|
|
382837
|
+
}
|
|
382838
|
+
return [
|
|
382839
|
+
/^(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:dev|start|serve|watch)(?:\s|$)/,
|
|
382840
|
+
/^(?:(?:npx|bunx|pnpm\s+exec)\s+)?(?:vite|next|nuxt|astro|webpack|rollup|parcel|tsc)\b.*(?:\b(?:dev|start|serve|watch)\b|(?:^|\s)(?:-w|--watch)(?:\s|$))/,
|
|
382841
|
+
/^(?:(?:npx|bunx|pnpm\s+exec)\s+)?vite(?:\s+(?!(?:build|optimize)(?:\s|$))|$)/,
|
|
382842
|
+
/^(?:python[\d.]*|py)(?:\s+-\d(?:\.\d+)?)?\s+-m\s+http\.server\b/,
|
|
382843
|
+
/^(?:(?:python[\d.]*|py)\s+-m\s+)?(?:uvicorn|gunicorn)\b/,
|
|
382844
|
+
/^flask\s+(?:--app\s+\S+\s+)?run\b/
|
|
382845
|
+
].some((pattern) => pattern.test(text3));
|
|
382846
|
+
}
|
|
382721
382847
|
function createShellTool2(shellOrExecutor, executor = defaultShellExecutor2) {
|
|
382722
382848
|
const shell = isShellExecutor2(shellOrExecutor) ? undefined : shellOrExecutor;
|
|
382723
382849
|
const effectiveExecutor = isShellExecutor2(shellOrExecutor) ? shellOrExecutor : executor;
|
|
@@ -382745,6 +382871,19 @@ function createShellTool2(shellOrExecutor, executor = defaultShellExecutor2) {
|
|
|
382745
382871
|
const command = typeof input.command === "string" ? input.command.trim() : "";
|
|
382746
382872
|
const descriptor = context.environment?.info.shellDescriptor ?? shell;
|
|
382747
382873
|
const hasExplicitTimeout = input.timeout !== undefined;
|
|
382874
|
+
if (command && !hasExplicitTimeout && context.terminal && context.sessionId && isPersistentServiceCommand2(command)) {
|
|
382875
|
+
const workdir = typeof input.workdir === "string" ? input.workdir.trim() : "";
|
|
382876
|
+
const resolvedWorkdir = workdir && context.environment ? await context.environment.paths.resolve(workdir, "execute") : undefined;
|
|
382877
|
+
if (resolvedWorkdir && resolvedWorkdir.mountPurpose !== "workspace")
|
|
382878
|
+
return workdirDenied2(resolvedWorkdir.executionPath);
|
|
382879
|
+
const atSessionRoot = resolvedWorkdir ? resolvedWorkdir.executionPath === context.environment.workspace.executionRoot : !workdir || resolve252(context.cwd, workdir) === resolve252(context.cwd);
|
|
382880
|
+
if (!atSessionRoot) {
|
|
382881
|
+
return { content: [{ type: "text", text: "Use TerminalOpen with command for this service. Include a shell-appropriate cd to the requested subdirectory in command; terminals are scoped to the session directory." }], isError: true, failureKind: "invalid_input", executionState: "not_started" };
|
|
382882
|
+
}
|
|
382883
|
+
if (context.abortSignal?.aborted)
|
|
382884
|
+
return interruptedBeforeStart2();
|
|
382885
|
+
return terminalOpenTool2.execute({ command, name: summarizeCommand2(command) }, context);
|
|
382886
|
+
}
|
|
382748
382887
|
const background = Boolean(command && !hasExplicitTimeout && shouldCreateBackgroundShell2(command, context));
|
|
382749
382888
|
if (background) {
|
|
382750
382889
|
try {
|
|
@@ -382985,7 +383124,7 @@ function descriptorHostLauncher2(descriptor) {
|
|
|
382985
383124
|
return descriptor.dialect === "bash" ? { kind: "bash", bin: descriptor.executable } : { kind: "posix-sh" };
|
|
382986
383125
|
}
|
|
382987
383126
|
function createShellDescription2(shell) {
|
|
382988
|
-
const background = "For
|
|
383127
|
+
const background = "For persistent services such as dev servers and watchers, use TerminalOpen with command when available, then inspect with JobRead/JobWait and stop with JobCancel. For finite long-running work such as installs, builds, and migrations, use BackgroundShellCreate, then follow the returned handle. Do not claim completion or service readiness without evidence.";
|
|
382989
383128
|
const powershellQuoting = `This tool already runs PowerShell: execute scripts directly. If another powershell/pwsh process is needed, use a single-quoted -Command script or a script block; double-quoted scripts expand $variables in the outer shell. A here-string opener (@' or @") must be followed by a newline before any content; put its matching terminator ('@ or "@) on its own line.`;
|
|
382990
383129
|
if (!shell)
|
|
382991
383130
|
return `Execute a short-lived command using the execution environment's resolved shell. ${background}`;
|
|
@@ -383238,18 +383377,21 @@ function createBackgroundShellTool2(shell) {
|
|
|
383238
383377
|
}
|
|
383239
383378
|
const description = readRequiredString2(input.description, "description");
|
|
383240
383379
|
if ("error" in description)
|
|
383241
|
-
return
|
|
383380
|
+
return failed32(description.error);
|
|
383242
383381
|
const command = readRequiredString2(input.command, "command");
|
|
383243
383382
|
if ("error" in command)
|
|
383244
|
-
return
|
|
383383
|
+
return failed32(command.error);
|
|
383384
|
+
if (context.terminal && context.sessionId && isPersistentServiceCommand2(command.value)) {
|
|
383385
|
+
return terminalOpenTool2.execute({ command: command.value, name: description.value }, context);
|
|
383386
|
+
}
|
|
383245
383387
|
if (!context.sessionId)
|
|
383246
|
-
return { ...
|
|
383388
|
+
return { ...failed32("Background shell jobs require a durable session."), failureKind: "configuration" };
|
|
383247
383389
|
if (!context.backgroundShell)
|
|
383248
|
-
return { ...
|
|
383390
|
+
return { ...failed32("Background shell host is not configured."), failureKind: "configuration" };
|
|
383249
383391
|
if (!context.toolCallId)
|
|
383250
|
-
return { ...
|
|
383392
|
+
return { ...failed32("Background shell request identity is not configured."), failureKind: "configuration" };
|
|
383251
383393
|
if (context.abortSignal?.aborted) {
|
|
383252
|
-
return { ...
|
|
383394
|
+
return { ...failed32("Shell interrupted before the command started."), failureKind: "interrupted" };
|
|
383253
383395
|
}
|
|
383254
383396
|
try {
|
|
383255
383397
|
const created = await context.backgroundShell.create({
|
|
@@ -383276,7 +383418,7 @@ function createBackgroundShellTool2(shell) {
|
|
|
383276
383418
|
compactSummary: `BackgroundShellCreate completed: jobId=${created.jobId}`
|
|
383277
383419
|
};
|
|
383278
383420
|
} catch (error2) {
|
|
383279
|
-
return { ...
|
|
383421
|
+
return { ...failed32(error2 instanceof Error ? error2.message : String(error2)), failureKind: "unknown_outcome", executionState: "unknown" };
|
|
383280
383422
|
}
|
|
383281
383423
|
}
|
|
383282
383424
|
};
|
|
@@ -383284,7 +383426,7 @@ function createBackgroundShellTool2(shell) {
|
|
|
383284
383426
|
function readRequiredString2(value, name) {
|
|
383285
383427
|
return typeof value === "string" && value.trim() ? { value: value.trim() } : { error: `${name} is required.` };
|
|
383286
383428
|
}
|
|
383287
|
-
function
|
|
383429
|
+
function failed32(message) {
|
|
383288
383430
|
return { content: [{ type: "text", text: message }], isError: true, failureKind: "invalid_input", executionState: "not_started" };
|
|
383289
383431
|
}
|
|
383290
383432
|
function requireProvider2(provider, capability) {
|
|
@@ -383555,40 +383697,6 @@ Try a broader query, alternate terms, or another relevant source.`
|
|
|
383555
383697
|
}
|
|
383556
383698
|
};
|
|
383557
383699
|
}
|
|
383558
|
-
function resolveHost3(context) {
|
|
383559
|
-
if (!context.terminal)
|
|
383560
|
-
return failed32("This host does not provide persistent terminals.");
|
|
383561
|
-
if (!context.sessionId)
|
|
383562
|
-
return failed32("Persistent terminals require a durable session.");
|
|
383563
|
-
return { host: context.terminal, sessionId: context.sessionId };
|
|
383564
|
-
}
|
|
383565
|
-
function terminalResult2(action2, value) {
|
|
383566
|
-
return {
|
|
383567
|
-
content: [
|
|
383568
|
-
{
|
|
383569
|
-
type: "text",
|
|
383570
|
-
text: JSON.stringify({ kind: "terminal", action: action2, ...value })
|
|
383571
|
-
}
|
|
383572
|
-
]
|
|
383573
|
-
};
|
|
383574
|
-
}
|
|
383575
|
-
function optionalString4(value) {
|
|
383576
|
-
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
383577
|
-
}
|
|
383578
|
-
function optionalNumber5(value) {
|
|
383579
|
-
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
383580
|
-
}
|
|
383581
|
-
function failed32(error2) {
|
|
383582
|
-
return {
|
|
383583
|
-
content: [
|
|
383584
|
-
{
|
|
383585
|
-
type: "text",
|
|
383586
|
-
text: error2 instanceof Error ? error2.message : String(error2)
|
|
383587
|
-
}
|
|
383588
|
-
],
|
|
383589
|
-
isError: true
|
|
383590
|
-
};
|
|
383591
|
-
}
|
|
383592
383700
|
function resolveHost22(context) {
|
|
383593
383701
|
if (!context.jobs)
|
|
383594
383702
|
return failed42("This host does not provide background jobs.");
|
|
@@ -383780,12 +383888,12 @@ function limitOutput(text3, maxChars = DEFAULT_OUTPUT_LIMIT) {
|
|
|
383780
383888
|
return text3.length > limit2 ? { text: text3.slice(-limit2), truncated: true } : { text: text3, truncated: false };
|
|
383781
383889
|
}
|
|
383782
383890
|
function delay(ms, signal) {
|
|
383783
|
-
return new Promise((
|
|
383891
|
+
return new Promise((resolve31, reject) => {
|
|
383784
383892
|
const timer = setTimeout(done, Math.max(1, ms));
|
|
383785
383893
|
timer.unref?.();
|
|
383786
383894
|
function done() {
|
|
383787
383895
|
signal?.removeEventListener("abort", aborted2);
|
|
383788
|
-
|
|
383896
|
+
resolve31();
|
|
383789
383897
|
}
|
|
383790
383898
|
function aborted2() {
|
|
383791
383899
|
clearTimeout(timer);
|
|
@@ -385170,6 +385278,7 @@ async function activateNativePluginTools(plugin, context) {
|
|
|
385170
385278
|
context.toolRegistry.unregister?.(name);
|
|
385171
385279
|
};
|
|
385172
385280
|
const host2 = new NativeToolHost(plugin, {
|
|
385281
|
+
dataRoot: context.dataRoot,
|
|
385173
385282
|
callTimeoutMs: context.callTimeoutMs,
|
|
385174
385283
|
cancellationGraceMs: context.cancellationGraceMs,
|
|
385175
385284
|
outputMaxBytes: context.outputMaxBytes,
|
|
@@ -385216,10 +385325,36 @@ async function activateNativePluginTools(plugin, context) {
|
|
|
385216
385325
|
if (view && (view.pluginId !== plugin.manifest.id || view.tools.get(definition.name)?.ownerPluginId !== plugin.manifest.id)) {
|
|
385217
385326
|
return Promise.resolve({ isError: true, content: [{ type: "text", text: "Native Tool is not available in this Run." }] });
|
|
385218
385327
|
}
|
|
385219
|
-
|
|
385220
|
-
|
|
385221
|
-
|
|
385222
|
-
|
|
385328
|
+
if (definition.execution?.network && (toolContext.environment?.info.networkMode === "none" || toolContext.settings?.sandbox?.enabled && toolContext.settings.sandbox.network?.mode === "none")) {
|
|
385329
|
+
return Promise.resolve({
|
|
385330
|
+
isError: true,
|
|
385331
|
+
failureKind: "policy",
|
|
385332
|
+
executionState: "not_started",
|
|
385333
|
+
content: [{ type: "text", text: "Tool requires network access, which is disabled in this Run." }]
|
|
385334
|
+
});
|
|
385335
|
+
}
|
|
385336
|
+
return guard.run(definition.name, definition.inputSchema, input, toolContext, async () => {
|
|
385337
|
+
const reference = definition.toolResultInput ? input[definition.toolResultInput] : undefined;
|
|
385338
|
+
const referenced = typeof reference === "string" ? toolContext.readToolResult?.(reference) : undefined;
|
|
385339
|
+
if (reference !== undefined && !referenced)
|
|
385340
|
+
return {
|
|
385341
|
+
isError: true,
|
|
385342
|
+
failureKind: "precondition",
|
|
385343
|
+
executionState: "not_started",
|
|
385344
|
+
content: [{ type: "text", text: "Referenced tool result is unavailable in this Run. Fetch it again or use already saved plugin data." }]
|
|
385345
|
+
};
|
|
385346
|
+
return host2.call(definition.name, input, {
|
|
385347
|
+
cwd: toolContext.cwd || context.cwd,
|
|
385348
|
+
...toolContext.sessionId ? { sessionId: toolContext.sessionId } : {},
|
|
385349
|
+
...toolContext.agent?.scope.runId ? { runId: toolContext.agent.scope.runId } : {},
|
|
385350
|
+
...referenced ? { toolResult: {
|
|
385351
|
+
toolUseId: referenced.toolUseId,
|
|
385352
|
+
toolName: referenced.toolName,
|
|
385353
|
+
content: referenced.content,
|
|
385354
|
+
isError: referenced.isError
|
|
385355
|
+
} } : {}
|
|
385356
|
+
}, toolContext.abortSignal);
|
|
385357
|
+
});
|
|
385223
385358
|
}
|
|
385224
385359
|
}, { kind: "plugin", id: plugin.manifest.id });
|
|
385225
385360
|
toolNames.push(definition.name);
|
|
@@ -385516,11 +385651,11 @@ async function resolveNativePluginPath2(root, declaredPath) {
|
|
|
385516
385651
|
}
|
|
385517
385652
|
let realRoot;
|
|
385518
385653
|
try {
|
|
385519
|
-
realRoot = await realpath32(
|
|
385654
|
+
realRoot = await realpath32(resolve282(root));
|
|
385520
385655
|
} catch (error2) {
|
|
385521
385656
|
throw new NativePluginPathError2("root_unavailable", `Native plugin root is unavailable: ${String(error2)}`, declaredPath);
|
|
385522
385657
|
}
|
|
385523
|
-
const lexicalTarget =
|
|
385658
|
+
const lexicalTarget = resolve282(realRoot, declaredPath);
|
|
385524
385659
|
if (!isWithin2(realRoot, lexicalTarget)) {
|
|
385525
385660
|
throw new NativePluginPathError2("path_outside_root", `Native component path leaves the plugin root: ${declaredPath}`, declaredPath);
|
|
385526
385661
|
}
|
|
@@ -385545,15 +385680,15 @@ async function resolveNativePluginPath2(root, declaredPath) {
|
|
|
385545
385680
|
if (!isWithin2(realRoot, realAncestor)) {
|
|
385546
385681
|
throw new NativePluginPathError2("path_outside_root", `Native component parent symlink leaves the plugin root: ${declaredPath}`, declaredPath);
|
|
385547
385682
|
}
|
|
385548
|
-
return
|
|
385683
|
+
return join332(realAncestor, ...missingSegments);
|
|
385549
385684
|
}
|
|
385550
385685
|
async function readUiBytes2(root, declaredPath, limit2) {
|
|
385551
385686
|
const realRoot = await realpath42(root);
|
|
385552
385687
|
const path = await resolveNativePluginPath2(realRoot, declaredPath);
|
|
385553
|
-
const lexicalPath =
|
|
385688
|
+
const lexicalPath = resolve292(realRoot, declaredPath);
|
|
385554
385689
|
let parent = realRoot;
|
|
385555
385690
|
for (const segment of relative112(realRoot, lexicalPath).split(sep72)) {
|
|
385556
|
-
parent =
|
|
385691
|
+
parent = join342(parent, segment);
|
|
385557
385692
|
if ((await lstat42(parent)).isSymbolicLink())
|
|
385558
385693
|
throw new UiReadError2("plugin_ui_invalid_definition");
|
|
385559
385694
|
}
|
|
@@ -385652,7 +385787,7 @@ function invalid22(diagnostics, rootManifest) {
|
|
|
385652
385787
|
return { status: "invalid", ...rootManifest ? { rootManifest } : {}, diagnostics };
|
|
385653
385788
|
}
|
|
385654
385789
|
async function validateNativePlugin2(root) {
|
|
385655
|
-
const manifestPath =
|
|
385790
|
+
const manifestPath = join352(root, MANIFEST_RELATIVE_PATH2);
|
|
385656
385791
|
let source;
|
|
385657
385792
|
try {
|
|
385658
385793
|
source = await readFile122(manifestPath, "utf8");
|
|
@@ -385766,7 +385901,7 @@ async function collectMarkdown2(path) {
|
|
|
385766
385901
|
return [];
|
|
385767
385902
|
const files = [];
|
|
385768
385903
|
for (const entry of (await readdir72(path, { withFileTypes: true })).sort((a2, b2) => a2.name.localeCompare(b2.name))) {
|
|
385769
|
-
const full =
|
|
385904
|
+
const full = join362(path, entry.name);
|
|
385770
385905
|
if (entry.isDirectory())
|
|
385771
385906
|
files.push(...await collectMarkdown2(full));
|
|
385772
385907
|
else if (entry.isFile() && entry.name.toLowerCase().endsWith(".md"))
|
|
@@ -385786,7 +385921,7 @@ async function loadNativeAgents2(plugin) {
|
|
|
385786
385921
|
const scopedName = typeof frontmatter.name === "string" && frontmatter.name.trim() ? frontmatter.name.trim() : stem;
|
|
385787
385922
|
const agent = buildAgentDefinition2(frontmatter, body, {
|
|
385788
385923
|
stem: scopedName,
|
|
385789
|
-
baseDir:
|
|
385924
|
+
baseDir: join362(file, ".."),
|
|
385790
385925
|
source: "plugin",
|
|
385791
385926
|
nameOverride: `${plugin.manifest.id}:${scopedName}`,
|
|
385792
385927
|
descriptionFallback: `Agent from ${plugin.manifest.name}`
|
|
@@ -386076,7 +386211,7 @@ async function loadNativePlugin2(plugin) {
|
|
|
386076
386211
|
async function filesUnder2(root, current = root) {
|
|
386077
386212
|
const files = [];
|
|
386078
386213
|
for (const entry of (await readdir82(current, { withFileTypes: true })).sort((a2, b2) => a2.name.localeCompare(b2.name))) {
|
|
386079
|
-
const full =
|
|
386214
|
+
const full = join372(current, entry.name);
|
|
386080
386215
|
if (entry.isDirectory())
|
|
386081
386216
|
files.push(...await filesUnder2(root, full));
|
|
386082
386217
|
else if (entry.isFile())
|
|
@@ -386097,7 +386232,7 @@ async function computePluginBehaviorDigest2(root) {
|
|
|
386097
386232
|
return hash.digest("hex");
|
|
386098
386233
|
}
|
|
386099
386234
|
function comparablePath2(path) {
|
|
386100
|
-
const resolved =
|
|
386235
|
+
const resolved = resolve302(path);
|
|
386101
386236
|
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
386102
386237
|
}
|
|
386103
386238
|
async function assertRegularPluginCacheSnapshot2(target) {
|
|
@@ -386110,7 +386245,7 @@ async function assertRegularPluginCacheSnapshot2(target) {
|
|
|
386110
386245
|
realpath62(parent),
|
|
386111
386246
|
realpath62(target)
|
|
386112
386247
|
]);
|
|
386113
|
-
const expectedTarget =
|
|
386248
|
+
const expectedTarget = join372(resolvedParent, basename12(target));
|
|
386114
386249
|
if (comparablePath2(resolvedTarget) !== comparablePath2(expectedTarget)) {
|
|
386115
386250
|
throw new Error(`Plugin cache snapshot is not a regular directory: ${target}`);
|
|
386116
386251
|
}
|
|
@@ -389421,8 +389556,8 @@ function adaptEnvironmentProcess22(process8) {
|
|
|
389421
389556
|
return child;
|
|
389422
389557
|
}
|
|
389423
389558
|
function sleep32(ms) {
|
|
389424
|
-
return new Promise((
|
|
389425
|
-
setTimeout(
|
|
389559
|
+
return new Promise((resolve31) => {
|
|
389560
|
+
setTimeout(resolve31, ms).unref();
|
|
389426
389561
|
});
|
|
389427
389562
|
}
|
|
389428
389563
|
function resolveTransportKind(config2) {
|
|
@@ -389907,7 +390042,7 @@ async function installRuntimeIntegrations(options) {
|
|
|
389907
390042
|
const checked = await loadNativeUiMetadata2({
|
|
389908
390043
|
root: plugin.root,
|
|
389909
390044
|
manifest: plugin.manifest,
|
|
389910
|
-
manifestPath:
|
|
390045
|
+
manifestPath: join382(plugin.root, ".vykor-plugin", "plugin.json")
|
|
389911
390046
|
});
|
|
389912
390047
|
if (checked.status !== "loaded" || checked.value?.length !== original.value.length || original.value.some((component2) => !checked.value?.some((current) => current.definition.id === component2.definition.id && current.componentDigest === component2.componentDigest && current.htmlSha256 === component2.htmlSha256 && current.entryPath === component2.entryPath))) {
|
|
389913
390048
|
diagnostic("Plugin UI component changed since discovery.");
|
|
@@ -390391,6 +390526,14 @@ function createAgentWorkspaceBinding(cwd, kind3) {
|
|
|
390391
390526
|
executionRoot: kind3 === "wsl" ? hostPathToWslPath2(cwd) : cwd
|
|
390392
390527
|
});
|
|
390393
390528
|
}
|
|
390529
|
+
function terminalCommandArgs(shell, command) {
|
|
390530
|
+
const name = shell.split(/[\\/]/).pop()?.replace(/\.exe$/i, "").toLowerCase();
|
|
390531
|
+
if (name === "powershell" || name === "pwsh")
|
|
390532
|
+
return ["-NoLogo", "-NoProfile", "-Command", command];
|
|
390533
|
+
if (name === "cmd")
|
|
390534
|
+
return ["/d", "/s", "/c", command];
|
|
390535
|
+
return ["-lc", command];
|
|
390536
|
+
}
|
|
390394
390537
|
function resolveDefaultShell(platform5 = process.platform, env = process.env, fileExists = existsSync182) {
|
|
390395
390538
|
if (platform5 === "win32") {
|
|
390396
390539
|
return { command: resolveWindowsShell(env, fileExists), args: [] };
|
|
@@ -390434,7 +390577,7 @@ function findOnPath(executable, env, fileExists, pathDelimiter = delimiter22) {
|
|
|
390434
390577
|
const directory = rawDirectory.trim().replace(/^"|"$/g, "");
|
|
390435
390578
|
if (!directory)
|
|
390436
390579
|
continue;
|
|
390437
|
-
const candidate =
|
|
390580
|
+
const candidate = join392(directory, executable);
|
|
390438
390581
|
if (fileExists(candidate))
|
|
390439
390582
|
return candidate;
|
|
390440
390583
|
}
|
|
@@ -390560,6 +390703,7 @@ function createRequest(input, sessionId) {
|
|
|
390560
390703
|
rows: input.rows ?? 30,
|
|
390561
390704
|
name: input.name ?? "Agent terminal",
|
|
390562
390705
|
...input.shell !== undefined ? { shell: input.shell } : {},
|
|
390706
|
+
...input.command !== undefined ? { command: input.command } : {},
|
|
390563
390707
|
cwd: input.cwd,
|
|
390564
390708
|
source: "agent"
|
|
390565
390709
|
};
|
|
@@ -391333,8 +391477,8 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
391333
391477
|
this.assertIdle(kind3);
|
|
391334
391478
|
this.lifecycleState = "maintaining";
|
|
391335
391479
|
let settle;
|
|
391336
|
-
const settled = new Promise((
|
|
391337
|
-
settle =
|
|
391480
|
+
const settled = new Promise((resolve31) => {
|
|
391481
|
+
settle = resolve31;
|
|
391338
391482
|
});
|
|
391339
391483
|
const operation = { kind: kind3, settled, controller };
|
|
391340
391484
|
this.maintenance = operation;
|
|
@@ -391987,7 +392131,7 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
391987
392131
|
}
|
|
391988
392132
|
}, startsWithSchemeRegexp, isAbsoluteURL = (url2) => {
|
|
391989
392133
|
return startsWithSchemeRegexp.test(url2);
|
|
391990
|
-
}, sleep3 = (ms) => new Promise((
|
|
392134
|
+
}, sleep3 = (ms) => new Promise((resolve31) => setTimeout(resolve31, ms)), validatePositiveInteger = (name, n2) => {
|
|
391991
392135
|
if (typeof n2 !== "number" || !Number.isInteger(n2)) {
|
|
391992
392136
|
throw new AnthropicError(`${name} must be an integer`);
|
|
391993
392137
|
}
|
|
@@ -393556,7 +393700,7 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
393556
393700
|
}
|
|
393557
393701
|
}, startsWithSchemeRegexp2, isAbsoluteURL2 = (url2) => {
|
|
393558
393702
|
return startsWithSchemeRegexp2.test(url2);
|
|
393559
|
-
}, sleep22 = (ms) => new Promise((
|
|
393703
|
+
}, sleep22 = (ms) => new Promise((resolve31) => setTimeout(resolve31, ms)), validatePositiveInteger2 = (name, n2) => {
|
|
393560
393704
|
if (typeof n2 !== "number" || !Number.isInteger(n2)) {
|
|
393561
393705
|
throw new OpenAIError(`${name} must be an integer`);
|
|
393562
393706
|
}
|
|
@@ -393660,12 +393804,12 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
393660
393804
|
_EventStream_errored.set(this, false);
|
|
393661
393805
|
_EventStream_aborted.set(this, false);
|
|
393662
393806
|
_EventStream_catchingPromiseCreated.set(this, false);
|
|
393663
|
-
__classPrivateFieldSet11(this, _EventStream_connectedPromise, new Promise((
|
|
393664
|
-
__classPrivateFieldSet11(this, _EventStream_resolveConnectedPromise,
|
|
393807
|
+
__classPrivateFieldSet11(this, _EventStream_connectedPromise, new Promise((resolve31, reject) => {
|
|
393808
|
+
__classPrivateFieldSet11(this, _EventStream_resolveConnectedPromise, resolve31, "f");
|
|
393665
393809
|
__classPrivateFieldSet11(this, _EventStream_rejectConnectedPromise, reject, "f");
|
|
393666
393810
|
}), "f");
|
|
393667
|
-
__classPrivateFieldSet11(this, _EventStream_endPromise, new Promise((
|
|
393668
|
-
__classPrivateFieldSet11(this, _EventStream_resolveEndPromise,
|
|
393811
|
+
__classPrivateFieldSet11(this, _EventStream_endPromise, new Promise((resolve31, reject) => {
|
|
393812
|
+
__classPrivateFieldSet11(this, _EventStream_resolveEndPromise, resolve31, "f");
|
|
393669
393813
|
__classPrivateFieldSet11(this, _EventStream_rejectEndPromise, reject, "f");
|
|
393670
393814
|
}), "f");
|
|
393671
393815
|
__classPrivateFieldGet12(this, _EventStream_connectedPromise, "f").catch(() => {});
|
|
@@ -393717,11 +393861,11 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
393717
393861
|
return this;
|
|
393718
393862
|
}
|
|
393719
393863
|
emitted(event) {
|
|
393720
|
-
return new Promise((
|
|
393864
|
+
return new Promise((resolve31, reject) => {
|
|
393721
393865
|
__classPrivateFieldSet11(this, _EventStream_catchingPromiseCreated, true, "f");
|
|
393722
393866
|
if (event !== "error")
|
|
393723
393867
|
this.once("error", reject);
|
|
393724
|
-
this.once(event,
|
|
393868
|
+
this.once(event, resolve31);
|
|
393725
393869
|
});
|
|
393726
393870
|
}
|
|
393727
393871
|
async done() {
|
|
@@ -394441,7 +394585,7 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
394441
394585
|
if (this.clock() - startedAt >= 1e4) {
|
|
394442
394586
|
throw new McpOAuthStoreError2("credential-lock-timeout", "Timed out waiting for OAuth credential lock");
|
|
394443
394587
|
}
|
|
394444
|
-
await new Promise((
|
|
394588
|
+
await new Promise((resolve31) => setTimeout(resolve31, 50));
|
|
394445
394589
|
}
|
|
394446
394590
|
}
|
|
394447
394591
|
}
|
|
@@ -394562,7 +394706,7 @@ var require2, __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __get
|
|
|
394562
394706
|
if (this.clock() - startedAt >= 1e4) {
|
|
394563
394707
|
throw new ChannelConfigStoreError2("channel-config-lock-timeout", "Timed out waiting for channel config lock");
|
|
394564
394708
|
}
|
|
394565
|
-
await new Promise((
|
|
394709
|
+
await new Promise((resolve31) => setTimeout(resolve31, 50));
|
|
394566
394710
|
}
|
|
394567
394711
|
}
|
|
394568
394712
|
}
|
|
@@ -395141,7 +395285,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395141
395285
|
};
|
|
395142
395286
|
}
|
|
395143
395287
|
run(spec, signal, onOutput) {
|
|
395144
|
-
return new Promise((
|
|
395288
|
+
return new Promise((resolve31) => {
|
|
395145
395289
|
let child;
|
|
395146
395290
|
let output = "";
|
|
395147
395291
|
let outputTruncated = false;
|
|
@@ -395178,7 +395322,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395178
395322
|
if (graceTimer)
|
|
395179
395323
|
clearTimeout(graceTimer);
|
|
395180
395324
|
signal?.removeEventListener("abort", interrupt);
|
|
395181
|
-
|
|
395325
|
+
resolve31(createRunResult2({
|
|
395182
395326
|
output,
|
|
395183
395327
|
outputTruncated,
|
|
395184
395328
|
exitCode,
|
|
@@ -395276,7 +395420,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395276
395420
|
this.pending = Buffer.alloc(0);
|
|
395277
395421
|
return result2;
|
|
395278
395422
|
}
|
|
395279
|
-
}, defaultShellExecutor2, shellTool2, backgroundShellCreateTool2, WebProviderError2, WebRuntime2 = class {
|
|
395423
|
+
}, defaultShellExecutor2, terminalOpenTool2, terminalTools2, shellTool2, backgroundShellCreateTool2, WebProviderError2, WebRuntime2 = class {
|
|
395280
395424
|
searchProvider;
|
|
395281
395425
|
fetchProvider;
|
|
395282
395426
|
constructor(options = {}) {
|
|
@@ -395418,7 +395562,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395418
395562
|
body
|
|
395419
395563
|
};
|
|
395420
395564
|
}
|
|
395421
|
-
}, defaultWebRuntime2, webFetchTool2, webSearchTool2,
|
|
395565
|
+
}, defaultWebRuntime2, webFetchTool2, webSearchTool2, DEFAULT_JOB_LIST_LIMIT2 = 100, MAX_JOB_WAIT_IDS2 = 32, MAX_JOB_WAIT_MS2 = 60000, jobIdProperty2, jobListTool2, jobReadTool2, jobWaitTool2, jobSendTool2, jobCancelTool2, jobTools2, CompositeAgentJobHost2 = class {
|
|
395422
395566
|
sources;
|
|
395423
395567
|
ownerByJobKey = /* @__PURE__ */ new Map;
|
|
395424
395568
|
constructor(sources) {
|
|
@@ -395935,7 +396079,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395935
396079
|
throw new Error("Cannot verify registered worktrees");
|
|
395936
396080
|
return parseWorktreePorcelain(stdout, this.options.baseDir);
|
|
395937
396081
|
}
|
|
395938
|
-
}, nodeRunGit = (args, cwd) => new Promise((
|
|
396082
|
+
}, nodeRunGit = (args, cwd) => new Promise((resolve31) => {
|
|
395939
396083
|
const child = spawn42("git", args, {
|
|
395940
396084
|
cwd,
|
|
395941
396085
|
windowsHide: true,
|
|
@@ -395949,8 +396093,8 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
395949
396093
|
child.stderr?.on("data", (data) => {
|
|
395950
396094
|
stderr += data.toString();
|
|
395951
396095
|
});
|
|
395952
|
-
child.on("error", (error2) =>
|
|
395953
|
-
child.on("close", (code) =>
|
|
396096
|
+
child.on("error", (error2) => resolve31({ code: 127, stdout, stderr: stderr || error2.message }));
|
|
396097
|
+
child.on("close", (code) => resolve31({ code: code ?? 1, stdout, stderr }));
|
|
395954
396098
|
}), DEFAULT_AGENT_CHILD_BUDGET, AgentChildRegistry = class {
|
|
395955
396099
|
byId = /* @__PURE__ */ new Map;
|
|
395956
396100
|
bySessionId = /* @__PURE__ */ new Map;
|
|
@@ -396978,7 +397122,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
396978
397122
|
const reason = error2 instanceof Error ? error2.message : String(error2);
|
|
396979
397123
|
return { blocked: blockOnFailure, reason };
|
|
396980
397124
|
}
|
|
396981
|
-
return new Promise((
|
|
397125
|
+
return new Promise((resolve31) => {
|
|
396982
397126
|
let stdout = "";
|
|
396983
397127
|
let stderr = "";
|
|
396984
397128
|
proc.stdout?.on("data", (data) => {
|
|
@@ -396990,14 +397134,14 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
396990
397134
|
proc.on("close", (code) => {
|
|
396991
397135
|
const success = code === 0;
|
|
396992
397136
|
if (success || !blockOnFailure) {
|
|
396993
|
-
|
|
397137
|
+
resolve31({ blocked: false });
|
|
396994
397138
|
} else {
|
|
396995
397139
|
const reason = stdout.trim() || stderr.trim() || `command hook failed with exit code ${code}`;
|
|
396996
|
-
|
|
397140
|
+
resolve31({ blocked: true, reason });
|
|
396997
397141
|
}
|
|
396998
397142
|
});
|
|
396999
397143
|
proc.on("error", (err) => {
|
|
397000
|
-
|
|
397144
|
+
resolve31({ blocked: blockOnFailure, reason: err.message });
|
|
397001
397145
|
});
|
|
397002
397146
|
});
|
|
397003
397147
|
}
|
|
@@ -397156,7 +397300,8 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
397156
397300
|
id: this.plugin.manifest.id,
|
|
397157
397301
|
name: this.plugin.manifest.name,
|
|
397158
397302
|
version: this.plugin.manifest.version,
|
|
397159
|
-
root: this.plugin.root
|
|
397303
|
+
root: this.plugin.root,
|
|
397304
|
+
dataDir: join322(this.options.dataRoot ?? getPluginDataDir2(), this.plugin.manifest.id)
|
|
397160
397305
|
},
|
|
397161
397306
|
entries: entries.map((entry) => ({ entryPath: entry.entryPath, permissions: entry.effectivePermissions }))
|
|
397162
397307
|
};
|
|
@@ -397214,9 +397359,9 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
397214
397359
|
if (signal?.aborted)
|
|
397215
397360
|
return Promise.reject(new NativeToolHostError("tool_call_cancelled", "Native Tool call was cancelled"));
|
|
397216
397361
|
const id2 = randomUUID34();
|
|
397217
|
-
return new Promise((
|
|
397362
|
+
return new Promise((resolve31, reject) => {
|
|
397218
397363
|
const pending = {
|
|
397219
|
-
resolve:
|
|
397364
|
+
resolve: resolve31,
|
|
397220
397365
|
reject,
|
|
397221
397366
|
timer: setTimeout(() => {
|
|
397222
397367
|
const error2 = new NativeToolHostError(method === "callTool" ? "tool_call_timeout" : "tool_protocol_timeout", `${method} timed out after ${timeoutMs} ms`);
|
|
@@ -399069,7 +399214,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399069
399214
|
return;
|
|
399070
399215
|
}
|
|
399071
399216
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
|
|
399072
|
-
await new Promise((
|
|
399217
|
+
await new Promise((resolve31) => setTimeout(resolve31, pollInterval));
|
|
399073
399218
|
options?.signal?.throwIfAborted();
|
|
399074
399219
|
}
|
|
399075
399220
|
} catch (error2) {
|
|
@@ -399081,7 +399226,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399081
399226
|
}
|
|
399082
399227
|
request(request, resultSchema, options) {
|
|
399083
399228
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
399084
|
-
return new Promise((
|
|
399229
|
+
return new Promise((resolve31, reject) => {
|
|
399085
399230
|
const earlyReject = (error2) => {
|
|
399086
399231
|
reject(error2);
|
|
399087
399232
|
};
|
|
@@ -399159,7 +399304,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399159
399304
|
if (!parseResult.success) {
|
|
399160
399305
|
reject(parseResult.error);
|
|
399161
399306
|
} else {
|
|
399162
|
-
|
|
399307
|
+
resolve31(parseResult.data);
|
|
399163
399308
|
}
|
|
399164
399309
|
} catch (error2) {
|
|
399165
399310
|
reject(error2);
|
|
@@ -399350,12 +399495,12 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399350
399495
|
interval = task.pollInterval;
|
|
399351
399496
|
}
|
|
399352
399497
|
} catch {}
|
|
399353
|
-
return new Promise((
|
|
399498
|
+
return new Promise((resolve31, reject) => {
|
|
399354
399499
|
if (signal.aborted) {
|
|
399355
399500
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
399356
399501
|
return;
|
|
399357
399502
|
}
|
|
399358
|
-
const timeoutId = setTimeout(
|
|
399503
|
+
const timeoutId = setTimeout(resolve31, interval);
|
|
399359
399504
|
signal.addEventListener("abort", () => {
|
|
399360
399505
|
clearTimeout(timeoutId);
|
|
399361
399506
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -399914,7 +400059,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399914
400059
|
}
|
|
399915
400060
|
_startOrAuth() {
|
|
399916
400061
|
const fetchImpl = this?._eventSourceInit?.fetch ?? this._fetch ?? fetch;
|
|
399917
|
-
return new Promise((
|
|
400062
|
+
return new Promise((resolve31, reject) => {
|
|
399918
400063
|
this._eventSource = new EventSource(this._url.href, {
|
|
399919
400064
|
...this._eventSourceInit,
|
|
399920
400065
|
fetch: async (url2, init3) => {
|
|
@@ -399935,7 +400080,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399935
400080
|
this._abortController = new AbortController;
|
|
399936
400081
|
this._eventSource.onerror = (event) => {
|
|
399937
400082
|
if (event.code === 401 && this._authProvider) {
|
|
399938
|
-
this._authThenStart().then(
|
|
400083
|
+
this._authThenStart().then(resolve31, reject);
|
|
399939
400084
|
return;
|
|
399940
400085
|
}
|
|
399941
400086
|
const error2 = new SseError(event.code, event.message, event);
|
|
@@ -399956,7 +400101,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
399956
400101
|
this.close();
|
|
399957
400102
|
return;
|
|
399958
400103
|
}
|
|
399959
|
-
|
|
400104
|
+
resolve31();
|
|
399960
400105
|
});
|
|
399961
400106
|
this._eventSource.onmessage = (event) => {
|
|
399962
400107
|
const messageEvent = event;
|
|
@@ -400093,13 +400238,13 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400093
400238
|
detached: false
|
|
400094
400239
|
});
|
|
400095
400240
|
this.process = child;
|
|
400096
|
-
await new Promise((
|
|
400241
|
+
await new Promise((resolve31, reject) => {
|
|
400097
400242
|
let started = false;
|
|
400098
400243
|
const resolveStarted = () => {
|
|
400099
400244
|
if (started)
|
|
400100
400245
|
return;
|
|
400101
400246
|
started = true;
|
|
400102
|
-
|
|
400247
|
+
resolve31();
|
|
400103
400248
|
};
|
|
400104
400249
|
const rejectStarted = (error2) => {
|
|
400105
400250
|
if (started)
|
|
@@ -400143,8 +400288,8 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400143
400288
|
if (this.process) {
|
|
400144
400289
|
const processToClose = this.process;
|
|
400145
400290
|
this.process = undefined;
|
|
400146
|
-
const closePromise = new Promise((
|
|
400147
|
-
processToClose.once("close", () =>
|
|
400291
|
+
const closePromise = new Promise((resolve31) => {
|
|
400292
|
+
processToClose.once("close", () => resolve31());
|
|
400148
400293
|
});
|
|
400149
400294
|
try {
|
|
400150
400295
|
processToClose.stdin?.end();
|
|
@@ -400168,11 +400313,11 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400168
400313
|
if (!this.process?.stdin)
|
|
400169
400314
|
throw new Error("Not connected");
|
|
400170
400315
|
const json = serializeMessage(message);
|
|
400171
|
-
await new Promise((
|
|
400316
|
+
await new Promise((resolve31) => {
|
|
400172
400317
|
if (this.process.stdin.write(json))
|
|
400173
|
-
|
|
400318
|
+
resolve31();
|
|
400174
400319
|
else
|
|
400175
|
-
this.process.stdin.once("drain",
|
|
400320
|
+
this.process.stdin.once("drain", resolve31);
|
|
400176
400321
|
});
|
|
400177
400322
|
}
|
|
400178
400323
|
processReadBuffer() {
|
|
@@ -400850,6 +400995,9 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400850
400995
|
sessions = /* @__PURE__ */ new Map;
|
|
400851
400996
|
events = new TerminalEventBus;
|
|
400852
400997
|
async create(input) {
|
|
400998
|
+
if (input.command !== undefined && (!input.command.trim() || input.shellArgs !== undefined)) {
|
|
400999
|
+
throw new Error("Terminal command must be non-empty and cannot be combined with shellArgs.");
|
|
401000
|
+
}
|
|
400853
401001
|
const id2 = randomUUID39();
|
|
400854
401002
|
const resolvedCwd = await this.options.resolveCwd(input);
|
|
400855
401003
|
const resolvedInfo = this.options.resolveSessionInfo?.(input) ?? (input.scope.kind === "project" ? { projectId: input.scope.projectId } : { sessionId: input.scope.sessionId });
|
|
@@ -400860,7 +401008,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400860
401008
|
const target = input.runtime === "environment" ? await this.requireEnvironmentTarget(input, resolvedCwd, id2) : createHostTerminalTarget({
|
|
400861
401009
|
cwd: resolvedCwd,
|
|
400862
401010
|
shell: input.shell?.trim() || resolveDefaultShell().command,
|
|
400863
|
-
shellArgs: input.shellArgs,
|
|
401011
|
+
shellArgs: input.command ? terminalCommandArgs(input.shell?.trim() || resolveDefaultShell().command, input.command) : input.shellArgs,
|
|
400864
401012
|
env: input.env
|
|
400865
401013
|
});
|
|
400866
401014
|
try {
|
|
@@ -400905,6 +401053,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400905
401053
|
status: "running",
|
|
400906
401054
|
cwd: target.executionCwd,
|
|
400907
401055
|
shell: target.shell,
|
|
401056
|
+
...input.command ? { command: input.command } : {},
|
|
400908
401057
|
cols: clampDimension(input.cols),
|
|
400909
401058
|
rows: clampDimension(input.rows),
|
|
400910
401059
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -400975,7 +401124,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400975
401124
|
const current = this.requireSession(input.terminalId);
|
|
400976
401125
|
if (isTerminalStatus(current.info.status))
|
|
400977
401126
|
return this.waitResult(input, false);
|
|
400978
|
-
return await new Promise((
|
|
401127
|
+
return await new Promise((resolve31, reject) => {
|
|
400979
401128
|
let settled = false;
|
|
400980
401129
|
let timer;
|
|
400981
401130
|
let unsubscribe = () => {};
|
|
@@ -400990,7 +401139,7 @@ rm -- "$1"`, WslFileOperations2 = class {
|
|
|
400990
401139
|
if (error2)
|
|
400991
401140
|
reject(error2);
|
|
400992
401141
|
else
|
|
400993
|
-
|
|
401142
|
+
resolve31(this.waitResult(input, timedOut));
|
|
400994
401143
|
};
|
|
400995
401144
|
unsubscribe = this.subscribe((event) => {
|
|
400996
401145
|
if (event.terminalId !== input.terminalId)
|
|
@@ -401981,6 +402130,7 @@ Keep the summary concise and focused on information needed for continuing the ta
|
|
|
401981
402130
|
hookExecutor;
|
|
401982
402131
|
options;
|
|
401983
402132
|
messages = [];
|
|
402133
|
+
recentToolResults = /* @__PURE__ */ new Map;
|
|
401984
402134
|
compactService;
|
|
401985
402135
|
costTracker;
|
|
401986
402136
|
systemPrompt;
|
|
@@ -402328,7 +402478,7 @@ ${reminder}`;
|
|
|
402328
402478
|
isError: result2.isError,
|
|
402329
402479
|
...toolFeedbackFields2(result2)
|
|
402330
402480
|
});
|
|
402331
|
-
deliveredResults.push(result2);
|
|
402481
|
+
deliveredResults.push(rawResult.metadata?.toolResultReadable === true ? rawResult : result2);
|
|
402332
402482
|
}
|
|
402333
402483
|
for (const result2 of deliveredResults)
|
|
402334
402484
|
yield { type: "tool_use_end", toolUseId: result2.toolUseId, result: result2 };
|
|
@@ -402514,7 +402664,7 @@ ${reminder}`;
|
|
|
402514
402664
|
return this.costTracker.getTotal();
|
|
402515
402665
|
}
|
|
402516
402666
|
async executeTools(toolUses, signal, execution, requestConfiguration, failedToolCalls, toolRegistry = visibleToolRegistry2(this.toolRegistry, this.allowedTools), internalTools = /* @__PURE__ */ new Set) {
|
|
402517
|
-
|
|
402667
|
+
const outcome = await executeCheckedTools2({
|
|
402518
402668
|
toolUses,
|
|
402519
402669
|
toolRegistry,
|
|
402520
402670
|
messages: this.messages,
|
|
@@ -402528,6 +402678,8 @@ ${reminder}`;
|
|
|
402528
402678
|
createToolContext: (toolUse, toolAttemptId) => this.createToolContext(toolUse, toolAttemptId, toolRegistry, signal, execution, requestConfiguration),
|
|
402529
402679
|
isTrustedSummary: (toolUse, definition) => this.isTrustedSummary(toolUse, definition, toolRegistry, execution)
|
|
402530
402680
|
});
|
|
402681
|
+
outcome.results = this.retainToolResults(outcome.results, execution);
|
|
402682
|
+
return outcome;
|
|
402531
402683
|
}
|
|
402532
402684
|
async executeTool(toolUse, options) {
|
|
402533
402685
|
const { execution } = options;
|
|
@@ -402547,7 +402699,39 @@ ${reminder}`;
|
|
|
402547
402699
|
});
|
|
402548
402700
|
if (failure)
|
|
402549
402701
|
throw failure.error;
|
|
402550
|
-
return results[0];
|
|
402702
|
+
return this.retainToolResults(results, execution)[0];
|
|
402703
|
+
}
|
|
402704
|
+
retainToolResults(results, execution) {
|
|
402705
|
+
if (!execution)
|
|
402706
|
+
return results;
|
|
402707
|
+
for (const [id2, entry] of this.recentToolResults)
|
|
402708
|
+
if (entry.runId !== execution.scope.runId)
|
|
402709
|
+
this.recentToolResults.delete(id2);
|
|
402710
|
+
if (!execution.capabilityView?.pluginId)
|
|
402711
|
+
return results;
|
|
402712
|
+
return results.map((result2) => {
|
|
402713
|
+
this.recentToolResults.delete(result2.toolUseId);
|
|
402714
|
+
if (result2.executionState === "not_started")
|
|
402715
|
+
return result2;
|
|
402716
|
+
const actual = { toolUseId: result2.toolUseId, toolName: result2.toolName, content: result2.content, isError: result2.isError };
|
|
402717
|
+
let json;
|
|
402718
|
+
try {
|
|
402719
|
+
json = JSON.stringify(actual);
|
|
402720
|
+
} catch {
|
|
402721
|
+
return result2;
|
|
402722
|
+
}
|
|
402723
|
+
const bytes = Buffer.byteLength(json);
|
|
402724
|
+
if (bytes > 256000)
|
|
402725
|
+
return result2;
|
|
402726
|
+
this.recentToolResults.set(result2.toolUseId, { runId: execution.scope.runId, result: JSON.parse(json), bytes });
|
|
402727
|
+
let size = [...this.recentToolResults.values()].reduce((total, entry) => total + entry.bytes, 0);
|
|
402728
|
+
while (size > 1e6 || this.recentToolResults.size > 16) {
|
|
402729
|
+
const id2 = this.recentToolResults.keys().next().value;
|
|
402730
|
+
size -= this.recentToolResults.get(id2).bytes;
|
|
402731
|
+
this.recentToolResults.delete(id2);
|
|
402732
|
+
}
|
|
402733
|
+
return { ...result2, metadata: { ...result2.metadata, toolResultReadable: true } };
|
|
402734
|
+
});
|
|
402551
402735
|
}
|
|
402552
402736
|
createToolContext(toolUse, toolAttemptId, toolRegistry, signal, execution, requestConfiguration) {
|
|
402553
402737
|
return {
|
|
@@ -402557,6 +402741,12 @@ ${reminder}`;
|
|
|
402557
402741
|
shellOutputLogs: this.options.shellOutputLogs,
|
|
402558
402742
|
toolCallId: toolUse.id,
|
|
402559
402743
|
toolAttemptId,
|
|
402744
|
+
readToolResult: (id2) => {
|
|
402745
|
+
const entry = this.recentToolResults.get(id2);
|
|
402746
|
+
if (!execution || !entry || entry.runId !== execution.scope.runId || !execution.capabilityView?.tools.has(entry.result.toolName))
|
|
402747
|
+
return;
|
|
402748
|
+
return structuredClone(entry.result);
|
|
402749
|
+
},
|
|
402560
402750
|
runAbortSignal: signal,
|
|
402561
402751
|
settings: this.options.settings,
|
|
402562
402752
|
setPlanMode: this.options.setPlanMode,
|
|
@@ -411358,7 +411548,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
411358
411548
|
const current = this.load(runId);
|
|
411359
411549
|
if (!current || current.updatedAt > after)
|
|
411360
411550
|
return current;
|
|
411361
|
-
return await new Promise((
|
|
411551
|
+
return await new Promise((resolve31, reject) => {
|
|
411362
411552
|
const listeners = this.listeners.get(runId) ?? /* @__PURE__ */ new Set;
|
|
411363
411553
|
let timer;
|
|
411364
411554
|
const finish = () => {
|
|
@@ -411371,7 +411561,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
411371
411561
|
};
|
|
411372
411562
|
const changed = () => {
|
|
411373
411563
|
finish();
|
|
411374
|
-
|
|
411564
|
+
resolve31(this.load(runId));
|
|
411375
411565
|
};
|
|
411376
411566
|
const aborted2 = () => {
|
|
411377
411567
|
finish();
|
|
@@ -411391,7 +411581,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
411391
411581
|
}
|
|
411392
411582
|
timer = setTimeout(() => {
|
|
411393
411583
|
finish();
|
|
411394
|
-
|
|
411584
|
+
resolve31(this.load(runId));
|
|
411395
411585
|
}, Math.max(1, options.timeoutMs));
|
|
411396
411586
|
timer.unref?.();
|
|
411397
411587
|
});
|
|
@@ -412288,7 +412478,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
412288
412478
|
return new SQL2([new StringChunk2(str2)]);
|
|
412289
412479
|
}
|
|
412290
412480
|
sql2.raw = raw;
|
|
412291
|
-
function
|
|
412481
|
+
function join40(chunks, separator) {
|
|
412292
412482
|
const result2 = [];
|
|
412293
412483
|
for (const [i2, chunk] of chunks.entries()) {
|
|
412294
412484
|
if (i2 > 0 && separator !== undefined) {
|
|
@@ -412298,7 +412488,7 @@ Complete the user's request by providing accurate, documentation-based guidance.
|
|
|
412298
412488
|
}
|
|
412299
412489
|
return new SQL2(result2);
|
|
412300
412490
|
}
|
|
412301
|
-
sql2.join =
|
|
412491
|
+
sql2.join = join40;
|
|
412302
412492
|
function identifier(value) {
|
|
412303
412493
|
return new Name2(value);
|
|
412304
412494
|
}
|
|
@@ -414288,7 +414478,7 @@ params: ${params}`);
|
|
|
414288
414478
|
const tableName = getTableLikeName2(table);
|
|
414289
414479
|
for (const item of extractUsedTable2(table))
|
|
414290
414480
|
this.usedTables.add(item);
|
|
414291
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
414481
|
+
if (typeof tableName === "string" && this.config.joins?.some((join40) => join40.alias === tableName)) {
|
|
414292
414482
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
414293
414483
|
}
|
|
414294
414484
|
if (!this.isPartialSelect) {
|
|
@@ -414716,7 +414906,7 @@ params: ${params}`);
|
|
|
414716
414906
|
createJoin(joinType) {
|
|
414717
414907
|
return (table, on) => {
|
|
414718
414908
|
const tableName = getTableLikeName2(table);
|
|
414719
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
414909
|
+
if (typeof tableName === "string" && this.config.joins.some((join40) => join40.alias === tableName)) {
|
|
414720
414910
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
414721
414911
|
}
|
|
414722
414912
|
if (typeof on === "function") {
|
|
@@ -416834,8 +417024,8 @@ params: ${params}`);
|
|
|
416834
417024
|
return this.run("exclusive", operation);
|
|
416835
417025
|
}
|
|
416836
417026
|
run(kind3, operation) {
|
|
416837
|
-
return new Promise((
|
|
416838
|
-
this.waiting.push({ kind: kind3, start:
|
|
417027
|
+
return new Promise((resolve31) => {
|
|
417028
|
+
this.waiting.push({ kind: kind3, start: resolve31 });
|
|
416839
417029
|
this.drain();
|
|
416840
417030
|
}).then(async () => {
|
|
416841
417031
|
try {
|
|
@@ -417134,7 +417324,7 @@ params: ${params}`);
|
|
|
417134
417324
|
if (this.waiting.length >= this.queueCapacity) {
|
|
417135
417325
|
return Promise.reject(new LocalOcrError2("ocr_queue_full", "The local OCR queue is full", true));
|
|
417136
417326
|
}
|
|
417137
|
-
return new Promise((
|
|
417327
|
+
return new Promise((resolve31, reject) => {
|
|
417138
417328
|
let settled = false;
|
|
417139
417329
|
const abort = () => {
|
|
417140
417330
|
const index2 = this.waiting.indexOf(item);
|
|
@@ -417145,7 +417335,7 @@ params: ${params}`);
|
|
|
417145
417335
|
settled = true;
|
|
417146
417336
|
};
|
|
417147
417337
|
const cleanup = () => options.signal?.removeEventListener("abort", abort);
|
|
417148
|
-
const item = { bytes, options, resolve:
|
|
417338
|
+
const item = { bytes, options, resolve: resolve31, reject, cleanup };
|
|
417149
417339
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
417150
417340
|
this.waiting.push(item);
|
|
417151
417341
|
this.pump();
|
|
@@ -422198,7 +422388,7 @@ params: ${params}`);
|
|
|
422198
422388
|
signal: this.config.signal,
|
|
422199
422389
|
stdio: ["ignore", "pipe", "pipe"]
|
|
422200
422390
|
});
|
|
422201
|
-
return new Promise((
|
|
422391
|
+
return new Promise((resolve31, reject) => {
|
|
422202
422392
|
let stdout = "";
|
|
422203
422393
|
let stderr = "";
|
|
422204
422394
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -422210,7 +422400,7 @@ params: ${params}`);
|
|
|
422210
422400
|
child.once("error", reject);
|
|
422211
422401
|
child.once("close", (code) => {
|
|
422212
422402
|
if (code === 0)
|
|
422213
|
-
|
|
422403
|
+
resolve31(stdout);
|
|
422214
422404
|
else
|
|
422215
422405
|
reject(new Error(stderr.trim() || `rg exited with code ${code ?? 1}`));
|
|
422216
422406
|
});
|
|
@@ -422348,7 +422538,7 @@ params: ${params}`);
|
|
|
422348
422538
|
const execution = this.requireExecution(executionId);
|
|
422349
422539
|
if (isTerminal3(execution.status))
|
|
422350
422540
|
return Promise.resolve(this.result(execution));
|
|
422351
|
-
return new Promise((
|
|
422541
|
+
return new Promise((resolve31) => {
|
|
422352
422542
|
let settled = false;
|
|
422353
422543
|
let timer;
|
|
422354
422544
|
let unregister = () => {};
|
|
@@ -422359,7 +422549,7 @@ params: ${params}`);
|
|
|
422359
422549
|
if (timer)
|
|
422360
422550
|
clearTimeout(timer);
|
|
422361
422551
|
unregister();
|
|
422362
|
-
|
|
422552
|
+
resolve31(result2);
|
|
422363
422553
|
};
|
|
422364
422554
|
unregister = this.registerExecutionListener((candidate, event) => {
|
|
422365
422555
|
if (candidate.id === executionId && event === "completed")
|
|
@@ -422664,7 +422854,7 @@ params: ${params}`);
|
|
|
422664
422854
|
exitCode: task.exitCode
|
|
422665
422855
|
}));
|
|
422666
422856
|
}
|
|
422667
|
-
return new Promise((
|
|
422857
|
+
return new Promise((resolve31, reject) => {
|
|
422668
422858
|
let settled = false;
|
|
422669
422859
|
let timer;
|
|
422670
422860
|
let unregister = () => {};
|
|
@@ -422681,7 +422871,7 @@ params: ${params}`);
|
|
|
422681
422871
|
settled = true;
|
|
422682
422872
|
cleanup();
|
|
422683
422873
|
try {
|
|
422684
|
-
|
|
422874
|
+
resolve31({ status, output: this.readOutput(executionId), exitCode, ...timedOut ? { timedOut: true } : {} });
|
|
422685
422875
|
} catch (error2) {
|
|
422686
422876
|
reject(error2);
|
|
422687
422877
|
}
|
|
@@ -425530,7 +425720,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
425530
425720
|
let accum = [];
|
|
425531
425721
|
let accumBytes = 0;
|
|
425532
425722
|
let abort = false;
|
|
425533
|
-
return new Body.Promise(function(
|
|
425723
|
+
return new Body.Promise(function(resolve31, reject) {
|
|
425534
425724
|
let resTimeout;
|
|
425535
425725
|
if (_this4.timeout) {
|
|
425536
425726
|
resTimeout = setTimeout(function() {
|
|
@@ -425564,7 +425754,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
425564
425754
|
}
|
|
425565
425755
|
clearTimeout(resTimeout);
|
|
425566
425756
|
try {
|
|
425567
|
-
|
|
425757
|
+
resolve31(Buffer.concat(accum, accumBytes));
|
|
425568
425758
|
} catch (err) {
|
|
425569
425759
|
reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
|
|
425570
425760
|
}
|
|
@@ -426160,7 +426350,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426160
426350
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
426161
426351
|
}
|
|
426162
426352
|
Body.Promise = fetch4.Promise;
|
|
426163
|
-
return new fetch4.Promise(function(
|
|
426353
|
+
return new fetch4.Promise(function(resolve31, reject) {
|
|
426164
426354
|
const request = new Request6(url2, opts);
|
|
426165
426355
|
const options = getNodeRequestOptions(request);
|
|
426166
426356
|
const send = (options.protocol === "https:" ? https : http).request;
|
|
@@ -426295,7 +426485,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426295
426485
|
requestOpts.body = undefined;
|
|
426296
426486
|
requestOpts.headers.delete("content-length");
|
|
426297
426487
|
}
|
|
426298
|
-
|
|
426488
|
+
resolve31(fetch4(new Request6(locationURL, requestOpts)));
|
|
426299
426489
|
finalize2();
|
|
426300
426490
|
return;
|
|
426301
426491
|
}
|
|
@@ -426317,7 +426507,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426317
426507
|
const codings = headers.get("Content-Encoding");
|
|
426318
426508
|
if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
|
|
426319
426509
|
response = new Response6(body, response_options);
|
|
426320
|
-
|
|
426510
|
+
resolve31(response);
|
|
426321
426511
|
return;
|
|
426322
426512
|
}
|
|
426323
426513
|
const zlibOptions = {
|
|
@@ -426327,7 +426517,7 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426327
426517
|
if (codings == "gzip" || codings == "x-gzip") {
|
|
426328
426518
|
body = body.pipe(zlib.createGunzip(zlibOptions));
|
|
426329
426519
|
response = new Response6(body, response_options);
|
|
426330
|
-
|
|
426520
|
+
resolve31(response);
|
|
426331
426521
|
return;
|
|
426332
426522
|
}
|
|
426333
426523
|
if (codings == "deflate" || codings == "x-deflate") {
|
|
@@ -426339,12 +426529,12 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426339
426529
|
body = body.pipe(zlib.createInflateRaw());
|
|
426340
426530
|
}
|
|
426341
426531
|
response = new Response6(body, response_options);
|
|
426342
|
-
|
|
426532
|
+
resolve31(response);
|
|
426343
426533
|
});
|
|
426344
426534
|
raw.on("end", function() {
|
|
426345
426535
|
if (!response) {
|
|
426346
426536
|
response = new Response6(body, response_options);
|
|
426347
|
-
|
|
426537
|
+
resolve31(response);
|
|
426348
426538
|
}
|
|
426349
426539
|
});
|
|
426350
426540
|
return;
|
|
@@ -426352,11 +426542,11 @@ over duplicating them. Do not save secrets. If nothing is worth saving, return
|
|
|
426352
426542
|
if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
|
|
426353
426543
|
body = body.pipe(zlib.createBrotliDecompress());
|
|
426354
426544
|
response = new Response6(body, response_options);
|
|
426355
|
-
|
|
426545
|
+
resolve31(response);
|
|
426356
426546
|
return;
|
|
426357
426547
|
}
|
|
426358
426548
|
response = new Response6(body, response_options);
|
|
426359
|
-
|
|
426549
|
+
resolve31(response);
|
|
426360
426550
|
});
|
|
426361
426551
|
writeToStream(req, request);
|
|
426362
426552
|
});
|
|
@@ -429062,7 +429252,7 @@ the \`Skill\` tool. Newly written skills are picked up on the next \`Skill\` /
|
|
|
429062
429252
|
init_personal_prompt_files2();
|
|
429063
429253
|
init_ledger_segments2();
|
|
429064
429254
|
DEFAULT_IDENTITY2 = "You are Vykor, an open-source AI coding assistant CLI. You are an interactive agent that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
|
|
429065
|
-
LONG_RUNNING_SHELL_GUIDANCE2 = " - Use Shell only for short-lived commands.
|
|
429255
|
+
LONG_RUNNING_SHELL_GUIDANCE2 = " - Use Shell only for short-lived commands. Start persistent services such as dev servers and watchers with TerminalOpen(command, name) when available so the user can see output and stop them in the terminal. Run the service in the foreground of that terminal; do not detach it with nohup, shell backgrounding, or Start-Process. Follow the returned jobId with JobRead or JobWait to verify readiness, JobSend for input, and JobCancel to stop it. For finite long-running work such as installs, builds, and migrations, use BackgroundShellCreate and follow progress with JobWait or JobRead. When terminals are unavailable, use BackgroundShellCreate for services. At handoff, mention any services left running and their terminal entry; do not stop them unless requested.";
|
|
429066
429256
|
INVARIANT_GUIDANCE2 = `Use reliable sources for URLs and references. Do not invent links or citations.
|
|
429067
429257
|
|
|
429068
429258
|
# System
|
|
@@ -431965,7 +432155,7 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
431965
432155
|
const schOrFunc = root.refs[ref];
|
|
431966
432156
|
if (schOrFunc)
|
|
431967
432157
|
return schOrFunc;
|
|
431968
|
-
let _sch =
|
|
432158
|
+
let _sch = resolve31.call(this, root, ref);
|
|
431969
432159
|
if (_sch === undefined) {
|
|
431970
432160
|
const schema = (_a5 = root.localRefs) === null || _a5 === undefined ? undefined : _a5[ref];
|
|
431971
432161
|
const { schemaId } = this.opts;
|
|
@@ -431992,7 +432182,7 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
431992
432182
|
function sameSchemaEnv(s1, s2) {
|
|
431993
432183
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
431994
432184
|
}
|
|
431995
|
-
function
|
|
432185
|
+
function resolve31(root, ref) {
|
|
431996
432186
|
let sch;
|
|
431997
432187
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
431998
432188
|
ref = sch;
|
|
@@ -432522,7 +432712,7 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
432522
432712
|
}
|
|
432523
432713
|
return uri;
|
|
432524
432714
|
}
|
|
432525
|
-
function
|
|
432715
|
+
function resolve31(baseURI, relativeURI, options) {
|
|
432526
432716
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
432527
432717
|
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
432528
432718
|
schemelessOptions.skipEscape = true;
|
|
@@ -432750,7 +432940,7 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
432750
432940
|
var fastUri = {
|
|
432751
432941
|
SCHEMES,
|
|
432752
432942
|
normalize: normalize4,
|
|
432753
|
-
resolve:
|
|
432943
|
+
resolve: resolve31,
|
|
432754
432944
|
resolveComponent,
|
|
432755
432945
|
equal,
|
|
432756
432946
|
serialize,
|
|
@@ -435638,12 +435828,12 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
435638
435828
|
if (typeof Promise !== "function") {
|
|
435639
435829
|
throw new TypeError("callback not provided");
|
|
435640
435830
|
}
|
|
435641
|
-
return new Promise(function(
|
|
435831
|
+
return new Promise(function(resolve31, reject) {
|
|
435642
435832
|
isexe(path, options || {}, function(er2, is2) {
|
|
435643
435833
|
if (er2) {
|
|
435644
435834
|
reject(er2);
|
|
435645
435835
|
} else {
|
|
435646
|
-
|
|
435836
|
+
resolve31(is2);
|
|
435647
435837
|
}
|
|
435648
435838
|
});
|
|
435649
435839
|
});
|
|
@@ -435705,27 +435895,27 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
435705
435895
|
opt = {};
|
|
435706
435896
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
435707
435897
|
const found = [];
|
|
435708
|
-
const step = (i2) => new Promise((
|
|
435898
|
+
const step = (i2) => new Promise((resolve31, reject) => {
|
|
435709
435899
|
if (i2 === pathEnv.length)
|
|
435710
|
-
return opt.all && found.length ?
|
|
435900
|
+
return opt.all && found.length ? resolve31(found) : reject(getNotFoundError(cmd));
|
|
435711
435901
|
const ppRaw = pathEnv[i2];
|
|
435712
435902
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
435713
435903
|
const pCmd = path.join(pathPart, cmd);
|
|
435714
435904
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
435715
|
-
|
|
435905
|
+
resolve31(subStep(p2, i2, 0));
|
|
435716
435906
|
});
|
|
435717
|
-
const subStep = (p2, i2, ii) => new Promise((
|
|
435907
|
+
const subStep = (p2, i2, ii) => new Promise((resolve31, reject) => {
|
|
435718
435908
|
if (ii === pathExt.length)
|
|
435719
|
-
return
|
|
435909
|
+
return resolve31(step(i2 + 1));
|
|
435720
435910
|
const ext = pathExt[ii];
|
|
435721
435911
|
isexe(p2 + ext, { pathExt: pathExtExe }, (er2, is2) => {
|
|
435722
435912
|
if (!er2 && is2) {
|
|
435723
435913
|
if (opt.all)
|
|
435724
435914
|
found.push(p2 + ext);
|
|
435725
435915
|
else
|
|
435726
|
-
return
|
|
435916
|
+
return resolve31(p2 + ext);
|
|
435727
435917
|
}
|
|
435728
|
-
return
|
|
435918
|
+
return resolve31(subStep(p2, i2, ii + 1));
|
|
435729
435919
|
});
|
|
435730
435920
|
});
|
|
435731
435921
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -436707,8 +436897,8 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
436707
436897
|
init();
|
|
436708
436898
|
APIPromise = class _APIPromise extends Promise {
|
|
436709
436899
|
constructor(responsePromise, parseResponse2 = defaultParseResponse) {
|
|
436710
|
-
super((
|
|
436711
|
-
|
|
436900
|
+
super((resolve31) => {
|
|
436901
|
+
resolve31(null);
|
|
436712
436902
|
});
|
|
436713
436903
|
this.responsePromise = responsePromise;
|
|
436714
436904
|
this.parseResponse = parseResponse2;
|
|
@@ -437035,12 +437225,12 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
437035
437225
|
}
|
|
437036
437226
|
return this._emit("error", new AnthropicError(String(error2)));
|
|
437037
437227
|
});
|
|
437038
|
-
__classPrivateFieldSet7(this, _BetaMessageStream_connectedPromise, new Promise((
|
|
437039
|
-
__classPrivateFieldSet7(this, _BetaMessageStream_resolveConnectedPromise,
|
|
437228
|
+
__classPrivateFieldSet7(this, _BetaMessageStream_connectedPromise, new Promise((resolve31, reject) => {
|
|
437229
|
+
__classPrivateFieldSet7(this, _BetaMessageStream_resolveConnectedPromise, resolve31, "f");
|
|
437040
437230
|
__classPrivateFieldSet7(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
|
|
437041
437231
|
}), "f");
|
|
437042
|
-
__classPrivateFieldSet7(this, _BetaMessageStream_endPromise, new Promise((
|
|
437043
|
-
__classPrivateFieldSet7(this, _BetaMessageStream_resolveEndPromise,
|
|
437232
|
+
__classPrivateFieldSet7(this, _BetaMessageStream_endPromise, new Promise((resolve31, reject) => {
|
|
437233
|
+
__classPrivateFieldSet7(this, _BetaMessageStream_resolveEndPromise, resolve31, "f");
|
|
437044
437234
|
__classPrivateFieldSet7(this, _BetaMessageStream_rejectEndPromise, reject, "f");
|
|
437045
437235
|
}), "f");
|
|
437046
437236
|
__classPrivateFieldGet8(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -437149,11 +437339,11 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
437149
437339
|
return this;
|
|
437150
437340
|
}
|
|
437151
437341
|
emitted(event) {
|
|
437152
|
-
return new Promise((
|
|
437342
|
+
return new Promise((resolve31, reject) => {
|
|
437153
437343
|
__classPrivateFieldSet7(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
|
|
437154
437344
|
if (event !== "error")
|
|
437155
437345
|
this.once("error", reject);
|
|
437156
|
-
this.once(event,
|
|
437346
|
+
this.once(event, resolve31);
|
|
437157
437347
|
});
|
|
437158
437348
|
}
|
|
437159
437349
|
async done() {
|
|
@@ -437428,7 +437618,7 @@ ${INVARIANT_GUIDANCE2}`;
|
|
|
437428
437618
|
if (done) {
|
|
437429
437619
|
return { value: undefined, done: true };
|
|
437430
437620
|
}
|
|
437431
|
-
return new Promise((
|
|
437621
|
+
return new Promise((resolve31, reject) => readQueue.push({ resolve: resolve31, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
437432
437622
|
}
|
|
437433
437623
|
const chunk = pushQueue.shift();
|
|
437434
437624
|
return { value: chunk, done: false };
|
|
@@ -437589,12 +437779,12 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
437589
437779
|
}
|
|
437590
437780
|
return this._emit("error", new AnthropicError(String(error2)));
|
|
437591
437781
|
});
|
|
437592
|
-
__classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((
|
|
437593
|
-
__classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise,
|
|
437782
|
+
__classPrivateFieldSet8(this, _MessageStream_connectedPromise, new Promise((resolve31, reject) => {
|
|
437783
|
+
__classPrivateFieldSet8(this, _MessageStream_resolveConnectedPromise, resolve31, "f");
|
|
437594
437784
|
__classPrivateFieldSet8(this, _MessageStream_rejectConnectedPromise, reject, "f");
|
|
437595
437785
|
}), "f");
|
|
437596
|
-
__classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((
|
|
437597
|
-
__classPrivateFieldSet8(this, _MessageStream_resolveEndPromise,
|
|
437786
|
+
__classPrivateFieldSet8(this, _MessageStream_endPromise, new Promise((resolve31, reject) => {
|
|
437787
|
+
__classPrivateFieldSet8(this, _MessageStream_resolveEndPromise, resolve31, "f");
|
|
437598
437788
|
__classPrivateFieldSet8(this, _MessageStream_rejectEndPromise, reject, "f");
|
|
437599
437789
|
}), "f");
|
|
437600
437790
|
__classPrivateFieldGet9(this, _MessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -437703,11 +437893,11 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
437703
437893
|
return this;
|
|
437704
437894
|
}
|
|
437705
437895
|
emitted(event) {
|
|
437706
|
-
return new Promise((
|
|
437896
|
+
return new Promise((resolve31, reject) => {
|
|
437707
437897
|
__classPrivateFieldSet8(this, _MessageStream_catchingPromiseCreated, true, "f");
|
|
437708
437898
|
if (event !== "error")
|
|
437709
437899
|
this.once("error", reject);
|
|
437710
|
-
this.once(event,
|
|
437900
|
+
this.once(event, resolve31);
|
|
437711
437901
|
});
|
|
437712
437902
|
}
|
|
437713
437903
|
async done() {
|
|
@@ -437982,7 +438172,7 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
437982
438172
|
if (done) {
|
|
437983
438173
|
return { value: undefined, done: true };
|
|
437984
438174
|
}
|
|
437985
|
-
return new Promise((
|
|
438175
|
+
return new Promise((resolve31, reject) => readQueue.push({ resolve: resolve31, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
437986
438176
|
}
|
|
437987
438177
|
const chunk = pushQueue.shift();
|
|
437988
438178
|
return { value: chunk, done: false };
|
|
@@ -438817,8 +439007,8 @@ Assistant:`;
|
|
|
438817
439007
|
init2();
|
|
438818
439008
|
APIPromise2 = class _APIPromise extends Promise {
|
|
438819
439009
|
constructor(responsePromise, parseResponse2 = defaultParseResponse2) {
|
|
438820
|
-
super((
|
|
438821
|
-
|
|
439010
|
+
super((resolve31) => {
|
|
439011
|
+
resolve31(null);
|
|
438822
439012
|
});
|
|
438823
439013
|
this.responsePromise = responsePromise;
|
|
438824
439014
|
this.parseResponse = parseResponse2;
|
|
@@ -439158,7 +439348,7 @@ Assistant:`;
|
|
|
439158
439348
|
if (done) {
|
|
439159
439349
|
return { value: undefined, done: true };
|
|
439160
439350
|
}
|
|
439161
|
-
return new Promise((
|
|
439351
|
+
return new Promise((resolve31, reject) => readQueue.push({ resolve: resolve31, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
439162
439352
|
}
|
|
439163
439353
|
const chunk = pushQueue.shift();
|
|
439164
439354
|
return { value: chunk, done: false };
|
|
@@ -440369,7 +440559,7 @@ Assistant:`;
|
|
|
440369
440559
|
if (done) {
|
|
440370
440560
|
return { value: undefined, done: true };
|
|
440371
440561
|
}
|
|
440372
|
-
return new Promise((
|
|
440562
|
+
return new Promise((resolve31, reject) => readQueue.push({ resolve: resolve31, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
440373
440563
|
}
|
|
440374
440564
|
const chunk = pushQueue.shift();
|
|
440375
440565
|
return { value: chunk, done: false };
|
|
@@ -441307,7 +441497,7 @@ Assistant:`;
|
|
|
441307
441497
|
if (done) {
|
|
441308
441498
|
return { value: undefined, done: true };
|
|
441309
441499
|
}
|
|
441310
|
-
return new Promise((
|
|
441500
|
+
return new Promise((resolve31, reject) => readQueue.push({ resolve: resolve31, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: undefined, done: true });
|
|
441311
441501
|
}
|
|
441312
441502
|
const event = pushQueue.shift();
|
|
441313
441503
|
return { value: event, done: false };
|
|
@@ -442879,7 +443069,7 @@ ${trailer}` : trailer }],
|
|
|
442879
443069
|
},
|
|
442880
443070
|
async execute(input) {
|
|
442881
443071
|
const seconds = Math.min(Math.max(input.seconds ?? 1, 0), 30);
|
|
442882
|
-
await new Promise((
|
|
443072
|
+
await new Promise((resolve31) => setTimeout(resolve31, seconds * 1000));
|
|
442883
443073
|
return { content: [{ type: "text", text: `Slept for ${seconds} seconds` }] };
|
|
442884
443074
|
}
|
|
442885
443075
|
};
|
|
@@ -442897,10 +443087,10 @@ ${trailer}` : trailer }],
|
|
|
442897
443087
|
},
|
|
442898
443088
|
async execute(input, context) {
|
|
442899
443089
|
const { readFile: readFile18, writeFile: writeFile8 } = await import("node:fs/promises");
|
|
442900
|
-
const { join:
|
|
443090
|
+
const { join: join40 } = await import("node:path");
|
|
442901
443091
|
const item = input.item;
|
|
442902
443092
|
const checked = input.checked ?? false;
|
|
442903
|
-
const filePath =
|
|
443093
|
+
const filePath = join40(context.cwd, input.path ?? "TODO.md");
|
|
442904
443094
|
const prefix = checked ? "- [x]" : "- [ ]";
|
|
442905
443095
|
let existing = `# TODO
|
|
442906
443096
|
`;
|
|
@@ -442984,7 +443174,7 @@ ${prefix} ${item}
|
|
|
442984
443174
|
async execute(input, context) {
|
|
442985
443175
|
const { exec } = await import("node:child_process");
|
|
442986
443176
|
const { promisify: promisify3 } = await import("node:util");
|
|
442987
|
-
const { resolve:
|
|
443177
|
+
const { resolve: resolve31, join: join40 } = await import("node:path");
|
|
442988
443178
|
const execAsync = promisify3(exec);
|
|
442989
443179
|
const branch = input.branch;
|
|
442990
443180
|
const createBranch = input.createBranch ?? true;
|
|
@@ -442997,7 +443187,7 @@ ${prefix} ${item}
|
|
|
442997
443187
|
return { content: [{ type: "text", text: "enter_worktree requires a git repository" }], isError: true };
|
|
442998
443188
|
}
|
|
442999
443189
|
const slug = branch.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-|-$/g, "") || "worktree";
|
|
443000
|
-
const worktreePath = input.path ?
|
|
443190
|
+
const worktreePath = input.path ? resolve31(context.cwd, input.path) : resolve31(topLevel, PROJECT_CONFIG_DIR_NAME2, "worktrees", slug);
|
|
443001
443191
|
const cmd = createBranch ? `git worktree add -b "${branch}" "${worktreePath}" ${baseRef}` : `git worktree add "${worktreePath}" "${branch}"`;
|
|
443002
443192
|
try {
|
|
443003
443193
|
const { stdout, stderr } = await execAsync(cmd, { cwd: topLevel, windowsHide: true });
|
|
@@ -443021,11 +443211,11 @@ Path: ${worktreePath}` }] };
|
|
|
443021
443211
|
async execute(input, context) {
|
|
443022
443212
|
const { exec } = await import("node:child_process");
|
|
443023
443213
|
const { promisify: promisify3 } = await import("node:util");
|
|
443024
|
-
const { resolve:
|
|
443214
|
+
const { resolve: resolve31 } = await import("node:path");
|
|
443025
443215
|
const execAsync = promisify3(exec);
|
|
443026
443216
|
let path = input.path;
|
|
443027
|
-
if (!
|
|
443028
|
-
path =
|
|
443217
|
+
if (!resolve31(path).startsWith("/"))
|
|
443218
|
+
path = resolve31(context.cwd, path);
|
|
443029
443219
|
try {
|
|
443030
443220
|
const { stdout, stderr } = await execAsync(`git worktree remove --force "${path}"`, { cwd: context.cwd, windowsHide: true });
|
|
443031
443221
|
const output = (stdout || stderr).trim() || `Removed worktree ${path}`;
|
|
@@ -443194,8 +443384,8 @@ Path: ${worktreePath}` }] };
|
|
|
443194
443384
|
},
|
|
443195
443385
|
async execute(input, context) {
|
|
443196
443386
|
const { readFile: readFile18, writeFile: writeFile8, mkdir: mkdir12 } = await import("node:fs/promises");
|
|
443197
|
-
const { resolve:
|
|
443198
|
-
const filePath =
|
|
443387
|
+
const { resolve: resolve31, dirname: dirname17 } = await import("node:path");
|
|
443388
|
+
const filePath = resolve31(context.cwd, input.path);
|
|
443199
443389
|
const cellIndex = input.cellIndex;
|
|
443200
443390
|
const newSource = input.newSource;
|
|
443201
443391
|
const cellType = input.cellType ?? "code";
|
|
@@ -443616,8 +443806,8 @@ Path: ${worktreePath}` }] };
|
|
|
443616
443806
|
const filePath = input.filePath;
|
|
443617
443807
|
if (!filePath)
|
|
443618
443808
|
return { content: [{ type: "text", text: `${operation} requires filePath` }], isError: true };
|
|
443619
|
-
const { resolve:
|
|
443620
|
-
const fullPath =
|
|
443809
|
+
const { resolve: resolve31 } = await import("node:path");
|
|
443810
|
+
const fullPath = resolve31(context.cwd, filePath);
|
|
443621
443811
|
if (operation === "document_symbol") {
|
|
443622
443812
|
const results = await client.documentSymbols(fullPath);
|
|
443623
443813
|
if (!results.length)
|
|
@@ -443659,36 +443849,13 @@ Path: ${worktreePath}` }] };
|
|
|
443659
443849
|
init_src32();
|
|
443660
443850
|
init_src32();
|
|
443661
443851
|
defaultShellExecutor2 = new DefaultShellExecutor2;
|
|
443662
|
-
shellTool2 = createShellTool2();
|
|
443663
|
-
backgroundShellCreateTool2 = createBackgroundShellTool2();
|
|
443664
|
-
WebProviderError2 = class extends Error {
|
|
443665
|
-
code;
|
|
443666
|
-
provider;
|
|
443667
|
-
status;
|
|
443668
|
-
statusText;
|
|
443669
|
-
cause;
|
|
443670
|
-
constructor(code, message, options = {}) {
|
|
443671
|
-
super(message);
|
|
443672
|
-
this.name = "WebProviderError";
|
|
443673
|
-
this.code = code;
|
|
443674
|
-
this.provider = options.provider;
|
|
443675
|
-
this.status = options.status;
|
|
443676
|
-
this.statusText = options.statusText;
|
|
443677
|
-
this.cause = options.cause;
|
|
443678
|
-
}
|
|
443679
|
-
};
|
|
443680
|
-
defaultWebRuntime2 = new WebRuntime2({
|
|
443681
|
-
searchProvider: new DuckDuckGoSearchProvider2,
|
|
443682
|
-
fetchProvider: new HttpFetchProvider2
|
|
443683
|
-
});
|
|
443684
|
-
webFetchTool2 = createWebFetchTool2();
|
|
443685
|
-
webSearchTool2 = createWebSearchTool2();
|
|
443686
443852
|
terminalOpenTool2 = {
|
|
443687
443853
|
name: "TerminalOpen",
|
|
443688
|
-
description: "Open a
|
|
443854
|
+
description: "Open a visible terminal in this session's working directory. For dev servers and watchers, provide command to run the service directly: its exit then updates terminal status. Do not daemonize the command or detach its child process. Use JobRead/JobWait to inspect output, JobSend for input, and JobCancel to stop it, with the returned jobId. Without command, opens an interactive shell. Prefer Shell for short commands and BackgroundShellCreate for finite builds or installs.",
|
|
443689
443855
|
inputSchema: {
|
|
443690
443856
|
type: "object",
|
|
443691
443857
|
properties: {
|
|
443858
|
+
command: { type: "string", description: "Service command to run in the session directory. For a subdirectory, include the shell-appropriate cd in the command. Omit to open an interactive shell." },
|
|
443692
443859
|
name: {
|
|
443693
443860
|
type: "string",
|
|
443694
443861
|
description: "Short label shown in the terminal panel"
|
|
@@ -443707,25 +443874,56 @@ Path: ${worktreePath}` }] };
|
|
|
443707
443874
|
}
|
|
443708
443875
|
},
|
|
443709
443876
|
async execute(input, context) {
|
|
443877
|
+
if (context.abortSignal?.aborted)
|
|
443878
|
+
return { ...failed22("Terminal interrupted before starting."), failureKind: "interrupted", executionState: "not_started" };
|
|
443879
|
+
if (input.command !== undefined && (typeof input.command !== "string" || !input.command.trim())) {
|
|
443880
|
+
return { ...failed22("command must be a non-empty string."), failureKind: "invalid_input", executionState: "not_started" };
|
|
443881
|
+
}
|
|
443710
443882
|
const resolved = resolveHost3(context);
|
|
443711
443883
|
if ("content" in resolved)
|
|
443712
443884
|
return resolved;
|
|
443885
|
+
const command = optionalString4(input.command);
|
|
443713
443886
|
try {
|
|
443714
443887
|
const terminal = await resolved.host.open({
|
|
443715
443888
|
sessionId: resolved.sessionId,
|
|
443716
443889
|
cwd: context.cwd,
|
|
443717
|
-
name: optionalString4(input.name),
|
|
443890
|
+
name: optionalString4(input.name) ?? (command ? command.slice(0, 80) : undefined),
|
|
443718
443891
|
cols: optionalNumber5(input.cols),
|
|
443719
443892
|
rows: optionalNumber5(input.rows),
|
|
443720
|
-
shell: optionalString4(input.shell)
|
|
443893
|
+
shell: optionalString4(input.shell),
|
|
443894
|
+
...command ? { command } : {}
|
|
443721
443895
|
});
|
|
443722
|
-
return terminalResult2("open", { terminal });
|
|
443896
|
+
return { ...terminalResult2("open", { terminal, jobId: terminal.id }), executionState: "completed", compactSummary: `TerminalOpen completed: jobId=${terminal.id}` };
|
|
443723
443897
|
} catch (error2) {
|
|
443724
|
-
return
|
|
443898
|
+
return { ...failed22(error2), failureKind: "unknown_outcome", executionState: "unknown" };
|
|
443725
443899
|
}
|
|
443726
443900
|
}
|
|
443727
443901
|
};
|
|
443728
443902
|
terminalTools2 = [terminalOpenTool2];
|
|
443903
|
+
shellTool2 = createShellTool2();
|
|
443904
|
+
backgroundShellCreateTool2 = createBackgroundShellTool2();
|
|
443905
|
+
WebProviderError2 = class extends Error {
|
|
443906
|
+
code;
|
|
443907
|
+
provider;
|
|
443908
|
+
status;
|
|
443909
|
+
statusText;
|
|
443910
|
+
cause;
|
|
443911
|
+
constructor(code, message, options = {}) {
|
|
443912
|
+
super(message);
|
|
443913
|
+
this.name = "WebProviderError";
|
|
443914
|
+
this.code = code;
|
|
443915
|
+
this.provider = options.provider;
|
|
443916
|
+
this.status = options.status;
|
|
443917
|
+
this.statusText = options.statusText;
|
|
443918
|
+
this.cause = options.cause;
|
|
443919
|
+
}
|
|
443920
|
+
};
|
|
443921
|
+
defaultWebRuntime2 = new WebRuntime2({
|
|
443922
|
+
searchProvider: new DuckDuckGoSearchProvider2,
|
|
443923
|
+
fetchProvider: new HttpFetchProvider2
|
|
443924
|
+
});
|
|
443925
|
+
webFetchTool2 = createWebFetchTool2();
|
|
443926
|
+
webSearchTool2 = createWebSearchTool2();
|
|
443729
443927
|
jobIdProperty2 = { type: "string", description: "Job id returned by a long-running tool or JobList" };
|
|
443730
443928
|
jobListTool2 = {
|
|
443731
443929
|
name: "JobList",
|
|
@@ -443965,6 +444163,7 @@ Path: ${worktreePath}` }] };
|
|
|
443965
444163
|
init_src32();
|
|
443966
444164
|
init_src18();
|
|
443967
444165
|
init_src18();
|
|
444166
|
+
init_src18();
|
|
443968
444167
|
NativeToolHostError = class extends Error {
|
|
443969
444168
|
constructor(code, message, options) {
|
|
443970
444169
|
super(message, options);
|
|
@@ -447199,7 +447398,7 @@ Path: ${worktreePath}` }] };
|
|
|
447199
447398
|
}
|
|
447200
447399
|
code;
|
|
447201
447400
|
};
|
|
447202
|
-
MANIFEST_RELATIVE_PATH2 =
|
|
447401
|
+
MANIFEST_RELATIVE_PATH2 = join352(".vykor-plugin", "plugin.json");
|
|
447203
447402
|
init_src42();
|
|
447204
447403
|
init_src18();
|
|
447205
447404
|
eventSet2 = new Set(HOOK_EVENTS2);
|
|
@@ -457133,7 +457332,7 @@ import { createHash as createHash21 } from "node:crypto";
|
|
|
457133
457332
|
import { createReadStream as createReadStream2, createWriteStream } from "node:fs";
|
|
457134
457333
|
import { lstat as lstat9, mkdir as mkdir15, mkdtemp as mkdtemp3, rm as rm10 } from "node:fs/promises";
|
|
457135
457334
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
457136
|
-
import { dirname as dirname23, join as join41, resolve as
|
|
457335
|
+
import { dirname as dirname23, join as join41, resolve as resolve31 } from "node:path";
|
|
457137
457336
|
import { Transform as Transform2 } from "node:stream";
|
|
457138
457337
|
import { pipeline } from "node:stream/promises";
|
|
457139
457338
|
|
|
@@ -457529,7 +457728,7 @@ async function extractTarEntries(path, destination, gzip, planned) {
|
|
|
457529
457728
|
throw failure;
|
|
457530
457729
|
}
|
|
457531
457730
|
async function cleanupPrivateRoot(root) {
|
|
457532
|
-
if (
|
|
457731
|
+
if (resolve31(dirname23(root)) !== resolve31(tmpdir5()) || !root.startsWith(join41(tmpdir5(), PRIVATE_PREFIX)))
|
|
457533
457732
|
throw archiveError("refusing to clean an unknown temporary directory");
|
|
457534
457733
|
await rm10(root, { recursive: true, force: true });
|
|
457535
457734
|
}
|
|
@@ -457579,7 +457778,7 @@ var init_local_zip = __esm(() => {
|
|
|
457579
457778
|
import { createHash as createHash23 } from "node:crypto";
|
|
457580
457779
|
import { execFile as execFile5 } from "node:child_process";
|
|
457581
457780
|
import { mkdtemp as mkdtemp4, rm as rm11 } from "node:fs/promises";
|
|
457582
|
-
import { join as join43, resolve as
|
|
457781
|
+
import { join as join43, resolve as resolve33 } from "node:path";
|
|
457583
457782
|
import { promisify as promisify4 } from "node:util";
|
|
457584
457783
|
import { tmpdir as tmpdir6 } from "node:os";
|
|
457585
457784
|
function gitSourceError(message) {
|
|
@@ -457613,9 +457812,9 @@ function sourceDigest(input) {
|
|
|
457613
457812
|
return createHash23("sha256").update("vykor-plugin-git-source-v1\x00").update(input.url).update("\x00").update(input.ref ?? "").update("\x00").update(input.commit).digest("hex");
|
|
457614
457813
|
}
|
|
457615
457814
|
async function cleanupPrivateRoot2(root) {
|
|
457616
|
-
const resolvedRoot =
|
|
457617
|
-
const resolvedTmp =
|
|
457618
|
-
if (
|
|
457815
|
+
const resolvedRoot = resolve33(root);
|
|
457816
|
+
const resolvedTmp = resolve33(tmpdir6());
|
|
457817
|
+
if (resolve33(join43(resolvedRoot, "..")) !== resolvedTmp || !resolvedRoot.startsWith(join43(resolvedTmp, PRIVATE_PREFIX2))) {
|
|
457619
457818
|
throw gitSourceError("refusing to clean an unknown temporary directory");
|
|
457620
457819
|
}
|
|
457621
457820
|
await rm11(resolvedRoot, { recursive: true, force: true });
|
|
@@ -458798,7 +458997,7 @@ var init_runtime_secrets = __esm(() => {
|
|
|
458798
458997
|
// ../../packages/server/src/runtime/runtime-settings.ts
|
|
458799
458998
|
import { execFile as execFile6 } from "node:child_process";
|
|
458800
458999
|
import { createHash as createHash24 } from "node:crypto";
|
|
458801
|
-
import { isAbsolute as isAbsolute11, resolve as
|
|
459000
|
+
import { isAbsolute as isAbsolute11, resolve as resolve34 } from "node:path";
|
|
458802
459001
|
import { isDeepStrictEqual as isDeepStrictEqual9, promisify as promisify5 } from "node:util";
|
|
458803
459002
|
import { tmpdir as tmpdir7 } from "node:os";
|
|
458804
459003
|
function environmentFingerprint(config) {
|
|
@@ -481468,6 +481667,14 @@ class OutputBuffer2 {
|
|
|
481468
481667
|
// ../../packages/terminal-node/src/shell.ts
|
|
481469
481668
|
import { existsSync as existsSync21 } from "node:fs";
|
|
481470
481669
|
import { delimiter as delimiter3, isAbsolute as isAbsolute13, join as join50 } from "node:path";
|
|
481670
|
+
function terminalCommandArgs2(shell, command) {
|
|
481671
|
+
const name = shell.split(/[\\/]/).pop()?.replace(/\.exe$/i, "").toLowerCase();
|
|
481672
|
+
if (name === "powershell" || name === "pwsh")
|
|
481673
|
+
return ["-NoLogo", "-NoProfile", "-Command", command];
|
|
481674
|
+
if (name === "cmd")
|
|
481675
|
+
return ["/d", "/s", "/c", command];
|
|
481676
|
+
return ["-lc", command];
|
|
481677
|
+
}
|
|
481471
481678
|
function resolveDefaultShell2(platform = process.platform, env = process.env, fileExists = existsSync21) {
|
|
481472
481679
|
if (platform === "win32") {
|
|
481473
481680
|
return { command: resolveWindowsShell2(env, fileExists), args: [] };
|
|
@@ -481593,6 +481800,9 @@ class LocalTerminalProvider2 {
|
|
|
481593
481800
|
this.options = options;
|
|
481594
481801
|
}
|
|
481595
481802
|
async create(input) {
|
|
481803
|
+
if (input.command !== undefined && (!input.command.trim() || input.shellArgs !== undefined)) {
|
|
481804
|
+
throw new Error("Terminal command must be non-empty and cannot be combined with shellArgs.");
|
|
481805
|
+
}
|
|
481596
481806
|
const id = randomUUID43();
|
|
481597
481807
|
const resolvedCwd = await this.options.resolveCwd(input);
|
|
481598
481808
|
const resolvedInfo = this.options.resolveSessionInfo?.(input) ?? (input.scope.kind === "project" ? { projectId: input.scope.projectId } : { sessionId: input.scope.sessionId });
|
|
@@ -481603,7 +481813,7 @@ class LocalTerminalProvider2 {
|
|
|
481603
481813
|
const target = input.runtime === "environment" ? await this.requireEnvironmentTarget(input, resolvedCwd, id) : createHostTerminalTarget2({
|
|
481604
481814
|
cwd: resolvedCwd,
|
|
481605
481815
|
shell: input.shell?.trim() || resolveDefaultShell2().command,
|
|
481606
|
-
shellArgs: input.shellArgs,
|
|
481816
|
+
shellArgs: input.command ? terminalCommandArgs2(input.shell?.trim() || resolveDefaultShell2().command, input.command) : input.shellArgs,
|
|
481607
481817
|
env: input.env
|
|
481608
481818
|
});
|
|
481609
481819
|
try {
|
|
@@ -481648,6 +481858,7 @@ class LocalTerminalProvider2 {
|
|
|
481648
481858
|
status: "running",
|
|
481649
481859
|
cwd: target.executionCwd,
|
|
481650
481860
|
shell: target.shell,
|
|
481861
|
+
...input.command ? { command: input.command } : {},
|
|
481651
481862
|
cols: clampDimension2(input.cols),
|
|
481652
481863
|
rows: clampDimension2(input.rows),
|
|
481653
481864
|
createdAt: new Date().toISOString()
|
|
@@ -481969,7 +482180,7 @@ var init_daemon_operation_gate = __esm(() => {
|
|
|
481969
482180
|
});
|
|
481970
482181
|
|
|
481971
482182
|
// ../../packages/server/src/terminal/daemon-terminal-service.ts
|
|
481972
|
-
import { resolve as
|
|
482183
|
+
import { resolve as resolve35 } from "node:path";
|
|
481973
482184
|
|
|
481974
482185
|
class DaemonTerminalService {
|
|
481975
482186
|
store;
|
|
@@ -482064,6 +482275,7 @@ class DaemonTerminalService {
|
|
|
482064
482275
|
rows: input.rows ?? 30,
|
|
482065
482276
|
name: input.name ?? "Agent terminal",
|
|
482066
482277
|
shell: input.shell,
|
|
482278
|
+
command: input.command,
|
|
482067
482279
|
cwd: input.cwd,
|
|
482068
482280
|
source: "agent"
|
|
482069
482281
|
})
|
|
@@ -482090,7 +482302,7 @@ class DaemonTerminalService {
|
|
|
482090
482302
|
throw new DaemonTerminalError(404, `Project not found: ${projectId}`);
|
|
482091
482303
|
cwd = project.path;
|
|
482092
482304
|
}
|
|
482093
|
-
if (input.cwd &&
|
|
482305
|
+
if (input.cwd && resolve35(input.cwd) !== resolve35(cwd)) {
|
|
482094
482306
|
throw new DaemonTerminalError(400, "Terminal cwd does not match its trusted scope.");
|
|
482095
482307
|
}
|
|
482096
482308
|
return {
|
|
@@ -482113,11 +482325,12 @@ class DaemonTerminalService {
|
|
|
482113
482325
|
const settings = await this.options.getSettingsForCwd(resolved.session ? sessionSettingsRoot(resolved.session) : resolved.cwd);
|
|
482114
482326
|
const lease = await this.options.acquireEnvironment(session, settings, { kind: "terminal", id: terminalId });
|
|
482115
482327
|
try {
|
|
482328
|
+
const shell = input.shell ?? (input.command ? lease.info.shellDescriptor.executable : undefined);
|
|
482116
482329
|
const target = await lease.terminal.prepare({
|
|
482117
482330
|
cwd: lease.workspace.executionRoot,
|
|
482118
|
-
shell
|
|
482331
|
+
shell,
|
|
482119
482332
|
owner: { kind: "terminal", id: terminalId },
|
|
482120
|
-
shellArgs: input.shellArgs,
|
|
482333
|
+
shellArgs: input.command ? terminalCommandArgs2(shell, input.command) : input.shellArgs,
|
|
482121
482334
|
env: input.env,
|
|
482122
482335
|
cols: input.cols,
|
|
482123
482336
|
rows: input.rows
|
|
@@ -482157,7 +482370,7 @@ var init_daemon_terminal_service = __esm(() => {
|
|
|
482157
482370
|
});
|
|
482158
482371
|
|
|
482159
482372
|
// ../../packages/server/src/runtime/session-execution-environment.ts
|
|
482160
|
-
import { resolve as
|
|
482373
|
+
import { resolve as resolve36 } from "node:path";
|
|
482161
482374
|
function createSessionEnvironmentAcquirer(_input) {
|
|
482162
482375
|
return async (session, settings) => {
|
|
482163
482376
|
const config = resolveExecutionEnvironmentConfig({ surface: "desktop_managed", settings, cwd: session.cwd });
|
|
@@ -482169,7 +482382,7 @@ function createSessionEnvironmentAcquirer(_input) {
|
|
|
482169
482382
|
const secretNames = settings.agentEnvironment?.secretEnv ?? [];
|
|
482170
482383
|
const secretEnv = {
|
|
482171
482384
|
...await loadRuntimeSecrets("global", secretNames),
|
|
482172
|
-
...await loadRuntimeSecrets(
|
|
482385
|
+
...await loadRuntimeSecrets(resolve36(sessionSettingsRoot(session)), secretNames)
|
|
482173
482386
|
};
|
|
482174
482387
|
if (secretNames.some((name) => !Object.hasOwn(secretEnv, name) || secretEnv[name] === undefined))
|
|
482175
482388
|
throw new Error("任务所需的机密环境变量尚未配置。");
|
|
@@ -489345,12 +489558,17 @@ function parseNumstat(buffer) {
|
|
|
489345
489558
|
const added = parts[0];
|
|
489346
489559
|
const deleted = parts[1];
|
|
489347
489560
|
const inlinePath = parts.slice(2).join("\t");
|
|
489348
|
-
const
|
|
489561
|
+
const entry = {
|
|
489562
|
+
additions: isBinaryCount(added) ? 0 : Number(added),
|
|
489563
|
+
deletions: isBinaryCount(deleted) ? 0 : Number(deleted)
|
|
489564
|
+
};
|
|
489565
|
+
if (!Number.isSafeInteger(entry.additions) || !Number.isSafeInteger(entry.deletions))
|
|
489566
|
+
return;
|
|
489349
489567
|
if (inlinePath.length > 0) {
|
|
489350
489568
|
const path = decodeField(Buffer.from(inlinePath, "latin1"));
|
|
489351
489569
|
if (path === undefined)
|
|
489352
489570
|
return;
|
|
489353
|
-
map.set(path,
|
|
489571
|
+
map.set(path, entry);
|
|
489354
489572
|
} else {
|
|
489355
489573
|
const oldPath = records[index + 1];
|
|
489356
489574
|
const newPath = records[index + 2];
|
|
@@ -489359,7 +489577,7 @@ function parseNumstat(buffer) {
|
|
|
489359
489577
|
const decoded = decodeField(newPath);
|
|
489360
489578
|
if (decoded === undefined)
|
|
489361
489579
|
return;
|
|
489362
|
-
map.set(decoded,
|
|
489580
|
+
map.set(decoded, entry);
|
|
489363
489581
|
index += 2;
|
|
489364
489582
|
}
|
|
489365
489583
|
}
|
|
@@ -489665,11 +489883,14 @@ class DefaultGitRunChangeInspector {
|
|
|
489665
489883
|
for (const path of trackedPaths) {
|
|
489666
489884
|
const info = nameStatus.get(path);
|
|
489667
489885
|
const status = info ? mapStatus(info.code) : "unknown";
|
|
489886
|
+
const stat = numstat.get(path);
|
|
489668
489887
|
files.push({
|
|
489669
489888
|
path,
|
|
489670
489889
|
...info?.oldPath ? { oldPath: info.oldPath } : {},
|
|
489671
489890
|
status,
|
|
489672
|
-
lines:
|
|
489891
|
+
lines: stat ? stat.additions + stat.deletions : 0,
|
|
489892
|
+
additions: stat?.additions ?? 0,
|
|
489893
|
+
deletions: stat?.deletions ?? 0
|
|
489673
489894
|
});
|
|
489674
489895
|
const diffArgs = info?.oldPath ? ["diff", "--binary", "--no-color", "HEAD", "--", info.oldPath, path] : ["diff", "--binary", "--no-color", "HEAD", "--", path];
|
|
489675
489896
|
const text = await this.readDiffText(cwd, diffArgs);
|
|
@@ -489678,7 +489899,14 @@ class DefaultGitRunChangeInspector {
|
|
|
489678
489899
|
chunks.push({ path, text });
|
|
489679
489900
|
}
|
|
489680
489901
|
for (const path of untrackedPaths) {
|
|
489681
|
-
|
|
489902
|
+
const stat = await this.countUntrackedLines(cwd, path);
|
|
489903
|
+
files.push({
|
|
489904
|
+
path,
|
|
489905
|
+
status: "added",
|
|
489906
|
+
lines: stat.additions + stat.deletions,
|
|
489907
|
+
additions: stat.additions,
|
|
489908
|
+
deletions: stat.deletions
|
|
489909
|
+
});
|
|
489682
489910
|
const text = await this.readDiffText(cwd, [
|
|
489683
489911
|
"diff",
|
|
489684
489912
|
"--no-index",
|
|
@@ -489714,11 +489942,14 @@ class DefaultGitRunChangeInspector {
|
|
|
489714
489942
|
return;
|
|
489715
489943
|
const files = [];
|
|
489716
489944
|
for (const [path, info] of nameStatus) {
|
|
489945
|
+
const stat = numstat.get(path);
|
|
489717
489946
|
files.push({
|
|
489718
489947
|
path,
|
|
489719
489948
|
...info.oldPath ? { oldPath: info.oldPath } : {},
|
|
489720
489949
|
status: mapStatus(info.code),
|
|
489721
|
-
lines:
|
|
489950
|
+
lines: stat ? stat.additions + stat.deletions : 0,
|
|
489951
|
+
additions: stat?.additions ?? 0,
|
|
489952
|
+
deletions: stat?.deletions ?? 0
|
|
489722
489953
|
});
|
|
489723
489954
|
}
|
|
489724
489955
|
const text = await this.readDiffText(cwd, ["diff", "--binary", "--no-color", baseHead, head]);
|
|
@@ -489781,7 +490012,7 @@ class DefaultGitRunChangeInspector {
|
|
|
489781
490012
|
async countUntrackedLines(cwd, path) {
|
|
489782
490013
|
const result = await this.executor.exec(["diff", "--no-index", "--numstat", "-z", "--no-color", "--", "/dev/null", path], cwd);
|
|
489783
490014
|
const parsed = parseNumstat(result.stdout);
|
|
489784
|
-
return parsed?.get(path) ?? 0;
|
|
490015
|
+
return parsed?.get(path) ?? { additions: 0, deletions: 0 };
|
|
489785
490016
|
}
|
|
489786
490017
|
}
|
|
489787
490018
|
function isUnavailable2(value) {
|
|
@@ -489860,7 +490091,7 @@ var init_git_run_change_inspector = __esm(() => {
|
|
|
489860
490091
|
});
|
|
489861
490092
|
|
|
489862
490093
|
// ../../packages/server/src/application/session/session-workspace-changes.ts
|
|
489863
|
-
import { resolve as
|
|
490094
|
+
import { resolve as resolve37 } from "node:path";
|
|
489864
490095
|
|
|
489865
490096
|
class SessionWorkspaceChanges {
|
|
489866
490097
|
options;
|
|
@@ -489873,7 +490104,7 @@ class SessionWorkspaceChanges {
|
|
|
489873
490104
|
this.active.set(runId, entry);
|
|
489874
490105
|
this.markOverlaps(runId, entry);
|
|
489875
490106
|
try {
|
|
489876
|
-
if (!localExecutionCwd || normalize5(
|
|
490107
|
+
if (!localExecutionCwd || normalize5(resolve37(localExecutionCwd)) !== normalize5(resolve37(cwd))) {
|
|
489877
490108
|
return this.unavailable(runId, "execution_environment_unavailable");
|
|
489878
490109
|
}
|
|
489879
490110
|
const baseline = await this.inspect(signal, this.options.captureBudgetMs ?? WORKSPACE_CAPTURE_BUDGET_MS, (inspectionSignal) => this.options.inspector.capture(cwd, inspectionSignal));
|
|
@@ -490086,7 +490317,7 @@ var init_session_plugin_capability_service = __esm(() => {
|
|
|
490086
490317
|
|
|
490087
490318
|
// ../../packages/server/src/application/session/session-plugin-ui-service.ts
|
|
490088
490319
|
import { createHash as createHash28, randomUUID as randomUUID50 } from "node:crypto";
|
|
490089
|
-
import { resolve as
|
|
490320
|
+
import { resolve as resolve38 } from "node:path";
|
|
490090
490321
|
|
|
490091
490322
|
class SessionPluginUiService {
|
|
490092
490323
|
options;
|
|
@@ -490103,7 +490334,7 @@ class SessionPluginUiService {
|
|
|
490103
490334
|
return this.backendReady && this.options.lifecycle !== undefined;
|
|
490104
490335
|
}
|
|
490105
490336
|
matches(scope, session, pluginId) {
|
|
490106
|
-
return scope.kind === "cwd" ?
|
|
490337
|
+
return scope.kind === "cwd" ? resolve38(scope.cwd) === resolve38(session.cwd) && (!scope.sessionId || scope.sessionId === session.id) : !scope.pluginId || scope.pluginId === pluginId;
|
|
490107
490338
|
}
|
|
490108
490339
|
assertNotMutating(session, instance) {
|
|
490109
490340
|
if ([...this.mutations].some((scope) => this.matches(scope, session, instance.pluginId)))
|
|
@@ -491080,7 +491311,7 @@ function isTerminalRuntimeStatus(status) {
|
|
|
491080
491311
|
|
|
491081
491312
|
// ../../packages/server/src/application/session/background-shell-service.ts
|
|
491082
491313
|
import { createHash as createHash29, randomUUID as randomUUID51 } from "node:crypto";
|
|
491083
|
-
import { resolve as
|
|
491314
|
+
import { resolve as resolve39 } from "node:path";
|
|
491084
491315
|
|
|
491085
491316
|
class BackgroundShellService {
|
|
491086
491317
|
context;
|
|
@@ -491367,7 +491598,7 @@ class BackgroundShellService {
|
|
|
491367
491598
|
if (options.requireActiveSession && (session.status === "closing" || session.status === "archived")) {
|
|
491368
491599
|
throw new BackgroundShellError(409, `Session is not accepting new work: ${input.sessionId}`);
|
|
491369
491600
|
}
|
|
491370
|
-
if (cwd &&
|
|
491601
|
+
if (cwd && resolve39(cwd) !== resolve39(session.cwd)) {
|
|
491371
491602
|
throw new BackgroundShellError(409, "Background shell cwd mismatch");
|
|
491372
491603
|
}
|
|
491373
491604
|
cwd = session.cwd;
|
|
@@ -589355,7 +589586,7 @@ import {
|
|
|
589355
589586
|
isAbsolute as isAbsolute16,
|
|
589356
589587
|
join as join54,
|
|
589357
589588
|
relative as relative14,
|
|
589358
|
-
resolve as
|
|
589589
|
+
resolve as resolve40,
|
|
589359
589590
|
sep as sep9
|
|
589360
589591
|
} from "node:path";
|
|
589361
589592
|
|
|
@@ -589368,8 +589599,8 @@ class SkillManagementService {
|
|
|
589368
589599
|
constructor(options) {
|
|
589369
589600
|
this.options = options;
|
|
589370
589601
|
const defaultSkillsDir = getSkillsDir();
|
|
589371
|
-
this.configDir =
|
|
589372
|
-
this.personalSkillsDir = options.configDir ? join54(this.configDir, "skills") :
|
|
589602
|
+
this.configDir = resolve40(options.configDir ?? dirname25(defaultSkillsDir));
|
|
589603
|
+
this.personalSkillsDir = options.configDir ? join54(this.configDir, "skills") : resolve40(defaultSkillsDir);
|
|
589373
589604
|
this.standardSkillsDirs = options.standardSkillsDirs ?? standardUserSkillDirs();
|
|
589374
589605
|
this.bundledSkills = options.bundledSkills ?? BUNDLED_SKILLS;
|
|
589375
589606
|
}
|
|
@@ -589446,7 +589677,7 @@ async function validProjects(input, warnings) {
|
|
|
589446
589677
|
const seen = new Set;
|
|
589447
589678
|
for (const project of input) {
|
|
589448
589679
|
try {
|
|
589449
|
-
const root = await realpath9(
|
|
589680
|
+
const root = await realpath9(resolve40(project.path));
|
|
589450
589681
|
if (!(await stat13(root)).isDirectory() || seen.has(key(root)))
|
|
589451
589682
|
continue;
|
|
589452
589683
|
seen.add(key(root));
|
|
@@ -589485,14 +589716,14 @@ function within2(root, target) {
|
|
|
589485
589716
|
return path !== "" && path !== ".." && !path.startsWith(`..${sep9}`) && !isAbsolute16(path);
|
|
589486
589717
|
}
|
|
589487
589718
|
function key(path) {
|
|
589488
|
-
const normalized =
|
|
589719
|
+
const normalized = resolve40(path);
|
|
589489
589720
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
589490
589721
|
}
|
|
589491
589722
|
function uniqueDirectories3(directories, personalSkillsDir) {
|
|
589492
589723
|
const personalKey = key(personalSkillsDir);
|
|
589493
589724
|
const seen = new Set;
|
|
589494
589725
|
return directories.flatMap((directory) => {
|
|
589495
|
-
const resolved =
|
|
589726
|
+
const resolved = resolve40(directory);
|
|
589496
589727
|
const directoryKey = key(resolved);
|
|
589497
589728
|
if (directoryKey === personalKey || seen.has(directoryKey))
|
|
589498
589729
|
return [];
|
|
@@ -590935,7 +591166,7 @@ var init_memory2 = __esm(() => {
|
|
|
590935
591166
|
});
|
|
590936
591167
|
|
|
590937
591168
|
// ../../packages/server/src/http/routes/facts.ts
|
|
590938
|
-
import { resolve as
|
|
591169
|
+
import { resolve as resolve41 } from "node:path";
|
|
590939
591170
|
function createFactsRoutes(context) {
|
|
590940
591171
|
return new Hono2().get("/", (c) => {
|
|
590941
591172
|
const cwd = c.req.query("cwd");
|
|
@@ -590958,7 +591189,7 @@ function createFactsRoutes(context) {
|
|
|
590958
591189
|
return errorResponse(400, "sessionId must be a string");
|
|
590959
591190
|
if (body.sessionId !== undefined) {
|
|
590960
591191
|
const session = context.sessions.get(body.sessionId);
|
|
590961
|
-
if (!session ||
|
|
591192
|
+
if (!session || resolve41(session.cwd) !== resolve41(body.cwd)) {
|
|
590962
591193
|
return errorResponse(400, "sessionId must belong to cwd");
|
|
590963
591194
|
}
|
|
590964
591195
|
}
|
|
@@ -592298,10 +592529,10 @@ import {
|
|
|
592298
592529
|
isAbsolute as isAbsolute17,
|
|
592299
592530
|
join as join55,
|
|
592300
592531
|
relative as relative15,
|
|
592301
|
-
resolve as
|
|
592532
|
+
resolve as resolve43
|
|
592302
592533
|
} from "node:path";
|
|
592303
592534
|
async function createApplicationBackup(input) {
|
|
592304
|
-
const destination =
|
|
592535
|
+
const destination = resolve43(input.destination);
|
|
592305
592536
|
assertDestinationOutsideSource(destination, dirname26(input.store.path));
|
|
592306
592537
|
if (existsSync23(destination) && readdirSync8(destination).length > 0) {
|
|
592307
592538
|
throw new Error(`Backup destination is not empty: ${destination}`);
|
|
@@ -592365,7 +592596,7 @@ async function createApplicationBackup(input) {
|
|
|
592365
592596
|
return manifest;
|
|
592366
592597
|
}
|
|
592367
592598
|
function restoreApplicationBackup(input) {
|
|
592368
|
-
const source =
|
|
592599
|
+
const source = resolve43(input.source);
|
|
592369
592600
|
const manifest = JSON.parse(readFileSync15(join55(source, "manifest.json"), "utf-8"));
|
|
592370
592601
|
if (![1, 2, 3].includes(manifest.version) || manifest.database !== "database.sqlite") {
|
|
592371
592602
|
throw new Error("Unsupported backup manifest");
|
|
@@ -592376,7 +592607,7 @@ function restoreApplicationBackup(input) {
|
|
|
592376
592607
|
if (manifest.version === 3 && typeof manifest.directories.notes !== "boolean")
|
|
592377
592608
|
throw new Error("Invalid note backup directory manifest");
|
|
592378
592609
|
verifyChecksums(source);
|
|
592379
|
-
const storePath =
|
|
592610
|
+
const storePath = resolve43(input.storePath);
|
|
592380
592611
|
const notesPath = join55(dirname26(storePath), "notes");
|
|
592381
592612
|
if (existsSync23(storePath))
|
|
592382
592613
|
throw new Error(`Restore Store already exists: ${storePath}`);
|
|
@@ -592414,7 +592645,7 @@ function restoreApplicationBackup(input) {
|
|
|
592414
592645
|
function copyOptionalDirectory(source, destination) {
|
|
592415
592646
|
if (!source || !existsSync23(source) || !statSync8(source).isDirectory())
|
|
592416
592647
|
return false;
|
|
592417
|
-
cpSync3(
|
|
592648
|
+
cpSync3(resolve43(source), destination, { recursive: true });
|
|
592418
592649
|
return true;
|
|
592419
592650
|
}
|
|
592420
592651
|
function assertDestinationOutsideSource(destination, source) {
|
|
@@ -592425,14 +592656,14 @@ function assertDestinationOutsideSource(destination, source) {
|
|
|
592425
592656
|
}
|
|
592426
592657
|
}
|
|
592427
592658
|
function canonicalBackupPath(path) {
|
|
592428
|
-
const absolute =
|
|
592659
|
+
const absolute = resolve43(path);
|
|
592429
592660
|
if (existsSync23(absolute))
|
|
592430
592661
|
return realpathSync(absolute);
|
|
592431
592662
|
const parent = dirname26(absolute);
|
|
592432
592663
|
return parent === absolute ? absolute : join55(canonicalBackupPath(parent), basename15(absolute));
|
|
592433
592664
|
}
|
|
592434
592665
|
function createRestoreTarget(finalPath, kind, restoreId) {
|
|
592435
|
-
const resolved =
|
|
592666
|
+
const resolved = resolve43(finalPath);
|
|
592436
592667
|
const stem = `.${basename15(resolved)}.restore-${restoreId}`;
|
|
592437
592668
|
return {
|
|
592438
592669
|
finalPath: resolved,
|
|
@@ -592500,17 +592731,17 @@ function stageRestoreTarget(target, source) {
|
|
|
592500
592731
|
function stageOptionalRestoreTarget(targets, destination, source) {
|
|
592501
592732
|
if (!destination)
|
|
592502
592733
|
return;
|
|
592503
|
-
const target = targets.find((candidate) => candidate.finalPath ===
|
|
592734
|
+
const target = targets.find((candidate) => candidate.finalPath === resolve43(destination));
|
|
592504
592735
|
if (target)
|
|
592505
592736
|
stageRestoreTarget(target, source);
|
|
592506
592737
|
}
|
|
592507
592738
|
function validateStagedRestore(targets, storePath, attachmentsPath, manifest) {
|
|
592508
|
-
const databaseTarget = targets.find((target) => target.finalPath ===
|
|
592509
|
-
const attachmentTarget = attachmentsPath ? targets.find((target) => target.finalPath ===
|
|
592739
|
+
const databaseTarget = targets.find((target) => target.finalPath === resolve43(storePath));
|
|
592740
|
+
const attachmentTarget = attachmentsPath ? targets.find((target) => target.finalPath === resolve43(attachmentsPath)) : undefined;
|
|
592510
592741
|
const database = new SessionStore({ path: databaseTarget.stagePath });
|
|
592511
592742
|
try {
|
|
592512
592743
|
{
|
|
592513
|
-
const noteTarget = targets.find((target) => target.finalPath === join55(dirname26(
|
|
592744
|
+
const noteTarget = targets.find((target) => target.finalPath === join55(dirname26(resolve43(storePath)), "notes"));
|
|
592514
592745
|
if (!noteTarget)
|
|
592515
592746
|
throw new Error("Note restore is incomplete");
|
|
592516
592747
|
if (!manifest.directories.notes)
|
|
@@ -592587,7 +592818,7 @@ function checksumsFor(root, excluded) {
|
|
|
592587
592818
|
return checksums;
|
|
592588
592819
|
}
|
|
592589
592820
|
function verifyApplicationBackup(source) {
|
|
592590
|
-
const root =
|
|
592821
|
+
const root = resolve43(source);
|
|
592591
592822
|
const manifest = JSON.parse(readFileSync15(join55(root, "manifest.json"), "utf-8"));
|
|
592592
592823
|
if (![1, 2, 3].includes(manifest.version) || manifest.database !== "database.sqlite" || !isDirectoryManifest(manifest.directories))
|
|
592593
592824
|
throw new Error("Unsupported backup manifest");
|
|
@@ -592632,7 +592863,7 @@ function validateAttachmentFiles(store, attachmentsRoot) {
|
|
|
592632
592863
|
}
|
|
592633
592864
|
let physicalBytes = 0;
|
|
592634
592865
|
for (const [sha256, expectedSize] of unique) {
|
|
592635
|
-
const path = join55(
|
|
592866
|
+
const path = join55(resolve43(attachmentsRoot), "blobs", sha256.slice(0, 2), sha256);
|
|
592636
592867
|
if (!existsSync23(path)) {
|
|
592637
592868
|
const asset = assets.find((candidate) => candidate.sha256 === sha256);
|
|
592638
592869
|
throw new Error(`Attachment backup is incomplete: missing blob for ${asset.id}`);
|
|
@@ -592668,16 +592899,16 @@ var init_application_backup = __esm(() => {
|
|
|
592668
592899
|
|
|
592669
592900
|
// ../../packages/server/src/application/maintenance/storage-settings.ts
|
|
592670
592901
|
import { accessSync, constants as constants3, existsSync as existsSync24, lstatSync as lstatSync4, readFileSync as readFileSync16, readdirSync as readdirSync9, realpathSync as realpathSync2, statfsSync } from "node:fs";
|
|
592671
|
-
import { dirname as dirname27, isAbsolute as isAbsolute18, join as join56, resolve as
|
|
592902
|
+
import { dirname as dirname27, isAbsolute as isAbsolute18, join as join56, resolve as resolve44 } from "node:path";
|
|
592672
592903
|
function maintenanceDirectories(storePath) {
|
|
592673
|
-
const root = dirname27(
|
|
592904
|
+
const root = dirname27(resolve44(storePath));
|
|
592674
592905
|
return { attachments: join56(root, "attachments"), memory: join56(getDataDir(), "memory"), executionOutput: getTasksDir() };
|
|
592675
592906
|
}
|
|
592676
592907
|
function scanStorage(storePath) {
|
|
592677
592908
|
if (!isAbsolute18(storePath))
|
|
592678
592909
|
throw new Error("当前后台没有持久数据目录,不支持磁盘维护统计");
|
|
592679
592910
|
const sources = maintenanceDirectories(storePath);
|
|
592680
|
-
const root = dirname27(
|
|
592911
|
+
const root = dirname27(resolve44(storePath));
|
|
592681
592912
|
const definitions = [
|
|
592682
592913
|
["database", "会话数据库", [storePath, `${storePath}-wal`, `${storePath}-shm`, join56(root, "notes")]],
|
|
592683
592914
|
["attachments", "附件(共享文件只计一次)", [sources.attachments]],
|
|
@@ -593049,7 +593280,7 @@ var init_cleanup_settings = __esm(() => {
|
|
|
593049
593280
|
import { constants as constants4, cpSync as cpSync4, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync18, readdirSync as readdirSync11, renameSync as renameSync10, rmSync as rmSync6, statfsSync as statfsSync2, statSync as statSync10, writeFileSync as writeFileSync15 } from "node:fs";
|
|
593050
593281
|
import { access as access7, statfs } from "node:fs/promises";
|
|
593051
593282
|
import { randomUUID as randomUUID59 } from "node:crypto";
|
|
593052
|
-
import { dirname as dirname28, isAbsolute as isAbsolute20, join as join58, relative as relative17, resolve as
|
|
593283
|
+
import { dirname as dirname28, isAbsolute as isAbsolute20, join as join58, relative as relative17, resolve as resolve45 } from "node:path";
|
|
593053
593284
|
function createMaintenanceRoutes(context) {
|
|
593054
593285
|
if (typeof context.store.path !== "string")
|
|
593055
593286
|
return new Hono2().all("/maintenance/*", () => errorResponse(501, "当前后台未提供持久存储维护。"));
|
|
@@ -593370,7 +593601,7 @@ function createMaintenanceRoutes(context) {
|
|
|
593370
593601
|
const { source } = await readJson2(c);
|
|
593371
593602
|
assertPath(source);
|
|
593372
593603
|
const manifest = verifyApplicationBackup(source);
|
|
593373
|
-
return jsonResponse({ path:
|
|
593604
|
+
return jsonResponse({ path: resolve45(source), manifest, totalBytes: backupBytes(source) });
|
|
593374
593605
|
} catch (error) {
|
|
593375
593606
|
return fail(error);
|
|
593376
593607
|
}
|
|
@@ -593537,6 +593768,7 @@ function createTerminalRoutes(terminals, events) {
|
|
|
593537
593768
|
name: optionalText(body.name),
|
|
593538
593769
|
shell: optionalText(body.shell),
|
|
593539
593770
|
shellArgs: readShellArgs(body.shellArgs),
|
|
593771
|
+
command: optionalText(body.command),
|
|
593540
593772
|
env: readTerminalEnvironment(body.env),
|
|
593541
593773
|
cwd: optionalText(body.cwd),
|
|
593542
593774
|
source: readSource(body.source) ?? "user"
|
|
@@ -595725,7 +595957,7 @@ async function openSystemBrowser(url) {
|
|
|
595725
595957
|
// src/commands/plugin.ts
|
|
595726
595958
|
init_src14();
|
|
595727
595959
|
init_src13();
|
|
595728
|
-
import { join as join67, resolve as
|
|
595960
|
+
import { join as join67, resolve as resolve50 } from "node:path";
|
|
595729
595961
|
import { mkdtemp as mkdtemp5, rm as rm15 } from "node:fs/promises";
|
|
595730
595962
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
595731
595963
|
// ../../packages/plugin-converters/src/core/digest.ts
|
|
@@ -595827,7 +596059,7 @@ async function detectClaudeCodePlugin(root) {
|
|
|
595827
596059
|
}
|
|
595828
596060
|
// ../../packages/plugin-converters/src/claude-code/parser.ts
|
|
595829
596061
|
import { access as access9, lstat as lstat12, readFile as readFile25, readdir as readdir11 } from "node:fs/promises";
|
|
595830
|
-
import { basename as basename17, isAbsolute as isAbsolute21, join as join63, relative as relative19, resolve as
|
|
596062
|
+
import { basename as basename17, isAbsolute as isAbsolute21, join as join63, relative as relative19, resolve as resolve46 } from "node:path";
|
|
595831
596063
|
var exists5 = async (path) => access9(path).then(() => true, () => false);
|
|
595832
596064
|
async function collect(root, path, extensions) {
|
|
595833
596065
|
if (!await exists5(path))
|
|
@@ -595851,14 +596083,14 @@ async function collect(root, path, extensions) {
|
|
|
595851
596083
|
}
|
|
595852
596084
|
var asPaths = (value) => typeof value === "string" ? [value] : Array.isArray(value) && value.every((x) => typeof x === "string") ? value : [];
|
|
595853
596085
|
function safe(root, value) {
|
|
595854
|
-
const target =
|
|
595855
|
-
const rel = relative19(
|
|
595856
|
-
if (rel.startsWith("..") || isAbsolute21(rel) || target ===
|
|
596086
|
+
const target = resolve46(root, value);
|
|
596087
|
+
const rel = relative19(resolve46(root), target);
|
|
596088
|
+
if (rel.startsWith("..") || isAbsolute21(rel) || target === resolve46(root))
|
|
595857
596089
|
throw new Error(`Claude component path escapes source: ${value}`);
|
|
595858
596090
|
return target;
|
|
595859
596091
|
}
|
|
595860
596092
|
async function inspectClaudeCodePlugin(rootInput) {
|
|
595861
|
-
const root =
|
|
596093
|
+
const root = resolve46(rootInput);
|
|
595862
596094
|
let manifest = {};
|
|
595863
596095
|
const manifestPath = join63(root, ".claude-plugin", "plugin.json");
|
|
595864
596096
|
if (await exists5(manifestPath))
|
|
@@ -595986,7 +596218,7 @@ function convertClaudeAgentMarkdown(content) {
|
|
|
595986
596218
|
init_src13();
|
|
595987
596219
|
import { randomUUID as randomUUID63 } from "node:crypto";
|
|
595988
596220
|
import { access as access10, cp as cp3, mkdir as mkdir21, readFile as readFile26, rename as rename9, rm as rm13, writeFile as writeFile13 } from "node:fs/promises";
|
|
595989
|
-
import { basename as basename18, dirname as dirname30, join as join64, relative as relative20, resolve as
|
|
596221
|
+
import { basename as basename18, dirname as dirname30, join as join64, relative as relative20, resolve as resolve47 } from "node:path";
|
|
595990
596222
|
var rel = (inspection, path) => relative20(inspection.root, path).replaceAll("\\", "/");
|
|
595991
596223
|
function componentPath(inspection, sourcePath, directory) {
|
|
595992
596224
|
const parts = rel(inspection, sourcePath).split("/");
|
|
@@ -596108,7 +596340,7 @@ class ClaudeCodePluginConverter {
|
|
|
596108
596340
|
throw new Error(`Blocked conversion items require approval: ${blocked.map((x) => x.id).join(", ")}`);
|
|
596109
596341
|
if (await digestSource(input.inspection.root) !== input.plan.sourceDigest)
|
|
596110
596342
|
throw new Error("Source changed after conversion planning; inspect and plan again");
|
|
596111
|
-
const output =
|
|
596343
|
+
const output = resolve47(input.output);
|
|
596112
596344
|
if (await access10(output).then(() => true, () => false))
|
|
596113
596345
|
throw new Error(`Conversion output already exists: ${output}`);
|
|
596114
596346
|
const temporary = `${output}.tmp-${randomUUID63()}`;
|
|
@@ -596177,11 +596409,11 @@ class ClaudeCodePluginConverter {
|
|
|
596177
596409
|
init_src13();
|
|
596178
596410
|
import { randomUUID as randomUUID64 } from "node:crypto";
|
|
596179
596411
|
import { copyFile as copyFile2, lstat as lstat14, mkdir as mkdir23, readFile as readFile28, realpath as realpath10, rename as rename10, rm as rm14, writeFile as writeFile14 } from "node:fs/promises";
|
|
596180
|
-
import { dirname as dirname33, join as join66, relative as relative23, resolve as
|
|
596412
|
+
import { dirname as dirname33, join as join66, relative as relative23, resolve as resolve49 } from "node:path";
|
|
596181
596413
|
|
|
596182
596414
|
// ../../packages/plugin-converters/src/codex/source.ts
|
|
596183
596415
|
import { lstat as lstat13, readFile as readFile27, readdir as readdir12 } from "node:fs/promises";
|
|
596184
|
-
import { dirname as dirname31, isAbsolute as isAbsolute23, join as join65, relative as relative21, resolve as
|
|
596416
|
+
import { dirname as dirname31, isAbsolute as isAbsolute23, join as join65, relative as relative21, resolve as resolve48 } from "node:path";
|
|
596185
596417
|
var PORTABLE_PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
596186
596418
|
var legacyManifest = ".codex-plugin/plugin.json";
|
|
596187
596419
|
function object6(value, label) {
|
|
@@ -596220,14 +596452,14 @@ async function sourceFiles(root, directory = root) {
|
|
|
596220
596452
|
return files;
|
|
596221
596453
|
}
|
|
596222
596454
|
function isWithin3(root, path) {
|
|
596223
|
-
const rel = relative21(
|
|
596455
|
+
const rel = relative21(resolve48(root), resolve48(path));
|
|
596224
596456
|
return rel === "" || !isAbsolute23(rel) && rel !== ".." && !rel.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`);
|
|
596225
596457
|
}
|
|
596226
596458
|
function pathDeclaration(root, value) {
|
|
596227
596459
|
if (!value.startsWith("./") || /[\\:\0]/.test(value) || value.split("/").includes("..")) {
|
|
596228
596460
|
throw new Error(`Invalid Codex component path: ${value}`);
|
|
596229
596461
|
}
|
|
596230
|
-
const full =
|
|
596462
|
+
const full = resolve48(root, value);
|
|
596231
596463
|
if (full === root || !isWithin3(root, full))
|
|
596232
596464
|
throw new Error(`Codex component path escapes source: ${value}`);
|
|
596233
596465
|
const path = relative21(root, full).replaceAll("\\", "/");
|
|
@@ -596252,7 +596484,7 @@ async function readJson3(root, path) {
|
|
|
596252
596484
|
return object6(JSON.parse(await readFile27(join65(root, path), "utf8")), path);
|
|
596253
596485
|
}
|
|
596254
596486
|
async function detectCodexPlugin(rootInput) {
|
|
596255
|
-
const root =
|
|
596487
|
+
const root = resolve48(rootInput);
|
|
596256
596488
|
if (await exists6(join65(root, legacyManifest)))
|
|
596257
596489
|
return { converterId: "codex", confidence: 1, evidence: [legacyManifest] };
|
|
596258
596490
|
if (!await exists6(join65(root, "plugin.json")))
|
|
@@ -596262,7 +596494,7 @@ async function detectCodexPlugin(rootInput) {
|
|
|
596262
596494
|
return manifest.$schema === PORTABLE_PLUGIN_SCHEMA ? { converterId: "codex", confidence: 1, evidence: [`plugin.json:${PORTABLE_PLUGIN_SCHEMA}`] } : null;
|
|
596263
596495
|
}
|
|
596264
596496
|
async function readCodexSource(rootInput) {
|
|
596265
|
-
const root =
|
|
596497
|
+
const root = resolve48(rootInput);
|
|
596266
596498
|
const files = await sourceFiles(root);
|
|
596267
596499
|
const portableCandidate = files.includes("plugin.json") ? await readJson3(root, "plugin.json") : undefined;
|
|
596268
596500
|
if (typeof portableCandidate?.$schema === "string" && portableCandidate.$schema.startsWith("https://agent-plugins.org/") && portableCandidate.$schema !== PORTABLE_PLUGIN_SCHEMA) {
|
|
@@ -596486,7 +596718,7 @@ async function checkOutput(sourceRoot, output) {
|
|
|
596486
596718
|
let parent = dirname33(output);
|
|
596487
596719
|
while (!await exists7(parent))
|
|
596488
596720
|
parent = dirname33(parent);
|
|
596489
|
-
const canonicalOutput =
|
|
596721
|
+
const canonicalOutput = resolve49(await realpath10(parent), relative23(parent, output));
|
|
596490
596722
|
if (isWithin3(await realpath10(sourceRoot), canonicalOutput))
|
|
596491
596723
|
throw new Error("Conversion output resolves inside the source directory");
|
|
596492
596724
|
}
|
|
@@ -596512,7 +596744,7 @@ class CodexPluginConverter {
|
|
|
596512
596744
|
return (await prepare(inspection)).plan;
|
|
596513
596745
|
}
|
|
596514
596746
|
async convert(input) {
|
|
596515
|
-
const output =
|
|
596747
|
+
const output = resolve49(input.output);
|
|
596516
596748
|
await checkOutput(input.inspection.root, output);
|
|
596517
596749
|
await readCodexSource(input.inspection.root);
|
|
596518
596750
|
if (await digestSource(input.inspection.root) !== input.plan.sourceDigest)
|
|
@@ -596685,11 +596917,11 @@ function createPluginCommand() {
|
|
|
596685
596917
|
const cmd = new Command3("plugin").description("Manage Native Plugins");
|
|
596686
596918
|
cmd.command("list").option("--cwd <path>").option("--verbose", "show permissions, contributions, runtime, and diagnostics").option("--json", "print the complete machine-readable response").action(async (options) => {
|
|
596687
596919
|
const c = await client();
|
|
596688
|
-
const result = await c.plugins.list({ cwd:
|
|
596920
|
+
const result = await c.plugins.list({ cwd: resolve50(options.cwd ?? process.cwd()) });
|
|
596689
596921
|
console.log(options.json ? JSON.stringify(result, null, 2) : formatPluginList(result, options.verbose));
|
|
596690
596922
|
});
|
|
596691
596923
|
cmd.command("validate").argument("<path>").action(async (path) => {
|
|
596692
|
-
const result = await validateNativePlugin(
|
|
596924
|
+
const result = await validateNativePlugin(resolve50(path));
|
|
596693
596925
|
if (result.status === "valid")
|
|
596694
596926
|
console.log(`Valid Native Plugin: ${result.plugin.manifest.id}@${result.plugin.manifest.version}`);
|
|
596695
596927
|
else {
|
|
@@ -596700,7 +596932,7 @@ function createPluginCommand() {
|
|
|
596700
596932
|
});
|
|
596701
596933
|
for (const [name, link] of [["install-local", false], ["link", true]]) {
|
|
596702
596934
|
cmd.command(name).argument("<path>").option("--cwd <path>").option("--approve <permission>", "approve a requested permission", collect2, []).action(async (path, options) => {
|
|
596703
|
-
const sourcePath =
|
|
596935
|
+
const sourcePath = resolve50(path);
|
|
596704
596936
|
const validation = await validateNativePlugin(sourcePath);
|
|
596705
596937
|
if (!validation.plugin)
|
|
596706
596938
|
throw new Error(validation.diagnostics.map((item) => item.message).join("; "));
|
|
@@ -596711,7 +596943,7 @@ function createPluginCommand() {
|
|
|
596711
596943
|
throw new Error(`Explicit approval required: ${missing.join(", ")}`);
|
|
596712
596944
|
const c = await client();
|
|
596713
596945
|
const result = await c.plugins.installLocal({
|
|
596714
|
-
cwd:
|
|
596946
|
+
cwd: resolve50(options.cwd ?? process.cwd()),
|
|
596715
596947
|
sourcePath,
|
|
596716
596948
|
scope: "user",
|
|
596717
596949
|
approvedPermissions: approved,
|
|
@@ -596723,16 +596955,16 @@ function createPluginCommand() {
|
|
|
596723
596955
|
for (const action of ["enable", "disable"])
|
|
596724
596956
|
cmd.command(action).argument("<id>").option("--cwd <path>").action(async (id, options) => {
|
|
596725
596957
|
const c = await client();
|
|
596726
|
-
const input = { cwd:
|
|
596958
|
+
const input = { cwd: resolve50(options.cwd ?? process.cwd()) };
|
|
596727
596959
|
console.log((action === "enable" ? await c.plugins.enable(id, input) : await c.plugins.disable(id, input)).message);
|
|
596728
596960
|
});
|
|
596729
596961
|
cmd.command("uninstall").argument("<id>").option("--cwd <path>").action(async (id, options) => {
|
|
596730
596962
|
const c = await client();
|
|
596731
|
-
console.log((await c.plugins.uninstall(id, { cwd:
|
|
596963
|
+
console.log((await c.plugins.uninstall(id, { cwd: resolve50(options.cwd ?? process.cwd()) })).message);
|
|
596732
596964
|
});
|
|
596733
596965
|
cmd.command("details").argument("<id>").option("--cwd <path>").action(async (id, options) => {
|
|
596734
596966
|
const c = await client();
|
|
596735
|
-
const listed = await c.plugins.list({ cwd:
|
|
596967
|
+
const listed = await c.plugins.list({ cwd: resolve50(options.cwd ?? process.cwd()) });
|
|
596736
596968
|
const plugin = listed.plugins.find((item) => item.identity.id === id);
|
|
596737
596969
|
if (!plugin)
|
|
596738
596970
|
throw new Error(`Plugin not found: ${id}`);
|
|
@@ -596742,8 +596974,8 @@ function createPluginCommand() {
|
|
|
596742
596974
|
const temporaryRoot = await mkdtemp5(join67(tmpdir8(), "vk-plugin-import-"));
|
|
596743
596975
|
const output = join67(temporaryRoot, "native");
|
|
596744
596976
|
try {
|
|
596745
|
-
const { converter } = await createBuiltinConverterRegistry().detect(
|
|
596746
|
-
const inspection = await converter.inspect(
|
|
596977
|
+
const { converter } = await createBuiltinConverterRegistry().detect(resolve50(source), options.from);
|
|
596978
|
+
const inspection = await converter.inspect(resolve50(source));
|
|
596747
596979
|
const plan = await converter.plan(inspection, {});
|
|
596748
596980
|
await converter.convert({ inspection, plan, output, approvals: options.approve });
|
|
596749
596981
|
const validation = await validateNativePlugin(output);
|
|
@@ -596755,7 +596987,7 @@ function createPluginCommand() {
|
|
|
596755
596987
|
throw new Error(`Explicit permission approval required: ${missing.join(", ")}`);
|
|
596756
596988
|
const c = await client();
|
|
596757
596989
|
const result = await c.plugins.installLocal({
|
|
596758
|
-
cwd:
|
|
596990
|
+
cwd: resolve50(options.cwd ?? process.cwd()),
|
|
596759
596991
|
sourcePath: output,
|
|
596760
596992
|
scope: "user",
|
|
596761
596993
|
approvedPermissions: requested
|
|
@@ -596767,8 +596999,8 @@ function createPluginCommand() {
|
|
|
596767
596999
|
});
|
|
596768
597000
|
cmd.command("convert").argument("<source>").option("--from <converter>", "source converter: claude-code or codex").option("--output <path>").option("--dry-run").option("--json").option("--approve <item>", "approve a conversion change, omitted component, or permission shown in the plan", collect2, []).action(async (source, options) => {
|
|
596769
597001
|
const registry = createBuiltinConverterRegistry();
|
|
596770
|
-
const { converter, detection } = await registry.detect(
|
|
596771
|
-
const inspection = await converter.inspect(
|
|
597002
|
+
const { converter, detection } = await registry.detect(resolve50(source), options.from);
|
|
597003
|
+
const inspection = await converter.inspect(resolve50(source));
|
|
596772
597004
|
const plan = await converter.plan(inspection, {});
|
|
596773
597005
|
if (options.dryRun) {
|
|
596774
597006
|
console.log(options.json ? JSON.stringify({ detection, inspection, plan }, null, 2) : formatConversionPlan(plan));
|
|
@@ -596776,7 +597008,7 @@ function createPluginCommand() {
|
|
|
596776
597008
|
}
|
|
596777
597009
|
if (!options.output)
|
|
596778
597010
|
throw new Error("--output is required unless --dry-run is used");
|
|
596779
|
-
const report = await converter.convert({ inspection, plan, output:
|
|
597011
|
+
const report = await converter.convert({ inspection, plan, output: resolve50(options.output), approvals: options.approve });
|
|
596780
597012
|
console.log(options.json ? JSON.stringify(report, null, 2) : `Converted ${inspection.identity.id}: ${report.status}`);
|
|
596781
597013
|
});
|
|
596782
597014
|
return cmd;
|
|
@@ -597633,7 +597865,7 @@ function createSandboxCommand() {
|
|
|
597633
597865
|
init_src3();
|
|
597634
597866
|
init_src8();
|
|
597635
597867
|
import { readFileSync as readFileSync20 } from "node:fs";
|
|
597636
|
-
import { resolve as
|
|
597868
|
+
import { resolve as resolve51 } from "node:path";
|
|
597637
597869
|
import { Command as Command8 } from "commander";
|
|
597638
597870
|
function createWorkflowCommand() {
|
|
597639
597871
|
const cmd = new Command8("workflow").description("Inspect and manage persisted workflow runs");
|
|
@@ -597790,7 +598022,7 @@ function readJsonOption(path, inlineJson) {
|
|
|
597790
598022
|
if (inlineJson)
|
|
597791
598023
|
return JSON.parse(inlineJson);
|
|
597792
598024
|
if (path)
|
|
597793
|
-
return JSON.parse(readFileSync20(
|
|
598025
|
+
return JSON.parse(readFileSync20(resolve51(path), "utf-8"));
|
|
597794
598026
|
return;
|
|
597795
598027
|
}
|
|
597796
598028
|
function parseCsv(value) {
|
|
@@ -598455,4 +598687,4 @@ program.command("doctor").description("Check environment and dependencies").acti
|
|
|
598455
598687
|
});
|
|
598456
598688
|
program.parse();
|
|
598457
598689
|
|
|
598458
|
-
//# debugId=
|
|
598690
|
+
//# debugId=9BF2C780A92CFF3164756E2164756E21
|