@wrongstack/core 0.286.0 → 0.287.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.
- package/dist/boot.d.ts.map +1 -1
- package/dist/coordination/brain-monitor.d.ts +15 -0
- package/dist/coordination/brain-monitor.d.ts.map +1 -1
- package/dist/coordination/delegate-tool.d.ts +8 -14
- package/dist/coordination/delegate-tool.d.ts.map +1 -1
- package/dist/coordination/director/director-btw-notes.d.ts +20 -0
- package/dist/coordination/director/director-btw-notes.d.ts.map +1 -0
- package/dist/coordination/director/director-collab.d.ts +40 -0
- package/dist/coordination/director/director-collab.d.ts.map +1 -0
- package/dist/coordination/director.d.ts +27 -8
- package/dist/coordination/director.d.ts.map +1 -1
- package/dist/coordination/fleet-manager.d.ts +21 -0
- package/dist/coordination/fleet-manager.d.ts.map +1 -1
- package/dist/coordination/fleet.d.ts +2 -3
- package/dist/coordination/fleet.d.ts.map +1 -1
- package/dist/coordination/global-mailbox.d.ts +36 -22
- package/dist/coordination/global-mailbox.d.ts.map +1 -1
- package/dist/coordination/icoordinator.d.ts +1 -3
- package/dist/coordination/icoordinator.d.ts.map +1 -1
- package/dist/coordination/index.js +708 -442
- package/dist/coordination/index.js.map +4 -4
- package/dist/coordination/mail-tools.d.ts.map +1 -1
- package/dist/coordination/mailbox-message-codec.d.ts +21 -1
- package/dist/coordination/mailbox-message-codec.d.ts.map +1 -1
- package/dist/coordination/mailbox-types.d.ts +42 -1
- package/dist/coordination/mailbox-types.d.ts.map +1 -1
- package/dist/core/agent-loop.d.ts.map +1 -1
- package/dist/core/agent-response.d.ts +10 -1
- package/dist/core/agent-response.d.ts.map +1 -1
- package/dist/core/agent-tools.d.ts.map +1 -1
- package/dist/core/agent.d.ts +8 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/context.d.ts +25 -0
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/conversation-state.d.ts +6 -0
- package/dist/core/conversation-state.d.ts.map +1 -1
- package/dist/core/fallback-model.d.ts.map +1 -1
- package/dist/core/mailbox-loop.d.ts +12 -5
- package/dist/core/mailbox-loop.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +14 -6
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/defaults/index.d.ts +0 -1
- package/dist/defaults/index.d.ts.map +1 -1
- package/dist/defaults/index.js +834 -1465
- package/dist/defaults/index.js.map +4 -4
- package/dist/execution/auto-compaction-middleware.d.ts +8 -1
- package/dist/execution/auto-compaction-middleware.d.ts.map +1 -1
- package/dist/execution/compaction-core.d.ts.map +1 -1
- package/dist/execution/council-brain.d.ts.map +1 -1
- package/dist/execution/council-orchestrator.d.ts +32 -0
- package/dist/execution/council-orchestrator.d.ts.map +1 -0
- package/dist/execution/council-personas.d.ts +19 -0
- package/dist/execution/council-personas.d.ts.map +1 -0
- package/dist/execution/council-profiles.d.ts +34 -0
- package/dist/execution/council-profiles.d.ts.map +1 -0
- package/dist/execution/council-prompts.d.ts +21 -0
- package/dist/execution/council-prompts.d.ts.map +1 -0
- package/dist/execution/council-resolution.d.ts +57 -0
- package/dist/execution/council-resolution.d.ts.map +1 -0
- package/dist/execution/design-kit-loader.d.ts.map +1 -1
- package/dist/execution/enhance-recovery.d.ts +35 -0
- package/dist/execution/enhance-recovery.d.ts.map +1 -0
- package/dist/execution/error-handler.d.ts.map +1 -1
- package/dist/execution/index.d.ts +6 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +1738 -161
- package/dist/execution/index.js.map +4 -4
- package/dist/execution/intelligent-compactor.d.ts +18 -7
- package/dist/execution/intelligent-compactor.d.ts.map +1 -1
- package/dist/execution/one-shot-llm.d.ts +52 -0
- package/dist/execution/one-shot-llm.d.ts.map +1 -0
- package/dist/execution/prompt-enhancer.d.ts +23 -4
- package/dist/execution/prompt-enhancer.d.ts.map +1 -1
- package/dist/execution/prompt-enhancer.js +24 -6
- package/dist/execution/prompt-enhancer.js.map +2 -2
- package/dist/execution/selective-compactor.d.ts +4 -4
- package/dist/execution/strategy-compactor.d.ts +7 -0
- package/dist/execution/strategy-compactor.d.ts.map +1 -1
- package/dist/execution/tool-executor.d.ts +19 -5
- package/dist/execution/tool-executor.d.ts.map +1 -1
- package/dist/hooks/registry.d.ts.map +1 -1
- package/dist/hooks/runner.d.ts.map +1 -1
- package/dist/hooks/shell-executor.d.ts.map +1 -1
- package/dist/hq/alerts.d.ts +5 -0
- package/dist/hq/alerts.d.ts.map +1 -1
- package/dist/hq/auth-store.d.ts +17 -7
- package/dist/hq/auth-store.d.ts.map +1 -1
- package/dist/hq/commands.d.ts +8 -4
- package/dist/hq/commands.d.ts.map +1 -1
- package/dist/hq/cost-bridge.d.ts +5 -3
- package/dist/hq/cost-bridge.d.ts.map +1 -1
- package/dist/hq/fleet-bridge.d.ts.map +1 -1
- package/dist/hq/index.d.ts +0 -1
- package/dist/hq/index.d.ts.map +1 -1
- package/dist/hq/index.js +471 -294
- package/dist/hq/index.js.map +4 -4
- package/dist/hq/persistence.d.ts +42 -0
- package/dist/hq/persistence.d.ts.map +1 -1
- package/dist/hq/protocol/brain.d.ts +24 -0
- package/dist/hq/protocol/brain.d.ts.map +1 -0
- package/dist/hq/protocol/browser.d.ts +12 -0
- package/dist/hq/protocol/browser.d.ts.map +1 -0
- package/dist/hq/protocol/client.d.ts +69 -0
- package/dist/hq/protocol/client.d.ts.map +1 -0
- package/dist/hq/protocol/core.d.ts +130 -0
- package/dist/hq/protocol/core.d.ts.map +1 -0
- package/dist/hq/protocol/fleet.d.ts +73 -0
- package/dist/hq/protocol/fleet.d.ts.map +1 -0
- package/dist/hq/protocol/mailbox.d.ts +76 -0
- package/dist/hq/protocol/mailbox.d.ts.map +1 -0
- package/dist/hq/protocol/mcp.d.ts +51 -0
- package/dist/hq/protocol/mcp.d.ts.map +1 -0
- package/dist/hq/protocol/project.d.ts +26 -0
- package/dist/hq/protocol/project.d.ts.map +1 -0
- package/dist/hq/protocol/session.d.ts +153 -0
- package/dist/hq/protocol/session.d.ts.map +1 -0
- package/dist/hq/protocol/tool.d.ts +31 -0
- package/dist/hq/protocol/tool.d.ts.map +1 -0
- package/dist/hq/protocol.d.ts +10 -611
- package/dist/hq/protocol.d.ts.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4540 -2283
- package/dist/index.js.map +4 -4
- package/dist/infrastructure/index.js +13 -11
- package/dist/infrastructure/index.js.map +2 -2
- package/dist/infrastructure/token-counter.d.ts.map +1 -1
- package/dist/kernel/events/agent-events.d.ts +283 -0
- package/dist/kernel/events/agent-events.d.ts.map +1 -0
- package/dist/kernel/events/brain-events.d.ts +176 -0
- package/dist/kernel/events/brain-events.d.ts.map +1 -0
- package/dist/kernel/events/fleet-events.d.ts +39 -0
- package/dist/kernel/events/fleet-events.d.ts.map +1 -0
- package/dist/kernel/events/memory-events.d.ts +165 -0
- package/dist/kernel/events/memory-events.d.ts.map +1 -0
- package/dist/kernel/events/provider-events.d.ts +98 -0
- package/dist/kernel/events/provider-events.d.ts.map +1 -0
- package/dist/kernel/events/sdd-events.d.ts +118 -0
- package/dist/kernel/events/sdd-events.d.ts.map +1 -0
- package/dist/kernel/events/session-events.d.ts +227 -0
- package/dist/kernel/events/session-events.d.ts.map +1 -0
- package/dist/kernel/events/tool-events.d.ts +185 -0
- package/dist/kernel/events/tool-events.d.ts.map +1 -0
- package/dist/kernel/events/worktree-events.d.ts +58 -0
- package/dist/kernel/events/worktree-events.d.ts.map +1 -0
- package/dist/kernel/events.d.ts +10 -1298
- package/dist/kernel/events.d.ts.map +1 -1
- package/dist/kernel/index.js +22 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/kernel/run-controller.d.ts +15 -0
- package/dist/kernel/run-controller.d.ts.map +1 -1
- package/dist/mailbox-attach.d.ts.map +1 -1
- package/dist/models/index.js +19 -6
- package/dist/models/index.js.map +2 -2
- package/dist/models/llm-selector.d.ts +7 -0
- package/dist/models/llm-selector.d.ts.map +1 -1
- package/dist/plugins/auto-review-plugin.d.ts +36 -0
- package/dist/plugins/auto-review-plugin.d.ts.map +1 -0
- package/dist/plugins/chimera-plugin.d.ts +8 -0
- package/dist/plugins/chimera-plugin.d.ts.map +1 -1
- package/dist/security/index.js +7 -2
- package/dist/security/index.js.map +2 -2
- package/dist/security/secret-scrubber.d.ts.map +1 -1
- package/dist/skills/index.js.map +2 -2
- package/dist/storage/config-loader.d.ts.map +1 -1
- package/dist/storage/goal-kanban.d.ts +69 -0
- package/dist/storage/goal-kanban.d.ts.map +1 -0
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +425 -717
- package/dist/storage/index.js.map +4 -4
- package/dist/storage/memory-consolidator.d.ts +9 -1
- package/dist/storage/memory-consolidator.d.ts.map +1 -1
- package/dist/tools/council-tool.d.ts +25 -0
- package/dist/tools/council-tool.d.ts.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1884 -12
- package/dist/tools/index.js.map +4 -4
- package/dist/tools/one-shot-llm-tool.d.ts +51 -0
- package/dist/tools/one-shot-llm-tool.d.ts.map +1 -0
- package/dist/types/config.d.ts +27 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context-window.d.ts.map +1 -1
- package/dist/types/council.d.ts +134 -0
- package/dist/types/council.d.ts.map +1 -0
- package/dist/types/default-config.d.ts +3 -3
- package/dist/types/hooks.d.ts +14 -0
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +29 -8
- package/dist/types/index.js.map +3 -3
- package/dist/types/one-shot-llm.d.ts +128 -0
- package/dist/types/one-shot-llm.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +6 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/provider.d.ts +17 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/system-prompt.d.ts +2 -1
- package/dist/types/system-prompt.d.ts.map +1 -1
- package/dist/types/tool-executor.d.ts +10 -0
- package/dist/types/tool-executor.d.ts.map +1 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/index.js +75 -8
- package/dist/utils/index.js.map +3 -3
- package/dist/utils/tool-wire-compact.d.ts +1 -0
- package/dist/utils/tool-wire-compact.d.ts.map +1 -1
- package/dist/utils/wstack-paths.d.ts +20 -4
- package/dist/utils/wstack-paths.d.ts.map +1 -1
- package/instructions/cli/next-task-predictor.md +5 -3
- package/instructions/coordination/subagent-baseline.md +8 -7
- package/instructions/leader-after-task.md +18 -9
- package/instructions/llm/council-judge.md +19 -0
- package/instructions/llm/council-voter.md +22 -0
- package/instructions/modes/architect.md +14 -9
- package/instructions/modes/audit-lite.md +9 -7
- package/instructions/modes/brief-system.md +12 -12
- package/instructions/modes/brief.md +7 -5
- package/instructions/modes/code-auditor.md +13 -8
- package/instructions/modes/code-reviewer.md +13 -8
- package/instructions/modes/debug-lite.md +7 -6
- package/instructions/modes/debugger.md +13 -9
- package/instructions/modes/devops.md +13 -9
- package/instructions/modes/plan-lite.md +7 -6
- package/instructions/modes/refactor-lite.md +7 -6
- package/instructions/modes/refactorer.md +14 -9
- package/instructions/modes/research-lite.md +8 -6
- package/instructions/modes/research-web.md +18 -55
- package/instructions/modes/review-lite.md +7 -6
- package/instructions/modes/teach-system.md +15 -15
- package/instructions/modes/teach.md +13 -12
- package/instructions/modes/test-lite.md +6 -5
- package/instructions/modes/tester.md +13 -9
- package/instructions/modes/ui-design.md +14 -8
- package/instructions/sections/tool/commit-hygiene.md +1 -7
- package/instructions/sections/tool/common-patterns.md +5 -5
- package/instructions/sections/tool/delegation-full.md +3 -31
- package/instructions/sections/tool/mailbox-compact.md +1 -1
- package/instructions/sections/tool/mailbox-full.md +6 -22
- package/instructions/system.md +278 -39
- package/package.json +2 -2
- package/skills/mailbox-bridge/SKILL.md +16 -7
- package/skills/output-standards/SKILL.md +16 -16
- package/skills/wrongstack-mailbox/SKILL.md +6 -0
- package/dist/coordination/director-construction.d.ts +0 -90
- package/dist/coordination/director-construction.d.ts.map +0 -1
- package/dist/hq/agent-bridge.d.ts +0 -27
- package/dist/hq/agent-bridge.d.ts.map +0 -1
- package/dist/storage/memory-store.d.ts +0 -119
- package/dist/storage/memory-store.d.ts.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Director construction helpers.
|
|
3
|
-
*
|
|
4
|
-
* The `Director` constructor was historically a single 300+ line function
|
|
5
|
-
* that interleaved field assignments with two pieces of event-listener
|
|
6
|
-
* wiring: the `task.completed` listener on the coordinator (which mirrors
|
|
7
|
-
* completions into the in-memory wait table, the on-disk checkpoint, and
|
|
8
|
-
* the session JSONL event stream) and the `budget.threshold_reached`
|
|
9
|
-
* filter on the FleetBus (which implements the heartbeat-driven timeout
|
|
10
|
-
* policy and the per-kind auto-extension logic).
|
|
11
|
-
*
|
|
12
|
-
* Both wirings were inlined because they close over a lot of Director
|
|
13
|
-
* private state (`completed`, `taskWaiters`, `taskDescriptions`,
|
|
14
|
-
* `appendSessionEvent`, `scheduleManifest`, `recordExtension`,
|
|
15
|
-
* `maxBudgetExtensions`, `maxFleetCostUsd`, etc.). Pulling them out
|
|
16
|
-
* without losing the closures requires a narrow `DirectorInternals`
|
|
17
|
-
* shape — exactly what this module exposes.
|
|
18
|
-
*
|
|
19
|
-
* The constructor itself stays a member-initializer; the helpers below
|
|
20
|
-
* are called *during* construction, after the relevant fields are
|
|
21
|
-
* populated. Each helper ends with `coordinator.on(...)` /
|
|
22
|
-
* `fleet.filter(...)` registration so the listener is wired exactly
|
|
23
|
-
* once, at construction time.
|
|
24
|
-
*/
|
|
25
|
-
import type { TaskResult, TaskSpec } from '../types/multi-agent.js';
|
|
26
|
-
/** Cap on the in-memory `completed` map. Trimmed oldest-first when exceeded. */
|
|
27
|
-
export declare const MAX_COMPLETED = 10000;
|
|
28
|
-
/** Narrow shape the wiring helpers need from a partially-constructed Director.
|
|
29
|
-
* The helpers accept a `Director` instance (structural typing — the class
|
|
30
|
-
* exposes every field this interface requires), so the constructor can pass
|
|
31
|
-
* `this` directly without an explicit cast.
|
|
32
|
-
*
|
|
33
|
-
* Note: Private/protected members cannot be picked via Pick<> because keyof
|
|
34
|
-
* only returns public keys. We define the interface explicitly rather than
|
|
35
|
-
* deriving from Director to include private fields the wiring code needs. */
|
|
36
|
-
export interface DirectorInternals {
|
|
37
|
-
id: string;
|
|
38
|
-
directorRunId: string;
|
|
39
|
-
completed: Map<string, import('../types/multi-agent.js').TaskResult>;
|
|
40
|
-
taskWaiters: Map<string, {
|
|
41
|
-
promise: Promise<import('../types/multi-agent.js').TaskResult>;
|
|
42
|
-
resolve: (r: import('../types/multi-agent.js').TaskResult) => void;
|
|
43
|
-
}>;
|
|
44
|
-
taskDescriptions: Map<string, string>;
|
|
45
|
-
stateCheckpoint: import('../storage/director-state.js').DirectorStateCheckpoint | null;
|
|
46
|
-
usage: import('./fleet-bus.js').FleetUsageAggregator;
|
|
47
|
-
fleetManager: import('./fleet-manager.js').FleetManager | undefined;
|
|
48
|
-
fleet: import('./fleet-bus.js').FleetBus;
|
|
49
|
-
coordinator: import('./icoordinator.js').ICoordinator;
|
|
50
|
-
maxBudgetExtensions: number;
|
|
51
|
-
maxFleetCostUsd: number;
|
|
52
|
-
recordExtension: (subagentId: string, taskId: string | undefined, kind: string, newLimit: number) => void;
|
|
53
|
-
appendSessionEvent: (event: Parameters<import('../types/session.js').SessionWriter['append']>[0]) => Promise<void>;
|
|
54
|
-
scheduleManifest: () => void;
|
|
55
|
-
brain: import('./brain.js').BrainArbiter | undefined;
|
|
56
|
-
}
|
|
57
|
-
export { TIMEOUT_PREEMPT_FRACTION } from './subagent-budget.js';
|
|
58
|
-
/**
|
|
59
|
-
* Wire the coordinator's `task.completed` event into the Director's
|
|
60
|
-
* in-memory wait table, the on-disk state checkpoint, and the session
|
|
61
|
-
* JSONL event stream.
|
|
62
|
-
*
|
|
63
|
-
* Mirrors coordinator completion events into:
|
|
64
|
-
* - `d.completed` (capped at `Director.MAX_COMPLETED`, oldest-first trim)
|
|
65
|
-
* - `d.taskWaiters` (resolve and clear the matching waiter)
|
|
66
|
-
* - `d.stateCheckpoint.recordTaskStatus(...)` + `setUsage(...)`
|
|
67
|
-
* - session event stream via `d.appendSessionEvent(...)`
|
|
68
|
-
* - fleet manifest via `d.fleetManager?.flushManifest()` or `d.scheduleManifest()`
|
|
69
|
-
*
|
|
70
|
-
* Returns the listener so the Director can call `coordinator.off(...)`
|
|
71
|
-
* during `shutdown()`.
|
|
72
|
-
*/
|
|
73
|
-
export declare function wireTaskCompletedListener(d: DirectorInternals): (payload: {
|
|
74
|
-
task: TaskSpec;
|
|
75
|
-
result: TaskResult;
|
|
76
|
-
}) => void;
|
|
77
|
-
/**
|
|
78
|
-
* Wire the FleetBus's `budget.threshold_reached` filter with the
|
|
79
|
-
* Director's auto-extend/deny policy. Implements:
|
|
80
|
-
*
|
|
81
|
-
* - Heartbeat-driven timeout policy: while a subagent keeps executing
|
|
82
|
-
* tools it never dies on time; once it stops making progress between
|
|
83
|
-
* grants, deny. Wall-clock time alone is never a reliable "stuck" signal.
|
|
84
|
-
* - Per-kind auto-extension with `maxBudgetExtensions` cap.
|
|
85
|
-
* - Brain-decision routing when a brain arbiter is configured.
|
|
86
|
-
* - Collab-subagent passthrough (BugHunter / RefactorPlanner / Critic
|
|
87
|
-
* own their own budget routing via the CollabSession).
|
|
88
|
-
*/
|
|
89
|
-
export declare function wireBudgetHandler(d: DirectorInternals): void;
|
|
90
|
-
//# sourceMappingURL=director-construction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"director-construction.d.ts","sourceRoot":"","sources":["../../src/coordination/director-construction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ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,KAAK,EAAE,OAAO,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACtD;AAyBD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAShE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,GAAG,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAiEzH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,CA8J5D"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgentMonitorEventBridge — forwards local agent timeline and status events
|
|
3
|
-
* to the HQ publisher as structured HQ event envelopes, so the HQ browser
|
|
4
|
-
* dashboard sees real-time agent conversation streams.
|
|
5
|
-
*/
|
|
6
|
-
import type { EventBus } from '../kernel/events.js';
|
|
7
|
-
import { type HqEventEnvelope } from './protocol.js';
|
|
8
|
-
export type HqAgentEventPublisher = (envelope: HqEventEnvelope) => void;
|
|
9
|
-
export interface AgentMonitorEventBridgeOptions {
|
|
10
|
-
/** Local EventBus emitting agent.timeline.* and agent.status_changed events. */
|
|
11
|
-
events: EventBus;
|
|
12
|
-
/** Client/project identifiers for HQ envelope authorship. */
|
|
13
|
-
clientId: string;
|
|
14
|
-
projectId: string;
|
|
15
|
-
/**
|
|
16
|
-
* Publish callback — called with each HQ event envelope. Wire this to
|
|
17
|
-
* your HQ publisher's `send()` or queue method when connected.
|
|
18
|
-
* When null (no HQ connection), events are silently dropped.
|
|
19
|
-
*/
|
|
20
|
-
publish?: HqAgentEventPublisher | undefined;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Start forwarding agent monitoring events to HQ. Returns a disposer that
|
|
24
|
-
* unsubscribes all listeners — call on shutdown.
|
|
25
|
-
*/
|
|
26
|
-
export declare function startAgentMonitorEventBridge(opts: AgentMonitorEventBridgeOptions): () => void;
|
|
27
|
-
//# sourceMappingURL=agent-bridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-bridge.d.ts","sourceRoot":"","sources":["../../src/hq/agent-bridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAgF,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAEnI,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;AAExE,MAAM,WAAW,8BAA8B;IAC7C,gFAAgF;IAChF,MAAM,EAAE,QAAQ,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,8BAA8B,GAAG,MAAM,IAAI,CAyD7F"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import type { MemoryEntry, MemoryRelevanceContext, MemoryScope, MemoryStore, ScoredEntry } from '../types/memory.js';
|
|
2
|
-
import type { EventBus } from '../kernel/events.js';
|
|
3
|
-
import type { WstackPaths } from '../utils/wstack-paths.js';
|
|
4
|
-
import { type MemoryBackend } from './memory-backend.js';
|
|
5
|
-
export interface MemoryStoreOptions {
|
|
6
|
-
paths: WstackPaths;
|
|
7
|
-
/**
|
|
8
|
-
* Optional event bus — when provided, mutations emit events so plugins
|
|
9
|
-
* and other subsystems can react to memory changes.
|
|
10
|
-
*/
|
|
11
|
-
events?: EventBus | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Storage backend. Defaults to FileMemoryBackend when omitted.
|
|
14
|
-
* Plugins can register a custom backend (graph, semantic, vector)
|
|
15
|
-
* via the DI container to override storage behavior.
|
|
16
|
-
*/
|
|
17
|
-
backend?: MemoryBackend | undefined;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Three scopes:
|
|
21
|
-
* project-agents → <project>/.wrongstack/AGENTS.md (committed)
|
|
22
|
-
* project-memory → ~/.wrongstack/projects/<hash>/memory.md (per-project agent notes)
|
|
23
|
-
* user-memory → ~/.wrongstack/memory.md (global personal memory)
|
|
24
|
-
*/
|
|
25
|
-
export declare class DefaultMemoryStore implements MemoryStore {
|
|
26
|
-
private readonly files;
|
|
27
|
-
private readonly events?;
|
|
28
|
-
private traceId?;
|
|
29
|
-
private readonly backend;
|
|
30
|
-
/**
|
|
31
|
-
* Per-scope serialization queue. `remember` / `forget` / `consolidate` /
|
|
32
|
-
* `clear` are read-modify-write against a single file; without a lock,
|
|
33
|
-
* two concurrent calls on the same scope can read the same baseline and
|
|
34
|
-
* the later write silently drops the earlier entry. We chain each
|
|
35
|
-
* mutation onto the prior promise for the same scope so they run in
|
|
36
|
-
* issue order. Different scopes still proceed in parallel.
|
|
37
|
-
*
|
|
38
|
-
* The chain tracks only the last pending write. If a write fails, its
|
|
39
|
-
* error is caught and swallowed so the chain stays alive for subsequent
|
|
40
|
-
* calls. The error is stored in `writeErrors` so callers can learn about
|
|
41
|
-
* it on the next read operation.
|
|
42
|
-
*/
|
|
43
|
-
private readonly writeChain;
|
|
44
|
-
/** Last write error per scope — surfaced as warnings on the next readAll(). */
|
|
45
|
-
private readonly writeErrors;
|
|
46
|
-
/**
|
|
47
|
-
* When the global root is a temporary directory (opencode, CI sandboxes),
|
|
48
|
-
* memory files are also mirrored to the project tree so they survive
|
|
49
|
-
* session cleanup. The primary path stays in the temp root for isolation;
|
|
50
|
-
* this backup ensures memory is never lost.
|
|
51
|
-
*/
|
|
52
|
-
private readonly persistBackup;
|
|
53
|
-
private readonly backupDir;
|
|
54
|
-
/**
|
|
55
|
-
* Per-scope tracked byte sizes — incremented on `remember()`, decremented on
|
|
56
|
-
* `forget()`, recalculated after `consolidate()`. Eliminates the redundant
|
|
57
|
-
* readAll() call that previously checked the file size after every write.
|
|
58
|
-
*/
|
|
59
|
-
private readonly _trackedByteSizes;
|
|
60
|
-
/** Result cache for scoreRelevant() — keyed by scope + context hash, TTL 30s. */
|
|
61
|
-
private readonly _scoreCache;
|
|
62
|
-
/**
|
|
63
|
-
* Per-entry cached lowercase strings — lazily allocated once and reused
|
|
64
|
-
* across scoreRelevant() calls so repeated scoring of the same entries skips
|
|
65
|
-
* re-lowercasing. Keyed by entry object identity; cleared (set to null) on
|
|
66
|
-
* every mutation (remember/forget/consolidate/clear) via invalidateScoreCaches().
|
|
67
|
-
*/
|
|
68
|
-
private _cachedLower;
|
|
69
|
-
constructor(opts: MemoryStoreOptions);
|
|
70
|
-
/** Expose the backend for plugin introspection and advanced queries. */
|
|
71
|
-
getBackend(): MemoryBackend;
|
|
72
|
-
private runSerialized;
|
|
73
|
-
/**
|
|
74
|
-
* Recalculate the tracked byte size for a scope by re-reading the file and
|
|
75
|
-
* summing the serialized byte length of each line. Called after consolidate()
|
|
76
|
-
* (which modifies the file) to keep the tracker accurate.
|
|
77
|
-
*/
|
|
78
|
-
private _recalcTrackedByteSize;
|
|
79
|
-
readAll(): Promise<string>;
|
|
80
|
-
read(scope: MemoryScope): Promise<string>;
|
|
81
|
-
/**
|
|
82
|
-
* List entries from a scope, newest first. Delegates to the backend
|
|
83
|
-
* so graph/semantic backends can return enriched or filtered results.
|
|
84
|
-
*/
|
|
85
|
-
list(scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
86
|
-
/**
|
|
87
|
-
* Find memories related to the given text via graph traversal.
|
|
88
|
-
* Falls back to content search when no graph backend is available.
|
|
89
|
-
*/
|
|
90
|
-
findRelated(text: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
91
|
-
search(query: string, scope?: MemoryScope, limit?: number): Promise<MemoryEntry[]>;
|
|
92
|
-
remember(text: string, scope?: MemoryScope, metadata?: Omit<Partial<MemoryEntry>, 'scope' | 'text' | 'ts'>): Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* Drop the relevance caches after a mutation. Both the per-context score
|
|
95
|
-
* cache and the per-entry lowercase cache are keyed on entry objects that a
|
|
96
|
-
* mutation invalidates, so they must be cleared together when entries change.
|
|
97
|
-
*/
|
|
98
|
-
private invalidateScoreCaches;
|
|
99
|
-
/**
|
|
100
|
-
* Score and rank memories by relevance to the current context.
|
|
101
|
-
* Returns entries with score >= MIN_RELEVANCE_SCORE, sorted highest first.
|
|
102
|
-
*/
|
|
103
|
-
scoreRelevant(ctx: MemoryRelevanceContext, scope?: MemoryScope, limit?: number): Promise<ScoredEntry[]>;
|
|
104
|
-
forget(query: string, scope?: MemoryScope): Promise<number>;
|
|
105
|
-
consolidate(scope: MemoryScope): Promise<void>;
|
|
106
|
-
clear(scope?: MemoryScope): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Return a new MemoryStore proxy that carries `traceId` on every storage
|
|
109
|
-
* event. The original store is left unchanged — callers that need a
|
|
110
|
-
* trace-decorated view (e.g. session-run tools) receive the proxy while
|
|
111
|
-
* the singleton remains trace-free for boot-time use.
|
|
112
|
-
*
|
|
113
|
-
* The proxy implements the full `MemoryStore` interface; all other
|
|
114
|
-
* properties (backend, etc.) are delegated to the original store.
|
|
115
|
-
*/
|
|
116
|
-
withTraceId(traceId: string): MemoryStore;
|
|
117
|
-
private mirrorBackup;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=memory-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/storage/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,WAAW,EAEX,sBAAsB,EAEtB,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,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