@attalabs/vinaya 0.42.1 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/checks/bin/check-evidence-fresh.js +177 -152
  2. package/dist/checks/bin/check-registry-gates.js +10 -3
  3. package/dist/index.js +300 -173
  4. package/dist/lib/pre-push-cache-test-run.js +145 -144
  5. package/dist/lib/pre-push-changed-files.js +10 -3
  6. package/dist/lib/pre-push-progress-dir.js +169 -147
  7. package/dist/lib/pre-push-select-tests.js +16 -4
  8. package/dist/lib/push-progress-observer.js +169 -147
  9. package/dist/programs/archive.js +172 -148
  10. package/dist/programs/audit.js +169 -147
  11. package/dist/programs/check.js +172 -148
  12. package/dist/programs/commit-msg.js +172 -148
  13. package/dist/programs/dev-review-loop.js +300 -176
  14. package/dist/programs/dispatch.js +1905 -1877
  15. package/dist/programs/log-emit.js +172 -148
  16. package/dist/programs/log-selftest.js +172 -148
  17. package/dist/programs/log-send.js +172 -148
  18. package/dist/programs/pr-report.js +177 -152
  19. package/dist/programs/pr-snapshot.js +172 -148
  20. package/dist/programs/pr-verify-evidence.js +177 -152
  21. package/dist/programs/pr.js +172 -148
  22. package/dist/programs/review-post.js +172 -148
  23. package/dist/programs/review-status.js +180 -148
  24. package/dist/programs/run-engine.js +110594 -0
  25. package/dist/programs/supervised-command.js +67 -0
  26. package/dist/programs/sync.js +63 -39
  27. package/dist/programs/task-brief.js +174 -150
  28. package/dist/programs/task-sweep.js +244 -151
  29. package/dist/programs/task-tools-serve.js +260 -163
  30. package/dist/programs/tokens.js +172 -148
  31. package/dist/programs/waiver.js +172 -148
  32. package/dist/vinaya-strict/checks/registry.ts +1085 -0
  33. package/dist/vinaya-strict/executing/code-reviewer/README.md +3 -0
  34. package/dist/vinaya-strict/executing/code-reviewer/doctrine.md +185 -0
  35. package/dist/vinaya-strict/executing/code-reviewer/evals/README.md +1 -0
  36. package/dist/vinaya-strict/executing/code-reviewer/evals/code-reviewer-cases.json +280 -0
  37. package/dist/vinaya-strict/executing/code-reviewer/grants.yaml +22 -0
  38. package/dist/vinaya-strict/executing/code-reviewer/output.schema.json +93 -0
  39. package/dist/vinaya-strict/executing/code-reviewer/review-result.ts +347 -0
  40. package/dist/vinaya-strict/executing/dev-review.flow.yaml +103 -0
  41. package/dist/vinaya-strict/executing/developer/README.md +3 -0
  42. package/dist/vinaya-strict/executing/developer/developer-doctrine-shape.test.ts +69 -0
  43. package/dist/vinaya-strict/executing/developer/developer-turn-result.ts +286 -0
  44. package/dist/vinaya-strict/executing/developer/doctrine.md +111 -0
  45. package/dist/vinaya-strict/executing/developer/evals/README.md +1 -0
  46. package/dist/vinaya-strict/executing/developer/evals/developer-capability-cases.json +6275 -0
  47. package/dist/vinaya-strict/executing/developer/evals/developer-capability-held-out.json +11526 -0
  48. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.test.ts +498 -0
  49. package/dist/vinaya-strict/executing/developer/evals/developer-capability-suite.ts +1407 -0
  50. package/dist/vinaya-strict/executing/developer/grants.yaml +25 -0
  51. package/dist/vinaya-strict/executing/developer/output.schema.json +148 -0
  52. package/dist/vinaya-strict/executing/developer/reference.md +376 -0
  53. package/dist/vinaya-strict/executing/operator/doctrine.md +209 -0
  54. package/dist/vinaya-strict/executing/security-reviewer/README.md +3 -0
  55. package/dist/vinaya-strict/executing/security-reviewer/doctrine.md +171 -0
  56. package/dist/vinaya-strict/executing/security-reviewer/evals/README.md +1 -0
  57. package/dist/vinaya-strict/executing/security-reviewer/evals/security-reviewer-cases.json +141 -0
  58. package/dist/vinaya-strict/executing/security-reviewer/grants.yaml +22 -0
  59. package/dist/vinaya-strict/executing/security-reviewer/output.schema.json +93 -0
  60. package/dist/vinaya-strict/integration/config/vinaya-config-section.ts +1278 -0
  61. package/dist/vinaya-strict/integration/policies/vinaya-policies.ts +52 -0
  62. package/dist/vinaya-strict/integration/process/process-integration.ts +57 -0
  63. package/dist/vinaya-strict/loops/dev-review/v2/dev-review-v2.flow.yaml +136 -0
  64. package/dist/vinaya-strict/process.yaml +43 -0
  65. package/dist/vinaya-strict/retrospecting/archivist/doctrine.md +174 -0
  66. package/dist/vinaya-strict/retrospecting/tranche-archivist/doctrine.md +270 -0
  67. package/dist/vinaya-strict/thinking/architect/doctrine.md +110 -0
  68. package/dist/vinaya-strict/thinking/planner/doctrine.md +105 -0
  69. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.test.ts +128 -0
  70. package/dist/vinaya-strict/thinking/planner/tools/amend-rationale-deps.ts +169 -0
  71. package/dist/vinaya-strict/thinking/planner/tools/open-issue.test.ts +701 -0
  72. package/dist/vinaya-strict/thinking/planner/tools/open-issue.ts +1035 -0
  73. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.test.ts +359 -0
  74. package/dist/vinaya-strict/thinking/planner/tools/planner-operations.ts +815 -0
  75. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.test.ts +200 -0
  76. package/dist/vinaya-strict/thinking/planner/tools/planner-tools.ts +458 -0
  77. package/package.json +4 -2
  78. package/studio-standalone/apps/vinaya-studio/.next/BUILD_ID +1 -1
  79. package/studio-standalone/apps/vinaya-studio/.next/build-manifest.json +2 -2
  80. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.html +1 -1
  81. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.rsc +1 -1
  82. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/.next/server/middleware-build-manifest.js +1 -1
  86. package/studio-standalone/apps/vinaya-studio/.next/server/pages/500.html +1 -1
  87. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_buildManifest.js +0 -0
  88. /package/studio-standalone/apps/vinaya-studio/.next/static/{yFfoujElgbwPk-7KNS-kw → x2q88XfwsihlevulRhIvs}/_ssgManifest.js +0 -0
