@ai-sdk/harness-grok-build 0.0.0 → 1.0.0
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 +17 -0
- package/LICENSE +13 -0
- package/README.md +41 -3
- package/dist/bridge/package.json +13 -0
- package/dist/bridge/pnpm-lock.yaml +890 -0
- package/dist/index.d.ts +4540 -0
- package/dist/index.js +288 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -10
- package/src/bridge/package.json +13 -0
- package/src/bridge/pnpm-lock.yaml +890 -0
- package/src/grok-build-harness.ts +314 -0
- package/src/index.ts +10 -0
- package/src/version.ts +5 -0
- package/index.js +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// src/grok-build-harness.ts
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import {
|
|
4
|
+
commonTool
|
|
5
|
+
} from "@ai-sdk/harness";
|
|
6
|
+
import {
|
|
7
|
+
createACP
|
|
8
|
+
} from "@ai-sdk/harness-acp";
|
|
9
|
+
import { tool } from "@ai-sdk/provider-utils";
|
|
10
|
+
import { z } from "zod/v4";
|
|
11
|
+
|
|
12
|
+
// src/version.ts
|
|
13
|
+
var VERSION = true ? "1.0.0" : "0.0.0-test";
|
|
14
|
+
|
|
15
|
+
// src/grok-build-harness.ts
|
|
16
|
+
var GROK_BUILD_CLIENT_APP = `ai-sdk/harness-grok-build/${VERSION}`;
|
|
17
|
+
var GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON = readFileSync(
|
|
18
|
+
new URL("./bridge/package.json", import.meta.url),
|
|
19
|
+
"utf8"
|
|
20
|
+
);
|
|
21
|
+
var GROK_BUILD_IMPLEMENTATION_PNPM_LOCK = readFileSync(
|
|
22
|
+
new URL("./bridge/pnpm-lock.yaml", import.meta.url),
|
|
23
|
+
"utf8"
|
|
24
|
+
);
|
|
25
|
+
var GROK_BUILD_BUILTIN_TOOLS = {
|
|
26
|
+
bash: commonTool("bash", {
|
|
27
|
+
nativeName: "run_terminal_command",
|
|
28
|
+
toolUseKind: "bash",
|
|
29
|
+
inputSchema: z.looseObject({
|
|
30
|
+
command: z.string(),
|
|
31
|
+
timeout: z.number().int().min(0).max(36e6).nullable().optional(),
|
|
32
|
+
description: z.string().optional(),
|
|
33
|
+
background: z.boolean().optional()
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
edit: commonTool("edit", {
|
|
37
|
+
nativeName: "search_replace",
|
|
38
|
+
toolUseKind: "edit",
|
|
39
|
+
inputSchema: z.looseObject({
|
|
40
|
+
file_path: z.string(),
|
|
41
|
+
old_string: z.string(),
|
|
42
|
+
new_string: z.string(),
|
|
43
|
+
replace_all: z.boolean().optional()
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
grep: commonTool("grep", {
|
|
47
|
+
nativeName: "grep",
|
|
48
|
+
toolUseKind: "readonly",
|
|
49
|
+
inputSchema: z.looseObject({
|
|
50
|
+
pattern: z.string(),
|
|
51
|
+
path: z.string().nullable().optional(),
|
|
52
|
+
glob: z.string().nullable().optional(),
|
|
53
|
+
"-B": z.number().int().optional(),
|
|
54
|
+
"-A": z.number().int().optional(),
|
|
55
|
+
"-C": z.number().int().optional(),
|
|
56
|
+
"-i": z.boolean().optional(),
|
|
57
|
+
type: z.string().nullable().optional(),
|
|
58
|
+
head_limit: z.number().int().optional(),
|
|
59
|
+
multiline: z.boolean().optional()
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
webSearch: commonTool("webSearch", {
|
|
63
|
+
nativeName: "web_search",
|
|
64
|
+
toolUseKind: "readonly",
|
|
65
|
+
inputSchema: z.looseObject({
|
|
66
|
+
query: z.string(),
|
|
67
|
+
allowed_domains: z.array(z.string()).nullable().optional()
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
write: commonTool("write", {
|
|
71
|
+
nativeName: "write",
|
|
72
|
+
toolUseKind: "edit",
|
|
73
|
+
inputSchema: z.looseObject({
|
|
74
|
+
file_path: z.string(),
|
|
75
|
+
content: z.string()
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
read_file: {
|
|
79
|
+
...tool({
|
|
80
|
+
inputSchema: z.looseObject({
|
|
81
|
+
target_file: z.string(),
|
|
82
|
+
offset: z.number().int().optional(),
|
|
83
|
+
limit: z.number().int().optional(),
|
|
84
|
+
pages: z.string().nullable().optional(),
|
|
85
|
+
format: z.string().nullable().optional()
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
88
|
+
toolUseKind: "readonly"
|
|
89
|
+
},
|
|
90
|
+
list_dir: {
|
|
91
|
+
...tool({
|
|
92
|
+
inputSchema: z.looseObject({
|
|
93
|
+
target_directory: z.string()
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
toolUseKind: "readonly"
|
|
97
|
+
},
|
|
98
|
+
kill_command_or_subagent: tool({
|
|
99
|
+
inputSchema: z.looseObject({
|
|
100
|
+
task_id: z.string()
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
todo_write: tool({
|
|
104
|
+
inputSchema: z.looseObject({
|
|
105
|
+
merge: z.boolean().optional(),
|
|
106
|
+
todos: z.array(
|
|
107
|
+
z.looseObject({
|
|
108
|
+
id: z.string(),
|
|
109
|
+
content: z.string().nullable().optional(),
|
|
110
|
+
status: z.enum(["pending", "in_progress", "completed", "cancelled"]).nullable().optional()
|
|
111
|
+
})
|
|
112
|
+
)
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
get_command_or_subagent_output: {
|
|
116
|
+
...tool({
|
|
117
|
+
inputSchema: z.looseObject({
|
|
118
|
+
task_ids: z.array(z.string()).optional(),
|
|
119
|
+
timeout_ms: z.number().int().nonnegative().nullable().optional()
|
|
120
|
+
})
|
|
121
|
+
}),
|
|
122
|
+
toolUseKind: "readonly"
|
|
123
|
+
},
|
|
124
|
+
spawn_subagent: tool({
|
|
125
|
+
inputSchema: z.looseObject({
|
|
126
|
+
prompt: z.string(),
|
|
127
|
+
description: z.string(),
|
|
128
|
+
subagent_type: z.string().optional(),
|
|
129
|
+
background: z.boolean().optional(),
|
|
130
|
+
capability_mode: z.enum(["read-only", "read-write", "execute", "all"]).nullable().optional(),
|
|
131
|
+
isolation: z.enum(["none", "worktree"]).nullable().optional(),
|
|
132
|
+
resume_from: z.string().nullable().optional(),
|
|
133
|
+
cwd: z.string().nullable().optional(),
|
|
134
|
+
model: z.string().nullable().optional()
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
scheduler_create: tool({
|
|
138
|
+
inputSchema: z.looseObject({
|
|
139
|
+
task_id: z.string().nullable().optional(),
|
|
140
|
+
interval: z.string().nullable().optional(),
|
|
141
|
+
prompt: z.string().nullable().optional(),
|
|
142
|
+
durable: z.boolean().nullable().optional(),
|
|
143
|
+
foreground: z.boolean().nullable().optional(),
|
|
144
|
+
fire_immediately: z.boolean().optional()
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
147
|
+
scheduler_delete: tool({
|
|
148
|
+
inputSchema: z.looseObject({ id: z.string() })
|
|
149
|
+
}),
|
|
150
|
+
scheduler_list: {
|
|
151
|
+
...tool({ inputSchema: z.looseObject({}) }),
|
|
152
|
+
toolUseKind: "readonly"
|
|
153
|
+
},
|
|
154
|
+
monitor: tool({
|
|
155
|
+
inputSchema: z.looseObject({
|
|
156
|
+
command: z.string(),
|
|
157
|
+
description: z.string(),
|
|
158
|
+
timeout_ms: z.number().int().nonnegative().nullable().optional(),
|
|
159
|
+
persistent: z.boolean().optional()
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
search_tool: {
|
|
163
|
+
...tool({
|
|
164
|
+
inputSchema: z.looseObject({
|
|
165
|
+
query: z.string(),
|
|
166
|
+
limit: z.number().int().min(0).max(255).nullable().optional()
|
|
167
|
+
})
|
|
168
|
+
}),
|
|
169
|
+
toolUseKind: "readonly"
|
|
170
|
+
},
|
|
171
|
+
use_tool: tool({
|
|
172
|
+
inputSchema: z.looseObject({
|
|
173
|
+
tool_name: z.string(),
|
|
174
|
+
tool_input: z.looseObject({})
|
|
175
|
+
})
|
|
176
|
+
}),
|
|
177
|
+
workflow: tool({
|
|
178
|
+
inputSchema: z.looseObject({
|
|
179
|
+
agent_budget: z.number().int().min(1).max(1024).nullable().optional(),
|
|
180
|
+
name: z.string().nullable().optional(),
|
|
181
|
+
script: z.string().nullable().optional(),
|
|
182
|
+
script_path: z.string().nullable().optional(),
|
|
183
|
+
args: z.unknown().optional(),
|
|
184
|
+
resume_from_run_id: z.string().nullable().optional(),
|
|
185
|
+
validate_only: z.boolean().optional()
|
|
186
|
+
})
|
|
187
|
+
}),
|
|
188
|
+
enter_plan_mode: tool({ inputSchema: z.looseObject({}) }),
|
|
189
|
+
exit_plan_mode: tool({ inputSchema: z.looseObject({}) }),
|
|
190
|
+
ask_user_question: tool({
|
|
191
|
+
inputSchema: z.looseObject({
|
|
192
|
+
questions: z.array(
|
|
193
|
+
z.looseObject({
|
|
194
|
+
question: z.string(),
|
|
195
|
+
options: z.array(
|
|
196
|
+
z.looseObject({
|
|
197
|
+
label: z.string(),
|
|
198
|
+
description: z.string(),
|
|
199
|
+
preview: z.string().nullable().optional()
|
|
200
|
+
})
|
|
201
|
+
),
|
|
202
|
+
multi_select: z.boolean().nullable().optional()
|
|
203
|
+
})
|
|
204
|
+
)
|
|
205
|
+
})
|
|
206
|
+
}),
|
|
207
|
+
image_gen: tool({
|
|
208
|
+
inputSchema: z.looseObject({
|
|
209
|
+
prompt: z.string(),
|
|
210
|
+
aspect_ratio: z.string().optional()
|
|
211
|
+
})
|
|
212
|
+
}),
|
|
213
|
+
image_edit: tool({
|
|
214
|
+
inputSchema: z.looseObject({
|
|
215
|
+
prompt: z.string(),
|
|
216
|
+
image: z.array(z.string()),
|
|
217
|
+
aspect_ratio: z.string().optional()
|
|
218
|
+
})
|
|
219
|
+
}),
|
|
220
|
+
image_to_video: tool({
|
|
221
|
+
inputSchema: z.looseObject({
|
|
222
|
+
prompt: z.string().nullable().optional(),
|
|
223
|
+
image: z.string(),
|
|
224
|
+
duration: z.number().int().nonnegative().nullable().optional(),
|
|
225
|
+
resolution_name: z.string().optional()
|
|
226
|
+
})
|
|
227
|
+
}),
|
|
228
|
+
reference_to_video: tool({
|
|
229
|
+
inputSchema: z.looseObject({
|
|
230
|
+
prompt: z.string(),
|
|
231
|
+
images: z.array(z.string()),
|
|
232
|
+
aspect_ratio: z.string(),
|
|
233
|
+
duration: z.number().int().nonnegative().nullable().optional(),
|
|
234
|
+
resolution_name: z.string().optional()
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
};
|
|
238
|
+
function createGrokBuild(settings = {}) {
|
|
239
|
+
const clientAppSegments = GROK_BUILD_CLIENT_APP.split("/");
|
|
240
|
+
const clientAppVersion = clientAppSegments.pop();
|
|
241
|
+
return createACP({
|
|
242
|
+
auth: settings.auth,
|
|
243
|
+
modelId: settings.model,
|
|
244
|
+
port: settings.port,
|
|
245
|
+
startupTimeoutMs: settings.startupTimeoutMs,
|
|
246
|
+
version: "v1",
|
|
247
|
+
harnessId: "grok-build",
|
|
248
|
+
builtinTools: GROK_BUILD_BUILTIN_TOOLS,
|
|
249
|
+
clientApp: {
|
|
250
|
+
name: clientAppSegments.join("/"),
|
|
251
|
+
version: clientAppVersion
|
|
252
|
+
},
|
|
253
|
+
source: {
|
|
254
|
+
type: "npm-locked",
|
|
255
|
+
packageJson: GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON,
|
|
256
|
+
pnpmLockYaml: GROK_BUILD_IMPLEMENTATION_PNPM_LOCK
|
|
257
|
+
},
|
|
258
|
+
executable: "grok",
|
|
259
|
+
args: ["agent", "stdio"],
|
|
260
|
+
forwardEnv: ["XAI_API_KEY"],
|
|
261
|
+
providerAuthentication: {
|
|
262
|
+
gateway: {
|
|
263
|
+
env: {
|
|
264
|
+
GROK_CLIENT_NAME: { $source: "client-app-name" },
|
|
265
|
+
GROK_CLIENT_VERSION: { $source: "client-app-version" },
|
|
266
|
+
XAI_API_KEY: { $source: "gateway-api-key" },
|
|
267
|
+
GROK_XAI_API_BASE_URL: {
|
|
268
|
+
$source: "gateway-base-url",
|
|
269
|
+
ensureSuffix: "/v1"
|
|
270
|
+
},
|
|
271
|
+
GROK_MODELS_BASE_URL: {
|
|
272
|
+
$source: "gateway-base-url",
|
|
273
|
+
ensureSuffix: "/v1"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/index.ts
|
|
282
|
+
var grokBuild = createGrokBuild();
|
|
283
|
+
export {
|
|
284
|
+
VERSION,
|
|
285
|
+
createGrokBuild,
|
|
286
|
+
grokBuild
|
|
287
|
+
};
|
|
288
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/grok-build-harness.ts","../src/version.ts","../src/index.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport {\n commonTool,\n type HarnessV1,\n type HarnessV1BuiltinTool,\n} from '@ai-sdk/harness';\nimport {\n createACP,\n type ACPProviderAuthenticationMode,\n} from '@ai-sdk/harness-acp';\nimport { tool } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { VERSION } from './version';\n\nconst GROK_BUILD_CLIENT_APP = `ai-sdk/harness-grok-build/${VERSION}`;\nconst GROK_BUILD_IMPLEMENTATION_PACKAGE_JSON = readFileSync(\n new URL('./bridge/package.json', import.meta.url),\n 'utf8',\n);\nconst GROK_BUILD_IMPLEMENTATION_PNPM_LOCK = readFileSync(\n new URL('./bridge/pnpm-lock.yaml', import.meta.url),\n 'utf8',\n);\n\nexport type GrokBuildHarnessSettings = {\n /**\n * Selects direct xAI or AI Gateway authentication. Defaults to automatic\n * environment-based selection.\n */\n readonly auth?: ACPProviderAuthenticationMode;\n /**\n * Grok model id selected through ACP. Unset preserves Grok Build's default.\n */\n readonly model?: string;\n /**\n * Overrides the sandbox port used by the ACP bridge.\n */\n readonly port?: number;\n /**\n * Maximum milliseconds to wait for the ACP bridge to start.\n */\n readonly startupTimeoutMs?: number;\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\n return createACP({\n auth: settings.auth,\n modelId: settings.model,\n port: settings.port,\n startupTimeoutMs: settings.startupTimeoutMs,\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 },\n executable: 'grok',\n args: ['agent', 'stdio'],\n forwardEnv: ['XAI_API_KEY'],\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","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 { GrokBuildHarnessSettings } from './grok-build-harness';\nexport { VERSION } from './version';\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,YAAY;AACrB,SAAS,SAAS;;;ACVX,IAAM,UACX,OACI,UACA;;;ADUN,IAAM,wBAAwB,6BAA6B,OAAO;AAClE,IAAM,yCAAyC;AAAA,EAC7C,IAAI,IAAI,yBAAyB,YAAY,GAAG;AAAA,EAChD;AACF;AACA,IAAM,sCAAsC;AAAA,EAC1C,IAAI,IAAI,2BAA2B,YAAY,GAAG;AAAA,EAClD;AACF;AA2BA,IAAM,2BAA2B;AAAA,EAC/B,MAAM,WAAW,QAAQ;AAAA,IACvB,YAAY;AAAA,I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MAAM,CAAC,SAAS,OAAO;AAAA,IACvB,YAAY,CAAC,aAAa;AAAA,IAC1B,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;;;AEpTO,IAAM,YAAY,gBAAgB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,23 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/harness-grok-build",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "AI SDK harness adapter for Grok Build",
|
|
5
|
-
"license": "Apache-2.0",
|
|
3
|
+
"version": "1.0.0",
|
|
6
4
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"source": "./src/index.ts",
|
|
11
10
|
"files": [
|
|
12
|
-
"
|
|
11
|
+
"dist/**/*",
|
|
12
|
+
"src",
|
|
13
|
+
"!src/**/*.test.ts",
|
|
14
|
+
"!src/**/*.test-d.ts",
|
|
15
|
+
"!src/**/__snapshots__",
|
|
16
|
+
"!src/**/__fixtures__",
|
|
17
|
+
"CHANGELOG.md",
|
|
13
18
|
"README.md"
|
|
14
19
|
],
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@ai-sdk/harness": "1.0.64",
|
|
30
|
+
"@ai-sdk/harness-acp": "1.0.1",
|
|
31
|
+
"@ai-sdk/provider-utils": "5.0.25"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"zod": "^3.25.76 || ^4.1.8"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@xai-official/grok": "0.2.111",
|
|
38
|
+
"@types/node": "22.19.19",
|
|
39
|
+
"tsup": "^8.5.1",
|
|
40
|
+
"typescript": "5.8.3",
|
|
41
|
+
"zod": "3.25.76",
|
|
42
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22"
|
|
46
|
+
},
|
|
15
47
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
48
|
+
"access": "public",
|
|
49
|
+
"provenance": true
|
|
17
50
|
},
|
|
51
|
+
"homepage": "https://ai-sdk.dev/docs",
|
|
18
52
|
"repository": {
|
|
19
53
|
"type": "git",
|
|
20
54
|
"url": "https://github.com/vercel/ai",
|
|
21
55
|
"directory": "packages/harness-grok-build"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/vercel/ai/issues"
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"ai",
|
|
62
|
+
"harness",
|
|
63
|
+
"acp",
|
|
64
|
+
"grok",
|
|
65
|
+
"grok-build"
|
|
66
|
+
],
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json && pnpm copy-bridge-assets",
|
|
69
|
+
"build:watch": "pnpm clean && tsup --watch",
|
|
70
|
+
"clean": "del-cli dist *.tsbuildinfo",
|
|
71
|
+
"copy-bridge-assets": "node -e \"import('node:fs/promises').then(async fs => { await fs.mkdir('dist/bridge', { recursive: true }); await fs.copyFile('src/bridge/package.json', 'dist/bridge/package.json'); await fs.copyFile('src/bridge/pnpm-lock.yaml', 'dist/bridge/pnpm-lock.yaml'); })\"",
|
|
72
|
+
"type-check": "tsc --build",
|
|
73
|
+
"test": "pnpm test:node",
|
|
74
|
+
"test:watch": "vitest --config vitest.node.config.js",
|
|
75
|
+
"test:node": "vitest --config vitest.node.config.js --run"
|
|
22
76
|
}
|
|
23
|
-
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "harness-grok-build-bridge",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@agentclientprotocol/sdk": "1.2.1",
|
|
8
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
9
|
+
"@xai-official/grok": "0.2.111",
|
|
10
|
+
"ws": "8.21.0",
|
|
11
|
+
"zod": "4.4.3"
|
|
12
|
+
}
|
|
13
|
+
}
|