@codexhost/cli-darwin-x64 0.12.2 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +9 -1
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +319 -64
  5. package/app/console-web.js +5089 -1367
  6. package/app/desktop-controller.mjs +259 -41
  7. package/app/host-runtime.mjs +5735 -1564
  8. package/app/plugins/antigravity/manifest.json +18 -1
  9. package/app/plugins/antigravity/plugin.mjs +282 -41
  10. package/app/plugins/claude-code/manifest.json +28 -0
  11. package/app/plugins/claude-code/plugin.mjs +35300 -23918
  12. package/app/plugins/codebuddy/manifest.json +17 -0
  13. package/app/plugins/codebuddy/plugin.mjs +5971 -5355
  14. package/app/plugins/codex-usage/manifest.json +9 -0
  15. package/app/plugins/codex-usage/plugin.mjs +17324 -0
  16. package/app/plugins/cursor-cli/manifest.json +17 -0
  17. package/app/plugins/cursor-cli/plugin.mjs +357 -76
  18. package/app/plugins/deepseek-harness/assets/icon.svg +1 -0
  19. package/app/plugins/deepseek-harness/manifest.json +35 -2
  20. package/app/plugins/deepseek-harness/plugin.mjs +822 -241
  21. package/app/plugins/enabled.json +2 -1
  22. package/app/plugins/grok/manifest.json +21 -1
  23. package/app/plugins/grok/plugin.mjs +918 -258
  24. package/app/plugins/hermes/assets/icon.png +0 -0
  25. package/app/plugins/hermes/manifest.json +30 -2
  26. package/app/plugins/hermes/plugin.mjs +284 -32
  27. package/app/plugins/kimi-code/assets/icon.svg +5 -0
  28. package/app/plugins/kimi-code/manifest.json +25 -2
  29. package/app/plugins/kimi-code/plugin.mjs +561 -35
  30. package/app/plugins/kiro-cli/assets/kiro-agent.svg +11 -0
  31. package/app/plugins/kiro-cli/manifest.json +18 -1
  32. package/app/plugins/kiro-cli/plugin.mjs +290 -21
  33. package/app/plugins/omp/manifest.json +21 -1
  34. package/app/plugins/omp/plugin.mjs +2765 -1960
  35. package/app/plugins/opencode/manifest.json +18 -1
  36. package/app/plugins/opencode/plugin.mjs +723 -146
  37. package/app/plugins/pi/manifest.json +32 -0
  38. package/app/plugins/pi/plugin.mjs +2908 -2312
  39. package/app/plugins/qoder/manifest.json +18 -1
  40. package/app/plugins/qoder/plugin.mjs +634 -80
  41. package/app/plugins/qoder-cn/manifest.json +18 -1
  42. package/app/plugins/qoder-cn/plugin.mjs +634 -80
  43. package/app/plugins/workbuddy/manifest.json +18 -0
  44. package/app/plugins/workbuddy/plugin.mjs +6361 -5747
  45. package/app/plugins/zcode/manifest.json +19 -1
  46. package/app/plugins/zcode/plugin.mjs +1098 -259
  47. package/app/renderer-extension.js +13080 -8884
  48. package/bin/codexhost +0 -0
  49. package/libexec/codexhost-shim +0 -0
  50. package/libexec/codexhost-updater +0 -0
  51. package/licenses/Cordis-LICENSE.txt +21 -0
  52. package/licenses/Cosmokit-LICENSE.txt +21 -0
  53. package/package.json +1 -1
  54. package/app/plugins/kiro-cli/assets/icon.svg +0 -5
@@ -396,7 +396,7 @@ async function npmInstallation(command, packages, environment) {
396
396
  const npm = resolveHarnessExecutable({ id: "npm", command: "npm", installRoots: { posix: [], windows: [] } }, { environment: env });
397
397
  let globalInstall = modules === globalRoot;
398
398
  if (process.platform === "win32") {
399
- const project = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
399
+ const project2 = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
400
400
  const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
401
401
  const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
402
402
  if (path4.basename(bin) !== bin || entry.includes(".."))
@@ -407,7 +407,7 @@ async function npmInstallation(command, packages, environment) {
407
407
  const shim = await readFile(path4.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
408
408
  return referencesNpmBin(shim, name, entry);
409
409
  }));
410
- globalInstall = globalInstall && !project && launchers.some(Boolean);
410
+ globalInstall = globalInstall && !project2 && launchers.some(Boolean);
411
411
  }
412
412
  const canUpdate = globalInstall && !!npm;
