@span-io/agent-link 0.0.3 → 0.1.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.
package/dist/index.js CHANGED
@@ -89,9 +89,19 @@ function handleControl(message) {
89
89
  else if (targetModel.startsWith("claude-")) {
90
90
  preferredAgent = "claude";
91
91
  }
92
+ else if (targetModel.includes("codex") || targetModel.startsWith("gpt-")) {
93
+ preferredAgent = "codex";
94
+ }
92
95
  }
93
96
  if (!preferredAgent) {
94
- preferredAgent = payload?.name || "codex";
97
+ // Only use payload.name if it matches a known binary, otherwise default to codex
98
+ const candidateName = payload?.name?.toLowerCase();
99
+ if (candidateName && ["codex", "gemini", "claude"].includes(candidateName)) {
100
+ preferredAgent = candidateName;
101
+ }
102
+ else {
103
+ preferredAgent = "codex";
104
+ }
95
105
  }
96
106
  const agentCandidate = resolveAgentBinary(preferredAgent, discovered);
97
107
  if (!agentCandidate) {
@@ -94,10 +94,15 @@ export function spawnAgentProcess(config) {
94
94
  const workingDir = process.env.CODEX_CWD ?? defaultCwd;
95
95
  // For logging/display
96
96
  const commandString = [command, ...args].map(shellQuote).join(" ");
97
- const finalCommand = useScriptWrapper ? "script" : command;
98
- // Script wrapper args: -q (quiet), -c (command), /dev/null (output file)
99
- const finalArgs = useScriptWrapper
100
- ? ["-q", "-c", commandString, "/dev/null"]
97
+ const platform = process.platform;
98
+ const canUseScript = useScriptWrapper && platform !== "win32";
99
+ const finalCommand = canUseScript ? "script" : command;
100
+ const finalArgs = canUseScript
101
+ ? platform === "darwin"
102
+ // BSD script: no -c, use "script -q /dev/null sh -c <command>"
103
+ ? ["-q", "/dev/null", "sh", "-c", commandString]
104
+ // GNU script: "script -q -c <command> /dev/null"
105
+ : ["-q", "-c", commandString, "/dev/null"]
101
106
  : args;
102
107
  const child = spawn(finalCommand, finalArgs, {
103
108
  stdio: [promptMode === "stdin" ? "pipe" : "ignore", "pipe", "pipe"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@span-io/agent-link",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "description": "Secure bridge between Span (AI control plane) and local agent CLI tools.",
5
5
  "type": "module",
6
6
  "bin": {