@voybio/ace-swarm 0.2.5 → 2.4.1

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 (144) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/README.md +21 -13
  3. package/assets/.agents/ACE/agent-qa/instructions.md +11 -0
  4. package/assets/agent-state/EVIDENCE_LOG.md +1 -1
  5. package/assets/agent-state/MODULES/roles/capability-framework.json +41 -0
  6. package/assets/agent-state/MODULES/roles/capability-git.json +33 -0
  7. package/assets/agent-state/MODULES/roles/capability-safety.json +37 -0
  8. package/assets/agent-state/MODULES/schemas/ACE_RUNTIME_PROFILE.schema.json +21 -0
  9. package/assets/agent-state/MODULES/schemas/RUNTIME_EXECUTOR_SESSION_REGISTRY.schema.json +43 -0
  10. package/assets/agent-state/MODULES/schemas/RUNTIME_TOOL_SPEC_REGISTRY.schema.json +43 -0
  11. package/assets/agent-state/MODULES/schemas/WORKSPACE_SESSION_REGISTRY.schema.json +11 -0
  12. package/assets/agent-state/STATUS.md +2 -2
  13. package/assets/agent-state/runtime-tool-specs.json +70 -2
  14. package/assets/instructions/ACE_Coder.instructions.md +13 -0
  15. package/assets/instructions/ACE_UI.instructions.md +11 -0
  16. package/assets/scripts/ace-hook-dispatch.mjs +70 -6
  17. package/assets/scripts/render-mcp-configs.sh +19 -5
  18. package/dist/ace-context.js +91 -11
  19. package/dist/ace-internal-tools.d.ts +3 -1
  20. package/dist/ace-internal-tools.js +10 -2
  21. package/dist/ace-server-instructions.js +3 -3
  22. package/dist/ace-state-resolver.js +5 -3
  23. package/dist/agent-runtime/role-adapters.d.ts +18 -1
  24. package/dist/agent-runtime/role-adapters.js +49 -5
  25. package/dist/astgrep-index.d.ts +57 -1
  26. package/dist/astgrep-index.js +140 -4
  27. package/dist/cli.js +232 -35
  28. package/dist/discovery-runtime-wrappers.d.ts +108 -0
  29. package/dist/discovery-runtime-wrappers.js +615 -0
  30. package/dist/handoff-registry.js +5 -5
  31. package/dist/helpers/artifacts.d.ts +19 -0
  32. package/dist/helpers/artifacts.js +152 -0
  33. package/dist/helpers/bootstrap.d.ts +24 -0
  34. package/dist/helpers/bootstrap.js +894 -0
  35. package/dist/helpers/constants.d.ts +53 -0
  36. package/dist/helpers/constants.js +295 -0
  37. package/dist/helpers/drift.d.ts +13 -0
  38. package/dist/helpers/drift.js +45 -0
  39. package/dist/helpers/path-utils.d.ts +24 -0
  40. package/dist/helpers/path-utils.js +123 -0
  41. package/dist/helpers/store-resolution.d.ts +19 -0
  42. package/dist/helpers/store-resolution.js +305 -0
  43. package/dist/helpers/workspace-root.d.ts +3 -0
  44. package/dist/helpers/workspace-root.js +80 -0
  45. package/dist/helpers.d.ts +8 -125
  46. package/dist/helpers.js +8 -1768
  47. package/dist/job-scheduler.js +33 -7
  48. package/dist/json-sanitizer.d.ts +16 -0
  49. package/dist/json-sanitizer.js +26 -0
  50. package/dist/local-model-policy.d.ts +27 -0
  51. package/dist/local-model-policy.js +84 -0
  52. package/dist/local-model-runtime.d.ts +6 -0
  53. package/dist/local-model-runtime.js +33 -21
  54. package/dist/model-bridge.d.ts +13 -1
  55. package/dist/model-bridge.js +410 -23
  56. package/dist/orchestrator-supervisor.d.ts +56 -0
  57. package/dist/orchestrator-supervisor.js +179 -1
  58. package/dist/plan-proposal.d.ts +115 -0
  59. package/dist/plan-proposal.js +1073 -0
  60. package/dist/run-ledger.js +3 -3
  61. package/dist/runtime-command.d.ts +8 -0
  62. package/dist/runtime-command.js +38 -6
  63. package/dist/runtime-executor.d.ts +20 -1
  64. package/dist/runtime-executor.js +737 -172
  65. package/dist/runtime-profile.d.ts +32 -0
  66. package/dist/runtime-profile.js +89 -13
  67. package/dist/runtime-tool-specs.d.ts +39 -0
  68. package/dist/runtime-tool-specs.js +144 -28
  69. package/dist/safe-edit.d.ts +7 -0
  70. package/dist/safe-edit.js +163 -37
  71. package/dist/schemas.js +48 -1
  72. package/dist/server.js +51 -0
  73. package/dist/shared.d.ts +3 -2
  74. package/dist/shared.js +2 -0
  75. package/dist/status-events.js +9 -6
  76. package/dist/store/ace-packed-store.d.ts +3 -2
  77. package/dist/store/ace-packed-store.js +188 -110
  78. package/dist/store/bootstrap-store.d.ts +2 -1
  79. package/dist/store/bootstrap-store.js +102 -83
  80. package/dist/store/cache-workspace.js +11 -5
  81. package/dist/store/materializers/context-snapshot-materializer.js +6 -2
  82. package/dist/store/materializers/hook-context-materializer.d.ts +6 -9
  83. package/dist/store/materializers/hook-context-materializer.js +11 -21
  84. package/dist/store/materializers/host-file-materializer.js +6 -0
  85. package/dist/store/materializers/projection-manager.d.ts +0 -1
  86. package/dist/store/materializers/projection-manager.js +5 -13
  87. package/dist/store/materializers/scheduler-projection-materializer.js +1 -1
  88. package/dist/store/materializers/vericify-projector.d.ts +7 -7
  89. package/dist/store/materializers/vericify-projector.js +11 -11
  90. package/dist/store/repositories/local-model-runtime-repository.d.ts +120 -3
  91. package/dist/store/repositories/local-model-runtime-repository.js +242 -6
  92. package/dist/store/repositories/vericify-repository.d.ts +1 -1
  93. package/dist/store/skills-install.d.ts +4 -0
  94. package/dist/store/skills-install.js +21 -12
  95. package/dist/store/state-reader.d.ts +2 -0
  96. package/dist/store/state-reader.js +20 -0
  97. package/dist/store/store-artifacts.d.ts +7 -0
  98. package/dist/store/store-artifacts.js +27 -1
  99. package/dist/store/store-authority-audit.d.ts +18 -1
  100. package/dist/store/store-authority-audit.js +115 -5
  101. package/dist/store/store-snapshot.d.ts +3 -0
  102. package/dist/store/store-snapshot.js +22 -2
  103. package/dist/store/workspace-store-paths.d.ts +39 -0
  104. package/dist/store/workspace-store-paths.js +94 -0
  105. package/dist/store/write-coordinator.d.ts +65 -0
  106. package/dist/store/write-coordinator.js +386 -0
  107. package/dist/todo-state.js +5 -5
  108. package/dist/tools-agent.d.ts +20 -0
  109. package/dist/tools-agent.js +789 -25
  110. package/dist/tools-discovery.js +136 -1
  111. package/dist/tools-files.d.ts +7 -0
  112. package/dist/tools-files.js +1002 -11
  113. package/dist/tools-framework.js +105 -66
  114. package/dist/tools-handoff.js +2 -2
  115. package/dist/tools-lifecycle.js +4 -4
  116. package/dist/tools-memory.js +6 -6
  117. package/dist/tools-todo.js +2 -2
  118. package/dist/tracker-adapters.d.ts +1 -1
  119. package/dist/tracker-adapters.js +13 -18
  120. package/dist/tracker-sync.js +5 -3
  121. package/dist/tui/agent-runner.js +3 -1
  122. package/dist/tui/chat.js +103 -7
  123. package/dist/tui/dashboard.d.ts +1 -0
  124. package/dist/tui/dashboard.js +43 -0
  125. package/dist/tui/index.js +10 -1
  126. package/dist/tui/layout.d.ts +20 -0
  127. package/dist/tui/layout.js +31 -1
  128. package/dist/tui/local-model-contract.d.ts +6 -2
  129. package/dist/tui/local-model-contract.js +16 -3
  130. package/dist/tui/ollama.d.ts +8 -1
  131. package/dist/tui/ollama.js +53 -12
  132. package/dist/tui/openai-compatible.d.ts +13 -0
  133. package/dist/tui/openai-compatible.js +305 -5
  134. package/dist/tui/provider-discovery.d.ts +1 -0
  135. package/dist/tui/provider-discovery.js +35 -11
  136. package/dist/vericify-bridge.d.ts +6 -1
  137. package/dist/vericify-bridge.js +27 -3
  138. package/dist/workspace-manager.d.ts +30 -3
  139. package/dist/workspace-manager.js +257 -27
  140. package/package.json +1 -2
  141. package/dist/internal-tool-runtime.d.ts +0 -21
  142. package/dist/internal-tool-runtime.js +0 -136
  143. package/dist/store/workspace-snapshot.d.ts +0 -26
  144. package/dist/store/workspace-snapshot.js +0 -107
