@wrongstack/core 0.5.3 → 0.5.6

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 (50) hide show
  1. package/dist/{agent-bridge-EiUFe3if.d.ts → agent-bridge-B07AYFBk.d.ts} +1 -1
  2. package/dist/{compactor-BP4xhKVi.d.ts → compactor-BWhJXxsW.d.ts} +1 -1
  3. package/dist/{config-BOD_HQBw.d.ts → config-BgM0BIpz.d.ts} +1 -1
  4. package/dist/{context-PH4DvBZV.d.ts → context-CLZXPPYk.d.ts} +18 -1
  5. package/dist/coordination/index.d.ts +10 -9
  6. package/dist/coordination/index.js +269 -15
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +20 -19
  9. package/dist/defaults/index.js +459 -17
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/director-state-BmYi3DGA.d.ts +108 -0
  12. package/dist/{events-oxn-Wkub.d.ts → events-qnDZbrtb.d.ts} +67 -2
  13. package/dist/execution/index.d.ts +12 -12
  14. package/dist/extension/index.d.ts +6 -6
  15. package/dist/{index-CcbWbcpy.d.ts → index-BDnUCRvL.d.ts} +113 -6
  16. package/dist/{index-a12jc7-r.d.ts → index-DPLJw_ZI.d.ts} +5 -5
  17. package/dist/index.d.ts +329 -27
  18. package/dist/index.js +2405 -27
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +6 -6
  21. package/dist/kernel/index.d.ts +9 -9
  22. package/dist/kernel/index.js +98 -1
  23. package/dist/kernel/index.js.map +1 -1
  24. package/dist/{mcp-servers-uPmBxZ1B.d.ts → mcp-servers-CSMfaBuL.d.ts} +3 -3
  25. package/dist/models/index.d.ts +2 -2
  26. package/dist/{multi-agent-D6S4Z7H8.d.ts → multi-agent-Cv8wk47i.d.ts} +2 -2
  27. package/dist/observability/index.d.ts +2 -2
  28. package/dist/{path-resolver-CprD5DhS.d.ts → path-resolver-DiCUvEg6.d.ts} +2 -2
  29. package/dist/{director-state-CVzkjKRZ.d.ts → plan-templates-DaxTCPfk.d.ts} +38 -77
  30. package/dist/{provider-runner-DGisz_lG.d.ts → provider-runner-3SHqk9zB.d.ts} +3 -3
  31. package/dist/{retry-policy-DUJ8-Qc_.d.ts → retry-policy-LLUxJmYY.d.ts} +1 -1
  32. package/dist/sdd/index.d.ts +3 -3
  33. package/dist/{secret-scrubber-CB11A2P7.d.ts → secret-scrubber-BhJTNr9v.d.ts} +4 -2
  34. package/dist/{secret-scrubber-EqFa0SyI.d.ts → secret-scrubber-Z_VXuXQT.d.ts} +1 -1
  35. package/dist/security/index.d.ts +13 -3
  36. package/dist/security/index.js +34 -1
  37. package/dist/security/index.js.map +1 -1
  38. package/dist/{selector-yqyxt-Ii.d.ts → selector-DB2-byKH.d.ts} +1 -1
  39. package/dist/{session-reader-1tOyoY1s.d.ts → session-reader-4jxsYLZ8.d.ts} +1 -1
  40. package/dist/storage/index.d.ts +7 -6
  41. package/dist/storage/index.js +222 -3
  42. package/dist/storage/index.js.map +1 -1
  43. package/dist/{system-prompt-BJlzKGO6.d.ts → system-prompt-DI4Dtc1I.d.ts} +1 -1
  44. package/dist/{tool-executor-B6kRcWeF.d.ts → tool-executor-DSvmOBe6.d.ts} +4 -4
  45. package/dist/types/index.d.ts +15 -15
  46. package/dist/types/index.js +9 -1
  47. package/dist/types/index.js.map +1 -1
  48. package/dist/utils/index.d.ts +2 -2
  49. package/dist/{wstack-paths-BGu2INTm.d.ts → wstack-paths-86YPFktR.d.ts} +1 -1
  50. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import { E as EventBus } from './events-oxn-Wkub.js';
