@wrongstack/core 0.299.0 → 0.301.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 (165) hide show
  1. package/dist/chronicle/index.d.ts +2 -0
  2. package/dist/chronicle/index.js +297 -10
  3. package/dist/chronicle/project-server.js +253 -15
  4. package/dist/chronicle/sqlite-compaction.d.ts +20 -0
  5. package/dist/chronicle/sqlite-journal.d.ts +57 -0
  6. package/dist/coordination/agents/capability-manifest.d.ts +7 -0
  7. package/dist/coordination/agents/index.d.ts +3 -2
  8. package/dist/coordination/agents/index.js +818 -570
  9. package/dist/coordination/agents/project-agent-identity.d.ts +6 -6
  10. package/dist/coordination/agents/role-skills.d.ts +1 -1
  11. package/dist/coordination/agents/types.d.ts +6 -0
  12. package/dist/coordination/director.d.ts +10 -2
  13. package/dist/coordination/fleet-manager.d.ts +48 -3
  14. package/dist/coordination/ifleet-manager.d.ts +2 -0
  15. package/dist/coordination/index.js +6880 -6440
  16. package/dist/coordination/mail-tools.d.ts +3 -3
  17. package/dist/coordination/mailbox-project-server.js +3 -4
  18. package/dist/coordination/mailbox-types.d.ts +6 -0
  19. package/dist/coordination/multi-agent-coordinator.d.ts +1 -0
  20. package/dist/core/agent-response.d.ts +5 -1
  21. package/dist/core/agent-tools.d.ts +3 -0
  22. package/dist/core/context.d.ts +20 -0
  23. package/dist/core/fallback-model.d.ts +48 -0
  24. package/dist/core/index.d.ts +11 -9
  25. package/dist/core/index.js +1119 -310
  26. package/dist/core/instruction-template.d.ts +83 -0
  27. package/dist/core/next-steps-slot.d.ts +88 -0
  28. package/dist/core/system-prompt-blocks.d.ts +10 -1
  29. package/dist/core/system-prompt-builder.d.ts +40 -4
  30. package/dist/core/system-prompt-memory-skills.d.ts +1 -0
  31. package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
  32. package/dist/defaults/index.js +9805 -8767
  33. package/dist/design/index.js +11 -3
  34. package/dist/execution/auto-compaction-middleware.d.ts +17 -0
  35. package/dist/execution/autonomy-brain.d.ts +15 -2
  36. package/dist/execution/brain-runtime.d.ts +3 -1
  37. package/dist/execution/compaction-core.d.ts +41 -2
  38. package/dist/execution/council-brain.d.ts +47 -1
  39. package/dist/execution/council-orchestrator.d.ts +25 -6
  40. package/dist/execution/council-prompts.d.ts +12 -1
  41. package/dist/execution/index.d.ts +11 -10
  42. package/dist/execution/index.js +10507 -9189
  43. package/dist/execution/tool-executor.d.ts +4 -1
  44. package/dist/execution/topic-shift-advisor.d.ts +53 -0
  45. package/dist/extension/index.js +8 -2
  46. package/dist/extension/registry.d.ts +8 -1
  47. package/dist/fleet-notifier.d.ts +9 -2
  48. package/dist/goal/index.js +11 -3
  49. package/dist/hooks/index.js +50 -13
  50. package/dist/hooks/runner.d.ts +12 -1
  51. package/dist/hq/index.js +59 -21
  52. package/dist/hq/protocol/fleet.d.ts +20 -0
  53. package/dist/hq/protocol.js +10 -0
  54. package/dist/hq/publisher.d.ts +21 -3
  55. package/dist/index.d.ts +22 -20
  56. package/dist/index.js +12211 -8572
  57. package/dist/infrastructure/index.js +108 -21
  58. package/dist/kernel/events/brain-events.d.ts +9 -0
  59. package/dist/kernel/events/provider-events.d.ts +42 -1
  60. package/dist/kernel/events/session-events.d.ts +13 -0
  61. package/dist/kernel/events/tool-events.d.ts +3 -3
  62. package/dist/models/index.d.ts +1 -0
  63. package/dist/models/index.js +18 -1
  64. package/dist/models/provider-credentials.d.ts +54 -0
  65. package/dist/plugin/api.d.ts +6 -0
  66. package/dist/plugin/config.d.ts +55 -0
  67. package/dist/plugin/index.d.ts +2 -1
  68. package/dist/plugin/index.js +2179 -544
  69. package/dist/plugins/auto-review-plugin.d.ts +3 -0
  70. package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
  71. package/dist/plugins/review-claim-registry.d.ts +23 -8
  72. package/dist/plugins/review-types.d.ts +2 -0
  73. package/dist/registry/index.js +109 -74
  74. package/dist/registry/tool-registry.d.ts +15 -0
  75. package/dist/security/capabilities.d.ts +2 -0
  76. package/dist/security/index.d.ts +2 -2
  77. package/dist/security/index.js +166 -44
  78. package/dist/security/permission-helpers.d.ts +23 -6
  79. package/dist/security/permission-policy.d.ts +16 -0
  80. package/dist/security/readonly-permission-policy.d.ts +20 -0
  81. package/dist/security/totp.d.ts +14 -0
  82. package/dist/session-registry-atomic-file.d.ts +32 -5
  83. package/dist/skills/frontmatter.d.ts +6 -0
  84. package/dist/skills/index.js +22 -5
  85. package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
  86. package/dist/storage/cloud-config-sync.d.ts +87 -0
  87. package/dist/storage/director-state.d.ts +7 -0
  88. package/dist/storage/index.d.ts +1 -0
  89. package/dist/storage/index.js +887 -74
  90. package/dist/tools/fallback-system-config-view-tool.d.ts +1 -1
  91. package/dist/tools/index.d.ts +1 -1
  92. package/dist/tools/index.js +898 -335
  93. package/dist/tools/one-shot-llm-tool.d.ts +1 -0
  94. package/dist/tools/plugin-manager.d.ts +27 -0
  95. package/dist/types/config/mcp-features.d.ts +18 -11
  96. package/dist/types/config/root.d.ts +8 -1
  97. package/dist/types/config/runtime.d.ts +20 -6
  98. package/dist/types/config/skills-fleet-brain.d.ts +12 -4
  99. package/dist/types/config/tools.d.ts +16 -0
  100. package/dist/types/context-window.d.ts +1 -0
  101. package/dist/types/council.d.ts +11 -0
  102. package/dist/types/hooks.d.ts +14 -0
  103. package/dist/types/index.d.ts +3 -3
  104. package/dist/types/index.js +1 -0
  105. package/dist/types/multi-agent.d.ts +12 -0
  106. package/dist/types/one-shot-llm.d.ts +25 -0
  107. package/dist/types/plugin.d.ts +28 -0
  108. package/dist/types/provider.d.ts +16 -0
  109. package/dist/types/runtime-capability-manifest.d.ts +168 -0
  110. package/dist/types/skill.d.ts +5 -0
  111. package/dist/types/system-prompt.d.ts +3 -1
  112. package/dist/types/tool-executor.d.ts +8 -1
  113. package/dist/utils/context-breakdown.d.ts +8 -2
  114. package/dist/utils/index.d.ts +1 -1
  115. package/dist/utils/index.js +141 -31
  116. package/dist/utils/regex-guard.d.ts +16 -2
  117. package/dist/utils/sage-output-block.d.ts +7 -10
  118. package/dist/utils/wstack-paths.d.ts +11 -3
  119. package/dist/worktree/index.js +4 -4
  120. package/instructions/agents/browser.md +1 -4
  121. package/instructions/agents/e2e.md +17 -15
  122. package/instructions/agents/ios.md +3 -3
  123. package/instructions/agents/search.md +1 -1
  124. package/instructions/autonomy/goal-preamble.md +4 -4
  125. package/instructions/coordination/director-preamble.md +2 -3
  126. package/instructions/coordination/subagent-baseline.md +3 -1
  127. package/instructions/leader-after-task.md +12 -0
  128. package/instructions/llm/chimera-review.md +1 -1
  129. package/instructions/modes/audit-lite.md +1 -1
  130. package/instructions/sections/tool/common-patterns.md +18 -2
  131. package/instructions/sections/tool/mailbox-compact.md +1 -1
  132. package/instructions/sections/tool/mailbox-full.md +1 -1
  133. package/instructions/system-lite.md +91 -3
  134. package/instructions/system-pro.md +296 -102
  135. package/instructions/system.md +248 -92
  136. package/package.json +3 -3
  137. package/skills/api-design/SKILL.md +3 -0
  138. package/skills/audit-log/SKILL.md +2 -0
  139. package/skills/auto-review/SKILL.md +6 -1
  140. package/skills/bug-hunter/SKILL.md +4 -1
  141. package/skills/chimera/SKILL.md +3 -0
  142. package/skills/data-governance/SKILL.md +3 -0
  143. package/skills/design-system/SKILL.md +5 -2
  144. package/skills/docker-deploy/SKILL.md +2 -0
  145. package/skills/git-flow/SKILL.md +2 -0
  146. package/skills/mailbox-bridge/SKILL.md +3 -0
  147. package/skills/mnemosyne/SKILL.md +2 -0
  148. package/skills/multi-agent/SKILL.md +4 -1
  149. package/skills/node-modern/SKILL.md +4 -1
  150. package/skills/observability/SKILL.md +3 -0
  151. package/skills/output-standards/SKILL.md +2 -0
  152. package/skills/plugin-author/SKILL.md +4 -1
  153. package/skills/prompt-engineering/SKILL.md +3 -1
  154. package/skills/react-modern/SKILL.md +6 -3
  155. package/skills/refactor-planner/SKILL.md +2 -0
  156. package/skills/research-web/SKILL.md +3 -0
  157. package/skills/sdd/SKILL.md +3 -1
  158. package/skills/security-scanner/SKILL.md +3 -0
  159. package/skills/skill-creator/SKILL.md +2 -0
  160. package/skills/tech-stack/SKILL.md +3 -0
  161. package/skills/testing/SKILL.md +4 -1
  162. package/skills/typescript-strict/SKILL.md +4 -1
  163. package/skills/wrongstack-kanban/SKILL.md +6 -3
  164. package/skills/wrongstack-mailbox/SKILL.md +4 -1
  165. package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
