@wrongstack/core 0.302.2 → 0.305.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 (97) hide show
  1. package/README.md +1 -1
  2. package/dist/chronicle/index.js +117 -30
  3. package/dist/chronicle/project-server.js +12 -5
  4. package/dist/coordination/agents/index.js +4645 -3448
  5. package/dist/coordination/agents/project-agent-auto-optimize.d.ts +116 -0
  6. package/dist/coordination/agents/project-agent-capture-window.d.ts +29 -0
  7. package/dist/coordination/agents/project-agent-config-io.d.ts +11 -0
  8. package/dist/coordination/agents/project-agent-consolidation.d.ts +34 -2
  9. package/dist/coordination/agents/project-agent-directive-outcome.d.ts +57 -0
  10. package/dist/coordination/agents/project-agent-files.d.ts +12 -3
  11. package/dist/coordination/agents/project-agent-identity-types.d.ts +4 -0
  12. package/dist/coordination/agents/project-agent-identity.d.ts +38 -11
  13. package/dist/coordination/agents/project-agent-learning-entries.d.ts +8 -2
  14. package/dist/coordination/agents/project-agent-learning-policy.d.ts +22 -1
  15. package/dist/coordination/agents/project-agent-learning-structured.d.ts +72 -1
  16. package/dist/coordination/agents/project-agent-optimizer.d.ts +49 -0
  17. package/dist/coordination/agents/project-agent-quarantine.d.ts +63 -0
  18. package/dist/coordination/agents/project-agent-skill-layer.d.ts +146 -0
  19. package/dist/coordination/agents/role-skills.d.ts +11 -1
  20. package/dist/coordination/agents/types.d.ts +10 -2
  21. package/dist/coordination/director-prompts.d.ts +19 -6
  22. package/dist/coordination/director-tools.d.ts +2 -2
  23. package/dist/coordination/fleet.d.ts +0 -6
  24. package/dist/coordination/index.d.ts +1 -1
  25. package/dist/coordination/index.js +5746 -4326
  26. package/dist/coordination/mail-tools.d.ts +1 -1
  27. package/dist/core/agent-types.d.ts +4 -2
  28. package/dist/core/agent.d.ts +1 -0
  29. package/dist/core/context.d.ts +19 -0
  30. package/dist/core/conversation-state.d.ts +14 -0
  31. package/dist/core/fallback-profile-manager.d.ts +70 -2
  32. package/dist/core/index.js +317 -108
  33. package/dist/core/system-prompt-blocks.d.ts +1 -1
  34. package/dist/core/system-prompt-builder.d.ts +13 -1
  35. package/dist/core/system-prompt-glossary.d.ts +73 -0
  36. package/dist/core/system-prompt-memory-skills.d.ts +2 -2
  37. package/dist/defaults/index.js +1635 -1120
  38. package/dist/execution/council-orchestrator.d.ts +3 -13
  39. package/dist/execution/index.js +3136 -2706
  40. package/dist/execution/one-shot-llm.d.ts +5 -0
  41. package/dist/goal/index.js +7 -0
  42. package/dist/hq/index.js +17 -7
  43. package/dist/hq/protocol/kanban.d.ts +21 -0
  44. package/dist/hq/protocol.js +5 -1
  45. package/dist/hq/redaction.d.ts +14 -0
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.js +5502 -3483
  48. package/dist/infrastructure/index.js +247 -122
  49. package/dist/kernel/events/agent-events.d.ts +28 -0
  50. package/dist/plugin/index.js +111 -7
  51. package/dist/registry/index.js +11 -0
  52. package/dist/registry/tool-registry.d.ts +8 -0
  53. package/dist/replay/hash.d.ts +9 -0
  54. package/dist/replay/index.js +14 -4
  55. package/dist/replay/replay-provider-runner.d.ts +31 -1
  56. package/dist/security/index.js +92 -21
  57. package/dist/security/kanban-boundary.d.ts +5 -1
  58. package/dist/security/secret-vault.d.ts +2 -0
  59. package/dist/session-catalog/index.js +86 -10
  60. package/dist/session-catalog/project-server.js +100 -17
  61. package/dist/session-catalog/protocol.d.ts +20 -4
  62. package/dist/session-catalog/store.d.ts +19 -3
  63. package/dist/storage/index.js +305 -69
  64. package/dist/storage/memory-consolidator.d.ts +4 -2
  65. package/dist/storage/plan-store.d.ts +1 -1
  66. package/dist/storage/session-resume-validation.d.ts +24 -0
  67. package/dist/storage/session-store/directory-scan.d.ts +5 -1
  68. package/dist/storage/session-store/fork-session.d.ts +13 -1
  69. package/dist/storage/session-store/load-cache.d.ts +11 -0
  70. package/dist/storage/session-store/prune-helpers.d.ts +5 -0
  71. package/dist/storage/session-store.d.ts +18 -0
  72. package/dist/tasking/index.js +5 -0
  73. package/dist/tools/index.js +1151 -831
  74. package/dist/types/config/mcp-features.d.ts +31 -1
  75. package/dist/types/config/root.d.ts +23 -1
  76. package/dist/types/config/skills-fleet-brain.d.ts +34 -0
  77. package/dist/types/config/tools.d.ts +22 -0
  78. package/dist/types/config/ui.d.ts +14 -0
  79. package/dist/types/config.d.ts +1 -0
  80. package/dist/types/default-config.d.ts +1 -0
  81. package/dist/types/index.d.ts +2 -2
  82. package/dist/types/index.js +23 -0
  83. package/dist/types/multi-agent.d.ts +7 -0
  84. package/dist/types/session.d.ts +9 -1
  85. package/dist/types/task-graph.d.ts +2 -0
  86. package/dist/types/tool-executor.d.ts +2 -0
  87. package/dist/utils/index.d.ts +1 -0
  88. package/dist/utils/index.js +217 -76
  89. package/dist/utils/project-state-guard.d.ts +21 -0
  90. package/dist/utils/session-scoped-path.d.ts +17 -0
  91. package/dist/utils/todos-format.d.ts +20 -0
  92. package/instructions/leader-after-task.md +3 -4
  93. package/instructions/system-lite.md +17 -14
  94. package/instructions/system-pro.md +29 -30
  95. package/instructions/system.md +29 -28
  96. package/package.json +3 -3
  97. package/skills/wrongstack-kanban/SKILL.md +95 -93
