@wrongstack/core 0.280.1 → 0.281.1

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 (95) hide show
  1. package/dist/{agent-subagent-runner-PoqNKiR4.d.ts → agent-subagent-runner-DyOSK2Wy.d.ts} +39 -8
  2. package/dist/{compactor-U3agvUIG.d.ts → compactor-BxddyCFu.d.ts} +1 -1
  3. package/dist/{config-Cr3312zc.d.ts → config-CN-vdDEI.d.ts} +82 -2
  4. package/dist/coordination/index.d.ts +203 -20
  5. package/dist/coordination/index.js +981 -52
  6. package/dist/coordination/index.js.map +1 -1
  7. package/dist/defaults/index.d.ts +26 -30
  8. package/dist/defaults/index.js +382 -30
  9. package/dist/defaults/index.js.map +1 -1
  10. package/dist/{events-Bs2fmldo.d.ts → events-C5hLU0AT.d.ts} +38 -2
  11. package/dist/execution/index.d.ts +16 -16
  12. package/dist/execution/index.js +161 -18
  13. package/dist/execution/index.js.map +1 -1
  14. package/dist/execution/prompt-enhancer.d.ts +1 -1
  15. package/dist/execution/prompt-enhancer.js +12 -3
  16. package/dist/execution/prompt-enhancer.js.map +1 -1
  17. package/dist/extension/index.d.ts +6 -6
  18. package/dist/{global-mailbox-Ct7IorLJ.d.ts → global-mailbox-CHM1QkCi.d.ts} +5 -2
  19. package/dist/{goal-store-C4F6DjC0.d.ts → goal-store-BLGZq16t.d.ts} +1 -1
  20. package/dist/hq/index.d.ts +6 -6
  21. package/dist/hq/index.js +35 -13
  22. package/dist/hq/index.js.map +1 -1
  23. package/dist/{index-nP09-oP2.d.ts → index-BEFWNZYs.d.ts} +1 -2
  24. package/dist/{index-kidebiDh.d.ts → index-C1E-_71T.d.ts} +6 -6
  25. package/dist/index.d.ts +44 -48
  26. package/dist/index.js +14855 -13944
  27. package/dist/index.js.map +1 -1
  28. package/dist/infrastructure/index.d.ts +60 -8
  29. package/dist/infrastructure/index.js.map +1 -1
  30. package/dist/kernel/index.d.ts +11 -11
  31. package/dist/kernel/index.js.map +1 -1
  32. package/dist/{mcp-servers-D910X5_r.d.ts → mcp-servers-EKRAcJDi.d.ts} +97 -4
  33. package/dist/models/index.d.ts +4 -5
  34. package/dist/models/index.js +22 -5
  35. package/dist/models/index.js.map +1 -1
  36. package/dist/{multi-agent-coordinator-CieyUoEL.d.ts → multi-agent-coordinator-IpHCuHUa.d.ts} +29 -1
  37. package/dist/{null-fleet-bus-DkdmZJ_W.d.ts → null-fleet-bus-ZBkKGR9j.d.ts} +105 -7
  38. package/dist/observability/index.d.ts +3 -3
  39. package/dist/{tool-executor-SiE1wlZo.d.ts → parallel-eternal-engine-Cc2CNgmv.d.ts} +6 -202
  40. package/dist/path-resolver-CMS5307d.d.ts +13 -0
  41. package/dist/{permission-Dx6dIqS2.d.ts → permission-B6YAtNFz.d.ts} +1 -1
  42. package/dist/{pipeline-BwAP21_4.d.ts → pipeline-E7_jqGyV.d.ts} +2 -2
  43. package/dist/{provider-model-resolve-CwQNZWt_.d.ts → provider-model-resolve-KgIdiEQ6.d.ts} +118 -5
  44. package/dist/{provider-runner-CYHFImzV.d.ts → provider-runner-DxWXNHL1.d.ts} +3 -3
  45. package/dist/{retry-policy-D4feSLk3.d.ts → retry-policy-V67lBOJz.d.ts} +2 -2
  46. package/dist/sdd/index.d.ts +9 -9
  47. package/dist/sdd/index.js +94 -10
  48. package/dist/sdd/index.js.map +1 -1
  49. package/dist/{permission-policy-C8vJcnX5.d.ts → secret-vault-D7jeyXUQ.d.ts} +119 -3
  50. package/dist/security/index.d.ts +5 -6
  51. package/dist/security/index.js +4 -1
  52. package/dist/security/index.js.map +1 -1
  53. package/dist/{selector-Dy-MzKp1.d.ts → selector-Bx2HgUkU.d.ts} +1 -1
  54. package/dist/{session-event-bridge-CqdiGnfU.d.ts → session-event-bridge-vA2fLV58.d.ts} +1 -1
  55. package/dist/{session-reader-Hk0WbNm9.d.ts → session-reader-B-Fi9L6I.d.ts} +1 -1
  56. package/dist/session-registry-Dvg7i_IA.d.ts +129 -0
  57. package/dist/storage/index.d.ts +71 -142
  58. package/dist/storage/index.js +161 -13
  59. package/dist/storage/index.js.map +1 -1
  60. package/dist/{todos-checkpoint-Bk2uP7Ex.d.ts → todos-checkpoint-B1QVkoa8.d.ts} +23 -5
  61. package/dist/{tool-BkOgs_KL.d.ts → tool-LVSLiE1s.d.ts} +18 -4
  62. package/dist/{strategy-compactor-CQwhbErd.d.ts → tool-executor-BWtYwuPI.d.ts} +210 -12
  63. package/dist/tools/index.d.ts +2 -2
  64. package/dist/tools/index.js.map +1 -1
  65. package/dist/types/index.d.ts +17 -41
  66. package/dist/types/index.js +182 -5085
  67. package/dist/types/index.js.map +1 -1
  68. package/dist/utils/index.d.ts +3 -3
  69. package/dist/utils/index.js +6 -1
  70. package/dist/utils/index.js.map +1 -1
  71. package/dist/{worktree-manager-BjOFF6bt.d.ts → worktree-manager-C6CIilTT.d.ts} +1 -1
  72. package/dist/{wstack-paths-CMl_cYgq.d.ts → wstack-paths-C3K40Qst.d.ts} +2 -0
  73. package/instructions/agents/shadow-agent.md +23 -84
  74. package/instructions/coordination/director-preamble.md +12 -3
  75. package/instructions/coordination/subagent-baseline.md +39 -46
  76. package/instructions/leader-after-task.md +10 -28
  77. package/instructions/llm/llm-selector.md +1 -2
  78. package/instructions/modes/brief-system.md +7 -33
  79. package/instructions/modes/brief.md +5 -20
  80. package/instructions/modes/teach-system.md +12 -72
  81. package/instructions/modes/teach.md +12 -49
  82. package/instructions/sections/tool/commit-hygiene.md +5 -5
  83. package/instructions/sections/tool/context-management-full.md +6 -6
  84. package/instructions/sections/tool/delegation-compact.md +1 -1
  85. package/instructions/sections/tool/delegation-full.md +19 -23
  86. package/instructions/sections/tool/mailbox-full.md +11 -31
  87. package/instructions/sections/tool/mcp-full-control.md +5 -7
  88. package/instructions/sections/tool/mcp-full-use.md +7 -7
  89. package/instructions/system.md +22 -38
  90. package/package.json +1 -29
  91. package/dist/agent-bridge-DXC6QDJ4.d.ts +0 -35
  92. package/dist/logger-D3lV0cUZ.d.ts +0 -101
  93. package/dist/models-registry-CLkoOcHk.d.ts +0 -108
  94. package/dist/path-resolver-XfZ9eLxG.d.ts +0 -67
  95. package/dist/secret-vault-CImt2XrR.d.ts +0 -118
