@wrongstack/core 0.3.3 → 0.3.7

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 (52) hide show
  1. package/dist/{agent-bridge-C3DUGjSb.d.ts → agent-bridge-DaOnnHNW.d.ts} +1 -1
  2. package/dist/{compactor-DpJBI1YH.d.ts → compactor-CFky6JKM.d.ts} +1 -1
  3. package/dist/{config-D2qvAxVd.d.ts → config-RlhKLjme.d.ts} +2 -1
  4. package/dist/{context-IovtuTf8.d.ts → context-B1kBj1lY.d.ts} +4 -3
  5. package/dist/coordination/index.d.ts +12 -10
  6. package/dist/coordination/index.js +50 -9
  7. package/dist/coordination/index.js.map +1 -1
  8. package/dist/defaults/index.d.ts +16 -16
  9. package/dist/defaults/index.js +213 -17
  10. package/dist/defaults/index.js.map +1 -1
  11. package/dist/{events-BHIQs4o1.d.ts → events-BBaKeMfb.d.ts} +11 -1
  12. package/dist/execution/index.d.ts +11 -11
  13. package/dist/execution/index.js +54 -1
  14. package/dist/execution/index.js.map +1 -1
  15. package/dist/extension/index.d.ts +6 -6
  16. package/dist/{index-hWNybrNZ.d.ts → index-meJRuQtc.d.ts} +26 -5
  17. package/dist/index.d.ts +26 -26
  18. package/dist/index.js +306 -39
  19. package/dist/index.js.map +1 -1
  20. package/dist/infrastructure/index.d.ts +6 -6
  21. package/dist/kernel/index.d.ts +9 -9
  22. package/dist/kernel/index.js.map +1 -1
  23. package/dist/{mcp-servers-C2OopXOn.d.ts → mcp-servers-Cf4-bJnd.d.ts} +3 -3
  24. package/dist/models/index.d.ts +2 -2
  25. package/dist/models/index.js +1 -0
  26. package/dist/models/index.js.map +1 -1
  27. package/dist/{multi-agent-B9a6sflH.d.ts → multi-agent-D5m66hzB.d.ts} +1 -1
  28. package/dist/observability/index.d.ts +2 -2
  29. package/dist/{path-resolver--59rCou3.d.ts → path-resolver-Bg4OP5fi.d.ts} +2 -2
  30. package/dist/{provider-runner-B39miKRw.d.ts → provider-runner-CU9gnU2E.d.ts} +3 -3
  31. package/dist/sdd/index.d.ts +3 -3
  32. package/dist/secret-scrubber-DyUAWS09.d.ts +54 -0
  33. package/dist/{secret-scrubber-Cuy5afaQ.d.ts → secret-scrubber-Dyh5LVYL.d.ts} +1 -1
  34. package/dist/security/index.d.ts +58 -5
  35. package/dist/security/index.js +95 -6
  36. package/dist/security/index.js.map +1 -1
  37. package/dist/{selector-wT2fv9Fg.d.ts → selector-DBEiwXBk.d.ts} +1 -1
  38. package/dist/{session-reader-CcPi4BQ8.d.ts → session-reader-D-z0AgHs.d.ts} +1 -1
  39. package/dist/{skill-C_7znCIC.d.ts → skill-DayhFUBb.d.ts} +1 -1
  40. package/dist/storage/index.d.ts +5 -5
  41. package/dist/storage/index.js +53 -1
  42. package/dist/storage/index.js.map +1 -1
  43. package/dist/{system-prompt-Dk1qm8ey.d.ts → system-prompt-DNetCecu.d.ts} +1 -1
  44. package/dist/{tool-executor-HsBLGRaA.d.ts → tool-executor-B5bgmEgE.d.ts} +12 -5
  45. package/dist/types/index.d.ts +15 -15
  46. package/dist/types/index.js +59 -2
  47. package/dist/types/index.js.map +1 -1
  48. package/dist/utils/index.d.ts +23 -2
  49. package/dist/utils/index.js +41 -1
  50. package/dist/utils/index.js.map +1 -1
  51. package/package.json +1 -1
  52. package/dist/secret-scrubber-CgG2tV2B.d.ts +0 -31
@@ -1,4 +1,4 @@
1
- import { U as Usage, a0 as Context, y as ToolProgressEvent, u as Tool } from './context-IovtuTf8.js';
1
+ import { U as Usage, a0 as Context, y as ToolProgressEvent, u as Tool } from './context-B1kBj1lY.js';
2
2
 
