@agentproto/driver-agent-cli 2.2.0 → 2.2.2
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.
|
@@ -691,6 +691,22 @@ function createPrintSession(opts) {
|
|
|
691
691
|
stdio: ["ignore", "pipe", "pipe"]
|
|
692
692
|
});
|
|
693
693
|
activeChild = child;
|
|
694
|
+
let spawnFailure;
|
|
695
|
+
await new Promise((resolve) => {
|
|
696
|
+
child.once("spawn", () => resolve());
|
|
697
|
+
child.once("error", (err) => {
|
|
698
|
+
spawnFailure = err;
|
|
699
|
+
resolve();
|
|
700
|
+
});
|
|
701
|
+
});
|
|
702
|
+
if (spawnFailure) {
|
|
703
|
+
activeChild = null;
|
|
704
|
+
yield {
|
|
705
|
+
kind: "error",
|
|
706
|
+
error: { message: `failed to spawn '${execBin} ${execArgs.join(" ")}': ${spawnFailure.message}` }
|
|
707
|
+
};
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
694
710
|
const stderrLines = [];
|
|
695
711
|
const STDERR_KEEP = 80;
|
|
696
712
|
child.stderr?.setEncoding("utf8");
|
|
@@ -1618,11 +1634,15 @@ var defineAgentCli = createDoctype(
|
|
|
1618
1634
|
}
|
|
1619
1635
|
}
|
|
1620
1636
|
);
|
|
1637
|
+
function resolveSpawnBin(bin) {
|
|
1638
|
+
return bin === "node" ? process.execPath : bin;
|
|
1639
|
+
}
|
|
1621
1640
|
function createAgentCliRuntime(definition) {
|
|
1622
1641
|
return {
|
|
1623
1642
|
definition,
|
|
1624
1643
|
async start(opts) {
|
|
1625
1644
|
const cwd = opts?.cwd ?? process.cwd();
|
|
1645
|
+
const resolvedBin = resolveSpawnBin(definition.bin);
|
|
1626
1646
|
const contextMode = opts?.contextProfile ? (definition.modes ?? []).find(
|
|
1627
1647
|
(mode) => mode.id === opts.contextProfile && mode.kind === "context"
|
|
1628
1648
|
) : void 0;
|
|
@@ -1671,17 +1691,21 @@ function createAgentCliRuntime(definition) {
|
|
|
1671
1691
|
join(claudeConfigDir, ".claude.json"),
|
|
1672
1692
|
JSON.stringify({ mcpServers: {} })
|
|
1673
1693
|
);
|
|
1694
|
+
const isolatedSettings = {
|
|
1695
|
+
attribution: { commit: "", pr: "", sessionUrl: false }
|
|
1696
|
+
};
|
|
1674
1697
|
if (permissionMode) {
|
|
1675
|
-
|
|
1676
|
-
join(claudeConfigDir, "settings.json"),
|
|
1677
|
-
JSON.stringify({ permissions: { defaultMode: permissionMode } })
|
|
1678
|
-
);
|
|
1698
|
+
isolatedSettings.permissions = { defaultMode: permissionMode };
|
|
1679
1699
|
}
|
|
1700
|
+
writeFileSync(
|
|
1701
|
+
join(claudeConfigDir, "settings.json"),
|
|
1702
|
+
JSON.stringify(isolatedSettings)
|
|
1703
|
+
);
|
|
1680
1704
|
env.CLAUDE_CONFIG_DIR = claudeConfigDir;
|
|
1681
1705
|
}
|
|
1682
1706
|
if (definition.protocol === "print") {
|
|
1683
1707
|
return createPrintSession({
|
|
1684
|
-
bin:
|
|
1708
|
+
bin: resolvedBin,
|
|
1685
1709
|
baseArgs: composed.binArgs,
|
|
1686
1710
|
cwd,
|
|
1687
1711
|
env,
|
|
@@ -1696,7 +1720,7 @@ function createAgentCliRuntime(definition) {
|
|
|
1696
1720
|
const stderrBuf = [];
|
|
1697
1721
|
if (definition.protocol !== "proprietary") {
|
|
1698
1722
|
const [execBin, execArgs] = await wrapAgentCliSpawn(
|
|
1699
|
-
|
|
1723
|
+
resolvedBin,
|
|
1700
1724
|
composed.binArgs,
|
|
1701
1725
|
{
|
|
1702
1726
|
mode: opts?.commandSandbox,
|
|
@@ -1705,12 +1729,29 @@ function createAgentCliRuntime(definition) {
|
|
|
1705
1729
|
label: definition.id
|
|
1706
1730
|
}
|
|
1707
1731
|
);
|
|
1708
|
-
|
|
1732
|
+
const spawned = spawn(execBin, execArgs, {
|
|
1709
1733
|
cwd,
|
|
1710
1734
|
env,
|
|
1711
1735
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1712
1736
|
signal: opts?.signal
|
|
1713
1737
|
});
|
|
1738
|
+
child = spawned;
|
|
1739
|
+
let spawnFailure;
|
|
1740
|
+
await new Promise((resolve) => {
|
|
1741
|
+
spawned.once("spawn", () => resolve());
|
|
1742
|
+
spawned.once("error", (err) => {
|
|
1743
|
+
spawnFailure = err;
|
|
1744
|
+
resolve();
|
|
1745
|
+
});
|
|
1746
|
+
});
|
|
1747
|
+
if (spawnFailure) {
|
|
1748
|
+
throw new Error(
|
|
1749
|
+
`agent-cli '${definition.id}': failed to spawn '${execBin} ${execArgs.join(" ")}': ${spawnFailure.message}`
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
spawned.on("error", (err) => {
|
|
1753
|
+
stderrBuf.push(`[spawn error] ${err.message}`);
|
|
1754
|
+
});
|
|
1714
1755
|
const STDERR_KEEP_LINES = 80;
|
|
1715
1756
|
child.stderr?.setEncoding("utf8");
|
|
1716
1757
|
child.stderr?.on("data", (chunk) => {
|
|
@@ -1868,5 +1909,5 @@ function filterStringEnv(env) {
|
|
|
1868
1909
|
}
|
|
1869
1910
|
|
|
1870
1911
|
export { LEGACY_GATEWAY_MODE_IDS, LEGACY_POSTURE_MODE_IDS, RuntimeConfigError, agentCliFrontmatterSchema, applyModelCommand, autoAllowPermissionHandler, composeSpawn, createAcpProtocolArm, createAgentCliRuntime, createArmSessionControls, createMastraMapperState, createPrintSession, createProprietaryProtocolArm, defineAgentCli, inferLegacyModeKind, isLegacyExtractedModeId, mapMastraEvent, planModePermissionHandler, promptTurn, resolveContinuationStrategy, runtimeConfigSchema, toFileBasedMcpServers };
|
|
1871
|
-
//# sourceMappingURL=chunk-
|
|
1872
|
-
//# sourceMappingURL=chunk-
|
|
1912
|
+
//# sourceMappingURL=chunk-ZXVIBZ4S.mjs.map
|
|
1913
|
+
//# sourceMappingURL=chunk-ZXVIBZ4S.mjs.map
|