openpond 0.0.43 → 0.0.44

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 (99) hide show
  1. package/dist/chunks/{app-layer-UPNMLDO5.js → app-layer-KH7LZGB6.js} +2 -2
  2. package/dist/chunks/{app-server-runtime-CLJWPISO.js → app-server-runtime-VEYSA27N.js} +7 -7
  3. package/dist/chunks/{apps-XLPSFCW4.js → apps-3UVBL7UK.js} +2 -2
  4. package/dist/chunks/{chunk-ZTE6A2VE.js → chunk-2NP3E4GP.js} +1 -1
  5. package/dist/chunks/{chunk-QHUJ2XVJ.js → chunk-3XFHKWKG.js} +32 -32
  6. package/dist/chunks/{chunk-2SF6HLT7.js → chunk-53YZBGDC.js} +4 -1
  7. package/dist/chunks/{chunk-MCBAI5M5.js → chunk-67K6KXTS.js} +1 -1
  8. package/dist/chunks/{chunk-SBVJGA3Y.js → chunk-6GLNUWY2.js} +768 -44
  9. package/dist/chunks/{chunk-L7SIUJEV.js → chunk-HKJG7VBI.js} +1 -1
  10. package/dist/chunks/{chunk-DBHT62E5.js → chunk-HLEQDBYN.js} +1 -1
  11. package/dist/chunks/{chunk-YYLUURQ4.js → chunk-JBUNQVLP.js} +3 -3
  12. package/dist/chunks/{chunk-YEKQWRBS.js → chunk-SLTKA5AW.js} +9 -5
  13. package/dist/chunks/{chunk-KSOI7GFA.js → chunk-Y7BBDWBT.js} +1 -1
  14. package/dist/chunks/{chunk-M2NXTLH2.js → chunk-ZXWFYFFB.js} +516 -26
  15. package/dist/chunks/{cli-UU4WCREM.js → cli-64VFZWFY.js} +6 -6
  16. package/dist/chunks/{core-commands-D66KZEHU.js → core-commands-54ZMYVFM.js} +3 -3
  17. package/dist/chunks/{desktop-test-FDA6MV77.js → desktop-test-ZISBAXA7.js} +2 -2
  18. package/dist/chunks/{extension-GDRW22N3.js → extension-65AJZLNI.js} +4 -1
  19. package/dist/chunks/{help-7QG4UITV.js → help-WHEMW4R3.js} +1 -1
  20. package/dist/chunks/{opchat-I2WGEFGU.js → opchat-ZFKPZQUA.js} +2 -2
  21. package/dist/chunks/{organizations-MADRLI2I.js → organizations-K4IDYOYN.js} +4 -4
  22. package/dist/chunks/{profile-B4A3GT3U.js → profile-NTBQ74Q7.js} +2 -2
  23. package/dist/chunks/{project-agent-PCO42FZJ.js → project-agent-7JDEGY6U.js} +2 -2
  24. package/dist/chunks/{sandbox-command-LBKSIR7P.js → sandbox-command-HPYUKC6U.js} +2 -2
  25. package/dist/chunks/{sandbox-template-YJXGG4H3.js → sandbox-template-APQYLIHG.js} +3 -3
  26. package/dist/chunks/{src-L2H4X4IY.js → src-22E2EIT5.js} +1393 -487
  27. package/dist/chunks/{src-35JYS27L.js → src-CBOXC5JP.js} +3 -3
  28. package/dist/chunks/{teams-bot-L4SR2SWM.js → teams-bot-TQKFFTJ7.js} +2 -2
  29. package/dist/chunks/{workspaces-ODFJT6HJ.js → workspaces-RKZVNT2A.js} +2 -2
  30. package/dist/cli.js +13 -13
  31. package/dist/web/assets/{AppDialog-Bua3f-6v.js → AppDialog-D8HiG2vU.js} +1 -1
  32. package/dist/web/assets/{AppsView-DrJkHeSO.js → AppsView-gZoE9vMK.js} +1 -1
  33. package/dist/web/assets/{BrowserSidebar-Bf-4Vozm.js → BrowserSidebar-D-HKuusA.js} +1 -1
  34. package/dist/web/assets/{CommandMenu-DDZlGQiB.js → CommandMenu-CzrixKzR.js} +1 -1
  35. package/dist/web/assets/{CommunityView-BtcCrba7.js → CommunityView-khbmjhWm.js} +1 -1
  36. package/dist/web/assets/{ComposerCreateImproveStrip-DOe5Otg6.js → ComposerCreateImproveStrip-CLxAZScx.js} +1 -1
  37. package/dist/web/assets/{GetStartedView-CG4z0Dtw.js → GetStartedView-C3nu80E_.js} +1 -1
  38. package/dist/web/assets/{LabModelVersionDetailPage-BEkmSKuv.js → LabModelVersionDetailPage-EcvM9TTz.js} +1 -1
  39. package/dist/web/assets/{LabSkillSidebar-BIotN_RB.js → LabSkillSidebar-LG9zm1yx.js} +1 -1
  40. package/dist/web/assets/{LabsRoute-CfOe0Zt5.js → LabsRoute-B4lijQB6.js} +3 -3
  41. package/dist/web/assets/{MainChatThread-C0-l1mHt.js → MainChatThread-D_-zWAT8.js} +2 -2
  42. package/dist/web/assets/{MainPane-aOVlVyRK.js → MainPane-Dfvc7xdq.js} +3 -3
  43. package/dist/web/assets/{MarkdownText-D7DT1k1k.js → MarkdownText-C0_D5zMW.js} +1 -1
  44. package/dist/web/assets/{Messages-CBIXruA9.js → Messages-C-Q91wIU.js} +1 -1
  45. package/dist/web/assets/{NativeSkillSidebar-C4t69Y7B.js → NativeSkillSidebar-DoSiN-Mr.js} +1 -1
  46. package/dist/web/assets/{NewProjectDialog-Bat65tYD.js → NewProjectDialog-C0hUcNck.js} +1 -1
  47. package/dist/web/assets/{OutputsPage-C58n39Db.js → OutputsPage-PV7Pm_OU.js} +1 -1
  48. package/dist/web/assets/{RightChatPanelStack-Bp7nZxQ0.js → RightChatPanelStack-C1LZTXEY.js} +1 -1
  49. package/dist/web/assets/{ScheduledWorkPage-BXP0j_c_.js → ScheduledWorkPage-7UGpZ8Gc.js} +1 -1
  50. package/dist/web/assets/{SettingsView-CtWK_aQ0.css → SettingsView-CrXwXjZ1.css} +1 -1
  51. package/dist/web/assets/SettingsView-DjSbBHb7.js +6 -0
  52. package/dist/web/assets/{TeamChatView-De2wdqyY.js → TeamChatView-D7_mZ6eT.js} +1 -1
  53. package/dist/web/assets/{TerminalOverlay-BsuCH3NX.js → TerminalOverlay-Cji37VqF.js} +1 -1
  54. package/dist/web/assets/{TrainingCreationPanel-D2OFWyQ-.js → TrainingCreationPanel-VctKu0b5.js} +1 -1
  55. package/dist/web/assets/{TrainingDraftPanel-DBpulXTz.js → TrainingDraftPanel-BJXcYQt5.js} +1 -1
  56. package/dist/web/assets/{UsageSettingsSection-DzMLUXAO.js → UsageSettingsSection-BxnbRELL.js} +1 -1
  57. package/dist/web/assets/{WorkspaceDiffPanel-B7yIhjNF.js → WorkspaceDiffPanel-Dj50bA58.js} +3 -3
  58. package/dist/web/assets/{WorkspaceEnvironmentMenu-B6jXM9xG.js → WorkspaceEnvironmentMenu-Dv_pK7bp.js} +1 -1
  59. package/dist/web/assets/{WorkspaceGitDialogs-CQ0fl9Qk.js → WorkspaceGitDialogs-Bs55QQk1.js} +1 -1
  60. package/dist/web/assets/{WorkspaceMonacoEditor-C2ctzITz.js → WorkspaceMonacoEditor-BKyihWp7.js} +3 -3
  61. package/dist/web/assets/{arrow-up-right-ecwcx3xt.js → arrow-up-right-O7S09juy.js} +1 -1
  62. package/dist/web/assets/{chevron-up-DP8PPfWd.js → chevron-up-ILypNpT9.js} +1 -1
  63. package/dist/web/assets/{circle-alert-envg1D6O.js → circle-alert-CqcEVbV4.js} +1 -1
  64. package/dist/web/assets/{cloud-upload-5MGPLnaA.js → cloud-upload-B-KanLwx.js} +1 -1
  65. package/dist/web/assets/{cssMode-CFifcEfw.js → cssMode-BIJYgmZR.js} +1 -1
  66. package/dist/web/assets/{folder-open-Dq3ZjeEP.js → folder-open-DCkv77b6.js} +1 -1
  67. package/dist/web/assets/{folder-plus-EiZ5wbv_.js → folder-plus-BqZUZnCI.js} +1 -1
  68. package/dist/web/assets/{git-branch-w29jmQ-X.js → git-branch-DLlfIOn_.js} +1 -1
  69. package/dist/web/assets/{git-commit-horizontal-CGZM0PZo.js → git-commit-horizontal-ClqcnbGe.js} +1 -1
  70. package/dist/web/assets/{htmlMode-Ct1P-_lf.js → htmlMode-B1PeNAJB.js} +1 -1
  71. package/dist/web/assets/index-BLgZVGpl.js +178 -0
  72. package/dist/web/assets/index-vV2sAtZG.js +1 -0
  73. package/dist/web/assets/{info-Cd2HkIeb.js → info-B-IcZCF8.js} +1 -1
  74. package/dist/web/assets/{jsonMode-BAUNCNAX.js → jsonMode-NqLd9KdG.js} +1 -1
  75. package/dist/web/assets/{lspLanguageFeatures-fucFYI1A.js → lspLanguageFeatures-DWa2E295.js} +1 -1
  76. package/dist/web/assets/{monaco.contribution-nG-5Cyjz.js → monaco.contribution-BYgdD9ap.js} +2 -2
  77. package/dist/web/assets/{monaco.contribution-DLLMi4cB.js → monaco.contribution-DOdpxIBx.js} +2 -2
  78. package/dist/web/assets/{monaco.contribution-g9QiIm1d.js → monaco.contribution-EiA1XLoV.js} +2 -2
  79. package/dist/web/assets/{monaco.contribution-Ce4v5kei.js → monaco.contribution-rE0pudHI.js} +2 -2
  80. package/dist/web/assets/{monitor-DgHCnCKl.js → monitor-IKHoaZYu.js} +1 -1
  81. package/dist/web/assets/{play-Be0XDHBu.js → play-B8a2D-Pu.js} +1 -1
  82. package/dist/web/assets/{python-CEhEiPo7.js → python-DXSUy3MY.js} +1 -1
  83. package/dist/web/assets/{refresh-cw-DH0KLbdD.js → refresh-cw-De3V2Tzv.js} +1 -1
  84. package/dist/web/assets/{reply-D1TK2yV8.js → reply-DtzLGSWr.js} +1 -1
  85. package/dist/web/assets/{save-C1MSeBnQ.js → save-CKSY2EC7.js} +1 -1
  86. package/dist/web/assets/{square-CemI-0g5.js → square-U2IL0jpg.js} +1 -1
  87. package/dist/web/assets/{square-pen-CqfsvR_n.js → square-pen-DhLj2CtT.js} +1 -1
  88. package/dist/web/assets/{toggleHighContrast-DrdQN3Rl.js → toggleHighContrast-Dusp2QyF.js} +1 -1
  89. package/dist/web/assets/{tsMode-CKB5oOUU.js → tsMode-CarGQUBk.js} +1 -1
  90. package/dist/web/assets/{upload-t751LLqP.js → upload-12FovSVQ.js} +1 -1
  91. package/dist/web/assets/{useLocalAgentSchedules-CzC3wfIP.js → useLocalAgentSchedules-DGQQtn8W.js} +1 -1
  92. package/dist/web/assets/{wifi-off-CxTHH3JU.js → wifi-off-CjQEPd2q.js} +1 -1
  93. package/dist/web/assets/{workers-CqYddzCd.js → workers-CeBkFaBO.js} +1 -1
  94. package/dist/web/assets/{yaml-e5wBkc-C.js → yaml-DQPBhykU.js} +1 -1
  95. package/dist/web/index.html +1 -1
  96. package/package.json +1 -1
  97. package/dist/web/assets/SettingsView-DOOfhO9a.js +0 -6
  98. package/dist/web/assets/index-ByIQyiUl.js +0 -178
  99. package/dist/web/assets/index-D4uCeiep.js +0 -1
