@wrongstack/core 0.5.6 → 0.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 (59) hide show
  1. package/dist/{agent-bridge-B07AYFBk.d.ts → agent-bridge-BKNiE1VH.d.ts} +1 -1
  2. package/dist/{compactor-BWhJXxsW.d.ts → compactor-RIPuTtWK.d.ts} +1 -1
  3. package/dist/{config-BgM0BIpz.d.ts → config-BGGuP_Ar.d.ts} +1 -1
  4. package/dist/{context-CLZXPPYk.d.ts → context-CDRyrkKQ.d.ts} +7 -0
  5. package/dist/coordination/index.d.ts +9 -9
  6. package/dist/coordination/index.js +339 -80
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +20 -19
  9. package/dist/defaults/index.js +731 -180
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/{events-qnDZbrtb.d.ts → events-DPQKFX7W.d.ts} +1 -1
  12. package/dist/execution/index.d.ts +152 -12
  13. package/dist/execution/index.js +474 -5
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/extension/index.d.ts +6 -6
  16. package/dist/extension/index.js +2 -1
  17. package/dist/extension/index.js.map +1 -1
  18. package/dist/goal-store-BQ3YX1h1.d.ts +75 -0
  19. package/dist/{index-DPLJw_ZI.d.ts → index-B0qTujQW.d.ts} +52 -5
  20. package/dist/{index-BDnUCRvL.d.ts → index-DkdRz6yK.d.ts} +351 -15
  21. package/dist/index.d.ts +109 -28
  22. package/dist/index.js +1143 -234
  23. package/dist/index.js.map +1 -1
  24. package/dist/infrastructure/index.d.ts +6 -6
  25. package/dist/kernel/index.d.ts +9 -9
  26. package/dist/{mcp-servers-CSMfaBuL.d.ts → mcp-servers-DBdh3cee.d.ts} +3 -3
  27. package/dist/models/index.d.ts +2 -2
  28. package/dist/models/index.js +2 -3
  29. package/dist/models/index.js.map +1 -1
  30. package/dist/{multi-agent-Cv8wk47i.d.ts → multi-agent-Cpp7FXUl.d.ts} +11 -3
  31. package/dist/observability/index.d.ts +2 -2
  32. package/dist/{path-resolver-DiCUvEg6.d.ts → path-resolver--g_hKJ7V.d.ts} +2 -2
  33. package/dist/{plan-templates-DaxTCPfk.d.ts → plan-templates-CKJs_sYh.d.ts} +9 -8
  34. package/dist/{provider-runner-3SHqk9zB.d.ts → provider-runner-hl4Il3xS.d.ts} +3 -3
  35. package/dist/{retry-policy-LLUxJmYY.d.ts → retry-policy-LKS8MHsB.d.ts} +1 -1
  36. package/dist/sdd/index.d.ts +6 -4
  37. package/dist/sdd/index.js +102 -68
  38. package/dist/sdd/index.js.map +1 -1
  39. package/dist/{secret-scrubber-Z_VXuXQT.d.ts → secret-scrubber-BzQR5BiL.d.ts} +1 -1
  40. package/dist/{secret-scrubber-BhJTNr9v.d.ts → secret-scrubber-CfMdAJ_l.d.ts} +1 -1
  41. package/dist/security/index.d.ts +3 -3
  42. package/dist/security/index.js +82 -82
  43. package/dist/security/index.js.map +1 -1
  44. package/dist/{selector-DB2-byKH.d.ts → selector-C7HqnZJU.d.ts} +1 -1
  45. package/dist/{session-reader-4jxsYLZ8.d.ts → session-reader-CzfRA6Vk.d.ts} +1 -1
  46. package/dist/skills/index.js +102 -38
  47. package/dist/skills/index.js.map +1 -1
  48. package/dist/storage/index.d.ts +6 -5
  49. package/dist/storage/index.js +131 -22
  50. package/dist/storage/index.js.map +1 -1
  51. package/dist/{system-prompt-DI4Dtc1I.d.ts → system-prompt-Dl2QY1_B.d.ts} +1 -1
  52. package/dist/{tool-executor-DSvmOBe6.d.ts → tool-executor-B03CRwu-.d.ts} +4 -4
  53. package/dist/types/index.d.ts +15 -15
  54. package/dist/types/index.js +100 -102
  55. package/dist/types/index.js.map +1 -1
  56. package/dist/utils/index.d.ts +1 -1
  57. package/dist/utils/index.js +5 -0
  58. package/dist/utils/index.js.map +1 -1
  59. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { U as Usage, a2 as Context, z as ToolProgressEvent, v as Tool } from './context-CLZXPPYk.js';
1
+ import { U as Usage, a2 as Context, z as ToolProgressEvent, v as Tool } from './context-CDRyrkKQ.js';
2
2
 
