@agentbean/daemon 0.1.29 → 0.1.31
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.
|
@@ -11,6 +11,10 @@ function buildPrompt(input, systemPrompt) {
|
|
|
11
11
|
parts.push(input.prompt);
|
|
12
12
|
return parts.join('\n\n---\n\n');
|
|
13
13
|
}
|
|
14
|
+
function normalizeClaudeArgs(args) {
|
|
15
|
+
const filtered = (args ?? []).filter((arg) => arg !== '--bare');
|
|
16
|
+
return ['-p', ...filtered];
|
|
17
|
+
}
|
|
14
18
|
export class ClaudeCodeAdapter {
|
|
15
19
|
opts;
|
|
16
20
|
kind = 'claude-code';
|
|
@@ -21,7 +25,7 @@ export class ClaudeCodeAdapter {
|
|
|
21
25
|
return new Promise((resolve, reject) => {
|
|
22
26
|
const prompt = buildPrompt(input, this.opts.systemPrompt ?? input.systemPrompt);
|
|
23
27
|
const cwd = input.workspace ?? this.opts.cwd ?? process.cwd();
|
|
24
|
-
const baseArgs =
|
|
28
|
+
const baseArgs = normalizeClaudeArgs(this.opts.args);
|
|
25
29
|
if (input.workspace)
|
|
26
30
|
baseArgs.push('--add-dir', input.workspace);
|
|
27
31
|
baseArgs.push('--add-dir', join(homedir(), '.codex', 'generated_images'));
|
package/dist/adapters/codex.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'node-pty';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
2
4
|
function renderPayload(input, systemPrompt) {
|
|
3
5
|
const parts = [];
|
|
4
6
|
if (systemPrompt)
|
|
@@ -52,6 +54,19 @@ function adapterTimeoutMs() {
|
|
|
52
54
|
const fromEnv = Number.parseInt(process.env.AGENTBEAN_CODEX_TIMEOUT_MS ?? '', 10);
|
|
53
55
|
return Number.isFinite(fromEnv) && fromEnv > 0 ? fromEnv : 900_000;
|
|
54
56
|
}
|
|
57
|
+
function buildRuntimeEnv(extra) {
|
|
58
|
+
const pathEntries = [
|
|
59
|
+
process.env.PATH,
|
|
60
|
+
'/opt/homebrew/bin',
|
|
61
|
+
'/usr/local/bin',
|
|
62
|
+
join(homedir(), '.local/bin'),
|
|
63
|
+
join(homedir(), '.bun/bin'),
|
|
64
|
+
join(homedir(), '.npm-global/bin'),
|
|
65
|
+
join(homedir(), '.asdf/shims'),
|
|
66
|
+
join(homedir(), '.local/share/mise/shims'),
|
|
67
|
+
].filter(Boolean).join(':');
|
|
68
|
+
return { ...process.env, PATH: pathEntries, ...(extra ?? {}) };
|
|
69
|
+
}
|
|
55
70
|
export class CodexAdapter {
|
|
56
71
|
opts;
|
|
57
72
|
kind = 'codex';
|
|
@@ -74,7 +89,7 @@ export class CodexAdapter {
|
|
|
74
89
|
cols: 80,
|
|
75
90
|
rows: 30,
|
|
76
91
|
cwd,
|
|
77
|
-
env:
|
|
92
|
+
env: buildRuntimeEnv(input.env),
|
|
78
93
|
});
|
|
79
94
|
const chunks = [];
|
|
80
95
|
let finished = false;
|
|
@@ -128,7 +143,7 @@ export class CodexAdapter {
|
|
|
128
143
|
const pty = spawn('bash', ['-c', 'codex --version'], {
|
|
129
144
|
name: 'xterm-color', cols: 80, rows: 30,
|
|
130
145
|
cwd: this.opts.cwd ?? process.cwd(),
|
|
131
|
-
env:
|
|
146
|
+
env: buildRuntimeEnv(),
|
|
132
147
|
});
|
|
133
148
|
pty.onExit(({ exitCode }) => resolve({ ok: exitCode === 0, detail: exitCode === 0 ? undefined : `exit ${exitCode}` }));
|
|
134
149
|
}
|
package/dist/device-daemon.js
CHANGED
|
@@ -71,6 +71,14 @@ export function resolveCustomAgentRuntime(custom, runtimes) {
|
|
|
71
71
|
if (bestRuntime?.command?.trim()) {
|
|
72
72
|
return { command: bestRuntime.command.trim(), runtime: bestRuntime };
|
|
73
73
|
}
|
|
74
|
+
if (configured && isAbsolute(configured) && !configuredAbsoluteExists) {
|
|
75
|
+
const fallback = basename(configured).trim();
|
|
76
|
+
if (fallback)
|
|
77
|
+
return { command: fallback };
|
|
78
|
+
}
|
|
79
|
+
if (!configured && normalizeAdapterKind(custom.adapterKind) === 'codex') {
|
|
80
|
+
return { command: 'codex' };
|
|
81
|
+
}
|
|
74
82
|
return { command: configured };
|
|
75
83
|
}
|
|
76
84
|
export function nativeDirectoryPickerCommands(platform = process.platform) {
|