@wrongstack/plugins 0.284.1 → 0.285.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/README.md +18 -14
- package/dist/accessibility-auditor/index.d.ts +38 -0
- package/dist/accessibility-auditor/index.d.ts.map +1 -0
- package/dist/accessibility-auditor.d.ts +2 -40
- package/dist/accessibility-auditor.js +5 -5
- package/dist/agent-handoff/index.d.ts +35 -0
- package/dist/agent-handoff/index.d.ts.map +1 -0
- package/dist/agent-handoff.d.ts +2 -37
- package/dist/agent-handoff.js +3 -2
- package/dist/api-compatibility-gate/index.d.ts +36 -0
- package/dist/api-compatibility-gate/index.d.ts.map +1 -0
- package/dist/api-compatibility-gate.d.ts +2 -38
- package/dist/api-compatibility-gate.js +6 -6
- package/dist/auto-doc/index.d.ts +20 -0
- package/dist/auto-doc/index.d.ts.map +1 -0
- package/dist/auto-doc.d.ts +2 -22
- package/dist/auto-doc.js +5 -5
- package/dist/auto-escalate/index.d.ts +43 -0
- package/dist/auto-escalate/index.d.ts.map +1 -0
- package/dist/auto-escalate.d.ts +2 -45
- package/dist/auto-escalate.js +5 -2
- package/dist/auto-i18n-extractor/index.d.ts +34 -0
- package/dist/auto-i18n-extractor/index.d.ts.map +1 -0
- package/dist/auto-i18n-extractor.d.ts +2 -36
- package/dist/auto-i18n-extractor.js +5 -5
- package/dist/branch-guard/index.d.ts +32 -0
- package/dist/branch-guard/index.d.ts.map +1 -0
- package/dist/branch-guard.d.ts +2 -34
- package/dist/branch-guard.js +4 -4
- package/dist/catalog.d.ts +39 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/changelog-writer/index.d.ts +71 -0
- package/dist/changelog-writer/index.d.ts.map +1 -0
- package/dist/changelog-writer.d.ts +2 -73
- package/dist/changelog-writer.js +9 -5
- package/dist/checkpoint/index.d.ts +53 -0
- package/dist/checkpoint/index.d.ts.map +1 -0
- package/dist/checkpoint.d.ts +2 -55
- package/dist/checkpoint.js +6 -6
- package/dist/code-metrics/index.d.ts +29 -0
- package/dist/code-metrics/index.d.ts.map +1 -0
- package/dist/code-metrics.d.ts +2 -31
- package/dist/code-metrics.js +5 -5
- package/dist/commit-validator/index.d.ts +31 -0
- package/dist/commit-validator/index.d.ts.map +1 -0
- package/dist/commit-validator.d.ts +2 -33
- package/dist/commit-validator.js +5 -3
- package/dist/config-validator/index.d.ts +46 -0
- package/dist/config-validator/index.d.ts.map +1 -0
- package/dist/config-validator.d.ts +2 -48
- package/dist/config-validator.js +8 -4
- package/dist/context-pins/index.d.ts +43 -0
- package/dist/context-pins/index.d.ts.map +1 -0
- package/dist/context-pins.d.ts +2 -45
- package/dist/context-pins.js +5 -5
- package/dist/cost-tracker/index.d.ts +51 -0
- package/dist/cost-tracker/index.d.ts.map +1 -0
- package/dist/cost-tracker.d.ts +2 -53
- package/dist/cost-tracker.js +4 -4
- package/dist/cron/index.d.ts +12 -0
- package/dist/cron/index.d.ts.map +1 -0
- package/dist/cron.d.ts +2 -14
- package/dist/cron.js +3 -2
- package/dist/dead-code-detector/index.d.ts +32 -0
- package/dist/dead-code-detector/index.d.ts.map +1 -0
- package/dist/dead-code-detector.d.ts +2 -34
- package/dist/dead-code-detector.js +5 -5
- package/dist/dep-guard/index.d.ts +63 -0
- package/dist/dep-guard/index.d.ts.map +1 -0
- package/dist/dep-guard.d.ts +2 -65
- package/dist/dep-guard.js +6 -2
- package/dist/dependency-vulnerability-gate/index.d.ts +33 -0
- package/dist/dependency-vulnerability-gate/index.d.ts.map +1 -0
- package/dist/dependency-vulnerability-gate.d.ts +2 -35
- package/dist/dependency-vulnerability-gate.js +5 -5
- package/dist/diff-summary/index.d.ts +34 -0
- package/dist/diff-summary/index.d.ts.map +1 -0
- package/dist/diff-summary.d.ts +2 -36
- package/dist/diff-summary.js +5 -5
- package/dist/doc-sync-guard/index.d.ts +31 -0
- package/dist/doc-sync-guard/index.d.ts.map +1 -0
- package/dist/doc-sync-guard.d.ts +2 -33
- package/dist/doc-sync-guard.js +4 -4
- package/dist/duplicate-code-detector/index.d.ts +31 -0
- package/dist/duplicate-code-detector/index.d.ts.map +1 -0
- package/dist/duplicate-code-detector.d.ts +2 -33
- package/dist/duplicate-code-detector.js +5 -5
- package/dist/error-lens/index.d.ts +65 -0
- package/dist/error-lens/index.d.ts.map +1 -0
- package/dist/error-lens.d.ts +2 -67
- package/dist/error-lens.js +5 -2
- package/dist/feature-flag-tracker/index.d.ts +36 -0
- package/dist/feature-flag-tracker/index.d.ts.map +1 -0
- package/dist/feature-flag-tracker.d.ts +2 -38
- package/dist/feature-flag-tracker.js +5 -5
- package/dist/file-watcher/index.d.ts +12 -0
- package/dist/file-watcher/index.d.ts.map +1 -0
- package/dist/file-watcher.d.ts +2 -14
- package/dist/file-watcher.js +7 -7
- package/dist/format-on-save/index.d.ts +33 -0
- package/dist/format-on-save/index.d.ts.map +1 -0
- package/dist/format-on-save.d.ts +2 -35
- package/dist/format-on-save.js +6 -6
- package/dist/git-autocommit/index.d.ts +15 -0
- package/dist/git-autocommit/index.d.ts.map +1 -0
- package/dist/git-autocommit.d.ts +2 -17
- package/dist/git-autocommit.js +5 -5
- package/dist/import-organizer/index.d.ts +50 -0
- package/dist/import-organizer/index.d.ts.map +1 -0
- package/dist/import-organizer.d.ts +2 -52
- package/dist/import-organizer.js +6 -6
- package/dist/index.d.ts +186 -64
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +946 -394
- package/dist/injection-shield/index.d.ts +47 -0
- package/dist/injection-shield/index.d.ts.map +1 -0
- package/dist/injection-shield.d.ts +2 -49
- package/dist/injection-shield.js +4 -2
- package/dist/interface-contract-guard/index.d.ts +35 -0
- package/dist/interface-contract-guard/index.d.ts.map +1 -0
- package/dist/interface-contract-guard.d.ts +2 -37
- package/dist/interface-contract-guard.js +5 -5
- package/dist/knowledge-graph/index.d.ts +43 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph.d.ts +2 -45
- package/dist/knowledge-graph.js +5 -5
- package/dist/license-audit-gate/index.d.ts +32 -0
- package/dist/license-audit-gate/index.d.ts.map +1 -0
- package/dist/license-audit-gate.d.ts +2 -34
- package/dist/license-audit-gate.js +5 -5
- package/dist/lint-gate/index.d.ts +31 -0
- package/dist/lint-gate/index.d.ts.map +1 -0
- package/dist/lint-gate.d.ts +2 -33
- package/dist/lint-gate.js +7 -7
- package/dist/llm-cache/index.d.ts +54 -0
- package/dist/llm-cache/index.d.ts.map +1 -0
- package/dist/llm-cache.d.ts +2 -56
- package/dist/llm-cache.js +6 -4
- package/dist/loop-breaker/index.d.ts +4 -0
- package/dist/loop-breaker/index.d.ts.map +1 -0
- package/dist/loop-breaker.d.ts +2 -5
- package/dist/loop-breaker.js +4 -4
- package/dist/migration-planner/index.d.ts +28 -0
- package/dist/migration-planner/index.d.ts.map +1 -0
- package/dist/migration-planner.d.ts +2 -30
- package/dist/migration-planner.js +5 -5
- package/dist/model-router/index.d.ts +67 -0
- package/dist/model-router/index.d.ts.map +1 -0
- package/dist/model-router.d.ts +2 -69
- package/dist/model-router.js +5 -2
- package/dist/notify-hub/index.d.ts +43 -0
- package/dist/notify-hub/index.d.ts.map +1 -0
- package/dist/notify-hub.d.ts +2 -45
- package/dist/notify-hub.js +3 -2
- package/dist/path-guard/index.d.ts +52 -0
- package/dist/path-guard/index.d.ts.map +1 -0
- package/dist/path-guard.d.ts +2 -54
- package/dist/path-guard.js +5 -2
- package/dist/performance-regression-gate/index.d.ts +31 -0
- package/dist/performance-regression-gate/index.d.ts.map +1 -0
- package/dist/performance-regression-gate.d.ts +2 -33
- package/dist/performance-regression-gate.js +5 -5
- package/dist/plugin-stack-observer/index.d.ts +33 -0
- package/dist/plugin-stack-observer/index.d.ts.map +1 -0
- package/dist/plugin-stack-observer.d.ts +2 -35
- package/dist/plugin-stack-observer.js +3 -2
- package/dist/pr-drafter/index.d.ts +33 -0
- package/dist/pr-drafter/index.d.ts.map +1 -0
- package/dist/pr-drafter.d.ts +2 -35
- package/dist/pr-drafter.js +6 -6
- package/dist/prompt-firewall/index.d.ts +55 -0
- package/dist/prompt-firewall/index.d.ts.map +1 -0
- package/dist/prompt-firewall.d.ts +2 -57
- package/dist/prompt-firewall.js +5 -2
- package/dist/refactor-suggester/index.d.ts +36 -0
- package/dist/refactor-suggester/index.d.ts.map +1 -0
- package/dist/refactor-suggester.d.ts +2 -38
- package/dist/refactor-suggester.js +5 -5
- package/dist/release-notes-generator/index.d.ts +25 -0
- package/dist/release-notes-generator/index.d.ts.map +1 -0
- package/dist/release-notes-generator.d.ts +2 -27
- package/dist/release-notes-generator.js +28 -10
- package/dist/runtime/index.d.ts +124 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +216 -0
- package/dist/schema-evolution-guard/index.d.ts +40 -0
- package/dist/schema-evolution-guard/index.d.ts.map +1 -0
- package/dist/schema-evolution-guard.d.ts +2 -42
- package/dist/schema-evolution-guard.js +5 -5
- package/dist/secret-scanner/index.d.ts +32 -0
- package/dist/secret-scanner/index.d.ts.map +1 -0
- package/dist/secret-scanner.d.ts +2 -34
- package/dist/secret-scanner.js +3 -2
- package/dist/security-hotspot-scanner/index.d.ts +28 -0
- package/dist/security-hotspot-scanner/index.d.ts.map +1 -0
- package/dist/security-hotspot-scanner.d.ts +2 -30
- package/dist/security-hotspot-scanner.js +5 -5
- package/dist/semantic-search-indexer/index.d.ts +36 -0
- package/dist/semantic-search-indexer/index.d.ts.map +1 -0
- package/dist/semantic-search-indexer.d.ts +2 -38
- package/dist/semantic-search-indexer.js +22 -6
- package/dist/semver-bump/index.d.ts +24 -0
- package/dist/semver-bump/index.d.ts.map +1 -0
- package/dist/semver-bump.d.ts +2 -26
- package/dist/semver-bump.js +10 -8
- package/dist/session-recap/index.d.ts +48 -0
- package/dist/session-recap/index.d.ts.map +1 -0
- package/dist/session-recap.d.ts +2 -50
- package/dist/session-recap.js +6 -4
- package/dist/shell-check/index.d.ts +14 -0
- package/dist/shell-check/index.d.ts.map +1 -0
- package/dist/shell-check.d.ts +2 -16
- package/dist/shell-check.js +6 -6
- package/dist/smart-rename/index.d.ts +24 -0
- package/dist/smart-rename/index.d.ts.map +1 -0
- package/dist/smart-rename.d.ts +2 -26
- package/dist/smart-rename.js +5 -5
- package/dist/spec-linker/index.d.ts +49 -0
- package/dist/spec-linker/index.d.ts.map +1 -0
- package/dist/spec-linker.d.ts +2 -51
- package/dist/spec-linker.js +20100 -244
- package/dist/template-engine/index.d.ts +13 -0
- package/dist/template-engine/index.d.ts.map +1 -0
- package/dist/template-engine.d.ts +2 -15
- package/dist/template-engine.js +7 -7
- package/dist/test-coverage-gate/index.d.ts +35 -0
- package/dist/test-coverage-gate/index.d.ts.map +1 -0
- package/dist/test-coverage-gate.d.ts +2 -37
- package/dist/test-coverage-gate.js +5 -5
- package/dist/test-flake-detector/index.d.ts +25 -0
- package/dist/test-flake-detector/index.d.ts.map +1 -0
- package/dist/test-flake-detector.d.ts +2 -27
- package/dist/test-flake-detector.js +98 -13
- package/dist/test-generator/index.d.ts +30 -0
- package/dist/test-generator/index.d.ts.map +1 -0
- package/dist/test-generator.d.ts +2 -32
- package/dist/test-generator.js +5 -5
- package/dist/test-runner-gate/index.d.ts +35 -0
- package/dist/test-runner-gate/index.d.ts.map +1 -0
- package/dist/test-runner-gate.d.ts +2 -37
- package/dist/test-runner-gate.js +6 -6
- package/dist/todo-listener/index.d.ts +35 -0
- package/dist/todo-listener/index.d.ts.map +1 -0
- package/dist/todo-listener.d.ts +2 -37
- package/dist/todo-listener.js +3 -2
- package/dist/todo-tracker/index.d.ts +4 -0
- package/dist/todo-tracker/index.d.ts.map +1 -0
- package/dist/todo-tracker.d.ts +2 -5
- package/dist/todo-tracker.js +5 -5
- package/dist/token-budget/index.d.ts +38 -0
- package/dist/token-budget/index.d.ts.map +1 -0
- package/dist/token-budget.d.ts +2 -40
- package/dist/token-budget.js +3 -2
- package/dist/token-throttle/index.d.ts +52 -0
- package/dist/token-throttle/index.d.ts.map +1 -0
- package/dist/token-throttle.d.ts +2 -54
- package/dist/token-throttle.js +6 -2
- package/dist/type-gate/index.d.ts +35 -0
- package/dist/type-gate/index.d.ts.map +1 -0
- package/dist/type-gate.d.ts +2 -37
- package/dist/type-gate.js +236 -43
- package/package.json +10 -7
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* injection-shield plugin — flags prompt-injection attempts inside
|
|
3
|
+
* tool output before the model acts on them.
|
|
4
|
+
*
|
|
5
|
+
* Fetched web pages, README files, issue bodies, and even source
|
|
6
|
+
* comments can contain text addressed at the *model* rather than the
|
|
7
|
+
* user ("ignore all previous instructions", fake system prompts,
|
|
8
|
+
* hidden HTML comments with directives). A `PostToolUse` hook scans
|
|
9
|
+
* tool results for a curated pattern set:
|
|
10
|
+
*
|
|
11
|
+
* - instruction-override phrasing ("ignore/disregard previous
|
|
12
|
+
* instructions", "your new instructions are", "you must now")
|
|
13
|
+
* - role/system spoofing ("system:", "<system>", "[INST]",
|
|
14
|
+
* "BEGIN SYSTEM PROMPT")
|
|
15
|
+
* - authority claims aimed at agents ("as your developer/admin,
|
|
16
|
+
* I authorize", "this instruction comes from Anthropic/OpenAI")
|
|
17
|
+
* - exfiltration bait ("send/post the conversation/API key to http…")
|
|
18
|
+
* - hidden-text vectors: HTML comments containing imperative text
|
|
19
|
+
* aimed at assistants, zero-width characters in bulk
|
|
20
|
+
*
|
|
21
|
+
* On a hit it injects a high-signal `additionalContext` warning that
|
|
22
|
+
* names the matched pattern and reminds the model that tool output
|
|
23
|
+
* is data, not instructions. It never blocks — reading hostile
|
|
24
|
+
* content is fine; *obeying* it is not. Everything is counted and
|
|
25
|
+
* queryable via `injection_shield_status`.
|
|
26
|
+
*
|
|
27
|
+
* Config (`config.extensions['injection-shield']`):
|
|
28
|
+
*
|
|
29
|
+
* ```jsonc
|
|
30
|
+
* {
|
|
31
|
+
* "enabled": true,
|
|
32
|
+
* "tools": "*", // matcher; scan all tool output by default
|
|
33
|
+
* "minMatches": 1, // hits needed before warning
|
|
34
|
+
* "maxScanChars": 262144 // scan cap per result
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Toggle off with `{ "name": "injection-shield", "enabled": false }`
|
|
39
|
+
* in `config.plugins`, or `"enabled": false` in the options above.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
import type { Plugin } from '@wrongstack/core';
|
|
44
|
+
export declare function scanForInjection(text: string): string[];
|
|
45
|
+
declare const plugin: Plugin;
|
|
46
|
+
export default plugin;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/injection-shield/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA6G/C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvD;AAMD,QAAA,MAAM,MAAM,EAAE,MAwJb,CAAC;eAEa,MAAM"}
|
|
@@ -1,49 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* injection-shield plugin — flags prompt-injection attempts inside
|
|
5
|
-
* tool output before the model acts on them.
|
|
6
|
-
*
|
|
7
|
-
* Fetched web pages, README files, issue bodies, and even source
|
|
8
|
-
* comments can contain text addressed at the *model* rather than the
|
|
9
|
-
* user ("ignore all previous instructions", fake system prompts,
|
|
10
|
-
* hidden HTML comments with directives). A `PostToolUse` hook scans
|
|
11
|
-
* tool results for a curated pattern set:
|
|
12
|
-
*
|
|
13
|
-
* - instruction-override phrasing ("ignore/disregard previous
|
|
14
|
-
* instructions", "your new instructions are", "you must now")
|
|
15
|
-
* - role/system spoofing ("system:", "<system>", "[INST]",
|
|
16
|
-
* "BEGIN SYSTEM PROMPT")
|
|
17
|
-
* - authority claims aimed at agents ("as your developer/admin,
|
|
18
|
-
* I authorize", "this instruction comes from Anthropic/OpenAI")
|
|
19
|
-
* - exfiltration bait ("send/post the conversation/API key to http…")
|
|
20
|
-
* - hidden-text vectors: HTML comments containing imperative text
|
|
21
|
-
* aimed at assistants, zero-width characters in bulk
|
|
22
|
-
*
|
|
23
|
-
* On a hit it injects a high-signal `additionalContext` warning that
|
|
24
|
-
* names the matched pattern and reminds the model that tool output
|
|
25
|
-
* is data, not instructions. It never blocks — reading hostile
|
|
26
|
-
* content is fine; *obeying* it is not. Everything is counted and
|
|
27
|
-
* queryable via `injection_shield_status`.
|
|
28
|
-
*
|
|
29
|
-
* Config (`config.extensions['injection-shield']`):
|
|
30
|
-
*
|
|
31
|
-
* ```jsonc
|
|
32
|
-
* {
|
|
33
|
-
* "enabled": true,
|
|
34
|
-
* "tools": "*", // matcher; scan all tool output by default
|
|
35
|
-
* "minMatches": 1, // hits needed before warning
|
|
36
|
-
* "maxScanChars": 262144 // scan cap per result
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* Toggle off with `{ "name": "injection-shield", "enabled": false }`
|
|
41
|
-
* in `config.plugins`, or `"enabled": false` in the options above.
|
|
42
|
-
*
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
declare function scanForInjection(text: string): string[];
|
|
47
|
-
declare const plugin: Plugin;
|
|
48
|
-
|
|
49
|
-
export { plugin as default, scanForInjection };
|
|
1
|
+
export * from './injection-shield/index.js';
|
|
2
|
+
export { default } from './injection-shield/index.js';
|
package/dist/injection-shield.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* interface-contract-guard plugin — checks TypeScript interface declarations
|
|
3
|
+
* for apparent implementers, warning when an interface looks unimplemented.
|
|
4
|
+
*
|
|
5
|
+
* Tools registered:
|
|
6
|
+
* - check_interface_contracts : Scan TypeScript files for unimplemented interfaces.
|
|
7
|
+
* - interface_contract_status : Report config + counters.
|
|
8
|
+
*
|
|
9
|
+
* Hooks registered:
|
|
10
|
+
* - PostToolUse with matcher `write|edit` to .ts/.tsx files, warning when the
|
|
11
|
+
* changed file contains interface declarations because implementers may need
|
|
12
|
+
* updating.
|
|
13
|
+
*
|
|
14
|
+
* Config (`config.extensions['interface-contract-guard']`):
|
|
15
|
+
*
|
|
16
|
+
* ```jsonc
|
|
17
|
+
* {
|
|
18
|
+
* "enabled": true,
|
|
19
|
+
* "extensions": [".ts", ".tsx"],
|
|
20
|
+
* "maxFindings": 50
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
import type { Plugin } from '@wrongstack/core';
|
|
27
|
+
export interface InterfaceContractFinding {
|
|
28
|
+
interfaceName: string;
|
|
29
|
+
file: string;
|
|
30
|
+
line: number;
|
|
31
|
+
message: string;
|
|
32
|
+
}
|
|
33
|
+
declare const plugin: Plugin;
|
|
34
|
+
export default plugin;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface-contract-guard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAyLD,QAAA,MAAM,MAAM,EAAE,MAuMb,CAAC;eAEa,MAAM"}
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* interface-contract-guard plugin — checks TypeScript interface declarations
|
|
5
|
-
* for apparent implementers, warning when an interface looks unimplemented.
|
|
6
|
-
*
|
|
7
|
-
* Tools registered:
|
|
8
|
-
* - check_interface_contracts : Scan TypeScript files for unimplemented interfaces.
|
|
9
|
-
* - interface_contract_status : Report config + counters.
|
|
10
|
-
*
|
|
11
|
-
* Hooks registered:
|
|
12
|
-
* - PostToolUse with matcher `write|edit` to .ts/.tsx files, warning when the
|
|
13
|
-
* changed file contains interface declarations because implementers may need
|
|
14
|
-
* updating.
|
|
15
|
-
*
|
|
16
|
-
* Config (`config.extensions['interface-contract-guard']`):
|
|
17
|
-
*
|
|
18
|
-
* ```jsonc
|
|
19
|
-
* {
|
|
20
|
-
* "enabled": true,
|
|
21
|
-
* "extensions": [".ts", ".tsx"],
|
|
22
|
-
* "maxFindings": 50
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
interface InterfaceContractFinding {
|
|
30
|
-
interfaceName: string;
|
|
31
|
-
file: string;
|
|
32
|
-
line: number;
|
|
33
|
-
message: string;
|
|
34
|
-
}
|
|
35
|
-
declare const plugin: Plugin;
|
|
36
|
-
|
|
37
|
-
export { type InterfaceContractFinding, plugin as default };
|
|
1
|
+
export * from './interface-contract-guard/index.js';
|
|
2
|
+
export { default } from './interface-contract-guard/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readFileSync, existsSync, statSync, readdirSync } from 'fs';
|
|
2
|
-
import { resolve, isAbsolute, relative, extname } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/interface-contract-guard/index.ts
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { extname, isAbsolute, relative, resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
scanCount: 0,
|
|
@@ -298,5 +297,6 @@ If you changed member shapes, search the project for implementers/\`satisfies\`/
|
|
|
298
297
|
}
|
|
299
298
|
};
|
|
300
299
|
var interface_contract_guard_default = plugin;
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
export {
|
|
301
|
+
interface_contract_guard_default as default
|
|
302
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge-graph plugin — accumulates structured facts about the project
|
|
3
|
+
* across sessions.
|
|
4
|
+
*
|
|
5
|
+
* The plugin gives the agent three tools:
|
|
6
|
+
* - `kg_add_fact` — add a (subject, relation, object) triple
|
|
7
|
+
* - `kg_query` — query facts by subject, relation, or object
|
|
8
|
+
* - `kg_remove_fact` — remove a fact by id
|
|
9
|
+
* - `kg_status` — counters + persisted path
|
|
10
|
+
*
|
|
11
|
+
* Facts persist in a project-local JSON file (default:
|
|
12
|
+
* `<projectDir>/.wrongstack/knowledge-graph.json`) so they survive across
|
|
13
|
+
* sessions. Optionally the plugin can contribute a compact summary of
|
|
14
|
+
* relevant facts to the system prompt for the current task.
|
|
15
|
+
*
|
|
16
|
+
* Config (`config.extensions['knowledge-graph']`):
|
|
17
|
+
*
|
|
18
|
+
* ```jsonc
|
|
19
|
+
* {
|
|
20
|
+
* "enabled": true,
|
|
21
|
+
* "filePath": ".wrongstack/knowledge-graph.json",
|
|
22
|
+
* "maxFacts": 200,
|
|
23
|
+
* "maxFactChars": 300,
|
|
24
|
+
* "contributeToSystemPrompt": true,
|
|
25
|
+
* "contributeMaxChars": 1500
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
import type { Plugin } from '@wrongstack/core';
|
|
32
|
+
export interface Fact {
|
|
33
|
+
id: string;
|
|
34
|
+
subject: string;
|
|
35
|
+
relation: string;
|
|
36
|
+
object: string;
|
|
37
|
+
source: string | null;
|
|
38
|
+
confidence: 'low' | 'medium' | 'high';
|
|
39
|
+
createdAt: string;
|
|
40
|
+
}
|
|
41
|
+
declare const plugin: Plugin;
|
|
42
|
+
export default plugin;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/knowledge-graph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AA2HD,QAAA,MAAM,MAAM,EAAE,MA2Sb,CAAC;eAEa,MAAM"}
|
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* knowledge-graph plugin — accumulates structured facts about the project
|
|
5
|
-
* across sessions.
|
|
6
|
-
*
|
|
7
|
-
* The plugin gives the agent three tools:
|
|
8
|
-
* - `kg_add_fact` — add a (subject, relation, object) triple
|
|
9
|
-
* - `kg_query` — query facts by subject, relation, or object
|
|
10
|
-
* - `kg_remove_fact` — remove a fact by id
|
|
11
|
-
* - `kg_status` — counters + persisted path
|
|
12
|
-
*
|
|
13
|
-
* Facts persist in a project-local JSON file (default:
|
|
14
|
-
* `<projectDir>/.wrongstack/knowledge-graph.json`) so they survive across
|
|
15
|
-
* sessions. Optionally the plugin can contribute a compact summary of
|
|
16
|
-
* relevant facts to the system prompt for the current task.
|
|
17
|
-
*
|
|
18
|
-
* Config (`config.extensions['knowledge-graph']`):
|
|
19
|
-
*
|
|
20
|
-
* ```jsonc
|
|
21
|
-
* {
|
|
22
|
-
* "enabled": true,
|
|
23
|
-
* "filePath": ".wrongstack/knowledge-graph.json",
|
|
24
|
-
* "maxFacts": 200,
|
|
25
|
-
* "maxFactChars": 300,
|
|
26
|
-
* "contributeToSystemPrompt": true,
|
|
27
|
-
* "contributeMaxChars": 1500
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
interface Fact {
|
|
35
|
-
id: string;
|
|
36
|
-
subject: string;
|
|
37
|
-
relation: string;
|
|
38
|
-
object: string;
|
|
39
|
-
source: string | null;
|
|
40
|
-
confidence: 'low' | 'medium' | 'high';
|
|
41
|
-
createdAt: string;
|
|
42
|
-
}
|
|
43
|
-
declare const plugin: Plugin;
|
|
44
|
-
|
|
45
|
-
export { type Fact, plugin as default };
|
|
1
|
+
export * from './knowledge-graph/index.js';
|
|
2
|
+
export { default } from './knowledge-graph/index.js';
|
package/dist/knowledge-graph.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
2
|
-
import { resolve, isAbsolute, relative, dirname } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/knowledge-graph/index.ts
|
|
2
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
facts: [],
|
|
@@ -321,5 +320,6 @@ var plugin = {
|
|
|
321
320
|
}
|
|
322
321
|
};
|
|
323
322
|
var knowledge_graph_default = plugin;
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
export {
|
|
324
|
+
knowledge_graph_default as default
|
|
325
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* license-audit-gate plugin — audits dependency licenses at install time.
|
|
3
|
+
*
|
|
4
|
+
* After every `bash` or `exec` tool call that looks like a package-manager
|
|
5
|
+
* install/add command (`npm i`, `pnpm add`, `yarn add`, `bun add`), the
|
|
6
|
+
* plugin reads `node_modules/<package>/package.json` for each newly added
|
|
7
|
+
* dependency, extracts its license field(s), and checks them against an
|
|
8
|
+
* allowlist. If any package's license is not on the allowlist, the hook
|
|
9
|
+
* either blocks the install (default) or injects a warning note.
|
|
10
|
+
*
|
|
11
|
+
* Tools registered:
|
|
12
|
+
* - license_audit_status : Show config + per-session counters.
|
|
13
|
+
*
|
|
14
|
+
* Hooks registered:
|
|
15
|
+
* - PostToolUse with matcher `bash|exec`.
|
|
16
|
+
*
|
|
17
|
+
* Config (`config.extensions['license-audit-gate']`):
|
|
18
|
+
*
|
|
19
|
+
* ```jsonc
|
|
20
|
+
* {
|
|
21
|
+
* "enabled": true,
|
|
22
|
+
* "allowedLicenses": ["MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "0BSD", "Unlicense"],
|
|
23
|
+
* "block": true
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
import type { Plugin } from '@wrongstack/core';
|
|
30
|
+
declare const plugin: Plugin;
|
|
31
|
+
export default plugin;
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/license-audit-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAmK/C,QAAA,MAAM,MAAM,EAAE,MAqMb,CAAC;eAEa,MAAM"}
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* license-audit-gate plugin — audits dependency licenses at install time.
|
|
5
|
-
*
|
|
6
|
-
* After every `bash` or `exec` tool call that looks like a package-manager
|
|
7
|
-
* install/add command (`npm i`, `pnpm add`, `yarn add`, `bun add`), the
|
|
8
|
-
* plugin reads `node_modules/<package>/package.json` for each newly added
|
|
9
|
-
* dependency, extracts its license field(s), and checks them against an
|
|
10
|
-
* allowlist. If any package's license is not on the allowlist, the hook
|
|
11
|
-
* either blocks the install (default) or injects a warning note.
|
|
12
|
-
*
|
|
13
|
-
* Tools registered:
|
|
14
|
-
* - license_audit_status : Show config + per-session counters.
|
|
15
|
-
*
|
|
16
|
-
* Hooks registered:
|
|
17
|
-
* - PostToolUse with matcher `bash|exec`.
|
|
18
|
-
*
|
|
19
|
-
* Config (`config.extensions['license-audit-gate']`):
|
|
20
|
-
*
|
|
21
|
-
* ```jsonc
|
|
22
|
-
* {
|
|
23
|
-
* "enabled": true,
|
|
24
|
-
* "allowedLicenses": ["MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "0BSD", "Unlicense"],
|
|
25
|
-
* "block": true
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
declare const plugin: Plugin;
|
|
33
|
-
|
|
34
|
-
export { plugin as default };
|
|
1
|
+
export * from './license-audit-gate/index.js';
|
|
2
|
+
export { default } from './license-audit-gate/index.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
|
|
4
1
|
// src/license-audit-gate/index.ts
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
5
4
|
var API_VERSION = "^0.1.10";
|
|
6
5
|
var state = {
|
|
7
6
|
invocations: 0,
|
|
@@ -256,5 +255,6 @@ Allowed licenses: ${cfg.allowedLicenses.join(", ")}
|
|
|
256
255
|
}
|
|
257
256
|
};
|
|
258
257
|
var license_audit_gate_default = plugin;
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
export {
|
|
259
|
+
license_audit_gate_default as default
|
|
260
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lint-gate plugin — PreToolUse hook that runs biome (or eslint) on
|
|
3
|
+
* the would-be file content before `write` or `edit` commits it.
|
|
4
|
+
*
|
|
5
|
+
* Tools registered:
|
|
6
|
+
* - lint_gate_status : Show config, linter, and per-session counters.
|
|
7
|
+
*
|
|
8
|
+
* Hooks registered:
|
|
9
|
+
* - PreToolUse with matcher `write|edit`. For `write`, the full
|
|
10
|
+
* content is available in `toolInput.content` — it's written to a
|
|
11
|
+
* temp file and linted. For `edit`, the current file is read, the
|
|
12
|
+
* `old_string → new_string` replacement is applied in-memory, and
|
|
13
|
+
* the result is linted.
|
|
14
|
+
*
|
|
15
|
+
* Config (`config.extensions['lint-gate']`):
|
|
16
|
+
*
|
|
17
|
+
* ```jsonc
|
|
18
|
+
* {
|
|
19
|
+
* "linter": "biome", // "biome" | "eslint" | "auto"
|
|
20
|
+
* "mode": "warn", // "block" (refuse the call) | "warn" (inject context)
|
|
21
|
+
* "severity": "error", // minimum severity to act on: "error" | "warning"
|
|
22
|
+
* "timeoutMs": 10000 // linter process timeout
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
import type { Plugin } from '@wrongstack/core';
|
|
29
|
+
declare const plugin: Plugin;
|
|
30
|
+
export default plugin;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lint-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA6R/C,QAAA,MAAM,MAAM,EAAE,MA8Vb,CAAC;eAEa,MAAM"}
|
package/dist/lint-gate.d.ts
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* lint-gate plugin — PreToolUse hook that runs biome (or eslint) on
|
|
5
|
-
* the would-be file content before `write` or `edit` commits it.
|
|
6
|
-
*
|
|
7
|
-
* Tools registered:
|
|
8
|
-
* - lint_gate_status : Show config, linter, and per-session counters.
|
|
9
|
-
*
|
|
10
|
-
* Hooks registered:
|
|
11
|
-
* - PreToolUse with matcher `write|edit`. For `write`, the full
|
|
12
|
-
* content is available in `toolInput.content` — it's written to a
|
|
13
|
-
* temp file and linted. For `edit`, the current file is read, the
|
|
14
|
-
* `old_string → new_string` replacement is applied in-memory, and
|
|
15
|
-
* the result is linted.
|
|
16
|
-
*
|
|
17
|
-
* Config (`config.extensions['lint-gate']`):
|
|
18
|
-
*
|
|
19
|
-
* ```jsonc
|
|
20
|
-
* {
|
|
21
|
-
* "linter": "biome", // "biome" | "eslint" | "auto"
|
|
22
|
-
* "mode": "warn", // "block" (refuse the call) | "warn" (inject context)
|
|
23
|
-
* "severity": "error", // minimum severity to act on: "error" | "warning"
|
|
24
|
-
* "timeoutMs": 10000 // linter process timeout
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
declare const plugin: Plugin;
|
|
32
|
-
|
|
33
|
-
export { plugin as default };
|
|
1
|
+
export * from './lint-gate/index.js';
|
|
2
|
+
export { default } from './lint-gate/index.js';
|
package/dist/lint-gate.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { execFile } from 'child_process';
|
|
2
|
-
import { readFile, mkdtemp, writeFile, rm } from 'fs/promises';
|
|
3
|
-
import { tmpdir } from 'os';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
|
|
6
1
|
// src/lint-gate/index.ts
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
7
6
|
var API_VERSION = "^0.1.10";
|
|
8
7
|
var state = {
|
|
9
8
|
/** Total PreToolUse invocations. */
|
|
@@ -426,5 +425,6 @@ ${summary}${truncated}`
|
|
|
426
425
|
}
|
|
427
426
|
};
|
|
428
427
|
var lint_gate_default = plugin;
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
export {
|
|
429
|
+
lint_gate_default as default
|
|
430
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* llm-cache plugin — caches identical provider requests and skips the
|
|
3
|
+
* provider call entirely on a hit.
|
|
4
|
+
*
|
|
5
|
+
* This is the deepest intervention a plugin can make: it registers an
|
|
6
|
+
* `AgentExtension.wrapProviderRunner`, which the agent loop composes
|
|
7
|
+
* around EVERY provider call (`agent-loop.ts` → `extensions
|
|
8
|
+
* .wrapProviderRunner(baseRunner)`). The plugin fingerprints the
|
|
9
|
+
* outgoing `Request` (model + system + messages + tools + sampling
|
|
10
|
+
* params) and, on a match, returns the cached `Response` without ever
|
|
11
|
+
* touching the network — killing redundant calls from retries, loops,
|
|
12
|
+
* and re-runs.
|
|
13
|
+
*
|
|
14
|
+
* Safety posture: caching changes call semantics (a repeated request
|
|
15
|
+
* returns the same answer instead of a fresh sample), so the plugin is
|
|
16
|
+
* **opt-in** — it loads inert and does nothing until
|
|
17
|
+
* `config.extensions['llm-cache'].enabled = true`. By default it only
|
|
18
|
+
* caches deterministic requests (`temperature` 0 or unset) so a
|
|
19
|
+
* sampled generation is never silently frozen.
|
|
20
|
+
*
|
|
21
|
+
* Config (`config.extensions['llm-cache']`):
|
|
22
|
+
*
|
|
23
|
+
* ```jsonc
|
|
24
|
+
* {
|
|
25
|
+
* "enabled": false, // master switch (default OFF)
|
|
26
|
+
* "maxEntries": 256, // LRU capacity
|
|
27
|
+
* "ttlMs": 0, // 0 = no expiry; else evict after N ms
|
|
28
|
+
* "onlyDeterministic": true, // only cache temperature 0/unset requests
|
|
29
|
+
* "zeroUsageOnHit": false // report 0 tokens on a hit (true) or keep
|
|
30
|
+
* // the cached usage for context accounting (false)
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* Tools:
|
|
35
|
+
* - `llm_cache_status` — hit/miss/skip counters, size, config
|
|
36
|
+
* - `llm_cache_clear` — drop all cached entries
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
import type { Plugin } from '@wrongstack/core';
|
|
41
|
+
/**
|
|
42
|
+
* Whether a request is safe to cache under `onlyDeterministic`. Sampled
|
|
43
|
+
* requests (temperature > 0) return different content each call, so
|
|
44
|
+
* caching them would silently freeze the first sample.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isDeterministic(request: Record<string, unknown>): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Stable fingerprint of the request fields that affect the response.
|
|
49
|
+
* Excludes anything cosmetic (user id, etc.). Same inputs → same key.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fingerprintRequest(request: Record<string, unknown>): string;
|
|
52
|
+
declare const plugin: Plugin;
|
|
53
|
+
export default plugin;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm-cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AAwF1D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAGzE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAiB3E;AAkCD,QAAA,MAAM,MAAM,EAAE,MAkNb,CAAC;eAEa,MAAM"}
|
package/dist/llm-cache.d.ts
CHANGED
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* llm-cache plugin — caches identical provider requests and skips the
|
|
5
|
-
* provider call entirely on a hit.
|
|
6
|
-
*
|
|
7
|
-
* This is the deepest intervention a plugin can make: it registers an
|
|
8
|
-
* `AgentExtension.wrapProviderRunner`, which the agent loop composes
|
|
9
|
-
* around EVERY provider call (`agent-loop.ts` → `extensions
|
|
10
|
-
* .wrapProviderRunner(baseRunner)`). The plugin fingerprints the
|
|
11
|
-
* outgoing `Request` (model + system + messages + tools + sampling
|
|
12
|
-
* params) and, on a match, returns the cached `Response` without ever
|
|
13
|
-
* touching the network — killing redundant calls from retries, loops,
|
|
14
|
-
* and re-runs.
|
|
15
|
-
*
|
|
16
|
-
* Safety posture: caching changes call semantics (a repeated request
|
|
17
|
-
* returns the same answer instead of a fresh sample), so the plugin is
|
|
18
|
-
* **opt-in** — it loads inert and does nothing until
|
|
19
|
-
* `config.extensions['llm-cache'].enabled = true`. By default it only
|
|
20
|
-
* caches deterministic requests (`temperature` 0 or unset) so a
|
|
21
|
-
* sampled generation is never silently frozen.
|
|
22
|
-
*
|
|
23
|
-
* Config (`config.extensions['llm-cache']`):
|
|
24
|
-
*
|
|
25
|
-
* ```jsonc
|
|
26
|
-
* {
|
|
27
|
-
* "enabled": false, // master switch (default OFF)
|
|
28
|
-
* "maxEntries": 256, // LRU capacity
|
|
29
|
-
* "ttlMs": 0, // 0 = no expiry; else evict after N ms
|
|
30
|
-
* "onlyDeterministic": true, // only cache temperature 0/unset requests
|
|
31
|
-
* "zeroUsageOnHit": false // report 0 tokens on a hit (true) or keep
|
|
32
|
-
* // the cached usage for context accounting (false)
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* Tools:
|
|
37
|
-
* - `llm_cache_status` — hit/miss/skip counters, size, config
|
|
38
|
-
* - `llm_cache_clear` — drop all cached entries
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Whether a request is safe to cache under `onlyDeterministic`. Sampled
|
|
45
|
-
* requests (temperature > 0) return different content each call, so
|
|
46
|
-
* caching them would silently freeze the first sample.
|
|
47
|
-
*/
|
|
48
|
-
declare function isDeterministic(request: Record<string, unknown>): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Stable fingerprint of the request fields that affect the response.
|
|
51
|
-
* Excludes anything cosmetic (user id, etc.). Same inputs → same key.
|
|
52
|
-
*/
|
|
53
|
-
declare function fingerprintRequest(request: Record<string, unknown>): string;
|
|
54
|
-
declare const plugin: Plugin;
|
|
55
|
-
|
|
56
|
-
export { plugin as default, fingerprintRequest, isDeterministic };
|
|
1
|
+
export * from './llm-cache/index.js';
|
|
2
|
+
export { default } from './llm-cache/index.js';
|
package/dist/llm-cache.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createHash } from 'crypto';
|
|
2
|
-
|
|
3
1
|
// src/llm-cache/index.ts
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
4
3
|
var state = {
|
|
5
4
|
cache: /* @__PURE__ */ new Map(),
|
|
6
5
|
hits: 0,
|
|
@@ -252,5 +251,8 @@ var plugin = {
|
|
|
252
251
|
}
|
|
253
252
|
};
|
|
254
253
|
var llm_cache_default = plugin;
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
export {
|
|
255
|
+
llm_cache_default as default,
|
|
256
|
+
fingerprintRequest,
|
|
257
|
+
isDeterministic
|
|
258
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loop-breaker/index.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAqP/C,QAAA,MAAM,MAAM,EAAE,MA6Yb,CAAC;eAEa,MAAM"}
|