@gaia-ai/addon-claude 0.14.2 → 0.15.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/src/index.d.ts +10 -3
- package/dist/src/index.js +34 -6
- package/dist/src/preset.js +2 -2
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type GaiaAgent } from '@gaia-ai/conductor/contract';
|
|
2
2
|
export { parseClaudeTranscript } from './footprint.js';
|
|
3
3
|
/**
|
|
4
4
|
* Encode an absolute cwd the way Claude Code names its per-project transcript
|
|
@@ -7,12 +7,19 @@ export { parseClaudeTranscript } from './footprint.js';
|
|
|
7
7
|
export declare function encodeClaudeProjectDir(cwd: string): string;
|
|
8
8
|
export interface ClaudeAgentOptions {
|
|
9
9
|
model?: string;
|
|
10
|
+
effort?: string;
|
|
11
|
+
args?: string[];
|
|
12
|
+
skip_permissions?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export declare class ClaudeAgent implements GaiaAgent {
|
|
12
|
-
private readonly options;
|
|
13
15
|
private readonly home;
|
|
14
16
|
readonly id = "claude";
|
|
15
|
-
|
|
17
|
+
private readonly args;
|
|
18
|
+
private readonly model;
|
|
19
|
+
private readonly effort;
|
|
20
|
+
private readonly skipPermissions;
|
|
21
|
+
private readonly overrides;
|
|
22
|
+
constructor(options?: ClaudeAgentOptions, home?: string);
|
|
16
23
|
launchCommand(prompt: string, run?: AgentRunIdentity): string;
|
|
17
24
|
/**
|
|
18
25
|
* `claude --session-id <uuid>` refuses to start when that session already
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { resolveAgentCliOptions, validateOptionalBoolean, } from '@gaia-ai/conductor/contract';
|
|
4
5
|
import { shellQuote } from '@gaia-ai/core';
|
|
5
6
|
import { parseClaudeTranscript } from './footprint.js';
|
|
6
7
|
export { parseClaudeTranscript } from './footprint.js';
|
|
@@ -11,23 +12,49 @@ export { parseClaudeTranscript } from './footprint.js';
|
|
|
11
12
|
export function encodeClaudeProjectDir(cwd) {
|
|
12
13
|
return cwd.replace(/[^a-zA-Z0-9]/g, '-');
|
|
13
14
|
}
|
|
15
|
+
const CLAUDE_RESERVED = [
|
|
16
|
+
'--session-id',
|
|
17
|
+
'--dangerously-skip-permissions',
|
|
18
|
+
'--allow-dangerously-skip-permissions',
|
|
19
|
+
'--permission-mode',
|
|
20
|
+
];
|
|
21
|
+
const CLAUDE_KNOWN = [
|
|
22
|
+
{ kind: 'model', flags: ['--model'] },
|
|
23
|
+
{ kind: 'effort', flags: ['--effort'] },
|
|
24
|
+
];
|
|
14
25
|
export class ClaudeAgent {
|
|
15
|
-
options;
|
|
16
26
|
home;
|
|
17
27
|
id = 'claude';
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
args;
|
|
29
|
+
model;
|
|
30
|
+
effort;
|
|
31
|
+
skipPermissions;
|
|
32
|
+
overrides;
|
|
33
|
+
constructor(options = {}, home = homedir()) {
|
|
20
34
|
this.home = home;
|
|
35
|
+
const cli = resolveAgentCliOptions(options, CLAUDE_RESERVED, CLAUDE_KNOWN);
|
|
36
|
+
this.args = cli.args;
|
|
37
|
+
this.model = cli.model;
|
|
38
|
+
this.effort = cli.effort;
|
|
39
|
+
this.overrides = cli.overrides;
|
|
40
|
+
this.skipPermissions =
|
|
41
|
+
validateOptionalBoolean(options.skip_permissions, 'skip_permissions') ??
|
|
42
|
+
true;
|
|
21
43
|
}
|
|
22
44
|
launchCommand(prompt, run) {
|
|
23
45
|
if (prompt === '') {
|
|
24
46
|
return 'claude';
|
|
25
47
|
}
|
|
26
48
|
const parts = ['claude', shellQuote(prompt)];
|
|
27
|
-
if (this.
|
|
28
|
-
parts.push('--model', this.
|
|
49
|
+
if (this.model !== undefined && !this.overrides.model) {
|
|
50
|
+
parts.push('--model', shellQuote(this.model));
|
|
51
|
+
}
|
|
52
|
+
if (this.effort !== undefined && !this.overrides.effort) {
|
|
53
|
+
parts.push('--effort', shellQuote(this.effort));
|
|
54
|
+
}
|
|
55
|
+
if (this.skipPermissions) {
|
|
56
|
+
parts.push('--dangerously-skip-permissions');
|
|
29
57
|
}
|
|
30
|
-
parts.push('--dangerously-skip-permissions');
|
|
31
58
|
// Pin the transcript's own session id to the run's UUID (GAIA-473), so
|
|
32
59
|
// `getRunLog` can read that ONE file directly instead of scanning the
|
|
33
60
|
// worktree-keyed directory by mtime — the scan is what let a
|
|
@@ -35,6 +62,7 @@ export class ClaudeAgent {
|
|
|
35
62
|
if (run?.sessionId) {
|
|
36
63
|
parts.push('--session-id', run.sessionId);
|
|
37
64
|
}
|
|
65
|
+
parts.push(...this.args.map(shellQuote));
|
|
38
66
|
return parts.join(' ');
|
|
39
67
|
}
|
|
40
68
|
/**
|
package/dist/src/preset.js
CHANGED
|
@@ -15,12 +15,12 @@ export const agents = (acc, opts) => {
|
|
|
15
15
|
{
|
|
16
16
|
alias: 'opus',
|
|
17
17
|
description: 'Strong reasoning for ambiguous design, diagnosis and demanding implementation.',
|
|
18
|
-
model: '
|
|
18
|
+
model: 'opus',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
alias: 'sonnet',
|
|
22
22
|
description: 'Efficient implementation of well-specified changes and routine maintenance.',
|
|
23
|
-
model: '
|
|
23
|
+
model: 'sonnet',
|
|
24
24
|
},
|
|
25
25
|
].map((candidate) => 'agent' in candidate
|
|
26
26
|
? candidate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaia-ai/addon-claude",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "GAIA agent plugin for the Claude CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"directory": "gaia-cli/addons/claude"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@gaia-ai/conductor": "^0.
|
|
24
|
-
"@gaia-ai/core": "^0.
|
|
23
|
+
"@gaia-ai/conductor": "^0.15.1",
|
|
24
|
+
"@gaia-ai/core": "^0.15.1"
|
|
25
25
|
}
|
|
26
26
|
}
|