@liberseek/boft-cli-win32-arm64 0.6.9 → 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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +12 -4
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/desktop-controller.mjs +287 -170
  5. package/app/host-runtime.mjs +2450 -1044
  6. package/app/plugins/antigravity/plugin.mjs +167 -16
  7. package/app/plugins/claude-code/plugin.mjs +311 -58
  8. package/app/plugins/codebuddy/plugin.mjs +2355 -894
  9. package/app/plugins/cursor-cli/plugin.mjs +35973 -10933
  10. package/app/plugins/deepseek-harness/plugin.mjs +125 -7
  11. package/app/plugins/enabled.json +4 -1
  12. package/app/plugins/grok/plugin.mjs +261 -97
  13. package/app/plugins/hermes/plugin.mjs +2486 -99
  14. package/app/plugins/kiro-cli/plugin.mjs +120 -3
  15. package/app/plugins/muse/plugin.mjs +110 -0
  16. package/app/plugins/omp/plugin.mjs +145 -10
  17. package/app/plugins/opencode/plugin.mjs +162 -46
  18. package/app/plugins/pi/plugin.mjs +2891 -1678
  19. package/app/plugins/qoder/assets/icon.svg +1 -0
  20. package/app/plugins/qoder/manifest.json +12 -0
  21. package/app/plugins/qoder/plugin.mjs +52352 -0
  22. package/app/plugins/qoder-cn/assets/icon.svg +1 -0
  23. package/app/plugins/qoder-cn/manifest.json +12 -0
  24. package/app/plugins/qoder-cn/plugin.mjs +52350 -0
  25. package/app/plugins/workbuddy/assets/icon.svg +29 -0
  26. package/app/plugins/workbuddy/manifest.json +14 -0
  27. package/app/plugins/workbuddy/plugin.mjs +25007 -0
  28. package/app/renderer-extension.js +6043 -1442
  29. package/bin/boft.exe +0 -0
  30. package/libexec/boft-node-repl.exe +0 -0
  31. package/libexec/boft-shim.exe +0 -0
  32. package/libexec/boft-updater.exe +0 -0
  33. package/licenses/Qoder-Agent-SDK-LICENSE.txt +7 -0
  34. package/licenses/QoderCN-Agent-SDK-LICENSE.txt +7 -0
  35. package/licenses/{opencodex-LICENSE.txt → tailwindcss-LICENSE.txt} +1 -1
  36. package/package.json +1 -1
@@ -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,9 +18722,104 @@ 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
 
18783
+ // ../../shared-contracts/dist/idle-release.js
18784
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MIN = 5;
18785
+ var IDLE_RELEASE_TIMEOUT_MINUTES_MAX = 1440;
18786
+ var idleReleaseSettingsSchema = external_exports.strictObject({
18787
+ enabled: external_exports.boolean(),
18788
+ timeoutMinutes: external_exports.number().int().min(IDLE_RELEASE_TIMEOUT_MINUTES_MIN).max(IDLE_RELEASE_TIMEOUT_MINUTES_MAX)
18789
+ });
18790
+ var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
18791
+ enabled: false,
18792
+ timeoutMinutes: 30
18793
+ });
18794
+
18795
+ // ../../shared-contracts/dist/loaded-sessions.js
18796
+ var loadedSessionStateSchema = external_exports.enum([
18797
+ "idle",
18798
+ "running",
18799
+ "busy",
18800
+ "closing",
18801
+ "failed",
18802
+ "blocked"
18803
+ ]);
18804
+ var loadedSessionReasonSchema = external_exports.enum([
18805
+ "none",
18806
+ "disabled",
18807
+ "timeout",
18808
+ "operation",
18809
+ "background",
18810
+ "identity",
18811
+ "persistence",
18812
+ "closeFailed"
18813
+ ]);
18814
+ var loadedSessionsSchema = external_exports.array(external_exports.strictObject({
18815
+ threadId: external_exports.string(),
18816
+ title: external_exports.string(),
18817
+ harnessId: external_exports.string(),
18818
+ state: loadedSessionStateSchema,
18819
+ reason: loadedSessionReasonSchema,
18820
+ inactiveMs: external_exports.number().nonnegative()
18821
+ }));
18822
+
18690
18823
  // ../../shared-contracts/dist/ids.js