@@ -19,19 +19,19 @@
19
19
  */
20
20
  import { existsSync } from 'node:fs';
21
21
  import type { SubagentConfig } from '../../types/multi-agent.js';
22
+ import { type ConsolidationMetadata } from './project-agent-consolidation.js';
23
+ import type { LearnedCaptureResult, ProjectAgentConfig, RoleKnowledgeManifest } from './project-agent-identity-types.js';
22
24
  import { type ProjectAgentLearningPolicy } from './project-agent-learning-policy.js';
23
25
  import { type StructuredLearnedEntry } from './project-agent-learning-structured.js';
24
- import type { LearnedCaptureResult, ProjectAgentConfig, RoleKnowledgeManifest } from './project-agent-identity-types.js';
25
- import { type ConsolidationMetadata } from './project-agent-consolidation.js';
26
26
  export { validateProjectAgentConfig } from './project-agent-config-validation.js';
27
+ export { buildConsolidationInstruction, type ConsolidationMetadata, clearProjectAgentConsolidated, isConsolidated, loadConsolidationMetadata, loadProjectAgentConsolidated, saveProjectAgentConsolidated, } from './project-agent-consolidation.js';
28
+ export type { CreateProjectAgentInput, LearnedCaptureResult, ProjectAgentConfig, ProjectAgentProfile, RoleKnowledgeManifest, } from './project-agent-identity-types.js';
27
29
  export { classifyLearnedEntry, LEARNED_ENTRY_MAX_CHARS, LEARNED_HARD_LIMIT, LEARNED_SOFT_LIMIT, type LearnedEntryCategory, normalizeLearnedEntry, } from './project-agent-learning-normalize.js';
