@dv.nghiem/flowdeck 0.3.4 → 0.3.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/README.md +154 -3
- package/dist/agents/coder.d.ts +3 -1
- package/dist/agents/coder.d.ts.map +1 -1
- package/dist/agents/design.d.ts +3 -0
- package/dist/agents/design.d.ts.map +1 -0
- package/dist/agents/index.d.ts +4 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/reviewer.d.ts.map +1 -1
- package/dist/agents/specialist.d.ts +0 -1
- package/dist/agents/specialist.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/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/schema.d.ts +55 -2
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +24 -1
- package/dist/dashboard/types.d.ts +72 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/hooks/guard-rails.d.ts.map +1 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/tool-guard.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +490 -418
- package/dist/services/agent-contract-registry.d.ts +32 -0
- package/dist/services/agent-contract-registry.d.ts.map +1 -0
- package/dist/services/agent-performance.d.ts +1 -1
- package/dist/services/agent-performance.d.ts.map +1 -1
- package/dist/services/agent-trace-graph.d.ts +94 -0
- package/dist/services/agent-trace-graph.d.ts.map +1 -0
- package/dist/services/agent-validator.d.ts +56 -0
- package/dist/services/agent-validator.d.ts.map +1 -0
- package/dist/services/deadlock-detector.d.ts +34 -0
- package/dist/services/deadlock-detector.d.ts.map +1 -0
- package/dist/services/delegation-budget.d.ts +54 -0
- package/dist/services/delegation-budget.d.ts.map +1 -0
- package/dist/services/governance.test.d.ts +11 -0
- package/dist/services/governance.test.d.ts.map +1 -0
- package/dist/services/index.d.ts +6 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/telemetry.d.ts +1 -1
- package/dist/services/telemetry.d.ts.map +1 -1
- package/dist/services/workflow-scorecard.d.ts +76 -0
- package/dist/services/workflow-scorecard.d.ts.map +1 -0
- package/dist/tools/delegate.d.ts.map +1 -1
- package/dist/tools/dispatch-routing.d.ts +4 -1
- package/dist/tools/dispatch-routing.d.ts.map +1 -1
- package/dist/tools/dispatch-routing.test.d.ts +2 -0
- package/dist/tools/dispatch-routing.test.d.ts.map +1 -0
- package/dist/tools/planning-state-lib.d.ts +8 -0
- package/dist/tools/planning-state-lib.d.ts.map +1 -1
- package/dist/tools/planning-state.d.ts.map +1 -1
- package/dist/tools/run-pipeline.d.ts.map +1 -1
- package/docs/agents.md +104 -74
- package/docs/best-practices.md +1 -1
- package/docs/commands/fd-ask.md +2 -2
- package/docs/commands/fd-fix-bug.md +2 -2
- package/docs/commands/fd-new-feature.md +2 -2
- package/docs/commands/fd-quick.md +3 -1
- package/docs/commands.md +37 -7
- package/docs/configuration.md +76 -46
- package/docs/design-first-workflow.md +94 -0
- package/docs/feature-integration-architecture.md +3 -31
- package/docs/index.md +5 -2
- package/docs/intelligence.md +92 -1
- package/docs/multi-repo.md +1 -1
- package/docs/rules.md +1 -1
- package/docs/skills.md +24 -15
- package/docs/workflows.md +11 -6
- package/package.json +1 -1
- package/src/commands/fd-ask.md +1 -0
- package/src/commands/fd-design.md +64 -0
- package/src/commands/fd-discuss.md +2 -0
- package/src/commands/fd-execute.md +7 -3
- package/src/commands/fd-fix-bug.md +2 -2
- package/src/commands/fd-multi-repo.md +3 -3
- package/src/commands/fd-plan.md +2 -0
- package/src/commands/fd-quick.md +4 -1
- package/src/commands/fd-verify.md +6 -0
- package/src/rules/common/agent-orchestration.md +6 -6
- package/src/skills/app-shell-design/SKILL.md +31 -0
- package/src/skills/dashboard-design/SKILL.md +32 -0
- package/src/skills/decision-trace/SKILL.md +1 -1
- package/src/skills/design-audit/SKILL.md +37 -0
- package/src/skills/design-system-definition/SKILL.md +33 -0
- package/src/skills/frontend-handoff/SKILL.md +31 -0
- package/src/skills/landing-page-design/SKILL.md +32 -0
- package/src/skills/multi-repo/SKILL.md +3 -3
- package/src/skills/plan-task/SKILL.md +2 -2
- package/src/skills/responsive-review/SKILL.md +31 -0
- package/src/skills/ui-ux-planning/SKILL.md +32 -0
- package/src/skills/wireframe-planning/SKILL.md +30 -0
- package/dist/services/model-router.d.ts +0 -35
- package/dist/services/model-router.d.ts.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Contract Registry
|
|
3
|
+
* Defines capability contracts for every agent in the FlowDeck system.
|
|
4
|
+
* Contracts are the authoritative source for what each agent is allowed to do,
|
|
5
|
+
* what inputs it requires, and what outputs it must produce.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentContract {
|
|
8
|
+
/** Agent identifier, matching the name in AGENT_NAMES */
|
|
9
|
+
agent: string;
|
|
10
|
+
/** One-line description of the agent's role */
|
|
11
|
+
role: string;
|
|
12
|
+
/** Task types this agent is allowed to handle */
|
|
13
|
+
allowedTaskTypes: string[];
|
|
14
|
+
/** Required inputs before the agent can execute */
|
|
15
|
+
requiredInputs: string[];
|
|
16
|
+
/** Fields that must appear in the agent's structured output */
|
|
17
|
+
expectedOutputFields: string[];
|
|
18
|
+
/** Tools the agent is permitted to use */
|
|
19
|
+
allowedTools: string[];
|
|
20
|
+
/** Actions the agent must never perform */
|
|
21
|
+
forbiddenActions: string[];
|
|
22
|
+
/** Conditions that require escalation or human intervention */
|
|
23
|
+
escalationConditions: string[];
|
|
24
|
+
/** Conditions that should cause the agent to stop */
|
|
25
|
+
stopConditions: string[];
|
|
26
|
+
/** Criteria for a successful run */
|
|
27
|
+
successCriteria: string[];
|
|
28
|
+
}
|
|
29
|
+
export declare function getContract(agent: string): AgentContract | null;
|
|
30
|
+
export declare function getAllContracts(): AgentContract[];
|
|
31
|
+
export declare function listAgentsWithContracts(): string[];
|
|
32
|
+
//# sourceMappingURL=agent-contract-registry.d.ts.map
|
|
@@ -0,0 +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;AA+SD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-performance.d.ts","sourceRoot":"","sources":["../../src/services/agent-performance.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-performance.d.ts","sourceRoot":"","sources":["../../src/services/agent-performance.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEzD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,QAAQ,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,SAAS,GAAG,SAAS,CAAA;CACnC;AA+BD,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,SAAI,GACP,IAAI,CAgCN;AAED,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,QAAQ,CAAA;CAAE,GAChD,cAAc,EAAE,CAQlB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,GAAG,mBAAmB,GAAG,IAAI,CAiBhG;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAatE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Trace Graph Service
|
|
3
|
+
* Records inter-agent execution as a causal span graph.
|
|
4
|
+
* Each agent invocation opens a span; spans link via parent_span_id to form a DAG.
|
|
5
|
+
* Stored in .codebase/AGENT_SPANS.jsonl — reusable by dashboard for timeline and graph views.
|
|
6
|
+
*/
|
|
7
|
+
export type SpanStatus = "running" | "complete" | "failed" | "blocked" | "skipped";
|
|
8
|
+
export interface AgentSpan {
|
|
9
|
+
span_id: string;
|
|
10
|
+
/** trace_id = run_id of the root workflow run */
|
|
11
|
+
trace_id: string;
|
|
12
|
+
/** span_id of the parent invocation; absent for the root agent */
|
|
13
|
+
parent_span_id?: string;
|
|
14
|
+
/** Agent or system that delegated to this agent */
|
|
15
|
+
invoker: string;
|
|
16
|
+
/** This agent's name */
|
|
17
|
+
agent: string;
|
|
18
|
+
task_description: string;
|
|
19
|
+
stage: string;
|
|
20
|
+
started_at: string;
|
|
21
|
+
ended_at?: string;
|
|
22
|
+
status: SpanStatus;
|
|
23
|
+
/** Whether the agent produced a schema-valid output */
|
|
24
|
+
output_valid: boolean;
|
|
25
|
+
/** Contract violation messages recorded during this span */
|
|
26
|
+
contract_violations: string[];
|
|
27
|
+
/** Tool names used during this span */
|
|
28
|
+
tools_used: string[];
|
|
29
|
+
/** Structured payload passed to the next agent */
|
|
30
|
+
handoff_payload?: Record<string, unknown>;
|
|
31
|
+
latency_ms?: number;
|
|
32
|
+
model?: string;
|
|
33
|
+
cost_estimate?: number;
|
|
34
|
+
retry_count: number;
|
|
35
|
+
/** Delegation depth: root agent is 0, its delegate is 1, etc. */
|
|
36
|
+
depth: number;
|
|
37
|
+
}
|
|
38
|
+
export interface TraceGraph {
|
|
39
|
+
trace_id: string;
|
|
40
|
+
root_agent: string;
|
|
41
|
+
started_at: string;
|
|
42
|
+
ended_at?: string;
|
|
43
|
+
spans: AgentSpan[];
|
|
44
|
+
total_agents: number;
|
|
45
|
+
total_unique_tools: number;
|
|
46
|
+
max_depth: number;
|
|
47
|
+
failed_spans: number;
|
|
48
|
+
retry_total: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function agentSpansPath(dir: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Open a new agent span. Call this when an agent is about to start executing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function openSpan(dir: string, opts: {
|
|
55
|
+
trace_id: string;
|
|
56
|
+
invoker: string;
|
|
57
|
+
agent: string;
|
|
58
|
+
task_description: string;
|
|
59
|
+
stage: string;
|
|
60
|
+
parent_span_id?: string;
|
|
61
|
+
depth?: number;
|
|
62
|
+
model?: string;
|
|
63
|
+
}): AgentSpan;
|
|
64
|
+
/**
|
|
65
|
+
* Close a span when an agent finishes (success, failure, or block).
|
|
66
|
+
*/
|
|
67
|
+
export declare function closeSpan(dir: string, span_id: string, status: Exclude<SpanStatus, "running">, opts?: {
|
|
68
|
+
output_valid?: boolean;
|
|
69
|
+
contract_violations?: string[];
|
|
70
|
+
tools_used?: string[];
|
|
71
|
+
handoff_payload?: Record<string, unknown>;
|
|
72
|
+
cost_estimate?: number;
|
|
73
|
+
retry_count?: number;
|
|
74
|
+
}): void;
|
|
75
|
+
/**
|
|
76
|
+
* Append a tool name to the span's tools_used list.
|
|
77
|
+
*/
|
|
78
|
+
export declare function recordToolUsed(dir: string, span_id: string, toolName: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Record a contract violation on the active span.
|
|
81
|
+
*/
|
|
82
|
+
export declare function addSpanViolation(dir: string, span_id: string, violation: string): void;
|
|
83
|
+
export declare function getSpan(dir: string, span_id: string): AgentSpan | null;
|
|
84
|
+
export declare function getTraceSpans(dir: string, trace_id: string): AgentSpan[];
|
|
85
|
+
/**
|
|
86
|
+
* Build the full trace graph for a run.
|
|
87
|
+
* Returns null if no spans exist for the trace.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildTraceGraph(dir: string, trace_id: string): TraceGraph | null;
|
|
90
|
+
/**
|
|
91
|
+
* Return the most recent trace IDs (most recent first).
|
|
92
|
+
*/
|
|
93
|
+
export declare function listRecentTraceIds(dir: string, limit?: number): string[];
|
|
94
|
+
//# sourceMappingURL=agent-trace-graph.d.ts.map
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AM,GAAG,IAAI,CAMtF;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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Validator
|
|
3
|
+
* Validates agent behavior against capability contracts.
|
|
4
|
+
* Emits policy violations to telemetry and returns a decision (allow/warn/block/escalate).
|
|
5
|
+
*/
|
|
6
|
+
export type ValidatorMode = "off" | "advisory" | "strict";
|
|
7
|
+
export type ValidatorAction = "allow" | "warn" | "block" | "escalate";
|
|
8
|
+
export interface ValidationViolation {
|
|
9
|
+
rule: string;
|
|
10
|
+
detail: string;
|
|
11
|
+
severity: "info" | "warn" | "block";
|
|
12
|
+
}
|
|
13
|
+
export interface ValidationResult {
|
|
14
|
+
agent: string;
|
|
15
|
+
valid: boolean;
|
|
16
|
+
action: ValidatorAction;
|
|
17
|
+
violations: ValidationViolation[];
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentExecutionContext {
|
|
21
|
+
/** Agent being validated */
|
|
22
|
+
agent: string;
|
|
23
|
+
/** Tool the agent is about to call (for pre-call checks) */
|
|
24
|
+
toolUsed?: string;
|
|
25
|
+
/** Task type assigned to this agent */
|
|
26
|
+
taskType?: string;
|
|
27
|
+
/** Current workflow stage */
|
|
28
|
+
currentStage?: string;
|
|
29
|
+
/** Whether required inputs are all present */
|
|
30
|
+
prerequisitesMet?: boolean;
|
|
31
|
+
/** Specific inputs that are missing */
|
|
32
|
+
missingInputs?: string[];
|
|
33
|
+
/** Whether an approval gate applies */
|
|
34
|
+
approvalRequired?: boolean;
|
|
35
|
+
/** Whether approval has been granted */
|
|
36
|
+
approvalGranted?: boolean;
|
|
37
|
+
/** For telemetry correlation */
|
|
38
|
+
run_id?: string;
|
|
39
|
+
session_id?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function resolveValidatorMode(directory: string): ValidatorMode;
|
|
42
|
+
/**
|
|
43
|
+
* Validate an agent against its contract before or after execution.
|
|
44
|
+
* In "off" mode, always returns allow.
|
|
45
|
+
* In "advisory" mode, returns warn even on block-level violations.
|
|
46
|
+
* In "strict" mode, returns block on block-level violations.
|
|
47
|
+
*/
|
|
48
|
+
export declare function validateAgent(directory: string, ctx: AgentExecutionContext): ValidationResult;
|
|
49
|
+
/**
|
|
50
|
+
* Convenience check: is this tool call allowed for this agent?
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateToolAccess(directory: string, agent: string, toolName: string, opts?: {
|
|
53
|
+
run_id?: string;
|
|
54
|
+
session_id?: string;
|
|
55
|
+
}): ValidationResult;
|
|
56
|
+
//# sourceMappingURL=agent-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-validator.d.ts","sourceRoot":"","sources":["../../src/services/agent-validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,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,CAQrE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,qBAAqB,GACzB,gBAAgB,CAmGlB;AAED;;GAEG;AACH,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deadlock and Loop Detector
|
|
3
|
+
* Analyzes agent spans for stuck execution patterns:
|
|
4
|
+
* - Agent bounce: two agents repeatedly hand off the same unresolved task
|
|
5
|
+
* - Step retry loop: same agent:stage executed beyond threshold without progress
|
|
6
|
+
* - Circular delegation: A → B → ... → A
|
|
7
|
+
* - Stage stall: a span has been "running" longer than the stall threshold
|
|
8
|
+
*
|
|
9
|
+
* New signals are appended to .codebase/DEADLOCK_SIGNALS.jsonl.
|
|
10
|
+
*/
|
|
11
|
+
export type DeadlockType = "agent_bounce" | "step_retry_loop" | "circular_delegation" | "stage_stall";
|
|
12
|
+
export type RecoveryAction = "retry_with_context" | "fallback_agent" | "escalate_human" | "stop";
|
|
13
|
+
export interface DeadlockSignal {
|
|
14
|
+
signal_id: string;
|
|
15
|
+
trace_id: string;
|
|
16
|
+
detected_at: string;
|
|
17
|
+
type: DeadlockType;
|
|
18
|
+
evidence: string[];
|
|
19
|
+
agents_involved: string[];
|
|
20
|
+
recommended_action: RecoveryAction;
|
|
21
|
+
/** Whether the system should auto-stop the run (from config) */
|
|
22
|
+
auto_stop: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function deadlockSignalsPath(dir: string): string;
|
|
25
|
+
export declare function getSignals(dir: string, trace_id?: string): DeadlockSignal[];
|
|
26
|
+
/**
|
|
27
|
+
* Run all detectors for a trace. Returns newly detected signals (not previously emitted).
|
|
28
|
+
*/
|
|
29
|
+
export declare function detectDeadlocks(dir: string, trace_id: string): DeadlockSignal[];
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if any signal for this trace has auto_stop=true.
|
|
32
|
+
*/
|
|
33
|
+
export declare function isTraceStuck(dir: string, trace_id: string): boolean;
|
|
34
|
+
//# sourceMappingURL=deadlock-detector.d.ts.map
|
|
@@ -0,0 +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;AAkID;;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,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Budget Manager
|
|
3
|
+
* Tracks and enforces per-run limits on tool calls, delegations, retries, and depth.
|
|
4
|
+
* Stored in .codebase/BUDGETS.json.
|
|
5
|
+
* When a limit is reached the run should stop, escalate, or enter fallback mode.
|
|
6
|
+
*/
|
|
7
|
+
export type BudgetStatus = "active" | "warning" | "exhausted" | "completed";
|
|
8
|
+
export interface BudgetLimits {
|
|
9
|
+
maxToolCalls: number;
|
|
10
|
+
maxDelegatedAgents: number;
|
|
11
|
+
maxRetries: number;
|
|
12
|
+
maxDepth: number;
|
|
13
|
+
maxSameStepRetries: number;
|
|
14
|
+
}
|
|
15
|
+
export interface BudgetConsumed {
|
|
16
|
+
toolCalls: number;
|
|
17
|
+
delegatedAgents: number;
|
|
18
|
+
retries: number;
|
|
19
|
+
maxDepthReached: number;
|
|
20
|
+
/** step_id → retry count */
|
|
21
|
+
sameStepRetries: Record<string, number>;
|
|
22
|
+
}
|
|
23
|
+
export interface DelegationBudget {
|
|
24
|
+
run_id: string;
|
|
25
|
+
session_id: string;
|
|
26
|
+
created_at: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
limits: BudgetLimits;
|
|
29
|
+
consumed: BudgetConsumed;
|
|
30
|
+
status: BudgetStatus;
|
|
31
|
+
exhaustion_reason?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface BudgetCheckResult {
|
|
34
|
+
allowed: boolean;
|
|
35
|
+
warning: boolean;
|
|
36
|
+
reason?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function createBudget(dir: string, run_id: string, session_id?: string): DelegationBudget;
|
|
39
|
+
export declare function getBudget(dir: string, run_id: string): DelegationBudget | null;
|
|
40
|
+
export declare function isBudgetExhausted(dir: string, run_id: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Increment tool call counter. Returns whether the call is allowed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function recordToolCall(dir: string, run_id: string): BudgetCheckResult;
|
|
45
|
+
/**
|
|
46
|
+
* Increment delegation counter and track max depth.
|
|
47
|
+
*/
|
|
48
|
+
export declare function recordDelegation(dir: string, run_id: string, depth: number): BudgetCheckResult;
|
|
49
|
+
/**
|
|
50
|
+
* Increment retry counter for a specific step. Enforces both per-step and total limits.
|
|
51
|
+
*/
|
|
52
|
+
export declare function recordRetry(dir: string, run_id: string, step_id: string): BudgetCheckResult;
|
|
53
|
+
export declare function completeBudget(dir: string, run_id: string): void;
|
|
54
|
+
//# 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;;;;;GAKG;AAOH,MAAM,MAA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AAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAsB7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAgC9F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAiC3F;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEhE"}
|
|
@@ -0,0 +1 @@
|
|
|
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
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export * from "./telemetry";
|
|
2
2
|
export * from "./run-trace";
|
|
3
3
|
export * from "./approval-manager";
|
|
4
|
-
export * from "./model-router";
|
|
5
4
|
export * from "./agent-performance";
|
|
6
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";
|
|
7
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
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";
|
|
2
2
|
export interface TelemetryEvent {
|
|
3
3
|
id: string;
|
|
4
4
|
ts: string;
|
|
@@ -1 +1 @@
|
|
|
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,CAAA;
|
|
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,G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f,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"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Scorecard Service
|
|
3
|
+
* Generates a quality score for every completed or failed workflow run.
|
|
4
|
+
* Scores across 10 dimensions; stored in .codebase/SCORECARDS.jsonl for trend analysis.
|
|
5
|
+
*/
|
|
6
|
+
import type { RunTrace } from "./run-trace";
|
|
7
|
+
export interface ScorecardDimensions {
|
|
8
|
+
/** Agents followed phase order and didn't skip required stages */
|
|
9
|
+
stageCompliance: number;
|
|
10
|
+
/** Design-first process followed for UI-heavy tasks */
|
|
11
|
+
designFirstCompliance: number;
|
|
12
|
+
/** TDD cycle followed (tests before implementation) */
|
|
13
|
+
tddCompliance: number;
|
|
14
|
+
/** Required approvals obtained before proceeding */
|
|
15
|
+
approvalCompliance: number;
|
|
16
|
+
/** Review step completed before marking done */
|
|
17
|
+
reviewQuality: number;
|
|
18
|
+
/** Low retry rate: 1 - (retries / maxRetries) */
|
|
19
|
+
retryEfficiency: number;
|
|
20
|
+
/** Tool call budget used efficiently */
|
|
21
|
+
budgetEfficiency: number;
|
|
22
|
+
/** Tool calls succeeded without errors */
|
|
23
|
+
toolReliability: number;
|
|
24
|
+
/** Agents produced valid, schema-conforming outputs */
|
|
25
|
+
handoffQuality: number;
|
|
26
|
+
/** No agent contract violations */
|
|
27
|
+
contractCompliance: number;
|
|
28
|
+
}
|
|
29
|
+
export interface WorkflowScorecard {
|
|
30
|
+
scorecard_id: string;
|
|
31
|
+
run_id: string;
|
|
32
|
+
session_id: string;
|
|
33
|
+
command: string;
|
|
34
|
+
generated_at: string;
|
|
35
|
+
completion_status: "complete" | "failed" | "blocked" | "cancelled";
|
|
36
|
+
dimensions: ScorecardDimensions;
|
|
37
|
+
/** Weighted average across all dimensions, 0–100 */
|
|
38
|
+
overall_score: number;
|
|
39
|
+
policy_violations: number;
|
|
40
|
+
human_interventions: number;
|
|
41
|
+
overrides_used: number;
|
|
42
|
+
deadlock_signals: number;
|
|
43
|
+
success_reason?: string;
|
|
44
|
+
failure_reason?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ScorecardInput {
|
|
47
|
+
/** Pass false to penalize design-first compliance */
|
|
48
|
+
design_first_compliant?: boolean;
|
|
49
|
+
/** Pass false to penalize TDD compliance */
|
|
50
|
+
tdd_compliant?: boolean;
|
|
51
|
+
/** Pass false to penalize approval compliance */
|
|
52
|
+
approval_compliant?: boolean;
|
|
53
|
+
/** Pass false to penalize review quality */
|
|
54
|
+
review_completed?: boolean;
|
|
55
|
+
policy_violations?: number;
|
|
56
|
+
human_interventions?: number;
|
|
57
|
+
overrides_used?: number;
|
|
58
|
+
}
|
|
59
|
+
export declare function scorecardsPath(dir: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Generate and persist a scorecard for the given run.
|
|
62
|
+
* Call this when a run transitions to complete/failed/cancelled.
|
|
63
|
+
*/
|
|
64
|
+
export declare function generateScorecard(dir: string, trace: RunTrace, input?: ScorecardInput): WorkflowScorecard;
|
|
65
|
+
export declare function readScorecards(dir: string, limit?: number): WorkflowScorecard[];
|
|
66
|
+
export declare function getScorecardByRun(dir: string, run_id: string): WorkflowScorecard | null;
|
|
67
|
+
/**
|
|
68
|
+
* Return the last N scorecards, optionally filtered by command.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getScorecardTrend(dir: string, command?: string, limit?: number): WorkflowScorecard[];
|
|
71
|
+
/**
|
|
72
|
+
* Average overall score across recent runs, optionally for a specific command.
|
|
73
|
+
* Returns null if no data exists.
|
|
74
|
+
*/
|
|
75
|
+
export declare function computeAverageScore(dir: string, command?: string): number | null;
|
|
76
|
+
//# sourceMappingURL=workflow-scorecard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-scorecard.d.ts","sourceRoot":"","sources":["../../src/services/workflow-scorecard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAM3C,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,eAAe,EAAE,MAAM,CAAA;IACvB,uDAAuD;IACvD,qBAAqB,EAAE,MAAM,CAAA;IAC7B,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAA;IACrB,oDAAoD;IACpD,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAA;IACrB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAA;IACvB,wCAAwC;IACxC,gBAAgB,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,eAAe,EAAE,MAAM,CAAA;IACvB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAA;IACtB,mCAAmC;IACnC,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAA;IAClE,UAAU,EAAE,mBAAmB,CAAA;IAC/B,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB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AAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/tools/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWtD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CA6HzE"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
export type TaskType = "planning" | "design" | "implementation" | "debugging" | "review" | "testing" | "documentation" | "analysis" | "security" | "orchestration";
|
|
2
2
|
export declare function shouldRetry(promptRes: any): boolean;
|
|
3
3
|
export declare function isTransientError(text?: string): boolean;
|
|
4
4
|
export declare function normalizeTaskType(taskType: string | undefined, agent: string): TaskType;
|
|
5
5
|
export declare function isTaskType(value: string): value is TaskType;
|
|
6
|
+
export declare function isUiHeavyTask(input: string): boolean;
|
|
7
|
+
export type UiTaskType = "landing-page" | "dashboard" | "admin-panel" | "marketing-site" | "mobile-app" | "saas-app" | "internal-tool" | "app-screen" | "general-ui";
|
|
8
|
+
export declare function classifyUiTaskType(input: string): UiTaskType | null;
|
|
6
9
|
//# sourceMappingURL=dispatch-routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-routing.d.ts","sourceRoot":"","sources":["../../src/tools/dispatch-routing.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"dispatch-routing.d.ts","sourceRoot":"","sources":["../../src/tools/dispatch-routing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,QAAQ,GACR,gBAAgB,GAChB,WAAW,GACX,QAAQ,GACR,SAAS,GACT,eAAe,GACf,UAAU,GACV,UAAU,GACV,eAAe,CAAA;AAEnB,wBAAgB,WAAW,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAOnD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAUvD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAevF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAa3D;AAmCD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED,MAAM,MAAM,UAAU,GAClB,cAAc,GACd,WAAW,GACX,aAAa,GACb,gBAAgB,GAChB,YAAY,GACZ,UAAU,GACV,eAAe,GACf,YAAY,GACZ,YAAY,CAAA;AAEhB,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAYnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch-routing.test.d.ts","sourceRoot":"","sources":["../../src/tools/dispatch-routing.test.ts"],"names":[],"mappings":""}
|
|
@@ -35,6 +35,13 @@ export interface PlanningState {
|
|
|
35
35
|
phase: number;
|
|
36
36
|
status: string;
|
|
37
37
|
plan_confirmed: boolean;
|
|
38
|
+
task_type?: string;
|
|
39
|
+
requires_design_first: boolean;
|
|
40
|
+
design_stage: "pending" | "discovery" | "ux_planning" | "wireframe_layout" | "visual_system_definition" | "design_approval" | "handoff_complete";
|
|
41
|
+
design_approved: boolean;
|
|
42
|
+
design_override: boolean;
|
|
43
|
+
design_override_reason?: string;
|
|
44
|
+
design_artifact?: string;
|
|
38
45
|
steps_complete: number[];
|
|
39
46
|
steps_pending: number[];
|
|
40
47
|
last_action: string;
|
|
@@ -52,6 +59,7 @@ export declare function parseState(content: string): Record<string, unknown>;
|
|
|
52
59
|
export declare function timestamp(): string;
|
|
53
60
|
export declare function appendHistory(stateContent: string, action: string): string;
|
|
54
61
|
export declare function readPlanningState(dir: string): PlanningState;
|
|
62
|
+
export declare function hasDesignGateSatisfied(state: PlanningState): boolean;
|
|
55
63
|
export declare function updateTDDState(dir: string, updates: Partial<TDDState>): void;
|
|
56
64
|
export declare function logTDDOverride(dir: string, stage: string, reason: string, override_by: string): void;
|
|
57
65
|
export declare function updatePlanningState(dir: string, updates: Partial<PlanningState>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning-state-lib.d.ts","sourceRoot":"","sources":["../../src/tools/planning-state-lib.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,MAAM,WAAW,QAAQ;IACvB,4EAA4E;IAC5E,KAAK,EAAE,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;IAC7D,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,SAAS,EAAE,WAAW,EAAE,CAAA;IACxB,gDAAgD;IAChD,qBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,sCAAsC;IACtC,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACn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G,IAAI,CAiBjE;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAMhF;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,QAAQ,GAAG,UAAU,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAerJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning-state.d.ts","sourceRoot":"","sources":["../../src/tools/planning-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAM/D,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"planning-state.d.ts","sourceRoot":"","sources":["../../src/tools/planning-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAM/D,eAAO,MAAM,iBAAiB,EAAE,cA0I9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-pipeline.d.ts","sourceRoot":"","sources":["../../src/tools/run-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"run-pipeline.d.ts","sourceRoot":"","sources":["../../src/tools/run-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AA4BtD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAuH5E"}
|