aiden-runtime 4.5.0 → 4.6.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 (38) hide show
  1. package/README.md +17 -2
  2. package/dist/cli/v4/aidenCLI.js +185 -99
  3. package/dist/cli/v4/chatSession.js +107 -0
  4. package/dist/cli/v4/commands/_runtimeToggleHelpers.js +2 -0
  5. package/dist/cli/v4/commands/fanout.js +42 -59
  6. package/dist/cli/v4/commands/help.js +6 -0
  7. package/dist/cli/v4/commands/index.js +16 -1
  8. package/dist/cli/v4/commands/mcp.js +80 -54
  9. package/dist/cli/v4/commands/plannerGuard.js +53 -0
  10. package/dist/cli/v4/commands/recovery.js +122 -0
  11. package/dist/cli/v4/commands/runs.js +22 -2
  12. package/dist/cli/v4/commands/spawnPause.js +93 -0
  13. package/dist/cli/v4/daemonAgentBuilder.js +4 -1
  14. package/dist/cli/v4/defaultSoul.js +1 -1
  15. package/dist/core/v4/aidenAgent.js +219 -1
  16. package/dist/core/v4/daemon/bootstrap.js +47 -0
  17. package/dist/core/v4/daemon/db/migrations.js +66 -0
  18. package/dist/core/v4/daemon/runStore.js +33 -3
  19. package/dist/core/v4/providerFallback.js +35 -2
  20. package/dist/core/v4/runtimeToggles.js +30 -3
  21. package/dist/core/v4/selfimprovement/recoveryStore.js +307 -0
  22. package/dist/core/v4/selfimprovement/signatureBuilder.js +158 -0
  23. package/dist/core/v4/subagent/childBuilder.js +391 -0
  24. package/dist/core/v4/subagent/fanout.js +75 -51
  25. package/dist/core/v4/subagent/spawnPause.js +191 -0
  26. package/dist/core/v4/subagent/spawnSubAgent.js +310 -0
  27. package/dist/core/v4/toolRegistry.js +19 -3
  28. package/dist/core/version.js +1 -1
  29. package/dist/moat/plannerGuard.js +29 -0
  30. package/dist/providers/v4/anthropicAdapter.js +31 -3
  31. package/dist/providers/v4/chatCompletionsAdapter.js +26 -3
  32. package/dist/providers/v4/codexResponsesAdapter.js +25 -2
  33. package/dist/providers/v4/ollamaPromptToolsAdapter.js +57 -2
  34. package/dist/tools/v4/index.js +17 -3
  35. package/dist/tools/v4/skills/lookupToolSchema.js +6 -1
  36. package/dist/tools/v4/subagent/spawnSubAgentTool.js +334 -0
  37. package/dist/tools/v4/subagent/subagentFanout.js +53 -1
  38. package/package.json +7 -3
@@ -41,6 +41,13 @@ exports.makeSubagentFanoutTool = makeSubagentFanoutTool;
41
41
  const factory_1 = require("../../../core/v4/logger/factory");
42
42
  const fanout_1 = require("../../../core/v4/subagent/fanout");
43
43
  const merger_1 = require("../../../core/v4/subagent/merger");
44
+ // v4.6 Phase 3A — operator kill-switch. Same check the
45
+ // `spawn_sub_agent` tool runs, applied here at fanout's handler
46
+ // entry. Locked decision (§12): check ONCE at entry, not inside
47
+ // the spawn loop — atomicity is per-call. A pause applied
48
+ // mid-fanout leaves the in-flight Promise.all to complete
49
+ // naturally; only the NEXT fanout call hits the rejection.
50
+ const spawnPause_1 = require("../../../core/v4/subagent/spawnPause");
44
51
  const SCHEMA_DESC = 'Spawn N parallel agent children against the same problem (ensemble) or a partitioned task list, ' +
45
52
  'then merge results via the chosen strategy. Use this for multi-perspective research, ' +
46
53
  'provider-diverse fact-checking, or analyzing N independent inputs in parallel. ' +
