agentv 0.2.8 → 0.2.11
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 +1 -18
- package/dist/chunk-7MGIZBZG.js +15238 -0
- package/dist/chunk-7MGIZBZG.js.map +1 -0
- package/dist/{chunk-RLBRJX7V.js → chunk-JT3E7T7V.js} +68 -49
- package/dist/{chunk-RLBRJX7V.js.map → chunk-JT3E7T7V.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -9076,25 +9076,24 @@ var NEVER = INVALID;
|
|
|
9076
9076
|
import { readFile as readFile22 } from "node:fs/promises";
|
|
9077
9077
|
import path22 from "node:path";
|
|
9078
9078
|
|
|
9079
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
9079
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/vscode/agentDispatch.js
|
|
9080
9080
|
import { exec, spawn } from "child_process";
|
|
9081
9081
|
import { copyFile, mkdir as mkdir2, readdir as readdir2, readFile, stat as stat2, writeFile } from "fs/promises";
|
|
9082
9082
|
import path5 from "path";
|
|
9083
9083
|
import { promisify } from "util";
|
|
9084
9084
|
|
|
9085
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
9085
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/vscode/constants.js
|
|
9086
9086
|
import os from "os";
|
|
9087
9087
|
import path2 from "path";
|
|
9088
9088
|
var DEFAULT_LOCK_NAME = "subagent.lock";
|
|
9089
|
+
var DEFAULT_ALIVE_FILENAME = ".alive";
|
|
9089
9090
|
function getDefaultSubagentRoot(vscodeCmd = "code") {
|
|
9090
9091
|
const folder = vscodeCmd === "code-insiders" ? "vscode-insiders-agents" : "vscode-agents";
|
|
9091
9092
|
return path2.join(os.homedir(), ".subagent", folder);
|
|
9092
9093
|
}
|
|
9093
9094
|
var DEFAULT_SUBAGENT_ROOT = getDefaultSubagentRoot();
|
|
9094
|
-
var DEFAULT_WAKEUP_FILENAME = "wakeup.chatmode.md";
|
|
9095
|
-
var DEFAULT_ALIVE_FILENAME = ".alive";
|
|
9096
9095
|
|
|
9097
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
9096
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/utils/fs.js
|
|
9098
9097
|
import { constants as constants2 } from "fs";
|
|
9099
9098
|
import { access as access2, mkdir, readdir, rm, stat } from "fs/promises";
|
|
9100
9099
|
import path3 from "path";
|
|
@@ -9127,14 +9126,14 @@ async function removeIfExists(target) {
|
|
|
9127
9126
|
}
|
|
9128
9127
|
}
|
|
9129
9128
|
|
|
9130
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
9129
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/utils/time.js
|
|
9131
9130
|
function sleep(ms2) {
|
|
9132
9131
|
return new Promise((resolve) => {
|
|
9133
9132
|
setTimeout(resolve, ms2);
|
|
9134
9133
|
});
|
|
9135
9134
|
}
|
|
9136
9135
|
|
|
9137
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
9136
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/utils/workspace.js
|
|
9138
9137
|
import path4 from "path";
|
|
9139
9138
|
|
|
9140
9139
|
// ../../node_modules/.pnpm/json5@2.2.3/node_modules/json5/dist/index.mjs
|
|
@@ -10222,7 +10221,7 @@ var JSON5 = {
|
|
|
10222
10221
|
var lib = JSON5;
|
|
10223
10222
|
var dist_default = lib;
|
|
10224
10223
|
|
|
10225
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
10224
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/utils/workspace.js
|
|
10226
10225
|
function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
10227
10226
|
let workspace;
|
|
10228
10227
|
try {
|
|
@@ -10295,28 +10294,39 @@ function transformWorkspacePaths(workspaceContent, templateDir) {
|
|
|
10295
10294
|
return JSON.stringify(transformedWorkspace, null, 2);
|
|
10296
10295
|
}
|
|
10297
10296
|
|
|
10298
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
10297
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/vscode/agentDispatch.js
|
|
10299
10298
|
var execAsync = promisify(exec);
|
|
10299
|
+
function generateTimestamp() {
|
|
10300
|
+
return (/* @__PURE__ */ new Date()).toISOString().replace(/[-:TZ.]/g, "").slice(0, 14);
|
|
10301
|
+
}
|
|
10300
10302
|
var DEFAULT_WORKSPACE_TEMPLATE = {
|
|
10301
10303
|
folders: [
|
|
10302
10304
|
{
|
|
10303
10305
|
path: "."
|
|
10304
10306
|
}
|
|
10305
|
-
]
|
|
10306
|
-
settings: {
|
|
10307
|
-
"chat.modeFilesLocations": {
|
|
10308
|
-
"**/*.chatmode.md": true
|
|
10309
|
-
}
|
|
10310
|
-
}
|
|
10307
|
+
]
|
|
10311
10308
|
};
|
|
10312
10309
|
var DEFAULT_WAKEUP_CONTENT = `---
|
|
10313
10310
|
description: 'Wake-up Signal'
|
|
10314
|
-
|
|
10315
|
-
model: GPT-4.1 (copilot)
|
|
10311
|
+
model: Grok Code Fast 1 (copilot)
|
|
10316
10312
|
---`;
|
|
10317
10313
|
function getSubagentRoot(vscodeCmd = "code") {
|
|
10318
10314
|
return getDefaultSubagentRoot(vscodeCmd);
|
|
10319
10315
|
}
|
|
10316
|
+
async function resolvePromptFile(promptFile) {
|
|
10317
|
+
if (!promptFile) {
|
|
10318
|
+
return void 0;
|
|
10319
|
+
}
|
|
10320
|
+
const resolvedPrompt = path5.resolve(promptFile);
|
|
10321
|
+
if (!await pathExists(resolvedPrompt)) {
|
|
10322
|
+
throw new Error(`Prompt file not found: ${resolvedPrompt}`);
|
|
10323
|
+
}
|
|
10324
|
+
const promptStats = await stat2(resolvedPrompt);
|
|
10325
|
+
if (!promptStats.isFile()) {
|
|
10326
|
+
throw new Error(`Prompt file must be a file, not a directory: ${resolvedPrompt}`);
|
|
10327
|
+
}
|
|
10328
|
+
return resolvedPrompt;
|
|
10329
|
+
}
|
|
10320
10330
|
async function findUnlockedSubagent(subagentRoot) {
|
|
10321
10331
|
if (!await pathExists(subagentRoot)) {
|
|
10322
10332
|
return null;
|
|
@@ -10350,7 +10360,10 @@ async function ensureWorkspaceFocused(workspacePath, workspaceName, subagentDir,
|
|
|
10350
10360
|
}
|
|
10351
10361
|
const aliveFile = path5.join(subagentDir, DEFAULT_ALIVE_FILENAME);
|
|
10352
10362
|
await removeIfExists(aliveFile);
|
|
10353
|
-
const
|
|
10363
|
+
const githubAgentsDir = path5.join(subagentDir, ".github", "agents");
|
|
10364
|
+
await mkdir2(githubAgentsDir, { recursive: true });
|
|
10365
|
+
const wakeupDst = path5.join(githubAgentsDir, "wakeup.md");
|
|
10366
|
+
const subagentDst = path5.join(githubAgentsDir, "subagent.md");
|
|
10354
10367
|
await writeFile(wakeupDst, DEFAULT_WAKEUP_CONTENT, "utf8");
|
|
10355
10368
|
spawn(vscodeCmd, [workspacePath], { windowsHide: true, shell: true, detached: false });
|
|
10356
10369
|
await sleep(100);
|
|
@@ -10402,8 +10415,12 @@ async function createSubagentLock(subagentDir) {
|
|
|
10402
10415
|
await removeIfExists(target);
|
|
10403
10416
|
}));
|
|
10404
10417
|
}
|
|
10405
|
-
const
|
|
10406
|
-
|
|
10418
|
+
const githubAgentsDir = path5.join(subagentDir, ".github", "agents");
|
|
10419
|
+
if (await pathExists(githubAgentsDir)) {
|
|
10420
|
+
const agentFiles = await readdir2(githubAgentsDir);
|
|
10421
|
+
const preservedFiles = /* @__PURE__ */ new Set(["wakeup.md", "subagent.md"]);
|
|
10422
|
+
await Promise.all(agentFiles.filter((file) => file.endsWith(".md") && !preservedFiles.has(file)).map((file) => removeIfExists(path5.join(githubAgentsDir, file))));
|
|
10423
|
+
}
|
|
10407
10424
|
const lockFile = path5.join(subagentDir, DEFAULT_LOCK_NAME);
|
|
10408
10425
|
await writeFile(lockFile, "", { encoding: "utf8" });
|
|
10409
10426
|
return lockFile;
|
|
@@ -10466,17 +10483,19 @@ async function prepareSubagentDirectory(subagentDir, promptFile, chatId, workspa
|
|
|
10466
10483
|
return 1;
|
|
10467
10484
|
}
|
|
10468
10485
|
if (promptFile) {
|
|
10469
|
-
const
|
|
10486
|
+
const githubAgentsDir = path5.join(subagentDir, ".github", "agents");
|
|
10487
|
+
await mkdir2(githubAgentsDir, { recursive: true });
|
|
10488
|
+
const agentFile = path5.join(githubAgentsDir, `${chatId}.md`);
|
|
10470
10489
|
try {
|
|
10471
|
-
await copyFile(promptFile,
|
|
10490
|
+
await copyFile(promptFile, agentFile);
|
|
10472
10491
|
} catch (error) {
|
|
10473
|
-
console.error(`error: Failed to copy prompt file to
|
|
10492
|
+
console.error(`error: Failed to copy prompt file to agent mode: ${error.message}`);
|
|
10474
10493
|
return 1;
|
|
10475
10494
|
}
|
|
10476
10495
|
}
|
|
10477
10496
|
return 0;
|
|
10478
10497
|
}
|
|
10479
|
-
function createRequestPrompt(userQuery, responseFileTmp, responseFileFinal
|
|
10498
|
+
function createRequestPrompt(userQuery, responseFileTmp, responseFileFinal) {
|
|
10480
10499
|
return `[[ ## task ## ]]
|
|
10481
10500
|
|
|
10482
10501
|
${userQuery}
|
|
@@ -10488,7 +10507,7 @@ ${userQuery}
|
|
|
10488
10507
|
2. When completely finished, run these PowerShell commands to signal completion:
|
|
10489
10508
|
\`\`\`
|
|
10490
10509
|
Move-Item -LiteralPath '${responseFileTmp}' -Destination '${responseFileFinal}'
|
|
10491
|
-
subagent
|
|
10510
|
+
if (Test-Path subagent.lock) { del subagent.lock }
|
|
10492
10511
|
\`\`\`
|
|
10493
10512
|
|
|
10494
10513
|
Do not proceed to step 2 until your response is completely written to the temporary file.`;
|
|
@@ -10536,21 +10555,13 @@ async function dispatchAgentSession(options) {
|
|
|
10536
10555
|
const { userQuery, promptFile, extraAttachments, workspaceTemplate, dryRun = false, wait = true, vscodeCmd = "code", subagentRoot, silent = false } = options;
|
|
10537
10556
|
try {
|
|
10538
10557
|
let resolvedPrompt;
|
|
10539
|
-
|
|
10540
|
-
resolvedPrompt =
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
}
|
|
10547
|
-
const promptStats = await stat2(resolvedPrompt);
|
|
10548
|
-
if (!promptStats.isFile()) {
|
|
10549
|
-
return {
|
|
10550
|
-
exitCode: 1,
|
|
10551
|
-
error: `Prompt file must be a file, not a directory: ${resolvedPrompt}`
|
|
10552
|
-
};
|
|
10553
|
-
}
|
|
10558
|
+
try {
|
|
10559
|
+
resolvedPrompt = await resolvePromptFile(promptFile);
|
|
10560
|
+
} catch (error) {
|
|
10561
|
+
return {
|
|
10562
|
+
exitCode: 1,
|
|
10563
|
+
error: error.message
|
|
10564
|
+
};
|
|
10554
10565
|
}
|
|
10555
10566
|
const subagentRootPath = subagentRoot ?? getSubagentRoot(vscodeCmd);
|
|
10556
10567
|
const subagentDir = await findUnlockedSubagent(subagentRootPath);
|
|
@@ -10580,11 +10591,11 @@ async function dispatchAgentSession(options) {
|
|
|
10580
10591
|
error: attachmentError.message
|
|
10581
10592
|
};
|
|
10582
10593
|
}
|
|
10583
|
-
const timestamp = (
|
|
10594
|
+
const timestamp = generateTimestamp();
|
|
10584
10595
|
const messagesDir = path5.join(subagentDir, "messages");
|
|
10585
10596
|
const responseFileTmp = path5.join(messagesDir, `${timestamp}_res.tmp.md`);
|
|
10586
10597
|
const responseFileFinal = path5.join(messagesDir, `${timestamp}_res.md`);
|
|
10587
|
-
const requestInstructions = createRequestPrompt(userQuery, responseFileTmp, responseFileFinal
|
|
10598
|
+
const requestInstructions = createRequestPrompt(userQuery, responseFileTmp, responseFileFinal);
|
|
10588
10599
|
if (dryRun) {
|
|
10589
10600
|
return {
|
|
10590
10601
|
exitCode: 0,
|
|
@@ -10636,7 +10647,7 @@ async function dispatchAgentSession(options) {
|
|
|
10636
10647
|
}
|
|
10637
10648
|
}
|
|
10638
10649
|
|
|
10639
|
-
// ../../node_modules/.pnpm/subagent@0.4.
|
|
10650
|
+
// ../../node_modules/.pnpm/subagent@0.4.6/node_modules/subagent/dist/vscode/provision.js
|
|
10640
10651
|
import { writeFile as writeFile2 } from "fs/promises";
|
|
10641
10652
|
import path6 from "path";
|
|
10642
10653
|
var DEFAULT_WORKSPACE_TEMPLATE2 = {
|
|
@@ -10647,7 +10658,7 @@ var DEFAULT_WORKSPACE_TEMPLATE2 = {
|
|
|
10647
10658
|
],
|
|
10648
10659
|
settings: {
|
|
10649
10660
|
"chat.modeFilesLocations": {
|
|
10650
|
-
"
|
|
10661
|
+
".github/agents/**/*.md": true
|
|
10651
10662
|
}
|
|
10652
10663
|
}
|
|
10653
10664
|
};
|
|
@@ -10697,9 +10708,11 @@ async function provisionSubagents(options) {
|
|
|
10697
10708
|
break;
|
|
10698
10709
|
}
|
|
10699
10710
|
const subagentDir = subagent.absolutePath;
|
|
10711
|
+
const githubAgentsDir = path6.join(subagentDir, ".github", "agents");
|
|
10700
10712
|
const lockFile = path6.join(subagentDir, lockName);
|
|
10701
10713
|
const workspaceDst = path6.join(subagentDir, `${path6.basename(subagentDir)}.code-workspace`);
|
|
10702
|
-
const wakeupDst = path6.join(
|
|
10714
|
+
const wakeupDst = path6.join(githubAgentsDir, "wakeup.md");
|
|
10715
|
+
const subagentDst = path6.join(githubAgentsDir, "subagent.md");
|
|
10703
10716
|
const isLocked = await pathExists(lockFile);
|
|
10704
10717
|
if (isLocked && !force) {
|
|
10705
10718
|
continue;
|
|
@@ -10707,6 +10720,7 @@ async function provisionSubagents(options) {
|
|
|
10707
10720
|
if (isLocked && force) {
|
|
10708
10721
|
if (!dryRun) {
|
|
10709
10722
|
await removeIfExists(lockFile);
|
|
10723
|
+
await ensureDir(githubAgentsDir);
|
|
10710
10724
|
await writeFile2(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
10711
10725
|
await writeFile2(wakeupDst, wakeupContent, "utf8");
|
|
10712
10726
|
}
|
|
@@ -10717,6 +10731,7 @@ async function provisionSubagents(options) {
|
|
|
10717
10731
|
}
|
|
10718
10732
|
if (!isLocked && force) {
|
|
10719
10733
|
if (!dryRun) {
|
|
10734
|
+
await ensureDir(githubAgentsDir);
|
|
10720
10735
|
await writeFile2(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
10721
10736
|
await writeFile2(wakeupDst, wakeupContent, "utf8");
|
|
10722
10737
|
}
|
|
@@ -10725,6 +10740,7 @@ async function provisionSubagents(options) {
|
|
|
10725
10740
|
continue;
|
|
10726
10741
|
}
|
|
10727
10742
|
if (!dryRun && !await pathExists(workspaceDst)) {
|
|
10743
|
+
await ensureDir(githubAgentsDir);
|
|
10728
10744
|
await writeFile2(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
10729
10745
|
await writeFile2(wakeupDst, wakeupContent, "utf8");
|
|
10730
10746
|
}
|
|
@@ -10735,10 +10751,13 @@ async function provisionSubagents(options) {
|
|
|
10735
10751
|
while (subagentsProvisioned < subagents) {
|
|
10736
10752
|
nextIndex += 1;
|
|
10737
10753
|
const subagentDir = path6.join(targetPath, `subagent-${nextIndex}`);
|
|
10754
|
+
const githubAgentsDir = path6.join(subagentDir, ".github", "agents");
|
|
10738
10755
|
const workspaceDst = path6.join(subagentDir, `${path6.basename(subagentDir)}.code-workspace`);
|
|
10739
|
-
const wakeupDst = path6.join(
|
|
10756
|
+
const wakeupDst = path6.join(githubAgentsDir, "wakeup.md");
|
|
10757
|
+
const subagentDst = path6.join(githubAgentsDir, "subagent.md");
|
|
10740
10758
|
if (!dryRun) {
|
|
10741
10759
|
await ensureDir(subagentDir);
|
|
10760
|
+
await ensureDir(githubAgentsDir);
|
|
10742
10761
|
await writeFile2(workspaceDst, JSON.stringify(workspaceTemplate, null, 2), "utf8");
|
|
10743
10762
|
await writeFile2(wakeupDst, wakeupContent, "utf8");
|
|
10744
10763
|
}
|
|
@@ -11761,7 +11780,7 @@ function buildMandatoryPrereadBlock(guidelineFiles) {
|
|
|
11761
11780
|
for (const absolutePath of guidelineFiles) {
|
|
11762
11781
|
counter += 1;
|
|
11763
11782
|
const fileName = path22.basename(absolutePath);
|
|
11764
|
-
const fileUri =
|
|
11783
|
+
const fileUri = pathToFileUri2(absolutePath);
|
|
11765
11784
|
fileList.push(`* [${fileName}](${fileUri})`);
|
|
11766
11785
|
}
|
|
11767
11786
|
const filesText = fileList.join("\n");
|
|
@@ -11791,7 +11810,7 @@ function collectGuidelineFiles(attachments, guidelinePatterns) {
|
|
|
11791
11810
|
}
|
|
11792
11811
|
return Array.from(unique.values());
|
|
11793
11812
|
}
|
|
11794
|
-
function
|
|
11813
|
+
function pathToFileUri2(filePath) {
|
|
11795
11814
|
const absolutePath = path22.isAbsolute(filePath) ? filePath : path22.resolve(filePath);
|
|
11796
11815
|
const normalizedPath = absolutePath.replace(/\\/g, "/");
|
|
11797
11816
|
if (/^[a-zA-Z]:\//.test(normalizedPath)) {
|
|
@@ -14722,4 +14741,4 @@ export {
|
|
|
14722
14741
|
createProgram,
|
|
14723
14742
|
runCli
|
|
14724
14743
|
};
|
|
14725
|
-
//# sourceMappingURL=chunk-
|
|
14744
|
+
//# sourceMappingURL=chunk-JT3E7T7V.js.map
|