@voybio/ace-swarm 2.4.4 → 2.4.6

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 (120) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +72 -532
  3. package/assets/eval-battery/battery.json +85 -0
  4. package/assets/eval-battery/fixtures/edit-target.js +3 -0
  5. package/assets/scripts/render-mcp-configs.sh +12 -0
  6. package/dist/ace-context.d.ts +18 -0
  7. package/dist/ace-context.js +161 -16
  8. package/dist/ace-server-instructions.js +36 -9
  9. package/dist/bridge-trace.d.ts +17 -0
  10. package/dist/bridge-trace.js +23 -0
  11. package/dist/cli.d.ts +9 -1
  12. package/dist/cli.js +619 -10
  13. package/dist/discovery-runtime-wrappers.d.ts +16 -1
  14. package/dist/discovery-runtime-wrappers.js +65 -9
  15. package/dist/eval-harness.d.ts +110 -0
  16. package/dist/eval-harness.js +254 -0
  17. package/dist/experience-reflector.d.ts +13 -0
  18. package/dist/experience-reflector.js +62 -0
  19. package/dist/goal-engine.d.ts +155 -0
  20. package/dist/goal-engine.js +795 -0
  21. package/dist/helpers/store-resolution.js +40 -39
  22. package/dist/hermes/session-manager.d.ts +10 -0
  23. package/dist/hermes/session-manager.js +130 -27
  24. package/dist/job-scheduler.d.ts +58 -0
  25. package/dist/job-scheduler.js +202 -2
  26. package/dist/job-worker.d.ts +87 -0
  27. package/dist/job-worker.js +182 -0
  28. package/dist/local-model-policy.d.ts +8 -2
  29. package/dist/local-model-policy.js +31 -17
  30. package/dist/local-model-runtime.d.ts +6 -0
  31. package/dist/local-model-runtime.js +130 -2
  32. package/dist/measured-classing.d.ts +66 -0
  33. package/dist/measured-classing.js +165 -0
  34. package/dist/model-bridge.d.ts +45 -0
  35. package/dist/model-bridge.js +502 -44
  36. package/dist/orchestrator-supervisor.js +1 -1
  37. package/dist/plan-proposal.d.ts +7 -0
  38. package/dist/plan-proposal.js +74 -4
  39. package/dist/playbook-adaptation.d.ts +37 -0
  40. package/dist/playbook-adaptation.js +159 -0
  41. package/dist/playbook-curator.d.ts +16 -0
  42. package/dist/playbook-curator.js +106 -0
  43. package/dist/playbook-llm-reflector.d.ts +26 -0
  44. package/dist/playbook-llm-reflector.js +157 -0
  45. package/dist/public-surface.d.ts +2 -0
  46. package/dist/public-surface.js +26 -14
  47. package/dist/safe-edit.d.ts +20 -0
  48. package/dist/safe-edit.js +355 -78
  49. package/dist/server.d.ts +11 -2
  50. package/dist/server.js +55 -5
  51. package/dist/shared.d.ts +12 -0
  52. package/dist/shared.js +13 -1
  53. package/dist/source-mutation-coordinator.d.ts +54 -0
  54. package/dist/source-mutation-coordinator.js +259 -0
  55. package/dist/status-events.d.ts +4 -1
  56. package/dist/status-events.js +41 -6
  57. package/dist/store/ace-packed-store.d.ts +28 -9
  58. package/dist/store/ace-packed-store.js +324 -57
  59. package/dist/store/bgzf.d.ts +4 -0
  60. package/dist/store/bgzf.js +94 -0
  61. package/dist/store/bootstrap-store.d.ts +4 -1
  62. package/dist/store/bootstrap-store.js +57 -3
  63. package/dist/store/cache-workspace.d.ts +8 -0
  64. package/dist/store/cache-workspace.js +67 -1
  65. package/dist/store/crc32.d.ts +2 -0
  66. package/dist/store/crc32.js +16 -0
  67. package/dist/store/fsck.d.ts +16 -0
  68. package/dist/store/fsck.js +240 -0
  69. package/dist/store/materializers/context-snapshot-materializer.d.ts +1 -0
  70. package/dist/store/materializers/context-snapshot-materializer.js +4 -1
  71. package/dist/store/materializers/projection-manager.d.ts +7 -0
  72. package/dist/store/materializers/projection-manager.js +37 -0
  73. package/dist/store/materializers/scheduler-projection-materializer.js +10 -3
  74. package/dist/store/repositories/goal-repository.d.ts +112 -0
  75. package/dist/store/repositories/goal-repository.js +157 -0
  76. package/dist/store/repositories/playbook-repository.d.ts +107 -0
  77. package/dist/store/repositories/playbook-repository.js +314 -0
  78. package/dist/store/store-artifacts.js +44 -2
  79. package/dist/store/store-authority-audit.js +1 -0
  80. package/dist/store/store-cli.d.ts +30 -0
  81. package/dist/store/store-cli.js +242 -0
  82. package/dist/store/store-snapshot.d.ts +12 -0
  83. package/dist/store/store-snapshot.js +74 -11
  84. package/dist/store/types.d.ts +1 -0
  85. package/dist/store/write-coordinator.d.ts +7 -0
  86. package/dist/store/write-coordinator.js +11 -0
  87. package/dist/todo-state.d.ts +21 -0
  88. package/dist/todo-state.js +150 -53
  89. package/dist/tools-agent.js +86 -22
  90. package/dist/tools-discovery.js +5 -3
  91. package/dist/tools-files.js +39 -18
  92. package/dist/tools-framework.js +31 -3
  93. package/dist/tools-goal.d.ts +11 -0
  94. package/dist/tools-goal.js +108 -0
  95. package/dist/tools-handoff.js +7 -11
  96. package/dist/tools-lifecycle.js +2 -0
  97. package/dist/tools-scheduler.js +44 -1
  98. package/dist/tools-skills.js +3 -2
  99. package/dist/tools-todo.js +64 -3
  100. package/dist/tools.js +2 -0
  101. package/dist/tui/chat.js +4 -0
  102. package/dist/tui/index.js +4 -1
  103. package/dist/tui/ollama.d.ts +2 -0
  104. package/dist/tui/openai-compatible.d.ts +14 -0
  105. package/dist/tui/openai-compatible.js +15 -2
  106. package/dist/tui/provider-discovery.d.ts +1 -0
  107. package/dist/tui/provider-discovery.js +2 -2
  108. package/docs/cli-reference.md +125 -0
  109. package/docs/development.md +46 -0
  110. package/docs/evaluation-safety.md +27 -0
  111. package/docs/experience-playbook.md +35 -0
  112. package/docs/hermes.md +129 -0
  113. package/docs/library-api.md +31 -0
  114. package/docs/mcp-tool-reference.md +290 -0
  115. package/docs/provider-security.md +85 -0
  116. package/docs/state-model.md +113 -0
  117. package/docs/troubleshooting.md +95 -0
  118. package/docs/tui-operator-guide.md +75 -0
  119. package/package.json +3 -1
  120. package/scripts/dev/run_hermes_crispr_live.mjs +212 -0
