@agentconnect.md/daemon 1.41.0-rc.43 → 1.41.0-rc.46
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/dist/shim/index.js +29 -0
- package/dist/shim/index.js.map +1 -1
- package/package.json +1 -1
package/dist/shim/index.js
CHANGED
|
@@ -8065,6 +8065,32 @@ discriminatedUnion("event", [object({
|
|
|
8065
8065
|
})]);
|
|
8066
8066
|
//#endregion
|
|
8067
8067
|
//#region src/shim/acp-runner.ts
|
|
8068
|
+
/** Pod-env names the runtime image accepts, mapped onto the matching runtime's own provider
|
|
8069
|
+
* variables. Interim until the managed egress proxy lands: the key stays deployment-owned
|
|
8070
|
+
* (SandboxTemplate env) instead of traveling from the daemon, and only the runtime whose
|
|
8071
|
+
* vendor the variable names ever sees it. */
|
|
8072
|
+
const SANDBOX_PROVIDER_ENV = {
|
|
8073
|
+
claude: {
|
|
8074
|
+
AC_CLAUDE_BASE_URL: "ANTHROPIC_BASE_URL",
|
|
8075
|
+
AC_CLAUDE_API_KEY: "ANTHROPIC_API_KEY"
|
|
8076
|
+
},
|
|
8077
|
+
codex: {
|
|
8078
|
+
AC_CODEX_BASE_URL: "OPENAI_BASE_URL",
|
|
8079
|
+
AC_CODEX_API_KEY: "OPENAI_API_KEY"
|
|
8080
|
+
}
|
|
8081
|
+
};
|
|
8082
|
+
/** Provider env for the REQUESTED command (its registry identity, not the resolved path). */
|
|
8083
|
+
function sandboxProviderEnv(command, podEnv) {
|
|
8084
|
+
const base = command.split(/[\\/]/).pop() ?? "";
|
|
8085
|
+
const profile = /^claude(?:$|[-.@])/i.test(base) ? "claude" : /^codex(?:$|[-.@])/i.test(base) ? "codex" : void 0;
|
|
8086
|
+
if (!profile) return {};
|
|
8087
|
+
const env = {};
|
|
8088
|
+
for (const [source, target] of Object.entries(SANDBOX_PROVIDER_ENV[profile])) {
|
|
8089
|
+
const value = podEnv[source]?.trim();
|
|
8090
|
+
if (value) env[target] = value;
|
|
8091
|
+
}
|
|
8092
|
+
return env;
|
|
8093
|
+
}
|
|
8068
8094
|
/**
|
|
8069
8095
|
* Runs the ACP runtime inside the sandbox and relays its stdio.
|
|
8070
8096
|
*
|
|
@@ -8101,6 +8127,7 @@ var AcpRunner = class {
|
|
|
8101
8127
|
const resolved = this.deps.resolveCommand?.(hint.command, env);
|
|
8102
8128
|
if (resolved) env[hint.envVar] = resolved;
|
|
8103
8129
|
}
|
|
8130
|
+
for (const [name, value] of Object.entries(sandboxProviderEnv(payload.command, this.deps.podEnv ?? {}))) if (!env[name]) env[name] = value;
|
|
8104
8131
|
const child = spawn(this.deps.resolveCommand?.(payload.command, env) ?? payload.command, payload.args, {
|
|
8105
8132
|
stdio: [
|
|
8106
8133
|
"pipe",
|
|
@@ -8462,6 +8489,7 @@ var ShimClient = class {
|
|
|
8462
8489
|
const runner = new AcpRunner({
|
|
8463
8490
|
emit: (event) => this.emitEvent(streamId, event),
|
|
8464
8491
|
...this.deps.resolveCommand ? { resolveCommand: this.deps.resolveCommand } : {},
|
|
8492
|
+
...this.deps.podEnv ? { podEnv: this.deps.podEnv } : {},
|
|
8465
8493
|
...this.deps.log ? { log: this.deps.log } : {}
|
|
8466
8494
|
});
|
|
8467
8495
|
this.acpStreams.set(streamId, runner);
|
|
@@ -8920,6 +8948,7 @@ async function main() {
|
|
|
8920
8948
|
path: opts.path
|
|
8921
8949
|
}),
|
|
8922
8950
|
resolveCommand: resolveCommandInPath,
|
|
8951
|
+
podEnv: process.env,
|
|
8923
8952
|
handle: createExecHandler({
|
|
8924
8953
|
workspaceRoot: process.env["AC_SHIM_WORKSPACE_ROOT"] ?? "/agent",
|
|
8925
8954
|
log
|