@voybio/ace-swarm 2.4.9 → 2.4.10

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 (185) hide show
  1. package/CHANGELOG.md +52 -14
  2. package/README.md +14 -10
  3. package/assets/.agents/ACE/ACE_coders/AGENTS.md +23 -30
  4. package/assets/.agents/ACE/ACE_coders/INSTRUCTIONS.md +21 -30
  5. package/assets/.agents/skills/landing-review-watcher/SKILL.md +1 -1
  6. package/assets/.agents/skills/learn-from-work/SKILL.md +41 -0
  7. package/assets/agent-state/ACE_WORKFLOW.md +25 -2
  8. package/assets/agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json +143 -2
  9. package/assets/agent-state/MODULES/schemas/RUNTIME_EXECUTOR_SESSION_REGISTRY.schema.json +2 -2
  10. package/assets/agent-state/MODULES/schemas/SWARM_HANDOFF.schema.json +10 -0
  11. package/assets/eval-battery/battery.json +1 -1
  12. package/assets/instructions/ACE_Coder.instructions.md +9 -13
  13. package/assets/scripts/ace-hook-dispatch.mjs +16 -411
  14. package/assets/tasks/SWARM_HANDOFF.example_ui_to_coders.json +1 -2
  15. package/assets/vendor/README.md +9 -0
  16. package/assets/vendor/vericify-reader.mjs +272 -0
  17. package/assets/vendor/vericify-reader.provenance.json +10 -0
  18. package/dist/ace-autonomy.d.ts +58 -0
  19. package/dist/ace-autonomy.js +211 -6
  20. package/dist/ace-internal-tools.d.ts +1 -0
  21. package/dist/ace-internal-tools.js +3 -3
  22. package/dist/ace-server-instructions.d.ts +3 -3
  23. package/dist/ace-server-instructions.js +46 -192
  24. package/dist/cli.js +44 -6
  25. package/dist/experience-reflector.d.ts +7 -0
  26. package/dist/experience-reflector.js +39 -0
  27. package/dist/goal-engine.d.ts +64 -7
  28. package/dist/goal-engine.js +197 -41
  29. package/dist/handoff-registry.d.ts +10 -0
  30. package/dist/handoff-registry.js +59 -0
  31. package/dist/helpers/artifacts.d.ts +6 -2
  32. package/dist/helpers/artifacts.js +8 -6
  33. package/dist/helpers/bootstrap.js +13 -20
  34. package/dist/helpers/path-utils.js +2 -0
  35. package/dist/helpers/store-resolution.js +18 -3
  36. package/dist/helpers/workspace-root.d.ts +2 -0
  37. package/dist/helpers/workspace-root.js +9 -0
  38. package/dist/helpers.d.ts +1 -0
  39. package/dist/helpers.js +1 -0
  40. package/dist/hermes/bridge-protocol.d.ts +1 -1
  41. package/dist/hermes/session-manager.d.ts +17 -0
  42. package/dist/hermes/session-manager.js +67 -14
  43. package/dist/host-goal-engine.d.ts +138 -0
  44. package/dist/host-goal-engine.js +793 -0
  45. package/dist/host-goal-status.d.ts +113 -0
  46. package/dist/host-goal-status.js +175 -0
  47. package/dist/host-learning.d.ts +68 -0
  48. package/dist/host-learning.js +115 -0
  49. package/dist/host-observation.d.ts +12 -0
  50. package/dist/host-observation.js +91 -0
  51. package/dist/host-plan-revision.d.ts +14 -0
  52. package/dist/host-plan-revision.js +101 -0
  53. package/dist/host-verification-job.d.ts +12 -0
  54. package/dist/host-verification-job.js +183 -0
  55. package/dist/host-work-context.d.ts +12 -0
  56. package/dist/host-work-context.js +8 -0
  57. package/dist/job-scheduler.d.ts +48 -14
  58. package/dist/job-scheduler.js +169 -23
  59. package/dist/job-worker.d.ts +3 -1
  60. package/dist/job-worker.js +10 -3
  61. package/dist/kanban.d.ts +4 -1
  62. package/dist/kanban.js +44 -16
  63. package/dist/learned-artifacts.d.ts +64 -0
  64. package/dist/learned-artifacts.js +321 -0
  65. package/dist/learning-controls.d.ts +142 -0
  66. package/dist/learning-controls.js +135 -0
  67. package/dist/learning-input-context.d.ts +9 -0
  68. package/dist/learning-input-context.js +62 -0
  69. package/dist/learning-lifecycle.d.ts +10 -0
  70. package/dist/learning-lifecycle.js +11 -0
  71. package/dist/learning-overlays.d.ts +3 -0
  72. package/dist/learning-overlays.js +17 -0
  73. package/dist/learning-policy.d.ts +40 -0
  74. package/dist/learning-policy.js +38 -0
  75. package/dist/learning-records.d.ts +35 -0
  76. package/dist/learning-records.js +17 -0
  77. package/dist/learning-scorecard.d.ts +82 -0
  78. package/dist/learning-scorecard.js +86 -0
  79. package/dist/learning-serving.d.ts +29 -0
  80. package/dist/learning-serving.js +134 -0
  81. package/dist/linked-work.d.ts +9 -0
  82. package/dist/linked-work.js +28 -0
  83. package/dist/local-model-runtime.js +1 -1
  84. package/dist/mcp-command-progress.d.ts +16 -0
  85. package/dist/mcp-command-progress.js +70 -0
  86. package/dist/model-bridge.d.ts +14 -13
  87. package/dist/model-bridge.js +73 -41
  88. package/dist/orchestrator-supervisor.d.ts +108 -6
  89. package/dist/orchestrator-supervisor.js +4 -32
  90. package/dist/plan-proposal.js +3 -3
  91. package/dist/playbook-curator.d.ts +1 -0
  92. package/dist/playbook-curator.js +11 -9
  93. package/dist/process-identity.d.ts +8 -0
  94. package/dist/process-identity.js +38 -0
  95. package/dist/progress-command.d.ts +34 -0
  96. package/dist/progress-command.js +153 -0
  97. package/dist/prompts.js +15 -15
  98. package/dist/resources.js +2 -2
  99. package/dist/runtime-command.d.ts +8 -1
  100. package/dist/runtime-command.js +48 -7
  101. package/dist/runtime-executor.js +33 -11
  102. package/dist/runtime-profile-syntax.d.ts +6 -0
  103. package/dist/runtime-profile-syntax.js +121 -0
  104. package/dist/runtime-profile.d.ts +37 -5
  105. package/dist/runtime-profile.js +36 -129
  106. package/dist/runtime-tool-specs.js +1 -1
  107. package/dist/safe-edit.d.ts +7 -3
  108. package/dist/safe-edit.js +40 -47
  109. package/dist/schemas.js +4 -2
  110. package/dist/server.d.ts +2 -16
  111. package/dist/server.js +14 -20
  112. package/dist/shared.d.ts +2 -0
  113. package/dist/shared.js +2 -0
  114. package/dist/skill-auditor.d.ts +19 -0
  115. package/dist/skill-auditor.js +32 -2
  116. package/dist/skill-catalog.d.ts +4 -1
  117. package/dist/skill-catalog.js +6 -5
  118. package/dist/store/ace-packed-store.d.ts +5 -1
  119. package/dist/store/ace-packed-store.js +33 -1
  120. package/dist/store/bootstrap-store.js +19 -12
  121. package/dist/store/cache-workspace.d.ts +8 -0
  122. package/dist/store/cache-workspace.js +94 -27
  123. package/dist/store/importer.js +11 -20
  124. package/dist/store/knowledge-bake.d.ts +3 -1
  125. package/dist/store/knowledge-bake.js +10 -1
  126. package/dist/store/legacy-vericify-posts.d.ts +8 -0
  127. package/dist/store/legacy-vericify-posts.js +76 -0
  128. package/dist/store/materializers/hook-context-materializer.d.ts +2 -1
  129. package/dist/store/materializers/hook-context-materializer.js +6 -2
  130. package/dist/store/materializers/host-file-materializer.js +2 -2
  131. package/dist/store/materializers/projection-manager.d.ts +4 -1
  132. package/dist/store/materializers/projection-manager.js +10 -3
  133. package/dist/store/materializers/todo-syncer.d.ts +39 -20
  134. package/dist/store/materializers/todo-syncer.js +208 -110
  135. package/dist/store/materializers/vericify-projector.js +15 -26
  136. package/dist/store/repositories/goal-repository.d.ts +51 -2
  137. package/dist/store/repositories/goal-repository.js +114 -48
  138. package/dist/store/repositories/playbook-repository.d.ts +41 -3
  139. package/dist/store/repositories/playbook-repository.js +61 -5
  140. package/dist/store/repositories/todo-repository.d.ts +8 -2
  141. package/dist/store/repositories/todo-repository.js +1 -1
  142. package/dist/store/repositories/vericify-repository.d.ts +4 -0
  143. package/dist/store/repositories/vericify-repository.js +46 -0
  144. package/dist/store/skills-install.d.ts +1 -0
  145. package/dist/store/skills-install.js +20 -16
  146. package/dist/store/source-preservation.d.ts +24 -0
  147. package/dist/store/source-preservation.js +79 -0
  148. package/dist/store/store-artifacts.js +8 -1
  149. package/dist/store/test-write-boundary.d.ts +16 -0
  150. package/dist/store/test-write-boundary.js +175 -0
  151. package/dist/store/types.d.ts +5 -1
  152. package/dist/store/write-coordinator.js +16 -0
  153. package/dist/task-plan-context.d.ts +11 -0
  154. package/dist/task-plan-context.js +59 -0
  155. package/dist/todo-state.d.ts +19 -9
  156. package/dist/todo-state.js +204 -321
  157. package/dist/tools-agent.d.ts +1 -1
  158. package/dist/tools-agent.js +38 -62
  159. package/dist/tools-files.d.ts +0 -3
  160. package/dist/tools-files.js +21 -11
  161. package/dist/tools-framework.js +16 -25
  162. package/dist/tools-goal.d.ts +2 -4
  163. package/dist/tools-goal.js +119 -16
  164. package/dist/tools-handoff.js +28 -4
  165. package/dist/tools-lifecycle.js +1 -1
  166. package/dist/tools-memory.d.ts +0 -3
  167. package/dist/tools-memory.js +51 -6
  168. package/dist/tools-scheduler.js +19 -17
  169. package/dist/tools-todo.js +160 -148
  170. package/dist/vericify-bridge.d.ts +8 -0
  171. package/dist/vericify-bridge.js +18 -0
  172. package/dist/vericify-context.d.ts +4 -0
  173. package/dist/vericify-context.js +26 -5
  174. package/dist/vericify-native.d.ts +101 -0
  175. package/dist/vericify-native.js +221 -0
  176. package/dist/verification-worker.d.ts +2 -0
  177. package/dist/verification-worker.js +31 -0
  178. package/docs/mcp-tool-reference.md +44 -9
  179. package/package.json +19 -6
  180. package/scripts/dev/run-tests-isolated.mjs +165 -0
  181. package/scripts/dev/run_hermes_crispr_live.mjs +1 -0
  182. package/scripts/dev/test-isolation-guard.mjs +20 -0
  183. package/scripts/dev/test-preload.mjs +153 -0
  184. package/scripts/dev/test-source-inventory.mjs +31 -0
  185. package/docs/development.md +0 -46