@@ -18,7 +18,7 @@ import { type InstructionTemplateContext } from './instruction-template.js';
18
18
  * `getContextBreakdown()` to attribute real token counts per category in the
19
19
  * `/context` display.
20
20
  */
21
- export type SystemBlockSource = 'identity' | 'tool-usage' | 'environment' | 'skills' | 'mode' | 'plan' | 'leader-after-task' | 'contributor' | 'ledger' | 'nextsteps';
21
+ export type SystemBlockSource = 'identity' | 'tool-usage' | 'environment' | 'skills' | 'mode' | 'plan' | 'leader-after-task' | 'contributor' | 'ledger' | 'glossary' | 'nextsteps';
22
22
  /**
23
23
  * Side-table mapping each system-prompt TextBlock to the section it came from.
24
24
  * Kept as a WeakMap rather than a field on TextBlock so the label never reaches
@@ -115,6 +115,18 @@ export interface DefaultSystemPromptBuilderOptions {
115
115
  * tests, embedders, and plugin-provided prompt experiments.
116
116
  */
117
117
  instructionBundle?: InstructionBundle | undefined;
118
+ /**
119
+ * Project jargon dictionary source. When set, the builder appends a
120
+ * compact `[Project Jargon Dictionary]` block to the prompt, sourced
121
+ * from SAGE-tagged `domain-term` memories. The host CLI/TUI/WebUI is
122
+ * responsible for handing the *same* `ProjectSageMemoryPort` it uses
123
+ * for memory injection into this slot — see
124
+ * `packages/core/src/core/system-prompt-glossary.ts` for the wiring
125
+ * contract and the SAGE architectural-rule cross-reference.
126
+ *
127
+ * omit → no glossary block (default).
128
+ */
129
+ domainGlossary?: MemoryStore | undefined;
118
130
  }
119
131
  export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
120
132
  private readonly opts;
