aura-code 0.6.3 → 0.10.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 (265) hide show
  1. package/README.md +47 -164
  2. package/dist/agent/affect.d.ts +13 -0
  3. package/dist/agent/affect.js +34 -0
  4. package/dist/agent/affect.js.map +1 -0
  5. package/dist/agent/compactor.d.ts +27 -4
  6. package/dist/agent/compactor.js +185 -54
  7. package/dist/agent/compactor.js.map +1 -1
  8. package/dist/agent/confess.d.ts +35 -0
  9. package/dist/agent/confess.js +296 -0
  10. package/dist/agent/confess.js.map +1 -0
  11. package/dist/agent/context.d.ts +0 -4
  12. package/dist/agent/context.js +0 -38
  13. package/dist/agent/context.js.map +1 -1
  14. package/dist/agent/domain-expertise.d.ts +22 -0
  15. package/dist/agent/domain-expertise.js +110 -0
  16. package/dist/agent/domain-expertise.js.map +1 -0
  17. package/dist/agent/executive-queue.d.ts +26 -0
  18. package/dist/agent/executive-queue.js +50 -0
  19. package/dist/agent/executive-queue.js.map +1 -0
  20. package/dist/agent/generational-flush.d.ts +28 -0
  21. package/dist/agent/generational-flush.js +48 -0
  22. package/dist/agent/generational-flush.js.map +1 -0
  23. package/dist/agent/loop-profile.d.ts +50 -0
  24. package/dist/agent/loop-profile.js +88 -0
  25. package/dist/agent/loop-profile.js.map +1 -0
  26. package/dist/agent/loop.d.ts +14 -5
  27. package/dist/agent/loop.js +167 -39
  28. package/dist/agent/loop.js.map +1 -1
  29. package/dist/agent/memory-consolidate.d.ts +14 -0
  30. package/dist/agent/memory-consolidate.js +141 -0
  31. package/dist/agent/memory-consolidate.js.map +1 -0
  32. package/dist/agent/mixture.d.ts +33 -0
  33. package/dist/agent/mixture.js +138 -0
  34. package/dist/agent/mixture.js.map +1 -0
  35. package/dist/agent/spawner.js +2 -2
  36. package/dist/agent/spawner.js.map +1 -1
  37. package/dist/agent/system-prompt.d.ts +1 -1
  38. package/dist/agent/system-prompt.js +50 -22
  39. package/dist/agent/system-prompt.js.map +1 -1
  40. package/dist/agent/unified-memory.d.ts +15 -0
  41. package/dist/agent/unified-memory.js +164 -0
  42. package/dist/agent/unified-memory.js.map +1 -0
  43. package/dist/checkpoints/engine.d.ts +44 -0
  44. package/dist/checkpoints/engine.js +324 -0
  45. package/dist/checkpoints/engine.js.map +1 -0
  46. package/dist/cli/command-palette.d.ts +26 -0
  47. package/dist/cli/command-palette.js +133 -0
  48. package/dist/cli/command-palette.js.map +1 -0
  49. package/dist/cli/context-health.d.ts +51 -0
  50. package/dist/cli/context-health.js +187 -0
  51. package/dist/cli/context-health.js.map +1 -0
  52. package/dist/cli/diamond.d.ts +67 -0
  53. package/dist/cli/diamond.js +222 -12
  54. package/dist/cli/diamond.js.map +1 -1
  55. package/dist/cli/dic.d.ts +2 -0
  56. package/dist/cli/dic.js +106 -0
  57. package/dist/cli/dic.js.map +1 -0
  58. package/dist/cli/diff-view.d.ts +18 -0
  59. package/dist/cli/diff-view.js +114 -0
  60. package/dist/cli/diff-view.js.map +1 -0
  61. package/dist/cli/display.d.ts +18 -4
  62. package/dist/cli/display.js +74 -151
  63. package/dist/cli/display.js.map +1 -1
  64. package/dist/cli/help-data.d.ts +7 -0
  65. package/dist/cli/help-data.js +80 -0
  66. package/dist/cli/help-data.js.map +1 -0
  67. package/dist/cli/index.js +1002 -852
  68. package/dist/cli/index.js.map +1 -1
  69. package/dist/cli/markdown.d.ts +5 -0
  70. package/dist/cli/markdown.js +128 -0
  71. package/dist/cli/markdown.js.map +1 -0
  72. package/dist/cli/model-select.d.ts +39 -0
  73. package/dist/cli/model-select.js +65 -0
  74. package/dist/cli/model-select.js.map +1 -0
  75. package/dist/cli/tui.d.ts +34 -0
  76. package/dist/cli/tui.js +1176 -0
  77. package/dist/cli/tui.js.map +1 -0
  78. package/dist/config/defaults.d.ts +6 -17
  79. package/dist/config/defaults.js +25 -46
  80. package/dist/config/defaults.js.map +1 -1
  81. package/dist/config/project-config.d.ts +2 -6
  82. package/dist/config/project-config.js +2 -2
  83. package/dist/config/project-config.js.map +1 -1
  84. package/dist/doctor/checks.d.ts +18 -0
  85. package/dist/doctor/checks.js +524 -0
  86. package/dist/doctor/checks.js.map +1 -0
  87. package/dist/doctor/index.d.ts +4 -0
  88. package/dist/doctor/index.js +229 -0
  89. package/dist/doctor/index.js.map +1 -0
  90. package/dist/doctor/repair.d.ts +19 -0
  91. package/dist/doctor/repair.js +126 -0
  92. package/dist/doctor/repair.js.map +1 -0
  93. package/dist/doctor/types.d.ts +38 -0
  94. package/dist/doctor/types.js +10 -0
  95. package/dist/doctor/types.js.map +1 -0
  96. package/dist/dream/dream.d.ts +79 -59
  97. package/dist/dream/dream.js +324 -144
  98. package/dist/dream/dream.js.map +1 -1
  99. package/dist/dream/episode.d.ts +17 -0
  100. package/dist/dream/episode.js +116 -0
  101. package/dist/dream/episode.js.map +1 -0
  102. package/dist/kanban/engine.d.ts +26 -0
  103. package/dist/kanban/engine.js +208 -0
  104. package/dist/kanban/engine.js.map +1 -0
  105. package/dist/kanban/types.d.ts +19 -0
  106. package/dist/kanban/types.js +9 -1
  107. package/dist/kanban/types.js.map +1 -1
  108. package/dist/machina/render-html.js +4 -2
  109. package/dist/machina/render-html.js.map +1 -1
  110. package/dist/machina/render-terminal.js +11 -4
  111. package/dist/machina/render-terminal.js.map +1 -1
  112. package/dist/machina/repair.d.ts +23 -0
  113. package/dist/machina/repair.js +98 -0
  114. package/dist/machina/repair.js.map +1 -0
  115. package/dist/machina/spec.js +12 -12
  116. package/dist/machina/spec.js.map +1 -1
  117. package/dist/machina/verify.d.ts +13 -1
  118. package/dist/machina/verify.js +12 -2
  119. package/dist/machina/verify.js.map +1 -1
  120. package/dist/mining/extract.d.ts +34 -0
  121. package/dist/mining/extract.js +229 -0
  122. package/dist/mining/extract.js.map +1 -0
  123. package/dist/mining/refine.d.ts +28 -0
  124. package/dist/mining/refine.js +256 -0
  125. package/dist/mining/refine.js.map +1 -0
  126. package/dist/perception/extractor.js +5 -3
  127. package/dist/perception/extractor.js.map +1 -1
  128. package/dist/perception/graph-store.d.ts +0 -11
  129. package/dist/perception/graph-store.js +0 -33
  130. package/dist/perception/graph-store.js.map +1 -1
  131. package/dist/perception/index.d.ts +1 -1
  132. package/dist/perception/index.js +1 -2
  133. package/dist/perception/index.js.map +1 -1
  134. package/dist/plugins/commands.d.ts +38 -0
  135. package/dist/plugins/commands.js +134 -0
  136. package/dist/plugins/commands.js.map +1 -0
  137. package/dist/plugins/frontmatter.d.ts +14 -0
  138. package/dist/plugins/frontmatter.js +78 -0
  139. package/dist/plugins/frontmatter.js.map +1 -0
  140. package/dist/plugins/hooks.d.ts +12 -0
  141. package/dist/plugins/hooks.js +148 -0
  142. package/dist/plugins/hooks.js.map +1 -0
  143. package/dist/plugins/loader.d.ts +7 -0
  144. package/dist/plugins/loader.js +255 -0
  145. package/dist/plugins/loader.js.map +1 -0
  146. package/dist/plugins/market.d.ts +23 -0
  147. package/dist/plugins/market.js +281 -0
  148. package/dist/plugins/market.js.map +1 -0
  149. package/dist/plugins/types.d.ts +90 -0
  150. package/dist/plugins/types.js +20 -0
  151. package/dist/plugins/types.js.map +1 -0
  152. package/dist/providers/anthropic-oauth-draft.d.ts +119 -0
  153. package/dist/providers/anthropic-oauth-draft.js +414 -0
  154. package/dist/providers/anthropic-oauth-draft.js.map +1 -0
  155. package/dist/providers/anthropic.d.ts +4 -1
  156. package/dist/providers/anthropic.js +35 -7
  157. package/dist/providers/anthropic.js.map +1 -1
  158. package/dist/providers/factory.d.ts +43 -19
  159. package/dist/providers/factory.js +183 -129
  160. package/dist/providers/factory.js.map +1 -1
  161. package/dist/providers/google.js +9 -22
  162. package/dist/providers/google.js.map +1 -1
  163. package/dist/providers/live-models.d.ts +23 -0
  164. package/dist/providers/live-models.js +145 -0
  165. package/dist/providers/live-models.js.map +1 -0
  166. package/dist/providers/openai-compatible.d.ts +1 -12
  167. package/dist/providers/openai-compatible.js +71 -108
  168. package/dist/providers/openai-compatible.js.map +1 -1
  169. package/dist/providers/resilient-factory.js +1 -1
  170. package/dist/providers/resilient-factory.js.map +1 -1
  171. package/dist/repl/queue.d.ts +22 -0
  172. package/dist/repl/queue.js +165 -0
  173. package/dist/repl/queue.js.map +1 -0
  174. package/dist/repl/side-channel.d.ts +23 -0
  175. package/dist/repl/side-channel.js +63 -0
  176. package/dist/repl/side-channel.js.map +1 -0
  177. package/dist/research/council.d.ts +2 -0
  178. package/dist/research/council.js +29 -4
  179. package/dist/research/council.js.map +1 -1
  180. package/dist/ruby/alternator.d.ts +11 -30
  181. package/dist/ruby/alternator.js +59 -38
  182. package/dist/ruby/alternator.js.map +1 -1
  183. package/dist/ruby/episode-capture.d.ts +0 -10
  184. package/dist/ruby/episode-capture.js +0 -33
  185. package/dist/ruby/episode-capture.js.map +1 -1
  186. package/dist/ruby/types.js +1 -1
  187. package/dist/ruby/types.js.map +1 -1
  188. package/dist/safety/path-jail.d.ts +17 -0
  189. package/dist/safety/path-jail.js +100 -0
  190. package/dist/safety/path-jail.js.map +1 -0
  191. package/dist/safety/permissions.d.ts +12 -21
  192. package/dist/safety/permissions.js +81 -216
  193. package/dist/safety/permissions.js.map +1 -1
  194. package/dist/safety/ssrf.d.ts +29 -0
  195. package/dist/safety/ssrf.js +185 -0
  196. package/dist/safety/ssrf.js.map +1 -0
  197. package/dist/server/index.js +64 -10
  198. package/dist/server/index.js.map +1 -1
  199. package/dist/setup/first-run.d.ts +0 -24
  200. package/dist/setup/first-run.js +10 -344
  201. package/dist/setup/first-run.js.map +1 -1
  202. package/dist/setup/key-store.d.ts +12 -0
  203. package/dist/setup/key-store.js +108 -0
  204. package/dist/setup/key-store.js.map +1 -0
  205. package/dist/setup/provider-registry.js +31 -18
  206. package/dist/setup/provider-registry.js.map +1 -1
  207. package/dist/setup/provider-test.d.ts +7 -0
  208. package/dist/setup/provider-test.js +73 -10
  209. package/dist/setup/provider-test.js.map +1 -1
  210. package/dist/setup/provider-wizard.d.ts +4 -1
  211. package/dist/setup/provider-wizard.js +92 -26
  212. package/dist/setup/provider-wizard.js.map +1 -1
  213. package/dist/setup/xiaomi.d.ts +1 -1
  214. package/dist/setup/xiaomi.js +3 -3
  215. package/dist/setup/xiaomi.js.map +1 -1
  216. package/dist/tools/browser.js +14 -10
  217. package/dist/tools/browser.js.map +1 -1
  218. package/dist/tools/clipboard.js +7 -1
  219. package/dist/tools/clipboard.js.map +1 -1
  220. package/dist/tools/dictate.d.ts +60 -0
  221. package/dist/tools/dictate.js +983 -0
  222. package/dist/tools/dictate.js.map +1 -0
  223. package/dist/tools/dictate_patched.js +1057 -0
  224. package/dist/tools/edit-file.js +10 -2
  225. package/dist/tools/edit-file.js.map +1 -1
  226. package/dist/tools/http-request.js +14 -4
  227. package/dist/tools/http-request.js.map +1 -1
  228. package/dist/tools/image-read.js +34 -2
  229. package/dist/tools/image-read.js.map +1 -1
  230. package/dist/tools/index.d.ts +16 -1
  231. package/dist/tools/index.js +59 -8
  232. package/dist/tools/index.js.map +1 -1
  233. package/dist/tools/mcp.js +12 -0
  234. package/dist/tools/mcp.js.map +1 -1
  235. package/dist/tools/read-file.js +10 -14
  236. package/dist/tools/read-file.js.map +1 -1
  237. package/dist/tools/telegram-audio-policy.d.ts +30 -0
  238. package/dist/tools/telegram-audio-policy.js +49 -0
  239. package/dist/tools/telegram-audio-policy.js.map +1 -0
  240. package/dist/tools/telegram-bot.js +1136 -537
  241. package/dist/tools/telegram-bot.js.map +1 -1
  242. package/dist/tools/telegram-voice.d.ts +18 -5
  243. package/dist/tools/telegram-voice.js +54 -12
  244. package/dist/tools/telegram-voice.js.map +1 -1
  245. package/dist/tools/telegram.d.ts +3 -3
  246. package/dist/tools/telegram.js +5 -84
  247. package/dist/tools/telegram.js.map +1 -1
  248. package/dist/tools/tools.d.ts +2 -14
  249. package/dist/tools/tools.js +79 -144
  250. package/dist/tools/tools.js.map +1 -1
  251. package/dist/tools/web-fetch.js +39 -7
  252. package/dist/tools/web-fetch.js.map +1 -1
  253. package/dist/tools/web-search.d.ts +0 -20
  254. package/dist/tools/web-search.js +40 -137
  255. package/dist/tools/web-search.js.map +1 -1
  256. package/dist/util/errors.js +1 -15
  257. package/dist/util/errors.js.map +1 -1
  258. package/dist/util/json-repair.d.ts +11 -0
  259. package/dist/util/json-repair.js +31 -0
  260. package/dist/util/json-repair.js.map +1 -0
  261. package/dist/util/rate-limiter.js +2 -8
  262. package/dist/util/rate-limiter.js.map +1 -1
  263. package/dist/viz/index.js +793 -792
  264. package/dist/viz/index.js.map +1 -1
  265. package/package.json +12 -32
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ /**
3
+ * Mixture of Agents — Phase 2: parallel domain sub-agents.
4
+ *
5
+ * For exploratory-shaped tasks (per loop-profile.ts — that's where ambiguity
6
+ * actually benefits from multiple angles), fan out 2-3 read-only sub-agents
7
+ * in parallel, each framed with a different domain lens, then synthesize
8
+ * their reports into one answer with a real model call.
9
+ *
10
+ * Design constraints (see docs/MIXTURE_OF_AGENTS.md):
11
+ * - Read-only only — parallel sub-agents never edit files.
12
+ * - Gated by task shape AND an explicit opt-in (--moa). The N-call cost is
13
+ * real; it stays off the default path until benchmarks justify it.
14
+ * - Synthesis is an actual provider call — reconciling N expert opinions
15
+ * is judgment, not pattern matching.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.runMixtureOfAgents = runMixtureOfAgents;
19
+ const loop_js_1 = require("./loop.js");
20
+ const permissions_js_1 = require("../safety/permissions.js");
21
+ const domain_expertise_js_1 = require("./domain-expertise.js");
22
+ /**
23
+ * Sub-agent streams would interleave garbage if they all wrote to the real
24
+ * display. Mute everything except warnings/errors, which are rare and
25
+ * worth surfacing (prefixed so the user can tell whose they are).
26
+ */
27
+ function mutedDisplay(base, label) {
28
+ return {
29
+ agentThinking: () => { },
30
+ streamText: () => { },
31
+ streamEnd: () => { },
32
+ toolStart: () => { },
33
+ toolCall: () => { },
34
+ toolResult: () => { },
35
+ toolBlocked: () => { },
36
+ warning: (msg) => base.warning(`[${label}] ${msg}`),
37
+ success: () => { },
38
+ error: (msg) => base.error(`[${label}] ${msg}`),
39
+ header: () => { },
40
+ summary: () => { },
41
+ showPlan: () => { },
42
+ stepStarted: () => { },
43
+ stepCompleted: () => { },
44
+ contextBar: () => { },
45
+ contextDashboard: () => { },
46
+ compactionEvent: () => { },
47
+ };
48
+ }
49
+ function perspectiveTask(lens, task) {
50
+ return [
51
+ `You are investigating as a ${lens} specialist. You are in read-only mode — do not modify any files or run state-changing commands.`,
52
+ '',
53
+ `Task: ${task}`,
54
+ '',
55
+ `Investigate the codebase strictly from the ${lens} angle. Your final message must be a compact report:`,
56
+ '1. FINDINGS — concrete observations with file paths / line references.',
57
+ `2. ANSWER — the most likely explanation or answer from the ${lens} perspective.`,
58
+ '3. CONFIDENCE — low / medium / high, with one sentence why.',
59
+ ].join('\n');
60
+ }
61
+ const SYNTHESIS_SYSTEM = [
62
+ 'You are synthesizing reports from parallel specialist investigators who each examined the same task from a different angle.',
63
+ 'Reconcile them into ONE answer: where they agree, state it plainly; where they conflict, weigh confidence and evidence and say which reading you trust and why.',
64
+ 'Do not enumerate the reports back — produce the merged answer a user should act on, citing file paths the specialists found.',
65
+ ].join(' ');
66
+ /**
67
+ * Run the mixture: N parallel read-only sub-agents + one synthesis call.
68
+ * Returns a LoopResult so callers can treat it exactly like a single-agent
69
+ * run (summary display, cost footer, exit codes).
70
+ */
71
+ async function runMixtureOfAgents(opts) {
72
+ const { provider, task, context, display } = opts;
73
+ const domains = (0, domain_expertise_js_1.classifyDomains)(task);
74
+ const lenses = domains.length > 0
75
+ ? [...domains, 'generalist']
76
+ : ['architecture', 'generalist'];
77
+ display.header('Mixture of Agents', `${lenses.length} parallel read-only perspectives: ${lenses.join(', ')}`);
78
+ const runs = await Promise.all(lenses.map((lens) => (0, loop_js_1.runAgentLoop)({
79
+ provider,
80
+ task: perspectiveTask(lens, task),
81
+ context,
82
+ permissions: new permissions_js_1.PermissionSystem('read-only'),
83
+ display: mutedDisplay(display, lens),
84
+ // Sub-agents must not fan out further — one level of parallelism.
85
+ disableSpawn: true,
86
+ pricingModel: opts.pricingModel,
87
+ }).catch((e) => ({
88
+ success: false,
89
+ summary: `Perspective failed: ${String(e)}`,
90
+ turns: 0, toolCallCount: 0,
91
+ usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },
92
+ costUsd: 0, history: [], toolCallLog: [],
93
+ }))));
94
+ runs.forEach((r, i) => {
95
+ display.success(`[${lenses[i]}] ${r.success ? 'reported' : 'failed'} — ${r.turns} turns, $${r.costUsd.toFixed(4)}`);
96
+ });
97
+ const usage = runs.reduce((acc, r) => ({
98
+ inputTokens: acc.inputTokens + r.usage.inputTokens,
99
+ outputTokens: acc.outputTokens + r.usage.outputTokens,
100
+ totalTokens: acc.totalTokens + r.usage.totalTokens,
101
+ }), { inputTokens: 0, outputTokens: 0, totalTokens: 0 });
102
+ const turns = runs.reduce((n, r) => n + r.turns, 0);
103
+ const toolCallCount = runs.reduce((n, r) => n + r.toolCallCount, 0);
104
+ let costUsd = runs.reduce((c, r) => c + r.costUsd, 0);
105
+ const succeeded = runs.filter((r) => r.success);
106
+ if (succeeded.length === 0) {
107
+ return {
108
+ success: false,
109
+ summary: `All ${lenses.length} perspectives failed:\n${runs.map((r, i) => `[${lenses[i]}] ${r.summary}`).join('\n')}`,
110
+ turns, toolCallCount, usage, costUsd, history: [], toolCallLog: [],
111
+ };
112
+ }
113
+ const reports = runs
114
+ .map((r, i) => `## Report from the ${lenses[i]} specialist${r.success ? '' : ' (FAILED — weigh accordingly)'}\n\n${r.summary}`)
115
+ .join('\n\n');
116
+ display.agentThinking();
117
+ const synthesis = await provider.complete(SYNTHESIS_SYSTEM, [
118
+ { role: 'user', content: `Original task: ${task}\n\n${reports}` },
119
+ ], []);
120
+ const su = synthesis.usage;
121
+ if (su) {
122
+ usage.inputTokens += su.inputTokens ?? 0;
123
+ usage.outputTokens += su.outputTokens ?? 0;
124
+ usage.totalTokens += (su.inputTokens ?? 0) + (su.outputTokens ?? 0);
125
+ costUsd += (0, loop_js_1.costFor)(opts.pricingModel ?? provider.model, su.inputTokens ?? 0, su.outputTokens ?? 0);
126
+ }
127
+ return {
128
+ success: true,
129
+ summary: synthesis.text || '(Synthesis produced no output)',
130
+ turns: turns + 1,
131
+ toolCallCount,
132
+ usage,
133
+ costUsd,
134
+ history: [{ role: 'user', content: task }, { role: 'assistant', content: synthesis.text }],
135
+ toolCallLog: runs.flatMap((r) => r.toolCallLog),
136
+ };
137
+ }
138
+ //# sourceMappingURL=mixture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixture.js","sourceRoot":"","sources":["../../src/agent/mixture.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAuEH,gDA8EC;AA/ID,uCAAkD;AAClD,6DAA4D;AAC5D,+DAAwD;AAWxD;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAa,EAAE,KAAa;IAChD,OAAO;QACL,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;QACvB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;QACrB,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QACnD,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QAC/C,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;QAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,QAAQ,EAA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AAE,SAAS,CAAC,IAAI,EAAE,CAAC;QAC1F,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;KAChD,CAAC;AACJ,CAAC"}
@@ -39,7 +39,6 @@ exports.clearSpawner = clearSpawner;
39
39
  exports.makeDefaultSpawner = makeDefaultSpawner;
