@danceiny/gotry 0.0.1-rc.16 → 0.0.1-rc.17

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 (229) hide show
  1. package/README.md +47 -13
  2. package/README.zh-CN.md +20 -10
  3. package/bin/gotry-booking-copilot.js +53 -0
  4. package/bin/gotry-bootstrap.js +111 -51
  5. package/bin/gotry-inner.js +442 -60
  6. package/bin/gotry-runtime-resolution.d.ts +27 -0
  7. package/bin/gotry-runtime-resolution.js +50 -0
  8. package/bin/gotry.js +1 -1
  9. package/cordis.gotry-patch.yml +5 -1
  10. package/dist/capabilities/agent-reach-deep.js +1 -1
  11. package/dist/capabilities/agent-reach.js +1 -1
  12. package/dist/capabilities/anything.js +1 -1
  13. package/dist/capabilities/artifacts.js +1 -1
  14. package/dist/capabilities/effect.js +1 -1
  15. package/dist/capabilities/fact-log.js +1 -1
  16. package/dist/capabilities/flyai.js +20 -6
  17. package/dist/capabilities/hbcli.js +1 -1
  18. package/dist/capabilities/incident-log.js +1 -1
  19. package/dist/capabilities/model-override.js +18 -0
  20. package/dist/capabilities/opensky.js +1 -1
  21. package/dist/capabilities/resilience.js +1 -1
  22. package/dist/capabilities/session/action-cache.js +1 -1
  23. package/dist/capabilities/session/adapters/ctrip-flight.js +1 -1
  24. package/dist/capabilities/session/adapters/meituan-local.js +1 -1
  25. package/dist/capabilities/session/benchmark.js +1 -1
  26. package/dist/capabilities/session/extension-bridge.js +19 -6
  27. package/dist/capabilities/session/extension-channel.js +3 -3
  28. package/dist/capabilities/session/extension-distribution.js +234 -0
  29. package/dist/capabilities/session/extract.js +1 -1
  30. package/dist/capabilities/session/golden-score.js +92 -0
  31. package/dist/capabilities/session/health-watch.js +1 -1
  32. package/dist/capabilities/session/read-guard.js +1 -1
  33. package/dist/capabilities/session/static-flight-golden.js +137 -0
  34. package/dist/capabilities/session/transport.js +1 -1
  35. package/dist/capabilities/session/wizard.js +21 -251
  36. package/dist/capabilities/session-consent.js +1 -1
  37. package/dist/capabilities/session-login.js +11 -5
  38. package/dist/capabilities/session-search.js +46 -4
  39. package/dist/capabilities/weather.js +168 -46
  40. package/dist/data/session-golden-20.json +25 -0
  41. package/dist/data/sf-golden-manifest.json +102 -0
  42. package/dist/data/sf-static-routes.json +91 -0
  43. package/dist/scripts/action-cache-tests.js +1 -1
  44. package/dist/scripts/agent-planning-budget-e2e.js +227 -0
  45. package/dist/scripts/agent-planning-budget-tests.js +173 -0
  46. package/dist/scripts/agent-reach-deep-tests.js +1 -1
  47. package/dist/scripts/agent-reach-tests.js +1 -1
  48. package/dist/scripts/agent-reach-wrapper-tests.js +1 -1
  49. package/dist/scripts/anything-tests.js +1 -1
  50. package/dist/scripts/async-collect.js +1 -1
  51. package/dist/scripts/benchmark-environment-bridge-e2e.js +981 -0
  52. package/dist/scripts/benchmark-environment-bridge-tests.js +2544 -0
  53. package/dist/scripts/booking-copilot-availability-ledger-binding-tests.js +335 -0
  54. package/dist/scripts/booking-copilot-availability-policy-v2-tests.js +1355 -0
  55. package/dist/scripts/booking-copilot-bin-proof-tests.js +89 -0
  56. package/dist/scripts/booking-copilot-crossrepo-fixture-server.js +113 -0
  57. package/dist/scripts/booking-copilot-dsh-core-proof-tests.js +356 -0
  58. package/dist/scripts/booking-copilot-dsh-planner-proof-tests.js +557 -0
  59. package/dist/scripts/booking-copilot-dsh-plugin-proof-tests.js +140 -0
  60. package/dist/scripts/booking-copilot-event-sequence-concurrency-proof-tests.js +202 -0
  61. package/dist/scripts/booking-copilot-gap-code-contract-proof-tests.js +102 -0
  62. package/dist/scripts/booking-copilot-operation-ledger-concurrency-proof-tests.js +374 -0
  63. package/dist/scripts/booking-copilot-receipt-ledger-concurrency-proof-tests.js +447 -0
  64. package/dist/scripts/booking-copilot-runtime-proof-tests.js +205 -0
  65. package/dist/scripts/booking-copilot-server-proof-tests.js +317 -0
  66. package/dist/scripts/booking-copilot-startup-proof-tests.js +283 -0
  67. package/dist/scripts/booking-copilot-v2-runtime-proof-tests.js +3935 -0
  68. package/dist/scripts/booking-saga-tests.js +1 -1
  69. package/dist/scripts/booking-surface-contract-proof-tests.js +393 -0
  70. package/dist/scripts/booking-surface-v2-contract-proof-tests.js +1174 -0
  71. package/dist/scripts/bootstrap-tests.js +30 -10
  72. package/dist/scripts/build-changelog.js +1 -1
  73. package/dist/scripts/changelog-tests.js +1 -1
  74. package/dist/scripts/companion-tests.js +1 -1
  75. package/dist/scripts/diff-test.js +1 -1
  76. package/dist/scripts/dsh-runtime-closure-tests.js +225 -0
  77. package/dist/scripts/dsh-runtime-closure.js +150 -0
  78. package/dist/scripts/effect-tests.js +1 -1
  79. package/dist/scripts/engine-run.js +1 -1
  80. package/dist/scripts/engine-tests.js +1 -1
  81. package/dist/scripts/evaluation-cadence-tests.js +347 -0
  82. package/dist/scripts/evaluation-contract-tests.js +574 -0
  83. package/dist/scripts/extension-distribution-cli.js +35 -0
  84. package/dist/scripts/extension-distribution-tests.js +341 -0
  85. package/dist/scripts/extension-tests.js +128 -23
  86. package/dist/scripts/fact-gate-tests.js +1 -1
  87. package/dist/scripts/flyai-tests.js +1 -1
  88. package/dist/scripts/hbcli-e2e-tests.js +1 -1
  89. package/dist/scripts/hbcli-tests.js +1 -1
  90. package/dist/scripts/health-watch-cli.js +1 -1
  91. package/dist/scripts/i18n-tests.js +1 -1
  92. package/dist/scripts/incident-tests.js +1 -1
  93. package/dist/scripts/journey-tests.js +1 -1
  94. package/dist/scripts/ledger-tests.js +1 -1
  95. package/dist/scripts/ledger-workflow-crash.js +1 -1
  96. package/dist/scripts/memory-capture-tests.js +1 -1
  97. package/dist/scripts/memory-decay-tests.js +1 -1
  98. package/dist/scripts/memory-metrics.js +1 -1
  99. package/dist/scripts/memory-value-report.js +1 -1
  100. package/dist/scripts/model-override-e2e.js +176 -0
  101. package/dist/scripts/nightly-evidence-tests.js +1 -1
  102. package/dist/scripts/nightly-evidence.js +1 -1
  103. package/dist/scripts/nudge-digest.js +1 -1
  104. package/dist/scripts/onboarding-tests.js +21 -53
  105. package/dist/scripts/opensky-check.js +1 -1
  106. package/dist/scripts/opensky-tests.js +1 -1
  107. package/dist/scripts/pnpm-dsh-closure-proof.js +20 -0
  108. package/dist/scripts/price-drift-tests.js +1 -1
  109. package/dist/scripts/price-drift-watch.js +1 -1
  110. package/dist/scripts/probe-poi-tests.js +1 -1
  111. package/dist/scripts/product-metrics.js +1 -1
  112. package/dist/scripts/publish-preverify.js +40 -4
  113. package/dist/scripts/realtime-pricing-tests.js +1 -1
  114. package/dist/scripts/replay-async.js +1 -1
  115. package/dist/scripts/replay-real.js +1 -1
  116. package/dist/scripts/replay.js +1 -1
  117. package/dist/scripts/session-attach-diagnose.js +1 -1
  118. package/dist/scripts/session-attach-poc.js +1 -1
  119. package/dist/scripts/session-benchmark.js +1 -1
  120. package/dist/scripts/session-extract-tests.js +1 -1
  121. package/dist/scripts/session-login.js +1 -1
  122. package/dist/scripts/session-tests.js +70 -20
  123. package/dist/scripts/sf-live-benchmark.js +338 -0
  124. package/dist/scripts/sf-live-cli-tests.js +21 -0
  125. package/dist/scripts/sf-soft-score-tests.js +108 -0
  126. package/dist/scripts/sf-summary.js +93 -0
  127. package/dist/scripts/skeleton-check.js +1 -1
  128. package/dist/scripts/skeleton-integration-test.js +1 -1
  129. package/dist/scripts/skills-contract-tests.js +1 -1
  130. package/dist/scripts/smoke-session-gate-tests.js +29 -0
  131. package/dist/scripts/smoke.js +79 -33
  132. package/dist/scripts/state-cli-tests.js +1 -1
  133. package/dist/scripts/state-cli.js +1 -1
  134. package/dist/scripts/static-golden-tests.js +299 -0
  135. package/dist/scripts/time-eval-tests.js +1 -1
  136. package/dist/scripts/travel-timeline-tests.js +1 -1
  137. package/dist/scripts/unified-tests.js +1 -1
  138. package/dist/scripts/weather-tests.js +694 -44
  139. package/dist/scripts/z3-race-tests.js +1 -1
  140. package/dist/src/artifact-gate.js +1 -1
  141. package/dist/src/benchmark-agent-conformance.js +370 -0
  142. package/dist/src/benchmark-environment-bridge.js +384 -0
  143. package/dist/src/benchmark-headless-child-diagnostics.js +173 -0
  144. package/dist/src/benchmark-tool-isolation.js +124 -0
  145. package/dist/src/bookable-facts.js +1 -1
  146. package/dist/src/booking-saga.js +1 -1
  147. package/dist/src/booking-surface/availability-policy-v2.js +830 -0
  148. package/dist/src/booking-surface/canonical-schema.js +113 -0
  149. package/dist/src/booking-surface/contracts-v2.js +89 -0
  150. package/dist/src/booking-surface/contracts.js +46 -0
  151. package/dist/src/booking-surface/dsh-planner.js +453 -0
  152. package/dist/src/booking-surface/dsh-plugin.js +93 -0
  153. package/dist/src/booking-surface/error-codes.js +94 -0
  154. package/dist/src/booking-surface/index.js +15 -0
  155. package/dist/src/booking-surface/profile.js +68 -0
  156. package/dist/src/booking-surface/runtime-v2.js +1771 -0
  157. package/dist/src/booking-surface/runtime.js +351 -0
  158. package/dist/src/booking-surface/server-v2.js +334 -0
  159. package/dist/src/booking-surface/server.js +302 -0
  160. package/dist/src/booking-surface/startup.js +159 -0
  161. package/dist/src/booking-surface/validation-v2.js +319 -0
  162. package/dist/src/booking-surface/validation.js +809 -0
  163. package/dist/src/bridge.js +1 -1
  164. package/dist/src/companions.js +1 -1
  165. package/dist/src/contracts.js +1 -1
  166. package/dist/src/dsh-llm.js +1 -1
  167. package/dist/src/engine.js +1 -1
  168. package/dist/src/evaluation-cadence.js +234 -0
  169. package/dist/src/evaluation-contracts.js +906 -0
  170. package/dist/src/i18n.js +1 -1
  171. package/dist/src/index.js +50 -19
  172. package/dist/src/journey.js +1 -1
  173. package/dist/src/loop.js +1 -1
  174. package/dist/src/memory-capture.js +1 -1
  175. package/dist/src/memory-decay.js +1 -1
  176. package/dist/src/memory-utility.js +1 -1
  177. package/dist/src/mock-llm.js +1 -1
  178. package/dist/src/model.js +1 -1
  179. package/dist/src/realtime-pricing.js +1 -1
  180. package/dist/src/slot-spec.js +1 -1
  181. package/dist/src/state-ledger.js +2 -1
  182. package/dist/src/time-anchor.js +1 -1
  183. package/dist/src/tool-budget.js +136 -0
  184. package/dist/src/tool-packet.js +1 -1
  185. package/dist/src/travel-slots.js +1 -1
  186. package/dist/src/travel-timeline.js +1 -1
  187. package/dist/src/unified.js +1 -1
  188. package/dist/src/wish-pool.js +1 -1
  189. package/dist/src/z3-shared.js +1 -1
  190. package/extension/README.md +31 -7
  191. package/package.json +286 -11
  192. package/schemas/booking.surface.v1.schema.json +927 -0
  193. package/schemas/booking.surface.v2.schema.json +61 -0
  194. package/ts/capabilities/flyai.ts +16 -3
  195. package/ts/capabilities/session/extension-bridge.ts +37 -14
  196. package/ts/capabilities/session/extension-channel.ts +6 -3
  197. package/ts/capabilities/session/extension-distribution.ts +264 -0
  198. package/ts/capabilities/session/golden-score.ts +139 -0
  199. package/ts/capabilities/session/health-watch.ts +1 -1
  200. package/ts/capabilities/session/static-flight-golden.ts +209 -0
  201. package/ts/capabilities/session/wizard.ts +34 -176
  202. package/ts/capabilities/session-login.ts +15 -5
  203. package/ts/capabilities/session-search.ts +40 -3
  204. package/ts/capabilities/weather.ts +141 -52
  205. package/ts/package.json +3 -3
  206. package/ts/src/benchmark-agent-conformance.ts +448 -0
  207. package/ts/src/benchmark-environment-bridge.ts +348 -0
  208. package/ts/src/benchmark-headless-child-diagnostics.ts +184 -0
  209. package/ts/src/benchmark-tool-isolation.ts +166 -0
  210. package/ts/src/booking-surface/availability-policy-v2.ts +523 -0
  211. package/ts/src/booking-surface/canonical-schema.js +113 -0
  212. package/ts/src/booking-surface/contracts-v2.ts +118 -0
  213. package/ts/src/booking-surface/contracts.ts +380 -0
  214. package/ts/src/booking-surface/dsh-planner.ts +452 -0
  215. package/ts/src/booking-surface/dsh-plugin.js +93 -0
  216. package/ts/src/booking-surface/error-codes.ts +101 -0
  217. package/ts/src/booking-surface/index.ts +12 -0
  218. package/ts/src/booking-surface/profile.ts +42 -0
  219. package/ts/src/booking-surface/runtime-v2.ts +1466 -0
  220. package/ts/src/booking-surface/runtime.ts +483 -0
  221. package/ts/src/booking-surface/server-v2.ts +247 -0
  222. package/ts/src/booking-surface/server.ts +324 -0
  223. package/ts/src/booking-surface/startup.ts +196 -0
  224. package/ts/src/booking-surface/validation-v2.ts +205 -0
  225. package/ts/src/booking-surface/validation.ts +453 -0
  226. package/ts/src/index.ts +64 -11
  227. package/ts/src/state-ledger.ts +1 -0
  228. package/ts/src/tool-budget.ts +165 -0
  229. package/dist/scripts/wizard-bootstrap.js +0 -32