@@ -1188,6 +1188,138 @@ var init_resolve_repo = __esm(() => {
1188
1188
  };
1189
1189
  });
1190
1190
 
1191
+ // ../../harness/kernel/log/roles.ts
1192
+ function registerRole(name, role) {
1193
+ roles.set(name, role);
1194
+ }
1195
+ function registerTitle(name, title) {
1196
+ titles.set(name, title);
1197
+ }
1198
+ function isRole(value) {
1199
+ return value !== undefined && roles.has(value);
1200
+ }
1201
+ function lookupRole(name) {
1202
+ return roles.get(name);
1203
+ }
1204
+ function lookupTitle(name) {
1205
+ return roles.get(name)?.title ?? titles.get(name);
1206
+ }
1207
+ var roles, titles;
1208
+ var init_roles = __esm(() => {
1209
+ roles = new Map;
1210
+ titles = new Map;
1211
+ });
1212
+
1213
+ // ../../harness/kernel/log/envelope.ts
1214
+ import { createHash } from "node:crypto";
1215
+ function actorIdFromEnv(role) {
1216
+ return role === undefined || role === "" ? null : role;
1217
+ }
1218
+ function lineageFieldFromEnv(value) {
1219
+ return value === undefined || value === "" ? null : value;
1220
+ }
1221
+ function attemptFromEnv(value) {
1222
+ if (value === undefined || value === "")
1223
+ return null;
1224
+ const n = Number(value);
1225
+ return Number.isInteger(n) ? n : null;
1226
+ }
1227
+ function provenanceFor(input) {
1228
+ if (input.provenance)
1229
+ return input.provenance;
1230
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
1231
+ return "unavailable";
1232
+ if (input.env.role || input.env.task)
1233
+ return "env_correlated";
1234
+ return "unavailable";
1235
+ }
1236
+ function issueFromTask(task) {
1237
+ if (task === undefined || task === "")
1238
+ return null;
1239
+ const n = Number(task);
1240
+ return Number.isInteger(n) ? n : null;
1241
+ }
1242
+ function roundFromEnv(round) {
1243
+ if (round === undefined || round === "")
1244
+ return;
1245
+ const n = Number(round);
1246
+ return Number.isInteger(n) ? n : undefined;
1247
+ }
1248
+ function prFromEnv(pr) {
1249
+ if (pr === undefined || pr === "")
1250
+ return;
1251
+ const n = Number(pr);
1252
+ return Number.isInteger(n) && n > 0 ? n : undefined;
1253
+ }
1254
+ function buildHeader(input) {
1255
+ const role = isRole(input.env.role) ? input.env.role : "unattributed";
1256
+ const round = roundFromEnv(input.env.round);
1257
+ const pr = prFromEnv(input.env.pr);
1258
+ const subject = {
1259
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
1260
+ role,
1261
+ ...round !== undefined ? { round } : {},
1262
+ ...pr !== undefined ? { pr } : {},
1263
+ ...input.subject ?? {}
1264
+ };
1265
+ const issue = subject.issue;
1266
+ return {
1267
+ meta: {
1268
+ schema: 4,
1269
+ ts: input.now.toISOString(),
1270
+ run_id: input.runId,
1271
+ seq: input.seq,
1272
+ repo: input.repo,
1273
+ vinaya: input.vinaya,
1274
+ doctrine: input.doctrine,
1275
+ host: input.host,
1276
+ machine: createHash("sha256").update(input.hostname).digest("hex"),
1277
+ event_id: input.eventId,
1278
+ process_id: input.processId,
1279
+ actor_id: actorIdFromEnv(input.env.role),
1280
+ lineage: {
1281
+ run: lineageFieldFromEnv(input.env.run),
1282
+ attempt: attemptFromEnv(input.env.attempt),
1283
+ parent: lineageFieldFromEnv(input.env.parent)
1284
+ },
1285
+ input_versions: {
1286
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
1287
+ objectives_version: input.inputVersions?.objectivesVersion ?? null,
1288
+ brief_hash: input.inputVersions?.briefHash ?? null,
1289
+ ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
1290
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
1291
+ policy_digest: input.inputVersions?.policyDigest ?? null
1292
+ },
1293
+ provenance: provenanceFor(input),
1294
+ work: {
1295
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
1296
+ repo: input.repo,
1297
+ change: pr === undefined ? null : String(pr),
1298
+ revision: input.revision ?? null
1299
+ },
1300
+ flow: {
1301
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
1302
+ version: lineageFieldFromEnv(input.env.flowVersion)
1303
+ },
1304
+ runtime: lineageFieldFromEnv(input.env.runtime),
1305
+ process: {
1306
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
1307
+ version: lineageFieldFromEnv(input.env.processVersion),
1308
+ digest: lineageFieldFromEnv(input.env.processDigest)
1309
+ },
1310
+ runner: {
1311
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
1312
+ version: lineageFieldFromEnv(input.env.runnerVersion)
1313
+ },
1314
+ source: lineageFieldFromEnv(input.env.source)
1315
+ },
1316
+ subject
1317
+ };
1318
+ }
1319
+ var init_envelope = __esm(() => {
1320
+ init_roles();
1321
+ });
1322
+
1191
1323
  // ../../harness/kernel/log/custom.ts
