@wrongstack/plugins 0.284.1 → 0.286.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 +10 -15
- 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 +6 -7
- 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 +13 -15
- 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 +8 -9
- 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 +6 -7
- 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 +992 -454
- 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 +6 -7
- 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 +6 -7
- 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 +16 -17
- 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 +6 -6
- 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 +20086 -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 +19 -20
- 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
package/dist/todo-listener.d.ts
CHANGED
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* todo-listener plugin — PostToolUse hook on the `todo` tool that
|
|
5
|
-
* broadcasts a structured status update to the project mailbox.
|
|
6
|
-
*
|
|
7
|
-
* When the agent (or any plugin) calls the built-in `todo` tool, the
|
|
8
|
-
* full todo list is replaced in `ctx.todos`. The hook fires after the
|
|
9
|
-
* tool completes, reads the new state, and posts a compact summary
|
|
10
|
-
* to the project mailbox so that other agents in the same project
|
|
11
|
-
* (terminals, WebUIs, shadow agents) can see what this agent is
|
|
12
|
-
* working on in real time.
|
|
13
|
-
*
|
|
14
|
-
* Use cases:
|
|
15
|
-
* - Multi-agent fleets where a coordinator should know which
|
|
16
|
-
* sub-agent is working on which item
|
|
17
|
-
* - Long-running sessions where a user opens a second terminal and
|
|
18
|
-
* wants to see the in-progress plan
|
|
19
|
-
* - Shadow agents that audit progress across the project
|
|
20
|
-
*
|
|
21
|
-
* Config (`config.extensions['todo-listener']`):
|
|
22
|
-
*
|
|
23
|
-
* ```jsonc
|
|
24
|
-
* {
|
|
25
|
-
* "enabled": false,
|
|
26
|
-
* "subjectPrefix": "todo: ",
|
|
27
|
-
* "broadcastOnChange": true,
|
|
28
|
-
* "cooldownMs": 30000
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
declare const plugin: Plugin;
|
|
36
|
-
|
|
37
|
-
export { plugin as default };
|
|
1
|
+
export * from './todo-listener/index.js';
|
|
2
|
+
export { default } from './todo-listener/index.js';
|
package/dist/todo-listener.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/todo-tracker/index.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAmK/C,QAAA,MAAM,MAAM,EAAE,MAsZb,CAAC;eAEa,MAAM"}
|
package/dist/todo-tracker.d.ts
CHANGED
package/dist/todo-tracker.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as fsp from 'fs/promises';
|
|
2
|
-
import { randomUUID } from 'crypto';
|
|
3
|
-
|
|
4
1
|
// src/todo-tracker/index.ts
|
|
2
|
+
import * as fsp from "node:fs/promises";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
5
4
|
function deriveFilePath(api) {
|
|
6
5
|
const raw = api.config.extensions?.["todo-tracker"];
|
|
7
6
|
const explicit = typeof raw?.["filePath"] === "string" ? raw["filePath"] : null;
|
|
@@ -437,5 +436,6 @@ var plugin = {
|
|
|
437
436
|
}
|
|
438
437
|
};
|
|
439
438
|
var todo_tracker_default = plugin;
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
export {
|
|
440
|
+
todo_tracker_default as default
|
|
441
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* token-budget plugin — Enforces a per-session token budget.
|
|
3
|
+
*
|
|
4
|
+
* Complements cost-tracker (which tracks but does not enforce).
|
|
5
|
+
* When token usage crosses the warning threshold, injects a "wrap up"
|
|
6
|
+
* signal into the LLM's context. When it crosses the hard limit,
|
|
7
|
+
* triggers a Stop hook to end the agent loop.
|
|
8
|
+
*
|
|
9
|
+
* Tools registered:
|
|
10
|
+
* - token_budget_status : Show budget limit, current usage, percent
|
|
11
|
+
* consumed, and whether the warning/stop
|
|
12
|
+
* threshold has been crossed.
|
|
13
|
+
*
|
|
14
|
+
* Hooks registered:
|
|
15
|
+
* - Stop : checks whether the budget is exhausted; if so, returns
|
|
16
|
+
* `decision: 'block'` with a reason so the agent loop does
|
|
17
|
+
* not continue.
|
|
18
|
+
*
|
|
19
|
+
* Events subscribed:
|
|
20
|
+
* - provider.response : accumulates prompt + completion tokens.
|
|
21
|
+
*
|
|
22
|
+
* Config surface (`config.extensions['token-budget']`):
|
|
23
|
+
*
|
|
24
|
+
* ```jsonc
|
|
25
|
+
* {
|
|
26
|
+
* "limit": 500000, // hard token limit (prompt + completion)
|
|
27
|
+
* "warnPercent": 80, // inject "wrap up" at this % of limit
|
|
28
|
+
* "stopPercent": 100, // trigger Stop at this % of limit
|
|
29
|
+
* "model": null // null = all models; or restrict to one
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
import type { Plugin } from '@wrongstack/core';
|
|
36
|
+
declare const plugin: Plugin;
|
|
37
|
+
export default plugin;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/token-budget/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAqF/C,QAAA,MAAM,MAAM,EAAE,MA8Qb,CAAC;eAEa,MAAM"}
|
package/dist/token-budget.d.ts
CHANGED
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* token-budget plugin — Enforces a per-session token budget.
|
|
5
|
-
*
|
|
6
|
-
* Complements cost-tracker (which tracks but does not enforce).
|
|
7
|
-
* When token usage crosses the warning threshold, injects a "wrap up"
|
|
8
|
-
* signal into the LLM's context. When it crosses the hard limit,
|
|
9
|
-
* triggers a Stop hook to end the agent loop.
|
|
10
|
-
*
|
|
11
|
-
* Tools registered:
|
|
12
|
-
* - token_budget_status : Show budget limit, current usage, percent
|
|
13
|
-
* consumed, and whether the warning/stop
|
|
14
|
-
* threshold has been crossed.
|
|
15
|
-
*
|
|
16
|
-
* Hooks registered:
|
|
17
|
-
* - Stop : checks whether the budget is exhausted; if so, returns
|
|
18
|
-
* `decision: 'block'` with a reason so the agent loop does
|
|
19
|
-
* not continue.
|
|
20
|
-
*
|
|
21
|
-
* Events subscribed:
|
|
22
|
-
* - provider.response : accumulates prompt + completion tokens.
|
|
23
|
-
*
|
|
24
|
-
* Config surface (`config.extensions['token-budget']`):
|
|
25
|
-
*
|
|
26
|
-
* ```jsonc
|
|
27
|
-
* {
|
|
28
|
-
* "limit": 500000, // hard token limit (prompt + completion)
|
|
29
|
-
* "warnPercent": 80, // inject "wrap up" at this % of limit
|
|
30
|
-
* "stopPercent": 100, // trigger Stop at this % of limit
|
|
31
|
-
* "model": null // null = all models; or restrict to one
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
declare const plugin: Plugin;
|
|
39
|
-
|
|
40
|
-
export { plugin as default };
|
|
1
|
+
export * from './token-budget/index.js';
|
|
2
|
+
export { default } from './token-budget/index.js';
|
package/dist/token-budget.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* token-throttle plugin — enforces a rolling-window token budget on the
|
|
3
|
+
* provider wire, delaying calls to stay under a rate limit.
|
|
4
|
+
*
|
|
5
|
+
* Registers an `AgentExtension.wrapProviderRunner`. Before each provider
|
|
6
|
+
* call it prunes a 60-second sliding window of recorded spend, estimates
|
|
7
|
+
* the outgoing request's tokens, and if the window's spend plus the
|
|
8
|
+
* estimate would exceed `tokensPerMinute`, it sleeps just long enough for
|
|
9
|
+
* older spend to age out of the window (capped at `maxDelayMs`). After
|
|
10
|
+
* the call it records the response's actual usage. This smooths bursty
|
|
11
|
+
* agent loops under a provider's TPM limit instead of hitting 429s.
|
|
12
|
+
*
|
|
13
|
+
* Safety posture: opt-in — loads inert until
|
|
14
|
+
* `config.extensions['token-throttle'].enabled = true`. Delay is bounded
|
|
15
|
+
* by `maxDelayMs` so a mis-set budget can never hang the agent
|
|
16
|
+
* indefinitely.
|
|
17
|
+
*
|
|
18
|
+
* Config (`config.extensions['token-throttle']`):
|
|
19
|
+
*
|
|
20
|
+
* ```jsonc
|
|
21
|
+
* {
|
|
22
|
+
* "enabled": false,
|
|
23
|
+
* "tokensPerMinute": 100000, // rolling-window budget
|
|
24
|
+
* "maxDelayMs": 30000, // hard cap on any single wait
|
|
25
|
+
* "charsPerToken": 4 // request-size → token estimate divisor
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Tools:
|
|
30
|
+
* - `token_throttle_status` — window spend, throttle counters, total delay
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
import type { Plugin } from '@wrongstack/core';
|
|
35
|
+
export interface SpendEntry {
|
|
36
|
+
at: number;
|
|
37
|
+
tokens: number;
|
|
38
|
+
}
|
|
39
|
+
/** Drop entries older than the 60s window relative to `now`. */
|
|
40
|
+
export declare function pruneWindow(entries: SpendEntry[], now: number): SpendEntry[];
|
|
41
|
+
/** Sum tokens currently in the window. */
|
|
42
|
+
export declare function windowSpend(entries: SpendEntry[]): number;
|
|
43
|
+
/**
|
|
44
|
+
* Delay (ms) needed before a request of `projected` tokens can proceed
|
|
45
|
+
* without the window exceeding `limit`. 0 when it already fits. Computed
|
|
46
|
+
* by aging out just enough of the oldest spend: we find the earliest
|
|
47
|
+
* point at which enough tokens have expired to make room.
|
|
48
|
+
*/
|
|
49
|
+
export declare function computeThrottleDelay(entries: SpendEntry[], now: number, limit: number, projected: number): number;
|
|
50
|
+
declare const plugin: Plugin;
|
|
51
|
+
export default plugin;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/token-throttle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AA8C1D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CAE5E;AAED,0CAA0C;AAC1C,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,UAAU,EAAE,EACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,CAoBR;AA4CD,QAAA,MAAM,MAAM,EAAE,MAoKb,CAAC;eAEa,MAAM"}
|
package/dist/token-throttle.d.ts
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* token-throttle plugin — enforces a rolling-window token budget on the
|
|
5
|
-
* provider wire, delaying calls to stay under a rate limit.
|
|
6
|
-
*
|
|
7
|
-
* Registers an `AgentExtension.wrapProviderRunner`. Before each provider
|
|
8
|
-
* call it prunes a 60-second sliding window of recorded spend, estimates
|
|
9
|
-
* the outgoing request's tokens, and if the window's spend plus the
|
|
10
|
-
* estimate would exceed `tokensPerMinute`, it sleeps just long enough for
|
|
11
|
-
* older spend to age out of the window (capped at `maxDelayMs`). After
|
|
12
|
-
* the call it records the response's actual usage. This smooths bursty
|
|
13
|
-
* agent loops under a provider's TPM limit instead of hitting 429s.
|
|
14
|
-
*
|
|
15
|
-
* Safety posture: opt-in — loads inert until
|
|
16
|
-
* `config.extensions['token-throttle'].enabled = true`. Delay is bounded
|
|
17
|
-
* by `maxDelayMs` so a mis-set budget can never hang the agent
|
|
18
|
-
* indefinitely.
|
|
19
|
-
*
|
|
20
|
-
* Config (`config.extensions['token-throttle']`):
|
|
21
|
-
*
|
|
22
|
-
* ```jsonc
|
|
23
|
-
* {
|
|
24
|
-
* "enabled": false,
|
|
25
|
-
* "tokensPerMinute": 100000, // rolling-window budget
|
|
26
|
-
* "maxDelayMs": 30000, // hard cap on any single wait
|
|
27
|
-
* "charsPerToken": 4 // request-size → token estimate divisor
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* Tools:
|
|
32
|
-
* - `token_throttle_status` — window spend, throttle counters, total delay
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
interface SpendEntry {
|
|
38
|
-
at: number;
|
|
39
|
-
tokens: number;
|
|
40
|
-
}
|
|
41
|
-
/** Drop entries older than the 60s window relative to `now`. */
|
|
42
|
-
declare function pruneWindow(entries: SpendEntry[], now: number): SpendEntry[];
|
|
43
|
-
/** Sum tokens currently in the window. */
|
|
44
|
-
declare function windowSpend(entries: SpendEntry[]): number;
|
|
45
|
-
/**
|
|
46
|
-
* Delay (ms) needed before a request of `projected` tokens can proceed
|
|
47
|
-
* without the window exceeding `limit`. 0 when it already fits. Computed
|
|
48
|
-
* by aging out just enough of the oldest spend: we find the earliest
|
|
49
|
-
* point at which enough tokens have expired to make room.
|
|
50
|
-
*/
|
|
51
|
-
declare function computeThrottleDelay(entries: SpendEntry[], now: number, limit: number, projected: number): number;
|
|
52
|
-
declare const plugin: Plugin;
|
|
53
|
-
|
|
54
|
-
export { type SpendEntry, computeThrottleDelay, plugin as default, pruneWindow, windowSpend };
|
|
1
|
+
export * from './token-throttle/index.js';
|
|
2
|
+
export { default } from './token-throttle/index.js';
|
package/dist/token-throttle.js
CHANGED
|
@@ -204,5 +204,9 @@ var plugin = {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
var token_throttle_default = plugin;
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
export {
|
|
208
|
+
computeThrottleDelay,
|
|
209
|
+
token_throttle_default as default,
|
|
210
|
+
pruneWindow,
|
|
211
|
+
windowSpend
|
|
212
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* type-gate plugin — PostToolUse hook that runs TypeScript type-checking
|
|
3
|
+
* after every `write` or `edit` to a source file.
|
|
4
|
+
*
|
|
5
|
+
* `lint-gate` validates style; this plugin validates types. It runs
|
|
6
|
+
* `tsc --noEmit` (or a user-supplied command) and injects the first few
|
|
7
|
+
* errors as `additionalContext` so the model can fix type regressions in
|
|
8
|
+
* the same turn.
|
|
9
|
+
*
|
|
10
|
+
* Tools registered:
|
|
11
|
+
* - type_gate_status : Show config + per-session counters.
|
|
12
|
+
*
|
|
13
|
+
* Hooks registered:
|
|
14
|
+
* - PostToolUse with matcher `write|edit`.
|
|
15
|
+
*
|
|
16
|
+
* Config (`config.extensions['type-gate']`):
|
|
17
|
+
*
|
|
18
|
+
* ```jsonc
|
|
19
|
+
* {
|
|
20
|
+
* "enabled": true,
|
|
21
|
+
* "command": "npx tsc --noEmit", // base type-check command
|
|
22
|
+
* "tsConfigPath": "tsconfig.json",
|
|
23
|
+
* "timeoutMs": 60000,
|
|
24
|
+
* "failSeverity": "warn", // "warn" | "block"
|
|
25
|
+
* "maxErrors": 5, // errors shown in context
|
|
26
|
+
* "runOnChange": [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"]
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
import type { Plugin } from '@wrongstack/core';
|
|
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/type-gate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AA6M/C,QAAA,MAAM,MAAM,EAAE,MAiOb,CAAC;eAEa,MAAM"}
|
package/dist/type-gate.d.ts
CHANGED
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* type-gate plugin — PostToolUse hook that runs TypeScript type-checking
|
|
5
|
-
* after every `write` or `edit` to a source file.
|
|
6
|
-
*
|
|
7
|
-
* `lint-gate` validates style; this plugin validates types. It runs
|
|
8
|
-
* `tsc --noEmit` (or a user-supplied command) and injects the first few
|
|
9
|
-
* errors as `additionalContext` so the model can fix type regressions in
|
|
10
|
-
* the same turn.
|
|
11
|
-
*
|
|
12
|
-
* Tools registered:
|
|
13
|
-
* - type_gate_status : Show config + per-session counters.
|
|
14
|
-
*
|
|
15
|
-
* Hooks registered:
|
|
16
|
-
* - PostToolUse with matcher `write|edit`.
|
|
17
|
-
*
|
|
18
|
-
* Config (`config.extensions['type-gate']`):
|
|
19
|
-
*
|
|
20
|
-
* ```jsonc
|
|
21
|
-
* {
|
|
22
|
-
* "enabled": true,
|
|
23
|
-
* "command": "npx tsc --noEmit", // base type-check command
|
|
24
|
-
* "tsConfigPath": "tsconfig.json",
|
|
25
|
-
* "timeoutMs": 60000,
|
|
26
|
-
* "failSeverity": "warn", // "warn" | "block"
|
|
27
|
-
* "maxErrors": 5, // errors shown in context
|
|
28
|
-
* "runOnChange": [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts"]
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
declare const plugin: Plugin;
|
|
36
|
-
|
|
37
|
-
export { plugin as default };
|
|
1
|
+
export * from './type-gate/index.js';
|
|
2
|
+
export { default } from './type-gate/index.js';
|