28
- export { decomposeLearnedEntry, mergeStructuredEntries, parseLearnedEntryStamp, renderLearnedInstructions, type StructuredLearnedEntry, } from './project-agent-learning-structured.js';
29
30
  export { loadProjectAgentLearningPolicy, type ProjectAgentLearningPolicy, updateProjectAgentLearningPolicy, } from './project-agent-learning-policy.js';
31
+ export { decomposeLearnedEntry, mergeStructuredEntries, parseLearnedEntryStamp, renderLearnedInstructions, type StructuredLearnedEntry, } from './project-agent-learning-structured.js';
30
32
  export { assertProjectAgentRole } from './project-agent-paths.js';
31
- export { buildConsolidationInstruction, clearProjectAgentConsolidated, isConsolidated, loadConsolidationMetadata, loadProjectAgentConsolidated, saveProjectAgentConsolidated, type ConsolidationMetadata, } from './project-agent-consolidation.js';
32
- export type { CreateProjectAgentInput, LearnedCaptureResult, ProjectAgentConfig, ProjectAgentProfile, RoleKnowledgeManifest, } from './project-agent-identity-types.js';
33
- export { createProjectAgent, loadProjectAgentProfile, slugifyProjectAgentRole, } from './project-agent-profile.js';
34
33
  export { listProjectAgentRoles, refreshProjectAgentIdentity, resetProjectAgentIdentity, updateProjectAgentConfig, updateProjectAgentIdentity, updateProjectAgentKnowledge, updateProjectAgentLearned, } from './project-agent-files.js';
