@code-yeongyu/senpi 2026.8.22 → 2026.8.23

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 (83) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/bun-runtime.d.ts +58 -0
  3. package/dist/bun-runtime.d.ts.map +1 -0
  4. package/dist/bun-runtime.js +163 -0
  5. package/dist/bun-runtime.js.map +1 -0
  6. package/dist/cli.js +45 -2
  7. package/dist/cli.js.map +1 -1
  8. package/dist/core/agent-session.d.ts +7 -2
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +81 -26
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/agent-settled-delivery.d.ts +13 -1
  13. package/dist/core/agent-settled-delivery.d.ts.map +1 -1
  14. package/dist/core/agent-settled-delivery.js +33 -2
  15. package/dist/core/agent-settled-delivery.js.map +1 -1
  16. package/dist/core/extensions/builtin/goal/cache-warm-renderer.d.ts.map +1 -1
  17. package/dist/core/extensions/builtin/goal/cache-warm-renderer.js +2 -3
  18. package/dist/core/extensions/builtin/goal/cache-warm-renderer.js.map +1 -1
  19. package/dist/core/extensions/builtin/goal/cache-warm.d.ts +6 -0
  20. package/dist/core/extensions/builtin/goal/cache-warm.d.ts.map +1 -1
  21. package/dist/core/extensions/builtin/goal/cache-warm.js +43 -0
  22. package/dist/core/extensions/builtin/goal/cache-warm.js.map +1 -1
  23. package/dist/core/model-config-schema.d.ts +12 -12
  24. package/dist/core/model-config-schema.js +2 -2
  25. package/dist/core/model-config-schema.js.map +1 -1
  26. package/dist/core/model-resolver.js +2 -2
  27. package/dist/core/model-resolver.js.map +1 -1
  28. package/dist/core/session-work-barrier.d.ts.map +1 -1
  29. package/dist/core/session-work-barrier.js +38 -1
  30. package/dist/core/session-work-barrier.js.map +1 -1
  31. package/dist/modes/interactive/components/status-indicator.d.ts +3 -0
  32. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  33. package/dist/modes/interactive/components/status-indicator.js +7 -1
  34. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  35. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  36. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  37. package/dist/modes/interactive/interactive-mode.js +39 -7
  38. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  39. package/dist/senpi +45 -2
  40. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +32 -0
  41. package/node_modules/@code-yeongyu/senpi-codemode/README.md +5 -0
  42. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  43. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-notifier.ts +16 -4
  44. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/runtime-factory.ts +4 -1
  45. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/runtime-info.ts +41 -0
  46. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +9 -3
  47. package/node_modules/@code-yeongyu/senpi-codemode/src/interpreters/detect.ts +17 -4
  48. package/node_modules/@code-yeongyu/senpi-codemode/src/interpreters/resolve-command.ts +68 -0
  49. package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/idle-timeout.ts +33 -4
  50. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +5 -1
  51. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +3 -0
  52. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +2 -0
  53. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +60 -3
  54. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/runtime-label.ts +49 -0
  55. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +13 -0
  56. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  57. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +5 -1
  58. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
  59. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +13 -5
  60. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
  61. package/node_modules/@earendil-works/pi-ai/dist/cursor/composer-prompt.d.ts +27 -0
  62. package/node_modules/@earendil-works/pi-ai/dist/cursor/composer-prompt.d.ts.map +1 -0
  63. package/node_modules/@earendil-works/pi-ai/dist/cursor/composer-prompt.js +54 -0
  64. package/node_modules/@earendil-works/pi-ai/dist/cursor/composer-prompt.js.map +1 -0
  65. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  66. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  67. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  68. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  69. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/markers.d.ts +4 -0
  70. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/markers.d.ts.map +1 -1
  71. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/markers.js +14 -0
  72. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/markers.js.map +1 -1
  73. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/recovery-stream.d.ts.map +1 -1
  74. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/recovery-stream.js +65 -35
  75. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/recovery-stream.js.map +1 -1
  76. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/thinking-recovery.d.ts.map +1 -1
  77. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/thinking-recovery.js +40 -12
  78. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/kimi-xtml/thinking-recovery.js.map +1 -1
  79. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  80. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  81. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  82. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  83. package/package.json +7 -7
@@ -1,9 +1,21 @@
1
+ export type DeferredTurnDisposition = "started" | "delegated" | "finished-without-start";
2
+ export declare class DeferredTurnClaim {
3
+ #private;
4
+ readonly disposition: Promise<DeferredTurnDisposition>;
5
+ constructor();
6
+ resolve(disposition: DeferredTurnDisposition): void;
7
+ }
1
8
  export type DeferredAgentSettledAction = () => void;
9
+ export interface DeferredAgentSettledBatch {
10
+ actions: DeferredAgentSettledAction[];
11
+ turnClaims: DeferredTurnClaim[];
12
+ }
2
13
  export declare class AgentSettledDelivery {
3
14
  #private;
4
15
  begin(userAbortGeneration: number): void;
5
16
  defer(action: DeferredAgentSettledAction): boolean;
6
- finish(userAbortGeneration: number): DeferredAgentSettledAction[];
17
+ deferTriggerTurn(action: (claim: DeferredTurnClaim) => void): boolean;
18
+ finish(userAbortGeneration: number): DeferredAgentSettledBatch;
7
19
  cancel(): void;
8
20
  }
9
21
  //# sourceMappingURL=agent-settled-delivery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-settled-delivery.d.ts","sourceRoot":"","sources":["../../src/core/agent-settled-delivery.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,MAAM,IAAI,CAAC;AAEpD,qBAAa,oBAAoB;;IAIhC,KAAK,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAKxC,KAAK,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO;IAMlD,MAAM,CAAC,mBAAmB,EAAE,MAAM,GAAG,0BAA0B,EAAE;IAOjE,MAAM,IAAI,IAAI;CAId"}
