@codexhost/cli-win32-arm64 0.12.1 → 0.13.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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.txt +8 -0
  3. package/app/codexhost-distribution.json +1 -1
  4. package/app/console-server.mjs +232 -21
  5. package/app/console-web.js +5434 -1092
  6. package/app/desktop-controller.mjs +252 -41
  7. package/app/host-runtime.mjs +5318 -1448
  8. package/app/plugins/antigravity/manifest.json +18 -1
  9. package/app/plugins/antigravity/plugin.mjs +276 -42
  10. package/app/plugins/claude-code/manifest.json +28 -0
  11. package/app/plugins/claude-code/plugin.mjs +1049 -359
  12. package/app/plugins/codebuddy/manifest.json +17 -0
  13. package/app/plugins/codebuddy/plugin.mjs +5931 -5358
  14. package/app/plugins/codex-usage/manifest.json +9 -0
  15. package/app/plugins/codex-usage/plugin.mjs +16703 -0
  16. package/app/plugins/cursor-cli/manifest.json +17 -0
  17. package/app/plugins/cursor-cli/plugin.mjs +351 -77
  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 +798 -242
  21. package/app/plugins/enabled.json +2 -1
  22. package/app/plugins/grok/manifest.json +21 -1
  23. package/app/plugins/grok/plugin.mjs +884 -259
  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 +278 -33
  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 +555 -36
  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 +284 -22
  33. package/app/plugins/omp/manifest.json +21 -1
  34. package/app/plugins/omp/plugin.mjs +2737 -1956
  35. package/app/plugins/opencode/manifest.json +18 -1
  36. package/app/plugins/opencode/plugin.mjs +694 -147
  37. package/app/plugins/pi/manifest.json +32 -0
  38. package/app/plugins/pi/plugin.mjs +2809 -2254
  39. package/app/plugins/qoder/manifest.json +18 -1
  40. package/app/plugins/qoder/plugin.mjs +585 -81
  41. package/app/plugins/qoder-cn/manifest.json +18 -1
  42. package/app/plugins/qoder-cn/plugin.mjs +585 -81
  43. package/app/plugins/workbuddy/manifest.json +18 -0
  44. package/app/plugins/workbuddy/plugin.mjs +6317 -5746
  45. package/app/plugins/zcode/manifest.json +19 -1
  46. package/app/plugins/zcode/plugin.mjs +1066 -260
  47. package/app/renderer-extension.js +1999 -1686
  48. package/bin/codexhost.exe +0 -0
  49. package/libexec/codexhost-node-repl.exe +0 -0
  50. package/libexec/codexhost-shim.exe +0 -0
  51. package/libexec/codexhost-updater.exe +0 -0
  52. package/licenses/Cordis-LICENSE.txt +21 -0
  53. package/licenses/Cosmokit-LICENSE.txt +21 -0
  54. package/package.json +1 -1
  55. 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,153 @@ 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
