@codexhost/cli-darwin-x64 0.10.2 → 0.11.0
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 +1 -1
- package/THIRD_PARTY_NOTICES.txt +4 -0
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +17959 -0
- package/app/console-web.js +25950 -0
- package/app/desktop-controller.mjs +154 -14
- package/app/host-runtime.mjs +3176 -1070
- package/app/plugins/antigravity/plugin.mjs +345 -72
- package/app/plugins/claude-code/plugin.mjs +2153 -1465
- package/app/plugins/codebuddy/plugin.mjs +426 -93
- package/app/plugins/cursor-cli/manifest.json +1 -1
- package/app/plugins/cursor-cli/plugin.mjs +1134 -495
- package/app/plugins/deepseek-harness/plugin.mjs +604 -36
- package/app/plugins/grok/plugin.mjs +290 -78
- package/app/plugins/hermes/plugin.mjs +311 -85
- package/app/plugins/kimi-code/plugin.mjs +659 -74
- package/app/plugins/kiro-cli/plugin.mjs +227 -55
- package/app/plugins/omp/plugin.mjs +300 -45
- package/app/plugins/opencode/plugin.mjs +3600 -206
- package/app/plugins/pi/plugin.mjs +897 -275
- package/app/plugins/qoder/plugin.mjs +397 -46
- package/app/plugins/qoder-cn/plugin.mjs +404 -47
- package/app/plugins/workbuddy/plugin.mjs +116 -6
- package/app/renderer-extension.js +2303 -1200
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/licenses/OpenCode-v2-Client-LICENSE.txt +21 -0
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ async function readGrokCredentials(environment) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// dist/grok-adapter.js
|
|
48
|
-
import
|
|
48
|
+
import path12 from "node:path";
|
|
49
49
|
|
|
50
50
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
51
51
|
var external_exports = {};
|
|
@@ -813,10 +813,10 @@ function mergeDefs(...defs) {
|
|
|
813
813
|
function cloneDef(schema) {
|
|
814
814
|
return mergeDefs(schema._zod.def);
|
|
815
815
|
}
|
|
816
|
-
function getElementAtPath(obj,
|
|
817
|
-
if (!
|
|
816
|
+
function getElementAtPath(obj, path13) {
|
|
817
|
+
if (!path13)
|
|
818
818
|
return obj;
|
|
819
|
-
return
|
|
819
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
820
820
|
}
|
|
821
821
|
function promiseAllObject(promisesObj) {
|
|
822
822
|
const keys = Object.keys(promisesObj);
|
|
@@ -1225,11 +1225,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
return false;
|
|
1227
1227
|
}
|
|
1228
|
-
function prefixIssues(
|
|
1228
|
+
function prefixIssues(path13, issues) {
|
|
1229
1229
|
return issues.map((iss) => {
|
|
1230
1230
|
var _a3;
|
|
1231
1231
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1232
|
-
iss.path.unshift(
|
|
1232
|
+
iss.path.unshift(path13);
|
|
1233
1233
|
return iss;
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
@@ -1376,16 +1376,16 @@ function flattenError(error53, mapper = (issue2) => issue2.message) {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
function formatError(error53, mapper = (issue2) => issue2.message) {
|
|
1378
1378
|
const fieldErrors = { _errors: [] };
|
|
1379
|
-
const processError = (error54,
|
|
1379
|
+
const processError = (error54, path13 = []) => {
|
|
1380
1380
|
for (const issue2 of error54.issues) {
|
|
1381
1381
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1382
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1382
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
1383
1383
|
} else if (issue2.code === "invalid_key") {
|
|
1384
|
-
processError({ issues: issue2.issues }, [...
|
|
1384
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1385
1385
|
} else if (issue2.code === "invalid_element") {
|
|
1386
|
-
processError({ issues: issue2.issues }, [...
|
|
1386
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1387
1387
|
} else {
|
|
1388
|
-
const fullpath = [...
|
|
1388
|
+
const fullpath = [...path13, ...issue2.path];
|
|
1389
1389
|
if (fullpath.length === 0) {
|
|
1390
1390
|
fieldErrors._errors.push(mapper(issue2));
|
|
1391
1391
|
} else {
|
|
@@ -1412,17 +1412,17 @@ function formatError(error53, mapper = (issue2) => issue2.message) {
|
|
|
1412
1412
|
}
|
|
1413
1413
|
function treeifyError(error53, mapper = (issue2) => issue2.message) {
|
|
1414
1414
|
const result = { errors: [] };
|
|
1415
|
-
const processError = (error54,
|
|
1415
|
+
const processError = (error54, path13 = []) => {
|
|
1416
1416
|
var _a3, _b;
|
|
1417
1417
|
for (const issue2 of error54.issues) {
|
|
1418
1418
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1419
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1419
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
1420
1420
|
} else if (issue2.code === "invalid_key") {
|
|
1421
|
-
processError({ issues: issue2.issues }, [...
|
|
1421
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1422
1422
|
} else if (issue2.code === "invalid_element") {
|
|
1423
|
-
processError({ issues: issue2.issues }, [...
|
|
1423
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
1424
1424
|
} else {
|
|
1425
|
-
const fullpath = [...
|
|
1425
|
+
const fullpath = [...path13, ...issue2.path];
|
|
1426
1426
|
if (fullpath.length === 0) {
|
|
1427
1427
|
result.errors.push(mapper(issue2));
|
|
1428
1428
|
continue;
|
|
@@ -1454,8 +1454,8 @@ function treeifyError(error53, mapper = (issue2) => issue2.message) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
function toDotPath(_path) {
|
|
1456
1456
|
const segs = [];
|
|
1457
|
-
const
|
|
1458
|
-
for (const seg of
|
|
1457
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1458
|
+
for (const seg of path13) {
|
|
1459
1459
|
if (typeof seg === "number")
|
|
1460
1460
|
segs.push(`[${seg}]`);
|
|
1461
1461
|
else if (typeof seg === "symbol")
|
|
@@ -14147,13 +14147,13 @@ function resolveRef(ref, ctx) {
|
|
|
14147
14147
|
if (!ref.startsWith("#")) {
|
|
14148
14148
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14149
14149
|
}
|
|
14150
|
-
const
|
|
14151
|
-
if (
|
|
14150
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
14151
|
+
if (path13.length === 0) {
|
|
14152
14152
|
return ctx.rootSchema;
|
|
14153
14153
|
}
|
|
14154
14154
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14155
|
-
if (
|
|
14156
|
-
const key =
|
|
14155
|
+
if (path13[0] === defsKey) {
|
|
14156
|
+
const key = path13[1];
|
|
14157
14157
|
if (!key || !ctx.defs[key]) {
|
|
14158
14158
|
throw new Error(`Reference not found: ${ref}`);
|
|
14159
14159
|
}
|
|
@@ -14616,6 +14616,55 @@ var credentialImportsParamsSchema = external_exports.object({
|
|
|
14616
14616
|
request: credentialImportsRequestSchema
|
|
14617
14617
|
}).strict();
|
|
14618
14618
|
|
|
14619
|
+
// ../../shared-contracts/dist/harness-display-settings.js
|
|
14620
|
+
var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
|
|
14621
|
+
agent: external_exports.string().min(1).max(128),
|
|
14622
|
+
section: external_exports.enum(["main", "more", "auto"])
|
|
14623
|
+
})).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
|
|
14624
|
+
var harnessDisplaySettingsSchema = external_exports.strictObject({
|
|
14625
|
+
entries: harnessDisplayEntriesSchema.nullable()
|
|
14626
|
+
});
|
|
14627
|
+
var harnessDisplayGetSchema = external_exports.strictObject({});
|
|
14628
|
+
var harnessDisplaySetSchema = external_exports.strictObject({
|
|
14629
|
+
entries: harnessDisplayEntriesSchema,
|
|
14630
|
+
/** Import legacy Desktop preferences only if no shared settings exist yet. */
|
|
14631
|
+
initializeOnly: external_exports.boolean().optional()
|
|
14632
|
+
});
|
|
14633
|
+
|
|
14634
|
+
// ../../shared-contracts/dist/console.js
|
|
14635
|
+
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14636
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
14637
|
+
type: external_exports.enum(["info", "warning", "danger"]),
|
|
14638
|
+
body: external_exports.string().trim().min(1).max(16 * 1024)
|
|
14639
|
+
});
|
|
14640
|
+
var consoleOpenParamsSchema = external_exports.strictObject({});
|
|
14641
|
+
var consoleOpenResultSchema = external_exports.strictObject({
|
|
14642
|
+
/** The console address. */
|
|
14643
|
+
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
14644
|
+
});
|
|
14645
|
+
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
14646
|
+
"codexhost/harness/plugins/list",
|
|
14647
|
+
"codexhost/harness/display-settings/get",
|
|
14648
|
+
"codexhost/harness/display-settings/set",
|
|
14649
|
+
"codexhost/harness/inspect",
|
|
14650
|
+
"codexhost/harness/launch-settings/get",
|
|
14651
|
+
"codexhost/harness/launch-settings/set",
|
|
14652
|
+
"codexhost/harness/web-ui/open",
|
|
14653
|
+
"codexhost/harness/accounts/sources",
|
|
14654
|
+
"codexhost/harness/accounts/list",
|
|
14655
|
+
"codexhost/harness/accounts/inspect",
|
|
14656
|
+
"codexhost/harness/credential-imports",
|
|
14657
|
+
"codexhost/harness/session-import/sources",
|
|
14658
|
+
"codexhost/harness/session-import/list",
|
|
14659
|
+
"codexhost/harness/session-import/import",
|
|
14660
|
+
"codexhost/account/list",
|
|
14661
|
+
"codexhost/account/refresh",
|
|
14662
|
+
"codexhost/account/usage/inspect",
|
|
14663
|
+
"codexhost/update/check",
|
|
14664
|
+
"codexhost/update/start",
|
|
14665
|
+
"codexhost/update/status"
|
|
14666
|
+
]);
|
|
14667
|
+
|
|
14619
14668
|
// ../../shared-contracts/dist/version.js
|
|
14620
14669
|
var WORKSPACE_CONTRACT_VERSION = 1;
|
|
14621
14670
|
|
|
@@ -14669,6 +14718,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
14669
14718
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14670
14719
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14671
14720
|
|
|
14721
|
+
// ../../shared-contracts/dist/manual-compaction.js
|
|
14722
|
+
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
14723
|
+
threadId: hostThreadIdSchema,
|
|
14724
|
+
turnId: hostTurnIdSchema
|
|
14725
|
+
});
|
|
14726
|
+
|
|
14672
14727
|
// ../../shared-contracts/dist/thread-usage.js
|
|
14673
14728
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14674
14729
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -14729,6 +14784,10 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
14729
14784
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14730
14785
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
14731
14786
|
product: external_exports.string().min(1),
|
|
14787
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
14788
|
+
// Zero is a real empty cap, not an absent field.
|
|
14789
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
14790
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
14732
14791
|
usagePercent: usagePercentSchema,
|
|
14733
14792
|
resetsAt: external_exports.string().min(1).optional()
|
|
14734
14793
|
}).strict();
|
|
@@ -14738,6 +14797,10 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
14738
14797
|
expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
|
|
14739
14798
|
}).strict();
|
|
14740
14799
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
14800
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
14801
|
+
// Zero is a real empty cap, not an absent field.
|
|
14802
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
14803
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
14741
14804
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14742
14805
|
label: external_exports.string().min(1).optional(),
|
|
14743
14806
|
usedPercent: usagePercentSchema,
|
|
@@ -14757,12 +14820,27 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
14757
14820
|
}).strict();
|
|
14758
14821
|
|
|
14759
14822
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
14760
|
-
var
|
|
14823
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
14824
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
14825
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
14826
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
14827
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
14828
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
14829
|
+
}).strict();
|
|
14830
|
+
var harnessAccountSnapshotObject = external_exports.object({
|
|
14761
14831
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
14762
14832
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
14763
14833
|
plan: external_exports.string().trim().min(1).max(128).optional(),
|
|
14764
|
-
credits: accountCreditsSnapshotSchema
|
|
14834
|
+
credits: accountCreditsSnapshotSchema.optional(),
|
|
14835
|
+
balance: accountBalanceSnapshotSchema.optional()
|
|
14765
14836
|
}).strict();
|
|
14837
|
+
function requireReportedQuota(schema) {
|
|
14838
|
+
return schema.refine((value) => {
|
|
14839
|
+
const reported = value;
|
|
14840
|
+
return reported.credits !== void 0 || reported.balance !== void 0;
|
|
14841
|
+
}, { message: "Account must report either credits or a balance" });
|
|
14842
|
+
}
|
|
14843
|
+
var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
|
|
14766
14844
|
var harnessAccountIdentityShape = {
|
|
14767
14845
|
harnessId: harnessIdSchema,
|
|
14768
14846
|
harnessName: external_exports.string().trim().min(1).max(128)
|
|
@@ -14773,11 +14851,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
|
|
|
14773
14851
|
var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
14774
14852
|
var harnessAccountInspectResultSchema = external_exports.object({
|
|
14775
14853
|
...harnessAccountIdentityShape,
|
|
14776
|
-
account: harnessAccountSnapshotSchema.nullable()
|
|
14854
|
+
account: harnessAccountSnapshotSchema.nullable(),
|
|
14855
|
+
/** Every Billing Source from one Harness; `account` remains the first for older clients. */
|
|
14856
|
+
accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
|
|
14777
14857
|
}).strict();
|
|
14778
14858
|
var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
|
|
14779
14859
|
var harnessAccountListResultSchema = external_exports.object({
|
|
14780
|
-
accounts: external_exports.array(
|
|
14860
|
+
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
14781
14861
|
}).strict();
|
|
14782
14862
|
|
|
14783
14863
|
// ../../shared-contracts/dist/json-value.js
|
|
@@ -14915,6 +14995,8 @@ var harnessModelSchema = external_exports.object({
|
|
|
14915
14995
|
ref: harnessModelRefSchema,
|
|
14916
14996
|
label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
14917
14997
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
14998
|
+
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
14999
|
+
fastModel: harnessModelRefSchema.optional(),
|
|
14918
15000
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
14919
15001
|
}).strict();
|
|
14920
15002
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
@@ -14947,6 +15029,16 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
14947
15029
|
});
|
|
14948
15030
|
}
|
|
14949
15031
|
refs.add(model.ref.id);
|
|
15032
|
+
if (model.fastModel) {
|
|
15033
|
+
if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
|
|
15034
|
+
context.addIssue({
|
|
15035
|
+
code: "custom",
|
|
15036
|
+
message: "Fast Model refs must be distinct and unique",
|
|
15037
|
+
path: ["models", index, "fastModel"]
|
|
15038
|
+
});
|
|
15039
|
+
}
|
|
15040
|
+
refs.add(model.fastModel.id);
|
|
15041
|
+
}
|
|
14950
15042
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
14951
15043
|
for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
|
|
14952
15044
|
if (supportedThinkingIds.has(optionId)) {
|
|
@@ -15066,11 +15158,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
|
|
|
15066
15158
|
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15067
15159
|
}).strict();
|
|
15068
15160
|
var threadInspectionParamsSchema = external_exports.object({
|
|
15069
|
-
threadId: hostThreadIdSchema
|
|
15161
|
+
threadId: hostThreadIdSchema,
|
|
15162
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15070
15163
|
}).strict();
|
|
15071
15164
|
var codexThreadInspectionSchema = external_exports.object({
|
|
15072
15165
|
owner: external_exports.literal("codex"),
|
|
15073
|
-
locked: external_exports.literal(true)
|
|
15166
|
+
locked: external_exports.literal(true),
|
|
15167
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15074
15168
|
}).strict();
|
|
15075
15169
|
var externalThreadInspectionSchema = external_exports.object({
|
|
15076
15170
|
owner: external_exports.literal("external"),
|
|
@@ -15196,6 +15290,19 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15196
15290
|
restartRequired: external_exports.boolean()
|
|
15197
15291
|
}).strict();
|
|
15198
15292
|
|
|
15293
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
15294
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
15295
|
+
harnessId: harnessIdSchema,
|
|
15296
|
+
action: external_exports.enum(["check", "update"])
|
|
15297
|
+
}).strict();
|
|
15298
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
15299
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
15300
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
15301
|
+
updateAvailable: external_exports.boolean(),
|
|
15302
|
+
canUpdate: external_exports.boolean(),
|
|
15303
|
+
message: external_exports.string().max(2048).optional()
|
|
15304
|
+
}).strict();
|
|
15305
|
+
|
|
15199
15306
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15200
15307
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
15201
15308
|
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
@@ -15776,7 +15883,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
|
15776
15883
|
import { spawn, spawnSync } from "node:child_process";
|
|
15777
15884
|
import { readdir, readFile as readFile2 } from "node:fs/promises";
|
|
15778
15885
|
import os4 from "node:os";
|
|
15779
|
-
import
|
|
15886
|
+
import path10 from "node:path";
|
|
15780
15887
|
import { Readable, Writable } from "node:stream";
|
|
15781
15888
|
|
|
15782
15889
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -19964,8 +20071,8 @@ function parseGrokAvailableCommands(value) {
|
|
|
19964
20071
|
});
|
|
19965
20072
|
}
|
|
19966
20073
|
function isGrokSkill(command) {
|
|
19967
|
-
const
|
|
19968
|
-
return typeof
|
|
20074
|
+
const path13 = command.meta?.path;
|
|
20075
|
+
return typeof path13 === "string" && /(^|[\\/])SKILL\.md$/u.test(path13) || typeof command.meta?.qualifiedName === "string";
|
|
19969
20076
|
}
|
|
19970
20077
|
function grokLiveCommands(native) {
|
|
19971
20078
|
return native.map((command) => ({
|
|
@@ -19976,7 +20083,7 @@ function grokLiveCommands(native) {
|
|
|
19976
20083
|
}
|
|
19977
20084
|
|
|
19978
20085
|
// dist/command.js
|
|
19979
|
-
import
|
|
20086
|
+
import path5 from "node:path";
|
|
19980
20087
|
|
|
19981
20088
|
// ../../harness-discovery/dist/environment.js
|
|
19982
20089
|
import fs from "node:fs";
|
|
@@ -20040,6 +20147,20 @@ function commandInvocation(command, arguments_, environment, platform = process.
|
|
|
20040
20147
|
};
|
|
20041
20148
|
}
|
|
20042
20149
|
|
|
20150
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
20151
|
+
import path4 from "node:path";
|
|
20152
|
+
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
20153
|
+
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
20154
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
20155
|
+
const runtimeDirectory = path4.dirname(runtimeExecutable);
|
|
20156
|
+
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
20157
|
+
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
20158
|
+
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
20159
|
+
directories.push(runtimeDirectory);
|
|
20160
|
+
}
|
|
20161
|
+
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
20162
|
+
}
|
|
20163
|
+
|
|
20043
20164
|
// ../../harness-discovery/dist/resolve.js
|
|
20044
20165
|
import os2 from "node:os";
|
|
20045
20166
|
|
|
@@ -20203,6 +20324,65 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
|
20203
20324
|
return void 0;
|
|
20204
20325
|
}
|
|
20205
20326
|
|
|
20327
|
+
// ../../harness-discovery/dist/installation.js
|
|
20328
|
+
import { execFile } from "node:child_process";
|
|
20329
|
+
import { homedir } from "node:os";
|
|
20330
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
20331
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
20332
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
20333
|
+
return new Promise((resolve, reject) => {
|
|
20334
|
+
const child = execFile(invocation.command, invocation.arguments, {
|
|
20335
|
+
env,
|
|
20336
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
20337
|
+
encoding: "utf8",
|
|
20338
|
+
timeout,
|
|
20339
|
+
killSignal: "SIGKILL",
|
|
20340
|
+
maxBuffer: 1024 * 1024,
|
|
20341
|
+
windowsHide: true,
|
|
20342
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
20343
|
+
}, (error53, stdout, stderr) => {
|
|
20344
|
+
if (error53)
|
|
20345
|
+
reject(new Error(error53.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
20346
|
+
else
|
|
20347
|
+
resolve((stdout || stderr).trim());
|
|
20348
|
+
});
|
|
20349
|
+
child.stdin?.end();
|
|
20350
|
+
});
|
|
20351
|
+
}
|
|
20352
|
+
function installationVersion(value) {
|
|
20353
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
20354
|
+
throw new Error("Harness returned an invalid version");
|
|
20355
|
+
return value.trim().replace(/^v/, "");
|
|
20356
|
+
}
|
|
20357
|
+
function createInstallationManager(options) {
|
|
20358
|
+
let checking;
|
|
20359
|
+
let updating;
|
|
20360
|
+
const check2 = () => checking ??= options.check().finally(() => {
|
|
20361
|
+
checking = void 0;
|
|
20362
|
+
});
|
|
20363
|
+
return (action) => {
|
|
20364
|
+
if (updating)
|
|
20365
|
+
return updating;
|
|
20366
|
+
if (action === "check")
|
|
20367
|
+
return check2();
|
|
20368
|
+
updating = (async () => {
|
|
20369
|
+
const before = await check2();
|
|
20370
|
+
if (!before.updateAvailable)
|
|
20371
|
+
return before;
|
|
20372
|
+
if (!before.canUpdate)
|
|
20373
|
+
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
20374
|
+
await options.update(before);
|
|
20375
|
+
const after = await check2();
|
|
20376
|
+
if (after.currentVersion === before.currentVersion)
|
|
20377
|
+
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
20378
|
+
return after;
|
|
20379
|
+
})().finally(() => {
|
|
20380
|
+
updating = void 0;
|
|
20381
|
+
});
|
|
20382
|
+
return updating;
|
|
20383
|
+
};
|
|
20384
|
+
}
|
|
20385
|
+
|
|
20206
20386
|
// dist/command.js
|
|
20207
20387
|
var GrokExecutableError = class extends Error {
|
|
20208
20388
|
code = "GROK_NOT_FOUND";
|
|
@@ -20232,7 +20412,7 @@ function resolveGrokExecutable(input = {}) {
|
|
|
20232
20412
|
});
|
|
20233
20413
|
if (!resolution)
|
|
20234
20414
|
throw new GrokExecutableError("Grok CLI is not installed");
|
|
20235
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
20415
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path5.resolve(resolution.executable);
|
|
20236
20416
|
}
|
|
20237
20417
|
function grokInvocation(command, platform = process.platform, modelId) {
|
|
20238
20418
|
const arguments_ = ["agent", "--no-leader"];
|
|
@@ -20245,11 +20425,11 @@ function grokInvocation(command, platform = process.platform, modelId) {
|
|
|
20245
20425
|
|
|
20246
20426
|
// dist/grok-fork.js
|
|
20247
20427
|
import { isDeepStrictEqual } from "node:util";
|
|
20248
|
-
import
|
|
20428
|
+
import path8 from "node:path";
|
|
20249
20429
|
|
|
20250
20430
|
// dist/grok-file-change.js
|
|
20251
20431
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
20252
|
-
import
|
|
20432
|
+
import path6 from "node:path";
|
|
20253
20433
|
|
|
20254
20434
|
// ../../../node_modules/diff/libesm/diff/base.js
|
|
20255
20435
|
var Diff = class {
|
|
@@ -20351,16 +20531,16 @@ var Diff = class {
|
|
|
20351
20531
|
}
|
|
20352
20532
|
}
|
|
20353
20533
|
}
|
|
20354
|
-
addToPath(
|
|
20355
|
-
const last =
|
|
20534
|
+
addToPath(path13, added, removed, oldPosInc, options) {
|
|
20535
|
+
const last = path13.lastComponent;
|
|
20356
20536
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
20357
20537
|
return {
|
|
20358
|
-
oldPos:
|
|
20538
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
20359
20539
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
20360
20540
|
};
|
|
20361
20541
|
} else {
|
|
20362
20542
|
return {
|
|
20363
|
-
oldPos:
|
|
20543
|
+
oldPos: path13.oldPos + oldPosInc,
|
|
20364
20544
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
20365
20545
|
};
|
|
20366
20546
|
}
|
|
@@ -20673,13 +20853,13 @@ function isRecord4(value) {
|
|
|
20673
20853
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20674
20854
|
}
|
|
20675
20855
|
function validAbsolutePath(value) {
|
|
20676
|
-
return typeof value === "string" &&
|
|
20856
|
+
return typeof value === "string" && path6.isAbsolute(value) && value.trim().length > 0 && !value.includes("\0") && !value.includes("\n") && !value.includes("\r");
|
|
20677
20857
|
}
|
|
20678
20858
|
function displayPath(nativePath, cwd) {
|
|
20679
|
-
const resolvedCwd =
|
|
20680
|
-
const resolvedPath =
|
|
20681
|
-
const relative =
|
|
20682
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
20859
|
+
const resolvedCwd = path6.resolve(cwd);
|
|
20860
|
+
const resolvedPath = path6.resolve(nativePath);
|
|
20861
|
+
const relative = path6.relative(resolvedCwd, resolvedPath);
|
|
20862
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path6.sep}`);
|
|
20683
20863
|
const selected = inside ? relative : resolvedPath;
|
|
20684
20864
|
const normalized = selected.replaceAll("\\", "/");
|
|
20685
20865
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -20742,7 +20922,7 @@ function projectGrokFileChanges(content, cwd, textLimit = DEFAULT_GROK_FILE_CHAN
|
|
|
20742
20922
|
// dist/local-media-markdown.js
|
|
20743
20923
|
import { existsSync, statSync } from "node:fs";
|
|
20744
20924
|
import os3 from "node:os";
|
|
20745
|
-
import
|
|
20925
|
+
import path7 from "node:path";
|
|
20746
20926
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
20747
20927
|
".aac",
|
|
20748
20928
|
".gif",
|
|
@@ -20761,14 +20941,14 @@ var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
20761
20941
|
".webp"
|
|
20762
20942
|
]);
|
|
20763
20943
|
function grokMediaResolveRoots(cwd, sessionDirectory) {
|
|
20764
|
-
const roots = [
|
|
20944
|
+
const roots = [path7.resolve(cwd)];
|
|
20765
20945
|
if (sessionDirectory) {
|
|
20766
|
-
const session =
|
|
20767
|
-
roots.push(session,
|
|
20946
|
+
const session = path7.resolve(sessionDirectory);
|
|
20947
|
+
roots.push(session, path7.join(session, "videos"), path7.join(session, "images"));
|
|
20768
20948
|
}
|
|
20769
20949
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? os3.homedir();
|
|
20770
20950
|
if (home)
|
|
20771
|
-
roots.push(
|
|
20951
|
+
roots.push(path7.join(home, "Downloads"));
|
|
20772
20952
|
return roots;
|
|
20773
20953
|
}
|
|
20774
20954
|
function rewriteLocalMediaMarkdown(text, roots, options = {}) {
|
|
@@ -20869,7 +21049,7 @@ function parseInlineCode(text, start) {
|
|
|
20869
21049
|
return { closed: false, content: text.slice(start + 1), end: text.length };
|
|
20870
21050
|
}
|
|
20871
21051
|
function mediaMarkdownImage(absolutePath) {
|
|
20872
|
-
const name =
|
|
21052
|
+
const name = path7.basename(absolutePath).replaceAll("]", "\\]");
|
|
20873
21053
|
return `})`;
|
|
20874
21054
|
}
|
|
20875
21055
|
function parseMarkdownImage(text, start) {
|
|
@@ -20994,11 +21174,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
20994
21174
|
if (!hasMediaExtension(stripped))
|
|
20995
21175
|
return null;
|
|
20996
21176
|
if (isAbsoluteMediaPath(stripped)) {
|
|
20997
|
-
const absolute =
|
|
21177
|
+
const absolute = path7.resolve(stripped);
|
|
20998
21178
|
return exists(absolute) ? absolute : null;
|
|
20999
21179
|
}
|
|
21000
21180
|
for (const root of roots) {
|
|
21001
|
-
const absolute =
|
|
21181
|
+
const absolute = path7.resolve(root, stripped);
|
|
21002
21182
|
if (exists(absolute))
|
|
21003
21183
|
return absolute;
|
|
21004
21184
|
}
|
|
@@ -21020,11 +21200,11 @@ function stripFileUrl(value) {
|
|
|
21020
21200
|
}
|
|
21021
21201
|
}
|
|
21022
21202
|
function isAbsoluteMediaPath(value) {
|
|
21023
|
-
return
|
|
21203
|
+
return path7.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
21024
21204
|
}
|
|
21025
21205
|
function hasMediaExtension(value) {
|
|
21026
21206
|
const pathname = value.split(/[?#]/, 1)[0] ?? value;
|
|
21027
|
-
return MEDIA_EXTENSIONS.has(
|
|
21207
|
+
return MEDIA_EXTENSIONS.has(path7.extname(pathname).toLowerCase());
|
|
21028
21208
|
}
|
|
21029
21209
|
function mediaFileExists(absolutePath) {
|
|
21030
21210
|
try {
|
|
@@ -22033,11 +22213,11 @@ function parseGrokForkResponse(value) {
|
|
|
22033
22213
|
}
|
|
22034
22214
|
function projectRelativePath(value, cwds) {
|
|
22035
22215
|
const normalized = value.replaceAll("\\", "/");
|
|
22036
|
-
if (!
|
|
22216
|
+
if (!path8.isAbsolute(value))
|
|
22037
22217
|
return normalized;
|
|
22038
22218
|
for (const cwd of cwds) {
|
|
22039
|
-
const relative =
|
|
22040
|
-
if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
22219
|
+
const relative = path8.relative(path8.resolve(cwd), path8.resolve(value));
|
|
22220
|
+
if (relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`)) {
|
|
22041
22221
|
return relative.replaceAll("\\", "/");
|
|
22042
22222
|
}
|
|
22043
22223
|
}
|
|
@@ -22102,8 +22282,8 @@ async function forkGrokSession(input) {
|
|
|
22102
22282
|
error: error51("sessionNotFound", "Grok Native Session is unavailable")
|
|
22103
22283
|
};
|
|
22104
22284
|
}
|
|
22105
|
-
const sourceCwd =
|
|
22106
|
-
const targetCwd =
|
|
22285
|
+
const sourceCwd = path8.resolve(located.cwd);
|
|
22286
|
+
const targetCwd = path8.resolve(input.cwd);
|
|
22107
22287
|
const source = await readSnapshot({ ...input, cwd: sourceCwd }, sourceRef.data.nativeSessionId);
|
|
22108
22288
|
if (!source.ok)
|
|
22109
22289
|
return source;
|
|
@@ -22285,7 +22465,7 @@ function parseGrokCompactResult(value, cancelled = false) {
|
|
|
22285
22465
|
}
|
|
22286
22466
|
|
|
22287
22467
|
// dist/grok-rewind.js
|
|
22288
|
-
import
|
|
22468
|
+
import path9 from "node:path";
|
|
22289
22469
|
var GROK_REWIND_EXECUTE_METHOD = "_x.ai/rewind/execute";
|
|
22290
22470
|
function error52(code, message, retryable = false) {
|
|
22291
22471
|
return { code, message, retryable };
|
|
@@ -22358,8 +22538,8 @@ async function rewindGrokLastTurn(input) {
|
|
|
22358
22538
|
error: error52("sessionNotFound", "Grok Native Session is unavailable")
|
|
22359
22539
|
};
|
|
22360
22540
|
}
|
|
22361
|
-
const sourceCwd =
|
|
22362
|
-
const targetCwd =
|
|
22541
|
+
const sourceCwd = path9.resolve(located.cwd);
|
|
22542
|
+
const targetCwd = path9.resolve(input.cwd);
|
|
22363
22543
|
if (sourceCwd !== targetCwd) {
|
|
22364
22544
|
return {
|
|
22365
22545
|
ok: false,
|
|
@@ -22603,13 +22783,13 @@ function transportEvent(update, metadata) {
|
|
|
22603
22783
|
function grokHomeDir(options) {
|
|
22604
22784
|
const environment = { ...process.env, ...options.environment };
|
|
22605
22785
|
const home = environment.HOME ?? environment.USERPROFILE ?? os4.homedir();
|
|
22606
|
-
return environment.GROK_HOME ??
|
|
22786
|
+
return environment.GROK_HOME ?? path10.join(home, ".grok");
|
|
22607
22787
|
}
|
|
22608
22788
|
function grokNativeSessionDirectory(options, sessionId) {
|
|
22609
|
-
return
|
|
22789
|
+
return path10.join(grokHomeDir(options), "sessions", encodeURIComponent(path10.resolve(options.cwd)), sessionId);
|
|
22610
22790
|
}
|
|
22611
22791
|
function nativeSessionFile(options, sessionId, fileName) {
|
|
22612
|
-
return
|
|
22792
|
+
return path10.join(grokNativeSessionDirectory(options, sessionId), fileName);
|
|
22613
22793
|
}
|
|
22614
22794
|
function nativeHistoryPath(options, sessionId) {
|
|
22615
22795
|
return nativeSessionFile(options, sessionId, "updates.jsonl");
|
|
@@ -22629,7 +22809,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
22629
22809
|
return null;
|
|
22630
22810
|
let entries;
|
|
22631
22811
|
try {
|
|
22632
|
-
entries = await readdir(
|
|
22812
|
+
entries = await readdir(path10.join(grokHomeDir(options), "sessions"), { withFileTypes: true });
|
|
22633
22813
|
} catch (error53) {
|
|
22634
22814
|
if (isMissingFile(error53))
|
|
22635
22815
|
return null;
|
|
@@ -22643,7 +22823,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
22643
22823
|
continue;
|
|
22644
22824
|
let summaryRaw;
|
|
22645
22825
|
try {
|
|
22646
|
-
summaryRaw = await readFile2(
|
|
22826
|
+
summaryRaw = await readFile2(path10.join(grokHomeDir(options), "sessions", entry.name, sessionId, "summary.json"), "utf8");
|
|
22647
22827
|
} catch (error53) {
|
|
22648
22828
|
if (isMissingFile(error53) || isRecord11(error53) && error53.code === "ENOTDIR")
|
|
22649
22829
|
continue;
|
|
@@ -22660,8 +22840,8 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
22660
22840
|
if (!isRecord11(parsed))
|
|
22661
22841
|
continue;
|
|
22662
22842
|
const info = parsed.info;
|
|
22663
|
-
const cwd = isRecord11(info) && typeof info.cwd === "string" && info.cwd.length > 0 ?
|
|
22664
|
-
const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ?
|
|
22843
|
+
const cwd = isRecord11(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path10.resolve(info.cwd) : path10.resolve(decodeURIComponent(entry.name));
|
|
22844
|
+
const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ? path10.resolve(parsed.source_workspace_dir) : void 0;
|
|
22665
22845
|
matches.push({
|
|
22666
22846
|
cwd,
|
|
22667
22847
|
...sourceWorkspaceDir ? { sourceWorkspaceDir } : {}
|
|
@@ -22671,7 +22851,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
22671
22851
|
}
|
|
22672
22852
|
async function readGrokNativeHistory(options, sessionId) {
|
|
22673
22853
|
try {
|
|
22674
|
-
return parseNativeHistory(await readFile2(nativeHistoryPath({ ...options, cwd:
|
|
22854
|
+
return parseNativeHistory(await readFile2(nativeHistoryPath({ ...options, cwd: path10.resolve(options.cwd) }, sessionId), "utf8"), sessionId);
|
|
22675
22855
|
} catch (error53) {
|
|
22676
22856
|
if (isMissingFile(error53))
|
|
22677
22857
|
return [];
|
|
@@ -23379,7 +23559,7 @@ function stateForGrokModel(modelState, nativeState, model = modelState.currentMo
|
|
|
23379
23559
|
// dist/grok-credits.js
|
|
23380
23560
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
23381
23561
|
import os5 from "node:os";
|
|
23382
|
-
import
|
|
23562
|
+
import path11 from "node:path";
|
|
23383
23563
|
var GROK_CREDITS_ENDPOINT = "https://cli-chat-proxy.grok.com/v1/billing?format=credits";
|
|
23384
23564
|
var REQUEST_TIMEOUT_MS = 15e3;
|
|
23385
23565
|
function isRecord13(value) {
|
|
@@ -23399,7 +23579,7 @@ function nonNegativeCentValue(value) {
|
|
|
23399
23579
|
return amount;
|
|
23400
23580
|
}
|
|
23401
23581
|
function grokHome(environment) {
|
|
23402
|
-
return environment.GROK_HOME ??
|
|
23582
|
+
return environment.GROK_HOME ?? path11.join(environment.HOME ?? environment.USERPROFILE ?? os5.homedir(), ".grok");
|
|
23403
23583
|
}
|
|
23404
23584
|
function periodTypeFrom(value) {
|
|
23405
23585
|
if (typeof value !== "string")
|
|
@@ -23478,7 +23658,7 @@ async function fetchGrokAccount(input = {}) {
|
|
|
23478
23658
|
if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((value) => value?.trim()))
|
|
23479
23659
|
return null;
|
|
23480
23660
|
const now = input.now ?? /* @__PURE__ */ new Date();
|
|
23481
|
-
const authPath =
|
|
23661
|
+
const authPath = path11.join(grokHome(environment), "auth.json");
|
|
23482
23662
|
const raw = input.readAuthFile ? await input.readAuthFile(authPath) : await readFile3(authPath, "utf8");
|
|
23483
23663
|
const token = selectAccessToken(JSON.parse(raw), now);
|
|
23484
23664
|
if (!token)
|
|
@@ -23514,7 +23694,7 @@ async function fetchGrokAccount(input = {}) {
|
|
|
23514
23694
|
}
|
|
23515
23695
|
async function fetchGrokCredits(input = {}) {
|
|
23516
23696
|
const account = await fetchGrokAccount(input);
|
|
23517
|
-
if (!account)
|
|
23697
|
+
if (!account?.credits)
|
|
23518
23698
|
return null;
|
|
23519
23699
|
const { credits } = account;
|
|
23520
23700
|
return {
|
|
@@ -24771,7 +24951,7 @@ var GrokAdapter = class {
|
|
|
24771
24951
|
async inspect(input = {}) {
|
|
24772
24952
|
if (this.#closePromise)
|
|
24773
24953
|
return { status: "unavailable", error: invalidState("Grok Adapter is closed") };
|
|
24774
|
-
const cwd =
|
|
24954
|
+
const cwd = path12.resolve(input.cwd ?? process.cwd());
|
|
24775
24955
|
if (!input.refresh) {
|
|
24776
24956
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
24777
24957
|
if (cached2)
|
|
@@ -24833,7 +25013,7 @@ var GrokAdapter = class {
|
|
|
24833
25013
|
}
|
|
24834
25014
|
};
|
|
24835
25015
|
}
|
|
24836
|
-
const cwd =
|
|
25016
|
+
const cwd = path12.resolve(input.cwd);
|
|
24837
25017
|
const parsedRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
|
|
24838
25018
|
if (parsedRef && (!parsedRef.success || parsedRef.data.harnessId !== this.harnessId)) {
|
|
24839
25019
|
return {
|
|
@@ -25017,14 +25197,46 @@ var GrokAdapter = class {
|
|
|
25017
25197
|
}
|
|
25018
25198
|
};
|
|
25019
25199
|
|
|
25200
|
+
// dist/installation.js
|
|
25201
|
+
var GROK_NPM_PACKAGE = "@xai-official/grok";
|
|
25202
|
+
function createGrokInstallation(environment, command) {
|
|
25203
|
+
const run = (args, timeout, extra) => runInstallationCommand(resolveGrokExecutable({ environment, ...command ? { command } : {} }), args, extra ? { ...environment, ...extra } : environment, timeout);
|
|
25204
|
+
let installer = "";
|
|
25205
|
+
return createInstallationManager({
|
|
25206
|
+
async check() {
|
|
25207
|
+
const state = JSON.parse(await run(["update", "--check", "--json"]));
|
|
25208
|
+
if (state.error || typeof state.updateAvailable !== "boolean")
|
|
25209
|
+
throw new Error("Grok update check failed");
|
|
25210
|
+
installer = typeof state.installer === "string" ? state.installer : "";
|
|
25211
|
+
return {
|
|
25212
|
+
currentVersion: installationVersion(state.currentVersion),
|
|
25213
|
+
latestVersion: installationVersion(state.latestVersion),
|
|
25214
|
+
updateAvailable: state.updateAvailable,
|
|
25215
|
+
canUpdate: true
|
|
25216
|
+
};
|
|
25217
|
+
},
|
|
25218
|
+
async update() {
|
|
25219
|
+
if (installer !== "npm") {
|
|
25220
|
+
await run(["update"], 3e5);
|
|
25221
|
+
return;
|
|
25222
|
+
}
|
|
25223
|
+
const existing = environment.npm_config_allow_scripts?.trim();
|
|
25224
|
+
const allowed = existing ? `${existing},${GROK_NPM_PACKAGE}` : GROK_NPM_PACKAGE;
|
|
25225
|
+
await run(["update", "--force-reinstall"], 3e5, {
|
|
25226
|
+
npm_config_allow_scripts: allowed
|
|
25227
|
+
});
|
|
25228
|
+
}
|
|
25229
|
+
});
|
|
25230
|
+
}
|
|
25231
|
+
|
|
25020
25232
|
// dist/plugin.js
|
|
25021
25233
|
var GROK_COMMAND_ENV = "CODEXHOST_GROK_COMMAND";
|
|
25022
25234
|
function createHarnessAdapter(context) {
|
|
25023
25235
|
const environment = { ...context.environment };
|
|
25024
|
-
return new GrokAdapter({
|
|
25236
|
+
return Object.assign(new GrokAdapter({
|
|
25025
25237
|
...environment[GROK_COMMAND_ENV] ? { command: environment[GROK_COMMAND_ENV] } : {},
|
|
25026
25238
|
environment
|
|
25027
|
-
});
|
|
25239
|
+
}), { installation: createGrokInstallation(environment, environment[GROK_COMMAND_ENV]) });
|
|
25028
25240
|
}
|
|
25029
25241
|
export {
|
|
25030
25242
|
GROK_COMMAND_ENV,
|