@@ -124,6 +131,32 @@ function makeSubagentFanoutTool(factory) {
124
131
  toolset: 'subagent',
125
132
  riskTier: 'caution', // v4.4 Phase 1
126
133
  async execute(args, _ctx) {
134
+ // ── Operator kill-switch (v4.6 Phase 3A) ────────────────────
135
+ // Top of handler — before parsing, provider resolution, or
136
+ // rotation. Reject the WHOLE call if paused; spawn loop never
137
+ // fires, so partial fanouts are impossible.
138
+ try {
139
+ const pauseStatus = (0, spawnPause_1.getSpawnPause)().status();
140
+ if (pauseStatus.paused) {
141
+ const reasonSuffix = pauseStatus.reason ? ` (reason: ${pauseStatus.reason})` : '';
142
+ return {
143
+ success: false,
144
+ errorCode: 'SUBAGENT_SPAWN_PAUSED',
145
+ message: `subagent_fanout: spawning is paused${reasonSuffix}. ` +
146
+ 'Run /spawn-pause off to resume.',
147
+ pausedAt: pauseStatus.pausedAt ?? null,
148
+ reason: pauseStatus.reason ?? null,
149
+ pausedBy: pauseStatus.pausedBy ?? null,
150
+ durationMs: pauseStatus.durationMs ?? null,
151
+ };
152
+ }
153
+ }
154
+ catch {
155
+ // getSpawnPause() throws when not initialized — let the
156
+ // fanout proceed rather than blocking on a wiring bug.
157
+ // Production boot always inits before any tool handler
158
+ // can fire; this catch only matters for unit tests.
159
+ }
127
160
  const logger = factory.logger ?? (0, factory_1.noopLogger)();
128
161
  // ── Coerce args ────────────────────────────────────────────
129
162
  const mode = (args.mode === 'partition' || args.mode === 'ensemble')
@@ -160,6 +193,23 @@ function makeSubagentFanoutTool(factory) {
160
193
  }
161
194
  const aggOverride = (0, merger_1.resolveAggregatorOverride)();
162
195
  const aggregatorModel = aggOverride ?? factory.resolveActiveModel();
196
+ // v4.6 Phase 2Q — spawnDeps absent means we're still bound to
197
+ // the boot-time stub (the runtime hasn't replaced the
198
+ // registration with the real factory yet). Surface the same
199
+ // "tool not wired" failure shape MCP / REPL surface in their
200
+ // own pre-wired states.
201
+ if (!factory.spawnDeps) {
202
+ return {
203
+ success: false,
204
+ error: 'subagent_fanout: tool not wired — runtime did not supply spawnDeps. ' +
205
+ 'Call register(makeSubagentFanoutTool({...spawnDeps})) after buildAgentRuntime.',
206
+ };
207
+ }
208
+ // v4.6 Phase 2Q — resolve parent identity at dispatch time so
209
+ // REPL turns that opened a run row between boot and now still
210
+ // link children to the right parent.
211
+ const parentRunId = factory.resolveParentRunId?.();
212
+ const parentSessionId = factory.resolveParentSessionId?.();
163
213
  const fanoutOpts = {
164
214
  mode,
165
215
  query,
@@ -167,7 +217,9 @@ function makeSubagentFanoutTool(factory) {
167
217
  n,
168
218
  merge,
169
219
  providers,
170
- runChild: factory.runChild,
220
+ spawnDeps: factory.spawnDeps,
221
+ parentRunId,
222
+ parentSessionId,
171
223
  aggregatorAdapter: factory.aggregatorAdapter,
172
224
  aggregatorModel,
173
225
  timeoutMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiden-runtime",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,8 +35,8 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "bin": {
38
- "devos-ai": "./dist/bin/npx-init.js",
39
- "aiden": "./dist/cli/v4/aidenCLI.js"
38
+ "aiden": "./dist/cli/v4/aidenCLI.js",
39
+ "aiden-runtime": "./dist/cli/v4/aidenCLI.js"
40
40
  },
41
41
  "main": "./dist/cli/v4/aidenCLI.js",
42
42
  "files": [
@@ -254,10 +254,12 @@
254
254
  "epub2": "^3.0.2",
255
255
  "execa": "^8.0.1",
256
256
  "express": "^4.18.2",
257
+ "form-data": "^4.0.0",
257
258
  "imap-simple": "^5.1.0",
258
259
  "js-tiktoken": "^1.0.21",
259
260
  "js-yaml": "^4.1.1",
260
261
  "kleur": "^4.1.5",
262
+ "lru-cache": "^10.0.0",
261
263
  "mailparser": "^3.9.8",
262
264
  "marked": "^15.0.12",
263
265
  "marked-terminal": "^7.3.0",
@@ -267,6 +269,7 @@
267
269
  "open": "^11.0.0",
268
270
  "ora": "^9.3.0",
269
271
  "pdf-parse": "^1.1.1",
272
+ "picomatch": "^4.0.0",
270
273
  "playwright": "^1.58.2",
271
274
  "proper-lockfile": "^4.1.2",
272
275
  "puppeteer": "^24.39.1",
@@ -277,6 +280,7 @@
277
280
  "stripe": "^20.4.1",
278
281
  "tar-stream": "^3.1.8",
279
282
  "twilio": "^5.13.1",
283
+ "undici": "^6.0.0",
280
284
  "uuid": "^9.0.0",
281
285
  "whatsapp-web.js": "^1.26.0",
282
286
  "wrap-ansi": "^9.0.2",