agentv 0.19.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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-YCIZ33BO.js
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-YCIZ33BO.js
4204
+ // ../../packages/core/dist/chunk-SVY324GN.js
4205
4205
  async function fileExists(filePath) {
4206
4206
  try {
4207
4207
  await access(filePath, constants.F_OK);
@@ -4874,7 +4874,7 @@ function isAgentProvider(provider) {
4874
4874
  import { readFile as readFile5 } from "node:fs/promises";
4875
4875
  import path62 from "node:path";
4876
4876
  import { parse as parse22 } from "yaml";
4877
- import { readFile as readFile6 } from "node:fs/promises";
4877
+ import { readFile as readFile4 } from "node:fs/promises";
4878
4878
  import path22 from "node:path";
4879
4879
  import micromatch from "micromatch";
4880
4880
  import { parse as parse5 } from "yaml";
@@ -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.3/node_modules/subagent/dist/vscode/agentDispatch.js
32492
- import { stat as stat3, writeFile as writeFile3 } from "fs/promises";
32493
- import path10 from "path";
32491
+ // ../../node_modules/.bun/subagent@0.5.6/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.3/node_modules/subagent/dist/utils/fs.js
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.6/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.3/node_modules/subagent/dist/utils/path.js
32529
- import path3 from "path";
32528
+ // ../../node_modules/.bun/subagent@0.5.6/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,325 @@ function pathToFileUri(filePath) {
32536
32536
  return `file://${normalizedPath}`;
32537
32537
  }
32538
32538
 
32539
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/workspaceManager.js
32540
- import { copyFile, mkdir as mkdir2, readdir as readdir2, readFile as readFile2, stat as stat2, writeFile } from "fs/promises";
32541
- import path6 from "path";
32539
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/promptBuilder.js
32540
+ import path4 from "node:path";
32542
32541
 
32543
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/constants.js
32544
- import os from "os";
32545
- import path4 from "path";
32542
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/utils/template.js
32543
+ function renderTemplate(content, variables) {
32544
+ if (!content) {
32545
+ return content;
32546
+ }
32547
+ const variableLookup = /* @__PURE__ */ new Map();
32548
+ for (const [key2, value] of Object.entries(variables)) {
32549
+ variableLookup.set(key2.toLowerCase(), value);
32550
+ }
32551
+ const referencedVariables = /* @__PURE__ */ new Set();
32552
+ const result = content.replace(/\{\{([a-zA-Z_]+)\}\}/gi, (match, variableName) => {
32553
+ const lowerCaseKey = variableName.toLowerCase();
32554
+ referencedVariables.add(lowerCaseKey);
32555
+ if (!variableLookup.has(lowerCaseKey)) {
32556
+ throw new Error(`Template variable '${variableName}' is not provided in the variables object`);
32557
+ }
32558
+ return variableLookup.get(lowerCaseKey);
32559
+ });
32560
+ return result;
32561
+ }
32562
+
32563
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/templates.js
32564
+ var DEFAULT_REQUEST_TEMPLATE = `[[ ## task ## ]]
32565
+
32566
+ {{userQuery}}
32567
+
32568
+ [[ ## system_instructions ## ]]
32569
+
32570
+ **IMPORTANT**: Follow these exact steps:
32571
+ 1. Create and write your complete response to: {{responseFileTmp}}
32572
+ 2. When completely finished, run these PowerShell commands to signal completion:
32573
+ \`\`\`
32574
+ Move-Item -LiteralPath '{{responseFileTmp}}' -Destination '{{responseFileFinal}}'
32575
+ if (Test-Path subagent.lock) { del subagent.lock }
32576
+ \`\`\`
32577
+
32578
+ Do not proceed to step 2 until your response is completely written to the temporary file.
32579
+ `;
32580
+ var DEFAULT_BATCH_REQUEST_TEMPLATE = `[[ ## task ## ]]
32581
+
32582
+ {{userQuery}}
32583
+
32584
+ [[ ## system_instructions ## ]]
32585
+
32586
+ **IMPORTANT**: Follow these exact steps:
32587
+ 1. Create and write your complete response to: {{responseFileTmp}}
32588
+ 2. When completely finished and the response is stable, rename it to: {{responseFileFinal}}
32589
+ 3. Do not unlock the workspace from this request; batch orchestration will handle unlocking after all responses are ready.
32590
+ `;
32591
+ var DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE = `MANDATORY: Run #runSubagent tool in your Available Actions for each request file to process them in isolated contexts.
32592
+ DO NOT read the request files yourself - only pass the file paths to each subagent:
32593
+
32594
+ {{requestFiles}}
32595
+
32596
+ After ALL queries complete, verify all responses exist and unlock:
32597
+
32598
+ \`\`\`powershell
32599
+ $responses = @({{responseList}})
32600
+ $missing = $responses | Where-Object { -not (Test-Path "messages/$_") }
32601
+ if ($missing.Count -eq 0) { del subagent.lock }
32602
+ \`\`\`
32603
+ `;
32604
+
32605
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/promptBuilder.js
32606
+ function loadDefaultRequestTemplate() {
32607
+ return DEFAULT_REQUEST_TEMPLATE;
32608
+ }
32609
+ function loadDefaultBatchRequestTemplate() {
32610
+ return DEFAULT_BATCH_REQUEST_TEMPLATE;
32611
+ }
32612
+ function loadDefaultBatchOrchestratorTemplate() {
32613
+ return DEFAULT_BATCH_ORCHESTRATOR_TEMPLATE;
32614
+ }
32615
+ function createRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
32616
+ return renderTemplate(templateContent, {
32617
+ userQuery,
32618
+ responseFileTmp,
32619
+ responseFileFinal
32620
+ });
32621
+ }
32622
+ function createBatchRequestPrompt(userQuery, responseFileTmp, responseFileFinal, templateContent) {
32623
+ return renderTemplate(templateContent, {
32624
+ userQuery,
32625
+ responseFileTmp,
32626
+ responseFileFinal
32627
+ });
32628
+ }
32629
+ function createBatchOrchestratorPrompt(requestFiles, responseFiles, templateContent) {
32630
+ const requestLines = requestFiles.map((file2, index) => `${index + 1}. messages/${path4.basename(file2)}`).join("\n");
32631
+ const responseList = responseFiles.map((file2) => `"${path4.basename(file2)}"`).join(", ");
32632
+ return renderTemplate(templateContent, {
32633
+ requestFiles: requestLines,
32634
+ responseList
32635
+ });
32636
+ }
32637
+
32638
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/responseWaiter.js
32639
+ import { readFile as readFile2 } from "node:fs/promises";
32640
+ import path5 from "node:path";
32641
+
32642
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/utils/time.js
32643
+ function sleep(ms) {
32644
+ return new Promise((resolve2) => {
32645
+ setTimeout(resolve2, ms);
32646
+ });
32647
+ }
32648
+
32649
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/responseWaiter.js
32650
+ async function waitForResponseOutput(responseFileFinal, pollInterval = 1e3, silent = false) {
32651
+ if (!silent) {
32652
+ console.error(`waiting for agent to finish: ${responseFileFinal}`);
32653
+ }
32654
+ try {
32655
+ while (!await pathExists(responseFileFinal)) {
32656
+ await sleep(pollInterval);
32657
+ }
32658
+ } catch (error40) {
32659
+ if (error40.code === "ENOENT") {
32660
+ return false;
32661
+ }
32662
+ throw error40;
32663
+ }
32664
+ let attempts = 0;
32665
+ const maxAttempts = 10;
32666
+ while (attempts < maxAttempts) {
32667
+ try {
32668
+ const content = await readFile2(responseFileFinal, { encoding: "utf8" });
32669
+ if (!silent) {
32670
+ process.stdout.write(`${content}
32671
+ `);
32672
+ }
32673
+ return true;
32674
+ } catch (error40) {
32675
+ attempts += 1;
32676
+ if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
32677
+ if (!silent) {
32678
+ console.error(`error: failed to read agent response: ${error40.message}`);
32679
+ }
32680
+ return false;
32681
+ }
32682
+ await sleep(pollInterval);
32683
+ }
32684
+ }
32685
+ return false;
32686
+ }
32687
+ async function waitForBatchResponses(responseFilesFinal, pollInterval = 1e3, silent = false) {
32688
+ if (!silent) {
32689
+ const fileList = responseFilesFinal.map((file2) => path5.basename(file2)).join(", ");
32690
+ console.error(`waiting for ${responseFilesFinal.length} batch response(s): ${fileList}`);
32691
+ }
32692
+ try {
32693
+ const pending = new Set(responseFilesFinal);
32694
+ while (pending.size > 0) {
32695
+ for (const file2 of [...pending]) {
32696
+ if (await pathExists(file2)) {
32697
+ pending.delete(file2);
32698
+ }
32699
+ }
32700
+ if (pending.size > 0) {
32701
+ await sleep(pollInterval);
32702
+ }
32703
+ }
32704
+ } catch (error40) {
32705
+ if (error40.code === "ENOENT") {
32706
+ return false;
32707
+ }
32708
+ throw error40;
32709
+ }
32710
+ for (const file2 of responseFilesFinal) {
32711
+ let attempts = 0;
32712
+ const maxAttempts = 10;
32713
+ while (attempts < maxAttempts) {
32714
+ try {
32715
+ const content = await readFile2(file2, { encoding: "utf8" });
32716
+ if (!silent) {
32717
+ process.stdout.write(`${content}
32718
+ `);
32719
+ }
32720
+ break;
32721
+ } catch (error40) {
32722
+ attempts += 1;
32723
+ if (error40.code !== "EBUSY" || attempts >= maxAttempts) {
32724
+ if (!silent) {
32725
+ console.error(`error: failed to read agent response: ${error40.message}`);
32726
+ }
32727
+ return false;
32728
+ }
32729
+ await sleep(pollInterval);
32730
+ }
32731
+ }
32732
+ }
32733
+ return true;
32734
+ }
32735
+
32736
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/vscodeProcess.js
32737
+ import { exec, spawn } from "node:child_process";
32738
+ import { mkdir as mkdir2, writeFile } from "node:fs/promises";
32739
+ import path7 from "node:path";
32740
+ import { promisify } from "node:util";
32741
+
32742
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/constants.js
32743
+ import os from "node:os";
32744
+ import path6 from "node:path";
32546
32745
  var DEFAULT_LOCK_NAME = "subagent.lock";
