@agentproto/driver-agent-cli 2.2.1 → 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;
|
|
@@ -1685,7 +1705,7 @@ function createAgentCliRuntime(definition) {
|
|
|
1685
1705
|
}
|
|
1686
1706
|
if (definition.protocol === "print") {
|
|
1687
1707
|
return createPrintSession({
|
|
1688
|
-
bin:
|
|
1708
|
+
bin: resolvedBin,
|
|
1689
1709
|
baseArgs: composed.binArgs,
|
|
1690
1710
|
cwd,
|
|
1691
1711
|
env,
|
|
@@ -1700,7 +1720,7 @@ function createAgentCliRuntime(definition) {
|
|
|
1700
1720
|
const stderrBuf = [];
|
|
1701
1721
|
if (definition.protocol !== "proprietary") {
|
|
1702
1722
|
const [execBin, execArgs] = await wrapAgentCliSpawn(
|
|
1703
|
-
|
|
1723
|
+
resolvedBin,
|
|
1704
1724
|
composed.binArgs,
|
|
1705
1725
|
{
|
|
1706
1726
|
mode: opts?.commandSandbox,
|
|
@@ -1709,12 +1729,29 @@ function createAgentCliRuntime(definition) {
|
|
|
1709
1729
|
label: definition.id
|
|
1710
1730
|
}
|
|
1711
1731
|
);
|
|
1712
|
-
|
|
1732
|
+
const spawned = spawn(execBin, execArgs, {
|
|
1713
1733
|
cwd,
|
|
1714
1734
|
env,
|
|
1715
1735
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1716
1736
|
signal: opts?.signal
|
|
1717
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
|
+
});
|
|
1718
1755
|
const STDERR_KEEP_LINES = 80;
|
|
1719
1756
|
child.stderr?.setEncoding("utf8");
|
|
1720
1757
|
child.stderr?.on("data", (chunk) => {
|
|
@@ -1872,5 +1909,5 @@ function filterStringEnv(env) {
|
|
|
1872
1909
|
}
|
|
1873
1910
|
|
|
1874
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 };
|
|
1875
|
-
//# sourceMappingURL=chunk-
|
|
1876
|
-
//# sourceMappingURL=chunk-
|
|
1912
|
+
//# sourceMappingURL=chunk-ZXVIBZ4S.mjs.map
|
|
1913
|
+
//# sourceMappingURL=chunk-ZXVIBZ4S.mjs.map
|