2
- import { o as SessionStore, n as SessionMetadata, q as SessionWriter, k as ResumedSession, S as SessionData, p as SessionSummary, b as ContentBlock, m as SessionEvent, ab as TodoItem, a5 as ConversationState } from './context-PH4DvBZV.js';
3
- import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-1tOyoY1s.js';
1
+ import { E as EventBus } from './events-qnDZbrtb.js';
2
+ import { p as SessionStore, o as SessionMetadata, r as SessionWriter, k as ResumedSession, S as SessionData, q as SessionSummary, b as ContentBlock, n as SessionEvent, a5 as TodoItem, a6 as ConversationState } from './context-CLZXPPYk.js';
3
+ import { e as AttachmentStore, A as AddAttachmentInput, d as AttachmentRef, a as Attachment } from './session-reader-4jxsYLZ8.js';
4
4
  import { b as MemoryStore, a as MemoryScope } from './memory-CEXuo7sz.js';
5
- import { a as WstackPaths } from './wstack-paths-BGu2INTm.js';
6
- import { c as ConfigStore, a as Config, b as ConfigLoader } from './config-BOD_HQBw.js';
5
+ import { W as WstackPaths } from './wstack-paths-86YPFktR.js';
6
+ import { c as ConfigStore, a as Config, b as ConfigLoader } from './config-BgM0BIpz.js';
7
7
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
8
8
 
