@claudexor/harness-grok 0.0.0-stage → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +189 -2
- package/dist/access.d.ts +5 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +39 -0
- package/dist/access.js.map +1 -0
- package/dist/bin.d.ts +4 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +27 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +321 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +26 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +94 -0
- package/dist/models.js.map +1 -0
- package/dist/parse.d.ts +17 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +221 -0
- package/dist/parse.js.map +1 -0
- package/dist/processing.d.ts +15 -0
- package/dist/processing.d.ts.map +1 -0
- package/dist/processing.js +42 -0
- package/dist/processing.js.map +1 -0
- package/dist/profile.d.ts +11 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +50 -0
- package/dist/profile.js.map +1 -0
- package/dist/prompt.d.ts +4 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +16 -0
- package/dist/prompt.js.map +1 -0
- package/dist/startup.d.ts +26 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +106 -0
- package/dist/startup.js.map +1 -0
- package/package.json +42 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anton Razzhigaev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,190 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Grok Build harness
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runs the official xAI Grok Build CLI on a grok.com subscription, without an
|
|
4
|
+
API key, as an Agent session: `ask`, `agent`, Best-of lanes and reviews. It is
|
|
5
|
+
not a raw model source. Discovery checks `CLAUDEXOR_GROK_BIN`, PATH, then
|
|
6
|
+
`~/.grok/bin/grok` (`grok.exe` on Windows). An explicit override is
|
|
7
|
+
authoritative even if missing. Claudexor does not install Grok; there is no
|
|
8
|
+
`harness install grok` recipe.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
claudexor profiles add grok work
|
|
12
|
+
claudexor profiles login grok work
|
|
13
|
+
claudexor ask "Reply with just OK" --harness grok --profile work
|
|
14
|
+
claudexor agent "Fix the typo" --harness grok --profile work --access workspace_write
|
|
15
|
+
claudexor best-of "Improve the error message" --harness codex,grok --n 2
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Accounts and login
|
|
19
|
+
|
|
20
|
+
Accounts are named profiles only. Grok has no default credential store and no
|
|
21
|
+
`auth login grok` bootstrap; host `GROK_HOME` and `~/.grok` are never read.
|
|
22
|
+
Each profile runs with `HOME`, `USERPROFILE` and `GROK_HOME=<profile>/.grok`
|
|
23
|
+
pointing at its Claudexor-owned directory, for login, model listing and runs
|
|
24
|
+
alike. That directory also holds Grok's own session history, so every thread
|
|
25
|
+
that runs on one account shares it, and attempt records name it as the HOME the
|
|
26
|
+
child actually received. Two or more enabled accounts join the ordinary pool
|
|
27
|
+
and rotate on typed rate limits; native resume stays on the same account.
|
|
28
|
+
|
|
29
|
+
`claudexor profiles login grok <id>` runs `grok login --device-auth` as a
|
|
30
|
+
managed setup job attached to that terminal, so the vendor's own output,
|
|
31
|
+
including the device code it prints, appears there. The macOS Add Account picker lists Grok Build;
|
|
32
|
+
its sign-in card shows the URL it detects in the vendor output but does not
|
|
33
|
+
capture a separately printed device code. Completing a login from the app is
|
|
34
|
+
not yet verified against a real vendor transcript; if the URL does not carry
|
|
35
|
+
the code, use the CLI command. A macOS app built before Grok support cannot
|
|
36
|
+
decode a Grok setup job: while one is active, that app's engine-update busy
|
|
37
|
+
check fails closed and reports the engine busy. Finish the login or cancel it
|
|
38
|
+
(`claudexor setup cancel <jobId>`); an app that includes Grok Build reads the
|
|
39
|
+
job.
|
|
40
|
+
|
|
41
|
+
Readiness comes only from `grok models` run in the profile's environment; the
|
|
42
|
+
private `auth.json` is never parsed. A normal exit that prints the whole line
|
|
43
|
+
`You are logged in with grok.com.` verifies the login. No `grok models`
|
|
44
|
+
transcript is recorded, logged in or out: the CLI binaries contain only the
|
|
45
|
+
prefix `You are logged in with ` and fill in the login at runtime, so that line
|
|
46
|
+
is the adapter's expectation. Another login, such as an enterprise identity
|
|
47
|
+
provider, and every other outcome (timeout, signal, cancellation, nonzero exit
|
|
48
|
+
after that line, output truncated by a lingering child, a binary that cannot
|
|
49
|
+
start, any other text) leave the account `unknown`, never a dead credential.
|
|
50
|
+
Words such as "unauthorized" can come from a proxy or backend rather than the
|
|
51
|
+
account, so no text is read as a refusal. Each run repeats the check first; an
|
|
52
|
+
unknown result ends that start with a typed retryable error before Grok runs.
|
|
53
|
+
A failed run is not read as an authentication verdict either: Grok documents
|
|
54
|
+
no authentication error code, and its guide says it refreshes credentials and
|
|
55
|
+
retries a request the server answers with 401. Error or stderr text such as
|
|
56
|
+
`401 Unauthorized`, or a code that merely contains `auth`, therefore stays an
|
|
57
|
+
ordinary failure and never marks the account unusable.
|
|
58
|
+
|
|
59
|
+
Provider keys and endpoint redirects are scrubbed from the child environment,
|
|
60
|
+
and so are the documented login selectors that would replace the profile's own
|
|
61
|
+
grok.com login (`GROK_AUTH`, `GROK_AUTH_PATH`, `GROK_DEPLOYMENT_KEY`,
|
|
62
|
+
`GROK_AUTH_PROVIDER_COMMAND`, and the `GROK_OIDC_*` and `GROK_OAUTH2_*`
|
|
63
|
+
families).
|
|
64
|
+
`GROK_DISABLE_AUTOUPDATER=1` disables vendor auto-update for version
|
|
65
|
+
discovery, login and runs, headless runs also pass `--no-auto-update`, and
|
|
66
|
+
inherited `GROK_CONFIG` and `GROK_CONFIG_PATH` overrides are removed.
|
|
67
|
+
|
|
68
|
+
## Credential source and cost
|
|
69
|
+
|
|
70
|
+
Every event carries the route Claudexor selected before spawn
|
|
71
|
+
(`vendor_native`) and the profile id. The source `native_session` is added
|
|
72
|
+
only after Grok's own startup frame reports `apiKeySource: "oauth"`. The
|
|
73
|
+
guide bundled with the CLI (1.0.46 to 1.0.70) defines `user` for API-key auth
|
|
74
|
+
and `oauth` otherwise, and the recorded 1.0.67 streams carry `oauth`. The value
|
|
75
|
+
therefore rules out an API key but does not say which identity provider issued
|
|
76
|
+
the session. A startup frame that reports any other source stops Grok before
|
|
77
|
+
further output is read and fails the attempt with the typed request refusal
|
|
78
|
+
`credential_source_unconfirmed`, which carries the reported value, also when
|
|
79
|
+
the same frame contradicts the scoped tool policy (see Access). As with
|
|
80
|
+
other request refusals, the engine then neither retries on the same account nor
|
|
81
|
+
rotates to another Grok account, because each new launch could pay before its
|
|
82
|
+
own startup frame is read; failover to another harness is unchanged. A startup
|
|
83
|
+
frame without the field is disclosed (`grok_credential_source_unreported`) and
|
|
84
|
+
the source stays unknown; it is not a refusal.
|
|
85
|
+
|
|
86
|
+
Claudexor never selects or substitutes an API key for Grok: an `api_key`
|
|
87
|
+
preference is refused, and the provider keys and login selectors above are
|
|
88
|
+
scrubbed. Grok's own configuration is outside that guarantee. The guide ranks a
|
|
89
|
+
per-model `api_key` or `env_key` above the session token when it appears in
|
|
90
|
+
the user, managed or requirements configuration, and the system-wide copies of
|
|
91
|
+
those layers live outside the profile. Grok also picks the default model
|
|
92
|
+
itself. Claudexor does not read, check or rewrite that configuration, and Grok
|
|
93
|
+
emits its startup frame only with its first output. A model keyed there can
|
|
94
|
+
therefore send a paid request before the check above stops it; nothing
|
|
95
|
+
guarantees before dispatch that a run uses the grok.com session.
|
|
96
|
+
|
|
97
|
+
Work on a grok.com login is included in the subscription's shared weekly
|
|
98
|
+
allowance, but the same pool can continue on Extra Usage Credits or Auto Top
|
|
99
|
+
Up, and no Grok output reports that debit. Runs therefore carry an included
|
|
100
|
+
cost basis with an unobserved debit, as Codex subscription work does: reported
|
|
101
|
+
cash is unknown, never an exact zero. A finite budget cap governs only the cash
|
|
102
|
+
Claudexor controls and meters; it sets no limit on credits or top-ups Grok may
|
|
103
|
+
draw, or on a request that Grok's own configuration sends with an API key,
|
|
104
|
+
because neither debit is observed. The vendor's `total_cost_usd` is
|
|
105
|
+
not interpreted as cash or as a valuation. Grok has no processing tiers; a
|
|
106
|
+
processing preference is reported unavailable.
|
|
107
|
+
|
|
108
|
+
## Models, effort and protocol
|
|
109
|
+
|
|
110
|
+
Account model lists come from `grok models` on that account and appear in the
|
|
111
|
+
account-scoped catalog. `claudexor models --harness grok`, with or without
|
|
112
|
+
`--route local_session`, names no account, so it prints `no account selected`
|
|
113
|
+
rather than an empty live list. Inventory absence is
|
|
114
|
+
advisory: an explicit model id is forwarded unchanged with a disclosure.
|
|
115
|
+
|
|
116
|
+
Recorded effort levels are `low`, `medium`, `high` and `xhigh` (snapshot from
|
|
117
|
+
CLI 1.0.46), sent as `--reasoning-effort`, which the help of 1.0.46, 1.0.67
|
|
118
|
+
and 1.0.70 lists with `--effort` as its alias. Preferences outside that ladder
|
|
119
|
+
are placed by the shared order: `max` and `ultra` go down to `xhigh`, `none`
|
|
120
|
+
and `minimal` up to `low`, and an unknown word is refused before spawn. The
|
|
121
|
+
1.0.70 guide also names `none`, `minimal` and `max`, accepted only by models
|
|
122
|
+
whose menu lists them; no per-model menu is read, so they are not sent. Native
|
|
123
|
+
`--max-turns`, `--json-schema`, additive `--rules` and `--resume` are
|
|
124
|
+
forwarded, and task text uses a private `--prompt-file`. Instructions keep the
|
|
125
|
+
`--rules` system channel with their exact bytes: Grok documents no file form
|
|
126
|
+
of it, and moving them into the task file would make them task text. Like the
|
|
127
|
+
`--json-schema` value, they are therefore process arguments, visible in
|
|
128
|
+
process listings and bounded by the platform's command-line limit (about 32K
|
|
129
|
+
characters on Windows); a launch over it fails to start instead of dropping
|
|
130
|
+
them. `--instructions-file` keeps them off Claudexor's own command line only.
|
|
131
|
+
|
|
132
|
+
`streaming-messages-json` supplies startup/model/session evidence, messages,
|
|
133
|
+
paired tool calls and results, successful file edits, the typed final and one
|
|
134
|
+
aggregate usage record: uncached input, cache reads and cache writes are disjoint
|
|
135
|
+
buckets whose sum is the input total, and an all-zero record, which Grok emits
|
|
136
|
+
when it cannot account for usage, is treated as unknown rather than free. Thinking signatures are
|
|
137
|
+
discarded. A top-level error frame fails the turn; a result that still follows
|
|
138
|
+
contributes its usage once and never an answer. Vendor and stderr quota
|
|
139
|
+
failures become typed `rate_limit` signals, stored as `grok_rate_limit`
|
|
140
|
+
cooldowns for routing and rotation; remaining allowance stays unknown.
|
|
141
|
+
|
|
142
|
+
## Access
|
|
143
|
+
|
|
144
|
+
| Access | Policy |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `readonly` | Read/list/grep only; writes, shell, MCP meta-tools and subagents disabled. |
|
|
147
|
+
| `workspace_write` | Read tools plus `search_replace`/`write`; `dontAsk` with explicit Edit/Write rules for the canonical working directory, refused when that path contains a glob character or a comma (a comma splits one rule value and has no documented escape); shell, MCP meta-tools and subagents disabled. |
|
|
148
|
+
| `full` | `--always-approve` with the vendor's full toolset; selected explicitly, never substituted for a scoped request. |
|
|
149
|
+
| `inherit_native` | Vendor permission defaults. |
|
|
150
|
+
|
|
151
|
+
A run whose web policy is `off` passes `--disable-web-search` and sets
|
|
152
|
+
`GROK_WEB_FETCH=0`, so an inherited `GROK_WEB_FETCH=1` cannot re-enable
|
|
153
|
+
`web_fetch` under `full`; the access mode itself is unchanged. Whether the
|
|
154
|
+
switch also outranks `[features] web_fetch = true` in a profile config is not
|
|
155
|
+
documented.
|
|
156
|
+
|
|
157
|
+
These are native tool policies, not an OS sandbox, and scoped modes cannot run
|
|
158
|
+
builds or tests. A scoped run stops if Grok's startup frame reports other tools
|
|
159
|
+
or another permission mode. With session login confirmed or the source
|
|
160
|
+
unreported, that stop is not a request refusal: the engine's ordinary, bounded
|
|
161
|
+
handling of a failure before progress applies (a same-account retry or a
|
|
162
|
+
rotation through the pool, each launch checked again), because the cause can
|
|
163
|
+
be one account's own profile configuration. A non-session source in the same
|
|
164
|
+
frame takes precedence and stops without retry or rotation. A run without that
|
|
165
|
+
frame is disclosed, not treated as confirmed. Vendor hooks and project
|
|
166
|
+
permission configuration remain vendor-owned and may add rules; use trusted
|
|
167
|
+
project configuration. Auxiliary writable roots, engine MCP injection, live
|
|
168
|
+
input, WorkReport transport, cross-account session moves and native-store
|
|
169
|
+
pruning are unsupported.
|
|
170
|
+
|
|
171
|
+
A `.grok/` directory holds Grok's configuration, login and sessions, so
|
|
172
|
+
Claudexor treats it as a credential store wherever it appears, as it treats
|
|
173
|
+
`.claude/`: context never includes it, and a directory run never copies or
|
|
174
|
+
publishes it. A copied directory run whose selected scope contains it (for
|
|
175
|
+
example `--scope-path .` over a folder with a project `.grok/`) is refused
|
|
176
|
+
before it starts; a writable in-place run over such a scope ends without a
|
|
177
|
+
published result, while its direct edits stay in place. Select the inputs with
|
|
178
|
+
repeated `--scope-path` values that leave `.grok/` out. Git-backed runs are not
|
|
179
|
+
affected.
|
|
180
|
+
|
|
181
|
+
## Qualification
|
|
182
|
+
|
|
183
|
+
The recorded fixtures and the contributor's live checks came from Windows 11
|
|
184
|
+
with Grok CLI 1.0.67. macOS and Linux behaviour (permission-rule paths,
|
|
185
|
+
symlinks, cwd canonicalization), multi-account isolation, managed login from
|
|
186
|
+
the app and cancellation have not been run live against the vendor.
|
|
187
|
+
|
|
188
|
+
Offline tests: `pnpm exec vitest run packages/harness-grok/src`.
|
|
189
|
+
Fixture provenance: `fixtures/manifest.yaml`.
|
|
190
|
+
Official documentation: <https://docs.x.ai/build/overview>.
|
package/dist/access.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HarnessRunSpec } from "@claudexor/schema";
|
|
2
|
+
/** Tool policy is portable to Windows, where the vendor OS sandbox has no
|
|
3
|
+
* enforcement. Shell, MCP meta-tools, and native subagents cannot escape it. */
|
|
4
|
+
export declare function grokAccessArgs(spec: Pick<HarnessRunSpec, "access" | "cwd" | "auxiliary_writable_roots">): string[];
|
|
5
|
+
//# sourceMappingURL=access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;gFACgF;AAChF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,KAAK,GAAG,0BAA0B,CAAC,GACxE,MAAM,EAAE,CAgCV"}
|
package/dist/access.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { AccessProfileIncompatibleError } from "@claudexor/core";
|
|
3
|
+
/** Tool policy is portable to Windows, where the vendor OS sandbox has no
|
|
4
|
+
* enforcement. Shell, MCP meta-tools, and native subagents cannot escape it. */
|
|
5
|
+
export function grokAccessArgs(spec) {
|
|
6
|
+
if (spec.auxiliary_writable_roots.length)
|
|
7
|
+
throw new AccessProfileIncompatibleError("Grok does not support auxiliary writable roots");
|
|
8
|
+
if (spec.access === "full")
|
|
9
|
+
return ["--always-approve"];
|
|
10
|
+
if (spec.access === "inherit_native")
|
|
11
|
+
return [];
|
|
12
|
+
const tools = ["read_file", "list_dir", "grep"];
|
|
13
|
+
const args = [
|
|
14
|
+
"--no-subagents",
|
|
15
|
+
"--disallowed-tools",
|
|
16
|
+
"search_tool,use_tool",
|
|
17
|
+
"--permission-mode",
|
|
18
|
+
"dontAsk",
|
|
19
|
+
"--deny",
|
|
20
|
+
"Bash",
|
|
21
|
+
"--deny",
|
|
22
|
+
"MCPTool",
|
|
23
|
+
];
|
|
24
|
+
if (spec.access === "workspace_write") {
|
|
25
|
+
const root = realpathSync(spec.cwd).replace(/\\/g, "/").replace(/\/$/, "");
|
|
26
|
+
// Glob-bearing roots cannot be represented by a literal permission rule,
|
|
27
|
+
// and a comma splits one `--allow` value into several rules (vendor guide);
|
|
28
|
+
// no escape for it is documented.
|
|
29
|
+
if (/[\[\]*?(),]/.test(root))
|
|
30
|
+
throw new AccessProfileIncompatibleError("Grok workspace path contains permission-rule metacharacters");
|
|
31
|
+
tools.push("search_replace", "write");
|
|
32
|
+
args.push("--allow", `Edit(${root}/**)`, "--allow", `Write(${root}/**)`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
args.push("--deny", "Edit", "--deny", "Write");
|
|
36
|
+
}
|
|
37
|
+
return [...args, "--tools", tools.join(",")];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAGjE;gFACgF;AAChF,MAAM,UAAU,cAAc,CAC5B,IAAyE;IAEzE,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM;QACtC,MAAM,IAAI,8BAA8B,CAAC,gDAAgD,CAAC,CAAC;IAC7F,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxD,IAAI,IAAI,CAAC,MAAM,KAAK,gBAAgB;QAAE,OAAO,EAAE,CAAC;IAChD,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG;QACX,gBAAgB;QAChB,oBAAoB;QACpB,sBAAsB;QACtB,mBAAmB;QACnB,SAAS;QACT,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,SAAS;KACV,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,KAAK,iBAAiB,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3E,yEAAyE;QACzE,4EAA4E;QAC5E,kCAAkC;QAClC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC1B,MAAM,IAAI,8BAA8B,CACtC,6DAA6D,CAC9D,CAAC;QACJ,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,MAAM,CAAC,CAAC;IAC3E,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** An explicit override is authoritative, including an unavailable path. */
|
|
2
|
+
export declare function resolveGrokBin(env?: NodeJS.ProcessEnv, resolve?: (bin: string) => string | null): string;
|
|
3
|
+
export declare function detectGrokVersion(): Promise<string | null>;
|
|
4
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAIA,4EAA4E;AAC5E,wBAAgB,cAAc,CAC5B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,OAAO,GAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAA8C,GAChF,MAAM,CAWR;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWhE"}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { resolveHarnessBinary, runCapture } from "@claudexor/core";
|
|
4
|
+
/** An explicit override is authoritative, including an unavailable path. */
|
|
5
|
+
export function resolveGrokBin(env = process.env, resolve = (bin) => resolveHarnessBinary(bin, env)) {
|
|
6
|
+
if (env.CLAUDEXOR_GROK_BIN)
|
|
7
|
+
return env.CLAUDEXOR_GROK_BIN;
|
|
8
|
+
const onPath = resolve("grok");
|
|
9
|
+
if (onPath)
|
|
10
|
+
return onPath;
|
|
11
|
+
const installed = join(homedir(), ".grok", "bin", process.platform === "win32" ? "grok.exe" : "grok");
|
|
12
|
+
return resolve(installed) ?? "grok";
|
|
13
|
+
}
|
|
14
|
+
export async function detectGrokVersion() {
|
|
15
|
+
try {
|
|
16
|
+
// The vendor updater switch login and runs already set.
|
|
17
|
+
const result = await runCapture(resolveGrokBin(), ["--version"], {
|
|
18
|
+
timeoutMs: 10_000,
|
|
19
|
+
env: { GROK_DISABLE_AUTOUPDATER: "1" },
|
|
20
|
+
});
|
|
21
|
+
return result.stdout.match(/\b\d+\.\d+\.\d+(?:[-+][\w.-]+)?\b/)?.[0] ?? null;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,4EAA4E;AAC5E,MAAM,UAAU,cAAc,CAC5B,GAAG,GAAsB,OAAO,CAAC,GAAG,EACpC,OAAO,GAAmC,CAAC,GAAG,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC;IAEjF,IAAI,GAAG,CAAC,kBAAkB;QAAE,OAAO,GAAG,CAAC,kBAAkB,CAAC;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,SAAS,GAAG,IAAI,CACpB,OAAO,EAAE,EACT,OAAO,EACP,KAAK,EACL,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CACnD,CAAC;IACF,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,wDAAwD;QACxD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE;YAC/D,SAAS,EAAE,MAAM;YACjB,GAAG,EAAE,EAAE,wBAAwB,EAAE,GAAG,EAAE;SACvC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { HarnessAdapter } from "@claudexor/core";
|
|
2
|
+
import { runCliHarness } from "@claudexor/core";
|
|
3
|
+
import { detectGrokVersion } from "./bin.js";
|
|
4
|
+
import { probeGrokLogin } from "./models.js";
|
|
5
|
+
export { resolveGrokBin } from "./bin.js";
|
|
6
|
+
export { canonicalGrokProfileHome, grokProfileEnv } from "./profile.js";
|
|
7
|
+
export declare const GROK_MANAGED_LOGIN: {
|
|
8
|
+
readonly stdin: "none";
|
|
9
|
+
};
|
|
10
|
+
export declare const GROK_CAPABILITY_PROFILE: {
|
|
11
|
+
auth: {
|
|
12
|
+
supported_sources: ("api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file")[];
|
|
13
|
+
preferred_source: "api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file" | null;
|
|
14
|
+
credential_transports: {
|
|
15
|
+
source: "api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file";
|
|
16
|
+
kind: "config_file" | "env_var" | "http_header" | "none" | "oauth_token_env" | "os_keychain";
|
|
17
|
+
relocatable_by: ("CONFIG_DIR" | "ENV" | "HOME" | "none")[];
|
|
18
|
+
platforms?: ("darwin" | "linux" | "win32")[] | undefined;
|
|
19
|
+
}[];
|
|
20
|
+
credential_profile_policies?: {
|
|
21
|
+
source: "api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file";
|
|
22
|
+
platforms: ("darwin" | "linux" | "win32")[];
|
|
23
|
+
identity_scope: "os_user" | "profile";
|
|
24
|
+
max_enabled_profiles: number | null;
|
|
25
|
+
cleanup_owner: "claudexor" | "vendor";
|
|
26
|
+
}[] | undefined;
|
|
27
|
+
managed_login?: {
|
|
28
|
+
stdin: "none" | "pipe" | "terminal";
|
|
29
|
+
} | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
access_control: {
|
|
32
|
+
readonly_mechanism: "fs_sandbox" | "none" | "permission_deny" | "tool_allowlist";
|
|
33
|
+
write_mechanism: "fs_sandbox" | "none" | "tool_policy";
|
|
34
|
+
auxiliary_writable_roots: boolean;
|
|
35
|
+
};
|
|
36
|
+
isolation: {
|
|
37
|
+
supported_containment: ("container" | "env_or_file_injection" | "host_user_context" | "private_per_profile_keychain" | "process_sandbox" | "scoped_home_keychain_bridge")[];
|
|
38
|
+
};
|
|
39
|
+
attachment_inputs: {
|
|
40
|
+
kind: "file" | "image";
|
|
41
|
+
mime_types: string[];
|
|
42
|
+
max_bytes: number;
|
|
43
|
+
max_count: number;
|
|
44
|
+
transport: "base64_inline" | "base64_stream" | "file_path" | "text_inline";
|
|
45
|
+
}[];
|
|
46
|
+
input_limits?: {
|
|
47
|
+
scope: "turn_text";
|
|
48
|
+
unit: "unicode_scalars";
|
|
49
|
+
limit: number;
|
|
50
|
+
source: string;
|
|
51
|
+
verified_against: string;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
mcp_injection: boolean;
|
|
54
|
+
mcp_injection_requires_full_access: boolean;
|
|
55
|
+
live_input: "mid_turn" | "next_tool_boundary" | "none";
|
|
56
|
+
prompt_cache_ttls?: ("1h" | "5m")[] | undefined;
|
|
57
|
+
};
|
|
58
|
+
declare const defaults: {
|
|
59
|
+
detectVersion: typeof detectGrokVersion;
|
|
60
|
+
probeLogin: typeof probeGrokLogin;
|
|
61
|
+
runCli: typeof runCliHarness;
|
|
62
|
+
};
|
|
63
|
+
type Runtime = typeof defaults;
|
|
64
|
+
export declare function createGrokAdapter(deps?: Partial<Runtime>): HarnessAdapter;
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAgC,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAML,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAAE,iBAAiB,EAAkB,MAAM,UAAU,CAAC;AAE7D,OAAO,EAAgB,cAAc,EAAuB,MAAM,aAAa,CAAC;AAMhF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAExE,eAAO,MAAM,kBAAkB;aAAK,KAAK,EAAE,MAAM;CAAW,CAAC;AAa7D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBlC,CAAC;AAEH,QAAA,MAAM,QAAQ;IACZ,aAAa;IACb,UAAU;IACV,MAAM;CACP,CAAC;AACF,KAAK,OAAO,GAAG,OAAO,QAAQ,CAAC;AAwG/B,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,OAAO,CAAC,OAAO,CAAM,GAAG,cAAc,CAmF7E"}
|