18691
18824
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
18692
18825
  message: "Identifier must not be empty or whitespace"
@@ -19193,6 +19326,8 @@ var pluginPresentationShape = {
19193
19326
  id: harnessPluginIdSchema,
19194
19327
  name: external_exports.string().trim().min(1).max(128),
19195
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(),
19196
19331
  links: external_exports.object({
19197
19332
  documentation: documentationUrlSchema.optional(),
19198
19333
  installation: documentationUrlSchema.optional()
@@ -19230,6 +19365,19 @@ var harnessPluginRouteSchema = external_exports.object({
19230
19365
  permissionModeId: harnessPermissionModeIdSchema.optional()
19231
19366
  }).strict();
19232
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
+
19233
19381
  // ../../shared-contracts/dist/codex-accounts.js
19234
19382
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
19235
19383
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
@@ -19720,19 +19868,19 @@ function parseHostUsage(value) {
19720
19868
 
19721
19869
  // dist/acp-transport.js
19722
19870
  import { spawn, spawnSync } from "node:child_process";
19723
- import { readdir, readFile } from "node:fs/promises";
19724
- import os3 from "node:os";
19725
- 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";
19726
19874
  import { Readable, Writable } from "node:stream";
19727
19875
 
19728
19876
  // dist/command.js
19729
- import path3 from "node:path";
19877
+ import path4 from "node:path";
19730
19878
 
19731
19879
  // ../../harness-discovery/dist/environment.js
19732
19880
  import fs from "node:fs";
19733
- import path from "node:path";
19881
+ import path2 from "node:path";
19734
19882
  function targetPath(platform) {
19735
- return platform === "win32" ? path.win32 : path.posix;
19883
+ return platform === "win32" ? path2.win32 : path2.posix;
19736
19884
  }
19737
19885
  function environmentValue(environment, name) {
19738
19886
  const lowered = name.toLowerCase();
@@ -19775,9 +19923,9 @@ function newestFirst(names) {
19775
19923
  }
19776
19924
 
19777
19925
  // ../../harness-discovery/dist/invocation.js
19778
- import path2 from "node:path";
19926
+ import path3 from "node:path";
19779
19927
  function commandInvocation(command, arguments_, environment, platform = process.platform) {
19780
- const extension = path2.win32.extname(command).toLowerCase();
19928
+ const extension = path3.win32.extname(command).toLowerCase();
19781
19929
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
19782
19930
  return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
19783
19931
  }
@@ -19791,7 +19939,7 @@ function commandInvocation(command, arguments_, environment, platform = process.
19791
19939
  }
19792
19940
 
19793
19941
  // ../../harness-discovery/dist/resolve.js
19794
- import os from "node:os";
19942
+ import os2 from "node:os";
19795
19943
 
19796
19944
  // ../../harness-discovery/dist/version-managers.js
19797
19945
  function versionManagerBinaryDirectories(context) {
@@ -19857,7 +20005,7 @@ function installRootExtensions(platform) {
19857
20005
  return platform === "win32" ? [".exe", ".cmd"] : [""];
19858
20006
  }
19859
20007
  function resolveHomeDirectory(input) {
19860
- 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();
19861
20009
  }
19862
20010
  function templateVariables(environment, platform, home) {
19863
20011
  const pathFlavor = targetPath(platform);
@@ -19982,7 +20130,7 @@ function resolveGrokExecutable(input = {}) {
19982
20130
  });
19983
20131
  if (!resolution)
19984
20132
  throw new GrokExecutableError("Grok CLI is not installed");
19985
- 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);
19986
20134
  }
19987
20135
  function grokInvocation(command, platform = process.platform, modelId) {
19988
20136
  const arguments_ = ["agent", "--no-leader"];
@@ -19995,11 +20143,11 @@ function grokInvocation(command, platform = process.platform, modelId) {
19995
20143
 
19996
20144
  // dist/grok-fork.js
19997
20145
  import { isDeepStrictEqual } from "node:util";
19998
- import path6 from "node:path";
20146
+ import path7 from "node:path";
19999
20147
 
20000
20148
  // dist/grok-file-change.js
20001
20149
  import { Buffer as Buffer2 } from "node:buffer";
20002
- import path4 from "node:path";
20150
+ import path5 from "node:path";
20003
20151
 
20004
20152
  // ../../../node_modules/diff/libesm/diff/base.js
20005
20153
  var Diff = class {
@@ -20101,16 +20249,16 @@ var Diff = class {
20101
20249
  }
20102
20250
  }
20103
20251
  }
20104
- addToPath(path11, added, removed, oldPosInc, options) {
20105
- const last = path11.lastComponent;
20252
+ addToPath(path12, added, removed, oldPosInc, options) {
20253
+ const last = path12.lastComponent;
20106
20254
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
20107
20255
  return {
20108
- oldPos: path11.oldPos + oldPosInc,
20256
+ oldPos: path12.oldPos + oldPosInc,
20109
20257
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
20110
20258
  };
20111
20259
  } else {
20112
20260
  return {
20113
- oldPos: path11.oldPos + oldPosInc,
20261
+ oldPos: path12.oldPos + oldPosInc,
20114
20262
  lastComponent: { count: 1, added, removed, previousComponent: last }
20115
20263
  };
20116
20264
  }
@@ -20423,13 +20571,13 @@ function isRecord3(value) {
20423
20571
  return typeof value === "object" && value !== null && !Array.isArray(value);
20424
20572
  }
20425
20573
  function validAbsolutePath(value) {
20426
- 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");
20427
20575
  }
20428
20576
  function displayPath(nativePath, cwd) {
20429
- const resolvedCwd = path4.resolve(cwd);
20430
- const resolvedPath = path4.resolve(nativePath);
20431
- const relative = path4.relative(resolvedCwd, resolvedPath);
20432
- 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}`);
20433
20581
  const selected = inside ? relative : resolvedPath;
20434
20582
  const normalized = selected.replaceAll("\\", "/");
20435
20583
  if (normalized.length === 0 || normalized === ".")
@@ -20491,8 +20639,8 @@ function projectGrokFileChanges(content, cwd, textLimit = DEFAULT_GROK_FILE_CHAN
20491
20639
 
20492
20640
  // dist/local-media-markdown.js
20493
20641
  import { existsSync, statSync } from "node:fs";
20494
- import os2 from "node:os";
20495
- import path5 from "node:path";
20642
+ import os3 from "node:os";
20643
+ import path6 from "node:path";
20496
20644
  var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
20497
20645
  ".aac",
20498
20646
  ".gif",
@@ -20511,14 +20659,14 @@ var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
20511
20659
  ".webp"
20512
20660
  ]);
20513
20661
  function grokMediaResolveRoots(cwd, sessionDirectory) {
20514
- const roots = [path5.resolve(cwd)];
20662
+ const roots = [path6.resolve(cwd)];
20515
20663
  if (sessionDirectory) {
20516
- const session = path5.resolve(sessionDirectory);
20517
- 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"));
20518
20666
  }
20519
- const home = process.env.HOME ?? process.env.USERPROFILE ?? os2.homedir();
20667
+ const home = process.env.HOME ?? process.env.USERPROFILE ?? os3.homedir();
20520
20668
  if (home)
20521
- roots.push(path5.join(home, "Downloads"));
20669
+ roots.push(path6.join(home, "Downloads"));
20522
20670
  return roots;
20523
20671
  }
20524
20672
  function rewriteLocalMediaMarkdown(text, roots, options = {}) {
@@ -20619,7 +20767,7 @@ function parseInlineCode(text, start) {
20619
20767
  return { closed: false, content: text.slice(start + 1), end: text.length };
20620
20768
  }
20621
20769
  function mediaMarkdownImage(absolutePath) {
20622
- const name = path5.basename(absolutePath).replaceAll("]", "\\]");
20770
+ const name = path6.basename(absolutePath).replaceAll("]", "\\]");
20623
20771
  return `![${name}](${formatMarkdownDestination(absolutePath, false)})`;
20624
20772
  }
20625
20773
  function parseMarkdownImage(text, start) {
@@ -20744,11 +20892,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
20744
20892
  if (!hasMediaExtension(stripped))
20745
20893
  return null;
20746
20894
  if (isAbsoluteMediaPath(stripped)) {
20747
- const absolute = path5.resolve(stripped);
20895
+ const absolute = path6.resolve(stripped);
20748
20896
  return exists(absolute) ? absolute : null;
20749
20897
  }
20750
20898
  for (const root of roots) {
20751
- const absolute = path5.resolve(root, stripped);
20899
+ const absolute = path6.resolve(root, stripped);
20752
20900
  if (exists(absolute))
20753
20901
  return absolute;
20754
20902
  }
@@ -20770,11 +20918,11 @@ function stripFileUrl(value) {
20770
20918
  }
20771
20919
  }
20772
20920
  function isAbsoluteMediaPath(value) {
20773
- return path5.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
20921
+ return path6.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
20774
20922
  }
20775
20923
  function hasMediaExtension(value) {
20776
20924
  const pathname = value.split(/[?#]/, 1)[0] ?? value;
20777
- return MEDIA_EXTENSIONS.has(path5.extname(pathname).toLowerCase());
20925
+ return MEDIA_EXTENSIONS.has(path6.extname(pathname).toLowerCase());
20778
20926
  }
20779
20927
  function mediaFileExists(absolutePath) {
20780
20928
  try {
@@ -21490,6 +21638,7 @@ function mapGrokReplay(replay, harnessId, sessionId, cwd, knownTurnRefs = [], to
21490
21638
  const fileItem = {
21491
21639
  type: "fileChange",
21492
21640
  itemId: stableId("file-change", turnIndex, ++messageIndex),
21641
+ sourceItemIds: [tool.itemId],
21493
21642
  changes
21494
21643
  };
21495
21644
  items.push({ item: fileItem, outcome: { status: "succeeded" } });
@@ -21782,11 +21931,11 @@ function parseGrokForkResponse(value) {
21782
21931
  }
21783
21932
  function projectRelativePath(value, cwds) {
21784
21933
  const normalized = value.replaceAll("\\", "/");
21785
- if (!path6.isAbsolute(value))
21934
+ if (!path7.isAbsolute(value))
21786
21935
  return normalized;
21787
21936
  for (const cwd of cwds) {
21788
- const relative = path6.relative(path6.resolve(cwd), path6.resolve(value));
21789
- 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}`)) {
21790
21939
  return relative.replaceAll("\\", "/");
21791
21940
  }
21792
21941
  }
@@ -21851,8 +22000,8 @@ async function forkGrokSession(input) {
21851
22000
  error: error51("sessionNotFound", "Grok Native Session is unavailable")
21852
22001
  };
21853
22002
  }
21854
- const sourceCwd = path6.resolve(located.cwd);
21855
- const targetCwd = path6.resolve(input.cwd);
22003
+ const sourceCwd = path7.resolve(located.cwd);
22004
+ const targetCwd = path7.resolve(input.cwd);
21856
22005
  const source = await readSnapshot({ ...input, cwd: sourceCwd }, sourceRef.data.nativeSessionId);
21857
22006
  if (!source.ok)
21858
22007
  return source;
@@ -22034,7 +22183,7 @@ function parseGrokCompactResult(value, cancelled = false) {
22034
22183
  }
22035
22184
 
22036
22185
  // dist/grok-rewind.js
22037
- import path7 from "node:path";
22186
+ import path8 from "node:path";
22038
22187
  var GROK_REWIND_EXECUTE_METHOD = "_x.ai/rewind/execute";
22039
22188
  function error52(code, message, retryable = false) {
22040
22189
  return { code, message, retryable };
@@ -22107,8 +22256,8 @@ async function rewindGrokLastTurn(input) {
22107
22256
  error: error52("sessionNotFound", "Grok Native Session is unavailable")
22108
22257
  };
22109
22258
  }
22110
- const sourceCwd = path7.resolve(located.cwd);
22111
- const targetCwd = path7.resolve(input.cwd);
22259
+ const sourceCwd = path8.resolve(located.cwd);
22260
+ const targetCwd = path8.resolve(input.cwd);
22112
22261
  if (sourceCwd !== targetCwd) {
22113
22262
  return {
22114
22263
  ok: false,
@@ -22164,6 +22313,12 @@ async function rewindGrokLastTurn(input) {
22164
22313
 
22165
22314
  // dist/grok-plan-review.js
22166
22315
  var GROK_PLAN_DECISION_ID = "plan-decision";
22316
+ var GROK_PLAN_APPROVE_VALUE = "approve";
22317
+ var GROK_PLAN_APPROVE_LABEL = "Approve plan and exit plan mode";
22318
+ var GROK_PLAN_STAY_VALUE = "stay";
22319
+ var GROK_PLAN_STAY_LABEL = "Stay in plan mode";
22320
+ var GROK_PLAN_OUTCOME_APPROVED = "approved";
22321
+ var GROK_PLAN_OUTCOME_CANCELLED = "cancelled";
22167
22322
  function isRecord10(value) {
22168
22323
  return typeof value === "object" && value !== null && !Array.isArray(value);
22169
22324
  }
@@ -22202,19 +22357,23 @@ function createGrokPlanReview(request, interactionId, turnId) {
22202
22357
  prompt: request.plan ? `${warning}
22203
22358
 
22204
22359
  ${request.plan}` : "Grok did not provide plan text. Stay in plan mode and ask Grok to present the plan before approving it.",
22205
- options: [
22360
+ options: request.plan ? [
22206
22361
  {
22207
- value: "stay",
22208
- label: "Stay in plan mode",
22209
- description: "Do not approve the plan or begin implementation."
22362
+ value: GROK_PLAN_APPROVE_VALUE,
22363
+ label: GROK_PLAN_APPROVE_LABEL,
22364
+ description: "Leave plan mode and begin implementation."
22210
22365
  },
22211
- ...request.plan ? [
22212
- {
22213
- value: "approve",
22214
- label: "Approve plan and exit plan mode",
22215
- description: "Leave plan mode and begin implementation."
22216
- }
22217
- ] : []
22366
+ {
22367
+ value: GROK_PLAN_STAY_VALUE,
22368
+ label: GROK_PLAN_STAY_LABEL,
22369
+ description: "Do not approve the plan or begin implementation."
22370
+ }
22371
+ ] : [
22372
+ {
22373
+ value: GROK_PLAN_STAY_VALUE,
22374
+ label: GROK_PLAN_STAY_LABEL,
22375
+ description: "Do not approve the plan or begin implementation."
22376
+ }
22218
22377
  ],
22219
22378
  multiple: false,
22220
22379
  allowOther: false,
@@ -22224,12 +22383,13 @@ ${request.plan}` : "Grok did not provide plan text. Stay in plan mode and ask Gr
22224
22383
  };
22225
22384
  }
22226
22385
  function grokPlanRejectedResponse() {
22227
- return { approved: false, feedback: "" };
22386
+ return { outcome: GROK_PLAN_OUTCOME_CANCELLED };
22228
22387
  }
22229
22388
  function grokExitPlanModeResponse(request, response) {
22389
+ const decision = response.answers[GROK_PLAN_DECISION_ID]?.[0];
22390
+ const approved = !response.cancelled && request.plan !== null && (decision === GROK_PLAN_APPROVE_VALUE || decision === GROK_PLAN_APPROVE_LABEL);
22230
22391
  return {
22231
- approved: !response.cancelled && request.plan !== null && response.answers[GROK_PLAN_DECISION_ID]?.[0] === "approve",
22232
- feedback: ""
22392
+ outcome: approved ? GROK_PLAN_OUTCOME_APPROVED : GROK_PLAN_OUTCOME_CANCELLED
22233
22393
  };
22234
22394
  }
22235
22395
 
@@ -22577,21 +22737,21 @@ function transportEvent(update, metadata) {
22577
22737
  }
22578
22738
  function grokHomeDir(options) {
22579
22739
  const environment = { ...process.env, ...options.environment };
22580
- const home = environment.HOME ?? environment.USERPROFILE ?? os3.homedir();
22581
- 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");
22582
22742
  }
22583
22743
  function grokNativeSessionDirectory(options, sessionId) {
22584
- 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);
22585
22745
  }
22586
22746
  function nativeSessionFile(options, sessionId, fileName) {
22587
- return path8.join(grokNativeSessionDirectory(options, sessionId), fileName);
22747
+ return path9.join(grokNativeSessionDirectory(options, sessionId), fileName);
22588
22748
  }
22589
22749
  function nativeHistoryPath(options, sessionId) {
22590
22750
  return nativeSessionFile(options, sessionId, "updates.jsonl");
22591
22751
  }
22592
22752
  async function readNativeSignals(options, sessionId) {
22593
22753
  try {
22594
- return JSON.parse(await readFile(nativeSessionFile(options, sessionId, "signals.json"), "utf8"));
22754
+ return JSON.parse(await readFile2(nativeSessionFile(options, sessionId, "signals.json"), "utf8"));
22595
22755
  } catch {
22596
22756
  return void 0;
22597
22757
  }
@@ -22604,7 +22764,7 @@ async function locateGrokNativeSession(options, sessionId) {
22604
22764
  return null;
22605
22765
  let entries;
22606
22766
  try {
22607
- entries = await readdir(path8.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
22767
+ entries = await readdir(path9.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
22608
22768
  } catch (error53) {
22609
22769
  if (isMissingFile(error53))
22610
22770
  return null;
@@ -22618,7 +22778,7 @@ async function locateGrokNativeSession(options, sessionId) {
22618
22778
  continue;
22619
22779
  let summaryRaw;
22620
22780
  try {
22621
- 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");
22622
22782
  } catch (error53) {
22623
22783
  if (isMissingFile(error53) || isRecord12(error53) && error53.code === "ENOTDIR")
22624
22784
  continue;
@@ -22635,8 +22795,8 @@ async function locateGrokNativeSession(options, sessionId) {
22635
22795
  if (!isRecord12(parsed))
22636
22796
  continue;
22637
22797
  const info = parsed.info;
22638
- const cwd = isRecord12(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path8.resolve(info.cwd) : path8.resolve(decodeURIComponent(entry.name));
22639
- 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;
22640
22800
  matches.push({
22641
22801
  cwd,
22642
22802
  ...sourceWorkspaceDir ? { sourceWorkspaceDir } : {}
@@ -22646,7 +22806,7 @@ async function locateGrokNativeSession(options, sessionId) {
22646
22806
  }
22647
22807
  async function readGrokNativeHistory(options, sessionId) {
22648
22808
  try {
22649
- 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);
22650
22810
  } catch (error53) {
22651
22811
  if (isMissingFile(error53))
22652
22812
  return [];
@@ -23353,9 +23513,9 @@ function stateForGrokModel(modelState, nativeState, model = modelState.currentMo
23353
23513
  }
23354
23514
 
23355
23515
  // dist/grok-credits.js
23356
- import { readFile as readFile2 } from "node:fs/promises";
23357
- import os4 from "node:os";
23358
- 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";
23359
23519
  var GROK_CREDITS_ENDPOINT = "https://cli-chat-proxy.grok.com/v1/billing?format=credits";
23360
23520
  var REQUEST_TIMEOUT_MS = 15e3;
23361
23521
  function isRecord14(value) {
@@ -23375,7 +23535,7 @@ function nonNegativeCentValue(value) {
23375
23535
  return amount;
23376
23536
  }
23377
23537
  function grokHome(environment) {
23378
- 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");
23379
23539
  }
23380
23540
  function periodTypeFrom(value) {
23381
23541
  if (typeof value !== "string")
@@ -23454,8 +23614,8 @@ async function fetchGrokAccount(input = {}) {
23454
23614
  if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((value) => value?.trim()))
23455
23615
  return null;
23456
23616
  const now = input.now ?? /* @__PURE__ */ new Date();
23457
- const authPath = path9.join(grokHome(environment), "auth.json");
23458
- 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");
23459
23619
  const token = selectAccessToken(JSON.parse(raw), now);
23460
23620
  if (!token)
23461
23621
  return null;
@@ -24059,7 +24219,7 @@ var GrokHarnessSession = class {
24059
24219
  return this.#configure(model, parsed.data);
24060
24220
  }
24061
24221
  async #configure(model, thinkingOptionId) {
24062
- if (this.#active || this.#configuring) {
24222
+ if (this.#configuring) {
24063
24223
  return {
24064
24224
  ok: false,
24065
24225
  error: {
@@ -24545,6 +24705,7 @@ var GrokHarnessSession = class {
24545
24705
  const fileItem = {
24546
24706
  type: "fileChange",
24547
24707
  itemId: hostItemIdSchema.parse(this.#randomUUID()),
24708
+ sourceItemIds: [tool.item.itemId],
24548
24709
  changes
24549
24710
  };
24550
24711
  this.#event({ type: "item.started", turnId: active.command.turnId, item: fileItem });
@@ -24734,6 +24895,9 @@ var GrokHarnessSession = class {
24734
24895
  }
24735
24896
  };
24736
24897
  var GrokAdapter = class {
24898
+ credentialExport = {
24899
+ read: () => this.#closePromise ? Promise.resolve([]) : readGrokCredentials(this.#environment ?? process.env)
24900
+ };
24737
24901
  commandCatalog = grokCommandCatalog;
24738
24902
  harnessId = grokHarnessId;
24739
24903
  subagents = {
@@ -24832,7 +24996,7 @@ var GrokAdapter = class {
24832
24996
  async inspect(input = {}) {
24833
24997
  if (this.#closePromise)
24834
24998
  return { status: "unavailable", error: invalidState("Grok Adapter is closed") };
24835
- const cwd = path10.resolve(input.cwd ?? process.cwd());
24999
+ const cwd = path11.resolve(input.cwd ?? process.cwd());
24836
25000
  if (!input.refresh) {
24837
25001
  const cached2 = this.#inspectionCache.get(cwd);
24838
25002
  if (cached2)
@@ -24894,7 +25058,7 @@ var GrokAdapter = class {
24894
25058
  }
24895
25059
  };
24896
25060
  }
24897
- const cwd = path10.resolve(input.cwd);
25061
+ const cwd = path11.resolve(input.cwd);
24898
25062
  const parsedRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
24899
25063
  if (parsedRef && (!parsedRef.success || parsedRef.data.harnessId !== this.harnessId)) {
24900
25064
  return {