+ /** Models the session used, most requests first. */
15167
+ models: external_exports.array(model).max(16),
15168
+ firstAtMs: count,
15169
+ lastAtMs: count,
15170
+ ...totals
15171
+ });
15172
+ var usageStatisticsResultSchema = external_exports.strictObject({
15173
+ range: external_exports.enum(USAGE_STATISTICS_RANGES),
15174
+ /** First local date of the range; null for all time. */
15175
+ from: localDate.nullable(),
15176
+ to: localDate,
15177
+ /** The filters these figures apply, echoed so a late answer to older filters is recognised. */
15178
+ filters: external_exports.strictObject({
15179
+ harness: harness.nullable(),
15180
+ model: model.nullable(),
15181
+ unknownModel: external_exports.boolean(),
15182
+ project: project.nullable(),
15183
+ unknownProject: external_exports.boolean(),
15184
+ date: localDate.nullable()
15185
+ }),
15186
+ /** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
15187
+ reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
15188
+ /** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
15189
+ failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
15190
+ /** Every value seen in the range, ignoring the filters, to choose filters from. */
15191
+ options: external_exports.strictObject({
15192
+ harnesses: external_exports.array(harness).max(256),
15193
+ models: external_exports.array(model.nullable()).max(4096),
15194
+ projects: external_exports.array(project.nullable()).max(4096)
15195
+ }),
15196
+ /** Current display metadata, scoped by Harness. Never a pricing or filter identity.
15197
+ * Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
15198
+ */
15199
+ modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
15200
+ /** Native credits, all filters applied, never combined across Harnesses or treated as USD.
15201
+ * Only groups with at least one reported value appear; reportedRequests exposes partial data.
15202
+ */
15203
+ credits: external_exports.array(external_exports.strictObject({
15204
+ harness,
15205
+ model: model.nullable(),
15206
+ credits: external_exports.number().finite().min(0),
15207
+ reportedRequests: count,
15208
+ requests: count
15209
+ })).max(4096).optional(),
15210
+ /** All filters applied. */
15211
+ totals: usageStatisticsTotalsSchema,
15212
+ /** Each date and Harness of the range: every filter except the day. */
15213
+ daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
15214
+ /** Local weekday (0 = Sunday) and hour, all filters applied. */
15215
+ hourly: external_exports.array(external_exports.strictObject({
15216
+ weekday: external_exports.number().int().min(0).max(6),
15217
+ hour: external_exports.number().int().min(0).max(23),
15218
+ ...totals
15219
+ })).max(168),
15220
+ byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
15221
+ byModel: external_exports.array(external_exports.strictObject({
15222
+ model: model.nullable(),
15223
+ ...totals,
15224
+ /** Requests priced by what the Harness recorded they cost, not by a price list. */
15225
+ harnessPricedRequests: count
15226
+ })).max(4096),
15227
+ byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
15228
+ /**
15229
+ * The sessions that spent the most, by cost and by tokens without cache, all filters applied;
15230
+ * requests without a native session are not listed here but count everywhere else.
15231
+ */
15232
+ sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
15233
+ });
15234
+
15079
15235
  // ../../shared-contracts/dist/ids.js
15080
15236
  var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15081
15237
  message: "Identifier must not be empty or whitespace"
@@ -15123,6 +15279,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15123
15279
  "codexhost/account/list",
15124
15280
  "codexhost/account/refresh",
15125
15281
  "codexhost/account/usage/inspect",
15282
+ "codexhost/usage/model-prices/get",
15283
+ "codexhost/usage/model-prices/set",
15284
+ "codexhost/usage/model-prices/default",
15285
+ "codexhost/usage/statistics/get",
15126
15286
  "codexhost/update/check",
15127
15287
  "codexhost/update/start",
15128
15288
  "codexhost/update/status"