34
+ export { createProjectAgent, loadProjectAgentProfile, slugifyProjectAgentRole, } from './project-agent-profile.js';
35
35
  /**
36
36
  * Live roster overlay. Project policy is resolved lazily for both built-in and
37
37
  * project-created roles, so WebUI changes take effect on the next spawn without
@@ -97,6 +97,6 @@ export declare const ROLE_SKILL_SETS: {
97
97
  export type CatalogRoleWithSkills = keyof typeof ROLE_SKILL_SETS;
98
98
  /** Standalone operational role that lives outside the phase catalog. */
99
99
  export declare const SHADOW_AGENT_SKILLS: ("api-design" | "audit-log" | "bug-hunter" | "chimera" | "data-governance" | "docker-deploy" | "git-flow" | "mnemosyne" | "multi-agent" | "node-modern" | "observability" | "output-standards" | "plugin-author" | "prompt-engineering" | "react-modern" | "refactor-planner" | "research-web" | "sdd" | "security-scanner" | "skill-creator" | "tech-stack" | "testing" | "typescript-strict" | "wrongstack-mailbox")[];
100
- /** Attach a fresh skill-name array so catalog templates remain mutation-safe. */
100
+ /** Attach a bounded, fresh skill-name array so catalog templates remain mutation-safe. */
101
101
  export declare function assignSkillsToAgents(definitions: readonly AgentDefinition[]): AgentDefinition[];
102
102
  //# sourceMappingURL=role-skills.d.ts.map
@@ -100,4 +100,10 @@ export declare const TOOLS: {
100
100
  /** Web research. */
101
101
  readonly research: readonly ["read", "grep", "glob", "search", "fetch", "mailbox"];
102
102
  };
103
+ /** Canonical optional tool packs used by specialist roster roles. */
104
+ export declare const SPECIALIST_TOOLS: {
105
+ readonly browser: string[];
106
+ readonly memory: string[];
107
+ readonly mcp: string[];
108
+ };
103
109
  //# sourceMappingURL=types.d.ts.map
@@ -5,6 +5,7 @@ import type { Tool } from '../types/tool.js';
5
5
  import { InMemoryAgentBridge } from './agent-bridge.js';
6
6
  import type { CollabDebugReport, CollabSessionOptions } from './collab-debug.js';
7
7
  import type { DirectorOptions } from './director-options.js';
8
+ import { type DirectorSubagentSessionSummary } from './director-session.js';
8
9
  import { FleetBus, type FleetUsage, FleetUsageAggregator } from './fleet-bus.js';
9
10
  import type { FleetManager } from './fleet-manager.js';
10
11
  import { type DirectorFleetHost } from './fleet-spawn.js';
@@ -14,10 +15,9 @@ import { LargeAnswerStore } from './large-answer-store.js';
14
15
  import type { ModelMatrixSource } from './model-matrix.js';
15
16
  import { DefaultMultiAgentCoordinator } from './multi-agent-coordinator.js';
16
17
  import { type WorktreeTaskStateUpdate } from './worktree-task-runner.js';
17
- import { type DirectorSubagentSessionSummary } from './director-session.js';
18
18
  export { FleetContextOverflowError, FleetCostCapError, FleetSpawnBudgetError, FleetTokenCapError, } from './director/director-errors.js';
19
- export type { ModelMatrixSource } from './model-matrix.js';
20
19
  export type { DirectorOptions, TaskResultNotification } from './director-options.js';