40
40
  exports.executeSpawnTask = executeSpawnTask;
41
41
  const factory_js_1 = require("../providers/factory.js");
42
- const defaults_js_1 = require("../config/defaults.js");
43
42
  let active = null;
44
43
  /**
45
44
  * Wire up the spawn_task tool to a real implementation. Called by the
@@ -74,7 +73,8 @@ function makeDefaultSpawner(ctx, baseConfig, display) {
74
73
  context: ctx,
75
74
  permissions: new PermissionSystem(level),
76
75
  display,
77
- maxTurns: defaults_js_1.DEFAULTS.maxTurns,
76
+ // No explicit maxTurns: let loop-profile size the sub-agent's
77
+ // budget from its task shape, same as the top-level loop.
78
78
  });
79
79
  const cost = result.costUsd.toFixed(4);
80
80
  return `[subagent ${model}]\n${result.summary}\n[cost: $${cost} · ${result.turns} turns · ${result.toolCallCount} tools]`;
@@ -1 +1 @@
1
- {"version":3,"file":"spawner.js","sourceRoot":"","sources":["../../src/agent/spawner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,0CAEC;AAED,oCAEC;AAKD,gDA6BC;AAED,4CAWC;AAjFD,wDAAyD;AAGzD,uDAAiD;AAkBjD,IAAI,MAAM,GAAyB,IAAI,CAAC;AAExC;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAsB;IACpD,MAAM,GAAG,OAAO,CAAC;AACnB,CAAC;AAED,SAAgB,YAAY;IAC1B,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAChC,GAAmB,EACnB,UAAqE,EACrE,OAAgB;IAEhB,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,IAAkB;YAC5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,oDAAoD,CAAC;IACzE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,+CAA+C,CAAC;IAClE,MAAM,IAAI,GAAiB;QACzB,IAAI;QACJ,KAAK,EAAE,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAChE,QAAQ,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI;QACjC,GAAG,EAAE,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;KAC3D,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAEY,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,oLAAoL;IACjM,UAAU,EAAE;QACV,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAK,EAAE,IAAI,EAAE,QAAQ,EAAG,WAAW,EAAE,wCAAwC,EAAE;YACnF,KAAK,EAAI,EAAE,IAAI,EAAE,QAAQ,EAAG,WAAW,EAAE,yDAAyD,EAAE;YACpG,QAAQ,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,uFAAuF,EAAE;YAClI,GAAG,EAAM,EAAE,IAAI,EAAE,QAAQ,EAAG,WAAW,EAAE,8CAA8C,EAAE;SAC1F;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { ProjectContext } from './context.js';
2
- export declare function buildSystemPrompt(ctx: ProjectContext, providerName: string, task?: string): string;
2
+ export declare function buildSystemPrompt(ctx: ProjectContext, providerName: string, task: string): string;
3
3
  export declare function buildArchitectPrompt(task: string, projectRoot: string): string;
@@ -2,18 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildSystemPrompt = buildSystemPrompt;
4
4
  exports.buildArchitectPrompt = buildArchitectPrompt;
5
- const design_js_1 = require("./design.js");
5
+ const domain_expertise_js_1 = require("./domain-expertise.js");
6
+ const unified_memory_js_1 = require("./unified-memory.js");
7
+ const confess_js_1 = require("./confess.js");
8
+ const loader_js_1 = require("../plugins/loader.js");
9
+ const WEB_KEYWORDS = /website|webpage|frontend|front-end|ui component|landing page|homepage|web app|portfolio|hero section|marketing page|site design|visual design|html.*css|make.*page|create.*page|build.*site/;
6
10
  function buildSystemPrompt(ctx, providerName, task) {
7
- const design = task ? (0, design_js_1.selectDesign)(ctx.root, task) : null;
8
- const designSection = design ? (0, design_js_1.designPromptSection)(design) : '';
9
- // Optional sections only included when data exists, so new users
10
- // with no dreams or graph don't see empty placeholders.
11
- const graphSection = ctx.graphSummary
12
- ? `\n### Codebase knowledge graph\n${ctx.graphSummary}\n`
13
- : '';
14
- const memorySection = ctx.reconciledMemory
15
- ? `\n### Memory (from past sessions)\nThe following lessons, patterns, and open threads were distilled from your previous work on this project. Use them to avoid repeating past mistakes and to continue unfinished work.\n\n${ctx.reconciledMemory}\n`
16
- : '';
11
+ const domainBlock = (0, domain_expertise_js_1.getDomainPromptBlock)(task);
12
+ // Unified memory: global identity/facts (shared with the Telegram bot) plus
13
+ // this project's reconciled lessons. Replaces the old dreams-only block.
14
+ const memoryBlock = (0, unified_memory_js_1.loadUnifiedMemory)({ projectRoot: ctx.root });
15
+ // Confessions: permanent lessons extracted from high-cost failures.
16
+ // Loaded separately so they sit above regular memory with elevated priority.
17
+ const confessionsBlock = (0, confess_js_1.loadConfessionsSection)();
18
+ // Plugin skills: inject relevant plugin skills when task matches their domain.
19
+ const pluginBlock = loadPluginSkillsBlock(task);
17
20
  return `You are Aura — a precise, efficient AI coding agent.
18
21
  You are working in a ${ctx.language} project called "${ctx.name}" (${ctx.framework}).
19
22
 
@@ -35,22 +38,22 @@ You are working in a ${ctx.language} project called "${ctx.name}" (${ctx.framewo
35
38
  - When done, summarize exactly what changed and what was verified (tests passed, build succeeded, specific checks that passed).
36
39
  - If the task requires a code change, you must eventually call write_file or edit_file to apply it. Do not spend all turns on read_file and search_code — at some point you must commit to making the change. Aim for a 2:1 ratio of reads to writes, not 100% reads.
37
40
  - Never respond to a task with only prose. Always begin by using at least one tool (search_code, read_file, or list_dir) to investigate the codebase before summarizing or concluding. A response with zero tool calls is almost always incomplete.
38
- - Not every task is a coding task. For questions, research, or information requests, use web_search/web_fetch and respond with the information directly — no code changes needed.
39
41
 
40
- ## Web and information tools
41
- - You have web_search and web_fetch tools. USE THEM for any question about current events, weather, news, documentation, or anything that requires up-to-date information.
42
- - When web_search returns results, READ THE RESULTS they are already in your context. Extract the relevant information (temperatures, dates, facts, summaries) and present it directly to the user. Do NOT say "I can't browse the results" — you already have them.
43
- - If search results contain snippets with the answer, give the answer directly. If you need more detail, use web_fetch on the most relevant URL to get the full page content.
44
- - For weather: extract temperature, conditions, humidity, wind from the search snippets and present them clearly.
45
- - For documentation/articles: summarize the key points, don't just list links.
46
- - You are NOT limited to coding tasks. You can research, summarize, explain, translate, and answer general knowledge questions using your tools and knowledge.
42
+ ## Tool call arguments
43
+ - Never inline large multi-line content (HTML, generated code, long files) as a raw string inside a tool call's JSON arguments models frequently produce invalid JSON when escaping quotes/newlines in big blocks, causing repeated failed calls.
44
+ - For content longer than ~30 lines, write it via run_shell using a heredoc (cat > file << 'EOF' ... EOF), or build it incrementally with edit_file on small, well-escaped chunks.
45
+
46
+ ## Images and screenshots
47
+ - You CAN read local image files (screenshots, diagrams, photos). Never tell the user you cannot access local files or \`file://\` paths — you have the image_read tool.
48
+ - When the user references an image path a plain path, or a \`file://\` URL like \`file:///home/user/shot.png\` — call \`image_read\` with \`action=ocr\` to extract the text/content, then answer from what it actually contains. Use \`action=info\` for dimensions/format.
49
+ - Never guess or invent what an image shows, and never ask the user to describe it before trying image_read first. Read it, then reason about it.
47
50
 
48
51
  ## Code standards
49
52
  - Match the existing code style: indentation, naming conventions, comment style.
50
53
  - Do not introduce new dependencies unless explicitly asked.
51
54
  - Prefer targeted, minimal changes over rewrites.
52
55
  - Add or update tests when you modify logic.
53
-
56
+ ${domainBlock}${memoryBlock}${confessionsBlock}${pluginBlock}
54
57
  ## Safety
55
58
  - Never delete files unless explicitly instructed.
56
59
  - Never commit to git unless explicitly instructed.
@@ -78,8 +81,33 @@ ${ctx.readme}
78
81
 
79
82
  ### Recent git history
80
83
  ${ctx.recentCommits}
81
- ${graphSection}${memorySection}
82
- Provider: ${providerName}. Work efficiently — minimize unnecessary tool calls.${designSection}`;
84
+
85
+ Provider: ${providerName}. Work efficiently — minimize unnecessary tool calls.`;
86
+ }
87
+ /** Load plugin skills relevant to the current task. Cached per process. */
88
+ let _pluginSkillsCache = null;
89
+ function loadPluginSkillsBlock(task) {
90
+ if (_pluginSkillsCache === null) {
91
+ try {
92
+ const plugins = (0, loader_js_1.loadAllPlugins)();
93
+ const lines = [];
94
+ for (const p of plugins) {
95
+ for (const s of p.skills) {
96
+ lines.push(`\n\n## Plugin skill: ${s.name} (from ${p.name})\n${s.body}`);
97
+ }
98
+ }
99
+ _pluginSkillsCache = lines.join('');
100
+ }
101
+ catch {
102
+ _pluginSkillsCache = '';
103
+ }
104
+ }
105
+ if (!_pluginSkillsCache)
106
+ return '';
107
+ // Only inject for web/UI tasks — avoid polluting non-design prompts
108
+ if (!WEB_KEYWORDS.test(task.toLowerCase()))
109
+ return '';
110
+ return `\n\n## Plugin instructions\nThese skill instructions from installed plugins apply to this task:${_pluginSkillsCache}`;
83
111
  }
