@ycodium-ai/agent-grok 0.2.2167 → 0.2.2488
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/README.md +14 -4
- package/dist/index.js +135 -86
- package/locales/en.json +14 -0
- package/locales/zh-CN.json +14 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @ycodium-ai/agent-grok
|
|
2
2
|
|
|
3
3
|
Grok executor plugin. Spawns `grok agent stdio` over stdio and runs
|
|
4
|
-
`ycodium-acp-executor`
|
|
4
|
+
the shared `ycodium-acp-executor` state machine, with the Grok-specific
|
|
5
5
|
semantics that used to live in the host Grok adapter:
|
|
6
6
|
|
|
7
7
|
- `_x.ai/ask_user_question` (and its `x.ai/ask_user_question` alias) is surfaced as
|
|
@@ -34,9 +34,19 @@ Facts:
|
|
|
34
34
|
credential reads use the home the subprocess actually sees. An empty
|
|
35
35
|
account directory means the CLI default `~/.grok` is used without injection.
|
|
36
36
|
- Manifest permission is `{ kind: "executor" }`.
|
|
37
|
-
- Native in-session model switching is `unsupported` on the card.
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
- Native in-session model switching is `unsupported` on the card.
|
|
38
|
+
- Model connection is the instance's own: either `grok login --device-auth`, or
|
|
39
|
+
`GROK_MODELS_BASE_URL` plus `XAI_API_KEY` in the instance environment. A signed-out
|
|
40
|
+
instance still probes `ready` (auth reports `unauthenticated`) because the second
|
|
41
|
+
form needs no login.
|
|
42
|
+
- Credential order warning: setting `GROK_MODELS_BASE_URL` does not switch the CLI to
|
|
43
|
+
API-key auth. Grok resolves `api_key` → `env_key` → the signed-in session token →
|
|
44
|
+
`XAI_API_KEY`, so a signed-in instance would send its x.ai session token to the custom
|
|
45
|
+
base URL. When the instance environment sets `GROK_MODELS_BASE_URL`, the plugin
|
|
46
|
+
therefore spawns the CLI with `GROK_AUTH_PATH` pointing at a fresh path that does not
|
|
47
|
+
exist (the card's `extraEnv` `$absentPath` entry), unless the instance sets
|
|
48
|
+
`GROK_AUTH_PATH` itself. The login file in the account directory is left untouched.
|
|
49
|
+
Settings also gives a new instance that sets these variables its own account directory.
|
|
40
50
|
|
|
41
51
|
Develop with `vp run --filter @ycodium-ai/agent-grok typecheck`, `build`, and `test`.
|
|
42
52
|
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var GROK_CARD = {
|
|
|
15
15
|
displayName: "Grok",
|
|
16
16
|
iconUrl: "./assets/icon.svg",
|
|
17
17
|
commandName: "grok",
|
|
18
|
-
// 启动命令是 `grok agent stdio
|
|
18
|
+
// 启动命令是 `grok agent stdio`(磁盘上的设置形状没有 launchArgs 字段,
|
|
19
19
|
// 宿主旧实现把它写死在 buildGrokAcpSpawnInput,这里落在名片上)。两个动态旗标
|
|
20
20
|
// 都不走名片这一栏,而且**位置不同**:思考档位 `--reasoning-effort` 是 agent 级、
|
|
21
21
|
// 插在 agent 与 stdio 之间;运行模式 `--permission-mode` 是顶层、排在 `agent`
|
|
@@ -24,7 +24,7 @@ var GROK_CARD = {
|
|
|
24
24
|
launchArgs: "agent stdio",
|
|
25
25
|
homeEnvVar: "GROK_HOME",
|
|
26
26
|
// 只有这一条是实话:实测这个 CLI 从不播报 api key 认证方式,点名 XAI_API_KEY
|
|
27
|
-
//
|
|
27
|
+
// 是把用户指向死路。
|
|
28
28
|
environment: [],
|
|
29
29
|
install: {
|
|
30
30
|
kind: "vendorScript",
|
|
@@ -48,16 +48,12 @@ var GROK_CARD = {
|
|
|
48
48
|
defaultTextGenerationModel: "",
|
|
49
49
|
customModelIdExample: "",
|
|
50
50
|
modelSlugAliases: null,
|
|
51
|
-
// models.dev 只有 `xai` 一家发 Grok。
|
|
52
|
-
modelsDevProviderIds: ["xai"],
|
|
53
|
-
modelsDevSlugPrefixed: false,
|
|
54
|
-
modelSlugPrefix: "",
|
|
55
51
|
mcpTransports: ["stdio", "http", "sse"],
|
|
56
52
|
pluginManaged: true,
|
|
57
53
|
verifiedSkills: false,
|
|
58
54
|
everydayHarness: false,
|
|
59
55
|
capabilities: {
|
|
60
|
-
//
|
|
56
|
+
// 插件不承诺原生会话内活切型号。
|
|
61
57
|
sessionModelSwitch: "unsupported",
|
|
62
58
|
// 运行模式只在 spawn 时定得了(`--permission-mode` 是启动旗标,ACP 那一侧
|
|
63
59
|
// `modes: null`,`session/set_mode` 对它无效),所以不许声称能会话中途换。
|
|
@@ -79,11 +75,29 @@ var GROK_CARD = {
|
|
|
79
75
|
}
|
|
80
76
|
],
|
|
81
77
|
diagnostics: [],
|
|
78
|
+
// 设置表单照这份画:带 x-ycodium-form 的属性才进表单(enabled、customModels 等另有入口,不在此列),
|
|
79
|
+
// 顺序看 x-ycodium-form-order;文案键在本插件 locales/<locale>.json 里解析,宿主不兜底。
|
|
82
80
|
configSchema: {
|
|
83
81
|
type: "object",
|
|
82
|
+
"x-ycodium-form-order": ["binaryPath", "homePath"],
|
|
84
83
|
properties: {
|
|
85
|
-
binaryPath: {
|
|
86
|
-
|
|
84
|
+
binaryPath: {
|
|
85
|
+
type: "string",
|
|
86
|
+
"x-ycodium-form": {
|
|
87
|
+
titleKey: "form.binaryPath.title",
|
|
88
|
+
descriptionKey: "form.binaryPath.description",
|
|
89
|
+
placeholderKey: "form.binaryPath.placeholder",
|
|
90
|
+
control: "executable-path"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
homePath: {
|
|
94
|
+
type: "string",
|
|
95
|
+
"x-ycodium-form": {
|
|
96
|
+
titleKey: "form.homePath.title",
|
|
97
|
+
descriptionKey: "form.homePath.description",
|
|
98
|
+
placeholderKey: "form.homePath.placeholder"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
87
101
|
enabled: { type: "boolean" },
|
|
88
102
|
customModels: { type: "array" },
|
|
89
103
|
driver: { type: "string" },
|
|
@@ -93,41 +107,39 @@ var GROK_CARD = {
|
|
|
93
107
|
additionalProperties: true
|
|
94
108
|
},
|
|
95
109
|
modelConnectivity: {
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// 格式的订阅全起不来。别家的脑经宿主翻译接上。它另有一笔标题请求走 `/v1/responses`,
|
|
100
|
-
// 本机端点按那一笔的路径另挑翻译对,不靠这一栏。
|
|
110
|
+
// 只报 `GROK_MODELS_BASE_URL` 下主请求说的那一种:后缀是 `/chat/completions`。CLI 换了
|
|
111
|
+
// 配置(`api_backend`)能说 messages / responses 不算。它另有一笔标题请求走
|
|
112
|
+
// `/v1/responses`,接外部服务时那个地址也得答得上。
|
|
101
113
|
dialects: ["openai-chat-completions"],
|
|
102
114
|
acceptsExternalEndpoints: true,
|
|
103
|
-
//
|
|
104
|
-
// (`grokModelProxyEgress.test.ts` 拿掉这一栏就红)。
|
|
115
|
+
// 实例上设 `GROK_MODELS_BASE_URL` 加 `XAI_API_KEY`,CLI 就改连那个服务,不必登录。
|
|
105
116
|
//
|
|
106
117
|
// **但设了 base 并不会把客户端切成 API-key 认证。** 它的凭据顺序是
|
|
107
118
|
// `api_key` → `env_key` → **已登录的 session token** → `XAI_API_KEY`
|
|
108
119
|
// (`~/.grok/docs/user-guide/11-custom-models.md` 的 "Credential Resolution")。
|
|
109
120
|
// 1.0.34 实测:账号目录里有 `auth.json` 时,启动预取 `/v1/models` 用的是
|
|
110
|
-
// `XAI_API_KEY`,而**推理请求带的是用户自己的 x.ai OIDC token
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
121
|
+
// `XAI_API_KEY`,而**推理请求带的是用户自己的 x.ai OIDC token**——登录过的实例会把
|
|
122
|
+
// x.ai 会话 token 发给那个自定义地址。所以设置页给设了这些变量的新实例单独的账号
|
|
123
|
+
// 目录,插件对设了 `GROK_MODELS_BASE_URL` 的实例另把 `GROK_AUTH_PATH` 指到不存在的
|
|
124
|
+
// 路径(见下面那栏)。
|
|
114
125
|
//
|
|
115
126
|
// 它启动时先打 `{base_url}/models` 拉模型列表(README:1953「on startup」),不给就
|
|
116
|
-
//
|
|
127
|
+
// 当端点不可用——接的服务得答 /models。
|
|
117
128
|
//
|
|
118
129
|
// base 含 /v1(它的例子是 `https://api.acme.com/v1`),后面自己加 /chat/completions。
|
|
119
130
|
nativePathSuffix: "/chat/completions",
|
|
120
131
|
baseUrlEnvKey: "GROK_MODELS_BASE_URL",
|
|
121
132
|
credentialEnvKey: "XAI_API_KEY",
|
|
122
|
-
//
|
|
123
|
-
// 前面,账号目录里有 `auth.json`
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
// `
|
|
130
|
-
//
|
|
133
|
+
// 接外部服务时不能用它自己的登录:凭据顺序里 session token 排在 `XAI_API_KEY`
|
|
134
|
+
// 前面,账号目录里有 `auth.json` 就一定发那一份。`GROK_AUTH_PATH` 是 CLI 读登录文件
|
|
135
|
+
// 的路径(1.0.34 的 argv 里与 `GROK_AUTH`、`GROK_DEPLOYMENT_KEY` 并列在同一张敏感
|
|
136
|
+
// 变量表上);指到一个必定不存在的路径,这次进程就读不到那份登录。不用空设备是因为
|
|
137
|
+
// 那是平台语义(POSIX `/dev/null` 对 Windows `NUL`),而「读不到」两边只有一种行为。
|
|
138
|
+
// 1.0.34 实测:`authMethods` 少掉 `cached_token`、两笔请求(推理与标题)都改带
|
|
139
|
+
// `XAI_API_KEY`,账号目录里那份 `auth.json` 一个字节没动,也没在别处新建文件。
|
|
140
|
+
// 宿主不注入它。插件在实例环境表设了 `GROK_MODELS_BASE_URL`、又没自己写
|
|
141
|
+
// `GROK_AUTH_PATH` 时替换 `$absentPath` 并填上(`grokInstance.ts` 的
|
|
142
|
+
// `ownEndpointAuthGuard`);没换地址的实例照旧用用户自己的登录。
|
|
131
143
|
extraEnv: [{ name: "GROK_AUTH_PATH", value: "$absentPath" }]
|
|
132
144
|
}
|
|
133
145
|
};
|
|
@@ -136,7 +148,7 @@ var GROK_CARD = {
|
|
|
136
148
|
import * as NodeCrypto2 from "node:crypto";
|
|
137
149
|
import * as NodeOS from "node:os";
|
|
138
150
|
import * as NodePath2 from "node:path";
|
|
139
|
-
import { mergeLaunchEnv
|
|
151
|
+
import { mergeLaunchEnv } from "@ycodium-ai/plugin-api/executor";
|
|
140
152
|
import { nodeStreamsFromHandle as nodeStreamsFromHandle2 } from "@ycodium-ai/plugin-api/process-stdin";
|
|
141
153
|
|
|
142
154
|
// ../../packages/ycodium-acp-executor/src/executor.ts
|
|
@@ -23527,10 +23539,44 @@ var legacyClientNotificationMethods = /* @__PURE__ */ new Set([
|
|
|
23527
23539
|
CLIENT_METHODS.elicitation_complete
|
|
23528
23540
|
]);
|
|
23529
23541
|
|
|
23530
|
-
// ../../packages/ycodium-acp-
|
|
23542
|
+
// ../../packages/ycodium-acp-executor/src/connection.ts
|
|
23531
23543
|
import * as NodeStream from "node:stream";
|
|
23532
23544
|
|
|
23533
|
-
// ../../packages/ycodium-acp-
|
|
23545
|
+
// ../../packages/ycodium-acp-executor/src/errors.ts
|
|
23546
|
+
var AcpExecutorError = class extends Error {
|
|
23547
|
+
code;
|
|
23548
|
+
constructor(code, message) {
|
|
23549
|
+
super(message);
|
|
23550
|
+
this.name = "AcpExecutorError";
|
|
23551
|
+
this.code = code;
|
|
23552
|
+
}
|
|
23553
|
+
};
|
|
23554
|
+
var AcpExecutorDisposedError = class extends AcpExecutorError {
|
|
23555
|
+
constructor(message = "ACP executor has been disposed") {
|
|
23556
|
+
super("disposed", message);
|
|
23557
|
+
this.name = "AcpExecutorDisposedError";
|
|
23558
|
+
}
|
|
23559
|
+
};
|
|
23560
|
+
var AcpExecutorNotStartedError = class extends AcpExecutorError {
|
|
23561
|
+
constructor(message = "ACP session has not been started") {
|
|
23562
|
+
super("not-started", message);
|
|
23563
|
+
this.name = "AcpExecutorNotStartedError";
|
|
23564
|
+
}
|
|
23565
|
+
};
|
|
23566
|
+
var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
|
|
23567
|
+
constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
|
|
23568
|
+
super("cancel-timeout", message);
|
|
23569
|
+
this.name = "AcpExecutorCancelTimeoutError";
|
|
23570
|
+
}
|
|
23571
|
+
};
|
|
23572
|
+
var AcpExecutorRequestError = class extends AcpExecutorError {
|
|
23573
|
+
method;
|
|
23574
|
+
constructor(method, message) {
|
|
23575
|
+
super("request-failed", message);
|
|
23576
|
+
this.name = "AcpExecutorRequestError";
|
|
23577
|
+
this.method = method;
|
|
23578
|
+
}
|
|
23579
|
+
};
|
|
23534
23580
|
var AcpConnectionClosedError = class extends Error {
|
|
23535
23581
|
constructor(message = "ACP connection closed") {
|
|
23536
23582
|
super(message);
|
|
@@ -23538,7 +23584,7 @@ var AcpConnectionClosedError = class extends Error {
|
|
|
23538
23584
|
}
|
|
23539
23585
|
};
|
|
23540
23586
|
|
|
23541
|
-
// ../../packages/ycodium-acp-
|
|
23587
|
+
// ../../packages/ycodium-acp-executor/src/jsonrpc.ts
|
|
23542
23588
|
function isRecord2(value) {
|
|
23543
23589
|
return typeof value === "object" && value !== null;
|
|
23544
23590
|
}
|
|
@@ -23576,7 +23622,7 @@ function readJsonRpcError(value) {
|
|
|
23576
23622
|
};
|
|
23577
23623
|
}
|
|
23578
23624
|
|
|
23579
|
-
// ../../packages/ycodium-acp-
|
|
23625
|
+
// ../../packages/ycodium-acp-executor/src/line-buffer.ts
|
|
23580
23626
|
var newline2 = 10;
|
|
23581
23627
|
var LineBuffer2 = class {
|
|
23582
23628
|
#pending = [];
|
|
@@ -23620,7 +23666,7 @@ var LineBuffer2 = class {
|
|
|
23620
23666
|
}
|
|
23621
23667
|
};
|
|
23622
23668
|
|
|
23623
|
-
// ../../packages/ycodium-acp-
|
|
23669
|
+
// ../../packages/ycodium-acp-executor/src/session-update.ts
|
|
23624
23670
|
var KNOWN_SESSION_UPDATES = /* @__PURE__ */ new Set([
|
|
23625
23671
|
"user_message_chunk",
|
|
23626
23672
|
"agent_message_chunk",
|
|
@@ -23665,7 +23711,7 @@ function decodeSessionUpdate(payload) {
|
|
|
23665
23711
|
return { status: "raw", params: payload };
|
|
23666
23712
|
}
|
|
23667
23713
|
|
|
23668
|
-
// ../../packages/ycodium-acp-
|
|
23714
|
+
// ../../packages/ycodium-acp-executor/src/connection.ts
|
|
23669
23715
|
var textDecoder = new TextDecoder();
|
|
23670
23716
|
var textEncoder = new TextEncoder();
|
|
23671
23717
|
function asBytes(chunk) {
|
|
@@ -24190,42 +24236,6 @@ var UnboundedEventStream = class {
|
|
|
24190
24236
|
}
|
|
24191
24237
|
};
|
|
24192
24238
|
|
|
24193
|
-
// ../../packages/ycodium-acp-executor/src/errors.ts
|
|
24194
|
-
var AcpExecutorError = class extends Error {
|
|
24195
|
-
code;
|
|
24196
|
-
constructor(code, message) {
|
|
24197
|
-
super(message);
|
|
24198
|
-
this.name = "AcpExecutorError";
|
|
24199
|
-
this.code = code;
|
|
24200
|
-
}
|
|
24201
|
-
};
|
|
24202
|
-
var AcpExecutorDisposedError = class extends AcpExecutorError {
|
|
24203
|
-
constructor(message = "ACP executor has been disposed") {
|
|
24204
|
-
super("disposed", message);
|
|
24205
|
-
this.name = "AcpExecutorDisposedError";
|
|
24206
|
-
}
|
|
24207
|
-
};
|
|
24208
|
-
var AcpExecutorNotStartedError = class extends AcpExecutorError {
|
|
24209
|
-
constructor(message = "ACP session has not been started") {
|
|
24210
|
-
super("not-started", message);
|
|
24211
|
-
this.name = "AcpExecutorNotStartedError";
|
|
24212
|
-
}
|
|
24213
|
-
};
|
|
24214
|
-
var AcpExecutorCancelTimeoutError = class extends AcpExecutorError {
|
|
24215
|
-
constructor(message = "Timed out waiting for session/prompt to finish after cancellation") {
|
|
24216
|
-
super("cancel-timeout", message);
|
|
24217
|
-
this.name = "AcpExecutorCancelTimeoutError";
|
|
24218
|
-
}
|
|
24219
|
-
};
|
|
24220
|
-
var AcpExecutorRequestError = class extends AcpExecutorError {
|
|
24221
|
-
method;
|
|
24222
|
-
constructor(method, message) {
|
|
24223
|
-
super("request-failed", message);
|
|
24224
|
-
this.name = "AcpExecutorRequestError";
|
|
24225
|
-
this.method = method;
|
|
24226
|
-
}
|
|
24227
|
-
};
|
|
24228
|
-
|
|
24229
24239
|
// ../../packages/ycodium-acp-executor/src/events.ts
|
|
24230
24240
|
function canonicalRequestTypeFromAcpKind(kind) {
|
|
24231
24241
|
switch (kind) {
|
|
@@ -27075,6 +27085,17 @@ function resolveGrokHomePath(value) {
|
|
|
27075
27085
|
if (trimmed2.length === 0) return NodePath2.join(NodeOS.homedir(), ".grok");
|
|
27076
27086
|
return NodePath2.resolve(expandHomePath(trimmed2));
|
|
27077
27087
|
}
|
|
27088
|
+
function probeGrokAccount(accountPath) {
|
|
27089
|
+
const resolved = resolveGrokHomePath(accountPath);
|
|
27090
|
+
const account = readGrokAccount(resolved);
|
|
27091
|
+
return {
|
|
27092
|
+
accountPath: resolved,
|
|
27093
|
+
state: account.state,
|
|
27094
|
+
...account.email === void 0 ? {} : { email: account.email },
|
|
27095
|
+
...account.name === void 0 ? {} : { name: account.name },
|
|
27096
|
+
...account.expiresAt === void 0 ? {} : { expiresAt: account.expiresAt }
|
|
27097
|
+
};
|
|
27098
|
+
}
|
|
27078
27099
|
function grokContinuationKey(recipe) {
|
|
27079
27100
|
return `grok:home:${resolveGrokHomePath(recipe.homePath)}`;
|
|
27080
27101
|
}
|
|
@@ -27085,14 +27106,38 @@ function resolveAccountHomePath(recipe, configuredHome) {
|
|
|
27085
27106
|
}
|
|
27086
27107
|
return resolveGrokHomePath(configuredHome);
|
|
27087
27108
|
}
|
|
27088
|
-
function
|
|
27089
|
-
|
|
27109
|
+
function absentPath() {
|
|
27110
|
+
return NodePath2.join(
|
|
27111
|
+
NodeOS.tmpdir(),
|
|
27112
|
+
`ycodium-grok-no-auth-${NodeCrypto2.randomUUID()}`,
|
|
27113
|
+
"auth.json"
|
|
27114
|
+
);
|
|
27115
|
+
}
|
|
27116
|
+
function ownEndpointAuthGuard(recipe) {
|
|
27117
|
+
const connectivity = GROK_CARD.modelConnectivity;
|
|
27118
|
+
const baseUrlKey = connectivity.baseUrlEnvKey;
|
|
27119
|
+
if (baseUrlKey === void 0 || (recipe.environment[baseUrlKey]?.trim() ?? "") === "") return {};
|
|
27120
|
+
const guard = {};
|
|
27121
|
+
for (const entry of connectivity.extraEnv ?? []) {
|
|
27122
|
+
if (entry.value === "$absentPath") guard[entry.name] = absentPath();
|
|
27123
|
+
}
|
|
27124
|
+
return guard;
|
|
27125
|
+
}
|
|
27126
|
+
function buildSignInEnv(recipe) {
|
|
27127
|
+
const configuredHome = recipe.homePath;
|
|
27128
|
+
const homeInjection = configuredHome.trim().length > 0 ? { [GROK_CARD.homeEnvVar]: resolveGrokHomePath(configuredHome) } : {};
|
|
27090
27129
|
return mergeLaunchEnv({
|
|
27091
|
-
brainSlots: brainSlotEnvKeys(GROK_CARD),
|
|
27092
27130
|
accountHome: homeInjection,
|
|
27093
27131
|
instanceTable: recipe.environment,
|
|
27094
|
-
handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" }
|
|
27095
|
-
|
|
27132
|
+
handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" }
|
|
27133
|
+
});
|
|
27134
|
+
}
|
|
27135
|
+
function buildSpawnEnv(recipe, resolvedHomePath, homeConfigured) {
|
|
27136
|
+
const homeInjection = homeConfigured ? { [GROK_CARD.homeEnvVar]: resolvedHomePath } : {};
|
|
27137
|
+
return mergeLaunchEnv({
|
|
27138
|
+
accountHome: { ...homeInjection, ...ownEndpointAuthGuard(recipe) },
|
|
27139
|
+
instanceTable: recipe.environment,
|
|
27140
|
+
handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" }
|
|
27096
27141
|
});
|
|
27097
27142
|
}
|
|
27098
27143
|
function nowIso() {
|
|
@@ -27122,6 +27167,9 @@ var createGrokInstance = (config2, host) => {
|
|
|
27122
27167
|
return booked;
|
|
27123
27168
|
};
|
|
27124
27169
|
const probeAuth = () => {
|
|
27170
|
+
if ((recipe.environment["XAI_API_KEY"] ?? "").trim().length > 0) {
|
|
27171
|
+
return { status: "authenticated", type: "api-key", label: "XAI_API_KEY" };
|
|
27172
|
+
}
|
|
27125
27173
|
const account = readGrokAccount(resolveAccountHomePath(recipe, recipe.homePath));
|
|
27126
27174
|
switch (account.state) {
|
|
27127
27175
|
case "signed-in":
|
|
@@ -27193,13 +27241,11 @@ var createGrokInstance = (config2, host) => {
|
|
|
27193
27241
|
await stopBooked(existing);
|
|
27194
27242
|
threads.delete(input2.threadId);
|
|
27195
27243
|
}
|
|
27196
|
-
const configuredHome =
|
|
27197
|
-
const resolvedHomePath = resolveGrokHomePath(configuredHome);
|
|
27244
|
+
const configuredHome = recipe.homePath;
|
|
27198
27245
|
const env = buildSpawnEnv(
|
|
27199
27246
|
recipe,
|
|
27200
|
-
|
|
27201
|
-
configuredHome.length > 0
|
|
27202
|
-
input2.launch.processEnv
|
|
27247
|
+
resolveGrokHomePath(configuredHome),
|
|
27248
|
+
configuredHome.trim().length > 0
|
|
27203
27249
|
);
|
|
27204
27250
|
const effort = modelSelectionStringOption(input2.modelSelection, GROK_REASONING_OPTION_ID);
|
|
27205
27251
|
const baseArgs = tokenizeLaunchArgs(recipe.launchArgs);
|
|
@@ -27220,7 +27266,7 @@ var createGrokInstance = (config2, host) => {
|
|
|
27220
27266
|
});
|
|
27221
27267
|
const { readable, writable } = nodeStreamsFromHandle2(handle);
|
|
27222
27268
|
const resume = input2.discardResumeCursor === true ? void 0 : parseAcpResumeCursor(input2.resumeCursor, RESUME_SCHEMA_VERSION);
|
|
27223
|
-
const requestedModelId =
|
|
27269
|
+
const requestedModelId = modelIdFromSelection(input2.modelSelection);
|
|
27224
27270
|
let initializeResult;
|
|
27225
27271
|
const executor = createAcpExecutor({
|
|
27226
27272
|
readable,
|
|
@@ -27430,10 +27476,12 @@ var createGrokInstance = (config2, host) => {
|
|
|
27430
27476
|
if (recipe.binaryPath.length === 0) {
|
|
27431
27477
|
throw new Error("Grok program path is not configured");
|
|
27432
27478
|
}
|
|
27479
|
+
const env = buildSignInEnv(recipe);
|
|
27433
27480
|
const handle = await host.process.spawn({
|
|
27434
27481
|
program: recipe.binaryPath,
|
|
27435
27482
|
args: [...GROK_CARD.deviceCodeSignInArgs],
|
|
27436
|
-
owner: { bindingId: host.bindingId }
|
|
27483
|
+
owner: { bindingId: host.bindingId },
|
|
27484
|
+
...Object.keys(env).length > 0 ? { env } : {}
|
|
27437
27485
|
});
|
|
27438
27486
|
const collected = [];
|
|
27439
27487
|
let onCodeFound;
|
|
@@ -27496,7 +27544,8 @@ var executors = [
|
|
|
27496
27544
|
createInstance: async (config2, host) => {
|
|
27497
27545
|
host.log.info("createInstance");
|
|
27498
27546
|
return createGrokInstance(config2, host);
|
|
27499
|
-
}
|
|
27547
|
+
},
|
|
27548
|
+
probeAccount: async ({ accountPath }) => probeGrokAccount(accountPath)
|
|
27500
27549
|
}
|
|
27501
27550
|
];
|
|
27502
27551
|
var index_default = definePlugin({
|
package/locales/en.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"form": {
|
|
3
|
+
"binaryPath": {
|
|
4
|
+
"title": "Program path",
|
|
5
|
+
"description": "Path to the Grok program this provider runs.",
|
|
6
|
+
"placeholder": "grok"
|
|
7
|
+
},
|
|
8
|
+
"homePath": {
|
|
9
|
+
"title": "Account directory",
|
|
10
|
+
"description": "Sessions and the `grok login` credentials live here, so providers sharing this directory can pick up each other's threads and providers with different directories cannot. Leave empty to use the CLI's default (~/.grok).",
|
|
11
|
+
"placeholder": "e.g. ~/.grok-work"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"form": {
|
|
3
|
+
"binaryPath": {
|
|
4
|
+
"title": "程序路径",
|
|
5
|
+
"description": "此 provider 运行的 Grok 程序的路径。",
|
|
6
|
+
"placeholder": "grok"
|
|
7
|
+
},
|
|
8
|
+
"homePath": {
|
|
9
|
+
"title": "账户目录",
|
|
10
|
+
"description": "会话和 `grok login` 的凭据都保存在这里,因此共用同一目录的 provider 可以接手彼此的会话,目录不同的则不能。留空则使用该命令行工具的默认目录(~/.grok)。",
|
|
11
|
+
"placeholder": "例如 ~/.grok-work"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-grok",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2488",
|
|
4
4
|
"description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"assets",
|
|
13
|
+
"locales",
|
|
13
14
|
"README.md"
|
|
14
15
|
],
|
|
15
16
|
"type": "module",
|
|
@@ -20,10 +21,9 @@
|
|
|
20
21
|
"@types/node": "24.12.4",
|
|
21
22
|
"esbuild": "0.28.1",
|
|
22
23
|
"vite-plus": "0.2.2",
|
|
23
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
24
|
-
"ycodium-executor
|
|
25
|
-
"ycodium-
|
|
26
|
-
"ycodium-acp-protocol": "0.0.0"
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.2488",
|
|
25
|
+
"ycodium-acp-executor": "0.2.2488",
|
|
26
|
+
"ycodium-executor-testing": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|