@liberseek/boft-cli-linux-x64 0.7.9 → 0.8.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 (56) 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 +322 -67
  5. package/app/console-web.js +9202 -5218
  6. package/app/desktop-controller.mjs +259 -42
  7. package/app/host-runtime.mjs +6250 -1689
  8. package/app/plugins/antigravity/manifest.json +18 -1
  9. package/app/plugins/antigravity/plugin.mjs +283 -42
  10. package/app/plugins/claude-code/manifest.json +28 -0
  11. package/app/plugins/claude-code/plugin.mjs +35676 -24151
  12. package/app/plugins/codebuddy/manifest.json +17 -0
  13. package/app/plugins/codebuddy/plugin.mjs +5972 -5356
  14. package/app/plugins/codex-usage/manifest.json +9 -0
  15. package/app/plugins/codex-usage/plugin.mjs +17386 -0
  16. package/app/plugins/cursor-cli/manifest.json +18 -1
  17. package/app/plugins/cursor-cli/plugin.mjs +358 -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 +823 -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 +933 -268
  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 +469 -73
  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 +562 -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 +291 -22
  33. package/app/plugins/muse/manifest.json +18 -1
  34. package/app/plugins/muse/plugin.mjs +258 -17
  35. package/app/plugins/omp/manifest.json +21 -1
  36. package/app/plugins/omp/plugin.mjs +2763 -1958
  37. package/app/plugins/opencode/manifest.json +18 -1
  38. package/app/plugins/opencode/plugin.mjs +724 -147
  39. package/app/plugins/pi/manifest.json +32 -0
  40. package/app/plugins/pi/plugin.mjs +2908 -2312
  41. package/app/plugins/qoder/manifest.json +18 -1
  42. package/app/plugins/qoder/plugin.mjs +635 -81
  43. package/app/plugins/qoder-cn/manifest.json +18 -1
  44. package/app/plugins/qoder-cn/plugin.mjs +635 -81
  45. package/app/plugins/workbuddy/manifest.json +18 -0
  46. package/app/plugins/workbuddy/plugin.mjs +6362 -5748
  47. package/app/plugins/zcode/manifest.json +19 -1
  48. package/app/plugins/zcode/plugin.mjs +1117 -278
  49. package/app/renderer-extension.js +14675 -10087
  50. package/bin/boft +0 -0
  51. package/libexec/boft-shim +0 -0
  52. package/libexec/boft-updater +0 -0
  53. package/licenses/Cordis-LICENSE.txt +21 -0
  54. package/licenses/Cosmokit-LICENSE.txt +21 -0
  55. package/package.json +4 -4
  56. 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"
@@ -15097,13 +15260,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
15097
15260
  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);
15098
15261
  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");
15099
15262
  var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15263