20
+ export type { ModelMatrixSource } from './model-matrix.js';
21
21
  export declare class Director implements DirectorFleetHost, ICoordinator {
22
22
  private static _asManifestEntry;
23
23
  get coordinatorId(): string;
@@ -149,5 +149,13 @@ export declare class Director implements DirectorFleetHost, ICoordinator {
149
149
  acquireCheckpointLock(): Promise<boolean>;
150
150
  spawnCollab(options: CollabSessionOptions): Promise<CollabDebugReport>;
151
151
  resumeFromCheckpoint(snapshot: DirectorStateSnapshot): void;
152
+ /**
153
+ * After re-attaching checkpoint metadata, pin the live maxSpawns ceiling
154
+ * (profile/flag/env wins over historical checkpoint metadata). The
155
+ * historical cumulative spawn counter is deliberately NOT restored — the
156
+ * lifetime budget is scoped to this director run, so a restarted session
157
+ * resumes with a fresh budget rather than a possibly-exhausted counter.
158
+ */
159
+ private applyResumeBudget;
152
160
  }
153
161
  //# sourceMappingURL=director.d.ts.map
@@ -72,6 +72,14 @@ export declare class FleetManager implements IFleetManager {
72
72
  readonly spawnDepth: number;
73
73
  /** Live spawn counter. */
74
74
  private spawnCount;
75
+ /**
76
+ * Historical `maxSpawns` from the last restored checkpoint (set for any
77
+ * finite checkpoint ceiling, matching or not). Surfaced in
78
+ * `budgetSnapshot()` so operators can see resume reconciliation without
79
+ * reading the JSON file; `ceilingMismatch` carries the actual mismatch signal.
80
+ */
81
+ private checkpointMaxSpawnsAtResume;
82
+ private ceilingMismatchAtResume;
75
83
  private readonly stateCheckpoint;
76
84
  private readonly sessionWriter;
77
85
  private manifestTimer;
@@ -129,7 +137,7 @@ export declare class FleetManager implements IFleetManager {
129
137
  * which cap was exceeded. Does NOT throw — the caller decides
130
138
  * how to surface the rejection.
131
139
  */
132
- canSpawn(_config: SubagentConfig): {
140
+ canSpawn(config: SubagentConfig): {
133
141
  kind: 'max_spawns' | 'max_spawn_depth' | 'max_cost_usd' | 'max_tokens' | 'max_context_load';
134
142
  limit: number;
135
143
  observed: number;
@@ -144,6 +152,41 @@ export declare class FleetManager implements IFleetManager {
144
152
  maxCostUsd: number;
145
153
  usedCostUsd: number;
146
154
  remainingCostUsd: number;
155
+ /** Historical ceiling from the last restored checkpoint, when it differs. */
156
+ checkpointMaxSpawns?: number | undefined;
157
+ /** True when checkpoint metadata and the live ceiling disagree. */
158
+ ceilingMismatch?: boolean | undefined;
159
+ };
160
+ /**
161
+ * Re-attach the on-disk checkpoint after a resume while keeping the live
162
+ * `maxSpawns` ceiling from construction (profile / flag / env). The
163
+ * historical `spawnCount` is deliberately NOT restored: the lifetime
164
+ * budget is scoped to this director run, so a restarted session gets a
165
+ * fresh budget instead of inheriting a (possibly exhausted) counter from
166
+ * before the restart. The checkpoint ceiling is rewritten to the live
167
+ * value so subsequent writes do not reintroduce a stale limit.
168
+ */
169
+ restoreFromCheckpoint(snapshot: {
170
+ spawnCount: number;
171
+ maxSpawns?: number | undefined;
172
+ version?: 1 | undefined;
173
+ directorRunId?: string | undefined;
174
+ updatedAt?: string | undefined;
175
+ spawnDepth?: number | undefined;
176
+ maxSpawnDepth?: number | undefined;
177
+ directorBudget?: {
178
+ maxCostUsd?: number | undefined;
179
+ maxTokens?: number | undefined;
180
+ } | undefined;
181
+ subagents?: unknown[] | undefined;
182
+ tasks?: unknown[] | undefined;
183
+ usage?: unknown | undefined;
184
+ }): {
185
+ usedSpawns: number;
186
+ maxSpawns: number;
187
+ remainingSpawns: number;
188
+ checkpointMaxSpawns?: number | undefined;
189
+ ceilingMismatch: boolean;
147
190
  };
148
191
  setLeaderContextPressure(tokens: number): void;
149
192
  /** Test-only accessor: number of entries in the private subagent-meta map. */
@@ -175,8 +218,10 @@ export declare class FleetManager implements IFleetManager {
175
218
  */
176
219
  get usedNicknames(): ReadonlySet<string>;
177
220
  /**
178
- * Records a spawn: increments counter, stores metadata, updates state checkpoint,
179
- * and schedules a debounced manifest write. Call AFTER the coordinator
221
+ * Records a spawn: stores metadata, updates state checkpoint, and schedules
222
+ * a debounced manifest write. Increments the lifetime spawn counter UNLESS
223
+ * the config is `spawnBudgetExempt` (ephemeral Chimera reviewer/cascade
224
+ * spawns do not consume the leader's budget). Call AFTER the coordinator
180
225
  * has successfully spawned the subagent.
181
226
  *
182
227
  * @param subagentId The subagent's id (from coordinator.spawn result)
@@ -52,6 +52,8 @@ export interface IFleetManager {
52
52
  maxCostUsd: number;
53
53
  usedCostUsd: number;
54
54
  remainingCostUsd: number;
55
+ checkpointMaxSpawns?: number | undefined;
56
+ ceilingMismatch?: boolean | undefined;
55
57
  }) | undefined;
56
58
  /**
57
59
  * Update the leader agent's current context pressure (tokens used in the