3
3
  /**
4
4
  * EventBus — observe-only typed event bus.
@@ -1,19 +1,20 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-DSvmOBe6.js';
2
- import { g as Provider, a2 as Context } from '../context-CLZXPPYk.js';
3
- import { a as Compactor, C as CompactReport } from '../compactor-BWhJXxsW.js';
4
- import { M as MessageSelector } from '../selector-DB2-byKH.js';
5
- import { E as EventBus } from '../events-qnDZbrtb.js';
6
- import { c as MiddlewareHandler } from '../system-prompt-DI4Dtc1I.js';
7
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BgM0BIpz.js';
8
- import { r as Agent, R as RunResult } from '../index-DPLJw_ZI.js';
9
- import { D as DoneCondition } from '../multi-agent-Cv8wk47i.js';
1
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-B03CRwu-.js';
2
+ import { g as Provider, a2 as Context } from '../context-CDRyrkKQ.js';
3
+ import { a as Compactor, C as CompactReport } from '../compactor-RIPuTtWK.js';
4
+ import { M as MessageSelector } from '../selector-C7HqnZJU.js';
5
+ import { E as EventBus } from '../events-DPQKFX7W.js';
6
+ import { c as MiddlewareHandler } from '../system-prompt-Dl2QY1_B.js';
7
+ import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BGGuP_Ar.js';
8
+ import { r as Agent, R as RunResult } from '../index-B0qTujQW.js';
9
+ import { D as DoneCondition } from '../multi-agent-Cpp7FXUl.js';
10
+ import { J as JournalEntry } from '../goal-store-BQ3YX1h1.js';
10
11
  import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
11
12
  import { W as WstackPaths } from '../wstack-paths-86YPFktR.js';
12
- import '../retry-policy-LLUxJmYY.js';
13
+ import '../retry-policy-LKS8MHsB.js';
13
14
  import '../models-registry-Y2xbog0E.js';
14
15
  import '../logger-BMQgxvdy.js';
15
16
  import '../observability-BhnVLBLS.js';
16
- import '../secret-scrubber-BhJTNr9v.js';
17
+ import '../secret-scrubber-CfMdAJ_l.js';
17
18
 
18
19
  interface SkillLoaderOptions {
19
20
  paths: WstackPaths;
@@ -252,6 +253,13 @@ interface AutonomousRunnerOptions {
252
253
  toolCalls: number;
253
254
  }) => void;
254
255
  onDone?: (result: AutonomousResult) => void;
256
+ /**
257
+ * When true and `doneCondition.type === 'directive'`, the runner
258
+ * runs the agent with `autonomousContinue: true` so the agent loop
259
+ * handles its own [continue]/[done] markers internally (no outer
260
+ * re-invocation needed). The runner still provides iteration/timeouts.
261
+ */
262
+ enableAutonomousContinue?: boolean;
255
263
  }
