@ai-sdk/harness-grok-build 1.0.37 → 1.0.39

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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @ai-sdk/harness-grok-build
2
2
 
3
+ ## 1.0.39
4
+
5
+ ### Patch Changes
6
+
7
+ - 255cccf: feat(harness): add `writeInstructions` helper and support filesystem based `instructionsMapping` in ACP backed harness adapters
8
+ - eeed977: feat(harness): allow passing arbitrary headers with inference requests via `headers` property in `HarnessAgentSettings`
9
+ - Updated dependencies [fe86f8f]
10
+ - Updated dependencies [ceb601c]
11
+ - Updated dependencies [255cccf]
12
+ - Updated dependencies [668b51d]
13
+ - Updated dependencies [eeed977]
14
+ - Updated dependencies [1291df7]
15
+ - Updated dependencies [a39c8bf]
16
+ - @ai-sdk/harness@1.0.102
17
+ - @ai-sdk/harness-acp@1.0.40
18
+
19
+ ## 1.0.38
20
+
21
+ ### Patch Changes
22
+
23
+ - 951c54d: feat(harness): support `askUserQuestions` tool including support for normalization across harness adapters
24
+ - Updated dependencies [951c54d]
25
+ - @ai-sdk/harness-acp@1.0.39
26
+ - @ai-sdk/harness@1.0.101
27
+
3
28
  ## 1.0.37
4
29
 
5
30
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _ai_sdk_provider from '@ai-sdk/provider';
2
- import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
2
  import * as _ai_sdk_harness from '@ai-sdk/harness';
4
3
  import { HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1, HarnessV1BuiltinTool } from '@ai-sdk/harness';
4
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
5
5
  import { ACPAuthenticationMode } from '@ai-sdk/harness-acp';
6
6
 
7
7
  type GrokBuildAuthenticationMode = ACPAuthenticationMode;
@@ -54,6 +54,40 @@ type GrokBuildHarnessSettings = {
54
54
  readonly mintBridgeToken?: (sandboxId: string) => string;
55
55
  };