9
9
  interface SessionStoreOptions {
@@ -452,6 +452,22 @@ declare function setPlanItemStatus(plan: PlanFile, idOrIndex: string, status: Pl
452
452
  declare function clearPlan(plan: PlanFile): PlanFile;
453
453
  /** Render the plan as a short markdown-ish string suitable for slash output. */
454
454
  declare function formatPlan(plan: PlanFile): string;
455
+ /**
456
+ * Promote a plan item to a set of todo items.
457
+ * The plan item is marked 'in_progress' (if not already done) and its
458
+ * title + details become the first todo; additional subtasks are appended.
459
+ * Returns the derived todo list so the caller can pass it to `todoTool`
460
+ * or `ctx.state.replaceTodos()`.
461
+ */
462
+ declare function deriveTodosFromPlanItem(plan: PlanFile, idOrIndex: string, subtasks?: string[]): {
463
+ plan: PlanFile;
464
+ todos: Array<{
465
+ id: string;
466
+ content: string;
467
+ status: 'pending' | 'in_progress' | 'completed';
468
+ activeForm?: string;
469
+ }>;
470
+ } | null;
455
471
  /**
456
472
  * Optional: attach a state-listener so meta operations (storing a plan
457
473
  * id on ctx.meta) trigger a save. Currently a stub — plans don't live
@@ -461,79 +477,24 @@ declare function formatPlan(plan: PlanFile): string;
461
477
  declare function attachPlanCheckpoint(_state: ConversationState, _filePath: string, _sessionId: string): () => void;
462
478
 
463
479
  /**
464
- * Director state checkpoint written incrementally throughout a fleet
465
- * run so a crashed director can be inspected (and eventually resumed)
466
- * instead of leaving only a final `fleet.json` manifest after `shutdown()`.
480
+ * Plan templatespre-defined plan skeletons for common workflows.
467
481
  *
468
- * Schema is JSON-friendly and deliberately denormalized. Each mutation
469
- * triggers an atomic-write of the whole file — small payloads (typically
470
- * < 10 KB even with dozens of subagents) make this cheap.
471
- */
472
- interface DirectorSubagentState {
473
- id: string;
474
- name?: string;
475
- role?: string;
476
- provider?: string;
477
- model?: string;
478
- spawnedAt: string;
479
- }
480
- interface DirectorTaskState {
481
- taskId: string;
482
- subagentId?: string;
483
- description?: string;
484
- status: 'pending' | 'running' | 'completed' | 'failed' | 'stopped' | 'timeout';
485
- assignedAt?: string;
486
- completedAt?: string;
487
- iterations?: number;
488
- toolCalls?: number;
489
- durationMs?: number;
490
- error?: string;
491
- }
492
- interface DirectorStateSnapshot {
493
- version: 1;
494
- directorRunId: string;
495
- updatedAt: string;
496
- spawnCount: number;
497
- maxSpawns?: number;
498
- spawnDepth: number;
499
- maxSpawnDepth: number;
500
- subagents: DirectorSubagentState[];
501
- tasks: DirectorTaskState[];
502
- /** Aggregated usage snapshot. Optional — populated by the Director on save when available. */
503
- usage?: unknown;
504
- }
505
- declare function loadDirectorState(filePath: string): Promise<DirectorStateSnapshot | null>;
506
- /**
507
- * In-memory accumulator with atomic-write checkpoint. The Director keeps
508
- * an instance, mutates it on every spawn/assign/complete/fail event, and
509
- * the instance debounces writes so a burst of activity collapses into a
510
- * single disk hit.
482
+ * Templates are stored in-memory (no disk I/O). Users instantiate them
483
+ * via `/plan template use <name>` or `planTool(action: 'template_use')`.
484
+ * Each template is a function that returns an array of item titles, so
485
+ * dynamic content (dates, project names) can be injected later.
511
486
  */
512
- declare class DirectorStateCheckpoint {
513
- private snapshot;
514
- private readonly filePath;
515
- private timer;
516
- private readonly debounceMs;
517
- private writing;
518
- private rewriteRequested;
519
- constructor(filePath: string, init: {
520
- directorRunId: string;
521
- maxSpawns?: number;
522
- spawnDepth: number;
523
- maxSpawnDepth: number;
524
- }, debounceMs?: number);
525
- current(): DirectorStateSnapshot;
526
- recordSpawn(sub: DirectorSubagentState, spawnCount: number): void;
527
- recordTaskAssigned(task: DirectorTaskState): void;
528
- recordTaskStatus(taskId: string, patch: Partial<DirectorTaskState> & {
529
- status: DirectorTaskState['status'];
530
- }): void;
531
- setUsage(usage: unknown): void;
532
- /** Force a synchronous flush — used by Director.shutdown(). */
533
- flush(): Promise<void>;
534
- private bumpUpdatedAt;
535
- private schedule;
536
- private persist;
487
+ interface PlanTemplate {
488
+ name: string;
489
+ description: string;
490
+ category: 'development' | 'release' | 'maintenance' | 'infrastructure';
491
+ items: Array<{
492
+ title: string;
493
+ details?: string;
494
+ }>;
537
495
  }
496
+ declare function listPlanTemplates(): PlanTemplate[];
497
+ declare function getPlanTemplate(name: string): PlanTemplate | undefined;
498
+ declare function formatPlanTemplates(): string;
538
499
 
539
- export { type AbandonedSession as A, loadPlan as B, type ConfigLoaderOptions as C, DEFAULT_CONFIG_MIGRATIONS as D, loadTodosCheckpoint as E, removePlanItem as F, runConfigMigrations as G, savePlan as H, saveTodosCheckpoint as I, setPlanItemStatus as J, type MemoryStoreOptions as M, type PersistedQueueItem as P, QueueStore as Q, RecoveryLock as R, SessionAnalyzer as S, type TodosCheckpointFile as T, type AttachmentStoreOptions as a, type ConfigMigration as b, ConfigMigrationError as c, type ConfigSource as d, DefaultAttachmentStore as e, DefaultConfigLoader as f, DefaultConfigStore as g, DefaultMemoryStore as h, DefaultSessionStore as i, DirectorStateCheckpoint as j, type DirectorStateSnapshot as k, type DirectorSubagentState as l, type DirectorTaskState as m, type MigrationContext as n, type MigrationResult as o, type PlanFile as p, type PlanItem as q, type RecoveryLockOptions as r, type SessionStoreOptions as s, addPlanItem as t, attachPlanCheckpoint as u, attachTodosCheckpoint as v, clearPlan as w, emptyPlan as x, formatPlan as y, loadDirectorState as z };
500
+ export { type AbandonedSession as A, loadPlan as B, type ConfigLoaderOptions as C, DEFAULT_CONFIG_MIGRATIONS as D, loadTodosCheckpoint as E, removePlanItem as F, runConfigMigrations as G, savePlan as H, saveTodosCheckpoint as I, setPlanItemStatus as J, type MemoryStoreOptions as M, type PersistedQueueItem as P, QueueStore as Q, RecoveryLock as R, SessionAnalyzer as S, type TodosCheckpointFile as T, type AttachmentStoreOptions as a, type ConfigMigration as b, ConfigMigrationError as c, type ConfigSource as d, DefaultAttachmentStore as e, DefaultConfigLoader as f, DefaultConfigStore as g, DefaultMemoryStore as h, DefaultSessionStore as i, type MigrationContext as j, type MigrationResult as k, type PlanFile as l, type PlanItem as m, type PlanTemplate as n, type RecoveryLockOptions as o, type SessionStoreOptions as p, addPlanItem as q, attachPlanCheckpoint as r, attachTodosCheckpoint as s, clearPlan as t, deriveTodosFromPlanItem as u, emptyPlan as v, formatPlan as w, formatPlanTemplates as x, getPlanTemplate as y, listPlanTemplates as z };
@@ -1,8 +1,8 @@
1
- import { E as EventBus } from './events-oxn-Wkub.js';
1
+ import { E as EventBus } from './events-qnDZbrtb.js';
2
2
  import { L as Logger } from './logger-BMQgxvdy.js';
3
3
  import { T as Tracer } from './observability-BhnVLBLS.js';
4
- import { g as Provider, R as Request, a1 as Context, j as Response } from './context-PH4DvBZV.js';
5
- import { R as RetryPolicy } from './retry-policy-DUJ8-Qc_.js';
4
+ import { g as Provider, R as Request, a2 as Context, j as Response } from './context-CLZXPPYk.js';
5
+ import { R as RetryPolicy } from './retry-policy-LLUxJmYY.js';
6
6
 
7
7
  /**
8
8
  * Options passed to a ProviderRunner when calling the provider.
@@ -1,4 +1,4 @@
1
- import { j as Response, a1 as Context, h as ProviderError } from './context-PH4DvBZV.js';
1
+ import { j as Response, a2 as Context, h as ProviderError } from './context-CLZXPPYk.js';
2
2
 
3
3
  type RecoveryDecision = {
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { h as Specification, S as SpecAnalysis, g as SpecValidationResult, l as TaskGraph, m as TaskNode, k as TaskFilter, p as TaskSort, o as TaskProgress, r as TaskType, n as TaskPriority, e as SpecStatus, f as SpecTemplate, b as SpecRequirement } from '../task-graph-BITvWt4t.js';
2
- import { E as EventBus } from '../events-oxn-Wkub.js';
3
- import { D as DoneCondition } from '../multi-agent-D6S4Z7H8.js';
4
- import '../context-PH4DvBZV.js';
2
+ import { E as EventBus } from '../events-qnDZbrtb.js';
3
+ import { D as DoneCondition } from '../multi-agent-Cv8wk47i.js';
4
+ import '../context-CLZXPPYk.js';
5
5
 
6
6
  declare class SpecParser {
7
7
  parse(content: string): Specification;
@@ -1,4 +1,4 @@
1
- import { u as Tool, a1 as Context, P as Permission } from './context-PH4DvBZV.js';
1
+ import { v as Tool, a2 as Context, P as Permission } from './context-CLZXPPYk.js';
2
2
 
3
3
  interface TrustPolicy {
4
4
  [toolNameOrPattern: string]: {
@@ -12,7 +12,9 @@ interface TrustPolicy {
12
12
  interface PermissionDecision {
13
13
  permission: Permission;
14
14
  reason?: string;
15
- source: 'default' | 'trust' | 'yolo' | 'user' | 'deny' | 'context';
15
+ source: 'default' | 'trust' | 'yolo' | 'yolo_destructive' | 'user' | 'deny' | 'context';
16
+ /** Risk tier of the tool, if classified. */
17
+ riskTier?: 'safe' | 'standard' | 'destructive';
16
18
  }
17
19
  interface PermissionPolicy {
18
20
  evaluate(tool: Tool, input: unknown, ctx: Context): Promise<PermissionDecision>;
@@ -1,5 +1,5 @@
1
1
  import { S as SecretVault } from './secret-vault-DoISxaKO.js';
2
- import { S as SecretScrubber } from './secret-scrubber-CB11A2P7.js';
2
+ import { S as SecretScrubber } from './secret-scrubber-BhJTNr9v.js';
3
3
 
4
4
  interface SecretVaultOptions {
5
5
  /** Absolute path to the key file. Created with mode 0o600 if missing. */
@@ -1,12 +1,17 @@
1
- export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-EqFa0SyI.js';
2
- import { u as Tool, a1 as Context } from '../context-PH4DvBZV.js';
1
+ export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-scrubber-Z_VXuXQT.js';
2
+ import { v as Tool, a2 as Context } from '../context-CLZXPPYk.js';
3
3
  import { I as InputReader } from '../input-reader-E-ffP2ee.js';
4
- import { a as PermissionPolicy, P as PermissionDecision } from '../secret-scrubber-CB11A2P7.js';
4
+ import { a as PermissionPolicy, P as PermissionDecision } from '../secret-scrubber-BhJTNr9v.js';
5
5
  import '../secret-vault-DoISxaKO.js';
6
6
 
7
7
  interface PermissionPolicyOptions {
8
8
  trustFile: string;
9
9
  yolo?: boolean;
10
+ /**
11
+ * When true, YOLO mode allows even `destructive` tools without confirm.
12
+ * Corresponds to the `--force-all-yolo` CLI flag.
13
+ */
14
+ forceAllYolo?: boolean;
10
15
  promptDelegate?: (tool: Tool, input: unknown, suggestedPattern: string) => Promise<'yes' | 'no' | 'always' | 'deny'>;
11
16
  inputReader?: InputReader;
12
17
  }
@@ -15,6 +20,7 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
15
20
  private loaded;
16
21
  private readonly trustFile;
17
22
  private yolo;
23
+ private forceAllYolo;
18
24
  /**
19
25
  * Session-scoped "soft deny" map. When the user presses 'n' (block once),
20
26
  * the tool+pattern is added here. If the LLM retries in the same session,
@@ -56,6 +62,10 @@ declare class DefaultPermissionPolicy implements PermissionPolicy {
56
62
  setYolo(enabled: boolean): void;
57
63
  /** Check whether YOLO mode is currently active. */
58
64
  getYolo(): boolean;
65
+ /** Toggle force-all-YOLO at runtime. */
66
+ setForceAllYolo(enabled: boolean): void;
67
+ /** Check whether force-all-YOLO is active. */
68
+ getForceAllYolo(): boolean;
59
69
  reload(): Promise<void>;
60
70
  evaluate(tool: Tool, input: unknown, ctx: Context): Promise<PermissionDecision>;
61
71
  trust(rule: {
@@ -21,7 +21,15 @@ var PATTERNS = [
21
21
  type: "stripe_key",
22
22
  regex: /(?<![A-Za-z0-9])sk_(?:live|test)_[A-Za-z0-9]{24,}(?![A-Za-z0-9])/g
23
23
  },
24
- { type: "twilio_sid", regex: /(?<![A-Za-z0-9])AC[a-f0-9]{32}(?![A-Za-z0-9])/g },
24
+ {
25
+ type: "twilio_sid",
26
+ regex: /(?<![A-Za-z0-9])AC[a-f0-9]{32}(?![A-Za-z0-9])/g
27
+ },
28
+ {
29
+ type: "telegram_bot_token",
30
+ // Telegram tokens are of the form bot<digits>:<alphanum> in URL paths
31
+ regex: /\/bot\d+:[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g
32
+ },
25
33
  {
26
34
  type: "jwt",
27
35
  // Anchored: look for literal "eyJ" which is unambiguous for JWT header
@@ -453,6 +461,7 @@ var DefaultPermissionPolicy = class {
453
461
  loaded = false;
454
462
  trustFile;
455
463
  yolo;
464
+ forceAllYolo;
456
465
  /**
457
466
  * Session-scoped "soft deny" map. When the user presses 'n' (block once),
458
467
  * the tool+pattern is added here. If the LLM retries in the same session,
@@ -485,6 +494,7 @@ var DefaultPermissionPolicy = class {
485
494
  constructor(opts) {
486
495
  this.trustFile = opts.trustFile;
487
496
  this.yolo = opts.yolo ?? false;
497
+ this.forceAllYolo = opts.forceAllYolo ?? false;
488
498
  this.promptDelegate = opts.promptDelegate;
489
499
  }
490
500
  /**
@@ -504,6 +514,14 @@ var DefaultPermissionPolicy = class {
504
514
  getYolo() {
505
515
  return this.yolo;
506
516
  }
517
+ /** Toggle force-all-YOLO at runtime. */
518
+ setForceAllYolo(enabled) {
519
+ this.forceAllYolo = enabled;
520
+ }
521
+ /** Check whether force-all-YOLO is active. */
522
+ getForceAllYolo() {
523
+ return this.forceAllYolo;
524
+ }
507
525
  async reload() {
508
526
  try {
509
527
  const raw = await fs2.readFile(this.trustFile, "utf8");
@@ -545,6 +563,21 @@ var DefaultPermissionPolicy = class {
545
563
  return { permission: "auto", source: "trust" };
546
564
  }
547
565
  if (this.yolo) {
566
+ if (tool.riskTier === "destructive" && !this.forceAllYolo) {
567
+ if (this.promptDelegate) {
568
+ const decision = await this.promptDelegate(tool, input, subject ?? tool.name);
569
+ if (decision === "always") {
570
+ await this.trust({ tool: tool.name, pattern: subject ?? tool.name });
571
+ return { permission: "auto", source: "user", reason: "destructive yolo always-allowed" };
572
+ }
573
+ if (decision === "deny") {
574
+ await this.deny({ tool: tool.name, pattern: subject ?? tool.name });
575
+ return { permission: "deny", source: "user", reason: "user denied destructive yolo" };
576
+ }
577
+ return { permission: decision === "yes" ? "auto" : "deny", source: "user" };
578
+ }
579
+ return { permission: "confirm", source: "yolo_destructive", riskTier: "destructive", reason: "destructive tool needs explicit approval even in yolo mode" };
580
+ }
548
581
  return { permission: "auto", source: "yolo" };
549
582
  }
550
583
  if (tool.name === "write" && subject) {