@bakers-build/addon-claude 0.9.1-next.3 → 0.9.1-next.5
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/src/index.d.ts +12 -6
- package/dist/src/index.js +17 -9
- package/dist/src/preset.js +14 -2
- package/dist/src/run.d.ts +4 -0
- package/dist/src/run.js +55 -0
- package/dist/src/setup.d.ts +3 -0
- package/dist/src/setup.js +14 -0
- package/measure/agent-proxy.mjs +3 -1
- package/measure/claude-measure.mjs +54 -40
- package/options.schema.json +6 -1
- package/package.json +4 -4
package/dist/src/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type BbAgent, type MarketplaceDeclaration, type PluginLaunch, type ResolvedSecurity, type RunEnvPolicy, type SandboxHost, type SandboxPreflight, type SecurityOptions } from '@bakers-build/conductor/contract';
|
|
1
|
+
import { type AgentFootprint, type AgentPlugin, type AgentRunContext, type AgentRunIdentity, type BbAgent, type MarketplaceDeclaration, type PluginLaunch, type ResolvedSecurity, type RunEnvPolicy, type SandboxHost, type SandboxPreflight, type SecurityOptions } from '@bakers-build/conductor/contract';
|
|
2
2
|
export { parseClaudeTranscript } from './footprint.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* directory under `~/.claude/projects/`: every non-alphanumeric char → `-`.
|
|
6
|
-
*/
|
|
7
|
-
export declare function encodeClaudeProjectDir(cwd: string): string;
|
|
3
|
+
export { encodeClaudeProjectDir } from './run.js';
|
|
4
|
+
export { claudeInstallCommand, claudeModelApi } from './setup.js';
|
|
8
5
|
export interface ClaudeAgentOptions extends SecurityOptions {
|
|
9
6
|
model?: string;
|
|
10
7
|
effort?: string;
|
|
@@ -15,12 +12,19 @@ export interface ClaudeAgentOptions extends SecurityOptions {
|
|
|
15
12
|
* applies the state-group settings shipped with the addon.
|
|
16
13
|
*/
|
|
17
14
|
measure?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When true (and `measure` is not), the unchanged launch runs through
|
|
17
|
+
* `claude-measure.mjs --capture`, which only logs every model request.
|
|
18
|
+
*/
|
|
19
|
+
proxy?: boolean;
|
|
18
20
|
/** False runs this agent in the user's own `~/.claude`, without the project's plugins. */
|
|
19
21
|
plugins?: boolean;
|
|
20
22
|
}
|
|
21
23
|
export declare class ClaudeAgent implements BbAgent {
|
|
22
24
|
private readonly home;
|
|
23
25
|
readonly id = "claude";
|
|
26
|
+
readonly installCommand = "npm install -g @anthropic-ai/claude-code@latest";
|
|
27
|
+
readonly modelApi: import("@bakers-build/conductor/contract").AgentModelApi;
|
|
24
28
|
private readonly args;
|
|
25
29
|
private readonly model;
|
|
26
30
|
private readonly effort;
|
|
@@ -32,6 +36,7 @@ export declare class ClaudeAgent implements BbAgent {
|
|
|
32
36
|
/** Set by the last launch: the conductor's server replaced the sandbox's own `bakers`. */
|
|
33
37
|
private replacedBakersServer;
|
|
34
38
|
private readonly measure;
|
|
39
|
+
private readonly proxy;
|
|
35
40
|
private readonly overrides;
|
|
36
41
|
readonly pluginsDisabled: boolean;
|
|
37
42
|
/** The Claude config dir runs read and write: the agent home while plugins are on. */
|
|
@@ -40,6 +45,7 @@ export declare class ClaudeAgent implements BbAgent {
|
|
|
40
45
|
constructor(options?: ClaudeAgentOptions, home?: string);
|
|
41
46
|
/** Point this agent at the agent home of the project's declared marketplaces. */
|
|
42
47
|
useMarketplaces(marketplaces: readonly MarketplaceDeclaration[]): void;
|
|
48
|
+
prepareRun(context: AgentRunContext): import("@bakers-build/conductor/contract").AgentRunPreparation;
|
|
43
49
|
installPlugins(marketplaces: readonly MarketplaceDeclaration[], home: string): Promise<PluginLaunch>;
|
|
44
50
|
get launchWarnings(): readonly string[];
|
|
45
51
|
/** A measured run stays without the conductor's tools, MCP or bridge. */
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,11 @@ import { promisify } from 'node:util';
|
|
|
8
8
|
import { CONDUCTOR_TOKEN_ENV, CONDUCTOR_TOOL_TIMEOUT_MS, CONDUCTOR_TOOLS_SERVER, ensureHome, homeKey, homePath, installCommand, lastLine, resolveAgentCliOptions, resolveSecurityOptions, systemSandboxHost, validateOptionalBoolean, } from '@bakers-build/conductor/contract';
|
|
9
9
|
import { gitSandboxPaths, shellQuote, withoutGitDirs, } from '@bakers-build/core';
|
|
10
10
|
import { parseClaudeTranscript } from './footprint.js';
|
|
11
|
+
import { encodeClaudeProjectDir, prepareClaudeRun } from './run.js';
|
|
12
|
+
import { claudeInstallCommand, claudeModelApi } from './setup.js';
|
|
11
13
|
export { parseClaudeTranscript } from './footprint.js';
|
|
14
|
+
export { encodeClaudeProjectDir } from './run.js';
|
|
15
|
+
export { claudeInstallCommand, claudeModelApi } from './setup.js';
|
|
12
16
|
/** src/index.ts and dist/src/index.js both sit two levels below the package root. */
|
|
13
17
|
const MEASURE_WRAPPER = fileURLToPath(new URL(import.meta.url.includes('/dist/')
|
|
14
18
|
? '../../measure/claude-measure.mjs'
|
|
@@ -90,13 +94,6 @@ function securityFlags({ mode, sandbox, config }, workspacePath, pluginsOn = fal
|
|
|
90
94
|
JSON.stringify(settings),
|
|
91
95
|
];
|
|
92
96
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Encode an absolute cwd the way Claude Code names its per-project transcript
|
|
95
|
-
* directory under `~/.claude/projects/`: every non-alphanumeric char → `-`.
|
|
96
|
-
*/
|
|
97
|
-
export function encodeClaudeProjectDir(cwd) {
|
|
98
|
-
return cwd.replace(/[^a-zA-Z0-9]/g, '-');
|
|
99
|
-
}
|
|
100
97
|
const run = promisify(execFile);
|
|
101
98
|
/** Run `claude <args> --json` in `configDir`; a failure names `what` and the CLI's output. */
|
|
102
99
|
async function claudeJson(configDir, what, args) {
|
|
@@ -128,6 +125,8 @@ const CLAUDE_KNOWN = [
|
|
|
128
125
|
export class ClaudeAgent {
|
|
129
126
|
home;
|
|
130
127
|
id = 'claude';
|
|
128
|
+
installCommand = claudeInstallCommand;
|
|
129
|
+
modelApi = claudeModelApi;
|
|
131
130
|
args;
|
|
132
131
|
model;
|
|
133
132
|
effort;
|
|
@@ -139,6 +138,7 @@ export class ClaudeAgent {
|
|
|
139
138
|
/** Set by the last launch: the conductor's server replaced the sandbox's own `bakers`. */
|
|
140
139
|
replacedBakersServer = false;
|
|
141
140
|
measure;
|
|
141
|
+
proxy;
|
|
142
142
|
overrides;
|
|
143
143
|
pluginsDisabled;
|
|
144
144
|
/** The Claude config dir runs read and write: the agent home while plugins are on. */
|
|
@@ -164,6 +164,7 @@ export class ClaudeAgent {
|
|
|
164
164
|
this.securityMode = security.mode;
|
|
165
165
|
this.runEnvPolicy = security.runEnvPolicy;
|
|
166
166
|
this.measure = validateOptionalBoolean(options.measure, 'measure') ?? false;
|
|
167
|
+
this.proxy = validateOptionalBoolean(options.proxy, 'proxy') ?? false;
|
|
167
168
|
this.pluginsDisabled =
|
|
168
169
|
validateOptionalBoolean(options.plugins, 'plugins') === false;
|
|
169
170
|
this.configDir = join(home, '.claude');
|
|
@@ -175,6 +176,9 @@ export class ClaudeAgent {
|
|
|
175
176
|
this.pluginsOn = true;
|
|
176
177
|
this.configDir = homePath(this.id, homeKey([...marketplaces]));
|
|
177
178
|
}
|
|
179
|
+
prepareRun(context) {
|
|
180
|
+
return prepareClaudeRun(context, this.configDir);
|
|
181
|
+
}
|
|
178
182
|
async installPlugins(marketplaces, home) {
|
|
179
183
|
const outcome = await ensureHome(home, async (dir) => {
|
|
180
184
|
const credentials = join(this.home, '.claude', '.credentials.json');
|
|
@@ -229,8 +233,12 @@ export class ClaudeAgent {
|
|
|
229
233
|
? ['node', shellQuote(TRUST_WRAPPER), shellQuote(workspacePath)]
|
|
230
234
|
: []),
|
|
231
235
|
...(this.measure
|
|
232
|
-
? ['node', shellQuote(MEASURE_WRAPPER)
|
|
233
|
-
:
|
|
236
|
+
? ['node', shellQuote(MEASURE_WRAPPER)]
|
|
237
|
+
: this.proxy
|
|
238
|
+
? ['node', shellQuote(MEASURE_WRAPPER), '--capture']
|
|
239
|
+
: []),
|
|
240
|
+
'claude',
|
|
241
|
+
shellQuote(prompt),
|
|
234
242
|
];
|
|
235
243
|
if (this.model !== undefined && !this.overrides.model) {
|
|
236
244
|
parts.push('--model', shellQuote(this.model));
|
package/dist/src/preset.js
CHANGED
|
@@ -27,11 +27,23 @@ export const agents = (acc, opts) => {
|
|
|
27
27
|
description: 'Demanding problems and long-running autonomous work.',
|
|
28
28
|
model: 'fable',
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
alias: 'opus-proxy',
|
|
32
|
+
description: 'Opus with every model request logged to `assets-ai/`; for diagnostics, not routine work.',
|
|
33
|
+
model: 'opus',
|
|
34
|
+
proxy: true,
|
|
35
|
+
},
|
|
30
36
|
].map((candidate) => 'agent' in candidate
|
|
31
37
|
? candidate
|
|
32
38
|
: {
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
alias: candidate.alias,
|
|
40
|
+
description: candidate.description,
|
|
41
|
+
model: candidate.model,
|
|
42
|
+
agent: claudeAgent({
|
|
43
|
+
...opts,
|
|
44
|
+
model: candidate.model,
|
|
45
|
+
...('proxy' in candidate && { proxy: candidate.proxy }),
|
|
46
|
+
}),
|
|
35
47
|
});
|
|
36
48
|
};
|
|
37
49
|
// Agents are per machine: list this addon in ~/.bakers/machine.config.js addons[].
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentRunContext, AgentRunPreparation } from '@bakers-build/conductor/contract';
|
|
2
|
+
export declare function encodeClaudeProjectDir(cwd: string): string;
|
|
3
|
+
/** Prepare Claude's files in the home supplied by any execution backend. */
|
|
4
|
+
export declare function prepareClaudeRun(context: AgentRunContext, configDir: string, hostEnv?: Readonly<Record<string, string | undefined>>): AgentRunPreparation;
|
package/dist/src/run.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, symlinkSync, writeFileSync, } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export function encodeClaudeProjectDir(cwd) {
|
|
4
|
+
return cwd.replace(/[^a-zA-Z0-9]/g, '-');
|
|
5
|
+
}
|
|
6
|
+
/** Prepare Claude's files in the home supplied by any execution backend. */
|
|
7
|
+
export function prepareClaudeRun(context, configDir, hostEnv = process.env) {
|
|
8
|
+
const source = context.env.CLAUDE_CONFIG_DIR ?? configDir;
|
|
9
|
+
const config = join(context.homePath, '.claude');
|
|
10
|
+
mkdirSync(config, { recursive: true });
|
|
11
|
+
if (existsSync(join(source, 'settings.json')))
|
|
12
|
+
copyFileSync(join(source, 'settings.json'), join(config, 'settings.json'));
|
|
13
|
+
const state = existsSync(join(source, '.claude.json'))
|
|
14
|
+
? JSON.parse(readFileSync(join(source, '.claude.json'), 'utf8'))
|
|
15
|
+
: {};
|
|
16
|
+
delete state.primaryApiKey;
|
|
17
|
+
const keys = ['CLAUDE_CODE_OAUTH_TOKEN', 'ANTHROPIC_API_KEY'];
|
|
18
|
+
const env = { CLAUDE_CONFIG_DIR: config };
|
|
19
|
+
const supplied = keys.some((key) => context.env[key]);
|
|
20
|
+
if (!supplied) {
|
|
21
|
+
const key = keys.find((name) => hostEnv[name]);
|
|
22
|
+
if (key)
|
|
23
|
+
env[key] = hostEnv[key];
|
|
24
|
+
else if (existsSync(join(source, '.credentials.json'))) {
|
|
25
|
+
const login = join(config, '.credentials.json');
|
|
26
|
+
copyFileSync(join(source, '.credentials.json'), login);
|
|
27
|
+
chmodSync(login, 0o600);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const apiKey = context.env.ANTHROPIC_API_KEY ?? env.ANTHROPIC_API_KEY;
|
|
31
|
+
writeFileSync(join(config, '.claude.json'), JSON.stringify({
|
|
32
|
+
...state,
|
|
33
|
+
hasCompletedOnboarding: true,
|
|
34
|
+
...(apiKey
|
|
35
|
+
? {
|
|
36
|
+
customApiKeyResponses: {
|
|
37
|
+
approved: [apiKey.slice(-20)],
|
|
38
|
+
rejected: [],
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
: {}),
|
|
42
|
+
}), { mode: 0o600 });
|
|
43
|
+
const readPaths = [];
|
|
44
|
+
const plugins = join(source, 'plugins');
|
|
45
|
+
if (existsSync(plugins)) {
|
|
46
|
+
symlinkSync(plugins, join(config, 'plugins'));
|
|
47
|
+
readPaths.push(plugins);
|
|
48
|
+
}
|
|
49
|
+
const key = encodeClaudeProjectDir(context.workspacePath);
|
|
50
|
+
const transcripts = join(source, 'projects', key);
|
|
51
|
+
mkdirSync(transcripts, { recursive: true });
|
|
52
|
+
mkdirSync(join(config, 'projects'), { recursive: true });
|
|
53
|
+
symlinkSync(transcripts, join(config, 'projects', key));
|
|
54
|
+
return { env, readPaths, writePaths: [transcripts] };
|
|
55
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const claudeInstallCommand = 'npm install -g @anthropic-ai/claude-code@latest';
|
|
2
|
+
export const claudeModelApi = {
|
|
3
|
+
target: 'https://api.anthropic.com',
|
|
4
|
+
baseUrlEnv: 'ANTHROPIC_BASE_URL',
|
|
5
|
+
keyEnv: 'ANTHROPIC_API_KEY',
|
|
6
|
+
auth: {
|
|
7
|
+
CLAUDE_CODE_OAUTH_TOKEN: {
|
|
8
|
+
set: { authorization: 'Bearer {value}' },
|
|
9
|
+
append: { 'anthropic-beta': 'oauth-2025-04-20' },
|
|
10
|
+
},
|
|
11
|
+
ANTHROPIC_API_KEY: { set: { 'x-api-key': '{value}' } },
|
|
12
|
+
},
|
|
13
|
+
credentialHint: 'set CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) or ANTHROPIC_API_KEY in the conductor environment',
|
|
14
|
+
};
|
package/measure/agent-proxy.mjs
CHANGED
|
@@ -37,6 +37,7 @@ const USAGE_KEYS = [
|
|
|
37
37
|
'input_tokens',
|
|
38
38
|
'cache_read_input_tokens',
|
|
39
39
|
'cache_creation_input_tokens',
|
|
40
|
+
'output_tokens',
|
|
40
41
|
];
|
|
41
42
|
const REDACT = new Set(['authorization', 'x-api-key', 'api-key']);
|
|
42
43
|
|
|
@@ -191,6 +192,7 @@ function renderAudit(a) {
|
|
|
191
192
|
`- **input_tokens**: ${a.usage.input_tokens}`,
|
|
192
193
|
`- **cache_read_input_tokens**: ${a.usage.cache_read_input_tokens}`,
|
|
193
194
|
`- **cache_creation_input_tokens**: ${a.usage.cache_creation_input_tokens}`,
|
|
195
|
+
`- **output_tokens**: ${a.usage.output_tokens}`,
|
|
194
196
|
]
|
|
195
197
|
: ['- **usage**: unknown'];
|
|
196
198
|
|
|
@@ -219,7 +221,7 @@ function printAudit(a, base, logDir) {
|
|
|
219
221
|
const top = a.toolRows.slice(0, 12);
|
|
220
222
|
const w = Math.max(4, ...top.map((r) => r.name.length));
|
|
221
223
|
const usage = a.usage
|
|
222
|
-
? ` · in ${a.usage.input_tokens} / cache-read ${a.usage.cache_read_input_tokens} / cache-create ${a.usage.cache_creation_input_tokens}`
|
|
224
|
+
? ` · in ${a.usage.input_tokens} / cache-read ${a.usage.cache_read_input_tokens} / cache-create ${a.usage.cache_creation_input_tokens} / out ${a.usage.output_tokens}`
|
|
223
225
|
: '';
|
|
224
226
|
console.log(
|
|
225
227
|
`\n[agent-proxy] ${a.toolCount} tools · ${a.toolsBytes.toLocaleString()} tool bytes · first user ${a.firstUserBytes.toLocaleString()} B${usage}`,
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
* command as `BB_PROXY_LOG_DIR`. When the
|
|
19
19
|
* proxy cannot start (no identifier, log directory not gitignored) the command
|
|
20
20
|
* still runs, unmeasured, with a warning on stderr.
|
|
21
|
+
*
|
|
22
|
+
* node claude-measure.mjs --capture claude <claude args…>
|
|
23
|
+
*
|
|
24
|
+
* The `with.proxy` mode: only the proxy, its log directory and
|
|
25
|
+
* `ANTHROPIC_BASE_URL`; argv and settings pass through unchanged and no
|
|
26
|
+
* settings file is written, so the log shows what a normal run sends.
|
|
21
27
|
*/
|
|
22
28
|
|
|
23
29
|
import { spawn, spawnSync } from 'node:child_process';
|
|
@@ -39,9 +45,12 @@ const GROUPS = {
|
|
|
39
45
|
review: 'review',
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
const
|
|
48
|
+
const argv = process.argv.slice(2);
|
|
49
|
+
// `--capture` only logs: argv and the caller's settings stay untouched.
|
|
50
|
+
const capture = argv[0] === '--capture';
|
|
51
|
+
const [command, ...args] = capture ? argv.slice(1) : argv;
|
|
43
52
|
if (!command) {
|
|
44
|
-
console.error('usage: node claude-measure.mjs <command> [args…]');
|
|
53
|
+
console.error('usage: node claude-measure.mjs [--capture] <command> [args…]');
|
|
45
54
|
process.exit(2);
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -62,43 +71,48 @@ function projectPlugins() {
|
|
|
62
71
|
return merged;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
/** Write the measure settings file; returns the temporary file to remove, if any. */
|
|
75
|
+
function writeMeasureSettings() {
|
|
76
|
+
// `--settings` outranks project settings, so fold the project's enabledPlugins
|
|
77
|
+
// into the copy: the profile is a default, the project has the last word.
|
|
78
|
+
const group = GROUPS[process.env.BAKERS_STATE] ?? 'ops';
|
|
79
|
+
let profile = JSON.parse(
|
|
80
|
+
fs.readFileSync(path.join(HERE, `keytec-${group}.json`), 'utf8'),
|
|
81
|
+
);
|
|
82
|
+
// The last one: an alias's own `--settings` precedes the measure flags.
|
|
83
|
+
const settingsAt = args.lastIndexOf('--settings');
|
|
84
|
+
// A security mode's inline settings (sandbox, custom) win over the profile;
|
|
85
|
+
// permission lists are joined so neither side's rules are lost.
|
|
86
|
+
const inline = settingsAt === -1 ? undefined : args[settingsAt + 1];
|
|
87
|
+
if (inline?.trimStart().startsWith('{')) {
|
|
88
|
+
const own = JSON.parse(inline);
|
|
89
|
+
const join = (key) => [
|
|
90
|
+
...(profile.permissions?.[key] ?? []),
|
|
91
|
+
...(own.permissions?.[key] ?? []),
|
|
92
|
+
];
|
|
93
|
+
profile = {
|
|
94
|
+
...profile,
|
|
95
|
+
...own,
|
|
96
|
+
permissions: {
|
|
97
|
+
...profile.permissions,
|
|
98
|
+
...own.permissions,
|
|
99
|
+
allow: join('allow'),
|
|
100
|
+
deny: join('deny'),
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
profile.enabledPlugins = { ...profile.enabledPlugins, ...projectPlugins() };
|
|
105
|
+
const ignored =
|
|
106
|
+
spawnSync('git', ['check-ignore', '-q', SETTINGS_REL]).status === 0;
|
|
107
|
+
const settingsFile = ignored
|
|
108
|
+
? SETTINGS_REL
|
|
109
|
+
: path.join(os.tmpdir(), `claude-measure-${randomUUID()}.settings.json`);
|
|
110
|
+
if (settingsAt !== -1) args[settingsAt + 1] = settingsFile;
|
|
111
|
+
fs.mkdirSync(path.dirname(settingsFile), { recursive: true });
|
|
112
|
+
fs.writeFileSync(settingsFile, `${JSON.stringify(profile, null, 2)}\n`);
|
|
113
|
+
return ignored ? undefined : settingsFile;
|
|
92
114
|
}
|
|
93
|
-
|
|
94
|
-
const ignored =
|
|
95
|
-
spawnSync('git', ['check-ignore', '-q', SETTINGS_REL]).status === 0;
|
|
96
|
-
const settingsFile = ignored
|
|
97
|
-
? SETTINGS_REL
|
|
98
|
-
: path.join(os.tmpdir(), `claude-measure-${randomUUID()}.settings.json`);
|
|
99
|
-
if (settingsAt !== -1) args[settingsAt + 1] = settingsFile;
|
|
100
|
-
fs.mkdirSync(path.dirname(settingsFile), { recursive: true });
|
|
101
|
-
fs.writeFileSync(settingsFile, `${JSON.stringify(profile, null, 2)}\n`);
|
|
115
|
+
const tempSettings = capture ? undefined : writeMeasureSettings();
|
|
102
116
|
|
|
103
117
|
const env = { ...process.env };
|
|
104
118
|
let proxy;
|
|
@@ -124,11 +138,11 @@ for (const signal of ['SIGTERM', 'SIGHUP']) {
|
|
|
124
138
|
}
|
|
125
139
|
child.on('error', (err) => {
|
|
126
140
|
console.error(`claude-measure: ${err.message}`);
|
|
127
|
-
if (
|
|
141
|
+
if (tempSettings) fs.rmSync(tempSettings, { force: true });
|
|
128
142
|
process.exit(127);
|
|
129
143
|
});
|
|
130
144
|
child.on('exit', async (code, signal) => {
|
|
131
145
|
await proxy?.close();
|
|
132
|
-
if (
|
|
146
|
+
if (tempSettings) fs.rmSync(tempSettings, { force: true });
|
|
133
147
|
process.exit(code ?? (signal ? 128 + os.constants.signals[signal] : 1));
|
|
134
148
|
});
|
package/options.schema.json
CHANGED
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
"description": "Start the launch through the addon's measuring proxy.",
|
|
10
10
|
"default": false
|
|
11
11
|
},
|
|
12
|
+
"proxy": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"description": "Log every model request of the unchanged launch to `assets-ai/`; `measure` wins.",
|
|
15
|
+
"default": false
|
|
16
|
+
},
|
|
12
17
|
"model": {
|
|
13
|
-
"description": "Passed as `--model`; replaces `opus`, `sonnet` and `
|
|
18
|
+
"description": "Passed as `--model`; replaces `opus`, `sonnet`, `fable` and `opus-proxy` with one custom candidate."
|
|
14
19
|
},
|
|
15
20
|
"effort": {
|
|
16
21
|
"description": "Passed as `--effort`."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-claude",
|
|
3
|
-
"version": "0.9.1-next.
|
|
3
|
+
"version": "0.9.1-next.5",
|
|
4
4
|
"description": "bakers.build agent plugin for the Claude CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"directory": "bakers-cli/addons/claude"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@bakers-build/conductor": "^0.9.1-next.
|
|
30
|
-
"@bakers-build/core": "^0.9.1-next.
|
|
29
|
+
"@bakers-build/conductor": "^0.9.1-next.5",
|
|
30
|
+
"@bakers-build/core": "^0.9.1-next.5"
|
|
31
31
|
},
|
|
32
32
|
"bakersBuild": {
|
|
33
|
-
"commit": "
|
|
33
|
+
"commit": "d9242cad6cabee1faf010b5d46ac1bac33f6e0a1",
|
|
34
34
|
"channel": "next"
|
|
35
35
|
}
|
|
36
36
|
}
|