@dv.nghiem/flowdeck 0.4.3 → 0.4.5
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/agents/risk-analyst.d.ts.map +1 -1
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +22 -73
- package/dist/hooks/approval-hook.d.ts.map +1 -1
- package/dist/hooks/event-log-hook.d.ts +12 -0
- package/dist/hooks/event-log-hook.d.ts.map +1 -0
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/patch-trust.d.ts +0 -1
- package/dist/hooks/patch-trust.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +634 -823
- package/dist/lib/impact-radar.d.ts.map +1 -1
- package/dist/services/agent-validator.d.ts +1 -1
- package/dist/services/agent-validator.d.ts.map +1 -1
- package/dist/services/event-logger.d.ts +18 -0
- package/dist/services/event-logger.d.ts.map +1 -0
- package/dist/services/supervisor-binding.d.ts.map +1 -1
- package/dist/services/token-metrics.d.ts +1 -1
- package/dist/services/workflow-scorecard.d.ts.map +1 -1
- package/dist/tools/delegate.d.ts.map +1 -1
- package/dist/tools/run-pipeline.d.ts.map +1 -1
- package/docs/commands/fd-deploy-check.md +1 -5
- package/docs/commands/fd-reflect.md +8 -9
- package/docs/commands/fd-suggest.md +3 -4
- package/docs/concepts/architecture.md +0 -3
- package/docs/concepts/intelligence.md +2 -36
- package/docs/skills/index.md +0 -2
- package/package.json +2 -2
- package/src/commands/fd-deploy-check.md +1 -5
- package/src/commands/fd-reflect.md +4 -6
- package/src/commands/fd-suggest.md +3 -4
- package/src/skills/change-impact-radar/SKILL.md +3 -4
- package/src/skills/confidence-aware-planning/SKILL.md +0 -1
- package/src/skills/patch-trust-score/SKILL.md +3 -5
- package/dist/dashboard/lib/port-finder.test.d.ts +0 -2
- package/dist/dashboard/lib/port-finder.test.d.ts.map +0 -1
- package/dist/hooks/notifications.test.d.ts +0 -14
- package/dist/hooks/notifications.test.d.ts.map +0 -1
- package/dist/hooks/patch-trust.test.d.ts +0 -2
- package/dist/hooks/patch-trust.test.d.ts.map +0 -1
- package/dist/hooks/telemetry-hook.d.ts +0 -32
- package/dist/hooks/telemetry-hook.d.ts.map +0 -1
- package/dist/hooks/telemetry-hook.test.d.ts +0 -2
- package/dist/hooks/telemetry-hook.test.d.ts.map +0 -1
- package/dist/hooks/tool-guard.test.d.ts +0 -2
- package/dist/hooks/tool-guard.test.d.ts.map +0 -1
- package/dist/lib/research-gate.test.d.ts +0 -2
- package/dist/lib/research-gate.test.d.ts.map +0 -1
- package/dist/services/artifact-store.d.ts +0 -39
- package/dist/services/artifact-store.d.ts.map +0 -1
- package/dist/services/artifact-store.test.d.ts +0 -2
- package/dist/services/artifact-store.test.d.ts.map +0 -1
- package/dist/services/codegraph.test.d.ts +0 -2
- package/dist/services/codegraph.test.d.ts.map +0 -1
- package/dist/services/command-validator.test.d.ts +0 -2
- package/dist/services/command-validator.test.d.ts.map +0 -1
- package/dist/services/context-assembler.d.ts +0 -29
- package/dist/services/context-assembler.d.ts.map +0 -1
- package/dist/services/context-assembler.test.d.ts +0 -2
- package/dist/services/context-assembler.test.d.ts.map +0 -1
- package/dist/services/cost-budget.d.ts +0 -53
- package/dist/services/cost-budget.d.ts.map +0 -1
- package/dist/services/cost-budget.test.d.ts +0 -2
- package/dist/services/cost-budget.test.d.ts.map +0 -1
- package/dist/services/cost-estimator.test.d.ts +0 -2
- package/dist/services/cost-estimator.test.d.ts.map +0 -1
- package/dist/services/draft-verifier.d.ts +0 -48
- package/dist/services/draft-verifier.d.ts.map +0 -1
- package/dist/services/draft-verifier.test.d.ts +0 -2
- package/dist/services/draft-verifier.test.d.ts.map +0 -1
- package/dist/services/governance.test.d.ts +0 -11
- package/dist/services/governance.test.d.ts.map +0 -1
- package/dist/services/index.d.ts +0 -25
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/lazy-rule-loader.test.d.ts +0 -23
- package/dist/services/lazy-rule-loader.test.d.ts.map +0 -1
- package/dist/services/model-router-ext.test.d.ts +0 -2
- package/dist/services/model-router-ext.test.d.ts.map +0 -1
- package/dist/services/model-router.test.d.ts +0 -2
- package/dist/services/model-router.test.d.ts.map +0 -1
- package/dist/services/policy-compiler.d.ts +0 -27
- package/dist/services/policy-compiler.d.ts.map +0 -1
- package/dist/services/preflight-explorer.test.d.ts +0 -25
- package/dist/services/preflight-explorer.test.d.ts.map +0 -1
- package/dist/services/prompt-cache-ext.test.d.ts +0 -2
- package/dist/services/prompt-cache-ext.test.d.ts.map +0 -1
- package/dist/services/prompt-cache.test.d.ts +0 -2
- package/dist/services/prompt-cache.test.d.ts.map +0 -1
- package/dist/services/quick-router.test.d.ts +0 -13
- package/dist/services/quick-router.test.d.ts.map +0 -1
- package/dist/services/recommended-question.test.d.ts +0 -2
- package/dist/services/recommended-question.test.d.ts.map +0 -1
- package/dist/services/rtk-manager.test.d.ts +0 -2
- package/dist/services/rtk-manager.test.d.ts.map +0 -1
- package/dist/services/rtk-policy.test.d.ts +0 -2
- package/dist/services/rtk-policy.test.d.ts.map +0 -1
- package/dist/services/rule-engine.d.ts +0 -29
- package/dist/services/rule-engine.d.ts.map +0 -1
- package/dist/services/rule-engine.test.d.ts +0 -2
- package/dist/services/rule-engine.test.d.ts.map +0 -1
- package/dist/services/services.test.d.ts +0 -2
- package/dist/services/services.test.d.ts.map +0 -1
- package/dist/services/supervisor.test.d.ts +0 -14
- package/dist/services/supervisor.test.d.ts.map +0 -1
- package/dist/services/task-batcher.d.ts +0 -48
- package/dist/services/task-batcher.d.ts.map +0 -1
- package/dist/services/task-batcher.test.d.ts +0 -2
- package/dist/services/task-batcher.test.d.ts.map +0 -1
- package/dist/services/telemetry.d.ts +0 -40
- package/dist/services/telemetry.d.ts.map +0 -1
- package/dist/services/token-budget.d.ts +0 -44
- package/dist/services/token-budget.d.ts.map +0 -1
- package/dist/services/token-budget.test.d.ts +0 -2
- package/dist/services/token-budget.test.d.ts.map +0 -1
- package/dist/services/token-metrics-ext.test.d.ts +0 -2
- package/dist/services/token-metrics-ext.test.d.ts.map +0 -1
- package/dist/services/token-metrics.test.d.ts +0 -2
- package/dist/services/token-metrics.test.d.ts.map +0 -1
- package/dist/tools/agent-dispatch.test.d.ts +0 -2
- package/dist/tools/agent-dispatch.test.d.ts.map +0 -1
- package/dist/tools/codebase-index.test.d.ts +0 -2
- package/dist/tools/codebase-index.test.d.ts.map +0 -1
- package/dist/tools/context-generator.d.ts +0 -3
- package/dist/tools/context-generator.d.ts.map +0 -1
- package/dist/tools/create-skill.d.ts +0 -3
- package/dist/tools/create-skill.d.ts.map +0 -1
- package/dist/tools/dispatch-routing.test.d.ts +0 -2
- package/dist/tools/dispatch-routing.test.d.ts.map +0 -1
- package/dist/tools/failure-replay.test.d.ts +0 -2
- package/dist/tools/failure-replay.test.d.ts.map +0 -1
- package/dist/tools/repo-memory.test.d.ts +0 -2
- package/dist/tools/repo-memory.test.d.ts.map +0 -1
- package/dist/tools/volatility-map.d.ts +0 -18
- package/dist/tools/volatility-map.d.ts.map +0 -1
- package/dist/tools/volatility-map.test.d.ts +0 -2
- package/dist/tools/volatility-map.test.d.ts.map +0 -1
- package/dist/tools/workspace-state.d.ts +0 -3
- package/dist/tools/workspace-state.d.ts.map +0 -1
- package/src/skills/volatility-map/SKILL.md +0 -52
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cost Budget Service
|
|
3
|
-
*
|
|
4
|
-
* Enforces per-workflow cost and token ceilings.
|
|
5
|
-
* Complements delegation-budget.ts (which counts calls/retries/depth) by tracking
|
|
6
|
-
* estimated USD spend and token consumption across a workflow run.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* const result = checkCostBudget(dir, workflowId, { inputTokensDelta: 5000, costUSDDelta: 0.015 }, cfg)
|
|
10
|
-
* if (result.status === "exhausted") throw new Error(result.message)
|
|
11
|
-
*/
|
|
12
|
-
import { loadFlowDeckConfig } from "../config";
|
|
13
|
-
export interface CostBudgetState {
|
|
14
|
-
workflow_id: string;
|
|
15
|
-
run_id: string;
|
|
16
|
-
started_at: string;
|
|
17
|
-
total_input_tokens: number;
|
|
18
|
-
total_output_tokens: number;
|
|
19
|
-
total_est_cost_usd: number;
|
|
20
|
-
call_count: number;
|
|
21
|
-
}
|
|
22
|
-
export type CostBudgetStatus = "ok" | "warned" | "exhausted";
|
|
23
|
-
export interface CostBudgetCheckResult {
|
|
24
|
-
status: CostBudgetStatus;
|
|
25
|
-
message: string;
|
|
26
|
-
state: CostBudgetState;
|
|
27
|
-
}
|
|
28
|
-
export interface CostDelta {
|
|
29
|
-
inputTokensDelta?: number;
|
|
30
|
-
outputTokensDelta?: number;
|
|
31
|
-
costUSDDelta?: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Apply a delta to the running budget state and check against configured limits.
|
|
35
|
-
* If no governance.costBudget is configured, always returns "ok".
|
|
36
|
-
*
|
|
37
|
-
* @param dir - project directory (for loading config and persisting state)
|
|
38
|
-
* @param workflowId - e.g. the GSD run id or workflow name
|
|
39
|
-
* @param runId - a unique id for this invocation (e.g. sessionID)
|
|
40
|
-
* @param delta - tokens/cost consumed by the current call
|
|
41
|
-
* @param cfg - optional pre-loaded budget config (avoids re-reading flowdeck.json)
|
|
42
|
-
*/
|
|
43
|
-
export declare function checkCostBudget(dir: string, workflowId: string, runId: string, delta: CostDelta, cfg?: ReturnType<typeof loadFlowDeckConfig>): CostBudgetCheckResult;
|
|
44
|
-
/**
|
|
45
|
-
* Read the current accumulated state for a workflow run without applying a delta.
|
|
46
|
-
* Returns null if no state exists yet.
|
|
47
|
-
*/
|
|
48
|
-
export declare function getCostBudgetState(dir: string, workflowId: string, runId: string): CostBudgetState | null;
|
|
49
|
-
/**
|
|
50
|
-
* Reset the budget state for a workflow run (e.g. at start of a new run).
|
|
51
|
-
*/
|
|
52
|
-
export declare function resetCostBudget(dir: string, workflowId: string, runId: string): void;
|
|
53
|
-
//# sourceMappingURL=cost-budget.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cost-budget.d.ts","sourceRoot":"","sources":["../../src/services/cost-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAI9C,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,QAAQ,GAAG,WAAW,CAAA;AAE5D,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,eAAe,CAAA;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AA8CD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,EAChB,GAAG,CAAC,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,GAC1C,qBAAqB,CAwDvB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,eAAe,GAAG,IAAI,CAGxB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIpF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cost-budget.test.d.ts","sourceRoot":"","sources":["../../src/services/cost-budget.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cost-estimator.test.d.ts","sourceRoot":"","sources":["../../src/services/cost-estimator.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Draft Verifier
|
|
3
|
-
*
|
|
4
|
-
* Implements draft-then-verify for agent calls. A cheap draft is checked
|
|
5
|
-
* against deterministic verifiers before deciding whether to escalate to
|
|
6
|
-
* an expensive model call.
|
|
7
|
-
*
|
|
8
|
-
* PHASE 1: Only rule-based (deterministic) verifiers are supported.
|
|
9
|
-
* Model-based verification is explicitly excluded to avoid turning 1 call into 2.
|
|
10
|
-
*
|
|
11
|
-
* Usage pattern:
|
|
12
|
-
* 1. Run cheap/draft agent → get draft response
|
|
13
|
-
* 2. Call verifyDraft(draft, verifiers)
|
|
14
|
-
* 3. If decision.accepted → return draft, skip expensive agent
|
|
15
|
-
* 4. If !decision.accepted → call expensive agent
|
|
16
|
-
*/
|
|
17
|
-
export type BuiltinVerifierType = "min_length" | "is_json" | "contains_key" | "matches_regex" | "is_nonempty" | "no_error_markers";
|
|
18
|
-
export interface BuiltinVerifier {
|
|
19
|
-
type: BuiltinVerifierType;
|
|
20
|
-
/** min_length: minimum character count after trimming */
|
|
21
|
-
min_chars?: number;
|
|
22
|
-
/** contains_key: substring that must appear in the response */
|
|
23
|
-
required_key?: string;
|
|
24
|
-
/** matches_regex: regex pattern string */
|
|
25
|
-
pattern?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface VerificationResult {
|
|
28
|
-
passed: boolean;
|
|
29
|
-
verifier: BuiltinVerifierType;
|
|
30
|
-
reason: string;
|
|
31
|
-
}
|
|
32
|
-
export interface DraftVerifyDecision {
|
|
33
|
-
/** True if all verifiers passed and the draft is acceptable. */
|
|
34
|
-
accepted: boolean;
|
|
35
|
-
verifications: VerificationResult[];
|
|
36
|
-
failures: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Run all verifiers against a draft response.
|
|
40
|
-
* ALL verifiers must pass for the draft to be accepted.
|
|
41
|
-
*/
|
|
42
|
-
export declare function verifyDraft(draft: string, verifiers: BuiltinVerifier[]): DraftVerifyDecision;
|
|
43
|
-
/**
|
|
44
|
-
* Return a default set of verifiers for a given task output type.
|
|
45
|
-
* Use as a starting point — callers can extend or replace.
|
|
46
|
-
*/
|
|
47
|
-
export declare function defaultVerifiers(taskType: "json_response" | "prose_response" | "classification"): BuiltinVerifier[];
|
|
48
|
-
//# sourceMappingURL=draft-verifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draft-verifier.d.ts","sourceRoot":"","sources":["../../src/services/draft-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,mBAAmB,GAC3B,YAAY,GACZ,SAAS,GACT,cAAc,GACd,eAAe,GACf,aAAa,GACb,kBAAkB,CAAA;AAEtB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAA;IACzB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAiBD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,mBAAmB,CAI5F;AAkFD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAC9D,eAAe,EAAE,CAsBnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"draft-verifier.test.d.ts","sourceRoot":"","sources":["../../src/services/draft-verifier.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"governance.test.d.ts","sourceRoot":"","sources":["../../src/services/governance.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/services/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from "./telemetry";
|
|
2
|
-
export * from "./run-trace";
|
|
3
|
-
export * from "./approval-manager";
|
|
4
|
-
export * from "./agent-performance";
|
|
5
|
-
export * from "./policy-compiler";
|
|
6
|
-
export * from "./agent-contract-registry";
|
|
7
|
-
export * from "./agent-validator";
|
|
8
|
-
export * from "./agent-trace-graph";
|
|
9
|
-
export * from "./delegation-budget";
|
|
10
|
-
export * from "./deadlock-detector";
|
|
11
|
-
export * from "./workflow-scorecard";
|
|
12
|
-
export * from "./token-metrics";
|
|
13
|
-
export * from "./model-router";
|
|
14
|
-
export * from "./context-assembler";
|
|
15
|
-
export * from "./prompt-cache";
|
|
16
|
-
export * from "./rule-engine";
|
|
17
|
-
export * from "./artifact-store";
|
|
18
|
-
export * from "./task-batcher";
|
|
19
|
-
export * from "./draft-verifier";
|
|
20
|
-
export * from "./token-budget";
|
|
21
|
-
export * from "./cost-estimator";
|
|
22
|
-
export * from "./cost-budget";
|
|
23
|
-
export * from "./rtk-manager";
|
|
24
|
-
export * from "./rtk-policy";
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lazy Rule Loader Tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - parseFrontmatter: correctly parses always_on, stages, languages arrays, and description
|
|
6
|
-
* - discoverRules: finds all .md files, caches results, skips README.md
|
|
7
|
-
* - selectRulePaths: always_on rules always included
|
|
8
|
-
* - selectRulePaths: language-mismatched rules skipped
|
|
9
|
-
* - selectRulePaths: language-matched rules included
|
|
10
|
-
* - selectRulePaths: stage filtering when stage is provided
|
|
11
|
-
* - selectRulePaths: stage-restricted rules still included when stage is absent
|
|
12
|
-
* - selectRulePaths: rules without frontmatter treated as always_on (fail-safe)
|
|
13
|
-
* - getStartupRulePaths: returns paths only for selected rules
|
|
14
|
-
* - detectProjectLanguages: detects TypeScript via tsconfig.json
|
|
15
|
-
* - detectProjectLanguages: detects Python via requirements.txt
|
|
16
|
-
* - detectProjectLanguages: detects Go via go.mod
|
|
17
|
-
* - detectProjectLanguages: detects Rust via Cargo.toml
|
|
18
|
-
* - buildSelectionDiagnostics: includes discovered/selected/skipped counts
|
|
19
|
-
* - invalidateRuleCache: clears cached discovery results
|
|
20
|
-
* - repeated loading suppressed (same dir returns cached metadata)
|
|
21
|
-
*/
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=lazy-rule-loader.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-rule-loader.test.d.ts","sourceRoot":"","sources":["../../src/services/lazy-rule-loader.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-router-ext.test.d.ts","sourceRoot":"","sources":["../../src/services/model-router-ext.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-router.test.d.ts","sourceRoot":"","sources":["../../src/services/model-router.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface PolicyContext {
|
|
2
|
-
command?: string;
|
|
3
|
-
file_path?: string;
|
|
4
|
-
change_description?: string;
|
|
5
|
-
tool?: string;
|
|
6
|
-
risk_score?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface PolicyViolation {
|
|
9
|
-
policy_id: string;
|
|
10
|
-
policy_name: string;
|
|
11
|
-
rule: string;
|
|
12
|
-
trigger: string;
|
|
13
|
-
severity: "block" | "warn";
|
|
14
|
-
}
|
|
15
|
-
export declare function evaluatePolicies(dir: string, ctx: PolicyContext): PolicyViolation[];
|
|
16
|
-
export interface ProposedPolicy {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
trigger: string;
|
|
20
|
-
rule: string;
|
|
21
|
-
source: "learned";
|
|
22
|
-
failure_count: number;
|
|
23
|
-
rationale: string;
|
|
24
|
-
}
|
|
25
|
-
export declare function learnFromFailure(failure_type: string, affected_paths: string[], root_cause?: string): ProposedPolicy | null;
|
|
26
|
-
export declare function formatViolations(violations: PolicyViolation[]): string;
|
|
27
|
-
//# sourceMappingURL=policy-compiler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy-compiler.d.ts","sourceRoot":"","sources":["../../src/services/policy-compiler.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAA;CAC3B;AAiCD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,eAAe,EAAE,CA8BnF;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB;AA+FD,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EAAE,EACxB,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,GAAG,IAAI,CAmBvB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CAUtE"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Preflight Explorer Tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - exploreRepo: discovers commands, agents, skills, tech stack from filesystem
|
|
6
|
-
* - canAnswerFromEvidence: correctly identifies suppressible questions
|
|
7
|
-
* - shouldSuppressQuestion: suppresses answered / duplicate questions
|
|
8
|
-
* - deriveTaskContext: narrows findings to task-relevant context
|
|
9
|
-
* - refineClassification: resolves ambiguous classification via evidence
|
|
10
|
-
* - createQuestionGuard: tracks asked questions and prevents duplicates
|
|
11
|
-
* - filterQuestions: returns only questions that pass the guard
|
|
12
|
-
* - needsSupervisorClarification: returns false when all questions are answered
|
|
13
|
-
* - classifyTaskWithContext: uses exploration to resolve ambiguity
|
|
14
|
-
* - createQuickRunState: persists exploration snapshot
|
|
15
|
-
* - /fd-quick performs codebase exploration before asking questions
|
|
16
|
-
* - /fd-discuss performs codebase exploration before asking questions
|
|
17
|
-
* - repo evidence prevents unnecessary human questions
|
|
18
|
-
* - supervisor-agent receives only genuine ambiguity
|
|
19
|
-
* - worker agents do not ask ad hoc questions
|
|
20
|
-
* - feature/bug/UI/docs tasks route correctly after preflight
|
|
21
|
-
* - exploration results are stored and reused
|
|
22
|
-
* - repeated question suppression works
|
|
23
|
-
*/
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=preflight-explorer.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"preflight-explorer.test.d.ts","sourceRoot":"","sources":["../../src/services/preflight-explorer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cache-ext.test.d.ts","sourceRoot":"","sources":["../../src/services/prompt-cache-ext.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cache.test.d.ts","sourceRoot":"","sources":["../../src/services/prompt-cache.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quick Router Tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - classifyTask: correctly classifies feature, bugfix, ui-feature, docs, simple, ambiguous
|
|
6
|
-
* - buildStageSequence: returns correct ordered stages for each task type
|
|
7
|
-
* - getNextStage: returns correct next stage and handles completed / blocked states
|
|
8
|
-
* - createQuickRunState: initialises state correctly
|
|
9
|
-
* - /fd-quick routing contracts (supervisor integration points are tested as
|
|
10
|
-
* integration-level expectations on the returned stage sequences)
|
|
11
|
-
*/
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=quick-router.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-router.test.d.ts","sourceRoot":"","sources":["../../src/services/quick-router.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recommended-question.test.d.ts","sourceRoot":"","sources":["../../src/services/recommended-question.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-manager.test.d.ts","sourceRoot":"","sources":["../../src/services/rtk-manager.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-policy.test.d.ts","sourceRoot":"","sources":["../../src/services/rtk-policy.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type CheckType = "file_exists" | "json_valid" | "detect_language" | "classify_command" | "is_nonempty" | "contains_keyword";
|
|
2
|
-
export interface CheckResult<T> {
|
|
3
|
-
type: CheckType;
|
|
4
|
-
value: T;
|
|
5
|
-
/** Always true — signals this result came from deterministic code, not a model. */
|
|
6
|
-
deterministic: true;
|
|
7
|
-
}
|
|
8
|
-
/** Check whether a file path exists on disk. */
|
|
9
|
-
export declare function checkFileExists(filePath: string): CheckResult<boolean>;
|
|
10
|
-
export interface JSONValidResult {
|
|
11
|
-
valid: boolean;
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
/** Check whether a string is valid JSON. */
|
|
15
|
-
export declare function checkJSONValid(text: string): CheckResult<JSONValidResult>;
|
|
16
|
-
/** Detect programming language from file extension. Returns null for unknown extensions. */
|
|
17
|
-
export declare function detectLanguage(filename: string): CheckResult<string | null>;
|
|
18
|
-
export type CommandClass = "read" | "write" | "delete" | "run" | "navigate" | "unknown";
|
|
19
|
-
/** Classify a tool/command name into its operational class. */
|
|
20
|
-
export declare function classifyCommandType(command: string): CheckResult<CommandClass>;
|
|
21
|
-
/** Check whether a string is non-empty after trimming. */
|
|
22
|
-
export declare function checkIsNonEmpty(text: string): CheckResult<boolean>;
|
|
23
|
-
export interface KeywordSearchResult {
|
|
24
|
-
found: boolean;
|
|
25
|
-
matched?: string;
|
|
26
|
-
}
|
|
27
|
-
/** Check whether a string contains any of the given keywords (case-insensitive). */
|
|
28
|
-
export declare function checkContainsKeyword(text: string, keywords: string[]): CheckResult<KeywordSearchResult>;
|
|
29
|
-
//# sourceMappingURL=rule-engine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-engine.d.ts","sourceRoot":"","sources":["../../src/services/rule-engine.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,GACb,kBAAkB,CAAA;AAEtB,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,CAAC,CAAA;IACR,mFAAmF;IACnF,aAAa,EAAE,IAAI,CAAA;CACpB;AAID,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAEtE;AAID,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAWzE;AA4BD,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAG3E;AAID,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,UAAU,GACV,SAAS,CAAA;AAUb,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,YAAY,CAAC,CAQ9E;AAID,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAElE;AAID,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAAE,GACjB,WAAW,CAAC,mBAAmB,CAAC,CAQlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rule-engine.test.d.ts","sourceRoot":"","sources":["../../src/services/rule-engine.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"services.test.d.ts","sourceRoot":"","sources":["../../src/services/services.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supervisor Binding Tests
|
|
3
|
-
*
|
|
4
|
-
* Covers:
|
|
5
|
-
* - Approves an existing valid command
|
|
6
|
-
* - Blocks an existing command with missing required stage
|
|
7
|
-
* - Blocks a workflow that violates policy
|
|
8
|
-
* - Does not invent new commands or workflows
|
|
9
|
-
* - Integrates with current orchestrator without breaking existing command routing
|
|
10
|
-
* - Only applied to already-registered commands/workflows
|
|
11
|
-
* - Missing command/workflow reported correctly
|
|
12
|
-
*/
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=supervisor.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.test.d.ts","sourceRoot":"","sources":["../../src/services/supervisor.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Batcher
|
|
3
|
-
*
|
|
4
|
-
* Coalesces multiple homogeneous cheap tasks into a single agent call.
|
|
5
|
-
* Reduces N session creations + system-prompt injections to 1 for
|
|
6
|
-
* classification/validation batches.
|
|
7
|
-
*
|
|
8
|
-
* SAFETY CONSTRAINTS:
|
|
9
|
-
* - Max 5 tasks per batch (avoid context contamination in large batches)
|
|
10
|
-
* - Each task must have a unique, non-empty id
|
|
11
|
-
* - Partial salvage: successfully parsed results are returned even if
|
|
12
|
-
* others fail — caller decides how to handle failures
|
|
13
|
-
* - The batcher builds prompts and parses responses; session creation
|
|
14
|
-
* is the caller's responsibility (use with `delegate`)
|
|
15
|
-
*/
|
|
16
|
-
export declare const TASK_BATCHER_MAX_SIZE = 5;
|
|
17
|
-
export interface BatchTask {
|
|
18
|
-
id: string;
|
|
19
|
-
prompt: string;
|
|
20
|
-
}
|
|
21
|
-
export interface BatchResult {
|
|
22
|
-
id: string;
|
|
23
|
-
result: string;
|
|
24
|
-
success: boolean;
|
|
25
|
-
error?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface BatchResponse {
|
|
28
|
-
results: BatchResult[];
|
|
29
|
-
success_count: number;
|
|
30
|
-
failure_count: number;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build a single batched prompt from multiple tasks.
|
|
34
|
-
* The expected response is a JSON array with `id` and `result` fields.
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildBatchPrompt(tasks: BatchTask[]): string;
|
|
37
|
-
/**
|
|
38
|
-
* Parse a batched model response into per-task results.
|
|
39
|
-
* Returns partial results: tasks whose ids appear in the response are
|
|
40
|
-
* marked success, missing tasks are marked failure.
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseBatchResponse(tasks: BatchTask[], rawResponse: string): BatchResponse;
|
|
43
|
-
/**
|
|
44
|
-
* Validate that a batch is safe to send.
|
|
45
|
-
* Returns null if valid, or an error message if not.
|
|
46
|
-
*/
|
|
47
|
-
export declare function validateBatch(tasks: BatchTask[]): string | null;
|
|
48
|
-
//# sourceMappingURL=task-batcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-batcher.d.ts","sourceRoot":"","sources":["../../src/services/task-batcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAiB3D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,aAAa,CA0DzF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,GAAG,IAAI,CAY/D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-batcher.test.d.ts","sourceRoot":"","sources":["../../src/services/task-batcher.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type TelemetryEventType = "command.start" | "command.end" | "tool.call" | "tool.complete" | "agent.dispatch" | "agent.complete" | "approval.request" | "approval.resolve" | "run.complete" | "run.fail" | "policy.violation" | "patch.scored" | "contract.violation" | "agent.span.open" | "agent.span.close" | "budget.warning" | "budget.exhausted" | "deadlock.detected" | "scorecard.generated" | "supervisor.review";
|
|
2
|
-
export interface TelemetryEvent {
|
|
3
|
-
id: string;
|
|
4
|
-
ts: string;
|
|
5
|
-
session_id: string;
|
|
6
|
-
run_id: string;
|
|
7
|
-
event: TelemetryEventType;
|
|
8
|
-
command?: string;
|
|
9
|
-
agent?: string;
|
|
10
|
-
tool?: string;
|
|
11
|
-
model?: string;
|
|
12
|
-
duration_ms?: number;
|
|
13
|
-
status?: "ok" | "error" | "blocked" | "approved" | "rejected";
|
|
14
|
-
risk_score?: number;
|
|
15
|
-
files?: string[];
|
|
16
|
-
cost_estimate?: number;
|
|
17
|
-
error_category?: string;
|
|
18
|
-
/** Estimated input tokens (chars / 4) for this event. */
|
|
19
|
-
input_tokens?: number;
|
|
20
|
-
/** Estimated output tokens (chars / 4) for this event. */
|
|
21
|
-
output_tokens?: number;
|
|
22
|
-
/** Raw input character count before prompt was sent to the model. */
|
|
23
|
-
context_size_chars?: number;
|
|
24
|
-
meta?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
export declare function telemetryPath(dir: string): string;
|
|
27
|
-
export declare function appendEvent(dir: string, partial: Omit<TelemetryEvent, "id" | "ts">): TelemetryEvent | null;
|
|
28
|
-
export declare function readEvents(dir: string, limit?: number): TelemetryEvent[];
|
|
29
|
-
export declare function getRunEvents(dir: string, run_id: string): TelemetryEvent[];
|
|
30
|
-
export interface CommandSummary {
|
|
31
|
-
command: string;
|
|
32
|
-
total_runs: number;
|
|
33
|
-
successes: number;
|
|
34
|
-
failures: number;
|
|
35
|
-
avg_duration_ms: number;
|
|
36
|
-
last_run: string;
|
|
37
|
-
}
|
|
38
|
-
export declare function getCommandSummary(dir: string, n?: number): CommandSummary[];
|
|
39
|
-
export declare function getRecentToolFailures(dir: string, limit?: number): TelemetryEvent[];
|
|
40
|
-
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/services/telemetry.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,aAAa,GACb,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,UAAU,GACV,kBAAkB,GAClB,cAAc,GAEd,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GAErB,mBAAmB,CAAA;AAEvB,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG,cAAc,GAAG,IAAI,CAa1G;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,cAAc,EAAE,CAUrE;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CAE1E;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,SAAM,GAAG,cAAc,EAAE,CAuBxE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,cAAc,EAAE,CAI/E"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Token Budget Service
|
|
3
|
-
*
|
|
4
|
-
* Provides INPUT size budgets and soft response directives by workflow stage
|
|
5
|
-
* and task complexity. These are GUIDANCE values, not hard limits
|
|
6
|
-
* (OpenCode SDK does not expose a max_tokens parameter on session.prompt).
|
|
7
|
-
*
|
|
8
|
-
* Hard controls apply to INPUT: context_chars_limit and prompt_chars_limit
|
|
9
|
-
* cap carry-forward and total prompt size before sending.
|
|
10
|
-
*
|
|
11
|
-
* Soft controls: response_directive is a hint string appended to the prompt.
|
|
12
|
-
* It asks the model to be concise — not enforced at the API level.
|
|
13
|
-
*/
|
|
14
|
-
import type { WorkflowStage } from "./token-metrics";
|
|
15
|
-
import type { TaskComplexity } from "./model-router";
|
|
16
|
-
export interface TokenBudget {
|
|
17
|
-
/** Hard cap on context/carry-forward chars (apply before sending). */
|
|
18
|
-
context_chars_limit: number;
|
|
19
|
-
/** Hard cap on total prompt chars including system instructions. */
|
|
20
|
-
prompt_chars_limit: number;
|
|
21
|
-
/**
|
|
22
|
-
* Soft directive to append to the prompt.
|
|
23
|
-
* Empty string = no constraint injected.
|
|
24
|
-
* This is guidance only — not API-enforced.
|
|
25
|
-
*/
|
|
26
|
-
response_directive: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Get the token budget for a given workflow stage and task complexity.
|
|
30
|
-
* Cheap tasks receive ~40% of the base budget; expensive tasks receive ~150%.
|
|
31
|
-
*/
|
|
32
|
-
export declare function getTokenBudget(stage: WorkflowStage, complexity: TaskComplexity): TokenBudget;
|
|
33
|
-
/**
|
|
34
|
-
* Truncate a carry-forward context to fit within budget.
|
|
35
|
-
* Preserves the most recent content (tail) when truncating.
|
|
36
|
-
* Attempts to trim to a line boundary to avoid mid-line cuts.
|
|
37
|
-
*/
|
|
38
|
-
export declare function applyContextBudget(context: string, budget: TokenBudget): string;
|
|
39
|
-
/**
|
|
40
|
-
* Append the response directive to a prompt, if one is set for this budget.
|
|
41
|
-
* Returns the prompt unchanged when no directive applies.
|
|
42
|
-
*/
|
|
43
|
-
export declare function applyResponseDirective(prompt: string, budget: TokenBudget): string;
|
|
44
|
-
//# sourceMappingURL=token-budget.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-budget.d.ts","sourceRoot":"","sources":["../../src/services/token-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oEAAoE;IACpE,kBAAkB,EAAE,MAAM,CAAA;IAC1B;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAyBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,GAAG,WAAW,CAY5F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAK/E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAGlF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-budget.test.d.ts","sourceRoot":"","sources":["../../src/services/token-budget.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-metrics-ext.test.d.ts","sourceRoot":"","sources":["../../src/services/token-metrics-ext.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-metrics.test.d.ts","sourceRoot":"","sources":["../../src/services/token-metrics.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-dispatch.test.d.ts","sourceRoot":"","sources":["../../src/tools/agent-dispatch.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codebase-index.test.d.ts","sourceRoot":"","sources":["../../src/tools/codebase-index.test.ts"],"names":[],"mappings":""}
|