56
56
  declare const GROK_BUILD_BUILTIN_TOOLS: {
57
+ readonly askUserQuestions: _ai_sdk_provider_utils.FunctionTool<{
58
+ allowPartialAnswers: boolean;
59
+ questions: {
60
+ id: string;
61
+ question: string;
62
+ header?: string | undefined;
63
+ options?: {
64
+ id: string;
65
+ label: string;
66
+ description?: string | undefined;
67
+ preview?: string | undefined;
68
+ }[] | undefined;
69
+ allowMultiple?: boolean | undefined;
70
+ allowFreeForm?: boolean | {
71
+ secret: boolean;
72
+ } | undefined;
73
+ }[];
74
+ }, {
75
+ action: "answered";
76
+ answers: Record<string, {
77
+ optionIds: string[];
78
+ freeform?: string | undefined;
79
+ }>;
80
+ } | {
81
+ action: "partially-answered";
82
+ answers: Record<string, {
83
+ optionIds: string[];
84
+ freeform?: string | undefined;
85
+ }>;
86
+ } | {
87
+ action: "declined";
88
+ } | {
89
+ action: "cancelled";
90
+ }>;
57
91
  readonly bash: HarnessV1BuiltinTool<{
58
92
  [x: string]: unknown;
59
93
  command: string;
@@ -2265,20 +2299,6 @@ declare const GROK_BUILD_BUILTIN_TOOLS: {
2265
2299
  readonly exit_plan_mode: _ai_sdk_provider_utils.Tool<{
2266
2300
  [x: string]: unknown;
2267
2301
  }, any, any>;
2268
- readonly ask_user_question: _ai_sdk_provider_utils.Tool<{
2269
- [x: string]: unknown;
2270
- questions: {
2271
- [x: string]: unknown;
2272
- question: string;
2273
- options: {
2274
- [x: string]: unknown;
2275
- label: string;
2276
- description: string;
2277
- preview?: string | null | undefined;
2278
- }[];
2279
- multi_select?: boolean | null | undefined;
2280
- }[];
2281
- }, any, any>;
2282
2302
  readonly image_gen: _ai_sdk_provider_utils.Tool<{
2283
2303
  [x: string]: unknown;
2284
2304
  prompt: string;
@@ -2314,6 +2334,40 @@ declare const VERSION: string;
2314
2334
  * Default Grok Build harness instance. Equivalent to `createGrokBuild()`.
2315
2335
  */
2316
2336
  declare const grokBuild: _ai_sdk_harness.HarnessV1<{
2337
+ readonly askUserQuestions: _ai_sdk_provider_utils.FunctionTool<{
2338
+ allowPartialAnswers: boolean;
2339
+ questions: {
2340
+ id: string;
2341
+ question: string;
2342
+ header?: string | undefined;
2343
+ options?: {
2344
+ id: string;
2345
+ label: string;
2346
+ description?: string | undefined;
2347
+ preview?: string | undefined;
2348
+ }[] | undefined;
2349
+ allowMultiple?: boolean | undefined;
2350
+ allowFreeForm?: boolean | {
2351
+ secret: boolean;
2352
+ } | undefined;
2353
+ }[];
2354
+ }, {
2355
+ action: "answered";
2356
+ answers: Record<string, {
2357
+ optionIds: string[];
2358
+ freeform?: string | undefined;
2359
+ }>;
2360
+ } | {
2361
+ action: "partially-answered";
2362
+ answers: Record<string, {
2363
+ optionIds: string[];
2364
+ freeform?: string | undefined;
2365
+ }>;
2366
+ } | {
2367
+ action: "declined";
2368
+ } | {
2369
+ action: "cancelled";
2370
+ }>;
2317
2371
  readonly bash: _ai_sdk_harness.HarnessV1BuiltinTool<{
2318
2372
  [x: string]: unknown;
2319
2373
  command: string;
@@ -4525,20 +4579,6 @@ declare const grokBuild: _ai_sdk_harness.HarnessV1<{
4525
4579
  readonly exit_plan_mode: _ai_sdk_provider_utils.Tool<{
4526
4580
  [x: string]: unknown;
4527
4581
  }, any, any>;
4528
- readonly ask_user_question: _ai_sdk_provider_utils.Tool<{
4529
- [x: string]: unknown;
4530
- questions: {
4531
- [x: string]: unknown;
4532
- question: string;
4533
- options: {
4534
- [x: string]: unknown;
4535
- label: string;
4536
- description: string;
4537
- preview?: string | null | undefined;
4538
- }[];
4539
- multi_select?: boolean | null | undefined;
4540
- }[];
4541
- }, any, any>;
4542
4582
  readonly image_gen: _ai_sdk_provider_utils.Tool<{
4543
4583
  [x: string]: unknown;
4544
4584
  prompt: string;
package/dist/index.js CHANGED
@@ -1,14 +1,154 @@
1
1
  // src/grok-build-harness.ts
2
2
  import {
3
+ HARNESS_V1_BUILTIN_TOOLS,
3
4
  commonTool
4
5
  } from "@ai-sdk/harness";
5
6
  import { createCredentialRequestTransformation } from "@ai-sdk/harness/utils";
6
7
  import { createACP } from "@ai-sdk/harness-acp";
7
8
  import { tool } from "@ai-sdk/provider-utils";
8
- import { z } from "zod/v4";
9
+ import { z as z2 } from "zod/v4";
9
10
 
10
11
  // src/version.ts
11
- var VERSION = true ? "1.0.37" : "0.0.0-test";
12
+ var VERSION = true ? "1.0.39" : "0.0.0-test";
13
+
14
+ // src/grok-build-question-tool.ts
15
+ import {
16
+ harnessV1QuestionsToolOutputSchema
17
+ } from "@ai-sdk/harness";
18
+ import { z } from "zod/v4";
19
+ var grokBuildQuestionRequestSchema = z.object({
20
+ sessionId: z.string(),
21
+ toolCallId: z.string(),
22
+ questions: z.array(
23
+ z.object({
24
+ question: z.string(),
25
+ options: z.array(
26
+ z.object({
27
+ label: z.string(),
28
+ description: z.string(),
29
+ preview: z.string().nullable().optional()
30
+ })
31
+ ),
32
+ multi_select: z.boolean().nullable().optional()
33
+ })
34
+ ),
35
+ mode: z.enum(["default", "plan"])
36
+ });
37
+ var grokBuildAskUserQuestions = {
38
+ requestMethod: "_x.ai/ask_user_question",
39
+ fromNativeRequest: ({ nativeRequest }) => {
40
+ const parsed = grokBuildQuestionRequestSchema.safeParse(nativeRequest);
41
+ if (!parsed.success) return null;
42
+ return {
43
+ type: "tool-call",
44
+ toolCallId: parsed.data.toolCallId,
45
+ toolName: "askUserQuestions",
46
+ nativeName: "ask_user_question",
47
+ input: JSON.stringify(toHarnessQuestionsInput(parsed.data)),
48
+ providerExecuted: false
49
+ };
50
+ },
51
+ toNativeResponse: ({ nativeRequest, toolResult }) => {
52
+ const request = grokBuildQuestionRequestSchema.parse(nativeRequest);
53
+ const output = parseQuestionsOutput(toolResult);
54
+ if (output.action === "cancelled") {
55
+ return { outcome: "cancelled" };
56
+ }
57
+ const nativeAnswers = output.action === "declined" ? { answers: {}, annotations: {} } : toNativeAnswers({ request, output });
58
+ const requestedOutcome = toolResult.providerOptions?.["grok-build"]?.outcome;
59
+ if (requestedOutcome === "chat_about_this" || requestedOutcome === "skip_interview") {
60
+ return {
61
+ outcome: requestedOutcome,
62
+ partial_answers: Object.fromEntries(
63
+ Object.entries(nativeAnswers.answers).map(([question, answers]) => [
64
+ question,
65
+ answers.join(", ")
66
+ ])
67
+ )
68
+ };
69
+ }
70
+ if (output.action === "declined") {
71
+ return { outcome: "skip_interview", partial_answers: {} };
72
+ }
73
+ return {
74
+ outcome: "accepted",
75
+ answers: nativeAnswers.answers,
76
+ ...Object.keys(nativeAnswers.annotations).length === 0 ? {} : { annotations: nativeAnswers.annotations }
77
+ };
78
+ },
79
+ matchesNativeRequest: ({ previousNativeRequest, nativeRequest }) => {
80
+ const previous = grokBuildQuestionRequestSchema.safeParse(
81
+ previousNativeRequest
82
+ );
83
+ const current = grokBuildQuestionRequestSchema.safeParse(nativeRequest);
84
+ return previous.success && current.success && questionFingerprint(previous.data) === questionFingerprint(current.data);
85
+ }
86
+ };
87
+ function toHarnessQuestionsInput(request) {
88
+ return {
89
+ allowPartialAnswers: true,
90
+ questions: request.questions.map((question, questionIndex) => ({
91
+ id: questionId(questionIndex),
92
+ question: question.question,
93
+ options: question.options.map((option, optionIndex) => ({
94
+ id: optionId(optionIndex),
95
+ label: option.label,
96
+ description: option.description,
97
+ ...option.preview == null ? {} : { preview: option.preview }
98
+ })),
99
+ ...question.multi_select == null ? {} : { allowMultiple: question.multi_select },
100
+ allowFreeForm: true
101
+ }))
102
+ };
103
+ }
104
+ function toNativeAnswers({
105
+ request,
106
+ output
107
+ }) {
108
+ const answers = {};
109
+ const annotations = {};
110
+ request.questions.forEach((question, questionIndex) => {
111
+ const answer = output.answers[questionId(questionIndex)];
112
+ if (answer == null) return;
113
+ const labels = answer.optionIds.flatMap((id) => {
114
+ const optionIndex = positionalIdIndex({ id, prefix: "option-" });
115
+ const option = optionIndex == null ? void 0 : question.options[optionIndex];
116
+ return option == null ? [] : [option.label];
117
+ });
118
+ if (answer.freeform != null) {
119
+ labels.push("Other");
120
+ annotations[question.question] = { notes: answer.freeform };
121
+ }
122
+ answers[question.question] = labels;
123
+ });
124
+ return { answers, annotations };
125
+ }
126
+ function parseQuestionsOutput(toolResult) {
127
+ if (toolResult.output.type !== "json" && toolResult.output.type !== "error-json") {
128
+ throw new Error("Grok Build askUserQuestions requires a JSON tool result.");
129
+ }
130
+ return harnessV1QuestionsToolOutputSchema.parse(toolResult.output.value);
131
+ }
132
+ function questionId(index) {
133
+ return `question-${index + 1}`;
134
+ }
135
+ function optionId(index) {
136
+ return `option-${index + 1}`;
137
+ }
138
+ function positionalIdIndex({
139
+ id,
140
+ prefix
141
+ }) {
142
+ if (!id.startsWith(prefix)) return void 0;
143
+ const index = Number(id.slice(prefix.length)) - 1;
144
+ return Number.isInteger(index) && index >= 0 ? index : void 0;
145
+ }
146
+ function questionFingerprint(request) {
147
+ return JSON.stringify({
148
+ questions: request.questions,
149
+ mode: request.mode
150
+ });
151
+ }
12
152
 
13
153
  // src/grok-build-harness.ts
14
154
  var GROK_BUILD_CLIENT_APP = `ai-sdk/harness-grok-build/${VERSION}`;
@@ -16,215 +156,199 @@ var GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON = '{\n "name": "harness-grok-build-b
16
156
  var GROK_BUILD_IMPLEMENTATION_PNPM_LOCK = "lockfileVersion: '9.0'\n\nsettings:\n autoInstallPeers: true\n excludeLinksFromLockfile: false\n\nimporters:\n\n .:\n dependencies:\n '@agentclientprotocol/sdk':\n specifier: 1.4.0\n version: 1.4.0(zod@4.4.3)\n '@modelcontextprotocol/sdk':\n specifier: 1.30.0\n version: 1.30.0(zod@4.4.3)\n '@xai-official/grok':\n specifier: 1.0.5\n version: 1.0.5\n ws:\n specifier: 8.21.0\n version: 8.21.0\n zod:\n specifier: 4.4.3\n version: 4.4.3\n\npackages:\n\n '@agentclientprotocol/sdk@1.4.0':\n resolution: {integrity: sha512-/eufudw+aFY1LKLolT6yFE6UMmYRl7fMJ/DEONSIyR6wI3slHWITBsANRGqXEY8FRzqUxwh7QEaGiZHcJPVThg==}\n peerDependencies:\n zod: ^3.25.0 || ^4.0.0\n\n '@hono/node-server@2.1.1':\n resolution: {integrity: sha512-ELuehkj5VCBdgEw9zs+ivkKwyzzUCSQuE96YmiPvn1ECBoZCczbFXJLeEGMTYjphP6gydh4pHMqEYPVMYUVgQg==}\n engines: {node: '>=20'}\n peerDependencies:\n hono: ^4\n\n '@iarna/toml@3.0.0':\n resolution: {integrity: sha512-td6ZUkz2oS3VeleBcN+m//Q6HlCFCPrnI0FZhrt/h4XqLEdOyYp2u21nd8MdsR+WJy5r9PTDaHTDDfhf4H4l6Q==}\n\n '@modelcontextprotocol/sdk@1.30.0':\n resolution: {integrity: sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==}\n engines: {node: '>=18'}\n peerDependencies:\n '@cfworker/json-schema': ^4.1.1\n zod: ^3.25 || ^4.0\n peerDependenciesMeta:\n '@cfworker/json-schema':\n optional: true\n\n '@xai-official/grok-darwin-arm64@1.0.5':\n resolution: {integrity: sha512-akEtE93V7nOHEMfj16kkl3Nxl/AjcNaRkZCnY5HoIayy3VR6qQ6VTsQdUka4ZgT1bGJCZff4UIcTVpFGDaMAQQ==}\n cpu: [arm64]\n os: [darwin]\n\n '@xai-official/grok-darwin-x64@1.0.5':\n resolution: {integrity: sha512-kIr1YUidX+Zl8Ti7qFBCmQyVzR/D779Q0/pNvCBo7enLObFaGiM7JUAuQ7Y23aaIC/m1rwPv7xzoQ3DGHOO1yA==}\n cpu: [x64]\n os: [darwin]\n\n '@xai-official/grok-linux-arm64@1.0.5':\n resolution: {integrity: sha512-yPdBddzfqBNfmyKGEuy0Vy+8zr/0I9xTqX9aYzaaz5QUS3+3Xe3bIJ2EYbAZV6o/16WUC2ZbkLNUx3X3IkBSRA==}\n cpu: [arm64]\n os: [linux]\n\n '@xai-official/grok-linux-x64@1.0.5':\n resolution: {integrity: sha512-JJ6ajCCdBeLc14jvcGKQmeOvoJdEvWMe2Bj82McNikup1d6QaX/E7MI7nmMmoHfQthqRfUSnFk/ExFRu4fodTw==}\n cpu: [x64]\n os: [linux]\n\n '@xai-official/grok-win32-arm64@1.0.5':\n resolution: {integrity: sha512-B4cIPElA8KWpOX2fvIxFeb8U5Ifwal56ZNKtvqPgatflLMf9Quo+3KnBUXH7X8/Ohwe81ff8G+mcU6Ja6Z5RKQ==}\n cpu: [arm64]\n os: [win32]\n\n '@xai-official/grok-win32-x64@1.0.5':\n resolution: {integrity: sha512-EqPxlKg5FMFymmnF+w58VQ8V+ZrghIp7Qsuc2VCurIY82H+6qvnAMgJXGCpo2qH6JSWfh0HPiHkmTk32kHstjw==}\n cpu: [x64]\n os: [win32]\n\n '@xai-official/grok@1.0.5':\n resolution: {integrity: sha512-kk5hez+Oz5CvWonDGkMNmL483CWRIGRF2ki8jQzpIXH56P0fhCgaX9lrr0IUoFCKh/rYAm5vfCPgQsdIIYLu8Q==}\n engines: {node: '>=20'}\n cpu: [arm64, x64]\n os: [darwin, linux, win32]\n hasBin: true\n\n accepts@2.0.0:\n resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==}\n engines: {node: '>= 0.6'}\n\n ajv-formats@3.0.1:\n resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}\n peerDependencies:\n ajv: ^8.0.0\n peerDependenciesMeta:\n ajv:\n optional: true\n\n ajv@8.20.0:\n resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}\n\n body-parser@2.3.0:\n resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==}\n engines: {node: '>=18'}\n\n bytes@3.1.2:\n resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}\n engines: {node: '>= 0.8'}\n\n call-bind-apply-helpers@1.0.2:\n resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}\n engines: {node: '>= 0.4'}\n\n call-bound@1.0.4:\n resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}\n engines: {node: '>= 0.4'}\n\n content-disposition@1.1.0:\n resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==}\n engines: {node: '>=18'}\n\n content-type@1.0.5:\n resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}\n engines: {node: '>= 0.6'}\n\n content-type@2.1.0:\n resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==}\n engines: {node: '>=18'}\n\n cookie-signature@1.2.2:\n resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==}\n engines: {node: '>=6.6.0'}\n\n cookie@0.7.2:\n resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}\n engines: {node: '>= 0.6'}\n\n cors@2.8.6:\n resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==}\n engines: {node: '>= 0.10'}\n\n cross-spawn@7.0.6:\n resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}\n engines: {node: '>= 8'}\n\n debug@4.4.3:\n resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}\n engines: {node: '>=6.0'}\n peerDependencies:\n supports-color: '*'\n peerDependenciesMeta:\n supports-color:\n optional: true\n\n depd@2.0.0:\n resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==}\n engines: {node: '>= 0.8'}\n\n dunder-proto@1.0.1:\n resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}\n engines: {node: '>= 0.4'}\n\n ee-first@1.1.1:\n resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}\n\n encodeurl@2.0.0:\n resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}\n engines: {node: '>= 0.8'}\n\n es-define-property@1.0.1:\n resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}\n engines: {node: '>= 0.4'}\n\n es-errors@1.3.0:\n resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}\n engines: {node: '>= 0.4'}\n\n es-object-atoms@1.1.2:\n resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==}\n engines: {node: '>= 0.4'}\n\n escape-html@1.0.3:\n resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==}\n\n etag@1.8.1:\n resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}\n engines: {node: '>= 0.6'}\n\n eventsource-parser@3.1.1:\n resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==}\n engines: {node: '>=18.0.0'}\n\n eventsource@3.0.7:\n resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}\n engines: {node: '>=18.0.0'}\n\n express-rate-limit@8.6.2:\n resolution: {integrity: sha512-YH4ru+eOJxQABscKFfRCy9R7x9QFGdezclVMwwgFFndzS2Xnm0uo6B0ABZsLhcpeptGv2qvuJVWlQr9gQZoC3A==}\n engines: {node: '>= 16'}\n peerDependencies:\n express: '>= 4.11'\n\n express@5.2.1:\n resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}\n engines: {node: '>= 18'}\n\n fast-deep-equal@3.1.3:\n resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}\n\n fast-uri@3.1.6:\n resolution: {integrity: sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q==}\n\n finalhandler@2.1.1:\n resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==}\n engines: {node: '>= 18.0.0'}\n\n forwarded@0.2.0:\n resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}\n engines: {node: '>= 0.6'}\n\n fresh@2.0.0:\n resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==}\n engines: {node: '>= 0.8'}\n\n function-bind@1.1.2:\n resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}\n\n get-intrinsic@1.3.0:\n resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}\n engines: {node: '>= 0.4'}\n\n get-proto@1.0.1:\n resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}\n engines: {node: '>= 0.4'}\n\n gopd@1.2.0:\n resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}\n engines: {node: '>= 0.4'}\n\n has-symbols@1.1.0:\n resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}\n engines: {node: '>= 0.4'}\n\n hasown@2.0.4:\n resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==}\n engines: {node: '>= 0.4'}\n\n hono@4.13.4:\n resolution: {integrity: sha512-AGEwKIyRMHRv1t8Wjwa3LHxQ61X5CqrdFT+4BRNTpqS5aJNnpl5WLjADb7vFlJzI/8uK7T5QLVApCMQKNa3LgQ==}\n engines: {node: '>=16.9.0'}\n\n http-errors@2.0.1:\n resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==}\n engines: {node: '>= 0.8'}\n\n iconv-lite@0.7.3:\n resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==}\n engines: {node: '>=0.10.0'}\n\n inherits@2.0.4:\n resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}\n\n ip-address@10.5.0:\n resolution: {integrity: sha512-R5SnVLJmgYYvf2F2ZgwSBnelz5G4q5AxIC277GDfUaNbrZKNANcBC7RHqYYePlszf4kBolVkJauG0ZjHHFh55g==}\n engines: {node: '>= 12'}\n\n ipaddr.js@1.9.1:\n resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}\n engines: {node: '>= 0.10'}\n\n is-promise@4.0.0:\n resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}\n\n isexe@2.0.0:\n resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}\n\n jose@6.2.10:\n resolution: {integrity: sha512-iiW7J9qRFlGxvCOIBDBDxFePQSn7ZMAnrYGhrrOo6siO/MIqwfyilLR27pkfDgUk+raLuzADS8A3S/KLBisc0g==}\n\n json-schema-traverse@1.0.0:\n resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}\n\n json-schema-typed@8.0.2:\n resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==}\n\n math-intrinsics@1.1.0:\n resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}\n engines: {node: '>= 0.4'}\n\n media-typer@1.1.1:\n resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==}\n engines: {node: '>= 0.8'}\n\n merge-descriptors@2.0.0:\n resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==}\n engines: {node: '>=18'}\n\n mime-db@1.54.0:\n resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==}\n engines: {node: '>= 0.6'}\n\n mime-types@3.0.2:\n resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==}\n engines: {node: '>=18'}\n\n ms@2.1.3:\n resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}\n\n negotiator@1.1.0:\n resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==}\n engines: {node: '>=18'}\n\n object-assign@4.1.1:\n resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}\n engines: {node: '>=0.10.0'}\n\n object-inspect@1.13.4:\n resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}\n engines: {node: '>= 0.4'}\n\n on-finished@2.4.1:\n resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}\n engines: {node: '>= 0.8'}\n\n once@1.4.0:\n resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}\n\n parseurl@1.3.3:\n resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}\n engines: {node: '>= 0.8'}\n\n path-key@3.1.1:\n resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}\n engines: {node: '>=8'}\n\n path-to-regexp@8.4.2:\n resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==}\n\n pkce-challenge@5.0.1:\n resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==}\n engines: {node: '>=16.20.0'}\n\n proxy-addr@2.0.7:\n resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}\n engines: {node: '>= 0.10'}\n\n qs@6.15.3:\n resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==}\n engines: {node: '>=0.6'}\n\n range-parser@1.3.0:\n resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==}\n engines: {node: '>= 0.6'}\n\n raw-body@3.0.2:\n resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==}\n engines: {node: '>= 0.10'}\n\n require-from-string@2.0.2:\n resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}\n engines: {node: '>=0.10.0'}\n\n router@2.2.0:\n resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}\n engines: {node: '>= 18'}\n\n safer-buffer@2.1.2:\n resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}\n\n send@1.2.1:\n resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==}\n engines: {node: '>= 18'}\n\n serve-static@2.2.1:\n resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==}\n engines: {node: '>= 18'}\n\n setprototypeof@1.2.0:\n resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}\n\n shebang-command@2.0.0:\n resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}\n engines: {node: '>=8'}\n\n shebang-regex@3.0.0:\n resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}\n engines: {node: '>=8'}\n\n side-channel-list@1.0.1:\n resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==}\n engines: {node: '>= 0.4'}\n\n side-channel-map@1.0.1:\n resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}\n engines: {node: '>= 0.4'}\n\n side-channel-weakmap@1.0.2:\n resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}\n engines: {node: '>= 0.4'}\n\n side-channel@1.1.1:\n resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==}\n engines: {node: '>= 0.4'}\n\n statuses@2.0.2:\n resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==}\n engines: {node: '>= 0.8'}\n\n toidentifier@1.0.1:\n resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}\n engines: {node: '>=0.6'}\n\n type-is@2.1.0:\n resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==}\n engines: {node: '>= 18'}\n\n unpipe@1.0.0:\n resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}\n engines: {node: '>= 0.8'}\n\n vary@1.1.2:\n resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==}\n engines: {node: '>= 0.8'}\n\n which@2.0.2:\n resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}\n engines: {node: '>= 8'}\n hasBin: true\n\n wrappy@1.0.2:\n resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}\n\n ws@8.21.0:\n resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==}\n engines: {node: '>=10.0.0'}\n peerDependencies:\n bufferutil: ^4.0.1\n utf-8-validate: '>=5.0.2'\n peerDependenciesMeta:\n bufferutil:\n optional: true\n utf-8-validate:\n optional: true\n\n zod-to-json-schema@3.25.2:\n resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==}\n peerDependencies:\n zod: ^3.25.28 || ^4\n\n zod@4.4.3:\n resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==}\n\nsnapshots:\n\n '@agentclientprotocol/sdk@1.4.0(zod@4.4.3)':\n dependencies:\n zod: 4.4.3\n\n '@hono/node-server@2.1.1(hono@4.13.4)':\n dependencies:\n hono: 4.13.4\n\n '@iarna/toml@3.0.0': {}\n\n '@modelcontextprotocol/sdk@1.30.0(zod@4.4.3)':\n dependencies:\n '@hono/node-server': 2.1.1(hono@4.13.4)\n ajv: 8.20.0\n ajv-formats: 3.0.1(ajv@8.20.0)\n content-type: 1.0.5\n cors: 2.8.6\n cross-spawn: 7.0.6\n eventsource: 3.0.7\n eventsource-parser: 3.1.1\n express: 5.2.1\n express-rate-limit: 8.6.2(express@5.2.1)\n hono: 4.13.4\n jose: 6.2.10\n json-schema-typed: 8.0.2\n pkce-challenge: 5.0.1\n raw-body: 3.0.2\n zod: 4.4.3\n zod-to-json-schema: 3.25.2(zod@4.4.3)\n transitivePeerDependencies:\n - supports-color\n\n '@xai-official/grok-darwin-arm64@1.0.5':\n optional: true\n\n '@xai-official/grok-darwin-x64@1.0.5':\n optional: true\n\n '@xai-official/grok-linux-arm64@1.0.5':\n optional: true\n\n '@xai-official/grok-linux-x64@1.0.5':\n optional: true\n\n '@xai-official/grok-win32-arm64@1.0.5':\n optional: true\n\n '@xai-official/grok-win32-x64@1.0.5':\n optional: true\n\n '@xai-official/grok@1.0.5':\n dependencies:\n '@iarna/toml': 3.0.0\n optionalDependencies:\n '@xai-official/grok-darwin-arm64': 1.0.5\n '@xai-official/grok-darwin-x64': 1.0.5\n '@xai-official/grok-linux-arm64': 1.0.5\n '@xai-official/grok-linux-x64': 1.0.5\n '@xai-official/grok-win32-arm64': 1.0.5\n '@xai-official/grok-win32-x64': 1.0.5\n\n accepts@2.0.0:\n dependencies:\n mime-types: 3.0.2\n negotiator: 1.1.0\n\n ajv-formats@3.0.1(ajv@8.20.0):\n optionalDependencies:\n ajv: 8.20.0\n\n ajv@8.20.0:\n dependencies:\n fast-deep-equal: 3.1.3\n fast-uri: 3.1.6\n json-schema-traverse: 1.0.0\n require-from-string: 2.0.2\n\n body-parser@2.3.0:\n dependencies:\n bytes: 3.1.2\n content-type: 2.1.0\n debug: 4.4.3\n http-errors: 2.0.1\n iconv-lite: 0.7.3\n on-finished: 2.4.1\n qs: 6.15.3\n raw-body: 3.0.2\n type-is: 2.1.0\n transitivePeerDependencies:\n - supports-color\n\n bytes@3.1.2: {}\n\n call-bind-apply-helpers@1.0.2:\n dependencies:\n es-errors: 1.3.0\n function-bind: 1.1.2\n\n call-bound@1.0.4:\n dependencies:\n call-bind-apply-helpers: 1.0.2\n get-intrinsic: 1.3.0\n\n content-disposition@1.1.0: {}\n\n content-type@1.0.5: {}\n\n content-type@2.1.0: {}\n\n cookie-signature@1.2.2: {}\n\n cookie@0.7.2: {}\n\n cors@2.8.6:\n dependencies:\n object-assign: 4.1.1\n vary: 1.1.2\n\n cross-spawn@7.0.6:\n dependencies:\n path-key: 3.1.1\n shebang-command: 2.0.0\n which: 2.0.2\n\n debug@4.4.3:\n dependencies:\n ms: 2.1.3\n\n depd@2.0.0: {}\n\n dunder-proto@1.0.1:\n dependencies:\n call-bind-apply-helpers: 1.0.2\n es-errors: 1.3.0\n gopd: 1.2.0\n\n ee-first@1.1.1: {}\n\n encodeurl@2.0.0: {}\n\n es-define-property@1.0.1: {}\n\n es-errors@1.3.0: {}\n\n es-object-atoms@1.1.2:\n dependencies:\n es-errors: 1.3.0\n\n escape-html@1.0.3: {}\n\n etag@1.8.1: {}\n\n eventsource-parser@3.1.1: {}\n\n eventsource@3.0.7:\n dependencies:\n eventsource-parser: 3.1.1\n\n express-rate-limit@8.6.2(express@5.2.1):\n dependencies:\n debug: 4.4.3\n express: 5.2.1\n ip-address: 10.5.0\n transitivePeerDependencies:\n - supports-color\n\n express@5.2.1:\n dependencies:\n accepts: 2.0.0\n body-parser: 2.3.0\n content-disposition: 1.1.0\n content-type: 1.0.5\n cookie: 0.7.2\n cookie-signature: 1.2.2\n debug: 4.4.3\n depd: 2.0.0\n encodeurl: 2.0.0\n escape-html: 1.0.3\n etag: 1.8.1\n finalhandler: 2.1.1\n fresh: 2.0.0\n http-errors: 2.0.1\n merge-descriptors: 2.0.0\n mime-types: 3.0.2\n on-finished: 2.4.1\n once: 1.4.0\n parseurl: 1.3.3\n proxy-addr: 2.0.7\n qs: 6.15.3\n range-parser: 1.3.0\n router: 2.2.0\n send: 1.2.1\n serve-static: 2.2.1\n statuses: 2.0.2\n type-is: 2.1.0\n vary: 1.1.2\n transitivePeerDependencies:\n - supports-color\n\n fast-deep-equal@3.1.3: {}\n\n fast-uri@3.1.6: {}\n\n finalhandler@2.1.1:\n dependencies:\n debug: 4.4.3\n encodeurl: 2.0.0\n escape-html: 1.0.3\n on-finished: 2.4.1\n parseurl: 1.3.3\n statuses: 2.0.2\n transitivePeerDependencies:\n - supports-color\n\n forwarded@0.2.0: {}\n\n fresh@2.0.0: {}\n\n function-bind@1.1.2: {}\n\n get-intrinsic@1.3.0:\n dependencies:\n call-bind-apply-helpers: 1.0.2\n es-define-property: 1.0.1\n es-errors: 1.3.0\n es-object-atoms: 1.1.2\n function-bind: 1.1.2\n get-proto: 1.0.1\n gopd: 1.2.0\n has-symbols: 1.1.0\n hasown: 2.0.4\n math-intrinsics: 1.1.0\n\n get-proto@1.0.1:\n dependencies:\n dunder-proto: 1.0.1\n es-object-atoms: 1.1.2\n\n gopd@1.2.0: {}\n\n has-symbols@1.1.0: {}\n\n hasown@2.0.4:\n dependencies:\n function-bind: 1.1.2\n\n hono@4.13.4: {}\n\n http-errors@2.0.1:\n dependencies:\n depd: 2.0.0\n inherits: 2.0.4\n setprototypeof: 1.2.0\n statuses: 2.0.2\n toidentifier: 1.0.1\n\n iconv-lite@0.7.3:\n dependencies:\n safer-buffer: 2.1.2\n\n inherits@2.0.4: {}\n\n ip-address@10.5.0: {}\n\n ipaddr.js@1.9.1: {}\n\n is-promise@4.0.0: {}\n\n isexe@2.0.0: {}\n\n jose@6.2.10: {}\n\n json-schema-traverse@1.0.0: {}\n\n json-schema-typed@8.0.2: {}\n\n math-intrinsics@1.1.0: {}\n\n media-typer@1.1.1: {}\n\n merge-descriptors@2.0.0: {}\n\n mime-db@1.54.0: {}\n\n mime-types@3.0.2:\n dependencies:\n mime-db: 1.54.0\n\n ms@2.1.3: {}\n\n negotiator@1.1.0:\n dependencies:\n content-type: 2.1.0\n\n object-assign@4.1.1: {}\n\n object-inspect@1.13.4: {}\n\n on-finished@2.4.1:\n dependencies:\n ee-first: 1.1.1\n\n once@1.4.0:\n dependencies:\n wrappy: 1.0.2\n\n parseurl@1.3.3: {}\n\n path-key@3.1.1: {}\n\n path-to-regexp@8.4.2: {}\n\n pkce-challenge@5.0.1: {}\n\n proxy-addr@2.0.7:\n dependencies:\n forwarded: 0.2.0\n ipaddr.js: 1.9.1\n\n qs@6.15.3:\n dependencies:\n es-define-property: 1.0.1\n side-channel: 1.1.1\n\n range-parser@1.3.0: {}\n\n raw-body@3.0.2:\n dependencies:\n bytes: 3.1.2\n http-errors: 2.0.1\n iconv-lite: 0.7.3\n unpipe: 1.0.0\n\n require-from-string@2.0.2: {}\n\n router@2.2.0:\n dependencies:\n debug: 4.4.3\n depd: 2.0.0\n is-promise: 4.0.0\n parseurl: 1.3.3\n path-to-regexp: 8.4.2\n transitivePeerDependencies:\n - supports-color\n\n safer-buffer@2.1.2: {}\n\n send@1.2.1:\n dependencies:\n debug: 4.4.3\n encodeurl: 2.0.0\n escape-html: 1.0.3\n etag: 1.8.1\n fresh: 2.0.0\n http-errors: 2.0.1\n mime-types: 3.0.2\n ms: 2.1.3\n on-finished: 2.4.1\n range-parser: 1.3.0\n statuses: 2.0.2\n transitivePeerDependencies:\n - supports-color\n\n serve-static@2.2.1:\n dependencies:\n encodeurl: 2.0.0\n escape-html: 1.0.3\n parseurl: 1.3.3\n send: 1.2.1\n transitivePeerDependencies:\n - supports-color\n\n setprototypeof@1.2.0: {}\n\n shebang-command@2.0.0:\n dependencies:\n shebang-regex: 3.0.0\n\n shebang-regex@3.0.0: {}\n\n side-channel-list@1.0.1:\n dependencies:\n es-errors: 1.3.0\n object-inspect: 1.13.4\n\n side-channel-map@1.0.1:\n dependencies:\n call-bound: 1.0.4\n es-errors: 1.3.0\n get-intrinsic: 1.3.0\n object-inspect: 1.13.4\n\n side-channel-weakmap@1.0.2:\n dependencies:\n call-bound: 1.0.4\n es-errors: 1.3.0\n get-intrinsic: 1.3.0\n object-inspect: 1.13.4\n side-channel-map: 1.0.1\n\n side-channel@1.1.1:\n dependencies:\n es-errors: 1.3.0\n object-inspect: 1.13.4\n side-channel-list: 1.0.1\n side-channel-map: 1.0.1\n side-channel-weakmap: 1.0.2\n\n statuses@2.0.2: {}\n\n toidentifier@1.0.1: {}\n\n type-is@2.1.0:\n dependencies:\n content-type: 2.1.0\n media-typer: 1.1.1\n mime-types: 3.0.2\n\n unpipe@1.0.0: {}\n\n vary@1.1.2: {}\n\n which@2.0.2:\n dependencies:\n isexe: 2.0.0\n\n wrappy@1.0.2: {}\n\n ws@8.21.0: {}\n\n zod-to-json-schema@3.25.2(zod@4.4.3):\n dependencies:\n zod: 4.4.3\n\n zod@4.4.3: {}\n";
17
157
  var GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE = "allowBuilds:\n '@xai-official/grok@1.0.5': true\n";
18
158
  var GROK_BUILD_BUILTIN_TOOLS = {
159
+ askUserQuestions: HARNESS_V1_BUILTIN_TOOLS.askUserQuestions,
19
160
  bash: commonTool("bash", {
20
161
  nativeName: "run_terminal_command",
21
162
  toolUseKind: "bash",
22
- inputSchema: z.looseObject({
23
- command: z.string(),
24
- timeout: z.number().int().min(0).max(36e6).nullable().optional(),
25
- description: z.string().optional(),
26
- background: z.boolean().optional()
163
+ inputSchema: z2.looseObject({
164
+ command: z2.string(),
165
+ timeout: z2.number().int().min(0).max(36e6).nullable().optional(),
166
+ description: z2.string().optional(),
167
+ background: z2.boolean().optional()
27
168
  })
28
169
  }),
29
170
  edit: commonTool("edit", {
30
171
  nativeName: "search_replace",
31
172
  toolUseKind: "edit",
32
- inputSchema: z.looseObject({
33
- file_path: z.string(),
34
- old_string: z.string(),
35
- new_string: z.string(),
36
- replace_all: z.boolean().optional()
173
+ inputSchema: z2.looseObject({
174
+ file_path: z2.string(),
175
+ old_string: z2.string(),
176
+ new_string: z2.string(),
177
+ replace_all: z2.boolean().optional()
37
178
  })
38
179
  }),
39
180
  grep: commonTool("grep", {
40
181
  nativeName: "grep",
41
182
  toolUseKind: "readonly",
42
- inputSchema: z.looseObject({
43
- pattern: z.string(),
44
- path: z.string().nullable().optional(),
45
- glob: z.string().nullable().optional(),
46
- "-B": z.number().int().optional(),
47
- "-A": z.number().int().optional(),
48
- "-C": z.number().int().optional(),
49
- "-i": z.boolean().optional(),
50
- type: z.string().nullable().optional(),
51
- head_limit: z.number().int().optional(),
52
- multiline: z.boolean().optional()
183
+ inputSchema: z2.looseObject({
184
+ pattern: z2.string(),
185
+ path: z2.string().nullable().optional(),
186
+ glob: z2.string().nullable().optional(),
187
+ "-B": z2.number().int().optional(),
188
+ "-A": z2.number().int().optional(),
189
+ "-C": z2.number().int().optional(),
190
+ "-i": z2.boolean().optional(),
191
+ type: z2.string().nullable().optional(),
192
+ head_limit: z2.number().int().optional(),
193
+ multiline: z2.boolean().optional()
53
194
  })
54
195
  }),
55
196
  webSearch: commonTool("webSearch", {
56
197
  nativeName: "web_search",
57
198
  toolUseKind: "readonly",
58
- inputSchema: z.looseObject({
59
- query: z.string(),
60
- allowed_domains: z.array(z.string()).nullable().optional()
199
+ inputSchema: z2.looseObject({
200
+ query: z2.string(),
201
+ allowed_domains: z2.array(z2.string()).nullable().optional()
61
202
  })
62
203
  }),
63
204
  write: commonTool("write", {
64
205
  nativeName: "write",
65
206
  toolUseKind: "edit",
66
- inputSchema: z.looseObject({
67
- file_path: z.string(),
68
- content: z.string()
207
+ inputSchema: z2.looseObject({
208
+ file_path: z2.string(),
209
+ content: z2.string()
69
210
  })
70
211
  }),
71
212
  read_file: {
72
213
  ...tool({
73
- inputSchema: z.looseObject({
74
- target_file: z.string(),
75
- offset: z.number().int().optional(),
76
- limit: z.number().int().optional(),
77
- pages: z.string().nullable().optional(),
78
- format: z.string().nullable().optional()
214
+ inputSchema: z2.looseObject({
215
+ target_file: z2.string(),
216
+ offset: z2.number().int().optional(),
217
+ limit: z2.number().int().optional(),
218
+ pages: z2.string().nullable().optional(),
219
+ format: z2.string().nullable().optional()
79
220
  })
80
221
  }),
81
222
  toolUseKind: "readonly"
82
223
  },
83
224
  list_dir: {
84
225
  ...tool({
85
- inputSchema: z.looseObject({
86
- target_directory: z.string()
226
+ inputSchema: z2.looseObject({
227
+ target_directory: z2.string()
87
228
  })
88
229
  }),
89
230
  toolUseKind: "readonly"
90
231
  },
91
232
  kill_command_or_subagent: tool({
92
- inputSchema: z.looseObject({
93
- task_id: z.string()
233
+ inputSchema: z2.looseObject({
234
+ task_id: z2.string()
94
235
  })
95
236
  }),
96
237
  todo_write: tool({
97
- inputSchema: z.looseObject({
98
- merge: z.boolean().optional(),
99
- todos: z.array(
100
- z.looseObject({
101
- id: z.string(),
102
- content: z.string().nullable().optional(),
103
- status: z.enum(["pending", "in_progress", "completed", "cancelled"]).nullable().optional()
238
+ inputSchema: z2.looseObject({
239
+ merge: z2.boolean().optional(),
240
+ todos: z2.array(
241
+ z2.looseObject({
242
+ id: z2.string(),
243
+ content: z2.string().nullable().optional(),
244
+ status: z2.enum(["pending", "in_progress", "completed", "cancelled"]).nullable().optional()
104
245
  })
105
246
  )
106
247
  })
107
248
  }),
108
249
  get_command_or_subagent_output: {
109
250
  ...tool({
110
- inputSchema: z.looseObject({
111
- task_ids: z.array(z.string()).optional(),
112
- timeout_ms: z.number().int().nonnegative().nullable().optional()
251
+ inputSchema: z2.looseObject({
252
+ task_ids: z2.array(z2.string()).optional(),
253
+ timeout_ms: z2.number().int().nonnegative().nullable().optional()
113
254
  })
114
255
  }),
115
256
  toolUseKind: "readonly"
116
257
  },
117
258
  spawn_subagent: tool({
118
- inputSchema: z.looseObject({
119
- prompt: z.string(),
120
- description: z.string(),
121
- subagent_type: z.string().optional(),
122
- background: z.boolean().optional(),
123
- capability_mode: z.enum(["read-only", "read-write", "execute", "all"]).nullable().optional(),
124
- isolation: z.enum(["none", "worktree"]).nullable().optional(),
125
- resume_from: z.string().nullable().optional(),
126
- cwd: z.string().nullable().optional(),
127
- model: z.string().nullable().optional()
259
+ inputSchema: z2.looseObject({
260
+ prompt: z2.string(),
261
+ description: z2.string(),
262
+ subagent_type: z2.string().optional(),
263
+ background: z2.boolean().optional(),
264
+ capability_mode: z2.enum(["read-only", "read-write", "execute", "all"]).nullable().optional(),
265
+ isolation: z2.enum(["none", "worktree"]).nullable().optional(),
266
+ resume_from: z2.string().nullable().optional(),
267
+ cwd: z2.string().nullable().optional(),
268
+ model: z2.string().nullable().optional()
128
269
  })
129
270
  }),
130
271
  scheduler_create: tool({
131
- inputSchema: z.looseObject({
132
- task_id: z.string().nullable().optional(),
133
- interval: z.string().nullable().optional(),
134
- prompt: z.string().nullable().optional(),
135
- durable: z.boolean().nullable().optional(),
136
- foreground: z.boolean().nullable().optional(),
137
- fire_immediately: z.boolean().optional()
272
+ inputSchema: z2.looseObject({
273
+ task_id: z2.string().nullable().optional(),
274
+ interval: z2.string().nullable().optional(),
275
+ prompt: z2.string().nullable().optional(),
276
+ durable: z2.boolean().nullable().optional(),
277
+ foreground: z2.boolean().nullable().optional(),
278
+ fire_immediately: z2.boolean().optional()
138
279
  })
139
280
  }),
140
281
  scheduler_delete: tool({
141
- inputSchema: z.looseObject({ id: z.string() })
282
+ inputSchema: z2.looseObject({ id: z2.string() })
142
283
  }),
143
284
  scheduler_list: {
144
- ...tool({ inputSchema: z.looseObject({}) }),
285
+ ...tool({ inputSchema: z2.looseObject({}) }),
145
286
  toolUseKind: "readonly"
146
287
  },
147
288
  monitor: tool({
148
- inputSchema: z.looseObject({
149
- command: z.string(),
150
- description: z.string(),
151
- timeout_ms: z.number().int().nonnegative().nullable().optional(),
152
- persistent: z.boolean().optional()
289
+ inputSchema: z2.looseObject({
290
+ command: z2.string(),
291
+ description: z2.string(),
292
+ timeout_ms: z2.number().int().nonnegative().nullable().optional(),
293
+ persistent: z2.boolean().optional()
153
294
  })
154
295
  }),
155
296
  search_tool: {
156
297
  ...tool({
157
- inputSchema: z.looseObject({
158
- query: z.string(),
159
- limit: z.number().int().min(0).max(255).nullable().optional()
298
+ inputSchema: z2.looseObject({
299
+ query: z2.string(),
300
+ limit: z2.number().int().min(0).max(255).nullable().optional()
160
301
  })
161
302
  }),
162
303
  toolUseKind: "readonly"
163
304
  },
164
305
  use_tool: tool({
165
- inputSchema: z.looseObject({
166
- tool_name: z.string(),
167
- tool_input: z.looseObject({})
306
+ inputSchema: z2.looseObject({
307
+ tool_name: z2.string(),
308
+ tool_input: z2.looseObject({})
168
309
  })
169
310
  }),
170
311
  workflow: tool({
171
- inputSchema: z.looseObject({
172
- agent_budget: z.number().int().min(1).max(1024).nullable().optional(),
173
- name: z.string().nullable().optional(),
174
- script: z.string().nullable().optional(),
175
- script_path: z.string().nullable().optional(),
176
- args: z.unknown().optional(),
177
- resume_from_run_id: z.string().nullable().optional(),
178
- validate_only: z.boolean().optional()
179
- })
180
- }),
181
- enter_plan_mode: tool({ inputSchema: z.looseObject({}) }),
182
- exit_plan_mode: tool({ inputSchema: z.looseObject({}) }),
183
- ask_user_question: tool({
184
- inputSchema: z.looseObject({
185
- questions: z.array(
186
- z.looseObject({
187
- question: z.string(),
188
- options: z.array(
189
- z.looseObject({
190
- label: z.string(),
191
- description: z.string(),
192
- preview: z.string().nullable().optional()
193
- })
194
- ),
195
- multi_select: z.boolean().nullable().optional()
196
- })
197
- )
312
+ inputSchema: z2.looseObject({
313
+ agent_budget: z2.number().int().min(1).max(1024).nullable().optional(),
314
+ name: z2.string().nullable().optional(),
315
+ script: z2.string().nullable().optional(),
316
+ script_path: z2.string().nullable().optional(),
317
+ args: z2.unknown().optional(),
318
+ resume_from_run_id: z2.string().nullable().optional(),
319
+ validate_only: z2.boolean().optional()
198
320
  })
199
321
  }),
322
+ enter_plan_mode: tool({ inputSchema: z2.looseObject({}) }),
323
+ exit_plan_mode: tool({ inputSchema: z2.looseObject({}) }),
200
324
  image_gen: tool({
201
- inputSchema: z.looseObject({
202
- prompt: z.string(),
203
- aspect_ratio: z.string().optional()
325
+ inputSchema: z2.looseObject({
326
+ prompt: z2.string(),
327
+ aspect_ratio: z2.string().optional()
204
328
  })
205
329
  }),
206
330
  image_edit: tool({
207
- inputSchema: z.looseObject({
208
- prompt: z.string(),
209
- image: z.array(z.string()),
210
- aspect_ratio: z.string().optional()
331
+ inputSchema: z2.looseObject({
332
+ prompt: z2.string(),
333
+ image: z2.array(z2.string()),
334
+ aspect_ratio: z2.string().optional()
211
335
  })
212
336
  }),
213
337
  image_to_video: tool({
214
- inputSchema: z.looseObject({
215
- prompt: z.string().nullable().optional(),
216
- image: z.string(),
217
- duration: z.number().int().nonnegative().nullable().optional(),
218
- resolution_name: z.string().optional()
338
+ inputSchema: z2.looseObject({
339
+ prompt: z2.string().nullable().optional(),
340
+ image: z2.string(),
341
+ duration: z2.number().int().nonnegative().nullable().optional(),
342
+ resolution_name: z2.string().optional()
219
343
  })
220
344
  }),
221
345
  reference_to_video: tool({
222
- inputSchema: z.looseObject({
223
- prompt: z.string(),
224
- images: z.array(z.string()),
225
- aspect_ratio: z.string(),
226
- duration: z.number().int().nonnegative().nullable().optional(),
227
- resolution_name: z.string().optional()
346
+ inputSchema: z2.looseObject({
347
+ prompt: z2.string(),
348
+ images: z2.array(z2.string()),
349
+ aspect_ratio: z2.string(),
350
+ duration: z2.number().int().nonnegative().nullable().optional(),
351
+ resolution_name: z2.string().optional()
228
352
  })
229
353
  })
230
354
  };
@@ -251,6 +375,7 @@ function createGrokBuild(settings = {}) {
251
375
  version: "v1",
252
376
  harnessId: "grok-build",
253
377
  builtinTools: GROK_BUILD_BUILTIN_TOOLS,
378
+ askUserQuestions: grokBuildAskUserQuestions,
254
379
  clientApp: {
255
380
  name: clientAppSegments.join("/"),
256
381
  version: clientAppVersion
@@ -268,7 +393,7 @@ function createGrokBuild(settings = {}) {
268
393
  "stdio"
269
394
  ],
270
395
  credentialEnv: ["XAI_API_KEY"],
271
- credentialBrokering: ({ env, sandboxEnv }) => {
396
+ credentialBrokering: ({ env, sandboxEnv, headers }) => {
272
397
  if (!env.XAI_API_KEY || !sandboxEnv?.XAI_API_KEY) return [];
273
398
  return [
274
399
  createCredentialRequestTransformation({
@@ -276,13 +401,16 @@ function createGrokBuild(settings = {}) {
276
401
  matchHeaders: {
277
402
  Authorization: `Bearer ${sandboxEnv.XAI_API_KEY}`
278
403
  },
279
- transformHeaders: { Authorization: `Bearer ${env.XAI_API_KEY}` }
404
+ transformHeaders: {
405
+ ...headers,
406
+ Authorization: `Bearer ${env.XAI_API_KEY}`
407
+ }
280
408
  })
281
409
  ];
282
410
  },
283
411
  instructionMapping: {
284
- type: "session-meta",
285
- path: ["rules"]
412
+ type: "filesystem",
413
+ path: ".grok/AGENTS.md"
286
414
  },
287
415
  outputSchemaMapping: {
288
416
  type: "session-prompt-meta",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/grok-build-harness.ts","../src/version.ts","../src/index.ts"],"sourcesContent":["import {\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n type HarnessV1CredentialForwarding,\n type HarnessV1PortEndpoint,\n} from '@ai-sdk/harness';\nimport { createCredentialRequestTransformation } from '@ai-sdk/harness/utils';\nimport { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\n\ndeclare const __GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON__: string;\ndeclare const __GROK_BUILD_IMPLEMENTATION_PNPM_LOCK_YAML__: string;\ndeclare const __GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE_YAML__: string;\n\nconst GROK_BUILD_CLIENT_APP = `ai-sdk/harness-grok-build/${VERSION}`;\nconst GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON =\n __GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON__;\nconst GROK_BUILD_IMPLEMENTATION_PNPM_LOCK =\n __GROK_BUILD_IMPLEMENTATION_PNPM_LOCK_YAML__;\nconst GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE =\n __GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE_YAML__;\n\nexport type GrokBuildAuthenticationMode = ACPAuthenticationMode;\n\nexport type GrokBuildHarnessSettings = {\n /**\n * Selects direct xAI or AI Gateway authentication. Defaults to automatic\n * environment-based selection.\n */\n readonly auth?: GrokBuildAuthenticationMode;\n /**\n * Customizes each credential value before it is forwarded into a sandbox\n * process. This does not restrict which credentials the harness adapter can\n * discover, read, or otherwise access in the host process.\n */\n readonly credentialForwarding?: HarnessV1CredentialForwarding;\n /**\n * Grok model id selected through Grok Build configuration. Leaving this\n * unset uses the default model.\n *\n * @deprecated Use `model` on `HarnessAgent` instead.\n */\n readonly model?: string;\n /**\n * Reasoning effort for reasoning-capable models. Leaving this unset defers\n * to Grok Build's default.\n */\n readonly reasoningEffort?:\n | 'none'\n | 'minimal'\n | 'low'\n | 'medium'\n | 'high'\n | 'xhigh'\n | 'max';\n /**\n * Overrides the sandbox port used by the ACP bridge.\n */\n readonly port?: number;\n /**\n * Override the host endpoint used to connect to the sandbox bridge. Required\n * together with `port` when using a basic sandbox session.\n */\n readonly portEndpoint?: HarnessV1PortEndpoint;\n /**\n * Maximum milliseconds to wait for the ACP bridge to start.\n */\n readonly startupTimeoutMs?: number;\n /**\n * MCP server definitions keyed by server name. Each definition uses the\n * underlying runtime's native MCP server configuration format.\n */\n readonly mcpServers?: Record<string, unknown>;\n /**\n * Creates the authentication token used by the sandbox bridge. Defaults to\n * a random 32-byte hexadecimal token.\n */\n readonly mintBridgeToken?: (sandboxId: string) => string;\n};\n\n/*\n * Tool names and inputs were captured from the model request produced by\n * @xai-official/grok 0.2.111, the version used by the pinned Grok Build ACP\n * implementation.\n */\nconst GROK_BUILD_BUILTIN_TOOLS = {\n bash: commonTool('bash', {\n nativeName: 'run_terminal_command',\n toolUseKind: 'bash',\n inputSchema: z.looseObject({\n command: z.string(),\n timeout: z.number().int().min(0).max(36_000_000).nullable().optional(),\n description: z.string().optional(),\n background: z.boolean().optional(),\n }),\n }),\n edit: commonTool('edit', {\n nativeName: 'search_replace',\n toolUseKind: 'edit',\n inputSchema: z.looseObject({\n file_path: z.string(),\n old_string: z.string(),\n new_string: z.string(),\n replace_all: z.boolean().optional(),\n }),\n }),\n grep: commonTool('grep', {\n nativeName: 'grep',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n path: z.string().nullable().optional(),\n glob: z.string().nullable().optional(),\n '-B': z.number().int().optional(),\n '-A': z.number().int().optional(),\n '-C': z.number().int().optional(),\n '-i': z.boolean().optional(),\n type: z.string().nullable().optional(),\n head_limit: z.number().int().optional(),\n multiline: z.boolean().optional(),\n }),\n }),\n webSearch: commonTool('webSearch', {\n nativeName: 'web_search',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n query: z.string(),\n allowed_domains: z.array(z.string()).nullable().optional(),\n }),\n }),\n write: commonTool('write', {\n nativeName: 'write',\n toolUseKind: 'edit',\n inputSchema: z.looseObject({\n file_path: z.string(),\n content: z.string(),\n }),\n }),\n read_file: {\n ...tool({\n inputSchema: z.looseObject({\n target_file: z.string(),\n offset: z.number().int().optional(),\n limit: z.number().int().optional(),\n pages: z.string().nullable().optional(),\n format: z.string().nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n list_dir: {\n ...tool({\n inputSchema: z.looseObject({\n target_directory: z.string(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n kill_command_or_subagent: tool({\n inputSchema: z.looseObject({\n task_id: z.string(),\n }),\n }),\n todo_write: tool({\n inputSchema: z.looseObject({\n merge: z.boolean().optional(),\n todos: z.array(\n z.looseObject({\n id: z.string(),\n content: z.string().nullable().optional(),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'cancelled'])\n .nullable()\n .optional(),\n }),\n ),\n }),\n }),\n get_command_or_subagent_output: {\n ...tool({\n inputSchema: z.looseObject({\n task_ids: z.array(z.string()).optional(),\n timeout_ms: z.number().int().nonnegative().nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n spawn_subagent: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n description: z.string(),\n subagent_type: z.string().optional(),\n background: z.boolean().optional(),\n capability_mode: z\n .enum(['read-only', 'read-write', 'execute', 'all'])\n .nullable()\n .optional(),\n isolation: z.enum(['none', 'worktree']).nullable().optional(),\n resume_from: z.string().nullable().optional(),\n cwd: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n }),\n }),\n scheduler_create: tool({\n inputSchema: z.looseObject({\n task_id: z.string().nullable().optional(),\n interval: z.string().nullable().optional(),\n prompt: z.string().nullable().optional(),\n durable: z.boolean().nullable().optional(),\n foreground: z.boolean().nullable().optional(),\n fire_immediately: z.boolean().optional(),\n }),\n }),\n scheduler_delete: tool({\n inputSchema: z.looseObject({ id: z.string() }),\n }),\n scheduler_list: {\n ...tool({ inputSchema: z.looseObject({}) }),\n toolUseKind: 'readonly',\n },\n monitor: tool({\n inputSchema: z.looseObject({\n command: z.string(),\n description: z.string(),\n timeout_ms: z.number().int().nonnegative().nullable().optional(),\n persistent: z.boolean().optional(),\n }),\n }),\n search_tool: {\n ...tool({\n inputSchema: z.looseObject({\n query: z.string(),\n limit: z.number().int().min(0).max(255).nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n use_tool: tool({\n inputSchema: z.looseObject({\n tool_name: z.string(),\n tool_input: z.looseObject({}),\n }),\n }),\n workflow: tool({\n inputSchema: z.looseObject({\n agent_budget: z.number().int().min(1).max(1024).nullable().optional(),\n name: z.string().nullable().optional(),\n script: z.string().nullable().optional(),\n script_path: z.string().nullable().optional(),\n args: z.unknown().optional(),\n resume_from_run_id: z.string().nullable().optional(),\n validate_only: z.boolean().optional(),\n }),\n }),\n enter_plan_mode: tool({ inputSchema: z.looseObject({}) }),\n exit_plan_mode: tool({ inputSchema: z.looseObject({}) }),\n ask_user_question: tool({\n inputSchema: z.looseObject({\n questions: z.array(\n z.looseObject({\n question: z.string(),\n options: z.array(\n z.looseObject({\n label: z.string(),\n description: z.string(),\n preview: z.string().nullable().optional(),\n }),\n ),\n multi_select: z.boolean().nullable().optional(),\n }),\n ),\n }),\n }),\n image_gen: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n aspect_ratio: z.string().optional(),\n }),\n }),\n image_edit: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n image: z.array(z.string()),\n aspect_ratio: z.string().optional(),\n }),\n }),\n image_to_video: tool({\n inputSchema: z.looseObject({\n prompt: z.string().nullable().optional(),\n image: z.string(),\n duration: z.number().int().nonnegative().nullable().optional(),\n resolution_name: z.string().optional(),\n }),\n }),\n reference_to_video: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n images: z.array(z.string()),\n aspect_ratio: z.string(),\n duration: z.number().int().nonnegative().nullable().optional(),\n resolution_name: z.string().optional(),\n }),\n }),\n} as const satisfies Record<string, HarnessV1BuiltinTool<any, any>>;\n\nexport function createGrokBuild(\n settings: GrokBuildHarnessSettings = {},\n): HarnessV1<typeof GROK_BUILD_BUILTIN_TOOLS> {\n const clientAppSegments = GROK_BUILD_CLIENT_APP.split('/');\n const clientAppVersion = clientAppSegments.pop()!;\n return createACP({\n auth: settings.auth,\n credentialForwarding: settings.credentialForwarding,\n modelId: settings.model,\n port: settings.port,\n portEndpoint: settings.portEndpoint,\n startupTimeoutMs: settings.startupTimeoutMs,\n mcpServers: settings.mcpServers,\n modelMapping: {\n type: 'session-model',\n path: 'modelId',\n },\n isMcpToolCall: toolCall => {\n const metadata = toolCall._meta?.['x.ai/tool'];\n return isRecord(metadata) && metadata.namespace === 'mcp';\n },\n mintBridgeToken: settings.mintBridgeToken,\n version: 'v1',\n harnessId: 'grok-build',\n builtinTools: GROK_BUILD_BUILTIN_TOOLS,\n clientApp: {\n name: clientAppSegments.join('/'),\n version: clientAppVersion,\n },\n source: {\n type: 'npm-locked',\n packageJson: GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON,\n pnpmLockYaml: GROK_BUILD_IMPLEMENTATION_PNPM_LOCK,\n pnpmWorkspaceYaml: GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE,\n },\n executable: 'grok',\n args: [\n 'agent',\n ...(settings.reasoningEffort == null\n ? []\n : ['--reasoning-effort', settings.reasoningEffort]),\n 'stdio',\n ],\n credentialEnv: ['XAI_API_KEY'],\n credentialBrokering: ({ env, sandboxEnv }) => {\n if (!env.XAI_API_KEY || !sandboxEnv?.XAI_API_KEY) return [];\n return [\n createCredentialRequestTransformation({\n matchUrl: env.GROK_XAI_API_BASE_URL ?? 'https://api.x.ai/v1',\n matchHeaders: {\n Authorization: `Bearer ${sandboxEnv.XAI_API_KEY}`,\n },\n transformHeaders: { Authorization: `Bearer ${env.XAI_API_KEY}` },\n }),\n ];\n },\n instructionMapping: {\n type: 'session-meta',\n path: ['rules'],\n },\n outputSchemaMapping: {\n type: 'session-prompt-meta',\n path: ['outputSchema'],\n },\n providerAuthentication: {\n gateway: {\n env: {\n GROK_CLIENT_NAME: { $source: 'client-app-name' },\n GROK_CLIENT_VERSION: { $source: 'client-app-version' },\n XAI_API_KEY: { $source: 'gateway-api-key' },\n GROK_XAI_API_BASE_URL: {\n $source: 'gateway-base-url',\n ensureSuffix: '/v1',\n },\n GROK_MODELS_BASE_URL: {\n $source: 'gateway-base-url',\n ensureSuffix: '/v1',\n },\n },\n },\n },\n });\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n","declare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import { createGrokBuild } from './grok-build-harness';\n\n/**\n * Default Grok Build harness instance. Equivalent to `createGrokBuild()`.\n */\nexport const grokBuild = createGrokBuild();\n\nexport { createGrokBuild } from './grok-build-harness';\nexport type {\n GrokBuildAuthenticationMode,\n GrokBuildHarnessSettings,\n} from './grok-build-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAKK;AACP,SAAS,6CAA6C;AACtD,SAAS,iBAA6C;AACtD,SAAS,YAAY;AACrB,SAAS,SAAS;;;ACTX,IAAM,UACX,OACI,WACA;;;ADaN,IAAM,wBAAwB,6BAA6B,OAAO;AAClE,IAAM,yCACJ;AACF,IAAM,sCACJ;AACF,IAAM,2CACJ;AAiEF,IAAM,2BAA2B;AAAA,EAC/B,MAAM,WAAW,QAAQ;AAAA,IACvB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa,EAAE,YAAY;AAAA,MACzB,SAAS,EAAE,OAAO;AAAA,MAClB,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,IAAU,EAAE,SAAS,EAAE,SAAS;AAAA,MACrE,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,MACjC,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,IACnC,CAAC;AAAA,EACH,CAAC;AAAA,EACD,MAAM,WAAW,QAAQ;AAAA,IACvB,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa,EAAE,YAAY;AAAA,MACzB,WAAW,EAAE,OAAO;AAAA,MACpB,YAAY,EAAE,OAAO;AAAA,MACrB,YAAY,EAAE,OAAO;AAAA,MACrB,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AAAA,EACD,MAAM,WAAW,QAAQ;AAAA,IACvB,YAAY;A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UAAU,IAAI,yBAAyB;AAAA,UACvC,cAAc;AAAA,YACZ,eAAe,UAAU,WAAW,WAAW;AAAA,UACjD;AAAA,UACA,kBAAkB,EAAE,eAAe,UAAU,IAAI,WAAW,GAAG;AAAA,QACjE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,MAAM,CAAC,OAAO;AAAA,IAChB;AAAA,IACA,qBAAqB;AAAA,MACnB,MAAM;AAAA,MACN,MAAM,CAAC,cAAc;AAAA,IACvB;AAAA,IACA,wBAAwB;AAAA,MACtB,SAAS;AAAA,QACP,KAAK;AAAA,UACH,kBAAkB,EAAE,SAAS,kBAAkB;AAAA,UAC/C,qBAAqB,EAAE,SAAS,qBAAqB;AAAA,UACrD,aAAa,EAAE,SAAS,kBAAkB;AAAA,UAC1C,uBAAuB;AAAA,YACrB,SAAS;AAAA,YACT,cAAc;AAAA,UAChB;AAAA,UACA,sBAAsB;AAAA,YACpB,SAAS;AAAA,YACT,cAAc;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,SAAS,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC3E;;;AErYO,IAAM,YAAY,gBAAgB;","names":[]}
1
+ {"version":3,"sources":["../src/grok-build-harness.ts","../src/version.ts","../src/grok-build-question-tool.ts","../src/index.ts"],"sourcesContent":["import {\n HARNESS_V1_BUILTIN_TOOLS,\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n type HarnessV1CredentialForwarding,\n type HarnessV1PortEndpoint,\n} from '@ai-sdk/harness';\nimport { createCredentialRequestTransformation } from '@ai-sdk/harness/utils';\nimport { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\nimport { grokBuildAskUserQuestions } from './grok-build-question-tool';\n\ndeclare const __GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON__: string;\ndeclare const __GROK_BUILD_IMPLEMENTATION_PNPM_LOCK_YAML__: string;\ndeclare const __GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE_YAML__: string;\n\nconst GROK_BUILD_CLIENT_APP = `ai-sdk/harness-grok-build/${VERSION}`;\nconst GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON =\n __GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON__;\nconst GROK_BUILD_IMPLEMENTATION_PNPM_LOCK =\n __GROK_BUILD_IMPLEMENTATION_PNPM_LOCK_YAML__;\nconst GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE =\n __GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE_YAML__;\n\nexport type GrokBuildAuthenticationMode = ACPAuthenticationMode;\n\nexport type GrokBuildHarnessSettings = {\n /**\n * Selects direct xAI or AI Gateway authentication. Defaults to automatic\n * environment-based selection.\n */\n readonly auth?: GrokBuildAuthenticationMode;\n /**\n * Customizes each credential value before it is forwarded into a sandbox\n * process. This does not restrict which credentials the harness adapter can\n * discover, read, or otherwise access in the host process.\n */\n readonly credentialForwarding?: HarnessV1CredentialForwarding;\n /**\n * Grok model id selected through Grok Build configuration. Leaving this\n * unset uses the default model.\n *\n * @deprecated Use `model` on `HarnessAgent` instead.\n */\n readonly model?: string;\n /**\n * Reasoning effort for reasoning-capable models. Leaving this unset defers\n * to Grok Build's default.\n */\n readonly reasoningEffort?:\n | 'none'\n | 'minimal'\n | 'low'\n | 'medium'\n | 'high'\n | 'xhigh'\n | 'max';\n /**\n * Overrides the sandbox port used by the ACP bridge.\n */\n readonly port?: number;\n /**\n * Override the host endpoint used to connect to the sandbox bridge. Required\n * together with `port` when using a basic sandbox session.\n */\n readonly portEndpoint?: HarnessV1PortEndpoint;\n /**\n * Maximum milliseconds to wait for the ACP bridge to start.\n */\n readonly startupTimeoutMs?: number;\n /**\n * MCP server definitions keyed by server name. Each definition uses the\n * underlying runtime's native MCP server configuration format.\n */\n readonly mcpServers?: Record<string, unknown>;\n /**\n * Creates the authentication token used by the sandbox bridge. Defaults to\n * a random 32-byte hexadecimal token.\n */\n readonly mintBridgeToken?: (sandboxId: string) => string;\n};\n\n/*\n * Tool names and inputs were captured from the model request produced by\n * @xai-official/grok 0.2.111, the version used by the pinned Grok Build ACP\n * implementation.\n */\nconst GROK_BUILD_BUILTIN_TOOLS = {\n askUserQuestions: HARNESS_V1_BUILTIN_TOOLS.askUserQuestions,\n bash: commonTool('bash', {\n nativeName: 'run_terminal_command',\n toolUseKind: 'bash',\n inputSchema: z.looseObject({\n command: z.string(),\n timeout: z.number().int().min(0).max(36_000_000).nullable().optional(),\n description: z.string().optional(),\n background: z.boolean().optional(),\n }),\n }),\n edit: commonTool('edit', {\n nativeName: 'search_replace',\n toolUseKind: 'edit',\n inputSchema: z.looseObject({\n file_path: z.string(),\n old_string: z.string(),\n new_string: z.string(),\n replace_all: z.boolean().optional(),\n }),\n }),\n grep: commonTool('grep', {\n nativeName: 'grep',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n pattern: z.string(),\n path: z.string().nullable().optional(),\n glob: z.string().nullable().optional(),\n '-B': z.number().int().optional(),\n '-A': z.number().int().optional(),\n '-C': z.number().int().optional(),\n '-i': z.boolean().optional(),\n type: z.string().nullable().optional(),\n head_limit: z.number().int().optional(),\n multiline: z.boolean().optional(),\n }),\n }),\n webSearch: commonTool('webSearch', {\n nativeName: 'web_search',\n toolUseKind: 'readonly',\n inputSchema: z.looseObject({\n query: z.string(),\n allowed_domains: z.array(z.string()).nullable().optional(),\n }),\n }),\n write: commonTool('write', {\n nativeName: 'write',\n toolUseKind: 'edit',\n inputSchema: z.looseObject({\n file_path: z.string(),\n content: z.string(),\n }),\n }),\n read_file: {\n ...tool({\n inputSchema: z.looseObject({\n target_file: z.string(),\n offset: z.number().int().optional(),\n limit: z.number().int().optional(),\n pages: z.string().nullable().optional(),\n format: z.string().nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n list_dir: {\n ...tool({\n inputSchema: z.looseObject({\n target_directory: z.string(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n kill_command_or_subagent: tool({\n inputSchema: z.looseObject({\n task_id: z.string(),\n }),\n }),\n todo_write: tool({\n inputSchema: z.looseObject({\n merge: z.boolean().optional(),\n todos: z.array(\n z.looseObject({\n id: z.string(),\n content: z.string().nullable().optional(),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'cancelled'])\n .nullable()\n .optional(),\n }),\n ),\n }),\n }),\n get_command_or_subagent_output: {\n ...tool({\n inputSchema: z.looseObject({\n task_ids: z.array(z.string()).optional(),\n timeout_ms: z.number().int().nonnegative().nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n spawn_subagent: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n description: z.string(),\n subagent_type: z.string().optional(),\n background: z.boolean().optional(),\n capability_mode: z\n .enum(['read-only', 'read-write', 'execute', 'all'])\n .nullable()\n .optional(),\n isolation: z.enum(['none', 'worktree']).nullable().optional(),\n resume_from: z.string().nullable().optional(),\n cwd: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n }),\n }),\n scheduler_create: tool({\n inputSchema: z.looseObject({\n task_id: z.string().nullable().optional(),\n interval: z.string().nullable().optional(),\n prompt: z.string().nullable().optional(),\n durable: z.boolean().nullable().optional(),\n foreground: z.boolean().nullable().optional(),\n fire_immediately: z.boolean().optional(),\n }),\n }),\n scheduler_delete: tool({\n inputSchema: z.looseObject({ id: z.string() }),\n }),\n scheduler_list: {\n ...tool({ inputSchema: z.looseObject({}) }),\n toolUseKind: 'readonly',\n },\n monitor: tool({\n inputSchema: z.looseObject({\n command: z.string(),\n description: z.string(),\n timeout_ms: z.number().int().nonnegative().nullable().optional(),\n persistent: z.boolean().optional(),\n }),\n }),\n search_tool: {\n ...tool({\n inputSchema: z.looseObject({\n query: z.string(),\n limit: z.number().int().min(0).max(255).nullable().optional(),\n }),\n }),\n toolUseKind: 'readonly',\n },\n use_tool: tool({\n inputSchema: z.looseObject({\n tool_name: z.string(),\n tool_input: z.looseObject({}),\n }),\n }),\n workflow: tool({\n inputSchema: z.looseObject({\n agent_budget: z.number().int().min(1).max(1024).nullable().optional(),\n name: z.string().nullable().optional(),\n script: z.string().nullable().optional(),\n script_path: z.string().nullable().optional(),\n args: z.unknown().optional(),\n resume_from_run_id: z.string().nullable().optional(),\n validate_only: z.boolean().optional(),\n }),\n }),\n enter_plan_mode: tool({ inputSchema: z.looseObject({}) }),\n exit_plan_mode: tool({ inputSchema: z.looseObject({}) }),\n image_gen: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n aspect_ratio: z.string().optional(),\n }),\n }),\n image_edit: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n image: z.array(z.string()),\n aspect_ratio: z.string().optional(),\n }),\n }),\n image_to_video: tool({\n inputSchema: z.looseObject({\n prompt: z.string().nullable().optional(),\n image: z.string(),\n duration: z.number().int().nonnegative().nullable().optional(),\n resolution_name: z.string().optional(),\n }),\n }),\n reference_to_video: tool({\n inputSchema: z.looseObject({\n prompt: z.string(),\n images: z.array(z.string()),\n aspect_ratio: z.string(),\n duration: z.number().int().nonnegative().nullable().optional(),\n resolution_name: z.string().optional(),\n }),\n }),\n} as const satisfies Record<string, HarnessV1BuiltinTool<any, any>>;\n\nexport function createGrokBuild(\n settings: GrokBuildHarnessSettings = {},\n): HarnessV1<typeof GROK_BUILD_BUILTIN_TOOLS> {\n const clientAppSegments = GROK_BUILD_CLIENT_APP.split('/');\n const clientAppVersion = clientAppSegments.pop()!;\n return createACP({\n auth: settings.auth,\n credentialForwarding: settings.credentialForwarding,\n modelId: settings.model,\n port: settings.port,\n portEndpoint: settings.portEndpoint,\n startupTimeoutMs: settings.startupTimeoutMs,\n mcpServers: settings.mcpServers,\n modelMapping: {\n type: 'session-model',\n path: 'modelId',\n },\n isMcpToolCall: toolCall => {\n const metadata = toolCall._meta?.['x.ai/tool'];\n return isRecord(metadata) && metadata.namespace === 'mcp';\n },\n mintBridgeToken: settings.mintBridgeToken,\n version: 'v1',\n harnessId: 'grok-build',\n builtinTools: GROK_BUILD_BUILTIN_TOOLS,\n askUserQuestions: grokBuildAskUserQuestions,\n clientApp: {\n name: clientAppSegments.join('/'),\n version: clientAppVersion,\n },\n source: {\n type: 'npm-locked',\n packageJson: GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON,\n pnpmLockYaml: GROK_BUILD_IMPLEMENTATION_PNPM_LOCK,\n pnpmWorkspaceYaml: GROK_BUILD_IMPLEMENTATION_PNPM_WORKSPACE,\n },\n executable: 'grok',\n args: [\n 'agent',\n ...(settings.reasoningEffort == null\n ? []\n : ['--reasoning-effort', settings.reasoningEffort]),\n 'stdio',\n ],\n credentialEnv: ['XAI_API_KEY'],\n credentialBrokering: ({ env, sandboxEnv, headers }) => {\n if (!env.XAI_API_KEY || !sandboxEnv?.XAI_API_KEY) return [];\n return [\n createCredentialRequestTransformation({\n matchUrl: env.GROK_XAI_API_BASE_URL ?? 'https://api.x.ai/v1',\n matchHeaders: {\n Authorization: `Bearer ${sandboxEnv.XAI_API_KEY}`,\n },\n transformHeaders: {\n ...headers,\n Authorization: `Bearer ${env.XAI_API_KEY}`,\n },\n }),\n ];\n },\n instructionMapping: {\n type: 'filesystem',\n path: '.grok/AGENTS.md',\n },\n outputSchemaMapping: {\n type: 'session-prompt-meta',\n path: ['outputSchema'],\n },\n providerAuthentication: {\n gateway: {\n env: {\n GROK_CLIENT_NAME: { $source: 'client-app-name' },\n GROK_CLIENT_VERSION: { $source: 'client-app-version' },\n XAI_API_KEY: { $source: 'gateway-api-key' },\n GROK_XAI_API_BASE_URL: {\n $source: 'gateway-base-url',\n ensureSuffix: '/v1',\n },\n GROK_MODELS_BASE_URL: {\n $source: 'gateway-base-url',\n ensureSuffix: '/v1',\n },\n },\n },\n },\n });\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === 'object' && !Array.isArray(value);\n}\n","declare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n","import {\n harnessV1QuestionsToolOutputSchema,\n type HarnessV1QuestionsToolInput,\n} from '@ai-sdk/harness';\nimport type { ACPAskUserQuestionsSettings } from '@ai-sdk/harness-acp';\nimport type { ToolResultPart } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst grokBuildQuestionRequestSchema = z.object({\n sessionId: z.string(),\n toolCallId: z.string(),\n questions: z.array(\n z.object({\n question: z.string(),\n options: z.array(\n z.object({\n label: z.string(),\n description: z.string(),\n preview: z.string().nullable().optional(),\n }),\n ),\n multi_select: z.boolean().nullable().optional(),\n }),\n ),\n mode: z.enum(['default', 'plan']),\n});\n\ntype GrokBuildQuestionRequest = z.infer<typeof grokBuildQuestionRequestSchema>;\n\nexport const grokBuildAskUserQuestions = {\n requestMethod: '_x.ai/ask_user_question',\n fromNativeRequest: ({ nativeRequest }) => {\n const parsed = grokBuildQuestionRequestSchema.safeParse(nativeRequest);\n if (!parsed.success) return null;\n return {\n type: 'tool-call',\n toolCallId: parsed.data.toolCallId,\n toolName: 'askUserQuestions',\n nativeName: 'ask_user_question',\n input: JSON.stringify(toHarnessQuestionsInput(parsed.data)),\n providerExecuted: false,\n };\n },\n toNativeResponse: ({ nativeRequest, toolResult }) => {\n const request = grokBuildQuestionRequestSchema.parse(nativeRequest);\n const output = parseQuestionsOutput(toolResult);\n if (output.action === 'cancelled') {\n return { outcome: 'cancelled' };\n }\n\n const nativeAnswers =\n output.action === 'declined'\n ? { answers: {}, annotations: {} }\n : toNativeAnswers({ request, output });\n const requestedOutcome =\n toolResult.providerOptions?.['grok-build']?.outcome;\n if (\n requestedOutcome === 'chat_about_this' ||\n requestedOutcome === 'skip_interview'\n ) {\n return {\n outcome: requestedOutcome,\n partial_answers: Object.fromEntries(\n Object.entries(nativeAnswers.answers).map(([question, answers]) => [\n question,\n answers.join(', '),\n ]),\n ),\n };\n }\n if (output.action === 'declined') {\n return { outcome: 'skip_interview', partial_answers: {} };\n }\n return {\n outcome: 'accepted',\n answers: nativeAnswers.answers,\n ...(Object.keys(nativeAnswers.annotations).length === 0\n ? {}\n : { annotations: nativeAnswers.annotations }),\n };\n },\n matchesNativeRequest: ({ previousNativeRequest, nativeRequest }) => {\n const previous = grokBuildQuestionRequestSchema.safeParse(\n previousNativeRequest,\n );\n const current = grokBuildQuestionRequestSchema.safeParse(nativeRequest);\n return (\n previous.success &&\n current.success &&\n questionFingerprint(previous.data) === questionFingerprint(current.data)\n );\n },\n} satisfies ACPAskUserQuestionsSettings;\n\nfunction toHarnessQuestionsInput(\n request: GrokBuildQuestionRequest,\n): HarnessV1QuestionsToolInput {\n return {\n allowPartialAnswers: true,\n questions: request.questions.map((question, questionIndex) => ({\n id: questionId(questionIndex),\n question: question.question,\n options: question.options.map((option, optionIndex) => ({\n id: optionId(optionIndex),\n label: option.label,\n description: option.description,\n ...(option.preview == null ? {} : { preview: option.preview }),\n })),\n ...(question.multi_select == null\n ? {}\n : { allowMultiple: question.multi_select }),\n allowFreeForm: true,\n })),\n };\n}\n\nfunction toNativeAnswers({\n request,\n output,\n}: {\n request: GrokBuildQuestionRequest;\n output: Extract<\n ReturnType<typeof parseQuestionsOutput>,\n { action: 'answered' | 'partially-answered' }\n >;\n}): {\n answers: Record<string, string[]>;\n annotations: Record<string, { preview?: string; notes?: string }>;\n} {\n const answers: Record<string, string[]> = {};\n const annotations: Record<string, { preview?: string; notes?: string }> = {};\n request.questions.forEach((question, questionIndex) => {\n const answer = output.answers[questionId(questionIndex)];\n if (answer == null) return;\n const labels = answer.optionIds.flatMap(id => {\n const optionIndex = positionalIdIndex({ id, prefix: 'option-' });\n const option =\n optionIndex == null ? undefined : question.options[optionIndex];\n return option == null ? [] : [option.label];\n });\n if (answer.freeform != null) {\n labels.push('Other');\n annotations[question.question] = { notes: answer.freeform };\n }\n answers[question.question] = labels;\n });\n return { answers, annotations };\n}\n\nfunction parseQuestionsOutput(toolResult: ToolResultPart) {\n if (\n toolResult.output.type !== 'json' &&\n toolResult.output.type !== 'error-json'\n ) {\n throw new Error('Grok Build askUserQuestions requires a JSON tool result.');\n }\n return harnessV1QuestionsToolOutputSchema.parse(toolResult.output.value);\n}\n\nfunction questionId(index: number): string {\n return `question-${index + 1}`;\n}\n\nfunction optionId(index: number): string {\n return `option-${index + 1}`;\n}\n\nfunction positionalIdIndex({\n id,\n prefix,\n}: {\n id: string;\n prefix: string;\n}): number | undefined {\n if (!id.startsWith(prefix)) return undefined;\n const index = Number(id.slice(prefix.length)) - 1;\n return Number.isInteger(index) && index >= 0 ? index : undefined;\n}\n\nfunction questionFingerprint(request: GrokBuildQuestionRequest): string {\n return JSON.stringify({\n questions: request.questions,\n mode: request.mode,\n });\n}\n","import { createGrokBuild } from './grok-build-harness';\n\n/**\n * Default Grok Build harness instance. Equivalent to `createGrokBuild()`.\n */\nexport const grokBuild = createGrokBuild();\n\nexport { createGrokBuild } from './grok-build-harness';\nexport type {\n GrokBuildAuthenticationMode,\n GrokBuildHarnessSettings,\n} from './grok-build-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAKK;AACP,SAAS,6CAA6C;AACtD,SAAS,iBAA6C;AACtD,SAAS,YAAY;AACrB,SAAS,KAAAA,UAAS;;;ACVX,IAAM,UACX,OACI,WACA;;;ACJN;AAAA,EACE;AAAA,OAEK;AAGP,SAAS,SAAS;AAElB,IAAM,iCAAiC,EAAE,OAAO;AAAA,EAC9C,WAAW,EAAE,OAAO;AAAA,EACpB,YAAY,EAAE,OAAO;AAAA,EACrB,WAAW,EAAE;AAAA,IACX,EAAE,OAAO;AAAA,MACP,UAAU,EAAE,OAAO;AAAA,MACnB,SAAS,EAAE;AAAA,QACT,EAAE,OAAO;AAAA,UACP,OAAO,EAAE,OAAO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O,IAAM,YAAY,gBAAgB;","names":["z","z"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/harness-grok-build",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -26,8 +26,8 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@ai-sdk/harness": "1.0.100",
30
- "@ai-sdk/harness-acp": "1.0.38",
29
+ "@ai-sdk/harness": "1.0.102",
30
+ "@ai-sdk/harness-acp": "1.0.40",
31
31
  "@ai-sdk/provider-utils": "5.0.36"
32
32
  },
33
33
  "peerDependencies": {
@@ -1,4 +1,5 @@
1
1
  import {
2
+ HARNESS_V1_BUILTIN_TOOLS,
2
3
  commonTool,
3
4
  type HarnessV1,
4
5
  type HarnessV1BuiltinTool,
@@ -10,6 +11,7 @@ import { createACP, type ACPAuthenticationMode } from '@ai-sdk/harness-acp';
10
11
  import { tool } from '@ai-sdk/provider-utils';
11
12
  import { z } from 'zod/v4';
12
13
  import { VERSION } from './version';
14
+ import { grokBuildAskUserQuestions } from './grok-build-question-tool';
13
15
 
14
16
  declare const __GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON__: string;
15
17
  declare const __GROK_BUILD_IMPLEMENTATION_PNPM_LOCK_YAML__: string;
@@ -87,6 +89,7 @@ export type GrokBuildHarnessSettings = {
87
89
  * implementation.
88
90
  */
89
91
  const GROK_BUILD_BUILTIN_TOOLS = {
92
+ askUserQuestions: HARNESS_V1_BUILTIN_TOOLS.askUserQuestions,
90
93
  bash: commonTool('bash', {
91
94
  nativeName: 'run_terminal_command',
92
95
  toolUseKind: 'bash',
@@ -257,23 +260,6 @@ const GROK_BUILD_BUILTIN_TOOLS = {
257
260
  }),
258
261
  enter_plan_mode: tool({ inputSchema: z.looseObject({}) }),
259
262
  exit_plan_mode: tool({ inputSchema: z.looseObject({}) }),
260
- ask_user_question: tool({
261
- inputSchema: z.looseObject({
262
- questions: z.array(
263
- z.looseObject({
264
- question: z.string(),
265
- options: z.array(
266
- z.looseObject({
267
- label: z.string(),
268
- description: z.string(),
269
- preview: z.string().nullable().optional(),
270
- }),
271
- ),
272
- multi_select: z.boolean().nullable().optional(),
273
- }),
274
- ),
275
- }),
276
- }),
277
263
  image_gen: tool({
278
264
  inputSchema: z.looseObject({
279
265
  prompt: z.string(),
@@ -331,6 +317,7 @@ export function createGrokBuild(
331
317
  version: 'v1',
332
318
  harnessId: 'grok-build',
333
319
  builtinTools: GROK_BUILD_BUILTIN_TOOLS,
320
+ askUserQuestions: grokBuildAskUserQuestions,
334
321
  clientApp: {
335
322
  name: clientAppSegments.join('/'),
336
323
  version: clientAppVersion,
@@ -350,7 +337,7 @@ export function createGrokBuild(
350
337
  'stdio',
351
338
  ],
352
339
  credentialEnv: ['XAI_API_KEY'],
353
- credentialBrokering: ({ env, sandboxEnv }) => {
340
+ credentialBrokering: ({ env, sandboxEnv, headers }) => {
354
341
  if (!env.XAI_API_KEY || !sandboxEnv?.XAI_API_KEY) return [];
355
342
  return [
356
343
  createCredentialRequestTransformation({
@@ -358,13 +345,16 @@ export function createGrokBuild(
358
345
  matchHeaders: {
359
346
  Authorization: `Bearer ${sandboxEnv.XAI_API_KEY}`,
360
347
  },
361
- transformHeaders: { Authorization: `Bearer ${env.XAI_API_KEY}` },
348
+ transformHeaders: {
349
+ ...headers,
350
+ Authorization: `Bearer ${env.XAI_API_KEY}`,
351
+ },
362
352
  }),
363
353
  ];
364
354
  },
365
355
  instructionMapping: {
366
- type: 'session-meta',
367
- path: ['rules'],
356
+ type: 'filesystem',
357
+ path: '.grok/AGENTS.md',
368
358
  },
369
359
  outputSchemaMapping: {
370
360
  type: 'session-prompt-meta',
@@ -0,0 +1,185 @@
1
+ import {
2
+ harnessV1QuestionsToolOutputSchema,
3
+ type HarnessV1QuestionsToolInput,
4
+ } from '@ai-sdk/harness';
5
+ import type { ACPAskUserQuestionsSettings } from '@ai-sdk/harness-acp';
6
+ import type { ToolResultPart } from '@ai-sdk/provider-utils';
7
+ import { z } from 'zod/v4';
8
+
9
+ const grokBuildQuestionRequestSchema = z.object({
10
+ sessionId: z.string(),
11
+ toolCallId: z.string(),
12
+ questions: z.array(
13
+ z.object({
14
+ question: z.string(),
15
+ options: z.array(
16
+ z.object({
17
+ label: z.string(),
18
+ description: z.string(),
19
+ preview: z.string().nullable().optional(),
20
+ }),
21
+ ),
22
+ multi_select: z.boolean().nullable().optional(),
23
+ }),
24
+ ),
25
+ mode: z.enum(['default', 'plan']),
26
+ });
27
+
28
+ type GrokBuildQuestionRequest = z.infer<typeof grokBuildQuestionRequestSchema>;
29
+
30
+ export const grokBuildAskUserQuestions = {
31
+ requestMethod: '_x.ai/ask_user_question',
32
+ fromNativeRequest: ({ nativeRequest }) => {
33
+ const parsed = grokBuildQuestionRequestSchema.safeParse(nativeRequest);
34
+ if (!parsed.success) return null;
35
+ return {
36
+ type: 'tool-call',
37
+ toolCallId: parsed.data.toolCallId,
38
+ toolName: 'askUserQuestions',
39
+ nativeName: 'ask_user_question',
40
+ input: JSON.stringify(toHarnessQuestionsInput(parsed.data)),
41
+ providerExecuted: false,
42
+ };
43
+ },
44
+ toNativeResponse: ({ nativeRequest, toolResult }) => {
45
+ const request = grokBuildQuestionRequestSchema.parse(nativeRequest);
46
+ const output = parseQuestionsOutput(toolResult);
47
+ if (output.action === 'cancelled') {
48
+ return { outcome: 'cancelled' };
49
+ }
50
+
51
+ const nativeAnswers =
52
+ output.action === 'declined'
53
+ ? { answers: {}, annotations: {} }
54
+ : toNativeAnswers({ request, output });
55
+ const requestedOutcome =
56
+ toolResult.providerOptions?.['grok-build']?.outcome;
57
+ if (
58
+ requestedOutcome === 'chat_about_this' ||
59
+ requestedOutcome === 'skip_interview'
60
+ ) {
61
+ return {
62
+ outcome: requestedOutcome,
63
+ partial_answers: Object.fromEntries(
64
+ Object.entries(nativeAnswers.answers).map(([question, answers]) => [
65
+ question,
66
+ answers.join(', '),
67
+ ]),
68
+ ),
69
+ };
70
+ }
71
+ if (output.action === 'declined') {
72
+ return { outcome: 'skip_interview', partial_answers: {} };
73
+ }
74
+ return {
75
+ outcome: 'accepted',
76
+ answers: nativeAnswers.answers,
77
+ ...(Object.keys(nativeAnswers.annotations).length === 0
78
+ ? {}
79
+ : { annotations: nativeAnswers.annotations }),
80
+ };
81
+ },
82
+ matchesNativeRequest: ({ previousNativeRequest, nativeRequest }) => {
83
+ const previous = grokBuildQuestionRequestSchema.safeParse(
84
+ previousNativeRequest,
85
+ );
86
+ const current = grokBuildQuestionRequestSchema.safeParse(nativeRequest);
87
+ return (
88
+ previous.success &&
89
+ current.success &&
90
+ questionFingerprint(previous.data) === questionFingerprint(current.data)
91
+ );
92
+ },
93
+ } satisfies ACPAskUserQuestionsSettings;
94
+
95
+ function toHarnessQuestionsInput(
96
+ request: GrokBuildQuestionRequest,
97
+ ): HarnessV1QuestionsToolInput {
98
+ return {
99
+ allowPartialAnswers: true,
100
+ questions: request.questions.map((question, questionIndex) => ({
101
+ id: questionId(questionIndex),
102
+ question: question.question,
103
+ options: question.options.map((option, optionIndex) => ({
104
+ id: optionId(optionIndex),
105
+ label: option.label,
106
+ description: option.description,
107
+ ...(option.preview == null ? {} : { preview: option.preview }),
108
+ })),
109
+ ...(question.multi_select == null
110
+ ? {}
111
+ : { allowMultiple: question.multi_select }),
112
+ allowFreeForm: true,
113
+ })),
114
+ };
115
+ }
116
+
117
+ function toNativeAnswers({
118
+ request,
119
+ output,
120
+ }: {
121
+ request: GrokBuildQuestionRequest;
122
+ output: Extract<
123
+ ReturnType<typeof parseQuestionsOutput>,
124
+ { action: 'answered' | 'partially-answered' }
125
+ >;
126
+ }): {
127
+ answers: Record<string, string[]>;
128
+ annotations: Record<string, { preview?: string; notes?: string }>;
129
+ } {
130
+ const answers: Record<string, string[]> = {};
131
+ const annotations: Record<string, { preview?: string; notes?: string }> = {};
132
+ request.questions.forEach((question, questionIndex) => {
133
+ const answer = output.answers[questionId(questionIndex)];
134
+ if (answer == null) return;
135
+ const labels = answer.optionIds.flatMap(id => {
136
+ const optionIndex = positionalIdIndex({ id, prefix: 'option-' });
137
+ const option =
138
+ optionIndex == null ? undefined : question.options[optionIndex];
139
+ return option == null ? [] : [option.label];
140
+ });
141
+ if (answer.freeform != null) {
142
+ labels.push('Other');
143
+ annotations[question.question] = { notes: answer.freeform };
144
+ }
145
+ answers[question.question] = labels;
146
+ });
147
+ return { answers, annotations };
148
+ }
149
+
150
+ function parseQuestionsOutput(toolResult: ToolResultPart) {
151
+ if (
152
+ toolResult.output.type !== 'json' &&
153
+ toolResult.output.type !== 'error-json'
154
+ ) {
155
+ throw new Error('Grok Build askUserQuestions requires a JSON tool result.');
156
+ }
157
+ return harnessV1QuestionsToolOutputSchema.parse(toolResult.output.value);
158
+ }
159
+
160
+ function questionId(index: number): string {
161
+ return `question-${index + 1}`;
162
+ }
163
+
164
+ function optionId(index: number): string {
165
+ return `option-${index + 1}`;
166
+ }
167
+
168
+ function positionalIdIndex({
169
+ id,
170
+ prefix,
171
+ }: {
172
+ id: string;
173
+ prefix: string;
174
+ }): number | undefined {
175
+ if (!id.startsWith(prefix)) return undefined;
176
+ const index = Number(id.slice(prefix.length)) - 1;
177
+ return Number.isInteger(index) && index >= 0 ? index : undefined;
178
+ }
179
+
180
+ function questionFingerprint(request: GrokBuildQuestionRequest): string {
181
+ return JSON.stringify({
182
+ questions: request.questions,
183
+ mode: request.mode,
184
+ });
185
+ }