@wrongstack/core 0.300.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 (144) 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 +2 -2
  13. package/dist/coordination/index.js +6778 -6438
  14. package/dist/coordination/mail-tools.d.ts +3 -3
  15. package/dist/coordination/mailbox-project-server.js +3 -4
  16. package/dist/coordination/mailbox-types.d.ts +6 -0
  17. package/dist/core/agent-response.d.ts +5 -1
  18. package/dist/core/agent-tools.d.ts +3 -0
  19. package/dist/core/context.d.ts +20 -0
  20. package/dist/core/index.d.ts +8 -7
  21. package/dist/core/index.js +893 -284
  22. package/dist/core/instruction-template.d.ts +6 -3
  23. package/dist/core/next-steps-slot.d.ts +88 -0
  24. package/dist/core/system-prompt-builder.d.ts +5 -3
  25. package/dist/core/system-prompt-memory-skills.d.ts +1 -0
  26. package/dist/core/system-prompt-skill-bodies.d.ts +3 -3
  27. package/dist/defaults/index.js +9796 -8897
  28. package/dist/design/index.js +11 -3
  29. package/dist/execution/auto-compaction-middleware.d.ts +17 -0
  30. package/dist/execution/autonomy-brain.d.ts +8 -2
  31. package/dist/execution/brain-runtime.d.ts +3 -1
  32. package/dist/execution/compaction-core.d.ts +41 -2
  33. package/dist/execution/council-brain.d.ts +37 -2
  34. package/dist/execution/council-orchestrator.d.ts +2 -2
  35. package/dist/execution/index.d.ts +11 -10
  36. package/dist/execution/index.js +5178 -4077
  37. package/dist/execution/tool-executor.d.ts +4 -1
  38. package/dist/execution/topic-shift-advisor.d.ts +53 -0
  39. package/dist/extension/index.js +8 -2
  40. package/dist/extension/registry.d.ts +8 -1
  41. package/dist/goal/index.js +11 -3
  42. package/dist/hooks/index.js +42 -9
  43. package/dist/hooks/runner.d.ts +12 -1
  44. package/dist/hq/index.js +41 -17
  45. package/dist/hq/publisher.d.ts +21 -3
  46. package/dist/index.d.ts +21 -20
  47. package/dist/index.js +10887 -8053
  48. package/dist/infrastructure/index.js +108 -21
  49. package/dist/kernel/events/session-events.d.ts +13 -0
  50. package/dist/kernel/events/tool-events.d.ts +3 -3
  51. package/dist/models/index.d.ts +1 -0
  52. package/dist/models/index.js +17 -0
  53. package/dist/models/provider-credentials.d.ts +54 -0
  54. package/dist/plugin/index.d.ts +1 -0
  55. package/dist/plugin/index.js +2024 -502
  56. package/dist/plugins/auto-review-plugin.d.ts +3 -0
  57. package/dist/plugins/cloud-config-sync-plugin.d.ts +22 -0
  58. package/dist/plugins/review-claim-registry.d.ts +23 -8
  59. package/dist/plugins/review-types.d.ts +2 -0
  60. package/dist/registry/index.js +109 -74
  61. package/dist/registry/tool-registry.d.ts +15 -0
  62. package/dist/security/capabilities.d.ts +2 -0
  63. package/dist/security/index.d.ts +1 -1
  64. package/dist/security/index.js +9 -2
  65. package/dist/security/readonly-permission-policy.d.ts +20 -0
  66. package/dist/session-registry-atomic-file.d.ts +32 -5
  67. package/dist/skills/frontmatter.d.ts +6 -0
  68. package/dist/skills/index.js +22 -5
  69. package/dist/storage/cloud-config-sync/sanitize.d.ts +54 -0
  70. package/dist/storage/cloud-config-sync.d.ts +87 -0
  71. package/dist/storage/index.d.ts +1 -0
  72. package/dist/storage/index.js +854 -66
  73. package/dist/tools/index.d.ts +1 -1
  74. package/dist/tools/index.js +511 -234
  75. package/dist/tools/one-shot-llm-tool.d.ts +1 -0
  76. package/dist/tools/plugin-manager.d.ts +27 -0
  77. package/dist/types/config/mcp-features.d.ts +18 -11
  78. package/dist/types/config/root.d.ts +8 -1
  79. package/dist/types/config/runtime.d.ts +20 -6
  80. package/dist/types/config/skills-fleet-brain.d.ts +12 -4
  81. package/dist/types/config/tools.d.ts +16 -0
  82. package/dist/types/context-window.d.ts +1 -0
  83. package/dist/types/hooks.d.ts +14 -0
  84. package/dist/types/index.d.ts +2 -2
  85. package/dist/types/index.js +1 -0
  86. package/dist/types/multi-agent.d.ts +2 -0
  87. package/dist/types/one-shot-llm.d.ts +16 -0
  88. package/dist/types/provider.d.ts +16 -0
  89. package/dist/types/runtime-capability-manifest.d.ts +168 -0
  90. package/dist/types/skill.d.ts +5 -0
  91. package/dist/types/system-prompt.d.ts +3 -1
  92. package/dist/types/tool-executor.d.ts +8 -1
  93. package/dist/utils/context-breakdown.d.ts +8 -2
  94. package/dist/utils/index.d.ts +1 -1
  95. package/dist/utils/index.js +141 -31
  96. package/dist/utils/regex-guard.d.ts +16 -2
  97. package/dist/utils/sage-output-block.d.ts +7 -10
  98. package/dist/utils/wstack-paths.d.ts +11 -3
  99. package/instructions/agents/browser.md +1 -4
  100. package/instructions/agents/e2e.md +17 -15
  101. package/instructions/agents/ios.md +3 -3
  102. package/instructions/agents/search.md +1 -1
  103. package/instructions/autonomy/goal-preamble.md +4 -4
  104. package/instructions/coordination/director-preamble.md +2 -3
  105. package/instructions/coordination/subagent-baseline.md +3 -1
  106. package/instructions/leader-after-task.md +12 -0
  107. package/instructions/llm/chimera-review.md +1 -1
  108. package/instructions/modes/audit-lite.md +1 -1
  109. package/instructions/sections/tool/common-patterns.md +18 -2
  110. package/instructions/sections/tool/mailbox-compact.md +1 -1
  111. package/instructions/sections/tool/mailbox-full.md +1 -1
  112. package/instructions/system-lite.md +10 -0
  113. package/instructions/system-pro.md +23 -14
  114. package/instructions/system.md +22 -13
  115. package/package.json +3 -3
  116. package/skills/api-design/SKILL.md +3 -0
  117. package/skills/audit-log/SKILL.md +2 -0
  118. package/skills/auto-review/SKILL.md +6 -1
  119. package/skills/bug-hunter/SKILL.md +4 -1
  120. package/skills/chimera/SKILL.md +3 -0
  121. package/skills/data-governance/SKILL.md +3 -0
  122. package/skills/design-system/SKILL.md +5 -2
  123. package/skills/docker-deploy/SKILL.md +2 -0
  124. package/skills/git-flow/SKILL.md +2 -0
  125. package/skills/mailbox-bridge/SKILL.md +3 -0
  126. package/skills/mnemosyne/SKILL.md +2 -0
  127. package/skills/multi-agent/SKILL.md +4 -1
  128. package/skills/node-modern/SKILL.md +4 -1
  129. package/skills/observability/SKILL.md +3 -0
  130. package/skills/output-standards/SKILL.md +2 -0
  131. package/skills/plugin-author/SKILL.md +4 -1
  132. package/skills/prompt-engineering/SKILL.md +3 -1
  133. package/skills/react-modern/SKILL.md +6 -3
  134. package/skills/refactor-planner/SKILL.md +2 -0
  135. package/skills/research-web/SKILL.md +3 -0
  136. package/skills/sdd/SKILL.md +3 -1
  137. package/skills/security-scanner/SKILL.md +3 -0
  138. package/skills/skill-creator/SKILL.md +2 -0
  139. package/skills/tech-stack/SKILL.md +3 -0
  140. package/skills/testing/SKILL.md +4 -1
  141. package/skills/typescript-strict/SKILL.md +4 -1
  142. package/skills/wrongstack-kanban/SKILL.md +6 -3
  143. package/skills/wrongstack-mailbox/SKILL.md +4 -1
  144. package/skills/wrongstack-mailbox-mcp/SKILL.md +10 -8
