@liberseek/boft-cli-win32-arm64 0.7.0 → 0.7.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.
@@ -7,7 +7,45 @@ var __export = (target, all) => {
7
7
 
8
8
  // dist/grok-adapter.js
9
9
  import { randomUUID } from "node:crypto";
10
- import path10 from "node:path";
10
+
11
+ // dist/grok-credential-export.js
12
+ import { createHash } from "node:crypto";
13
+ import { readFile } from "node:fs/promises";
14
+ import os from "node:os";
15
+ import path from "node:path";
16
+ async function readGrokCredentials(environment) {
17
+ if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((v) => v?.trim()))
18
+ return [];
19
+ try {
20
+ const home = environment.GROK_HOME ?? path.join(environment.HOME ?? os.homedir(), ".grok");
21
+ const auth = JSON.parse(await readFile(path.join(home, "auth.json"), "utf8"));
22
+ const client2 = "b1a00492-073a-47ea-816f-4c329264a828";
23
+ const entry = auth[`https://auth.x.ai::${client2}`] ?? auth["https://auth.x.ai"];
24
+ if (!entry || entry.oidc_issuer !== "https://auth.x.ai" || entry.oidc_client_id !== client2)
25
+ return [];
26
+ if (![entry.key, entry.refresh_token, entry.user_id].every((v) => typeof v === "string" && v.length))
27
+ return [];
28
+ const expires = Date.parse(entry.expires_at);
29
+ if (!Number.isFinite(expires))
30
+ return [];
31
+ return [
32
+ {
33
+ source: {
34
+ id: `grok:${createHash("sha256").update(entry.user_id).digest("hex")}`,
35
+ harnessId: "grok",
36
+ provider: "xai",
37
+ label: typeof entry.email === "string" && entry.email ? entry.email : "Grok"
38
+ },
39
+ oauth: { access: entry.key, refresh: entry.refresh_token, expires: expires - 3e5 }
40
+ }
41
+ ];
42
+ } catch {
43
+ return [];
44
+ }
45
+ }
46
+
47
+ // dist/grok-adapter.js
48
+ import path11 from "node:path";
11
49
 