32547
32746
  var DEFAULT_ALIVE_FILENAME = ".alive";
32548
32747
  function getDefaultSubagentRoot(vscodeCmd = "code") {
32549
32748
  const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
32550
- return path4.join(os.homedir(), ".subagent", folder);
32749
+ return path6.join(os.homedir(), ".subagent", folder);
32551
32750
  }
32552
32751
  var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
32553
32752
 
32554
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/utils/workspace.js
32555
- import path5 from "path";
32753
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/vscodeProcess.js
32754
+ var execAsync = promisify(exec);
32755
+ var DEFAULT_WAKEUP_CONTENT = `---
32756
+ description: 'Wake-up Signal'
32757
+ model: Grok Code Fast 1 (copilot)
32758
+ ---`;
32759
+ async function checkWorkspaceOpened(workspaceName, vscodeCmd) {
32760
+ try {
32761
+ const { stdout } = await execAsync(`${vscodeCmd} --status`, {
32762
+ timeout: 1e4,
32763
+ windowsHide: true
32764
+ });
32765
+ return stdout.includes(workspaceName);
32766
+ } catch {
32767
+ return false;
32768
+ }
32769
+ }
32770
+ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir, vscodeCmd, pollInterval = 1, timeout = 60) {
32771
+ const alreadyOpen = await checkWorkspaceOpened(workspaceName, vscodeCmd);
32772
+ if (alreadyOpen) {
32773
+ spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
32774
+ return true;
32775
+ }
32776
+ const aliveFile = path7.join(subagentDir, DEFAULT_ALIVE_FILENAME);
32777
+ await removeIfExists(aliveFile);
32778
+ const githubAgentsDir = path7.join(subagentDir, ".github", "agents");
32779
+ await mkdir2(githubAgentsDir, { recursive: true });
32780
+ const wakeupDst = path7.join(githubAgentsDir, "wakeup.md");
32781
+ await writeFile(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
32782
+ spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
32783
+ await sleep(100);
32784
+ const wakeupChatId = "wakeup";
32785
+ const chatArgs = [
32786
+ "-r",
32787
+ "chat",
32788
+ "-m",
32789
+ wakeupChatId,
32790
+ `create a file named .alive in the ${path7.basename(subagentDir)} folder`
32791
+ ];
32792
+ spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
32793
+ const start = Date.now();
32794
+ while (!await pathExists(aliveFile)) {
32795
+ if (Date.now() - start > timeout * 1e3) {
32796
+ console.error(`warning: Workspace readiness timeout after ${timeout}s`);
32797
+ return false;
32798
+ }
32799
+ await sleep(pollInterval * 1e3);
32800
+ }
32801
+ return true;
32802
+ }
32803
+ async function launchVsCodeWithChat(subagentDir, chatId, attachmentPaths, requestInstructions, timestamp, vscodeCmd) {
32804
+ try {
32805
+ const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
32806
+ const messagesDir = path7.join(subagentDir, "messages");
32807
+ await mkdir2(messagesDir, { recursive: true });
32808
+ const reqFile = path7.join(messagesDir, `${timestamp}_req.md`);
32809
+ await writeFile(reqFile, requestInstructions, { encoding: "utf8" });
32810
+ const reqUri = pathToFileUri(reqFile);
32811
+ const chatArgs = ["-r", "chat", "-m", chatId];
32812
+ for (const attachment of attachmentPaths) {
32813
+ chatArgs.push("-a", attachment);
32814
+ }
32815
+ chatArgs.push("-a", reqFile);
32816
+ chatArgs.push(`Follow instructions in [${path7.basename(reqFile)}](${reqUri})`);
32817
+ const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
32818
+ if (!workspaceReady) {
32819
+ console.error("warning: Workspace may not be fully ready");
32820
+ }
32821
+ await sleep(500);
32822
+ spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
32823
+ return true;
32824
+ } catch (error40) {
32825
+ console.error(`warning: Failed to launch VS Code: ${error40.message}`);
32826
+ return false;
32827
+ }
32828
+ }
32829
+ async function launchVsCodeWithBatchChat(subagentDir, chatId, attachmentPaths, chatInstruction, vscodeCmd) {
32830
+ try {
32831
+ const workspacePath = path7.join(subagentDir, `${path7.basename(subagentDir)}.code-workspace`);
32832
+ const messagesDir = path7.join(subagentDir, "messages");
32833
+ await mkdir2(messagesDir, { recursive: true });
32834
+ const chatArgs = ["-r", "chat", "-m", chatId];
32835
+ for (const attachment of attachmentPaths) {
32836
+ chatArgs.push("-a", attachment);
32837
+ }
32838
+ chatArgs.push(chatInstruction);
32839
+ const workspaceReady = await ensureWorkspaceFocused(workspacePath, path7.basename(subagentDir), subagentDir, vscodeCmd);
32840
+ if (!workspaceReady) {
32841
+ console.error("warning: Workspace may not be fully ready");
32842
+ }
32843
+ await sleep(500);
32844
+ spawn(vscodeCmd, chatArgs, { windowsHide: true, shell: true, detached: false });
32845
+ return true;
32846
+ } catch (error40) {
32847
+ console.error(`warning: Failed to launch VS Code: ${error40.message}`);
32848
+ return false;
32849
+ }
32850
+ }
32851
+
32852
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/workspaceManager.js
32853
+ import { copyFile, mkdir as mkdir3, readFile as readFile3, readdir as readdir2, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
32854
+ import path9 from "node:path";
32855
+
32856
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/utils/workspace.js
32857
+ import path8 from "node:path";
32556
32858
 
32557
32859
  // ../../node_modules/.bun/json5@2.2.3/node_modules/json5/dist/index.mjs
32558
32860
  var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
@@ -33639,7 +33941,7 @@ var JSON5 = {
33639
33941
  var lib = JSON5;
33640
33942
  var dist_default = lib;
33641
33943
 
33642
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/utils/workspace.js
33944
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/utils/workspace.js
33643
33945
  function transformWorkspacePaths(workspaceContent, templateDir) {
33644
33946
  let workspace;
33645
33947
  try {
@@ -33655,19 +33957,16 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
33655
33957
  }
33656
33958
  const transformedFolders = workspace.folders.map((folder) => {
33657
33959
  const folderPath = folder.path;
33658
- if (path5.isAbsolute(folderPath)) {
33960
+ if (path8.isAbsolute(folderPath)) {
33659
33961
  return folder;
33660
33962
  }
33661
- const absolutePath = path5.resolve(templateDir, folderPath);
33963
+ const absolutePath = path8.resolve(templateDir, folderPath);
33662
33964
  return {
33663
33965
  ...folder,
33664
33966
  path: absolutePath
33665
33967
  };
33666
33968
  });
33667
- const updatedFolders = [
33668
- { path: "." },
33669
- ...transformedFolders
33670
- ];
33969
+ const updatedFolders = [{ path: "." }, ...transformedFolders];
33671
33970
  let transformedSettings = workspace.settings;
33672
33971
  if (workspace.settings) {
33673
33972
  transformedSettings = {
@@ -33683,19 +33982,19 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
33683
33982
  if (locationMap && typeof locationMap === "object") {
33684
33983
  const transformedMap = {};
33685
33984
  for (const [locationPath, value] of Object.entries(locationMap)) {
33686
- const isAbsolute = path5.isAbsolute(locationPath);
33985
+ const isAbsolute = path8.isAbsolute(locationPath);
33687
33986
  if (isAbsolute) {
33688
33987
  transformedMap[locationPath] = value;
33689
33988
  } else {
33690
33989
  const firstGlobIndex = locationPath.search(/[*]/);
33691
33990
  if (firstGlobIndex === -1) {
33692
- const resolvedPath = path5.resolve(templateDir, locationPath).replace(/\\/g, "/");
33991
+ const resolvedPath = path8.resolve(templateDir, locationPath).replace(/\\/g, "/");
33693
33992
  transformedMap[resolvedPath] = value;
33694
33993
  } else {
33695
33994
  const basePathEnd = locationPath.lastIndexOf("/", firstGlobIndex);
33696
33995
  const basePath = basePathEnd !== -1 ? locationPath.substring(0, basePathEnd) : ".";
33697
33996
  const patternPath = locationPath.substring(basePathEnd !== -1 ? basePathEnd : 0);
33698
- const resolvedPath = (path5.resolve(templateDir, basePath) + patternPath).replace(/\\/g, "/");
33997
+ const resolvedPath = (path8.resolve(templateDir, basePath) + patternPath).replace(/\\/g, "/");
33699
33998
  transformedMap[resolvedPath] = value;
33700
33999
  }
33701
34000
  }
@@ -33712,7 +34011,7 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
33712
34011
  return JSON.stringify(transformedWorkspace, null, 2);
33713
34012
  }
33714
34013
 
33715
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/workspaceManager.js
34014
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/workspaceManager.js
33716
34015
  var DEFAULT_WORKSPACE_TEMPLATE = {
33717
34016
  folders: [
33718
34017
  {
@@ -33733,7 +34032,7 @@ async function findUnlockedSubagent(subagentRoot) {
33733
34032
  number: Number.parseInt(entry.name.split("-")[1] ?? "", 10)
33734
34033
  })).filter((entry) => Number.isInteger(entry.number)).sort((a, b) => a.number - b.number);
33735
34034
  for (const subagent of subagents) {
33736
- const lockFile = path6.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
34035
+ const lockFile = path9.join(subagent.absolutePath, DEFAULT_LOCK_NAME);
33737
34036
  if (!await pathExists(lockFile)) {
33738
34037
  return subagent.absolutePath;
33739
34038
  }
@@ -33743,7 +34042,7 @@ async function findUnlockedSubagent(subagentRoot) {
33743
34042
  async function copyAgentConfig(subagentDir, workspaceTemplate) {
33744
34043
  let workspaceContent;
33745
34044
  if (workspaceTemplate) {
33746
- const workspaceSrc = path6.resolve(workspaceTemplate);
34045
+ const workspaceSrc = path9.resolve(workspaceTemplate);
33747
34046
  if (!await pathExists(workspaceSrc)) {
33748
34047
  throw new Error(`workspace template not found: ${workspaceSrc}`);
33749
34048
  }
@@ -33751,42 +34050,42 @@ async function copyAgentConfig(subagentDir, workspaceTemplate) {
33751
34050
  if (!stats.isFile()) {
33752
34051
  throw new Error(`workspace template must be a file, not a directory: ${workspaceSrc}`);
33753
34052
  }
33754
- const templateText = await readFile2(workspaceSrc, "utf8");
34053
+ const templateText = await readFile3(workspaceSrc, "utf8");
33755
34054
  workspaceContent = JSON.parse(templateText);
33756
34055
  } else {
33757
34056
  workspaceContent = DEFAULT_WORKSPACE_TEMPLATE;
33758
34057
  }
33759
- const workspaceName = `${path6.basename(subagentDir)}.code-workspace`;
33760
- const workspaceDst = path6.join(subagentDir, workspaceName);
33761
- const templateDir = workspaceTemplate ? path6.dirname(path6.resolve(workspaceTemplate)) : subagentDir;
34058
+ const workspaceName = `${path9.basename(subagentDir)}.code-workspace`;
34059
+ const workspaceDst = path9.join(subagentDir, workspaceName);
34060
+ const templateDir = workspaceTemplate ? path9.dirname(path9.resolve(workspaceTemplate)) : subagentDir;
33762
34061
  const workspaceJson = JSON.stringify(workspaceContent, null, 2);
33763
34062
  const transformedContent = transformWorkspacePaths(workspaceJson, templateDir);
33764
- await writeFile(workspaceDst, transformedContent, "utf8");
33765
- const messagesDir = path6.join(subagentDir, "messages");
33766
- await mkdir2(messagesDir, { recursive: true });
34063
+ await writeFile2(workspaceDst, transformedContent, "utf8");
34064
+ const messagesDir = path9.join(subagentDir, "messages");
34065
+ await mkdir3(messagesDir, { recursive: true });
33767
34066
  return { workspace: workspaceDst, messagesDir };
33768
34067
  }
33769
34068
  async function createSubagentLock(subagentDir) {
33770
- const messagesDir = path6.join(subagentDir, "messages");
34069
+ const messagesDir = path9.join(subagentDir, "messages");
33771
34070
  if (await pathExists(messagesDir)) {
33772
34071
  const files = await readdir2(messagesDir);
33773
34072
  await Promise.all(files.map(async (file2) => {
33774
- const target = path6.join(messagesDir, file2);
34073
+ const target = path9.join(messagesDir, file2);
33775
34074
  await removeIfExists(target);
33776
34075
  }));
33777
34076
  }
33778
- const githubAgentsDir = path6.join(subagentDir, ".github", "agents");
34077
+ const githubAgentsDir = path9.join(subagentDir, ".github", "agents");
33779
34078
  if (await pathExists(githubAgentsDir)) {
33780
34079
  const agentFiles = await readdir2(githubAgentsDir);
33781
34080
  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(path6.join(githubAgentsDir, file2))));
34081
+ await Promise.all(agentFiles.filter((file2) => file2.endsWith(".md") && !preservedFiles.has(file2)).map((file2) => removeIfExists(path9.join(githubAgentsDir, file2))));
33783
34082
  }
33784
- const lockFile = path6.join(subagentDir, DEFAULT_LOCK_NAME);
33785
- await writeFile(lockFile, "", { encoding: "utf8" });
34083
+ const lockFile = path9.join(subagentDir, DEFAULT_LOCK_NAME);
34084
+ await writeFile2(lockFile, "", { encoding: "utf8" });
33786
34085
  return lockFile;
33787
34086
  }
33788
34087
  async function removeSubagentLock(subagentDir) {
33789
- const lockFile = path6.join(subagentDir, DEFAULT_LOCK_NAME);
34088
+ const lockFile = path9.join(subagentDir, DEFAULT_LOCK_NAME);
33790
34089
  await removeIfExists(lockFile);
33791
34090
  }
33792
34091
  async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspaceTemplate, dryRun) {
@@ -33806,9 +34105,9 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
33806
34105
  return 1;
33807
34106
  }
33808
34107
  if (promptFile) {
33809
- const githubAgentsDir = path6.join(subagentDir, ".github", "agents");
33810
- await mkdir2(githubAgentsDir, { recursive: true });
33811
- const agentFile = path6.join(githubAgentsDir, `${chatId}.md`);
34108
+ const githubAgentsDir = path9.join(subagentDir, ".github", "agents");
34109
+ await mkdir3(githubAgentsDir, { recursive: true });
34110
+ const agentFile = path9.join(githubAgentsDir, `${chatId}.md`);
33812
34111
  try {
33813
34112
  await copyFile(promptFile, agentFile);
33814
34113
  } catch (error40) {
@@ -33819,320 +34118,7 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
33819
34118
  return 0;
33820
34119
  }
33821
34120
 
33822
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/vscodeProcess.js
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
34121
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/agentDispatch.js
34136
34122
  function generateTimestamp() {
34137
34123
  return (/* @__PURE__ */ new Date()).toISOString().replace(/[-:TZ.]/g, "").slice(0, 14);
34138
34124
  }
@@ -34176,15 +34162,7 @@ async function dispatchAgentSession(options) {
34176
34162
  error: error40.message
34177
34163
  };
34178
34164
  }
34179
- let templateContent;
34180
- try {
34181
- templateContent = requestTemplate ? await loadTemplateFile(path10.resolve(requestTemplate)) : loadDefaultRequestTemplate();
34182
- } catch (error40) {
34183
- return {
34184
- exitCode: 1,
34185
- error: error40.message
34186
- };
34187
- }
34165
+ const templateContent = requestTemplate ?? loadDefaultRequestTemplate();
34188
34166
  const subagentRootPath = subagentRoot ?? getSubagentRoot(vscodeCmd);
34189
34167
  const subagentDir = await findUnlockedSubagent(subagentRootPath);
34190
34168
  if (!subagentDir) {
@@ -34294,17 +34272,7 @@ async function dispatchBatchAgent(options) {
34294
34272
  error: error40.message
34295
34273
  };
34296
34274
  }
34297
- let batchRequestTemplateContent;
34298
- try {
34299
- batchRequestTemplateContent = requestTemplate ? await loadTemplateFile(path10.resolve(requestTemplate)) : loadDefaultBatchRequestTemplate();
34300
- } catch (error40) {
34301
- return {
34302
- exitCode: 1,
34303
- requestFiles,
34304
- queryCount,
34305
- error: error40.message
34306
- };
34307
- }
34275
+ const batchRequestTemplateContent = requestTemplate ?? loadDefaultBatchRequestTemplate();
34308
34276
  const orchestratorTemplateContent = loadDefaultBatchOrchestratorTemplate();
34309
34277
  const subagentRootPath = subagentRoot ?? getSubagentRoot(vscodeCmd);
34310
34278
  const subagentDir = await findUnlockedSubagent(subagentRootPath);
@@ -34412,9 +34380,9 @@ async function dispatchBatchAgent(options) {
34412
34380
  }
34413
34381
  }
34414
34382
 
34415
- // ../../node_modules/.bun/subagent@0.5.3/node_modules/subagent/dist/vscode/provision.js
34416
- import { writeFile as writeFile4 } from "fs/promises";
34417
- import path11 from "path";
34383
+ // ../../node_modules/.bun/subagent@0.5.6/node_modules/subagent/dist/vscode/provision.js
34384
+ import { writeFile as writeFile4 } from "node:fs/promises";
34385
+ import path11 from "node:path";
34418
34386
  var DEFAULT_WORKSPACE_TEMPLATE2 = {
34419
34387
  folders: [
34420
34388
  {
@@ -34451,6 +34419,8 @@ async function provisionSubagents(options) {
34451
34419
  continue;
34452
34420
  }
34453
34421
  const suffix = entry.name.split("-")[1];
34422
+ if (!suffix)
34423
+ continue;
34454
34424
  const parsed = Number.parseInt(suffix, 10);
34455
34425
  if (!Number.isInteger(parsed)) {
34456
34426
  continue;
@@ -34538,7 +34508,7 @@ async function provisionSubagents(options) {
34538
34508
 
34539
34509
  // ../../packages/core/dist/index.js
34540
34510
  import { constants as constants32 } from "node:fs";
34541
- import { access as access32, readFile as readFile62 } from "node:fs/promises";
34511
+ import { access as access32, readFile as readFile6 } from "node:fs/promises";
34542
34512
  import path112 from "node:path";
34543
34513
  import { parse as parse32 } from "yaml";
34544
34514
  import { createHash, randomUUID as randomUUID2 } from "node:crypto";
@@ -34771,7 +34741,7 @@ async function loadConfig(evalFilePath, repoRoot) {
34771
34741
  continue;
34772
34742
  }
34773
34743
  try {
34774
- const rawConfig = await readFile6(configPath, "utf8");
34744
+ const rawConfig = await readFile4(configPath, "utf8");
34775
34745
  const parsed = parse5(rawConfig);
34776
34746
  if (!isJsonObject(parsed)) {
34777
34747
  logWarning(`Invalid .agentv/config.yaml format at ${configPath}`);
@@ -36936,6 +36906,39 @@ var MockProvider = class {
36936
36906
  return this.delayMs;
36937
36907
  }
36938
36908
  };
36909
+ var AGENTV_REQUEST_TEMPLATE = `[[ ## task ## ]]
36910
+
36911
+ {{userQuery}}
36912
+
36913
+ [[ ## system_instructions ## ]]
36914
+
36915
+ **IMPORTANT**: Follow these exact steps:
36916
+ 1. Create and write your complete response to: {{responseFileTmp}}
36917
+ - Do NOT create any additional output files in the workspace.
36918
+ - All intended file outputs/changes MUST be written in your response file.
36919
+ - For each intended file, include the repo name, relative path and unified git diff following the convention \`diff --git ...\`.
36920
+ 2. When completely finished, run these PowerShell commands to signal completion:
36921
+ \`\`\`
36922
+ Move-Item -LiteralPath '{{responseFileTmp}}' -Destination '{{responseFileFinal}}'
36923
+ if (Test-Path subagent.lock) { del subagent.lock }
36924
+ \`\`\`
36925
+
36926
+ Do not proceed to step 2 until your response is completely written to the temporary file.
36927
+ `;
36928
+ var AGENTV_BATCH_REQUEST_TEMPLATE = `[[ ## task ## ]]
36929
+
36930
+ {{userQuery}}
36931
+
36932
+ [[ ## system_instructions ## ]]
36933
+
36934
+ **IMPORTANT**: Follow these exact steps:
36935
+ 1. Create and write your complete response to: {{responseFileTmp}}
36936
+ - Do NOT create any additional output files in the workspace.
36937
+ - All intended file outputs/changes MUST be written in your response file.
36938
+ - For each intended file, include the repo name, relative path and unified git diff following the convention \`diff --git ...\`.
36939
+ 2. When completely finished and the response is stable, rename it to: {{responseFileFinal}}
36940
+ 3. Do not unlock the workspace from this request; batch orchestration will handle unlocking after all responses are ready.
36941
+ `;
36939
36942
  var VSCodeProvider = class {
36940
36943
  id;
36941
36944
  kind;
@@ -36957,6 +36960,7 @@ var VSCodeProvider = class {
36957
36960
  const session = await dispatchAgentSession({
36958
36961
  userQuery: promptContent,
36959
36962
  extraAttachments: inputFiles,
36963
+ requestTemplate: AGENTV_REQUEST_TEMPLATE,
36960
36964
  wait: this.config.waitForResponse,
36961
36965
  dryRun: this.config.dryRun,
36962
36966
  vscodeCmd: this.config.command,
@@ -37003,6 +37007,7 @@ var VSCodeProvider = class {
37003
37007
  const session = await dispatchBatchAgent({
37004
37008
  userQueries,
37005
37009
  extraAttachments: combinedInputFiles,
37010
+ requestTemplate: AGENTV_BATCH_REQUEST_TEMPLATE,
37006
37011
  wait: this.config.waitForResponse,
37007
37012
  dryRun: this.config.dryRun,
37008
37013
  vscodeCmd: this.config.command,
@@ -37220,7 +37225,7 @@ async function readTargetDefinitions(filePath) {
37220
37225
  if (!await fileExists3(absolutePath)) {
37221
37226
  throw new Error(`targets.yaml not found at ${absolutePath}`);
37222
37227
  }
37223
- const raw = await readFile62(absolutePath, "utf8");
37228
+ const raw = await readFile6(absolutePath, "utf8");
37224
37229
  const parsed = parse32(raw);
37225
37230
  if (!isRecord(parsed)) {
37226
37231
  throw new Error(`targets.yaml at ${absolutePath} must be a YAML object with a 'targets' field`);
@@ -41132,4 +41137,4 @@ export {
41132
41137
  createProgram,
41133
41138
  runCli
41134
41139
  };
41135
- //# sourceMappingURL=chunk-EJTXU5JO.js.map
41140
+ //# sourceMappingURL=chunk-GDGNKNKP.js.map