@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
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
+
5
+ // ../../harness/processes/vinaya-strict/loops/dev-review/v2/supervised-command.ts
6
+ import { spawn } from "node:child_process";
7
+ import { closeSync, createReadStream, writeSync } from "node:fs";
8
+ var CONTROL_FD = 3;
9
+ var RESULT_FD = 4;
10
+ function parseSupervisedCommandResult(text) {
11
+ try {
12
+ const value = JSON.parse(text.trim());
13
+ const code = typeof value.code === "number" && Number.isInteger(value.code) ? value.code : null;
14
+ const signal = typeof value.signal === "string" && value.signal !== "" ? value.signal : null;
15
+ const error = typeof value.error === "string" ? value.error : undefined;
16
+ if (code === null && signal === null && error === undefined)
17
+ return null;
18
+ return { code, signal, ...error !== undefined ? { error } : {} };
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ function report(result) {
24
+ try {
25
+ writeSync(RESULT_FD, `${JSON.stringify(result)}
26
+ `);
27
+ } catch {}
28
+ try {
29
+ closeSync(RESULT_FD);
30
+ } catch {}
31
+ }
32
+ function main(argv) {
33
+ const [file, ...args] = argv;
34
+ let started = false;
35
+ let pending = "";
36
+ const control = createReadStream("", { fd: CONTROL_FD, encoding: "utf8" });
37
+ control.on("data", (chunk) => {
38
+ if (started)
39
+ return;
40
+ pending += chunk;
41
+ if (!pending.includes(`
42
+ `))
43
+ return;
44
+ started = true;
45
+ if (file === undefined) {
46
+ report({ code: null, signal: null, error: "no command was given" });
47
+ return;
48
+ }
49
+ const child = spawn(file, args, { stdio: ["inherit", "inherit", "inherit"] });
50
+ child.on("error", (error) => report({ code: null, signal: null, error: error.message }));
51
+ child.on("exit", (code, signal) => report({ code, signal }));
52
+ });
53
+ const release = () => {
54
+ if (!started)
55
+ process.exit(1);
56
+ process.kill(0, "SIGKILL");
57
+ };
58
+ control.on("end", release);
59
+ control.on("error", release);
60
+ }
61
+ if (__require.main == __require.module)
62
+ main(process.argv.slice(2));
63
+ export {
64
+ CONTROL_FD,
65
+ RESULT_FD,
66
+ parseSupervisedCommandResult
67
+ };
@@ -201,19 +201,11 @@ var init_custom = __esm(() => {
201
201
 
202
202
  // ../../harness/kernel/log/schema.ts
203
203
  import { z as z2 } from "zod";
204
- 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;
204
+ 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;
205
205
  var init_schema = __esm(() => {
206
206
  init_custom();
207
- ROLE_VALUES = [
208
- "planner",
209
- "developer",
210
- "code-reviewer",
211
- "security",
212
- "principal",
213
- "archivist",
214
- "architect"
215
- ];
216
- RoleSchema = z2.enum(ROLE_VALUES);
207
+ ROLE_NAME_PATTERN = /^[a-z0-9-]+$/;
208
+ RoleSchema = z2.string().regex(ROLE_NAME_PATTERN);
217
209
  HOST_VALUES = ["hook", "ci", "cli", "loop"];
218
210
  HostSchema = z2.enum(HOST_VALUES);
219
211
  RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
@@ -1041,11 +1033,30 @@ var init_config_schema = __esm(() => {
1041
1033
  KERNEL_CONFIG_REFINEMENTS = [];
1042
1034
  });
1043
1035
 
1044
- // ../../harness/kernel/log/envelope.ts
1045
- import { createHash as createHash2 } from "node:crypto";
1036
+ // ../../harness/kernel/log/roles.ts
1037
+ function registerRole(name, role) {
1038
+ roles.set(name, role);
1039
+ }
1040
+ function registerTitle(name, title) {
1041
+ titles.set(name, title);
1042
+ }
1046
1043
  function isRole(value) {
1047
- return value !== undefined && ROLE_VALUES.includes(value);
1044
+ return value !== undefined && roles.has(value);
1045
+ }
1046
+ function lookupRole(name) {
1047
+ return roles.get(name);
1048
1048
  }
1049
+ function lookupTitle(name) {
1050
+ return roles.get(name)?.title ?? titles.get(name);
1051
+ }
1052
+ var roles, titles;
1053
+ var init_roles = __esm(() => {
1054
+ roles = new Map;
1055
+ titles = new Map;
1056
+ });
1057
+
1058
+ // ../../harness/kernel/log/envelope.ts
1059
+ import { createHash as createHash2 } from "node:crypto";
1049
1060
  function actorIdFromEnv(role) {
1050
1061
  return role === undefined || role === "" ? null : role;
1051
1062
  }
@@ -1151,7 +1162,7 @@ function buildHeader(input) {
1151
1162
  };
1152
1163
  }
1153
1164
  var init_envelope = __esm(() => {
1154
- init_schema();
1165
+ init_roles();
1155
1166
  });
1156
1167
 
1157
1168
  // ../../harness/kernel/log/deferred-sink-factory.ts
@@ -1534,7 +1545,8 @@ function code(value) {
1534
1545
  return typeof value === "string" && CODE_TOKEN_PATTERN.test(value) ? value : null;
1535
1546
  }
1536
1547
  function roleSubject(value, sentenceStart = true) {
1537
- const name = typeof value === "string" && ROLE_VALUES.includes(value) ? `the ${value === "security" ? "security reviewer" : value.replace(/-/g, " ")}` : "a role";
1548
+ const known = typeof value === "string" ? lookupRole(value) : undefined;
1549
+ const name = known ? `the ${known.reading}` : "a role";
1538
1550
  return sentenceStart ? `${name[0]?.toUpperCase()}${name.slice(1)}` : name;
1539
1551
  }
1540
1552
  function roundLabel(record) {
@@ -1653,7 +1665,7 @@ function conflictReentry(record) {
1653
1665
  function dispatched(record) {
1654
1666
  const role = text(record.target_role);
1655
1667
  const who = roleSubject(role);
1656
- const reviewing = role === "code-reviewer" || role === "security";
1668
+ const reviewing = role !== null && (lookupRole(role)?.reviews ?? false);
1657
1669
  const round = whole(record.round);
1658
1670
  return {
1659
1671
  kind: "working",
@@ -1712,6 +1724,7 @@ function narrate(record, earlier = []) {
1712
1724
  }
1713
1725
  var REASONS, PAUSE_WITHOUT_CODE;
1714
1726
  var init_narration = __esm(() => {
1727
+ init_roles();
1715
1728
  init_schema();
1716
1729
  REASONS = {
1717
1730
  escalation: { words: "a role escalated a question", person: true },
@@ -1744,13 +1757,7 @@ var init_narration = __esm(() => {
1744
1757
 
1745
1758
  // ../../harness/kernel/adapters/agents/agent-line.ts
1746
1759
  function roleLabel(role) {
1747
- if (role in roleLabels)
1748
- return roleLabels[role];
1749
- if (role === "dev-review-loop")
1750
- return "Loop";
1751
- if (role === "operator")
1752
- return "Operator";
1753
- return role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
1760
+ return lookupTitle(role) ?? role.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
1754
1761
  }
1755
1762
  function formatLineMeta(meta) {
1756
1763
  if (meta === undefined)
@@ -1764,17 +1771,9 @@ function formatAgentLine(role, words, options = {}) {
1764
1771
  const mark = options.unicode ?? true ? unicodeMarks[options.mark ?? "working"] : asciiMarks[options.mark ?? "working"];
1765
1772
  return `${time} ${mark} ${roleLabel(role)} ${words}`;
1766
1773
  }
1767
- var roleLabels, unicodeMarks, asciiMarks, META_KEY, META_VALUE;
1774
+ var unicodeMarks, asciiMarks, META_KEY, META_VALUE;
1768
1775
  var init_agent_line = __esm(() => {
1769
- roleLabels = {
1770
- planner: "Planner",
1771
- developer: "Developer",
1772
- "code-reviewer": "Code review",
1773
- security: "Security",
1774
- principal: "Principal",
1775
- archivist: "Archivist",
1776
- architect: "Architect"
1777
- };
1776
+ init_roles();
1778
1777
  unicodeMarks = { working: "▸", done: "✓", failed: "✕", waiting: "◌", round: "◆" };
1779
1778
  asciiMarks = { working: ">", done: "+", failed: "x", waiting: "~", round: "#" };
1780
1779
  META_KEY = /^[a-z]+$/;
@@ -6036,6 +6035,28 @@ var init_compose = __esm(() => {
6036
6035
  installVinayaConfigProvider();
6037
6036
  });
6038
6037
 
6038
+ // ../../harness/processes/vinaya-strict/integration/log/log-roles.ts
6039
+ function registerVinayaLogRoles() {
6040
+ for (const { name, reading, title, reviews } of VINAYA_LOG_ROLES)
6041
+ registerRole(name, { reading, title, reviews });
6042
+ registerTitle("dev-review-loop", "Loop");
6043
+ }
6044
+ var VINAYA_LOG_ROLES, VINAYA_LOG_ROLE_NAMES;
6045
+ var init_log_roles = __esm(() => {
6046
+ init_roles();
6047
+ VINAYA_LOG_ROLES = [
6048
+ { name: "planner", reading: "planner", title: "Planner", reviews: false },
6049
+ { name: "developer", reading: "developer", title: "Developer", reviews: false },
6050
+ { name: "code-reviewer", reading: "code reviewer", title: "Code review", reviews: true },
6051
+ { name: "security", reading: "security reviewer", title: "Security", reviews: true },
6052
+ { name: "principal", reading: "principal", title: "Principal", reviews: false },
6053
+ { name: "archivist", reading: "archivist", title: "Archivist", reviews: false },
6054
+ { name: "architect", reading: "architect", title: "Architect", reviews: false }
6055
+ ];
6056
+ VINAYA_LOG_ROLE_NAMES = VINAYA_LOG_ROLES.map((role) => role.name);
6057
+ registerVinayaLogRoles();
6058
+ });
6059
+
6039
6060
  // ../../harness/processes/vinaya-strict/integration/log/branch-issue.ts
6040
6061
  import { execFile as execFile5 } from "node:child_process";
6041
6062
  import { promisify as promisify5 } from "node:util";
@@ -6238,6 +6259,7 @@ function installVinayaLogSinkFactory() {
6238
6259
  var init_log_sink_factory = __esm(() => {
6239
6260
  init_log_sink();
6240
6261
  init_package_root();
6262
+ init_log_roles();
6241
6263
  init_branch_issue();
6242
6264
  init_doctrine_version();
6243
6265
  });
@@ -6643,8 +6665,8 @@ var init_protected_paths2 = __esm(() => {
6643
6665
 
6644
6666
  // ../../harness/processes/vinaya-strict/integration/policies/roles.ts
6645
6667
  var GRANTED_ROLES, ROLE_TOOL_GRANTS, VINAYA_TOOL_GRANTS, VINAYA_BROKER_ROLES, VINAYA_BOUNDARY_ROLES, OPERATOR_TOOL_GRANT, VINAYA_ROUTER_ROLES;
6646
- var init_roles = __esm(() => {
6647
- init_schema();
6668
+ var init_roles2 = __esm(() => {
6669
+ init_log_roles();
6648
6670
  GRANTED_ROLES = ["developer", "code-reviewer", "security", "controller"];
6649
6671
  ROLE_TOOL_GRANTS = {
6650
6672
  developer: [
@@ -6663,7 +6685,7 @@ var init_roles = __esm(() => {
6663
6685
  };
6664
6686
  VINAYA_TOOL_GRANTS = { roles: GRANTED_ROLES, grants: ROLE_TOOL_GRANTS };
6665
6687
  VINAYA_BROKER_ROLES = {
6666
- recognizedRoles: ROLE_VALUES,
6688
+ recognizedRoles: VINAYA_LOG_ROLE_NAMES,
6667
6689
  workerRoles: ["developer"],
6668
6690
  surfaceOwner: "the Planner"
6669
6691
  };
@@ -6747,7 +6769,7 @@ function vinayaRouterPolicies() {
6747
6769
  var init_vinaya_policies = __esm(() => {
6748
6770
  init_launch_records();
6749
6771
  init_protected_paths2();
6750
- init_roles();
6772
+ init_roles2();
6751
6773
  init_scratch_names();
6752
6774
  });
6753
6775
 
@@ -6834,7 +6856,9 @@ var init_programs = __esm(() => {
6834
6856
  program("log-selftest", `${P}/integration/bin/log-selftest.ts`, "dist/programs/log-selftest.js", [
6835
6857
  words("log", "selftest")
6836
6858
  ]),
6837
- program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")])
6859
+ program("sync", `${P}/integration/bin/sync.ts`, "dist/programs/sync.js", [words("sync")]),
6860
+ program("run-engine", `${P}/bin/run-engine.ts`, "dist/programs/run-engine.js"),
6861
+ program("supervised-command", `${P}/loops/dev-review/v2/supervised-command.ts`, "dist/programs/supervised-command.js")
6838
6862
  ]);
6839
6863
  SOURCE_ROOT = join15(dirname10(fileURLToPath4(import.meta.url)), "..", "..", "..", "..");
6840
6864
  FROM_SOURCE = fileURLToPath4(import.meta.url).endsWith(".ts");