@@ -1,7 +1,7 @@
1
- import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, writeFileSync } from "node:fs";
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { dirname, extname, join, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- import { PACKAGE_ROOT, resolveWorkspaceRoot } from "./helpers.js";
4
+ import { PACKAGE_ROOT, resolveWorkspaceRoot, safeWrite } from "./helpers.js";
5
5
  import { EVENT_TYPE } from "./shared.js";
6
6
  export const PUBLIC_SURFACE_REPORT_REL_PATH = "agent-state/PUBLIC_SURFACE_REPORT.md";
7
7
  const SCHEMA_REQUIREMENTS = {
@@ -116,13 +116,6 @@ function workspaceRoot() {
116
116
  function reportPath(relPath = PUBLIC_SURFACE_REPORT_REL_PATH) {
117
117
  return resolve(workspaceRoot(), relPath);
118
118
  }
119
- function safeWriteReport(filePath, content) {
120
- mkdirSync(dirname(filePath), { recursive: true });
121
- const tmpPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
122
- writeFileSync(tmpPath, content, "utf-8");
123
- renameSync(tmpPath, filePath);
124
- return filePath;
125
- }
126
119
  async function collectSurfaceEntries() {
127
120
  const entries = [];
128
121
  const [{ registerTools }, { registerResources }, { registerPrompts }] = await Promise.all([
@@ -162,7 +155,7 @@ async function collectSurfaceEntries() {
162
155
  registerPrompts(stub);
163
156
  return entries.sort((left, right) => left.id.localeCompare(right.id));
164
157
  }
165
- function walkTypescriptFiles(root) {
158
+ function walkRuntimeSourceFiles(root) {
166
159
  const files = [];
167
160
  const visit = (dirPath) => {
168
161
  const entries = readdirSync(dirPath, { withFileTypes: true });
@@ -176,8 +169,9 @@ function walkTypescriptFiles(root) {
176
169
  visit(absolutePath);
177
170
  continue;
178
171
  }
179
- if (extname(entry.name) === ".ts")
172
+ if ([".ts", ".js"].includes(extname(entry.name)) && !entry.name.endsWith(".d.ts")) {
180
173
  files.push(absolutePath);
174
+ }
181
175
  }
182
176
  };
183
177
  visit(root);
@@ -185,7 +179,7 @@ function walkTypescriptFiles(root) {
185
179
  }
186
180
  function collectEmittedEventTypes() {
187
181
  const srcRoot = dirname(fileURLToPath(import.meta.url));
188
- const files = walkTypescriptFiles(srcRoot);
182
+ const files = walkRuntimeSourceFiles(srcRoot);
189
183
  const discovered = new Set();
190
184
  const patterns = [
191
185
  /event_type:\s*"([A-Z][A-Z0-9_]+)"/g,
@@ -272,10 +266,24 @@ export function auditPublicSurface(options) {
272
266
  const packageAbs = resolve(PACKAGE_ROOT, "assets", relPath);
273
267
  if (!existsSync(abs) && !existsSync(packageAbs)) {
274
268
  failures.push(`schema file missing for ${surfaceId}: ${relPath}`);
269
+ continue;
270
+ }
271
+ const schemaPath = existsSync(abs) ? abs : packageAbs;
272
+ try {
273
+ const schema = JSON.parse(readFileSync(schemaPath, "utf-8"));
274
+ if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
275
+ failures.push(`schema file is not a JSON object for ${surfaceId}: ${relPath}`);
276
+ }
277
+ }
278
+ catch (error) {
279
+ failures.push(`schema file is invalid JSON for ${surfaceId}: ${relPath} (${error instanceof Error ? error.message : String(error)})`);
275
280
  }
276
281
  }
277
282
  }
278
283
  const eventRegistry = new Set(Object.values(EVENT_TYPE));
284
+ if (emittedEvents.length === 0) {
285
+ failures.push("no emitted event types discovered in the production runtime sources");
286
+ }
279
287
  for (const eventType of emittedEvents) {
280
288
  if (!eventRegistry.has(eventType)) {
281
289
  failures.push(`event type emitted without shared registry entry: ${eventType}`);
@@ -292,7 +300,8 @@ export function auditPublicSurface(options) {
292
300
  emitted_events: emittedEvents.length,
293
301
  schema_bound_surfaces: Object.keys(SCHEMA_REQUIREMENTS).length,
294
302
  };
295
- const report_path = reportPath(options?.artifact_path || PUBLIC_SURFACE_REPORT_REL_PATH);
303
+ const artifactRelPath = options?.artifact_path || PUBLIC_SURFACE_REPORT_REL_PATH;
304
+ const report_path = reportPath(artifactRelPath);
296
305
  const result = {
297
306
  ok: failures.length === 0,
298
307
  summary,
@@ -301,8 +310,9 @@ export function auditPublicSurface(options) {
301
310
  surfaces,
302
311
  emitted_events: emittedEvents,
303
312
  };
313
+ let written_path;
304
314
  if (options?.write_artifact !== false) {
305
- safeWriteReport(report_path, renderReport(result));
315
+ written_path = safeWrite(artifactRelPath, renderReport(result));
306
316
  }
307
317
  else if (!existsSync(report_path)) {
308
318
  warnings.push(`public surface report missing: ${report_path}`);
@@ -310,6 +320,8 @@ export function auditPublicSurface(options) {
310
320
  return {
311
321
  ...result,
312
322
  report_path,
323
+ artifact_path: artifactRelPath,
324
+ written_path,
313
325
  };
314
326
  });
315
327
  }
@@ -7,6 +7,8 @@ export interface SafeEditInput {
7
7
  path: string;
8
8
  /** New file content. */
9
9
  content: string;
10
+ /** Optional full sha256:<hex> source precondition checked immediately before promotion. */
11
+ expected_base_hash?: string;
10
12
  /** Shell command to validate the change (e.g., "npx tsc --noEmit"). */
11
13
  validation_command?: string;
12
14
  /** Shell command to run tests (e.g., "npm test"). */
@@ -26,6 +28,11 @@ export interface SafeEditResult {
26
28
  test_passed?: boolean;
27
29
  test_output?: string;
28
30
  error?: string;
31
+ reason_code?: string;
32
+ expected_hash?: string;
33
+ observed_hash?: string;
34
+ lease_lock_path?: string;
35
+ lease_waited_ms?: number;
29
36
  restored?: boolean;
30
37
  }
31
38
  export interface TestSuiteResult {
@@ -43,6 +50,18 @@ export interface DiffResult {
43
50
  removed: number;
44
51
  diff_summary: string;
45
52
  }
53
+ export interface GcStagingInput {
54
+ max_age_hours?: number;
55
+ max_entries?: number;
56
+ }
57
+ export interface GcStagingResult {
58
+ ok: boolean;
59
+ staging_path: string;
60
+ removed_entries: number;
61
+ kept_entries: number;
62
+ errors: string[];
63
+ }
64
+ export declare function gcStaging(input?: GcStagingInput): GcStagingResult;
46
65
  export declare function safeEditFile(input: SafeEditInput): SafeEditResult;
47
66
  export declare function runTestSuite(command?: string): TestSuiteResult;
48
67
  export declare function diffContents(original: string, updated: string): DiffResult;
@@ -52,6 +71,7 @@ export declare function diffFiles(pathA: string, pathB: string): DiffResult & {
52
71
  export interface ApplyPatchInput {
53
72
  path: string;
54
73
  patch: string;
74
+ expected_base_hash?: string;
55
75
  validation_command?: string;
56
76
  test_command?: string;
57
77
  }