12
50
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
13
51
  var AGENT_METHODS = {
@@ -827,10 +865,10 @@ function mergeDefs(...defs) {
827
865
  function cloneDef(schema) {
828
866
  return mergeDefs(schema._zod.def);
829
867
  }
830
- function getElementAtPath(obj, path11) {
831
- if (!path11)
868
+ function getElementAtPath(obj, path12) {
869
+ if (!path12)
832
870
  return obj;
833
- return path11.reduce((acc, key) => acc?.[key], obj);
871
+ return path12.reduce((acc, key) => acc?.[key], obj);
834
872
  }
835
873
  function promiseAllObject(promisesObj) {
836
874
  const keys = Object.keys(promisesObj);
@@ -1239,11 +1277,11 @@ function explicitlyAborted(x, startIndex = 0) {
1239
1277
  }
1240
1278
  return false;
1241
1279
  }
1242
- function prefixIssues(path11, issues) {
1280
+ function prefixIssues(path12, issues) {
1243
1281
  return issues.map((iss) => {
1244
1282
  var _a3;
1245
1283
  (_a3 = iss).path ?? (_a3.path = []);
1246
- iss.path.unshift(path11);
1284
+ iss.path.unshift(path12);
1247
1285
  return iss;
1248
1286
  });
1249
1287
  }
@@ -1390,16 +1428,16 @@ function flattenError(error53, mapper = (issue2) => issue2.message) {
1390
1428
  }
1391
1429
  function formatError(error53, mapper = (issue2) => issue2.message) {
1392
1430
  const fieldErrors = { _errors: [] };
1393
- const processError = (error54, path11 = []) => {
1431
+ const processError = (error54, path12 = []) => {
1394
1432
  for (const issue2 of error54.issues) {
1395
1433
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1396
- issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1434
+ issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
1397
1435
  } else if (issue2.code === "invalid_key") {
1398
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1436
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1399
1437
  } else if (issue2.code === "invalid_element") {
1400
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1438
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1401
1439
  } else {
1402
- const fullpath = [...path11, ...issue2.path];
1440
+ const fullpath = [...path12, ...issue2.path];
1403
1441
  if (fullpath.length === 0) {
1404
1442
  fieldErrors._errors.push(mapper(issue2));
1405
1443
  } else {
@@ -1426,17 +1464,17 @@ function formatError(error53, mapper = (issue2) => issue2.message) {
1426
1464
  }
1427
1465
  function treeifyError(error53, mapper = (issue2) => issue2.message) {
1428
1466
  const result = { errors: [] };
1429
- const processError = (error54, path11 = []) => {
1467
+ const processError = (error54, path12 = []) => {
1430
1468
  var _a3, _b;
1431
1469
  for (const issue2 of error54.issues) {
1432
1470
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1433
- issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
1471
+ issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
1434
1472
  } else if (issue2.code === "invalid_key") {
1435
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1473
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1436
1474
  } else if (issue2.code === "invalid_element") {
1437
- processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
1475
+ processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1438
1476
  } else {
1439
- const fullpath = [...path11, ...issue2.path];
1477
+ const fullpath = [...path12, ...issue2.path];
1440
1478
  if (fullpath.length === 0) {
1441
1479
  result.errors.push(mapper(issue2));
1442
1480
  continue;
@@ -1468,8 +1506,8 @@ function treeifyError(error53, mapper = (issue2) => issue2.message) {
1468
1506
  }
1469
1507
  function toDotPath(_path) {
1470
1508
  const segs = [];
1471
- const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1472
- for (const seg of path11) {
1509
+ const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1510
+ for (const seg of path12) {
1473
1511
  if (typeof seg === "number")
1474
1512
  segs.push(`[${seg}]`);
1475
1513
  else if (typeof seg === "symbol")
@@ -14161,13 +14199,13 @@ function resolveRef(ref, ctx) {
14161
14199
  if (!ref.startsWith("#")) {
14162
14200
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14163
14201
  }
14164
- const path11 = ref.slice(1).split("/").filter(Boolean);
14165
- if (path11.length === 0) {
14202
+ const path12 = ref.slice(1).split("/").filter(Boolean);
14203
+ if (path12.length === 0) {
14166
14204
  return ctx.rootSchema;
14167
14205
  }
14168
14206
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14169
- if (path11[0] === defsKey) {
14170
- const key = path11[1];
14207
+ if (path12[0] === defsKey) {
14208
+ const key = path12[1];
14171
14209
  if (!key || !ctx.defs[key]) {
14172
14210
  throw new Error(`Reference not found: ${ref}`);
14173
14211
  }
@@ -18684,6 +18722,61 @@ var ClientSideConnection = class {
18684
18722
  }
18685
18723
  };
18686
18724
 
18725
+ // ../../shared-contracts/dist/credential-imports.js
18726
+ var credentialSourceSchema = external_exports.object({
18727
+ id: external_exports.string().min(1).max(256),
18728
+ harnessId: external_exports.string().min(1),
18729
+ label: external_exports.string().min(1).max(512),
18730
+ provider: external_exports.enum(["openai-codex", "xai"])
18731
+ }).strict();
18732
+ var credentialImportNameSchema = external_exports.string().regex(/^[a-z][a-z0-9-]{0,47}$/);
18733
+ var credentialImportRecordSchema = external_exports.object({
18734
+ name: credentialImportNameSchema,
18735
+ source: credentialSourceSchema,
18736
+ importedAt: external_exports.string()
18737
+ }).strict();
18738
+ var credentialImportsRequestSchema = external_exports.discriminatedUnion("action", [
18739
+ external_exports.object({ action: external_exports.literal("list") }).strict(),
18740
+ external_exports.object({
18741
+ action: external_exports.literal("import"),
18742
+ sourceId: external_exports.string().min(1).max(256),
18743
+ name: credentialImportNameSchema,
18744
+ confirmed: external_exports.literal(true)
18745
+ }).strict(),
18746
+ external_exports.object({
18747
+ action: external_exports.literal("reimport"),
18748
+ sourceId: external_exports.string().min(1).max(256),
18749
+ name: credentialImportNameSchema,
18750
+ confirmed: external_exports.literal(true)
18751
+ }).strict(),
18752
+ external_exports.object({
18753
+ action: external_exports.literal("remove"),
18754
+ name: credentialImportNameSchema,
18755
+ confirmed: external_exports.literal(true)
18756
+ }).strict()
18757
+ ]);
18758
+ var credentialOtherLoginSchema = external_exports.object({
18759
+ provider: external_exports.string().min(1).max(128),
18760
+ type: external_exports.enum(["oauth", "api_key", "unknown"]),
18761
+ /** Best-effort account label (e.g. the email in a Codex token), derived locally when present. */
18762
+ label: external_exports.string().min(1).max(512).optional(),
18763
+ /** Recognized credential vendor, derived from the OAuth token issuer. Absent when unknown. */
18764
+ vendor: external_exports.enum(["openai-codex", "xai"]).optional()
18765
+ }).strict();
18766
+ var credentialImportsResultSchema = external_exports.object({
18767
+ sources: external_exports.array(credentialSourceSchema),
18768
+ targets: external_exports.array(external_exports.object({
18769
+ harnessId: external_exports.string(),
18770
+ providers: external_exports.array(external_exports.enum(["openai-codex", "xai"])),
18771
+ imports: external_exports.array(credentialImportRecordSchema),
18772
+ others: external_exports.array(credentialOtherLoginSchema).default([])
18773
+ }).strict())
18774
+ }).strict();
18775
+ var credentialImportsParamsSchema = external_exports.object({
18776
+ targetHarnessId: external_exports.string().min(1).max(128).optional(),
18777
+ request: credentialImportsRequestSchema
18778
+ }).strict();
18779
+
18687
18780
  // ../../shared-contracts/dist/version.js
18688
18781
  var WORKSPACE_CONTRACT_VERSION = 1;
18689
18782
 
@@ -19233,6 +19326,8 @@ var pluginPresentationShape = {
19233
19326
  id: harnessPluginIdSchema,
19234
19327
  name: external_exports.string().trim().min(1).max(128),
19235
19328
  version: external_exports.string().min(1).max(128),
19329
+ /** The factory accepts a persisted local entrypoint through its construction context. */
19330
+ launchCommand: external_exports.literal(true).optional(),
19236
19331
  links: external_exports.object({
19237
19332
  documentation: documentationUrlSchema.optional(),
19238
19333
  installation: documentationUrlSchema.optional()
@@ -19270,6 +19365,19 @@ var harnessPluginRouteSchema = external_exports.object({
19270
19365
  permissionModeId: harnessPermissionModeIdSchema.optional()
19271
19366
  }).strict();
19272
19367
 
19368
+ // ../../shared-contracts/dist/harness-launch-settings.js
19369
+ var harnessLaunchPathSchema = external_exports.string().trim().min(1).max(4096).refine((value) => !/[\u0000\r\n]/u.test(value), "Invalid entrypoint path");
19370
+ var harnessLaunchSettingsGetSchema = external_exports.object({
19371
+ harnessId: harnessPluginIdSchema
19372
+ }).strict();
19373
+ var harnessLaunchSettingsSetSchema = harnessLaunchSettingsGetSchema.extend({
19374
+ path: harnessLaunchPathSchema.nullable()
19375
+ });
19376
+ var harnessLaunchSettingsSchema = external_exports.object({
19377
+ path: harnessLaunchPathSchema.nullable(),
19378
+ restartRequired: external_exports.boolean()
19379
+ }).strict();
19380
+
19273
19381
  // ../../shared-contracts/dist/codex-accounts.js
19274
19382
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
19275
19383
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -19760,19 +19868,19 @@ function parseHostUsage(value) {
19760
19868
 
19761
19869
  // dist/acp-transport.js
19762
19870
  import { spawn, spawnSync } from "node:child_process";
19763
- import { readdir, readFile } from "node:fs/promises";
19764
- import os3 from "node:os";
19765
- import path8 from "node:path";
19871
+ import { readdir, readFile as readFile2 } from "node:fs/promises";
19872
+ import os4 from "node:os";
19873
+ import path9 from "node:path";
19766
19874
  import { Readable, Writable } from "node:stream";
19767
19875
 
19768
19876
  // dist/command.js
19769
- import path3 from "node:path";
19877
+ import path4 from "node:path";
19770
19878
 
19771
19879
  // ../../harness-discovery/dist/environment.js
19772
19880
  import fs from "node:fs";
19773
- import path from "node:path";
19881
+ import path2 from "node:path";
19774
19882
  function targetPath(platform) {
19775
- return platform === "win32" ? path.win32 : path.posix;
19883
+ return platform === "win32" ? path2.win32 : path2.posix;
19776
19884
  }
19777
19885
  function environmentValue(environment, name) {
19778
19886
  const lowered = name.toLowerCase();
@@ -19815,9 +19923,9 @@ function newestFirst(names) {
19815
19923
  }
19816
19924
 
19817
19925
  // ../../harness-discovery/dist/invocation.js
19818
- import path2 from "node:path";
19926
+ import path3 from "node:path";
19819
19927
  function commandInvocation(command, arguments_, environment, platform = process.platform) {
19820
- const extension = path2.win32.extname(command).toLowerCase();
19928
+ const extension = path3.win32.extname(command).toLowerCase();
19821
19929
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
19822
19930
  return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
19823
19931
  }
@@ -19831,7 +19939,7 @@ function commandInvocation(command, arguments_, environment, platform = process.
19831
19939
  }
19832
19940
 
19833
19941
  // ../../harness-discovery/dist/resolve.js
19834
- import os from "node:os";
19942
+ import os2 from "node:os";
19835
19943
 
19836
19944
  // ../../harness-discovery/dist/version-managers.js
19837
19945
  function versionManagerBinaryDirectories(context) {
@@ -19897,7 +20005,7 @@ function installRootExtensions(platform) {
19897
20005
  return platform === "win32" ? [".exe", ".cmd"] : [""];
19898
20006
  }
19899
20007
  function resolveHomeDirectory(input) {
19900
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
20008
+ return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os2.homedir();
19901
20009
  }
19902
20010
  function templateVariables(environment, platform, home) {
19903
20011
  const pathFlavor = targetPath(platform);
@@ -20022,7 +20130,7 @@ function resolveGrokExecutable(input = {}) {
20022
20130
  });
20023
20131
  if (!resolution)
20024
20132
  throw new GrokExecutableError("Grok CLI is not installed");
20025
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
20133
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
20026
20134
  }
20027
20135
  function grokInvocation(command, platform = process.platform, modelId) {
20028
20136
  const arguments_ = ["agent", "--no-leader"];
@@ -20035,11 +20143,11 @@ function grokInvocation(command, platform = process.platform, modelId) {
20035
20143
 
20036
20144
  // dist/grok-fork.js
20037
20145
  import { isDeepStrictEqual } from "node:util";
20038
- import path6 from "node:path";
20146
+ import path7 from "node:path";
20039
20147
 
20040
20148
  // dist/grok-file-change.js
20041
20149
  import { Buffer as Buffer2 } from "node:buffer";
20042
- import path4 from "node:path";
20150
+ import path5 from "node:path";
20043
20151
 
20044
20152
  // ../../../node_modules/diff/libesm/diff/base.js
20045
20153
  var Diff = class {
@@ -20141,16 +20249,16 @@ var Diff = class {
20141
20249
  }
20142
20250
  }
20143
20251
  }
20144
- addToPath(path11, added, removed, oldPosInc, options) {
20145
- const last = path11.lastComponent;
20252
+ addToPath(path12, added, removed, oldPosInc, options) {
20253
+ const last = path12.lastComponent;
20146
20254
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
20147
20255
  return {
20148
- oldPos: path11.oldPos + oldPosInc,
20256
+ oldPos: path12.oldPos + oldPosInc,
20149
20257
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
20150
20258
  };
20151
20259
  } else {
20152
20260
  return {
20153
- oldPos: path11.oldPos + oldPosInc,
20261
+ oldPos: path12.oldPos + oldPosInc,
20154
20262
  lastComponent: { count: 1, added, removed, previousComponent: last }
20155
20263
  };
20156
20264
  }
@@ -20463,13 +20571,13 @@ function isRecord3(value) {
20463
20571
  return typeof value === "object" && value !== null && !Array.isArray(value);
20464
20572
  }
20465
20573
  function validAbsolutePath(value) {
20466
- return typeof value === "string" && path4.isAbsolute(value) && value.trim().length > 0 && !value.includes("\0") && !value.includes("\n") && !value.includes("\r");
20574
+ return typeof value === "string" && path5.isAbsolute(value) && value.trim().length > 0 && !value.includes("\0") && !value.includes("\n") && !value.includes("\r");
20467
20575
  }
20468
20576
  function displayPath(nativePath, cwd) {
20469
- const resolvedCwd = path4.resolve(cwd);
20470
- const resolvedPath = path4.resolve(nativePath);
20471
- const relative = path4.relative(resolvedCwd, resolvedPath);
20472
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
20577
+ const resolvedCwd = path5.resolve(cwd);
20578
+ const resolvedPath = path5.resolve(nativePath);
20579
+ const relative = path5.relative(resolvedCwd, resolvedPath);
20580
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
20473
20581
  const selected = inside ? relative : resolvedPath;
20474
20582
  const normalized = selected.replaceAll("\\", "/");
20475
20583
  if (normalized.length === 0 || normalized === ".")
@@ -20531,8 +20639,8 @@ function projectGrokFileChanges(content, cwd, textLimit = DEFAULT_GROK_FILE_CHAN
20531
20639
 
20532
20640
  // dist/local-media-markdown.js
20533
20641
  import { existsSync, statSync } from "node:fs";
20534
- import os2 from "node:os";
20535
- import path5 from "node:path";
20642
+ import os3 from "node:os";
20643
+ import path6 from "node:path";
20536
20644
  var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
20537
20645
  ".aac",
20538
20646
  ".gif",
@@ -20551,14 +20659,14 @@ var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
20551
20659
  ".webp"
20552
20660
  ]);
20553
20661
  function grokMediaResolveRoots(cwd, sessionDirectory) {
20554
- const roots = [path5.resolve(cwd)];
20662
+ const roots = [path6.resolve(cwd)];
20555
20663
  if (sessionDirectory) {
20556
- const session = path5.resolve(sessionDirectory);
20557
- roots.push(session, path5.join(session, "videos"), path5.join(session, "images"));
20664
+ const session = path6.resolve(sessionDirectory);
20665
+ roots.push(session, path6.join(session, "videos"), path6.join(session, "images"));
20558
20666
  }
20559
- const home = process.env.HOME ?? process.env.USERPROFILE ?? os2.homedir();
20667
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? os3.homedir();
20560
20668
  if (home)
20561
- roots.push(path5.join(home, "Downloads"));
20669
+ roots.push(path6.join(home, "Downloads"));
20562
20670
  return roots;
20563
20671
  }
20564
20672
  function rewriteLocalMediaMarkdown(text, roots, options = {}) {
@@ -20659,7 +20767,7 @@ function parseInlineCode(text, start) {
20659
20767
  return { closed: false, content: text.slice(start + 1), end: text.length };
20660
20768
  }
20661
20769
  function mediaMarkdownImage(absolutePath) {
20662
- const name = path5.basename(absolutePath).replaceAll("]", "\\]");
20770
+ const name = path6.basename(absolutePath).replaceAll("]", "\\]");
20663
20771
  return `![${name}](${formatMarkdownDestination(absolutePath, false)})`;
20664
20772
  }
20665
20773
  function parseMarkdownImage(text, start) {
@@ -20784,11 +20892,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
20784
20892
  if (!hasMediaExtension(stripped))
20785
20893
  return null;
20786
20894
  if (isAbsoluteMediaPath(stripped)) {
20787
- const absolute = path5.resolve(stripped);
20895
+ const absolute = path6.resolve(stripped);
20788
20896
  return exists(absolute) ? absolute : null;
20789
20897
  }
20790
20898
  for (const root of roots) {
20791
- const absolute = path5.resolve(root, stripped);
20899
+ const absolute = path6.resolve(root, stripped);
20792
20900
  if (exists(absolute))
20793
20901
  return absolute;
20794
20902
  }
@@ -20810,11 +20918,11 @@ function stripFileUrl(value) {
20810
20918
  }
20811
20919
  }
20812
20920
  function isAbsoluteMediaPath(value) {
20813
- return path5.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
20921
+ return path6.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
20814
20922
  }
20815
20923
  function hasMediaExtension(value) {
20816
20924
  const pathname = value.split(/[?#]/, 1)[0] ?? value;
20817
- return MEDIA_EXTENSIONS.has(path5.extname(pathname).toLowerCase());
20925
+ return MEDIA_EXTENSIONS.has(path6.extname(pathname).toLowerCase());
20818
20926
  }
20819
20927
  function mediaFileExists(absolutePath) {
20820
20928
  try {
@@ -21823,11 +21931,11 @@ function parseGrokForkResponse(value) {
21823
21931
  }
21824
21932
  function projectRelativePath(value, cwds) {
21825
21933
  const normalized = value.replaceAll("\\", "/");
21826
- if (!path6.isAbsolute(value))
21934
+ if (!path7.isAbsolute(value))
21827
21935
  return normalized;
21828
21936
  for (const cwd of cwds) {
21829
- const relative = path6.relative(path6.resolve(cwd), path6.resolve(value));
21830
- if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path6.sep}`)) {
21937
+ const relative = path7.relative(path7.resolve(cwd), path7.resolve(value));
21938
+ if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path7.sep}`)) {
21831
21939
  return relative.replaceAll("\\", "/");
21832
21940
  }
21833
21941
  }
@@ -21892,8 +22000,8 @@ async function forkGrokSession(input) {
21892
22000
  error: error51("sessionNotFound", "Grok Native Session is unavailable")
21893
22001
  };
21894
22002
  }
21895
- const sourceCwd = path6.resolve(located.cwd);
21896
- const targetCwd = path6.resolve(input.cwd);
22003
+ const sourceCwd = path7.resolve(located.cwd);
22004
+ const targetCwd = path7.resolve(input.cwd);
21897
22005
  const source = await readSnapshot({ ...input, cwd: sourceCwd }, sourceRef.data.nativeSessionId);
21898
22006
  if (!source.ok)
21899
22007
  return source;
@@ -22075,7 +22183,7 @@ function parseGrokCompactResult(value, cancelled = false) {
22075
22183
  }
22076
22184
 
22077
22185
  // dist/grok-rewind.js
22078
- import path7 from "node:path";
22186
+ import path8 from "node:path";
22079
22187
  var GROK_REWIND_EXECUTE_METHOD = "_x.ai/rewind/execute";
22080
22188
  function error52(code, message, retryable = false) {
22081
22189
  return { code, message, retryable };
@@ -22148,8 +22256,8 @@ async function rewindGrokLastTurn(input) {
22148
22256
  error: error52("sessionNotFound", "Grok Native Session is unavailable")
22149
22257
  };
22150
22258
  }
22151
- const sourceCwd = path7.resolve(located.cwd);
22152
- const targetCwd = path7.resolve(input.cwd);
22259
+ const sourceCwd = path8.resolve(located.cwd);
22260
+ const targetCwd = path8.resolve(input.cwd);
22153
22261
  if (sourceCwd !== targetCwd) {
22154
22262
  return {
22155
22263
  ok: false,
@@ -22629,21 +22737,21 @@ function transportEvent(update, metadata) {
22629
22737
  }
22630
22738
  function grokHomeDir(options) {
22631
22739
  const environment = { ...process.env, ...options.environment };
22632
- const home = environment.HOME ?? environment.USERPROFILE ?? os3.homedir();
22633
- return environment.GROK_HOME ?? path8.join(home, ".grok");
22740
+ const home = environment.HOME ?? environment.USERPROFILE ?? os4.homedir();
22741
+ return environment.GROK_HOME ?? path9.join(home, ".grok");
22634
22742
  }
22635
22743
  function grokNativeSessionDirectory(options, sessionId) {
22636
- return path8.join(grokHomeDir(options), "sessions", encodeURIComponent(path8.resolve(options.cwd)), sessionId);
22744
+ return path9.join(grokHomeDir(options), "sessions", encodeURIComponent(path9.resolve(options.cwd)), sessionId);
22637
22745
  }
22638
22746
  function nativeSessionFile(options, sessionId, fileName) {
22639
- return path8.join(grokNativeSessionDirectory(options, sessionId), fileName);
22747
+ return path9.join(grokNativeSessionDirectory(options, sessionId), fileName);
22640
22748
  }
22641
22749
  function nativeHistoryPath(options, sessionId) {
22642
22750
  return nativeSessionFile(options, sessionId, "updates.jsonl");
22643
22751
  }
22644
22752
  async function readNativeSignals(options, sessionId) {
22645
22753
  try {
22646
- return JSON.parse(await readFile(nativeSessionFile(options, sessionId, "signals.json"), "utf8"));
22754
+ return JSON.parse(await readFile2(nativeSessionFile(options, sessionId, "signals.json"), "utf8"));
22647
22755
  } catch {
22648
22756
  return void 0;
22649
22757
  }
@@ -22656,7 +22764,7 @@ async function locateGrokNativeSession(options, sessionId) {
22656
22764
  return null;
22657
22765
  let entries;
22658
22766
  try {
22659
- entries = await readdir(path8.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
22767
+ entries = await readdir(path9.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
22660
22768
  } catch (error53) {
22661
22769
  if (isMissingFile(error53))
22662
22770
  return null;
@@ -22670,7 +22778,7 @@ async function locateGrokNativeSession(options, sessionId) {
22670
22778
  continue;
22671
22779
  let summaryRaw;
22672
22780
  try {
22673
- summaryRaw = await readFile(path8.join(grokHomeDir(options), "sessions", entry.name, sessionId, "summary.json"), "utf8");
22781
+ summaryRaw = await readFile2(path9.join(grokHomeDir(options), "sessions", entry.name, sessionId, "summary.json"), "utf8");
22674
22782
  } catch (error53) {
22675
22783
  if (isMissingFile(error53) || isRecord12(error53) && error53.code === "ENOTDIR")
22676
22784
  continue;
@@ -22687,8 +22795,8 @@ async function locateGrokNativeSession(options, sessionId) {
22687
22795
  if (!isRecord12(parsed))
22688
22796
  continue;
22689
22797
  const info = parsed.info;
22690
- const cwd = isRecord12(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path8.resolve(info.cwd) : path8.resolve(decodeURIComponent(entry.name));
22691
- const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ? path8.resolve(parsed.source_workspace_dir) : void 0;
22798
+ const cwd = isRecord12(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path9.resolve(info.cwd) : path9.resolve(decodeURIComponent(entry.name));
22799
+ const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ? path9.resolve(parsed.source_workspace_dir) : void 0;
22692
22800
  matches.push({
22693
22801
  cwd,
22694
22802
  ...sourceWorkspaceDir ? { sourceWorkspaceDir } : {}
@@ -22698,7 +22806,7 @@ async function locateGrokNativeSession(options, sessionId) {
22698
22806
  }
22699
22807
  async function readGrokNativeHistory(options, sessionId) {
22700
22808
  try {
22701
- return parseNativeHistory(await readFile(nativeHistoryPath({ ...options, cwd: path8.resolve(options.cwd) }, sessionId), "utf8"), sessionId);
22809
+ return parseNativeHistory(await readFile2(nativeHistoryPath({ ...options, cwd: path9.resolve(options.cwd) }, sessionId), "utf8"), sessionId);
22702
22810
  } catch (error53) {
22703
22811
  if (isMissingFile(error53))
22704
22812
  return [];
@@ -23405,9 +23513,9 @@ function stateForGrokModel(modelState, nativeState, model = modelState.currentMo
23405
23513
  }
23406
23514
 
23407
23515
  // dist/grok-credits.js
23408
- import { readFile as readFile2 } from "node:fs/promises";
23409
- import os4 from "node:os";
23410
- import path9 from "node:path";
23516
+ import { readFile as readFile3 } from "node:fs/promises";
23517
+ import os5 from "node:os";
23518
+ import path10 from "node:path";
23411
23519
  var GROK_CREDITS_ENDPOINT = "https://cli-chat-proxy.grok.com/v1/billing?format=credits";
23412
23520
  var REQUEST_TIMEOUT_MS = 15e3;
23413
23521
  function isRecord14(value) {
@@ -23427,7 +23535,7 @@ function nonNegativeCentValue(value) {
23427
23535
  return amount;
23428
23536
  }
23429
23537
  function grokHome(environment) {
23430
- return environment.GROK_HOME ?? path9.join(environment.HOME ?? environment.USERPROFILE ?? os4.homedir(), ".grok");
23538
+ return environment.GROK_HOME ?? path10.join(environment.HOME ?? environment.USERPROFILE ?? os5.homedir(), ".grok");
23431
23539
  }
23432
23540
  function periodTypeFrom(value) {
23433
23541
  if (typeof value !== "string")
@@ -23506,8 +23614,8 @@ async function fetchGrokAccount(input = {}) {
23506
23614
  if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((value) => value?.trim()))
23507
23615
  return null;
23508
23616
  const now = input.now ?? /* @__PURE__ */ new Date();
23509
- const authPath = path9.join(grokHome(environment), "auth.json");
23510
- const raw = input.readAuthFile ? await input.readAuthFile(authPath) : await readFile2(authPath, "utf8");
23617
+ const authPath = path10.join(grokHome(environment), "auth.json");
23618
+ const raw = input.readAuthFile ? await input.readAuthFile(authPath) : await readFile3(authPath, "utf8");
23511
23619
  const token = selectAccessToken(JSON.parse(raw), now);
23512
23620
  if (!token)
23513
23621
  return null;
@@ -24787,6 +24895,9 @@ var GrokHarnessSession = class {
24787
24895
  }
24788
24896
  };
24789
24897
  var GrokAdapter = class {
24898
+ credentialExport = {
24899
+ read: () => this.#closePromise ? Promise.resolve([]) : readGrokCredentials(this.#environment ?? process.env)
24900
+ };
24790
24901
  commandCatalog = grokCommandCatalog;
24791
24902
  harnessId = grokHarnessId;
24792
24903
  subagents = {
@@ -24885,7 +24996,7 @@ var GrokAdapter = class {
24885
24996
  async inspect(input = {}) {
24886
24997
  if (this.#closePromise)
24887
24998
  return { status: "unavailable", error: invalidState("Grok Adapter is closed") };
24888
- const cwd = path10.resolve(input.cwd ?? process.cwd());
24999
+ const cwd = path11.resolve(input.cwd ?? process.cwd());
24889
25000
  if (!input.refresh) {
24890
25001
  const cached2 = this.#inspectionCache.get(cwd);
24891
25002
  if (cached2)
@@ -24947,7 +25058,7 @@ var GrokAdapter = class {
24947
25058
  }
24948
25059
  };
24949
25060
  }
24950
- const cwd = path10.resolve(input.cwd);
25061
+ const cwd = path11.resolve(input.cwd);
24951
25062
  const parsedRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
24952
25063
  if (parsedRef && (!parsedRef.success || parsedRef.data.harnessId !== this.harnessId)) {
24953
25064
  return {