1192
1324
  import { z } from "zod";
1193
1325
  var CUSTOM_EVENT_NAME_PATTERN, CUSTOM_EVENT_NAME_MAX_LENGTH = 64, CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya", CUSTOM_EVENT_MAX_FIELDS = 20, CUSTOM_FIELD_NAME_PATTERN, CUSTOM_FIELD_NAME_MAX_LENGTH = 64, CUSTOM_TEXT_MAX_LENGTH = 500, CUSTOM_WORD_PATTERN, CUSTOM_WORD_MAX_LENGTH = 64, CUSTOM_FIELD_MAX_WORDS = 50, CustomFieldTypeSchema, CustomEventDeclarationsSchema;
@@ -1245,19 +1377,11 @@ var init_custom = __esm(() => {
1245
1377
 
1246
1378
  // ../../harness/kernel/log/schema.ts
1247
1379
  import { z as z2 } from "zod";
1248
- var CONFIDENCE_REASON_MAX_LENGTH = 280, REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000, ROLE_VALUES, RoleSchema, HOST_VALUES, HostSchema, RUN_ID_PATTERN, headerMetaCore, HeaderMetaV1Schema, LineageSchema, InputVersionsSchema, ProvenanceSchema, HeaderMetaV2Schema, WorkSchema, FlowSchema, HeaderMetaV3Schema, HeaderMetaV4Schema, HeaderMetaSchema, SubjectSchema, HeaderSchema, envelopeTail, ReviewFindingSchema, DispatchOutcomeSchema, dispatchShared, dispatchUsageField, DispatchEventSchema, CODE_TOKEN_PATTERN, CodeTokenSchema, ReviewerVerdictSchema, loopShared, DevReviewLoopEventSchema, ForgeOpSchema, ForgeWriteTargetSchema, forgeWriteShared, ForgeWriteEventSchema, GateOutcomeSchema, gateShared, GateEventSchema, OperationResultSchema, operationShared, OperationEventSchema, UsageUnitsSchema, usageShared, UsageEventSchema, RoleAttemptOutcomeSchema, roleAttemptShared, RoleAttemptEventSchema, handoffShared, HandoffEventSchema, EffectTargetSchema, effectShared, EffectEventSchema, CustomFieldValueSchema, customShared, CustomEventSchema, LogEventSchema;
1380
+ var CONFIDENCE_REASON_MAX_LENGTH = 280, REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000, ROLE_NAME_PATTERN, RoleSchema, HOST_VALUES, HostSchema, RUN_ID_PATTERN, headerMetaCore, HeaderMetaV1Schema, LineageSchema, InputVersionsSchema, ProvenanceSchema, HeaderMetaV2Schema, WorkSchema, FlowSchema, HeaderMetaV3Schema, HeaderMetaV4Schema, HeaderMetaSchema, SubjectSchema, HeaderSchema, envelopeTail, ReviewFindingSchema, DispatchOutcomeSchema, dispatchShared, dispatchUsageField, DispatchEventSchema, CODE_TOKEN_PATTERN, CodeTokenSchema, ReviewerVerdictSchema, loopShared, DevReviewLoopEventSchema, ForgeOpSchema, ForgeWriteTargetSchema, forgeWriteShared, ForgeWriteEventSchema, GateOutcomeSchema, gateShared, GateEventSchema, OperationResultSchema, operationShared, OperationEventSchema, UsageUnitsSchema, usageShared, UsageEventSchema, RoleAttemptOutcomeSchema, roleAttemptShared, RoleAttemptEventSchema, handoffShared, HandoffEventSchema, EffectTargetSchema, effectShared, EffectEventSchema, CustomFieldValueSchema, customShared, CustomEventSchema, LogEventSchema;
1249
1381
  var init_schema = __esm(() => {
1250
1382
  init_custom();
1251
- ROLE_VALUES = [
1252
- "planner",
1253
- "developer",
1254
- "code-reviewer",
1255
- "security",
1256
- "principal",
1257
- "archivist",
1258
- "architect"
1259
- ];
1260
- RoleSchema = z2.enum(ROLE_VALUES);
1383
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
1384
+ RoleSchema = z2.string().regex(ROLE_NAME_PATTERN);
1261
1385
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
1262
1386
  HostSchema = z2.enum(HOST_VALUES);
1263
1387
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -1839,119 +1963,6 @@ var init_schema = __esm(() => {
1839
1963
  ]);
1840
1964
  });
1841
1965
 
1842
- // ../../harness/kernel/log/envelope.ts
1843
- import { createHash } from "node:crypto";
1844
- function isRole(value) {
1845
- return value !== undefined && ROLE_VALUES.includes(value);
1846
- }
1847
- function actorIdFromEnv(role) {
1848
- return role === undefined || role === "" ? null : role;
1849
- }
1850
- function lineageFieldFromEnv(value) {
1851
- return value === undefined || value === "" ? null : value;
1852
- }
1853
- function attemptFromEnv(value) {
1854
- if (value === undefined || value === "")
1855
- return null;
1856
- const n = Number(value);
1857
- return Number.isInteger(n) ? n : null;
1858
- }
1859
- function provenanceFor(input) {
1860
- if (input.provenance)
1861
- return input.provenance;
1862
- if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
1863
- return "unavailable";
1864
- if (input.env.role || input.env.task)
1865
- return "env_correlated";
1866
- return "unavailable";
1867
- }
1868
- function issueFromTask(task) {
1869
- if (task === undefined || task === "")
1870
- return null;
1871
- const n = Number(task);
1872
- return Number.isInteger(n) ? n : null;
1873
- }
1874
- function roundFromEnv(round) {
1875
- if (round === undefined || round === "")
1876
- return;
1877
- const n = Number(round);
1878
- return Number.isInteger(n) ? n : undefined;
1879
- }
1880
- function prFromEnv(pr) {
1881
- if (pr === undefined || pr === "")
1882
- return;
1883
- const n = Number(pr);
1884
- return Number.isInteger(n) && n > 0 ? n : undefined;
1885
- }
1886
- function buildHeader(input) {
1887
- const role = isRole(input.env.role) ? input.env.role : "unattributed";
1888
- const round = roundFromEnv(input.env.round);
1889
- const pr = prFromEnv(input.env.pr);
1890
- const subject = {
1891
- issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
1892
- role,
1893
- ...round !== undefined ? { round } : {},
1894
- ...pr !== undefined ? { pr } : {},
1895
- ...input.subject ?? {}
1896
- };
1897
- const issue = subject.issue;
1898
- return {
1899
- meta: {
1900
- schema: 4,
1901
- ts: input.now.toISOString(),
1902
- run_id: input.runId,
1903
- seq: input.seq,
1904
- repo: input.repo,
1905
- vinaya: input.vinaya,
1906
- doctrine: input.doctrine,
1907
- host: input.host,
1908
- machine: createHash("sha256").update(input.hostname).digest("hex"),
1909
- event_id: input.eventId,
1910
- process_id: input.processId,
1911
- actor_id: actorIdFromEnv(input.env.role),
1912
- lineage: {
1913
- run: lineageFieldFromEnv(input.env.run),
1914
- attempt: attemptFromEnv(input.env.attempt),
1915
- parent: lineageFieldFromEnv(input.env.parent)
1916
- },
1917
- input_versions: {
1918
- manifest_version: input.inputVersions?.manifestVersion ?? null,
1919
- objectives_version: input.inputVersions?.objectivesVersion ?? null,
1920
- brief_hash: input.inputVersions?.briefHash ?? null,
1921
- ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
1922
- pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
1923
- policy_digest: input.inputVersions?.policyDigest ?? null
1924
- },
1925
- provenance: provenanceFor(input),
1926
- work: {
1927
- ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
1928
- repo: input.repo,
1929
- change: pr === undefined ? null : String(pr),
1930
- revision: input.revision ?? null
1931
- },
1932
- flow: {
1933
- id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
1934
- version: lineageFieldFromEnv(input.env.flowVersion)
1935
- },
1936
- runtime: lineageFieldFromEnv(input.env.runtime),
1937
- process: {
1938
- id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
1939
- version: lineageFieldFromEnv(input.env.processVersion),
1940
- digest: lineageFieldFromEnv(input.env.processDigest)
1941
- },
1942
- runner: {
1943
- id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
1944
- version: lineageFieldFromEnv(input.env.runnerVersion)
1945
- },
1946
- source: lineageFieldFromEnv(input.env.source)
1947
- },
1948
- subject
1949
- };
1950
- }
1951
- var init_envelope = __esm(() => {
1952
- init_schema();
1953
- });
1954
-
1955
1966
  // ../../harness/kernel/log/redact.ts
1956
1967
  function redactString(value, home) {
1957
1968
  let out = value.replace(GITHUB_TOKEN_PATTERN, "<redacted>").replace(CLASSIC_GITHUB_PAT_PATTERN, "$1<redacted>").replace(BEARER_TOKEN_PATTERN, "<redacted>").replace(AWS_ACCESS_KEY_PATTERN, "<redacted>").replace(SLACK_TOKEN_PATTERN, "<redacted>").replace(STRIPE_KEY_PATTERN, "<redacted>").replace(ANTHROPIC_KEY_PATTERN, "<redacted>").replace(OPENAI_KEY_PATTERN, "<redacted>").replace(NPM_TOKEN_PATTERN, "<redacted>").replace(JWT_PATTERN, "<redacted>").replace(PEM_BLOCK_PATTERN, "<redacted>").replace(BASIC_AUTH_URL_PATTERN, "$1<redacted>@").replace(GENERIC_SECRET_ASSIGNMENT_PATTERN, "$1<redacted>");
@@ -2735,7 +2746,8 @@ function code(value) {
2735
2746
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
2736
2747
  }
2737
2748
  function roleSubject(value, sentenceStart = true) {
2738
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
2749
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
2750
+ const name = known ? `the ${known.reading}` : "a role";
2739
2751
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
2740
2752
  }
2741
2753
  function roundLabel(record) {
@@ -2854,7 +2866,7 @@ function conflictReentry(record) {
2854
2866
  function dispatched(record) {
2855
2867
  const role = text(record.target_role);
2856
2868
  const who = roleSubject(role);
2857
- const reviewing = role === "code-reviewer" || role === "security";
2869
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
2858
2870
  const round = whole(record.round);
2859
2871
  return {
2860
2872
  kind: "working",
@@ -2913,6 +2925,7 @@ function narrate(record, earlier = []) {
2913
2925
  }
2914
2926
  var REASONS, PAUSE_WITHOUT_CODE;
2915
2927
  var init_narration = __esm(() => {
2928
+ init_roles();
2916
2929
  init_schema();
2917
2930
  REASONS = {
2918
2931
  escalation: { words: "a role escalated a question", person: true },
@@ -2945,13 +2958,7 @@ var init_narration = __esm(() => {
2945
2958
 
2946
2959
  // ../../harness/kernel/adapters/agents/agent-line.ts
2947
2960
  function roleLabel(role) {
2948
- if (role in roleLabels)
2949
- return roleLabels[role];
2950
- if (role === "dev-review-loop")
2951
- return "Loop";
2952
- if (role === "operator")
2953
- return "Operator";
2954
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
2961
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
2955
2962
  }
2956
2963
  function formatLineMeta(meta) {
2957
2964
  if (meta === undefined)
@@ -2965,17 +2972,9 @@ function formatAgentLine(role, words, options = {}) {
2965
2972
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
2966
2973
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
2967
2974
  }
2968
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
2975
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
2969
2976
  var init_agent_line = __esm(() => {
2970
- roleLabels = {
2971
- planner: "Planner",
2972
- developer: "Developer",
2973
- "code-reviewer": "Code review",
2974
- security: "Security",
2975
- principal: "Principal",
2976
- archivist: "Archivist",
2977
- architect: "Architect"
2978
- };
2977
+ init_roles();
2979
2978
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
2980
2979
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
2981
2980
  META_KEY = /^[a-z]+$/;
@@ -6412,7 +6411,9 @@ var PROGRAMS = new Map([
6412
6411
  program("log-selftest", `${P}/integration/bin/log-selftest.ts`, "dist/programs/log-selftest.js", [
6413
6412
  words("log", "selftest")
6414
6413
  ]),
6415
- program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")])
6414
+ program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")]),
6415
+ program("run-engine", `${P}/bin/run-engine.ts`, "dist/programs/run-engine.js"),
6416
+ program("supervised-command", `${P}/loops/dev-review/v2/supervised-command.ts`, "dist/programs/supervised-command.js")
6416
6417
  ]);
6417
6418
  var SOURCE_ROOT = join10(dirname9(fileURLToPath3(import.meta.url)), "..", "..", "..", "..");
6418
6419
  var FROM_SOURCE = fileURLToPath3(import.meta.url).endsWith(".ts");
@@ -165,6 +165,8 @@ function parseHunkRanges(patch) {
165
165
  }
166
166
  return { beforeRanges, afterRanges };
167
167
  }
168
+ // ../../packages/test-selection/src/hunk-classes.ts
169
+ var LOAD_ERROR_CODES = new Set([2300, 2392, 2393, 2440, 2448, 2449, 2450, 2451]);
168
170
  // ../../packages/test-selection/src/compiler-graph.ts
169
171
  import { createRequire } from "node:module";
170
172
  import { dirname, join, resolve } from "node:path";
@@ -535,7 +537,12 @@ var AT_CALLS = new Set([
535
537
  "execveat"
536
538
  ]);
537
539
  var CLONE_CALLS = new Set(["clone", "clone3", "fork", "vfork"]);
540
+ var OPEN_CALLS = new Set(["open", "openat", "openat2", "creat"]);
538
541
  var GIT_PATH_READERS = new Set(["show", "cat-file", "rev-parse"]);
542
+ // ../../packages/test-selection/src/selector.ts
543
+ import { readdirSync, readFileSync, statSync } from "node:fs";
544
+ import { dirname as dirname4, extname, isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "node:path";
545
+
539
546
  // ../../packages/test-selection/src/scanner-inputs.ts
540
547
  import { dirname as dirname2, isAbsolute, join as join2, resolve as resolve2 } from "node:path";
541
548
  var TREE_READERS = new Set([
@@ -691,9 +698,6 @@ function startsProcessIn(ts, file, source, ranges) {
691
698
  ts.forEachChild(sourceFile, visit);
692
699
  return found;
693
700
  }
694
- // ../../packages/test-selection/src/selector.ts
695
- import { readdirSync, readFileSync, statSync } from "node:fs";
696
- import { dirname as dirname4, extname, isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "node:path";
697
701
 
698
702
  // ../../packages/test-selection/src/spawn-inputs.ts
699
703
  import { dirname as dirname3, isAbsolute as isAbsolute2, join as join3, resolve as resolve3 } from "node:path";
@@ -1823,6 +1827,9 @@ function reaches(start, edges, changed, maxDepth = Number.POSITIVE_INFINITY) {
1823
1827
  }
1824
1828
  return null;
1825
1829
  }
1830
+
1831
+ // ../../packages/test-selection/src/recorder.ts
1832
+ var RECORDER_TIME_LIMIT_MS = 15 * 60000;
1826
1833
  // ../../harness/kernel/connectors/git/remote-base.ts
1827
1834
  function cleanGitEnv() {
1828
1835
  const env = { ...process.env };