agentv 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -20
- package/dist/{chunk-EJTXU5JO.js → chunk-N7M3URIJ.js} +399 -368
- package/dist/chunk-N7M3URIJ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/.claude/skills/agentv-eval-builder/SKILL.md +1 -1
- package/package.json +1 -1
- package/dist/chunk-EJTXU5JO.js.map +0 -1
|
@@ -155,7 +155,7 @@ import { access as access6, mkdir as mkdir7 } from "node:fs/promises";
|
|
|
155
155
|
import path18 from "node:path";
|
|
156
156
|
import { pathToFileURL } from "node:url";
|
|
157
157
|
|
|
158
|
-
// ../../packages/core/dist/chunk-
|
|
158
|
+
// ../../packages/core/dist/chunk-SVY324GN.js
|
|
159
159
|
import { constants } from "node:fs";
|
|
160
160
|
import { access, readFile } from "node:fs/promises";
|
|
161
161
|
import path from "node:path";
|
|
@@ -4201,7 +4201,7 @@ var coerce = {
|
|
|
4201
4201
|
};
|
|
4202
4202
|
var NEVER = INVALID;
|
|
4203
4203
|
|
|
4204
|
-
// ../../packages/core/dist/chunk-
|
|
4204
|
+
// ../../packages/core/dist/chunk-SVY324GN.js
|
|
4205
4205
|
async function fileExists(filePath) {
|
|
4206
4206
|
try {
|
|
4207
4207
|
await access(filePath, constants.F_OK);
|
|
@@ -32488,14 +32488,14 @@ import { promisify as promisify22 } from "node:util";
|
|
|
32488
32488
|
import path82 from "node:path";
|
|
32489
32489
|
import path102 from "node:path";
|
|
32490
32490
|
|
|
32491
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32492
|
-
import { stat as stat3, writeFile as writeFile3 } from "fs/promises";
|
|
32493
|
-
import path10 from "path";
|
|
32491
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/agentDispatch.js
|
|
32492
|
+
import { stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
|
|
32493
|
+
import path10 from "node:path";
|
|
32494
32494
|
|
|
32495
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32496
|
-
import { constants as constants2 } from "fs";
|
|
32497
|
-
import { access as access2, mkdir, readdir, rm, stat } from "fs/promises";
|
|
32498
|
-
import path2 from "path";
|
|
32495
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/fs.js
|
|
32496
|
+
import { constants as constants2 } from "node:fs";
|
|
32497
|
+
import { access as access2, mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
32498
|
+
import path2 from "node:path";
|
|
32499
32499
|
async function pathExists(target) {
|
|
32500
32500
|
try {
|
|
32501
32501
|
await access2(target, constants2.F_OK);
|
|
@@ -32525,8 +32525,8 @@ async function removeIfExists(target) {
|
|
|
32525
32525
|
}
|
|
32526
32526
|
}
|
|
32527
32527
|
|
|
32528
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32529
|
-
import path3 from "path";
|
|
32528
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/path.js
|
|
32529
|
+
import path3 from "node:path";
|
|
32530
32530
|
function pathToFileUri(filePath) {
|
|
32531
32531
|
const absolutePath = path3.isAbsolute(filePath) ? filePath : path3.resolve(filePath);
|
|
32532
32532
|
const normalizedPath = absolutePath.replace(/\\/g, "/");
|
|
@@ -32536,23 +32536,333 @@ function pathToFileUri(filePath) {
|
|
|
32536
32536
|
return `file://${normalizedPath}`;
|
|
32537
32537
|
}
|
|
32538
32538
|
|
|
32539
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32540
|
-
import {
|
|
32541
|
-
import
|
|
32539
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/promptBuilder.js
|
|
32540
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
32541
|
+
import path4 from "node:path";
|
|
32542
32542
|
|
|
32543
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32544
|
-
|
|
32545
|
-
|
|
32543
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/template.js
|
|
32544
|
+
function renderTemplate(content, variables) {
|
|
32545
|
+
if (!content) {
|
|
32546
|
+
return content;
|
|
32547
|
+
}
|
|
32548
|
+
const variableLookup = /* @__PURE__ */ new Map();
|
|
32549
|
+
for (const [key2, value] of Object.entries(variables)) {
|
|
32550
|
+
variableLookup.set(key2.toLowerCase(), value);
|
|
32551
|
+
}
|
|
32552
|
+
const referencedVariables = /* @__PURE__ */ new Set();
|
|
32553
|
+
const result = content.replace(/\{\{([a-zA-Z_]+)\}\}/gi, (match, variableName) => {
|
|
32554
|
+
const lowerCaseKey = variableName.toLowerCase();
|
|
32555
|
+
referencedVariables.add(lowerCaseKey);
|
|
32556
|
+
if (!variableLookup.has(lowerCaseKey)) {
|
|
32557
|
+
throw new Error(`Template variable '${variableName}' is not provided in the variables object`);
|
|
32558
|
+
}
|
|
32559
|
+
return variableLookup.get(lowerCaseKey);
|
|
32560
|
+
});
|
|
32561
|
+
return result;
|
|
32562
|
+
}
|
|
32563
|
+
|
|
32564
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/templates.js
|
|
32565
|
+
var DEFAULT_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
32566
|
+
|
|
32567
|
+
**IMPORTANT**: Follow these exact steps:
|
|
32568
|
+
1. Create and write your complete response to: {{responseFileTmp}}
|
|
32569
|
+
2. When completely finished, run these PowerShell commands to signal completion:
|
|
32570
|
+
\`\`\`
|
|
32571
|
+
Move-Item -LiteralPath '{{responseFileTmp}}' -Destination '{{responseFileFinal}}'
|
|
32572
|
+
if (Test-Path subagent.lock) { del subagent.lock }
|
|
32573
|
+
\`\`\`
|
|
32574
|
+
|
|
32575
|
+
Do not proceed to step 2 until your response is completely written to the temporary file.
|
|
32576
|
+
|
|
32577
|
+
[[ ## task ## ]]
|
|
32578
|
+
|
|
32579
|
+
{{userQuery}}
|
|
32580
|
+
`;
|
|
32581
|
+
var DEFAULT_BATCH_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
32582
|
+
|
|
32583
|
+
**IMPORTANT**: Follow these exact steps:
|
|
32584
|
+
1. Create and write your complete response to: {{responseFileTmp}}
|
|
32585
|
+
2. When completely finished and the response is stable, rename it to: {{responseFileFinal}}
|
|
32586
|
+
5. Do not unlock the workspace from this request; batch orchestration will handle unlocking after all responses are ready.
|
|
32587
|
+
|
|
32588
|
+
[[ ## task ## ]]
|
|
32589
|
+
|
|
32590
|
+
{{userQuery}}
|
|
32591
|
+
`;
|
|
32592
|
+
var DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE = `MANDATORY: Run #runSubagent tool in your Available Actions for each request file to process them in isolated contexts.
|
|
32593
|
+
DO NOT read the request files yourself - only pass the file paths to each subagent:
|
|
32594
|
+
|
|
32595
|
+
{{requestFiles}}
|
|
32596
|
+
|
|
32597
|
+
After ALL queries complete, verify all responses exist and unlock:
|
|
32598
|
+
|
|
32599
|
+
\`\`\`powershell
|
|
32600
|
+
$responses = @({{responseList}})
|
|
32601
|
+
$missing = $responses | Where-Object { -not (Test-Path "messages/$_") }
|
|
32602
|
+
if ($missing.Count -eq 0) { del subagent.lock }
|
|
32603
|
+
\`\`\`
|
|
32604
|
+
`;
|
|
32605
|
+
|
|
32606
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/promptBuilder.js
|
|
32607
|
+
async function loadTemplateFile(filePath) {
|
|
32608
|
+
try {
|
|
32609
|
+
return await readFile2(filePath, "utf8");
|
|
32610
|
+
} catch (error40) {
|
|
32611
|
+
throw new Error(`Failed to load template file '${filePath}': ${error40.message}`);
|
|
32612
|
+
}
|
|
32613
|
+
}
|
|
32614
|
+
function loadDefaultRequestTemplate() {
|
|
32615
|
+
return DEFAULT_REQUEST_TEMPLATE;
|
|
32616
|
+
}
|
|
32617
|
+
function loadDefaultBatchRequestTemplate() {
|
|
32618
|
+
return DEFAULT_BATCH_REQUEST_TEMPLATE;
|
|
32619
|
+
}
|
|
32620
|
+
function loadDefaultBatchOrchestratorTemplate() {
|
|
32621
|
+
return DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE;
|
|
32622
|
+
}
|
|
32623
|
+
function createRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
|
|
32624
|
+
return renderTemplate(templateContent, {
|
|
32625
|
+
userQuery,
|
|
32626
|
+
responseFileTmp,
|
|
32627
|
+
responseFileFinal
|
|
32628
|
+
});
|
|
32629
|
+
}
|
|
32630
|
+
function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
|
|
32631
|
+
return renderTemplate(templateContent, {
|
|
32632
|
+
userQuery,
|
|
32633
|
+
responseFileTmp,
|
|
32634
|
+
responseFileFinal
|
|
32635
|
+
});
|
|
32636
|
+
}
|
|
32637
|
+
function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
|
|
32638
|
+
const requestLines = requestFiles.map((file2, index) => `${index + 1}. messages/${path4.basename(file2)}`).join("\n");
|
|
32639
|
+
const responseList = responseFiles.map((file2) => `"${path4.basename(file2)}"`).join(", ");
|
|
32640
|
+
return renderTemplate(templateContent, {
|
|
32641
|
+
requestFiles: requestLines,
|
|
32642
|
+
responseList
|
|
32643
|
+
});
|
|
32644
|
+
}
|
|
32645
|
+
|
|
32646
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/responseWaiter.js
|
|
32647
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
32648
|
+
import path5 from "node:path";
|
|
32649
|
+
|
|
32650
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/time.js
|
|
32651
|
+
function sleep(ms) {
|
|
32652
|
+
return new Promise((resolve2) => {
|
|
32653
|
+
setTimeout(resolve2, ms);
|
|
32654
|
+
});
|
|
32655
|
+
}
|
|
32656
|
+
|
|
32657
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/responseWaiter.js
|
|
32658
|
+
async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, silent = false) {
|
|
32659
|
+
if (!silent) {
|
|
32660
|
+
console.error(`waiting for agent to finish: ${responseFileFinal}`);
|
|
32661
|
+
}
|
|
32662
|
+
try {
|
|
32663
|
+
while (!await pathExists(responseFileFinal)) {
|
|
32664
|
+
await sleep(pollInterval);
|
|
32665
|
+
}
|
|
32666
|
+
} catch (error40) {
|
|
32667
|
+
if (error40.code === "ENOENT") {
|
|
32668
|
+
return false;
|
|
32669
|
+
}
|
|
32670
|
+
throw error40;
|
|
32671
|
+
}
|
|
32672
|
+
let attempts = 0;
|
|
32673
|
+
const maxAttempts = 10;
|
|
32674
|
+
while (attempts < maxAttempts) {
|
|
32675
|
+
try {
|
|
32676
|
+
const content = await readFile3(responseFileFinal, { encoding: "utf8" });
|
|
32677
|
+
if (!silent) {
|
|
32678
|
+
process.stdout.write(`${content}
|
|
32679
|
+
`);
|
|
32680
|
+
}
|
|
32681
|
+
return true;
|
|
32682
|
+
} catch (error40) {
|
|
32683
|
+
attempts += 1;
|
|
32684
|
+
if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
|
|
32685
|
+
if (!silent) {
|
|
32686
|
+
console.error(`error: failed to read agent response: ${error40.message}`);
|
|
32687
|
+
}
|
|
32688
|
+
return false;
|
|
32689
|
+
}
|
|
32690
|
+
await sleep(pollInterval);
|
|
32691
|
+
}
|
|
32692
|
+
}
|
|
32693
|
+
return false;
|
|
32694
|
+
}
|
|
32695
|
+
async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false) {
|
|
32696
|
+
if (!silent) {
|
|
32697
|
+
const fileList = responseFilesFinal.map((file2) => path5.basename(file2)).join(", ");
|
|
32698
|
+
console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
|
|
32699
|
+
}
|
|
32700
|
+
try {
|
|
32701
|
+
const pending = new Set(responseFilesFinal);
|
|
32702
|
+
while (pending.size > 0) {
|
|
32703
|
+
for (const file2 of [...pending]) {
|
|
32704
|
+
if (await pathExists(file2)) {
|
|
32705
|
+
pending.delete(file2);
|
|
32706
|
+
}
|
|
32707
|
+
}
|
|
32708
|
+
if (pending.size > 0) {
|
|
32709
|
+
await sleep(pollInterval);
|
|
32710
|
+
}
|
|
32711
|
+
}
|
|
32712
|
+
} catch (error40) {
|
|
32713
|
+
if (error40.code === "ENOENT") {
|
|
32714
|
+
return false;
|
|
32715
|
+
}
|
|
32716
|
+
throw error40;
|
|
32717
|
+
}
|
|
32718
|
+
for (const file2 of responseFilesFinal) {
|
|
32719
|
+
let attempts = 0;
|
|
32720
|
+
const maxAttempts = 10;
|
|
32721
|
+
while (attempts < maxAttempts) {
|
|
32722
|
+
try {
|
|
32723
|
+
const content = await readFile3(file2, { encoding: "utf8" });
|
|
32724
|
+
if (!silent) {
|
|
32725
|
+
process.stdout.write(`${content}
|
|
32726
|
+
`);
|
|
32727
|
+
}
|
|
32728
|
+
break;
|
|
32729
|
+
} catch (error40) {
|
|
32730
|
+
attempts += 1;
|
|
32731
|
+
if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
|
|
32732
|
+
if (!silent) {
|
|
32733
|
+
console.error(`error: failed to read agent response: ${error40.message}`);
|
|
32734
|
+
}
|
|
32735
|
+
return false;
|
|
32736
|
+
}
|
|
32737
|
+
await sleep(pollInterval);
|
|
32738
|
+
}
|
|
32739
|
+
}
|
|
32740
|
+
}
|
|
32741
|
+
return true;
|
|
32742
|
+
}
|
|
32743
|
+
|
|
32744
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/vscodeProcess.js
|
|
32745
|
+
import { exec, spawn } from "node:child_process";
|
|
32746
|
+
import { mkdir as mkdir2, writeFile } from "node:fs/promises";
|
|
32747
|
+
import path7 from "node:path";
|
|
32748
|
+
import { promisify } from "node:util";
|
|
32749
|
+
|
|
32750
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/constants.js
|
|
32751
|
+
import os from "node:os";
|
|
32752
|
+
import path6 from "node:path";
|
|
32546
32753
|
var DEFAULT_LOCK_NAME = "subagent.lock";
|
|
32547
32754
|
var DEFAULT_ALIVE_FILENAME = ".alive";
|
|
32548
32755
|
function getDefaultSubagentRoot(vscodeCmd = "code") {
|
|
32549
32756
|
const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
|
|
32550
|
-
return
|
|
32757
|
+
return path6.join(os.homedir(), ".subagent", folder);
|
|
32551
32758
|
}
|
|
32552
32759
|
var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
|
|
32553
32760
|
|
|
32554
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
32555
|
-
|
|
32761
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/vscodeProcess.js
|
|
32762
|
+
var execAsync = promisify(exec);
|
|
32763
|
+
var DEFAULT_WAKEUP_CONTENT = `---
|
|
32764
|
+
description: 'Wake-up Signal'
|
|
32765
|
+
model: Grok Code Fast 1 (copilot)
|
|
32766
|
+
---`;
|
|
32767
|
+
async function checkWorkspaceOpened(workspaceName, vscodeCmd) {
|
|
32768
|
+
try {
|
|
32769
|
+
const { stdout } = await execAsync(`${vscodeCmd} --status`, {
|
|
32770
|
+
timeout: 1e4,
|
|
32771
|
+
windowsHide: true
|
|
32772
|
+
});
|
|
32773
|
+
return stdout.includes(workspaceName);
|
|
32774
|
+
} catch {
|
|
32775
|
+
return false;
|
|
32776
|
+
}
|
|
32777
|
+
}
|
|
32778
|
+
async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir, vscodeCmd, pollInterval = 1, timeout = 60) {
|
|
32779
|
+
const alreadyOpen = await checkWorkspaceOpened(workspaceName, vscodeCmd);
|
|
32780
|
+
if (alreadyOpen) {
|
|
32781
|
+
spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
|
|
32782
|
+
return true;
|
|
32783
|
+
}
|
|
32784
|
+
const aliveFile = path7.join(subagentDir, DEFAULT_ALIVE_FILENAME);
|
|
32785
|
+
await removeIfExists(aliveFile);
|
|
32786
|
+
const githubAgentsDir = path7.join(subagentDir, ".github", "agents");
|
|
32787
|
+
await mkdir2(githubAgentsDir, { recursive: true });
|
|
32788
|
+
const wakeupDst = path7.join(githubAgentsDir, "wakeup.md");
|
|
32789
|
+
await writeFile(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
|
|
32790
|
+
spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
|
|
32791
|
+
await sleep(100);
|
|
32792
|
+
const wakeupChatId = "wakeup";
|
|
32793
|
+
const chatArgs = [
|
|
32794
|
+
"-r",
|
|
32795
|
+
"chat",
|
|
32796
|
+
"-m",
|
|
32797
|
+
wakeupChatId,
|
|
32798
|
+
`create a file named .alive in the ${path7.basename(subagentDir)} folder`
|
|
32799
|
+
];
|
|
32800
|
+
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
32801
|
+
const start = Date.now();
|
|
32802
|
+
while (!await pathExists(aliveFile)) {
|
|
32803
|
+
if (Date.now() - start > timeout * 1e3) {
|
|
32804
|
+
console.error(`warning: Workspace readiness timeout after ${timeout}s`);
|
|
32805
|
+
return false;
|
|
32806
|
+
}
|
|
32807
|
+
await sleep(pollInterval * 1e3);
|
|
32808
|
+
}
|
|
32809
|
+
return true;
|
|
32810
|
+
}
|
|
32811
|
+
async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
|
|
32812
|
+
try {
|
|
32813
|
+
const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
|
|
32814
|
+
const messagesDir = path7.join(subagentDir, "messages");
|
|
32815
|
+
await mkdir2(messagesDir, { recursive: true });
|
|
32816
|
+
const reqFile = path7.join(messagesDir, `${timestamp}_req.md`);
|
|
32817
|
+
await writeFile(reqFile, requestInstructions, { encoding: "utf8" });
|
|
32818
|
+
const reqUri = pathToFileUri(reqFile);
|
|
32819
|
+
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
32820
|
+
for (const attachment of attachmentPaths) {
|
|
32821
|
+
chatArgs.push("-a", attachment);
|
|
32822
|
+
}
|
|
32823
|
+
chatArgs.push("-a", reqFile);
|
|
32824
|
+
chatArgs.push(`Follow instructions in [${path7.basename(reqFile)}](${reqUri})`);
|
|
32825
|
+
const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
|
|
32826
|
+
if (!workspaceReady) {
|
|
32827
|
+
console.error("warning: Workspace may not be fully ready");
|
|
32828
|
+
}
|
|
32829
|
+
await sleep(500);
|
|
32830
|
+
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
32831
|
+
return true;
|
|
32832
|
+
} catch (error40) {
|
|
32833
|
+
console.error(`warning: Failed to launch VS Code: ${error40.message}`);
|
|
32834
|
+
return false;
|
|
32835
|
+
}
|
|
32836
|
+
}
|
|
32837
|
+
async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
|
|
32838
|
+
try {
|
|
32839
|
+
const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
|
|
32840
|
+
const messagesDir = path7.join(subagentDir, "messages");
|
|
32841
|
+
await mkdir2(messagesDir, { recursive: true });
|
|
32842
|
+
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
32843
|
+
for (const attachment of attachmentPaths) {
|
|
32844
|
+
chatArgs.push("-a", attachment);
|
|
32845
|
+
}
|
|
32846
|
+
chatArgs.push(chatInstruction);
|
|
32847
|
+
const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
|
|
32848
|
+
if (!workspaceReady) {
|
|
32849
|
+
console.error("warning: Workspace may not be fully ready");
|
|
32850
|
+
}
|
|
32851
|
+
await sleep(500);
|
|
32852
|
+
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
32853
|
+
return true;
|
|
32854
|
+
} catch (error40) {
|
|
32855
|
+
console.error(`warning: Failed to launch VS Code: ${error40.message}`);
|
|
32856
|
+
return false;
|
|
32857
|
+
}
|
|
32858
|
+
}
|
|
32859
|
+
|
|
32860
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/workspaceManager.js
|
|
32861
|
+
import { copyFile, mkdir as mkdir3, readFile as readFile4, readdir as readdir2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
|
|
32862
|
+
import path9 from "node:path";
|
|
32863
|
+
|
|
32864
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/workspace.js
|
|
32865
|
+
import path8 from "node:path";
|
|
32556
32866
|
|
|
32557
32867
|
// ../../node_modules/.bun/json5@2.2.3/node_modules/json5/dist/index.mjs
|
|
32558
32868
|
var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
@@ -33639,7 +33949,7 @@ var JSON5 = {
|
|
|
33639
33949
|
var lib = JSON5;
|
|
33640
33950
|
var dist_default = lib;
|
|
33641
33951
|
|
|
33642
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
33952
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/utils/workspace.js
|
|
33643
33953
|
function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
33644
33954
|
let workspace;
|
|
33645
33955
|
try {
|
|
@@ -33655,19 +33965,16 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
33655
33965
|
}
|
|
33656
33966
|
const transformedFolders = workspace.folders.map((folder) => {
|
|
33657
33967
|
const folderPath = folder.path;
|
|
33658
|
-
if (
|
|
33968
|
+
if (path8.isAbsolute(folderPath)) {
|
|
33659
33969
|
return folder;
|
|
33660
33970
|
}
|
|
33661
|
-
const absolutePath =
|
|
33971
|
+
const absolutePath = path8.resolve(templateDir, folderPath);
|
|
33662
33972
|
return {
|
|
33663
33973
|
...folder,
|
|
33664
33974
|
path: absolutePath
|
|
33665
33975
|
};
|
|
33666
33976
|
});
|
|
33667
|
-
const updatedFolders = [
|
|
33668
|
-
{ path: "." },
|
|
33669
|
-
...transformedFolders
|
|
33670
|
-
];
|
|
33977
|
+
const updatedFolders = [{ path: "." }, ...transformedFolders];
|
|
33671
33978
|
let transformedSettings = workspace.settings;
|
|
33672
33979
|
if (workspace.settings) {
|
|
33673
33980
|
transformedSettings = {
|
|
@@ -33683,19 +33990,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
33683
33990
|
if (locationMap && typeof locationMap === "object") {
|
|
33684
33991
|
const transformedMap = {};
|
|
33685
33992
|
for (const [locationPath, value] of Object.entries(locationMap)) {
|
|
33686
|
-
const isAbsolute =
|
|
33993
|
+
const isAbsolute = path8.isAbsolute(locationPath);
|
|
33687
33994
|
if (isAbsolute) {
|
|
33688
33995
|
transformedMap[locationPath] = value;
|
|
33689
33996
|
} else {
|
|
33690
33997
|
const firstGlobIndex = locationPath.search(/[*]/);
|
|
33691
33998
|
if (firstGlobIndex === -1) {
|
|
33692
|
-
const resolvedPath =
|
|
33999
|
+
const resolvedPath = path8.resolve(templateDir, locationPath).replace(/\\/g, "/");
|
|
33693
34000
|
transformedMap[resolvedPath] = value;
|
|
33694
34001
|
} else {
|
|
33695
34002
|
const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
|
|
33696
34003
|
const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
|
|
33697
34004
|
const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
|
|
33698
|
-
const resolvedPath = (
|
|
34005
|
+
const resolvedPath = (path8.resolve(templateDir, basePath) + patternPath).replace(/\\/g, "/");
|
|
33699
34006
|
transformedMap[resolvedPath] = value;
|
|
33700
34007
|
}
|
|
33701
34008
|
}
|
|
@@ -33712,7 +34019,7 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
33712
34019
|
return JSON.stringify(transformedWorkspace, null, 2);
|
|
33713
34020
|
}
|
|
33714
34021
|
|
|
33715
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
34022
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/workspaceManager.js
|
|
33716
34023
|
var DEFAULT_WORKSPACE_TEMPLATE = {
|
|
33717
34024
|
folders: [
|
|
33718
34025
|
{
|
|
@@ -33733,7 +34040,7 @@ async function findUnlockedSubagent(subagentRoot) {
|
|
|
33733
34040
|
number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
|
|
33734
34041
|
})).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
|
|
33735
34042
|
for (const subagent of subagents) {
|
|
33736
|
-
const lockFile =
|
|
34043
|
+
const lockFile = path9.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
|
|
33737
34044
|
if (!await pathExists(lockFile)) {
|
|
33738
34045
|
return subagent.absolutePath;
|
|
33739
34046
|
}
|
|
@@ -33743,7 +34050,7 @@ async function findUnlockedSubagent(subagentRoot) {
|
|
|
33743
34050
|
async function copyAgentConfig(subagentDir, workspaceTemplate) {
|
|
33744
34051
|
let workspaceContent;
|
|
33745
34052
|
if (workspaceTemplate) {
|
|
33746
|
-
const workspaceSrc =
|
|
34053
|
+
const workspaceSrc = path9.resolve(workspaceTemplate);
|
|
33747
34054
|
if (!await pathExists(workspaceSrc)) {
|
|
33748
34055
|
throw new Error(`workspace template not found: ${workspaceSrc}`);
|
|
33749
34056
|
}
|
|
@@ -33751,42 +34058,42 @@ async function copyAgentConfig(subagentDir, workspaceTemplate) {
|
|
|
33751
34058
|
if (!stats.isFile()) {
|
|
33752
34059
|
throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
|
|
33753
34060
|
}
|
|
33754
|
-
const templateText = await
|
|
34061
|
+
const templateText = await readFile4(workspaceSrc, "utf8");
|
|
33755
34062
|
workspaceContent = JSON.parse(templateText);
|
|
33756
34063
|
} else {
|
|
33757
34064
|
workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
|
|
33758
34065
|
}
|
|
33759
|
-
const workspaceName = `${
|
|
33760
|
-
const workspaceDst =
|
|
33761
|
-
const templateDir = workspaceTemplate ?
|
|
34066
|
+
const workspaceName = `${path9.basename(subagentDir)}.code-workspace`;
|
|
34067
|
+
const workspaceDst = path9.join(subagentDir, workspaceName);
|
|
34068
|
+
const templateDir = workspaceTemplate ? path9.dirname(path9.resolve(workspaceTemplate)) : subagentDir;
|
|
33762
34069
|
const workspaceJson = JSON.stringify(workspaceContent, null, 2);
|
|
33763
34070
|
const transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
|
|
33764
|
-
await
|
|
33765
|
-
const messagesDir =
|
|
33766
|
-
await
|
|
34071
|
+
await writeFile2(workspaceDst, transformedContent, "utf8");
|
|
34072
|
+
const messagesDir = path9.join(subagentDir, "messages");
|
|
34073
|
+
await mkdir3(messagesDir, { recursive: true });
|
|
33767
34074
|
return { workspace: workspaceDst, messagesDir };
|
|
33768
34075
|
}
|
|
33769
34076
|
async function createSubagentLock(subagentDir) {
|
|
33770
|
-
const messagesDir =
|
|
34077
|
+
const messagesDir = path9.join(subagentDir, "messages");
|
|
33771
34078
|
if (await pathExists(messagesDir)) {
|
|
33772
34079
|
const files = await readdir2(messagesDir);
|
|
33773
34080
|
await Promise.all(files.map(async (file2) => {
|
|
33774
|
-
const target =
|
|
34081
|
+
const target = path9.join(messagesDir, file2);
|
|
33775
34082
|
await removeIfExists(target);
|
|
33776
34083
|
}));
|
|
33777
34084
|
}
|
|
33778
|
-
const githubAgentsDir =
|
|
34085
|
+
const githubAgentsDir = path9.join(subagentDir, ".github", "agents");
|
|
33779
34086
|
if (await pathExists(githubAgentsDir)) {
|
|
33780
34087
|
const agentFiles = await readdir2(githubAgentsDir);
|
|
33781
34088
|
const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
|
|
33782
|
-
await Promise.all(agentFiles.filter((file2) => file2.endsWith(".md") && !preservedFiles.has(file2)).map((file2) => removeIfExists(
|
|
34089
|
+
await Promise.all(agentFiles.filter((file2) => file2.endsWith(".md") && !preservedFiles.has(file2)).map((file2) => removeIfExists(path9.join(githubAgentsDir, file2))));
|
|
33783
34090
|
}
|
|
33784
|
-
const lockFile =
|
|
33785
|
-
await
|
|
34091
|
+
const lockFile = path9.join(subagentDir, DEFAULT_LOCK_NAME);
|
|
34092
|
+
await writeFile2(lockFile, "", { encoding: "utf8" });
|
|
33786
34093
|
return lockFile;
|
|
33787
34094
|
}
|
|
33788
34095
|
async function removeSubagentLock(subagentDir) {
|
|
33789
|
-
const lockFile =
|
|
34096
|
+
const lockFile = path9.join(subagentDir, DEFAULT_LOCK_NAME);
|
|
33790
34097
|
await removeIfExists(lockFile);
|
|
33791
34098
|
}
|
|
33792
34099
|
async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun) {
|
|
@@ -33806,9 +34113,9 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
|
|
|
33806
34113
|
return 1;
|
|
33807
34114
|
}
|
|
33808
34115
|
if (promptFile) {
|
|
33809
|
-
const githubAgentsDir =
|
|
33810
|
-
await
|
|
33811
|
-
const agentFile =
|
|
34116
|
+
const githubAgentsDir = path9.join(subagentDir, ".github", "agents");
|
|
34117
|
+
await mkdir3(githubAgentsDir, { recursive: true });
|
|
34118
|
+
const agentFile = path9.join(githubAgentsDir, `${chatId}.md`);
|
|
33812
34119
|
try {
|
|
33813
34120
|
await copyFile(promptFile, agentFile);
|
|
33814
34121
|
} catch (error40) {
|
|
@@ -33819,320 +34126,7 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
|
|
|
33819
34126
|
return 0;
|
|
33820
34127
|
}
|
|
33821
34128
|
|
|
33822
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
33823
|
-
import { exec, spawn } from "child_process";
|
|
33824
|
-
import { mkdir as mkdir3, writeFile as writeFile2 } from "fs/promises";
|
|
33825
|
-
import path7 from "path";
|
|
33826
|
-
import { promisify } from "util";
|
|
33827
|
-
|
|
33828
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/utils/time.js
|
|
33829
|
-
function sleep(ms) {
|
|
33830
|
-
return new Promise((resolve2) => {
|
|
33831
|
-
setTimeout(resolve2, ms);
|
|
33832
|
-
});
|
|
33833
|
-
}
|
|
33834
|
-
|
|
33835
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/vscodeProcess.js
|
|
33836
|
-
var execAsync = promisify(exec);
|
|
33837
|
-
var DEFAULT_WAKEUP_CONTENT = `---
|
|
33838
|
-
description: 'Wake-up Signal'
|
|
33839
|
-
model: Grok Code Fast 1 (copilot)
|
|
33840
|
-
---`;
|
|
33841
|
-
async function checkWorkspaceOpened(workspaceName, vscodeCmd) {
|
|
33842
|
-
try {
|
|
33843
|
-
const { stdout } = await execAsync(`${vscodeCmd} --status`, { timeout: 1e4, windowsHide: true });
|
|
33844
|
-
return stdout.includes(workspaceName);
|
|
33845
|
-
} catch {
|
|
33846
|
-
return false;
|
|
33847
|
-
}
|
|
33848
|
-
}
|
|
33849
|
-
async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir, vscodeCmd, pollInterval = 1, timeout = 60) {
|
|
33850
|
-
const alreadyOpen = await checkWorkspaceOpened(workspaceName, vscodeCmd);
|
|
33851
|
-
if (alreadyOpen) {
|
|
33852
|
-
spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
|
|
33853
|
-
return true;
|
|
33854
|
-
}
|
|
33855
|
-
const aliveFile = path7.join(subagentDir, DEFAULT_ALIVE_FILENAME);
|
|
33856
|
-
await removeIfExists(aliveFile);
|
|
33857
|
-
const githubAgentsDir = path7.join(subagentDir, ".github", "agents");
|
|
33858
|
-
await mkdir3(githubAgentsDir, { recursive: true });
|
|
33859
|
-
const wakeupDst = path7.join(githubAgentsDir, "wakeup.md");
|
|
33860
|
-
await writeFile2(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
|
|
33861
|
-
spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
|
|
33862
|
-
await sleep(100);
|
|
33863
|
-
const wakeupChatId = "wakeup";
|
|
33864
|
-
const chatArgs = [
|
|
33865
|
-
"-r",
|
|
33866
|
-
"chat",
|
|
33867
|
-
"-m",
|
|
33868
|
-
wakeupChatId,
|
|
33869
|
-
`create a file named .alive in the ${path7.basename(subagentDir)} folder`
|
|
33870
|
-
];
|
|
33871
|
-
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
33872
|
-
const start = Date.now();
|
|
33873
|
-
while (!await pathExists(aliveFile)) {
|
|
33874
|
-
if (Date.now() - start > timeout * 1e3) {
|
|
33875
|
-
console.error(`warning: Workspace readiness timeout after ${timeout}s`);
|
|
33876
|
-
return false;
|
|
33877
|
-
}
|
|
33878
|
-
await sleep(pollInterval * 1e3);
|
|
33879
|
-
}
|
|
33880
|
-
return true;
|
|
33881
|
-
}
|
|
33882
|
-
async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
|
|
33883
|
-
try {
|
|
33884
|
-
const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
|
|
33885
|
-
const messagesDir = path7.join(subagentDir, "messages");
|
|
33886
|
-
await mkdir3(messagesDir, { recursive: true });
|
|
33887
|
-
const reqFile = path7.join(messagesDir, `${timestamp}_req.md`);
|
|
33888
|
-
await writeFile2(reqFile, requestInstructions, { encoding: "utf8" });
|
|
33889
|
-
const reqUri = pathToFileUri(reqFile);
|
|
33890
|
-
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
33891
|
-
for (const attachment of attachmentPaths) {
|
|
33892
|
-
chatArgs.push("-a", attachment);
|
|
33893
|
-
}
|
|
33894
|
-
chatArgs.push("-a", reqFile);
|
|
33895
|
-
chatArgs.push(`Follow instructions in [${path7.basename(reqFile)}](${reqUri})`);
|
|
33896
|
-
const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
|
|
33897
|
-
if (!workspaceReady) {
|
|
33898
|
-
console.error("warning: Workspace may not be fully ready");
|
|
33899
|
-
}
|
|
33900
|
-
await sleep(500);
|
|
33901
|
-
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
33902
|
-
return true;
|
|
33903
|
-
} catch (error40) {
|
|
33904
|
-
console.error(`warning: Failed to launch VS Code: ${error40.message}`);
|
|
33905
|
-
return false;
|
|
33906
|
-
}
|
|
33907
|
-
}
|
|
33908
|
-
async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
|
|
33909
|
-
try {
|
|
33910
|
-
const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
|
|
33911
|
-
const messagesDir = path7.join(subagentDir, "messages");
|
|
33912
|
-
await mkdir3(messagesDir, { recursive: true });
|
|
33913
|
-
const chatArgs = ["-r", "chat", "-m", chatId];
|
|
33914
|
-
for (const attachment of attachmentPaths) {
|
|
33915
|
-
chatArgs.push("-a", attachment);
|
|
33916
|
-
}
|
|
33917
|
-
chatArgs.push(chatInstruction);
|
|
33918
|
-
const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
|
|
33919
|
-
if (!workspaceReady) {
|
|
33920
|
-
console.error("warning: Workspace may not be fully ready");
|
|
33921
|
-
}
|
|
33922
|
-
await sleep(500);
|
|
33923
|
-
spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
|
|
33924
|
-
return true;
|
|
33925
|
-
} catch (error40) {
|
|
33926
|
-
console.error(`warning: Failed to launch VS Code: ${error40.message}`);
|
|
33927
|
-
return false;
|
|
33928
|
-
}
|
|
33929
|
-
}
|
|
33930
|
-
|
|
33931
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/promptBuilder.js
|
|
33932
|
-
import { readFile as readFile3 } from "fs/promises";
|
|
33933
|
-
import path8 from "path";
|
|
33934
|
-
|
|
33935
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/utils/template.js
|
|
33936
|
-
function renderTemplate(content, variables) {
|
|
33937
|
-
if (!content) {
|
|
33938
|
-
return content;
|
|
33939
|
-
}
|
|
33940
|
-
const variableLookup = /* @__PURE__ */ new Map();
|
|
33941
|
-
for (const [key2, value] of Object.entries(variables)) {
|
|
33942
|
-
variableLookup.set(key2.toLowerCase(), value);
|
|
33943
|
-
}
|
|
33944
|
-
const referencedVariables = /* @__PURE__ */ new Set();
|
|
33945
|
-
const result = content.replace(/\{\{([a-zA-Z_]+)\}\}/gi, (match, variableName) => {
|
|
33946
|
-
const lowerCaseKey = variableName.toLowerCase();
|
|
33947
|
-
referencedVariables.add(lowerCaseKey);
|
|
33948
|
-
if (!variableLookup.has(lowerCaseKey)) {
|
|
33949
|
-
throw new Error(`Template variable '${variableName}' is not provided in the variables object`);
|
|
33950
|
-
}
|
|
33951
|
-
return variableLookup.get(lowerCaseKey);
|
|
33952
|
-
});
|
|
33953
|
-
return result;
|
|
33954
|
-
}
|
|
33955
|
-
|
|
33956
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/templates.js
|
|
33957
|
-
var DEFAULT_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
33958
|
-
|
|
33959
|
-
**IMPORTANT**: Follow these exact steps:
|
|
33960
|
-
1. Do NOT create any additional output files in the workspace.
|
|
33961
|
-
2. Create and write your complete response to: {{responseFileTmp}}
|
|
33962
|
-
3. All intended file outputs/changes MUST be returned INLINE in your response using \`<file path="..."> ... </file>\` tags. For each file, include either:
|
|
33963
|
-
- the full final file content, OR
|
|
33964
|
-
- a unified git diff (preferred when editing an existing file).
|
|
33965
|
-
4. When completely finished, run these PowerShell commands to signal completion:
|
|
33966
|
-
\`\`\`
|
|
33967
|
-
Move-Item -LiteralPath '{{responseFileTmp}}' -Destination '{{responseFileFinal}}'
|
|
33968
|
-
if (Test-Path subagent.lock) { del subagent.lock }
|
|
33969
|
-
\`\`\`
|
|
33970
|
-
|
|
33971
|
-
Do not proceed to step 2 until your response is completely written to the temporary file.
|
|
33972
|
-
|
|
33973
|
-
[[ ## task ## ]]
|
|
33974
|
-
|
|
33975
|
-
{{userQuery}}
|
|
33976
|
-
`;
|
|
33977
|
-
var DEFAULT_BATCH_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
33978
|
-
|
|
33979
|
-
**IMPORTANT**: Follow these exact steps:
|
|
33980
|
-
1. Do NOT create any additional output files in the workspace.
|
|
33981
|
-
2. Create and write your complete response to: {{responseFileTmp}}
|
|
33982
|
-
3. All intended file outputs/changes MUST be returned INLINE in your response using \`<file path="..."> ... </file>\` tags. For each file, include either:
|
|
33983
|
-
- the full final file content, OR
|
|
33984
|
-
- a unified git diff (preferred when editing an existing file).
|
|
33985
|
-
4. When completely finished and the response is stable, rename it to: {{responseFileFinal}}
|
|
33986
|
-
5. Do not unlock the workspace from this request; batch orchestration will handle unlocking after all responses are ready.
|
|
33987
|
-
|
|
33988
|
-
[[ ## task ## ]]
|
|
33989
|
-
|
|
33990
|
-
{{userQuery}}
|
|
33991
|
-
`;
|
|
33992
|
-
var DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE = `MANDATORY: Run #runSubagent tool in your Available Actions for each request file to process them in isolated contexts.
|
|
33993
|
-
DO NOT read the request files yourself - only pass the file paths to each subagent:
|
|
33994
|
-
|
|
33995
|
-
{{requestFiles}}
|
|
33996
|
-
|
|
33997
|
-
After ALL queries complete, verify all responses exist and unlock:
|
|
33998
|
-
|
|
33999
|
-
\`\`\`powershell
|
|
34000
|
-
$responses = @({{responseList}})
|
|
34001
|
-
$missing = $responses | Where-Object { -not (Test-Path "messages/$_") }
|
|
34002
|
-
if ($missing.Count -eq 0) { del subagent.lock }
|
|
34003
|
-
\`\`\`
|
|
34004
|
-
`;
|
|
34005
|
-
|
|
34006
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/promptBuilder.js
|
|
34007
|
-
async function loadTemplateFile(filePath) {
|
|
34008
|
-
try {
|
|
34009
|
-
return await readFile3(filePath, "utf8");
|
|
34010
|
-
} catch (error40) {
|
|
34011
|
-
throw new Error(`Failed to load template file '${filePath}': ${error40.message}`);
|
|
34012
|
-
}
|
|
34013
|
-
}
|
|
34014
|
-
function loadDefaultRequestTemplate() {
|
|
34015
|
-
return DEFAULT_REQUEST_TEMPLATE;
|
|
34016
|
-
}
|
|
34017
|
-
function loadDefaultBatchRequestTemplate() {
|
|
34018
|
-
return DEFAULT_BATCH_REQUEST_TEMPLATE;
|
|
34019
|
-
}
|
|
34020
|
-
function loadDefaultBatchOrchestratorTemplate() {
|
|
34021
|
-
return DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE;
|
|
34022
|
-
}
|
|
34023
|
-
function createRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
|
|
34024
|
-
return renderTemplate(templateContent, {
|
|
34025
|
-
userQuery,
|
|
34026
|
-
responseFileTmp,
|
|
34027
|
-
responseFileFinal
|
|
34028
|
-
});
|
|
34029
|
-
}
|
|
34030
|
-
function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
|
|
34031
|
-
return renderTemplate(templateContent, {
|
|
34032
|
-
userQuery,
|
|
34033
|
-
responseFileTmp,
|
|
34034
|
-
responseFileFinal
|
|
34035
|
-
});
|
|
34036
|
-
}
|
|
34037
|
-
function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
|
|
34038
|
-
const requestLines = requestFiles.map((file2, index) => `${index + 1}. messages/${path8.basename(file2)}`).join("\n");
|
|
34039
|
-
const responseList = responseFiles.map((file2) => `"${path8.basename(file2)}"`).join(", ");
|
|
34040
|
-
return renderTemplate(templateContent, {
|
|
34041
|
-
requestFiles: requestLines,
|
|
34042
|
-
responseList
|
|
34043
|
-
});
|
|
34044
|
-
}
|
|
34045
|
-
|
|
34046
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/responseWaiter.js
|
|
34047
|
-
import { readFile as readFile4 } from "fs/promises";
|
|
34048
|
-
import path9 from "path";
|
|
34049
|
-
async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, silent = false) {
|
|
34050
|
-
if (!silent) {
|
|
34051
|
-
console.error(`waiting for agent to finish: ${responseFileFinal}`);
|
|
34052
|
-
}
|
|
34053
|
-
try {
|
|
34054
|
-
while (!await pathExists(responseFileFinal)) {
|
|
34055
|
-
await sleep(pollInterval);
|
|
34056
|
-
}
|
|
34057
|
-
} catch (error40) {
|
|
34058
|
-
if (error40.code === "ENOENT") {
|
|
34059
|
-
return false;
|
|
34060
|
-
}
|
|
34061
|
-
throw error40;
|
|
34062
|
-
}
|
|
34063
|
-
let attempts = 0;
|
|
34064
|
-
const maxAttempts = 10;
|
|
34065
|
-
while (attempts < maxAttempts) {
|
|
34066
|
-
try {
|
|
34067
|
-
const content = await readFile4(responseFileFinal, { encoding: "utf8" });
|
|
34068
|
-
if (!silent) {
|
|
34069
|
-
process.stdout.write(`${content}
|
|
34070
|
-
`);
|
|
34071
|
-
}
|
|
34072
|
-
return true;
|
|
34073
|
-
} catch (error40) {
|
|
34074
|
-
attempts += 1;
|
|
34075
|
-
if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
|
|
34076
|
-
if (!silent) {
|
|
34077
|
-
console.error(`error: failed to read agent response: ${error40.message}`);
|
|
34078
|
-
}
|
|
34079
|
-
return false;
|
|
34080
|
-
}
|
|
34081
|
-
await sleep(pollInterval);
|
|
34082
|
-
}
|
|
34083
|
-
}
|
|
34084
|
-
return false;
|
|
34085
|
-
}
|
|
34086
|
-
async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false) {
|
|
34087
|
-
if (!silent) {
|
|
34088
|
-
const fileList = responseFilesFinal.map((file2) => path9.basename(file2)).join(", ");
|
|
34089
|
-
console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
|
|
34090
|
-
}
|
|
34091
|
-
try {
|
|
34092
|
-
const pending = new Set(responseFilesFinal);
|
|
34093
|
-
while (pending.size > 0) {
|
|
34094
|
-
for (const file2 of [...pending]) {
|
|
34095
|
-
if (await pathExists(file2)) {
|
|
34096
|
-
pending.delete(file2);
|
|
34097
|
-
}
|
|
34098
|
-
}
|
|
34099
|
-
if (pending.size > 0) {
|
|
34100
|
-
await sleep(pollInterval);
|
|
34101
|
-
}
|
|
34102
|
-
}
|
|
34103
|
-
} catch (error40) {
|
|
34104
|
-
if (error40.code === "ENOENT") {
|
|
34105
|
-
return false;
|
|
34106
|
-
}
|
|
34107
|
-
throw error40;
|
|
34108
|
-
}
|
|
34109
|
-
for (const file2 of responseFilesFinal) {
|
|
34110
|
-
let attempts = 0;
|
|
34111
|
-
const maxAttempts = 10;
|
|
34112
|
-
while (attempts < maxAttempts) {
|
|
34113
|
-
try {
|
|
34114
|
-
const content = await readFile4(file2, { encoding: "utf8" });
|
|
34115
|
-
if (!silent) {
|
|
34116
|
-
process.stdout.write(`${content}
|
|
34117
|
-
`);
|
|
34118
|
-
}
|
|
34119
|
-
break;
|
|
34120
|
-
} catch (error40) {
|
|
34121
|
-
attempts += 1;
|
|
34122
|
-
if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
|
|
34123
|
-
if (!silent) {
|
|
34124
|
-
console.error(`error: failed to read agent response: ${error40.message}`);
|
|
34125
|
-
}
|
|
34126
|
-
return false;
|
|
34127
|
-
}
|
|
34128
|
-
await sleep(pollInterval);
|
|
34129
|
-
}
|
|
34130
|
-
}
|
|
34131
|
-
}
|
|
34132
|
-
return true;
|
|
34133
|
-
}
|
|
34134
|
-
|
|
34135
|
-
// ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/agentDispatch.js
|
|
34129
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/agentDispatch.js
|
|
34136
34130
|
function generateTimestamp() {
|
|
34137
34131
|
return (/* @__PURE__ */ new Date()).toISOString().replace(/[-:TZ.]/g, "").slice(0, 14);
|
|
34138
34132
|
}
|
|
@@ -34412,9 +34406,9 @@ async function dispatchBatchAgent(options) {
|
|
|
34412
34406
|
}
|
|
34413
34407
|
}
|
|
34414
34408
|
|
|
34415
|
-
// ../../node_modules/.bun/subagent@0.5.
|
|
34416
|
-
import { writeFile as writeFile4 } from "fs/promises";
|
|
34417
|
-
import path11 from "path";
|
|
34409
|
+
// ../../node_modules/.bun/subagent@0.5.5/node_modules/subagent/dist/vscode/provision.js
|
|
34410
|
+
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
34411
|
+
import path11 from "node:path";
|
|
34418
34412
|
var DEFAULT_WORKSPACE_TEMPLATE2 = {
|
|
34419
34413
|
folders: [
|
|
34420
34414
|
{
|
|
@@ -34451,6 +34445,8 @@ async function provisionSubagents(options) {
|
|
|
34451
34445
|
continue;
|
|
34452
34446
|
}
|
|
34453
34447
|
const suffix = entry.name.split("-")[1];
|
|
34448
|
+
if (!suffix)
|
|
34449
|
+
continue;
|
|
34454
34450
|
const parsed = Number.parseInt(suffix, 10);
|
|
34455
34451
|
if (!Number.isInteger(parsed)) {
|
|
34456
34452
|
continue;
|
|
@@ -36936,6 +36932,39 @@ var MockProvider = class {
|
|
|
36936
36932
|
return this.delayMs;
|
|
36937
36933
|
}
|
|
36938
36934
|
};
|
|
36935
|
+
var AGENTV_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
36936
|
+
|
|
36937
|
+
**IMPORTANT**: You are processing an evaluation request from AgentV. Follow these exact steps:
|
|
36938
|
+
|
|
36939
|
+
1. Read and understand all guideline files and attachments provided above
|
|
36940
|
+
2. Process the user query below according to the guidelines
|
|
36941
|
+
3. Write your complete response to: {{responseFileTmp}}
|
|
36942
|
+
4. When completely finished, run these PowerShell commands to signal completion:
|
|
36943
|
+
\`\`\`powershell
|
|
36944
|
+
Move-Item -LiteralPath '{{responseFileTmp}}' -Destination '{{responseFileFinal}}'
|
|
36945
|
+
if (Test-Path subagent.lock) { Remove-Item subagent.lock }
|
|
36946
|
+
\`\`\`
|
|
36947
|
+
|
|
36948
|
+
Do not proceed to step 4 until your response is completely written to the temporary file.
|
|
36949
|
+
|
|
36950
|
+
[[ ## task ## ]]
|
|
36951
|
+
|
|
36952
|
+
{{userQuery}}
|
|
36953
|
+
`;
|
|
36954
|
+
var AGENTV_BATCH_REQUEST_TEMPLATE = `[[ ## system_instructions ## ]]
|
|
36955
|
+
|
|
36956
|
+
**IMPORTANT**: You are processing a batch evaluation request from AgentV. Follow these exact steps:
|
|
36957
|
+
|
|
36958
|
+
1. Read and understand all guideline files and attachments provided above
|
|
36959
|
+
2. Process the user query below according to the guidelines
|
|
36960
|
+
3. Write your complete response to: {{responseFileTmp}}
|
|
36961
|
+
4. When completely finished and the response is stable, rename it to: {{responseFileFinal}}
|
|
36962
|
+
5. Do not unlock the workspace from this request; batch orchestration will handle unlocking after all responses are ready.
|
|
36963
|
+
|
|
36964
|
+
[[ ## task ## ]]
|
|
36965
|
+
|
|
36966
|
+
{{userQuery}}
|
|
36967
|
+
`;
|
|
36939
36968
|
var VSCodeProvider = class {
|
|
36940
36969
|
id;
|
|
36941
36970
|
kind;
|
|
@@ -36957,6 +36986,7 @@ var VSCodeProvider = class {
|
|
|
36957
36986
|
const session = await dispatchAgentSession({
|
|
36958
36987
|
userQuery: promptContent,
|
|
36959
36988
|
extraAttachments: inputFiles,
|
|
36989
|
+
requestTemplate: AGENTV_REQUEST_TEMPLATE,
|
|
36960
36990
|
wait: this.config.waitForResponse,
|
|
36961
36991
|
dryRun: this.config.dryRun,
|
|
36962
36992
|
vscodeCmd: this.config.command,
|
|
@@ -37003,6 +37033,7 @@ var VSCodeProvider = class {
|
|
|
37003
37033
|
const session = await dispatchBatchAgent({
|
|
37004
37034
|
userQueries,
|
|
37005
37035
|
extraAttachments: combinedInputFiles,
|
|
37036
|
+
requestTemplate: AGENTV_BATCH_REQUEST_TEMPLATE,
|
|
37006
37037
|
wait: this.config.waitForResponse,
|
|
37007
37038
|
dryRun: this.config.dryRun,
|
|
37008
37039
|
vscodeCmd: this.config.command,
|
|
@@ -41132,4 +41163,4 @@ export {
|
|
|
41132
41163
|
createProgram,
|
|
41133
41164
|
runCli
|
|
41134
41165
|
};
|
|
41135
|
-
//# sourceMappingURL=chunk-
|
|
41166
|
+
//# sourceMappingURL=chunk-N7M3URIJ.js.map
|