@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
@@ -2077,6 +2077,138 @@ var init_resolve_repo = __esm(() => {
2077
2077
  };
2078
2078
  });
2079
2079
 
2080
+ // ../../harness/kernel/log/roles.ts
2081
+ function registerRole(name, role) {
2082
+ roles.set(name, role);
2083
+ }
2084
+ function registerTitle(name, title) {
2085
+ titles.set(name, title);
2086
+ }
2087
+ function isRole(value) {
2088
+ return value !== undefined && roles.has(value);
2089
+ }
2090
+ function lookupRole(name) {
2091
+ return roles.get(name);
2092
+ }
2093
+ function lookupTitle(name) {
2094
+ return roles.get(name)?.title ?? titles.get(name);
2095
+ }
2096
+ var roles, titles;
2097
+ var init_roles = __esm(() => {
2098
+ roles = new Map;
2099
+ titles = new Map;
2100
+ });
2101
+
2102
+ // ../../harness/kernel/log/envelope.ts
2103
+ import { createHash as createHash3 } from "node:crypto";
2104
+ function actorIdFromEnv(role) {
2105
+ return role === undefined || role === "" ? null : role;
2106
+ }
2107
+ function lineageFieldFromEnv(value) {
2108
+ return value === undefined || value === "" ? null : value;
2109
+ }
2110
+ function attemptFromEnv(value) {
2111
+ if (value === undefined || value === "")
2112
+ return null;
2113
+ const n = Number(value);
2114
+ return Number.isInteger(n) ? n : null;
2115
+ }
2116
+ function provenanceFor(input) {
2117
+ if (input.provenance)
2118
+ return input.provenance;
2119
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
2120
+ return "unavailable";
2121
+ if (input.env.role || input.env.task)
2122
+ return "env_correlated";
2123
+ return "unavailable";
2124
+ }
2125
+ function issueFromTask(task) {
2126
+ if (task === undefined || task === "")
2127
+ return null;
2128
+ const n = Number(task);
2129
+ return Number.isInteger(n) ? n : null;
2130
+ }
2131
+ function roundFromEnv(round) {
2132
+ if (round === undefined || round === "")
2133
+ return;
2134
+ const n = Number(round);
2135
+ return Number.isInteger(n) ? n : undefined;
2136
+ }
2137
+ function prFromEnv(pr) {
2138
+ if (pr === undefined || pr === "")
2139
+ return;
2140
+ const n = Number(pr);
2141
+ return Number.isInteger(n) && n > 0 ? n : undefined;
2142
+ }
2143
+ function buildHeader(input) {
2144
+ const role = isRole(input.env.role) ? input.env.role : "unattributed";
2145
+ const round = roundFromEnv(input.env.round);
2146
+ const pr = prFromEnv(input.env.pr);
2147
+ const subject = {
2148
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
2149
+ role,
2150
+ ...round !== undefined ? { round } : {},
2151
+ ...pr !== undefined ? { pr } : {},
2152
+ ...input.subject ?? {}
2153
+ };
2154
+ const issue = subject.issue;
2155
+ return {
2156
+ meta: {
2157
+ schema: 4,
2158
+ ts: input.now.toISOString(),
2159
+ run_id: input.runId,
2160
+ seq: input.seq,
2161
+ repo: input.repo,
2162
+ vinaya: input.vinaya,
2163
+ doctrine: input.doctrine,
2164
+ host: input.host,
2165
+ machine: createHash3("sha256").update(input.hostname).digest("hex"),
2166
+ event_id: input.eventId,
2167
+ process_id: input.processId,
2168
+ actor_id: actorIdFromEnv(input.env.role),
2169
+ lineage: {
2170
+ run: lineageFieldFromEnv(input.env.run),
2171
+ attempt: attemptFromEnv(input.env.attempt),
2172
+ parent: lineageFieldFromEnv(input.env.parent)
2173
+ },
2174
+ input_versions: {
2175
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
2176
+ objectives_version: input.inputVersions?.objectivesVersion ?? null,
2177
+ brief_hash: input.inputVersions?.briefHash ?? null,
2178
+ ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
2179
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
2180
+ policy_digest: input.inputVersions?.policyDigest ?? null
2181
+ },
2182
+ provenance: provenanceFor(input),
2183
+ work: {
2184
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
2185
+ repo: input.repo,
2186
+ change: pr === undefined ? null : String(pr),
2187
+ revision: input.revision ?? null
2188
+ },
2189
+ flow: {
2190
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
2191
+ version: lineageFieldFromEnv(input.env.flowVersion)
2192
+ },
2193
+ runtime: lineageFieldFromEnv(input.env.runtime),
2194
+ process: {
2195
+ id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
2196
+ version: lineageFieldFromEnv(input.env.processVersion),
2197
+ digest: lineageFieldFromEnv(input.env.processDigest)
2198
+ },
2199
+ runner: {
2200
+ id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
2201
+ version: lineageFieldFromEnv(input.env.runnerVersion)
2202
+ },
2203
+ source: lineageFieldFromEnv(input.env.source)
2204
+ },
2205
+ subject
2206
+ };
2207
+ }
2208
+ var init_envelope = __esm(() => {
2209
+ init_roles();
2210
+ });
2211
+
2080
2212
  // ../../harness/kernel/log/custom.ts