@@ -15,12 +15,12 @@ import {
15
15
  runAgentCompactionProgram,
16
16
  runProviderRound,
17
17
  runProviderRoundLoop
18
- } from "./chunk-YEKQWRBS.js";
18
+ } from "./chunk-SLTKA5AW.js";
19
19
  import {
20
20
  getBundledRuntimeVersion,
21
21
  loadOpenPondAccountContext,
22
22
  streamOpenPondHostedChatTurn
23
- } from "./chunk-ZTE6A2VE.js";
23
+ } from "./chunk-2NP3E4GP.js";
24
24
  import {
25
25
  assertSafeBranchName,
26
26
  isGeneratedWorkspacePath,
@@ -33,14 +33,14 @@ import {
33
33
  truncatePatch,
34
34
  uniqueSortedPaths,
35
35
  workspaceImageContentType
36
- } from "./chunk-DBHT62E5.js";
36
+ } from "./chunk-HLEQDBYN.js";
37
37
  import {
38
38
  HOSTED_CHAT_SYSTEM_PROMPT,
39
39
  VERSION,
40
40
  event,
41
41
  now,
42
42
  textFromUnknown
43
- } from "./chunk-L7SIUJEV.js";
43
+ } from "./chunk-HKJG7VBI.js";
44
44
  import {
45
45
  AppPreferencesSchema,
46
46
  ApplyCreateImproveRunActionRequestSchema,
@@ -138,7 +138,7 @@ import {
138
138
  runAgentSdkProjectCommand,
139
139
  runProfileSkillCommand,
140
140
  sidebarFileBookmarkId
141
- } from "./chunk-2SF6HLT7.js";
141
+ } from "./chunk-53YZBGDC.js";
142
142
  import {
143
143
  AgentSnapshotSchema,
144
144
  CONNECTED_APP_PROVIDER_TOOL_NAMES,
@@ -146,18 +146,22 @@ import {
146
146
  DEFAULT_REFINEMENT_TRIGGER_POLICY,
147
147
  DEFAULT_REFINER_MAX_OUTPUT_TOKENS,
148
148
  DEFAULT_REFINER_TIMEOUT_MS,
149
+ EvaluationResultSchema,
149
150
  EvidenceArtifactRefSchema,
150
151
  HarnessAdvanceReceiptSchema,
152
+ HarnessEvaluationReviewReceiptSchema,
151
153
  HarnessImprovementProposalSchema,
152
154
  HarnessOverlayMergeReceiptSchema,
153
155
  HarnessRefinerOutcomeSchema,
154
156
  HarnessReleaseSchema,
157
+ HarnessReviewWatermarkSchema,
155
158
  HarnessRunOverlaySchema,
156
159
  HarnessTargetedValidationReceiptSchema,
157
160
  HarnessWorkspaceSchema,
158
161
  ImprovementApplyReceiptSchema,
159
162
  ImprovementObservationSchema,
160
163
  ImprovementRouteDecisionSchema,
164
+ ModelImprovementQualificationReceiptSchema,
161
165
  OPENPOND_MANIFEST_FILE_NAME,
162
166
  RefinementTriggerDecisionSchema,
163
167
  SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,
@@ -176,6 +180,7 @@ import {
176
180
  connectedAppProviderOperationById,
177
181
  contentHash,
178
182
  createAgentSnapshot,
183
+ createHarnessEvaluationReviewReceipt,
179
184
  createHarnessImprovementProposal,
180
185
  createHarnessRefinerOutcome,
181
186
  createHarnessRelease,
@@ -195,7 +200,7 @@ import {
195
200
  stableId,
196
201
  uniqueEventRefs,
197
202
  validateConnectedAppProviderOperationRequest
198
- } from "./chunk-M2NXTLH2.js";
203
+ } from "./chunk-ZXWFYFFB.js";
199
204
  import {
200
205
  external_exports
201
206
  } from "./chunk-WYDVQOBL.js";
@@ -952,7 +957,7 @@ import { promises as fs2 } from "node:fs";
952
957
  import path2 from "node:path";
953
958
 
954
959
  // ../server/src/store/store-schema.ts
955
- var CURRENT_SQLITE_SCHEMA_VERSION = 39;
960
+ var CURRENT_SQLITE_SCHEMA_VERSION = 40;
956
961
  var SQLITE_CREATE_SCHEMA_SQL = `
957
962
  CREATE TABLE IF NOT EXISTS sessions (
958
963
  id TEXT PRIMARY KEY,
@@ -1384,6 +1389,15 @@ var SQLITE_CREATE_SCHEMA_SQL = `
1384
1389
  );
1385
1390
  CREATE INDEX IF NOT EXISTS grade_results_attempt_idx ON grade_results(attempt_id, created_at DESC);
1386
1391
 
1392
+ CREATE TABLE IF NOT EXISTS evaluation_results (
1393
+ id TEXT PRIMARY KEY,
1394
+ taskset_id TEXT NOT NULL,
1395
+ kind TEXT NOT NULL,
1396
+ payload TEXT NOT NULL,
1397
+ created_at TEXT NOT NULL
1398
+ );
1399
+ CREATE INDEX IF NOT EXISTS evaluation_results_taskset_kind_idx ON evaluation_results(taskset_id, kind, created_at DESC);
1400
+
1387
1401
  CREATE TABLE IF NOT EXISTS grader_audit_reports (
1388
1402
  id TEXT PRIMARY KEY,
1389
1403
  taskset_id TEXT NOT NULL,
@@ -1820,6 +1834,24 @@ async function createHarnessWorkspaceTables(exec) {
1820
1834
  FOREIGN KEY(workspace_id) REFERENCES harness_workspaces(id) ON DELETE RESTRICT
1821
1835
  );
1822
1836
 
1837
+ CREATE TABLE IF NOT EXISTS harness_evaluation_review_settings (
1838
+ workspace_id TEXT PRIMARY KEY,
1839
+ enabled INTEGER NOT NULL DEFAULT 0,
1840
+ cadence TEXT NOT NULL DEFAULT 'manual',
1841
+ max_estimated_cost_usd REAL NOT NULL DEFAULT 0,
1842
+ next_run_at TEXT,
1843
+ last_run_at TEXT,
1844
+ last_review_id TEXT,
1845
+ last_review_hash TEXT,
1846
+ last_classification TEXT,
1847
+ last_error TEXT,
1848
+ updated_at TEXT NOT NULL,
1849
+ FOREIGN KEY(workspace_id) REFERENCES harness_workspaces(id) ON DELETE RESTRICT
1850
+ );
1851
+
1852
+ CREATE INDEX IF NOT EXISTS harness_evaluation_review_settings_due_idx
1853
+ ON harness_evaluation_review_settings(enabled, next_run_at);
1854
+
1823
1855
  CREATE TABLE IF NOT EXISTS harness_release_records (
1824
1856
  content_hash TEXT PRIMARY KEY,
1825
1857
  id TEXT NOT NULL,
@@ -2232,6 +2264,10 @@ var SQLITE_MIGRATIONS = [
2232
2264
  {
2233
2265
  version: 39,
2234
2266
  run: (store) => store.createHarnessWorkspaceTables()
2267
+ },
2268
+ {
2269
+ version: 40,
2270
+ run: (store) => store.createHarnessWorkspaceTables()
2235
2271
  }
2236
2272
  ];
2237
2273
 
@@ -2524,6 +2560,8 @@ var TRAINING_TABLES_SQL = `
2524
2560
  CREATE INDEX IF NOT EXISTS task_attempts_taskset_split_idx ON task_attempts(taskset_id, split, created_at DESC);
2525
2561
  CREATE TABLE IF NOT EXISTS grade_results (id TEXT PRIMARY KEY, attempt_id TEXT NOT NULL, payload TEXT NOT NULL, created_at TEXT NOT NULL);
2526
2562
  CREATE INDEX IF NOT EXISTS grade_results_attempt_idx ON grade_results(attempt_id, created_at DESC);
2563
+ CREATE TABLE IF NOT EXISTS evaluation_results (id TEXT PRIMARY KEY, taskset_id TEXT NOT NULL, kind TEXT NOT NULL, payload TEXT NOT NULL, created_at TEXT NOT NULL);
2564
+ CREATE INDEX IF NOT EXISTS evaluation_results_taskset_kind_idx ON evaluation_results(taskset_id, kind, created_at DESC);
2527
2565
  CREATE TABLE IF NOT EXISTS readiness_reports (taskset_id TEXT PRIMARY KEY, payload TEXT NOT NULL, updated_at TEXT NOT NULL);
2528
2566
  CREATE TABLE IF NOT EXISTS task_miner_configs (profile_id TEXT PRIMARY KEY, payload TEXT NOT NULL, updated_at TEXT NOT NULL);
2529
2567
  CREATE TABLE IF NOT EXISTS task_miner_runs (id TEXT PRIMARY KEY, profile_id TEXT NOT NULL, status TEXT NOT NULL, payload TEXT NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL);
@@ -3895,6 +3933,44 @@ var SqliteDatasetStore = class extends SqliteTrainingModelStore {
3895
3933
  }
3896
3934
  };
3897
3935
 
3936
+ // ../server/src/store/store-evaluation-results.ts
3937
+ var SqliteEvaluationResultStore = class extends SqliteDatasetStore {
3938
+ async saveEvaluationResult(input) {
3939
+ const result = EvaluationResultSchema.parse(input.result);
3940
+ assertContentHash(result, "Evaluation result");
3941
+ if (result.metadata.sourceTasksetId !== input.tasksetId) {
3942
+ throw new Error("Evaluation result does not match the supplied Taskset identity.");
3943
+ }
3944
+ const existing = await this.getEvaluationResult(result.id);
3945
+ if (existing) {
3946
+ if (existing.contentHash !== result.contentHash) {
3947
+ throw new Error(`Evaluation result ${result.id} is immutable and already has another content hash.`);
3948
+ }
3949
+ return existing;
3950
+ }
3951
+ await this.upsertPayload(
3952
+ `INSERT INTO evaluation_results (id, taskset_id, kind, payload, created_at)
3953
+ VALUES (?, ?, ?, ?, ?)`,
3954
+ [result.id, input.tasksetId, input.kind, JSON.stringify(result), input.createdAt]
3955
+ );
3956
+ return result;
3957
+ }
3958
+ async getEvaluationResult(id) {
3959
+ return this.getParsedPayload(
3960
+ "SELECT payload FROM evaluation_results WHERE id = ?",
3961
+ [id],
3962
+ EvaluationResultSchema.parse
3963
+ );
3964
+ }
3965
+ async listEvaluationResults(tasksetId, kind) {
3966
+ return this.listParsedPayloads(
3967
+ kind ? "SELECT payload FROM evaluation_results WHERE taskset_id = ? AND kind = ? ORDER BY created_at DESC, id ASC" : "SELECT payload FROM evaluation_results WHERE taskset_id = ? ORDER BY created_at DESC, id ASC",
3968
+ kind ? [tasksetId, kind] : [tasksetId],
3969
+ EvaluationResultSchema.parse
3970
+ );
3971
+ }
3972
+ };
3973
+
3898
3974
  // ../server/src/store/store-training-search.ts
3899
3975
  function trainingChatSearchResult(query, offset, limit, total, rows, indexedChats, totalChats) {
3900
3976
  return {
@@ -3928,7 +4004,7 @@ function appendTrainingChatSearchText(target, sessionId, text) {
3928
4004
 
3929
4005
  // ../server/src/store/store-training.ts
3930
4006
  var ACTIVE_TRAINING_DESTINATIONS_SQL = "('local_cpu_fixture', 'openpond_managed')";
3931
- var SqliteTrainingStore = class extends SqliteDatasetStore {
4007
+ var SqliteTrainingStore = class extends SqliteEvaluationResultStore {
3932
4008
  async trainingChatSearchSignatures(source) {
3933
4009
  await this.ready;
3934
4010
  await this.writeQueue;
@@ -4305,6 +4381,7 @@ var SqliteTrainingStore = class extends SqliteDatasetStore {
4305
4381
  await this.exec("BEGIN IMMEDIATE");
4306
4382
  try {
4307
4383
  await this.run("DELETE FROM grade_results WHERE attempt_id IN (SELECT id FROM task_attempts WHERE taskset_id = ?)", [id]);
4384
+ await this.run("DELETE FROM evaluation_results WHERE taskset_id = ?", [id]);
4308
4385
  await this.run("DELETE FROM task_attempt_artifacts WHERE taskset_id = ?", [id]);
4309
4386
  await this.run("DELETE FROM task_attempts WHERE taskset_id = ?", [id]);
4310
4387
  await this.run("DELETE FROM grader_audit_reports WHERE taskset_id = ?", [id]);
@@ -5156,6 +5233,123 @@ var SqliteHarnessMemoryStore = class extends SqliteSidebarFileBookmarkStore {
5156
5233
  }
5157
5234
  };
5158
5235
 
5236
+ // ../server/src/store/store-harness-evaluation-review-settings.ts
5237
+ var DEFAULT_SETTINGS = {
5238
+ enabled: false,
5239
+ cadence: "manual",
5240
+ maxEstimatedCostUsd: 0,
5241
+ nextRunAt: null,
5242
+ lastRunAt: null,
5243
+ lastResult: null,
5244
+ lastError: null,
5245
+ updatedAt: null
5246
+ };
5247
+ var SqliteHarnessEvaluationReviewSettingsStore = class extends SqliteHarnessMemoryStore {
5248
+ async getHarnessBackgroundReviewSettings(workspaceId) {
5249
+ await this.ready;
5250
+ await this.writeQueue;
5251
+ const row = await this.get(
5252
+ `SELECT background_review_enabled, updated_at
5253
+ FROM harness_workspace_settings WHERE workspace_id = ?`,
5254
+ [workspaceId]
5255
+ );
5256
+ return row ? { enabled: row.background_review_enabled === 1, updatedAt: row.updated_at } : { enabled: true, updatedAt: null };
5257
+ }
5258
+ async setHarnessBackgroundReviewSettings(input) {
5259
+ await this.ready;
5260
+ const write = this.writeQueue.then(async () => {
5261
+ const workspace = await this.get(
5262
+ "SELECT id FROM harness_workspaces WHERE id = ?",
5263
+ [input.workspaceId]
5264
+ );
5265
+ if (!workspace) throw new Error(`Harness workspace ${input.workspaceId} does not exist.`);
5266
+ await this.run(
5267
+ `INSERT INTO harness_workspace_settings (
5268
+ workspace_id, background_review_enabled, updated_at
5269
+ ) VALUES (?, ?, ?)
5270
+ ON CONFLICT(workspace_id) DO UPDATE SET
5271
+ background_review_enabled = excluded.background_review_enabled,
5272
+ updated_at = excluded.updated_at`,
5273
+ [input.workspaceId, input.enabled ? 1 : 0, input.updatedAt]
5274
+ );
5275
+ });
5276
+ this.writeQueue = write.catch(() => void 0);
5277
+ await write;
5278
+ return { enabled: input.enabled, updatedAt: input.updatedAt };
5279
+ }
5280
+ async getHarnessEvaluationReviewSettings(workspaceId) {
5281
+ await this.ready;
5282
+ await this.writeQueue;
5283
+ const row = await this.get(
5284
+ `SELECT enabled, cadence, max_estimated_cost_usd, next_run_at, last_run_at,
5285
+ last_review_id, last_review_hash, last_classification, last_error, updated_at
5286
+ FROM harness_evaluation_review_settings WHERE workspace_id = ?`,
5287
+ [workspaceId]
5288
+ );
5289
+ if (!row) return { ...DEFAULT_SETTINGS };
5290
+ const lastResult = row.last_review_id && row.last_review_hash && row.last_classification ? {
5291
+ id: row.last_review_id,
5292
+ contentHash: row.last_review_hash,
5293
+ classification: row.last_classification
5294
+ } : null;
5295
+ return {
5296
+ enabled: row.enabled === 1,
5297
+ cadence: row.cadence,
5298
+ maxEstimatedCostUsd: row.max_estimated_cost_usd,
5299
+ nextRunAt: row.next_run_at,
5300
+ lastRunAt: row.last_run_at,
5301
+ lastResult,
5302
+ lastError: row.last_error,
5303
+ updatedAt: row.updated_at
5304
+ };
5305
+ }
5306
+ async setHarnessEvaluationReviewSettings(input) {
5307
+ await this.ready;
5308
+ const write = this.writeQueue.then(async () => {
5309
+ const workspace = await this.get(
5310
+ "SELECT id FROM harness_workspaces WHERE id = ?",
5311
+ [input.workspaceId]
5312
+ );
5313
+ if (!workspace) throw new Error(`Harness workspace ${input.workspaceId} does not exist.`);
5314
+ const result = input.settings.lastResult;
5315
+ await this.run(
5316
+ `INSERT INTO harness_evaluation_review_settings (
5317
+ workspace_id, enabled, cadence, max_estimated_cost_usd, next_run_at,
5318
+ last_run_at, last_review_id, last_review_hash, last_classification,
5319
+ last_error, updated_at
5320
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
5321
+ ON CONFLICT(workspace_id) DO UPDATE SET
5322
+ enabled = excluded.enabled,
5323
+ cadence = excluded.cadence,
5324
+ max_estimated_cost_usd = excluded.max_estimated_cost_usd,
5325
+ next_run_at = excluded.next_run_at,
5326
+ last_run_at = excluded.last_run_at,
5327
+ last_review_id = excluded.last_review_id,
5328
+ last_review_hash = excluded.last_review_hash,
5329
+ last_classification = excluded.last_classification,
5330
+ last_error = excluded.last_error,
5331
+ updated_at = excluded.updated_at`,
5332
+ [
5333
+ input.workspaceId,
5334
+ input.settings.enabled ? 1 : 0,
5335
+ input.settings.cadence,
5336
+ input.settings.maxEstimatedCostUsd,
5337
+ input.settings.nextRunAt,
5338
+ input.settings.lastRunAt,
5339
+ result?.id ?? null,
5340
+ result?.contentHash ?? null,
5341
+ result?.classification ?? null,
5342
+ input.settings.lastError,
5343
+ input.settings.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
5344
+ ]
5345
+ );
5346
+ });
5347
+ this.writeQueue = write.catch(() => void 0);
5348
+ await write;
5349
+ return input.settings;
5350
+ }
5351
+ };
5352
+
5159
5353
  // ../server/src/store/store-harness-release-record.ts
5160
5354
  var LocalHarnessReleaseRecordSchema = external_exports.object({
5161
5355
  schemaVersion: external_exports.literal("openpond.localHarnessReleaseRecord.v1"),
@@ -5178,6 +5372,8 @@ var LocalHarnessReleaseRecordSchema = external_exports.object({
5178
5372
  // ../server/src/store/store-harness-workspace-artifacts.ts
5179
5373
  var HARNESS_IMPROVEMENT_ARTIFACT_SCHEMAS = {
5180
5374
  run_overlay: HarnessRunOverlaySchema,
5375
+ evaluation_review: HarnessEvaluationReviewReceiptSchema,
5376
+ training_qualification: ModelImprovementQualificationReceiptSchema,
5181
5377
  proposal: HarnessImprovementProposalSchema,
5182
5378
  targeted_validation: HarnessTargetedValidationReceiptSchema,
5183
5379
  merge_receipt: HarnessOverlayMergeReceiptSchema,
@@ -5208,35 +5404,7 @@ function immutableHarnessReleaseRecord(record5) {
5208
5404
  }
5209
5405
 
5210
5406
  // ../server/src/store/store-harness-workspaces.ts
5211
- var SqliteHarnessWorkspaceStore = class extends SqliteHarnessMemoryStore {
5212
- async getHarnessBackgroundReviewSettings(workspaceId) {
5213
- await this.ready;
5214
- await this.writeQueue;
5215
- const row = await this.get(
5216
- `SELECT background_review_enabled, updated_at
5217
- FROM harness_workspace_settings WHERE workspace_id = ?`,
5218
- [workspaceId]
5219
- );
5220
- return row ? { enabled: row.background_review_enabled === 1, updatedAt: row.updated_at } : { enabled: true, updatedAt: null };
5221
- }
5222
- async setHarnessBackgroundReviewSettings(input) {
5223
- await this.ready;
5224
- const write = this.writeQueue.then(async () => {
5225
- await this.requireHarnessWorkspace(input.workspaceId);
5226
- await this.run(
5227
- `INSERT INTO harness_workspace_settings (
5228
- workspace_id, background_review_enabled, updated_at
5229
- ) VALUES (?, ?, ?)
5230
- ON CONFLICT(workspace_id) DO UPDATE SET
5231
- background_review_enabled = excluded.background_review_enabled,
5232
- updated_at = excluded.updated_at`,
5233
- [input.workspaceId, input.enabled ? 1 : 0, input.updatedAt]
5234
- );
5235
- });
5236
- this.writeQueue = write.catch(() => void 0);
5237
- await write;
5238
- return { enabled: input.enabled, updatedAt: input.updatedAt };
5239
- }
5407
+ var SqliteHarnessWorkspaceStore = class extends SqliteHarnessEvaluationReviewSettingsStore {
5240
5408
  async createHarnessWorkspace(input) {
5241
5409
  const workspace = HarnessWorkspaceSchema.parse(input);
5242
5410
  await this.ready;
@@ -7397,6 +7565,443 @@ function gitBasicAuthEnv(remoteUrl, token) {
7397
7565
  };
7398
7566
  }
7399
7567
 
7568
+ // ../server/src/harness/local-harness-evaluation-review.ts
7569
+ var ReviewSourcePolicySchema = external_exports.object({
7570
+ sourceRef: external_exports.string().trim().min(1),
7571
+ policy: external_exports.object({
7572
+ id: external_exports.string().trim().min(1),
7573
+ contentHash: external_exports.string().regex(/^[a-f0-9]{64}$/)
7574
+ }).strict(),
7575
+ state: external_exports.enum(["authorized", "revoked", "deleted", "expired"]),
7576
+ checkedAt: external_exports.string().datetime()
7577
+ }).strict();
7578
+ var LocalHarnessEvaluationReviewRequestSchema = external_exports.object({
7579
+ previousWatermark: HarnessReviewWatermarkSchema.nullable().optional(),
7580
+ sourcePolicies: external_exports.array(ReviewSourcePolicySchema).max(1e4).default([]),
7581
+ limits: external_exports.object({
7582
+ maxEvidence: external_exports.number().int().min(1).max(1e3).default(200),
7583
+ maxTokens: external_exports.number().int().min(1).max(1e6).default(5e4),
7584
+ maxDurationMs: external_exports.number().int().min(1).max(6e4).default(5e3),
7585
+ maxEstimatedCostUsd: external_exports.number().finite().nonnegative().default(0)
7586
+ }).strict().default({
7587
+ maxEvidence: 200,
7588
+ maxTokens: 5e4,
7589
+ maxDurationMs: 5e3,
7590
+ maxEstimatedCostUsd: 0
7591
+ })
7592
+ }).strict();
7593
+ async function reviewSelectedLocalHarnessEvaluation(input) {
7594
+ const request = LocalHarnessEvaluationReviewRequestSchema.parse(input.request ?? {});
7595
+ const startedAt = performance.now();
7596
+ const selectedRelease = await resolveSelectedLocalHarnessRelease(input.store);
7597
+ if (!selectedRelease) {
7598
+ throw new Error("No Local Harness release is selected for evaluation review.");
7599
+ }
7600
+ const workspace = await input.store.getHarnessWorkspace(selectedRelease.workspaceId);
7601
+ if (!workspace) {
7602
+ throw new Error(`Selected Harness workspace ${selectedRelease.workspaceId} does not exist.`);
7603
+ }
7604
+ const [reviews, routes, triggers, observations, applyReceipts] = await Promise.all([
7605
+ input.store.listHarnessImprovementArtifacts(workspace.id, "evaluation_review", 1e3),
7606
+ input.store.listHarnessImprovementArtifacts(workspace.id, "route_decision", 1e3),
7607
+ input.store.listHarnessImprovementArtifacts(workspace.id, "trigger_decision", 1e3),
7608
+ input.store.listHarnessImprovementArtifacts(workspace.id, "observation", 1e3),
7609
+ input.store.listHarnessImprovementArtifacts(workspace.id, "apply_receipt", 1e3)
7610
+ ]);
7611
+ const latestReview = reviews[0] ?? null;
7612
+ const previousWatermark = request.previousWatermark ?? latestReview?.nextWatermark ?? null;
7613
+ const typedRoutes = routes;
7614
+ const typedTriggers = triggers;
7615
+ const typedObservations = observations;
7616
+ const typedApplyReceipts = applyReceipts;
7617
+ if (request.previousWatermark === void 0 && latestReview && !typedRoutes.some((route) => route.createdAt > latestReview.nextWatermark.throughCreatedAt)) {
7618
+ return latestReview;
7619
+ }
7620
+ const triggerByRef = new Map(
7621
+ typedTriggers.map((trigger) => [artifactKey(trigger), trigger])
7622
+ );
7623
+ const observationByRef = new Map(
7624
+ typedObservations.map((observation) => [artifactKey(observation), observation])
7625
+ );
7626
+ const policyBySource = new Map(request.sourcePolicies.map((policy) => [policy.sourceRef, policy]));
7627
+ const excludedEvidence = [];
7628
+ const candidates = [];
7629
+ let examined = 0;
7630
+ let estimatedTokens = 0;
7631
+ for (const routeDecision of typedRoutes.slice().sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id))) {
7632
+ if (performance.now() - startedAt >= request.limits.maxDurationMs) {
7633
+ excludedEvidence.push({
7634
+ evidence: artifactRef(routeDecision),
7635
+ sourcePolicy: null,
7636
+ reason: "budget"
7637
+ });
7638
+ continue;
7639
+ }
7640
+ if (previousWatermark && routeDecision.createdAt <= previousWatermark.throughCreatedAt) {
7641
+ excludedEvidence.push({
7642
+ evidence: artifactRef(routeDecision),
7643
+ sourcePolicy: null,
7644
+ reason: "before_watermark"
7645
+ });
7646
+ continue;
7647
+ }
7648
+ if (examined >= request.limits.maxEvidence) {
7649
+ excludedEvidence.push({
7650
+ evidence: artifactRef(routeDecision),
7651
+ sourcePolicy: null,
7652
+ reason: "budget"
7653
+ });
7654
+ continue;
7655
+ }
7656
+ examined += 1;
7657
+ const trigger = triggerByRef.get(artifactKey(routeDecision.trigger));
7658
+ if (!trigger) {
7659
+ excludedEvidence.push({
7660
+ evidence: artifactRef(routeDecision),
7661
+ sourcePolicy: null,
7662
+ reason: "unverified"
7663
+ });
7664
+ continue;
7665
+ }
7666
+ const observation = trigger.observations.map((reference) => observationByRef.get(artifactKey(reference)) ?? null).find((candidate) => candidate !== null) ?? null;
7667
+ const proposalId = typeof routeDecision.metadata.proposalId === "string" ? routeDecision.metadata.proposalId : null;
7668
+ if (proposalId && typedApplyReceipts.some(
7669
+ (receipt2) => receipt2.proposal.id === proposalId && receipt2.decision === "applied"
7670
+ )) {
7671
+ excludedEvidence.push({
7672
+ evidence: artifactRef(routeDecision),
7673
+ sourcePolicy: null,
7674
+ reason: "resolved"
7675
+ });
7676
+ continue;
7677
+ }
7678
+ const candidateTokens = Math.ceil(JSON.stringify({ routeDecision, trigger, observation }).length / 4);
7679
+ if (estimatedTokens + candidateTokens > request.limits.maxTokens) {
7680
+ excludedEvidence.push({
7681
+ evidence: artifactRef(routeDecision),
7682
+ sourcePolicy: null,
7683
+ reason: "budget"
7684
+ });
7685
+ continue;
7686
+ }
7687
+ estimatedTokens += candidateTokens;
7688
+ const sourceRef = observation?.runRef ?? trigger.runRef;
7689
+ const policy = policyBySource.get(sourceRef);
7690
+ if (!policy || policy.state !== "authorized") {
7691
+ excludedEvidence.push({
7692
+ evidence: artifactRef(routeDecision),
7693
+ sourcePolicy: policy ? sourcePolicyRef(policy) : null,
7694
+ reason: policy && policy.state !== "authorized" ? policy.state : "unverified"
7695
+ });
7696
+ continue;
7697
+ }
7698
+ candidates.push({
7699
+ route: routeDecision.route,
7700
+ family: recurrenceFamily(routeDecision.route, trigger, observation),
7701
+ routeDecision,
7702
+ trigger,
7703
+ observation,
7704
+ sourceRef
7705
+ });
7706
+ }
7707
+ const deduplicated = deduplicateCandidates(candidates, excludedEvidence, policyBySource);
7708
+ const grouped = groupCandidates(deduplicated);
7709
+ const chosen = [...grouped.entries()].map(([family, items]) => ({ family, items })).sort((left, right) => right.items.length - left.items.length || left.family.localeCompare(right.family))[0] ?? null;
7710
+ const decision = classify(chosen?.items ?? []);
7711
+ const selectedEvidence = decision.classification === "no_action" ? [] : (chosen?.items ?? []).map((candidate) => evidenceRef(candidate, policyBySource.get(candidate.sourceRef)));
7712
+ const createdAt = (input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString()))();
7713
+ const examinedCreatedAt = typedRoutes.filter((route) => !previousWatermark || route.createdAt > previousWatermark.throughCreatedAt).slice(0, request.limits.maxEvidence).map((route) => route.createdAt).sort().at(-1);
7714
+ const throughCreatedAt = maxTimestamp(previousWatermark?.throughCreatedAt, examinedCreatedAt, createdAt);
7715
+ const cursor = contentHash({
7716
+ previousCursor: previousWatermark?.cursor ?? null,
7717
+ throughCreatedAt,
7718
+ examined: typedRoutes.filter((route) => !previousWatermark || route.createdAt > previousWatermark.throughCreatedAt).slice(0, request.limits.maxEvidence).map(artifactRef)
7719
+ });
7720
+ const receiptId = `evaluation-review-${contentHash({
7721
+ workspaceId: workspace.id,
7722
+ harnessRelease: selectedRelease.harnessRelease,
7723
+ previousWatermark,
7724
+ cursor
7725
+ }).slice(0, 24)}`;
7726
+ const receipt = createHarnessEvaluationReviewReceipt({
7727
+ schemaVersion: "openpond.harnessEvaluationReviewReceipt.v1",
7728
+ id: receiptId,
7729
+ ownerScope: workspace.ownerScope,
7730
+ workspaceRef: workspace.id,
7731
+ harnessRelease: artifactRef(selectedRelease.harnessRelease),
7732
+ previousWatermark,
7733
+ nextWatermark: { cursor, throughCreatedAt },
7734
+ selectedEvidence,
7735
+ excludedEvidence,
7736
+ claim: decision.classification === "no_action" || !chosen ? null : {
7737
+ fingerprint: contentHash({ family: chosen.family, evidence: selectedEvidence.map((item) => item.occurrenceKey) }),
7738
+ recurrenceFamily: chosen.family,
7739
+ statement: decision.reason,
7740
+ independentOccurrences: new Set(chosen.items.map((item) => item.sourceRef)).size,
7741
+ unresolvedOccurrences: new Set(chosen.items.map((item) => item.sourceRef)).size
7742
+ },
7743
+ classification: decision.classification,
7744
+ triage: decision.classification === "no_action" ? [] : [{
7745
+ layer: triageLayer(decision.classification),
7746
+ status: "unresolved",
7747
+ reason: decision.reason,
7748
+ evidenceRefs: selectedEvidence.map((item) => item.evidence)
7749
+ }],
7750
+ reason: decision.reason,
7751
+ nextAuthority: nextAuthority(decision.classification),
7752
+ maxEstimatedCostUsd: request.limits.maxEstimatedCostUsd,
7753
+ tasksetProposal: null,
7754
+ evaluation: null,
7755
+ trainingQualification: null,
7756
+ policyVersion: "local-harness-evaluation-review-v1",
7757
+ createdAt,
7758
+ metadata: {
7759
+ examinedEvidence: examined,
7760
+ estimatedTokens,
7761
+ elapsedMs: performance.now() - startedAt,
7762
+ explicitInvocation: true
7763
+ }
7764
+ });
7765
+ await input.store.saveHarnessImprovementArtifact(workspace.id, "evaluation_review", receipt);
7766
+ return receipt;
7767
+ }
7768
+ function artifactRef(artifact) {
7769
+ return { id: artifact.id, contentHash: artifact.contentHash };
7770
+ }
7771
+ function artifactKey(artifact) {
7772
+ return `${artifact.id}:${artifact.contentHash}`;
7773
+ }
7774
+ function sourcePolicyRef(policy) {
7775
+ return { policy: policy.policy, state: policy.state, checkedAt: policy.checkedAt };
7776
+ }
7777
+ function recurrenceFamily(route, trigger, observation) {
7778
+ return [
7779
+ route,
7780
+ observation?.deterministicClass ?? "unclassified",
7781
+ observation?.tool?.name ?? trigger.deduplicationKey,
7782
+ observation?.state ?? "unknown-state"
7783
+ ].join(":");
7784
+ }
7785
+ function deduplicateCandidates(candidates, excluded, policies) {
7786
+ const seen = /* @__PURE__ */ new Set();
7787
+ return candidates.filter((candidate) => {
7788
+ const key = `${candidate.family}:${candidate.sourceRef}`;
7789
+ if (!seen.has(key)) {
7790
+ seen.add(key);
7791
+ return true;
7792
+ }
7793
+ excluded.push({
7794
+ evidence: artifactRef(candidate.routeDecision),
7795
+ sourcePolicy: sourcePolicyRef(policies.get(candidate.sourceRef)),
7796
+ reason: "duplicate"
7797
+ });
7798
+ return false;
7799
+ });
7800
+ }
7801
+ function groupCandidates(candidates) {
7802
+ const groups = /* @__PURE__ */ new Map();
7803
+ for (const candidate of candidates) {
7804
+ groups.set(candidate.family, [...groups.get(candidate.family) ?? [], candidate]);
7805
+ }
7806
+ return groups;
7807
+ }
7808
+ function evidenceRef(candidate, policy) {
7809
+ return {
7810
+ evidence: artifactRef(candidate.routeDecision),
7811
+ kind: "route_decision",
7812
+ sourceRef: candidate.sourceRef,
7813
+ sourcePolicy: sourcePolicyRef(policy),
7814
+ occurrenceKey: contentHash({ family: candidate.family, sourceRef: candidate.sourceRef }),
7815
+ occurredAt: candidate.routeDecision.createdAt
7816
+ };
7817
+ }
7818
+ function classify(items) {
7819
+ if (items.length === 0) {
7820
+ return { classification: "no_action", reason: "No authorized unresolved evidence qualified for action." };
7821
+ }
7822
+ const route = items[0].route;
7823
+ if (route === "runtime") {
7824
+ return { classification: "runtime", reason: "Authorized unresolved evidence belongs to the runtime-service layer." };
7825
+ }
7826
+ if (route === "product") {
7827
+ return { classification: "product", reason: "Authorized unresolved evidence belongs to the product layer." };
7828
+ }
7829
+ if (route === "taskset" || route === "training") {
7830
+ if (items.length >= 3) {
7831
+ return { classification: "taskset", reason: "Three or more independent unresolved occurrences qualify for Taskset proposal review." };
7832
+ }
7833
+ return { classification: "no_action", reason: "Taskset evidence has not met the three-occurrence recurrence threshold." };
7834
+ }
7835
+ return { classification: "harness_maintenance", reason: "Authorized unresolved evidence belongs to Harness maintenance." };
7836
+ }
7837
+ function nextAuthority(classification) {
7838
+ if (classification === "runtime") return "runtime_service";
7839
+ if (classification === "product") return "product_team";
7840
+ if (classification === "taskset") return "human_review";
7841
+ if (classification === "harness_maintenance") return "human_review";
7842
+ if (classification === "model_improvement") return "training_system";
7843
+ return "none";
7844
+ }
7845
+ function triageLayer(classification) {
7846
+ if (classification === "runtime") return "runtime";
7847
+ if (classification === "product") return "product";
7848
+ if (classification === "taskset") return "evaluation";
7849
+ if (classification === "model_improvement") return "model";
7850
+ return "harness";
7851
+ }
7852
+ function maxTimestamp(...values) {
7853
+ return values.filter((value) => Boolean(value)).sort().at(-1);
7854
+ }
7855
+
7856
+ // ../server/src/harness/local-harness-evaluation-review-host.ts
7857
+ var SOURCE_POLICY_VERSION = "local-personal-work-v1";
7858
+ async function reviewSelectedLocalHarnessEvaluationFromHost(input) {
7859
+ const selected = await resolveSelectedLocalHarnessRelease(input.store);
7860
+ if (!selected || selected.workspaceId !== input.workspaceId) {
7861
+ throw new Error("Evaluation review requires the selected Personal Local Harness.");
7862
+ }
7863
+ const workspace = await input.store.getHarnessWorkspace(input.workspaceId);
7864
+ if (!workspace || workspace.ownerScope.kind !== "personal" || workspace.location !== "local") {
7865
+ throw new Error("Evaluation review requires the selected Personal Local Harness.");
7866
+ }
7867
+ const [observations, triggers] = await Promise.all([
7868
+ input.store.listHarnessImprovementArtifacts(input.workspaceId, "observation", 1e4),
7869
+ input.store.listHarnessImprovementArtifacts(input.workspaceId, "trigger_decision", 1e4)
7870
+ ]);
7871
+ const sourceRefs = /* @__PURE__ */ new Set([
7872
+ ...observations.map((observation) => observation.runRef),
7873
+ ...triggers.map((trigger) => trigger.runRef)
7874
+ ]);
7875
+ const checkedAt = (input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString()))();
7876
+ const sourcePolicies = await Promise.all([...sourceRefs].sort().map(async (sourceRef) => {
7877
+ const session = await input.store.getSession(sourceRef);
7878
+ return {
7879
+ sourceRef,
7880
+ policy: {
7881
+ id: `source-policy-${contentHash({
7882
+ workspaceId: input.workspaceId,
7883
+ sourceRef,
7884
+ policyVersion: SOURCE_POLICY_VERSION
7885
+ }).slice(0, 24)}`,
7886
+ contentHash: contentHash({
7887
+ workspaceId: input.workspaceId,
7888
+ sourceRef,
7889
+ policyVersion: SOURCE_POLICY_VERSION
7890
+ })
7891
+ },
7892
+ state: session ? "authorized" : "deleted",
7893
+ checkedAt
7894
+ };
7895
+ }));
7896
+ return reviewSelectedLocalHarnessEvaluation({
7897
+ store: input.store,
7898
+ request: {
7899
+ sourcePolicies,
7900
+ limits: {
7901
+ maxEvidence: 200,
7902
+ maxTokens: 5e4,
7903
+ maxDurationMs: 5e3,
7904
+ maxEstimatedCostUsd: input.maxEstimatedCostUsd
7905
+ }
7906
+ },
7907
+ now: input.now
7908
+ });
7909
+ }
7910
+
7911
+ // ../server/src/harness/local-harness-evaluation-review-scheduler.ts
7912
+ var DEFAULT_TICK_MS = 15e3;
7913
+ function nextHarnessEvaluationReviewRunAt(cadence, from) {
7914
+ if (cadence === "manual") return null;
7915
+ const next = new Date(from);
7916
+ next.setUTCDate(next.getUTCDate() + (cadence === "daily" ? 1 : 7));
7917
+ return next.toISOString();
7918
+ }
7919
+ function createLocalHarnessEvaluationReviewScheduler(input) {
7920
+ let interval = null;
7921
+ let active = null;
7922
+ const now2 = input.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
7923
+ async function runDueNow() {
7924
+ if (active) return active;
7925
+ active = (async () => {
7926
+ const workspace = await input.store.getSelectedHarnessWorkspace({
7927
+ ownerKind: "personal",
7928
+ ownerId: DESKTOP_PERSONAL_HARNESS_OWNER_ID
7929
+ });
7930
+ if (!workspace) return null;
7931
+ const settings = await input.store.getHarnessEvaluationReviewSettings(workspace.id);
7932
+ const startedAt = now2();
7933
+ if (!settings.enabled || settings.cadence === "manual" || !settings.nextRunAt || settings.nextRunAt > startedAt) return null;
7934
+ const claimed = {
7935
+ ...settings,
7936
+ nextRunAt: nextHarnessEvaluationReviewRunAt(settings.cadence, startedAt),
7937
+ lastRunAt: startedAt,
7938
+ lastError: null,
7939
+ updatedAt: startedAt
7940
+ };
7941
+ await input.store.setHarnessEvaluationReviewSettings({
7942
+ workspaceId: workspace.id,
7943
+ settings: claimed
7944
+ });
7945
+ try {
7946
+ const receipt = await reviewSelectedLocalHarnessEvaluationFromHost({
7947
+ store: input.store,
7948
+ workspaceId: workspace.id,
7949
+ maxEstimatedCostUsd: settings.maxEstimatedCostUsd,
7950
+ now: now2
7951
+ });
7952
+ await input.store.setHarnessEvaluationReviewSettings({
7953
+ workspaceId: workspace.id,
7954
+ settings: {
7955
+ ...claimed,
7956
+ lastResult: {
7957
+ id: receipt.id,
7958
+ contentHash: receipt.contentHash,
7959
+ classification: receipt.classification
7960
+ },
7961
+ updatedAt: now2()
7962
+ }
7963
+ });
7964
+ input.logger?.info("Harness evaluation review schedule completed", {
7965
+ workspaceId: workspace.id,
7966
+ reviewId: receipt.id,
7967
+ classification: receipt.classification
7968
+ });
7969
+ return receipt;
7970
+ } catch (error) {
7971
+ const message = error instanceof Error ? error.message : String(error);
7972
+ await input.store.setHarnessEvaluationReviewSettings({
7973
+ workspaceId: workspace.id,
7974
+ settings: { ...claimed, lastError: message, updatedAt: now2() }
7975
+ });
7976
+ input.logger?.warn("Harness evaluation review schedule failed", {
7977
+ workspaceId: workspace.id,
7978
+ error: message
7979
+ });
7980
+ return null;
7981
+ }
7982
+ })().finally(() => {
7983
+ active = null;
7984
+ });
7985
+ return active;
7986
+ }
7987
+ return {
7988
+ start() {
7989
+ if (interval) return;
7990
+ interval = setInterval(() => {
7991
+ if (!input.isClosing()) void runDueNow();
7992
+ }, input.tickMs ?? DEFAULT_TICK_MS);
7993
+ interval.unref?.();
7994
+ void runDueNow();
7995
+ },
7996
+ async stop() {
7997
+ if (interval) clearInterval(interval);
7998
+ interval = null;
7999
+ await active;
8000
+ },
8001
+ runDueNow
8002
+ };
8003
+ }
8004
+
7400
8005
  // ../server/src/harness/local-harness-history.ts
7401
8006
  function createLocalHarnessSettingsRoutePayloads(input) {
7402
8007
  return {
@@ -7405,6 +8010,14 @@ function createLocalHarnessSettingsRoutePayloads(input) {
7405
8010
  store: input.store,
7406
8011
  request: parseHarnessBackgroundReviewRequest(payload)
7407
8012
  }),
8013
+ reviewHarnessEvaluationPayload: (payload) => reviewLocalHarnessEvaluationFromSettings({
8014
+ store: input.store,
8015
+ request: parseHarnessEvaluationReviewRequest(payload)
8016
+ }),
8017
+ updateHarnessEvaluationReviewSchedulePayload: (payload) => updateLocalHarnessEvaluationReviewScheduleFromSettings({
8018
+ store: input.store,
8019
+ request: parseHarnessEvaluationReviewScheduleRequest(payload)
8020
+ }),
7408
8021
  harnessDiffPayload: (payload) => localHarnessReleaseDiffPayload({
7409
8022
  ...input,
7410
8023
  request: parseHarnessReleaseDiffRequest(payload)
@@ -7419,6 +8032,37 @@ function createLocalHarnessSettingsRoutePayloads(input) {
7419
8032
  })
7420
8033
  };
7421
8034
  }
8035
+ function parseHarnessEvaluationReviewRequest(payload) {
8036
+ if (!payload || typeof payload !== "object") {
8037
+ throw new Error("Harness evaluation review requires a workspace.");
8038
+ }
8039
+ const record5 = payload;
8040
+ if (typeof record5.workspaceId !== "string") {
8041
+ throw new Error("Harness evaluation review requires a workspace.");
8042
+ }
8043
+ if (record5.maxEstimatedCostUsd !== void 0 && (typeof record5.maxEstimatedCostUsd !== "number" || !Number.isFinite(record5.maxEstimatedCostUsd) || record5.maxEstimatedCostUsd < 0)) {
8044
+ throw new Error("Harness evaluation review cost must be a non-negative number.");
8045
+ }
8046
+ return {
8047
+ workspaceId: record5.workspaceId,
8048
+ maxEstimatedCostUsd: record5.maxEstimatedCostUsd
8049
+ };
8050
+ }
8051
+ function parseHarnessEvaluationReviewScheduleRequest(payload) {
8052
+ if (!payload || typeof payload !== "object") {
8053
+ throw new Error("Harness evaluation review schedule requires a workspace and cadence.");
8054
+ }
8055
+ const record5 = payload;
8056
+ if (typeof record5.workspaceId !== "string" || typeof record5.enabled !== "boolean" || record5.cadence !== "manual" && record5.cadence !== "daily" && record5.cadence !== "weekly" || typeof record5.maxEstimatedCostUsd !== "number" || !Number.isFinite(record5.maxEstimatedCostUsd) || record5.maxEstimatedCostUsd < 0) {
8057
+ throw new Error("Harness evaluation review schedule requires a valid workspace, cadence, and cost limit.");
8058
+ }
8059
+ return {
8060
+ workspaceId: record5.workspaceId,
8061
+ enabled: record5.enabled,
8062
+ cadence: record5.cadence,
8063
+ maxEstimatedCostUsd: record5.maxEstimatedCostUsd
8064
+ };
8065
+ }
7422
8066
  function parseHarnessBackgroundReviewRequest(payload) {
7423
8067
  if (!payload || typeof payload !== "object") {
7424
8068
  throw new Error("Harness background review requires a workspace and enabled state.");
@@ -7499,30 +8143,48 @@ async function localHarnessHistoryPayload(store) {
7499
8143
  return {
7500
8144
  workspace: null,
7501
8145
  backgroundReview: { enabled: true, updatedAt: null },
8146
+ evaluationReviewSchedule: {
8147
+ enabled: false,
8148
+ cadence: "manual",
8149
+ maxEstimatedCostUsd: 0,
8150
+ nextRunAt: null,
8151
+ lastRunAt: null,
8152
+ lastResult: null,
8153
+ lastError: null,
8154
+ updatedAt: null
8155
+ },
7502
8156
  releases: [],
7503
8157
  changes: [],
7504
8158
  routes: [],
8159
+ evaluationReviews: [],
8160
+ modelImprovementQualifications: [],
7505
8161
  pendingReviews: [],
7506
8162
  memories: []
7507
8163
  };
7508
8164
  }
7509
8165
  const [
7510
8166
  backgroundReview,
8167
+ evaluationReviewSchedule,
7511
8168
  releaseRecords,
7512
8169
  receipts,
7513
8170
  proposals,
7514
8171
  validations,
7515
8172
  routeDecisions,
8173
+ evaluationReviews,
8174
+ modelImprovementQualifications,
7516
8175
  applyReceipts,
7517
8176
  outcomes,
7518
8177
  triggers
7519
8178
  ] = await Promise.all([
7520
8179
  store.getHarnessBackgroundReviewSettings(workspace.id),
8180
+ store.getHarnessEvaluationReviewSettings(workspace.id),
7521
8181
  store.listHarnessReleaseRecords(workspace.id),
7522
8182
  store.listHarnessAdvanceReceipts(workspace.id),
7523
8183
  store.listHarnessImprovementArtifacts(workspace.id, "proposal", 1e3),
7524
8184
  store.listHarnessImprovementArtifacts(workspace.id, "targeted_validation", 1e3),
7525
8185
  store.listHarnessImprovementArtifacts(workspace.id, "route_decision", 1e3),
8186
+ store.listHarnessImprovementArtifacts(workspace.id, "evaluation_review", 1e3),
8187
+ store.listHarnessImprovementArtifacts(workspace.id, "training_qualification", 1e3),
7526
8188
  store.listHarnessImprovementArtifacts(workspace.id, "apply_receipt", 1e3),
7527
8189
  store.listHarnessImprovementArtifacts(workspace.id, "refiner_outcome", 1e3),
7528
8190
  store.listHarnessImprovementArtifacts(workspace.id, "trigger_decision", 1e3)
@@ -7595,6 +8257,7 @@ async function localHarnessHistoryPayload(store) {
7595
8257
  return {
7596
8258
  workspace,
7597
8259
  backgroundReview,
8260
+ evaluationReviewSchedule,
7598
8261
  releases: releaseRecords.map((record5) => ({
7599
8262
  id: record5.harnessRelease.id,
7600
8263
  contentHash: record5.harnessRelease.contentHash,
@@ -7611,10 +8274,65 @@ async function localHarnessHistoryPayload(store) {
7611
8274
  })),
7612
8275
  changes,
7613
8276
  routes,
8277
+ evaluationReviews,
8278
+ modelImprovementQualifications,
7614
8279
  pendingReviews,
7615
8280
  memories: await store.listHarnessMemories(workspace.id)
7616
8281
  };
7617
8282
  }
8283
+ async function reviewLocalHarnessEvaluationFromSettings(input) {
8284
+ const settings = await input.store.getHarnessEvaluationReviewSettings(input.request.workspaceId);
8285
+ const receipt = await reviewSelectedLocalHarnessEvaluationFromHost({
8286
+ store: input.store,
8287
+ workspaceId: input.request.workspaceId,
8288
+ maxEstimatedCostUsd: input.request.maxEstimatedCostUsd ?? settings.maxEstimatedCostUsd
8289
+ });
8290
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
8291
+ await input.store.setHarnessEvaluationReviewSettings({
8292
+ workspaceId: input.request.workspaceId,
8293
+ settings: {
8294
+ ...settings,
8295
+ lastRunAt: timestamp,
8296
+ lastResult: {
8297
+ id: receipt.id,
8298
+ contentHash: receipt.contentHash,
8299
+ classification: receipt.classification
8300
+ },
8301
+ lastError: null,
8302
+ updatedAt: timestamp
8303
+ }
8304
+ });
8305
+ return { receipt, history: await localHarnessHistoryPayload(input.store) };
8306
+ }
8307
+ async function updateLocalHarnessEvaluationReviewScheduleFromSettings(input) {
8308
+ const workspace = await input.store.getHarnessWorkspace(input.request.workspaceId);
8309
+ if (!workspace || workspace.ownerScope.kind !== "personal" || workspace.location !== "local") {
8310
+ throw new Error("Evaluation review schedule requires the selected Personal Local Harness.");
8311
+ }
8312
+ const selected = await input.store.getSelectedHarnessWorkspace({
8313
+ ownerKind: "personal",
8314
+ ownerId: DESKTOP_PERSONAL_HARNESS_OWNER_ID
8315
+ });
8316
+ if (selected?.id !== workspace.id) {
8317
+ throw new Error("Evaluation review schedule requires the selected Personal Local Harness.");
8318
+ }
8319
+ const previous = await input.store.getHarnessEvaluationReviewSettings(workspace.id);
8320
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
8321
+ const enabled = input.request.enabled && input.request.cadence !== "manual";
8322
+ await input.store.setHarnessEvaluationReviewSettings({
8323
+ workspaceId: workspace.id,
8324
+ settings: {
8325
+ ...previous,
8326
+ enabled,
8327
+ cadence: input.request.cadence,
8328
+ maxEstimatedCostUsd: input.request.maxEstimatedCostUsd,
8329
+ nextRunAt: enabled ? nextHarnessEvaluationReviewRunAt(input.request.cadence, timestamp) : null,
8330
+ lastError: null,
8331
+ updatedAt: timestamp
8332
+ }
8333
+ });
8334
+ return { history: await localHarnessHistoryPayload(input.store) };
8335
+ }
7618
8336
  async function updateLocalHarnessBackgroundReviewFromSettings(input) {
7619
8337
  const workspace = await input.store.getHarnessWorkspace(input.request.workspaceId);
7620
8338
  if (!workspace || workspace.ownerScope.kind !== "personal" || workspace.location !== "local") {
@@ -13653,8 +14371,8 @@ function normalizeSearchApiUrl(value) {
13653
14371
  if (url.protocol !== "http:" && url.protocol !== "https:") {
13654
14372
  throw new Error("Hosted web search endpoint must use http or https.");
13655
14373
  }
13656
- if (url.hostname === "api.staging-api.openpond.ai" || url.hostname === "staging-api.openpond.ai") {
13657
- url.hostname = "api-new.staging-api.openpond.ai";
14374
+ if (url.hostname === "api.staging-api.openpond.ai" || url.hostname === "api-new.staging-api.openpond.ai") {
14375
+ url.hostname = "staging-api.openpond.ai";
13658
14376
  }
13659
14377
  const segments = url.pathname.split("/").filter(Boolean);
13660
14378
  const opchatIndex = segments.findIndex((segment) => segment.toLowerCase() === "opchat");
@@ -15355,8 +16073,8 @@ function checkResultRef(eventId, index) {
15355
16073
  function messageRef(eventId) {
15356
16074
  return `message:${eventId}`;
15357
16075
  }
15358
- function artifactResourceRef(eventId, artifactRef) {
15359
- return `artifact:${eventId}:${encodeURIComponent(artifactRef)}`;
16076
+ function artifactResourceRef(eventId, artifactRef2) {
16077
+ return `artifact:${eventId}:${encodeURIComponent(artifactRef2)}`;
15360
16078
  }
15361
16079
  function goalContextRef(identifier) {
15362
16080
  return `goal-context:${encodeURIComponent(identifier)}`;
@@ -20100,6 +20818,8 @@ function createAgentRuntimePorts(deps) {
20100
20818
  userInput: true,
20101
20819
  compaction: true,
20102
20820
  harnessInspection: true,
20821
+ harnessProposalReview: true,
20822
+ harnessEvaluationReview: true,
20103
20823
  harnessValidation: true,
20104
20824
  immutableHarnessAdmission: true,
20105
20825
  harnessBackgroundReview: true,
@@ -20123,11 +20843,12 @@ function createAgentRuntimePorts(deps) {
20123
20843
  interruptTurn: deps.interruptSessionTurn,
20124
20844
  resolveApproval: deps.resolveApproval,
20125
20845
  inspectHarness: deps.inspectHarness,
20846
+ reviewHarnessProposal: deps.reviewHarnessProposal,
20847
+ reviewHarness: deps.reviewHarness,
20126
20848
  validateHarness: deps.validateHarness,
20127
20849
  updateHarnessBackgroundReview: deps.updateHarnessBackgroundReview,
20128
20850
  diffHarness: deps.diffHarness,
20129
20851
  rollbackHarness: deps.rollbackHarness,
20130
- reviewHarnessProposal: deps.reviewHarnessProposal,
20131
20852
  subscribeEvents: deps.subscribeRuntimeEvents,
20132
20853
  eventNotification: runtimeEventNotification,
20133
20854
  telemetry: deps.observeRuntimeOperation
@@ -33126,7 +33847,7 @@ function uniqueEvidence(run, evidence) {
33126
33847
  }
33127
33848
  async function verifyAppliedProfileCommit(input) {
33128
33849
  const command = input.command ?? (async (name, args, cwd, env) => {
33129
- const { runWorkspaceCommand } = await import("./workspaces-ODFJT6HJ.js");
33850
+ const { runWorkspaceCommand } = await import("./workspaces-RKZVNT2A.js");
33130
33851
  return runWorkspaceCommand(name, args, cwd, env);
33131
33852
  });
33132
33853
  const result = await command("git", ["rev-parse", "HEAD"], input.repoPath);
@@ -40697,6 +41418,8 @@ async function createOpenPondAppServer(options = {}) {
40697
41418
  interruptSessionTurn: turnRunner.interruptSessionTurn,
40698
41419
  resolveApproval,
40699
41420
  inspectHarness: () => localHarnessHistoryPayload(store),
41421
+ reviewHarnessProposal: createLocalHarnessSettingsRoutePayloads({ store, storeDir }).reviewHarnessProposalPayload,
41422
+ reviewHarness: (request) => reviewSelectedLocalHarnessEvaluation({ store, request }),
40700
41423
  validateHarness: async () => {
40701
41424
  const release = await resolveSelectedLocalHarnessRelease(store);
40702
41425
  return release ? {
@@ -40712,7 +41435,6 @@ async function createOpenPondAppServer(options = {}) {
40712
41435
  updateHarnessBackgroundReview: harnessSettings.updateHarnessBackgroundReviewPayload,
40713
41436
  diffHarness: harnessSettings.harnessDiffPayload,
40714
41437
  rollbackHarness: harnessSettings.rollbackHarnessPayload,
40715
- reviewHarnessProposal: harnessSettings.reviewHarnessProposalPayload,
40716
41438
  subscribeRuntimeEvents,
40717
41439
  observeRuntimeOperation: (runtimeEvent) => {
40718
41440
  logger.info("agent runtime operation", runtimeEvent);
@@ -40782,6 +41504,8 @@ export {
40782
41504
  loadLocalHarnessRuntimeForAgentRun,
40783
41505
  ensureLocalHarnessRunOverlay,
40784
41506
  trimOutput,
41507
+ reviewSelectedLocalHarnessEvaluation,
41508
+ createLocalHarnessEvaluationReviewScheduler,
40785
41509
  createLocalHarnessSettingsRoutePayloads,
40786
41510
  createOpenAiSubscriptionAuthService,
40787
41511
  isOpenAiCompatibleProviderId,