@@ -31,4 +31,4 @@ export async function recordLatency(logPath, latencyMs, kind) {
31
31
  }
32
32
 
33
33
 
34
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/src/bridge.ts
34
+ //# sourceURL=ts/src/bridge.ts
@@ -109,4 +109,4 @@ export function upsertCompanion(profiles, patch) {
109
109
  }
110
110
 
111
111
 
112
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/src/companions.ts
112
+ //# sourceURL=ts/src/companions.ts
@@ -61,4 +61,4 @@ export const TRIP_STATE_JSON_SCHEMA = {
61
61
  };
62
62
 
63
63
 
64
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/src/contracts.ts
64
+ //# sourceURL=ts/src/contracts.ts
@@ -195,4 +195,4 @@ export function createOpenAICompatLlm(flightPackPath, clock = ()=>new Date()) {
195
195
  }
196
196
 
197
197
 
198
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/src/dsh-llm.ts
198
+ //# sourceURL=ts/src/dsh-llm.ts
@@ -397,4 +397,4 @@ function renderMarkdown(req, verdicts, recommended) {
397
397
  }
398
398
 
399
399
 
400
- //# sourceURL=/Users/bytedance/work/gotry-publish/ts/src/engine.ts
400
+ //# sourceURL=ts/src/engine.ts
@@ -0,0 +1,234 @@
1
+ import { assertPublicArtifactSafe } from './evaluation-contracts.js';
2
+ export const CADENCES = [
3
+ 'pr',
4
+ 'nightly',
5
+ 'weekly',
6
+ 'milestone'
7
+ ];
8
+ export const STOP_SIGNALS = [
9
+ 'source_revision_drift',
10
+ 'license_unresolved',
11
+ 'scorer_ceiling_invalid',
12
+ 'known_bad_no_longer_fails',
13
+ 'hard_violation',
14
+ 'matched_regression',
15
+ 'variance_breach',
16
+ 'budget_breach'
17
+ ];
18
+ function object(value, label) {
19
+ if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} must be an object`);
20
+ return value;
21
+ }
22
+ function exact(value, label, keys) {
23
+ const actual = Object.keys(value).sort();
24
+ const expected = [
25
+ ...keys
26
+ ].sort();
27
+ if (JSON.stringify(actual) !== JSON.stringify(expected)) throw new Error(`${label} keys must be exact`);
28
+ }
29
+ function number(value, label, min = 0) {
30
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < min) throw new Error(`${label} must be finite and non-negative`);
31
+ return value;
32
+ }
33
+ function integer(value, label, min = 0) {
34
+ const n = number(value, label, min);
35
+ if (!Number.isInteger(n)) throw new Error(`${label} must be an integer`);
36
+ return n;
37
+ }
38
+ function literal(value, label, allowed) {
39
+ if (typeof value !== 'string' || !allowed.includes(value)) throw new Error(`${label} is invalid`);
40
+ return value;
41
+ }
42
+ function bool(value, label, expected) {
43
+ if (value !== expected) throw new Error(`${label} must be ${expected}`);
44
+ return expected;
45
+ }
46
+ export function parseEvaluationCadencePolicy(value) {
47
+ const root = object(value, 'policy');
48
+ exact(root, 'policy', [
49
+ 'schema',
50
+ 'levels',
51
+ 'cross_benchmark_window',
52
+ 'performance_tradeoff_disclosure_threshold',
53
+ 'round_delivery',
54
+ 'stop_signals',
55
+ 'failure_registry_signals',
56
+ 'public_safety'
57
+ ]);
58
+ if (root.schema !== 'gotry_evaluation_cadence_policy_v1') throw new Error('policy schema is invalid');
59
+ if (!Array.isArray(root.levels) || root.levels.length !== 4) throw new Error('policy levels must be complete');
60
+ for(let index = 0; index < root.levels.length; index += 1)if (!Object.hasOwn(root.levels, index)) throw new Error('policy levels must be dense');
61
+ const levels = root.levels.map((raw, i)=>{
62
+ const item = object(raw, `policy.levels[${i}]`);
63
+ exact(item, `policy.levels[${i}]`, [
64
+ 'cadence',
65
+ 'pass_k',
66
+ 'max_cost_usd',
67
+ 'max_wall_minutes',
68
+ 'max_tool_calls_per_case',
69
+ 'human_calibration'
70
+ ]);
71
+ const cadence = literal(item.cadence, 'cadence', CADENCES);
72
+ if (cadence !== CADENCES[i]) throw new Error('policy levels must use canonical order');
73
+ const calibration = object(item.human_calibration, 'human_calibration');
74
+ exact(calibration, 'human_calibration', [
75
+ 'required',
76
+ 'min_samples'
77
+ ]);
78
+ const pass_k = integer(item.pass_k, 'pass_k', 1);
79
+ const max_cost_usd = number(item.max_cost_usd, 'max_cost_usd');
80
+ const max_wall_minutes = number(item.max_wall_minutes, 'max_wall_minutes');
81
+ if (item.max_tool_calls_per_case !== 18) throw new Error('max_tool_calls_per_case must be 18');
82
+ const required = Boolean(calibration.required);
83
+ if (calibration.required !== required) throw new Error('human calibration required must be boolean');
84
+ const min_samples = integer(calibration.min_samples, 'min_samples');
85
+ const expected = [
86
+ [
87
+ 1,
88
+ 0,
89
+ 20,
90
+ false,
91
+ 0
92
+ ],
93
+ [
94
+ 2,
95
+ 2,
96
+ 90,
97
+ false,
98
+ 0
99
+ ],
100
+ [
101
+ 3,
102
+ 10,
103
+ 360,
104
+ true,
105
+ 10
106
+ ],
107
+ [
108
+ 5,
109
+ 50,
110
+ 1440,
111
+ true,
112
+ 30
113
+ ]
114
+ ][i];
115
+ if (pass_k !== expected[0] || max_cost_usd !== expected[1] || max_wall_minutes !== expected[2] || required !== expected[3] || min_samples !== expected[4]) throw new Error('policy level literals are invalid');
116
+ return {
117
+ cadence,
118
+ pass_k,
119
+ max_cost_usd,
120
+ max_wall_minutes,
121
+ max_tool_calls_per_case: 18,
122
+ human_calibration: {
123
+ required,
124
+ min_samples
125
+ }
126
+ };
127
+ });
128
+ const window = object(root.cross_benchmark_window, 'cross_benchmark_window');
129
+ exact(window, 'cross_benchmark_window', [
130
+ 'min_prs',
131
+ 'max_prs'
132
+ ]);
133
+ if (window.min_prs !== 3 || window.max_prs !== 5) throw new Error('cross benchmark window must be 3..5');
134
+ if (root.performance_tradeoff_disclosure_threshold !== 0.2) throw new Error('tradeoff threshold must be 0.2');
135
+ const delivery = object(root.round_delivery, 'round_delivery');
136
+ exact(delivery, 'round_delivery', [
137
+ 'exactly_one_gotry_pr',
138
+ 'exactly_one_discussion_78_comment',
139
+ 'update_existing_comment'
140
+ ]);
141
+ for (const key of Object.keys(delivery))bool(delivery[key], `round_delivery.${key}`, true);
142
+ if (!Array.isArray(root.stop_signals) || JSON.stringify(root.stop_signals) !== JSON.stringify(STOP_SIGNALS)) throw new Error('stop signals must be the complete canonical set');
143
+ if (!Array.isArray(root.failure_registry_signals) || JSON.stringify(root.failure_registry_signals) !== JSON.stringify(STOP_SIGNALS.slice(4))) throw new Error('failure registry signals are invalid');
144
+ const publicSafety = object(root.public_safety, 'public_safety');
145
+ exact(publicSafety, 'public_safety', [
146
+ 'artifact_classification',
147
+ 'contains_third_party_prompt',
148
+ 'contains_gold',
149
+ 'contains_oracle',
150
+ 'contains_private_data'
151
+ ]);
152
+ if (publicSafety.artifact_classification !== 'public_safe') throw new Error('policy must be public safe');
153
+ for (const key of [
154
+ 'contains_third_party_prompt',
155
+ 'contains_gold',
156
+ 'contains_oracle',
157
+ 'contains_private_data'
158
+ ])bool(publicSafety[key], `public_safety.${key}`, false);
159
+ const policy = {
160
+ schema: root.schema,
161
+ levels,
162
+ cross_benchmark_window: {
163
+ min_prs: 3,
164
+ max_prs: 5
165
+ },
166
+ performance_tradeoff_disclosure_threshold: 0.2,
167
+ round_delivery: {
168
+ exactly_one_gotry_pr: true,
169
+ exactly_one_discussion_78_comment: true,
170
+ update_existing_comment: true
171
+ },
172
+ stop_signals: [
173
+ ...STOP_SIGNALS
174
+ ],
175
+ failure_registry_signals: [
176
+ ...STOP_SIGNALS.slice(4)
177
+ ],
178
+ public_safety: {
179
+ artifact_classification: 'public_safe',
180
+ contains_third_party_prompt: false,
181
+ contains_gold: false,
182
+ contains_oracle: false,
183
+ contains_private_data: false
184
+ }
185
+ };
186
+ assertPublicArtifactSafe(policy, 'evaluation cadence policy');
187
+ return policy;
188
+ }
189
+ export function planEvaluationCadence(policy, input) {
190
+ const inputObject = object(input, 'planner input');
191
+ exact(inputObject, 'planner input', [
192
+ 'cadence',
193
+ 'signals',
194
+ 'recent_optimization_prs'
195
+ ]);
196
+ if (!CADENCES.includes(input.cadence) || !Array.isArray(input.signals) || !Array.isArray(input.recent_optimization_prs)) throw new Error('planner input is invalid');
197
+ for(let index = 0; index < input.signals.length; index += 1)if (!Object.hasOwn(input.signals, index)) throw new Error('stop signals must be dense');
198
+ for(let index = 0; index < input.recent_optimization_prs.length; index += 1)if (!Object.hasOwn(input.recent_optimization_prs, index)) throw new Error('recent optimization PR IDs must be dense');
199
+ if (input.recent_optimization_prs.some((id)=>!Number.isInteger(id) || id < 1) || new Set(input.recent_optimization_prs).size !== input.recent_optimization_prs.length) throw new Error('recent optimization PR IDs must be positive and unique');
200
+ const normalizedPolicy = parseEvaluationCadencePolicy(policy);
201
+ const cadence = input.cadence;
202
+ const signals = input.signals.map((signal)=>literal(signal, 'stop signal', STOP_SIGNALS));
203
+ if (new Set(signals).size !== signals.length) throw new Error('stop signals must be unique');
204
+ const level = normalizedPolicy.levels.find((item)=>item.cadence === cadence);
205
+ if (!level) throw new Error('cadence is not configured');
206
+ const failure_registry = signals.some((signal)=>normalizedPolicy.failure_registry_signals.includes(signal));
207
+ const decision = {
208
+ cadence,
209
+ admission: signals.length === 0,
210
+ failure_registry,
211
+ stop_signals: signals,
212
+ launches_external_runs: false,
213
+ pass_k: level.pass_k,
214
+ max_cost_usd: level.max_cost_usd,
215
+ max_wall_minutes: level.max_wall_minutes,
216
+ max_tool_calls_per_case: 18,
217
+ human_calibration: level.human_calibration,
218
+ cross_benchmark_window: {
219
+ min_prs: 3,
220
+ max_prs: 5
221
+ },
222
+ performance_tradeoff_disclosure_threshold: 0.2,
223
+ delivery: normalizedPolicy.round_delivery,
224
+ cross_benchmark_synthesis: {
225
+ required: input.recent_optimization_prs.length >= 3,
226
+ overdue: input.recent_optimization_prs.length > 5
227
+ }
228
+ };
229
+ assertPublicArtifactSafe(decision, 'evaluation cadence decision');
230
+ return decision;
231
+ }
232
+
233
+
234
+ //# sourceURL=ts/src/evaluation-cadence.ts