413
413
  return {
@@ -5128,8 +5128,8 @@ function az_default() {
5128
5128
  }
5129
5129
 
5130
5130
  // ../../../node_modules/zod/v4/locales/be.js
5131
- function getBelarusianPlural(count, one, few, many) {
5132
- const absCount = Math.abs(count);
5131
+ function getBelarusianPlural(count2, one, few, many) {
5132
+ const absCount = Math.abs(count2);
5133
5133
  const lastDigit = absCount % 10;
5134
5134
  const lastTwoDigits = absCount % 100;
5135
5135
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -7207,8 +7207,8 @@ function hu_default() {
7207
7207
  }
7208
7208
 
7209
7209
  // ../../../node_modules/zod/v4/locales/hy.js
7210
- function getArmenianPlural(count, one, many) {
7211
- return Math.abs(count) === 1 ? one : many;
7210
+ function getArmenianPlural(count2, one, many) {
7211
+ return Math.abs(count2) === 1 ? one : many;
7212
7212
  }
7213
7213
  function withDefiniteArticle(word) {
7214
7214
  if (!word)
@@ -9336,8 +9336,8 @@ function ro_default() {
9336
9336
  }
9337
9337
 
9338
9338
  // ../../../node_modules/zod/v4/locales/ru.js
9339
- function getRussianPlural(count, one, few, many) {
9340
- const absCount = Math.abs(count);
9339
+ function getRussianPlural(count2, one, few, many) {
9340
+ const absCount = Math.abs(count2);
9341
9341
  const lastDigit = absCount % 10;
9342
9342
  const lastTwoDigits = absCount % 100;
9343
9343
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -15006,6 +15006,15 @@ function date4(params) {
15006
15006
  // ../../../node_modules/zod/v4/classic/external.js
15007
15007
  config(en_default());
15008
15008
 
15009
+ // ../../shared-contracts/dist/delegation-read.js
15010
+ var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
15011
+ var delegationReadParamsSchema = external_exports.strictObject({
15012
+ threadId: external_exports.string().min(1).max(1024),
15013
+ view: external_exports.enum(["result", "messages"]),
15014
+ cursor: external_exports.string().min(1).max(8192).optional(),
15015
+ limit: external_exports.number().int().min(1).max(100).optional()
15016
+ });
15017
+
15009
15018
  // ../../shared-contracts/dist/credential-imports.js
15010
15019
  var credentialSourceSchema = external_exports.object({
15011
15020
  id: external_exports.string().min(1).max(256),
@@ -15076,6 +15085,160 @@ var harnessDisplaySetSchema = external_exports.strictObject({
15076
15085
  initializeOnly: external_exports.boolean().optional()
15077
15086
  });
15078
15087
 
15088
+ // ../../shared-contracts/dist/model-price-overrides.js
15089
+ var usdPerMillionTokens = external_exports.number().finite().nonnegative();
15090
+ var modelPriceOverrideSchema = external_exports.strictObject({
15091
+ input: usdPerMillionTokens,
15092
+ output: usdPerMillionTokens,
15093
+ cacheRead: usdPerMillionTokens.optional(),
15094
+ cacheWrite: usdPerMillionTokens.optional(),
15095
+ cacheWrite1h: usdPerMillionTokens.optional()
15096
+ });
15097
+ var modelPriceKeySchema = external_exports.string().max(512).refine((key) => key.trim() === key && key.length > 0, "Model ID is required");
15098
+ var modelPriceOverridesSchema = external_exports.strictObject({
15099
+ /** Absolute path of the Host's `pricing.json`. */
15100
+ path: external_exports.string(),
15101
+ entries: external_exports.array(external_exports.strictObject({ key: external_exports.string(), price: modelPriceOverrideSchema })),
15102
+ /** Why the existing file is unusable; the Host then ignores it and refuses to overwrite it. */
15103
+ error: external_exports.string().nullable()
15104
+ });
15105
+ var modelPriceOverridesGetSchema = external_exports.strictObject({});
15106
+ var modelPriceOverridesSetSchema = external_exports.strictObject({
15107
+ key: modelPriceKeySchema,
15108
+ price: modelPriceOverrideSchema.nullable(),
15109
+ previousKey: modelPriceKeySchema.optional()
15110
+ });
15111
+ var modelPriceDefaultParamsSchema = external_exports.strictObject({
15112
+ model: modelPriceKeySchema
15113
+ });
15114
+ var modelPriceSuggestionSchema = external_exports.strictObject({
15115
+ /** Verified from catalog canonical links, not inferred from names or equal prices. */
15116
+ official: external_exports.boolean().optional(),
15117
+ canonicalModelId: external_exports.string().min(1).optional(),
15118
+ provider: external_exports.string().min(1).max(512),
15119
+ model: external_exports.string().min(1).max(512),
15120
+ price: modelPriceOverrideSchema
15121
+ });
15122
+ var modelPriceDefaultResultSchema = external_exports.strictObject({
15123
+ price: modelPriceOverrideSchema.nullable(),
15124
+ /** Local catalog suggestions only; never used automatically for pricing. */
15125
+ suggestions: external_exports.array(modelPriceSuggestionSchema).max(6).optional()
15126
+ });
15127
+
15128
+ // ../../shared-contracts/dist/usage-statistics.js
15129
+ var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
15130
+ var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
15131
+ var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
15132
+ var harness = external_exports.string().min(1).max(128);
15133
+ var model = external_exports.string().min(1).max(512);
15134
+ var project = external_exports.string().min(1).max(4096);
15135
+ var usageStatisticsParamsSchema = external_exports.strictObject({
15136
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
15137
+ harness: harness.optional(),
15138
+ model: model.nullable().optional(),
15139
+ project: project.nullable().optional(),
15140
+ /** One local date inside the range. */
15141
+ date: localDate.optional()
15142
+ });
15143
+ var usageStatisticsTotalsSchema = external_exports.strictObject({
15144
+ requests: count,
15145
+ inputTokens: count,
15146
+ cachedInputTokens: count,
15147
+ cacheWriteInputTokens: count,
15148
+ cacheKnownInputTokens: count,
15149
+ outputTokens: count,
15150
+ reasoningOutputTokens: count,
15151
+ /** USD at the public price, summed over the priced requests only. */
15152
+ costUsd: external_exports.number().finite().min(0),
15153
+ /** Requests without a price (or the cache data the price needs); not in `costUsd`. */
15154
+ unpricedRequests: count,
15155
+ /**
15156
+ * Requests whose storage gave no token counts: counted as requests, with neither tokens nor
15157
+ * cost, and not as unpriced.
15158
+ */
15159
+ unmeteredRequests: count
15160
+ });
15161
+ var totals = usageStatisticsTotalsSchema.shape;
15162
+ var usageStatisticsSessionSchema = external_exports.strictObject({
15163
+ harness,
15164
+ sessionId: external_exports.string().min(1).max(512),
15165
+ project: project.nullable(),
15166
+ /** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
15167
+ title: external_exports.string().min(1).max(200).optional(),
15168
+ /** Models the session used, most requests first. */
15169
+ models: external_exports.array(model).max(16),
15170
+ firstAtMs: count,
15171
+ lastAtMs: count,
15172
+ ...totals
15173
+ });
15174
+ var usageStatisticsResultSchema = external_exports.strictObject({
15175
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
15176
+ /** First local date of the range; null for all time. */
15177
+ from: localDate.nullable(),
15178
+ to: localDate,
15179
+ /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
15180
+ filters: external_exports.strictObject({
15181
+ harness: harness.nullable(),
15182
+ model: model.nullable(),
15183
+ unknownModel: external_exports.boolean(),
15184
+ project: project.nullable(),
15185
+ unknownProject: external_exports.boolean(),
15186
+ date: localDate.nullable()
15187
+ }),
15188
+ /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
15189
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
15190
+ /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
15191
+ failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
15192
+ /** Every value seen in the range, ignoring the filters, to choose filters from. */
15193
+ options: external_exports.strictObject({
15194
+ harnesses: external_exports.array(harness).max(256),
15195
+ models: external_exports.array(model.nullable()).max(4096),
15196
+ projects: external_exports.array(project.nullable()).max(4096)
15197
+ }),
15198
+ /** Current display metadata, scoped by Harness. Never a pricing or filter identity.
15199
+ * Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
15200
+ */
15201
+ modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
15202
+ /** Native credits, all filters applied, never combined across Harnesses or treated as USD.
15203
+ * Only groups with at least one reported value appear; reportedRequests exposes partial data.
15204
+ */
15205
+ credits: external_exports.array(external_exports.strictObject({
15206
+ harness,
15207
+ model: model.nullable(),
15208
+ credits: external_exports.number().finite().min(0),
15209
+ reportedRequests: count,
15210
+ requests: count
15211
+ })).max(4096).optional(),
15212
+ /** All filters applied. */
15213
+ totals: usageStatisticsTotalsSchema,
15214
+ /** Each date and Harness of the range: every filter except the day. */
15215
+ daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
15216
+ /** Local weekday (0 = Sunday) and hour, all filters applied. */
15217
+ hourly: external_exports.array(external_exports.strictObject({
15218
+ weekday: external_exports.number().int().min(0).max(6),
15219
+ hour: external_exports.number().int().min(0).max(23),
15220
+ ...totals
15221
+ })).max(168),
15222
+ byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
15223
+ byModel: external_exports.array(external_exports.strictObject({
15224
+ model: model.nullable(),
15225
+ ...totals,
15226
+ /** Requests priced by what the Harness recorded they cost, not by a price list. */
15227
+ harnessPricedRequests: count
15228
+ })).max(4096),
15229
+ byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
15230
+ /**
15231
+ * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15232
+ * requests without a native session are not listed here but count everywhere else.
15233
+ */
15234
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
15235
+ /**
15236
+ * The sessions last active in the range, newest first, all filters applied. Optional for older
15237
+ * Hosts; missing is treated as no list rather than no sessions.
15238
+ */
15239
+ recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
15240
+ });
15241
+
15079
15242
  // ../../shared-contracts/dist/ids.js
15080
15243
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15081
15244
  message: "Identifier must not be empty or whitespace"
@@ -15123,6 +15286,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15123
15286
  "codexhost/account/list",
15124
15287
  "codexhost/account/refresh",
15125
15288
  "codexhost/account/usage/inspect",
15289
+ "codexhost/usage/model-prices/get",
15290
+ "codexhost/usage/model-prices/set",
15291
+ "codexhost/usage/model-prices/default",
15292
+ "codexhost/usage/statistics/get",
15126
15293
  "codexhost/update/check",
15127
15294
  "codexhost/update/start",
15128
15295
  "codexhost/update/status"
@@ -15187,6 +15354,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15187
15354
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15188
15355
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15189
15356
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15357
+ apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15190
15358
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15191
15359
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
15192
15360
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
@@ -15198,7 +15366,11 @@ var threadUsageSnapshotSchema = external_exports.object({
15198
15366
  planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
15199
15367
  planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15200
15368
  planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
15201
- planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
15369
+ planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15370
+ sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15371
+ timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15372
+ costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15373
+ unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15202
15374
  }).strict().superRefine((usage, context) => {
15203
15375
  if (Object.keys(usage).length === 0) {
15204
15376
  context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
@@ -15219,6 +15391,20 @@ var threadUsageSnapshotSchema = external_exports.object({
15219
15391
  path: ["contextWindowTokens"]
15220
15392
  });
15221
15393
  }
15394
+ if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
15395
+ context.addIssue({
15396
+ code: "custom",
15397
+ message: "Thread Usage costSource must be provided with totalCostUsd",
15398
+ path: ["costSource"]
15399
+ });
15400
+ }
15401
+ if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
15402
+ context.addIssue({
15403
+ code: "custom",
15404
+ message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
15405
+ path: ["unpricedModels"]
15406
+ });
15407
+ }
15222
15408
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
15223
15409
  context.addIssue({
15224
15410
  code: "custom",
@@ -15473,27 +15659,27 @@ var harnessModelCatalogSchema = external_exports.object({
15473
15659
  }).strict().superRefine((catalog, context) => {
15474
15660
  const refs = /* @__PURE__ */ new Set();
15475
15661
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
15476
- for (const [index, model] of catalog.models.entries()) {
15477
- if (refs.has(model.ref.id)) {
15662
+ for (const [index, model2] of catalog.models.entries()) {
15663
+ if (refs.has(model2.ref.id)) {
15478
15664
  context.addIssue({
15479
15665
  code: "custom",
15480
15666
  message: "Model Catalog refs must be unique",
15481
15667
  path: ["models", index, "ref", "id"]
15482
15668
  });
15483
15669
  }
15484
- refs.add(model.ref.id);
15485
- if (model.fastModel) {
15486
- if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15670
+ refs.add(model2.ref.id);
15671
+ if (model2.fastModel) {
15672
+ if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15487
15673
  context.addIssue({
15488
15674
  code: "custom",
15489
15675
  message: "Fast Model refs must be distinct and unique",
15490
15676
  path: ["models", index, "fastModel"]
15491
15677
  });
15492
15678
  }
15493
- refs.add(model.fastModel.id);
15679
+ refs.add(model2.fastModel.id);
15494
15680
  }
15495
15681
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15496
- for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
15682
+ for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
15497
15683
  if (supportedThinkingIds.has(optionId)) {
15498
15684
  context.addIssue({
15499
15685
  code: "custom",
@@ -15687,13 +15873,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
15687
15873
  var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
15688
15874
  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");
15689
15875
  var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15876
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15877
+ var harnessInstallationGuideSchema = external_exports.object({
15878
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15879
+ before: localizedTextSchema.optional(),
15880
+ after: localizedTextSchema.optional(),
15881
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15882
+ }).strict();
15690
15883
  var pluginPresentationShape = {
15691
15884
  id: harnessPluginIdSchema,
15692
15885
  name: external_exports.string().trim().min(1).max(128),
15693
15886
  version: external_exports.string().min(1).max(128),
15887
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15888
+ kind: external_exports.literal("usage").optional(),
15889
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15890
+ iconStyle: external_exports.object({
15891
+ vector: external_exports.object({
15892
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15893
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15894
+ paths: external_exports.array(external_exports.object({
15895
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15896
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15897
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15898
+ }).strict()).min(1).max(32)
15899
+ }).strict().optional(),
15900
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15901
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15902
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15903
+ }).strict().optional(),
15904
+ installation: harnessInstallationGuideSchema.optional(),
15905
+ notice: localizedTextSchema.optional(),
15694
15906
  /** The factory accepts a persisted local entrypoint through its construction context. */
15695
15907
  launchCommand: external_exports.literal(true).optional(),
15696
15908
  links: external_exports.object({
15909
+ website: documentationUrlSchema.optional(),
15697
15910
  documentation: documentationUrlSchema.optional(),
15698
15911
  installation: documentationUrlSchema.optional()
15699
15912
  }).strict().optional()
@@ -16112,6 +16325,11 @@ var codexSshDraftSchema = external_exports.strictObject({
16112
16325
  });
16113
16326
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16114
16327
  external_exports.strictObject({ action: external_exports.literal("list") }),
16328
+ external_exports.strictObject({
16329
+ action: external_exports.literal("read-thread"),
16330
+ hostId: hostId.refine((id) => id !== "local"),
16331
+ input: delegationReadParamsSchema
16332
+ }),
16115
16333
  external_exports.strictObject({
16116
16334
  action: external_exports.literal("save"),
16117
16335
  draft: codexSshDraftSchema,
@@ -16254,10 +16472,12 @@ var tokenFields = [
16254
16472
  ];
16255
16473
  var safeIntegerFields = [
16256
16474
  "planFiveHourResetsAtUnix",
16257
- "planSevenDayResetsAtUnix"
16475
+ "planSevenDayResetsAtUnix",
16476
+ "timeToFirstOutputMs"
16258
16477
  ];
16259
16478
  var percentFields = [
16260
16479
  "cacheHitRatePercent",
16480
+ "sessionCacheHitRatePercent",
16261
16481
  "planFiveHourUsedPercent",
16262
16482
  "planSevenDayUsedPercent"
16263
16483
  ];
@@ -16265,10 +16485,14 @@ var usageFields = /* @__PURE__ */ new Set([
16265
16485
  ...tokenFields,
16266
16486
  ...safeIntegerFields,
16267
16487
  ...percentFields,
16488
+ "sessionCacheUsage",
16268
16489
  "totalCostUsd",
16269
16490
  "totalCredits",
16270
16491
  "contextUsagePercent",
16271
- "outputTokensPerSecond"
16492
+ "outputTokensPerSecond",
16493
+ "apiOutputTokensPerSecond",
16494
+ "costSource",
16495
+ "unpricedModels"
16272
16496
  ]);
16273
16497
  function isRecord(value) {
16274
16498
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -16284,7 +16508,11 @@ function parseHostUsage(value) {
16284
16508
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16285
16509
  }
16286
16510
  }
16287
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16511
+ for (const field of [
16512
+ "totalCredits",
16513
+ "contextUsagePercent",
16514
+ "apiOutputTokensPerSecond"
16515
+ ]) {
16288
16516
  const candidate = value[field];
16289
16517
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16290
16518
  throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
@@ -16314,6 +16542,12 @@ function parseHostUsage(value) {
16314
16542
  throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16315
16543
  }
16316
16544
  }
16545
+ if (value.sessionCacheUsage !== void 0) {
16546
+ const totals2 = value.sessionCacheUsage;
16547
+ if (!isRecord(totals2) || Object.keys(totals2).some((key) => key !== "inputTokens" && key !== "cachedInputTokens") || typeof totals2.inputTokens !== "number" || !Number.isSafeInteger(totals2.inputTokens) || totals2.inputTokens < 0 || typeof totals2.cachedInputTokens !== "number" || !Number.isSafeInteger(totals2.cachedInputTokens) || totals2.cachedInputTokens < 0 || totals2.cachedInputTokens > totals2.inputTokens) {
16548
+ throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
16549
+ }
16550
+ }
16317
16551
  const hasContextUsed = value.contextUsedTokens !== void 0;
16318
16552
  const hasContextWindow = value.contextWindowTokens !== void 0;
16319
16553
  if (hasContextUsed !== hasContextWindow) {
@@ -16328,8 +16562,43 @@ function parseHostUsage(value) {
16328
16562
  if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
16329
16563
  throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
16330
16564
  }
16565
+ if (value.costSource !== void 0) {
16566
+ if (value.costSource !== "publicPrice" && value.costSource !== "native") {
16567
+ throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
16568
+ }
16569
+ if (value.totalCostUsd === void 0) {
16570
+ throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
16571
+ }
16572
+ }
16573
+ if (value.unpricedModels !== void 0) {
16574
+ const models = value.unpricedModels;
16575
+ if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
16576
+ throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
16577
+ }
16578
+ if (value.costSource !== "publicPrice") {
16579
+ throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16580
+ }
16581
+ return { ...value, unpricedModels: [...models] };
16582
+ }
16331
16583
  return { ...value };
16332
16584
  }
16585
+ var requestTokenFields = [
16586
+ "inputTokens",
16587
+ "cachedInputTokens",
16588
+ "cacheWriteInputTokens",
16589
+ "cacheWrite1hInputTokens",
16590
+ "outputTokens",
16591
+ "reasoningOutputTokens",
16592
+ "startedAtMs",
16593
+ "completedAtMs"
16594
+ ];
16595
+ var requestFields = /* @__PURE__ */ new Set([
16596
+ ...requestTokenFields,
16597
+ "requestId",
16598
+ "historical",
16599
+ "model",
16600
+ "provider"
16601
+ ]);
16333
16602
 
16334
16603
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
16335
16604
  var AGENT_METHODS = {
@@ -18614,9 +18883,9 @@ var Connection = class {
18614
18883
  return;
18615
18884
  }
18616
18885
  const responseBatch = isResponseBatch(batch);
18617
- const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
18886
+ const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
18618
18887
  let remaining = responseCount;
18619
- let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
18888
+ let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
18620
18889
  let responseSent = false;
18621
18890
  const responses = [];
18622
18891
  const sendResponsesIfReady = async () => {
@@ -21600,6 +21869,33 @@ function splitLines(text) {
21600
21869
  }
21601
21870
 
21602
21871
  // ../../../node_modules/smol-toml/dist/date.js
21872
+ /*!
21873
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
21874
+ * SPDX-License-Identifier: BSD-3-Clause
21875
+ *
21876
+ * Redistribution and use in source and binary forms, with or without
21877
+ * modification, are permitted provided that the following conditions are met:
21878
+ *
21879
+ * 1. Redistributions of source code must retain the above copyright notice, this
21880
+ * list of conditions and the following disclaimer.
21881
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21882
+ * this list of conditions and the following disclaimer in the
21883
+ * documentation and/or other materials provided with the distribution.
21884
+ * 3. Neither the name of the copyright holder nor the names of its contributors
21885
+ * may be used to endorse or promote products derived from this software without
21886
+ * specific prior written permission.
21887
+ *
21888
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21889
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21890
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21891
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21892
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21893
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21894
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21895
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21896
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21897
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21898
+ */
21603
21899
  var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
21604
21900
  var TomlDate = class _TomlDate extends Date {
21605
21901
  #hasDate = false;
@@ -21692,6 +21988,33 @@ var TomlDate = class _TomlDate extends Date {
21692
21988
  };
21693
21989
 
21694
21990
  // ../../../node_modules/smol-toml/dist/error.js
21991
+ /*!
21992
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
21993
+ * SPDX-License-Identifier: BSD-3-Clause
21994
+ *
21995
+ * Redistribution and use in source and binary forms, with or without
21996
+ * modification, are permitted provided that the following conditions are met:
21997
+ *
21998
+ * 1. Redistributions of source code must retain the above copyright notice, this
21999
+ * list of conditions and the following disclaimer.
22000
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22001
+ * this list of conditions and the following disclaimer in the
22002
+ * documentation and/or other materials provided with the distribution.
22003
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22004
+ * may be used to endorse or promote products derived from this software without
22005
+ * specific prior written permission.
22006
+ *
22007
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22008
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22009
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22010
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22011
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22012
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22013
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22014
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22015
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22016
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22017
+ */
21695
22018
  function getLineColFromPtr(string4, ptr) {
21696
22019
  let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
21697
22020
  return [lines.length, lines.pop().length + 1];
@@ -21732,6 +22055,33 @@ ${codeblock}`, options);
21732
22055
  };
21733
22056
 
21734
22057
  // ../../../node_modules/smol-toml/dist/util.js
22058
+ /*!
22059
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22060
+ * SPDX-License-Identifier: BSD-3-Clause
22061
+ *
22062
+ * Redistribution and use in source and binary forms, with or without
22063
+ * modification, are permitted provided that the following conditions are met:
22064
+ *
22065
+ * 1. Redistributions of source code must retain the above copyright notice, this
22066
+ * list of conditions and the following disclaimer.
22067
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22068
+ * this list of conditions and the following disclaimer in the
22069
+ * documentation and/or other materials provided with the distribution.
22070
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22071
+ * may be used to endorse or promote products derived from this software without
22072
+ * specific prior written permission.
22073
+ *
22074
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22075
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22076
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22077
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22078
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22079
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22080
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22081
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22082
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22083
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22084
+ */
21735
22085
  function indexOfNewline(str, start = 0) {
21736
22086
  let idx = str.indexOf("\n", start);
21737
22087
  if (str.charCodeAt(idx - 1) === 13)
@@ -21787,6 +22137,33 @@ function skipUntil(ctx, sep, end) {
21787
22137
  }
21788
22138
 
21789
22139
  // ../../../node_modules/smol-toml/dist/primitive.js
22140
+ /*!
22141
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22142
+ * SPDX-License-Identifier: BSD-3-Clause
22143
+ *
22144
+ * Redistribution and use in source and binary forms, with or without
22145
+ * modification, are permitted provided that the following conditions are met:
22146
+ *
22147
+ * 1. Redistributions of source code must retain the above copyright notice, this
22148
+ * list of conditions and the following disclaimer.
22149
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22150
+ * this list of conditions and the following disclaimer in the
22151
+ * documentation and/or other materials provided with the distribution.
22152
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22153
+ * may be used to endorse or promote products derived from this software without
22154
+ * specific prior written permission.
22155
+ *
22156
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22157
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22158
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22159
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22160
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22161
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22162
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22163
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22164
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22165
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22166
+ */
21790
22167
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
21791
22168
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
21792
22169
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
@@ -21943,6 +22320,33 @@ function parseValue(ctx, integersAsBigInt, end) {
21943
22320
  }
21944
22321
 
21945
22322
  // ../../../node_modules/smol-toml/dist/extract.js
22323
+ /*!
22324
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22325
+ * SPDX-License-Identifier: BSD-3-Clause
22326
+ *
22327
+ * Redistribution and use in source and binary forms, with or without
22328
+ * modification, are permitted provided that the following conditions are met:
22329
+ *
22330
+ * 1. Redistributions of source code must retain the above copyright notice, this
22331
+ * list of conditions and the following disclaimer.
22332
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22333
+ * this list of conditions and the following disclaimer in the
22334
+ * documentation and/or other materials provided with the distribution.
22335
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22336
+ * may be used to endorse or promote products derived from this software without
22337
+ * specific prior written permission.
22338
+ *
22339
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22340
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22341
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22342
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22343
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22344
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22345
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22346
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22347
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22348
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22349
+ */
21946
22350
  function extractValue(ctx, end, integersAsBigInt) {
21947
22351
  let ptr = ctx.p;
21948
22352
  let c = ctx.s.charCodeAt(ptr);
@@ -21976,6 +22380,33 @@ function extractValue(ctx, end, integersAsBigInt) {
21976
22380
  }
21977
22381
 
21978
22382
  // ../../../node_modules/smol-toml/dist/struct.js
22383
+ /*!
22384
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22385
+ * SPDX-License-Identifier: BSD-3-Clause
22386
+ *
22387
+ * Redistribution and use in source and binary forms, with or without
22388
+ * modification, are permitted provided that the following conditions are met:
22389
+ *
22390
+ * 1. Redistributions of source code must retain the above copyright notice, this
22391
+ * list of conditions and the following disclaimer.
22392
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22393
+ * this list of conditions and the following disclaimer in the
22394
+ * documentation and/or other materials provided with the distribution.
22395
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22396
+ * may be used to endorse or promote products derived from this software without
22397
+ * specific prior written permission.
22398
+ *
22399
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22400
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22401
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22402
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22403
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22404
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22405
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22406
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22407
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22408
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22409
+ */
21979
22410
  var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
21980
22411
  function parseKey(ctx, end = "=") {
21981
22412
  let start = ctx.p;
@@ -22118,6 +22549,33 @@ function parseArray(ctx, integersAsBigInt) {
22118
22549
  }
22119
22550
 
22120
22551
  // ../../../node_modules/smol-toml/dist/parse.js
22552
+ /*!
22553
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22554
+ * SPDX-License-Identifier: BSD-3-Clause
22555
+ *
22556
+ * Redistribution and use in source and binary forms, with or without
22557
+ * modification, are permitted provided that the following conditions are met:
22558
+ *
22559
+ * 1. Redistributions of source code must retain the above copyright notice, this
22560
+ * list of conditions and the following disclaimer.
22561
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22562
+ * this list of conditions and the following disclaimer in the
22563
+ * documentation and/or other materials provided with the distribution.
22564
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22565
+ * may be used to endorse or promote products derived from this software without
22566
+ * specific prior written permission.
22567
+ *
22568
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22569
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22570
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22571
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22572
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22573
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22574
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22575
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22576
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22577
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22578
+ */
22121
22579
  function peekTable(key, table, meta3, type) {
22122
22580
  let t = table;
22123
22581
  let m = meta3;
@@ -22244,6 +22702,64 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
22244
22702
  return res;
22245
22703
  }
22246
22704
 
22705
+ // ../../../node_modules/smol-toml/dist/stringify.js
22706
+ /*!
22707
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22708
+ * SPDX-License-Identifier: BSD-3-Clause
22709
+ *
22710
+ * Redistribution and use in source and binary forms, with or without
22711
+ * modification, are permitted provided that the following conditions are met:
22712
+ *
22713
+ * 1. Redistributions of source code must retain the above copyright notice, this
22714
+ * list of conditions and the following disclaimer.
22715
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22716
+ * this list of conditions and the following disclaimer in the
22717
+ * documentation and/or other materials provided with the distribution.
22718
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22719
+ * may be used to endorse or promote products derived from this software without
22720
+ * specific prior written permission.
22721
+ *
22722
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22723
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22724
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22725
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22726
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22727
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22728
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22729
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22730
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22731
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22732
+ */
22733
+
22734
+ // ../../../node_modules/smol-toml/dist/index.js
22735
+ /*!
22736
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22737
+ * SPDX-License-Identifier: BSD-3-Clause
22738
+ *
22739
+ * Redistribution and use in source and binary forms, with or without
22740
+ * modification, are permitted provided that the following conditions are met:
22741
+ *
22742
+ * 1. Redistributions of source code must retain the above copyright notice, this
22743
+ * list of conditions and the following disclaimer.
22744
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22745
+ * this list of conditions and the following disclaimer in the
22746
+ * documentation and/or other materials provided with the distribution.
22747
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22748
+ * may be used to endorse or promote products derived from this software without
22749
+ * specific prior written permission.
22750
+ *
22751
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22752
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22753
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22754
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22755
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22756
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22757
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22758
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22759
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22760
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22761
+ */
22762
+
22247
22763
  // dist/models.js
22248
22764
  var KIMI_MODEL_PREFIX = "kimi.";
22249
22765
  function encodeKimiModelRef(alias) {
@@ -24087,7 +24603,7 @@ var KimiSession = class {
24087
24603
  }
24088
24604
  });
24089
24605
  };
24090
- const completeAgentMessage = (phase) => {
24606
+ const completeAgentMessage = (phase, outcome = { status: "succeeded" }) => {
24091
24607
  if (currentAgentMessage) {
24092
24608
  const resolvedPhase = phase ?? currentAgentMessage.phase;
24093
24609
  const item = {
@@ -24096,10 +24612,23 @@ var KimiSession = class {
24096
24612
  text: currentAgentMessage.text,
24097
24613
  ...resolvedPhase ? { phase: resolvedPhase } : {}
24098
24614
  };
24099
- completeItem({ item, outcome: { status: "succeeded" } });
24615
+ completeItem({ item, outcome });
24100
24616
  currentAgentMessage = null;
24101
24617
  }
24102
24618
  };
24619
+ const completeFinalMessage = (outcome) => {
24620
+ completeAgentMessage(outcome.status !== "succeeded" ? "commentary" : hasHadToolCallsInTurn ? "final_answer" : void 0, outcome);
24621
+ };
24622
+ const getActiveTool = (event) => {
24623
+ const existing = accumulator.get(event.toolCallId);
24624
+ if (existing) {
24625
+ return existing.status === "completed" || existing.status === "failed" ? void 0 : existing;
24626
+ }
24627
+ hasHadToolCallsInTurn = true;
24628
+ completeReasoning();
24629
+ completeAgentMessage("commentary");
24630
+ return accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24631
+ };
24103
24632
  const handler = {
24104
24633
  onEvent: (event) => {
24105
24634
  if (this.#closed || this.#faulted || this.#activeTurn?.turnId !== turnId)
@@ -24121,12 +24650,9 @@ var KimiSession = class {
24121
24650
  break;
24122
24651
  }
24123
24652
  case "tool.call": {
24124
- hasHadToolCallsInTurn = true;
24125
- completeReasoning();
24126
- if (currentAgentMessage) {
24127
- completeAgentMessage("commentary");
24128
- }
24129
- const state = accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24653
+ const state = getActiveTool(event);
24654
+ if (!state)
24655
+ break;
24130
24656
  state.name = canonicalizeKimiToolName(event.name, event.kind, event.args);
24131
24657
  if (event.kind)
24132
24658
  state.kind = event.kind;
@@ -24143,11 +24669,9 @@ var KimiSession = class {
24143
24669
  break;
24144
24670
  }
24145
24671
  case "tool.update": {
24146
- completeReasoning();
24147
- if (currentAgentMessage) {
24148
- completeAgentMessage("commentary");
24149
- }
24150
- const state = accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24672
+ const state = getActiveTool(event);
24673
+ if (!state)
24674
+ break;
24151
24675
  if (state.name === "Tool" && event.name) {
24152
24676
  state.name = canonicalizeKimiToolName(event.name, event.kind ?? state.kind, event.rawInput ?? state.rawInput);
24153
24677
  }
@@ -24303,13 +24827,13 @@ var KimiSession = class {
24303
24827
  completeReasoning();
24304
24828
  if (isCommandTurn)
24305
24829
  appendAgentText(formatKimiCommandOutput(commandOutput));
24306
- completeAgentMessage(hasHadToolCallsInTurn ? "final_answer" : void 0);
24307
24830
  let currentNativeTurn = null;
24308
24831
  if (isCommandTurn) {
24309
24832
  const outcome = promptError ? {
24310
24833
  status: "failed",
24311
24834
  error: { code: "nativeFailure", message: promptError.message, retryable: false }
24312
24835
  } : promptResponse?.stopReason === "cancelled" ? { status: "cancelled", reason: "Native command cancelled" } : { status: "succeeded" };
24836
+ completeFinalMessage(outcome);
24313
24837
  const commandTurn = {
24314
24838
  nativeTurnRef: createKimiNativeTurnRef(this.#sessionId, `command:${turnId}`),
24315
24839
  input: command.input,
@@ -24400,6 +24924,8 @@ var KimiSession = class {
24400
24924
  status: "succeeded"
24401
24925
  };
24402
24926
  }
24927
+ if (!isCommandTurn)
24928
+ completeFinalMessage(turnOutcome);
24403
24929
  const completedOutcome = currentNativeTurn?.checkpoint ? { ...turnOutcome, checkpoint: currentNativeTurn.checkpoint } : turnOutcome;
24404
24930
  return {
24405
24931
  kind: "event",