@@ -1,6 +1,9 @@
1
- import { T as Tool, C as Context } from './tool-BkOgs_KL.js';
1
+ import { g as Tool, d as Context } from './tool-LVSLiE1s.js';
2
2
  import { I as InputReader } from './input-reader-E-ffP2ee.js';
3
- import { P as PermissionPolicy, a as PermissionDecision } from './permission-Dx6dIqS2.js';
3
+ import { P as PermissionPolicy, a as PermissionDecision } from './permission-B6YAtNFz.js';
4
+ import { S as SecretScrubber } from './secret-scrubber-3MHDDAtm.js';
5
+ import { L as Logger } from './logger-B63L5bTg.js';
6
+ import { R as RotatableSecretVault, S as SecretVault } from './secret-vault-BAKpgFw_.js';
4
7
 
5
8
  interface PermissionPolicyOptions {
6
9
  trustFile: string;
@@ -152,4 +155,117 @@ declare class AutoApprovePermissionPolicy implements PermissionPolicy {
152
155
  reload(): Promise<void>;
153
156
  }
154
157
 
155
- export { AutoApprovePermissionPolicy as A, DefaultPermissionPolicy as D, type PermissionPolicyOptions as P };
158
+ declare class DefaultSecretScrubber implements SecretScrubber {
159
+ scrub(text: string): string;
160
+ private scrubOne;
161
+ /**
162
+ * Recursively scrub every string value in an object/array graph. Secrets can
163
+ * appear under any key — a URL query param, an `authorization` header, an
164
+ * arbitrarily-named nested field — so we don't gate recursion on key names.
165
+ * The per-string `scrub()` fast-path (anchor pre-scan) keeps this cheap: any
166
+ * value without a credential anchor returns immediately without regex work.
167
+ */
168
+ scrubObject<T>(obj: T): T;
169
+ }
170
+
171
+ interface SecretVaultOptions {
172
+ /** Absolute path to the key file. Created with mode 0o600 if missing. */
173
+ keyFile: string;
174
+ }
175
+ /**
176
+ * Default vault: AES-256-GCM with a key stored at `keyFile` (mode 0o600).
177
+ * The key is loaded lazily on first encrypt/decrypt; if it does not exist,
178
+ * a fresh one is generated. Decryption of plaintext values is a no-op so
179
+ * legacy configs continue to work.
180
+ *
181
+ * Key file format:
182
+ * - Legacy (v1): exactly 32 raw bytes
183
+ * - Versioned (v2+): 4-byte magic `WSKV` + 1-byte version + 32-byte key (37 bytes)
184
+ *
185
+ * Encrypted value format: `enc:v<N>:<iv>:<tag>:<ciphertext>` where N is the
186
+ * key version. After rotation, encrypt() emits the new version prefix.
187
+ */
188
+ declare class DefaultSecretVault implements RotatableSecretVault {
189
+ private readonly keyFile;
190
+ private key?;
191
+ private _keyVersion;
192
+ constructor(opts: SecretVaultOptions);
193
+ /** Current key version. Starts at 1; incremented by rotateKey(). */
194
+ get keyVersion(): number;
195
+ isEncrypted(value: string): boolean;
196
+ encrypt(plaintext: string): string;
197
+ decrypt(value: string): string;
198
+ /**
199
+ * Generate a new encryption key, write it to disk, and increment the key version.
200
+ * After rotation, encrypt() emits the new version prefix (e.g. enc:v2:).
201
+ * The caller must re-encrypt existing config values (see rotateConfigKeys()).
202
+ */
203
+ rotateKey(): {
204
+ oldVersion: number;
205
+ newVersion: number;
206
+ };
207
+ /**
208
+ * If WRONGSTACK_VAULT_PASSPHRASE is set but the key on disk is still stored
209
+ * unwrapped (legacy v1 / versioned v2), re-write it in passphrase-wrapped (v3)
210
+ * form. The data key is preserved, so all existing ciphertext keeps
211
+ * decrypting. Best-effort: a write failure leaves the working unwrapped file
212
+ * in place and is not fatal to load.
213
+ */
214
+ private migrateToWrappedIfPassphrase;
215
+ private loadOrCreateKey;
216
+ }
217
+ /**
218
+ * Walk a Config-shaped object and decrypt any apiKey-like fields in place,
219
+ * returning a new object. Used by the config loader so the rest of the
220
+ * system never has to know about the wire format.
221
+ *
222
+ * @param warn — callback for decryption warnings. Defaults to `console.warn`
223
+ * for backward compatibility; pass `logger.warn` when a structured logger
224
+ * is available (preferred in long-running/server contexts).
225
+ */
226
+ declare function decryptConfigSecrets<T>(cfg: T, vault: SecretVault, opts?: {
227
+ warn?: (msg: string) => void;
228
+ }): T;
229
+ declare function encryptConfigSecrets<T>(cfg: T, vault: SecretVault, _opts?: {
230
+ warn?: (msg: string) => void;
231
+ }): T;
232
+ declare function isSecretField(name: string): boolean;
233
+ /**
234
+ * Re-write `~/.wrongstack/config.json` (or any path) with all secret-bearing
235
+ * fields encrypted. Used by the `wstack auth` subcommand.
236
+ */
237
+ declare function rewriteConfigEncrypted(configPath: string, vault: SecretVault, patch?: Record<string, unknown>): Promise<void>;
238
+ /**
239
+ * Scan a config file on disk for plaintext secret-bearing fields and
240
+ * rewrite the file with them encrypted in place. Returns a count of how
241
+ * many fields were migrated. Idempotent — calling on a fully-encrypted
242
+ * file is a no-op and writes nothing. Used by the CLI on every boot so
243
+ * users who had plaintext keys before the vault landed are upgraded
244
+ * transparently.
245
+ */
246
+ declare function migratePlaintextSecrets(configPath: string, vault: SecretVault, logger?: Pick<Logger, 'warn'>): Promise<{
247
+ migrated: number;
248
+ file: string;
249
+ }>;
250
+ /**
251
+ * Rotate the vault's encryption key and re-encrypt all secret-bearing
252
+ * fields in a config file. This is the atomic key rotation operation:
253
+ *
254
+ * 1. Read the config file
255
+ * 2. Decrypt all encrypted values with the old key
256
+ * 3. Generate a new key (vault.rotateKey())
257
+ * 4. Re-encrypt all values with the new key (new version prefix)
258
+ * 5. Write the config file atomically
259
+ *
260
+ * Returns the number of fields re-encrypted and the version transition.
261
+ * If the config file doesn't exist or has no encrypted fields, returns
262
+ * { rotated: 0 } without modifying the key.
263
+ */
264
+ declare function rotateConfigKeys(configPath: string, vault: RotatableSecretVault, logger?: Pick<Logger, 'warn' | 'info'>): Promise<{
265
+ rotated: number;
266
+ oldVersion: number;
267
+ newVersion: number;
268
+ file: string;
269
+ }>;
270
+
271
+ export { AutoApprovePermissionPolicy as A, DefaultSecretVault as D, type PermissionPolicyOptions as P, type SecretVaultOptions as S, DefaultPermissionPolicy as a, DefaultSecretScrubber as b, rotateConfigKeys as c, decryptConfigSecrets as d, encryptConfigSecrets as e, isSecretField as i, migratePlaintextSecrets as m, rewriteConfigEncrypted as r };
@@ -1,9 +1,8 @@
1
- export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, b as rotateConfigKeys } from '../secret-vault-CImt2XrR.js';
2
- export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-C8vJcnX5.js';
3
- export { D as DANGEROUS_FOR_SUBAGENTS, T as ToolCapabilities, a as ToolCapability, g as getDangerousCapabilities, h as hasCapability, b as hasDangerousCapabilityForSubagents } from '../index-nP09-oP2.js';
1
+ export { A as AutoApprovePermissionPolicy, a as DefaultPermissionPolicy, b as DefaultSecretScrubber, D as DefaultSecretVault, P as PermissionPolicyOptions, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, c as rotateConfigKeys } from '../secret-vault-D7jeyXUQ.js';
2
+ export { D as DANGEROUS_FOR_SUBAGENTS, T as ToolCapabilities, a as ToolCapability, g as getDangerousCapabilities, h as hasCapability, b as hasDangerousCapabilityForSubagents } from '../index-BEFWNZYs.js';
3
+ import '../tool-LVSLiE1s.js';
4
+ import '../input-reader-E-ffP2ee.js';
5
+ import '../permission-B6YAtNFz.js';
4
6
  import '../secret-scrubber-3MHDDAtm.js';
5
7
  import '../logger-B63L5bTg.js';
6
8
  import '../secret-vault-BAKpgFw_.js';
7
- import '../tool-BkOgs_KL.js';
8
- import '../input-reader-E-ffP2ee.js';
9
- import '../permission-Dx6dIqS2.js';
@@ -1164,7 +1164,10 @@ var DANGEROUS_FOR_SUBAGENTS = [
1164
1164
  ToolCapabilities.SHELL_ARBITRARY,
1165
1165
  ToolCapabilities.SHELL_RESTRICTED,
1166
1166
  ToolCapabilities.SHELL_EXEC,
1167
- ToolCapabilities.PACKAGE_INSTALL
1167
+ ToolCapabilities.PACKAGE_INSTALL,
1168
+ // Read-only fleet visibility (fleet_status) — peer awareness has no blast
1169
+ // radius and every fleet worker should coordinate around its peers.
1170
+ ToolCapabilities.COORDINATION_FLEET_READ
1168
1171
  ];
1169
1172
  function hasDangerousCapabilityForSubagents(toolOrCaps) {
1170
1173
  if (!toolOrCaps) return false;