ace-swarm 2.2.0 → 2.3.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 (77) hide show
  1. package/CHANGELOG.md +52 -1
  2. package/README.md +86 -40
  3. package/assets/.github/hooks/ace-copilot.json +16 -16
  4. package/assets/agent-state/MODULES/schemas/VERICIFY_PROCESS_POST_LOG.schema.json +1 -0
  5. package/assets/scripts/ace-hook-dispatch.mjs +447 -0
  6. package/assets/scripts/copilot-hook-dispatch.mjs +1 -303
  7. package/assets/scripts/render-mcp-configs.sh +328 -1
  8. package/dist/ace-context.d.ts +29 -0
  9. package/dist/ace-context.d.ts.map +1 -0
  10. package/dist/ace-context.js +240 -0
  11. package/dist/ace-context.js.map +1 -0
  12. package/dist/ace-internal-tools.d.ts +8 -0
  13. package/dist/ace-internal-tools.d.ts.map +1 -0
  14. package/dist/ace-internal-tools.js +76 -0
  15. package/dist/ace-internal-tools.js.map +1 -0
  16. package/dist/ace-server-instructions.d.ts +12 -0
  17. package/dist/ace-server-instructions.d.ts.map +1 -0
  18. package/dist/ace-server-instructions.js +299 -0
  19. package/dist/ace-server-instructions.js.map +1 -0
  20. package/dist/helpers.d.ts.map +1 -1
  21. package/dist/helpers.js +90 -0
  22. package/dist/helpers.js.map +1 -1
  23. package/dist/internal-tool-runtime.d.ts +21 -0
  24. package/dist/internal-tool-runtime.d.ts.map +1 -0
  25. package/dist/internal-tool-runtime.js +136 -0
  26. package/dist/internal-tool-runtime.js.map +1 -0
  27. package/dist/local-model-runtime.d.ts +36 -0
  28. package/dist/local-model-runtime.d.ts.map +1 -0
  29. package/dist/local-model-runtime.js +161 -0
  30. package/dist/local-model-runtime.js.map +1 -0
  31. package/dist/model-bridge.d.ts +54 -0
  32. package/dist/model-bridge.d.ts.map +1 -0
  33. package/dist/model-bridge.js +587 -0
  34. package/dist/model-bridge.js.map +1 -0
  35. package/dist/orchestrator-supervisor.d.ts +100 -0
  36. package/dist/orchestrator-supervisor.d.ts.map +1 -0
  37. package/dist/orchestrator-supervisor.js +399 -0
  38. package/dist/orchestrator-supervisor.js.map +1 -0
  39. package/dist/runtime-executor.d.ts.map +1 -1
  40. package/dist/runtime-executor.js +5 -42
  41. package/dist/runtime-executor.js.map +1 -1
  42. package/dist/schemas.js +1 -1
  43. package/dist/schemas.js.map +1 -1
  44. package/dist/server.d.ts +5 -1
  45. package/dist/server.d.ts.map +1 -1
  46. package/dist/server.js +9 -1
  47. package/dist/server.js.map +1 -1
  48. package/dist/shared.d.ts +3 -3
  49. package/dist/tools-agent.d.ts +1 -0
  50. package/dist/tools-agent.d.ts.map +1 -1
  51. package/dist/tools-agent.js +456 -1
  52. package/dist/tools-agent.js.map +1 -1
  53. package/dist/tui/agent-runner.d.ts +6 -0
  54. package/dist/tui/agent-runner.d.ts.map +1 -1
  55. package/dist/tui/agent-runner.js +15 -1
  56. package/dist/tui/agent-runner.js.map +1 -1
  57. package/dist/tui/agent-worker.d.ts +3 -1
  58. package/dist/tui/agent-worker.d.ts.map +1 -1
  59. package/dist/tui/agent-worker.js +117 -9
  60. package/dist/tui/agent-worker.js.map +1 -1
  61. package/dist/tui/chat.d.ts +19 -0
  62. package/dist/tui/chat.d.ts.map +1 -1
  63. package/dist/tui/chat.js +108 -0
  64. package/dist/tui/chat.js.map +1 -1
  65. package/dist/tui/index.d.ts +1 -0
  66. package/dist/tui/index.d.ts.map +1 -1
  67. package/dist/tui/index.js +3 -0
  68. package/dist/tui/index.js.map +1 -1
  69. package/dist/vericify-bridge.d.ts +5 -1
  70. package/dist/vericify-bridge.d.ts.map +1 -1
  71. package/dist/vericify-bridge.js +10 -0
  72. package/dist/vericify-bridge.js.map +1 -1
  73. package/dist/vericify-context.d.ts +10 -0
  74. package/dist/vericify-context.d.ts.map +1 -0
  75. package/dist/vericify-context.js +72 -0
  76. package/dist/vericify-context.js.map +1 -0
  77. package/package.json +2 -1
