@wrongstack/core 0.308.7 → 0.309.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 (47) hide show
  1. package/dist/coordination/director/director-toolset.d.ts +2 -2
  2. package/dist/coordination/director-mutation-test-tool.d.ts +29 -0
  3. package/dist/coordination/director-tools.d.ts +2 -0
  4. package/dist/coordination/director.d.ts +16 -0
  5. package/dist/coordination/explore-companion.d.ts +9 -6
  6. package/dist/coordination/fleet.d.ts +12 -0
  7. package/dist/coordination/index.d.ts +1 -1
  8. package/dist/coordination/index.js +990 -61
  9. package/dist/coordination/mail-tools.d.ts +10 -6
  10. package/dist/coordination/mailbox-codecs.d.ts +31 -0
  11. package/dist/coordination/multi-agent-coordinator.d.ts +14 -0
  12. package/dist/coordination/multi-agent-timeout.d.ts +11 -1
  13. package/dist/coordination/mutation-engine.d.ts +76 -0
  14. package/dist/coordination/subagent-budget.d.ts +54 -0
  15. package/dist/coordination/subagent-finish.d.ts +78 -0
  16. package/dist/core/index.js +58 -13
  17. package/dist/defaults/index.js +1132 -106
  18. package/dist/execution/index.js +260 -20
  19. package/dist/hq/index.js +45 -5
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +1456 -263
  22. package/dist/infrastructure/index.js +22 -3
  23. package/dist/kernel/events/agent-events.d.ts +31 -2
  24. package/dist/models/index.js +11 -1
  25. package/dist/observability/index.js +1 -1
  26. package/dist/plugin/index.js +113 -12
  27. package/dist/prompts/index.js +360 -3
  28. package/dist/security/auto-approve-policy.d.ts +2 -2
  29. package/dist/security/index.js +177 -50
  30. package/dist/security/permission-helpers.d.ts +11 -0
  31. package/dist/security/permission-policy.d.ts +10 -1
  32. package/dist/security/yolo-risk.d.ts +17 -0
  33. package/dist/session-catalog/index.js +32 -2
  34. package/dist/session-catalog/project-server.js +32 -2
  35. package/dist/skills/index.js +39 -6
  36. package/dist/storage/index.js +44 -3
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/index.js +14 -0
  39. package/dist/types/multi-agent.d.ts +15 -0
  40. package/dist/types/provider.d.ts +29 -1
  41. package/dist/types/tool.d.ts +15 -0
  42. package/dist/utils/index.d.ts +1 -0
  43. package/dist/utils/index.js +54 -4
  44. package/dist/utils/terminal-sanitize.d.ts +41 -0
  45. package/dist/utils/tool-subject.d.ts +1 -1
  46. package/instructions/agents/chaos-monkey.md +61 -0
  47. package/package.json +4 -4
@@ -1,7 +1,7 @@
1
1
  import type { SubagentConfig } from '../../types/multi-agent.js';
2
2
  import type { Tool } from '../../types/tool.js';
3
- import { makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeFleetEmitTool, makeFleetTool, makeKanbanQueueTool, makeQualityGateTool, makeRollUpTool, makeSpawnTool, makeTerminateAllTool, makeTerminateTool, makeWorkCompleteTool } from '../director-tools.js';
4
- type DirectorToolsetHost = Parameters<typeof makeSpawnTool>[0] & Parameters<typeof makeAssignTool>[0] & Parameters<typeof makeKanbanQueueTool>[0] & Parameters<typeof makeAwaitTasksTool>[0] & Parameters<typeof makeAskTool>[0] & Parameters<typeof makeAskResultTool>[0] & Parameters<typeof makeRollUpTool>[0] & Parameters<typeof makeQualityGateTool>[0] & Parameters<typeof makeTerminateTool>[0] & Parameters<typeof makeTerminateAllTool>[0] & Parameters<typeof makeFleetTool>[0] & Parameters<typeof makeCollabDebugTool>[0] & Parameters<typeof makeFleetEmitTool>[0] & Parameters<typeof makeWorkCompleteTool>[0];
3
+ import { makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeFleetEmitTool, makeFleetTool, makeKanbanQueueTool, makeMutationTestTool, makeQualityGateTool, makeRollUpTool, makeSpawnTool, makeTerminateAllTool, makeTerminateTool, makeWorkCompleteTool } from '../director-tools.js';
4
+ type DirectorToolsetHost = Parameters<typeof makeSpawnTool>[0] & Parameters<typeof makeAssignTool>[0] & Parameters<typeof makeKanbanQueueTool>[0] & Parameters<typeof makeAwaitTasksTool>[0] & Parameters<typeof makeAskTool>[0] & Parameters<typeof makeAskResultTool>[0] & Parameters<typeof makeRollUpTool>[0] & Parameters<typeof makeQualityGateTool>[0] & Parameters<typeof makeMutationTestTool>[0] & Parameters<typeof makeTerminateTool>[0] & Parameters<typeof makeTerminateAllTool>[0] & Parameters<typeof makeFleetTool>[0] & Parameters<typeof makeCollabDebugTool>[0] & Parameters<typeof makeFleetEmitTool>[0] & Parameters<typeof makeWorkCompleteTool>[0];
5
5
  export declare function buildDirectorToolset(director: DirectorToolsetHost, roster?: Record<string, SubagentConfig>): Tool[];