@@ -3,11 +3,12 @@
3
3
  *
4
4
  * Why this exists: `instructions/system.md` (and its `-lite` / `-pro`
5
5
  * variants) used to be injected as layer-1 verbatim, listing ~100 tool names
6
- * regardless of which tools the current request actually registered. At
7
- * `minimal`/`light` tier only the 15 TIER1 tools survive
6
+ * regardless of which tools the current request actually exposed. At
7
+ * `minimal`/`light` tier only the 15 TIER1 tools are sent directly
8
8
  * (`@wrongstack/tools` `selectBuiltinToolsForTier`), yet the prompt still
9
9
  * spent ~8k tokens explaining `kanban`, the browser tools, the SAGE memory
10
- * tools and the Telegram bridge none of which the model could call. The
10
+ * tools and the Telegram bridge. Those tools may remain executable through
11
+ * lazy discovery, but are not legal direct calls in that request. The
11
12
  * token-saving tier was spending most of its savings back in the prompt, and
12
13
  * the text had to carry a "some of the above may be a lie" disclaimer to
13
14
  * compensate.
@@ -69,6 +70,8 @@ export interface InstructionTemplateContext {
69
70
  subagent: boolean;
70
71
  /** Values for plain `{{name}}` placeholders. Unknown names are left as-is. */
71
72
  vars?: Record<string, string | number> | undefined;
73
+ /** Drop lines that format a declared but unavailable tool as callable. */
74
+ strictToolReferences?: boolean | undefined;
72
75
  }