1
+ {"version":3,"file":"agent-settled-delivery.d.ts","sourceRoot":"","sources":["../../src/core/agent-settled-delivery.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,WAAW,GAAG,wBAAwB,CAAC;AAEzF,qBAAa,iBAAiB;;IAC7B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;;IASvD,OAAO,CAAC,WAAW,EAAE,uBAAuB,GAAG,IAAI;CAMnD;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,IAAI,CAAC;AAEpD,MAAM,WAAW,yBAAyB;IACzC,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,UAAU,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,qBAAa,oBAAoB;;IAKhC,KAAK,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAMxC,KAAK,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO;IAMlD,gBAAgB,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO;IAQrE,MAAM,CAAC,mBAAmB,EAAE,MAAM,GAAG,yBAAyB;IAW9D,MAAM,IAAI,IAAI;CAMd"}
@@ -1,9 +1,26 @@
1
+ export class DeferredTurnClaim {
2
+ #resolve;
3
+ constructor() {
4
+ this.disposition = new Promise((resolve) => {
5
+ this.#resolve = resolve;
6
+ });
7
+ }
8
+ resolve(disposition) {
9
+ const resolve = this.#resolve;
10
+ if (!resolve)
11
+ return;
12
+ this.#resolve = undefined;
13
+ resolve(disposition);
14
+ }
15
+ }
1
16
  export class AgentSettledDelivery {
2
17
  #generation;
3
18
  #actions = [];
19
+ #turnClaims = [];
4
20
  begin(userAbortGeneration) {
5
21
  this.#generation = userAbortGeneration;
6
22
  this.#actions = [];
23
+ this.#turnClaims = [];
7
24
  }
8
25
  defer(action) {
9
26
  if (this.#generation === undefined)
@@ -11,15 +28,29 @@ export class AgentSettledDelivery {
11
28
  this.#actions.push(action);
12
29
  return true;
13
30
  }
31
+ deferTriggerTurn(action) {
32
+ if (this.#generation === undefined)
33
+ return false;
34
+ const claim = new DeferredTurnClaim();
35
+ this.#turnClaims.push(claim);
36
+ this.#actions.push(() => action(claim));
37
+ return true;
38
+ }
14
39
  finish(userAbortGeneration) {
15
- const actions = this.#generation === userAbortGeneration ? this.#actions : [];
40
+ const batch = this.#generation === userAbortGeneration
41
+ ? { actions: this.#actions, turnClaims: this.#turnClaims }
42
+ : { actions: [], turnClaims: [] };
16
43
  this.#generation = undefined;
17
44
  this.#actions = [];
18
- return actions;
45
+ this.#turnClaims = [];
46
+ return batch;
19
47
  }
20
48
  cancel() {
49
+ for (const claim of this.#turnClaims)
50
+ claim.resolve("finished-without-start");
21
51
  this.#generation = undefined;
22
52
  this.#actions = [];
53
+ this.#turnClaims = [];
23
54
  }
24
55
  }
25
56
  //# sourceMappingURL=agent-settled-delivery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-settled-delivery.js","sourceRoot":"","sources":["../../src/core/agent-settled-delivery.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,oBAAoB;IAChC,WAAW,CAAqB;IAChC,QAAQ,GAAiC,EAAE,CAAC;IAE5C,KAAK,CAAC,mBAA2B;QAChC,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,MAAkC;QACvC,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,CAAC,mBAA2B;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,KAAK,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,MAAM;QACL,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpB,CAAC;CACD","sourcesContent":["export type DeferredAgentSettledAction = () => void;\n\nexport class AgentSettledDelivery {\n\t#generation: number | undefined;\n\t#actions: DeferredAgentSettledAction[] = [];\n\n\tbegin(userAbortGeneration: number): void {\n\t\tthis.#generation = userAbortGeneration;\n\t\tthis.#actions = [];\n\t}\n\n\tdefer(action: DeferredAgentSettledAction): boolean {\n\t\tif (this.#generation === undefined) return false;\n\t\tthis.#actions.push(action);\n\t\treturn true;\n\t}\n\n\tfinish(userAbortGeneration: number): DeferredAgentSettledAction[] {\n\t\tconst actions = this.#generation === userAbortGeneration ? this.#actions : [];\n\t\tthis.#generation = undefined;\n\t\tthis.#actions = [];\n\t\treturn actions;\n\t}\n\n\tcancel(): void {\n\t\tthis.#generation = undefined;\n\t\tthis.#actions = [];\n\t}\n}\n"]}
1
+ {"version":3,"file":"agent-settled-delivery.js","sourceRoot":"","sources":["../../src/core/agent-settled-delivery.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IAE7B,QAAQ,CAA+D;IAEvE;QACC,IAAI,CAAC,WAAW,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,WAAoC;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,OAAO,CAAC,WAAW,CAAC,CAAC;IACtB,CAAC;CACD;AASD,MAAM,OAAO,oBAAoB;IAChC,WAAW,CAAq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AC,WAAW;YAAE,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC9E,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["export type DeferredTurnDisposition = \"started\" | \"delegated\" | \"finished-without-start\";\n\nexport class DeferredTurnClaim {\n\treadonly disposition: Promise<DeferredTurnDisposition>;\n\t#resolve: ((disposition: DeferredTurnDisposition) => void) | undefined;\n\n\tconstructor() {\n\t\tthis.disposition = new Promise((resolve) => {\n\t\t\tthis.#resolve = resolve;\n\t\t});\n\t}\n\n\tresolve(disposition: DeferredTurnDisposition): void {\n\t\tconst resolve = this.#resolve;\n\t\tif (!resolve) return;\n\t\tthis.#resolve = undefined;\n\t\tresolve(disposition);\n\t}\n}\n\nexport type DeferredAgentSettledAction = () => void;\n\nexport interface DeferredAgentSettledBatch {\n\tactions: DeferredAgentSettledAction[];\n\tturnClaims: DeferredTurnClaim[];\n}\n\nexport class AgentSettledDelivery {\n\t#generation: number | undefined;\n\t#actions: DeferredAgentSettledAction[] = [];\n\t#turnClaims: DeferredTurnClaim[] = [];\n\n\tbegin(userAbortGeneration: number): void {\n\t\tthis.#generation = userAbortGeneration;\n\t\tthis.#actions = [];\n\t\tthis.#turnClaims = [];\n\t}\n\n\tdefer(action: DeferredAgentSettledAction): boolean {\n\t\tif (this.#generation === undefined) return false;\n\t\tthis.#actions.push(action);\n\t\treturn true;\n\t}\n\n\tdeferTriggerTurn(action: (claim: DeferredTurnClaim) => void): boolean {\n\t\tif (this.#generation === undefined) return false;\n\t\tconst claim = new DeferredTurnClaim();\n\t\tthis.#turnClaims.push(claim);\n\t\tthis.#actions.push(() => action(claim));\n\t\treturn true;\n\t}\n\n\tfinish(userAbortGeneration: number): DeferredAgentSettledBatch {\n\t\tconst batch =\n\t\t\tthis.#generation === userAbortGeneration\n\t\t\t\t? { actions: this.#actions, turnClaims: this.#turnClaims }\n\t\t\t\t: { actions: [], turnClaims: [] };\n\t\tthis.#generation = undefined;\n\t\tthis.#actions = [];\n\t\tthis.#turnClaims = [];\n\t\treturn batch;\n\t}\n\n\tcancel(): void {\n\t\tfor (const claim of this.#turnClaims) claim.resolve(\"finished-without-start\");\n\t\tthis.#generation = undefined;\n\t\tthis.#actions = [];\n\t\tthis.#turnClaims = [];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cache-warm-renderer.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAKN,KAAK,wBAAwB,EAC7B,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,wBAAwB,CAU7E,CAAC"}
1
+ {"version":3,"file":"cache-warm-renderer.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAMN,KAAK,wBAAwB,EAC7B,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,wBAAwB,CAU7E,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { noticeEntryRenderer } from "../../notice/index.js";
2
- import { formatCacheTtl, formatSavedUsd, formatWakeDuration, formatWarmTokenCount, } from "./cache-warm.js";
2
+ import { formatCacheTtl, formatSavedUsd, formatWakeDuration, formatWakeTimestamp, formatWarmTokenCount, } from "./cache-warm.js";
3
3
  export const renderGoalCacheWarmupEntry = noticeEntryRenderer((entry) => {
4
4
  const data = entry.data;
5
5
  if (data === undefined)
@@ -44,8 +44,7 @@ function whyLine(data) {
44
44
  function formatExpectedWake(dueAtMs, elapsedMs) {
45
45
  if (dueAtMs === undefined || !Number.isFinite(dueAtMs))
46
46
  return `waited ${formatWakeDuration(elapsedMs)}`;
47
- const timestamp = new Date(dueAtMs).toISOString().slice(0, 16).replace("T", " ");
48
- return `ready ${timestamp} UTC (${formatWakeDuration(elapsedMs)})`;
47
+ return `ready ${formatWakeTimestamp(dueAtMs)} (${formatWakeDuration(elapsedMs)})`;
49
48
  }
50
49
  function expandedLine(data) {
51
50
  const planned = `goal ${data.goalId} · planned delay ${formatWakeDuration(data.delayMs)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"cache-warm-renderer.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EACN,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GAEpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,0BAA0B,GAA4C,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE;IAChH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO;QACN,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;QACtB,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAClE,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC;KAChC,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,IAA8B;IAChD,MAAM,WAAW,GAChB,IAAI,CAAC,kBAAkB,KAAK,CAAC,CAA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AC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC;IACrE,MAAM,iBAAiB,GACtB,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IAC9F,IAAI,iBAAiB,EAAE,CAAC;QACvB,OAAO,GAAG,MAAM,wFAAwF,CAAC;IAC1G,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,kCAAkC,CAAC;IAC9G,MAAM,KAAK,GACV,KAAK,CAAC,iBAAiB,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,GAAG,CAAC;QACnE,CAAC,CAAC,WAAW,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B;QAC9E,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { noticeEntryRenderer } from \"../../notice/index.ts\";\nimport type { EntryRenderer } from \"../../types.ts\";\nimport {\n\tformatCacheTtl,\n\tformatSavedUsd,\n\tformatWakeDuration,\n\tformatWarmTokenCount,\n\ttype GoalCacheWarmupEntryData,\n} from \"./cache-warm.ts\";\n\nexport const renderGoalCacheWarmupEntry: EntryRenderer<GoalCacheWarmupEntryData> = noticeEntryRenderer((entry) => {\n\tconst data = entry.data;\n\tif (data === undefined) return undefined;\n\tconst warm = warmLine(data);\n\treturn {\n\t\ttitle: titleLine(data),\n\t\twhy: whyLine(data),\n\t\textra: warm === undefined ? [] : [{ text: warm, tone: \"success\" }],\n\t\texpandedLine: expandedLine(data),\n\t};\n});\n\nfunction titleLine(data: GoalCacheWarmupEntryData): string {\n\tconst wakeSources =\n\t\tdata.activeMonitorCount === 1 ? \"1 wake source on duty\" : `${data.activeMonitorCount} wake sources on duty`;\n\tconst iteration = validIteration(data.iteration);\n\tconst iterationText = iteration === undefined ? \"\" : ` · iteration ${iteration}`;\n\tswitch (data.phase) {\n\t\tcase \"scheduled\":\n\t\t\treturn `⚡ Cache-warm wait${iterationText} · ${wakeSources}`;\n\t\tcase \"resumed\":\n\t\t\treturn `⚡ Cache-warm wake${iterationText} · ${formatExpectedWake(data.dueAtMs, data.waitedMs ?? data.delayMs)} · ${wakeSources}`;\n\t}\n}\n\nfunction validIteration(value: number | undefined): number | undefined {\n\treturn typeof value === \"number\" && Number.isInteger(value) && value > 0 ? value : undefined;\n}\n\nfunction whyLine(data: GoalCacheWarmupEntryData): string {\n\tswitch (data.phase) {\n\t\tcase \"scheduled\": {\n\t\t\tconst expected = `Continuation expected ${formatExpectedWake(data.dueAtMs, data.delayMs)}`;\n\t\t\tif (data.cache?.ttlSeconds === undefined) {\n\t\t\t\treturn `${expected} - the monitor wakes the goal the moment decisive output lands.`;\n\t\t\t}\n\t\t\treturn data.delayMs < data.cache.ttlSeconds * 1000\n\t\t\t\t? `${expected} - the timed wake stays inside the ${formatCacheTtl(data.cache.ttlSeconds)} prompt-cache TTL.`\n\t\t\t\t: `${expected} - the prompt-cache TTL may elapse before the timed wake.`;\n\t\t}\n\t\tcase \"resumed\":\n\t\t\treturn \"Woke on schedule to keep pursuing the goal.\";\n\t}\n}\n\nfunction formatExpectedWake(dueAtMs: number | undefined, elapsedMs: number): string {\n\tif (dueAtMs === undefined || !Number.isFinite(dueAtMs)) return `waited ${formatWakeDuration(elapsedMs)}`;\n\tconst timestamp = new Date(dueAtMs).toISOString().slice(0, 16).replace(\"T\", \" \");\n\treturn `ready ${timestamp} UTC (${formatWakeDuration(elapsedMs)})`;\n}\n\nfunction expandedLine(data: GoalCacheWarmupEntryData): string {\n\tconst planned = `goal ${data.goalId} · planned delay ${formatWakeDuration(data.delayMs)}`;\n\tif (data.phase === \"scheduled\") return `${planned} · ${formatExpectedWake(data.dueAtMs, data.delayMs)}`;\n\treturn `${planned} · ${formatExpectedWake(data.dueAtMs, data.waitedMs ?? data.delayMs)}`;\n}\n\nfunction warmLine(data: GoalCacheWarmupEntryData): string | undefined {\n\tconst cache = data.cache;\n\tif (cache === undefined || cache.cachedTokens <= 0) return undefined;\n\tconst tokens = `~${formatWarmTokenCount(cache.cachedTokens)} tokens`;\n\tconst ttlMayHaveElapsed =\n\t\tcache.ttlSeconds !== undefined && (data.waitedMs ?? data.delayMs) >= cache.ttlSeconds * 1000;\n\tif (ttlMayHaveElapsed) {\n\t\treturn `${tokens} were cached after the prior turn · prompt-cache TTL may have elapsed before this wake`;\n\t}\n\tconst body = data.phase === \"scheduled\" ? `${tokens} kept warm` : `${tokens} stayed warm in the prompt cache`;\n\tconst saved =\n\t\tcache.estimatedSavedUsd !== undefined && cache.estimatedSavedUsd > 0\n\t\t\t? ` · est. ${formatSavedUsd(cache.estimatedSavedUsd)} saved vs a cold re-read`\n\t\t\t: \"\";\n\treturn `${body}${saved}`;\n}\n"]}
1
+ {"version":3,"file":"cache-warm-renderer.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EACN,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GAEpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,0BAA0B,GAA4C,mBAAmB,CAAC,CAAC,KAAK,EAAE,EAAE;IAChH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO;QACN,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;QACtB,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,EAAE,IA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,CAAC,KAAK,CAAC;IACzB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACrE,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC;IACrE,MAAM,iBAAiB,GACtB,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IAC9F,IAAI,iBAAiB,EAAE,CAAC;QACvB,OAAO,GAAG,MAAM,wFAAwF,CAAC;IAC1G,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,kCAAkC,CAAC;IAC9G,MAAM,KAAK,GACV,KAAK,CAAC,iBAAiB,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,GAAG,CAAC;QACnE,CAAC,CAAC,WAAW,cAAc,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B;QAC9E,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import { noticeEntryRenderer } from \"../../notice/index.ts\";\nimport type { EntryRenderer } from \"../../types.ts\";\nimport {\n\tformatCacheTtl,\n\tformatSavedUsd,\n\tformatWakeDuration,\n\tformatWakeTimestamp,\n\tformatWarmTokenCount,\n\ttype GoalCacheWarmupEntryData,\n} from \"./cache-warm.ts\";\n\nexport const renderGoalCacheWarmupEntry: EntryRenderer<GoalCacheWarmupEntryData> = noticeEntryRenderer((entry) => {\n\tconst data = entry.data;\n\tif (data === undefined) return undefined;\n\tconst warm = warmLine(data);\n\treturn {\n\t\ttitle: titleLine(data),\n\t\twhy: whyLine(data),\n\t\textra: warm === undefined ? [] : [{ text: warm, tone: \"success\" }],\n\t\texpandedLine: expandedLine(data),\n\t};\n});\n\nfunction titleLine(data: GoalCacheWarmupEntryData): string {\n\tconst wakeSources =\n\t\tdata.activeMonitorCount === 1 ? \"1 wake source on duty\" : `${data.activeMonitorCount} wake sources on duty`;\n\tconst iteration = validIteration(data.iteration);\n\tconst iterationText = iteration === undefined ? \"\" : ` · iteration ${iteration}`;\n\tswitch (data.phase) {\n\t\tcase \"scheduled\":\n\t\t\treturn `⚡ Cache-warm wait${iterationText} · ${wakeSources}`;\n\t\tcase \"resumed\":\n\t\t\treturn `⚡ Cache-warm wake${iterationText} · ${formatExpectedWake(data.dueAtMs, data.waitedMs ?? data.delayMs)} · ${wakeSources}`;\n\t}\n}\n\nfunction validIteration(value: number | undefined): number | undefined {\n\treturn typeof value === \"number\" && Number.isInteger(value) && value > 0 ? value : undefined;\n}\n\nfunction whyLine(data: GoalCacheWarmupEntryData): string {\n\tswitch (data.phase) {\n\t\tcase \"scheduled\": {\n\t\t\tconst expected = `Continuation expected ${formatExpectedWake(data.dueAtMs, data.delayMs)}`;\n\t\t\tif (data.cache?.ttlSeconds === undefined) {\n\t\t\t\treturn `${expected} - the monitor wakes the goal the moment decisive output lands.`;\n\t\t\t}\n\t\t\treturn data.delayMs < data.cache.ttlSeconds * 1000\n\t\t\t\t? `${expected} - the timed wake stays inside the ${formatCacheTtl(data.cache.ttlSeconds)} prompt-cache TTL.`\n\t\t\t\t: `${expected} - the prompt-cache TTL may elapse before the timed wake.`;\n\t\t}\n\t\tcase \"resumed\":\n\t\t\treturn \"Woke on schedule to keep pursuing the goal.\";\n\t}\n}\n\nfunction formatExpectedWake(dueAtMs: number | undefined, elapsedMs: number): string {\n\tif (dueAtMs === undefined || !Number.isFinite(dueAtMs)) return `waited ${formatWakeDuration(elapsedMs)}`;\n\treturn `ready ${formatWakeTimestamp(dueAtMs)} (${formatWakeDuration(elapsedMs)})`;\n}\n\nfunction expandedLine(data: GoalCacheWarmupEntryData): string {\n\tconst planned = `goal ${data.goalId} · planned delay ${formatWakeDuration(data.delayMs)}`;\n\tif (data.phase === \"scheduled\") return `${planned} · ${formatExpectedWake(data.dueAtMs, data.delayMs)}`;\n\treturn `${planned} · ${formatExpectedWake(data.dueAtMs, data.waitedMs ?? data.delayMs)}`;\n}\n\nfunction warmLine(data: GoalCacheWarmupEntryData): string | undefined {\n\tconst cache = data.cache;\n\tif (cache === undefined || cache.cachedTokens <= 0) return undefined;\n\tconst tokens = `~${formatWarmTokenCount(cache.cachedTokens)} tokens`;\n\tconst ttlMayHaveElapsed =\n\t\tcache.ttlSeconds !== undefined && (data.waitedMs ?? data.delayMs) >= cache.ttlSeconds * 1000;\n\tif (ttlMayHaveElapsed) {\n\t\treturn `${tokens} were cached after the prior turn · prompt-cache TTL may have elapsed before this wake`;\n\t}\n\tconst body = data.phase === \"scheduled\" ? `${tokens} kept warm` : `${tokens} stayed warm in the prompt cache`;\n\tconst saved =\n\t\tcache.estimatedSavedUsd !== undefined && cache.estimatedSavedUsd > 0\n\t\t\t? ` · est. ${formatSavedUsd(cache.estimatedSavedUsd)} saved vs a cold re-read`\n\t\t\t: \"\";\n\treturn `${body}${saved}`;\n}\n"]}
@@ -53,6 +53,12 @@ export declare function createGoalCacheWarmScheduleData(options: {
53
53
  export declare function estimateCacheWarmMetrics(model: Model<Api> | undefined, env: NodeJS.ProcessEnv, lastTurnUsage: Pick<TokenUsageSnapshot, "cacheRead" | "cacheWrite"> | undefined): GoalCacheWarmMetrics | undefined;
54
54
  export declare function formatWarmTokenCount(tokens: number): string;
55
55
  export declare function formatWakeDuration(ms: number): string;
56
+ /**
57
+ * Wake timestamp shown in cache-warm notices. Rendered in the user's local
58
+ * system timezone with its short zone label (for example `GMT+9`); falls back
59
+ * to the legacy UTC shape when local timezone formatting is unavailable.
60
+ */
61
+ export declare function formatWakeTimestamp(dueAtMs: number): string;
56
62
  export declare function formatCacheTtl(seconds: number): string;
57
63
  export declare function formatSavedUsd(value: number): string;
58
64
  //# sourceMappingURL=cache-warm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-warm.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAe,MAAM,uBAAuB,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,sBAAsB,CAAC;AAEhE,eAAO,MAAM,2CAA2C,SAAU,CAAC;AAInE,wBAAgB,qCAAqC,CACpD,oBAAoB,EAAE,MAAM,GAAG,SAAS,EACxC,sBAAsB,CAAC,EAAE,MAAM,GAC7B,MAAM,CAeR;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACpC,mEAAmE;IACnE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,qGAAqG;IACrG,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,SAAS,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wGAAwG;IACxG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,kGAAkG;IACl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mCD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD"}
@@ -62,6 +62,49 @@ export function formatWakeDuration(ms) {
62
62
  const restMinutes = minutes % 60;
63
63
  return restMinutes === 0 ? `${hours}h` : `${hours}h ${restMinutes}m`;
64
64
  }
65
+ /**
66
+ * Wake timestamp shown in cache-warm notices. Rendered in the user's local
67
+ * system timezone with its short zone label (for example `GMT+9`); falls back
68
+ * to the legacy UTC shape when local timezone formatting is unavailable.
69
+ */
70
+ export function formatWakeTimestamp(dueAtMs) {
71
+ const date = new Date(dueAtMs);
72
+ const local = formatLocalWakeTimestamp(date);
73
+ if (local !== undefined)
74
+ return local;
75
+ return `${date.toISOString().slice(0, 16).replace("T", " ")} UTC`;
76
+ }
77
+ function formatLocalWakeTimestamp(date) {
78
+ try {
79
+ const parts = new Intl.DateTimeFormat("en-CA", {
80
+ year: "numeric",
81
+ month: "2-digit",
82
+ day: "2-digit",
83
+ hour: "2-digit",
84
+ minute: "2-digit",
85
+ hourCycle: "h23",
86
+ timeZoneName: "short",
87
+ }).formatToParts(date);
88
+ const read = (type) => parts.find((part) => part.type === type)?.value;
89
+ const year = read("year");
90
+ const month = read("month");
91
+ const day = read("day");
92
+ const hour = read("hour");
93
+ const minute = read("minute");
94
+ if (year === undefined ||
95
+ month === undefined ||
96
+ day === undefined ||
97
+ hour === undefined ||
98
+ minute === undefined) {
99
+ return undefined;
100
+ }
101
+ const zone = read("timeZoneName");
102
+ return `${year}-${month}-${day} ${hour}:${minute}${zone === undefined ? "" : ` ${zone}`}`;
103
+ }
104
+ catch {
105
+ return undefined;
106
+ }
107
+ }
65
108
  export function formatCacheTtl(seconds) {
66
109
  if (seconds % 3600 === 0)
67
110
  return `${seconds / 3600}h`;
@@ -1 +1 @@
1
- {"version":3,"file":"cache-warm.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/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GAAG,OAAO,GAAG,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa;IAC3C,IAAI,KAAK,GAAG,MAAM;QAAE,OAAO,SAAS,CAAC;IACrC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC;AAED,SAAS,WAAW,CAAC,KAAyB;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,aAAa,CAAC,GAAsB;IAC5C,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAChD,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["import type { Api, Model, ProviderEnv } from \"@earendil-works/pi-ai\";\nimport { resolvePromptCacheTtlSeconds } from \"@earendil-works/pi-ai\";\nimport type { TokenUsageSnapshot } from \"./types.ts\";\n\n/** Custom session-entry type carrying the cache-warm continuation story. */\nexport const GOAL_CACHE_WARMUP_ENTRY_TYPE = \"goal-cache-warmup\";\n\nexport const GOAL_MONITOR_CONTINUATION_FALLBACK_DELAY_MS = 240_000;\nconst GOAL_MONITOR_CONTINUATION_MIN_DELAY_MS = 1_000;\nconst GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS = 3_600_000;\n\nexport function resolveGoalMonitorContinuationDelayMs(\n\tcacheSafeWaitSeconds: number | undefined,\n\tgoalBackstopMaxSeconds?: number,\n): number {\n\tif (\n\t\ttypeof cacheSafeWaitSeconds !== \"number\" ||\n\t\t!Number.isFinite(cacheSafeWaitSeconds) ||\n\t\tcacheSafeWaitSeconds <= 0\n\t) {\n\t\treturn GOAL_MONITOR_CONTINUATION_FALLBACK_DELAY_MS;\n\t}\n\tconst configuredCeilingMs =\n\t\ttypeof goalBackstopMaxSeconds === \"number\" &&\n\t\tNumber.isFinite(goalBackstopMaxSeconds) &&\n\t\tgoalBackstopMaxSeconds > 0\n\t\t\t? Math.min(goalBackstopMaxSeconds * 1000, GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS)\n\t\t\t: GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS;\n\treturn Math.max(GOAL_MONITOR_CONTINUATION_MIN_DELAY_MS, Math.min(cacheSafeWaitSeconds * 1000, configuredCeilingMs));\n}\n\n/** Cache context captured when a monitor-wait continuation is scheduled. */\nexport interface GoalCacheWarmMetrics {\n\t/** Prompt-cache TTL of the active model in seconds, when known. */\n\treadonly ttlSeconds?: number;\n\t/** Tokens sitting warm in the provider prompt cache after the last turn. */\n\treadonly cachedTokens: number;\n\t/** Estimated USD saved by re-reading those tokens from cache instead of paying a cold input read. */\n\treadonly estimatedSavedUsd?: number;\n}\n\nexport type GoalCacheWarmupPhase = \"scheduled\" | \"resumed\";\n\n/**\n * Durable payload appended as a `goal-cache-warmup` custom entry and carried by\n * the `goal_continuation_scheduled` / `goal_continuation_resumed` pi-events, so\n * external consumers (for example omo-desktop-app) can render the story later.\n */\nexport interface GoalCacheWarmupEntryData {\n\treadonly phase: GoalCacheWarmupPhase;\n\treadonly goalId: string;\n\t/** Display ordinal within the current in-memory Goal/wake epoch; absent on legacy persisted entries. */\n\treadonly iteration?: number;\n\t/** Planned continuation delay in milliseconds. */\n\treadonly delayMs: number;\n\t/** Epoch milliseconds when the scheduled continuation is expected to resume. */\n\treadonly dueAtMs?: number;\n\t/** Actual wait in milliseconds; present on the `resumed` phase only. */\n\treadonly waitedMs?: number;\n\t/** Backward-compatible field containing the total active wake-source count. */\n\treadonly activeMonitorCount: number;\n\t/** Full source-keyed snapshot; absent on entries written before wake sources were generalized. */\n\treadonly wakeSources?: Readonly<Record<string, number>>;\n\treadonly cache?: GoalCacheWarmMetrics;\n}\n\n/** Live entries always carry an iteration; the ordinal is intentionally not persisted into Goal state. */\nexport type LiveGoalCacheWarmupEntryData = GoalCacheWarmupEntryData & { readonly iteration: number };\n\nexport type GoalCacheWarmScheduleData = Omit<LiveGoalCacheWarmupEntryData, \"phase\" | \"waitedMs\">;\n\nexport function createGoalCacheWarmScheduleData(options: {\n\treadonly goalId: string;\n\treadonly delayMs: number;\n\treadonly scheduledAtMs: number;\n\treadonly iteration: number;\n\treadonly activeMonitorCount: number;\n\treadonly wakeSources: Readonly<Record<string, number>>;\n\treadonly cache?: GoalCacheWarmMetrics;\n}): GoalCacheWarmScheduleData {\n\treturn {\n\t\tgoalId: options.goalId,\n\t\tdelayMs: options.delayMs,\n\t\tdueAtMs: options.scheduledAtMs + options.delayMs,\n\t\titeration: options.iteration,\n\t\tactiveMonitorCount: options.activeMonitorCount,\n\t\twakeSources: options.wakeSources,\n\t\t...(options.cache !== undefined ? { cache: options.cache } : {}),\n\t};\n}\n\nconst TOKENS_PER_PRICE_UNIT = 1_000_000;\n\nexport function estimateCacheWarmMetrics(\n\tmodel: Model<Api> | undefined,\n\tenv: NodeJS.ProcessEnv,\n\tlastTurnUsage: Pick<TokenUsageSnapshot, \"cacheRead\" | \"cacheWrite\"> | undefined,\n): GoalCacheWarmMetrics | undefined {\n\tconst cachedTokens = clampTokens(lastTurnUsage?.cacheRead) + clampTokens(lastTurnUsage?.cacheWrite);\n\tconst ttlSeconds = model === undefined ? undefined : resolvePromptCacheTtlSeconds(model, toProviderEnv(env));\n\tif (ttlSeconds === undefined && cachedTokens === 0) return undefined;\n\tconst estimatedSavedUsd =\n\t\tmodel !== undefined && cachedTokens > 0\n\t\t\t? (Math.max(0, model.cost.input - model.cost.cacheRead) * cachedTokens) / TOKENS_PER_PRICE_UNIT\n\t\t\t: undefined;\n\treturn {\n\t\tcachedTokens,\n\t\t...(ttlSeconds !== undefined ? { ttlSeconds } : {}),\n\t\t...(estimatedSavedUsd !== undefined ? { estimatedSavedUsd } : {}),\n\t};\n}\n\nexport function formatWarmTokenCount(tokens: number): string {\n\tif (tokens >= 1_000_000) return `${trimTrailingZero((tokens / 1_000_000).toFixed(1))}M`;\n\tif (tokens >= 1000) return `${trimTrailingZero((tokens / 1000).toFixed(1))}K`;\n\treturn String(Math.max(0, Math.trunc(tokens)));\n}\n\nexport function formatWakeDuration(ms: number): string {\n\tconst seconds = Math.round(ms / 1000);\n\tif (seconds < 60) return `${seconds}s`;\n\tconst minutes = Math.floor(seconds / 60);\n\tconst restSeconds = seconds % 60;\n\tif (minutes < 60) return restSeconds === 0 ? `${minutes}m` : `${minutes}m ${restSeconds}s`;\n\tconst hours = Math.floor(minutes / 60);\n\tconst restMinutes = minutes % 60;\n\treturn restMinutes === 0 ? `${hours}h` : `${hours}h ${restMinutes}m`;\n}\n\nexport function formatCacheTtl(seconds: number): string {\n\tif (seconds % 3600 === 0) return `${seconds / 3600}h`;\n\tif (seconds % 60 === 0) return `${seconds / 60}m`;\n\treturn `${seconds}s`;\n}\n\nexport function formatSavedUsd(value: number): string {\n\tif (value < 0.0005) return \"<$0.001\";\n\tif (value < 1) return `$${value.toFixed(3)}`;\n\treturn `$${value.toFixed(2)}`;\n}\n\nfunction trimTrailingZero(value: string): string {\n\treturn value.endsWith(\".0\") ? value.slice(0, -2) : value;\n}\n\nfunction clampTokens(value: number | undefined): number {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0;\n}\n\nfunction toProviderEnv(env: NodeJS.ProcessEnv): ProviderEnv {\n\tconst resolved: Record<string, string> = {};\n\tfor (const [key, value] of Object.entries(env)) {\n\t\tif (value !== undefined) resolved[key] = value;\n\t}\n\treturn resolved;\n}\n"]}
1
+ {"version":3,"file":"cache-warm.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/cache-warm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAGrE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAEhE,MAAM,CAAC,MAAM,2CAA2C,GAAG,OAAO,CAAC;AACnE,MAAM,sCAAsC,GAAG,KAAK,CAAC;AACrD,MAAM,yCAAyC,GAAG,SAAS,CAAC;AAE5D,MAAM,UAAU,qCAAqC,CACpD,oBAAwC,EACxC,sBAA+B;IAE/B,IACC,OAAO,oBAAoB,KAAK,QAAQ;QACxC,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACtC,oBAAoB,IAAI,CAAC,EACxB,CAAC;QACF,OAAO,2CAA2C,CAAC;IACpD,CAAC;IACD,MAAM,mBAAmB,GACxB,OAAO,sBAAsB,KAAK,QAAQ;QAC1C,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACvC,sBAAsB,GAAG,CAAC;QACzB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,GAAG,IAAI,EAAE,yCAAyC,CAAC;QACpF,CAAC,CAAC,yCAAyC,CAAC;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,sCAAsC,EAAE,IAAI,CAAC,GAAG,CAAC,oBAAoB,GAAG,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;AACrH,CAAC;AA0CD,MAAM,UAAU,+BAA+B,CAAC,OAQ/C;I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O,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,aAAa,CAAC,GAAsB;IAC5C,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,KAAK,SAAS;YAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAChD,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["import type { Api, Model, ProviderEnv } from \"@earendil-works/pi-ai\";\nimport { resolvePromptCacheTtlSeconds } from \"@earendil-works/pi-ai\";\nimport type { TokenUsageSnapshot } from \"./types.ts\";\n\n/** Custom session-entry type carrying the cache-warm continuation story. */\nexport const GOAL_CACHE_WARMUP_ENTRY_TYPE = \"goal-cache-warmup\";\n\nexport const GOAL_MONITOR_CONTINUATION_FALLBACK_DELAY_MS = 240_000;\nconst GOAL_MONITOR_CONTINUATION_MIN_DELAY_MS = 1_000;\nconst GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS = 3_600_000;\n\nexport function resolveGoalMonitorContinuationDelayMs(\n\tcacheSafeWaitSeconds: number | undefined,\n\tgoalBackstopMaxSeconds?: number,\n): number {\n\tif (\n\t\ttypeof cacheSafeWaitSeconds !== \"number\" ||\n\t\t!Number.isFinite(cacheSafeWaitSeconds) ||\n\t\tcacheSafeWaitSeconds <= 0\n\t) {\n\t\treturn GOAL_MONITOR_CONTINUATION_FALLBACK_DELAY_MS;\n\t}\n\tconst configuredCeilingMs =\n\t\ttypeof goalBackstopMaxSeconds === \"number\" &&\n\t\tNumber.isFinite(goalBackstopMaxSeconds) &&\n\t\tgoalBackstopMaxSeconds > 0\n\t\t\t? Math.min(goalBackstopMaxSeconds * 1000, GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS)\n\t\t\t: GOAL_MONITOR_CONTINUATION_HARD_CEILING_MS;\n\treturn Math.max(GOAL_MONITOR_CONTINUATION_MIN_DELAY_MS, Math.min(cacheSafeWaitSeconds * 1000, configuredCeilingMs));\n}\n\n/** Cache context captured when a monitor-wait continuation is scheduled. */\nexport interface GoalCacheWarmMetrics {\n\t/** Prompt-cache TTL of the active model in seconds, when known. */\n\treadonly ttlSeconds?: number;\n\t/** Tokens sitting warm in the provider prompt cache after the last turn. */\n\treadonly cachedTokens: number;\n\t/** Estimated USD saved by re-reading those tokens from cache instead of paying a cold input read. */\n\treadonly estimatedSavedUsd?: number;\n}\n\nexport type GoalCacheWarmupPhase = \"scheduled\" | \"resumed\";\n\n/**\n * Durable payload appended as a `goal-cache-warmup` custom entry and carried by\n * the `goal_continuation_scheduled` / `goal_continuation_resumed` pi-events, so\n * external consumers (for example omo-desktop-app) can render the story later.\n */\nexport interface GoalCacheWarmupEntryData {\n\treadonly phase: GoalCacheWarmupPhase;\n\treadonly goalId: string;\n\t/** Display ordinal within the current in-memory Goal/wake epoch; absent on legacy persisted entries. */\n\treadonly iteration?: number;\n\t/** Planned continuation delay in milliseconds. */\n\treadonly delayMs: number;\n\t/** Epoch milliseconds when the scheduled continuation is expected to resume. */\n\treadonly dueAtMs?: number;\n\t/** Actual wait in milliseconds; present on the `resumed` phase only. */\n\treadonly waitedMs?: number;\n\t/** Backward-compatible field containing the total active wake-source count. */\n\treadonly activeMonitorCount: number;\n\t/** Full source-keyed snapshot; absent on entries written before wake sources were generalized. */\n\treadonly wakeSources?: Readonly<Record<string, number>>;\n\treadonly cache?: GoalCacheWarmMetrics;\n}\n\n/** Live entries always carry an iteration; the ordinal is intentionally not persisted into Goal state. */\nexport type LiveGoalCacheWarmupEntryData = GoalCacheWarmupEntryData & { readonly iteration: number };\n\nexport type GoalCacheWarmScheduleData = Omit<LiveGoalCacheWarmupEntryData, \"phase\" | \"waitedMs\">;\n\nexport function createGoalCacheWarmScheduleData(options: {\n\treadonly goalId: string;\n\treadonly delayMs: number;\n\treadonly scheduledAtMs: number;\n\treadonly iteration: number;\n\treadonly activeMonitorCount: number;\n\treadonly wakeSources: Readonly<Record<string, number>>;\n\treadonly cache?: GoalCacheWarmMetrics;\n}): GoalCacheWarmScheduleData {\n\treturn {\n\t\tgoalId: options.goalId,\n\t\tdelayMs: options.delayMs,\n\t\tdueAtMs: options.scheduledAtMs + options.delayMs,\n\t\titeration: options.iteration,\n\t\tactiveMonitorCount: options.activeMonitorCount,\n\t\twakeSources: options.wakeSources,\n\t\t...(options.cache !== undefined ? { cache: options.cache } : {}),\n\t};\n}\n\nconst TOKENS_PER_PRICE_UNIT = 1_000_000;\n\nexport function estimateCacheWarmMetrics(\n\tmodel: Model<Api> | undefined,\n\tenv: NodeJS.ProcessEnv,\n\tlastTurnUsage: Pick<TokenUsageSnapshot, \"cacheRead\" | \"cacheWrite\"> | undefined,\n): GoalCacheWarmMetrics | undefined {\n\tconst cachedTokens = clampTokens(lastTurnUsage?.cacheRead) + clampTokens(lastTurnUsage?.cacheWrite);\n\tconst ttlSeconds = model === undefined ? undefined : resolvePromptCacheTtlSeconds(model, toProviderEnv(env));\n\tif (ttlSeconds === undefined && cachedTokens === 0) return undefined;\n\tconst estimatedSavedUsd =\n\t\tmodel !== undefined && cachedTokens > 0\n\t\t\t? (Math.max(0, model.cost.input - model.cost.cacheRead) * cachedTokens) / TOKENS_PER_PRICE_UNIT\n\t\t\t: undefined;\n\treturn {\n\t\tcachedTokens,\n\t\t...(ttlSeconds !== undefined ? { ttlSeconds } : {}),\n\t\t...(estimatedSavedUsd !== undefined ? { estimatedSavedUsd } : {}),\n\t};\n}\n\nexport function formatWarmTokenCount(tokens: number): string {\n\tif (tokens >= 1_000_000) return `${trimTrailingZero((tokens / 1_000_000).toFixed(1))}M`;\n\tif (tokens >= 1000) return `${trimTrailingZero((tokens / 1000).toFixed(1))}K`;\n\treturn String(Math.max(0, Math.trunc(tokens)));\n}\n\nexport function formatWakeDuration(ms: number): string {\n\tconst seconds = Math.round(ms / 1000);\n\tif (seconds < 60) return `${seconds}s`;\n\tconst minutes = Math.floor(seconds / 60);\n\tconst restSeconds = seconds % 60;\n\tif (minutes < 60) return restSeconds === 0 ? `${minutes}m` : `${minutes}m ${restSeconds}s`;\n\tconst hours = Math.floor(minutes / 60);\n\tconst restMinutes = minutes % 60;\n\treturn restMinutes === 0 ? `${hours}h` : `${hours}h ${restMinutes}m`;\n}\n\n/**\n * Wake timestamp shown in cache-warm notices. Rendered in the user's local\n * system timezone with its short zone label (for example `GMT+9`); falls back\n * to the legacy UTC shape when local timezone formatting is unavailable.\n */\nexport function formatWakeTimestamp(dueAtMs: number): string {\n\tconst date = new Date(dueAtMs);\n\tconst local = formatLocalWakeTimestamp(date);\n\tif (local !== undefined) return local;\n\treturn `${date.toISOString().slice(0, 16).replace(\"T\", \" \")} UTC`;\n}\n\nfunction formatLocalWakeTimestamp(date: Date): string | undefined {\n\ttry {\n\t\tconst parts = new Intl.DateTimeFormat(\"en-CA\", {\n\t\t\tyear: \"numeric\",\n\t\t\tmonth: \"2-digit\",\n\t\t\tday: \"2-digit\",\n\t\t\thour: \"2-digit\",\n\t\t\tminute: \"2-digit\",\n\t\t\thourCycle: \"h23\",\n\t\t\ttimeZoneName: \"short\",\n\t\t}).formatToParts(date);\n\t\tconst read = (type: string): string | undefined => parts.find((part) => part.type === type)?.value;\n\t\tconst year = read(\"year\");\n\t\tconst month = read(\"month\");\n\t\tconst day = read(\"day\");\n\t\tconst hour = read(\"hour\");\n\t\tconst minute = read(\"minute\");\n\t\tif (\n\t\t\tyear === undefined ||\n\t\t\tmonth === undefined ||\n\t\t\tday === undefined ||\n\t\t\thour === undefined ||\n\t\t\tminute === undefined\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst zone = read(\"timeZoneName\");\n\t\treturn `${year}-${month}-${day} ${hour}:${minute}${zone === undefined ? \"\" : ` ${zone}`}`;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport function formatCacheTtl(seconds: number): string {\n\tif (seconds % 3600 === 0) return `${seconds / 3600}h`;\n\tif (seconds % 60 === 0) return `${seconds / 60}m`;\n\treturn `${seconds}s`;\n}\n\nexport function formatSavedUsd(value: number): string {\n\tif (value < 0.0005) return \"<$0.001\";\n\tif (value < 1) return `$${value.toFixed(3)}`;\n\treturn `$${value.toFixed(2)}`;\n}\n\nfunction trimTrailingZero(value: string): string {\n\treturn value.endsWith(\".0\") ? value.slice(0, -2) : value;\n}\n\nfunction clampTokens(value: number | undefined): number {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0;\n}\n\nfunction toProviderEnv(env: NodeJS.ProcessEnv): ProviderEnv {\n\tconst resolved: Record<string, string> = {};\n\tfor (const [key, value] of Object.entries(env)) {\n\t\tif (value !== undefined) resolved[key] = value;\n\t}\n\treturn resolved;\n}\n"]}
@@ -18,7 +18,7 @@ declare const ModelDefinitionSchema: Type.TObject<{
18
18
  xhigh: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
19
19
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
20
20
  }>>;
21
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
21
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
22
22
  cost: Type.TOptional<Type.TObject<{
23
23
  tiers: Type.TOptional<Type.TArray<Type.TObject<{
24
24
  input: Type.TNumber;
@@ -137,7 +137,7 @@ declare const ModelOverrideSchema: Type.TObject<{
137
137
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
138
138
  }>>;
139
139
  thinkingLevelMapMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"merge">, Type.TLiteral<"replace">]>>;
140
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
140
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
141
141
  cost: Type.TOptional<Type.TObject<{
142
142
  input: Type.TOptional<Type.TNumber>;
143
143
  output: Type.TOptional<Type.TNumber>;
@@ -357,7 +357,7 @@ declare const ProviderConfigSchema: Type.TObject<{
357
357
  xhigh: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
358
358
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
359
359
  }>>;
360
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
360
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
361
361
  cost: Type.TOptional<Type.TObject<{
362
362
  tiers: Type.TOptional<Type.TArray<Type.TObject<{
363
363
  input: Type.TNumber;
@@ -476,7 +476,7 @@ declare const ProviderConfigSchema: Type.TObject<{
476
476
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
477
477
  }>>;
478
478
  thinkingLevelMapMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"merge">, Type.TLiteral<"replace">]>>;
479
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
479
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
480
480
  cost: Type.TOptional<Type.TObject<{
481
481
  input: Type.TOptional<Type.TNumber>;
482
482
  output: Type.TOptional<Type.TNumber>;
@@ -699,7 +699,7 @@ declare const ModelsConfigSchema: Type.TObject<{
699
699
  xhigh: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
700
700
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
701
701
  }>>;
702
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
702
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
703
703
  cost: Type.TOptional<Type.TObject<{
704
704
  tiers: Type.TOptional<Type.TArray<Type.TObject<{
705
705
  input: Type.TNumber;
@@ -818,7 +818,7 @@ declare const ModelsConfigSchema: Type.TObject<{
818
818
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
819
819
  }>>;
820
820
  thinkingLevelMapMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"merge">, Type.TLiteral<"replace">]>>;
821
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
821
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
822
822
  cost: Type.TOptional<Type.TObject<{
823
823
  input: Type.TOptional<Type.TNumber>;
824
824
  output: Type.TOptional<Type.TNumber>;
@@ -1042,7 +1042,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1042
1042
  xhigh: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1043
1043
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1044
1044
  }>>;
1045
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
1045
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
1046
1046
  cost: Type.TOptional<Type.TObject<{
1047
1047
  tiers: Type.TOptional<Type.TArray<Type.TObject<{
1048
1048
  input: Type.TNumber;
@@ -1161,7 +1161,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1161
1161
  max: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
1162
1162
  }>>;
1163
1163
  thinkingLevelMapMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"merge">, Type.TLiteral<"replace">]>>;
1164
- input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">]>>>;
1164
+ input: Type.TOptional<Type.TArray<Type.TUnion<[Type.TLiteral<"text">, Type.TLiteral<"image">, Type.TLiteral<"video">]>>>;
1165
1165
  cost: Type.TOptional<Type.TObject<{
1166
1166
  input: Type.TOptional<Type.TNumber>;
1167
1167
  output: Type.TOptional<Type.TNumber>;
@@ -1368,7 +1368,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1368
1368
  models?: {
1369
1369
  name?: string | undefined;
1370
1370
  headers?: Record<string, string> | undefined;
1371
- input?: ("text" | "image")[] | undefined;
1371
+ input?: ("text" | "image" | "video")[] | undefined;
1372
1372
  upstreamModelId?: string | undefined;
1373
1373
  serviceTier?: "auto" | "flex" | "priority" | undefined;
1374
1374
  promptPreset?: string | undefined;
@@ -1491,7 +1491,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1491
1491
  modelOverrides?: Record<string, {
1492
1492
  name?: string | undefined;
1493
1493
  headers?: Record<string, string> | undefined;
1494
- input?: ("text" | "image")[] | undefined;
1494
+ input?: ("text" | "image" | "video")[] | undefined;
1495
1495
  promptPreset?: string | undefined;
1496
1496
  recoverTextToolCalls?: boolean | undefined;
1497
1497
  reasoning?: boolean | undefined;
@@ -1710,7 +1710,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1710
1710
  models?: {
1711
1711
  name?: string | undefined;
1712
1712
  headers?: Record<string, string> | undefined;
1713
- input?: ("text" | "image")[] | undefined;
1713
+ input?: ("text" | "image" | "video")[] | undefined;
1714
1714
  upstreamModelId?: string | undefined;
1715
1715
  serviceTier?: "auto" | "flex" | "priority" | undefined;
1716
1716
  promptPreset?: string | undefined;
@@ -1833,7 +1833,7 @@ export declare const validateModelsConfig: import("typebox/compile").Validator<{
1833
1833
  modelOverrides?: Record<string, {
1834
1834
  name?: string | undefined;
1835
1835
  headers?: Record<string, string> | undefined;
1836
- input?: ("text" | "image")[] | undefined;
1836
+ input?: ("text" | "image" | "video")[] | undefined;
1837
1837
  promptPreset?: string | undefined;
1838
1838
  recoverTextToolCalls?: boolean | undefined;
1839
1839
  reasoning?: boolean | undefined;
@@ -142,7 +142,7 @@ const ModelDefinitionSchema = Type.Object({
142
142
  baseUrl: Type.Optional(Type.String({ minLength: 1 })),
143
143
  reasoning: Type.Optional(Type.Boolean()),
144
144
  thinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),
145
- input: Type.Optional(Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image")]))),
145
+ input: Type.Optional(Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image"), Type.Literal("video")]))),
146
146
  cost: Type.Optional(ModelCostSchema),
147
147
  contextWindow: Type.Optional(Type.Number()),
148
148
  maxTokens: Type.Optional(Type.Number()),
@@ -158,7 +158,7 @@ const ModelOverrideSchema = Type.Object({
158
158
  reasoning: Type.Optional(Type.Boolean()),
159
159
  thinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),
160
160
  thinkingLevelMapMode: Type.Optional(Type.Union([Type.Literal("merge"), Type.Literal("replace")])),
161
- input: Type.Optional(Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image")]))),
161
+ input: Type.Optional(Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image"), Type.Literal("video")]))),
162
162
  cost: Type.Optional(Type.Object({
163
163
  input: Type.Optional(Type.Number()),
164
164
  output: Type.Optional(Type.Number()),
@@ -1 +1 @@
1
- {"version":3,"file":"model-config-schema.js","sourceRoot":"","sources":["../../src/core/model-config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,i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,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3E,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC;CAC3D,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n\tmax: Type.Optional(ThinkingLevelMapValueSchema),\n});\n\nconst ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);\nconst ChatTemplateKwargVariableSchema = Type.Object({\n\t$var: Type.Union([Type.Literal(\"thinking.enabled\"), Type.Literal(\"thinking.effort\")]),\n\tomitWhenOff: Type.Optional(Type.Boolean()),\n});\nconst ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tsupportsDisabledThinking: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"chat-template\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\tType.Literal(\"string-thinking\"),\n\t\t\tType.Literal(\"ant-ling\"),\n\t\t]),\n\t),\n\tchatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tzaiToolStream: Type.Optional(Type.Boolean()),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\ttoolCallFormat: Type.Optional(Type.String()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tdeferredToolsMode: Type.Optional(Type.Literal(\"kimi\")),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsupportsWebSocket: Type.Optional(Type.Boolean()),\n\tsupportsRemoteCompactionV2: Type.Optional(Type.Boolean()),\n\tsupportsWebSearchPreview: Type.Optional(Type.Boolean()),\n\tsupportsToolSearch: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tsupportsDisabledThinking: Type.Optional(Type.Boolean()),\n\tsupportsTemperature: Type.Optional(Type.Boolean()),\n\tsupportsToolChoice: Type.Optional(Type.Boolean()),\n\tsupportsForcedToolChoice: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n\tallowEmptySignature: Type.Optional(Type.Boolean()),\n\tsupportsToolReferences: Type.Optional(Type.Boolean()),\n\tsupportsWebSearch: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelCostRatesSchema = {\n\tinput: Type.Number(),\n\toutput: Type.Number(),\n\tcacheRead: Type.Number(),\n\tcacheWrite: Type.Number(),\n};\nconst ModelCostTierSchema = Type.Object({\n\tinputTokensAbove: Type.Number(),\n\t...ModelCostRatesSchema,\n});\nconst ModelCostSchema = Type.Object({\n\t...ModelCostRatesSchema,\n\ttiers: Type.Optional(Type.Array(ModelCostTierSchema)),\n});\nconst ExtraBodySchema = Type.Record(Type.String(), Type.Unknown());\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tupstreamModelId: Type.Optional(Type.String({ minLength: 1 })),\n\tserviceTier: Type.Optional(Type.Union([Type.Literal(\"auto\"), Type.Literal(\"flex\"), Type.Literal(\"priority\")])),\n\tpromptPreset: Type.Optional(Type.String({ minLength: 1 })),\n\trecoverTextToolCalls: Type.Optional(Type.Boolean()),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(ModelCostSchema),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tpromptPreset: Type.Optional(Type.String({ minLength: 1 })),\n\trecoverTextToolCalls: Type.Optional(Type.Boolean()),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tthinkingLevelMapMode: Type.Optional(Type.Union([Type.Literal(\"merge\"), Type.Literal(\"replace\")])),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t\ttiers: Type.Optional(Type.Array(ModelCostTierSchema)),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tdisabled: Type.Optional(Type.Boolean()),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\toauth: Type.Optional(Type.Literal(\"radius\")),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\twhitelist: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tblacklist: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tdisabledProviders: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsJsonModel = Static<typeof ModelDefinitionSchema>;\nexport type ModelsJsonModelOverride = Static<typeof ModelOverrideSchema>;\nexport type ModelsJsonProvider = Static<typeof ProviderConfigSchema>;\nexport type ModelsJson = Static<typeof ModelsConfigSchema>;\n"]}
1
+ {"version":3,"file":"model-config-schema.js","sourceRoot":"","sources":["../../src/core/model-config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,M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,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC;CAC9E,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3E,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC;CAC3D,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { Compile } from \"typebox/compile\";\n\nconst PercentileCutoffsSchema = Type.Object({\n\tp50: Type.Optional(Type.Number()),\n\tp75: Type.Optional(Type.Number()),\n\tp90: Type.Optional(Type.Number()),\n\tp99: Type.Optional(Type.Number()),\n});\n\nconst OpenRouterRoutingSchema = Type.Object({\n\tallow_fallbacks: Type.Optional(Type.Boolean()),\n\trequire_parameters: Type.Optional(Type.Boolean()),\n\tdata_collection: Type.Optional(Type.Union([Type.Literal(\"deny\"), Type.Literal(\"allow\")])),\n\tzdr: Type.Optional(Type.Boolean()),\n\tenforce_distillable_text: Type.Optional(Type.Boolean()),\n\torder: Type.Optional(Type.Array(Type.String())),\n\tonly: Type.Optional(Type.Array(Type.String())),\n\tignore: Type.Optional(Type.Array(Type.String())),\n\tquantizations: Type.Optional(Type.Array(Type.String())),\n\tsort: Type.Optional(\n\t\tType.Union([\n\t\t\tType.String(),\n\t\t\tType.Object({\n\t\t\t\tby: Type.Optional(Type.String()),\n\t\t\t\tpartition: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n\t\t\t}),\n\t\t]),\n\t),\n\tmax_price: Type.Optional(\n\t\tType.Object({\n\t\t\tprompt: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\tcompletion: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\timage: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\taudio: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t\trequest: Type.Optional(Type.Union([Type.Number(), Type.String()])),\n\t\t}),\n\t),\n\tpreferred_min_throughput: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n\tpreferred_max_latency: Type.Optional(Type.Union([Type.Number(), PercentileCutoffsSchema])),\n});\n\nconst VercelGatewayRoutingSchema = Type.Object({\n\tonly: Type.Optional(Type.Array(Type.String())),\n\torder: Type.Optional(Type.Array(Type.String())),\n});\n\nconst ThinkingLevelMapValueSchema = Type.Union([Type.String(), Type.Null()]);\nconst ThinkingLevelMapSchema = Type.Object({\n\toff: Type.Optional(ThinkingLevelMapValueSchema),\n\tminimal: Type.Optional(ThinkingLevelMapValueSchema),\n\tlow: Type.Optional(ThinkingLevelMapValueSchema),\n\tmedium: Type.Optional(ThinkingLevelMapValueSchema),\n\thigh: Type.Optional(ThinkingLevelMapValueSchema),\n\txhigh: Type.Optional(ThinkingLevelMapValueSchema),\n\tmax: Type.Optional(ThinkingLevelMapValueSchema),\n});\n\nconst ChatTemplateKwargScalarSchema = Type.Union([Type.String(), Type.Number(), Type.Boolean(), Type.Null()]);\nconst ChatTemplateKwargVariableSchema = Type.Object({\n\t$var: Type.Union([Type.Literal(\"thinking.enabled\"), Type.Literal(\"thinking.effort\")]),\n\tomitWhenOff: Type.Optional(Type.Boolean()),\n});\nconst ChatTemplateKwargSchema = Type.Union([ChatTemplateKwargScalarSchema, ChatTemplateKwargVariableSchema]);\n\nconst OpenAICompletionsCompatSchema = Type.Object({\n\tsupportsStore: Type.Optional(Type.Boolean()),\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsupportsReasoningEffort: Type.Optional(Type.Boolean()),\n\tsupportsUsageInStreaming: Type.Optional(Type.Boolean()),\n\tmaxTokensField: Type.Optional(Type.Union([Type.Literal(\"max_completion_tokens\"), Type.Literal(\"max_tokens\")])),\n\trequiresToolResultName: Type.Optional(Type.Boolean()),\n\trequiresAssistantAfterToolResult: Type.Optional(Type.Boolean()),\n\trequiresThinkingAsText: Type.Optional(Type.Boolean()),\n\trequiresReasoningContentOnAssistantMessages: Type.Optional(Type.Boolean()),\n\tsupportsDisabledThinking: Type.Optional(Type.Boolean()),\n\tthinkingFormat: Type.Optional(\n\t\tType.Union([\n\t\t\tType.Literal(\"openai\"),\n\t\t\tType.Literal(\"openrouter\"),\n\t\t\tType.Literal(\"together\"),\n\t\t\tType.Literal(\"deepseek\"),\n\t\t\tType.Literal(\"zai\"),\n\t\t\tType.Literal(\"qwen\"),\n\t\t\tType.Literal(\"chat-template\"),\n\t\t\tType.Literal(\"qwen-chat-template\"),\n\t\t\tType.Literal(\"string-thinking\"),\n\t\t\tType.Literal(\"ant-ling\"),\n\t\t]),\n\t),\n\tchatTemplateKwargs: Type.Optional(Type.Record(Type.String(), ChatTemplateKwargSchema)),\n\tcacheControlFormat: Type.Optional(Type.Literal(\"anthropic\")),\n\topenRouterRouting: Type.Optional(OpenRouterRoutingSchema),\n\tvercelGatewayRouting: Type.Optional(VercelGatewayRoutingSchema),\n\tzaiToolStream: Type.Optional(Type.Boolean()),\n\tsupportsStrictMode: Type.Optional(Type.Boolean()),\n\ttoolCallFormat: Type.Optional(Type.String()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tdeferredToolsMode: Type.Optional(Type.Literal(\"kimi\")),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n});\n\nconst OpenAIResponsesCompatSchema = Type.Object({\n\tsupportsDeveloperRole: Type.Optional(Type.Boolean()),\n\tsessionAffinityFormat: Type.Optional(\n\t\tType.Union([Type.Literal(\"openai\"), Type.Literal(\"openai-nosession\"), Type.Literal(\"openrouter\")]),\n\t),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsupportsWebSocket: Type.Optional(Type.Boolean()),\n\tsupportsRemoteCompactionV2: Type.Optional(Type.Boolean()),\n\tsupportsWebSearchPreview: Type.Optional(Type.Boolean()),\n\tsupportsToolSearch: Type.Optional(Type.Boolean()),\n});\n\nconst AnthropicMessagesCompatSchema = Type.Object({\n\tsupportsEagerToolInputStreaming: Type.Optional(Type.Boolean()),\n\tsupportsLongCacheRetention: Type.Optional(Type.Boolean()),\n\tsendSessionAffinityHeaders: Type.Optional(Type.Boolean()),\n\tsupportsCacheControlOnTools: Type.Optional(Type.Boolean()),\n\tsupportsDisabledThinking: Type.Optional(Type.Boolean()),\n\tsupportsTemperature: Type.Optional(Type.Boolean()),\n\tsupportsToolChoice: Type.Optional(Type.Boolean()),\n\tsupportsForcedToolChoice: Type.Optional(Type.Boolean()),\n\tforceAdaptiveThinking: Type.Optional(Type.Boolean()),\n\tallowEmptySignature: Type.Optional(Type.Boolean()),\n\tsupportsToolReferences: Type.Optional(Type.Boolean()),\n\tsupportsWebSearch: Type.Optional(Type.Boolean()),\n});\n\nconst ProviderCompatSchema = Type.Union([\n\tOpenAICompletionsCompatSchema,\n\tOpenAIResponsesCompatSchema,\n\tAnthropicMessagesCompatSchema,\n]);\n\nconst ModelCostRatesSchema = {\n\tinput: Type.Number(),\n\toutput: Type.Number(),\n\tcacheRead: Type.Number(),\n\tcacheWrite: Type.Number(),\n};\nconst ModelCostTierSchema = Type.Object({\n\tinputTokensAbove: Type.Number(),\n\t...ModelCostRatesSchema,\n});\nconst ModelCostSchema = Type.Object({\n\t...ModelCostRatesSchema,\n\ttiers: Type.Optional(Type.Array(ModelCostTierSchema)),\n});\nconst ExtraBodySchema = Type.Record(Type.String(), Type.Unknown());\n\nconst ModelDefinitionSchema = Type.Object({\n\tid: Type.String({ minLength: 1 }),\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tupstreamModelId: Type.Optional(Type.String({ minLength: 1 })),\n\tserviceTier: Type.Optional(Type.Union([Type.Literal(\"auto\"), Type.Literal(\"flex\"), Type.Literal(\"priority\")])),\n\tpromptPreset: Type.Optional(Type.String({ minLength: 1 })),\n\trecoverTextToolCalls: Type.Optional(Type.Boolean()),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\"), Type.Literal(\"video\")]))),\n\tcost: Type.Optional(ModelCostSchema),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ModelOverrideSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tpromptPreset: Type.Optional(Type.String({ minLength: 1 })),\n\trecoverTextToolCalls: Type.Optional(Type.Boolean()),\n\treasoning: Type.Optional(Type.Boolean()),\n\tthinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),\n\tthinkingLevelMapMode: Type.Optional(Type.Union([Type.Literal(\"merge\"), Type.Literal(\"replace\")])),\n\tinput: Type.Optional(Type.Array(Type.Union([Type.Literal(\"text\"), Type.Literal(\"image\"), Type.Literal(\"video\")]))),\n\tcost: Type.Optional(\n\t\tType.Object({\n\t\t\tinput: Type.Optional(Type.Number()),\n\t\t\toutput: Type.Optional(Type.Number()),\n\t\t\tcacheRead: Type.Optional(Type.Number()),\n\t\t\tcacheWrite: Type.Optional(Type.Number()),\n\t\t\ttiers: Type.Optional(Type.Array(ModelCostTierSchema)),\n\t\t}),\n\t),\n\tcontextWindow: Type.Optional(Type.Number()),\n\tmaxTokens: Type.Optional(Type.Number()),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n});\n\nconst ProviderConfigSchema = Type.Object({\n\tname: Type.Optional(Type.String({ minLength: 1 })),\n\tdisabled: Type.Optional(Type.Boolean()),\n\tbaseUrl: Type.Optional(Type.String({ minLength: 1 })),\n\tapiKey: Type.Optional(Type.String({ minLength: 1 })),\n\tapi: Type.Optional(Type.String({ minLength: 1 })),\n\toauth: Type.Optional(Type.Literal(\"radius\")),\n\theaders: Type.Optional(Type.Record(Type.String(), Type.String())),\n\textraBody: Type.Optional(ExtraBodySchema),\n\tcacheRetention: Type.Optional(Type.Union([Type.Literal(\"none\"), Type.Literal(\"short\"), Type.Literal(\"long\")])),\n\tcompat: Type.Optional(ProviderCompatSchema),\n\tauthHeader: Type.Optional(Type.Boolean()),\n\twhitelist: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tblacklist: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tmodels: Type.Optional(Type.Array(ModelDefinitionSchema)),\n\tmodelOverrides: Type.Optional(Type.Record(Type.String(), ModelOverrideSchema)),\n});\n\nconst ModelsConfigSchema = Type.Object({\n\tdisabledProviders: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),\n\tproviders: Type.Record(Type.String(), ProviderConfigSchema),\n});\nexport const validateModelsConfig = Compile(ModelsConfigSchema);\n\nexport type ModelsJsonModel = Static<typeof ModelDefinitionSchema>;\nexport type ModelsJsonModelOverride = Static<typeof ModelOverrideSchema>;\nexport type ModelsJsonProvider = Static<typeof ProviderConfigSchema>;\nexport type ModelsJson = Static<typeof ModelsConfigSchema>;\n"]}
@@ -11,9 +11,9 @@ export const defaultModelPerProvider = {
11
11
  "amazon-bedrock": "us.anthropic.claude-opus-4-6-v1",
12
12
  "ant-ling": "Ring-2.6-1T",
13
13
  anthropic: "claude-opus-4-8",
14
- openai: "gpt-5.5",
14
+ openai: "gpt-5.6-sol",
15
15
  "azure-openai-responses": "gpt-5.4",
16
- "openai-codex": "gpt-5.5",
16
+ "openai-codex": "gpt-5.6-sol",
17
17
  ollama: "qwen3.5:397b",
18
18
  // Cursor ships no models until its chat protocol is ported; "auto" matches
19
19
  // the Cursor agent's native model auto-selection once models exist.