@@ -15187,6 +15347,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15187
15347
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15188
15348
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15189
15349
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15350
+ apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15190
15351
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15191
15352
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
15192
15353
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
@@ -15198,7 +15359,11 @@ var threadUsageSnapshotSchema = external_exports.object({
15198
15359
  planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
15199
15360
  planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15200
15361
  planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
15201
- planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
15362
+ planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15363
+ sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15364
+ timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15365
+ costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15366
+ unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15202
15367
  }).strict().superRefine((usage, context) => {
15203
15368
  if (Object.keys(usage).length === 0) {
15204
15369
  context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
@@ -15219,6 +15384,20 @@ var threadUsageSnapshotSchema = external_exports.object({
15219
15384
  path: ["contextWindowTokens"]
15220
15385
  });
15221
15386
  }
15387
+ if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
15388
+ context.addIssue({
15389
+ code: "custom",
15390
+ message: "Thread Usage costSource must be provided with totalCostUsd",
15391
+ path: ["costSource"]
15392
+ });
15393
+ }
15394
+ if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
15395
+ context.addIssue({
15396
+ code: "custom",
15397
+ message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
15398
+ path: ["unpricedModels"]
15399
+ });
15400
+ }
15222
15401
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
15223
15402
  context.addIssue({
15224
15403
  code: "custom",
@@ -15473,27 +15652,27 @@ var harnessModelCatalogSchema = external_exports.object({
15473
15652
  }).strict().superRefine((catalog, context) => {
15474
15653
  const refs = /* @__PURE__ */ new Set();
15475
15654
  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)) {
15655
+ for (const [index, model2] of catalog.models.entries()) {
15656
+ if (refs.has(model2.ref.id)) {
15478
15657
  context.addIssue({
15479
15658
  code: "custom",
15480
15659
  message: "Model Catalog refs must be unique",
15481
15660
  path: ["models", index, "ref", "id"]
15482
15661
  });
15483
15662
  }
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)) {
15663
+ refs.add(model2.ref.id);
15664
+ if (model2.fastModel) {
15665
+ if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15487
15666
  context.addIssue({
15488
15667
  code: "custom",
15489
15668
  message: "Fast Model refs must be distinct and unique",
15490
15669
  path: ["models", index, "fastModel"]
15491
15670
  });
15492
15671
  }
15493
- refs.add(model.fastModel.id);
15672
+ refs.add(model2.fastModel.id);
15494
15673
  }
15495
15674
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15496
- for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
15675
+ for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
15497
15676
  if (supportedThinkingIds.has(optionId)) {
15498
15677
  context.addIssue({
15499
15678
  code: "custom",
@@ -15687,13 +15866,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
15687
15866
  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
15867
  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
15868
  var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15869
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15870
+ var harnessInstallationGuideSchema = external_exports.object({
15871
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15872
+ before: localizedTextSchema.optional(),
15873
+ after: localizedTextSchema.optional(),
15874
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15875
+ }).strict();
15690
15876
  var pluginPresentationShape = {
15691
15877
  id: harnessPluginIdSchema,
15692
15878
  name: external_exports.string().trim().min(1).max(128),
15693
15879
  version: external_exports.string().min(1).max(128),
15880
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15881
+ kind: external_exports.literal("usage").optional(),
15882
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15883
+ iconStyle: external_exports.object({
15884
+ vector: external_exports.object({
15885
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15886
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15887
+ paths: external_exports.array(external_exports.object({
15888
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15889
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15890
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15891
+ }).strict()).min(1).max(32)
15892
+ }).strict().optional(),
15893
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15894
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15895
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15896
+ }).strict().optional(),
15897
+ installation: harnessInstallationGuideSchema.optional(),
15898
+ notice: localizedTextSchema.optional(),
15694
15899
  /** The factory accepts a persisted local entrypoint through its construction context. */
15695
15900
  launchCommand: external_exports.literal(true).optional(),
15696
15901
  links: external_exports.object({
15902
+ website: documentationUrlSchema.optional(),
15697
15903
  documentation: documentationUrlSchema.optional(),
15698
15904
  installation: documentationUrlSchema.optional()
15699
15905
  }).strict().optional()
@@ -16112,6 +16318,11 @@ var codexSshDraftSchema = external_exports.strictObject({
16112
16318
  });
16113
16319
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16114
16320
  external_exports.strictObject({ action: external_exports.literal("list") }),
16321
+ external_exports.strictObject({
16322
+ action: external_exports.literal("read-thread"),
16323
+ hostId: hostId.refine((id) => id !== "local"),
16324
+ input: delegationReadParamsSchema
16325
+ }),
16115
16326
  external_exports.strictObject({
16116
16327
  action: external_exports.literal("save"),
16117
16328
  draft: codexSshDraftSchema,
@@ -16247,7 +16458,6 @@ var tokenFields = [
16247
16458
  "cachedInputTokens",
16248
16459
  "cacheWriteInputTokens",
16249
16460
  "outputTokens",
16250
- "outputTokensPerSecond",
16251
16461
  "reasoningOutputTokens",
16252
16462
  "totalTokens",
16253
16463
  "contextWindowTokens",
@@ -16255,10 +16465,12 @@ var tokenFields = [
16255
16465
  ];
16256
16466
  var safeIntegerFields = [
16257
16467
  "planFiveHourResetsAtUnix",
16258
- "planSevenDayResetsAtUnix"
16468
+ "planSevenDayResetsAtUnix",
16469
+ "timeToFirstOutputMs"
16259
16470
  ];
16260
16471
  var percentFields = [
16261
16472
  "cacheHitRatePercent",
16473
+ "sessionCacheHitRatePercent",
16262
16474
  "planFiveHourUsedPercent",
16263
16475
  "planSevenDayUsedPercent"
16264
16476
  ];
@@ -16266,9 +16478,14 @@ var usageFields = /* @__PURE__ */ new Set([
16266
16478
  ...tokenFields,
16267
16479
  ...safeIntegerFields,
16268
16480
  ...percentFields,
16481
+ "sessionCacheUsage",
16269
16482
  "totalCostUsd",
16270
16483
  "totalCredits",
16271
- "contextUsagePercent"
16484
+ "contextUsagePercent",
16485
+ "outputTokensPerSecond",
16486
+ "apiOutputTokensPerSecond",
16487
+ "costSource",
16488
+ "unpricedModels"
16272
16489
  ]);
16273
16490
  function isRecord(value) {
16274
16491
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -16284,7 +16501,11 @@ function parseHostUsage(value) {
16284
16501
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16285
16502
  }
16286
16503
  }
16287
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16504
+ for (const field of [
16505
+ "totalCredits",
16506
+ "contextUsagePercent",
16507
+ "apiOutputTokensPerSecond"
16508
+ ]) {
16288
16509
  const candidate = value[field];
16289
16510
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16290
16511
  throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
@@ -16314,6 +16535,12 @@ function parseHostUsage(value) {
16314
16535
  throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16315
16536
  }
16316
16537
  }
16538
+ if (value.sessionCacheUsage !== void 0) {
16539
+ const totals2 = value.sessionCacheUsage;
16540
+ 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) {
16541
+ throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
16542
+ }
16543
+ }
16317
16544
  const hasContextUsed = value.contextUsedTokens !== void 0;
16318
16545
  const hasContextWindow = value.contextWindowTokens !== void 0;
16319
16546
  if (hasContextUsed !== hasContextWindow) {
@@ -16328,8 +16555,43 @@ function parseHostUsage(value) {
16328
16555
  if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
16329
16556
  throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
16330
16557
  }
16558
+ if (value.costSource !== void 0) {
16559
+ if (value.costSource !== "publicPrice" && value.costSource !== "native") {
16560
+ throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
16561
+ }
16562
+ if (value.totalCostUsd === void 0) {
16563
+ throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
16564
+ }
16565
+ }
16566
+ if (value.unpricedModels !== void 0) {
16567
+ const models = value.unpricedModels;
16568
+ if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
16569
+ throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
16570
+ }
16571
+ if (value.costSource !== "publicPrice") {
16572
+ throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16573
+ }
16574
+ return { ...value, unpricedModels: [...models] };
16575
+ }
16331
16576
  return { ...value };
16332
16577
  }
16578
+ var requestTokenFields = [
16579
+ "inputTokens",
16580
+ "cachedInputTokens",
16581
+ "cacheWriteInputTokens",
16582
+ "cacheWrite1hInputTokens",
16583
+ "outputTokens",
16584
+ "reasoningOutputTokens",
16585
+ "startedAtMs",
16586
+ "completedAtMs"
16587
+ ];
16588
+ var requestFields = /* @__PURE__ */ new Set([
16589
+ ...requestTokenFields,
16590
+ "requestId",
16591
+ "historical",
16592
+ "model",
16593
+ "provider"
16594
+ ]);
16333
16595
 
16334
16596
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
16335
16597
  var AGENT_METHODS = {
@@ -18614,9 +18876,9 @@ var Connection = class {
18614
18876
  return;
18615
18877
  }
18616
18878
  const responseBatch = isResponseBatch(batch);
18617
- const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
18879
+ const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
18618
18880
  let remaining = responseCount;
18619
- let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
18881
+ let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
18620
18882
  let responseSent = false;
18621
18883
  const responses = [];
18622
18884
  const sendResponsesIfReady = async () => {
@@ -21600,6 +21862,33 @@ function splitLines(text) {
21600
21862
  }
21601
21863
 
21602
21864
  // ../../../node_modules/smol-toml/dist/date.js
21865
+ /*!
21866
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
21867
+ * SPDX-License-Identifier: BSD-3-Clause
21868
+ *
21869
+ * Redistribution and use in source and binary forms, with or without
21870
+ * modification, are permitted provided that the following conditions are met:
21871
+ *
21872
+ * 1. Redistributions of source code must retain the above copyright notice, this
21873
+ * list of conditions and the following disclaimer.
21874
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21875
+ * this list of conditions and the following disclaimer in the
21876
+ * documentation and/or other materials provided with the distribution.
21877
+ * 3. Neither the name of the copyright holder nor the names of its contributors
21878
+ * may be used to endorse or promote products derived from this software without
21879
+ * specific prior written permission.
21880
+ *
21881
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21882
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21883
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21884
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21885
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21886
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21887
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21888
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21889
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21890
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21891
+ */
21603
21892
  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
21893
  var TomlDate = class _TomlDate extends Date {
21605
21894
  #hasDate = false;
@@ -21692,6 +21981,33 @@ var TomlDate = class _TomlDate extends Date {
21692
21981
  };
21693
21982
 
21694
21983
  // ../../../node_modules/smol-toml/dist/error.js
21984
+ /*!
21985
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
21986
+ * SPDX-License-Identifier: BSD-3-Clause
21987
+ *
21988
+ * Redistribution and use in source and binary forms, with or without
21989
+ * modification, are permitted provided that the following conditions are met:
21990
+ *
21991
+ * 1. Redistributions of source code must retain the above copyright notice, this
21992
+ * list of conditions and the following disclaimer.
21993
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21994
+ * this list of conditions and the following disclaimer in the
21995
+ * documentation and/or other materials provided with the distribution.
21996
+ * 3. Neither the name of the copyright holder nor the names of its contributors
21997
+ * may be used to endorse or promote products derived from this software without
21998
+ * specific prior written permission.
21999
+ *
22000
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22001
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22002
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22003
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22004
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22005
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22006
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22007
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22008
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22009
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22010
+ */
21695
22011
  function getLineColFromPtr(string4, ptr) {
21696
22012
  let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
21697
22013
  return [lines.length, lines.pop().length + 1];
@@ -21732,6 +22048,33 @@ ${codeblock}`, options);
21732
22048
  };
21733
22049
 
21734
22050
  // ../../../node_modules/smol-toml/dist/util.js
22051
+ /*!
22052
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22053
+ * SPDX-License-Identifier: BSD-3-Clause
22054
+ *
22055
+ * Redistribution and use in source and binary forms, with or without
22056
+ * modification, are permitted provided that the following conditions are met:
22057
+ *
22058
+ * 1. Redistributions of source code must retain the above copyright notice, this
22059
+ * list of conditions and the following disclaimer.
22060
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22061
+ * this list of conditions and the following disclaimer in the
22062
+ * documentation and/or other materials provided with the distribution.
22063
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22064
+ * may be used to endorse or promote products derived from this software without
22065
+ * specific prior written permission.
22066
+ *
22067
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22068
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22069
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22070
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22071
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22072
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22073
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22074
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22075
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22076
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22077
+ */
21735
22078
  function indexOfNewline(str, start = 0) {
21736
22079
  let idx = str.indexOf("\n", start);
21737
22080
  if (str.charCodeAt(idx - 1) === 13)
@@ -21787,6 +22130,33 @@ function skipUntil(ctx, sep, end) {
21787
22130
  }
21788
22131
 
21789
22132
  // ../../../node_modules/smol-toml/dist/primitive.js
22133
+ /*!
22134
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22135
+ * SPDX-License-Identifier: BSD-3-Clause
22136
+ *
22137
+ * Redistribution and use in source and binary forms, with or without
22138
+ * modification, are permitted provided that the following conditions are met:
22139
+ *
22140
+ * 1. Redistributions of source code must retain the above copyright notice, this
22141
+ * list of conditions and the following disclaimer.
22142
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22143
+ * this list of conditions and the following disclaimer in the
22144
+ * documentation and/or other materials provided with the distribution.
22145
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22146
+ * may be used to endorse or promote products derived from this software without
22147
+ * specific prior written permission.
22148
+ *
22149
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22150
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22151
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22152
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22153
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22154
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22155
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22156
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22157
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22158
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22159
+ */
21790
22160
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
21791
22161
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
21792
22162
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
@@ -21943,6 +22313,33 @@ function parseValue(ctx, integersAsBigInt, end) {
21943
22313
  }
21944
22314
 
21945
22315
  // ../../../node_modules/smol-toml/dist/extract.js
22316
+ /*!
22317
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22318
+ * SPDX-License-Identifier: BSD-3-Clause
22319
+ *
22320
+ * Redistribution and use in source and binary forms, with or without
22321
+ * modification, are permitted provided that the following conditions are met:
22322
+ *
22323
+ * 1. Redistributions of source code must retain the above copyright notice, this
22324
+ * list of conditions and the following disclaimer.
22325
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22326
+ * this list of conditions and the following disclaimer in the
22327
+ * documentation and/or other materials provided with the distribution.
22328
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22329
+ * may be used to endorse or promote products derived from this software without
22330
+ * specific prior written permission.
22331
+ *
22332
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22333
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22334
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22335
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22336
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22337
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22338
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22339
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22340
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22341
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22342
+ */
21946
22343
  function extractValue(ctx, end, integersAsBigInt) {
21947
22344
  let ptr = ctx.p;
21948
22345
  let c = ctx.s.charCodeAt(ptr);
@@ -21976,6 +22373,33 @@ function extractValue(ctx, end, integersAsBigInt) {
21976
22373
  }
21977
22374
 
21978
22375
  // ../../../node_modules/smol-toml/dist/struct.js
22376
+ /*!
22377
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22378
+ * SPDX-License-Identifier: BSD-3-Clause
22379
+ *
22380
+ * Redistribution and use in source and binary forms, with or without
22381
+ * modification, are permitted provided that the following conditions are met:
22382
+ *
22383
+ * 1. Redistributions of source code must retain the above copyright notice, this
22384
+ * list of conditions and the following disclaimer.
22385
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22386
+ * this list of conditions and the following disclaimer in the
22387
+ * documentation and/or other materials provided with the distribution.
22388
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22389
+ * may be used to endorse or promote products derived from this software without
22390
+ * specific prior written permission.
22391
+ *
22392
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22393
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22394
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22395
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22396
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22397
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22398
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22399
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22400
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22401
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22402
+ */
21979
22403
  var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
21980
22404
  function parseKey(ctx, end = "=") {
21981
22405
  let start = ctx.p;
@@ -22118,6 +22542,33 @@ function parseArray(ctx, integersAsBigInt) {
22118
22542
  }
22119
22543
 
22120
22544
  // ../../../node_modules/smol-toml/dist/parse.js
22545
+ /*!
22546
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22547
+ * SPDX-License-Identifier: BSD-3-Clause
22548
+ *
22549
+ * Redistribution and use in source and binary forms, with or without
22550
+ * modification, are permitted provided that the following conditions are met:
22551
+ *
22552
+ * 1. Redistributions of source code must retain the above copyright notice, this
22553
+ * list of conditions and the following disclaimer.
22554
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22555
+ * this list of conditions and the following disclaimer in the
22556
+ * documentation and/or other materials provided with the distribution.
22557
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22558
+ * may be used to endorse or promote products derived from this software without
22559
+ * specific prior written permission.
22560
+ *
22561
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22562
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22563
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22564
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22565
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22566
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22567
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22568
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22569
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22570
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22571
+ */
22121
22572
  function peekTable(key, table, meta3, type) {
22122
22573
  let t = table;
22123
22574
  let m = meta3;
@@ -22244,6 +22695,64 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
22244
22695
  return res;
22245
22696
  }
22246
22697
 
22698
+ // ../../../node_modules/smol-toml/dist/stringify.js
22699
+ /*!
22700
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22701
+ * SPDX-License-Identifier: BSD-3-Clause
22702
+ *
22703
+ * Redistribution and use in source and binary forms, with or without
22704
+ * modification, are permitted provided that the following conditions are met:
22705
+ *
22706
+ * 1. Redistributions of source code must retain the above copyright notice, this
22707
+ * list of conditions and the following disclaimer.
22708
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22709
+ * this list of conditions and the following disclaimer in the
22710
+ * documentation and/or other materials provided with the distribution.
22711
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22712
+ * may be used to endorse or promote products derived from this software without
22713
+ * specific prior written permission.
22714
+ *
22715
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22716
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22717
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22718
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22719
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22720
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22721
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22722
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22723
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22724
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22725
+ */
22726
+
22727
+ // ../../../node_modules/smol-toml/dist/index.js
22728
+ /*!
22729
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22730
+ * SPDX-License-Identifier: BSD-3-Clause
22731
+ *
22732
+ * Redistribution and use in source and binary forms, with or without
22733
+ * modification, are permitted provided that the following conditions are met:
22734
+ *
22735
+ * 1. Redistributions of source code must retain the above copyright notice, this
22736
+ * list of conditions and the following disclaimer.
22737
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22738
+ * this list of conditions and the following disclaimer in the
22739
+ * documentation and/or other materials provided with the distribution.
22740
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22741
+ * may be used to endorse or promote products derived from this software without
22742
+ * specific prior written permission.
22743
+ *
22744
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22745
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22746
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22747
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22748
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22749
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22750
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22751
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22752
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22753
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22754
+ */
22755
+
22247
22756
  // dist/models.js
22248
22757
  var KIMI_MODEL_PREFIX = "kimi.";
22249
22758
  function encodeKimiModelRef(alias) {
@@ -24087,7 +24596,7 @@ var KimiSession = class {
24087
24596
  }
24088
24597
  });
24089
24598
  };
24090
- const completeAgentMessage = (phase) => {
24599
+ const completeAgentMessage = (phase, outcome = { status: "succeeded" }) => {
24091
24600
  if (currentAgentMessage) {
24092
24601
  const resolvedPhase = phase ?? currentAgentMessage.phase;
24093
24602
  const item = {
@@ -24096,10 +24605,23 @@ var KimiSession = class {
24096
24605
  text: currentAgentMessage.text,
24097
24606
  ...resolvedPhase ? { phase: resolvedPhase } : {}
24098
24607
  };
24099
- completeItem({ item, outcome: { status: "succeeded" } });
24608
+ completeItem({ item, outcome });
24100
24609
  currentAgentMessage = null;
24101
24610
  }
24102
24611
  };
24612
+ const completeFinalMessage = (outcome) => {
24613
+ completeAgentMessage(outcome.status !== "succeeded" ? "commentary" : hasHadToolCallsInTurn ? "final_answer" : void 0, outcome);
24614
+ };
24615
+ const getActiveTool = (event) => {
24616
+ const existing = accumulator.get(event.toolCallId);
24617
+ if (existing) {
24618
+ return existing.status === "completed" || existing.status === "failed" ? void 0 : existing;
24619
+ }
24620
+ hasHadToolCallsInTurn = true;
24621
+ completeReasoning();
24622
+ completeAgentMessage("commentary");
24623
+ return accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24624
+ };
24103
24625
  const handler = {
24104
24626
  onEvent: (event) => {
24105
24627
  if (this.#closed || this.#faulted || this.#activeTurn?.turnId !== turnId)
@@ -24121,12 +24643,9 @@ var KimiSession = class {
24121
24643
  break;
24122
24644
  }
24123
24645
  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);
24646
+ const state = getActiveTool(event);
24647
+ if (!state)
24648
+ break;
24130
24649
  state.name = canonicalizeKimiToolName(event.name, event.kind, event.args);
24131
24650
  if (event.kind)
24132
24651
  state.kind = event.kind;
@@ -24143,11 +24662,9 @@ var KimiSession = class {
24143
24662
  break;
24144
24663
  }
24145
24664
  case "tool.update": {
24146
- completeReasoning();
24147
- if (currentAgentMessage) {
24148
- completeAgentMessage("commentary");
24149
- }
24150
- const state = accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24665
+ const state = getActiveTool(event);
24666
+ if (!state)
24667
+ break;
24151
24668
  if (state.name === "Tool" && event.name) {
24152
24669
  state.name = canonicalizeKimiToolName(event.name, event.kind ?? state.kind, event.rawInput ?? state.rawInput);
24153
24670
  }
@@ -24303,13 +24820,13 @@ var KimiSession = class {
24303
24820
  completeReasoning();
24304
24821
  if (isCommandTurn)
24305
24822
  appendAgentText(formatKimiCommandOutput(commandOutput));
24306
- completeAgentMessage(hasHadToolCallsInTurn ? "final_answer" : void 0);
24307
24823
  let currentNativeTurn = null;
24308
24824
  if (isCommandTurn) {
24309
24825
  const outcome = promptError ? {
24310
24826
  status: "failed",
24311
24827
  error: { code: "nativeFailure", message: promptError.message, retryable: false }
24312
24828
  } : promptResponse?.stopReason === "cancelled" ? { status: "cancelled", reason: "Native command cancelled" } : { status: "succeeded" };
24829
+ completeFinalMessage(outcome);
24313
24830
  const commandTurn = {
24314
24831
  nativeTurnRef: createKimiNativeTurnRef(this.#sessionId, `command:${turnId}`),
24315
24832
  input: command.input,
@@ -24400,6 +24917,8 @@ var KimiSession = class {
24400
24917
  status: "succeeded"
24401
24918
  };
24402
24919
  }
24920
+ if (!isCommandTurn)
24921
+ completeFinalMessage(turnOutcome);
24403
24922
  const completedOutcome = currentNativeTurn?.checkpoint ? { ...turnOutcome, checkpoint: currentNativeTurn.checkpoint } : turnOutcome;
24404
24923
  return {
24405
24924
  kind: "event",