+ var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
15264
+ var harnessInstallationGuideSchema = external_exports.object({
15265
+ commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
15266
+ before: localizedTextSchema.optional(),
15267
+ after: localizedTextSchema.optional(),
15268
+ downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
15269
+ }).strict();
15100
15270
  var pluginPresentationShape = {
15101
15271
  id: harnessPluginIdSchema,
15102
15272
  name: external_exports.string().trim().min(1).max(128),
15103
15273
  version: external_exports.string().min(1).max(128),
15274
+ /** Capability-only plugin; omitted for existing session-capable plugins. */
15275
+ kind: external_exports.literal("usage").optional(),
15276
+ /** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
15277
+ iconStyle: external_exports.object({
15278
+ vector: external_exports.object({
15279
+ viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
15280
+ color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
15281
+ paths: external_exports.array(external_exports.object({
15282
+ d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
15283
+ fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
15284
+ fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
15285
+ }).strict()).min(1).max(32)
15286
+ }).strict().optional(),
15287
+ background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
15288
+ borderRadius: external_exports.number().min(0).max(50).optional(),
15289
+ paddingRatio: external_exports.number().min(0).max(0.25).optional()
15290
+ }).strict().optional(),
15291
+ installation: harnessInstallationGuideSchema.optional(),
15292
+ notice: localizedTextSchema.optional(),
15104
15293
  /** The factory accepts a persisted local entrypoint through its construction context. */
15105
15294
  launchCommand: external_exports.literal(true).optional(),
15106
15295
  links: external_exports.object({
15296
+ website: documentationUrlSchema.optional(),
15107
15297
  documentation: documentationUrlSchema.optional(),
15108
15298
  installation: documentationUrlSchema.optional()
15109
15299
  }).strict().optional()
@@ -15180,6 +15370,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
15180
15370
  "codexhost/account/list",
15181
15371
  "codexhost/account/refresh",
15182
15372
  "codexhost/account/usage/inspect",
15373
+ "codexhost/usage/model-prices/get",
15374
+ "codexhost/usage/model-prices/set",
15375
+ "codexhost/usage/model-prices/default",
15376
+ "codexhost/usage/statistics/get",
15183
15377
  "codexhost/update/check",
15184
15378
  "codexhost/update/start",
15185
15379
  "codexhost/update/status"
@@ -15244,6 +15438,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15244
15438
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15245
15439
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15246
15440
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15441
+ apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15247
15442
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15248
15443
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
15249
15444
  totalCostUsd: finiteNonNegativeNumberSchema.optional(),
@@ -15255,7 +15450,11 @@ var threadUsageSnapshotSchema = external_exports.object({
15255
15450
  planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
15256
15451
  planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15257
15452
  planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
15258
- planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
15453
+ planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
15454
+ sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
15455
+ timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
15456
+ costSource: external_exports.enum(["publicPrice", "native"]).optional(),
15457
+ unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
15259
15458
  }).strict().superRefine((usage, context) => {
15260
15459
  if (Object.keys(usage).length === 0) {
15261
15460
  context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
@@ -15276,6 +15475,20 @@ var threadUsageSnapshotSchema = external_exports.object({
15276
15475
  path: ["contextWindowTokens"]
15277
15476
  });
15278
15477
  }
15478
+ if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
15479
+ context.addIssue({
15480
+ code: "custom",
15481
+ message: "Thread Usage costSource must be provided with totalCostUsd",
15482
+ path: ["costSource"]
15483
+ });
15484
+ }
15485
+ if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
15486
+ context.addIssue({
15487
+ code: "custom",
15488
+ message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
15489
+ path: ["unpricedModels"]
15490
+ });
15491
+ }
15279
15492
  if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
15280
15493
  context.addIssue({
15281
15494
  code: "custom",
@@ -15545,27 +15758,27 @@ var harnessModelCatalogSchema = external_exports.object({
15545
15758
  }).strict().superRefine((catalog, context) => {
15546
15759
  const refs = /* @__PURE__ */ new Set();
15547
15760
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
15548
- for (const [index, model] of catalog.models.entries()) {
15549
- if (refs.has(model.ref.id)) {
15761
+ for (const [index, model2] of catalog.models.entries()) {
15762
+ if (refs.has(model2.ref.id)) {
15550
15763
  context.addIssue({
15551
15764
  code: "custom",
15552
15765
  message: "Model Catalog refs must be unique",
15553
15766
  path: ["models", index, "ref", "id"]
15554
15767
  });
15555
15768
  }
15556
- refs.add(model.ref.id);
15557
- if (model.fastModel) {
15558
- if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15769
+ refs.add(model2.ref.id);
15770
+ if (model2.fastModel) {
15771
+ if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
15559
15772
  context.addIssue({
15560
15773
  code: "custom",
15561
15774
  message: "Fast Model refs must be distinct and unique",
15562
15775
  path: ["models", index, "fastModel"]
15563
15776
  });
15564
15777
  }
15565
- refs.add(model.fastModel.id);
15778
+ refs.add(model2.fastModel.id);
15566
15779
  }
15567
15780
  const supportedThinkingIds = /* @__PURE__ */ new Set();
15568
- for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
15781
+ for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
15569
15782
  if (supportedThinkingIds.has(optionId)) {
15570
15783
  context.addIssue({
15571
15784
  code: "custom",
@@ -16159,6 +16372,11 @@ var codexSshDraftSchema = external_exports.strictObject({
16159
16372
  });
16160
16373
  var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
16161
16374
  external_exports.strictObject({ action: external_exports.literal("list") }),
16375
+ external_exports.strictObject({
16376
+ action: external_exports.literal("read-thread"),
16377
+ hostId: hostId.refine((id) => id !== "local"),
16378
+ input: delegationReadParamsSchema
16379
+ }),
16162
16380
  external_exports.strictObject({
16163
16381
  action: external_exports.literal("save"),
16164
16382
  draft: codexSshDraftSchema,
@@ -16294,7 +16512,6 @@ var tokenFields = [
16294
16512
  "cachedInputTokens",
16295
16513
  "cacheWriteInputTokens",
16296
16514
  "outputTokens",
16297
- "outputTokensPerSecond",
16298
16515
  "reasoningOutputTokens",
16299
16516
  "totalTokens",
16300
16517
  "contextWindowTokens",
@@ -16302,10 +16519,12 @@ var tokenFields = [
16302
16519
  ];
16303
16520
  var safeIntegerFields = [
16304
16521
  "planFiveHourResetsAtUnix",
16305
- "planSevenDayResetsAtUnix"
16522
+ "planSevenDayResetsAtUnix",
16523
+ "timeToFirstOutputMs"
16306
16524
  ];
16307
16525
  var percentFields = [
16308
16526
  "cacheHitRatePercent",
16527
+ "sessionCacheHitRatePercent",
16309
16528
  "planFiveHourUsedPercent",
16310
16529
  "planSevenDayUsedPercent"
16311
16530
  ];
@@ -16313,9 +16532,14 @@ var usageFields = /* @__PURE__ */ new Set([
16313
16532
  ...tokenFields,
16314
16533
  ...safeIntegerFields,
16315
16534
  ...percentFields,
16535
+ "sessionCacheUsage",
16316
16536
  "totalCostUsd",
16317
16537
  "totalCredits",
16318
- "contextUsagePercent"
16538
+ "contextUsagePercent",
16539
+ "outputTokensPerSecond",
16540
+ "apiOutputTokensPerSecond",
16541
+ "costSource",
16542
+ "unpricedModels"
16319
16543
  ]);
16320
16544
  function isRecord(value) {
16321
16545
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -16331,7 +16555,11 @@ function parseHostUsage(value) {
16331
16555
  throw new Error(`Harness Usage contains unknown field '${key}'`);
16332
16556
  }
16333
16557
  }
16334
- for (const field of ["totalCredits", "contextUsagePercent"]) {
16558
+ for (const field of [
16559
+ "totalCredits",
16560
+ "contextUsagePercent",
16561
+ "apiOutputTokensPerSecond"
16562
+ ]) {
16335
16563
  const candidate = value[field];
16336
16564
  if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
16337
16565
  throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
@@ -16367,6 +16595,12 @@ function parseHostUsage(value) {
16367
16595
  throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
16368
16596
  }
16369
16597
  }
16598
+ if (value.sessionCacheUsage !== void 0) {
16599
+ const totals2 = value.sessionCacheUsage;
16600
+ 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) {
16601
+ throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
16602
+ }
16603
+ }
16370
16604
  const hasContextUsed = value.contextUsedTokens !== void 0;
16371
16605
  const hasContextWindow = value.contextWindowTokens !== void 0;
16372
16606
  if (hasContextUsed !== hasContextWindow) {
@@ -16381,8 +16615,43 @@ function parseHostUsage(value) {
16381
16615
  if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
16382
16616
  throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
16383
16617
  }
16618
+ if (value.costSource !== void 0) {
16619
+ if (value.costSource !== "publicPrice" && value.costSource !== "native") {
16620
+ throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
16621
+ }
16622
+ if (value.totalCostUsd === void 0) {
16623
+ throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
16624
+ }
16625
+ }
16626
+ if (value.unpricedModels !== void 0) {
16627
+ const models = value.unpricedModels;
16628
+ if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
16629
+ throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
16630
+ }
16631
+ if (value.costSource !== "publicPrice") {
16632
+ throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
16633
+ }
16634
+ return { ...value, unpricedModels: [...models] };
16635
+ }
16384
16636
  return { ...value };
16385
16637
  }
16638
+ var requestTokenFields = [
16639
+ "inputTokens",
16640
+ "cachedInputTokens",
16641
+ "cacheWriteInputTokens",
16642
+ "cacheWrite1hInputTokens",
16643
+ "outputTokens",
16644
+ "reasoningOutputTokens",
16645
+ "startedAtMs",
16646
+ "completedAtMs"
16647
+ ];
16648
+ var requestFields = /* @__PURE__ */ new Set([
16649
+ ...requestTokenFields,
16650
+ "requestId",
16651
+ "historical",
16652
+ "model",
16653
+ "provider"
16654
+ ]);
16386
16655
 
16387
16656
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
16388
16657
  var AGENT_METHODS = {
@@ -18667,9 +18936,9 @@ var Connection = class {
18667
18936
  return;
18668
18937
  }
18669
18938
  const responseBatch = isResponseBatch(batch);
18670
- const responseCount = responseBatch ? 0 : batch.reduce((count, message) => count + (isNotificationMessage(message) ? 0 : 1), 0);
18939
+ const responseCount = responseBatch ? 0 : batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 0 : 1), 0);
18671
18940
  let remaining = responseCount;
18672
- let remainingNotifications = batch.reduce((count, message) => count + (isNotificationMessage(message) ? 1 : 0), 0);
18941
+ let remainingNotifications = batch.reduce((count2, message) => count2 + (isNotificationMessage(message) ? 1 : 0), 0);
18673
18942
  let responseSent = false;
18674
18943
  const responses = [];
18675
18944
  const sendResponsesIfReady = async () => {
@@ -21653,6 +21922,33 @@ function splitLines(text) {
21653
21922
  }
21654
21923
 
21655
21924
  // ../../../node_modules/smol-toml/dist/date.js
21925
+ /*!
21926
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
21927
+ * SPDX-License-Identifier: BSD-3-Clause
21928
+ *
21929
+ * Redistribution and use in source and binary forms, with or without
21930
+ * modification, are permitted provided that the following conditions are met:
21931
+ *
21932
+ * 1. Redistributions of source code must retain the above copyright notice, this
21933
+ * list of conditions and the following disclaimer.
21934
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
21935
+ * this list of conditions and the following disclaimer in the
21936
+ * documentation and/or other materials provided with the distribution.
21937
+ * 3. Neither the name of the copyright holder nor the names of its contributors
21938
+ * may be used to endorse or promote products derived from this software without
21939
+ * specific prior written permission.
21940
+ *
21941
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21942
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21943
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21944
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21945
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21946
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21947
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21948
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21949
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21950
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21951
+ */
21656
21952
  var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
21657
21953
  var TomlDate = class _TomlDate extends Date {
21658
21954
  #hasDate = false;
@@ -21745,6 +22041,33 @@ var TomlDate = class _TomlDate extends Date {
21745
22041
  };
21746
22042
 
21747
22043
  // ../../../node_modules/smol-toml/dist/error.js
22044
+ /*!
22045
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22046
+ * SPDX-License-Identifier: BSD-3-Clause
22047
+ *
22048
+ * Redistribution and use in source and binary forms, with or without
22049
+ * modification, are permitted provided that the following conditions are met:
22050
+ *
22051
+ * 1. Redistributions of source code must retain the above copyright notice, this
22052
+ * list of conditions and the following disclaimer.
22053
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22054
+ * this list of conditions and the following disclaimer in the
22055
+ * documentation and/or other materials provided with the distribution.
22056
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22057
+ * may be used to endorse or promote products derived from this software without
22058
+ * specific prior written permission.
22059
+ *
22060
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22061
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22062
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22063
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22064
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22065
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22066
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22067
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22068
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22069
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22070
+ */
21748
22071
  function getLineColFromPtr(string4, ptr) {
21749
22072
  let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
21750
22073
  return [lines.length, lines.pop().length + 1];
@@ -21785,6 +22108,33 @@ ${codeblock}`, options);
21785
22108
  };
21786
22109
 
21787
22110
  // ../../../node_modules/smol-toml/dist/util.js
22111
+ /*!
22112
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22113
+ * SPDX-License-Identifier: BSD-3-Clause
22114
+ *
22115
+ * Redistribution and use in source and binary forms, with or without
22116
+ * modification, are permitted provided that the following conditions are met:
22117
+ *
22118
+ * 1. Redistributions of source code must retain the above copyright notice, this
22119
+ * list of conditions and the following disclaimer.
22120
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22121
+ * this list of conditions and the following disclaimer in the
22122
+ * documentation and/or other materials provided with the distribution.
22123
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22124
+ * may be used to endorse or promote products derived from this software without
22125
+ * specific prior written permission.
22126
+ *
22127
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22128
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22129
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22130
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22131
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22132
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22133
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22134
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22135
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22136
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22137
+ */
21788
22138
  function indexOfNewline(str, start = 0) {
21789
22139
  let idx = str.indexOf("\n", start);
21790
22140
  if (str.charCodeAt(idx - 1) === 13)
@@ -21840,6 +22190,33 @@ function skipUntil(ctx, sep, end) {
21840
22190
  }
21841
22191
 
21842
22192
  // ../../../node_modules/smol-toml/dist/primitive.js
22193
+ /*!
22194
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22195
+ * SPDX-License-Identifier: BSD-3-Clause
22196
+ *
22197
+ * Redistribution and use in source and binary forms, with or without
22198
+ * modification, are permitted provided that the following conditions are met:
22199
+ *
22200
+ * 1. Redistributions of source code must retain the above copyright notice, this
22201
+ * list of conditions and the following disclaimer.
22202
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22203
+ * this list of conditions and the following disclaimer in the
22204
+ * documentation and/or other materials provided with the distribution.
22205
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22206
+ * may be used to endorse or promote products derived from this software without
22207
+ * specific prior written permission.
22208
+ *
22209
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22210
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22211
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22212
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22213
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22214
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22215
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22216
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22217
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22218
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22219
+ */
21843
22220
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
21844
22221
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
21845
22222
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
@@ -21996,6 +22373,33 @@ function parseValue(ctx, integersAsBigInt, end) {
21996
22373
  }
21997
22374
 
21998
22375
  // ../../../node_modules/smol-toml/dist/extract.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
+ */
21999
22403
  function extractValue(ctx, end, integersAsBigInt) {
22000
22404
  let ptr = ctx.p;
22001
22405
  let c = ctx.s.charCodeAt(ptr);
@@ -22029,6 +22433,33 @@ function extractValue(ctx, end, integersAsBigInt) {
22029
22433
  }
22030
22434
 
22031
22435
  // ../../../node_modules/smol-toml/dist/struct.js
22436
+ /*!
22437
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22438
+ * SPDX-License-Identifier: BSD-3-Clause
22439
+ *
22440
+ * Redistribution and use in source and binary forms, with or without
22441
+ * modification, are permitted provided that the following conditions are met:
22442
+ *
22443
+ * 1. Redistributions of source code must retain the above copyright notice, this
22444
+ * list of conditions and the following disclaimer.
22445
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22446
+ * this list of conditions and the following disclaimer in the
22447
+ * documentation and/or other materials provided with the distribution.
22448
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22449
+ * may be used to endorse or promote products derived from this software without
22450
+ * specific prior written permission.
22451
+ *
22452
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22453
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22454
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22455
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22456
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22457
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22458
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22459
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22460
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22461
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22462
+ */
22032
22463
  var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
22033
22464
  function parseKey(ctx, end = "=") {
22034
22465
  let start = ctx.p;
@@ -22171,6 +22602,33 @@ function parseArray(ctx, integersAsBigInt) {
22171
22602
  }
22172
22603
 
22173
22604
  // ../../../node_modules/smol-toml/dist/parse.js
22605
+ /*!
22606
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22607
+ * SPDX-License-Identifier: BSD-3-Clause
22608
+ *
22609
+ * Redistribution and use in source and binary forms, with or without
22610
+ * modification, are permitted provided that the following conditions are met:
22611
+ *
22612
+ * 1. Redistributions of source code must retain the above copyright notice, this
22613
+ * list of conditions and the following disclaimer.
22614
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22615
+ * this list of conditions and the following disclaimer in the
22616
+ * documentation and/or other materials provided with the distribution.
22617
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22618
+ * may be used to endorse or promote products derived from this software without
22619
+ * specific prior written permission.
22620
+ *
22621
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22622
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22623
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22624
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22625
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22626
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22627
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22628
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22629
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22630
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22631
+ */
22174
22632
  function peekTable(key, table, meta3, type) {
22175
22633
  let t = table;
22176
22634
  let m = meta3;
@@ -22297,6 +22755,64 @@ function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
22297
22755
  return res;
22298
22756
  }
22299
22757
 
22758
+ // ../../../node_modules/smol-toml/dist/stringify.js
22759
+ /*!
22760
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22761
+ * SPDX-License-Identifier: BSD-3-Clause
22762
+ *
22763
+ * Redistribution and use in source and binary forms, with or without
22764
+ * modification, are permitted provided that the following conditions are met:
22765
+ *
22766
+ * 1. Redistributions of source code must retain the above copyright notice, this
22767
+ * list of conditions and the following disclaimer.
22768
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22769
+ * this list of conditions and the following disclaimer in the
22770
+ * documentation and/or other materials provided with the distribution.
22771
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22772
+ * may be used to endorse or promote products derived from this software without
22773
+ * specific prior written permission.
22774
+ *
22775
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22776
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22777
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22778
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22779
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22780
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22781
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22782
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22783
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22784
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22785
+ */
22786
+
22787
+ // ../../../node_modules/smol-toml/dist/index.js
22788
+ /*!
22789
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
22790
+ * SPDX-License-Identifier: BSD-3-Clause
22791
+ *
22792
+ * Redistribution and use in source and binary forms, with or without
22793
+ * modification, are permitted provided that the following conditions are met:
22794
+ *
22795
+ * 1. Redistributions of source code must retain the above copyright notice, this
22796
+ * list of conditions and the following disclaimer.
22797
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
22798
+ * this list of conditions and the following disclaimer in the
22799
+ * documentation and/or other materials provided with the distribution.
22800
+ * 3. Neither the name of the copyright holder nor the names of its contributors
22801
+ * may be used to endorse or promote products derived from this software without
22802
+ * specific prior written permission.
22803
+ *
22804
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22805
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22806
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22807
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22808
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22809
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22810
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22811
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22812
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22813
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22814
+ */
22815
+
22300
22816
  // dist/models.js
22301
22817
  var KIMI_MODEL_PREFIX = "kimi.";
22302
22818
  function encodeKimiModelRef(alias) {
@@ -24143,7 +24659,7 @@ var KimiSession = class {
24143
24659
  }
24144
24660
  });
24145
24661
  };
24146
- const completeAgentMessage = (phase) => {
24662
+ const completeAgentMessage = (phase, outcome = { status: "succeeded" }) => {
24147
24663
  if (currentAgentMessage) {
24148
24664
  const resolvedPhase = phase ?? currentAgentMessage.phase;
24149
24665
  const item = {
@@ -24152,10 +24668,23 @@ var KimiSession = class {
24152
24668
  text: currentAgentMessage.text,
24153
24669
  ...resolvedPhase ? { phase: resolvedPhase } : {}
24154
24670
  };
24155
- completeItem({ item, outcome: { status: "succeeded" } });
24671
+ completeItem({ item, outcome });
24156
24672
  currentAgentMessage = null;
24157
24673
  }
24158
24674
  };
24675
+ const completeFinalMessage = (outcome) => {
24676
+ completeAgentMessage(outcome.status !== "succeeded" ? "commentary" : hasHadToolCallsInTurn ? "final_answer" : void 0, outcome);
24677
+ };
24678
+ const getActiveTool = (event) => {
24679
+ const existing = accumulator.get(event.toolCallId);
24680
+ if (existing) {
24681
+ return existing.status === "completed" || existing.status === "failed" ? void 0 : existing;
24682
+ }
24683
+ hasHadToolCallsInTurn = true;
24684
+ completeReasoning();
24685
+ completeAgentMessage("commentary");
24686
+ return accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24687
+ };
24159
24688
  const handler = {
24160
24689
  onEvent: (event) => {
24161
24690
  if (this.#closed || this.#faulted || this.#activeTurn?.turnId !== turnId)
@@ -24177,12 +24706,9 @@ var KimiSession = class {
24177
24706
  break;
24178
24707
  }
24179
24708
  case "tool.call": {
24180
- hasHadToolCallsInTurn = true;
24181
- completeReasoning();
24182
- if (currentAgentMessage) {
24183
- completeAgentMessage("commentary");
24184
- }
24185
- const state = accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24709
+ const state = getActiveTool(event);
24710
+ if (!state)
24711
+ break;
24186
24712
  state.name = canonicalizeKimiToolName(event.name, event.kind, event.args);
24187
24713
  if (event.kind)
24188
24714
  state.kind = event.kind;
@@ -24199,11 +24725,9 @@ var KimiSession = class {
24199
24725
  break;
24200
24726
  }
24201
24727
  case "tool.update": {
24202
- completeReasoning();
24203
- if (currentAgentMessage) {
24204
- completeAgentMessage("commentary");
24205
- }
24206
- const state = accumulator.getOrCreate(event.toolCallId, turnId, event.name, event.kind);
24728
+ const state = getActiveTool(event);
24729
+ if (!state)
24730
+ break;
24207
24731
  if (state.name === "Tool" && event.name) {
24208
24732
  state.name = canonicalizeKimiToolName(event.name, event.kind ?? state.kind, event.rawInput ?? state.rawInput);
24209
24733
  }
@@ -24359,13 +24883,13 @@ var KimiSession = class {
24359
24883
  completeReasoning();
24360
24884
  if (isCommandTurn)
24361
24885
  appendAgentText(formatKimiCommandOutput(commandOutput));
24362
- completeAgentMessage(hasHadToolCallsInTurn ? "final_answer" : void 0);
24363
24886
  let currentNativeTurn = null;
24364
24887
  if (isCommandTurn) {
24365
24888
  const outcome = promptError ? {
24366
24889
  status: "failed",
24367
24890
  error: { code: "nativeFailure", message: promptError.message, retryable: false }
24368
24891
  } : promptResponse?.stopReason === "cancelled" ? { status: "cancelled", reason: "Native command cancelled" } : { status: "succeeded" };
24892
+ completeFinalMessage(outcome);
24369
24893
  const commandTurn = {
24370
24894
  nativeTurnRef: createKimiNativeTurnRef(this.#sessionId, `command:${turnId}`),
24371
24895
  input: command.input,
@@ -24456,6 +24980,8 @@ var KimiSession = class {
24456
24980
  status: "succeeded"
24457
24981
  };
24458
24982
  }
24983
+ if (!isCommandTurn)
24984
+ completeFinalMessage(turnOutcome);
24459
24985
  const completedOutcome = currentNativeTurn?.checkpoint ? { ...turnOutcome, checkpoint: currentNativeTurn.checkpoint } : turnOutcome;
24460
24986
  return {
24461
24987
  kind: "event",