@wrongstack/plugins 0.308.6 → 0.308.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.
- package/dist/accessibility-auditor.js +26 -82
- package/dist/agent-handoff.js +16 -26
- package/dist/auto-i18n-extractor.js +19 -23
- package/dist/branch-guard.js +19 -111
- package/dist/changelog-writer.js +20 -133
- package/dist/code-metrics.js +26 -71
- package/dist/commit-validator.js +16 -14
- package/dist/config-validator.js +18 -22
- package/dist/cost-tracker.js +15 -96
- package/dist/dead-code-detector.js +27 -31
- package/dist/dependency-vulnerability-gate.js +18 -15
- package/dist/diff-summary.js +19 -128
- package/dist/doc-sync-guard.js +24 -39
- package/dist/duplicate-code-detector.js +30 -169
- package/dist/feature-flag-tracker.js +26 -71
- package/dist/file-watcher.js +19 -23
- package/dist/format-on-save.js +25 -214
- package/dist/import-organizer.js +31 -106
- package/dist/index.js +452 -1236
- package/dist/interface-contract-guard.js +26 -71
- package/dist/lint-gate.js +19 -111
- package/dist/migration-planner.js +28 -120
- package/dist/notify-hub.js +18 -28
- package/dist/path-guard.js +27 -102
- package/dist/pr-drafter.js +18 -16
- package/dist/prompt-firewall.js +8 -205
- package/dist/refactor-suggester.js +27 -166
- package/dist/release-notes-generator.js +6 -35
- package/dist/runtime/bounded-map.d.ts +2 -85
- package/dist/runtime/credential-patterns.d.ts +2 -41
- package/dist/runtime/h1-state.d.ts +2 -61
- package/dist/runtime/handles.d.ts +2 -45
- package/dist/runtime/index.d.ts +8 -180
- package/dist/runtime/llm.d.ts +2 -43
- package/dist/runtime/local-bin.d.ts +2 -119
- package/dist/runtime/redos-guard.d.ts +2 -68
- package/dist/runtime/safe-json.d.ts +2 -24
- package/dist/runtime/sandbox.d.ts +2 -58
- package/dist/runtime.js +1 -868
- package/dist/schema-evolution-guard.js +20 -24
- package/dist/secret-scanner.js +22 -146
- package/dist/security-hotspot-scanner.js +24 -154
- package/dist/session-recap.js +16 -14
- package/dist/spec-linker.js +19 -17
- package/dist/template-engine.js +22 -37
- package/dist/test-coverage-gate.js +19 -34
- package/dist/test-generator.js +6 -35
- package/dist/test-runner-gate.js +34 -143
- package/dist/todo-listener.js +17 -38
- package/dist/type-gate.js +23 -311
- package/package.json +4 -3
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* the host can actually terminate it on a wall-clock budget.
|
|
4
|
-
*
|
|
5
|
-
* Why a worker thread?
|
|
6
|
-
* A `setTimeout`-based watchdog cannot interrupt a synchronous
|
|
7
|
-
* CPU-bound regex in Node.js's single-threaded event loop. The
|
|
8
|
-
* `setImmediate`/`setTimeout` race fires whichever wins the next
|
|
9
|
-
* event-loop tick; if the regex blocks the loop synchronously for
|
|
10
|
-
* 7 seconds, the timer has long since fired and the regex still
|
|
11
|
-
* returns a result — only after the loop is unblocked does the
|
|
12
|
-
* `setImmediate` callback resume and resolve `{ timedOut: false }`.
|
|
13
|
-
*
|
|
14
|
-
* The only honest fix is to run the regex in a separate thread that
|
|
15
|
-
* the host can `worker.terminate()`. `node:worker_threads` gives us
|
|
16
|
-
* that, and the per-thread cost is amortized by the runtime helper
|
|
17
|
-
* itself (the host doesn't pay for the thread except when it
|
|
18
|
-
* invokes `withReDoSGuard`).
|
|
19
|
-
*
|
|
20
|
-
* Why is this here, not inside each plugin?
|
|
21
|
-
* Three plugins (`secret-scanner`, `prompt-firewall`, `path-guard`)
|
|
22
|
-
* need the same contract. Three copies would drift; one copy is
|
|
23
|
-
* auditable and testable.
|
|
24
|
-
*
|
|
25
|
-
* Contract:
|
|
26
|
-
* `withReDoSGuard(re, input, ms)` returns:
|
|
27
|
-
* { timedOut: false, match: RegExpExecArray | null } on normal completion
|
|
28
|
-
* { timedOut: true, match: null } on timeout
|
|
29
|
-
*/
|
|
30
|
-
export interface ReDoSResult {
|
|
31
|
-
/** True when the regex did not complete within the wall-clock budget. */
|
|
32
|
-
timedOut: boolean;
|
|
33
|
-
/** The match result (groups, indices) when `timedOut === false`; null otherwise. */
|
|
34
|
-
match: RegExpExecArray | null;
|
|
35
|
-
}
|
|
36
|
-
export interface ReDoSOptions {
|
|
37
|
-
/** Wall-clock budget in ms. Default 50. */
|
|
38
|
-
budgetMs?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Optional hook invoked exactly once when the budget is exceeded.
|
|
41
|
-
* Called synchronously after the regex is terminated. Default: no-op.
|
|
42
|
-
*/
|
|
43
|
-
onTimeout?: (info: {
|
|
44
|
-
regex: RegExp;
|
|
45
|
-
input: string;
|
|
46
|
-
budgetMs: number;
|
|
47
|
-
elapsedMs: number;
|
|
48
|
-
}) => void;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Run `re.exec(input)` inside a worker thread with a wall-clock
|
|
52
|
-
* watchdog. The worker is terminated when the budget elapses; the
|
|
53
|
-
* regex cannot keep running.
|
|
54
|
-
*
|
|
55
|
-
* Returns a Promise; resolved with `{ timedOut, match }`.
|
|
56
|
-
*/
|
|
57
|
-
export declare function withReDoSGuard(re: RegExp, input: string, budgetMs?: number, options?: ReDoSOptions): Promise<ReDoSResult>;
|
|
58
|
-
/**
|
|
59
|
-
* Convenience: build a guarded matcher.
|
|
60
|
-
*
|
|
61
|
-
* ```ts
|
|
62
|
-
* const matchCredential = guardedMatcher(/AKIA[0-9A-Z]{16}/g, 25);
|
|
63
|
-
* const r = await matchCredential(line);
|
|
64
|
-
* if (r.timedOut) counters.redosTimeouts++;
|
|
65
|
-
* else if (r.match) report(r.match);
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare function guardedMatcher(re: RegExp, budgetMs?: number, onTimeout?: ReDoSOptions['onTimeout']): (input: string) => Promise<ReDoSResult>;
|
|
1
|
+
/** Shim: implementation moved to @wrongstack/plugin-sdk/runtime. */
|
|
2
|
+
export { withReDoSGuard, guardedMatcher, type ReDoSResult, type ReDoSOptions, } from '@wrongstack/plugin-sdk/runtime';
|
|
69
3
|
//# sourceMappingURL=redos-guard.d.ts.map
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Plugins routinely stringify values they did not construct: event-bus
|
|
5
|
-
* payloads, tool results, mailbox bodies. `JSON.stringify` throws on a
|
|
6
|
-
* circular reference and on `BigInt`, and several of these call sites sit
|
|
7
|
-
* inside detached (fire-and-forget) work where a throw becomes an
|
|
8
|
-
* unhandled rejection rather than a handled failure.
|
|
9
|
-
*
|
|
10
|
-
* `safeJsonStringify` never throws. A value it cannot represent is
|
|
11
|
-
* replaced with a marker, so the surrounding feature degrades to "this
|
|
12
|
-
* field is unreadable" instead of failing — or crashing — outright.
|
|
13
|
-
*/
|
|
14
|
-
/** Placeholder substituted for a value that cannot be serialised. */
|
|
15
|
-
export declare const UNSERIALIZABLE = "[unserializable]";
|
|
16
|
-
/**
|
|
17
|
-
* `JSON.stringify` with cycle handling and a total-failure fallback.
|
|
18
|
-
*
|
|
19
|
-
* @param value anything
|
|
20
|
-
* @param indent passed through to `JSON.stringify` (e.g. `2` to pretty-print)
|
|
21
|
-
* @returns a JSON string, or a marker string when the value resists
|
|
22
|
-
* serialisation entirely. Never throws.
|
|
23
|
-
*/
|
|
24
|
-
export declare function safeJsonStringify(value: unknown, indent?: number): string;
|
|
1
|
+
/** Shim: implementation moved to @wrongstack/plugin-sdk/runtime. */
|
|
2
|
+
export { UNSERIALIZABLE, safeJsonStringify } from '@wrongstack/plugin-sdk/runtime';
|
|
25
3
|
//# sourceMappingURL=safe-json.d.ts.map
|
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Why a new helper when `runtime/index.ts` already exports
|
|
5
|
-
* `withinProject` and `sanitizeRunnerPath`?
|
|
6
|
-
*
|
|
7
|
-
* - `withinProject` does NOT resolve symlinks: a path like
|
|
8
|
-
* `project/link-to-/etc/passwd` reports as inside the project
|
|
9
|
-
* even though the resolved target is outside.
|
|
10
|
-
* - `sanitizeRunnerPath` is for runner argv (linter binaries),
|
|
11
|
-
* not user-supplied tool input. The two paths share the
|
|
12
|
-
* leading-dash + length checks but `sanitizeRunnerPath`
|
|
13
|
-
* rejects a `cwd` for which it cannot resolve; user-input
|
|
14
|
-
* sandbox needs canonicalization instead.
|
|
15
|
-
*
|
|
16
|
-
* The previous design (per SAGE memory T-03) relied on three
|
|
17
|
-
* duplicate `withinProject` copies in `runtime/index.ts`,
|
|
18
|
-
* `file-watcher/index.ts`, and `path-guard/glob.ts`. They drifted
|
|
19
|
-
* on edge cases. This helper is the single replacement.
|
|
20
|
-
*
|
|
21
|
-
* Contract:
|
|
22
|
-
* `safePath(input, projectRoot?)` returns the canonical absolute
|
|
23
|
-
* path inside the project on success, or `null` on rejection.
|
|
24
|
-
*
|
|
25
|
-
* Rejection cases:
|
|
26
|
-
* - empty string
|
|
27
|
-
* - length > 4096 bytes (matches `runtime.withinProject`)
|
|
28
|
-
* - leading-dash (option smuggling)
|
|
29
|
-
* - cannot be resolved (path doesn't exist or EPERM)
|
|
30
|
-
* - resolved path escapes the project root
|
|
31
|
-
* - symlink target is outside the project
|
|
32
|
-
*/
|
|
33
|
-
export interface SafePathOptions {
|
|
34
|
-
/**
|
|
35
|
-
* Project root for the sandbox. Defaults to `process.cwd()`. Pass
|
|
36
|
-
* the session cwd from the plugin host when available so that
|
|
37
|
-
* tools running in a subdirectory are scoped to that directory.
|
|
38
|
-
*/
|
|
39
|
-
projectRoot?: string;
|
|
40
|
-
/**
|
|
41
|
-
* If true (default), follow symlinks via `realpathSync`. Set false
|
|
42
|
-
* for plugins that need to record the literal path the user wrote
|
|
43
|
-
* (e.g. checkpoint capture, git diff).
|
|
44
|
-
*/
|
|
45
|
-
followSymlinks?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Resolve `input` to an absolute path inside the project root.
|
|
49
|
-
*
|
|
50
|
-
* Returns `null` for empty/oversized/leading-dash inputs and for
|
|
51
|
-
* paths whose real target escapes the project.
|
|
52
|
-
*/
|
|
53
|
-
export declare function safePath(input: string, options?: SafePathOptions): string | null;
|
|
54
|
-
/**
|
|
55
|
-
* Boolean convenience for callers that don't need the canonical path.
|
|
56
|
-
* Equivalent to `safePath(input, options) !== null`.
|
|
57
|
-
*/
|
|
58
|
-
export declare function isInsideProject(input: string, options?: SafePathOptions): boolean;
|
|
1
|
+
/** Shim: implementation moved to @wrongstack/plugin-sdk/runtime. */
|
|
2
|
+
export { safePath, isInsideProject, type SafePathOptions, } from '@wrongstack/plugin-sdk/runtime';
|
|
59
3
|
//# sourceMappingURL=sandbox.d.ts.map
|