@@ -1,305 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { existsSync, readFileSync } from "node:fs";
4
- import { resolve } from "node:path";
5
-
6
- const DESTRUCTIVE_COMMAND_PATTERNS = [
7
- /\brm\s+-rf\b/i,
8
- /\bgit\s+reset\s+--hard\b/i,
9
- /\bgit\s+checkout\s+--\b/i,
10
- /\bgit\s+clean\s+-fdx\b/i,
11
- /\bdel\s+\/s\s+\/q\b/i,
12
- /\bdrop\s+table\b/i,
13
- /\btruncate\s+table\b/i,
14
- /\bmkfs\b/i,
15
- ];
16
-
17
- const PROTECTED_PATH_FRAGMENTS = [
18
- ".github/hooks/",
19
- ".github\\hooks\\",
20
- "scripts/ace/copilot-hook-dispatch.mjs",
21
- "scripts\\ace\\copilot-hook-dispatch.mjs",
22
- ".vscode/settings.json",
23
- ".vscode\\settings.json",
24
- ];
25
-
26
- function readStdin() {
27
- return new Promise((resolveStdin, reject) => {
28
- let input = "";
29
- process.stdin.setEncoding("utf8");
30
- process.stdin.on("data", (chunk) => {
31
- input += chunk;
32
- });
33
- process.stdin.on("end", () => resolveStdin(input));
34
- process.stdin.on("error", reject);
35
- });
36
- }
37
-
38
- function writeJson(payload) {
39
- process.stdout.write(JSON.stringify(payload));
40
- }
41
-
42
- function toLowerText(value) {
43
- return typeof value === "string" ? value.trim().toLowerCase() : "";
44
- }
45
-
46
- function safeJson(value) {
47
- try {
48
- return JSON.stringify(value ?? {});
49
- } catch {
50
- return "";
51
- }
52
- }
53
-
54
- function resolveWorkspaceRoot(payload) {
55
- const cwd = typeof payload.cwd === "string" && payload.cwd.trim() ? payload.cwd.trim() : process.cwd();
56
- return resolve(cwd);
57
- }
58
-
59
- function aceContext(workspaceRoot) {
60
- const stateDirs = [
61
- "agent-state",
62
- "global-state",
63
- "venture-state",
64
- "brand-state",
65
- "engineering-state",
66
- ].filter((relPath) => existsSync(resolve(workspaceRoot, relPath)));
67
- const coreFiles = [
68
- "agent-state/TASK.md",
69
- "agent-state/STATUS.md",
70
- "agent-state/SCOPE.md",
71
- "agent-state/EVIDENCE_LOG.md",
72
- ].filter((relPath) => existsSync(resolve(workspaceRoot, relPath)));
73
-
74
- const hasSkills = existsSync(resolve(workspaceRoot, ".agents", "skills"));
75
- const hasAgentState = existsSync(resolve(workspaceRoot, "agent-state"));
76
-
77
- return {
78
- coreFiles,
79
- stateDirs,
80
- hasSkills,
81
- hasAgentState,
82
- };
83
- }
84
-
85
- function readAutonomyHint(workspaceRoot) {
86
- const workflowPath = resolve(workspaceRoot, "agent-state", "ACE_WORKFLOW.md");
87
- const defaultHint =
88
- "Runtime autonomy defaults are active: orchestrator preflight, context recall.";
89
- if (!existsSync(workflowPath)) return defaultHint;
90
-
91
- let raw = "";
92
- try {
93
- raw = readFileSync(workflowPath, "utf8");
94
- } catch {
95
- return defaultHint;
96
- }
97
-
98
- if (!/^\s*autonomy:\s*$/m.test(raw)) {
99
- return defaultHint;
100
- }
101
-
102
- const signals = [];
103
- if (/^\s*autonomy:\s*$/m.test(raw) && /^\s*orchestrator_preflight:\s*true\s*$/m.test(raw)) {
104
- signals.push("orchestrator preflight");
105
- }
106
- if (/^\s*autonomy:\s*$/m.test(raw) && /^\s*recall_context:\s*true\s*$/m.test(raw)) {
107
- signals.push("context recall");
108
- }
109
- const reviewMode = raw.match(/^\s*review_mode:\s*["']?([A-Za-z0-9_-]+)["']?\s*$/m)?.[1];
110
- if (reviewMode) {
111
- signals.push(`review mode ${reviewMode}`);
112
- }
113
-
114
- return signals.length > 0
115
- ? `Runtime autonomy policy is active in agent-state/ACE_WORKFLOW.md: ${signals.join(", ")}.`
116
- : "";
117
- }
118
-
119
- function buildAceMessage(workspaceRoot) {
120
- const context = aceContext(workspaceRoot);
121
- if (!context.hasAgentState && !context.hasSkills) return "";
122
-
123
- const parts = [];
124
- if (context.coreFiles.length > 0) {
125
- parts.push(`ACE workspace detected. Ground truth lives in ${context.coreFiles.join(", ")}.`);
126
- } else if (context.hasAgentState) {
127
- parts.push("ACE workspace detected. Ground truth lives in agent-state/*.");
128
- }
129
- if (context.stateDirs.length > 0) {
130
- parts.push(
131
- `Persist durable artifacts under ${context.stateDirs.map((dir) => `${dir}/`).join(", ")} rather than editor session caches such as workspaceStorage/.../chat-session-resources/.`
132
- );
133
- }
134
- parts.push(
135
- "Before major edits, read task, scope, and status artifacts rather than relying on chat history."
136
- );
137
- if (context.hasSkills) {
138
- parts.push("Workspace skills are available under .agents/skills/.");
139
- }
140
- const autonomyHint = readAutonomyHint(workspaceRoot);
141
- if (autonomyHint) {
142
- parts.push(autonomyHint);
143
- }
144
- parts.push(
145
- "Copilot hook policy protects .github/hooks, .vscode/settings.json, and scripts/ace/copilot-hook-dispatch.mjs from silent self-modification."
146
- );
147
- return parts.join(" ");
148
- }
149
-
150
- function isCommandTool(toolName) {
151
- return ["terminal", "shell", "bash", "command", "execute"].some((token) =>
152
- toolName.includes(token)
153
- );
154
- }
155
-
156
- function isMutationTool(toolName) {
157
- return [
158
- "edit",
159
- "write",
160
- "create",
161
- "replace",
162
- "delete",
163
- "rename",
164
- "move",
165
- "file",
166
- ].some((token) => toolName.includes(token));
167
- }
168
-
169
- function containsProtectedPath(text) {
170
- const normalized = toLowerText(text);
171
- return PROTECTED_PATH_FRAGMENTS.some((fragment) => normalized.includes(fragment.toLowerCase()));
172
- }
173
-
174
- function containsDestructiveCommand(text) {
175
- return DESTRUCTIVE_COMMAND_PATTERNS.some((pattern) => pattern.test(text));
176
- }
177
-
178
- function resolvePreToolUse(payload, workspaceRoot) {
179
- const toolName = toLowerText(payload.tool_name);
180
- const serializedInput = safeJson(payload.tool_input);
181
-
182
- if (isCommandTool(toolName) && containsDestructiveCommand(serializedInput)) {
183
- return {
184
- continue: true,
185
- hookSpecificOutput: {
186
- hookEventName: "PreToolUse",
187
- permissionDecision: "deny",
188
- permissionDecisionReason:
189
- "Blocked by ACE Copilot hook policy: destructive shell command detected.",
190
- additionalContext:
191
- "Use a non-destructive alternative or ask for explicit confirmation before destructive terminal actions.",
192
- },
193
- };
194
- }
195
-
196
- if (isMutationTool(toolName) && containsProtectedPath(serializedInput)) {
197
- return {
198
- continue: true,
199
- hookSpecificOutput: {
200
- hookEventName: "PreToolUse",
201
- permissionDecision: "ask",
202
- permissionDecisionReason:
203
- "Editing Copilot hook/config files requires confirmation.",
204
- additionalContext:
205
- "This workspace treats hook files and VS Code settings as protected control-plane artifacts.",
206
- },
207
- };
208
- }
209
-
210
- const message = buildAceMessage(workspaceRoot);
211
- if (isMutationTool(toolName) && message) {
212
- return {
213
- continue: true,
214
- hookSpecificOutput: {
215
- hookEventName: "PreToolUse",
216
- permissionDecision: "allow",
217
- additionalContext: `${message} After mutating files, reconcile evidence and verification where relevant.`,
218
- },
219
- };
220
- }
221
-
222
- return { continue: true };
223
- }
224
-
225
- function resolvePostToolUse(payload, workspaceRoot) {
226
- const toolName = toLowerText(payload.tool_name);
227
- if (!isMutationTool(toolName)) {
228
- return { continue: true };
229
- }
230
-
231
- const message = buildAceMessage(workspaceRoot);
232
- return {
233
- continue: true,
234
- hookSpecificOutput: {
235
- hookEventName: "PostToolUse",
236
- additionalContext: message
237
- ? `${message} If project files changed, run the smallest relevant verification before concluding.`
238
- : "If project files changed, run the smallest relevant verification before concluding.",
239
- },
240
- };
241
- }
242
-
243
- function resolveSessionStart(payload, workspaceRoot, eventName) {
244
- const message = buildAceMessage(workspaceRoot);
245
- if (!message) return { continue: true };
246
-
247
- return {
248
- continue: true,
249
- hookSpecificOutput: {
250
- hookEventName: eventName,
251
- additionalContext: message,
252
- },
253
- };
254
- }
255
-
256
- function resolveHook(payload) {
257
- const eventName = toLowerText(payload.hookEventName);
258
- const workspaceRoot = resolveWorkspaceRoot(payload);
259
-
260
- if (eventName === "sessionstart") {
261
- return resolveSessionStart(payload, workspaceRoot, "SessionStart");
262
- }
263
-
264
- if (eventName === "subagentstart") {
265
- return resolveSessionStart(payload, workspaceRoot, "SubagentStart");
266
- }
267
-
268
- if (eventName === "pretooluse") {
269
- return resolvePreToolUse(payload, workspaceRoot);
270
- }
271
-
272
- if (eventName === "posttooluse") {
273
- return resolvePostToolUse(payload, workspaceRoot);
274
- }
275
-
276
- if (eventName === "precompact") {
277
- return { continue: true };
278
- }
279
-
280
- if (eventName === "userpromptsubmit") {
281
- return { continue: true };
282
- }
283
-
284
- if (eventName === "subagentstop" || eventName === "stop") {
285
- return { continue: true };
286
- }
287
-
288
- return { continue: true };
289
- }
290
-
291
- async function main() {
292
- try {
293
- const raw = await readStdin();
294
- const payload = raw.trim() ? JSON.parse(raw) : {};
295
- writeJson(resolveHook(payload));
296
- } catch (error) {
297
- const message = error instanceof Error ? error.message : String(error);
298
- writeJson({
299
- continue: true,
300
- systemMessage: `ACE Copilot hook warning: ${message}`,
301
- });
302
- }
303
- }
304
-
305
- main();
3
+ import "./ace-hook-dispatch.mjs";
@@ -2,6 +2,10 @@
2
2
  set -euo pipefail
3
3
 
4
4
  mkdir -p .mcp-config
5
+ mkdir -p .github/hooks
6
+ mkdir -p .claude
7
+ mkdir -p .cursor
8
+ mkdir -p .vscode
5
9
 
6
10
  cat > .mcp-config/vscode.mcp.json <<'JSON'
7
11
  {
@@ -49,9 +53,332 @@ cat > .mcp-config/antigravity.mcp.json <<'JSON'
49
53
  JSON
50
54
 
51
55
  cat > .mcp-config/codex.config.toml <<'TOML'
56
+ # ACE instructions are scaffolded into AGENTS.md during bootstrap.
52
57
  [mcp_servers.ace-swarm]
53
58
  command = "npx"
54
59
  args = ["-y", "ace-swarm", "mcp"]
55
60
  TOML
56
61
 
57
- echo "Wrote .mcp-config bundle for codex, vscode, claude, cursor, antigravity"
62
+ cat > CLAUDE.md <<'MD'
63
+ # ACE Instructions For Claude Code
64
+
65
+ This workspace is ACE-governed. Ground truth lives in `agent-state/TASK.md`,
66
+ `agent-state/STATUS.md`, `agent-state/SCOPE.md`, and `agent-state/EVIDENCE_LOG.md`.
67
+
68
+ Before significant work, call `recall_context`. Use `route_task` and
69
+ `get_agent_instructions` for role guidance. After meaningful edits or state
70
+ changes, call `execute_gates` and persist evidence/handoffs in ACE artifacts.
71
+ MD
72
+
73
+ cat > .github/copilot-instructions.md <<'MD'
74
+ # ACE Instructions For GitHub Copilot
75
+
76
+ This workspace is ACE-governed. Read file-backed ACE state before acting:
77
+ `agent-state/TASK.md`, `agent-state/STATUS.md`, `agent-state/SCOPE.md`, and
78
+ `agent-state/EVIDENCE_LOG.md`.
79
+
80
+ Before significant work, call `recall_context`. Route with `route_task`.
81
+ After material changes, call `execute_gates` and update durable ACE artifacts.
82
+ MD
83
+
84
+ cat > .cursorrules <<'MD'
85
+ # ACE Instructions For Cursor
86
+
87
+ This workspace is ACE-governed. Do not rely on chat history for state. Use
88
+ `recall_context` to load task, scope, and status from `agent-state/*`.
89
+
90
+ Use `route_task` and `get_agent_instructions` for role guidance. After edits,
91
+ run `execute_gates` and persist evidence/handoffs in ACE artifacts.
92
+ MD
93
+
94
+ cat > AGENTS.md <<'MD'
95
+ # ACE Instructions For Codex
96
+
97
+ This workspace is ACE-governed. File-backed ACE state is authoritative:
98
+ `agent-state/TASK.md`, `agent-state/STATUS.md`, `agent-state/SCOPE.md`, and
99
+ `agent-state/EVIDENCE_LOG.md`.
100
+
101
+ Before significant work, call `recall_context`. Use `route_task` and
102
+ `get_agent_instructions` for role guidance. After meaningful edits or state
103
+ changes, call `execute_gates` and persist evidence or handoffs.
104
+ MD
105
+
106
+ cat > .github/hooks/ace-copilot.json <<'JSON'
107
+ {
108
+ "hooks": {
109
+ "SessionStart": [
110
+ {
111
+ "type": "command",
112
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
113
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
114
+ "timeout": 10
115
+ }
116
+ ],
117
+ "UserPromptSubmit": [
118
+ {
119
+ "type": "command",
120
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
121
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
122
+ "timeout": 10
123
+ }
124
+ ],
125
+ "PreToolUse": [
126
+ {
127
+ "type": "command",
128
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
129
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
130
+ "timeout": 10
131
+ }
132
+ ],
133
+ "PostToolUse": [
134
+ {
135
+ "type": "command",
136
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
137
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
138
+ "timeout": 10
139
+ }
140
+ ],
141
+ "PreCompact": [
142
+ {
143
+ "type": "command",
144
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
145
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
146
+ "timeout": 10
147
+ }
148
+ ],
149
+ "SubagentStart": [
150
+ {
151
+ "type": "command",
152
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
153
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
154
+ "timeout": 10
155
+ }
156
+ ],
157
+ "SubagentStop": [
158
+ {
159
+ "type": "command",
160
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
161
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
162
+ "timeout": 10
163
+ }
164
+ ],
165
+ "Stop": [
166
+ {
167
+ "type": "command",
168
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
169
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
170
+ "timeout": 10
171
+ }
172
+ ]
173
+ }
174
+ }
175
+ JSON
176
+
177
+ cat > .claude/settings.json <<'JSON'
178
+ {
179
+ "hooks": {
180
+ "SessionStart": [
181
+ {
182
+ "matcher": "",
183
+ "hooks": [
184
+ {
185
+ "type": "command",
186
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
187
+ }
188
+ ]
189
+ }
190
+ ],
191
+ "UserPromptSubmit": [
192
+ {
193
+ "matcher": "",
194
+ "hooks": [
195
+ {
196
+ "type": "command",
197
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
198
+ }
199
+ ]
200
+ }
201
+ ],
202
+ "PreToolUse": [
203
+ {
204
+ "matcher": "",
205
+ "hooks": [
206
+ {
207
+ "type": "command",
208
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
209
+ }
210
+ ]
211
+ }
212
+ ],
213
+ "PostToolUse": [
214
+ {
215
+ "matcher": "",
216
+ "hooks": [
217
+ {
218
+ "type": "command",
219
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
220
+ }
221
+ ]
222
+ }
223
+ ],
224
+ "PreCompact": [
225
+ {
226
+ "matcher": "",
227
+ "hooks": [
228
+ {
229
+ "type": "command",
230
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
231
+ }
232
+ ]
233
+ }
234
+ ],
235
+ "SubagentStart": [
236
+ {
237
+ "matcher": "",
238
+ "hooks": [
239
+ {
240
+ "type": "command",
241
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
242
+ }
243
+ ]
244
+ }
245
+ ],
246
+ "SubagentStop": [
247
+ {
248
+ "matcher": "",
249
+ "hooks": [
250
+ {
251
+ "type": "command",
252
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
253
+ }
254
+ ]
255
+ }
256
+ ],
257
+ "Stop": [
258
+ {
259
+ "matcher": "",
260
+ "hooks": [
261
+ {
262
+ "type": "command",
263
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs"
264
+ }
265
+ ]
266
+ }
267
+ ]
268
+ }
269
+ }
270
+ JSON
271
+
272
+ cat > .vscode/ace-hooks.json <<'JSON'
273
+ {
274
+ "hooks": {
275
+ "SessionStart": [
276
+ {
277
+ "type": "command",
278
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
279
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
280
+ "timeout": 10
281
+ }
282
+ ],
283
+ "UserPromptSubmit": [
284
+ {
285
+ "type": "command",
286
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
287
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
288
+ "timeout": 10
289
+ }
290
+ ],
291
+ "PreToolUse": [
292
+ {
293
+ "type": "command",
294
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
295
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
296
+ "timeout": 10
297
+ }
298
+ ],
299
+ "PostToolUse": [
300
+ {
301
+ "type": "command",
302
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
303
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
304
+ "timeout": 10
305
+ }
306
+ ],
307
+ "PreCompact": [
308
+ {
309
+ "type": "command",
310
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
311
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
312
+ "timeout": 10
313
+ }
314
+ ],
315
+ "SubagentStart": [
316
+ {
317
+ "type": "command",
318
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
319
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
320
+ "timeout": 10
321
+ }
322
+ ],
323
+ "SubagentStop": [
324
+ {
325
+ "type": "command",
326
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
327
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
328
+ "timeout": 10
329
+ }
330
+ ],
331
+ "Stop": [
332
+ {
333
+ "type": "command",
334
+ "command": "node ./scripts/ace/ace-hook-dispatch.mjs",
335
+ "windows": "node .\\\\scripts\\\\ace\\\\ace-hook-dispatch.mjs",
336
+ "timeout": 10
337
+ }
338
+ ]
339
+ }
340
+ }
341
+ JSON
342
+
343
+ cp .vscode/ace-hooks.json .cursor/hooks.json
344
+ cp .vscode/ace-hooks.json .mcp-config/gemini.hooks.json
345
+ cp .vscode/ace-hooks.json .mcp-config/antigravity.hooks.json
346
+
347
+ cat > .mcp-config/codex.hooks.toml <<'TOML'
348
+ # ACE lifecycle hook scaffold for Codex-compatible runtimes.
349
+ # Merge these entries into the host hook config that supports SessionStart/SubagentStart hooks.
350
+
351
+ [[hooks]]
352
+ event = "SessionStart"
353
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
354
+
355
+ [[hooks]]
356
+ event = "UserPromptSubmit"
357
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
358
+
359
+ [[hooks]]
360
+ event = "PreToolUse"
361
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
362
+
363
+ [[hooks]]
364
+ event = "PostToolUse"
365
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
366
+
367
+ [[hooks]]
368
+ event = "PreCompact"
369
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
370
+
371
+ [[hooks]]
372
+ event = "SubagentStart"
373
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
374
+
375
+ [[hooks]]
376
+ event = "SubagentStop"
377
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
378
+
379
+ [[hooks]]
380
+ event = "Stop"
381
+ command = "node ./scripts/ace/ace-hook-dispatch.mjs"
382
+ TOML
383
+
384
+ echo "Wrote MCP configs, host instruction files, and ACE hook configs for codex, vscode, claude, cursor, copilot, gemini, and antigravity"
@@ -0,0 +1,29 @@
1
+ import { buildAceContinuityPacket, buildAceRecallContext } from "./ace-autonomy.js";
2
+ import { type AceInternalToolCatalogEntry } from "./ace-internal-tools.js";
3
+ export type AceContextTier = "full" | "compressed" | "brief";
4
+ export interface RenderAceContextOptions {
5
+ task: string;
6
+ role: string;
7
+ workspace: string;
8
+ tier?: AceContextTier;
9
+ tools?: string[];
10
+ }
11
+ export interface RenderAceContextResult {
12
+ systemPrompt: string;
13
+ tools: AceInternalToolCatalogEntry[];
14
+ stateDigest: string;
15
+ tokenEstimate: number;
16
+ tier: AceContextTier;
17
+ }
18
+ export interface ToolPlanResult {
19
+ prompt: string;
20
+ catalog: AceInternalToolCatalogEntry[];
21
+ recommended_tools: string[];
22
+ selection_limit: number;
23
+ }
24
+ export declare function renderAceRecallPromptBlock(recall?: ReturnType<typeof buildAceRecallContext>, includeSlices?: boolean): string;
25
+ export declare function renderAceSnapshotPromptBlock(recall?: ReturnType<typeof buildAceRecallContext>): string;
26
+ export declare function renderAceContinuityPromptBlock(packet?: ReturnType<typeof buildAceContinuityPacket>): string;
27
+ export declare function buildToolPlan(options: RenderAceContextOptions): ToolPlanResult;
28
+ export declare function renderAceContext(options: RenderAceContextOptions): RenderAceContextResult;
29
+ //# sourceMappingURL=ace-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ace-context.d.ts","sourceRoot":"","sources":["../src/ace-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EAKtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AAIjC,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,2BAA2B,EAAE,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACvC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB;AAgED,wBAAgB,0BAA0B,CACxC,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,EACjD,aAAa,UAAO,GACnB,MAAM,CASR;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,GAChD,MAAM,CAUR;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,GACnD,MAAM,CAER;AAkFD,wBAAgB,aAAa,CAAC,OAAO,EAAE,uBAAuB,GAAG,cAAc,CAkC9E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAuDzF"}