@dv.nghiem/flowdeck 0.4.12 → 0.5.1
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/orchestrator.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/schema.d.ts +27 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/dashboard/lib/state-reader.d.ts +2 -1
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +29 -1
- package/dist/dashboard/types.d.ts +14 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/dashboard/views/index.ejs +2 -0
- package/dist/dashboard/views/partials/token-budget.ejs +35 -0
- package/dist/hooks/approval-hook.d.ts +16 -2
- package/dist/hooks/approval-hook.d.ts.map +1 -1
- package/dist/hooks/compaction-hook.d.ts +1 -1
- package/dist/hooks/compaction-hook.d.ts.map +1 -1
- package/dist/hooks/context-window-monitor.d.ts +7 -1
- package/dist/hooks/context-window-monitor.d.ts.map +1 -1
- package/dist/hooks/decision-trace-hook.d.ts +3 -0
- package/dist/hooks/decision-trace-hook.d.ts.map +1 -1
- package/dist/hooks/event-log-hook.d.ts +19 -3
- package/dist/hooks/event-log-hook.d.ts.map +1 -1
- package/dist/hooks/guard-rails.d.ts +16 -5
- package/dist/hooks/guard-rails.d.ts.map +1 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts +8 -5
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/tool-guard.d.ts +19 -3
- package/dist/hooks/tool-guard.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9978 -5880
- package/dist/lib/lazy.d.ts +12 -0
- package/dist/lib/lazy.d.ts.map +1 -0
- package/dist/services/agent-contract-registry.d.ts.map +1 -1
- package/dist/services/agent-trace-graph.d.ts +4 -0
- package/dist/services/agent-trace-graph.d.ts.map +1 -1
- package/dist/services/agent-validator.d.ts +2 -1
- package/dist/services/agent-validator.d.ts.map +1 -1
- package/dist/services/approval-manager.d.ts +14 -1
- package/dist/services/approval-manager.d.ts.map +1 -1
- package/dist/services/audit-log.d.ts +23 -0
- package/dist/services/audit-log.d.ts.map +1 -0
- package/dist/services/context-ingress.d.ts +81 -0
- package/dist/services/context-ingress.d.ts.map +1 -0
- package/dist/services/council-runner.d.ts +19 -0
- package/dist/services/council-runner.d.ts.map +1 -0
- package/dist/services/deadlock-detector.d.ts.map +1 -1
- package/dist/services/delegation-budget.d.ts +55 -0
- package/dist/services/delegation-budget.d.ts.map +1 -0
- package/dist/services/event-handlers/command-executed-handler.d.ts +9 -0
- package/dist/services/event-handlers/command-executed-handler.d.ts.map +1 -0
- package/dist/services/event-handlers/index.d.ts +6 -0
- package/dist/services/event-handlers/index.d.ts.map +1 -0
- package/dist/services/event-handlers/session-error-handler.d.ts +8 -0
- package/dist/services/event-handlers/session-error-handler.d.ts.map +1 -0
- package/dist/services/event-handlers/session-idle-handler.d.ts +9 -0
- package/dist/services/event-handlers/session-idle-handler.d.ts.map +1 -0
- package/dist/services/event-handlers/tool-outcome-handler.d.ts +11 -0
- package/dist/services/event-handlers/tool-outcome-handler.d.ts.map +1 -0
- package/dist/services/event-handlers/types.d.ts +42 -0
- package/dist/services/event-handlers/types.d.ts.map +1 -0
- package/dist/services/event-logger.d.ts +3 -1
- package/dist/services/event-logger.d.ts.map +1 -1
- package/dist/services/execution-substrate.d.ts +35 -0
- package/dist/services/execution-substrate.d.ts.map +1 -0
- package/dist/services/harness-controller.d.ts +58 -0
- package/dist/services/harness-controller.d.ts.map +1 -0
- package/dist/services/harness-policy.d.ts +24 -0
- package/dist/services/harness-policy.d.ts.map +1 -0
- package/dist/services/harness-types.d.ts +185 -0
- package/dist/services/harness-types.d.ts.map +1 -0
- package/dist/services/lazy-rule-loader.d.ts +2 -0
- package/dist/services/lazy-rule-loader.d.ts.map +1 -1
- package/dist/services/prompt-cache.d.ts +25 -0
- package/dist/services/prompt-cache.d.ts.map +1 -0
- package/dist/services/recovery-layer.d.ts +26 -0
- package/dist/services/recovery-layer.d.ts.map +1 -0
- package/dist/services/run-trace.d.ts +17 -0
- package/dist/services/run-trace.d.ts.map +1 -1
- package/dist/services/state-persistence.d.ts +22 -0
- package/dist/services/state-persistence.d.ts.map +1 -0
- package/dist/services/supervisor-binding.d.ts +9 -0
- package/dist/services/supervisor-binding.d.ts.map +1 -1
- package/dist/services/token-metrics.d.ts +54 -0
- package/dist/services/token-metrics.d.ts.map +1 -0
- package/dist/services/verification-layer.d.ts +24 -0
- package/dist/services/verification-layer.d.ts.map +1 -0
- package/dist/services/workflow-scorecard.d.ts +5 -0
- package/dist/services/workflow-scorecard.d.ts.map +1 -1
- package/dist/tools/council.d.ts.map +1 -1
- package/dist/tools/decision-trace.d.ts +4 -0
- package/dist/tools/decision-trace.d.ts.map +1 -1
- package/dist/tools/delegate.d.ts +16 -0
- package/dist/tools/delegate.d.ts.map +1 -0
- package/dist/tools/failure-replay.d.ts +8 -0
- package/dist/tools/failure-replay.d.ts.map +1 -1
- package/dist/tools/policy-engine.d.ts +1 -0
- package/dist/tools/policy-engine.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +54 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/docs/concepts/HARNESS_ARCHITECTURE.md +241 -0
- package/docs/concepts/HARNESS_LAYERS.md +378 -0
- package/docs/concepts/HARNESS_WIRING.md +404 -0
- package/package.json +1 -1
- package/src/commands/fd-guarded-edit.md +69 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic lazy initializer.
|
|
3
|
+
*
|
|
4
|
+
* Wraps a factory so the value is created on first access, cached thereafter,
|
|
5
|
+
* and can be reset (primarily useful for test isolation).
|
|
6
|
+
*/
|
|
7
|
+
export interface Lazy<T> {
|
|
8
|
+
get: () => T;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function lazy<T>(factory: () => T): Lazy<T>;
|
|
12
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/lib/lazy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC,CAAA;IACZ,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAiBjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-contract-registry.d.ts","sourceRoot":"","sources":["../../src/services/agent-contract-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,mDAAmD;IACnD,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAC9B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,2CAA2C;IAC3C,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAC9B,qDAAqD;IACrD,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,oCAAoC;IACpC,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;
|
|
1
|
+
{"version":3,"file":"agent-contract-registry.d.ts","sourceRoot":"","sources":["../../src/services/agent-contract-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,mDAAmD;IACnD,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAC9B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,2CAA2C;IAC3C,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAC9B,qDAAqD;IACrD,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,oCAAoC;IACpC,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AA+UD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAE/D;AAED,wBAAgB,eAAe,IAAI,aAAa,EAAE,CAEjD;AAED,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CAElD"}
|
|
@@ -80,6 +80,10 @@ export declare function recordToolUsed(dir: string, span_id: string, toolName: s
|
|
|
80
80
|
* Record a contract violation on the active span.
|
|
81
81
|
*/
|
|
82
82
|
export declare function addSpanViolation(dir: string, span_id: string, violation: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* Record a contract violation on the active span (convenience alias).
|
|
85
|
+
*/
|
|
86
|
+
export declare function recordContractViolation(dir: string, span_id: string, violation: string): void;
|
|
83
87
|
export declare function getSpan(dir: string, span_id: string): AgentSpan | null;
|
|
84
88
|
export declare function getTraceSpans(dir: string, trace_id: string): AgentSpan[];
|
|
85
89
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-trace-graph.d.ts","sourceRoot":"","sources":["../../src/services/agent-trace-graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UA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BN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQnF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAMtF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE7F;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAEtE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,CAExE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAoBhF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,EAAE,CAYpE"}
|
|
@@ -47,8 +47,9 @@ export declare function resolveValidatorMode(directory: string): ValidatorMode;
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function validateAgent(directory: string, ctx: AgentExecutionContext): ValidationResult;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Validate that an agent's structured output contains the contract's expected fields.
|
|
51
51
|
*/
|
|
52
|
+
export declare function validateAgentOutput(agent: string, output: Record<string, unknown>): ValidationResult;
|
|
52
53
|
export declare function validateToolAccess(directory: string, agent: string, toolName: string, opts?: {
|
|
53
54
|
run_id?: string;
|
|
54
55
|
session_id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-validator.d.ts","sourceRoot":"","sources":["../../src/services/agent-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAA;AACzD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAA;AAErE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,eAAe,CAAA;IACvB,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,wCAAwC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"agent-validator.d.ts","sourceRoot":"","sources":["../../src/services/agent-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;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AC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CA0CpG;AACD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,gBAAgB,CAElB"}
|
|
@@ -9,12 +9,21 @@ export interface ApprovalRequest {
|
|
|
9
9
|
trigger: string;
|
|
10
10
|
reason: string;
|
|
11
11
|
risk_score: number;
|
|
12
|
+
agent?: string;
|
|
12
13
|
file_path?: string;
|
|
14
|
+
content_hash?: string;
|
|
13
15
|
change_description?: string;
|
|
14
16
|
}
|
|
15
17
|
export interface ApprovalsStore {
|
|
16
18
|
requests: ApprovalRequest[];
|
|
17
19
|
}
|
|
20
|
+
export interface ApprovalCheckCriteria {
|
|
21
|
+
run_id: string;
|
|
22
|
+
session_id: string;
|
|
23
|
+
agent: string;
|
|
24
|
+
file_path: string;
|
|
25
|
+
content_hash: string;
|
|
26
|
+
}
|
|
18
27
|
export declare function isSensitivePath(filePath: string): boolean;
|
|
19
28
|
export declare function isApprovalRequired(filePath: string, riskScore: number): boolean;
|
|
20
29
|
export declare function requestApproval(dir: string, run_id: string, trigger: string, reason: string, options?: {
|
|
@@ -22,9 +31,13 @@ export declare function requestApproval(dir: string, run_id: string, trigger: st
|
|
|
22
31
|
risk_score?: number;
|
|
23
32
|
change_description?: string;
|
|
24
33
|
session_id?: string;
|
|
34
|
+
agent?: string;
|
|
35
|
+
content_hash?: string;
|
|
25
36
|
}): ApprovalRequest;
|
|
26
37
|
export declare function resolveApproval(dir: string, approval_id: string, decision: "approved" | "rejected"): boolean;
|
|
27
|
-
export declare function checkApproval(dir: string,
|
|
38
|
+
export declare function checkApproval(dir: string, criteria: ApprovalCheckCriteria): ApprovalRequest | null;
|
|
39
|
+
export declare function computeContentHash(args: Record<string, unknown>): string;
|
|
40
|
+
export declare function requestApprovalForTool(dir: string, run_id: string, session_id: string, agent: string, tool: string, args: Record<string, unknown>): ApprovalRequest;
|
|
28
41
|
export declare function getPendingApprovals(dir: string): ApprovalRequest[];
|
|
29
42
|
export declare function getRecentApprovals(dir: string, limit?: number): ApprovalRequest[];
|
|
30
43
|
//# sourceMappingURL=approval-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-manager.d.ts","sourceRoot":"","sources":["../../src/services/approval-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approval-manager.d.ts","sourceRoot":"","sources":["../../src/services/approval-manager.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;AAEhE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CAC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
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Log Service
|
|
3
|
+
*
|
|
4
|
+
* Append-only log of every harness policy decision.
|
|
5
|
+
* Writes to `.codebase/AUDIT.jsonl` and rotates at 1000 lines.
|
|
6
|
+
*/
|
|
7
|
+
import type { AuditEntry } from "../services/harness-types";
|
|
8
|
+
export interface AuditFilter {
|
|
9
|
+
run_id?: string;
|
|
10
|
+
session_id?: string;
|
|
11
|
+
tool?: string;
|
|
12
|
+
verdict?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AuditLog {
|
|
15
|
+
append(entry: AuditEntry): void;
|
|
16
|
+
query(filter: AuditFilter): AuditEntry[];
|
|
17
|
+
}
|
|
18
|
+
export declare function auditPath(directory: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Create an audit log writer for the given project directory.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createAuditLog(directory: string, appLog?: (msg: string) => void): AuditLog;
|
|
23
|
+
//# sourceMappingURL=audit-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../src/services/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAK3D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IAC/B,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,EAAE,CAAA;CACzC;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAuED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7B,QAAQ,CAKV"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Ingress Service
|
|
3
|
+
*
|
|
4
|
+
* Assembles the runtime context for a command execution:
|
|
5
|
+
* - planning state (STATE.md)
|
|
6
|
+
* - plan content (PLAN.md)
|
|
7
|
+
* - .codebase/ documentation
|
|
8
|
+
* - recent tool/session events
|
|
9
|
+
* - task complexity classification
|
|
10
|
+
* - relevant rules and skills
|
|
11
|
+
* - token budget snapshot
|
|
12
|
+
* - trivial-chat short-circuit
|
|
13
|
+
*
|
|
14
|
+
* The service is advisory: it does not block execution and does not mutate
|
|
15
|
+
* external state except through explicit dependencies injected by the caller.
|
|
16
|
+
*/
|
|
17
|
+
import type { FlowDeckConfig } from "../config/schema";
|
|
18
|
+
import { type AssembledContext, type TokenBudgetSnapshot } from "./harness-types";
|
|
19
|
+
export interface TrivialChatResult {
|
|
20
|
+
isTrivialChat: boolean;
|
|
21
|
+
confidence: number;
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ContextIngressInput {
|
|
25
|
+
runId: string;
|
|
26
|
+
sessionId: string;
|
|
27
|
+
projectRoot: string;
|
|
28
|
+
command?: string;
|
|
29
|
+
description: string;
|
|
30
|
+
config?: FlowDeckConfig;
|
|
31
|
+
currentStage?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ContextIngressOptions {
|
|
34
|
+
maxEvents?: number;
|
|
35
|
+
eventMaxAgeMinutes?: number;
|
|
36
|
+
planTruncateThreshold?: number;
|
|
37
|
+
planTruncateTo?: number;
|
|
38
|
+
totalTokenBudget?: number;
|
|
39
|
+
}
|
|
40
|
+
/** Clear all module-level context-ingress caches. Useful for tests. */
|
|
41
|
+
export declare function clearContextIngressCaches(): void;
|
|
42
|
+
export declare function isTrivialChat(description: string): TrivialChatResult;
|
|
43
|
+
export declare class ContextIngressService {
|
|
44
|
+
private options;
|
|
45
|
+
private readonly _assembledBySession;
|
|
46
|
+
constructor(options?: ContextIngressOptions);
|
|
47
|
+
assemble(input: ContextIngressInput): AssembledContext;
|
|
48
|
+
/**
|
|
49
|
+
* Persist a per-component token budget snapshot for dashboard consumption.
|
|
50
|
+
* Failures are logged to stderr but do not block context assembly.
|
|
51
|
+
*/
|
|
52
|
+
private persistBudgetSnapshot;
|
|
53
|
+
/**
|
|
54
|
+
* Build the prompt fragment to inject for this context.
|
|
55
|
+
* Trivial chats get a minimal greeting; heavy tasks get rules, skills, plan,
|
|
56
|
+
* state, and recent events. Heavy fragments are cached for 5 minutes.
|
|
57
|
+
*/
|
|
58
|
+
buildPromptFragment(ctx: AssembledContext): string;
|
|
59
|
+
/**
|
|
60
|
+
* Return per-component token budget snapshots.
|
|
61
|
+
* Uses real token-metrics totals when available; otherwise falls back to
|
|
62
|
+
* estimated token counts derived from content length and kind.
|
|
63
|
+
*/
|
|
64
|
+
getComponentBudgets(ctx: AssembledContext): Record<string, TokenBudgetSnapshot>;
|
|
65
|
+
/** Return the total context limit for a session (from ingress or default). */
|
|
66
|
+
getTotalBudget(sessionID: string): number;
|
|
67
|
+
/** Retrieve the most recently assembled context for a session. */
|
|
68
|
+
getAssembledContext(sessionID: string): AssembledContext | undefined;
|
|
69
|
+
private readPlanContent;
|
|
70
|
+
private readCodebaseDocs;
|
|
71
|
+
private readRecentEvents;
|
|
72
|
+
private buildRoute;
|
|
73
|
+
private mapComplexityToWorkflowClass;
|
|
74
|
+
private inferStages;
|
|
75
|
+
private selectRelevantRules;
|
|
76
|
+
private inferStageFromRoute;
|
|
77
|
+
private selectRelevantSkills;
|
|
78
|
+
}
|
|
79
|
+
/** Convenience factory used by the plugin entry point. */
|
|
80
|
+
export declare function createContextIngressService(options?: ContextIngressOptions): ContextIngressService;
|
|
81
|
+
//# sourceMappingURL=context-ingress.d.ts.map
|
|
@@ -0,0 +1 @@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H,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM;IAiElD;;;;OAIG;IACH,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAgD/E,8EAA8E;IAC9E,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIzC,kEAAkE;IAClE,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIpE,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,4BAA4B;IAWpC,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,mBAAmB;IAgC3B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,oBAAoB;CAQ7B;AAED,0DAA0D;AAC1D,wBAAgB,2BAA2B,CACzC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Council Runner
|
|
3
|
+
*
|
|
4
|
+
* Shared fan-out logic for the council delegation mode. Prompts a list of agents
|
|
5
|
+
* in parallel with bounded concurrency and returns their individual outputs.
|
|
6
|
+
*/
|
|
7
|
+
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
8
|
+
export interface CouncilAgentResult {
|
|
9
|
+
agent: string;
|
|
10
|
+
output?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function runCouncil(client: OpencodeClient, context: {
|
|
14
|
+
directory: string;
|
|
15
|
+
sessionID: string;
|
|
16
|
+
}, task: string, agents: string[], options?: {
|
|
17
|
+
maxConcurrency?: number;
|
|
18
|
+
}): Promise<CouncilAgentResult[]>;
|
|
19
|
+
//# sourceMappingURL=council-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"council-runner.d.ts","sourceRoot":"","sources":["../../src/services/council-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACjD,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACpC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deadlock-detector.d.ts","sourceRoot":"","sources":["../../src/services/deadlock-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,CAAA;AAEjB,MAAM,MAAM,cAAc,GACtB,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,MAAM,CAAA;AAEV,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,cAAc,CAAA;IAClC,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAA;CACnB;AAoCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAQD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAa3E;
|
|
1
|
+
{"version":3,"file":"deadlock-detector.d.ts","sourceRoot":"","sources":["../../src/services/deadlock-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,iBAAiB,GACjB,qBAAqB,GACrB,aAAa,CAAA;AAEjB,MAAM,MAAM,cAAc,GACtB,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,MAAM,CAAA;AAEV,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,cAAc,CAAA;IAClC,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAA;CACnB;AAoCD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAQD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAa3E;AAmID;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,EAAE,CAe/E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Budget Service
|
|
3
|
+
*
|
|
4
|
+
* Per-run envelope for tool calls, delegation depth, and same-step retries.
|
|
5
|
+
* All state is kept in memory; final budget snapshots are persisted to the
|
|
6
|
+
* run trace on run end via a stubbed persistence call.
|
|
7
|
+
*
|
|
8
|
+
* The service is advisory by default. Callers decide whether to honour the
|
|
9
|
+
* budget result.
|
|
10
|
+
*/
|
|
11
|
+
import type { FlowDeckConfig } from "../config/schema";
|
|
12
|
+
import type { PolicyDecision } from "./harness-types";
|
|
13
|
+
export interface DelegationBudgetConfig {
|
|
14
|
+
maxToolCalls: number;
|
|
15
|
+
maxDepth: number;
|
|
16
|
+
maxSameStepRetries: number;
|
|
17
|
+
}
|
|
18
|
+
export interface DelegationBudget {
|
|
19
|
+
runId: string;
|
|
20
|
+
config: DelegationBudgetConfig;
|
|
21
|
+
spentToolCalls: number;
|
|
22
|
+
currentDepth: number;
|
|
23
|
+
sameStepRetries: number;
|
|
24
|
+
}
|
|
25
|
+
export interface SpendResult {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
remaining: number;
|
|
28
|
+
}
|
|
29
|
+
export interface DelegationBudgetSnapshot {
|
|
30
|
+
runId: string;
|
|
31
|
+
maxToolCalls: number;
|
|
32
|
+
maxDepth: number;
|
|
33
|
+
maxSameStepRetries: number;
|
|
34
|
+
spentToolCalls: number;
|
|
35
|
+
currentDepth: number;
|
|
36
|
+
sameStepRetries: number;
|
|
37
|
+
remainingToolCalls: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function resolveDelegationBudgetConfig(config?: FlowDeckConfig): DelegationBudgetConfig;
|
|
40
|
+
export declare function init(runId: string, config?: FlowDeckConfig): DelegationBudget;
|
|
41
|
+
export declare function getBudget(runId: string): DelegationBudgetSnapshot | null;
|
|
42
|
+
export declare function checkSpend(runId: string, _toolName?: string): PolicyDecision;
|
|
43
|
+
export declare function recordDelegation(parentRunId: string, childRunId: string): boolean;
|
|
44
|
+
export declare function incrementSameStepRetry(runId: string): boolean;
|
|
45
|
+
export declare function resetSameStepRetry(runId: string): void;
|
|
46
|
+
export declare function toSnapshot(budget: DelegationBudget): DelegationBudgetSnapshot;
|
|
47
|
+
/** Persist the final budget snapshot into the run trace. */
|
|
48
|
+
export declare function persistBudget(runId: string, dir?: string): boolean;
|
|
49
|
+
/** Release the in-memory budget for a run. */
|
|
50
|
+
export declare function end(runId: string): DelegationBudgetSnapshot | null;
|
|
51
|
+
/** Clear all in-memory budgets. Useful for tests. */
|
|
52
|
+
export declare function clearAllBudgets(): void;
|
|
53
|
+
/** Return the number of active in-memory budgets. Useful for tests/telemetry. */
|
|
54
|
+
export declare function activeBudgetCount(): number;
|
|
55
|
+
//# sourceMappingURL=delegation-budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-budget.d.ts","sourceRoot":"","sources":["../../src/services/delegation-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,iBAAiB,CAAA;AAGpE,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,sBAAsB,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AA6BD,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,cAAc,GACtB,sBAAsB,CAQxB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAW7E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAIxE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAe5E;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAYjF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK7D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKtD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,wBAAwB,CAW7E;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAMlE;AAED,8CAA8C;AAC9C,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,wBAAwB,GAAG,IAAI,CAOlE;AAED,qDAAqD;AACrD,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command executed handler.
|
|
3
|
+
*
|
|
4
|
+
* Tracks the last command name/output and validates any /fd-* command references
|
|
5
|
+
* emitted by the agent, recording contract violations when references are invalid.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerDeps } from "./types";
|
|
8
|
+
export declare function createCommandExecutedHandler(deps: HandlerDeps): (sessionID: string, properties: Record<string, unknown>) => void;
|
|
9
|
+
//# sourceMappingURL=command-executed-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-executed-handler.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/command-executed-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,WAAW,IAGpD,WAAW,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI,CA2BtE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createToolOutcomeHandler } from "./tool-outcome-handler";
|
|
2
|
+
export { createCommandExecutedHandler } from "./command-executed-handler";
|
|
3
|
+
export { createSessionIdleHandler } from "./session-idle-handler";
|
|
4
|
+
export { createSessionErrorHandler } from "./session-error-handler";
|
|
5
|
+
export type { HarnessControllerState, HandlerDeps } from "./types";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACnE,YAAY,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session error handler.
|
|
3
|
+
*
|
|
4
|
+
* Logs the session event and ends the active run as failed.
|
|
5
|
+
*/
|
|
6
|
+
import type { HandlerDeps } from "./types";
|
|
7
|
+
export declare function createSessionErrorHandler(deps: HandlerDeps): (sessionID: string, properties: Record<string, unknown>) => Promise<void>;
|
|
8
|
+
//# sourceMappingURL=session-error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-error-handler.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/session-error-handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,IAG3C,WAAW,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAerF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session idle handler.
|
|
3
|
+
*
|
|
4
|
+
* Logs the session event, checks for stuck-run signals, ends the run as failed
|
|
5
|
+
* when deadlocked, or runs completion validation for fd-done before completing.
|
|
6
|
+
*/
|
|
7
|
+
import type { HandlerDeps } from "./types";
|
|
8
|
+
export declare function createSessionIdleHandler(deps: HandlerDeps): (sessionID: string, properties: Record<string, unknown>) => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=session-idle-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-idle-handler.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/session-idle-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,IAY1C,WAAW,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAmCrF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool outcome handler.
|
|
3
|
+
*
|
|
4
|
+
* Records loop-detector history, agent trace data, decision-trace enrichment,
|
|
5
|
+
* failure-replay observations, execution-substrate completion, and context-window
|
|
6
|
+
* monitoring after a tool has executed.
|
|
7
|
+
*/
|
|
8
|
+
import type { HandlerDeps } from "./types";
|
|
9
|
+
import type { ToolCallRequest } from "../harness-controller";
|
|
10
|
+
export declare function createToolOutcomeHandler(deps: HandlerDeps): (req: ToolCallRequest, output: unknown, status: "success" | "error" | "blocked") => void;
|
|
11
|
+
//# sourceMappingURL=tool-outcome-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-outcome-handler.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/tool-outcome-handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,IAgBhD,KAAK,eAAe,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS,GAAG,OAAO,GAAG,SAAS,KAAG,IAAI,CAuE9F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for harness event handlers.
|
|
3
|
+
*/
|
|
4
|
+
import type { LoopDetector } from "../loop-detector";
|
|
5
|
+
import type { createEventLogHooks } from "../../hooks/event-log-hook";
|
|
6
|
+
import type { createContextWindowMonitorHook } from "../../hooks/context-window-monitor";
|
|
7
|
+
import type { Lazy } from "../../lib/lazy";
|
|
8
|
+
import type { PolicyDecision } from "../harness-policy";
|
|
9
|
+
import type { ContextIngressService } from "../context-ingress";
|
|
10
|
+
import type { StatePersistenceService } from "../state-persistence";
|
|
11
|
+
import type { RecoveryLayer } from "../recovery-layer";
|
|
12
|
+
import type { VerificationLayer } from "../verification-layer";
|
|
13
|
+
import type { AuditLog } from "../audit-log";
|
|
14
|
+
import type { ExecutionSubstrate } from "../execution-substrate";
|
|
15
|
+
import type { HarnessPolicy } from "../harness-policy";
|
|
16
|
+
import { OrchestratorGuard } from "../../hooks/orchestrator-guard-hook";
|
|
17
|
+
export interface HarnessControllerState {
|
|
18
|
+
loopDetector: Lazy<LoopDetector>;
|
|
19
|
+
eventLog: Lazy<ReturnType<typeof createEventLogHooks>>;
|
|
20
|
+
contextMonitor: Lazy<ReturnType<typeof createContextWindowMonitorHook>>;
|
|
21
|
+
currentWorkflowClass: string | undefined;
|
|
22
|
+
lastActiveSessionID: string | null;
|
|
23
|
+
lastCommandName: string | null;
|
|
24
|
+
lastCommandOutput: string | null;
|
|
25
|
+
toolFailureCounts: Map<string, number>;
|
|
26
|
+
lastToolDecisions: Map<string, PolicyDecision>;
|
|
27
|
+
}
|
|
28
|
+
export interface HandlerDeps {
|
|
29
|
+
directory: string;
|
|
30
|
+
appLog: (msg: string) => void;
|
|
31
|
+
policy: HarnessPolicy;
|
|
32
|
+
contextIngress: ContextIngressService;
|
|
33
|
+
statePersistence: StatePersistenceService;
|
|
34
|
+
recoveryLayer: RecoveryLayer;
|
|
35
|
+
verificationLayer: VerificationLayer;
|
|
36
|
+
auditLog: AuditLog;
|
|
37
|
+
executionSubstrate: ExecutionSubstrate;
|
|
38
|
+
orchestratorGuard: OrchestratorGuard;
|
|
39
|
+
state: HarnessControllerState;
|
|
40
|
+
endRun: (sessionID: string, status: "complete" | "failed" | "cancelled", outcome?: string, error?: string) => void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/event-handlers/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,KAAK,EAAE,8BAA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AAM,KAAK,IAAI,CAAA;IAC7B,MAAM,EAAE,aAAa,CAAA;IACrB,cAAc,EAAE,qBAAqB,CAAA;IACrC,gBAAgB,EAAE,uBAAuB,CAAA;IACzC,aAAa,EAAE,aAAa,CAAA;IAC5B,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,QAAQ,EAAE,QAAQ,CAAA;IAClB,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,KAAK,EAAE,sBAAsB,CAAA;IAC7B,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,WAAW,EAC3C,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,KACX,IAAI,CAAA;CACV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface ToolEvent {
|
|
2
2
|
timestamp: string;
|
|
3
|
-
type: "tool.before" | "tool.after" | "session.created" | "session.idle" | "session.error";
|
|
3
|
+
type: "tool.before" | "tool.after" | "session.created" | "session.idle" | "session.error" | "span.open" | "span.close";
|
|
4
4
|
agent?: string;
|
|
5
5
|
tool?: string;
|
|
6
6
|
args?: Record<string, unknown>;
|
|
@@ -9,6 +9,8 @@ export interface ToolEvent {
|
|
|
9
9
|
status?: "success" | "error" | "blocked";
|
|
10
10
|
error?: string;
|
|
11
11
|
session_id?: string;
|
|
12
|
+
span_id?: string;
|
|
13
|
+
parent_span_id?: string;
|
|
12
14
|
}
|
|
13
15
|
export declare function getCurrentAgent(): string | null;
|
|
14
16
|
export declare function setCurrentAgent(agent: string | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-logger.d.ts","sourceRoot":"","sources":["../../src/services/event-logger.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,iBAAiB,GAAG,cA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,SAAS,GAAG,MAAM,CAqD7D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Substrate
|
|
3
|
+
*
|
|
4
|
+
* Tracks active tool/command executions, durations, and timeout helpers.
|
|
5
|
+
* Best-effort only: the plugin API does not expose a kill signal, so this
|
|
6
|
+
* layer records lifecycle state and flags overdue executions for downstream
|
|
7
|
+
* policy/scorecard use.
|
|
8
|
+
*/
|
|
9
|
+
export interface ActiveExecution {
|
|
10
|
+
runId: string;
|
|
11
|
+
sessionID: string;
|
|
12
|
+
tool: string;
|
|
13
|
+
startedAt: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ExecutionSubstrate {
|
|
16
|
+
start(req: {
|
|
17
|
+
runId: string;
|
|
18
|
+
sessionID: string;
|
|
19
|
+
tool: string;
|
|
20
|
+
args: Record<string, unknown>;
|
|
21
|
+
}): void;
|
|
22
|
+
finish(req: {
|
|
23
|
+
runId: string;
|
|
24
|
+
sessionID: string;
|
|
25
|
+
tool: string;
|
|
26
|
+
}, status: "success" | "error" | "blocked", durationMs?: number): void;
|
|
27
|
+
active(): ActiveExecution[];
|
|
28
|
+
isOverdue(exec: {
|
|
29
|
+
startedAt: number;
|
|
30
|
+
}, maxMs: number): boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function createExecutionSubstrate(): ExecutionSubstrate;
|
|
33
|
+
/** Release all tracked executions. Intended for tests. */
|
|
34
|
+
export declare function clearExecutionSubstrate(): void;
|
|
35
|
+
//# sourceMappingURL=execution-substrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-substrate.d.ts","sourceRoot":"","sources":["../../src/services/execution-substrate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI,CAAA;IACnG,MAAM,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnI,MAAM,IAAI,eAAe,EAAE,CAAA;IAC3B,SAAS,CAAC,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAC/D;AAQD,wBAAgB,wBAAwB,IAAI,kBAAkB,CA+B7D;AAED,0DAA0D;AAC1D,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness Controller
|
|
3
|
+
*
|
|
4
|
+
* Central control plane for the FlowDeck runtime. Receives every model-facing
|
|
5
|
+
* decision point from the plugin entry point and delegates to the context,
|
|
6
|
+
* policy, execution, and persistence layers.
|
|
7
|
+
*/
|
|
8
|
+
import type { Permission } from "@opencode-ai/sdk";
|
|
9
|
+
import type { HarnessPolicy, PolicyDecision } from "./harness-policy";
|
|
10
|
+
import type { AssembledContext, RunContext } from "./harness-types";
|
|
11
|
+
import { type ContextIngressService } from "./context-ingress";
|
|
12
|
+
import { type StatePersistenceService } from "./state-persistence";
|
|
13
|
+
import { createContextWindowMonitorHook } from "../hooks/context-window-monitor";
|
|
14
|
+
import { type VerificationLayer } from "./verification-layer";
|
|
15
|
+
import { type RecoveryLayer } from "./recovery-layer";
|
|
16
|
+
export interface HarnessControllerConfig {
|
|
17
|
+
directory: string;
|
|
18
|
+
client: any;
|
|
19
|
+
appLog: (msg: string) => void;
|
|
20
|
+
policy: HarnessPolicy;
|
|
21
|
+
verificationLayer?: VerificationLayer;
|
|
22
|
+
recoveryLayer?: RecoveryLayer;
|
|
23
|
+
contextIngress?: ContextIngressService;
|
|
24
|
+
contextMonitor?: ReturnType<typeof createContextWindowMonitorHook>;
|
|
25
|
+
}
|
|
26
|
+
export interface ToolCallRequest {
|
|
27
|
+
sessionID: string;
|
|
28
|
+
tool: string;
|
|
29
|
+
args: Record<string, unknown>;
|
|
30
|
+
agent?: string;
|
|
31
|
+
parentRunId?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface CommandRequest {
|
|
34
|
+
sessionID: string;
|
|
35
|
+
command: string;
|
|
36
|
+
arguments: string;
|
|
37
|
+
agent?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionEvent {
|
|
40
|
+
type: "session.created" | "session.started" | "session.idle" | "session.error" | "session.deleted" | "command.executed" | "message.updated";
|
|
41
|
+
properties?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface HarnessController {
|
|
44
|
+
init(): void;
|
|
45
|
+
onCommandBefore(req: CommandRequest): RunContext;
|
|
46
|
+
evaluateToolCall(req: ToolCallRequest): PolicyDecision;
|
|
47
|
+
recordToolOutcome(req: ToolCallRequest, output: unknown, status: "success" | "error" | "blocked"): void;
|
|
48
|
+
onSessionEvent(evt: SessionEvent): Promise<void>;
|
|
49
|
+
onPermissionAsk(input: Permission): void;
|
|
50
|
+
getAssembledContext(sessionID: string): AssembledContext | undefined;
|
|
51
|
+
endRun(sessionID: string, status: "complete" | "failed" | "cancelled", outcome?: string, error?: string): void;
|
|
52
|
+
getCurrentStage(sessionID?: string): string | undefined;
|
|
53
|
+
getStatePersistence(): StatePersistenceService;
|
|
54
|
+
getContextIngress(): ContextIngressService;
|
|
55
|
+
getContextMonitor(): ReturnType<typeof createContextWindowMonitorHook>;
|
|
56
|
+
}
|
|
57
|
+
export declare function createHarnessController(config: HarnessControllerConfig): HarnessController;
|
|
58
|
+
//# sourceMappingURL=harness-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-controller.d.ts","sourceRoot":"","sources":["../../src/services/harness-controller.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAc,MAAM,iBAAiB,CAAA;AAC/E,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE3F,OAAO,EAA0B,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAG1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAA;AAMhF,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACtF,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAW1E,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,GAAG,CAAA;IACX,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,MAAM,EAAE,aAAa,CAAA;IACrB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,cAAc,CAAC,EAAE,qBAAqB,CAAA;IACtC,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAA;CACnE;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CA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uB,CAAA;IAC9C,iBAAiB,IAAI,qBAAqB,CAAA;IAC1C,iBAAiB,IAAI,UAAU,CAAC,OAAO,8BAA8B,CAAC,CAAA;CACvE;AAID,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,iBAAiB,CA+S1F"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness Policy Service
|
|
3
|
+
*
|
|
4
|
+
* Unified allow/deny/ask evaluator for every tool call. Runs checks in order
|
|
5
|
+
* and short-circuits on deny:
|
|
6
|
+
*
|
|
7
|
+
* 1. Runtime limits (loop detector, delegation budget, deadlock signals)
|
|
8
|
+
* 2. Agent contract (tool allowlist / forbidden actions)
|
|
9
|
+
* 3. Governance (tool guard, guard rails, approvals, active policies)
|
|
10
|
+
* 4. Supervisor review
|
|
11
|
+
*
|
|
12
|
+
* Every evaluation produces exactly one entry in `.codebase/AUDIT.jsonl`.
|
|
13
|
+
*/
|
|
14
|
+
import type { PolicyDecision, PolicyInput } from "./harness-types";
|
|
15
|
+
export type { PolicyDecision } from "./harness-types";
|
|
16
|
+
export interface HarnessPolicy {
|
|
17
|
+
evaluate(input: PolicyInput): PolicyDecision;
|
|
18
|
+
checkAgentContract(input: PolicyInput): PolicyDecision;
|
|
19
|
+
checkRuntimeLimits(input: PolicyInput): PolicyDecision;
|
|
20
|
+
checkGovernance(input: PolicyInput): PolicyDecision;
|
|
21
|
+
checkSupervisor(input: PolicyInput, targetName: string): PolicyDecision;
|
|
22
|
+
}
|
|
23
|
+
export declare function createHarnessPolicy(directory: string, appLog?: (msg: string) => void): HarnessPolicy;
|
|
24
|
+
//# sourceMappingURL=harness-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-policy.d.ts","sourceRoot":"","sources":["../../src/services/harness-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAEV,cAAc,EACd,WAAW,EAEZ,MAAM,iBAAiB,CAAA;AAExB,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAcrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAAA;IAC5C,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAAA;IACtD,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAAA;IACtD,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAAA;IACnD,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAAA;CACxE;AA6FD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7B,aAAa,CAyTf"}
|