73
76
  /**
74
77
  * Render an instruction markdown layer against the live request.
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Turn-scoped slot for `<nextsteps>` suggestions produced by the `nextsteps`
3
+ * tool, plus the renderer that turns them back into the canonical XML block.
4
+ *
5
+ * ## Why a slot and not a direct channel to the UI
6
+ *
7
+ * Every suggestion surface — the TUI history renderer, the WebUI and SimpleUI
8
+ * chat stores, the CLI REPL suggestion store, and the session replay/rehydrate
9
+ * paths — reads `<nextsteps>` out of the assistant's *message text* via
10
+ * `parseNextSteps` in `@wrongstack/tools/next-steps`. Handing the tool its own
11
+ * transport would mean teaching all of them a second source of truth, and any
12
+ * one of them lagging behind would silently drop suggestions.
13
+ *
14
+ * Instead the tool parks its steps here, and `maybeAppendPendingNextSteps`
15
+ * appends the rendered block to the turn-ending provider response before that
16
+ * response is emitted, persisted, or folded into `finalText`. Downstream code
17
+ * cannot tell the difference between a block the model typed and one the tool
18
+ * produced, which is exactly the point.
19
+ *
20
+ * ## Why this module duplicates the tag knowledge
21
+ *
22
+ * `core` sits below `tools` in the package DAG (enforced by
23
+ * `package-boundaries.test.ts`), so it cannot import the parser. The overlap is
24
+ * deliberately kept to the tag name and the item line shape; the round-trip
25
+ * test in `tests/next-steps-slot.test.ts` feeds this renderer's output through
26
+ * the real parser so the two cannot drift apart unnoticed.
27
+ */
28
+ import type { Response } from '../types/provider.js';
29
+ import type { Context } from './context.js';
30
+ /** A single suggestion parked by the `nextsteps` tool. */
31
+ export interface PendingNextStep {
32
+ text: string;
33
+ /** Opt-in unattended execution. Honored only on the first item. */
34
+ auto?: boolean | undefined;
35
+ }
36
+ /**
37
+ * Upper bound on parked steps. The parser accepts up to 6, but the leader
38
+ * prompt's contract is 1–4, so the slot enforces the tighter number and the
39
+ * tool's schema mirrors it.
40
+ */
41
+ export declare const MAX_PENDING_NEXT_STEPS = 4;
42
+ /**
43
+ * Park the steps for this turn, replacing anything already there.
44
+ *
45
+ * Replace (rather than append) matches `todo`'s whole-list semantics: a second
46
+ * call in the same turn is the model changing its mind, not adding to a list.
47
+ */
48
+ export declare function writePendingNextSteps(ctx: Pick<Context, 'meta'>, steps: readonly PendingNextStep[]): void;
49
+ /** Read the parked steps, or undefined when the slot is empty or malformed. */
50
+ export declare function readPendingNextSteps(ctx: Pick<Context, 'meta'>): PendingNextStep[] | undefined;
51
+ /**
52
+ * Empty the slot. Called at the start of every `run()` so a block produced for
53
+ * one prompt can never attach itself to the answer for the next one, and again
54
+ * after a successful append so it cannot repeat within the same run.
55
+ */
56
+ export declare function clearPendingNextSteps(ctx: Pick<Context, 'meta'>): void;
57
+ /** True when the text already carries a `<nextsteps>` block the model wrote. */
58
+ export declare function hasNextStepsTag(text: string): boolean;
59
+ /**
60
+ * Render parked steps as the canonical block.
61
+ *
62
+ * The output must satisfy `parseNextSteps` exactly: an opening tag with no
63
+ * attributes, one `N. text` line per item, `auto="true"` only ever on item 1,
64
+ * and a balanced closing tag.
65
+ */
66
+ export declare function renderNextStepsBlock(steps: readonly PendingNextStep[]): string;
67
+ /**
68
+ * Append the parked `<nextsteps>` block to the turn-ending response.
69
+ *
70
+ * Returns `res` untouched unless every gate passes:
71
+ *
72
+ * - **leader only** — subagent output is parsed or rolled up by its parent, so
73
+ * a suggestion block there is noise that leaks into specs and plans. Same
74
+ * check as `buildLiveNextStepsGateBlock`.
75
+ * - **turn-ending stop reason** — mid-turn prose must not surface suggestions;
76
+ * every surface gates on this already.
77
+ * - **not aborted** — an interrupted turn has no answer to follow up on.
78
+ * - **no open todos** — finishing tracked work outranks proposing new work.
79
+ * Enforced here rather than per-surface so the gate has one home.
80
+ * - **no block already in the text** — if the model also typed one, its own
81
+ * wording is the fresher intent and wins.
82
+ *
83
+ * The block is *appended* to the last text block, never prepended: the WebUI
84
+ * only accepts a canonical-response update when it extends the text it already
85
+ * streamed (`session-handlers.ts`), so a prefix would be silently dropped.
86
+ */
87
+ export declare function maybeAppendPendingNextSteps(ctx: Pick<Context, 'meta' | 'agentId' | 'todos' | 'signal'>, res: Response): Response;
88
+ //# sourceMappingURL=next-steps-slot.d.ts.map
@@ -7,7 +7,7 @@ import type { BuildContext, ModelCapabilities, SystemPromptBuilder, SystemPrompt
7
7
  import type { SystemPromptContributor } from '../types/system-prompt-contributor.js';
8
8
  import { type InstructionBundle, type InstructionBundlePaths } from './instruction-bundle.js';
9
9
  import { type InstructionTemplateContext } from './instruction-template.js';
10
- export { effectiveShell, shellGuidanceBlock, type EffectiveShell } from './system-prompt-shell.js';
10
+ export { type EffectiveShell, effectiveShell, shellGuidanceBlock } from './system-prompt-shell.js';
11
11
  export declare const LAYER_1_IDENTITY: string;
12
12
  /**
13
13
  * Compose the layer-1 identity from the bundled default plus any override.
@@ -45,8 +45,8 @@ export interface DefaultSystemPromptBuilderOptions {
45
45
  injectMemory?: boolean | undefined;
46
46
  skillLoader?: SkillLoader | undefined;
47
47
  /**
48
- * How skill bodies reach the prompt. `'eager'` (default) injects every
49
- * discovered skill body; `'progressive'` injects only a name+trigger manifest
48
+ * How skill bodies reach the prompt. `'progressive'` (runtime default)
49
+ * injects only a name+trigger manifest; `'eager'` injects discovered bodies
50
50
  * and relies on the agent calling the `skill` tool to load a body on demand
51
51
  * (the agentskills.io progressive-disclosure model).
52
52
  */
@@ -131,6 +131,8 @@ export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
131
131
  private skillBodyCache?;
132
132
  /** Tools from last build — used for memory relevance scoring. */
133
133
  private _lastBuildTools?;
134
+ /** Full executable catalog used to capability-gate progressive skills. */
135
+ private _lastCatalogTools?;
134
136
  /** Cached rendered online agents string, keyed by content fingerprint. */
135
137
  private _lastOnlineAgents?;
136
138
  /** Cached full buildToolUsage output — keyed by tools array ref + agents fingerprint + tier. */
@@ -46,6 +46,7 @@ export interface MemorySkillsContext {
46
46
  skillEagerMaxChars: number | undefined;
47
47
  /** Tools from the last build — used for memory relevance scoring. */
48
48
  lastBuildTools: Tool[] | undefined;
49
+ catalogTools: Tool[] | undefined;
49
50
  skillBodyCache: string | undefined;
50
51
  }
51
52
  /**
@@ -1,5 +1,5 @@
1
1
  import type { SkillLoader } from '../types/skill.js';
2
- export declare function buildProgressiveSkillManifestText(loader: SkillLoader): Promise<string>;
3
- export declare function buildFullSkillBodiesText(loader: SkillLoader, budget?: number): Promise<string>;
4
- export declare function buildCompactSkillBodiesText(loader: SkillLoader, budget?: number): Promise<string>;
2
+ export declare function buildProgressiveSkillManifestText(loader: SkillLoader, availableToolNames?: readonly string[]): Promise<string>;
3
+ export declare function buildFullSkillBodiesText(loader: SkillLoader, budget?: number, availableToolNames?: readonly string[]): Promise<string>;
4
+ export declare function buildCompactSkillBodiesText(loader: SkillLoader, budget?: number, availableToolNames?: readonly string[]): Promise<string>;
5
5
  //# sourceMappingURL=system-prompt-skill-bodies.d.ts.map