@@ -4,7 +4,7 @@ import { isReadError } from "./shared.js";
4
4
  import { openStore } from "./store/ace-packed-store.js";
5
5
  import { ProjectionManager } from "./store/materializers/projection-manager.js";
6
6
  import { LedgerRepository } from "./store/repositories/ledger-repository.js";
7
- import { withStoreWriteQueue } from "./store/write-queue.js";
7
+ import { withStoreWriteCoordinator } from "./store/write-coordinator.js";
8
8
  import { getWorkspaceStorePath, listStoreKeysSync, readStoreJsonSync, storeExistsSync, } from "./store/store-snapshot.js";
9
9
  import { operationalArtifactVirtualPath } from "./store/store-artifacts.js";
10
10
  /** Maximum entries kept in run-ledger.json before rotation. */
@@ -216,7 +216,7 @@ export async function appendRunLedgerEntrySafe(input) {
216
216
  return withFileLock(RUN_LEDGER_REL, () => appendRunLedgerEntry(input));
217
217
  }
218
218
  return withFileLock(RUN_LEDGER_REL, async () => {
219
- return withStoreWriteQueue(storePath, async () => {
219
+ return withStoreWriteCoordinator(storePath, async () => {
220
220
  const store = await openStore(storePath);
221
221
  try {
222
222
  const ledger = new LedgerRepository(store);
@@ -244,7 +244,7 @@ export async function appendRunLedgerEntrySafe(input) {
244
244
  finally {
245
245
  await store.close();
246
246
  }
247
- });
247
+ }, { operation_label: "appendRunLedgerEntrySafe" });
248
248
  });
249
249
  }
250
250
  export function getRunLedgerPath() {
@@ -5,14 +5,22 @@ export interface ShellCommandResult {
5
5
  stdout: string;
6
6
  stderr: string;
7
7
  timed_out: boolean;
8
+ timeout_reason?: "turn_budget" | "stall";
8
9
  duration_ms: number;
10
+ last_progress_at: number;
11
+ }
12
+ export interface ShellCommandProgressEvent {
13
+ source: "spawn" | "stdout" | "stderr";
14
+ at: number;
9
15
  }
10
16
  export interface RunShellCommandOptions {
11
17
  cwd: string;
12
18
  env?: NodeJS.ProcessEnv;
13
19
  timeout_ms: number;
20
+ stall_timeout_ms?: number;
14
21
  max_output_bytes?: number;
15
22
  on_spawn?: (child: ChildProcess) => void;
23
+ on_progress?: (event: ShellCommandProgressEvent) => void;
16
24
  }
17
25
  export declare function runShellCommand(command: string, options: RunShellCommandOptions): Promise<ShellCommandResult>;
18
26
  //# sourceMappingURL=runtime-command.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
+ const STALL_TIMEOUT_SCHEDULER_GRACE_MS = 50;
2
3
  function appendChunk(buffer, chunk, maxBytes) {
3
4
  const next = buffer + chunk;
4
5
  if (Buffer.byteLength(next, "utf8") <= maxBytes) {
@@ -14,7 +15,10 @@ export async function runShellCommand(command, options) {
14
15
  let stdout = "";
15
16
  let stderr = "";
16
17
  let timedOut = false;
18
+ let timeoutReason;
17
19
  let finished = false;
20
+ let lastProgressAt = startedAt;
21
+ let stallTimer;
18
22
  let forcedKillTimer;
19
23
  let child;
20
24
  try {
@@ -29,32 +33,58 @@ export async function runShellCommand(command, options) {
29
33
  return;
30
34
  }
31
35
  options.on_spawn?.(child);
36
+ const requestTimeout = (reason) => {
37
+ if (finished || timedOut)
38
+ return;
39
+ timedOut = true;
40
+ timeoutReason = reason;
41
+ child.kill("SIGTERM");
42
+ forcedKillTimer = setTimeout(() => {
43
+ if (!finished)
44
+ child.kill("SIGKILL");
45
+ }, 500);
46
+ };
47
+ const resetStallTimer = () => {
48
+ if (stallTimer)
49
+ clearTimeout(stallTimer);
50
+ const stallTimeoutMs = options.stall_timeout_ms;
51
+ if (!stallTimeoutMs || stallTimeoutMs <= 0)
52
+ return;
53
+ stallTimer = setTimeout(() => requestTimeout("stall"), stallTimeoutMs + STALL_TIMEOUT_SCHEDULER_GRACE_MS);
54
+ };
55
+ const recordProgress = (source) => {
56
+ lastProgressAt = Date.now();
57
+ options.on_progress?.({ source, at: lastProgressAt });
58
+ resetStallTimer();
59
+ };
32
60
  const finish = (result) => {
33
61
  if (finished)
34
62
  return;
35
63
  finished = true;
64
+ if (stallTimer)
65
+ clearTimeout(stallTimer);
36
66
  if (forcedKillTimer)
37
67
  clearTimeout(forcedKillTimer);
38
68
  resolve(result);
39
69
  };
40
70
  const timeout = setTimeout(() => {
41
- timedOut = true;
42
- child.kill("SIGTERM");
43
- forcedKillTimer = setTimeout(() => {
44
- if (!finished)
45
- child.kill("SIGKILL");
46
- }, 500);
71
+ requestTimeout("turn_budget");
47
72
  }, options.timeout_ms);
73
+ recordProgress("spawn");
48
74
  child.stdout?.setEncoding("utf8");
49
75
  child.stdout?.on("data", (chunk) => {
50
76
  stdout = appendChunk(stdout, String(chunk), maxOutputBytes);
77
+ recordProgress("stdout");
51
78
  });
52
79
  child.stderr?.setEncoding("utf8");
53
80
  child.stderr?.on("data", (chunk) => {
54
81
  stderr = appendChunk(stderr, String(chunk), maxOutputBytes);
82
+ recordProgress("stderr");
55
83
  });
56
84
  child.on("error", (error) => {
57
85
  clearTimeout(timeout);
86
+ if (stallTimer)
87
+ clearTimeout(stallTimer);
58
88
  if (forcedKillTimer)
59
89
  clearTimeout(forcedKillTimer);
60
90
  if (!finished)
@@ -68,7 +98,9 @@ export async function runShellCommand(command, options) {
68
98
  stdout,
69
99
  stderr,
70
100
  timed_out: timedOut,
101
+ timeout_reason: timeoutReason,
71
102
  duration_ms: Date.now() - startedAt,
103
+ last_progress_at: lastProgressAt,
72
104
  });
73
105
  });
74
106
  });
@@ -5,6 +5,13 @@ export declare const RUNTIME_EXECUTOR_SESSION_SCHEMA_REL_PATH = "agent-state/MOD
5
5
  export declare const RUNTIME_EXECUTOR_SESSION_SCHEMA_NAME = "runtime-executor-session-registry@1.0.0";
6
6
  export type UnattendedSessionStatus = "starting" | "running" | "completed" | "failed" | "blocked" | "stopped";
7
7
  export type UnattendedTurnStatus = "completed" | "failed" | "blocked" | "stopped";
8
+ export type TurnOutcome = "no_op_success" | "meaningful_completion" | "escalation_blocker";
9
+ export interface TurnOutputPolicy {
10
+ emit_to: ("tui" | "tracker" | "handoff" | "vericify")[];
11
+ silent_unless_blocked: boolean;
12
+ require_approval_before_emit: boolean;
13
+ }
14
+ export declare const DEFAULT_TURN_OUTPUT_POLICY: TurnOutputPolicy;
8
15
  export interface UnattendedToolCallRecord {
9
16
  tool_name: string;
10
17
  ok: boolean;
@@ -32,6 +39,8 @@ export interface UnattendedTurnRecord {
32
39
  stdout: string;
33
40
  stderr: string;
34
41
  tool_calls: UnattendedToolCallRecord[];
42
+ turn_outcome?: TurnOutcome;
43
+ outcome_reason?: string;
35
44
  }
36
45
  export interface UnattendedSessionRecord {
37
46
  session_id: string;
@@ -55,7 +64,10 @@ export interface UnattendedSessionRecord {
55
64
  last_error?: string;
56
65
  cleanup_error?: string;
57
66
  workspace_cleanup_status: "pending" | "removed" | "archived" | "failed";
67
+ output_policy?: TurnOutputPolicy;
58
68
  turns: UnattendedTurnRecord[];
69
+ /** Set after propose_plan + validate_plan succeed in the before_run preflight. */
70
+ validated_plan_id?: string;
59
71
  }
60
72
  export interface UnattendedSessionRegistry {
61
73
  version: 1;
@@ -64,6 +76,7 @@ export interface UnattendedSessionRegistry {
64
76
  }
65
77
  export interface StartUnattendedSessionInput {
66
78
  session_id?: string;
79
+ workspace_root?: string;
67
80
  task: string;
68
81
  context?: Record<string, unknown>;
69
82
  workspace_name?: string;
@@ -73,6 +86,9 @@ export interface StartUnattendedSessionInput {
73
86
  max_turns?: number;
74
87
  turn_timeout_ms?: number;
75
88
  auto_cleanup?: boolean;
89
+ emit_to?: TurnOutputPolicy["emit_to"];
90
+ silent_unless_blocked?: boolean;
91
+ require_approval_before_emit?: boolean;
76
92
  }
77
93
  export interface StartUnattendedSessionResult {
78
94
  ok: boolean;
@@ -94,11 +110,14 @@ export interface WaitForUnattendedSessionResult {
94
110
  session?: UnattendedSessionRecord;
95
111
  error?: string;
96
112
  }
113
+ export interface WaitForUnattendedSessionOptions {
114
+ flush_sidecars?: boolean;
115
+ }
97
116
  export declare function validateRuntimeExecutorSessionRegistryContent(raw: string): ValidationResult;
98
117
  export declare function listUnattendedSessions(): UnattendedSessionRegistry;
99
118
  export declare function getUnattendedSession(sessionId: string): UnattendedSessionRecord | undefined;
100
119
  export declare function getRuntimeExecutorSessionRegistryPath(): string;
101
120
  export declare function startUnattendedSession(input: StartUnattendedSessionInput): Promise<StartUnattendedSessionResult>;
102
- export declare function waitForUnattendedSession(sessionId: string, timeoutMs?: number): Promise<WaitForUnattendedSessionResult>;
121
+ export declare function waitForUnattendedSession(sessionId: string, timeoutMsOrOptions?: number | WaitForUnattendedSessionOptions, options?: WaitForUnattendedSessionOptions): Promise<WaitForUnattendedSessionResult>;
103
122
  export declare function stopUnattendedSession(sessionId: string): Promise<StopUnattendedSessionResult>;
104
123
  //# sourceMappingURL=runtime-executor.d.ts.map