@codexhost/cli-linux-arm64 0.22.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 +3332 -249
- package/app/console-web.js +9883 -2837
- package/app/desktop-controller.mjs +3135 -309
- package/app/host-runtime.mjs +6571 -2095
- package/app/plugins/antigravity/plugin.mjs +682 -114
- package/app/plugins/claude-code/plugin.mjs +883 -154
- package/app/plugins/codebuddy/plugin.mjs +587 -109
- package/app/plugins/codex-usage/plugin.mjs +532 -88
- package/app/plugins/copilot/plugin.mjs +532 -88
- package/app/plugins/cursor-cli/plugin.mjs +587 -109
- package/app/plugins/deepseek-harness/plugin.mjs +874 -218
- package/app/plugins/devin/plugin.mjs +532 -88
- package/app/plugins/grok/plugin.mjs +596 -105
- package/app/plugins/hermes/plugin.mjs +532 -88
- package/app/plugins/kimi-code/plugin.mjs +532 -88
- package/app/plugins/kiro-cli/plugin.mjs +532 -88
- package/app/plugins/omp/plugin.mjs +532 -88
- package/app/plugins/opencode/plugin.mjs +532 -88
- package/app/plugins/pi/plugin.mjs +538 -93
- package/app/plugins/qoder/plugin.mjs +532 -88
- package/app/plugins/qoder-cn/plugin.mjs +532 -88
- package/app/plugins/qwen-code/plugin.mjs +532 -88
- package/app/plugins/workbuddy/plugin.mjs +645 -120
- package/app/plugins/zcode/plugin.mjs +539 -95
- package/app/renderer-extension.js +12946 -4450
- package/app/web/assets/index-Dyh1KzAB.js +201 -0
- package/app/web/codexhost-settings.js +9793 -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 +34991 -3000
- 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-CN4a4sj0.js +0 -201
|
@@ -14928,6 +14928,87 @@ function date4(params) {
|
|
|
14928
14928
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
14929
14929
|
config(en_default());
|
|
14930
14930
|
|
|
14931
|
+
// ../../shared-contracts/dist/ids.js
|
|
14932
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
14933
|
+
message: "Identifier must not be empty or whitespace"
|
|
14934
|
+
});
|
|
14935
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14936
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14937
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14938
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14939
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14940
|
+
|
|
14941
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
14942
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
14943
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
14944
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
14945
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
14946
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
14947
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
14948
|
+
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");
|
|
14949
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
14950
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
14951
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
14952
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
14953
|
+
before: localizedTextSchema.optional(),
|
|
14954
|
+
after: localizedTextSchema.optional(),
|
|
14955
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
14956
|
+
}).strict();
|
|
14957
|
+
var pluginPresentationShape = {
|
|
14958
|
+
id: installedHarnessPluginIdSchema,
|
|
14959
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
14960
|
+
version: external_exports.string().min(1).max(128),
|
|
14961
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
14962
|
+
kind: external_exports.literal("usage").optional(),
|
|
14963
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
14964
|
+
iconStyle: external_exports.object({
|
|
14965
|
+
vector: external_exports.object({
|
|
14966
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
14967
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
14968
|
+
paths: external_exports.array(external_exports.object({
|
|
14969
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
14970
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
14971
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
14972
|
+
}).strict()).min(1).max(32)
|
|
14973
|
+
}).strict().optional(),
|
|
14974
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
14975
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
14976
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
14977
|
+
}).strict().optional(),
|
|
14978
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
14979
|
+
notice: localizedTextSchema.optional(),
|
|
14980
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
14981
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
14982
|
+
links: external_exports.object({
|
|
14983
|
+
website: documentationUrlSchema.optional(),
|
|
14984
|
+
documentation: documentationUrlSchema.optional(),
|
|
14985
|
+
installation: documentationUrlSchema.optional()
|
|
14986
|
+
}).strict().optional()
|
|
14987
|
+
};
|
|
14988
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
14989
|
+
manifestVersion: external_exports.literal(1),
|
|
14990
|
+
...pluginPresentationShape,
|
|
14991
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
14992
|
+
entry: pluginRelativeResourceSchema,
|
|
14993
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
14994
|
+
}).strict();
|
|
14995
|
+
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);
|
|
14996
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
14997
|
+
...pluginPresentationShape,
|
|
14998
|
+
icon: harnessPluginIconSchema.optional()
|
|
14999
|
+
}).strict();
|
|
15000
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15001
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15002
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
15003
|
+
}).strict();
|
|
15004
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15005
|
+
version: external_exports.literal(1),
|
|
15006
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15007
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15008
|
+
message: "Enabled plugin IDs must be unique",
|
|
15009
|
+
path: ["enabled"]
|
|
15010
|
+
});
|
|
15011
|
+
|
|
14931
15012
|
// ../../shared-contracts/dist/json-value.js
|
|
14932
15013
|
function rejectExplicitUndefined(keys) {
|
|
14933
15014
|
return (value, context) => {
|
|
@@ -14987,6 +15068,346 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
14987
15068
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
14988
15069
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
14989
15070
|
|
|
15071
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
15072
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
15073
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
15074
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
15075
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
|
|
15076
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
15077
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
15078
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
15079
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
15080
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
15081
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
15082
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
15083
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
15084
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
15085
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
15086
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
15087
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
15088
|
+
"sidebar.thread-layout",
|
|
15089
|
+
"sidebar.thread-badge",
|
|
15090
|
+
"appearance.theme"
|
|
15091
|
+
]);
|
|
15092
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
15093
|
+
"appearance",
|
|
15094
|
+
"interface",
|
|
15095
|
+
"workflow",
|
|
15096
|
+
"analytics",
|
|
15097
|
+
"integrations",
|
|
15098
|
+
"tools"
|
|
15099
|
+
]);
|
|
15100
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
15101
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
15102
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15103
|
+
case "png":
|
|
15104
|
+
return "image/png";
|
|
15105
|
+
case "jpg":
|
|
15106
|
+
case "jpeg":
|
|
15107
|
+
return "image/jpeg";
|
|
15108
|
+
case "webp":
|
|
15109
|
+
return "image/webp";
|
|
15110
|
+
default:
|
|
15111
|
+
return void 0;
|
|
15112
|
+
}
|
|
15113
|
+
}
|
|
15114
|
+
function desktopExtensionAssetMimeType(resource) {
|
|
15115
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
15116
|
+
case "gif":
|
|
15117
|
+
return "image/gif";
|
|
15118
|
+
case "svg":
|
|
15119
|
+
return "image/svg+xml";
|
|
15120
|
+
case "woff2":
|
|
15121
|
+
return "font/woff2";
|
|
15122
|
+
case "json":
|
|
15123
|
+
return "application/json";
|
|
15124
|
+
case "css":
|
|
15125
|
+
return "text/css";
|
|
15126
|
+
default:
|
|
15127
|
+
return desktopExtensionScreenshotMimeType(resource);
|
|
15128
|
+
}
|
|
15129
|
+
}
|
|
15130
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
15131
|
+
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
15132
|
+
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");
|
|
15133
|
+
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) => {
|
|
15134
|
+
const { username, password } = new URL(value);
|
|
15135
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
15136
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
15137
|
+
function localizedText(text2) {
|
|
15138
|
+
return external_exports.strictObject({ en: text2, "zh-CN": text2 });
|
|
15139
|
+
}
|
|
15140
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
15141
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
15142
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
15143
|
+
var settingField = {
|
|
15144
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
15145
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
15146
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
15147
|
+
};
|
|
15148
|
+
var numericSetting = {
|
|
15149
|
+
...settingField,
|
|
15150
|
+
step: external_exports.number().positive().optional(),
|
|
15151
|
+
default: external_exports.number().optional()
|
|
15152
|
+
};
|
|
15153
|
+
var settingOption = external_exports.strictObject({
|
|
15154
|
+
value: external_exports.string(),
|
|
15155
|
+
label: desktopExtensionLocalizedTextSchema
|
|
15156
|
+
});
|
|
15157
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
15158
|
+
external_exports.strictObject({
|
|
15159
|
+
...settingField,
|
|
15160
|
+
type: external_exports.literal("boolean"),
|
|
15161
|
+
default: external_exports.boolean().optional()
|
|
15162
|
+
}),
|
|
15163
|
+
external_exports.strictObject({
|
|
15164
|
+
...settingField,
|
|
15165
|
+
type: external_exports.literal("string"),
|
|
15166
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
15167
|
+
default: external_exports.string().optional()
|
|
15168
|
+
}),
|
|
15169
|
+
external_exports.strictObject({
|
|
15170
|
+
...numericSetting,
|
|
15171
|
+
type: external_exports.literal("number"),
|
|
15172
|
+
min: external_exports.number().optional(),
|
|
15173
|
+
max: external_exports.number().optional()
|
|
15174
|
+
}),
|
|
15175
|
+
external_exports.strictObject({
|
|
15176
|
+
...numericSetting,
|
|
15177
|
+
type: external_exports.literal("range"),
|
|
15178
|
+
min: external_exports.number(),
|
|
15179
|
+
max: external_exports.number()
|
|
15180
|
+
}),
|
|
15181
|
+
external_exports.strictObject({
|
|
15182
|
+
...settingField,
|
|
15183
|
+
type: external_exports.literal("select"),
|
|
15184
|
+
options: external_exports.array(settingOption).min(1),
|
|
15185
|
+
default: external_exports.string().optional()
|
|
15186
|
+
})
|
|
15187
|
+
]).superRefine((field3, ctx) => {
|
|
15188
|
+
const issue2 = (path13, message3) => ctx.addIssue({ code: "custom", path: [path13], message: message3 });
|
|
15189
|
+
if (field3.type === "number" || field3.type === "range") {
|
|
15190
|
+
const { min = -Infinity, max = Infinity, default: value } = field3;
|
|
15191
|
+
if (min > max)
|
|
15192
|
+
issue2("max", "Must be at least min");
|
|
15193
|
+
if (value !== void 0 && (value < min || value > max))
|
|
15194
|
+
issue2("default", "Must be within min and max");
|
|
15195
|
+
} else if (field3.type === "select") {
|
|
15196
|
+
const values = new Set(field3.options.map(({ value }) => value));
|
|
15197
|
+
if (values.size !== field3.options.length)
|
|
15198
|
+
issue2("options", "Duplicate option values");
|
|
15199
|
+
if (field3.default !== void 0 && !values.has(field3.default))
|
|
15200
|
+
issue2("default", "Must match an option value");
|
|
15201
|
+
}
|
|
15202
|
+
});
|
|
15203
|
+
var manifestHeader = external_exports.object({
|
|
15204
|
+
manifestVersion: external_exports.int().positive(),
|
|
15205
|
+
id: desktopExtensionIdSchema,
|
|
15206
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
15207
|
+
version: external_exports.string().min(1).max(128),
|
|
15208
|
+
desktopApi: external_exports.int().positive()
|
|
15209
|
+
}).passthrough();
|
|
15210
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
15211
|
+
manifestVersion: external_exports.literal(1),
|
|
15212
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
15213
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
15214
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
15215
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
15216
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
15217
|
+
icon: imagePathSchema.optional(),
|
|
15218
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
15219
|
+
desktop: external_exports.strictObject({
|
|
15220
|
+
script: pluginRelativeResourceSchema,
|
|
15221
|
+
style: pluginRelativeResourceSchema.optional()
|
|
15222
|
+
}).optional(),
|
|
15223
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
15224
|
+
slots: slotsSchema.default(() => []),
|
|
15225
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
15226
|
+
categories: categoriesSchema.optional()
|
|
15227
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
15228
|
+
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
15229
|
+
version: external_exports.literal(1),
|
|
15230
|
+
revision: external_exports.int().nonnegative(),
|
|
15231
|
+
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
15232
|
+
reloadToken: external_exports.uuid().optional()
|
|
15233
|
+
});
|
|
15234
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
15235
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
15236
|
+
state: external_exports.enum([
|
|
15237
|
+
"running",
|
|
15238
|
+
"disabled",
|
|
15239
|
+
"invalid",
|
|
15240
|
+
"incompatible",
|
|
15241
|
+
"conflict",
|
|
15242
|
+
"failed",
|
|
15243
|
+
"waiting"
|
|
15244
|
+
]),
|
|
15245
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
15246
|
+
error: external_exports.string().optional(),
|
|
15247
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
15248
|
+
});
|
|
15249
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
15250
|
+
controllerPid: external_exports.int().positive(),
|
|
15251
|
+
targetId: external_exports.string().nullable(),
|
|
15252
|
+
updatedAt: external_exports.iso.datetime(),
|
|
15253
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
15254
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
15255
|
+
});
|
|
15256
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
15257
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
15258
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
15259
|
+
}
|
|
15260
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
15261
|
+
const url2 = new URL(input);
|
|
15262
|
+
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);
|
|
15263
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
15264
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
15265
|
+
id: desktopExtensionIdSchema,
|
|
15266
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
15267
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
15268
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
15269
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
15270
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
15271
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
15272
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
15273
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
15274
|
+
categories: categoriesSchema.optional(),
|
|
15275
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
15276
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
15277
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15278
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
15279
|
+
sha256: desktopExtensionHashSchema,
|
|
15280
|
+
slots: slotsSchema.optional(),
|
|
15281
|
+
publishedAt: external_exports.string().optional(),
|
|
15282
|
+
updatedAt: external_exports.string().optional(),
|
|
15283
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
15284
|
+
});
|
|
15285
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
15286
|
+
schemaVersion: external_exports.literal(1),
|
|
15287
|
+
generatedAt: external_exports.string(),
|
|
15288
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
15289
|
+
});
|
|
15290
|
+
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
15291
|
+
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
15292
|
+
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
15293
|
+
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
15294
|
+
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
15295
|
+
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
15296
|
+
...extensionIdParams,
|
|
15297
|
+
path: desktopExtensionAssetPathSchema
|
|
15298
|
+
});
|
|
15299
|
+
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
15300
|
+
mimeType: external_exports.string(),
|
|
15301
|
+
dataUrl: external_exports.string()
|
|
15302
|
+
});
|
|
15303
|
+
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
15304
|
+
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
15305
|
+
...extensionIdParams,
|
|
15306
|
+
values: jsonObjectSchema
|
|
15307
|
+
});
|
|
15308
|
+
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
15309
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
15310
|
+
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
15311
|
+
...extensionIdParams,
|
|
15312
|
+
method: desktopExtensionBackendMethodSchema,
|
|
15313
|
+
params: jsonValueSchema.optional()
|
|
15314
|
+
});
|
|
15315
|
+
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
15316
|
+
result: jsonValueSchema
|
|
15317
|
+
});
|
|
15318
|
+
|
|
15319
|
+
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
15320
|
+
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
15321
|
+
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
15322
|
+
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
15323
|
+
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
15324
|
+
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
15325
|
+
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
15326
|
+
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
15327
|
+
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
15328
|
+
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
15329
|
+
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
15330
|
+
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
15331
|
+
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
15332
|
+
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
15333
|
+
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
15334
|
+
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
15335
|
+
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
15336
|
+
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
15337
|
+
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
15338
|
+
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
15339
|
+
];
|
|
15340
|
+
var revisionSchema = external_exports.int().nonnegative();
|
|
15341
|
+
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
15342
|
+
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
15343
|
+
id: desktopExtensionIdSchema,
|
|
15344
|
+
expectedRevision: revisionSchema
|
|
15345
|
+
});
|
|
15346
|
+
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
15347
|
+
expectedRevision: revisionSchema.optional()
|
|
15348
|
+
});
|
|
15349
|
+
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);
|
|
15350
|
+
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
15351
|
+
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
15352
|
+
id: external_exports.string().min(1),
|
|
15353
|
+
manifest: desktopExtensionManifestSchema.optional(),
|
|
15354
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
15355
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
15356
|
+
enabled: external_exports.boolean(),
|
|
15357
|
+
status: desktopExtensionStatusSchema
|
|
15358
|
+
});
|
|
15359
|
+
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
15360
|
+
configuration: desktopExtensionConfigurationSchema,
|
|
15361
|
+
desktopConnected: external_exports.boolean(),
|
|
15362
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
15363
|
+
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
15364
|
+
});
|
|
15365
|
+
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
15366
|
+
forceRefresh: external_exports.boolean().optional()
|
|
15367
|
+
});
|
|
15368
|
+
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
15369
|
+
catalogUrl: external_exports.string(),
|
|
15370
|
+
source: external_exports.enum(["remote", "fallback"]),
|
|
15371
|
+
fetchedAt: external_exports.string(),
|
|
15372
|
+
cached: external_exports.boolean(),
|
|
15373
|
+
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
15374
|
+
error: external_exports.string().optional()
|
|
15375
|
+
});
|
|
15376
|
+
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
15377
|
+
source: external_exports.discriminatedUnion("type", [
|
|
15378
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
15379
|
+
external_exports.strictObject({
|
|
15380
|
+
type: external_exports.literal("url"),
|
|
15381
|
+
url: desktopExtensionHttpUrlSchema,
|
|
15382
|
+
expectedSha256: desktopExtensionHashSchema.optional()
|
|
15383
|
+
}),
|
|
15384
|
+
external_exports.strictObject({
|
|
15385
|
+
type: external_exports.literal("zip-base64"),
|
|
15386
|
+
fileName: external_exports.string().trim().min(1).max(255),
|
|
15387
|
+
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")
|
|
15388
|
+
})
|
|
15389
|
+
])
|
|
15390
|
+
});
|
|
15391
|
+
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
15392
|
+
extensionId: desktopExtensionIdSchema,
|
|
15393
|
+
version: external_exports.string().min(1),
|
|
15394
|
+
replaced: external_exports.boolean(),
|
|
15395
|
+
installedPath: external_exports.string(),
|
|
15396
|
+
list: desktopExtensionsListResultSchema
|
|
15397
|
+
});
|
|
15398
|
+
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
15399
|
+
id: desktopExtensionIdSchema
|
|
15400
|
+
});
|
|
15401
|
+
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
15402
|
+
removedId: desktopExtensionIdSchema,
|
|
15403
|
+
list: desktopExtensionsListResultSchema
|
|
15404
|
+
});
|
|
15405
|
+
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
15406
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
15407
|
+
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
15408
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
15409
|
+
]);
|
|
15410
|
+
|
|
14990
15411
|
// ../../shared-contracts/dist/errors.js
|
|
14991
15412
|
var codexhostErrorSchema = external_exports.strictObject({
|
|
14992
15413
|
code: external_exports.string().min(1),
|
|
@@ -15007,16 +15428,6 @@ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_
|
|
|
15007
15428
|
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
15008
15429
|
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");
|
|
15009
15430
|
|
|
15010
|
-
// ../../shared-contracts/dist/ids.js
|
|
15011
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15012
|
-
message: "Identifier must not be empty or whitespace"
|
|
15013
|
-
});
|
|
15014
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15015
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15016
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15017
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15018
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15019
|
-
|
|
15020
15431
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
15021
15432
|
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
15022
15433
|
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
@@ -15216,6 +15627,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
15216
15627
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
15217
15628
|
resetCredits: accountResetCreditsSchema.optional()
|
|
15218
15629
|
}).strict();
|
|
15630
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15631
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15632
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15633
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15634
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15635
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15636
|
+
}).strict();
|
|
15219
15637
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
15220
15638
|
threadId: hostThreadIdSchema,
|
|
15221
15639
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -15224,7 +15642,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
15224
15642
|
threadId: hostThreadIdSchema,
|
|
15225
15643
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
15226
15644
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15227
|
-
/**
|
|
15645
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
15646
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
15647
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
15648
|
+
* independently of usage. */
|
|
15228
15649
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
15229
15650
|
}).strict();
|
|
15230
15651
|
|
|
@@ -15516,12 +15937,89 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
15516
15937
|
}).strict();
|
|
15517
15938
|
|
|
15518
15939
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
15940
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
15519
15941
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
15520
15942
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
15521
15943
|
|
|
15522
15944
|
// ../../shared-contracts/dist/client-channel.js
|
|
15523
15945
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
15524
15946
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
15947
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
15948
|
+
"codexhost/skills/list",
|
|
15949
|
+
"codexhost/voice/status",
|
|
15950
|
+
"codexhost/voice/transcribe",
|
|
15951
|
+
"codexhost/harness/display-settings/get",
|
|
15952
|
+
"codexhost/harness/display-settings/set",
|
|
15953
|
+
"codexhost/harness/display-settings/capabilities",
|
|
15954
|
+
"codexhost/harness/preferences/get",
|
|
15955
|
+
"codexhost/harness/preferences/patch",
|
|
15956
|
+
"thread/list",
|
|
15957
|
+
"codexhost/thread/catalog/read",
|
|
15958
|
+
"thread/read",
|
|
15959
|
+
"thread/resume",
|
|
15960
|
+
"thread/fork",
|
|
15961
|
+
"thread/turns/list",
|
|
15962
|
+
"thread/revert",
|
|
15963
|
+
"thread/items/list",
|
|
15964
|
+
"thread/start",
|
|
15965
|
+
"thread/name/set",
|
|
15966
|
+
"codexhost/thread/title/generate",
|
|
15967
|
+
"thread/archive",
|
|
15968
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
15969
|
+
"thread/unarchive",
|
|
15970
|
+
"turn/start",
|
|
15971
|
+
"turn/interrupt",
|
|
15972
|
+
"turn/steer",
|
|
15973
|
+
"thread/queue/list",
|
|
15974
|
+
"thread/queue/add",
|
|
15975
|
+
"thread/queue/update",
|
|
15976
|
+
"thread/queue/delete",
|
|
15977
|
+
"thread/queue/reorder",
|
|
15978
|
+
"thread/queue/start",
|
|
15979
|
+
"codexhost/thread/queue/send-now",
|
|
15980
|
+
"codexhost/workspace/read",
|
|
15981
|
+
"codexhost/thread/tree/read",
|
|
15982
|
+
"codexhost/thread/pins/list",
|
|
15983
|
+
"codexhost/thread/pins/set",
|
|
15984
|
+
"codexhost/harness/plugins/list",
|
|
15985
|
+
"codexhost/harness/inspect",
|
|
15986
|
+
"codexhost/thread/inspect",
|
|
15987
|
+
"codexhost/thread/usage/inspect",
|
|
15988
|
+
"codexhost/thread/ownership/list",
|
|
15989
|
+
"codexhost/thread/model/select",
|
|
15990
|
+
"codexhost/thread/thinking/select",
|
|
15991
|
+
"codexhost/thread/permission-mode/select",
|
|
15992
|
+
"codexhost/thread/commands/inspect",
|
|
15993
|
+
"codexhost/harness/commands/inspect",
|
|
15994
|
+
"codexhost/thread/command/execute",
|
|
15995
|
+
"codexhost/thread/fork",
|
|
15996
|
+
"codexhost/harness/session-import/sources",
|
|
15997
|
+
"codexhost/harness/session-import/list",
|
|
15998
|
+
"codexhost/harness/session-import/import",
|
|
15999
|
+
// Host settings shared across Desktop and Web.
|
|
16000
|
+
...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
|
|
16001
|
+
"codexhost/harness/installation",
|
|
16002
|
+
"codexhost/harness/installation/start",
|
|
16003
|
+
"codexhost/harness/installation/status",
|
|
16004
|
+
"codexhost/harness/launch-settings/get",
|
|
16005
|
+
"codexhost/harness/launch-settings/set",
|
|
16006
|
+
"codexhost/harness/web-ui/open",
|
|
16007
|
+
"codexhost/harness/accounts/sources",
|
|
16008
|
+
"codexhost/harness/accounts/list",
|
|
16009
|
+
"codexhost/harness/accounts/inspect",
|
|
16010
|
+
"codexhost/harness/credential-imports",
|
|
16011
|
+
"codexhost/account/list",
|
|
16012
|
+
"codexhost/account/refresh",
|
|
16013
|
+
"codexhost/account/usage/inspect",
|
|
16014
|
+
"codexhost/usage/model-prices/get",
|
|
16015
|
+
"codexhost/usage/model-prices/set",
|
|
16016
|
+
"codexhost/usage/model-prices/default",
|
|
16017
|
+
"codexhost/usage/statistics/get",
|
|
16018
|
+
"codexhost/update/check",
|
|
16019
|
+
"codexhost/update/start",
|
|
16020
|
+
"codexhost/update/status",
|
|
16021
|
+
"codexhost/sessions/loaded/list"
|
|
16022
|
+
];
|
|
15525
16023
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
15526
16024
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
15527
16025
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -15735,6 +16233,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
15735
16233
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15736
16234
|
}).strict();
|
|
15737
16235
|
|
|
16236
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
16237
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
16238
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
16239
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
16240
|
+
harnessId: harnessIdSchema,
|
|
16241
|
+
title: external_exports.string().optional(),
|
|
16242
|
+
status: threadTreeStatusSchema,
|
|
16243
|
+
archived: external_exports.boolean()
|
|
16244
|
+
});
|
|
16245
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
16246
|
+
revision: external_exports.int().nonnegative(),
|
|
16247
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
16248
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
16249
|
+
truncated: external_exports.boolean()
|
|
16250
|
+
}).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");
|
|
16251
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
16252
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
16253
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
16254
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
16255
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
16256
|
+
snapshot: threadTreeSnapshotSchema
|
|
16257
|
+
});
|
|
16258
|
+
|
|
15738
16259
|
// ../../shared-contracts/dist/voice.js
|
|
15739
16260
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
15740
16261
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -16365,13 +16886,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
16365
16886
|
});
|
|
16366
16887
|
|
|
16367
16888
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
16368
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
16369
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
16370
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
16371
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
16372
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
16373
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
16374
|
-
}).strict();
|
|
16375
16889
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
16376
16890
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
16377
16891
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -16405,76 +16919,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
16405
16919
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
16406
16920
|
}).strict();
|
|
16407
16921
|
|
|
16408
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
16409
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
16410
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
16411
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
16412
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
16413
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
16414
|
-
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");
|
|
16415
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
16416
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
16417
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
16418
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
16419
|
-
before: localizedTextSchema.optional(),
|
|
16420
|
-
after: localizedTextSchema.optional(),
|
|
16421
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
16422
|
-
}).strict();
|
|
16423
|
-
var pluginPresentationShape = {
|
|
16424
|
-
id: installedHarnessPluginIdSchema,
|
|
16425
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
16426
|
-
version: external_exports.string().min(1).max(128),
|
|
16427
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
16428
|
-
kind: external_exports.literal("usage").optional(),
|
|
16429
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
16430
|
-
iconStyle: external_exports.object({
|
|
16431
|
-
vector: external_exports.object({
|
|
16432
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
16433
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
16434
|
-
paths: external_exports.array(external_exports.object({
|
|
16435
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
16436
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
16437
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
16438
|
-
}).strict()).min(1).max(32)
|
|
16439
|
-
}).strict().optional(),
|
|
16440
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
16441
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
16442
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
16443
|
-
}).strict().optional(),
|
|
16444
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
16445
|
-
notice: localizedTextSchema.optional(),
|
|
16446
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
16447
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
16448
|
-
links: external_exports.object({
|
|
16449
|
-
website: documentationUrlSchema.optional(),
|
|
16450
|
-
documentation: documentationUrlSchema.optional(),
|
|
16451
|
-
installation: documentationUrlSchema.optional()
|
|
16452
|
-
}).strict().optional()
|
|
16453
|
-
};
|
|
16454
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
16455
|
-
manifestVersion: external_exports.literal(1),
|
|
16456
|
-
...pluginPresentationShape,
|
|
16457
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
16458
|
-
entry: relativeResourceSchema,
|
|
16459
|
-
icon: relativeResourceSchema.optional()
|
|
16460
|
-
}).strict();
|
|
16461
|
-
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);
|
|
16462
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
16463
|
-
...pluginPresentationShape,
|
|
16464
|
-
icon: harnessPluginIconSchema.optional()
|
|
16465
|
-
}).strict();
|
|
16466
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
16467
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
16468
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
16469
|
-
}).strict();
|
|
16470
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
16471
|
-
version: external_exports.literal(1),
|
|
16472
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
16473
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
16474
|
-
message: "Enabled plugin IDs must be unique",
|
|
16475
|
-
path: ["enabled"]
|
|
16476
|
-
});
|
|
16477
|
-
|
|
16478
16922
|
// ../../shared-contracts/dist/harness-route.js
|
|
16479
16923
|
var harnessPluginRouteSchema = external_exports.object({
|
|
16480
16924
|
harnessId: harnessPluginIdSchema,
|
|
@@ -22894,7 +23338,9 @@ var AntigravityAcpTransport = class {
|
|
|
22894
23338
|
#sessionId = null;
|
|
22895
23339
|
#sessionHandler = null;
|
|
22896
23340
|
#active = null;
|
|
23341
|
+
#promptRequestId;
|
|
22897
23342
|
#callbacks = /* @__PURE__ */ new Set();
|
|
23343
|
+
#acceptedCallbacks = /* @__PURE__ */ new WeakSet();
|
|
22898
23344
|
#acceptCallbacks = false;
|
|
22899
23345
|
#promptInterrupted = null;
|
|
22900
23346
|
#opening = null;
|
|
@@ -22954,7 +23400,18 @@ var AntigravityAcpTransport = class {
|
|
|
22954
23400
|
strategy: { highWaterMark: Infinity }
|
|
22955
23401
|
})
|
|
22956
23402
|
);
|
|
23403
|
+
const writer = stream.writable.getWriter();
|
|
23404
|
+
stream.writable = new WritableStream({
|
|
23405
|
+
write: (message3) => {
|
|
23406
|
+
if ("method" in message3 && message3.method === "session/prompt" && "id" in message3)
|
|
23407
|
+
this.#promptRequestId = message3.id;
|
|
23408
|
+
return writer.write(message3);
|
|
23409
|
+
},
|
|
23410
|
+
close: () => writer.close(),
|
|
23411
|
+
abort: (reason) => writer.abort(reason)
|
|
23412
|
+
});
|
|
22957
23413
|
const nativeMethods = /* @__PURE__ */ new Set(["session/request_permission", "elicitation/create"]);
|
|
23414
|
+
const extensionPrefix = "_antigravity/";
|
|
22958
23415
|
stream.readable = stream.readable.pipeThrough(new TransformStream({
|
|
22959
23416
|
transform: (message3, controller) => {
|
|
22960
23417
|
if ("method" in message3 && message3.method === "session/update") {
|
|
@@ -22962,15 +23419,26 @@ var AntigravityAcpTransport = class {
|
|
|
22962
23419
|
this.#update(params.sessionId, params.update);
|
|
22963
23420
|
return;
|
|
22964
23421
|
}
|
|
22965
|
-
if ("method" in message3 &&
|
|
22966
|
-
message3.method
|
|
23422
|
+
if ("method" in message3 && typeof message3.method === "string") {
|
|
23423
|
+
const method = message3.method.startsWith(extensionPrefix) ? message3.method.slice(extensionPrefix.length) : message3.method;
|
|
23424
|
+
if (nativeMethods.has(method)) {
|
|
23425
|
+
message3.method = extensionPrefix + method;
|
|
23426
|
+
if (this.#acceptCallbacks && "id" in message3 && typeof message3.params === "object" && message3.params !== null)
|
|
23427
|
+
this.#acceptedCallbacks.add(message3.params);
|
|
23428
|
+
}
|
|
23429
|
+
}
|
|
23430
|
+
if (!("method" in message3) && "id" in message3 && message3.id === this.#promptRequestId && ("result" in message3 || "error" in message3)) {
|
|
23431
|
+
this.#promptRequestId = void 0;
|
|
23432
|
+
this.#acceptCallbacks = false;
|
|
23433
|
+
this.#active?.onResponse?.();
|
|
23434
|
+
}
|
|
22967
23435
|
controller.enqueue(message3);
|
|
22968
23436
|
}
|
|
22969
23437
|
}));
|
|
22970
|
-
const onElicitation = (request) => this.#callback(
|
|
23438
|
+
const onElicitation = (request) => this.#callback(request, (handler) => handler.onElicitation(request), { action: "cancel" });
|
|
22971
23439
|
const client2 = {
|
|
22972
23440
|
sessionUpdate: ({ sessionId, update }) => this.#update(sessionId, update),
|
|
22973
|
-
requestPermission: (request) => this.#callback(request
|
|
23441
|
+
requestPermission: (request) => this.#callback(request, (handler) => handler.onPermission(request), {
|
|
22974
23442
|
outcome: { outcome: "cancelled" }
|
|
22975
23443
|
}),
|
|
22976
23444
|
unstable_createElicitation: onElicitation,
|
|
@@ -23067,6 +23535,7 @@ var AntigravityAcpTransport = class {
|
|
|
23067
23535
|
this.#clearCallbacks();
|
|
23068
23536
|
this.#acceptCallbacks = false;
|
|
23069
23537
|
this.#active = null;
|
|
23538
|
+
this.#promptRequestId = void 0;
|
|
23070
23539
|
this.#promptInterrupted = null;
|
|
23071
23540
|
}
|
|
23072
23541
|
}
|
|
@@ -23082,6 +23551,7 @@ var AntigravityAcpTransport = class {
|
|
|
23082
23551
|
this.#acceptCallbacks = false;
|
|
23083
23552
|
this.#promptInterrupted?.abort(new AntigravityTransportError("unavailable", "ACP session closed"));
|
|
23084
23553
|
this.#active = null;
|
|
23554
|
+
this.#promptRequestId = void 0;
|
|
23085
23555
|
this.#pendingEvents = [];
|
|
23086
23556
|
this.#clearCallbacks();
|
|
23087
23557
|
if (sessionId && this.#connection)
|
|
@@ -23139,7 +23609,9 @@ ${this.#error(error51).message}`.slice(-32e3);
|
|
|
23139
23609
|
this.#dispatch(event);
|
|
23140
23610
|
}
|
|
23141
23611
|
#dispatch(event) {
|
|
23142
|
-
if (["config.update", "mode.update", "commands.update", "session.info", "usage.context"].includes(event.type)
|
|
23612
|
+
if (["config.update", "mode.update", "commands.update", "session.info", "usage.context"].includes(event.type) || // The wire request bounds foreground updates; the handler may still
|
|
23613
|
+
// be present to let the SDK finish processing earlier callbacks.
|
|
23614
|
+
this.#promptRequestId === void 0 && !this.#opening) {
|
|
23143
23615
|
if (this.#sessionHandler)
|
|
23144
23616
|
this.#sessionHandler(event);
|
|
23145
23617
|
else
|
|
@@ -23147,9 +23619,9 @@ ${this.#error(error51).message}`.slice(-32e3);
|
|
|
23147
23619
|
} else
|
|
23148
23620
|
this.#active?.onEvent(event);
|
|
23149
23621
|
}
|
|
23150
|
-
async #callback(
|
|
23622
|
+
async #callback(request, invoke, cancelled) {
|
|
23151
23623
|
const active = this.#active;
|
|
23152
|
-
if (!active || !this.#
|
|
23624
|
+
if (!active || !this.#acceptedCallbacks.delete(request) || !("sessionId" in request) || request.sessionId !== this.#sessionId || this.#closed)
|
|
23153
23625
|
return cancelled;
|
|
23154
23626
|
let cancel;
|
|
23155
23627
|
const cancellation = new Promise((resolve) => {
|
|
@@ -23163,6 +23635,7 @@ ${this.#error(error51).message}`.slice(-32e3);
|
|
|
23163
23635
|
}
|
|
23164
23636
|
}
|
|
23165
23637
|
#clearCallbacks() {
|
|
23638
|
+
this.#acceptedCallbacks = /* @__PURE__ */ new WeakSet();
|
|
23166
23639
|
for (const cancel of this.#callbacks)
|
|
23167
23640
|
cancel();
|
|
23168
23641
|
this.#callbacks.clear();
|
|
@@ -25656,6 +26129,9 @@ var AntigravitySession = class {
|
|
|
25656
26129
|
#commands = ANTIGRAVITY_COMMAND_CATALOG;
|
|
25657
26130
|
#turnCount = 0;
|
|
25658
26131
|
#active;
|
|
26132
|
+
#lastCompletedTurnId;
|
|
26133
|
+
#background;
|
|
26134
|
+
#postPromptBackground = [];
|
|
25659
26135
|
#pending = /* @__PURE__ */ new Map();
|
|
25660
26136
|
#usage;
|
|
25661
26137
|
#usageWork = Promise.resolve();
|
|
@@ -25908,6 +26384,10 @@ var AntigravitySession = class {
|
|
|
25908
26384
|
this.#applyConfig(confirmed);
|
|
25909
26385
|
}
|
|
25910
26386
|
#sessionEvent(event) {
|
|
26387
|
+
if (event.type === "agent.text" || event.type === "agent.thought") {
|
|
26388
|
+
this.#appendBackgroundText(event.type === "agent.text" ? "agentMessage" : "reasoning", event.text);
|
|
26389
|
+
return;
|
|
26390
|
+
}
|
|
25911
26391
|
switch (event.type) {
|
|
25912
26392
|
case "config.update":
|
|
25913
26393
|
this.#applyConfig(event.configOptions);
|
|
@@ -25926,7 +26406,7 @@ var AntigravitySession = class {
|
|
|
25926
26406
|
const usage = this.#usage?.recordContextWindow(event.used, event.size);
|
|
25927
26407
|
if (usage)
|
|
25928
26408
|
this.#emit({ type: "session.usage.changed", usage });
|
|
25929
|
-
if (this.#active?.
|
|
26409
|
+
if (this.#active?.promptPhase === "submitted")
|
|
25930
26410
|
void this.refreshUsage();
|
|
25931
26411
|
break;
|
|
25932
26412
|
}
|
|
@@ -25986,11 +26466,11 @@ var AntigravitySession = class {
|
|
|
25986
26466
|
return err("invalidRequest", "Command accepts only a text argument");
|
|
25987
26467
|
prompt = `${descriptor.invocation}${typeof args.text === "string" && args.text.trim() ? ` ${args.text.trim()}` : ""}`;
|
|
25988
26468
|
}
|
|
25989
|
-
return this
|
|
26469
|
+
return this.#startTurn({
|
|
25990
26470
|
type: "turn.start",
|
|
25991
26471
|
turnId: invocation.turnId,
|
|
25992
26472
|
input: [{ type: "text", text: prompt }]
|
|
25993
|
-
});
|
|
26473
|
+
}, true);
|
|
25994
26474
|
}
|
|
25995
26475
|
};
|
|
25996
26476
|
}
|
|
@@ -26024,23 +26504,14 @@ var AntigravitySession = class {
|
|
|
26024
26504
|
}
|
|
26025
26505
|
}
|
|
26026
26506
|
async execute(command) {
|
|
26507
|
+
if (command.type === "turn.start")
|
|
26508
|
+
return this.#startTurn(command, false);
|
|
26027
26509
|
if (this.#closed || this.#faulted)
|
|
26028
26510
|
return err("invalidState", "Session is closed");
|
|
26029
26511
|
try {
|
|
26030
26512
|
switch (command.type) {
|
|
26031
26513
|
case "turn.steer":
|
|
26032
26514
|
return unsupportedSteer("Antigravity ACP");
|
|
26033
|
-
case "turn.start": {
|
|
26034
|
-
if (this.#active || this.#configuring || this.#historyOperation)
|
|
26035
|
-
return err("sessionBusy", "Session is busy", true);
|
|
26036
|
-
if (!command.turnId || !command.input.length || !command.input.some((part) => typeof part.text === "string" && part.text.trim()))
|
|
26037
|
-
return err("invalidRequest", "Prompt and Turn ID must not be empty");
|
|
26038
|
-
const turn = { turnId: command.turnId, cancelled: false, ended: false };
|
|
26039
|
-
this.#active = turn;
|
|
26040
|
-
this.#emit({ type: "turn.started", turnId: turn.turnId });
|
|
26041
|
-
void this.#runTurn(turn, command);
|
|
26042
|
-
return ok({ turnId: command.turnId });
|
|
26043
|
-
}
|
|
26044
26515
|
case "turn.cancel": {
|
|
26045
26516
|
const turn = this.#active;
|
|
26046
26517
|
if (!turn || turn.turnId !== command.turnId)
|
|
@@ -26049,7 +26520,7 @@ var AntigravitySession = class {
|
|
|
26049
26520
|
turn.cancelled = true;
|
|
26050
26521
|
this.#closeInteractions("cancelled");
|
|
26051
26522
|
try {
|
|
26052
|
-
if (turn.
|
|
26523
|
+
if (turn.promptPhase === "submitted")
|
|
26053
26524
|
await this.#transport?.cancel();
|
|
26054
26525
|
} catch (error51) {
|
|
26055
26526
|
this.handleTransportFault(new AntigravityTransportError("unavailable", "Native cancellation could not be confirmed", { cause: error51 }));
|
|
@@ -26067,6 +26538,31 @@ var AntigravitySession = class {
|
|
|
26067
26538
|
return { ok: false, error: normalizeAntigravityError(error51) };
|
|
26068
26539
|
}
|
|
26069
26540
|
}
|
|
26541
|
+
#startTurn(command, catalogCommand) {
|
|
26542
|
+
if (this.#closed || this.#faulted)
|
|
26543
|
+
return err("invalidState", "Session is closed");
|
|
26544
|
+
if (this.#active || this.#configuring || this.#historyOperation)
|
|
26545
|
+
return err("sessionBusy", "Session is busy", true);
|
|
26546
|
+
if (!command.turnId || !command.input.length || !command.input.some((part) => typeof part.text === "string" && part.text.trim()))
|
|
26547
|
+
return err("invalidRequest", "Prompt and Turn ID must not be empty");
|
|
26548
|
+
try {
|
|
26549
|
+
this.#postPromptBackground.length = 0;
|
|
26550
|
+
const turn = {
|
|
26551
|
+
turnId: command.turnId,
|
|
26552
|
+
cancelled: false,
|
|
26553
|
+
ended: false,
|
|
26554
|
+
promptPhase: "notSubmitted"
|
|
26555
|
+
};
|
|
26556
|
+
this.#active = turn;
|
|
26557
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26558
|
+
this.#lastCompletedTurnId = void 0;
|
|
26559
|
+
this.#emit({ type: "turn.started", turnId: turn.turnId });
|
|
26560
|
+
void this.#runTurn(turn, command, catalogCommand);
|
|
26561
|
+
return ok({ turnId: command.turnId });
|
|
26562
|
+
} catch (error51) {
|
|
26563
|
+
return { ok: false, error: normalizeAntigravityError(error51) };
|
|
26564
|
+
}
|
|
26565
|
+
}
|
|
26070
26566
|
async #select(command) {
|
|
26071
26567
|
if (this.#configuring || this.#historyOperation)
|
|
26072
26568
|
return err("sessionBusy", "Configuration or history is changing", true);
|
|
@@ -26122,6 +26618,7 @@ var AntigravitySession = class {
|
|
|
26122
26618
|
thinkingOptionId: this.#state.effectiveThinkingOptionId,
|
|
26123
26619
|
permissionModeId: command.permissionModeId
|
|
26124
26620
|
};
|
|
26621
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26125
26622
|
old.setSessionEventHandler(null);
|
|
26126
26623
|
await old.close();
|
|
26127
26624
|
this.#transport = void 0;
|
|
@@ -26149,7 +26646,7 @@ var AntigravitySession = class {
|
|
|
26149
26646
|
this.#configuring = false;
|
|
26150
26647
|
}
|
|
26151
26648
|
}
|
|
26152
|
-
async #runTurn(turn, command) {
|
|
26649
|
+
async #runTurn(turn, command, catalogCommand) {
|
|
26153
26650
|
let outcome;
|
|
26154
26651
|
let nativeTurnRef;
|
|
26155
26652
|
try {
|
|
@@ -26180,8 +26677,11 @@ var AntigravitySession = class {
|
|
|
26180
26677
|
if (!transport || !ref)
|
|
26181
26678
|
throw new AntigravityTransportError("unavailable", "Native Session is not connected");
|
|
26182
26679
|
this.#usage?.beginTurn();
|
|
26183
|
-
turn.
|
|
26680
|
+
turn.promptPhase = "submitted";
|
|
26184
26681
|
const result = await transport.prompt(promptParts(command), {
|
|
26682
|
+
onResponse: () => {
|
|
26683
|
+
turn.promptPhase = "returned";
|
|
26684
|
+
},
|
|
26185
26685
|
onEvent: (event) => {
|
|
26186
26686
|
if (!this.#isCurrent(turn) || turn.cancelled)
|
|
26187
26687
|
return;
|
|
@@ -26205,7 +26705,7 @@ var AntigravitySession = class {
|
|
|
26205
26705
|
return this.#question(turn, request);
|
|
26206
26706
|
}
|
|
26207
26707
|
});
|
|
26208
|
-
turn.
|
|
26708
|
+
turn.promptPhase = "returned";
|
|
26209
26709
|
const completedAtMs = Date.now();
|
|
26210
26710
|
if (!this.#isCurrent(turn))
|
|
26211
26711
|
return;
|
|
@@ -26222,7 +26722,7 @@ var AntigravitySession = class {
|
|
|
26222
26722
|
try {
|
|
26223
26723
|
count4 = await readNativeTurnCount(nativeConversationDbPath(ref.nativeSessionId, antigravityHome(this.#options.environment)));
|
|
26224
26724
|
} catch {
|
|
26225
|
-
count4 = outcome.status === "succeeded" ? before + 1 : before;
|
|
26725
|
+
count4 = !catalogCommand && outcome.status === "succeeded" ? before + 1 : before;
|
|
26226
26726
|
}
|
|
26227
26727
|
if (count4 > before) {
|
|
26228
26728
|
const key = `turn-${count4 - 1}`;
|
|
@@ -26308,6 +26808,61 @@ var AntigravitySession = class {
|
|
|
26308
26808
|
});
|
|
26309
26809
|
turn.textItem = void 0;
|
|
26310
26810
|
}
|
|
26811
|
+
/** Idle Harness output lands on the most recently completed user Turn. */
|
|
26812
|
+
#appendBackgroundText(type, text2) {
|
|
26813
|
+
if (!text2)
|
|
26814
|
+
return;
|
|
26815
|
+
if (this.#active) {
|
|
26816
|
+
if (this.#active.promptPhase === "returned") {
|
|
26817
|
+
if (!this.#active.ended && !this.#active.cancelled && !this.#opening && !this.#configuring && !this.#historyOperation)
|
|
26818
|
+
this.#postPromptBackground.push({ type, text: text2 });
|
|
26819
|
+
return;
|
|
26820
|
+
}
|
|
26821
|
+
return;
|
|
26822
|
+
}
|
|
26823
|
+
if (this.#opening || this.#configuring || this.#historyOperation)
|
|
26824
|
+
return;
|
|
26825
|
+
const turnId = this.#lastCompletedTurnId;
|
|
26826
|
+
if (!turnId) {
|
|
26827
|
+
return;
|
|
26828
|
+
}
|
|
26829
|
+
this.#background ??= { turnId, textItem: void 0 };
|
|
26830
|
+
const episode = this.#background;
|
|
26831
|
+
if (episode.turnId !== turnId || episode.textItem?.type !== type) {
|
|
26832
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26833
|
+
this.#background = { turnId, textItem: void 0 };
|
|
26834
|
+
}
|
|
26835
|
+
const current = this.#background;
|
|
26836
|
+
if (!current.textItem) {
|
|
26837
|
+
current.textItem = { type, itemId: hostItemIdSchema.parse(randomUUID2()), text: "" };
|
|
26838
|
+
this.#emit({
|
|
26839
|
+
type: "item.background.started",
|
|
26840
|
+
turnId,
|
|
26841
|
+
item: { ...current.textItem }
|
|
26842
|
+
});
|
|
26843
|
+
}
|
|
26844
|
+
current.textItem.text += text2;
|
|
26845
|
+
this.#emit({
|
|
26846
|
+
type: "item.updated",
|
|
26847
|
+
turnId,
|
|
26848
|
+
itemId: current.textItem.itemId,
|
|
26849
|
+
update: { type: "text.append", text: text2 }
|
|
26850
|
+
});
|
|
26851
|
+
}
|
|
26852
|
+
/** Close the pending idle-output Item; the emitted content stays real output. */
|
|
26853
|
+
#settleBackground(outcome) {
|
|
26854
|
+
const episode = this.#background;
|
|
26855
|
+
if (!episode?.textItem) {
|
|
26856
|
+
this.#background = void 0;
|
|
26857
|
+
return;
|
|
26858
|
+
}
|
|
26859
|
+
this.#emit({
|
|
26860
|
+
type: "item.completed",
|
|
26861
|
+
turnId: episode.turnId,
|
|
26862
|
+
snapshot: { item: { ...episode.textItem }, outcome }
|
|
26863
|
+
});
|
|
26864
|
+
this.#background = void 0;
|
|
26865
|
+
}
|
|
26311
26866
|
#finish(turn, outcome, nativeTurnRef) {
|
|
26312
26867
|
if (!this.#isCurrent(turn))
|
|
26313
26868
|
return;
|
|
@@ -26316,12 +26871,21 @@ var AntigravitySession = class {
|
|
|
26316
26871
|
turn.tracker?.finishPending(outcome);
|
|
26317
26872
|
turn.ended = true;
|
|
26318
26873
|
this.#active = void 0;
|
|
26874
|
+
if (nativeTurnRef)
|
|
26875
|
+
this.#lastCompletedTurnId = turn.turnId;
|
|
26876
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26319
26877
|
this.#emit({
|
|
26320
26878
|
type: "turn.completed",
|
|
26321
26879
|
turnId: turn.turnId,
|
|
26322
26880
|
...nativeTurnRef ? { nativeTurnRef } : outcome.status === "succeeded" ? { ephemeral: true } : {},
|
|
26323
26881
|
outcome
|
|
26324
26882
|
});
|
|
26883
|
+
if (outcome.status === "succeeded" && !turn.cancelled && !this.#closed && !this.#faulted) {
|
|
26884
|
+
for (const entry of this.#postPromptBackground.splice(0))
|
|
26885
|
+
this.#appendBackgroundText(entry.type, entry.text);
|
|
26886
|
+
} else {
|
|
26887
|
+
this.#postPromptBackground.length = 0;
|
|
26888
|
+
}
|
|
26325
26889
|
}
|
|
26326
26890
|
#permission(turn, request) {
|
|
26327
26891
|
const ref = this.nativeRef;
|
|
@@ -26428,9 +26992,11 @@ var AntigravitySession = class {
|
|
|
26428
26992
|
return;
|
|
26429
26993
|
this.#faulted = true;
|
|
26430
26994
|
this.#abort.abort();
|
|
26995
|
+
this.#postPromptBackground.length = 0;
|
|
26431
26996
|
this.#closeInteractions("cancelled");
|
|
26432
26997
|
if (this.#active)
|
|
26433
26998
|
this.#finish(this.#active, { status: "failed", error: normalizeAntigravityError(error51) });
|
|
26999
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26434
27000
|
this.#emit({ type: "session.faulted", error: normalizeAntigravityError(error51) });
|
|
26435
27001
|
this.#channel.end();
|
|
26436
27002
|
this.#subagents.stop();
|
|
@@ -26445,7 +27011,9 @@ var AntigravitySession = class {
|
|
|
26445
27011
|
async #close() {
|
|
26446
27012
|
this.#closed = true;
|
|
26447
27013
|
this.#abort.abort();
|
|
27014
|
+
this.#postPromptBackground.length = 0;
|
|
26448
27015
|
this.#closeInteractions("cancelled");
|
|
27016
|
+
this.#settleBackground({ status: "succeeded" });
|
|
26449
27017
|
const active = this.#active;
|
|
26450
27018
|
if (active)
|
|
26451
27019
|
this.#finish(active, { status: "cancelled", reason: "Session closed" });
|