6
6
  export {};
7
7
  //# sourceMappingURL=director-toolset.d.ts.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `mutation_test` — director-facing tool behind the Chaos Monkey
3
+ * ("Kaos Maymunu") mutation-testing flow.
4
+ *
5
+ * Green tests prove nothing if they cannot detect sabotage. This tool:
6
+ * 1. Reads each target file in-process and computes a DETERMINISTIC
7
+ * mutation plan (`mutation-engine.ts`) — boundary relax/tighten,
8
+ * `+`↔`-`, boolean flips, `return null`.
9
+ * 2. Spawns ONE chaos-monkey subagent with the exact plan. The subagent
10
+ * applies each mutant one at a time in its checkout, runs the test
11
+ * command, records killed/survived, and restores byte-for-byte.
12
+ * 3. Parses the structured report and, when survivors exist and a
13
+ * `repairSubagentId` was supplied, loops: strengthen-tests task →
14
+ * re-run the surviving mutants only. A mutant that survives twice
15
+ * is reported as `suspected-equivalent` — a code smell, not a test
16
+ * bug — so the loop always terminates without ping-ponging.
17
+ *
18
+ * The LLM never invents mutants: the plan is mechanical, so two runs over
19
+ * the same source produce the same ids and the comparison is honest.
20
+ *
21
+ * @module coordination/director-mutation-test-tool
22
+ */
23
+ import type { SubagentConfig } from '../types/multi-agent.js';
24
+ import type { Tool } from '../types/tool.js';
25
+ import type * as Host from './director-host-contracts.js';
26
+ export declare function makeMutationTestTool(director: Host.DirectorRepairPort, roster?: Record<string, SubagentConfig>, opts?: {
27
+ projectRoot?: string | undefined;
28
+ }): Tool;
29
+ //# sourceMappingURL=director-mutation-test-tool.d.ts.map
@@ -4,6 +4,8 @@ import type * as Host from './director-host-contracts.js';
4
4
  export { makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeFleetTool, makeRollUpTool, makeTerminateAllTool, makeTerminateTool, } from './director-basic-tools.js';
5
5
  export { makeCollabDebugTool, makeFleetEmitTool, makeWorkCompleteTool, } from './director-collab-tools.js';
6
6
  export { makeQualityGateTool } from './director-quality-gate-tool.js';
7
+ export { makeMutationTestTool } from './director-mutation-test-tool.js';
8
+ export { applyMutation, type MutationKind, type MutationPlanItem, parseMutationReport, planMutations, } from './mutation-engine.js';
7
9
  export declare function makeSpawnTool(director: Host.DirectorAdmissionPort, roster?: Record<string, SubagentConfig>): Tool;
8
10
  export declare function makeKanbanQueueTool(director: Host.DirectorLeaseRecoveryPort, roster?: Record<string, SubagentConfig>): Tool;
9
11
  //# sourceMappingURL=director-tools.d.ts.map
