@codexhost/cli-linux-arm64 0.21.0 → 0.23.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 +3333 -249
- package/app/console-web.js +9884 -2837
- package/app/desktop-controller.mjs +3139 -310
- package/app/host-runtime.mjs +6652 -2111
- package/app/plugins/antigravity/plugin.mjs +1796 -1338
- package/app/plugins/claude-code/plugin.mjs +1272 -238
- package/app/plugins/codebuddy/plugin.mjs +588 -109
- package/app/plugins/codex-usage/plugin.mjs +533 -88
- package/app/plugins/copilot/plugin.mjs +533 -88
- package/app/plugins/cursor-cli/plugin.mjs +588 -109
- package/app/plugins/deepseek-harness/plugin.mjs +875 -218
- package/app/plugins/devin/plugin.mjs +533 -88
- package/app/plugins/grok/plugin.mjs +778 -272
- package/app/plugins/hermes/plugin.mjs +533 -88
- package/app/plugins/kimi-code/plugin.mjs +533 -88
- package/app/plugins/kiro-cli/plugin.mjs +533 -88
- package/app/plugins/omp/plugin.mjs +640 -110
- package/app/plugins/opencode/plugin.mjs +533 -88
- package/app/plugins/pi/plugin.mjs +657 -116
- package/app/plugins/qoder/plugin.mjs +533 -88
- package/app/plugins/qoder-cn/plugin.mjs +533 -88
- package/app/plugins/qwen-code/plugin.mjs +533 -88
- package/app/plugins/workbuddy/plugin.mjs +646 -120
- package/app/plugins/zcode/plugin.mjs +540 -95
- package/app/renderer-extension.js +12947 -4450
- package/app/web/assets/index-Dyh1KzAB.js +201 -0
- package/app/web/codexhost-settings.js +9794 -2934
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +90 -90
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-browser/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
- package/app/web-modules/licenses/werift-NOTICES.txt +123 -0
- package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
- package/app/web-modules/server.mjs +34958 -2911
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BdmZfTRW.js +0 -201
|
@@ -14886,6 +14886,87 @@ function date4(params) {
|
|
|
14886
14886
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
14887
14887
|
config(en_default());
|
|
14888
14888
|
|
|
14889
|
+
// ../../shared-contracts/dist/ids.js
|
|
14890
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14891
|
+
message: "Identifier must not be empty or whitespace"
|
|
14892
|
+
});
|
|
14893
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14894
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14895
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14896
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14897
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14898
|
+
|
|
14899
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
14900
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14901
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
14902
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
14903
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
14904
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
14905
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
14906
|
+
var pluginRelativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
14907
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
14908
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
14909
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
14910
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
14911
|
+
before: localizedTextSchema.optional(),
|
|
14912
|
+
after: localizedTextSchema.optional(),
|
|
14913
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
14914
|
+
}).strict();
|
|
14915
|
+
var pluginPresentationShape = {
|
|
14916
|
+
id: installedHarnessPluginIdSchema,
|
|
14917
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
14918
|
+
version: external_exports.string().min(1).max(128),
|
|
14919
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
14920
|
+
kind: external_exports.literal("usage").optional(),
|
|
14921
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
14922
|
+
iconStyle: external_exports.object({
|
|
14923
|
+
vector: external_exports.object({
|
|
14924
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
14925
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
14926
|
+
paths: external_exports.array(external_exports.object({
|
|
14927
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
14928
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
14929
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
14930
|
+
}).strict()).min(1).max(32)
|
|
14931
|
+
}).strict().optional(),
|
|
14932
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
14933
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
14934
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
14935
|
+
}).strict().optional(),
|
|
14936
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
14937
|
+
notice: localizedTextSchema.optional(),
|
|
14938
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
14939
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
14940
|
+
links: external_exports.object({
|
|
14941
|
+
website: documentationUrlSchema.optional(),
|
|
14942
|
+
documentation: documentationUrlSchema.optional(),
|
|
14943
|
+
installation: documentationUrlSchema.optional()
|
|
14944
|
+
}).strict().optional()
|
|
14945
|
+
};
|
|
14946
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
14947
|
+
manifestVersion: external_exports.literal(1),
|
|
14948
|
+
...pluginPresentationShape,
|
|
14949
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
14950
|
+
entry: pluginRelativeResourceSchema,
|
|
14951
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
14952
|
+
}).strict();
|
|
14953
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
14954
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
14955
|
+
...pluginPresentationShape,
|
|
14956
|
+
icon: harnessPluginIconSchema.optional()
|
|
14957
|
+
}).strict();
|
|
14958
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
14959
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
14960
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
14961
|
+
}).strict();
|
|
14962
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
14963
|
+
version: external_exports.literal(1),
|
|
14964
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
14965
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
14966
|
+
message: "Enabled plugin IDs must be unique",
|
|
14967
|
+
path: ["enabled"]
|
|
14968
|
+
});
|
|
14969
|
+
|
|
14889
14970
|
// ../../shared-contracts/dist/json-value.js
|
|
14890
14971
|
function rejectExplicitUndefined(keys) {
|
|
14891
14972
|
return (value, context) => {
|
|
@@ -14945,6 +15026,346 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
14945
15026
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
14946
15027
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
14947
15028
|
|
|
15029
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15030
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15031
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15032
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15033
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
|
|
15034
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15035
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15036
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15037
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15038
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15039
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15040
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15041
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15042
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15043
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15044
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15045
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15046
|
+
"sidebar.thread-layout",
|
|
15047
|
+
"sidebar.thread-badge",
|
|
15048
|
+
"appearance.theme"
|
|
15049
|
+
]);
|
|
15050
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15051
|
+
"appearance",
|
|
15052
|
+
"interface",
|
|
15053
|
+
"workflow",
|
|
15054
|
+
"analytics",
|
|
15055
|
+
"integrations",
|
|
15056
|
+
"tools"
|
|
15057
|
+
]);
|
|
15058
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15059
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15060
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15061
|
+
case "png":
|
|
15062
|
+
return "image/png";
|
|
15063
|
+
case "jpg":
|
|
15064
|
+
case "jpeg":
|
|
15065
|
+
return "image/jpeg";
|
|
15066
|
+
case "webp":
|
|
15067
|
+
return "image/webp";
|
|
15068
|
+
default:
|
|
15069
|
+
return void 0;
|
|
15070
|
+
}
|
|
15071
|
+
}
|
|
15072
|
+
function desktopExtensionAssetMimeType(resource) {
|
|
15073
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15074
|
+
case "gif":
|
|
15075
|
+
return "image/gif";
|
|
15076
|
+
case "svg":
|
|
15077
|
+
return "image/svg+xml";
|
|
15078
|
+
case "woff2":
|
|
15079
|
+
return "font/woff2";
|
|
15080
|
+
case "json":
|
|
15081
|
+
return "application/json";
|
|
15082
|
+
case "css":
|
|
15083
|
+
return "text/css";
|
|
15084
|
+
default:
|
|
15085
|
+
return desktopExtensionScreenshotMimeType(resource);
|
|
15086
|
+
}
|
|
15087
|
+
}
|
|
15088
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15089
|
+
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15090
|
+
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
15091
|
+
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
15092
|
+
const { username, password } = new URL(value);
|
|
15093
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15094
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15095
|
+
function localizedText(text) {
|
|
15096
|
+
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
15097
|
+
}
|
|
15098
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15099
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15100
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15101
|
+
var settingField = {
|
|
15102
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15103
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15104
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15105
|
+
};
|
|
15106
|
+
var numericSetting = {
|
|
15107
|
+
...settingField,
|
|
15108
|
+
step: external_exports.number().positive().optional(),
|
|
15109
|
+
default: external_exports.number().optional()
|
|
15110
|
+
};
|
|
15111
|
+
var settingOption = external_exports.strictObject({
|
|
15112
|
+
value: external_exports.string(),
|
|
15113
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15114
|
+
});
|
|
15115
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15116
|
+
external_exports.strictObject({
|
|
15117
|
+
...settingField,
|
|
15118
|
+
type: external_exports.literal("boolean"),
|
|
15119
|
+
default: external_exports.boolean().optional()
|
|
15120
|
+
}),
|
|
15121
|
+
external_exports.strictObject({
|
|
15122
|
+
...settingField,
|
|
15123
|
+
type: external_exports.literal("string"),
|
|
15124
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15125
|
+
default: external_exports.string().optional()
|
|
15126
|
+
}),
|
|
15127
|
+
external_exports.strictObject({
|
|
15128
|
+
...numericSetting,
|
|
15129
|
+
type: external_exports.literal("number"),
|
|
15130
|
+
min: external_exports.number().optional(),
|
|
15131
|
+
max: external_exports.number().optional()
|
|
15132
|
+
}),
|
|
15133
|
+
external_exports.strictObject({
|
|
15134
|
+
...numericSetting,
|
|
15135
|
+
type: external_exports.literal("range"),
|
|
15136
|
+
min: external_exports.number(),
|
|
15137
|
+
max: external_exports.number()
|
|
15138
|
+
}),
|
|
15139
|
+
external_exports.strictObject({
|
|
15140
|
+
...settingField,
|
|
15141
|
+
type: external_exports.literal("select"),
|
|
15142
|
+
options: external_exports.array(settingOption).min(1),
|
|
15143
|
+
default: external_exports.string().optional()
|
|
15144
|
+
})
|
|
15145
|
+
]).superRefine((field2, ctx) => {
|
|
15146
|
+
const issue2 = (path17, message) => ctx.addIssue({ code: "custom", path: [path17], message });
|
|
15147
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
15148
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
15149
|
+
if (min > max)
|
|
15150
|
+
issue2("max", "Must be at least min");
|
|
15151
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15152
|
+
issue2("default", "Must be within min and max");
|
|
15153
|
+
} else if (field2.type === "select") {
|
|
15154
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
15155
|
+
if (values.size !== field2.options.length)
|
|
15156
|
+
issue2("options", "Duplicate option values");
|
|
15157
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
15158
|
+
issue2("default", "Must match an option value");
|
|
15159
|
+
}
|
|
15160
|
+
});
|
|
15161
|
+
var manifestHeader = external_exports.object({
|
|
15162
|
+
manifestVersion: external_exports.int().positive(),
|
|
15163
|
+
id: desktopExtensionIdSchema,
|
|
15164
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15165
|
+
version: external_exports.string().min(1).max(128),
|
|
15166
|
+
desktopApi: external_exports.int().positive()
|
|
15167
|
+
}).passthrough();
|
|
15168
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15169
|
+
manifestVersion: external_exports.literal(1),
|
|
15170
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15171
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15172
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15173
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15174
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15175
|
+
icon: imagePathSchema.optional(),
|
|
15176
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15177
|
+
desktop: external_exports.strictObject({
|
|
15178
|
+
script: pluginRelativeResourceSchema,
|
|
15179
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15180
|
+
}).optional(),
|
|
15181
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15182
|
+
slots: slotsSchema.default(() => []),
|
|
15183
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15184
|
+
categories: categoriesSchema.optional()
|
|
15185
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15186
|
+
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15187
|
+
version: external_exports.literal(1),
|
|
15188
|
+
revision: external_exports.int().nonnegative(),
|
|
15189
|
+
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15190
|
+
reloadToken: external_exports.uuid().optional()
|
|
15191
|
+
});
|
|
15192
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15193
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15194
|
+
state: external_exports.enum([
|
|
15195
|
+
"running",
|
|
15196
|
+
"disabled",
|
|
15197
|
+
"invalid",
|
|
15198
|
+
"incompatible",
|
|
15199
|
+
"conflict",
|
|
15200
|
+
"failed",
|
|
15201
|
+
"waiting"
|
|
15202
|
+
]),
|
|
15203
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15204
|
+
error: external_exports.string().optional(),
|
|
15205
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15206
|
+
});
|
|
15207
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15208
|
+
controllerPid: external_exports.int().positive(),
|
|
15209
|
+
targetId: external_exports.string().nullable(),
|
|
15210
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15211
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15212
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15213
|
+
});
|
|
15214
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15215
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15216
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15217
|
+
}
|
|
15218
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15219
|
+
const url2 = new URL(input);
|
|
15220
|
+
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
15221
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15222
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15223
|
+
id: desktopExtensionIdSchema,
|
|
15224
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15225
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15226
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15227
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15228
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15229
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15230
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15231
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15232
|
+
categories: categoriesSchema.optional(),
|
|
15233
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15234
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15235
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15236
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15237
|
+
sha256: desktopExtensionHashSchema,
|
|
15238
|
+
slots: slotsSchema.optional(),
|
|
15239
|
+
publishedAt: external_exports.string().optional(),
|
|
15240
|
+
updatedAt: external_exports.string().optional(),
|
|
15241
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15242
|
+
});
|
|
15243
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15244
|
+
schemaVersion: external_exports.literal(1),
|
|
15245
|
+
generatedAt: external_exports.string(),
|
|
15246
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15247
|
+
});
|
|
15248
|
+
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15249
|
+
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15250
|
+
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15251
|
+
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15252
|
+
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15253
|
+
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15254
|
+
...extensionIdParams,
|
|
15255
|
+
path: desktopExtensionAssetPathSchema
|
|
15256
|
+
});
|
|
15257
|
+
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15258
|
+
mimeType: external_exports.string(),
|
|
15259
|
+
dataUrl: external_exports.string()
|
|
15260
|
+
});
|
|
15261
|
+
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15262
|
+
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15263
|
+
...extensionIdParams,
|
|
15264
|
+
values: jsonObjectSchema
|
|
15265
|
+
});
|
|
15266
|
+
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15267
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15268
|
+
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15269
|
+
...extensionIdParams,
|
|
15270
|
+
method: desktopExtensionBackendMethodSchema,
|
|
15271
|
+
params: jsonValueSchema.optional()
|
|
15272
|
+
});
|
|
15273
|
+
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15274
|
+
result: jsonValueSchema
|
|
15275
|
+
});
|
|
15276
|
+
|
|
15277
|
+
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15278
|
+
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15279
|
+
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15280
|
+
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15281
|
+
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15282
|
+
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15283
|
+
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15284
|
+
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15285
|
+
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15286
|
+
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15287
|
+
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15288
|
+
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15289
|
+
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15290
|
+
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15291
|
+
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15292
|
+
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15293
|
+
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15294
|
+
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15295
|
+
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15296
|
+
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15297
|
+
];
|
|
15298
|
+
var revisionSchema = external_exports.int().nonnegative();
|
|
15299
|
+
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15300
|
+
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15301
|
+
id: desktopExtensionIdSchema,
|
|
15302
|
+
expectedRevision: revisionSchema
|
|
15303
|
+
});
|
|
15304
|
+
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15305
|
+
expectedRevision: revisionSchema.optional()
|
|
15306
|
+
});
|
|
15307
|
+
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15308
|
+
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15309
|
+
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15310
|
+
id: external_exports.string().min(1),
|
|
15311
|
+
manifest: desktopExtensionManifestSchema.optional(),
|
|
15312
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15313
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15314
|
+
enabled: external_exports.boolean(),
|
|
15315
|
+
status: desktopExtensionStatusSchema
|
|
15316
|
+
});
|
|
15317
|
+
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15318
|
+
configuration: desktopExtensionConfigurationSchema,
|
|
15319
|
+
desktopConnected: external_exports.boolean(),
|
|
15320
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
15321
|
+
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15322
|
+
});
|
|
15323
|
+
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15324
|
+
forceRefresh: external_exports.boolean().optional()
|
|
15325
|
+
});
|
|
15326
|
+
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15327
|
+
catalogUrl: external_exports.string(),
|
|
15328
|
+
source: external_exports.enum(["remote", "fallback"]),
|
|
15329
|
+
fetchedAt: external_exports.string(),
|
|
15330
|
+
cached: external_exports.boolean(),
|
|
15331
|
+
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15332
|
+
error: external_exports.string().optional()
|
|
15333
|
+
});
|
|
15334
|
+
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15335
|
+
source: external_exports.discriminatedUnion("type", [
|
|
15336
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15337
|
+
external_exports.strictObject({
|
|
15338
|
+
type: external_exports.literal("url"),
|
|
15339
|
+
url: desktopExtensionHttpUrlSchema,
|
|
15340
|
+
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15341
|
+
}),
|
|
15342
|
+
external_exports.strictObject({
|
|
15343
|
+
type: external_exports.literal("zip-base64"),
|
|
15344
|
+
fileName: external_exports.string().trim().min(1).max(255),
|
|
15345
|
+
contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
|
|
15346
|
+
})
|
|
15347
|
+
])
|
|
15348
|
+
});
|
|
15349
|
+
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15350
|
+
extensionId: desktopExtensionIdSchema,
|
|
15351
|
+
version: external_exports.string().min(1),
|
|
15352
|
+
replaced: external_exports.boolean(),
|
|
15353
|
+
installedPath: external_exports.string(),
|
|
15354
|
+
list: desktopExtensionsListResultSchema
|
|
15355
|
+
});
|
|
15356
|
+
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15357
|
+
id: desktopExtensionIdSchema
|
|
15358
|
+
});
|
|
15359
|
+
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15360
|
+
removedId: desktopExtensionIdSchema,
|
|
15361
|
+
list: desktopExtensionsListResultSchema
|
|
15362
|
+
});
|
|
15363
|
+
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15364
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15365
|
+
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15366
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15367
|
+
]);
|
|
15368
|
+
|
|
14948
15369
|
// ../../shared-contracts/dist/errors.js
|
|
14949
15370
|
var codexhostErrorSchema = external_exports.strictObject({
|
|
14950
15371
|
code: external_exports.string().min(1),
|
|
@@ -14965,16 +15386,6 @@ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_
|
|
|
14965
15386
|
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14966
15387
|
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");
|
|
14967
15388
|
|
|
14968
|
-
// ../../shared-contracts/dist/ids.js
|
|
14969
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14970
|
-
message: "Identifier must not be empty or whitespace"
|
|
14971
|
-
});
|
|
14972
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14973
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14974
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14975
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14976
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14977
|
-
|
|
14978
15389
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
14979
15390
|
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
14980
15391
|
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
@@ -15174,6 +15585,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
15174
15585
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15175
15586
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15176
15587
|
}).strict();
|
|
15588
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15589
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15590
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15591
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15592
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15593
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15594
|
+
}).strict();
|
|
15177
15595
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
15178
15596
|
threadId: hostThreadIdSchema,
|
|
15179
15597
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -15182,7 +15600,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
15182
15600
|
threadId: hostThreadIdSchema,
|
|
15183
15601
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
15184
15602
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15185
|
-
/**
|
|
15603
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
15604
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
15605
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
15606
|
+
* independently of usage. */
|
|
15186
15607
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
15187
15608
|
}).strict();
|
|
15188
15609
|
|
|
@@ -15474,12 +15895,89 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
15474
15895
|
}).strict();
|
|
15475
15896
|
|
|
15476
15897
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15898
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
15477
15899
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15478
15900
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15479
15901
|
|
|
15480
15902
|
// ../../shared-contracts/dist/client-channel.js
|
|
15481
15903
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15482
15904
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15905
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
15906
|
+
"codexhost/skills/list",
|
|
15907
|
+
"codexhost/voice/status",
|
|
15908
|
+
"codexhost/voice/transcribe",
|
|
15909
|
+
"codexhost/harness/display-settings/get",
|
|
15910
|
+
"codexhost/harness/display-settings/set",
|
|
15911
|
+
"codexhost/harness/display-settings/capabilities",
|
|
15912
|
+
"codexhost/harness/preferences/get",
|
|
15913
|
+
"codexhost/harness/preferences/patch",
|
|
15914
|
+
"thread/list",
|
|
15915
|
+
"codexhost/thread/catalog/read",
|
|
15916
|
+
"thread/read",
|
|
15917
|
+
"thread/resume",
|
|
15918
|
+
"thread/fork",
|
|
15919
|
+
"thread/turns/list",
|
|
15920
|
+
"thread/revert",
|
|
15921
|
+
"thread/items/list",
|
|
15922
|
+
"thread/start",
|
|
15923
|
+
"thread/name/set",
|
|
15924
|
+
"codexhost/thread/title/generate",
|
|
15925
|
+
"thread/archive",
|
|
15926
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
15927
|
+
"thread/unarchive",
|
|
15928
|
+
"turn/start",
|
|
15929
|
+
"turn/interrupt",
|
|
15930
|
+
"turn/steer",
|
|
15931
|
+
"thread/queue/list",
|
|
15932
|
+
"thread/queue/add",
|
|
15933
|
+
"thread/queue/update",
|
|
15934
|
+
"thread/queue/delete",
|
|
15935
|
+
"thread/queue/reorder",
|
|
15936
|
+
"thread/queue/start",
|
|
15937
|
+
"codexhost/thread/queue/send-now",
|
|
15938
|
+
"codexhost/workspace/read",
|
|
15939
|
+
"codexhost/thread/tree/read",
|
|
15940
|
+
"codexhost/thread/pins/list",
|
|
15941
|
+
"codexhost/thread/pins/set",
|
|
15942
|
+
"codexhost/harness/plugins/list",
|
|
15943
|
+
"codexhost/harness/inspect",
|
|
15944
|
+
"codexhost/thread/inspect",
|
|
15945
|
+
"codexhost/thread/usage/inspect",
|
|
15946
|
+
"codexhost/thread/ownership/list",
|
|
15947
|
+
"codexhost/thread/model/select",
|
|
15948
|
+
"codexhost/thread/thinking/select",
|
|
15949
|
+
"codexhost/thread/permission-mode/select",
|
|
15950
|
+
"codexhost/thread/commands/inspect",
|
|
15951
|
+
"codexhost/harness/commands/inspect",
|
|
15952
|
+
"codexhost/thread/command/execute",
|
|
15953
|
+
"codexhost/thread/fork",
|
|
15954
|
+
"codexhost/harness/session-import/sources",
|
|
15955
|
+
"codexhost/harness/session-import/list",
|
|
15956
|
+
"codexhost/harness/session-import/import",
|
|
15957
|
+
// Host settings shared across Desktop and Web.
|
|
15958
|
+
...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
|
|
15959
|
+
"codexhost/harness/installation",
|
|
15960
|
+
"codexhost/harness/installation/start",
|
|
15961
|
+
"codexhost/harness/installation/status",
|
|
15962
|
+
"codexhost/harness/launch-settings/get",
|
|
15963
|
+
"codexhost/harness/launch-settings/set",
|
|
15964
|
+
"codexhost/harness/web-ui/open",
|
|
15965
|
+
"codexhost/harness/accounts/sources",
|
|
15966
|
+
"codexhost/harness/accounts/list",
|
|
15967
|
+
"codexhost/harness/accounts/inspect",
|
|
15968
|
+
"codexhost/harness/credential-imports",
|
|
15969
|
+
"codexhost/account/list",
|
|
15970
|
+
"codexhost/account/refresh",
|
|
15971
|
+
"codexhost/account/usage/inspect",
|
|
15972
|
+
"codexhost/usage/model-prices/get",
|
|
15973
|
+
"codexhost/usage/model-prices/set",
|
|
15974
|
+
"codexhost/usage/model-prices/default",
|
|
15975
|
+
"codexhost/usage/statistics/get",
|
|
15976
|
+
"codexhost/update/check",
|
|
15977
|
+
"codexhost/update/start",
|
|
15978
|
+
"codexhost/update/status",
|
|
15979
|
+
"codexhost/sessions/loaded/list"
|
|
15980
|
+
];
|
|
15483
15981
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15484
15982
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15485
15983
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -15693,6 +16191,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
15693
16191
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15694
16192
|
}).strict();
|
|
15695
16193
|
|
|
16194
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
16195
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
16196
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
16197
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
16198
|
+
harnessId: harnessIdSchema,
|
|
16199
|
+
title: external_exports.string().optional(),
|
|
16200
|
+
status: threadTreeStatusSchema,
|
|
16201
|
+
archived: external_exports.boolean()
|
|
16202
|
+
});
|
|
16203
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
16204
|
+
revision: external_exports.int().nonnegative(),
|
|
16205
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
16206
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
16207
|
+
truncated: external_exports.boolean()
|
|
16208
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)), "Missing Thread tree node");
|
|
16209
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
16210
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
16211
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
16212
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
16213
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
16214
|
+
snapshot: threadTreeSnapshotSchema
|
|
16215
|
+
});
|
|
16216
|
+
|
|
15696
16217
|
// ../../shared-contracts/dist/voice.js
|
|
15697
16218
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
15698
16219
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -16323,13 +16844,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
16323
16844
|
});
|
|
16324
16845
|
|
|
16325
16846
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
16326
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
16327
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
16328
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
16329
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
16330
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
16331
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
16332
|
-
}).strict();
|
|
16333
16847
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
16334
16848
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
16335
16849
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -16363,76 +16877,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
16363
16877
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
16364
16878
|
}).strict();
|
|
16365
16879
|
|
|
16366
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
16367
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
16368
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
16369
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
16370
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
16371
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
16372
|
-
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
16373
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
16374
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
16375
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
16376
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
16377
|
-
before: localizedTextSchema.optional(),
|
|
16378
|
-
after: localizedTextSchema.optional(),
|
|
16379
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
16380
|
-
}).strict();
|
|
16381
|
-
var pluginPresentationShape = {
|
|
16382
|
-
id: installedHarnessPluginIdSchema,
|
|
16383
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
16384
|
-
version: external_exports.string().min(1).max(128),
|
|
16385
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
16386
|
-
kind: external_exports.literal("usage").optional(),
|
|
16387
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
16388
|
-
iconStyle: external_exports.object({
|
|
16389
|
-
vector: external_exports.object({
|
|
16390
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
16391
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
16392
|
-
paths: external_exports.array(external_exports.object({
|
|
16393
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
16394
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
16395
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
16396
|
-
}).strict()).min(1).max(32)
|
|
16397
|
-
}).strict().optional(),
|
|
16398
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
16399
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
16400
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
16401
|
-
}).strict().optional(),
|
|
16402
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
16403
|
-
notice: localizedTextSchema.optional(),
|
|
16404
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
16405
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
16406
|
-
links: external_exports.object({
|
|
16407
|
-
website: documentationUrlSchema.optional(),
|
|
16408
|
-
documentation: documentationUrlSchema.optional(),
|
|
16409
|
-
installation: documentationUrlSchema.optional()
|
|
16410
|
-
}).strict().optional()
|
|
16411
|
-
};
|
|
16412
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
16413
|
-
manifestVersion: external_exports.literal(1),
|
|
16414
|
-
...pluginPresentationShape,
|
|
16415
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
16416
|
-
entry: relativeResourceSchema,
|
|
16417
|
-
icon: relativeResourceSchema.optional()
|
|
16418
|
-
}).strict();
|
|
16419
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
16420
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
16421
|
-
...pluginPresentationShape,
|
|
16422
|
-
icon: harnessPluginIconSchema.optional()
|
|
16423
|
-
}).strict();
|
|
16424
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
16425
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
16426
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
16427
|
-
}).strict();
|
|
16428
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
16429
|
-
version: external_exports.literal(1),
|
|
16430
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
16431
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
16432
|
-
message: "Enabled plugin IDs must be unique",
|
|
16433
|
-
path: ["enabled"]
|
|
16434
|
-
});
|
|
16435
|
-
|
|
16436
16880
|
// ../../shared-contracts/dist/harness-route.js
|
|
16437
16881
|
var harnessPluginRouteSchema = external_exports.object({
|
|
16438
16882
|
harnessId: harnessPluginIdSchema,
|
|
@@ -16867,6 +17311,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16867
17311
|
message: "A history continuation requires its connection epoch"
|
|
16868
17312
|
}).optional()
|
|
16869
17313
|
}),
|
|
17314
|
+
external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
|
|
16870
17315
|
external_exports.strictObject({
|
|
16871
17316
|
kind: external_exports.literal("configure"),
|
|
16872
17317
|
...thread,
|
|
@@ -22220,6 +22665,145 @@ function grokLiveCommands(native) {
|
|
|
22220
22665
|
}));
|
|
22221
22666
|
}
|
|
22222
22667
|
|
|
22668
|
+
// dist/grok-models.js
|
|
22669
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
22670
|
+
var GROK_MODEL_REF_PREFIX = "grok-model-v1.";
|
|
22671
|
+
function isRecord5(value) {
|
|
22672
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22673
|
+
}
|
|
22674
|
+
function nonBlank(value) {
|
|
22675
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
22676
|
+
}
|
|
22677
|
+
function encodeGrokModelRef(value) {
|
|
22678
|
+
if (!nonBlank(value))
|
|
22679
|
+
throw new Error("Grok Model ID must not be blank");
|
|
22680
|
+
const plain = harnessModelRefSchema.safeParse({ id: value });
|
|
22681
|
+
if (plain.success && !value.startsWith(GROK_MODEL_REF_PREFIX))
|
|
22682
|
+
return plain.data;
|
|
22683
|
+
const id = `${GROK_MODEL_REF_PREFIX}${Buffer2.from(value, "utf8").toString("base64url")}`;
|
|
22684
|
+
if (id.length > HARNESS_MODEL_REF_MAX_LENGTH) {
|
|
22685
|
+
throw new Error("Grok Model ID is too long for a Model Ref");
|
|
22686
|
+
}
|
|
22687
|
+
return harnessModelRefSchema.parse({ id });
|
|
22688
|
+
}
|
|
22689
|
+
function decodeGrokModelRef(ref) {
|
|
22690
|
+
const parsed = harnessModelRefSchema.parse(ref);
|
|
22691
|
+
if (!parsed.id.startsWith(GROK_MODEL_REF_PREFIX))
|
|
22692
|
+
return parsed.id;
|
|
22693
|
+
const encoded = parsed.id.slice(GROK_MODEL_REF_PREFIX.length);
|
|
22694
|
+
if (encoded.length === 0)
|
|
22695
|
+
throw new Error("Grok Model Ref is empty");
|
|
22696
|
+
let value;
|
|
22697
|
+
try {
|
|
22698
|
+
value = Buffer2.from(encoded, "base64url").toString("utf8");
|
|
22699
|
+
} catch {
|
|
22700
|
+
throw new Error("Grok Model Ref is malformed");
|
|
22701
|
+
}
|
|
22702
|
+
if (!nonBlank(value) || encodeGrokModelRef(value).id !== parsed.id) {
|
|
22703
|
+
throw new Error("Grok Model Ref is not canonical");
|
|
22704
|
+
}
|
|
22705
|
+
return value;
|
|
22706
|
+
}
|
|
22707
|
+
function thinkingOptions(value) {
|
|
22708
|
+
if (!Array.isArray(value))
|
|
22709
|
+
return [];
|
|
22710
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22711
|
+
const options = [];
|
|
22712
|
+
for (const candidate of value) {
|
|
22713
|
+
if (!isRecord5(candidate) || !nonBlank(candidate.label))
|
|
22714
|
+
continue;
|
|
22715
|
+
const id = harnessThinkingOptionIdSchema.safeParse(candidate.id ?? candidate.value);
|
|
22716
|
+
if (!id.success || seen.has(id.data))
|
|
22717
|
+
continue;
|
|
22718
|
+
seen.add(id.data);
|
|
22719
|
+
options.push({ id: id.data, label: candidate.label });
|
|
22720
|
+
}
|
|
22721
|
+
return options;
|
|
22722
|
+
}
|
|
22723
|
+
function parseGrokModelState(value) {
|
|
22724
|
+
if (!isRecord5(value) || !nonBlank(value.currentModelId) || !Array.isArray(value.availableModels)) {
|
|
22725
|
+
return null;
|
|
22726
|
+
}
|
|
22727
|
+
let currentModel;
|
|
22728
|
+
try {
|
|
22729
|
+
currentModel = encodeGrokModelRef(value.currentModelId);
|
|
22730
|
+
} catch {
|
|
22731
|
+
return null;
|
|
22732
|
+
}
|
|
22733
|
+
const allThinking = /* @__PURE__ */ new Map();
|
|
22734
|
+
const contextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
22735
|
+
const defaultContextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
22736
|
+
const models = [];
|
|
22737
|
+
let currentThinkingOptionId;
|
|
22738
|
+
for (const candidate of value.availableModels) {
|
|
22739
|
+
if (!isRecord5(candidate) || !nonBlank(candidate.modelId) || !nonBlank(candidate.name))
|
|
22740
|
+
continue;
|
|
22741
|
+
let ref;
|
|
22742
|
+
try {
|
|
22743
|
+
ref = encodeGrokModelRef(candidate.modelId);
|
|
22744
|
+
} catch {
|
|
22745
|
+
continue;
|
|
22746
|
+
}
|
|
22747
|
+
const metadata = isRecord5(candidate._meta) ? candidate._meta : {};
|
|
22748
|
+
const options2 = thinkingOptions(metadata.reasoningEfforts);
|
|
22749
|
+
if (Array.isArray(metadata.contextWindows) && metadata.contextWindows.includes(5e5)) {
|
|
22750
|
+
defaultContextWindowTokensByModel.set(ref.id, 5e5);
|
|
22751
|
+
}
|
|
22752
|
+
if (typeof metadata.totalContextTokens === "number" && Number.isSafeInteger(metadata.totalContextTokens) && metadata.totalContextTokens > 0) {
|
|
22753
|
+
contextWindowTokensByModel.set(ref.id, metadata.totalContextTokens);
|
|
22754
|
+
}
|
|
22755
|
+
for (const option of options2)
|
|
22756
|
+
allThinking.set(option.id, option);
|
|
22757
|
+
if (candidate.modelId === value.currentModelId && nonBlank(metadata.reasoningEffort)) {
|
|
22758
|
+
const parsed = harnessThinkingOptionIdSchema.safeParse(metadata.reasoningEffort);
|
|
22759
|
+
if (parsed.success && options2.some(({ id }) => id === parsed.data)) {
|
|
22760
|
+
currentThinkingOptionId = parsed.data;
|
|
22761
|
+
}
|
|
22762
|
+
}
|
|
22763
|
+
models.push({
|
|
22764
|
+
ref,
|
|
22765
|
+
label: candidate.name,
|
|
22766
|
+
...options2.length > 0 ? { supportedThinkingOptionIds: options2.map(({ id }) => id) } : {}
|
|
22767
|
+
});
|
|
22768
|
+
}
|
|
22769
|
+
if (!models.some(({ ref }) => ref.id === currentModel.id))
|
|
22770
|
+
return null;
|
|
22771
|
+
const options = [...allThinking.values()];
|
|
22772
|
+
return {
|
|
22773
|
+
currentModel,
|
|
22774
|
+
contextWindowTokensByModel,
|
|
22775
|
+
defaultContextWindowTokensByModel,
|
|
22776
|
+
...currentThinkingOptionId ? { currentThinkingOptionId } : {},
|
|
22777
|
+
catalog: {
|
|
22778
|
+
models,
|
|
22779
|
+
defaultModel: currentModel,
|
|
22780
|
+
thinkingOptions: options,
|
|
22781
|
+
...currentThinkingOptionId ? { defaultThinkingOptionId: currentThinkingOptionId } : {}
|
|
22782
|
+
}
|
|
22783
|
+
};
|
|
22784
|
+
}
|
|
22785
|
+
function modelStateFromInitialize(response) {
|
|
22786
|
+
return parseGrokModelState(isRecord5(response._meta) ? response._meta.modelState : void 0);
|
|
22787
|
+
}
|
|
22788
|
+
function modelStateFromSessionResponse(response) {
|
|
22789
|
+
return parseGrokModelState(isRecord5(response) ? response.models : void 0);
|
|
22790
|
+
}
|
|
22791
|
+
function stateForGrokModel(modelState, nativeState, model2 = modelState.currentModel, thinkingOptionId = modelState.currentThinkingOptionId, permissionModeId) {
|
|
22792
|
+
const selectedModel = model2;
|
|
22793
|
+
const catalogModel = modelState.catalog.models.find(({ ref }) => ref.id === selectedModel.id);
|
|
22794
|
+
const availableThinkingOptions = catalogModel?.supportedThinkingOptionIds?.flatMap((id) => {
|
|
22795
|
+
const option = modelState.catalog.thinkingOptions.find((candidate) => candidate.id === id);
|
|
22796
|
+
return option ? [option] : [];
|
|
22797
|
+
});
|
|
22798
|
+
return {
|
|
22799
|
+
...nativeState,
|
|
22800
|
+
effectiveModel: selectedModel,
|
|
22801
|
+
...thinkingOptionId ? { effectiveThinkingOptionId: thinkingOptionId } : {},
|
|
22802
|
+
...permissionModeId ? { effectivePermissionModeId: permissionModeId } : {},
|
|
22803
|
+
...availableThinkingOptions ? { availableThinkingOptions } : {}
|
|
22804
|
+
};
|
|
22805
|
+
}
|
|
22806
|
+
|
|
22223
22807
|
// dist/command.js
|
|
22224
22808
|
import path8 from "node:path";
|
|
22225
22809
|
var GrokExecutableError = class extends Error {
|
|
@@ -22266,7 +22850,7 @@ import { isDeepStrictEqual } from "node:util";
|
|
|
22266
22850
|
import path11 from "node:path";
|
|
22267
22851
|
|
|
22268
22852
|
// dist/grok-file-change.js
|
|
22269
|
-
import { Buffer as
|
|
22853
|
+
import { Buffer as Buffer3 } from "node:buffer";
|
|
22270
22854
|
import path9 from "node:path";
|
|
22271
22855
|
|
|
22272
22856
|
// ../../../node_modules/diff/libesm/diff/base.js
|
|
@@ -22687,7 +23271,7 @@ function splitLines(text) {
|
|
|
22687
23271
|
// dist/grok-file-change.js
|
|
22688
23272
|
var DEFAULT_GROK_FILE_CHANGE_TEXT_LIMIT = 4 * 1024 * 1024;
|
|
22689
23273
|
var MAX_GROK_FILE_CHANGES_PER_TOOL = 32;
|
|
22690
|
-
function
|
|
23274
|
+
function isRecord6(value) {
|
|
22691
23275
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22692
23276
|
}
|
|
22693
23277
|
function validAbsolutePath(value) {
|
|
@@ -22713,7 +23297,7 @@ function projectDiff(value, cwd, remainingTextBytes) {
|
|
|
22713
23297
|
if (typeof oldText === "string" && oldText === newText || oldText === null && newText === "") {
|
|
22714
23298
|
return null;
|
|
22715
23299
|
}
|
|
22716
|
-
const textBytes =
|
|
23300
|
+
const textBytes = Buffer3.byteLength(oldText ?? "", "utf8") + Buffer3.byteLength(newText, "utf8");
|
|
22717
23301
|
if (textBytes > remainingTextBytes)
|
|
22718
23302
|
return null;
|
|
22719
23303
|
const displayed = displayPath(value.path, cwd);
|
|
@@ -22738,7 +23322,7 @@ function projectGrokFileChanges(content, cwd, textLimit = DEFAULT_GROK_FILE_CHAN
|
|
|
22738
23322
|
return null;
|
|
22739
23323
|
const candidates = [];
|
|
22740
23324
|
for (const entry of content) {
|
|
22741
|
-
if (
|
|
23325
|
+
if (isRecord6(entry) && entry.type === "diff")
|
|
22742
23326
|
candidates.push(entry);
|
|
22743
23327
|
}
|
|
22744
23328
|
if (candidates.length === 0 || candidates.length > MAX_GROK_FILE_CHANGES_PER_TOOL)
|
|
@@ -22775,14 +23359,14 @@ function grokMediaResolveRoots(cwd, sessionDirectory) {
|
|
|
22775
23359
|
// dist/grok-tool-output.js
|
|
22776
23360
|
var DEFAULT_GROK_TOOL_OUTPUT_LIMIT = 64e3;
|
|
22777
23361
|
var EXECUTE_TOOL_NAMES = /* @__PURE__ */ new Set(["bash", "run_terminal_command", "shell", "cursor_shell"]);
|
|
22778
|
-
function
|
|
23362
|
+
function isRecord7(value) {
|
|
22779
23363
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22780
23364
|
}
|
|
22781
23365
|
function stringField(value, key) {
|
|
22782
|
-
return
|
|
23366
|
+
return isRecord7(value) && typeof value[key] === "string" && value[key].length > 0 ? value[key] : void 0;
|
|
22783
23367
|
}
|
|
22784
23368
|
function numberField(value, key) {
|
|
22785
|
-
if (!
|
|
23369
|
+
if (!isRecord7(value))
|
|
22786
23370
|
return void 0;
|
|
22787
23371
|
const field2 = value[key];
|
|
22788
23372
|
if (field2 === null)
|
|
@@ -22805,7 +23389,7 @@ function firstReadableText(...candidates) {
|
|
|
22805
23389
|
for (const candidate of candidates) {
|
|
22806
23390
|
if (typeof candidate === "string" && candidate.length > 0)
|
|
22807
23391
|
return candidate;
|
|
22808
|
-
if (
|
|
23392
|
+
if (isRecord7(candidate)) {
|
|
22809
23393
|
const nested = stringField(candidate, "content") ?? stringField(candidate, "text") ?? stringField(candidate, "tool_result") ?? stringField(candidate, "raw_output");
|
|
22810
23394
|
if (nested)
|
|
22811
23395
|
return nested;
|
|
@@ -22828,7 +23412,7 @@ function grokToolArguments(rawInput) {
|
|
|
22828
23412
|
if (!parsed.success)
|
|
22829
23413
|
return {};
|
|
22830
23414
|
const argumentsValue = parsed.data;
|
|
22831
|
-
if (!
|
|
23415
|
+
if (!isRecord7(argumentsValue) || stringField(argumentsValue, "path"))
|
|
22832
23416
|
return argumentsValue;
|
|
22833
23417
|
const targetFile = stringField(argumentsValue, "target_file");
|
|
22834
23418
|
return targetFile ? { ...argumentsValue, path: targetFile } : argumentsValue;
|
|
@@ -22841,7 +23425,7 @@ function grokCommand(name, kind, rawInput) {
|
|
|
22841
23425
|
return command;
|
|
22842
23426
|
if (name && EXECUTE_TOOL_NAMES.has(name))
|
|
22843
23427
|
return command;
|
|
22844
|
-
return
|
|
23428
|
+
return isRecord7(rawInput) && rawInput.variant === "Bash" ? command : void 0;
|
|
22845
23429
|
}
|
|
22846
23430
|
function grokCommandCwd(rawInput, fallback) {
|
|
22847
23431
|
return stringField(rawInput, "cwd") ?? fallback;
|
|
@@ -22868,11 +23452,11 @@ function acpContentText(content) {
|
|
|
22868
23452
|
if (!Array.isArray(content))
|
|
22869
23453
|
return "";
|
|
22870
23454
|
return content.flatMap((entry) => {
|
|
22871
|
-
if (!
|
|
23455
|
+
if (!isRecord7(entry))
|
|
22872
23456
|
return [];
|
|
22873
23457
|
if (entry.type === "text" && typeof entry.text === "string")
|
|
22874
23458
|
return [entry.text];
|
|
22875
|
-
if (entry.type !== "content" || !
|
|
23459
|
+
if (entry.type !== "content" || !isRecord7(entry.content))
|
|
22876
23460
|
return [];
|
|
22877
23461
|
return entry.content.type === "text" && typeof entry.content.text === "string" ? [entry.content.text] : [];
|
|
22878
23462
|
}).join("\n");
|
|
@@ -22883,10 +23467,10 @@ function acpContentImages(content, remainingBytes) {
|
|
|
22883
23467
|
const images = [];
|
|
22884
23468
|
let remaining = remainingBytes;
|
|
22885
23469
|
for (const entry of content) {
|
|
22886
|
-
if (!
|
|
23470
|
+
if (!isRecord7(entry))
|
|
22887
23471
|
continue;
|
|
22888
23472
|
const image = entry.type === "image" ? entry : entry.type === "content" ? entry.content : null;
|
|
22889
|
-
if (!
|
|
23473
|
+
if (!isRecord7(image) || image.type !== "image")
|
|
22890
23474
|
continue;
|
|
22891
23475
|
const mimeType = stringField(image, "mimeType") ?? stringField(image, "mime_type");
|
|
22892
23476
|
const data = stringField(image, "data");
|
|
@@ -22909,14 +23493,14 @@ function bashOutput(rawOutput) {
|
|
|
22909
23493
|
function rawOutputProjection(rawOutput) {
|
|
22910
23494
|
if (typeof rawOutput === "string")
|
|
22911
23495
|
return rawOutput.length > 0 ? { text: rawOutput } : {};
|
|
22912
|
-
if (!
|
|
23496
|
+
if (!isRecord7(rawOutput))
|
|
22913
23497
|
return {};
|
|
22914
23498
|
if (rawOutput.type === "Bash" || rawOutput.variant === "Bash" || numberField(rawOutput, "exit_code") !== void 0 || numberField(rawOutput, "exitCode") !== void 0) {
|
|
22915
23499
|
const bash = bashOutput(rawOutput);
|
|
22916
23500
|
if (bash.text !== void 0 || bash.exitCode !== void 0)
|
|
22917
23501
|
return bash;
|
|
22918
23502
|
}
|
|
22919
|
-
const text = firstReadableText(rawOutput.content, rawOutput.text, rawOutput.tool_result, rawOutput.raw_output,
|
|
23503
|
+
const text = firstReadableText(rawOutput.content, rawOutput.text, rawOutput.tool_result, rawOutput.raw_output, isRecord7(rawOutput.FileContent) ? rawOutput.FileContent : void 0, isRecord7(rawOutput.Content) ? rawOutput.Content : void 0);
|
|
22920
23504
|
if (text)
|
|
22921
23505
|
return { text };
|
|
22922
23506
|
if (typeof rawOutput.match_count === "number" && Number.isFinite(rawOutput.match_count)) {
|
|
@@ -22980,11 +23564,11 @@ var WAIT_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
22980
23564
|
var KILL_TOOL_NAMES = /* @__PURE__ */ new Set(["kill_command_or_subagent", "kill_task"]);
|
|
22981
23565
|
var DESCRIPTION_LIMIT = 500;
|
|
22982
23566
|
var SUMMARY_LIMIT = 2e3;
|
|
22983
|
-
function
|
|
23567
|
+
function isRecord8(value) {
|
|
22984
23568
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22985
23569
|
}
|
|
22986
23570
|
function idField(value, key) {
|
|
22987
|
-
if (!
|
|
23571
|
+
if (!isRecord8(value))
|
|
22988
23572
|
return void 0;
|
|
22989
23573
|
const field2 = value[key];
|
|
22990
23574
|
if (typeof field2 === "string") {
|
|
@@ -22996,7 +23580,7 @@ function idField(value, key) {
|
|
|
22996
23580
|
return void 0;
|
|
22997
23581
|
}
|
|
22998
23582
|
function stringField2(value, key) {
|
|
22999
|
-
if (!
|
|
23583
|
+
if (!isRecord8(value) || typeof value[key] !== "string")
|
|
23000
23584
|
return void 0;
|
|
23001
23585
|
const trimmed = value[key].trim();
|
|
23002
23586
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -23019,7 +23603,7 @@ function collectIds(value) {
|
|
|
23019
23603
|
};
|
|
23020
23604
|
push(idField(value, "task_id"));
|
|
23021
23605
|
push(idField(value, "subagent_id"));
|
|
23022
|
-
if (
|
|
23606
|
+
if (isRecord8(value)) {
|
|
23023
23607
|
const list = value.task_ids ?? value.subagent_ids;
|
|
23024
23608
|
if (Array.isArray(list)) {
|
|
23025
23609
|
for (const entry of list)
|
|
@@ -23038,7 +23622,7 @@ function grokSubagentOperation(name, title, rawInput) {
|
|
|
23038
23622
|
return "send";
|
|
23039
23623
|
if (SPAWN_TOOL_NAMES.has(id))
|
|
23040
23624
|
return "spawn";
|
|
23041
|
-
if (
|
|
23625
|
+
if (isRecord8(rawInput) && rawInput.variant === "Task")
|
|
23042
23626
|
return "spawn";
|
|
23043
23627
|
return null;
|
|
23044
23628
|
}
|
|
@@ -23061,7 +23645,7 @@ function grokSubagentRole(rawInput) {
|
|
|
23061
23645
|
return bounded(stringField2(rawInput, "subagent_type") ?? stringField2(rawInput, "agent_type") ?? stringField2(rawInput, "type"), DESCRIPTION_LIMIT);
|
|
23062
23646
|
}
|
|
23063
23647
|
function grokSubagentBackground(rawInput) {
|
|
23064
|
-
if (!
|
|
23648
|
+
if (!isRecord8(rawInput))
|
|
23065
23649
|
return true;
|
|
23066
23650
|
if (rawInput.background === false || rawInput.run_in_background === false)
|
|
23067
23651
|
return false;
|
|
@@ -23099,7 +23683,7 @@ function grokSubagentResultSummary(...candidates) {
|
|
|
23099
23683
|
return void 0;
|
|
23100
23684
|
}
|
|
23101
23685
|
function grokSubagentEventFromUpdate(update) {
|
|
23102
|
-
if (!
|
|
23686
|
+
if (!isRecord8(update) || typeof update.sessionUpdate !== "string")
|
|
23103
23687
|
return null;
|
|
23104
23688
|
const nativeSubagentId = idField(update, "subagent_id") ?? idField(update, "child_session_id");
|
|
23105
23689
|
if (!nativeSubagentId)
|
|
@@ -23160,14 +23744,14 @@ function grokSubagentWaitSettlements(input) {
|
|
|
23160
23744
|
return ids.map((id) => ({ id, status: overall }));
|
|
23161
23745
|
}
|
|
23162
23746
|
function taskOutputResults(rawOutput) {
|
|
23163
|
-
if (!
|
|
23747
|
+
if (!isRecord8(rawOutput))
|
|
23164
23748
|
return [];
|
|
23165
23749
|
if (Array.isArray(rawOutput.results)) {
|
|
23166
|
-
return rawOutput.results.filter(
|
|
23750
|
+
return rawOutput.results.filter(isRecord8);
|
|
23167
23751
|
}
|
|
23168
23752
|
const nested = firstRecord(rawOutput.MultiResult, rawOutput.multiResult, rawOutput.multi_result);
|
|
23169
23753
|
if (nested && Array.isArray(nested.results)) {
|
|
23170
|
-
return nested.results.filter(
|
|
23754
|
+
return nested.results.filter(isRecord8);
|
|
23171
23755
|
}
|
|
23172
23756
|
const single = firstRecord(rawOutput.Result, rawOutput.result);
|
|
23173
23757
|
if (single)
|
|
@@ -23178,7 +23762,7 @@ function taskOutputResults(rawOutput) {
|
|
|
23178
23762
|
}
|
|
23179
23763
|
function firstRecord(...values) {
|
|
23180
23764
|
for (const value of values) {
|
|
23181
|
-
if (
|
|
23765
|
+
if (isRecord8(value))
|
|
23182
23766
|
return value;
|
|
23183
23767
|
}
|
|
23184
23768
|
return void 0;
|
|
@@ -23201,7 +23785,7 @@ function taskOutputTextSettlements(rawOutput, content, ids) {
|
|
|
23201
23785
|
return settled;
|
|
23202
23786
|
}
|
|
23203
23787
|
function taskOutputStatus(rawOutput, content) {
|
|
23204
|
-
if (
|
|
23788
|
+
if (isRecord8(rawOutput) && typeof rawOutput.status === "string")
|
|
23205
23789
|
return rawOutput.status;
|
|
23206
23790
|
const text = extractText(content) ?? extractText(rawOutput);
|
|
23207
23791
|
if (!text)
|
|
@@ -23260,7 +23844,7 @@ function extractText(value, depth = 0) {
|
|
|
23260
23844
|
const joined = parts.join("\n").trim();
|
|
23261
23845
|
return joined.length > 0 ? joined : void 0;
|
|
23262
23846
|
}
|
|
23263
|
-
if (!
|
|
23847
|
+
if (!isRecord8(value))
|
|
23264
23848
|
return void 0;
|
|
23265
23849
|
if (typeof value.text === "string" && value.text.trim().length > 0)
|
|
23266
23850
|
return value.text.trim();
|
|
@@ -23731,11 +24315,11 @@ var GROK_SESSION_DELETE_METHOD = "_x.ai/session/delete";
|
|
|
23731
24315
|
function error51(code, message, retryable = false) {
|
|
23732
24316
|
return { code, message, retryable };
|
|
23733
24317
|
}
|
|
23734
|
-
function
|
|
24318
|
+
function isRecord9(value) {
|
|
23735
24319
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23736
24320
|
}
|
|
23737
24321
|
function isGrokMethodNotFound(error53) {
|
|
23738
|
-
if (
|
|
24322
|
+
if (isRecord9(error53) && error53.code === -32601)
|
|
23739
24323
|
return true;
|
|
23740
24324
|
const message = error53 instanceof Error ? error53.message : String(error53);
|
|
23741
24325
|
return /method not found/iu.test(message);
|
|
@@ -23753,10 +24337,10 @@ function buildGrokForkParams(input) {
|
|
|
23753
24337
|
};
|
|
23754
24338
|
}
|
|
23755
24339
|
function parseGrokForkResponse(value) {
|
|
23756
|
-
if (!
|
|
24340
|
+
if (!isRecord9(value) || value.error !== void 0)
|
|
23757
24341
|
return null;
|
|
23758
|
-
const payload = typeof value.newSessionId !== "string" &&
|
|
23759
|
-
if (!
|
|
24342
|
+
const payload = typeof value.newSessionId !== "string" && isRecord9(value.result) ? value.result : value;
|
|
24343
|
+
if (!isRecord9(payload) || payload.error !== void 0)
|
|
23760
24344
|
return null;
|
|
23761
24345
|
if (typeof payload.newSessionId !== "string" || payload.newSessionId.length === 0)
|
|
23762
24346
|
return null;
|
|
@@ -23920,7 +24504,7 @@ var GROK_SESSION_UPDATE_EXTENSION_METHODS = [
|
|
|
23920
24504
|
"x.ai/session_notification",
|
|
23921
24505
|
"_x.ai/session_notification"
|
|
23922
24506
|
];
|
|
23923
|
-
function
|
|
24507
|
+
function isRecord10(value) {
|
|
23924
24508
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23925
24509
|
}
|
|
23926
24510
|
function optionalNonNegativeInt(value) {
|
|
@@ -23941,7 +24525,7 @@ function isGrokExtensionSessionUpdateMethod(method) {
|
|
|
23941
24525
|
return GROK_SESSION_UPDATE_EXTENSION_METHODS.includes(method);
|
|
23942
24526
|
}
|
|
23943
24527
|
function grokCompactionEventFromUpdate(update) {
|
|
23944
|
-
if (!
|
|
24528
|
+
if (!isRecord10(update) || typeof update.sessionUpdate !== "string")
|
|
23945
24529
|
return null;
|
|
23946
24530
|
const tokensUsed = optionalNonNegativeInt(firstPresent(update, ["tokensUsed", "tokens_used"]));
|
|
23947
24531
|
const contextWindowTokens = optionalNonNegativeInt(firstPresent(update, ["contextWindowTokens", "contextWindow", "context_window"]));
|
|
@@ -23980,7 +24564,7 @@ function grokCompactionEventFromUpdate(update) {
|
|
|
23980
24564
|
// dist/grok-manual-compaction.js
|
|
23981
24565
|
var GROK_COMPACT_CONVERSATION_METHOD = "x.ai/compact_conversation";
|
|
23982
24566
|
var GROK_COMPACT_CONVERSATION_FALLBACK_METHOD = "_x.ai/compact_conversation";
|
|
23983
|
-
function
|
|
24567
|
+
function isRecord11(value) {
|
|
23984
24568
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23985
24569
|
}
|
|
23986
24570
|
function optionalNonNegativeInt2(value) {
|
|
@@ -23992,7 +24576,7 @@ function optionalErrorMessage2(value) {
|
|
|
23992
24576
|
function parseGrokCompactResult(value, cancelled = false) {
|
|
23993
24577
|
if (cancelled)
|
|
23994
24578
|
return { outcome: "cancelled" };
|
|
23995
|
-
if (!
|
|
24579
|
+
if (!isRecord11(value))
|
|
23996
24580
|
return { outcome: "succeeded" };
|
|
23997
24581
|
const tokensBefore = optionalNonNegativeInt2(value.tokensBefore ?? value.tokens_before);
|
|
23998
24582
|
const tokensAfter = optionalNonNegativeInt2(value.tokensAfter ?? value.tokens_after);
|
|
@@ -24030,7 +24614,7 @@ var GROK_REWIND_EXECUTE_METHOD = "_x.ai/rewind/execute";
|
|
|
24030
24614
|
function error52(code, message, retryable = false) {
|
|
24031
24615
|
return { code, message, retryable };
|
|
24032
24616
|
}
|
|
24033
|
-
function
|
|
24617
|
+
function isRecord12(value) {
|
|
24034
24618
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24035
24619
|
}
|
|
24036
24620
|
function buildGrokRewindParams(input) {
|
|
@@ -24042,10 +24626,10 @@ function buildGrokRewindParams(input) {
|
|
|
24042
24626
|
};
|
|
24043
24627
|
}
|
|
24044
24628
|
function parseGrokRewindResponse(value) {
|
|
24045
|
-
if (!
|
|
24629
|
+
if (!isRecord12(value))
|
|
24046
24630
|
return null;
|
|
24047
|
-
const payload = typeof value.success !== "boolean" &&
|
|
24048
|
-
if (!
|
|
24631
|
+
const payload = typeof value.success !== "boolean" && isRecord12(value.result) ? value.result : value;
|
|
24632
|
+
if (!isRecord12(payload) || typeof payload.success !== "boolean")
|
|
24049
24633
|
return null;
|
|
24050
24634
|
return rewindPayload(payload);
|
|
24051
24635
|
}
|
|
@@ -24247,25 +24831,25 @@ var GrokPermissionConfirmation = class {
|
|
|
24247
24831
|
|
|
24248
24832
|
// dist/grok-questions.js
|
|
24249
24833
|
var GROK_ASK_USER_QUESTION_METHOD = "_x.ai/ask_user_question";
|
|
24250
|
-
function
|
|
24834
|
+
function isRecord13(value) {
|
|
24251
24835
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24252
24836
|
}
|
|
24253
24837
|
function nonEmptyString(value) {
|
|
24254
24838
|
return typeof value === "string" && value.trim().length > 0;
|
|
24255
24839
|
}
|
|
24256
24840
|
function parseGrokQuestionRequest(value) {
|
|
24257
|
-
if (!
|
|
24841
|
+
if (!isRecord13(value) || !nonEmptyString(value.sessionId) || !nonEmptyString(value.toolCallId) || value.mode !== "default" && value.mode !== "plan" || !Array.isArray(value.questions) || value.questions.length === 0)
|
|
24258
24842
|
throw new Error("Grok question requires sessionId, toolCallId, mode and nonempty questions");
|
|
24259
24843
|
const seen = /* @__PURE__ */ new Set();
|
|
24260
24844
|
const questions = value.questions.map((question) => {
|
|
24261
|
-
if (!
|
|
24845
|
+
if (!isRecord13(question) || !nonEmptyString(question.question) || seen.has(question.question) || !Array.isArray(question.options) || question.multiSelect != null && typeof question.multiSelect !== "boolean" || question.multi_select != null && typeof question.multi_select !== "boolean")
|
|
24262
24846
|
throw new Error("Grok question text must be unique and options/multiSelect must be valid");
|
|
24263
24847
|
if (question.multiSelect != null && question.multi_select != null && question.multiSelect !== question.multi_select)
|
|
24264
24848
|
throw new Error("Grok question contains conflicting multi-select flags");
|
|
24265
24849
|
seen.add(question.question);
|
|
24266
24850
|
const labels = /* @__PURE__ */ new Set();
|
|
24267
24851
|
const options = question.options.map((option) => {
|
|
24268
|
-
if (!
|
|
24852
|
+
if (!isRecord13(option) || !nonEmptyString(option.label) || labels.has(option.label) || typeof option.description !== "string" || option.preview != null && typeof option.preview !== "string")
|
|
24269
24853
|
throw new Error("Grok question options require unique labels and text descriptions/previews");
|
|
24270
24854
|
labels.add(option.label);
|
|
24271
24855
|
return {
|
|
@@ -24413,16 +24997,16 @@ var GrokTransportError = class extends Error {
|
|
|
24413
24997
|
this.name = "GrokTransportError";
|
|
24414
24998
|
}
|
|
24415
24999
|
};
|
|
24416
|
-
function
|
|
25000
|
+
function isRecord14(value) {
|
|
24417
25001
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24418
25002
|
}
|
|
24419
25003
|
function acpToolName(update, metadata) {
|
|
24420
|
-
if (!
|
|
25004
|
+
if (!isRecord14(update))
|
|
24421
25005
|
return void 0;
|
|
24422
25006
|
if (typeof update.name === "string" && update.name.length > 0)
|
|
24423
25007
|
return update.name;
|
|
24424
|
-
const meta3 =
|
|
24425
|
-
const tool = meta3 &&
|
|
25008
|
+
const meta3 = isRecord14(update._meta) ? update._meta : metadata;
|
|
25009
|
+
const tool = meta3 && isRecord14(meta3["x.ai/tool"]) ? meta3["x.ai/tool"] : void 0;
|
|
24426
25010
|
return tool && typeof tool.name === "string" && tool.name.length > 0 ? tool.name : void 0;
|
|
24427
25011
|
}
|
|
24428
25012
|
function errorText(error53) {
|
|
@@ -24478,12 +25062,12 @@ function signalProcessTree(child, signal) {
|
|
|
24478
25062
|
try {
|
|
24479
25063
|
process.kill(-child.pid, signal);
|
|
24480
25064
|
} catch (error53) {
|
|
24481
|
-
if (!
|
|
25065
|
+
if (!isRecord14(error53) || error53.code === "ESRCH")
|
|
24482
25066
|
return;
|
|
24483
25067
|
try {
|
|
24484
25068
|
child.kill(signal);
|
|
24485
25069
|
} catch (fallback) {
|
|
24486
|
-
if (!
|
|
25070
|
+
if (!isRecord14(fallback) || fallback.code !== "ESRCH")
|
|
24487
25071
|
throw fallback;
|
|
24488
25072
|
}
|
|
24489
25073
|
}
|
|
@@ -24598,7 +25182,7 @@ async function readNativeSignals(options, sessionId) {
|
|
|
24598
25182
|
}
|
|
24599
25183
|
}
|
|
24600
25184
|
function isMissingFile(error53) {
|
|
24601
|
-
return
|
|
25185
|
+
return isRecord14(error53) && error53.code === "ENOENT";
|
|
24602
25186
|
}
|
|
24603
25187
|
async function locateGrokNativeSession(options, sessionId) {
|
|
24604
25188
|
if (sessionId.length === 0)
|
|
@@ -24621,7 +25205,7 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
24621
25205
|
try {
|
|
24622
25206
|
summaryRaw = await readFile3(path13.join(grokHomeDir(options), "sessions", entry.name, sessionId, "summary.json"), "utf8");
|
|
24623
25207
|
} catch (error53) {
|
|
24624
|
-
if (isMissingFile(error53) ||
|
|
25208
|
+
if (isMissingFile(error53) || isRecord14(error53) && error53.code === "ENOTDIR")
|
|
24625
25209
|
continue;
|
|
24626
25210
|
throw new GrokTransportError("unavailable", "Grok Native Session metadata could not be read", {
|
|
24627
25211
|
cause: error53
|
|
@@ -24633,10 +25217,10 @@ async function locateGrokNativeSession(options, sessionId) {
|
|
|
24633
25217
|
} catch {
|
|
24634
25218
|
continue;
|
|
24635
25219
|
}
|
|
24636
|
-
if (!
|
|
25220
|
+
if (!isRecord14(parsed))
|
|
24637
25221
|
continue;
|
|
24638
25222
|
const info = parsed.info;
|
|
24639
|
-
const cwd =
|
|
25223
|
+
const cwd = isRecord14(info) && typeof info.cwd === "string" && info.cwd.length > 0 ? path13.resolve(info.cwd) : path13.resolve(decodeURIComponent(entry.name));
|
|
24640
25224
|
const sourceWorkspaceDir = typeof parsed.source_workspace_dir === "string" && parsed.source_workspace_dir.length > 0 ? path13.resolve(parsed.source_workspace_dir) : void 0;
|
|
24641
25225
|
matches.push({
|
|
24642
25226
|
cwd,
|
|
@@ -24669,12 +25253,12 @@ function parseNativeHistory(contents, sessionId) {
|
|
|
24669
25253
|
} catch {
|
|
24670
25254
|
throw new GrokTransportError("protocolError", "Grok Native history contains invalid JSON");
|
|
24671
25255
|
}
|
|
24672
|
-
if (!
|
|
25256
|
+
if (!isRecord14(record3) || !isRecord14(record3.params))
|
|
24673
25257
|
continue;
|
|
24674
25258
|
const params = record3.params;
|
|
24675
|
-
if (params.sessionId !== sessionId || !
|
|
25259
|
+
if (params.sessionId !== sessionId || !isRecord14(params.update))
|
|
24676
25260
|
continue;
|
|
24677
|
-
const metadata =
|
|
25261
|
+
const metadata = isRecord14(params._meta) ? params._meta : void 0;
|
|
24678
25262
|
const event = transportEvent(params.update, metadata);
|
|
24679
25263
|
if (event)
|
|
24680
25264
|
events.push(metadata ? { ...event, metadata } : event);
|
|
@@ -24717,13 +25301,23 @@ var GrokAcpTransport = class {
|
|
|
24717
25301
|
throw new Error("Grok ACP inspection cannot reuse an open Session");
|
|
24718
25302
|
try {
|
|
24719
25303
|
const initialize = await this.#ensureInitialized();
|
|
25304
|
+
const connection = this.#connection;
|
|
25305
|
+
if (!connection)
|
|
25306
|
+
throw new GrokTransportError("unavailable", "Grok ACP is unavailable");
|
|
24720
25307
|
if (initialize.agentCapabilities?.sessionCapabilities?.list) {
|
|
24721
|
-
const connection = this.#connection;
|
|
24722
|
-
if (!connection)
|
|
24723
|
-
throw new GrokTransportError("unavailable", "Grok ACP is unavailable");
|
|
24724
25308
|
await withTimeout(connection.listSessions({ cwd: this.#options.cwd }), this.#options.commandTimeoutMs, "Grok Session inspection");
|
|
24725
25309
|
}
|
|
24726
|
-
|
|
25310
|
+
try {
|
|
25311
|
+
const response = await withTimeout(connection.request("_x.ai/models/list", {}), this.#options.commandTimeoutMs, "Grok Model inspection");
|
|
25312
|
+
const modelState = isRecord14(response) ? response.result : void 0;
|
|
25313
|
+
if (!parseGrokModelState(modelState))
|
|
25314
|
+
throw new GrokTransportError("protocolError", "Grok returned an invalid Model catalog");
|
|
25315
|
+
return { ...initialize, _meta: { ...initialize._meta, modelState } };
|
|
25316
|
+
} catch (error53) {
|
|
25317
|
+
if (isGrokMethodNotFound(error53))
|
|
25318
|
+
return initialize;
|
|
25319
|
+
throw error53;
|
|
25320
|
+
}
|
|
24727
25321
|
} catch (error53) {
|
|
24728
25322
|
const classified = classifyStartupError(error53);
|
|
24729
25323
|
await this.close().catch(() => void 0);
|
|
@@ -24738,7 +25332,7 @@ var GrokAcpTransport = class {
|
|
|
24738
25332
|
if (!this.#connection)
|
|
24739
25333
|
throw new GrokTransportError("unavailable", "Grok ACP is unavailable");
|
|
24740
25334
|
const result = await withTimeout(this.#connection.request("_x.ai/session/usage", { sessionId: this.sessionId }), this.#options.commandTimeoutMs, "Grok Session usage");
|
|
24741
|
-
return
|
|
25335
|
+
return isRecord14(result) ? result.usage : void 0;
|
|
24742
25336
|
}
|
|
24743
25337
|
async readHistory(sessionId, cwd = this.#options.cwd) {
|
|
24744
25338
|
return readGrokNativeHistory({ ...this.#options, cwd }, sessionId);
|
|
@@ -25001,7 +25595,7 @@ var GrokAcpTransport = class {
|
|
|
25001
25595
|
...reasoningEffort ? { reasoningEffort } : {},
|
|
25002
25596
|
...contextWindowTokens !== void 0 ? { _meta: { contextWindow: contextWindowTokens } } : {}
|
|
25003
25597
|
});
|
|
25004
|
-
if (!
|
|
25598
|
+
if (!isRecord14(response) || !isRecord14(response._meta) || !isRecord14(response._meta.model)) {
|
|
25005
25599
|
throw new GrokTransportError("protocolError", "Grok rejected Model configuration");
|
|
25006
25600
|
}
|
|
25007
25601
|
const selected = response._meta.model.Ok;
|
|
@@ -25041,7 +25635,7 @@ var GrokAcpTransport = class {
|
|
|
25041
25635
|
permission_mode: mode
|
|
25042
25636
|
});
|
|
25043
25637
|
const response = await connection.request("_x.ai/session/info", { sessionId });
|
|
25044
|
-
if (!
|
|
25638
|
+
if (!isRecord14(response) || !isRecord14(response.result) || response.result.sessionId !== sessionId) {
|
|
25045
25639
|
throw new Error("Grok did not confirm the target Session");
|
|
25046
25640
|
}
|
|
25047
25641
|
})()
|
|
@@ -25096,7 +25690,7 @@ var GrokAcpTransport = class {
|
|
|
25096
25690
|
this.#availableCommands = parseGrokAvailableCommands(update.availableCommands);
|
|
25097
25691
|
return;
|
|
25098
25692
|
}
|
|
25099
|
-
const metadata =
|
|
25693
|
+
const metadata = isRecord14(notification._meta) ? notification._meta : void 0;
|
|
25100
25694
|
const event = transportEvent(notification.update, metadata);
|
|
25101
25695
|
if (!event)
|
|
25102
25696
|
return;
|
|
@@ -25111,7 +25705,7 @@ var GrokAcpTransport = class {
|
|
|
25111
25705
|
#handleExtensionNotification(method, params) {
|
|
25112
25706
|
if (!isGrokExtensionSessionUpdateMethod(method))
|
|
25113
25707
|
return;
|
|
25114
|
-
if (typeof params.sessionId !== "string" || !
|
|
25708
|
+
if (typeof params.sessionId !== "string" || !isRecord14(params.update))
|
|
25115
25709
|
return;
|
|
25116
25710
|
this.#handleUpdate(params);
|
|
25117
25711
|
}
|
|
@@ -25267,7 +25861,7 @@ var SessionImportScope = class {
|
|
|
25267
25861
|
// dist/session-import.js
|
|
25268
25862
|
var MAX_METADATA_BYTES = 4 * 1024 * 1024;
|
|
25269
25863
|
var SUBAGENT_SESSION_KINDS = /* @__PURE__ */ new Set(["subagent", "subagent_resume"]);
|
|
25270
|
-
function
|
|
25864
|
+
function isRecord15(value) {
|
|
25271
25865
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25272
25866
|
}
|
|
25273
25867
|
async function readJson(file2, signal) {
|
|
@@ -25280,7 +25874,7 @@ function processAlive(pid) {
|
|
|
25280
25874
|
process.kill(pid, 0);
|
|
25281
25875
|
return true;
|
|
25282
25876
|
} catch (error53) {
|
|
25283
|
-
return
|
|
25877
|
+
return isRecord15(error53) && error53.code === "EPERM";
|
|
25284
25878
|
}
|
|
25285
25879
|
}
|
|
25286
25880
|
async function firstUserText(file2, signal) {
|
|
@@ -25297,10 +25891,10 @@ async function firstUserText(file2, signal) {
|
|
|
25297
25891
|
} catch {
|
|
25298
25892
|
continue;
|
|
25299
25893
|
}
|
|
25300
|
-
const update =
|
|
25301
|
-
if (!
|
|
25894
|
+
const update = isRecord15(entry) && isRecord15(entry.params) ? entry.params.update : null;
|
|
25895
|
+
if (!isRecord15(update) || update.sessionUpdate !== "user_message_chunk")
|
|
25302
25896
|
continue;
|
|
25303
|
-
const text =
|
|
25897
|
+
const text = isRecord15(update.content) ? update.content.text : null;
|
|
25304
25898
|
return typeof text === "string" ? text : "";
|
|
25305
25899
|
}
|
|
25306
25900
|
return null;
|
|
@@ -25377,7 +25971,7 @@ var GrokSessionImport = class {
|
|
|
25377
25971
|
if (!Array.isArray(entries))
|
|
25378
25972
|
return active;
|
|
25379
25973
|
for (const entry of entries) {
|
|
25380
|
-
if (
|
|
25974
|
+
if (isRecord15(entry) && typeof entry.session_id === "string" && processAlive(entry.pid))
|
|
25381
25975
|
active.add(entry.session_id);
|
|
25382
25976
|
}
|
|
25383
25977
|
return active;
|
|
@@ -25426,7 +26020,7 @@ var GrokSessionImport = class {
|
|
|
25426
26020
|
return null;
|
|
25427
26021
|
try {
|
|
25428
26022
|
const summary = await readJson(files[0], signal);
|
|
25429
|
-
if (!
|
|
26023
|
+
if (!isRecord15(summary) || !isRecord15(summary.info) || summary.info.id !== nativeSessionId)
|
|
25430
26024
|
return null;
|
|
25431
26025
|
if (typeof summary.session_kind === "string" && SUBAGENT_SESSION_KINDS.has(summary.session_kind))
|
|
25432
26026
|
return null;
|
|
@@ -25652,107 +26246,6 @@ var GrokSubagentLifecycle = class {
|
|
|
25652
26246
|
}
|
|
25653
26247
|
};
|
|
25654
26248
|
|
|
25655
|
-
// dist/grok-models.js
|
|
25656
|
-
function isRecord15(value) {
|
|
25657
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25658
|
-
}
|
|
25659
|
-
function nonBlank(value) {
|
|
25660
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
25661
|
-
}
|
|
25662
|
-
function thinkingOptions(value) {
|
|
25663
|
-
if (!Array.isArray(value))
|
|
25664
|
-
return [];
|
|
25665
|
-
const seen = /* @__PURE__ */ new Set();
|
|
25666
|
-
const options = [];
|
|
25667
|
-
for (const candidate of value) {
|
|
25668
|
-
if (!isRecord15(candidate) || !nonBlank(candidate.label))
|
|
25669
|
-
continue;
|
|
25670
|
-
const id = harnessThinkingOptionIdSchema.safeParse(candidate.id ?? candidate.value);
|
|
25671
|
-
if (!id.success || seen.has(id.data))
|
|
25672
|
-
continue;
|
|
25673
|
-
seen.add(id.data);
|
|
25674
|
-
options.push({ id: id.data, label: candidate.label });
|
|
25675
|
-
}
|
|
25676
|
-
return options;
|
|
25677
|
-
}
|
|
25678
|
-
function parseGrokModelState(value) {
|
|
25679
|
-
if (!isRecord15(value) || !nonBlank(value.currentModelId) || !Array.isArray(value.availableModels)) {
|
|
25680
|
-
return null;
|
|
25681
|
-
}
|
|
25682
|
-
const currentModel = harnessModelRefSchema.safeParse({ id: value.currentModelId });
|
|
25683
|
-
if (!currentModel.success)
|
|
25684
|
-
return null;
|
|
25685
|
-
const allThinking = /* @__PURE__ */ new Map();
|
|
25686
|
-
const contextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
25687
|
-
const defaultContextWindowTokensByModel = /* @__PURE__ */ new Map();
|
|
25688
|
-
const models = [];
|
|
25689
|
-
let currentThinkingOptionId;
|
|
25690
|
-
for (const candidate of value.availableModels) {
|
|
25691
|
-
if (!isRecord15(candidate) || !nonBlank(candidate.modelId) || !nonBlank(candidate.name))
|
|
25692
|
-
continue;
|
|
25693
|
-
const ref = harnessModelRefSchema.safeParse({ id: candidate.modelId });
|
|
25694
|
-
if (!ref.success)
|
|
25695
|
-
continue;
|
|
25696
|
-
const metadata = isRecord15(candidate._meta) ? candidate._meta : {};
|
|
25697
|
-
const options2 = thinkingOptions(metadata.reasoningEfforts);
|
|
25698
|
-
if (Array.isArray(metadata.contextWindows) && metadata.contextWindows.includes(5e5)) {
|
|
25699
|
-
defaultContextWindowTokensByModel.set(ref.data.id, 5e5);
|
|
25700
|
-
}
|
|
25701
|
-
if (typeof metadata.totalContextTokens === "number" && Number.isSafeInteger(metadata.totalContextTokens) && metadata.totalContextTokens > 0) {
|
|
25702
|
-
contextWindowTokensByModel.set(ref.data.id, metadata.totalContextTokens);
|
|
25703
|
-
}
|
|
25704
|
-
for (const option of options2)
|
|
25705
|
-
allThinking.set(option.id, option);
|
|
25706
|
-
if (candidate.modelId === value.currentModelId && nonBlank(metadata.reasoningEffort)) {
|
|
25707
|
-
const parsed = harnessThinkingOptionIdSchema.safeParse(metadata.reasoningEffort);
|
|
25708
|
-
if (parsed.success && options2.some(({ id }) => id === parsed.data)) {
|
|
25709
|
-
currentThinkingOptionId = parsed.data;
|
|
25710
|
-
}
|
|
25711
|
-
}
|
|
25712
|
-
models.push({
|
|
25713
|
-
ref: ref.data,
|
|
25714
|
-
label: candidate.name,
|
|
25715
|
-
...options2.length > 0 ? { supportedThinkingOptionIds: options2.map(({ id }) => id) } : {}
|
|
25716
|
-
});
|
|
25717
|
-
}
|
|
25718
|
-
if (!models.some(({ ref }) => ref.id === currentModel.data.id))
|
|
25719
|
-
return null;
|
|
25720
|
-
const options = [...allThinking.values()];
|
|
25721
|
-
return {
|
|
25722
|
-
currentModel: currentModel.data,
|
|
25723
|
-
contextWindowTokensByModel,
|
|
25724
|
-
defaultContextWindowTokensByModel,
|
|
25725
|
-
...currentThinkingOptionId ? { currentThinkingOptionId } : {},
|
|
25726
|
-
catalog: {
|
|
25727
|
-
models,
|
|
25728
|
-
defaultModel: currentModel.data,
|
|
25729
|
-
thinkingOptions: options,
|
|
25730
|
-
...currentThinkingOptionId ? { defaultThinkingOptionId: currentThinkingOptionId } : {}
|
|
25731
|
-
}
|
|
25732
|
-
};
|
|
25733
|
-
}
|
|
25734
|
-
function modelStateFromInitialize(response) {
|
|
25735
|
-
return parseGrokModelState(isRecord15(response._meta) ? response._meta.modelState : void 0);
|
|
25736
|
-
}
|
|
25737
|
-
function modelStateFromSessionResponse(response) {
|
|
25738
|
-
return parseGrokModelState(isRecord15(response) ? response.models : void 0);
|
|
25739
|
-
}
|
|
25740
|
-
function stateForGrokModel(modelState, nativeState, model2 = modelState.currentModel, thinkingOptionId = modelState.currentThinkingOptionId, permissionModeId) {
|
|
25741
|
-
const selectedModel = model2;
|
|
25742
|
-
const catalogModel = modelState.catalog.models.find(({ ref }) => ref.id === selectedModel.id);
|
|
25743
|
-
const availableThinkingOptions = catalogModel?.supportedThinkingOptionIds?.flatMap((id) => {
|
|
25744
|
-
const option = modelState.catalog.thinkingOptions.find((candidate) => candidate.id === id);
|
|
25745
|
-
return option ? [option] : [];
|
|
25746
|
-
});
|
|
25747
|
-
return {
|
|
25748
|
-
...nativeState,
|
|
25749
|
-
effectiveModel: selectedModel,
|
|
25750
|
-
...thinkingOptionId ? { effectiveThinkingOptionId: thinkingOptionId } : {},
|
|
25751
|
-
...permissionModeId ? { effectivePermissionModeId: permissionModeId } : {},
|
|
25752
|
-
...availableThinkingOptions ? { availableThinkingOptions } : {}
|
|
25753
|
-
};
|
|
25754
|
-
}
|
|
25755
|
-
|
|
25756
26249
|
// dist/grok-credits.js
|
|
25757
26250
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
25758
26251
|
import os6 from "node:os";
|
|
@@ -26257,6 +26750,7 @@ function capabilitiesForModels(modelState) {
|
|
|
26257
26750
|
};
|
|
26258
26751
|
}
|
|
26259
26752
|
var DEFAULT_CLOSE_TIMEOUT_MS = 2e3;
|
|
26753
|
+
var INSPECTION_CACHE_TTL_MS = 3e4;
|
|
26260
26754
|
function invalidState(message) {
|
|
26261
26755
|
return { code: "invalidState", message, retryable: false };
|
|
26262
26756
|
}
|
|
@@ -26664,7 +27158,7 @@ var GrokHarnessSession = class {
|
|
|
26664
27158
|
this.#configuring = true;
|
|
26665
27159
|
try {
|
|
26666
27160
|
const contextWindow = this.#modelState.defaultContextWindowTokensByModel.get(model2.id);
|
|
26667
|
-
await this.#transport.setModel(model2
|
|
27161
|
+
await this.#transport.setModel(decodeGrokModelRef(model2), thinkingOptionId, contextWindow);
|
|
26668
27162
|
if (contextWindow !== void 0) {
|
|
26669
27163
|
this.#modelState.contextWindowTokensByModel = new Map([
|
|
26670
27164
|
...this.#modelState.contextWindowTokensByModel,
|
|
@@ -27398,8 +27892,8 @@ var GrokAdapter = class {
|
|
|
27398
27892
|
const cwd = path16.resolve(input.cwd ?? process.cwd());
|
|
27399
27893
|
if (!input.refresh) {
|
|
27400
27894
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
27401
|
-
if (cached2)
|
|
27402
|
-
return cached2;
|
|
27895
|
+
if (cached2 && Date.now() < cached2.expiresAt)
|
|
27896
|
+
return cached2.inspection;
|
|
27403
27897
|
}
|
|
27404
27898
|
let transport = null;
|
|
27405
27899
|
const startedAt = Date.now();
|
|
@@ -27419,7 +27913,10 @@ var GrokAdapter = class {
|
|
|
27419
27913
|
permissionModes: GROK_PERMISSION_MODE_CATALOG,
|
|
27420
27914
|
capabilities: capabilitiesForModels(modelState)
|
|
27421
27915
|
};
|
|
27422
|
-
this.#inspectionCache.set(cwd,
|
|
27916
|
+
this.#inspectionCache.set(cwd, {
|
|
27917
|
+
inspection: ready,
|
|
27918
|
+
expiresAt: Date.now() + INSPECTION_CACHE_TTL_MS
|
|
27919
|
+
});
|
|
27423
27920
|
this.#scheduleCreditsRefresh();
|
|
27424
27921
|
return ready;
|
|
27425
27922
|
} catch (error53) {
|
|
@@ -27544,7 +28041,7 @@ var GrokAdapter = class {
|
|
|
27544
28041
|
} : {
|
|
27545
28042
|
kind: "create",
|
|
27546
28043
|
permissionModeId: requestedPermissionModeId,
|
|
27547
|
-
...input.kind === "create" && input.model ? { modelId: input.model
|
|
28044
|
+
...input.kind === "create" && input.model ? { modelId: decodeGrokModelRef(input.model) } : {}
|
|
27548
28045
|
});
|
|
27549
28046
|
}
|
|
27550
28047
|
if (!opened) {
|
|
@@ -27558,7 +28055,8 @@ var GrokAdapter = class {
|
|
|
27558
28055
|
}
|
|
27559
28056
|
};
|
|
27560
28057
|
}
|
|
27561
|
-
const
|
|
28058
|
+
const sessionModelState = modelStateFromSessionResponse(opened.session);
|
|
28059
|
+
const modelState = sessionModelState ?? modelStateFromInitialize(opened.initialize);
|
|
27562
28060
|
if (!modelState)
|
|
27563
28061
|
throw new GrokTransportError("protocolError", "Grok returned an invalid Model catalog");
|
|
27564
28062
|
const nativeModelId = modelState.currentModel.id;
|
|
@@ -27600,9 +28098,17 @@ var GrokAdapter = class {
|
|
|
27600
28098
|
delete modelState.currentThinkingOptionId;
|
|
27601
28099
|
}
|
|
27602
28100
|
}
|
|
28101
|
+
const savedModel = input.kind === "resume" && !sessionModelState && input.model ? modelState.catalog.models.find(({ ref }) => ref.id === input.model?.id) : void 0;
|
|
28102
|
+
if (savedModel) {
|
|
28103
|
+
modelState.currentModel = savedModel.ref;
|
|
28104
|
+
const thinking = modelState.currentThinkingOptionId;
|
|
28105
|
+
if (thinking && !savedModel.supportedThinkingOptionIds?.includes(thinking)) {
|
|
28106
|
+
delete modelState.currentThinkingOptionId;
|
|
28107
|
+
}
|
|
28108
|
+
}
|
|
27603
28109
|
const contextWindow = modelState.defaultContextWindowTokensByModel.get(modelState.currentModel.id);
|
|
27604
|
-
if (modelState.currentModel.id !== nativeModelId || modelState.currentThinkingOptionId !== nativeThinkingOptionId || contextWindow !== void 0 && modelState.contextWindowTokensByModel.get(modelState.currentModel.id) !== contextWindow) {
|
|
27605
|
-
await transport.setModel(modelState.currentModel
|
|
28110
|
+
if (savedModel || modelState.currentModel.id !== nativeModelId || modelState.currentThinkingOptionId !== nativeThinkingOptionId || contextWindow !== void 0 && modelState.contextWindowTokensByModel.get(modelState.currentModel.id) !== contextWindow) {
|
|
28111
|
+
await transport.setModel(decodeGrokModelRef(modelState.currentModel), modelState.currentThinkingOptionId, contextWindow);
|
|
27606
28112
|
if (contextWindow !== void 0) {
|
|
27607
28113
|
modelState.contextWindowTokensByModel = new Map([
|
|
27608
28114
|
...modelState.contextWindowTokensByModel,
|