@@ -12,7 +12,7 @@ import { renderAceContinuityPromptBlock, renderAceRecallPromptBlock, renderAceSn
12
12
  import { executeRuntimeTool, buildFilteredToolCatalog, SMALL_LOCAL_PRIORITY_TOOL_NAMES, } from "./runtime-tool-specs.js";
13
13
  import { validateRuntimeExecutorSessionRegistryPayload, } from "./schemas.js";
14
14
  import { appendStatusEventSafe } from "./status-events.js";
15
- import { appendVericifyProcessPostSafe, deriveVericifyRunRef, isVericifyBridgeEnabled, refreshVericifyBridgeSnapshotSafe, } from "./vericify-bridge.js";
15
+ import { appendAutomaticVericifyProcessPostSafe, deriveVericifyRunRef, isVericifyBridgeEnabled, refreshVericifyBridgeSnapshotSafe, } from "./vericify-bridge.js";
16
16
  import { createWorkspaceSessionAsync, removeWorkspaceSession, runWorkspaceSessionHook, } from "./workspace-manager.js";
17
17
  import { buildAceContinuityPacket, buildAceRecallContext, normalizeAutonomyPolicy, normalizeContinuityPolicy, } from "./ace-autonomy.js";
18
18
  import { openStore } from "./store/ace-packed-store.js";
@@ -358,7 +358,7 @@ async function emitVericifyProcessPostForSession(session, kind, summary, toolRef
358
358
  if (!isVericifyBridgeEnabled())
359
359
  return;
360
360
  const refs = deriveVericifyRunRef(session);
361
- await appendVericifyProcessPostSafe({
361
+ const posted = await appendAutomaticVericifyProcessPostSafe({
362
362
  run_id: refs.run_id,
363
363
  branch_id: refs.branch_id,
364
364
  lane_id: refs.lane_id,
@@ -368,7 +368,8 @@ async function emitVericifyProcessPostForSession(session, kind, summary, toolRef
368
368
  tool_refs: toolRefs,
369
369
  evidence_refs: evidenceRefs,
370
370
  }).catch(() => undefined);
371
- refreshVericifyBridgeSnapshotSafe();
371
+ if (posted && !posted.skipped)
372
+ refreshVericifyBridgeSnapshotSafe();
372
373
  }
373
374
  async function touchRuntimeProgress(sessionId, _reason, at = Date.now()) {
374
375
  if (!storeExistsSync(workspaceRoot()))
@@ -664,12 +665,12 @@ async function runSessionLoop(sessionId, context, autoCleanup, runtimeProfileSna
664
665
  let consecutiveStallRestarts = runtimeStatus?.stall_restart_count ?? 0;
665
666
  let isStallRestart = false;
666
667
  let stallRestartContext = "";
667
- // Liveness defaults are explicit runtime policy. The resolved model class
668
- // only informs the default budget profile when the caller has not already
669
- // supplied a workspace/session budget or status-seeded runtime budget.
668
+ // Overall deadlines come only from explicit profile/session policy.
669
+ // Default liveness checks measure silence, separately warning and killing.
670
670
  const livenessDefaults = getLivenessDefaults(effectiveModelClass);
671
671
  const effectiveTurnBudgetMs = runtimeStatus?.turn_budget_ms ?? registryStart.turn_timeout_ms ?? livenessDefaults.turn_budget_ms;
672
- const effectiveStallWindowMs = runtimeStatus?.stall_window_ms ?? livenessDefaults.stall_window_ms;
672
+ const effectiveStallWindowMs = runtimeStatus?.stall_window_ms ?? runtimeProfileSnapshot.profile.executor.stall_window_ms ?? livenessDefaults.stall_window_ms;
673
+ const effectiveStallWarningMs = runtimeProfileSnapshot.profile.executor.stall_warning_ms ?? Math.min(livenessDefaults.stall_warning_ms, effectiveStallWindowMs);
673
674
  const maxStallRestarts = livenessDefaults.max_stall_restarts;
674
675
  const initialBackoffMs = livenessDefaults.initial_backoff_ms;
675
676
  const maxRetryBackoffMs = livenessDefaults.max_retry_backoff_ms;
@@ -698,7 +699,7 @@ async function runSessionLoop(sessionId, context, autoCleanup, runtimeProfileSna
698
699
  const flushProgress = async () => {
699
700
  await pumpProgressWrite().catch(() => undefined);
700
701
  };
701
- for (let turnNumber = 1; turnNumber <= registryStart.max_turns; turnNumber += 1) {
702
+ for (let turnNumber = 1; (registryStart.max_turns === 0 || turnNumber <= registryStart.max_turns); turnNumber += 1) {
702
703
  if (active?.stop_requested) {
703
704
  const stopped = await finalizeSession(sessionId, "stopped", `Unattended session ${sessionId} stopped by request.`);
704
705
  if (stopped) {
@@ -910,6 +911,10 @@ async function runSessionLoop(sessionId, context, autoCleanup, runtimeProfileSna
910
911
  },
911
912
  timeout_ms: effectiveTurnBudgetMs,
912
913
  stall_timeout_ms: effectiveStallWindowMs,
914
+ stall_warning_ms: effectiveStallWarningMs,
915
+ on_stall: (event) => {
916
+ void emitExecutorEvent("RUNTIME_EXECUTOR_SUSPECTED_STALL", "in_progress", `Turn ${turnNumber} has no output for ${event.silence_ms}ms; work remains running until the configured final silence threshold.`, { session_id: sessionId, turn_number: turnNumber, last_progress_at: event.last_progress_at, stall_window_ms: effectiveStallWindowMs }).catch(() => undefined);
917
+ },
913
918
  on_spawn: (child) => {
914
919
  if (active)
915
920
  active.child = child;
@@ -1433,8 +1438,8 @@ export async function startUnattendedSession(input) {
1433
1438
  });
1434
1439
  }
1435
1440
  const workspaceSession = workspace.session;
1436
- const maxTurns = Math.max(1, input.max_turns ?? runtimeProfileSnapshot.profile.executor.max_turns ?? 6);
1437
- const turnTimeout = Math.max(1_000, input.turn_timeout_ms ?? runtimeProfileSnapshot.profile.executor.turn_timeout_ms ?? 300_000);
1441
+ const maxTurns = Math.max(0, input.max_turns ?? runtimeProfileSnapshot.profile.executor.max_turns ?? 0);
1442
+ const turnTimeout = Math.max(0, input.turn_timeout_ms ?? runtimeProfileSnapshot.profile.executor.turn_timeout_ms ?? 0);
1438
1443
  const now = new Date().toISOString();
1439
1444
  const sessionRecord = {
1440
1445
  session_id: sessionId,
@@ -1581,7 +1586,24 @@ export async function stopUnattendedSession(sessionId) {
1581
1586
  };
1582
1587
  }
1583
1588
  active.stop_requested = true;
1584
- active.child?.kill("SIGTERM");
1589
+ const child = active.child;
1590
+ if (child?.pid) {
1591
+ const killGroup = (signal) => {
1592
+ try {
1593
+ if (process.platform === "win32")
1594
+ child.kill(signal);
1595
+ else
1596
+ process.kill(-child.pid, signal);
1597
+ }
1598
+ catch (error) {
1599
+ if (error.code !== "ESRCH")
1600
+ throw error;
1601
+ }
1602
+ };
1603
+ killGroup("SIGTERM");
1604
+ const force = setTimeout(() => killGroup("SIGKILL"), 500);
1605
+ force.unref?.();
1606
+ }
1585
1607
  const waited = await waitForUnattendedSession(sessionId, 15_000);
1586
1608
  return {
1587
1609
  ok: waited.ok,
@@ -0,0 +1,6 @@
1
+ export declare function parseYamlFrontMatter(raw: string): Record<string, unknown>;
2
+ export declare function extractFrontMatter(raw: string): {
3
+ front_matter: string;
4
+ body: string;
5
+ };
6
+ //# sourceMappingURL=runtime-profile-syntax.d.ts.map
@@ -0,0 +1,121 @@
1
+ // Shared ACE_WORKFLOW frontmatter parser; kept independent of runtime/event owners.
2
+ function stripInlineComment(value) {
3
+ let inSingle = false;
4
+ let inDouble = false;
5
+ for (let idx = 0; idx < value.length; idx += 1) {
6
+ const char = value[idx];
7
+ const prev = idx > 0 ? value[idx - 1] : "";
8
+ if (char === "'" && !inDouble)
9
+ inSingle = !inSingle;
10
+ if (char === '"' && !inSingle && prev !== "\\")
11
+ inDouble = !inDouble;
12
+ if (char === "#" && !inSingle && !inDouble) {
13
+ const before = idx > 0 ? value[idx - 1] : "";
14
+ if (!before || /\s/.test(before)) {
15
+ return value.slice(0, idx).trimEnd();
16
+ }
17
+ }
18
+ }
19
+ return value.trimEnd();
20
+ }
21
+ function parseYamlScalar(rawValue, lineNumber) {
22
+ const value = stripInlineComment(rawValue.trim());
23
+ if (value === "null" || value === "~")
24
+ return null;
25
+ if (value === "true")
26
+ return true;
27
+ if (value === "false")
28
+ return false;
29
+ if (value === "{}")
30
+ return {};
31
+ if (value === "[]")
32
+ return [];
33
+ if (/^-?\d+$/.test(value))
34
+ return Number(value);
35
+ if ((value.startsWith("[") && value.endsWith("]")) ||
36
+ (value.startsWith("{") && value.endsWith("}"))) {
37
+ try {
38
+ return JSON.parse(value);
39
+ }
40
+ catch (error) {
41
+ throw new Error(`line ${lineNumber}: invalid JSON-style scalar (${error instanceof Error ? error.message : String(error)})`);
42
+ }
43
+ }
44
+ if ((value.startsWith('"') && value.endsWith('"')) ||
45
+ (value.startsWith("'") && value.endsWith("'"))) {
46
+ const quote = value[0];
47
+ const inner = value.slice(1, -1);
48
+ if (quote === '"') {
49
+ return inner
50
+ .replace(/\\"/g, '"')
51
+ .replace(/\\n/g, "\n")
52
+ .replace(/\\r/g, "\r")
53
+ .replace(/\\t/g, "\t")
54
+ .replace(/\\\\/g, "\\");
55
+ }
56
+ return inner.replace(/''/g, "'");
57
+ }
58
+ return value;
59
+ }
60
+ export function parseYamlFrontMatter(raw) {
61
+ const root = {};
62
+ const stack = [
63
+ { indent: -1, value: root },
64
+ ];
65
+ const lines = raw.split(/\r?\n/);
66
+ lines.forEach((line, index) => {
67
+ const lineNumber = index + 1;
68
+ if (!line.trim() || line.trimStart().startsWith("#"))
69
+ return;
70
+ if (line.includes("\t")) {
71
+ throw new Error(`line ${lineNumber}: tabs are not allowed in ACE runtime front matter`);
72
+ }
73
+ const indentMatch = line.match(/^ */);
74
+ const indent = indentMatch ? indentMatch[0].length : 0;
75
+ if (indent % 2 !== 0) {
76
+ throw new Error(`line ${lineNumber}: indentation must use multiples of two spaces`);
77
+ }
78
+ const trimmed = line.trim();
79
+ if (trimmed.startsWith("- ")) {
80
+ throw new Error(`line ${lineNumber}: arrays are not supported in ACE runtime front matter`);
81
+ }
82
+ const colonIndex = trimmed.indexOf(":");
83
+ if (colonIndex <= 0) {
84
+ throw new Error(`line ${lineNumber}: expected "key: value" mapping`);
85
+ }
86
+ const key = trimmed.slice(0, colonIndex).trim();
87
+ const valuePart = trimmed.slice(colonIndex + 1).trim();
88
+ if (!/^[A-Za-z0-9_-]+$/.test(key)) {
89
+ throw new Error(`line ${lineNumber}: invalid key "${key}"`);
90
+ }
91
+ while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {
92
+ stack.pop();
93
+ }
94
+ const parent = stack[stack.length - 1];
95
+ const expectedIndent = parent.indent < 0 ? 0 : parent.indent + 2;
96
+ if (indent > expectedIndent) {
97
+ throw new Error(`line ${lineNumber}: indentation jumps from ${parent.indent} to ${indent}`);
98
+ }
99
+ if (Object.prototype.hasOwnProperty.call(parent.value, key)) {
100
+ throw new Error(`line ${lineNumber}: duplicate key "${key}"`);
101
+ }
102
+ if (!valuePart) {
103
+ const child = {};
104
+ parent.value[key] = child;
105
+ stack.push({ indent, value: child });
106
+ return;
107
+ }
108
+ parent.value[key] = parseYamlScalar(valuePart, lineNumber);
109
+ });
110
+ return root;
111
+ }
112
+ export function extractFrontMatter(raw) {
113
+ const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/);
114
+ if (!match) {
115
+ throw new Error("ACE_WORKFLOW.md must start with YAML front matter delimited by leading and trailing --- lines");
116
+ }
117
+ const frontMatter = match[1];
118
+ const body = raw.slice(match[0].length);
119
+ return { front_matter: frontMatter, body };
120
+ }
121
+ //# sourceMappingURL=runtime-profile-syntax.js.map
@@ -5,18 +5,20 @@ export declare const RUNTIME_PROFILE_REL_PATH = "agent-state/ACE_WORKFLOW.md";
5
5
  export declare const RUNTIME_PROFILE_SCHEMA_REL_PATH = "agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json";
6
6
  export declare const RUNTIME_PROFILE_SCHEMA_NAME = "ace-runtime-profile@1.0.0";
7
7
  export declare const DEFAULT_RUNTIME_TOOL_REGISTRY_REL_PATH = "agent-state/runtime-tool-specs.json";
8
- export declare const DEFAULT_EXECUTOR_MAX_TURNS = 6;
9
- export declare const DEFAULT_EXECUTOR_TURN_TIMEOUT_MS = 300000;
8
+ export declare const DEFAULT_EXECUTOR_MAX_TURNS = 0;
9
+ export declare const DEFAULT_EXECUTOR_TURN_TIMEOUT_MS = 0;
10
10
  export declare const DEFAULT_VERICIFY_BRIDGE_REL_PATH = "agent-state/vericify/ace-bridge.json";
11
11
  export type RuntimeModelClass = "frontier" | "mid" | "small_local";
12
- export declare const DEFAULT_STALL_WINDOW_MS = 300000;
13
- export declare const DEFAULT_TURN_BUDGET_MS = 1800000;
12
+ export declare const DEFAULT_STALL_WINDOW_MS = 3600000;
13
+ export declare const DEFAULT_STALL_WARNING_MS = 600000;
14
+ export declare const DEFAULT_TURN_BUDGET_MS = 0;
14
15
  export declare const DEFAULT_MAX_STALL_RESTARTS = 3;
15
16
  export declare const DEFAULT_INITIAL_BACKOFF_MS = 5000;
16
17
  export declare const DEFAULT_MAX_RETRY_BACKOFF_MS = 300000;
17
18
  export interface ModelClassLivenessDefaults {
18
19
  turn_budget_ms: number;
19
20
  stall_window_ms: number;
21
+ stall_warning_ms: number;
20
22
  max_stall_restarts: number;
21
23
  initial_backoff_ms: number;
22
24
  max_retry_backoff_ms: number;
@@ -36,6 +38,19 @@ export declare function resolveEffectiveSurgicalReadBudget(profile: RuntimeProfi
36
38
  export declare const DEFAULT_VERICIFY_PROCESS_POST_LOG_REL_PATH = "agent-state/vericify/process-posts.json";
37
39
  declare const runtimeProfileSchema: z.ZodObject<{
38
40
  ace_runtime_version: z.ZodLiteral<"1.0.0">;
41
+ learning: z.ZodDefault<z.ZodOptional<z.ZodObject<{
42
+ enabled: z.ZodDefault<z.ZodBoolean>;
43
+ distill_min_items: z.ZodDefault<z.ZodNumber>;
44
+ distill_min_goals: z.ZodDefault<z.ZodNumber>;
45
+ max_open_learning_steps: z.ZodDefault<z.ZodLiteral<1>>;
46
+ distill_cooldown_days: z.ZodDefault<z.ZodNumber>;
47
+ max_learned_skills: z.ZodDefault<z.ZodNumber>;
48
+ serve_max_lessons: z.ZodDefault<z.ZodNumber>;
49
+ serve_max_skills: z.ZodDefault<z.ZodNumber>;
50
+ serve_max_tokens: z.ZodDefault<z.ZodNumber>;
51
+ retire_unhelpful_after_serves: z.ZodDefault<z.ZodNumber>;
52
+ instructions_require_approval: z.ZodDefault<z.ZodLiteral<true>>;
53
+ }, z.core.$strict>>>;
39
54
  runtime: z.ZodObject<{
40
55
  mode: z.ZodEnum<{
41
56
  interactive: "interactive";
@@ -63,6 +78,8 @@ declare const runtimeProfileSchema: z.ZodObject<{
63
78
  turn_sandbox_policy: z.ZodNullable<z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>>;
64
79
  max_turns: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
65
80
  turn_timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
81
+ stall_window_ms: z.ZodOptional<z.ZodNumber>;
82
+ stall_warning_ms: z.ZodOptional<z.ZodNumber>;
66
83
  }, z.core.$strict>;
67
84
  tools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
68
85
  registry_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -93,8 +110,8 @@ declare const runtimeProfileSchema: z.ZodObject<{
93
110
  tracker: z.ZodObject<{
94
111
  kind: z.ZodEnum<{
95
112
  memory: "memory";
96
- none: "none";
97
113
  external: "external";
114
+ none: "none";
98
115
  }>;
99
116
  config: z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>;
100
117
  }, z.core.$strict>;
@@ -103,6 +120,21 @@ declare const runtimeProfileSchema: z.ZodObject<{
103
120
  http_port: z.ZodNullable<z.ZodNumber>;
104
121
  vericify_bridge: z.ZodDefault<z.ZodOptional<z.ZodObject<{
105
122
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
123
+ legacy_auto_posts: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
124
+ api_path: z.ZodOptional<z.ZodString>;
125
+ native: z.ZodOptional<z.ZodObject<{
126
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
127
+ executable: z.ZodOptional<z.ZodString>;
128
+ data_dir: z.ZodOptional<z.ZodString>;
129
+ workspace_root: z.ZodOptional<z.ZodString>;
130
+ workspace_id: z.ZodOptional<z.ZodString>;
131
+ incarnation: z.ZodOptional<z.ZodString>;
132
+ query_timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
133
+ max_pages: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
134
+ max_bytes: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
135
+ retries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
136
+ acceptance_wait_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
137
+ }, z.core.$strict>>;
106
138
  bridge_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
107
139
  process_post_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
108
140
  }, z.core.$strict>>>;
@@ -1,3 +1,5 @@
1
+ import { parseYamlFrontMatter, extractFrontMatter } from './runtime-profile-syntax.js';
2
+ import { learningPolicySchema, DEFAULT_LEARNING_POLICY } from './learning-policy.js';
1
3
  import { createHash } from "node:crypto";
2
4
  import { existsSync, readFileSync, statSync } from "node:fs";
3
5
  import { resolve } from "node:path";
@@ -10,12 +12,13 @@ export const RUNTIME_PROFILE_REL_PATH = "agent-state/ACE_WORKFLOW.md";
10
12
  export const RUNTIME_PROFILE_SCHEMA_REL_PATH = "agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json";
11
13
  export const RUNTIME_PROFILE_SCHEMA_NAME = "ace-runtime-profile@1.0.0";
12
14
  export const DEFAULT_RUNTIME_TOOL_REGISTRY_REL_PATH = "agent-state/runtime-tool-specs.json";
13
- export const DEFAULT_EXECUTOR_MAX_TURNS = 6;
14
- export const DEFAULT_EXECUTOR_TURN_TIMEOUT_MS = 300_000;
15
+ export const DEFAULT_EXECUTOR_MAX_TURNS = 0;
16
+ export const DEFAULT_EXECUTOR_TURN_TIMEOUT_MS = 0;
15
17
  export const DEFAULT_VERICIFY_BRIDGE_REL_PATH = "agent-state/vericify/ace-bridge.json";
16
18
  // Liveness defaults per model class
17
- export const DEFAULT_STALL_WINDOW_MS = 300_000; // 5 min — inter-progress cap
18
- export const DEFAULT_TURN_BUDGET_MS = 1_800_000; // 30 min — per-turn soft cap
19
+ export const DEFAULT_STALL_WINDOW_MS = 3_600_000; // 60 minutes of silence before termination
20
+ export const DEFAULT_STALL_WARNING_MS = 600_000; // Warn after 10 minutes of silence
21
+ export const DEFAULT_TURN_BUDGET_MS = 0; // No implicit total turn deadline
19
22
  export const DEFAULT_MAX_STALL_RESTARTS = 3;
20
23
  export const DEFAULT_INITIAL_BACKOFF_MS = 5_000;
21
24
  export const DEFAULT_MAX_RETRY_BACKOFF_MS = 300_000;
@@ -28,16 +31,18 @@ export function getLivenessDefaults(modelClass) {
28
31
  switch (modelClass) {
29
32
  case "small_local":
30
33
  return {
31
- turn_budget_ms: 3_600_000, // 60 min — slow models need generous cap
32
- stall_window_ms: 180_000, // 3 min stall window
34
+ turn_budget_ms: DEFAULT_TURN_BUDGET_MS,
35
+ stall_window_ms: DEFAULT_STALL_WINDOW_MS,
36
+ stall_warning_ms: DEFAULT_STALL_WARNING_MS,
33
37
  max_stall_restarts: 3,
34
38
  initial_backoff_ms: 10_000,
35
39
  max_retry_backoff_ms: 300_000,
36
40
  };
37
41
  case "mid":
38
42
  return {
39
- turn_budget_ms: 1_800_000, // 30 min
40
- stall_window_ms: 300_000, // 5 min
43
+ turn_budget_ms: DEFAULT_TURN_BUDGET_MS,
44
+ stall_window_ms: DEFAULT_STALL_WINDOW_MS,
45
+ stall_warning_ms: DEFAULT_STALL_WARNING_MS,
41
46
  max_stall_restarts: 3,
42
47
  initial_backoff_ms: 5_000,
43
48
  max_retry_backoff_ms: 180_000,
@@ -47,6 +52,7 @@ export function getLivenessDefaults(modelClass) {
47
52
  return {
48
53
  turn_budget_ms: DEFAULT_TURN_BUDGET_MS,
49
54
  stall_window_ms: DEFAULT_STALL_WINDOW_MS,
55
+ stall_warning_ms: DEFAULT_STALL_WARNING_MS,
50
56
  max_stall_restarts: DEFAULT_MAX_STALL_RESTARTS,
51
57
  initial_backoff_ms: DEFAULT_INITIAL_BACKOFF_MS,
52
58
  max_retry_backoff_ms: DEFAULT_MAX_RETRY_BACKOFF_MS,
@@ -72,6 +78,7 @@ const STRING_LIST = z.array(z.string().min(1));
72
78
  const runtimeProfileSchema = z
73
79
  .object({
74
80
  ace_runtime_version: z.literal("1.0.0"),
81
+ learning: learningPolicySchema.optional().default(DEFAULT_LEARNING_POLICY),
75
82
  runtime: z
76
83
  .object({
77
84
  mode: z.enum(["interactive", "unattended"]),
@@ -98,13 +105,15 @@ const runtimeProfileSchema = z
98
105
  approval_policy: z.union([z.string(), ANY_OBJECT]),
99
106
  thread_sandbox: z.string().min(1),
100
107
  turn_sandbox_policy: ANY_OBJECT.nullable(),
101
- max_turns: z.number().int().positive().optional().default(DEFAULT_EXECUTOR_MAX_TURNS),
108
+ max_turns: z.number().int().nonnegative().optional().default(DEFAULT_EXECUTOR_MAX_TURNS),
102
109
  turn_timeout_ms: z
103
110
  .number()
104
111
  .int()
105
- .positive()
112
+ .nonnegative()
106
113
  .optional()
107
114
  .default(DEFAULT_EXECUTOR_TURN_TIMEOUT_MS),
115
+ stall_window_ms: z.number().int().nonnegative().optional(),
116
+ stall_warning_ms: z.number().int().nonnegative().optional(),
108
117
  })
109
118
  .strict(),
110
119
  tools: z
@@ -169,6 +178,22 @@ const runtimeProfileSchema = z
169
178
  vericify_bridge: z
170
179
  .object({
171
180
  enabled: z.boolean().optional().default(false),
181
+ // Additive opt-ins: old profiles retain their paths and require no migration.
182
+ legacy_auto_posts: z.boolean().optional().default(false),
183
+ api_path: z.string().min(1).optional(),
184
+ native: z.object({
185
+ enabled: z.boolean().optional().default(false),
186
+ executable: z.string().min(1).optional(),
187
+ data_dir: z.string().min(1).optional(),
188
+ workspace_root: z.string().min(1).optional(),
189
+ workspace_id: z.string().min(1).optional(),
190
+ incarnation: z.string().min(1).optional(),
191
+ query_timeout_ms: z.number().int().min(1000).max(60000).optional().default(15000),
192
+ max_pages: z.number().int().min(1).max(64).optional().default(8),
193
+ max_bytes: z.number().int().min(4096).max(1048576).optional().default(262144),
194
+ retries: z.number().int().min(0).max(3).optional().default(1),
195
+ acceptance_wait_ms: z.number().int().min(0).max(120000).optional().default(15000),
196
+ }).strict().optional(),
172
197
  bridge_path: z
173
198
  .string()
174
199
  .min(1)
@@ -184,6 +209,7 @@ const runtimeProfileSchema = z
184
209
  .optional()
185
210
  .default({
186
211
  enabled: false,
212
+ legacy_auto_posts: false,
187
213
  bridge_path: DEFAULT_VERICIFY_BRIDGE_REL_PATH,
188
214
  process_post_path: DEFAULT_VERICIFY_PROCESS_POST_LOG_REL_PATH,
189
215
  }),
@@ -263,125 +289,6 @@ function computeSignature(path, content) {
263
289
  content_sha256: hashContent(content),
264
290
  };
265
291
  }
266
- function stripInlineComment(value) {
267
- let inSingle = false;
268
- let inDouble = false;
269
- for (let idx = 0; idx < value.length; idx += 1) {
270
- const char = value[idx];
271
- const prev = idx > 0 ? value[idx - 1] : "";
272
- if (char === "'" && !inDouble)
273
- inSingle = !inSingle;
274
- if (char === '"' && !inSingle && prev !== "\\")
275
- inDouble = !inDouble;
276
- if (char === "#" && !inSingle && !inDouble) {
277
- const before = idx > 0 ? value[idx - 1] : "";
278
- if (!before || /\s/.test(before)) {
279
- return value.slice(0, idx).trimEnd();
280
- }
281
- }
282
- }
283
- return value.trimEnd();
284
- }
285
- function parseYamlScalar(rawValue, lineNumber) {
286
- const value = stripInlineComment(rawValue.trim());
287
- if (value === "null" || value === "~")
288
- return null;
289
- if (value === "true")
290
- return true;
291
- if (value === "false")
292
- return false;
293
- if (value === "{}")
294
- return {};
295
- if (value === "[]")
296
- return [];
297
- if (/^-?\d+$/.test(value))
298
- return Number(value);
299
- if ((value.startsWith("[") && value.endsWith("]")) ||
300
- (value.startsWith("{") && value.endsWith("}"))) {
301
- try {
302
- return JSON.parse(value);
303
- }
304
- catch (error) {
305
- throw new Error(`line ${lineNumber}: invalid JSON-style scalar (${error instanceof Error ? error.message : String(error)})`);
306
- }
307
- }
308
- if ((value.startsWith('"') && value.endsWith('"')) ||
309
- (value.startsWith("'") && value.endsWith("'"))) {
310
- const quote = value[0];
311
- const inner = value.slice(1, -1);
312
- if (quote === '"') {
313
- return inner
314
- .replace(/\\"/g, '"')
315
- .replace(/\\n/g, "\n")
316
- .replace(/\\r/g, "\r")
317
- .replace(/\\t/g, "\t")
318
- .replace(/\\\\/g, "\\");
319
- }
320
- return inner.replace(/''/g, "'");
321
- }
322
- return value;
323
- }
324
- function parseYamlFrontMatter(raw) {
325
- const root = {};
326
- const stack = [
327
- { indent: -1, value: root },
328
- ];
329
- const lines = raw.split(/\r?\n/);
330
- lines.forEach((line, index) => {
331
- const lineNumber = index + 1;
332
- if (!line.trim() || line.trimStart().startsWith("#"))
333
- return;
334
- if (line.includes("\t")) {
335
- throw new Error(`line ${lineNumber}: tabs are not allowed in ACE runtime front matter`);
336
- }
337
- const indentMatch = line.match(/^ */);
338
- const indent = indentMatch ? indentMatch[0].length : 0;
339
- if (indent % 2 !== 0) {
340
- throw new Error(`line ${lineNumber}: indentation must use multiples of two spaces`);
341
- }
342
- const trimmed = line.trim();
343
- if (trimmed.startsWith("- ")) {
344
- throw new Error(`line ${lineNumber}: arrays are not supported in ACE runtime front matter`);
345
- }
346
- const colonIndex = trimmed.indexOf(":");
347
- if (colonIndex <= 0) {
348
- throw new Error(`line ${lineNumber}: expected "key: value" mapping`);
349
- }
350
- const key = trimmed.slice(0, colonIndex).trim();
351
- const valuePart = trimmed.slice(colonIndex + 1).trim();
352
- if (!/^[A-Za-z0-9_-]+$/.test(key)) {
353
- throw new Error(`line ${lineNumber}: invalid key "${key}"`);
354
- }
355
- while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {
356
- stack.pop();
357
- }
358
- const parent = stack[stack.length - 1];
359
- const expectedIndent = parent.indent < 0 ? 0 : parent.indent + 2;
360
- if (indent > expectedIndent) {
361
- throw new Error(`line ${lineNumber}: indentation jumps from ${parent.indent} to ${indent}`);
362
- }
363
- if (Object.prototype.hasOwnProperty.call(parent.value, key)) {
364
- throw new Error(`line ${lineNumber}: duplicate key "${key}"`);
365
- }
366
- if (!valuePart) {
367
- const child = {};
368
- parent.value[key] = child;
369
- stack.push({ indent, value: child });
370
- return;
371
- }
372
- parent.value[key] = parseYamlScalar(valuePart, lineNumber);
373
- });
374
- return root;
375
- }
376
- function extractFrontMatter(raw) {
377
- const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/);
378
- if (!match) {
379
- throw new Error("ACE_WORKFLOW.md must start with YAML front matter delimited by leading and trailing --- lines");
380
- }
381
- const frontMatter = match[1];
382
- const body = raw.slice(match[0].length);
383
- return { front_matter: frontMatter, body };
384
- }
385
292
  function parseRuntimeProfileContent(raw) {
386
293
  const { front_matter, body } = extractFrontMatter(raw);
387
294
  if (body.length === 0) {
@@ -416,7 +416,7 @@ export async function executeRuntimeTool(name, input, context = {}) {
416
416
  ACE_RUNTIME_WORKSPACE_PATH: workspacePath,
417
417
  },
418
418
  }),
419
- timeout_ms: spec.executor.timeout_ms ?? 60_000,
419
+ timeout_ms: spec.executor.timeout_ms,
420
420
  });
421
421
  let responseRaw;
422
422
  if (existsSync(tempPaths.responsePath)) {
@@ -2,7 +2,9 @@
2
2
  * Safe-edit module: copy → modify → validate → swap pattern.
3
3
  * Prevents bricking by never leaving core files in a broken state.
4
4
  */
5
+ import { type CommandOptions } from "./progress-command.js";
5
6
  export interface SafeEditInput {
7
+ command_policy?: CommandOptions;
6
8
  /** Workspace-relative path to edit. */
7
9
  path: string;
8
10
  /** New file content. */
@@ -41,6 +43,7 @@ export interface TestSuiteResult {
41
43
  output: string;
42
44
  command: string;
43
45
  duration_ms: number;
46
+ reason_code?: string;
44
47
  }
45
48
  export interface DiffResult {
46
49
  has_diff: boolean;
@@ -62,18 +65,19 @@ export interface GcStagingResult {
62
65
  errors: string[];
63
66
  }
64
67
  export declare function gcStaging(input?: GcStagingInput): GcStagingResult;
65
- export declare function safeEditFile(input: SafeEditInput): SafeEditResult;
66
- export declare function runTestSuite(command?: string): TestSuiteResult;
68
+ export declare function safeEditFile(input: SafeEditInput): Promise<SafeEditResult>;
69
+ export declare function runTestSuite(command?: string, options?: CommandOptions): Promise<TestSuiteResult>;
67
70
  export declare function diffContents(original: string, updated: string): DiffResult;
68
71
  export declare function diffFiles(pathA: string, pathB: string): DiffResult & {
69
72
  error?: string;
70
73
  };
71
74
  export interface ApplyPatchInput {
75
+ command_policy?: CommandOptions;
72
76
  path: string;
73
77
  patch: string;
74
78
  expected_base_hash?: string;
75
79
  validation_command?: string;
76
80
  test_command?: string;
77
81
  }
78
- export declare function applyPatch(input: ApplyPatchInput): SafeEditResult;
82
+ export declare function applyPatch(input: ApplyPatchInput): Promise<SafeEditResult>;
79
83
  //# sourceMappingURL=safe-edit.d.ts.map