@@ -56,6 +56,13 @@ export declare class Director implements DirectorFleetHost, ICoordinator {
56
56
  private readonly subagentIdleTimeoutMs;
57
57
  private readonly retireSubagentOnTaskComplete;
58
58
  private readonly subagentIdleTimers;
59
+ /**
60
+ * Effective idle window per subagent (spawn-time `idleTimeoutMs` override
61
+ * or the Director-wide default; undefined = no window). Internal-task
62
+ * completion re-arms with THIS value, not the Director-wide default, so
63
+ * a subagent-configured window survives its first internal probe.
64
+ */
65
+ private readonly subagentIdleDelayMs;
59
66
  readonly sharedScratchpadPath: string | null;
60
67
  readonly maxSpawns: number;
61
68
  readonly maxSpawnDepth: number;
@@ -92,6 +99,15 @@ export declare class Director implements DirectorFleetHost, ICoordinator {
92
99
  extensionsFor(subagentId: string): number;
93
100
  workComplete(): void;
94
101
  isWorkComplete(): boolean;
102
+ /**
103
+ * Ask every running background subagent that opted into `gracefulFinish`
104
+ * to finish its task in its own turn. In-band notification between tool
105
+ * batches — no interrupt, no abort; each subagent keeps its time budget and
106
+ * accelerates. Session shutdown calls this before draining Chimera work so
107
+ * the post-session reviewer is nudged to complete rather than killed.
108
+ * Returns the number of subagents notified.
109
+ */
110
+ requestFinish(reason: string): number;
95
111
  setLeaderBtwNote(note: string): number;
96
112
  getLeaderBtwNotes(): string[];
97
113
  peekLeaderBtwNotes(): string[];
@@ -76,12 +76,15 @@ export interface ExploreCompanionOptions {
76
76
  /** Project mailbox the companion polls for explicit asks and acks them. */
77
77
  mailbox: Mailbox;
78
78
  /**
79
- * Leader session id used to filter out subagent events. The companion
80
- * subscribes to global events (tool.executed, error, session.agents_updated)
81
- * which fire for BOTH the leader and subagents. When set, any event whose
82
- * `sessionId` differs from this value is skipped. Events without a
83
- * `sessionId` field always pass through (backward compatibility). Pass a
84
- * lazy getter when the session id may change at runtime.
79
+ * Leader session id used to filter events down to this leader only. The
80
+ * companion subscribes to global events (tool.executed, error,
81
+ * session.agents_updated) which fire for BOTH the leader and subagents.
82
+ * Strict, fail-closed: an event passes only when its `sessionId` equals
83
+ * this value unstamped events are dropped (production emitters always
84
+ * stamp; an unstamped event is assumed to be a subagent's), and a
85
+ * transiently unresolved getter drops everything rather than probing on
86
+ * unattributed activity. Pass a lazy getter when the session id may
87
+ * change at runtime.
85
88
  */
86
89
  leaderSessionId: string | (() => string | undefined);
87
90
  /**
@@ -38,6 +38,18 @@ export declare const SECURITY_SCANNER_AGENT: SubagentConfig;
38
38
  * awaited; idle reaping comes from the FLEET_ROSTER_BUDGETS entry.
39
39
  */
40
40
  export declare const EXPLORE_COMPANION_AGENT: SubagentConfig;
41
+ /**
42
+ * Chaos Monkey ("Kaos Maymunu") — one-shot mutation-testing saboteur.
43
+ * Use for: proving whether tests actually pin down the code they cover.
44
+ *
45
+ * Operational role — deliberately NOT in ALL_AGENT_DEFINITIONS (like
46
+ * `shadow-agent` and `explore-companion`), so the free-form dispatcher
47
+ * never routes to it and the phase-catalog count stays intact. The
48
+ * `mutation_test` director tool computes the deterministic mutation plan
49
+ * and hands this agent an exact apply/run/restore checklist; the agent
50
+ * never invents mutants.
51
+ */
52
+ export declare const CHAOS_MONKEY_AGENT: SubagentConfig;
41
53
  /** Generic template used directly or cloned into project-specific roles. */
42
54
  export declare const GENERIC_AGENT: SubagentConfig;
43
55
  export declare const FLEET_ROSTER: Record<string, SubagentConfig>;
@@ -15,7 +15,7 @@ export { attachDepWatcherBridge, type DepWatcherBridgeOptions, } from './dep-wat
15
15
  export { Director, FleetCostCapError, FleetSpawnBudgetError, FleetTokenCapError, type TaskResultNotification, } from './director.js';
16
16
  export { composeDirectorPrompt, composeSubagentPrompt, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_SUBAGENT_BASELINE, type DirectorPromptParts, rosterSummaryFromConfigs, type SubagentPromptParts, } from './director-prompts.js';
17
17
  export { type DirectorSessionFactory, type DirectorSessionFactoryOptions, makeDirectorSessionFactory, } from './director-session.js';
18
- export { makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeFleetEmitTool, makeFleetTool, makeKanbanQueueTool, makeQualityGateTool, makeRollUpTool, makeSpawnTool, makeTerminateAllTool, makeTerminateTool, makeWorkCompleteTool, } from './director-tools.js';
18
+ export { makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeFleetEmitTool, makeFleetTool, makeKanbanQueueTool, makeMutationTestTool, makeQualityGateTool, makeRollUpTool, makeSpawnTool, makeTerminateAllTool, makeTerminateTool, makeWorkCompleteTool, } from './director-tools.js';
19
19
  export { DEFAULT_DISPATCH_ROLE, type DispatchCandidate, type DispatchClassifier, type DispatchMethod, type DispatchOptions, type DispatchResult, dispatchAgent, makeLLMClassifier, scoreAgents, } from './dispatcher.js';
20
20
  export { type FileAuthorTrackerOptions, recordFileAction } from './file-author-tracker.js';
21
21
  export { ACP_AGENTS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, applyRosterBudget, BUG_HUNTER_AGENT, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, type FleetRosterBudget, GENERIC_AGENT, REFACTOR_PLANNER_AGENT, SECURITY_SCANNER_AGENT, } from './fleet.js';