@gaia-ai/addon-grok 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.
@@ -1,16 +1,21 @@
1
- import type { AgentFootprint, AgentPlugin, AgentRunIdentity, GaiaAgent } from '@gaia-ai/conductor/contract';
1
+ import { type AgentFootprint, type AgentPlugin, type AgentRunIdentity, type GaiaAgent } from '@gaia-ai/conductor/contract';
2
2
  export { parseGrokTranscript } from './footprint.js';
3
3
  export type GrokReasoningEffort = 'high' | 'medium' | 'low';
4
4
  export interface GrokAgentOptions {
5
- model: string;
6
- reasoningEffort?: GrokReasoningEffort;
5
+ model?: string;
6
+ reasoningEffort?: GrokReasoningEffort | string;
7
+ effort?: string;
8
+ args?: string[];
7
9
  }
8
10
  export declare const DEFAULT_GROK_MODEL = "grok-4.6";
9
11
  export declare function encodeGrokSessionCwd(cwd: string): string;
10
12
  export declare class GrokAgent implements GaiaAgent {
11
- private readonly options;
12
13
  private readonly home;
13
14
  readonly id = "grok";
15
+ private readonly args;
16
+ private readonly model;
17
+ private readonly effort;
18
+ private readonly overrides;
14
19
  constructor(options?: GrokAgentOptions, home?: string);
15
20
  launchCommand(prompt: string, run?: AgentRunIdentity): string;
16
21
  /**
package/dist/src/index.js CHANGED
@@ -1,11 +1,17 @@
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, validateOptionalString, } from '@gaia-ai/conductor/contract';
4
5
  import { shellQuote } from '@gaia-ai/core';
5
6
  import { parseGrokTranscript } from './footprint.js';
6
7
  export { parseGrokTranscript } from './footprint.js';
7
8
  export const DEFAULT_GROK_MODEL = 'grok-4.6';
8
9
  const DEFAULT_OPTIONS = { model: DEFAULT_GROK_MODEL };
10
+ const GROK_RESERVED = ['--permission-mode', '--session-id'];
11
+ const GROK_KNOWN = [
12
+ { kind: 'model', flags: ['--model', '-m'] },
13
+ { kind: 'effort', flags: ['--reasoning-effort', '--effort'] },
14
+ ];
9
15
  export function encodeGrokSessionCwd(cwd) {
10
16
  return encodeURIComponent(cwd);
11
17
  }
@@ -29,12 +35,21 @@ async function readJson(path) {
29
35
  }
30
36
  }
31
37
  export class GrokAgent {
32
- options;
33
38
  home;
34
39
  id = 'grok';
40
+ args;
41
+ model;
42
+ effort;
43
+ overrides;
35
44
  constructor(options = DEFAULT_OPTIONS, home = homedir()) {
36
- this.options = options;
37
45
  this.home = home;
46
+ const cli = resolveAgentCliOptions(options, GROK_RESERVED, GROK_KNOWN);
47
+ this.args = cli.args;
48
+ this.model = cli.model ?? DEFAULT_GROK_MODEL;
49
+ this.effort =
50
+ cli.effort ??
51
+ validateOptionalString(options.reasoningEffort, 'reasoningEffort');
52
+ this.overrides = cli.overrides;
38
53
  }
39
54
  launchCommand(prompt, run) {
40
55
  const parts = ['grok'];
@@ -45,9 +60,12 @@ export class GrokAgent {
45
60
  // dispatched into instead of holding a session there.
46
61
  parts.push(shellQuote(prompt));
47
62
  }
48
- parts.push('--permission-mode', 'bypassPermissions', '-m', this.options.model);
49
- if (this.options.reasoningEffort) {
50
- parts.push('--reasoning-effort', this.options.reasoningEffort);
63
+ parts.push('--permission-mode', 'bypassPermissions');
64
+ if (!this.overrides.model) {
65
+ parts.push('-m', shellQuote(this.model));
66
+ }
67
+ if (this.effort !== undefined && !this.overrides.effort) {
68
+ parts.push('--reasoning-effort', shellQuote(this.effort));
51
69
  }
52
70
  // Pin the session dir name to the run's UUID (GAIA-473), so `getRunLog`
53
71
  // can select it directly instead of scanning every session dir under the
@@ -56,6 +74,9 @@ export class GrokAgent {
56
74
  if (run?.sessionId) {
57
75
  parts.push('--session-id', run.sessionId);
58
76
  }
77
+ if (prompt !== '') {
78
+ parts.push(...this.args.map(shellQuote));
79
+ }
59
80
  return parts.join(' ');
60
81
  }
61
82
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaia-ai/addon-grok",
3
- "version": "0.14.2",
3
+ "version": "0.15.1",
4
4
  "description": "GAIA agent plugin for xAI Grok Build, with a real session footprint.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "directory": "gaia-cli/addons/grok"
21
21
  },
22
22
  "peerDependencies": {
23
- "@gaia-ai/conductor": "^0.14.2",
24
- "@gaia-ai/core": "^0.14.2"
23
+ "@gaia-ai/conductor": "^0.15.1",
24
+ "@gaia-ai/core": "^0.15.1"
25
25
  }
26
26
  }