2081
2213
  import { z } from "zod";
2082
2214
  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;
@@ -2134,19 +2266,11 @@ var init_custom = __esm(() => {
2134
2266
 
2135
2267
  // ../../harness/kernel/log/schema.ts
2136
2268
  import { z as z2 } from "zod";
2137
- 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;
2269
+ 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;
2138
2270
  var init_schema = __esm(() => {
2139
2271
  init_custom();
2140
- ROLE_VALUES = [
2141
- "planner",
2142
- "developer",
2143
- "code-reviewer",
2144
- "security",
2145
- "principal",
2146
- "archivist",
2147
- "architect"
2148
- ];
2149
- RoleSchema = z2.enum(ROLE_VALUES);
2272
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
2273
+ RoleSchema = z2.string().regex(ROLE_NAME_PATTERN);
2150
2274
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
2151
2275
  HostSchema = z2.enum(HOST_VALUES);
2152
2276
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -2728,119 +2852,6 @@ var init_schema = __esm(() => {
2728
2852
  ]);
2729
2853
  });
2730
2854
 
2731
- // ../../harness/kernel/log/envelope.ts
2732
- import { createHash as createHash3 } from "node:crypto";
2733
- function isRole(value) {
2734
- return value !== undefined && ROLE_VALUES.includes(value);
2735
- }
2736
- function actorIdFromEnv(role) {
2737
- return role === undefined || role === "" ? null : role;
2738
- }
2739
- function lineageFieldFromEnv(value) {
2740
- return value === undefined || value === "" ? null : value;
2741
- }
2742
- function attemptFromEnv(value) {
2743
- if (value === undefined || value === "")
2744
- return null;
2745
- const n = Number(value);
2746
- return Number.isInteger(n) ? n : null;
2747
- }
2748
- function provenanceFor(input) {
2749
- if (input.provenance)
2750
- return input.provenance;
2751
- if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
2752
- return "unavailable";
2753
- if (input.env.role || input.env.task)
2754
- return "env_correlated";
2755
- return "unavailable";
2756
- }
2757
- function issueFromTask(task) {
2758
- if (task === undefined || task === "")
2759
- return null;
2760
- const n = Number(task);
2761
- return Number.isInteger(n) ? n : null;
2762
- }
2763
- function roundFromEnv(round) {
2764
- if (round === undefined || round === "")
2765
- return;
2766
- const n = Number(round);
2767
- return Number.isInteger(n) ? n : undefined;
2768
- }
2769
- function prFromEnv(pr) {
2770
- if (pr === undefined || pr === "")
2771
- return;
2772
- const n = Number(pr);
2773
- return Number.isInteger(n) && n > 0 ? n : undefined;
2774
- }
2775
- function buildHeader(input) {
2776
- const role = isRole(input.env.role) ? input.env.role : "unattributed";
2777
- const round = roundFromEnv(input.env.round);
2778
- const pr = prFromEnv(input.env.pr);
2779
- const subject = {
2780
- issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
2781
- role,
2782
- ...round !== undefined ? { round } : {},
2783
- ...pr !== undefined ? { pr } : {},
2784
- ...input.subject ?? {}
2785
- };
2786
- const issue = subject.issue;
2787
- return {
2788
- meta: {
2789
- schema: 4,
2790
- ts: input.now.toISOString(),
2791
- run_id: input.runId,
2792
- seq: input.seq,
2793
- repo: input.repo,
2794
- vinaya: input.vinaya,
2795
- doctrine: input.doctrine,
2796
- host: input.host,
2797
- machine: createHash3("sha256").update(input.hostname).digest("hex"),
2798
- event_id: input.eventId,
2799
- process_id: input.processId,
2800
- actor_id: actorIdFromEnv(input.env.role),
2801
- lineage: {
2802
- run: lineageFieldFromEnv(input.env.run),
2803
- attempt: attemptFromEnv(input.env.attempt),
2804
- parent: lineageFieldFromEnv(input.env.parent)
2805
- },
2806
- input_versions: {
2807
- manifest_version: input.inputVersions?.manifestVersion ?? null,
2808
- objectives_version: input.inputVersions?.objectivesVersion ?? null,
2809
- brief_hash: input.inputVersions?.briefHash ?? null,
2810
- ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
2811
- pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
2812
- policy_digest: input.inputVersions?.policyDigest ?? null
2813
- },
2814
- provenance: provenanceFor(input),
2815
- work: {
2816
- ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
2817
- repo: input.repo,
2818
- change: pr === undefined ? null : String(pr),
2819
- revision: input.revision ?? null
2820
- },
2821
- flow: {
2822
- id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
2823
- version: lineageFieldFromEnv(input.env.flowVersion)
2824
- },
2825
- runtime: lineageFieldFromEnv(input.env.runtime),
2826
- process: {
2827
- id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
2828
- version: lineageFieldFromEnv(input.env.processVersion),
2829
- digest: lineageFieldFromEnv(input.env.processDigest)
2830
- },
2831
- runner: {
2832
- id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
2833
- version: lineageFieldFromEnv(input.env.runnerVersion)
2834
- },
2835
- source: lineageFieldFromEnv(input.env.source)
2836
- },
2837
- subject
2838
- };
2839
- }
2840
- var init_envelope = __esm(() => {
2841
- init_schema();
2842
- });
2843
-
2844
2855
  // ../../harness/kernel/log/redact.ts
2845
2856
  function redactString(value, home) {
2846
2857
  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>");
@@ -3624,7 +3635,8 @@ function code(value) {
3624
3635
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
3625
3636
  }
3626
3637
  function roleSubject(value, sentenceStart = true) {
3627
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
3638
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
3639
+ const name = known ? `the ${known.reading}` : "a role";
3628
3640
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
3629
3641
  }
3630
3642
  function roundLabel(record) {
@@ -3743,7 +3755,7 @@ function conflictReentry(record) {
3743
3755
  function dispatched(record) {
3744
3756
  const role = text(record.target_role);
3745
3757
  const who = roleSubject(role);
3746
- const reviewing = role === "code-reviewer" || role === "security";
3758
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
3747
3759
  const round = whole(record.round);
3748
3760
  return {
3749
3761
  kind: "working",
@@ -3802,6 +3814,7 @@ function narrate(record, earlier = []) {
3802
3814
  }
3803
3815
  var REASONS, PAUSE_WITHOUT_CODE;
3804
3816
  var init_narration = __esm(() => {
3817
+ init_roles();
3805
3818
  init_schema();
3806
3819
  REASONS = {
3807
3820
  escalation: { words: "a role escalated a question", person: true },
@@ -3834,13 +3847,7 @@ var init_narration = __esm(() => {
3834
3847
 
3835
3848
  // ../../harness/kernel/adapters/agents/agent-line.ts
3836
3849
  function roleLabel(role) {
3837
- if (role in roleLabels)
3838
- return roleLabels[role];
3839
- if (role === "dev-review-loop")
3840
- return "Loop";
3841
- if (role === "operator")
3842
- return "Operator";
3843
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
3850
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
3844
3851
  }
3845
3852
  function formatLineMeta(meta) {
3846
3853
  if (meta === undefined)
@@ -3854,17 +3861,9 @@ function formatAgentLine(role, words, options = {}) {
3854
3861
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
3855
3862
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
3856
3863
  }
3857
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
3864
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
3858
3865
  var init_agent_line = __esm(() => {
3859
- roleLabels = {
3860
- planner: "Planner",
3861
- developer: "Developer",
3862
- "code-reviewer": "Code review",
3863
- security: "Security",
3864
- principal: "Principal",
3865
- archivist: "Archivist",
3866
- architect: "Architect"
3867
- };
3866
+ init_roles();
3868
3867
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
3869
3868
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
3870
3869
  META_KEY = /^[a-z]+$/;
@@ -8805,11 +8804,12 @@ function lookup(name) {
8805
8804
  throw new Error(`no program named '${name}' — the program table names: ${[...PROGRAMS.keys()].join(", ")}`);
8806
8805
  return found;
8807
8806
  }
8808
- function programFile(name) {
8807
+ function programFile(name, packageRoot = cliPackageRoot(), fromSource = FROM_SOURCE) {
8809
8808
  const entry = lookup(name);
8810
- const built = join13(cliPackageRoot(), entry.built);
8811
- const source = join13(SOURCE_ROOT, entry.source);
8812
- if (FROM_SOURCE && existsSync11(source))
8809
+ return pickFile(join13(packageRoot, entry.built), join13(SOURCE_ROOT, entry.source), fromSource);
8810
+ }
8811
+ function pickFile(built, source, fromSource) {
8812
+ if (fromSource && existsSync11(source))
8813
8813
  return source;
8814
8814
  return existsSync11(built) ? built : source;
8815
8815
  }
@@ -8870,7 +8870,9 @@ var init_programs = __esm(() => {
8870
8870
  program("log-selftest", `${P}/integration/bin/log-selftest.ts`, "dist/programs/log-selftest.js", [
8871
8871
  words("log", "selftest")
8872
8872
  ]),
8873
- program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")])
8873
+ program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")]),
8874
+ program("run-engine", `${P}/bin/run-engine.ts`, "dist/programs/run-engine.js"),
8875
+ program("supervised-command", `${P}/loops/dev-review/v2/supervised-command.ts`, "dist/programs/supervised-command.js")
8874
8876
  ]);
8875
8877
  SOURCE_ROOT = join13(dirname10(fileURLToPath4(import.meta.url)), "..", "..", "..", "..");
8876
8878
  FROM_SOURCE = fileURLToPath4(import.meta.url).endsWith(".ts");
@@ -8962,6 +8964,28 @@ var init_install_process = __esm(() => {
8962
8964
  SLOT_ORDER = ["log", "config", "checks"];
8963
8965
  });
8964
8966
 
8967
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
8968
+ function registerVinayaLogRoles() {
8969
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
8970
+ registerRole(name, { reading, title, reviews });
8971
+ registerTitle("dev-review-loop", "Loop");
8972
+ }
8973
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
8974
+ var init_log_roles = __esm(() => {
8975
+ init_roles();
8976
+ VINAYA_LOG_ROLES = [
8977
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
8978
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
8979
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
8980
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
8981
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
8982
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
8983
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
8984
+ ];
8985
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
8986
+ registerVinayaLogRoles();
8987
+ });
8988
+
8965
8989
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
8966
8990
  import { execFile as execFile8 } from "node:child_process";
8967
8991
  import { promisify as promisify8 } from "node:util";
@@ -9164,6 +9188,7 @@ function installVinayaLogSinkFactory() {
9164
9188
  var init_log_sink_factory = __esm(() => {
9165
9189
  init_log_sink();
9166
9190
  init_package_root();
9191
+ init_log_roles();
9167
9192
  init_branch_issue();
9168
9193
  init_doctrine_version();
9169
9194
  });
@@ -9734,8 +9759,8 @@ var init_protected_paths2 = __esm(() => {
9734
9759
 
9735
9760
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
9736
9761
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, VINAYA_ROUTER_ROLES;
9737
- var init_roles = __esm(() => {
9738
- init_schema();
9762
+ var init_roles2 = __esm(() => {
9763
+ init_log_roles();
9739
9764
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
9740
9765
  ROLE_TOOL_GRANTS = {
9741
9766
  developer: [
@@ -9754,7 +9779,7 @@ var init_roles = __esm(() => {
9754
9779
  };
9755
9780
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
9756
9781
  VINAYA_BROKER_ROLES = {
9757
- recognizedRoles: ROLE_VALUES,
9782
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
9758
9783
  workerRoles: ["developer"],
9759
9784
  surfaceOwner: "the Planner"
9760
9785
  };
@@ -9838,7 +9863,7 @@ function vinayaRouterPolicies() {
9838
9863
  var init_vinaya_policies = __esm(() => {
9839
9864
  init_launch_records();
9840
9865
  init_protected_paths2();
9841
- init_roles();
9866
+ init_roles2();
9842
9867
  init_scratch_names();
9843
9868
  });
9844
9869
 
@@ -1529,6 +1529,8 @@ function findCrossingFiles(candidateFiles) {
1529
1529
  // ../../harness/processes/vinaya-strict/checks/log-producer-graph.ts
1530
1530
  import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
1531
1531
  import { join as join2, relative, sep } from "node:path";
1532
+ // ../../packages/test-selection/src/hunk-classes.ts
1533
+ var LOAD_ERROR_CODES = new Set([2300, 2392, 2393, 2440, 2448, 2449, 2450, 2451]);
1532
1534
  // ../../packages/test-selection/src/inventory.ts
1533
1535
  var READER_KINDS = new Set(["code", "raw-bytes", "semantic", "parsed-keys", "schema-policy"]);
1534
1536
  var EDGE_KINDS = new Set([
@@ -1581,7 +1583,12 @@ var AT_CALLS = new Set([
1581
1583
  "execveat"
1582
1584
  ]);
1583
1585
  var CLONE_CALLS = new Set(["clone", "clone3", "fork", "vfork"]);
1586
+ var OPEN_CALLS = new Set(["open", "openat", "openat2", "creat"]);
1584
1587
  var GIT_PATH_READERS = new Set(["show", "cat-file", "rev-parse"]);
1588
+ // ../../packages/test-selection/src/selector.ts
1589
+ import { readdirSync as readdirSync2, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
1590
+ import { dirname, extname, isAbsolute, join, resolve } from "node:path";
1591
+
1585
1592
  // ../../packages/test-selection/src/scanner-inputs.ts
1586
1593
  var TREE_READERS = new Set([
1587
1594
  "readdirSync",
@@ -1594,9 +1601,6 @@ var TREE_READERS = new Set([
1594
1601
  ]);
1595
1602
  var SPAWN_CALLS = new Set(["execFileSync", "execSync", "spawnSync", "spawn", "exec", "execFile"]);
1596
1603
  var PROCESS_CALLS = new Set([...SPAWN_CALLS, "fork"]);
1597
- // ../../packages/test-selection/src/selector.ts
1598
- import { readdirSync as readdirSync2, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
1599
- import { dirname, extname, isAbsolute, join, resolve } from "node:path";
1600
1604
 
1601
1605
  // ../../packages/test-selection/src/spawn-inputs.ts
1602
1606
  var parsedTrees = new Map;
@@ -1752,6 +1756,9 @@ function resolveRelativeImport(fromFile, specifier, knownFiles) {
1752
1756
  var TYPE_ONLY_CONDITIONS = new Set(["types", "typings"]);
1753
1757
  var PACKAGE_TEST_DATA_FOLDERS = new Set(["tests", "test", "__tests__", "specs", "fixtures"]);
1754
1758
  var PACKAGE_PROSE_FILE_NAMES = new Set(["README.md", "CHANGELOG.md", "LICENSE"]);
1759
+
1760
+ // ../../packages/test-selection/src/recorder.ts
1761
+ var RECORDER_TIME_LIMIT_MS = 15 * 60000;
1755
1762
  // ../../harness/processes/vinaya-strict/integration/repository-verification.ts
1756
1763
  function walkFiles(root) {
1757
1764
  return walkTree(diskTree(root), root);