cclaw-cli 7.7.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +210 -134
- package/dist/artifact-frontmatter.d.ts +51 -0
- package/dist/artifact-frontmatter.js +131 -0
- package/dist/artifact-paths.d.ts +7 -27
- package/dist/artifact-paths.js +20 -249
- package/dist/cancel.d.ts +16 -0
- package/dist/cancel.js +66 -0
- package/dist/cli.d.ts +2 -27
- package/dist/cli.js +90 -508
- package/dist/compound.d.ts +26 -0
- package/dist/compound.js +96 -0
- package/dist/config.d.ts +14 -51
- package/dist/config.js +23 -359
- package/dist/constants.d.ts +11 -18
- package/dist/constants.js +19 -106
- package/dist/content/antipatterns.d.ts +1 -0
- package/dist/content/antipatterns.js +109 -0
- package/dist/content/artifact-templates.d.ts +10 -0
- package/dist/content/artifact-templates.js +550 -0
- package/dist/content/cancel-command.d.ts +2 -2
- package/dist/content/cancel-command.js +25 -17
- package/dist/content/core-agents.d.ts +9 -233
- package/dist/content/core-agents.js +39 -768
- package/dist/content/decision-protocol.d.ts +1 -12
- package/dist/content/decision-protocol.js +27 -20
- package/dist/content/examples.d.ts +8 -42
- package/dist/content/examples.js +293 -425
- package/dist/content/idea-command.d.ts +2 -0
- package/dist/content/idea-command.js +38 -0
- package/dist/content/iron-laws.d.ts +4 -138
- package/dist/content/iron-laws.js +18 -197
- package/dist/content/meta-skill.d.ts +1 -3
- package/dist/content/meta-skill.js +57 -134
- package/dist/content/node-hooks.d.ts +12 -8
- package/dist/content/node-hooks.js +188 -838
- package/dist/content/recovery.d.ts +8 -0
- package/dist/content/recovery.js +179 -0
- package/dist/content/reference-patterns.d.ts +4 -13
- package/dist/content/reference-patterns.js +260 -389
- package/dist/content/research-playbooks.d.ts +8 -8
- package/dist/content/research-playbooks.js +108 -121
- package/dist/content/review-loop.d.ts +6 -192
- package/dist/content/review-loop.js +29 -731
- package/dist/content/skills.d.ts +8 -38
- package/dist/content/skills.js +681 -732
- package/dist/content/specialist-prompts/architect.d.ts +1 -0
- package/dist/content/specialist-prompts/architect.js +225 -0
- package/dist/content/specialist-prompts/brainstormer.d.ts +1 -0
- package/dist/content/specialist-prompts/brainstormer.js +168 -0
- package/dist/content/specialist-prompts/index.d.ts +2 -0
- package/dist/content/specialist-prompts/index.js +14 -0
- package/dist/content/specialist-prompts/planner.d.ts +1 -0
- package/dist/content/specialist-prompts/planner.js +182 -0
- package/dist/content/specialist-prompts/reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/reviewer.js +193 -0
- package/dist/content/specialist-prompts/security-reviewer.d.ts +1 -0
- package/dist/content/specialist-prompts/security-reviewer.js +133 -0
- package/dist/content/specialist-prompts/slice-builder.d.ts +1 -0
- package/dist/content/specialist-prompts/slice-builder.js +232 -0
- package/dist/content/stage-playbooks.d.ts +8 -0
- package/dist/content/stage-playbooks.js +404 -0
- package/dist/content/start-command.d.ts +2 -12
- package/dist/content/start-command.js +221 -207
- package/dist/flow-state.d.ts +21 -178
- package/dist/flow-state.js +67 -170
- package/dist/fs-utils.d.ts +6 -26
- package/dist/fs-utils.js +29 -162
- package/dist/gitignore.d.ts +2 -1
- package/dist/gitignore.js +51 -34
- package/dist/harness-detect.d.ts +10 -0
- package/dist/harness-detect.js +29 -0
- package/dist/install.d.ts +27 -15
- package/dist/install.js +230 -1342
- package/dist/knowledge-store.d.ts +19 -163
- package/dist/knowledge-store.js +56 -590
- package/dist/logger.d.ts +8 -3
- package/dist/logger.js +13 -4
- package/dist/orchestrator-routing.d.ts +29 -0
- package/dist/orchestrator-routing.js +156 -0
- package/dist/run-persistence.d.ts +7 -118
- package/dist/run-persistence.js +29 -845
- package/dist/runtime/run-hook.entry.d.ts +1 -3
- package/dist/runtime/run-hook.entry.js +19 -4
- package/dist/runtime/run-hook.mjs +13 -1024
- package/dist/types.d.ts +25 -261
- package/dist/types.js +8 -36
- package/package.json +6 -3
- package/dist/artifact-linter/brainstorm.d.ts +0 -2
- package/dist/artifact-linter/brainstorm.js +0 -353
- package/dist/artifact-linter/design.d.ts +0 -18
- package/dist/artifact-linter/design.js +0 -444
- package/dist/artifact-linter/findings-dedup.d.ts +0 -56
- package/dist/artifact-linter/findings-dedup.js +0 -232
- package/dist/artifact-linter/plan.d.ts +0 -2
- package/dist/artifact-linter/plan.js +0 -826
- package/dist/artifact-linter/review-army.d.ts +0 -49
- package/dist/artifact-linter/review-army.js +0 -520
- package/dist/artifact-linter/review.d.ts +0 -2
- package/dist/artifact-linter/review.js +0 -113
- package/dist/artifact-linter/scope.d.ts +0 -2
- package/dist/artifact-linter/scope.js +0 -158
- package/dist/artifact-linter/shared.d.ts +0 -637
- package/dist/artifact-linter/shared.js +0 -2163
- package/dist/artifact-linter/ship.d.ts +0 -2
- package/dist/artifact-linter/ship.js +0 -250
- package/dist/artifact-linter/spec.d.ts +0 -2
- package/dist/artifact-linter/spec.js +0 -176
- package/dist/artifact-linter/tdd.d.ts +0 -118
- package/dist/artifact-linter/tdd.js +0 -1404
- package/dist/artifact-linter.d.ts +0 -15
- package/dist/artifact-linter.js +0 -517
- package/dist/codex-feature-flag.d.ts +0 -58
- package/dist/codex-feature-flag.js +0 -193
- package/dist/content/closeout-guidance.d.ts +0 -14
- package/dist/content/closeout-guidance.js +0 -44
- package/dist/content/diff-command.d.ts +0 -1
- package/dist/content/diff-command.js +0 -43
- package/dist/content/harness-doc.d.ts +0 -1
- package/dist/content/harness-doc.js +0 -65
- package/dist/content/hook-events.d.ts +0 -9
- package/dist/content/hook-events.js +0 -23
- package/dist/content/hook-manifest.d.ts +0 -81
- package/dist/content/hook-manifest.js +0 -156
- package/dist/content/hooks.d.ts +0 -11
- package/dist/content/hooks.js +0 -1972
- package/dist/content/idea.d.ts +0 -60
- package/dist/content/idea.js +0 -416
- package/dist/content/language-policy.d.ts +0 -2
- package/dist/content/language-policy.js +0 -13
- package/dist/content/learnings.d.ts +0 -6
- package/dist/content/learnings.js +0 -141
- package/dist/content/observe.d.ts +0 -19
- package/dist/content/observe.js +0 -86
- package/dist/content/opencode-plugin.d.ts +0 -1
- package/dist/content/opencode-plugin.js +0 -635
- package/dist/content/review-prompts.d.ts +0 -1
- package/dist/content/review-prompts.js +0 -104
- package/dist/content/runtime-shared-snippets.d.ts +0 -8
- package/dist/content/runtime-shared-snippets.js +0 -80
- package/dist/content/session-hooks.d.ts +0 -7
- package/dist/content/session-hooks.js +0 -107
- package/dist/content/skills-elicitation.d.ts +0 -1
- package/dist/content/skills-elicitation.js +0 -167
- package/dist/content/stage-command.d.ts +0 -2
- package/dist/content/stage-command.js +0 -17
- package/dist/content/stage-schema.d.ts +0 -117
- package/dist/content/stage-schema.js +0 -955
- package/dist/content/stages/_lint-metadata/index.d.ts +0 -2
- package/dist/content/stages/_lint-metadata/index.js +0 -97
- package/dist/content/stages/brainstorm.d.ts +0 -2
- package/dist/content/stages/brainstorm.js +0 -184
- package/dist/content/stages/design.d.ts +0 -2
- package/dist/content/stages/design.js +0 -288
- package/dist/content/stages/index.d.ts +0 -8
- package/dist/content/stages/index.js +0 -11
- package/dist/content/stages/plan.d.ts +0 -2
- package/dist/content/stages/plan.js +0 -191
- package/dist/content/stages/review.d.ts +0 -2
- package/dist/content/stages/review.js +0 -240
- package/dist/content/stages/schema-types.d.ts +0 -203
- package/dist/content/stages/schema-types.js +0 -1
- package/dist/content/stages/scope.d.ts +0 -2
- package/dist/content/stages/scope.js +0 -254
- package/dist/content/stages/ship.d.ts +0 -2
- package/dist/content/stages/ship.js +0 -159
- package/dist/content/stages/spec.d.ts +0 -2
- package/dist/content/stages/spec.js +0 -170
- package/dist/content/stages/tdd.d.ts +0 -4
- package/dist/content/stages/tdd.js +0 -273
- package/dist/content/state-contracts.d.ts +0 -1
- package/dist/content/state-contracts.js +0 -63
- package/dist/content/status-command.d.ts +0 -4
- package/dist/content/status-command.js +0 -109
- package/dist/content/subagent-context-skills.d.ts +0 -4
- package/dist/content/subagent-context-skills.js +0 -279
- package/dist/content/subagents.d.ts +0 -3
- package/dist/content/subagents.js +0 -997
- package/dist/content/templates.d.ts +0 -26
- package/dist/content/templates.js +0 -1692
- package/dist/content/track-render-context.d.ts +0 -18
- package/dist/content/track-render-context.js +0 -53
- package/dist/content/tree-command.d.ts +0 -1
- package/dist/content/tree-command.js +0 -64
- package/dist/content/utility-skills.d.ts +0 -30
- package/dist/content/utility-skills.js +0 -160
- package/dist/content/view-command.d.ts +0 -2
- package/dist/content/view-command.js +0 -92
- package/dist/delegation.d.ts +0 -649
- package/dist/delegation.js +0 -1539
- package/dist/early-loop.d.ts +0 -70
- package/dist/early-loop.js +0 -302
- package/dist/execution-topology.d.ts +0 -44
- package/dist/execution-topology.js +0 -95
- package/dist/gate-evidence.d.ts +0 -85
- package/dist/gate-evidence.js +0 -631
- package/dist/harness-adapters.d.ts +0 -151
- package/dist/harness-adapters.js +0 -756
- package/dist/harness-selection.d.ts +0 -31
- package/dist/harness-selection.js +0 -214
- package/dist/hook-schema.d.ts +0 -6
- package/dist/hook-schema.js +0 -114
- package/dist/hook-schemas/claude-hooks.v1.json +0 -10
- package/dist/hook-schemas/codex-hooks.v1.json +0 -10
- package/dist/hook-schemas/cursor-hooks.v1.json +0 -13
- package/dist/init-detect.d.ts +0 -2
- package/dist/init-detect.js +0 -50
- package/dist/internal/advance-stage/advance.d.ts +0 -89
- package/dist/internal/advance-stage/advance.js +0 -655
- package/dist/internal/advance-stage/cancel-run.d.ts +0 -8
- package/dist/internal/advance-stage/cancel-run.js +0 -19
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +0 -3
- package/dist/internal/advance-stage/flow-state-coercion.js +0 -81
- package/dist/internal/advance-stage/helpers.d.ts +0 -14
- package/dist/internal/advance-stage/helpers.js +0 -145
- package/dist/internal/advance-stage/hook.d.ts +0 -8
- package/dist/internal/advance-stage/hook.js +0 -40
- package/dist/internal/advance-stage/parsers.d.ts +0 -72
- package/dist/internal/advance-stage/parsers.js +0 -357
- package/dist/internal/advance-stage/proactive-delegation-trace.d.ts +0 -24
- package/dist/internal/advance-stage/proactive-delegation-trace.js +0 -56
- package/dist/internal/advance-stage/review-loop.d.ts +0 -16
- package/dist/internal/advance-stage/review-loop.js +0 -199
- package/dist/internal/advance-stage/rewind.d.ts +0 -14
- package/dist/internal/advance-stage/rewind.js +0 -108
- package/dist/internal/advance-stage/start-flow.d.ts +0 -13
- package/dist/internal/advance-stage/start-flow.js +0 -241
- package/dist/internal/advance-stage/verify.d.ts +0 -21
- package/dist/internal/advance-stage/verify.js +0 -185
- package/dist/internal/advance-stage.d.ts +0 -7
- package/dist/internal/advance-stage.js +0 -138
- package/dist/internal/cohesion-contract-stub.d.ts +0 -24
- package/dist/internal/cohesion-contract-stub.js +0 -148
- package/dist/internal/compound-readiness.d.ts +0 -23
- package/dist/internal/compound-readiness.js +0 -102
- package/dist/internal/detect-public-api-changes.d.ts +0 -5
- package/dist/internal/detect-public-api-changes.js +0 -45
- package/dist/internal/detect-supply-chain-changes.d.ts +0 -6
- package/dist/internal/detect-supply-chain-changes.js +0 -138
- package/dist/internal/early-loop-status.d.ts +0 -7
- package/dist/internal/early-loop-status.js +0 -93
- package/dist/internal/envelope-validate.d.ts +0 -7
- package/dist/internal/envelope-validate.js +0 -66
- package/dist/internal/flow-state-repair.d.ts +0 -20
- package/dist/internal/flow-state-repair.js +0 -104
- package/dist/internal/plan-split-waves.d.ts +0 -190
- package/dist/internal/plan-split-waves.js +0 -764
- package/dist/internal/runtime-integrity.d.ts +0 -7
- package/dist/internal/runtime-integrity.js +0 -268
- package/dist/internal/slice-commit.d.ts +0 -7
- package/dist/internal/slice-commit.js +0 -619
- package/dist/internal/tdd-loop-status.d.ts +0 -14
- package/dist/internal/tdd-loop-status.js +0 -68
- package/dist/internal/tdd-red-evidence.d.ts +0 -7
- package/dist/internal/tdd-red-evidence.js +0 -153
- package/dist/internal/waiver-grant.d.ts +0 -62
- package/dist/internal/waiver-grant.js +0 -294
- package/dist/internal/wave-status.d.ts +0 -74
- package/dist/internal/wave-status.js +0 -506
- package/dist/managed-resources.d.ts +0 -53
- package/dist/managed-resources.js +0 -313
- package/dist/policy.d.ts +0 -10
- package/dist/policy.js +0 -167
- package/dist/retro-gate.d.ts +0 -9
- package/dist/retro-gate.js +0 -47
- package/dist/run-archive.d.ts +0 -61
- package/dist/run-archive.js +0 -391
- package/dist/runs.d.ts +0 -2
- package/dist/runs.js +0 -2
- package/dist/stack-detection.d.ts +0 -116
- package/dist/stack-detection.js +0 -489
- package/dist/streaming/event-stream.d.ts +0 -31
- package/dist/streaming/event-stream.js +0 -114
- package/dist/tdd-cycle.d.ts +0 -107
- package/dist/tdd-cycle.js +0 -289
- package/dist/tdd-verification-evidence.d.ts +0 -17
- package/dist/tdd-verification-evidence.js +0 -122
- package/dist/track-heuristics.d.ts +0 -27
- package/dist/track-heuristics.js +0 -154
- package/dist/util/slice-id.d.ts +0 -58
- package/dist/util/slice-id.js +0 -89
- package/dist/worktree-manager.d.ts +0 -20
- package/dist/worktree-manager.js +0 -108
package/dist/delegation.d.ts
DELETED
|
@@ -1,649 +0,0 @@
|
|
|
1
|
-
import { type SubagentFallback } from "./harness-adapters.js";
|
|
2
|
-
import { type MandatoryDelegationTaskClass } from "./content/stage-schema.js";
|
|
3
|
-
import type { FlowStage } from "./types.js";
|
|
4
|
-
import { type FlowState } from "./flow-state.js";
|
|
5
|
-
import { type ParseImplementationUnitParallelOptions, type ParsedParallelWave } from "./internal/plan-split-waves.js";
|
|
6
|
-
export type DelegationMode = "mandatory" | "proactive";
|
|
7
|
-
export type DelegationStatus = "scheduled" | "launched" | "acknowledged" | "completed" | "failed" | "waived" | "stale";
|
|
8
|
-
export declare const DELEGATION_DISPATCH_SURFACES: readonly ["claude-task", "cursor-task", "opencode-agent", "codex-agent", "generic-task", "role-switch", "manual"];
|
|
9
|
-
export type DelegationDispatchSurface = typeof DELEGATION_DISPATCH_SURFACES[number];
|
|
10
|
-
/** Agents that declare `claimedPaths` for parallel/disjoint scheduling and fan-out caps. */
|
|
11
|
-
export declare function isParallelTddSliceWorker(agent: string | undefined): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Per-surface allowed agent-definition path prefixes. Used by the generated
|
|
14
|
-
* `.cclaw/hooks/delegation-record.mjs` helper to reject mismatched
|
|
15
|
-
* `--agent-definition-path` values without inspecting any harness state.
|
|
16
|
-
*
|
|
17
|
-
* The list is intentionally structural: each surface maps to one or more
|
|
18
|
-
* repo-relative path prefixes that must be a parent of the supplied path.
|
|
19
|
-
* `role-switch` and `manual` accept any path because the agent-definition
|
|
20
|
-
* is intentionally not a generated artifact for those surfaces.
|
|
21
|
-
*/
|
|
22
|
-
export declare const DELEGATION_DISPATCH_SURFACE_PATH_PREFIXES: Record<DelegationDispatchSurface, string[]>;
|
|
23
|
-
export type DelegationEventType = DelegationStatus;
|
|
24
|
-
/**
|
|
25
|
-
* How a delegation was actually fulfilled. Advisory — mirrors the harness
|
|
26
|
-
* `subagentFallback` that was in effect when the entry was recorded.
|
|
27
|
-
*
|
|
28
|
-
* - `isolated` — native isolated subagent worker (Claude/OpenCode/Codex).
|
|
29
|
-
* - `generic-dispatch` — generic Task/Subagent dispatch mapped to a named role.
|
|
30
|
-
* - `role-switch` — performed in-session with explicit role announce.
|
|
31
|
-
* - `harness-waiver` — auto-waived due to missing dispatch capability.
|
|
32
|
-
* - `legacy-inferred` — pre-v3 entry: completed status without dispatch
|
|
33
|
-
* surface/proof. Read-only; stage-complete reports it as a warning until
|
|
34
|
-
* the entry is re-recorded via `delegation-record.mjs --rerecord`.
|
|
35
|
-
*/
|
|
36
|
-
export type DelegationFulfillmentMode = "isolated" | "generic-dispatch" | "role-switch" | "harness-waiver" | "legacy-inferred";
|
|
37
|
-
export interface DelegationTokenUsage {
|
|
38
|
-
input: number;
|
|
39
|
-
output: number;
|
|
40
|
-
model: string;
|
|
41
|
-
}
|
|
42
|
-
export type DelegationWaiverAcceptedBy = "user-flag";
|
|
43
|
-
export type DelegationEntry = {
|
|
44
|
-
stage: string;
|
|
45
|
-
agent: string;
|
|
46
|
-
mode: DelegationMode;
|
|
47
|
-
status: DelegationStatus;
|
|
48
|
-
/**
|
|
49
|
-
* Span identifier for this delegation unit. Multiple status transitions for
|
|
50
|
-
* the same delegated unit should reuse the same spanId.
|
|
51
|
-
*/
|
|
52
|
-
spanId?: string;
|
|
53
|
-
/** Parent span id when this delegation was spawned from another span. */
|
|
54
|
-
parentSpanId?: string;
|
|
55
|
-
/** ISO timestamp when the delegation span started. */
|
|
56
|
-
startTs?: string;
|
|
57
|
-
/** ISO timestamp when the delegation span ended (for terminal statuses). */
|
|
58
|
-
endTs?: string;
|
|
59
|
-
/**
|
|
60
|
-
* Legacy timestamp used by historical ledgers. New writers set both `ts` and
|
|
61
|
-
* `startTs` for backward compatibility.
|
|
62
|
-
*/
|
|
63
|
-
taskId?: string;
|
|
64
|
-
waiverReason?: string;
|
|
65
|
-
acceptedBy?: DelegationWaiverAcceptedBy;
|
|
66
|
-
/**
|
|
67
|
-
* Waiver approval token captured from `cclaw-cli internal waiver-grant`.
|
|
68
|
-
* Present on waiver rows that went through `cclaw-cli internal
|
|
69
|
-
* waiver-grant`. Legacy rows that lack provenance are surfaced as the
|
|
70
|
-
* advisory linter finding `waiver_legacy_provenance`.
|
|
71
|
-
*/
|
|
72
|
-
approvalToken?: string;
|
|
73
|
-
approvalReason?: string;
|
|
74
|
-
approvalIssuedAt?: string;
|
|
75
|
-
ts?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Run id the entry belongs to. Older ledgers written before 0.5.17 may omit this;
|
|
78
|
-
* consumers treat missing runId as unscoped (conservatively excluded from current-run checks).
|
|
79
|
-
*/
|
|
80
|
-
runId?: string;
|
|
81
|
-
/** Legacy field kept for backward compatibility with historical ledgers. */
|
|
82
|
-
conditionTrigger?: string;
|
|
83
|
-
/** Optional token usage captured from the delegated run. */
|
|
84
|
-
tokens?: DelegationTokenUsage;
|
|
85
|
-
/** Number of retries attempted for this span. */
|
|
86
|
-
retryCount?: number;
|
|
87
|
-
/** Optional references to evidence anchors in artifacts. */
|
|
88
|
-
evidenceRefs?: string[];
|
|
89
|
-
/** Dispatch proof id from the parent/controller side. */
|
|
90
|
-
dispatchId?: string;
|
|
91
|
-
/** Worker-reported run id or task id returned by the harness. */
|
|
92
|
-
workerRunId?: string;
|
|
93
|
-
/** Concrete runtime surface used to launch the worker. */
|
|
94
|
-
dispatchSurface?: DelegationDispatchSurface;
|
|
95
|
-
/** Path to the generated or canonical agent definition used for dispatch. */
|
|
96
|
-
agentDefinitionPath?: string;
|
|
97
|
-
/** ISO timestamp when the worker was acknowledged by the harness/worker. */
|
|
98
|
-
ackTs?: string;
|
|
99
|
-
/** ISO timestamp when the worker was launched. */
|
|
100
|
-
launchedTs?: string;
|
|
101
|
-
/** ISO timestamp when the worker completed. */
|
|
102
|
-
completedTs?: string;
|
|
103
|
-
/** Optional skill marker used for role-specific mandatory checks. */
|
|
104
|
-
skill?: string;
|
|
105
|
-
/**
|
|
106
|
-
* Fulfillment mode this entry was executed under. Omitted on legacy rows
|
|
107
|
-
* (treated as `"isolated"` for Claude, otherwise inferred from the active
|
|
108
|
-
* harness).
|
|
109
|
-
*/
|
|
110
|
-
fulfillmentMode?: DelegationFulfillmentMode;
|
|
111
|
-
/**
|
|
112
|
-
* Schema version marker for span-compatible delegation rows.
|
|
113
|
-
*
|
|
114
|
-
* - `1` — legacy rows that predate the dispatch-surface lock
|
|
115
|
-
* - `2` — historical interim format that introduced ack/launched
|
|
116
|
-
* timestamps but did not require dispatch-surface or ack-ts on
|
|
117
|
-
* completed isolated/generic
|
|
118
|
-
* - `3` — current format: completed isolated/generic must carry
|
|
119
|
-
* `dispatchSurface`, `agentDefinitionPath`, and ACK timestamp
|
|
120
|
-
*/
|
|
121
|
-
schemaVersion?: 1 | 2 | 3;
|
|
122
|
-
/**
|
|
123
|
-
* When set, the operator explicitly opted into running this
|
|
124
|
-
* scheduled span concurrently with another active span on the same
|
|
125
|
-
* `(stage, agent)` pair. Bypasses the dispatch-dedup check.
|
|
126
|
-
*/
|
|
127
|
-
allowParallel?: boolean;
|
|
128
|
-
/**
|
|
129
|
-
* Set on synthetic terminal `stale` rows written via
|
|
130
|
-
* `--supersede=<prevSpanId>`. References the new spanId that
|
|
131
|
-
* superseded this span. Helps `/cc tree` and the linter report a
|
|
132
|
-
* coherent successor chain.
|
|
133
|
-
*/
|
|
134
|
-
supersededBy?: string;
|
|
135
|
-
/**
|
|
136
|
-
* Repo-relative paths the delegated slice-builder will edit. Used by the
|
|
137
|
-
* file-overlap scheduler to either auto-allow parallel dispatch (disjoint
|
|
138
|
-
* paths) or block the row with `DispatchOverlapError` (overlapping paths).
|
|
139
|
-
* For agents other than `slice-builder` the field is advisory.
|
|
140
|
-
*
|
|
141
|
-
* keep in sync with the inline copy in
|
|
142
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
143
|
-
*/
|
|
144
|
-
claimedPaths?: string[];
|
|
145
|
-
/**
|
|
146
|
-
* Absolute path of the isolated git worktree assigned to this span when
|
|
147
|
-
* `tdd.isolationMode=worktree|auto`.
|
|
148
|
-
*/
|
|
149
|
-
worktreePath?: string;
|
|
150
|
-
/**
|
|
151
|
-
* TDD slice identifier, e.g. `"S-1"`. Recorded by the controller when
|
|
152
|
-
* dispatching `slice-builder` so the artifact linter can auto-derive the
|
|
153
|
-
* Watched-RED Proof + Vertical Slice Cycle tables from
|
|
154
|
-
* `delegation-events.jsonl` instead of requiring agents to maintain the
|
|
155
|
-
* markdown by hand. Optional on non-TDD rows.
|
|
156
|
-
*
|
|
157
|
-
* keep in sync with the inline copy in
|
|
158
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
159
|
-
*/
|
|
160
|
-
sliceId?: string;
|
|
161
|
-
/**
|
|
162
|
-
* Explicit phase tag for TDD slice events. Combined with `sliceId`, the
|
|
163
|
-
* linter validates RED → GREEN → REFACTOR → DOC monotonicity per slice.
|
|
164
|
-
* `refactor-deferred` requires a rationale either via
|
|
165
|
-
* `--refactor-rationale` (recorded into `evidenceRefs[0]`) or an
|
|
166
|
-
* `evidenceRefs` entry that contains the rationale text.
|
|
167
|
-
*
|
|
168
|
-
* keep in sync with the inline copy in
|
|
169
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
170
|
-
*/
|
|
171
|
-
phase?: "red" | "green" | "refactor" | "refactor-deferred" | "doc" | "resolve-conflict";
|
|
172
|
-
/**
|
|
173
|
-
* Refactor outcome folded into `phase=green` events so a single row can
|
|
174
|
-
* close RED → GREEN → REFACTOR for the slice without a separate
|
|
175
|
-
* `phase=refactor` / `phase=refactor-deferred` lifecycle pass.
|
|
176
|
-
*
|
|
177
|
-
* - `mode: "inline"` — refactor pass ran inline as part of the GREEN
|
|
178
|
-
* delegation (rationale optional but recommended for traceability).
|
|
179
|
-
* - `mode: "deferred"` — refactor was intentionally deferred; rationale
|
|
180
|
-
* is required (carried in `rationale` and mirrored into
|
|
181
|
-
* `evidenceRefs[0]` so evidence-pointer linters keep matching).
|
|
182
|
-
*
|
|
183
|
-
* `phase=refactor` and `phase=refactor-deferred` events remain valid;
|
|
184
|
-
* the linter accepts either form for REFACTOR coverage.
|
|
185
|
-
*
|
|
186
|
-
* keep in sync with the inline copy in
|
|
187
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
188
|
-
*/
|
|
189
|
-
refactorOutcome?: {
|
|
190
|
-
mode: "inline" | "deferred";
|
|
191
|
-
rationale?: string;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Risk tier hint copied from the plan slice. Used by
|
|
195
|
-
* `integrationCheckRequired()` to decide whether the integration-overseer
|
|
196
|
-
* must run. `low` and `medium` are advisory; `high` always triggers the
|
|
197
|
-
* overseer. Optional on every row.
|
|
198
|
-
*/
|
|
199
|
-
riskTier?: "low" | "medium" | "high";
|
|
200
|
-
};
|
|
201
|
-
export declare const DELEGATION_PHASES: readonly ["red", "green", "refactor", "refactor-deferred", "doc", "resolve-conflict"];
|
|
202
|
-
export type DelegationPhase = (typeof DELEGATION_PHASES)[number];
|
|
203
|
-
export declare const DELEGATION_LEDGER_SCHEMA_VERSION: 3;
|
|
204
|
-
export type DelegationLedger = {
|
|
205
|
-
runId: string;
|
|
206
|
-
entries: DelegationEntry[];
|
|
207
|
-
/** Schema version of the ledger envelope. Current: `3`. */
|
|
208
|
-
schemaVersion?: 1 | 2 | 3;
|
|
209
|
-
};
|
|
210
|
-
export type DelegationEvent = DelegationEntry & {
|
|
211
|
-
event: DelegationEventType;
|
|
212
|
-
eventTs: string;
|
|
213
|
-
schemaVersion: 1 | 2 | 3;
|
|
214
|
-
};
|
|
215
|
-
/**
|
|
216
|
-
* Heuristic: does a changed file path strongly imply a trust-boundary
|
|
217
|
-
* surface? Used by tests and prompt guidance for risk-triggered review.
|
|
218
|
-
*
|
|
219
|
-
* Matches authN/Z, credentials, crypto, policy, or explicit sanitization
|
|
220
|
-
* or injection handling. Intentionally excludes broad terms like `input`
|
|
221
|
-
* and `validation` because they match innocuous paths such as
|
|
222
|
-
* `form-input.ts` or `number-validation.ts` and produce false positives.
|
|
223
|
-
*/
|
|
224
|
-
export declare function isTrustBoundaryPath(filePath: string): boolean;
|
|
225
|
-
export declare function readDelegationLedger(projectRoot: string): Promise<DelegationLedger>;
|
|
226
|
-
export declare function readDelegationEvents(projectRoot: string): Promise<{
|
|
227
|
-
events: DelegationEvent[];
|
|
228
|
-
corruptLines: number[];
|
|
229
|
-
}>;
|
|
230
|
-
/**
|
|
231
|
-
* Fold ledger entries to the latest row per `spanId` and keep only spans
|
|
232
|
-
* whose latest status is still active (`scheduled | launched |
|
|
233
|
-
* acknowledged`). Used by the `state/subagents.json` writer so the
|
|
234
|
-
* tracker never reports a span that already has a terminal row.
|
|
235
|
-
*
|
|
236
|
-
* Output is ordered by ascending `startTs ?? ts` so existing UI
|
|
237
|
-
* consumers see a stable presentation order.
|
|
238
|
-
*
|
|
239
|
-
* Rows without a `spanId` are skipped — they are not addressable by
|
|
240
|
-
* the tracker contract and would collide on the empty key.
|
|
241
|
-
*
|
|
242
|
-
* Callers are expected to pass entries already filtered to the active
|
|
243
|
-
* `runId`; cross-run rows are therefore not re-filtered here.
|
|
244
|
-
*
|
|
245
|
-
* keep in sync with the inline copy in
|
|
246
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
247
|
-
*/
|
|
248
|
-
export declare function computeActiveSubagents(entries: DelegationEntry[]): DelegationEntry[];
|
|
249
|
-
/**
|
|
250
|
-
* Thrown by `validateMonotonicTimestamps` when an incoming row
|
|
251
|
-
* would push a span's timeline backwards. Carries enough context that
|
|
252
|
-
* the CLI / hook surface can format a `delegation_timestamp_non_monotonic`
|
|
253
|
-
* JSON payload without re-deriving the offending field.
|
|
254
|
-
*
|
|
255
|
-
* keep in sync with the inline copy in
|
|
256
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
257
|
-
*/
|
|
258
|
-
export declare class DelegationTimestampError extends Error {
|
|
259
|
-
readonly field: string;
|
|
260
|
-
readonly actual: string;
|
|
261
|
-
readonly priorBound: string;
|
|
262
|
-
constructor(field: string, actual: string, priorBound: string);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Enforce that lifecycle timestamps on a delegation span move
|
|
266
|
-
* forward (or stay equal). Validates both per-row invariants
|
|
267
|
-
* (`startTs ≤ launchedTs ≤ ackTs ≤ completedTs`) and a cross-row
|
|
268
|
-
* invariant: the union of prior rows for this `spanId` plus the
|
|
269
|
-
* incoming row must have non-decreasing `ts`.
|
|
270
|
-
*
|
|
271
|
-
* Equality is allowed because fast-completing dispatches legitimately
|
|
272
|
-
* collapse multiple lifecycle markers onto the same instant.
|
|
273
|
-
*
|
|
274
|
-
* keep in sync with the inline copy in
|
|
275
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
276
|
-
*/
|
|
277
|
-
export declare function validateMonotonicTimestamps(stamped: DelegationEntry, prior: DelegationEntry[]): void;
|
|
278
|
-
/**
|
|
279
|
-
* Thrown by `appendDelegation` when the operator opens a
|
|
280
|
-
* second `scheduled` span on the same `(stage, agent)` pair while an
|
|
281
|
-
* earlier span on the same pair is still active. Callers can catch and
|
|
282
|
-
* either pass the existing span id via `--supersede=<id>` (which
|
|
283
|
-
* pre-writes a synthetic `stale` row) or `--allow-parallel` to record
|
|
284
|
-
* concurrent spans intentionally.
|
|
285
|
-
*/
|
|
286
|
-
export declare class DispatchDuplicateError extends Error {
|
|
287
|
-
readonly existingSpanId: string;
|
|
288
|
-
readonly existingStatus: DelegationStatus;
|
|
289
|
-
readonly newSpanId: string;
|
|
290
|
-
readonly pair: {
|
|
291
|
-
stage: string;
|
|
292
|
-
agent: string;
|
|
293
|
-
};
|
|
294
|
-
constructor(params: {
|
|
295
|
-
existingSpanId: string;
|
|
296
|
-
existingStatus: DelegationStatus;
|
|
297
|
-
newSpanId: string;
|
|
298
|
-
pair: {
|
|
299
|
-
stage: string;
|
|
300
|
-
agent: string;
|
|
301
|
-
};
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Thrown by `validateFileOverlap` when a new `slice-builder` is scheduled
|
|
306
|
-
* on a TDD stage with at least one `claimedPaths` entry that overlaps an
|
|
307
|
-
* active span. The scheduler auto-allows parallel dispatch when paths are
|
|
308
|
-
* disjoint, so an explicit overlap is treated as a serialization signal:
|
|
309
|
-
* the operator must wait for the existing span to terminate or pass
|
|
310
|
-
* `--allow-parallel` deliberately to acknowledge the conflict.
|
|
311
|
-
*/
|
|
312
|
-
export declare class DispatchOverlapError extends Error {
|
|
313
|
-
readonly existingSpanId: string;
|
|
314
|
-
readonly newSpanId: string;
|
|
315
|
-
readonly pair: {
|
|
316
|
-
stage: string;
|
|
317
|
-
agent: string;
|
|
318
|
-
};
|
|
319
|
-
readonly conflictingPaths: string[];
|
|
320
|
-
constructor(params: {
|
|
321
|
-
existingSpanId: string;
|
|
322
|
-
newSpanId: string;
|
|
323
|
-
pair: {
|
|
324
|
-
stage: string;
|
|
325
|
-
agent: string;
|
|
326
|
-
};
|
|
327
|
-
conflictingPaths: string[];
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Thrown when the count of active `slice-builder` spans reaches
|
|
332
|
-
* `MAX_PARALLEL_SLICE_BUILDERS` and a new scheduled row would push it past
|
|
333
|
-
* the cap. Cap can be configured via `.cclaw/config.yaml::execution.maxBuilders`,
|
|
334
|
-
* overridden once via `--override-cap=N` on the hook flag, or globally via
|
|
335
|
-
* `CCLAW_MAX_PARALLEL_SLICE_BUILDERS=<N>` env.
|
|
336
|
-
*/
|
|
337
|
-
export declare class DispatchCapError extends Error {
|
|
338
|
-
readonly cap: number;
|
|
339
|
-
readonly active: number;
|
|
340
|
-
readonly pair: {
|
|
341
|
-
stage: string;
|
|
342
|
-
agent: string;
|
|
343
|
-
};
|
|
344
|
-
constructor(params: {
|
|
345
|
-
cap: number;
|
|
346
|
-
active: number;
|
|
347
|
-
pair: {
|
|
348
|
-
stage: string;
|
|
349
|
-
agent: string;
|
|
350
|
-
};
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Return `true` when `path` is a repo-relative path owned by the cclaw
|
|
355
|
-
* managed runtime under `.cclaw/`. Used by `validateClaimedPathsNotProtected`
|
|
356
|
-
* during `appendDelegation` to reject `slice-builder` (or any worker)
|
|
357
|
-
* spans that try to claim ownership of cclaw-managed files. Does not
|
|
358
|
-
* normalise the input — callers pass the path exactly as the worker wrote
|
|
359
|
-
* it into `claimedPaths` so the error message points at the real string.
|
|
360
|
-
*/
|
|
361
|
-
export declare function isManagedRuntimePath(path: string): boolean;
|
|
362
|
-
/**
|
|
363
|
-
* Thrown by `appendDelegation` when a scheduled span declares a
|
|
364
|
-
* `claimedPaths` entry that lives under the cclaw managed runtime
|
|
365
|
-
* (see `isManagedRuntimePath`). Workers must never edit those paths
|
|
366
|
-
* directly — they are owned by the managed sync surface. The error
|
|
367
|
-
* lists the offending paths so the operator can drop or rewrite them.
|
|
368
|
-
*/
|
|
369
|
-
export declare class DispatchClaimedPathProtectedError extends Error {
|
|
370
|
-
readonly protectedPaths: string[];
|
|
371
|
-
readonly spanId: string;
|
|
372
|
-
constructor(params: {
|
|
373
|
-
protectedPaths: string[];
|
|
374
|
-
spanId: string;
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Reject any worker span that declares `claimedPaths` entries owned by
|
|
379
|
-
* the cclaw managed runtime. Called from `appendDelegation` for
|
|
380
|
-
* `status === "scheduled"` rows alongside the overlap and fan-out
|
|
381
|
-
* checks. Throws `DispatchClaimedPathProtectedError` listing every
|
|
382
|
-
* offending path so the operator can fix the dispatch in one pass.
|
|
383
|
-
*/
|
|
384
|
-
export declare function validateClaimedPathsNotProtected(stamped: DelegationEntry): void;
|
|
385
|
-
/**
|
|
386
|
-
* Thrown by `appendDelegation` (and the inline `delegation-record.mjs`
|
|
387
|
-
* helper) when an event with a non-null `phase` is recorded with
|
|
388
|
-
* `status="acknowledged"`. Phase-level granularity only makes sense on
|
|
389
|
-
* terminal outcomes (`completed` or `failed`); the dispatch-level ACK
|
|
390
|
-
* (no phase) is the controller saying "I see the dispatch surface back".
|
|
391
|
-
*
|
|
392
|
-
* Motivated by hox W-08/S-41: the slice-builder agent recorded all four
|
|
393
|
-
* phase events with `--status=acknowledged`, which the helper silently
|
|
394
|
-
* accepted but `slice-commit.mjs` only fires on `phase=doc status=completed`.
|
|
395
|
-
* `wave-status` then saw the slice as phantom-open even though the
|
|
396
|
-
* worker had finished. Recovery required raw backfill commands.
|
|
397
|
-
*
|
|
398
|
-
* 7.6.0 makes the constraint explicit: pair `--phase=<phase>` with
|
|
399
|
-
* `--status=completed` (or `--status=failed`) and use
|
|
400
|
-
* `--status=acknowledged` only for the dispatch-level ack (no phase).
|
|
401
|
-
*/
|
|
402
|
-
export declare class PhaseEventRequiresTerminalStatusError extends Error {
|
|
403
|
-
readonly phase: string;
|
|
404
|
-
readonly status: DelegationStatus;
|
|
405
|
-
readonly spanId: string;
|
|
406
|
-
readonly correctedCommandHint: string;
|
|
407
|
-
constructor(params: {
|
|
408
|
-
phase: string;
|
|
409
|
-
status: DelegationStatus;
|
|
410
|
-
spanId: string;
|
|
411
|
-
correctedCommandHint: string;
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Reject delegation rows where `phase` is set but `status` is not
|
|
416
|
-
* `completed` or `failed`. Acknowledged/launched/scheduled/waived/stale
|
|
417
|
-
* rows must NOT carry a phase — the phase-level lifecycle exists only
|
|
418
|
-
* to record terminal outcomes per phase (RED/GREEN/REFACTOR/DOC).
|
|
419
|
-
*
|
|
420
|
-
* Throws `PhaseEventRequiresTerminalStatusError`; the message includes
|
|
421
|
-
* an actionable corrected-command hint that the controller can paste.
|
|
422
|
-
*/
|
|
423
|
-
export declare function validatePhaseEventStatus(stamped: DelegationEntry): void;
|
|
424
|
-
/**
|
|
425
|
-
* Thrown by `appendDelegation` when a new `scheduled` span would open a
|
|
426
|
-
* second TDD cycle for a slice that already has at least one closed span
|
|
427
|
-
* (a span with completed phase rows for `red`, `green`, at least one of
|
|
428
|
-
* `refactor`/`refactor-deferred`, and `doc`) in the same run. Re-running
|
|
429
|
-
* a slice under a fresh span is almost always controller drift —
|
|
430
|
-
* legitimate replay reuses the original spanId and is absorbed by the
|
|
431
|
-
* existing dedup. Motivated by the hox-session 7.0.5 finding where
|
|
432
|
-
* `S-36` had two scheduled spans (`span-w07-S-36-final` and `span-w07-S-36`)
|
|
433
|
-
* that the linter then misread as out-of-order phases.
|
|
434
|
-
*/
|
|
435
|
-
export declare class SliceAlreadyClosedError extends Error {
|
|
436
|
-
readonly sliceId: string;
|
|
437
|
-
readonly runId: string;
|
|
438
|
-
readonly closedSpanId: string;
|
|
439
|
-
readonly newSpanId: string;
|
|
440
|
-
constructor(params: {
|
|
441
|
-
sliceId: string;
|
|
442
|
-
runId: string;
|
|
443
|
-
closedSpanId: string;
|
|
444
|
-
newSpanId: string;
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* Default cap on active `slice-builder` spans in a single TDD run. Override
|
|
449
|
-
* via `CCLAW_MAX_PARALLEL_SLICE_BUILDERS=<int>` (validated `>=1`).
|
|
450
|
-
*/
|
|
451
|
-
export declare const MAX_PARALLEL_SLICE_BUILDERS: 5;
|
|
452
|
-
export interface ReadySliceUnit {
|
|
453
|
-
unitId: string;
|
|
454
|
-
sliceId: string;
|
|
455
|
-
dependsOn: string[];
|
|
456
|
-
claimedPaths: string[];
|
|
457
|
-
parallelizable: boolean;
|
|
458
|
-
}
|
|
459
|
-
export interface SelectReadySlicesOptions {
|
|
460
|
-
cap: number;
|
|
461
|
-
completedUnitIds: ReadonlySet<string>;
|
|
462
|
-
activePathHolders: ReadonlyArray<{
|
|
463
|
-
paths: string[];
|
|
464
|
-
}>;
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Return up to `cap` slice units whose dependsOn are satisfied, avoiding
|
|
468
|
-
* `claimedPaths` intersections with already-selected units and active holders.
|
|
469
|
-
*/
|
|
470
|
-
export declare function selectReadySlices(units: ReadySliceUnit[], opts: SelectReadySlicesOptions): ReadySliceUnit[];
|
|
471
|
-
/**
|
|
472
|
-
* Build scheduler rows from merged parallel wave definitions + plan units.
|
|
473
|
-
*/
|
|
474
|
-
export declare function readySliceUnitsFromMergedWaves(mergedWaves: ParsedParallelWave[], planMarkdown: string, options?: ParseImplementationUnitParallelOptions): ReadySliceUnit[];
|
|
475
|
-
/**
|
|
476
|
-
* Verdict from `integrationCheckRequired()`.
|
|
477
|
-
*
|
|
478
|
-
* `required: true` means the controller MUST dispatch
|
|
479
|
-
* `integration-overseer` before stage-complete; `reasons[]` lists the
|
|
480
|
-
* triggers that fired so the controller can quote them in artifacts.
|
|
481
|
-
*
|
|
482
|
-
* `required: false` means the integration check can be safely skipped
|
|
483
|
-
* (disjoint paths and no high-risk slices). Callers
|
|
484
|
-
* that skip dispatch should append a `cclaw_integration_overseer_skipped`
|
|
485
|
-
* audit row to `delegation-events.jsonl` so the run log stays honest
|
|
486
|
-
* about the decision.
|
|
487
|
-
*/
|
|
488
|
-
export interface IntegrationCheckVerdict {
|
|
489
|
-
required: boolean;
|
|
490
|
-
reasons: string[];
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Heuristic helper deciding whether a multi-slice wave needs
|
|
494
|
-
* the `integration-overseer` dispatch.
|
|
495
|
-
*
|
|
496
|
-
* Triggers (any one):
|
|
497
|
-
* - **two or more closed slices share import boundaries** (heuristic:
|
|
498
|
-
* two slices declare a `claimedPaths` whose first 2 path segments
|
|
499
|
-
* match — same package/module directory);
|
|
500
|
-
* - any slice has `riskTier === "high"`.
|
|
501
|
-
*
|
|
502
|
-
* When none fire, the verdict is `{ required: false, reasons: ["disjoint-paths"] }`
|
|
503
|
-
* and the caller should record a `cclaw_integration_overseer_skipped`
|
|
504
|
-
* audit before bypassing the dispatch.
|
|
505
|
-
*
|
|
506
|
-
* Note on inputs: this function reads from the supplied delegation
|
|
507
|
-
* events list directly so callers can inject synthetic data in tests.
|
|
508
|
-
* Use `readDelegationEvents(projectRoot)` in production paths.
|
|
509
|
-
*/
|
|
510
|
-
export declare function integrationCheckRequired(events: DelegationEvent[]): IntegrationCheckVerdict;
|
|
511
|
-
/**
|
|
512
|
-
* Append a non-delegation audit event recording that the
|
|
513
|
-
* integration-overseer dispatch was skipped because
|
|
514
|
-
* `integrationCheckRequired()` returned `required: false`. Best-effort;
|
|
515
|
-
* never throws.
|
|
516
|
-
*/
|
|
517
|
-
export declare function recordIntegrationOverseerSkipped(projectRoot: string, params: {
|
|
518
|
-
runId: string;
|
|
519
|
-
reasons: string[];
|
|
520
|
-
sliceIds: string[];
|
|
521
|
-
}): Promise<void>;
|
|
522
|
-
/**
|
|
523
|
-
* Load merged wave plan (Parallel Execution Plan block + wave-plans/) and map to `ReadySliceUnit[]`.
|
|
524
|
-
*/
|
|
525
|
-
export declare function loadTddReadySlicePool(planMarkdown: string, artifactsDir: string, options?: ParseImplementationUnitParallelOptions): Promise<ReadySliceUnit[]>;
|
|
526
|
-
/**
|
|
527
|
-
* When scheduling a `slice-builder` on a TDD stage, compare `claimedPaths`
|
|
528
|
-
* against every currently active span on the same `(stage, agent)` pair.
|
|
529
|
-
* Overlap → throw `DispatchOverlapError`; disjoint paths → return
|
|
530
|
-
* `{ autoParallel: true }` so the caller can mark the new entry
|
|
531
|
-
* `allowParallel = true` without explicit operator intent. When the agent
|
|
532
|
-
* is not a slice-builder or no `claimedPaths` are supplied, the function
|
|
533
|
-
* returns `{ autoParallel: false }` and the standard dedup path takes over.
|
|
534
|
-
*/
|
|
535
|
-
export declare function validateFileOverlap(stamped: DelegationEntry, activeEntries: DelegationEntry[]): {
|
|
536
|
-
autoParallel: boolean;
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* Enforce the slice-builder fan-out cap. The new scheduled row pushes the
|
|
540
|
-
* active count from N to N+1; if that would exceed the cap (default/config 5,
|
|
541
|
-
* env-overridable via `CCLAW_MAX_PARALLEL_SLICE_BUILDERS`), throw
|
|
542
|
-
* `DispatchCapError`.
|
|
543
|
-
*
|
|
544
|
-
* Caller passes the already-folded list of active entries (latest row per
|
|
545
|
-
* spanId, ACTIVE statuses only). The function counts entries that match
|
|
546
|
-
* the agent on the same `stage`. The new row's own spanId is excluded so
|
|
547
|
-
* re-recording a `scheduled` doesn't trip the cap on a span that's already
|
|
548
|
-
* counted.
|
|
549
|
-
*/
|
|
550
|
-
export declare function validateFanOutCap(stamped: DelegationEntry, activeEntries: DelegationEntry[], override?: number | null): void;
|
|
551
|
-
/**
|
|
552
|
-
* Find the latest active span for a given `(stage, agent)`
|
|
553
|
-
* pair in the supplied ledger entries. Returns the row whose latest
|
|
554
|
-
* status (after the latest-by-spanId fold) is still in the active set
|
|
555
|
-
* (`scheduled | launched | acknowledged`).
|
|
556
|
-
*
|
|
557
|
-
* Run-scope is **strict**: only entries whose `runId` matches the
|
|
558
|
-
* supplied `runId` are folded. Entries with empty/missing `runId`
|
|
559
|
-
* (older ledgers without explicit run scoping) are treated as NOT belonging
|
|
560
|
-
* to the current run, so they cannot keep an old span "active" across
|
|
561
|
-
* a fresh dispatch and trip a spurious `dispatch_duplicate`. This
|
|
562
|
-
* Ensures a slice-builder that ran in run-1 does not block a
|
|
563
|
-
* slice-builder scheduled in run-2.
|
|
564
|
-
*
|
|
565
|
-
* keep in sync with the inline copy in
|
|
566
|
-
* `src/content/hooks.ts::delegationRecordScript`.
|
|
567
|
-
*/
|
|
568
|
-
export declare function findActiveSpanForPair(stage: string, agent: string, runId: string, ledger: DelegationLedger): DelegationEntry | null;
|
|
569
|
-
export declare function appendDelegation(projectRoot: string, entry: DelegationEntry): Promise<void>;
|
|
570
|
-
/**
|
|
571
|
-
* Aggregate the fulfillment mode cclaw expects for the active harness set.
|
|
572
|
-
* Priority native > generic-dispatch > role-switch > waiver — the best
|
|
573
|
-
* available mode wins so mixed installs (e.g. claude + codex) inherit the
|
|
574
|
-
* strongest guarantee.
|
|
575
|
-
*/
|
|
576
|
-
export declare function expectedFulfillmentMode(fallbacks: SubagentFallback[]): DelegationFulfillmentMode;
|
|
577
|
-
export declare function checkMandatoryDelegations(projectRoot: string, stage: FlowStage, options?: {
|
|
578
|
-
repairFeatureSystem?: boolean;
|
|
579
|
-
/**
|
|
580
|
-
* Optional task class for the active run. When set to
|
|
581
|
-
* `"software-bugfix"`, the mandatory delegation gate is skipped
|
|
582
|
-
* entirely. Callers that don't classify the run leave
|
|
583
|
-
* this undefined; the function then falls back to
|
|
584
|
-
* `flowState.taskClass` (persisted in `flow-state.json`) so the
|
|
585
|
-
* Bugfix-skip remains active across the `cclaw advance-stage`
|
|
586
|
-
* code path even when no caller forwards an explicit override.
|
|
587
|
-
*/
|
|
588
|
-
taskClass?: MandatoryDelegationTaskClass | null;
|
|
589
|
-
}): Promise<{
|
|
590
|
-
satisfied: boolean;
|
|
591
|
-
missing: string[];
|
|
592
|
-
waived: string[];
|
|
593
|
-
staleIgnored: string[];
|
|
594
|
-
/** Delegation rows missing required evidence under a role-switch fallback. */
|
|
595
|
-
missingEvidence: string[];
|
|
596
|
-
/** Native isolated completion rows that lack dispatch proof. */
|
|
597
|
-
missingDispatchProof: string[];
|
|
598
|
-
/** Legacy inferred isolated completions accepted only as migration warnings. */
|
|
599
|
-
legacyInferredCompletions: string[];
|
|
600
|
-
/** Current-run event log lines that could not be parsed. */
|
|
601
|
-
corruptEventLines: number[];
|
|
602
|
-
/** Current-run scheduled rows with no terminal row sharing the same spanId. */
|
|
603
|
-
staleWorkers: string[];
|
|
604
|
-
/** Expected fulfillment mode for the active harness set. */
|
|
605
|
-
expectedMode: DelegationFulfillmentMode;
|
|
606
|
-
/**
|
|
607
|
-
* `true` when `mandatoryAgentsFor` returned [] for
|
|
608
|
-
* this (track, taskClass) combination — i.e. the gate was skipped
|
|
609
|
-
* entirely on quick track or software-bugfix runs. The skip is also
|
|
610
|
-
* recorded as a `mandatory_delegations_skipped_by_track` event in
|
|
611
|
-
* `delegation-events.jsonl` for audit traceability.
|
|
612
|
-
*/
|
|
613
|
-
skippedByTrack: boolean;
|
|
614
|
-
}>;
|
|
615
|
-
/**
|
|
616
|
-
* Append a non-delegation audit event recording
|
|
617
|
-
* that one or more required artifact-validation findings were
|
|
618
|
-
* demoted from blocking to advisory because the active run is on a
|
|
619
|
-
* small-fix lane (`track === "quick"` or `taskClass === "software-bugfix"`).
|
|
620
|
-
*
|
|
621
|
-
* The event mirrors `mandatory_delegations_skipped_by_track`
|
|
622
|
-
* audit pattern: best-effort write to `delegation-events.jsonl`, no
|
|
623
|
-
* agent payload, recognized by `readDelegationEvents` so it does not
|
|
624
|
-
* corrupt downstream parsers. Failures are swallowed.
|
|
625
|
-
*/
|
|
626
|
-
export declare function recordArtifactValidationDemotedByTrack(projectRoot: string, params: {
|
|
627
|
-
stage: FlowStage;
|
|
628
|
-
track: FlowState["track"];
|
|
629
|
-
taskClass: MandatoryDelegationTaskClass | null;
|
|
630
|
-
runId: string;
|
|
631
|
-
sections: string[];
|
|
632
|
-
}): Promise<void>;
|
|
633
|
-
/**
|
|
634
|
-
* Append a non-delegation audit event recording
|
|
635
|
-
* that the scope-stage Expansion Strategist (`product-discovery`)
|
|
636
|
-
* delegation requirement was skipped because the active run is on a
|
|
637
|
-
* small-fix lane (`track === "quick"` or `taskClass === "software-bugfix"`).
|
|
638
|
-
*
|
|
639
|
-
* Mirrors the `mandatory_delegations_skipped_by_track`
|
|
640
|
-
* audit pattern: best-effort write to `delegation-events.jsonl`, no
|
|
641
|
-
* agent payload, recognized by `readDelegationEvents` so it does not
|
|
642
|
-
* corrupt downstream parsers. Failures are swallowed.
|
|
643
|
-
*/
|
|
644
|
-
export declare function recordExpansionStrategistSkippedByTrack(projectRoot: string, params: {
|
|
645
|
-
track: FlowState["track"];
|
|
646
|
-
taskClass: MandatoryDelegationTaskClass | null;
|
|
647
|
-
runId: string;
|
|
648
|
-
selectedScopeMode: string;
|
|
649
|
-
}): Promise<void>;
|