@voybio/ace-swarm 2.4.4 → 2.4.7

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 +41 -12
  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 +623 -11
  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 +127 -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
@@ -0,0 +1,155 @@
1
+ /**
2
+ * ACE Goal Engine (WS-F).
3
+ *
4
+ * `startGoal("<objective>")` compiles a plan with ACE's own planner, then a
5
+ * self-paced driver loop (`runGoal`) executes it step-by-step under evidence-
6
+ * gated completion. A goal can leave `executing` only through one of four
7
+ * control-flow paths — evidence-gated success, budget exhaustion, operator
8
+ * stop, or an escalated blocker — so "declaring success by prose" is
9
+ * structurally impossible (there is no code path from a model message to
10
+ * `status: "done"`).
11
+ *
12
+ * That guarantee rests on the success contract carrying at least one
13
+ * machine-checkable obligation. A contract with none is refused at `startGoal`
14
+ * and again at verify time with `contract_uncheckable`, never satisfied
15
+ * vacuously — see {@link enforceableObligationCount}.
16
+ *
17
+ * This composes existing organs rather than forking a second orchestrator:
18
+ * - planning: proposePlan → validatePlan (blocking) → createTaskPlan
19
+ * - execution: getReadyTaskSteps / applyBridgeResultToStep / amendTaskPlan
20
+ * (the supervisor's own step primitives), one step per tick
21
+ * - completion: the same artifact-existence check the ModelBridge false-
22
+ * completion gate uses, run against the compiled success contract
23
+ *
24
+ * The single new mechanism is the goal record + tick/budget policy. All side
25
+ * effects (spawning a step, running a verification command, checking an
26
+ * artifact, sleeping, posting) are injectable so the engine is driven
27
+ * hermetically in tests with a stub bridge.
28
+ */
29
+ import type { BridgeResult } from "./model-bridge.js";
30
+ import { type TaskPlan, type TaskStep } from "./orchestrator-supervisor.js";
31
+ import type { ProposePlanResult } from "./plan-proposal.js";
32
+ import { GoalRepository, type GoalEscalationKind, type GoalRecord, type SuccessContract } from "./store/repositories/goal-repository.js";
33
+ export type { GoalRecord, GoalStatus, GoalBudgets, SuccessContract, } from "./store/repositories/goal-repository.js";
34
+ export interface CompiledPlan {
35
+ proposal: ProposePlanResult;
36
+ verdict: {
37
+ ok: boolean;
38
+ score: number;
39
+ blocking_findings: string[];
40
+ };
41
+ }
42
+ export interface GoalEngineDeps {
43
+ workspaceRoot?: string;
44
+ /** Millisecond clock (injectable so budgets/heartbeats are deterministic). */
45
+ now?: () => number;
46
+ /** Executes one plan step. Default: local ModelBridge via runLocalModelTask. */
47
+ spawnStep?: (step: TaskStep, plan: TaskPlan, goal: GoalRecord) => Promise<BridgeResult>;
48
+ /** Compiles an objective into a validated proposal. Default: proposePlan+validatePlan. */
49
+ compilePlan?: (objective: string) => Promise<CompiledPlan>;
50
+ /** Runs a verification command; ok === (exit 0). Default: exec in workspace. */
51
+ runVerification?: (command: string, workspaceRoot: string) => Promise<{
52
+ ok: boolean;
53
+ output: string;
54
+ }>;
55
+ /** Returns true when an expected artifact exists. Default: fs existence check. */
56
+ artifactExists?: (path: string, workspaceRoot: string) => boolean;
57
+ /** Cooperative sleep between ticks. Default: real timer. */
58
+ sleep?: (ms: number) => Promise<void>;
59
+ /** Status-event sink. Default: appendStatusEventSafe. */
60
+ emitStatusEvent?: (input: {
61
+ status: string;
62
+ summary: string;
63
+ payload: Record<string, unknown>;
64
+ }) => Promise<void>;
65
+ /** Vericify process-post sink. Default: appendVericifyProcessPostSafe. */
66
+ appendProcessPost?: (input: {
67
+ kind: GoalEscalationKind | "progress" | "completion";
68
+ summary: string;
69
+ reason_code?: string;
70
+ evidence_refs?: string[];
71
+ }) => Promise<void>;
72
+ }
73
+ export interface StartGoalOptions {
74
+ budget_hours?: number;
75
+ max_ticks?: number;
76
+ max_replans?: number;
77
+ plan_only?: boolean;
78
+ goal_id?: string;
79
+ /** Shell commands that must exit 0 before the goal can reach `done`. */
80
+ verify_commands?: string[];
81
+ }
82
+ interface ResolvedDeps {
83
+ workspaceRoot: string;
84
+ repo: GoalRepository;
85
+ now: () => number;
86
+ spawnStep: NonNullable<GoalEngineDeps["spawnStep"]>;
87
+ compilePlan: NonNullable<GoalEngineDeps["compilePlan"]>;
88
+ runVerification: NonNullable<GoalEngineDeps["runVerification"]>;
89
+ artifactExists: NonNullable<GoalEngineDeps["artifactExists"]>;
90
+ sleep: NonNullable<GoalEngineDeps["sleep"]>;
91
+ emitStatusEvent: NonNullable<GoalEngineDeps["emitStatusEvent"]>;
92
+ appendProcessPost: NonNullable<GoalEngineDeps["appendProcessPost"]>;
93
+ }
94
+ /**
95
+ * The number of machine-checkable obligations in a contract. Zero means the
96
+ * only thing standing between the model and `status: "done"` is the model's own
97
+ * assertion — which is exactly what this engine exists to prevent.
98
+ *
99
+ * `gate_ids` is excluded: nothing populates it yet (see goal-repository.ts).
100
+ */
101
+ export declare function enforceableObligationCount(contract: SuccessContract): number;
102
+ export interface StartGoalResult {
103
+ ok: boolean;
104
+ goal: GoalRecord;
105
+ reason_code?: string;
106
+ blocking_findings?: string[];
107
+ }
108
+ export declare function startGoal(objective: string, options?: StartGoalOptions, deps?: GoalEngineDeps): Promise<StartGoalResult>;
109
+ export interface TickGoalResult {
110
+ goal: GoalRecord;
111
+ plan: TaskPlan;
112
+ progressed: boolean;
113
+ step_id?: string;
114
+ step_status?: TaskStep["status"];
115
+ }
116
+ export declare function tickGoal(goalId: string, deps?: GoalEngineDeps): Promise<TickGoalResult>;
117
+ export interface ContractCheckResult {
118
+ ok: boolean;
119
+ missing_artifacts: string[];
120
+ missing_evidence_refs: string[];
121
+ failed_commands: string[];
122
+ /** True when the contract carries zero enforceable obligations. Never `ok`. */
123
+ uncheckable: boolean;
124
+ }
125
+ export declare function checkSuccessContract(d: ResolvedDeps, goal: GoalRecord): Promise<ContractCheckResult>;
126
+ export interface RunGoalResult {
127
+ goal: GoalRecord;
128
+ plan?: TaskPlan;
129
+ }
130
+ export declare function runGoal(goalId: string, deps?: GoalEngineDeps): Promise<RunGoalResult>;
131
+ export declare function resumeGoal(goalId: string, deps?: GoalEngineDeps): Promise<RunGoalResult>;
132
+ export declare function stopGoal(goalId: string, deps?: GoalEngineDeps): GoalRecord;
133
+ export interface GoalStatusView {
134
+ goal: GoalRecord;
135
+ plan?: TaskPlan;
136
+ ready_steps: string[];
137
+ plan_status?: string;
138
+ }
139
+ export declare function getGoalStatus(goalId: string, deps?: GoalEngineDeps): GoalStatusView | undefined;
140
+ export declare function listGoals(filter?: {
141
+ status?: GoalRecord["status"];
142
+ }, deps?: GoalEngineDeps): import("./store/repositories/goal-repository.js").GoalIndexEntry[];
143
+ export declare class UnknownGoalError extends Error {
144
+ readonly goal_id: string;
145
+ readonly name = "UnknownGoalError";
146
+ constructor(goal_id: string);
147
+ }
148
+ /** A goal whose state cannot be revived by re-running it. Reported, not thrown, at the CLI. */
149
+ export declare class GoalNotResumableError extends Error {
150
+ readonly goal_id: string;
151
+ readonly message: string;
152
+ readonly name = "GoalNotResumableError";
153
+ constructor(goal_id: string, message: string);
154
+ }
155
+ //# sourceMappingURL=goal-engine.d.ts.map