@@ -165,7 +177,7 @@ export declare class DefaultSystemPromptBuilder implements SystemPromptBuilder {
165
177
  private get tier();
166
178
  /**
167
179
  * Returns the max tool description length for the current tier.
168
- * Per the design doc: off=80, minimal=40, light=50, medium=60, aggressive=70.
180
+ * The aggressive tier has the shortest descriptions; off keeps the most detail.
169
181
  */
170
182
  private toolDescLimit;
171
183
  build(ctx: BuildContext): Promise<TextBlock[]>;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * `[Project Jargon Dictionary]` block for the agent system prompt.
3
+ *
4
+ * The block is rendered FROM the same SAGE port the agent uses for
5
+ * all other memory context — never from `@wrongstack/sage-mcp`.
6
+ * Per the SAGE architectural rule (see `packages/sage/docs/direct-icp-usage.md`
7
+ * §1, "The architectural rule"), in-process consumers like the system-prompt
8
+ * builder must consume SAGE through `ProjectSageMemoryPort`/`SqliteMemoryPort`
9
+ * only. MCP is for external consumers; reading the glossary through MCP would
10
+ * open a second writer to the same SQLite file.
11
+ *
12
+ * This module is therefore intentionally `MemoryStore`-shaped rather than
13
+ * typed against the SAGE surface directly, so the prompt-builder stays
14
+ * core-level (no `@wrongstack/sage` import — `core` does not depend on
15
+ * `sage`). The host (CLI/TUI/WebUI) constructs the `SageDomainTermExtractor`
16
+ * against its own SAGE port and stitches it onto the builder via the
17
+ * `injectDomainGlossary` helper.
18
+ *
19
+ * Implementation note — the minimal-dictionary format:
20
+ * We render at most `maxEntries` bullets (default 12, configurable per
21
+ * token-saving tier) of `**Term** — short definition`. Definitions are
22
+ * capped at `maxEntryChars` chars per bullet (default 80) so the block
23
+ * always fits inside ~1k tokens. The format mirrors what the agent would
24
+ * otherwise have to re-derive by reading every recalled SAGE memory, which
25
+ * is the exact token-cost the design reduces.
26
+ */
27
+ import type { MemoryStore } from '../types/memory.js';
28
+ import type { BuildContext } from '../types/system-prompt.js';
29
+ export interface DomainGlossaryOptions {
30
+ /** Max number of bullets. Default 12. */
31
+ maxEntries?: number | undefined;
32
+ /** Max chars per bullet line (after the **Term** header). Default 80. */
33
+ maxEntryChars?: number | undefined;
34
+ }
35
+ export interface DomainGlossary {
36
+ /** The extractor port shape we depend on. */
37
+ readonly memory: MemoryStore;
38
+ /** Render the block, or `null` when no glossary entries exist. */
39
+ readonly formatGlossaryBlock: () => Promise<string | null>;
40
+ }
41
+ /**
42
+ * Build the minimal `[Project Jargon Dictionary]` block.
43
+ *
44
+ * Returns:
45
+ * - `null` when the memory store is missing or doesn't expose the glossary
46
+ * shape — never throw; the prompt builder logs and continues.
47
+ * - an empty string when the memory store has no glossary entries.
48
+ * - a markdown block capped at `maxEntries` × `maxEntryChars` otherwise.
49
+ *
50
+ * The block is prefixed with a clear provenance heading so the agent
51
+ * understands the source and can override / refresh at runtime via
52
+ * the SAGE tooling. The trailing line lists the lookup tag for grep
53
+ * parity (`domain-term`).
54
+ */
55
+ export declare function renderDomainGlossary(ctx: BuildContext, memory: MemoryStore | undefined, options?: DomainGlossaryOptions): Promise<string | null>;
56
+ /**
57
+ * Wire a glossary block into a `DefaultSystemPromptBuilder` via the
58
+ * existing `contributors` channel (see `system-prompt-contributor.ts`).
59
+ *
60
+ * Use from the host (CLI/TUI/WebUI) like this:
61
+ *
62
+ * const builder = new DefaultSystemPromptBuilder({
63
+ * ...other opts,
64
+ * contributors: [
65
+ * ...DefaultSystemPromptBuilder.defaultContributors({ projectRoot }),
66
+ * makeDomainGlossaryContributor({ memory: sagePort }),
67
+ * ],
68
+ * });
69
+ *
70
+ * The contributor returns `[]` for non-SAGE stores so the prompt stays clean.
71
+ */
72
+ export declare function makeDomainGlossaryContributor(glossary: DomainGlossary): (ctx: BuildContext) => Promise<import('../types/blocks.js').TextBlock[]>;
73
+ //# sourceMappingURL=system-prompt-glossary.d.ts.map
@@ -26,8 +26,8 @@ export interface OnlineAgentsCache {
26
26
  * a fresh object on every status check, so reference equality always misses.
27
27
  *
28
28
  * Tier behaviour:
29
- * - 'off' / 'medium' / 'aggressive' → full list with names, sessions, sources
30
- * - 'minimal' / 'light' → count only (no list)
29
+ * - 'off' / 'medium' → full list with names, sessions, sources
30
+ * - 'minimal' / 'light' / 'aggressive' → count only (no list)
31
31
  *
32
32
  * Returns the (possibly updated) cache alongside the text; the caller stores it.
33
33
  */