@wrongstack/core 0.267.0 → 0.269.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 (78) hide show
  1. package/dist/{agent-bridge-STJ3JwwK.d.ts → agent-bridge-PcHQl_UQ.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-CzPGP3jA.d.ts → agent-subagent-runner-SHJW7t8q.d.ts} +8 -8
  3. package/dist/{brain-Cdg77tVN.d.ts → brain-BYcK__Ym.d.ts} +1 -1
  4. package/dist/{compactor-iMZ84CXq.d.ts → compactor-C2RKEBtC.d.ts} +1 -1
  5. package/dist/{config-Du3pYYln.d.ts → config-C_ae2k86.d.ts} +79 -2
  6. package/dist/{context-dT5Ueund.d.ts → context-Dp87Bcaq.d.ts} +47 -1
  7. package/dist/coordination/index.d.ts +62 -160
  8. package/dist/coordination/index.js +566 -149
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +366 -137
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +267 -55
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -6
  18. package/dist/global-mailbox-Bvrz1P3f.d.ts +664 -0
  19. package/dist/{goal-preamble-SulMTowG.d.ts → goal-preamble-CA_4yiGQ.d.ts} +9 -9
  20. package/dist/{goal-store-CABDwdFE.d.ts → goal-store-DhuJoUNG.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +204 -0
  22. package/dist/hq/index.js +1931 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/{index-DtCVWel4.d.ts → index-CZQ6Pwbs.d.ts} +8 -8
  25. package/dist/{index-Bms0m4oy.d.ts → index-W4VJCzHa.d.ts} +5 -5
  26. package/dist/{index-IEuxQd-E.d.ts → index-whDfTANu.d.ts} +2 -2
  27. package/dist/index.d.ts +46 -42
  28. package/dist/index.js +3472 -1651
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +48 -21
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/{pipeline-BfD2k1rT.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  35. package/dist/{mcp-servers-C2cBTxUR.d.ts → mcp-servers-DJdZiRcv.d.ts} +10 -4
  36. package/dist/models/index.d.ts +5 -5
  37. package/dist/models/index.js +4 -3
  38. package/dist/models/index.js.map +1 -1
  39. package/dist/{models-registry-BqGZNJQ-.d.ts → models-registry-C3a-2-Yd.d.ts} +1 -1
  40. package/dist/{multi-agent-coordinator-B8R43uPz.d.ts → multi-agent-coordinator-CJSpTe5O.d.ts} +1 -1
  41. package/dist/{null-fleet-bus-CnXa5oTH.d.ts → null-fleet-bus-QVshIsDx.d.ts} +6 -6
  42. package/dist/observability/index.d.ts +2 -2
  43. package/dist/{parallel-eternal-engine-DdNnw9BQ.d.ts → parallel-eternal-engine-D9y5Pkcc.d.ts} +9 -15
  44. package/dist/{path-resolver-COIMLCQL.d.ts → path-resolver-CnQ8SIfh.d.ts} +4 -3
  45. package/dist/{permission-B75JAi3-.d.ts → permission-CvYQNUqZ.d.ts} +1 -1
  46. package/dist/{permission-policy-DlR9eJAM.d.ts → permission-policy-D5Ss8j4B.d.ts} +2 -3
  47. package/dist/pipeline-l_zzFRh3.d.ts +245 -0
  48. package/dist/{plan-templates-DSIKCXZN.d.ts → plan-templates-NtPgyeJA.d.ts} +6 -5
  49. package/dist/{provider-model-resolve-BNRsNuJx.d.ts → provider-model-resolve-d5poT5y0.d.ts} +3 -3
  50. package/dist/{provider-runner-CX7iIvox.d.ts → provider-runner-gkctlQV_.d.ts} +3 -3
  51. package/dist/{retry-policy-BilV1ujH.d.ts → retry-policy-CtFhfwa8.d.ts} +1 -1
  52. package/dist/sdd/index.d.ts +9 -8
  53. package/dist/sdd/index.js +33 -3
  54. package/dist/sdd/index.js.map +1 -1
  55. package/dist/{secret-vault-gkvEZZfE.d.ts → secret-vault-BLsVmTIK.d.ts} +1 -1
  56. package/dist/security/index.d.ts +5 -5
  57. package/dist/security/index.js +39 -29
  58. package/dist/security/index.js.map +1 -1
  59. package/dist/{selector-Bc7eWtT3.d.ts → selector-CXl2_y9W.d.ts} +1 -1
  60. package/dist/{session-event-bridge-D-araDEz.d.ts → session-event-bridge-Ccud20CC.d.ts} +1 -1
  61. package/dist/{session-reader-D7Dapswh.d.ts → session-reader-ZeXQmsmE.d.ts} +1 -1
  62. package/dist/skills/index.js.map +1 -1
  63. package/dist/storage/index.d.ts +16 -12
  64. package/dist/storage/index.js +273 -100
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +2 -2
  67. package/dist/tools/index.js +166 -31
  68. package/dist/tools/index.js.map +1 -1
  69. package/dist/types/index.d.ts +22 -21
  70. package/dist/types/index.js +178 -70
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/index.d.ts +22 -3
  73. package/dist/utils/index.js +197 -25
  74. package/dist/utils/index.js.map +1 -1
  75. package/package.json +5 -1
  76. package/skills/chimera/SKILL.md +1 -1
  77. package/skills/typescript-strict/SKILL.md +3 -3
  78. package/skills/typescript-strict/SKILL.save.md +1 -1
@@ -1,14 +1,14 @@
1
1
  import { S as SkillLoader, a as SkillManifest, b as SkillEntry } from './skill-DGIXCtdv.js';
2
2
  import { W as WstackPaths } from './wstack-paths-hOpNLmvf.js';
3
- import { P as Provider, C as Context } from './context-dT5Ueund.js';
4
- import { C as Compactor, a as CompactReport } from './compactor-iMZ84CXq.js';
5
- import { M as MessageSelector } from './selector-Bc7eWtT3.js';
6
- import { E as EventBus } from './brain-Cdg77tVN.js';
7
- import { M as MiddlewareHandler } from './pipeline-BfD2k1rT.js';
8
- import { S as SessionEventBridge } from './session-event-bridge-D-araDEz.js';
9
- import { C as ContextWindowAggressiveOn, h as ContextWindowPolicy } from './config-Du3pYYln.js';
10
- import { g as Agent, D as DoneCondition } from './agent-subagent-runner-CzPGP3jA.js';
11
- import { R as RunResult, S as SystemPromptContributor } from './index-Bms0m4oy.js';
3
+ import { P as Provider, C as Context } from './context-Dp87Bcaq.js';
4
+ import { C as Compactor, a as CompactReport } from './compactor-C2RKEBtC.js';
5
+ import { M as MessageSelector } from './selector-CXl2_y9W.js';
6
+ import { E as EventBus } from './brain-BYcK__Ym.js';
7
+ import { M as MiddlewareHandler } from './pipeline-l_zzFRh3.js';
8
+ import { S as SessionEventBridge } from './session-event-bridge-Ccud20CC.js';
9
+ import { C as ContextWindowAggressiveOn, h as ContextWindowPolicy } from './config-C_ae2k86.js';
10
+ import { g as Agent, D as DoneCondition } from './agent-subagent-runner-SHJW7t8q.js';
11
+ import { R as RunResult, S as SystemPromptContributor } from './index-W4VJCzHa.js';
12
12
 
13
13
  interface SkillLoaderOptions {
14
14
  paths: WstackPaths;
@@ -1,4 +1,4 @@
1
- import { E as EventBus } from './brain-Cdg77tVN.js';
1
+ import { E as EventBus } from './brain-BYcK__Ym.js';
2
2
 
3
3
  /**
4
4
  * Long-running autonomous mission. A goal survives across sessions and
@@ -0,0 +1,204 @@
1
+ import { W as HqRedactionPolicy, p as HqEventEnvelope, R as HqPublisher, l as HqClientIdentity, a2 as HqSocketFactory, G as GlobalMailbox } from '../global-mailbox-Bvrz1P3f.js';
2
+ export { D as DEFAULT_HQ_REDACTION_POLICY, H as HQ_PROTOCOL_VERSION, a as HqAlertMessage, b as HqBrowserEventMessage, c as HqBrowserMessage, d as HqBrowserSnapshotMessage, e as HqClientCapability, f as HqClientCommandAckMessage, g as HqClientCommandPollMessage, h as HqClientEventMessage, i as HqClientHeartbeatPayload, j as HqClientHelloMessage, k as HqClientHelloPayload, m as HqClientKind, n as HqClientMessage, o as HqClientRecord, q as HqEventPayloadResult, r as HqEventType, s as HqFleetEventPayload, t as HqFleetSnapshotPayload, u as HqFleetSummary, v as HqGitSnapshotPayload, w as HqMailboxAgentStatus, x as HqMailboxAgentSummary, y as HqMailboxEventAction, z as HqMailboxEventPayload, A as HqMailboxMappingOptions, B as HqMailboxMessageSummary, C as HqMailboxMessageType, E as HqMailboxPriority, F as HqMailboxSnapshotOptions, I as HqMailboxSnapshotPayload, J as HqMailboxSummary, K as HqParseResult, L as HqPathPolicy, M as HqProjectIdentity, N as HqProjectRecord, O as HqProjectStatus, P as HqProtocolVersion, Q as HqPublishEventOptions, S as HqPublisherCommandHandler, T as HqPublisherCommandResult, U as HqPublisherOptions, V as HqQueuedCommand, X as HqServerCommandBatchMessage, Y as HqServerMessage, Z as HqSessionStartedPayload, _ as HqSessionStatus, $ as HqSessionStatusPayload, a0 as HqSessionSummary, a1 as HqSnapshot, a3 as HqSocketLike, a4 as HqSubagentSummary, a5 as HqToolArgsPolicy, a6 as HqToolCompletedPayload, a7 as HqToolStartedPayload, a8 as HqUsagePayload, a9 as HqWelcomePayload, aa as HqWorklistCounts, ab as HqWorklistSnapshotPayload, ac as HqWorkspaceKind, ad as createHqEventEnvelope, ae as createMailboxEventPayload, af as createMailboxSnapshotPayload, ag as createMailboxSnapshotPayloadFromMailbox, ah as mapMailboxAgentToHqSummary, ai as mapMailboxMessageToHqSummary, aj as parseHqEventPayload, ak as parseHqFrame } from '../global-mailbox-Bvrz1P3f.js';
3
+ import { E as EventBus } from '../brain-BYcK__Ym.js';
4
+ import { x as HqClientConfig } from '../config-C_ae2k86.js';
5
+ import '../mailbox-types-Ct2hJq0P.js';
6
+ import '../context-Dp87Bcaq.js';
7
+
8
+ interface HqRedactOptions {
9
+ policy?: Partial<HqRedactionPolicy>;
10
+ projectRoot?: string;
11
+ maxSummaryLength?: number;
12
+ }
13
+ interface HqRedactionResult<T> {
14
+ value: T;
15
+ redacted: boolean;
16
+ }
17
+ /**
18
+ * Scrub a free-text preview field and truncate it to a maximum length so
19
+ * it is safe to embed in HQ event envelopes and broadcast to browsers
20
+ * without leaking secrets or running away on unbounded input.
21
+ *
22
+ * Returns `undefined` when the input is empty or non-string. Truncation
23
+ * suffix is `"…[truncated:N]"` where N is the number of dropped chars.
24
+ */
25
+ declare function scrubAndTruncateHqPreview(value: unknown, maxLength?: number): string | undefined;
26
+ declare function redactHqValue<T>(value: T, options?: HqRedactOptions): HqRedactionResult<T>;
27
+ declare function redactHqEvent<TPayload>(event: HqEventEnvelope<TPayload>, options?: HqRedactOptions): HqRedactionResult<HqEventEnvelope<TPayload>>;
28
+ declare function summarizeHqToolArgs(value: unknown, options?: HqRedactOptions): unknown;
29
+
30
+ interface HqPublisherEnvConfig {
31
+ url: string;
32
+ token?: string;
33
+ enabled?: boolean;
34
+ rawContent?: boolean;
35
+ projectAlias?: string;
36
+ }
37
+ declare function resolveHqConfigFromEnv(env?: NodeJS.ProcessEnv): HqPublisherEnvConfig | undefined;
38
+ declare function resolveHqConfig(options?: {
39
+ env?: NodeJS.ProcessEnv | undefined;
40
+ config?: HqClientConfig | undefined;
41
+ }): HqPublisherEnvConfig | undefined;
42
+ interface CreateHqPublisherOptions {
43
+ clientKind: HqClientIdentity['kind'];
44
+ projectRoot: string;
45
+ projectName?: string;
46
+ machineId?: string;
47
+ hostnameOverride?: string;
48
+ socketFactory?: HqSocketFactory;
49
+ config?: HqPublisherEnvConfig;
50
+ appConfig?: {
51
+ hq?: HqClientConfig | undefined;
52
+ } | undefined;
53
+ redactionPolicy?: Partial<HqRedactionPolicy>;
54
+ }
55
+ declare function createHqPublisherFromEnv(options: CreateHqPublisherOptions): HqPublisher | undefined;
56
+ interface CreateGlobalMailboxOptions {
57
+ projectDir: string;
58
+ events?: EventBus;
59
+ hqPublisher?: HqPublisher;
60
+ }
61
+ declare function createGlobalMailbox(options: CreateGlobalMailboxOptions): GlobalMailbox;
62
+
63
+ /** Current auth-file schema version. Bump on breaking shape changes. */
64
+ declare const HQ_AUTH_FILE_VERSION: 1;
65
+ /** Default HQ data directory: `~/.wrongstack/hq` (honors WRONGSTACK_HOME). */
66
+ declare function defaultHqDataDir(): string;
67
+ /**
68
+ * Resolve an HQ data directory from an optional override.
69
+ *
70
+ * Resolution order:
71
+ * 1. Explicit `override` (from `--data-dir`) — resolved against
72
+ * `process.cwd()` if relative.
73
+ * 2. `WRONGSTACK_HQ_DATA_DIR` env var (same resolution rules).
74
+ * 3. `defaultHqDataDir()` — `~/.wrongstack/hq`.
75
+ *
76
+ * The env var exists so tests (and sandboxed runs) can redirect HQ state
77
+ * away from the real user home without threading a CLI flag everywhere.
78
+ */
79
+ declare function resolveHqDataDir(override?: string, env?: NodeJS.ProcessEnv): string;
80
+ /**
81
+ * A generic HQ-issued token. Used for both browser tokens (validated on
82
+ * `/ws/browser`) and client tokens (validated on `/ws/client`). The two
83
+ * are stored in separate lists so a browser-only token cannot be replayed
84
+ * against the client channel and vice versa.
85
+ */
86
+ interface HqToken {
87
+ id: string;
88
+ token: string;
89
+ label?: string;
90
+ createdAt: string;
91
+ lastUsedAt?: string;
92
+ }
93
+ /**
94
+ * Alias kept for backward-compat with Phase 3 callers/tests. New code
95
+ * should prefer `HqToken`.
96
+ */
97
+ type HqBrowserToken = HqToken;
98
+ /** On-disk shape of `<dataDir>/auth.json`. */
99
+ interface HqRuntimeFile {
100
+ url: string;
101
+ updatedAt: string;
102
+ pid?: number;
103
+ }
104
+ interface HqAuthFile {
105
+ version: typeof HQ_AUTH_FILE_VERSION;
106
+ updatedAt: string;
107
+ /**
108
+ * Operator-configured redaction policy override. When present, the HQ
109
+ * server applies these settings AFTER any publisher-declared policy —
110
+ * i.e. the operator can always tighten, never loosen.
111
+ */
112
+ redactionPolicy?: Partial<HqRedactionPolicy>;
113
+ /** Browser tokens — validated on `/ws/browser` upgrades (Phase 3). */
114
+ browserTokens?: HqToken[];
115
+ /** Client tokens — validated on `/ws/client` upgrades (Phase 4). */
116
+ clientTokens?: HqToken[];
117
+ }
118
+ /** An empty auth file — what a brand-new HQ install starts with. */
119
+ declare function emptyHqAuthFile(): HqAuthFile;
120
+ /** Path to `auth.json` under the given data directory. */
121
+ declare function hqAuthFilePath(dataDir: string): string;
122
+ /** Path to the best-effort runtime endpoint marker under the given data directory. */
123
+ declare function hqRuntimeFilePath(dataDir: string): string;
124
+ declare function writeHqRuntimeFile(dataDir: string, file: Omit<HqRuntimeFile, 'updatedAt'>): Promise<void>;
125
+ declare function readHqRuntimeFileSync(dataDir: string): HqRuntimeFile | undefined;
126
+ /**
127
+ * Read `auth.json` from disk. Returns `emptyHqAuthFile()` when:
128
+ * - the file does not exist (ENOENT), or
129
+ * - the file cannot be parsed (the `warn` callback surfaces the error).
130
+ *
131
+ * Never throws for routine I/O — a missing or corrupt auth file should not
132
+ * prevent the HQ server from starting. The operator can recover by editing
133
+ * or deleting the file.
134
+ */
135
+ declare function readHqAuthFile(dataDir: string, opts?: {
136
+ warn?: (msg: string) => void;
137
+ }): Promise<HqAuthFile>;
138
+ /**
139
+ * Write `auth.json` atomically with mode 0o600. Creates the data directory
140
+ * if needed. Throws on I/O failure — callers (CLI commands) should surface
141
+ * the error to the operator.
142
+ */
143
+ declare function writeHqAuthFile(dataDir: string, file: HqAuthFile): Promise<void>;
144
+ interface EnsureHqFirstRunAuthResult {
145
+ authFile: HqAuthFile;
146
+ created: boolean;
147
+ browserToken?: HqToken;
148
+ clientToken?: HqToken;
149
+ }
150
+ /**
151
+ * Ensure a brand-new HQ data directory has the auth required for safe
152
+ * first-run operation. Only a missing auth.json is bootstrapped; an existing
153
+ * file, including one with empty token arrays, is treated as operator intent.
154
+ */
155
+ declare function ensureHqFirstRunAuthFile(dataDir: string, opts?: {
156
+ warn?: (msg: string) => void;
157
+ }): Promise<EnsureHqFirstRunAuthResult>;
158
+ /**
159
+ * Load → mutate → write. The mutator receives the current file (or an empty
160
+ * one) and returns the next file. Use this for any read-modify-write cycle
161
+ * to avoid clobbering concurrent edits from another CLI invocation.
162
+ *
163
+ * Note: this does NOT take a file lock. HQ auth edits are rare (operator
164
+ * running `wstack --hq-token add` etc.) and the atomic rename protects
165
+ * against torn writes; a race between two concurrent edits would be
166
+ * last-write-wins, which is acceptable for this low-frequency file.
167
+ */
168
+ declare function mutateHqAuthFile(dataDir: string, mutator: (current: HqAuthFile) => HqAuthFile | Promise<HqAuthFile>, opts?: {
169
+ warn?: (msg: string) => void;
170
+ }): Promise<HqAuthFile>;
171
+ /**
172
+ * Mint a fresh token. Used for both browser and client tokens; the caller
173
+ * decides which list to append to.
174
+ */
175
+ declare function mintHqToken(label?: string): HqToken;
176
+ /**
177
+ * Backward-compat alias for `mintHqToken`. Phase 3 callers/tests use this.
178
+ */
179
+ declare const mintHqBrowserToken: typeof mintHqToken;
180
+ /**
181
+ * Watch `auth.json` for changes and invoke `onChange` with the freshly-read
182
+ * file. Returns a `close()` function that stops watching.
183
+ *
184
+ * The watcher debounces events (default 200ms) because most editors do a
185
+ * tmp+rename dance that emits multiple events. On any read failure (file
186
+ * deleted, corrupt, etc.) the `warn` callback is invoked with the same
187
+ * semantics as `readHqAuthFile`; the watcher stays active so a future
188
+ * valid write re-triggers the callback.
189
+ *
190
+ * Notes:
191
+ * - `fs.watch` is best-effort across platforms. On some network
192
+ * filesystems events may not fire; the operator must restart the server
193
+ * to pick up changes in that case.
194
+ * - The watcher polls the parent directory (not the file itself) so that
195
+ * atomic rename events surface reliably.
196
+ */
197
+ declare function watchHqAuthFile(dataDir: string, onChange: (file: HqAuthFile) => void, opts?: {
198
+ warn?: (msg: string) => void;
199
+ debounceMs?: number;
200
+ }): {
201
+ close: () => void;
202
+ };
203
+
204
+ export { type CreateGlobalMailboxOptions, type CreateHqPublisherOptions, type EnsureHqFirstRunAuthResult, HQ_AUTH_FILE_VERSION, type HqAuthFile, type HqBrowserToken, HqClientIdentity, HqEventEnvelope, HqPublisher, type HqPublisherEnvConfig, type HqRedactOptions, HqRedactionPolicy, type HqRedactionResult, type HqRuntimeFile, HqSocketFactory, type HqToken, createGlobalMailbox, createHqPublisherFromEnv, defaultHqDataDir, emptyHqAuthFile, ensureHqFirstRunAuthFile, hqAuthFilePath, hqRuntimeFilePath, mintHqBrowserToken, mintHqToken, mutateHqAuthFile, readHqAuthFile, readHqRuntimeFileSync, redactHqEvent, redactHqValue, resolveHqConfig, resolveHqConfigFromEnv, resolveHqDataDir, scrubAndTruncateHqPreview, summarizeHqToolArgs, watchHqAuthFile, writeHqAuthFile, writeHqRuntimeFile };