@codexhost/cli-win32-arm64 0.13.2 → 0.14.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/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +94 -8
- package/app/console-web.js +537 -146
- package/app/desktop-controller.mjs +108 -12
- package/app/host-runtime.mjs +847 -235
- package/app/plugins/antigravity/plugin.mjs +143 -20
- package/app/plugins/claude-code/plugin.mjs +601 -71
- package/app/plugins/codebuddy/plugin.mjs +227 -30
- package/app/plugins/codex-usage/plugin.mjs +212 -77
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34546 -0
- package/app/plugins/cursor-cli/plugin.mjs +20805 -44862
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +202 -21
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +278 -29
- package/app/plugins/hermes/plugin.mjs +143 -12
- package/app/plugins/kimi-code/plugin.mjs +140 -16
- package/app/plugins/kiro-cli/plugin.mjs +121 -10
- package/app/plugins/omp/plugin.mjs +2200 -2002
- package/app/plugins/opencode/plugin.mjs +137 -16
- package/app/plugins/pi/plugin.mjs +2563 -2282
- package/app/plugins/qoder/plugin.mjs +133 -14
- package/app/plugins/qoder-cn/plugin.mjs +133 -14
- package/app/plugins/workbuddy/plugin.mjs +603 -56
- package/app/plugins/zcode/plugin.mjs +133 -14
- package/app/renderer-extension.js +1171 -529
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -393,10 +393,13 @@ function usageSessionTitle(value) {
|
|
|
393
393
|
return void 0;
|
|
394
394
|
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
395
395
|
return normalized;
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
let title = "";
|
|
397
|
+
for (const character of normalized) {
|
|
398
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
399
|
+
break;
|
|
400
|
+
title += character;
|
|
401
|
+
}
|
|
402
|
+
return `${title.trimEnd()}…`;
|
|
400
403
|
}
|
|
401
404
|
function sessionIdOk(value) {
|
|
402
405
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
@@ -15195,6 +15198,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
15195
15198
|
initializeOnly: external_exports.boolean().optional()
|
|
15196
15199
|
});
|
|
15197
15200
|
|
|
15201
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
15202
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15203
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text) => text.trim().length > 0);
|
|
15204
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15205
|
+
label: displayText(256).optional(),
|
|
15206
|
+
description: displayText(1024).optional()
|
|
15207
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15208
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15209
|
+
|
|
15198
15210
|
// ../../shared-contracts/dist/model-price-overrides.js
|
|
15199
15211
|
var usdPerMillionTokens = external_exports.number().finite().nonnegative();
|
|
15200
15212
|
var modelPriceOverrideSchema = external_exports.strictObject({
|
|
@@ -15244,10 +15256,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
15244
15256
|
var project = external_exports.string().min(1).max(4096);
|
|
15245
15257
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
15246
15258
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15259
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
15260
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
15261
|
+
try {
|
|
15262
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
15263
|
+
return true;
|
|
15264
|
+
} catch {
|
|
15265
|
+
return false;
|
|
15266
|
+
}
|
|
15267
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
15247
15268
|
harness: harness.optional(),
|
|
15248
15269
|
model: model.nullable().optional(),
|
|
15249
15270
|
project: project.nullable().optional(),
|
|
15250
|
-
/** One
|
|
15271
|
+
/** One date in the query timezone inside the range. */
|
|
15251
15272
|
date: localDate.optional()
|
|
15252
15273
|
});
|
|
15253
15274
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -15283,7 +15304,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15283
15304
|
});
|
|
15284
15305
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
15285
15306
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15286
|
-
/** First
|
|
15307
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
15287
15308
|
from: localDate.nullable(),
|
|
15288
15309
|
to: localDate,
|
|
15289
15310
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -15323,7 +15344,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15323
15344
|
totals: usageStatisticsTotalsSchema,
|
|
15324
15345
|
/** Each date and Harness of the range: every filter except the day. */
|
|
15325
15346
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
15326
|
-
/**
|
|
15347
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
15327
15348
|
hourly: external_exports.array(external_exports.strictObject({
|
|
15328
15349
|
weekday: external_exports.number().int().min(0).max(6),
|
|
15329
15350
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -15383,6 +15404,8 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
15383
15404
|
"codexhost/harness/display-settings/set",
|
|
15384
15405
|
"codexhost/harness/inspect",
|
|
15385
15406
|
"codexhost/harness/installation",
|
|
15407
|
+
"codexhost/harness/installation/start",
|
|
15408
|
+
"codexhost/harness/installation/status",
|
|
15386
15409
|
"codexhost/harness/launch-settings/get",
|
|
15387
15410
|
"codexhost/harness/launch-settings/set",
|
|
15388
15411
|
"codexhost/harness/web-ui/open",
|
|
@@ -15458,7 +15481,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
15458
15481
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15459
15482
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15460
15483
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15484
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
15485
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15486
|
+
kind: external_exports.literal("countdown"),
|
|
15487
|
+
id: external_exports.string().min(1).max(64),
|
|
15488
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15489
|
+
label: indicatorTextSchema(256).optional(),
|
|
15490
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15491
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15492
|
+
message: "Composer indicator IDs must be unique"
|
|
15493
|
+
});
|
|
15461
15494
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15495
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
15462
15496
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15463
15497
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15464
15498
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -15531,8 +15565,24 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
15531
15565
|
}
|
|
15532
15566
|
});
|
|
15533
15567
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15568
|
+
var accountCreditsPeriodSchema = external_exports.enum([
|
|
15569
|
+
"weekly",
|
|
15570
|
+
"monthly",
|
|
15571
|
+
"five_hour",
|
|
15572
|
+
"seven_day",
|
|
15573
|
+
"unknown"
|
|
15574
|
+
]);
|
|
15575
|
+
var accountCreditsScopeSchema = external_exports.object({
|
|
15576
|
+
id: external_exports.string().min(1).max(256),
|
|
15577
|
+
label: external_exports.string().min(1).max(256),
|
|
15578
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15579
|
+
}).strict();
|
|
15534
15580
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
15535
15581
|
product: external_exports.string().min(1),
|
|
15582
|
+
/** Native period and scope, never inferred from the display name. */
|
|
15583
|
+
periodType: accountCreditsPeriodSchema.optional(),
|
|
15584
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
15585
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15536
15586
|
used: external_exports.number().finite().nonnegative().optional(),
|
|
15537
15587
|
// Zero is a real empty cap, not an absent field.
|
|
15538
15588
|
limit: external_exports.number().finite().nonnegative().optional(),
|
|
@@ -15552,9 +15602,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
15552
15602
|
unit: external_exports.string().min(1).max(32).optional(),
|
|
15553
15603
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
15554
15604
|
label: external_exports.string().min(1).optional(),
|
|
15605
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
15606
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15555
15607
|
usedPercent: usagePercentSchema,
|
|
15556
15608
|
resetsAt: external_exports.string().min(1).optional(),
|
|
15557
|
-
periodType:
|
|
15609
|
+
periodType: accountCreditsPeriodSchema,
|
|
15558
15610
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15559
15611
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15560
15612
|
}).strict();
|
|
@@ -15565,7 +15617,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
|
|
|
15565
15617
|
var threadUsageInspectionSchema = external_exports.object({
|
|
15566
15618
|
threadId: hostThreadIdSchema,
|
|
15567
15619
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
15568
|
-
accountCredits: accountCreditsSnapshotSchema.optional()
|
|
15620
|
+
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15621
|
+
/** Whether this source can provide cached account quota independently of usage. */
|
|
15622
|
+
accountCreditsSupported: external_exports.boolean().optional()
|
|
15569
15623
|
}).strict();
|
|
15570
15624
|
|
|
15571
15625
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
@@ -15692,7 +15746,8 @@ var harnessPermissionModeSchema = external_exports.object({
|
|
|
15692
15746
|
id: harnessPermissionModeIdSchema,
|
|
15693
15747
|
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15694
15748
|
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15695
|
-
dangerous: external_exports.boolean().optional()
|
|
15749
|
+
dangerous: external_exports.boolean().optional(),
|
|
15750
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15696
15751
|
}).strict();
|
|
15697
15752
|
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15698
15753
|
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
@@ -15845,7 +15900,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
15845
15900
|
}).strict().optional(),
|
|
15846
15901
|
autonomousTurns: external_exports.object({
|
|
15847
15902
|
observe: external_exports.boolean()
|
|
15848
|
-
}).strict().optional()
|
|
15903
|
+
}).strict().optional(),
|
|
15904
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
15905
|
+
steer: external_exports.boolean().optional()
|
|
15849
15906
|
}).strict();
|
|
15850
15907
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
15851
15908
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -15892,7 +15949,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
15892
15949
|
var harnessInspectParamsSchema = external_exports.object({
|
|
15893
15950
|
harnessId: harnessIdSchema,
|
|
15894
15951
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
15895
|
-
refresh: external_exports.boolean().optional()
|
|
15952
|
+
refresh: external_exports.boolean().optional(),
|
|
15953
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
15954
|
+
purpose: external_exports.literal("availability").optional()
|
|
15896
15955
|
}).strict();
|
|
15897
15956
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
15898
15957
|
harnessId: harnessIdSchema
|
|
@@ -15975,6 +16034,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15975
16034
|
seen.add(thread.threadId);
|
|
15976
16035
|
}
|
|
15977
16036
|
});
|
|
16037
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
16038
|
+
threadId: hostThreadIdSchema,
|
|
16039
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16040
|
+
text: external_exports.string().optional()
|
|
16041
|
+
}).strict();
|
|
16042
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16043
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16044
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
16045
|
+
}).strict();
|
|
15978
16046
|
|
|
15979
16047
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
15980
16048
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
@@ -16076,11 +16144,31 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16076
16144
|
latestVersion: external_exports.string().min(1).max(128),
|
|
16077
16145
|
updateAvailable: external_exports.boolean(),
|
|
16078
16146
|
canUpdate: external_exports.boolean(),
|
|
16147
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
16148
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
16149
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
16150
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
16079
16151
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
16080
16152
|
message: external_exports.string().max(2048).optional(),
|
|
16081
16153
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
16154
|
+
/** Safe plugin-owned explanation, distinct from raw diagnostic message. */
|
|
16155
|
+
notice: harnessLocalizedTextSchema.optional(),
|
|
16082
16156
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
16083
16157
|
}).strict();
|
|
16158
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
16159
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
16160
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
16161
|
+
external_exports.object({
|
|
16162
|
+
taskId: external_exports.string().uuid(),
|
|
16163
|
+
status: external_exports.literal("succeeded"),
|
|
16164
|
+
result: harnessInstallationStateSchema
|
|
16165
|
+
}).strict(),
|
|
16166
|
+
external_exports.object({
|
|
16167
|
+
taskId: external_exports.string().uuid(),
|
|
16168
|
+
status: external_exports.literal("failed"),
|
|
16169
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
16170
|
+
}).strict()
|
|
16171
|
+
]);
|
|
16084
16172
|
|
|
16085
16173
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
16086
16174
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -16205,6 +16293,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
|
|
|
16205
16293
|
invocation: commandInvocationSchema,
|
|
16206
16294
|
label: commandLabelSchema,
|
|
16207
16295
|
description: commandDescriptionSchema.optional(),
|
|
16296
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
16208
16297
|
argumentMode: external_exports.enum(["none", "text"]),
|
|
16209
16298
|
/**
|
|
16210
16299
|
* Native distinction reported by the Harness. Omitted when the Harness does
|
|
@@ -16529,6 +16618,18 @@ function sanitizeDiagnosticTail(value) {
|
|
|
16529
16618
|
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
16530
16619
|
}
|
|
16531
16620
|
|
|
16621
|
+
// ../../harness-adapter/dist/steer.js
|
|
16622
|
+
function unsupportedSteer(harnessLabel) {
|
|
16623
|
+
return {
|
|
16624
|
+
ok: false,
|
|
16625
|
+
error: {
|
|
16626
|
+
code: "unsupported",
|
|
16627
|
+
message: `${harnessLabel} cannot steer an active Turn natively`,
|
|
16628
|
+
retryable: false
|
|
16629
|
+
}
|
|
16630
|
+
};
|
|
16631
|
+
}
|
|
16632
|
+
|
|
16532
16633
|
// ../../harness-adapter/dist/usage.js
|
|
16533
16634
|
var tokenFields = [
|
|
16534
16635
|
"inputTokens",
|
|
@@ -16556,6 +16657,7 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
16556
16657
|
...safeIntegerFields,
|
|
16557
16658
|
...percentFields,
|
|
16558
16659
|
"sessionCacheUsage",
|
|
16660
|
+
"composerIndicators",
|
|
16559
16661
|
"totalCostUsd",
|
|
16560
16662
|
"totalCredits",
|
|
16561
16663
|
"contextUsagePercent",
|
|
@@ -16578,6 +16680,7 @@ function parseHostUsage(value) {
|
|
|
16578
16680
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
16579
16681
|
}
|
|
16580
16682
|
}
|
|
16683
|
+
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16581
16684
|
for (const field of [
|
|
16582
16685
|
"totalCredits",
|
|
16583
16686
|
"contextUsagePercent",
|
|
@@ -16648,9 +16751,9 @@ function parseHostUsage(value) {
|
|
|
16648
16751
|
if (value.costSource !== "publicPrice") {
|
|
16649
16752
|
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
16650
16753
|
}
|
|
16651
|
-
return { ...value, unpricedModels: [...models] };
|
|
16754
|
+
return { ...value, ...indicators, unpricedModels: [...models] };
|
|
16652
16755
|
}
|
|
16653
|
-
return { ...value };
|
|
16756
|
+
return { ...value, ...indicators };
|
|
16654
16757
|
}
|
|
16655
16758
|
var requestTokenFields = [
|
|
16656
16759
|
"inputTokens",
|
|
@@ -23211,16 +23314,23 @@ var GROK_PERMISSION_MODE_CATALOG = harnessPermissionModeCatalogSchema.parse({
|
|
|
23211
23314
|
{
|
|
23212
23315
|
id: "ask",
|
|
23213
23316
|
label: "Ask",
|
|
23317
|
+
localizations: { "zh-CN": { label: "询问", description: "执行受保护的工具操作前询问。" } },
|
|
23214
23318
|
description: "Ask before protected tool actions."
|
|
23215
23319
|
},
|
|
23216
23320
|
{
|
|
23217
23321
|
id: "auto",
|
|
23218
23322
|
label: "Auto",
|
|
23323
|
+
localizations: {
|
|
23324
|
+
"zh-CN": { label: "自动", description: "由 Grok Build 决定哪些工具操作可自动运行。" }
|
|
23325
|
+
},
|
|
23219
23326
|
description: "Let Grok Build decide which tool actions may run automatically."
|
|
23220
23327
|
},
|
|
23221
23328
|
{
|
|
23222
23329
|
id: "always-approve",
|
|
23223
23330
|
label: "Always approve",
|
|
23331
|
+
localizations: {
|
|
23332
|
+
"zh-CN": { label: "始终批准", description: "无需提示即可批准所有工具操作。" }
|
|
23333
|
+
},
|
|
23224
23334
|
description: "Approve all tool actions without prompting.",
|
|
23225
23335
|
dangerous: true
|
|
23226
23336
|
}
|
|
@@ -23241,6 +23351,53 @@ function grokPermissionModeSessionMeta(permissionMode) {
|
|
|
23241
23351
|
};
|
|
23242
23352
|
}
|
|
23243
23353
|
|
|
23354
|
+
// dist/permission-confirmation.js
|
|
23355
|
+
import { stripVTControlCharacters } from "node:util";
|
|
23356
|
+
var GROK_PERMISSION_MODE_METHOD = "_x.ai/yolo_mode_changed";
|
|
23357
|
+
var permissionManagerLog = "xai_grok_workspace::permission::manager=info";
|
|
23358
|
+
function grokPermissionLogFilter(existing) {
|
|
23359
|
+
return existing ? `${existing},${permissionManagerLog}` : permissionManagerLog;
|
|
23360
|
+
}
|
|
23361
|
+
var GrokPermissionConfirmation = class {
|
|
23362
|
+
#expected;
|
|
23363
|
+
#completion = Promise.withResolvers();
|
|
23364
|
+
#yolo;
|
|
23365
|
+
#auto;
|
|
23366
|
+
#buffer = "";
|
|
23367
|
+
constructor(mode) {
|
|
23368
|
+
this.#expected = grokPermissionModeSessionMeta(mode);
|
|
23369
|
+
}
|
|
23370
|
+
get completed() {
|
|
23371
|
+
return this.#completion.promise;
|
|
23372
|
+
}
|
|
23373
|
+
accept(chunk) {
|
|
23374
|
+
this.#buffer += chunk;
|
|
23375
|
+
let newline2;
|
|
23376
|
+
while ((newline2 = this.#buffer.indexOf("\n")) !== -1) {
|
|
23377
|
+
const line = stripVTControlCharacters(this.#buffer.slice(0, newline2)).trimEnd();
|
|
23378
|
+
this.#buffer = this.#buffer.slice(newline2 + 1);
|
|
23379
|
+
const match = /^\d{4}-\d{2}-\d{2}T\S+\s+INFO\s+(?:.*?: )?(always-approve|auto permission mode) set to: (true|false)$/.exec(line);
|
|
23380
|
+
if (!match)
|
|
23381
|
+
continue;
|
|
23382
|
+
const value = match[2] === "true";
|
|
23383
|
+
if (match[1] === "always-approve")
|
|
23384
|
+
this.#yolo = value;
|
|
23385
|
+
else
|
|
23386
|
+
this.#auto = value;
|
|
23387
|
+
if (this.#yolo !== void 0 && this.#yolo !== this.#expected.yoloMode || this.#auto !== void 0 && this.#auto !== this.#expected.autoMode) {
|
|
23388
|
+
this.reject(new Error("Grok did not apply the requested Permission Mode"));
|
|
23389
|
+
} else if (this.#yolo !== void 0 && this.#auto !== void 0) {
|
|
23390
|
+
this.#completion.resolve(void 0);
|
|
23391
|
+
}
|
|
23392
|
+
}
|
|
23393
|
+
if (this.#buffer.length > 16384)
|
|
23394
|
+
this.#buffer = "";
|
|
23395
|
+
}
|
|
23396
|
+
reject(error53) {
|
|
23397
|
+
this.#completion.reject(error53);
|
|
23398
|
+
}
|
|
23399
|
+
};
|
|
23400
|
+
|
|
23244
23401
|
// dist/acp-transport.js
|
|
23245
23402
|
var GrokTransportError = class extends Error {
|
|
23246
23403
|
kind;
|
|
@@ -23517,6 +23674,8 @@ var GrokAcpTransport = class {
|
|
|
23517
23674
|
#child = null;
|
|
23518
23675
|
#closed = false;
|
|
23519
23676
|
#closing = false;
|
|
23677
|
+
#closePromise = null;
|
|
23678
|
+
#permissionConfirmation = null;
|
|
23520
23679
|
#connection = null;
|
|
23521
23680
|
#initialize = null;
|
|
23522
23681
|
#replay = null;
|
|
@@ -23716,7 +23875,11 @@ var GrokAcpTransport = class {
|
|
|
23716
23875
|
const invocation = grokInvocation(executable, process.platform, this.#startupModelId);
|
|
23717
23876
|
const child = spawn(invocation.command, invocation.arguments, {
|
|
23718
23877
|
cwd: this.#options.cwd,
|
|
23719
|
-
env: {
|
|
23878
|
+
env: {
|
|
23879
|
+
...process.env,
|
|
23880
|
+
...this.#options.environment,
|
|
23881
|
+
RUST_LOG: grokPermissionLogFilter(this.#options.environment?.RUST_LOG ?? process.env.RUST_LOG)
|
|
23882
|
+
},
|
|
23720
23883
|
detached: process.platform !== "win32",
|
|
23721
23884
|
stdio: ["pipe", "pipe", "pipe"],
|
|
23722
23885
|
windowsHide: true,
|
|
@@ -23725,6 +23888,7 @@ var GrokAcpTransport = class {
|
|
|
23725
23888
|
this.#child = child;
|
|
23726
23889
|
child.stderr.on("data", (chunk) => {
|
|
23727
23890
|
this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
|
|
23891
|
+
this.#permissionConfirmation?.accept(chunk.toString());
|
|
23728
23892
|
});
|
|
23729
23893
|
await withTimeout(new Promise((resolve, reject) => {
|
|
23730
23894
|
child.once("spawn", resolve);
|
|
@@ -23761,6 +23925,8 @@ var GrokAcpTransport = class {
|
|
|
23761
23925
|
}
|
|
23762
23926
|
if (this.#activePrompt)
|
|
23763
23927
|
throw new Error("Grok ACP Session already has an active Prompt");
|
|
23928
|
+
if (this.#permissionConfirmation)
|
|
23929
|
+
throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
|
|
23764
23930
|
const active = { onEvent, onPermission };
|
|
23765
23931
|
this.#activePrompt = active;
|
|
23766
23932
|
try {
|
|
@@ -23779,7 +23945,7 @@ var GrokAcpTransport = class {
|
|
|
23779
23945
|
if (!connection || !this.#sessionId || this.#closed || this.#closing) {
|
|
23780
23946
|
throw new GrokTransportError("unavailable", "Grok ACP Session is unavailable");
|
|
23781
23947
|
}
|
|
23782
|
-
if (this.#activePrompt || this.#activeCompact) {
|
|
23948
|
+
if (this.#activePrompt || this.#activeCompact || this.#permissionConfirmation) {
|
|
23783
23949
|
throw new GrokTransportError("unavailable", "Grok ACP Session already has an active operation");
|
|
23784
23950
|
}
|
|
23785
23951
|
const active = { onEvent, cancellationRequested: false };
|
|
@@ -23812,6 +23978,8 @@ var GrokAcpTransport = class {
|
|
|
23812
23978
|
const connection = this.#connection;
|
|
23813
23979
|
if (!connection || !this.#sessionId)
|
|
23814
23980
|
throw new Error("Grok ACP Session is unavailable");
|
|
23981
|
+
if (this.#permissionConfirmation)
|
|
23982
|
+
throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
|
|
23815
23983
|
const response = await connection.request("session/set_model", {
|
|
23816
23984
|
sessionId: this.#sessionId,
|
|
23817
23985
|
modelId,
|
|
@@ -23835,14 +24003,57 @@ var GrokAcpTransport = class {
|
|
|
23835
24003
|
this.#activeCompact.cancellationRequested = true;
|
|
23836
24004
|
return connection.cancel({ sessionId: this.#sessionId });
|
|
23837
24005
|
}
|
|
23838
|
-
async
|
|
24006
|
+
async setPermissionMode(permissionModeId) {
|
|
24007
|
+
const mode = decodeGrokPermissionModeId(permissionModeId);
|
|
24008
|
+
const connection = this.#connection;
|
|
24009
|
+
const sessionId = this.#sessionId;
|
|
24010
|
+
if (!connection || !sessionId || this.#closed || this.#closing) {
|
|
24011
|
+
throw new GrokTransportError("unavailable", "Grok ACP Session is unavailable");
|
|
24012
|
+
}
|
|
24013
|
+
if (this.#activePrompt || this.#activeCompact || this.#permissionConfirmation) {
|
|
24014
|
+
throw new GrokTransportError("unavailable", "Grok ACP Session has an active operation");
|
|
24015
|
+
}
|
|
24016
|
+
const confirmation = new GrokPermissionConfirmation(mode);
|
|
24017
|
+
this.#permissionConfirmation = confirmation;
|
|
24018
|
+
try {
|
|
24019
|
+
await withTimeout(Promise.all([
|
|
24020
|
+
confirmation.completed,
|
|
24021
|
+
(async () => {
|
|
24022
|
+
const flags = grokPermissionModeSessionMeta(mode);
|
|
24023
|
+
await connection.notify(GROK_PERMISSION_MODE_METHOD, {
|
|
24024
|
+
yolo_mode: flags.yoloMode,
|
|
24025
|
+
auto_mode: flags.autoMode,
|
|
24026
|
+
permission_mode: mode
|
|
24027
|
+
});
|
|
24028
|
+
const response = await connection.request("_x.ai/session/info", { sessionId });
|
|
24029
|
+
if (!isRecord12(response) || !isRecord12(response.result) || response.result.sessionId !== sessionId) {
|
|
24030
|
+
throw new Error("Grok did not confirm the target Session");
|
|
24031
|
+
}
|
|
24032
|
+
})()
|
|
24033
|
+
]), this.#options.commandTimeoutMs, "Grok Permission Mode confirmation");
|
|
24034
|
+
if (this.#closed || this.#closing)
|
|
24035
|
+
throw new Error("Grok Session closed during configuration");
|
|
24036
|
+
} catch (cause) {
|
|
24037
|
+
const error53 = new GrokTransportError("protocolError", "Grok Permission Mode could not be confirmed; reopen the Session to continue", { cause });
|
|
24038
|
+
this.#fault(error53);
|
|
24039
|
+
await this.close();
|
|
24040
|
+
throw error53;
|
|
24041
|
+
} finally {
|
|
24042
|
+
this.#permissionConfirmation = null;
|
|
24043
|
+
}
|
|
24044
|
+
}
|
|
24045
|
+
close() {
|
|
24046
|
+
return this.#closePromise ??= this.#close();
|
|
24047
|
+
}
|
|
24048
|
+
async #close() {
|
|
23839
24049
|
if (this.#closed)
|
|
23840
24050
|
return;
|
|
23841
24051
|
this.#closing = true;
|
|
24052
|
+
this.#permissionConfirmation?.reject(new Error("Grok Session closed during configuration"));
|
|
23842
24053
|
const child = this.#child;
|
|
23843
24054
|
const connection = this.#connection;
|
|
23844
24055
|
if (connection && this.#sessionId && this.#initialize?.agentCapabilities?.sessionCapabilities?.close) {
|
|
23845
|
-
await connection.closeSession({ sessionId: this.#sessionId }).catch(() => void 0);
|
|
24056
|
+
await withTimeout(connection.closeSession({ sessionId: this.#sessionId }), this.#options.closeTimeoutMs, "Grok Session close").catch(() => void 0);
|
|
23846
24057
|
}
|
|
23847
24058
|
if (child?.stdin.writable)
|
|
23848
24059
|
child.stdin.end();
|
|
@@ -23896,6 +24107,7 @@ var GrokAcpTransport = class {
|
|
|
23896
24107
|
return this.#activePrompt.onPermission({ request: params, options: params.options });
|
|
23897
24108
|
}
|
|
23898
24109
|
#fault(error53) {
|
|
24110
|
+
this.#permissionConfirmation?.reject(error53);
|
|
23899
24111
|
if (this.#closing || this.#closed)
|
|
23900
24112
|
return;
|
|
23901
24113
|
this.#options.onFault?.(error53);
|
|
@@ -24554,7 +24766,20 @@ function productUsageFrom(value) {
|
|
|
24554
24766
|
if (!isRecord15(entry) || typeof entry.product !== "string")
|
|
24555
24767
|
return [];
|
|
24556
24768
|
const usagePercent = finitePercent(entry.usagePercent);
|
|
24557
|
-
|
|
24769
|
+
const labels = {
|
|
24770
|
+
GrokBuild: "Build",
|
|
24771
|
+
GrokChat: "Chat",
|
|
24772
|
+
GrokImagine: "Imagine",
|
|
24773
|
+
GrokVoice: "Voice"
|
|
24774
|
+
};
|
|
24775
|
+
const label = Object.hasOwn(labels, entry.product) ? labels[entry.product] : void 0;
|
|
24776
|
+
return usagePercent === void 0 ? [] : [
|
|
24777
|
+
{
|
|
24778
|
+
product: entry.product,
|
|
24779
|
+
...label ? { localizations: { en: { label }, "zh-CN": { label } } } : {},
|
|
24780
|
+
usagePercent
|
|
24781
|
+
}
|
|
24782
|
+
];
|
|
24558
24783
|
});
|
|
24559
24784
|
return products.length > 0 ? products : void 0;
|
|
24560
24785
|
}
|
|
@@ -24943,6 +25168,7 @@ var grokCommandCatalog = harnessCommandCatalogSchema.parse({
|
|
|
24943
25168
|
{
|
|
24944
25169
|
id: "grok.compact",
|
|
24945
25170
|
invocation: "/compact",
|
|
25171
|
+
localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
|
|
24946
25172
|
label: "Compact context",
|
|
24947
25173
|
description: "Compact the current conversation context",
|
|
24948
25174
|
argumentMode: "text"
|
|
@@ -24955,7 +25181,7 @@ function capabilitiesForModels(modelState) {
|
|
|
24955
25181
|
selectModel: modelState.catalog.models.length > 0,
|
|
24956
25182
|
selectThinkingOption: modelState.catalog.thinkingOptions.length > 0,
|
|
24957
25183
|
selectPermissionMode: true,
|
|
24958
|
-
permissionModeScope: "
|
|
25184
|
+
permissionModeScope: "live"
|
|
24959
25185
|
},
|
|
24960
25186
|
history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
|
|
24961
25187
|
subagents: { observe: true, readTranscript: true }
|
|
@@ -25109,6 +25335,8 @@ var GrokHarnessSession = class {
|
|
|
25109
25335
|
return { ok: false, error: invalidState("Grok Session is not open") };
|
|
25110
25336
|
if ("commandId" in command)
|
|
25111
25337
|
return this.#executeHarnessCommand(command);
|
|
25338
|
+
if (command.type === "turn.steer")
|
|
25339
|
+
return unsupportedSteer("Grok");
|
|
25112
25340
|
if (command.type === "turn.cancel")
|
|
25113
25341
|
return this.#cancel(command);
|
|
25114
25342
|
if (command.type === "interaction.respond")
|
|
@@ -25388,14 +25616,29 @@ var GrokHarnessSession = class {
|
|
|
25388
25616
|
}
|
|
25389
25617
|
};
|
|
25390
25618
|
}
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25619
|
+
if (this.#active || this.#configuring) {
|
|
25620
|
+
return {
|
|
25621
|
+
ok: false,
|
|
25622
|
+
error: {
|
|
25623
|
+
code: "sessionBusy",
|
|
25624
|
+
message: "Grok Session cannot configure permissions during another operation",
|
|
25625
|
+
retryable: true
|
|
25626
|
+
}
|
|
25627
|
+
};
|
|
25628
|
+
}
|
|
25629
|
+
this.#configuring = true;
|
|
25630
|
+
try {
|
|
25631
|
+
await this.#transport.setPermissionMode(command.permissionModeId);
|
|
25632
|
+
if (this.#phase !== "open")
|
|
25633
|
+
return { ok: false, error: invalidState("Grok Session is closed") };
|
|
25634
|
+
this.#state = { ...this.#state, effectivePermissionModeId: command.permissionModeId };
|
|
25635
|
+
this.#event({ type: "session.state.changed", state: this.#state });
|
|
25636
|
+
return { ok: true, value: { completed: true } };
|
|
25637
|
+
} catch (error53) {
|
|
25638
|
+
return { ok: false, error: normalizeError(error53, "nativeFailure") };
|
|
25639
|
+
} finally {
|
|
25640
|
+
this.#configuring = false;
|
|
25641
|
+
}
|
|
25399
25642
|
}
|
|
25400
25643
|
async #cancel(command) {
|
|
25401
25644
|
const active = this.#active;
|
|
@@ -26036,10 +26279,15 @@ var GrokAdapter = class {
|
|
|
26036
26279
|
async inspectAccount() {
|
|
26037
26280
|
if (this.#closePromise)
|
|
26038
26281
|
return null;
|
|
26039
|
-
|
|
26282
|
+
const account = await (this.#dependencies.fetchAccount ?? fetchGrokAccount)({
|
|
26040
26283
|
...this.#environment ? { environment: this.#environment } : {},
|
|
26041
26284
|
signal: this.#accountAbort.signal
|
|
26042
26285
|
});
|
|
26286
|
+
if (!account?.credits)
|
|
26287
|
+
return account;
|
|
26288
|
+
const credits = { ...account.credits };
|
|
26289
|
+
delete credits.productUsage;
|
|
26290
|
+
return { ...account, credits };
|
|
26043
26291
|
}
|
|
26044
26292
|
credits() {
|
|
26045
26293
|
return this.#credits;
|
|
@@ -26284,6 +26532,7 @@ var GrokAdapter = class {
|
|
|
26284
26532
|
]);
|
|
26285
26533
|
}
|
|
26286
26534
|
}
|
|
26535
|
+
await transport.setPermissionMode(initialPermissionModeId);
|
|
26287
26536
|
const history = await transport.getHistory();
|
|
26288
26537
|
let initialUsage = input.kind === "resume" || input.kind === "fork" || input.kind === "rollbackLastTurn" ? combineUsage(sessionUsageFromHistory(history), usageFromSignals(opened.signals)) : null;
|
|
26289
26538
|
if (contextWindow !== void 0 && initialUsage?.contextUsedTokens !== void 0) {
|