3
3
  /**
4
4
  * EventBus — observe-only typed event bus.
@@ -109,6 +109,16 @@ interface EventMap {
109
109
  suggestedPattern: string;
110
110
  resolve: (decision: 'yes' | 'no' | 'always' | 'deny') => void;
111
111
  };
112
+ /**
113
+ * Fired after the user chooses 'always' or 'deny' on a confirmation prompt.
114
+ * The TUI can use this to show a brief notification that the decision was
115
+ * persisted to the trust file (e.g. "✓ always allowed popo.txt" / "✗ denied popo.txt").
116
+ */
117
+ 'trust.persisted': {
118
+ tool: string;
119
+ pattern: string;
120
+ decision: 'always' | 'deny';
121
+ };
112
122
  /**
113
123
  * `output` is a truncated preview of the tool's serialized result text
114
124
  * (capped at ~400 chars by the emitter). UIs render this inline in the
@@ -1,18 +1,18 @@
1
- export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-HsBLGRaA.js';
2
- import { g as Provider, a0 as Context } from '../context-IovtuTf8.js';
3
- import { a as Compactor, C as CompactReport } from '../compactor-DpJBI1YH.js';
4
- import { M as MessageSelector } from '../selector-wT2fv9Fg.js';
5
- import { E as EventBus } from '../events-BHIQs4o1.js';
6
- import { c as MiddlewareHandler } from '../system-prompt-Dk1qm8ey.js';
7
- import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-D2qvAxVd.js';
8
- import { r as Agent, R as RunResult } from '../index-hWNybrNZ.js';
9
- import { D as DoneCondition } from '../multi-agent-B9a6sflH.js';
10
- import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-C_7znCIC.js';
1
+ export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-B5bgmEgE.js';
2
+ import { g as Provider, a0 as Context } from '../context-B1kBj1lY.js';
3
+ import { a as Compactor, C as CompactReport } from '../compactor-CFky6JKM.js';
4
+ import { M as MessageSelector } from '../selector-DBEiwXBk.js';
5
+ import { E as EventBus } from '../events-BBaKeMfb.js';
6
+ import { c as MiddlewareHandler } from '../system-prompt-DNetCecu.js';
7
+ import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-RlhKLjme.js';
8
+ import { r as Agent, R as RunResult } from '../index-meJRuQtc.js';
9
+ import { D as DoneCondition } from '../multi-agent-D5m66hzB.js';
10
+ import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-DayhFUBb.js';
11
11
  import { a as WstackPaths } from '../wstack-paths-BGu2INTm.js';
12
12
  import '../models-registry-Y2xbog0E.js';
13
13
  import '../logger-BMQgxvdy.js';
14
14
  import '../observability-BhnVLBLS.js';
15
- import '../secret-scrubber-CgG2tV2B.js';
15
+ import '../secret-scrubber-DyUAWS09.js';
16
16
 
17
17
  interface SkillLoaderOptions {
18
18
  paths: WstackPaths;
@@ -1070,6 +1070,15 @@ var ToolExecutor = class {
1070
1070
  opts;
1071
1071
  serializer;
1072
1072
  iterationTimeoutMs;
1073
+ /**
1074
+ * Clear the interactive confirm awaiter so the executor returns
1075
+ * `ToolConfirmPendingResult` instead of blocking on stdin. Used by
1076
+ * the CLI to switch from inline prompts (REPL) to event-driven
1077
+ * confirmation (TUI) at runtime.
1078
+ */
1079
+ clearConfirmAwaiter() {
1080
+ this.opts.confirmAwaiter = void 0;
1081
+ }
1073
1082
  /**
1074
1083
  * Execute a batch of tool uses using the configured strategy.
1075
1084
  * Returns the execution results and the remaining output budget.
@@ -1318,11 +1327,55 @@ var ToolExecutor = class {
1318
1327
  }
1319
1328
  };
1320
1329
 
1330
+ // src/utils/regex-guard.ts
1331
+ var MAX_PATTERN_LEN = 512;
1332
+ var DANGEROUS_PATTERNS = [
1333
+ /(\([^)]*[+*][^)]*\))[+*]/,
1334
+ // (a+)+, (.*)+, etc
1335
+ /(\(\?:[^)]*[+*][^)]*\))[+*]/
1336
+ // same, with non-capturing group
1337
+ ];
1338
+ function compileUserRegex(pattern, flags) {
1339
+ if (typeof pattern !== "string") {
1340
+ return { ok: false, reason: "pattern must be a string" };
1341
+ }
1342
+ if (pattern.length === 0) {
1343
+ return { ok: false, reason: "pattern is empty" };
1344
+ }
1345
+ if (pattern.length > MAX_PATTERN_LEN) {
1346
+ return { ok: false, reason: `pattern exceeds ${MAX_PATTERN_LEN} characters` };
1347
+ }
1348
+ for (const rx of DANGEROUS_PATTERNS) {
1349
+ if (rx.test(pattern)) {
1350
+ return {
1351
+ ok: false,
1352
+ reason: "pattern looks vulnerable to catastrophic backtracking \u2014 rewrite without nested quantifiers"
1353
+ };
1354
+ }
1355
+ }
1356
+ try {
1357
+ return { ok: true, regex: new RegExp(pattern, flags) };
1358
+ } catch (err) {
1359
+ return {
1360
+ ok: false,
1361
+ reason: err instanceof Error ? err.message : "invalid regex"
1362
+ };
1363
+ }
1364
+ }
1365
+
1321
1366
  // src/execution/autonomous-runner.ts
1322
1367
  var DoneConditionChecker = class {
1323
1368
  constructor(condition) {
1324
1369
  this.condition = condition;
1325
- this.compiledRegex = condition.type === "output_match" && condition.pattern ? new RegExp(condition.pattern) : null;
1370
+ if (condition.type === "output_match" && condition.pattern) {
1371
+ const result = compileUserRegex(condition.pattern, "");
1372
+ this.compiledRegex = result.ok ? result.regex : null;
1373
+ if (!result.ok) {
1374
+ console.warn(`[DoneConditionChecker] Invalid regex pattern "${condition.pattern}": ${result.reason}`);
1375
+ }
1376
+ } else {
1377
+ this.compiledRegex = null;
1378
+ }
1326
1379
  }
1327
1380
  condition;
1328
1381
  compiledRegex;