84
112
  function buildArchitectPrompt(task, projectRoot) {
85
113
  return `You are in architect mode. You are planning the implementation for: "${task}"
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":";;AAGA,8CAgFC;AAED,oDA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AAC;gBACxB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;oBACzB,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC3E,CAAC;YACH,CAAC;YACD,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,kBAAkB,GAAG,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,IAAI,CAAC,kBAAkB;QAAE,OAAO,EAAE,CAAC;IACnC,oEAAoE;IACpE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IACtD,OAAO,kGAAkG,kBAAkB,EAAE,CAAC;AAChI,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAY,EAAE,WAAmB;IACpE,OAAO,wEAAwE,IAAI;;gBAErE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BzB,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Canonical global identity store (created by the consolidation migration). */
2
+ export declare const IDENTITY_FILE: string;
3
+ /** Global episodic-lessons digest (created by runGlobalReconciliation). */
4
+ export declare const GLOBAL_LESSONS_FILE: string;
5
+ export interface UnifiedMemoryOptions {
6
+ /** CLI passes its project root for per-project lessons; bot omits it. */
7
+ projectRoot?: string;
8
+ /** Total cap for the whole block (default ~4 KB). */
9
+ maxChars?: number;
10
+ }
11
+ /**
12
+ * The single memory block both the CLI and the Telegram bot inject into their
13
+ * system prompts. Returns '' when there's nothing to add.
14
+ */
15
+ export declare function loadUnifiedMemory(opts?: UnifiedMemoryOptions): string;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.GLOBAL_LESSONS_FILE = exports.IDENTITY_FILE = void 0;
37
+ exports.loadUnifiedMemory = loadUnifiedMemory;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const os = __importStar(require("os"));
41
+ // ─────────────────────────────────────────────────────────────────────────────
42
+ // Unified Memory — one read path shared by the CLI and the Telegram bot.
43
+ //
44
+ // Aura's memory used to live in three disconnected places (see the plan/design):
45
+ // 1. key-value identity ~/.aura/memory/*.json (bot read default+user only)
46
+ // 2. episode→dream ~/.aura/episodes + dreams/ (CLI read per-project)
47
+ // 3. chat history ~/.aura/sessions
48
+ // Facts saved by one surface never reached the other. This module gives both
49
+ // surfaces ONE canonical view:
50
+ // • GLOBAL identity/facts → ~/.aura/memory/identity.json (everywhere)
51
+ // • lessons → per-project reconciled dream (CLI) OR the
52
+ // global digest ~/.aura/memory/lessons-global.md
53
+ // (the bot, which is not tied to one project)
54
+ //
55
+ // It is read-only and defensive: any missing/corrupt file is skipped, and the
56
+ // whole block is length-capped so it never bloats a prompt.
57
+ // ─────────────────────────────────────────────────────────────────────────────
58
+ const MEMORY_DIR = path.join(os.homedir(), '.aura', 'memory');
59
+ /** Canonical global identity store (created by the consolidation migration). */
60
+ exports.IDENTITY_FILE = path.join(MEMORY_DIR, 'identity.json');
61
+ /** Global episodic-lessons digest (created by runGlobalReconciliation). */
62
+ exports.GLOBAL_LESSONS_FILE = path.join(MEMORY_DIR, 'lessons-global.md');
63
+ function loadJson(file) {
64
+ try {
65
+ if (!fs.existsSync(file))
66
+ return {};
67
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
68
+ }
69
+ catch {
70
+ return {};
71
+ }
72
+ }
73
+ function readText(file) {
74
+ try {
75
+ return fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '';
76
+ }
77
+ catch {
78
+ return '';
79
+ }
80
+ }
81
+ /**
82
+ * Identity/facts block from the canonical global store. Falls back to the
83
+ * legacy default.json + user.json if identity.json hasn't been created yet
84
+ * (so the surfaces keep working before/after the consolidation migration).
85
+ */
86
+ function identitySection(maxChars) {
87
+ let store = loadJson(exports.IDENTITY_FILE);
88
+ if (Object.keys(store).length === 0) {
89
+ // Pre-migration fallback: merge the two namespaces the bot used to read.
90
+ store = { ...loadJson(path.join(MEMORY_DIR, 'default.json')), ...loadJson(path.join(MEMORY_DIR, 'user.json')) };
91
+ }
92
+ const keys = Object.keys(store);
93
+ if (keys.length === 0)
94
+ return '';
95
+ // Most-recently-updated entries first: identity.json only grows, and a
96
+ // budget-capped walk in raw insertion order silently drops whatever was
97
+ // added most recently once older entries fill the budget — which is
98
+ // exactly backwards, since a newly-added entry is usually a standing rule
99
+ // or current fact, while old entries are stable background bio. A missing
100
+ // `updated` sorts last (oldest-equivalent), not first.
101
+ const ordered = [...keys].sort((a, b) => {
102
+ const ta = Date.parse(store[a]?.updated ?? '') || 0;
103
+ const tb = Date.parse(store[b]?.updated ?? '') || 0;
104
+ return tb - ta;
105
+ });
106
+ const lines = [];
107
+ let used = 0;
108
+ for (const k of ordered) {
109
+ const v = store[k]?.value ?? '';
110
+ if (!v)
111
+ continue;
112
+ const line = `- **${k}**: ${v}`;
113
+ if (used + line.length > maxChars)
114
+ continue; // skip, don't stop — a later (older) entry may still fit
115
+ lines.push(line);
116
+ used += line.length;
117
+ }
118
+ return lines.length ? `### Who & what Aura knows (identity/facts)\n${lines.join('\n')}` : '';
119
+ }
120
+ /**
121
+ * Lessons block. CLI passes a projectRoot → per-project reconciled dream.
122
+ * The bot passes nothing → the global lessons digest.
123
+ */
124
+ function lessonsSection(projectRoot, maxChars) {
125
+ let content = '';
126
+ if (projectRoot) {
127
+ const reconciled = path.join(projectRoot, 'dreams', '.reconciled.md');
128
+ content = readText(reconciled);
129
+ // Fall back to the latest dated dream if reconciliation hasn't run.
130
+ if (!content) {
131
+ try {
132
+ const dir = path.join(projectRoot, 'dreams');
133
+ const files = fs.readdirSync(dir).filter(f => /^\d{4}-\d{2}-\d{2}\.md$/.test(f)).sort();
134
+ if (files.length)
135
+ content = readText(path.join(dir, files[files.length - 1]));
136
+ }
137
+ catch { /* no dreams yet */ }
138
+ }
139
+ }
140
+ else {
141
+ content = readText(exports.GLOBAL_LESSONS_FILE);
142
+ }
143
+ content = content.trim();
144
+ if (!content)
145
+ return '';
146
+ if (content.length > maxChars)
147
+ content = content.slice(0, maxChars) + '\n… (truncated)';
148
+ return `### Lessons from past sessions\n${content}`;
149
+ }
150
+ /**
151
+ * The single memory block both the CLI and the Telegram bot inject into their
152
+ * system prompts. Returns '' when there's nothing to add.
153
+ */
154
+ function loadUnifiedMemory(opts = {}) {
155
+ const budget = opts.maxChars ?? 4000;
156
+ // Split the budget: identity gets the larger share, lessons the rest.
157
+ const idBlock = identitySection(Math.floor(budget * 0.6));
158
+ const lessonBlock = lessonsSection(opts.projectRoot, budget - idBlock.length);
159
+ const parts = [idBlock, lessonBlock].filter(Boolean);
160
+ if (parts.length === 0)
161
+ return '';
162
+ return `\n\n## Memory (shared across Aura CLI + Telegram)\n${parts.join('\n\n')}\n`;
163
+ }
164
+ //# sourceMappingURL=unified-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-memory.js","sourceRoot":"","sources":["../../src/agent/unified-memory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,8CASC;AArID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,gFAAgF;AAChF,yEAAyE;AACzE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,8CAA8C;AAC9C,6EAA6E;AAC7E,+BAA+B;AAC/B,4EAA4E;AAC5E,0EAA0E;AAC1E,+EAA+E;AAC/E,4EAA4E;AAC5E,EAAE;AACF,8EAA8E;AAC9E,4DAA4D;AAC5D,gFAAgF;AAEhF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE9D,gFAAgF;AACnE,QAAA,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AACpE,2EAA2E;AAC9D,QAAA,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;AAI9E,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAU,CAAC;IAC5D,CAAC;I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M,CAAC,IAAI,CAAC;AACtF,CAAC"}
@@ -0,0 +1,44 @@
1
+ export interface Checkpoint {
2
+ /** Short id, e.g. "m1x2y3-4f" — used in refs and CLI commands. */
3
+ id: string;
4
+ /** Full ref name: refs/aura/checkpoints/<id> */
5
+ ref: string;
6
+ /** Commit hash of the shadow commit. */
7
+ commit: string;
8
+ /** Tree hash of the snapshot. */
9
+ tree: string;
10
+ /** Human label (usually the task that triggered the snapshot). */
11
+ label: string;
12
+ /** ISO timestamp of creation. */
13
+ createdAt: string;
14
+ }
15
+ export interface RestoreResult {
16
+ /** Files written back from the snapshot. */
17
+ restored: string[];
18
+ /** Files deleted because they did not exist at snapshot time. */
19
+ deleted: string[];
20
+ /** Checkpoint of the state just before restoring (undo the undo). */
21
+ preRestore: Checkpoint | null;
22
+ }
23
+ /** Absolute .git dir of the repo containing root, or null if not a repo. */
24
+ export declare function gitDirOf(root: string): Promise<string | null>;
25
+ /**
26
+ * Create a checkpoint of the current working tree.
27
+ * Returns null when: not a git repo, or the tree is identical to the most
28
+ * recent checkpoint (deduped — repeated calls within a burst are no-ops).
29
+ */
30
+ export declare function createCheckpoint(root: string, label: string): Promise<Checkpoint | null>;
31
+ /** All checkpoints for the repo containing root, newest first. */
32
+ export declare function listCheckpoints(root: string): Promise<Checkpoint[]>;
33
+ /**
34
+ * Restore the working tree to the state captured by checkpoint `id`
35
+ * (or the most recent checkpoint when id is omitted).
36
+ *
37
+ * Only paths that differ are touched; the user's index/HEAD stay put, so
38
+ * after a restore `git status` simply reflects the restored content.
39
+ */
40
+ export declare function restoreCheckpoint(root: string, id?: string): Promise<RestoreResult>;
41
+ /** Delete all but the newest `keep` checkpoints. Returns how many were pruned. */
42
+ export declare function pruneCheckpoints(root: string, keep: number): Promise<number>;
43
+ /** Delete a single checkpoint by id. */
44
+ export declare function deleteCheckpoint(root: string, id: string): Promise<boolean>;