@ycodium-ai/agent-grok 0.2.6520 → 0.2.6551

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -19
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  import { definePlugin } from "@ycodium-ai/plugin-api";
9
9
 
10
10
  // ../../packages/plugin-api/src/version.ts
11
- var PLUGIN_API_VERSION = 218;
11
+ var PLUGIN_API_VERSION = 219;
12
12
 
13
13
  // src/index.ts
14
14
  import { registerEffectiveHomeCommand } from "@ycodium-ai/plugin-api/instance-config";
@@ -171,7 +171,10 @@ var GROK_CARD = {
171
171
  import * as NodeCrypto from "node:crypto";
172
172
  import * as NodeOS from "node:os";
173
173
  import * as NodePath2 from "node:path";
174
- import { mergeLaunchEnv } from "@ycodium-ai/plugin-api/executor";
174
+ import {
175
+ mergeLaunchEnv,
176
+ readModelConnectionEnv
177
+ } from "@ycodium-ai/plugin-api/executor";
175
178
  import { expandHomePath } from "@ycodium-ai/plugin-api/instance-config";
176
179
 
177
180
  // src/grokAccount.ts
@@ -243,7 +246,7 @@ function grokContinuationKey(recipe) {
243
246
  return `grok:home:${resolveGrokHomePath(recipe.homePath)}`;
244
247
  }
245
248
  function resolveAccountHomePath(recipe, configuredHome) {
246
- const fromEnvironment = recipe.environment["GROK_HOME"]?.trim();
249
+ const fromEnvironment = recipe.environment[GROK_CARD.homeEnvVar]?.trim();
247
250
  if (fromEnvironment !== void 0 && fromEnvironment.length > 0) {
248
251
  return NodePath2.resolve(expandHomePath(fromEnvironment));
249
252
  }
@@ -256,36 +259,41 @@ function absentPath() {
256
259
  "auth.json"
257
260
  );
258
261
  }
259
- function ownEndpointAuthGuard(recipe) {
262
+ function ownEndpointAuthGuard(recipe, platform) {
260
263
  const connectivity = GROK_CARD.modelConnectivity;
261
264
  const baseUrlKey = connectivity.baseUrlEnvKey;
262
265
  if (baseUrlKey === void 0) return {};
263
266
  const effectiveEnv = mergeLaunchEnv({
264
267
  inherited: process.env,
265
- instanceTable: recipe.environment
268
+ instanceTable: recipe.environment,
269
+ platform
266
270
  });
267
- if ((effectiveEnv[baseUrlKey]?.trim() ?? "") === "") return {};
271
+ if ((readModelConnectionEnv(connectivity, effectiveEnv, platform)[baseUrlKey]?.trim() ?? "") === "") {
272
+ return {};
273
+ }
268
274
  const guard = {};
269
275
  for (const entry of connectivity.extraEnv ?? []) {
270
276
  if (entry.value === "$absentPath") guard[entry.name] = absentPath();
271
277
  }
272
278
  return guard;
273
279
  }
274
- function buildSignInEnv(recipe) {
280
+ function buildSignInEnv(recipe, platform) {
275
281
  const configuredHome = recipe.homePath;
276
282
  const homeInjection = configuredHome.trim().length > 0 ? { [GROK_CARD.homeEnvVar]: resolveGrokHomePath(configuredHome) } : {};
277
283
  return mergeLaunchEnv({
278
284
  accountHome: homeInjection,
279
285
  instanceTable: recipe.environment,
280
- handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" }
286
+ handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" },
287
+ platform
281
288
  });
282
289
  }
283
- function buildSpawnEnv(recipe, resolvedHomePath, homeConfigured) {
290
+ function buildSpawnEnv(recipe, resolvedHomePath, homeConfigured, platform) {
284
291
  const homeInjection = homeConfigured ? { [GROK_CARD.homeEnvVar]: resolvedHomePath } : {};
285
292
  return mergeLaunchEnv({
286
- accountHome: { ...homeInjection, ...ownEndpointAuthGuard(recipe) },
293
+ accountHome: { ...homeInjection, ...ownEndpointAuthGuard(recipe, platform) },
287
294
  instanceTable: recipe.environment,
288
- handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" }
295
+ handOverrides: { GROK_OAUTH2_REFERRER: "ycodium" },
296
+ platform
289
297
  });
290
298
  }
291
299
 
@@ -293,7 +301,8 @@ function buildSpawnEnv(recipe, resolvedHomePath, homeConfigured) {
293
301
  import { sessionReadFromImport } from "@ycodium-ai/plugin-api/session-history";
294
302
  import * as NodeCrypto6 from "node:crypto";
295
303
  import {
296
- raceAbort as raceAbort2
304
+ raceAbort as raceAbort2,
305
+ readModelConnectionEnv as readModelConnectionEnv3
297
306
  } from "@ycodium-ai/plugin-api/executor";
298
307
  import { nodeStreamsFromHandle as nodeStreamsFromHandle2 } from "@ycodium-ai/plugin-api/process-stdin";
299
308
 
@@ -30201,8 +30210,8 @@ import {
30201
30210
  readLaunchInstanceRecipe
30202
30211
  } from "@ycodium-ai/plugin-api/instance-config";
30203
30212
  var GROK_DEFAULT_LAUNCH_ARGS = "agent stdio";
30204
- function parseGrokInstanceConfig(config2) {
30205
- return readLaunchInstanceRecipe(config2, GROK_DEFAULT_LAUNCH_ARGS);
30213
+ function parseGrokInstanceConfig(config2, platform) {
30214
+ return readLaunchInstanceRecipe(config2, GROK_DEFAULT_LAUNCH_ARGS, platform);
30206
30215
  }
30207
30216
 
30208
30217
  // src/grokSignIn.ts
@@ -30226,6 +30235,7 @@ function makeGrokSignIn(input2) {
30226
30235
  // src/grokQuota.ts
30227
30236
  import * as NodeFS2 from "node:fs";
30228
30237
  import * as NodePath5 from "node:path";
30238
+ import { readModelConnectionEnv as readModelConnectionEnv2 } from "@ycodium-ai/plugin-api/executor";
30229
30239
  import "@ycodium-ai/plugin-api/usage";
30230
30240
  import {
30231
30241
  requestQuotaJson,
@@ -30269,8 +30279,13 @@ var createGrokUsage = (input2) => {
30269
30279
  const now = input2.now ?? Date.now;
30270
30280
  const authPath = NodePath5.join(input2.homePath, AUTH_FILE_NAME2);
30271
30281
  const readQuota = async (request) => {
30282
+ const connectionEnv = readModelConnectionEnv2(
30283
+ GROK_CARD.modelConnectivity,
30284
+ input2.environment,
30285
+ input2.platform
30286
+ );
30272
30287
  const baseUrlKey = GROK_CARD.modelConnectivity.baseUrlEnvKey;
30273
- if (baseUrlKey !== void 0 && (input2.environment[baseUrlKey]?.trim() ?? "") !== "") {
30288
+ if (baseUrlKey !== void 0 && (connectionEnv[baseUrlKey]?.trim() ?? "") !== "") {
30274
30289
  return { status: "unavailable", reason: "customEndpoint" };
30275
30290
  }
30276
30291
  let token = null;
@@ -30280,7 +30295,8 @@ var createGrokUsage = (input2) => {
30280
30295
  token = null;
30281
30296
  }
30282
30297
  if (token === null) {
30283
- const apiKey = input2.environment["XAI_API_KEY"]?.trim() ?? "";
30298
+ const credentialKey = GROK_CARD.modelConnectivity.credentialEnvKey ?? "XAI_API_KEY";
30299
+ const apiKey = connectionEnv[credentialKey]?.trim() ?? "";
30284
30300
  return {
30285
30301
  status: "unavailable",
30286
30302
  reason: apiKey.length > 0 ? "unsupportedLogin" : "missingCredentials"
@@ -32319,8 +32335,9 @@ var createGrokInstance = (config2, host, deps) => {
32319
32335
  const table = createAcpThreadTable(host.log, () => signIn.close());
32320
32336
  const { threads, requireThread, registerSession, stopSession, disposeOnce } = table;
32321
32337
  const probeAuth = () => {
32322
- if ((recipe.environment["XAI_API_KEY"] ?? "").trim().length > 0) {
32323
- return { status: "authenticated", type: "api-key", label: "XAI_API_KEY" };
32338
+ const credentialKey = GROK_CARD.modelConnectivity.credentialEnvKey ?? "XAI_API_KEY";
32339
+ if ((readModelConnectionEnv3(GROK_CARD.modelConnectivity, recipe.environment)[credentialKey] ?? "").trim().length > 0) {
32340
+ return { status: "authenticated", type: "api-key", label: credentialKey };
32324
32341
  }
32325
32342
  const account = readGrokAccount(resolveAccountHomePath(recipe, recipe.homePath));
32326
32343
  switch (account.state) {
@@ -32424,7 +32441,8 @@ var createGrokInstance = (config2, host, deps) => {
32424
32441
  ...deps?.readAttachment === void 0 ? {} : { readAttachment: deps.readAttachment }
32425
32442
  });
32426
32443
  const sessionSkillNames = /* @__PURE__ */ new Map();
32427
- const sessionHome = (spawnEnv().GROK_HOME ?? process.env.GROK_HOME)?.trim();
32444
+ const sessionEnv = spawnEnv();
32445
+ const sessionHome = (Object.hasOwn(sessionEnv, GROK_CARD.homeEnvVar) ? sessionEnv[GROK_CARD.homeEnvVar] : process.env[GROK_CARD.homeEnvVar])?.trim();
32428
32446
  const sessions = createGrokNativeSessions(
32429
32447
  sessionHome || resolveGrokHomePath(""),
32430
32448
  RESUME_SCHEMA_VERSION
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-grok",
3
- "version": "0.2.6520",
3
+ "version": "0.2.6551",
4
4
  "description": "Grok executor: grok CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,10 +21,10 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.0",
25
- "ycodium-acp-executor": "0.2.0",
26
- "ycodium-credential-account": "0.0.0",
27
- "ycodium-executor-testing": "0.0.0"
24
+ "ycodium-acp-executor": "0.2.6551",
25
+ "@ycodium-ai/plugin-api": "0.2.6551",
26
+ "ycodium-executor-testing": "0.0.0",
27
+ "ycodium-credential-account": "0.0.0"
28
28
  },
29
29
  "ycodium": {
30
30
  "plugin": "./dist/index.js",