@gaia-ai/addon-claude 0.16.1 → 0.16.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.
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.js +22 -1
- package/package.json +7 -4
package/dist/src/index.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export interface ClaudeAgentOptions {
|
|
|
10
10
|
effort?: string;
|
|
11
11
|
args?: string[];
|
|
12
12
|
skip_permissions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* When true, the launch runs through `measure/claude-measure.mjs`, which
|
|
15
|
+
* starts the logging proxy for the lifetime of this Claude process and
|
|
16
|
+
* applies the state-group settings shipped with the addon.
|
|
17
|
+
*/
|
|
18
|
+
measure?: boolean;
|
|
13
19
|
}
|
|
14
20
|
export declare class ClaudeAgent implements GaiaAgent {
|
|
15
21
|
private readonly home;
|
|
@@ -18,6 +24,7 @@ export declare class ClaudeAgent implements GaiaAgent {
|
|
|
18
24
|
private readonly model;
|
|
19
25
|
private readonly effort;
|
|
20
26
|
private readonly skipPermissions;
|
|
27
|
+
private readonly measure;
|
|
21
28
|
private readonly overrides;
|
|
22
29
|
constructor(options?: ClaudeAgentOptions, home?: string);
|
|
23
30
|
launchCommand(prompt: string, run?: AgentRunIdentity): string;
|
package/dist/src/index.js
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import { resolveAgentCliOptions, validateOptionalBoolean, } from '@gaia-ai/conductor/contract';
|
|
5
6
|
import { shellQuote } from '@gaia-ai/core';
|
|
6
7
|
import { parseClaudeTranscript } from './footprint.js';
|
|
7
8
|
export { parseClaudeTranscript } from './footprint.js';
|
|
9
|
+
/** src/index.ts and dist/src/index.js both sit two levels below the package root. */
|
|
10
|
+
const MEASURE_WRAPPER = fileURLToPath(new URL(import.meta.url.includes('/dist/')
|
|
11
|
+
? '../../measure/claude-measure.mjs'
|
|
12
|
+
: '../measure/claude-measure.mjs', import.meta.url));
|
|
13
|
+
const MEASURE_FLAGS = [
|
|
14
|
+
'--setting-sources',
|
|
15
|
+
'project,local',
|
|
16
|
+
'--settings',
|
|
17
|
+
'.gaia/claude-measure.settings.json',
|
|
18
|
+
'--strict-mcp-config',
|
|
19
|
+
'--mcp-config',
|
|
20
|
+
'{"mcpServers":{}}',
|
|
21
|
+
];
|
|
8
22
|
/**
|
|
9
23
|
* Encode an absolute cwd the way Claude Code names its per-project transcript
|
|
10
24
|
* directory under `~/.claude/projects/`: every non-alphanumeric char → `-`.
|
|
@@ -29,6 +43,7 @@ export class ClaudeAgent {
|
|
|
29
43
|
model;
|
|
30
44
|
effort;
|
|
31
45
|
skipPermissions;
|
|
46
|
+
measure;
|
|
32
47
|
overrides;
|
|
33
48
|
constructor(options = {}, home = homedir()) {
|
|
34
49
|
this.home = home;
|
|
@@ -40,12 +55,15 @@ export class ClaudeAgent {
|
|
|
40
55
|
this.skipPermissions =
|
|
41
56
|
validateOptionalBoolean(options.skip_permissions, 'skip_permissions') ??
|
|
42
57
|
true;
|
|
58
|
+
this.measure = validateOptionalBoolean(options.measure, 'measure') ?? false;
|
|
43
59
|
}
|
|
44
60
|
launchCommand(prompt, run) {
|
|
45
61
|
if (prompt === '') {
|
|
46
62
|
return 'claude';
|
|
47
63
|
}
|
|
48
|
-
const parts =
|
|
64
|
+
const parts = this.measure
|
|
65
|
+
? ['node', shellQuote(MEASURE_WRAPPER), 'claude', shellQuote(prompt)]
|
|
66
|
+
: ['claude', shellQuote(prompt)];
|
|
49
67
|
if (this.model !== undefined && !this.overrides.model) {
|
|
50
68
|
parts.push('--model', shellQuote(this.model));
|
|
51
69
|
}
|
|
@@ -63,6 +81,9 @@ export class ClaudeAgent {
|
|
|
63
81
|
parts.push('--session-id', run.sessionId);
|
|
64
82
|
}
|
|
65
83
|
parts.push(...this.args.map(shellQuote));
|
|
84
|
+
if (this.measure) {
|
|
85
|
+
parts.push(...MEASURE_FLAGS.map(shellQuote));
|
|
86
|
+
}
|
|
66
87
|
return parts.join(' ');
|
|
67
88
|
}
|
|
68
89
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaia-ai/addon-claude",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "GAIA agent plugin for the Claude CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"./preset": "./dist/src/preset.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"dist/src"
|
|
12
|
+
"dist/src",
|
|
13
|
+
"measure/*.json",
|
|
14
|
+
"measure/agent-proxy.mjs",
|
|
15
|
+
"measure/claude-measure.mjs"
|
|
13
16
|
],
|
|
14
17
|
"publishConfig": {
|
|
15
18
|
"access": "public"
|
|
@@ -20,7 +23,7 @@
|
|
|
20
23
|
"directory": "gaia-cli/addons/claude"
|
|
21
24
|
},
|
|
22
25
|
"peerDependencies": {
|
|
23
|
-
"@gaia-ai/conductor": "^0.16.
|
|
24
|
-
"@gaia-ai/core": "^0.16.
|
|
26
|
+
"@gaia-ai/conductor": "^0.16.2",
|
|
27
|
+
"@gaia-ai/core": "^0.16.2"
|
|
25
28
|
}
|
|
26
29
|
}
|