256
264
  declare class AutonomousRunner {
257
265
  private readonly opts;
@@ -266,4 +274,136 @@ declare class AutonomousRunner {
266
274
  stop(): void;
267
275
  }
268
276
 
269
- export { AutoCompactionMiddleware, AutonomousRunner, type AutonomousRunnerOptions, DefaultSkillLoader, type DoneCheckResult, DoneConditionChecker, IntelligentCompactor, type IntelligentCompactorOptions, SelectiveCompactor, type SelectiveCompactorOptions, type SkillLoaderOptions };
277
+ /**
278
+ * Sense-decide-execute-reflect loop on top of a long-running Goal.
279
+ *
280
+ * Each iteration:
281
+ * 1. Sense — read goal, pending todos, `git status --porcelain`.
282
+ * 2. Decide — pick a source (todo / git / brainstorm) and a task.
283
+ * 3. Execute — single agent.run with a directive prompt.
284
+ * 4. Reflect — append a journal entry, persist state to disk.
285
+ *
286
+ * The loop runs forever until `stop()` is called externally (REPL SIGINT
287
+ * handler, /autonomy stop). No internal time/cost cap by design — the
288
+ * user wants "sittin sene". Failures are logged and the loop continues
289
+ * with a different source on the next tick.
290
+ */
291
+ interface EternalAutonomyOptions {
292
+ agent: Agent;
293
+ projectRoot: string;
294
+ /**
295
+ * Per-iteration agent timeout. Defaults to 5 minutes. A single hung
296
+ * provider call should not freeze the whole eternal loop.
297
+ */
298
+ iterationTimeoutMs?: number;
299
+ /**
300
+ * Minimum sleep between iterations. Defaults to 1 s — enough for
301
+ * SIGINT handlers to fire mid-loop without pegging a core when the
302
+ * provider is being rate-limited.
303
+ */
304
+ cycleGapMs?: number;
305
+ /**
306
+ * Maximum consecutive failures before the source rotation forces a
307
+ * brainstorm cycle. Default 3. Acts as a soft-recovery, not a stop.
308
+ */
309
+ failureBudget?: number;
310
+ /** Side-channel notifications (logging, UI updates). */
311
+ onIteration?: (entry: JournalEntry) => void;
312
+ onError?: (err: Error, iteration: number) => void;
313
+ /**
314
+ * Optional injected git status reader — production code uses git, tests
315
+ * stub this out so they don't shell out.
316
+ */
317
+ gitStatusReader?: () => Promise<string>;
318
+ /**
319
+ * Optional clock — tests stub for deterministic timestamps.
320
+ */
321
+ now?: () => Date;
322
+ /**
323
+ * Optional compactor. When provided, the engine runs compaction every
324
+ * `compactEveryNIterations` iterations to keep the agent's message
325
+ * history under control during multi-day eternal loops. Without
326
+ * compaction, an infinite loop will eventually overflow the provider's
327
+ * context window and start failing.
328
+ */
329
+ compactor?: Compactor;
330
+ /** How many iterations between compaction calls. Default 25. */
331
+ compactEveryNIterations?: number;
332
+ /**
333
+ * Aggressive compaction threshold. When ctx token usage exceeds this
334
+ * fraction of `maxContextTokens`, compaction runs in aggressive mode
335
+ * regardless of the iteration cadence. 0.85 by default.
336
+ */
337
+ aggressiveCompactRatio?: number;
338
+ /**
339
+ * Model's max context window in tokens. When set, the engine watches
340
+ * `currentRequestTokens()` against this and triggers aggressive compact
341
+ * before the next iteration would overflow. Omit to disable threshold
342
+ * checks (iteration cadence still applies).
343
+ */
344
+ maxContextTokens?: number;
345
+ }
346
+ type EternalEngineState = 'idle' | 'running' | 'stopped';
347
+ declare class EternalAutonomyEngine {
348
+ private readonly opts;
349
+ private state;
350
+ private stopRequested;
351
+ private consecutiveFailures;
352
+ private currentCtrl;
353
+ private iterationsSinceCompact;
354
+ private readonly goalPath;
355
+ constructor(opts: EternalAutonomyOptions);
356
+ /** Current engine state — readable for UIs. */
357
+ get currentState(): EternalEngineState;
358
+ /** Synchronously request stop. Resolves once the running iteration aborts. */
359
+ stop(): void;
360
+ /**
361
+ * Mark the engine as 'running' on disk + reset stop state so a new
362
+ * batch of `runOneIteration()` calls can proceed. Called by the REPL
363
+ * when the user invokes `/autonomy eternal`. Idempotent.
364
+ */
365
+ prime(): Promise<void>;
366
+ /**
367
+ * Main loop. Returns when stop() is called or the goal file is removed.
368
+ * Does NOT throw — every iteration is wrapped to keep the loop alive.
369
+ */
370
+ run(): Promise<void>;
371
+ /**
372
+ * Execute a single sense-decide-execute-reflect cycle.
373
+ * Returns true on success, false on handled failure / no-op.
374
+ *
375
+ * Exposed publicly so the REPL can pace iterations from its main loop
376
+ * — running the engine and the REPL as a single sequential consumer of
377
+ * `agent.run()` avoids race conditions on the shared Context.
378
+ */
379
+ runOneIteration(): Promise<boolean>;
380
+ /**
381
+ * Run compaction when either trigger fires:
382
+ * - We've done >= compactEveryNIterations since the last compact.
383
+ * - Current request tokens exceed aggressiveCompactRatio * maxContext.
384
+ *
385
+ * The second check uses *aggressive* mode to free more headroom; the
386
+ * cadence check uses non-aggressive (cheaper).
387
+ */
388
+ private maybeCompact;
389
+ /**
390
+ * Hybrid idea source.
391
+ * 1. Pending todos on the agent's context.
392
+ * 2. Dirty git working tree → propose a "review and finish this" task.
393
+ * 3. Otherwise: brainstorm via the LLM against the goal.
394
+ *
395
+ * After failureBudget consecutive failures, force brainstorm so the
396
+ * engine doesn't loop on the same broken todo or stuck git state.
397
+ */
398
+ private decide;
399
+ private pickPendingTodo;
400
+ private pickGitTask;
401
+ private readGitStatus;
402
+ private brainstormTask;
403
+ private buildDirective;
404
+ private appendIterationEntry;
405
+ private appendFailure;
406
+ private persistEngineState;
407
+ }
408
+
409
+ export { AutoCompactionMiddleware, AutonomousRunner, type AutonomousRunnerOptions, DefaultSkillLoader, type DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, type EternalAutonomyOptions, type EternalEngineState, IntelligentCompactor, type IntelligentCompactorOptions, SelectiveCompactor, type SelectiveCompactorOptions, type SkillLoaderOptions };