@cleocode/contracts 2026.4.85 → 2026.4.87
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/agent-registry-v3.d.ts +162 -0
- package/dist/agent-registry-v3.d.ts.map +1 -0
- package/dist/agent-registry-v3.js +15 -0
- package/dist/agent-registry-v3.js.map +1 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +44 -0
- package/dist/errors.js.map +1 -1
- package/dist/exit-codes.d.ts +22 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +23 -1
- package/dist/exit-codes.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/playbook.d.ts +110 -0
- package/dist/playbook.d.ts.map +1 -0
- package/dist/playbook.js +8 -0
- package/dist/playbook.js.map +1 -0
- package/package.json +1 -1
- package/src/agent-registry-v3.ts +187 -0
- package/src/errors.ts +47 -0
- package/src/exit-codes.ts +24 -1
- package/src/index.ts +33 -0
- package/src/playbook.ts +124 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Registry v3 — Extended registry fields for tier-aware resolution.
|
|
3
|
+
*
|
|
4
|
+
* Introduced by T889 / T897 (agent_registry v3 migration). These types layer
|
|
5
|
+
* on top of the existing `AgentCredential` contract (see `./agent-registry.js`)
|
|
6
|
+
* to carry tier, spawn capability, orchestration level, and on-disk `.cant`
|
|
7
|
+
* provenance metadata.
|
|
8
|
+
*
|
|
9
|
+
* @see packages/core/migrations/drizzle-signaldock/*_T897_agent_registry_v3.sql
|
|
10
|
+
* @module agent-registry-v3
|
|
11
|
+
* @task T897
|
|
12
|
+
* @epic T889
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Tier where an agent is installed or resolved from.
|
|
16
|
+
*
|
|
17
|
+
* - `project` — installed in the current project (`.cleo/agents/`)
|
|
18
|
+
* - `global` — installed at the user/global scope (`$XDG_DATA_HOME/cleo/agents/`)
|
|
19
|
+
* - `packaged` — bundled with the CLEO distribution
|
|
20
|
+
* - `fallback` — synthesized at resolve-time when no concrete `.cant` exists
|
|
21
|
+
*
|
|
22
|
+
* @task T897
|
|
23
|
+
* @epic T889
|
|
24
|
+
*/
|
|
25
|
+
export type AgentTier = 'project' | 'global' | 'packaged' | 'fallback';
|
|
26
|
+
/**
|
|
27
|
+
* Whether an agent is permitted to spawn other agents and its role in the
|
|
28
|
+
* orchestration hierarchy.
|
|
29
|
+
*
|
|
30
|
+
* - `orchestrator` — top-level coordinator, may spawn leads and workers
|
|
31
|
+
* - `lead` — may spawn workers only
|
|
32
|
+
* - `worker` — terminal; may not spawn
|
|
33
|
+
*
|
|
34
|
+
* @task T897
|
|
35
|
+
* @epic T889
|
|
36
|
+
*/
|
|
37
|
+
export type AgentSpawnCapability = 'orchestrator' | 'lead' | 'worker';
|
|
38
|
+
/**
|
|
39
|
+
* Taxonomy for the `agent_skills.source` column, identifying how a skill
|
|
40
|
+
* binding was derived.
|
|
41
|
+
*
|
|
42
|
+
* - `cant` — parsed from the agent's `.cant` manifest
|
|
43
|
+
* - `manual` — attached explicitly by a CLI call
|
|
44
|
+
* - `computed` — derived by a background indexer (e.g. doctor / index)
|
|
45
|
+
*
|
|
46
|
+
* @task T897
|
|
47
|
+
* @epic T889
|
|
48
|
+
*/
|
|
49
|
+
export type AgentSkillSource = 'cant' | 'manual' | 'computed';
|
|
50
|
+
/**
|
|
51
|
+
* Extended agent registry row fields added in the T889 / T897 v3 migration.
|
|
52
|
+
*
|
|
53
|
+
* These fields live directly on the global `signaldock.db:agents` table and
|
|
54
|
+
* supplement the pre-existing `AgentCredential` shape with tier-aware
|
|
55
|
+
* resolution metadata.
|
|
56
|
+
*
|
|
57
|
+
* @task T897
|
|
58
|
+
* @epic T889
|
|
59
|
+
*/
|
|
60
|
+
export interface AgentRegistryExtendedFields {
|
|
61
|
+
/** Tier where the row was installed / resolved from. */
|
|
62
|
+
tier: AgentTier;
|
|
63
|
+
/** `true` when the agent is permitted to spawn subagents. */
|
|
64
|
+
canSpawn: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Orchestration level (0 = orchestrator, 1 = lead, 2 = worker). Constrained
|
|
67
|
+
* to the closed interval [0, 2] by the v3 CHECK constraint.
|
|
68
|
+
*/
|
|
69
|
+
orchLevel: number;
|
|
70
|
+
/** `agent_id` of the supervising agent, or `null` for top-level agents. */
|
|
71
|
+
reportsTo: string | null;
|
|
72
|
+
/** Absolute path to the `.cant` manifest that provisioned this row. */
|
|
73
|
+
cantPath: string | null;
|
|
74
|
+
/** SHA-256 checksum of the `.cant` manifest at install time (hex-encoded). */
|
|
75
|
+
cantSha256: string | null;
|
|
76
|
+
/** Source of the install record (`seed` = bundled, `user` = CLI attach, `manual` = hand-edited). */
|
|
77
|
+
installedFrom: 'seed' | 'user' | 'manual' | null;
|
|
78
|
+
/** ISO 8601 timestamp when the row was installed. */
|
|
79
|
+
installedAt: string | null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolved agent record returned from the future `resolveAgent()` lookup.
|
|
83
|
+
*
|
|
84
|
+
* Aggregates tier-ranked registry state with the merged skill list and an
|
|
85
|
+
* optional alias record. Returned as an LAFS-compatible envelope so callers
|
|
86
|
+
* can inline the record in `data` without further shaping.
|
|
87
|
+
*
|
|
88
|
+
* @task T897
|
|
89
|
+
* @epic T889
|
|
90
|
+
*/
|
|
91
|
+
export interface ResolvedAgent {
|
|
92
|
+
/** Agent business identifier (matches `agents.agent_id`). */
|
|
93
|
+
agentId: string;
|
|
94
|
+
/** Tier the resolved row was sourced from. */
|
|
95
|
+
tier: AgentTier;
|
|
96
|
+
/** Absolute path to the resolved `.cant` manifest. */
|
|
97
|
+
cantPath: string;
|
|
98
|
+
/** SHA-256 checksum of the resolved `.cant` manifest (hex-encoded). */
|
|
99
|
+
cantSha256: string;
|
|
100
|
+
/** `true` when the agent may spawn subagents. */
|
|
101
|
+
canSpawn: boolean;
|
|
102
|
+
/** Orchestration level (0..2). */
|
|
103
|
+
orchLevel: number;
|
|
104
|
+
/** `agent_id` of the supervising agent, or `null`. */
|
|
105
|
+
reportsTo: string | null;
|
|
106
|
+
/** Merged skill slugs (union of catalog bindings and `.cant`-declared skills). */
|
|
107
|
+
skills: string[];
|
|
108
|
+
/** Concrete source tier of the chosen row (mirrors `tier`). */
|
|
109
|
+
source: 'project' | 'global' | 'packaged' | 'fallback';
|
|
110
|
+
/** `true` when an alias redirected the lookup to another agentId. */
|
|
111
|
+
aliasApplied: boolean;
|
|
112
|
+
/** When `aliasApplied` is true, the terminal canonical agentId the alias pointed at. */
|
|
113
|
+
aliasTarget?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Stable diagnostic codes emitted by the `cleo agent doctor` walk. Codes are
|
|
117
|
+
* frozen for the lifetime of the v3 schema; new checks MUST claim a fresh
|
|
118
|
+
* code rather than reusing a retired one.
|
|
119
|
+
*
|
|
120
|
+
* @task T897
|
|
121
|
+
* @epic T889
|
|
122
|
+
*/
|
|
123
|
+
export type AgentDoctorCode = 'D-001' | 'D-002' | 'D-003' | 'D-004' | 'D-005' | 'D-006' | 'D-007' | 'D-008' | 'D-009' | 'D-010';
|
|
124
|
+
/**
|
|
125
|
+
* Single finding produced by the agent doctor. A `fixCommand` is populated
|
|
126
|
+
* when the diagnostic is auto-remediable.
|
|
127
|
+
*
|
|
128
|
+
* @task T897
|
|
129
|
+
* @epic T889
|
|
130
|
+
*/
|
|
131
|
+
export interface AgentDoctorFinding {
|
|
132
|
+
/** Stable diagnostic code (see `AgentDoctorCode`). */
|
|
133
|
+
code: AgentDoctorCode;
|
|
134
|
+
/** Severity classification. */
|
|
135
|
+
severity: 'error' | 'warn' | 'info';
|
|
136
|
+
/** Entity under inspection (usually an `agent_id` or `.cant` path). */
|
|
137
|
+
subject: string;
|
|
138
|
+
/** Human-readable description of the finding. */
|
|
139
|
+
message: string;
|
|
140
|
+
/** Optional `cleo` command that will repair the finding when applied. */
|
|
141
|
+
fixCommand?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate doctor report envelope. `summary` tallies findings by severity
|
|
145
|
+
* for quick triage.
|
|
146
|
+
*
|
|
147
|
+
* @task T897
|
|
148
|
+
* @epic T889
|
|
149
|
+
*/
|
|
150
|
+
export interface DoctorReport {
|
|
151
|
+
/** Ordered findings, first-detected-first. */
|
|
152
|
+
findings: AgentDoctorFinding[];
|
|
153
|
+
/** Severity histogram. */
|
|
154
|
+
summary: {
|
|
155
|
+
error: number;
|
|
156
|
+
warn: number;
|
|
157
|
+
info: number;
|
|
158
|
+
};
|
|
159
|
+
/** ISO 8601 timestamp when the report was generated. */
|
|
160
|
+
generatedAt: string;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=agent-registry-v3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registry-v3.d.ts","sourceRoot":"","sources":["../src/agent-registry-v3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAM9D;;;;;;;;;GASG;AACH,MAAM,WAAW,2BAA2B;IAC1C,wDAAwD;IACxD,IAAI,EAAE,SAAS,CAAC;IAChB,6DAA6D;IAC7D,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,SAAS,EAAE,M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AO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,0BAA0B;IAC1B,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Registry v3 — Extended registry fields for tier-aware resolution.
|
|
3
|
+
*
|
|
4
|
+
* Introduced by T889 / T897 (agent_registry v3 migration). These types layer
|
|
5
|
+
* on top of the existing `AgentCredential` contract (see `./agent-registry.js`)
|
|
6
|
+
* to carry tier, spawn capability, orchestration level, and on-disk `.cant`
|
|
7
|
+
* provenance metadata.
|
|
8
|
+
*
|
|
9
|
+
* @see packages/core/migrations/drizzle-signaldock/*_T897_agent_registry_v3.sql
|
|
10
|
+
* @module agent-registry-v3
|
|
11
|
+
* @task T897
|
|
12
|
+
* @epic T889
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=agent-registry-v3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registry-v3.js","sourceRoot":"","sources":["../src/agent-registry-v3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -6,6 +6,43 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @task T5702
|
|
8
8
|
*/
|
|
9
|
+
import { ExitCode } from './exit-codes.js';
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a non-orchestrator role attempts to spawn another agent,
|
|
12
|
+
* violating the thin-agent inversion-of-control rule (ORC-012).
|
|
13
|
+
*
|
|
14
|
+
* Only orchestrators may spawn subagents. Leads and workers must escalate
|
|
15
|
+
* via the playbook approval gate defined in T889 Orchestration Coherence v3.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Emitted by the spawn-guard middleware when an agent's declared role does
|
|
19
|
+
* not satisfy the orchestrator precondition. Carries `exitCode` aligned with
|
|
20
|
+
* {@link ExitCode.THIN_AGENT_VIOLATION} so the CLI can surface exit 68 to
|
|
21
|
+
* callers without additional mapping.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* throw new ThinAgentViolationError('worker-42', 'lead', 'orchestrate spawn');
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @task T889 Orchestration Coherence v3
|
|
29
|
+
* @task T907 Thin-agent enforcement
|
|
30
|
+
*/
|
|
31
|
+
export declare class ThinAgentViolationError extends Error {
|
|
32
|
+
readonly agentId: string;
|
|
33
|
+
readonly role: string;
|
|
34
|
+
readonly attemptedAction: string;
|
|
35
|
+
/** Stable LAFS error code string for envelope emission. */
|
|
36
|
+
readonly code = "E_THIN_AGENT_VIOLATION";
|
|
37
|
+
/** Numeric exit code aligned with {@link ExitCode.THIN_AGENT_VIOLATION}. */
|
|
38
|
+
readonly exitCode: ExitCode;
|
|
39
|
+
/**
|
|
40
|
+
* @param agentId - The offending agent's unique identifier.
|
|
41
|
+
* @param role - The offending agent's declared role (lead, worker, etc.).
|
|
42
|
+
* @param attemptedAction - The spawn action that was blocked.
|
|
43
|
+
*/
|
|
44
|
+
constructor(agentId: string, role: string, attemptedAction: string);
|
|
45
|
+
}
|
|
9
46
|
/**
|
|
10
47
|
* Normalize any thrown value into a standardized error object.
|
|
11
48
|
*
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts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O,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAE9C"}
|
package/dist/errors.js
CHANGED
|
@@ -6,6 +6,50 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @task T5702
|
|
8
8
|
*/
|
|
9
|
+
import { ExitCode } from './exit-codes.js';
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a non-orchestrator role attempts to spawn another agent,
|
|
12
|
+
* violating the thin-agent inversion-of-control rule (ORC-012).
|
|
13
|
+
*
|
|
14
|
+
* Only orchestrators may spawn subagents. Leads and workers must escalate
|
|
15
|
+
* via the playbook approval gate defined in T889 Orchestration Coherence v3.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Emitted by the spawn-guard middleware when an agent's declared role does
|
|
19
|
+
* not satisfy the orchestrator precondition. Carries `exitCode` aligned with
|
|
20
|
+
* {@link ExitCode.THIN_AGENT_VIOLATION} so the CLI can surface exit 68 to
|
|
21
|
+
* callers without additional mapping.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* throw new ThinAgentViolationError('worker-42', 'lead', 'orchestrate spawn');
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @task T889 Orchestration Coherence v3
|
|
29
|
+
* @task T907 Thin-agent enforcement
|
|
30
|
+
*/
|
|
31
|
+
export class ThinAgentViolationError extends Error {
|
|
32
|
+
agentId;
|
|
33
|
+
role;
|
|
34
|
+
attemptedAction;
|
|
35
|
+
/** Stable LAFS error code string for envelope emission. */
|
|
36
|
+
code = 'E_THIN_AGENT_VIOLATION';
|
|
37
|
+
/** Numeric exit code aligned with {@link ExitCode.THIN_AGENT_VIOLATION}. */
|
|
38
|
+
exitCode = ExitCode.THIN_AGENT_VIOLATION;
|
|
39
|
+
/**
|
|
40
|
+
* @param agentId - The offending agent's unique identifier.
|
|
41
|
+
* @param role - The offending agent's declared role (lead, worker, etc.).
|
|
42
|
+
* @param attemptedAction - The spawn action that was blocked.
|
|
43
|
+
*/
|
|
44
|
+
constructor(agentId, role, attemptedAction) {
|
|
45
|
+
super(`E_THIN_AGENT_VIOLATION: agent '${agentId}' (role=${role}) attempted '${attemptedAction}'. ` +
|
|
46
|
+
'Only orchestrators may spawn. Escalate via playbook approval gate.');
|
|
47
|
+
this.agentId = agentId;
|
|
48
|
+
this.role = role;
|
|
49
|
+
this.attemptedAction = attemptedAction;
|
|
50
|
+
this.name = 'ThinAgentViolationError';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
9
53
|
/**
|
|
10
54
|
* Normalize any thrown value into a standardized error object.
|
|
11
55
|
*
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAc,EACd,eAAe,GAAG,8BAA8B;IAEhD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EACjC,CAAC;QACD,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,QAAQ,GAAG,eAAe;IACxE,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,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Y,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,UAAkB;IAC5D,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,iCAAiC;QACjC,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAC,MAG7B;IACC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;AACzB,CAAC"}
|
package/dist/exit-codes.d.ts
CHANGED
|
@@ -61,6 +61,28 @@ export declare enum ExitCode {
|
|
|
61
61
|
HANDOFF_REQUIRED = 65,
|
|
62
62
|
RESUME_FAILED = 66,
|
|
63
63
|
CONCURRENT_SESSION = 67,
|
|
64
|
+
/**
|
|
65
|
+
* E_THIN_AGENT_VIOLATION — A worker or lead agent attempted to spawn another
|
|
66
|
+
* agent, violating the thin-agent inversion-of-control rule (ORC-012).
|
|
67
|
+
* Only orchestrators may spawn subagents; non-orchestrator roles must
|
|
68
|
+
* escalate via the playbook approval gate.
|
|
69
|
+
*
|
|
70
|
+
* @task T889 Orchestration Coherence v3
|
|
71
|
+
* @task T907 Thin-agent enforcement
|
|
72
|
+
*/
|
|
73
|
+
THIN_AGENT_VIOLATION = 68,
|
|
74
|
+
/**
|
|
75
|
+
* E_ATOMICITY_VIOLATION — A worker-role spawn was attempted for a task that
|
|
76
|
+
* exceeds the atomicity budget (more than {@link MAX_WORKER_FILES} files) or
|
|
77
|
+
* lacks an explicit file-scope declaration on its acceptance criteria.
|
|
78
|
+
*
|
|
79
|
+
* Workers MUST remain atomic (≤ 3 files with declared AC.files). Violations
|
|
80
|
+
* should be split into child tasks or promoted to a lead role.
|
|
81
|
+
*
|
|
82
|
+
* @task T889 Orchestration Coherence v3
|
|
83
|
+
* @task T894 Atomicity guard (W3-3)
|
|
84
|
+
*/
|
|
85
|
+
ATOMICITY_VIOLATION = 69,
|
|
64
86
|
NEXUS_NOT_INITIALIZED = 70,
|
|
65
87
|
NEXUS_PROJECT_NOT_FOUND = 71,
|
|
66
88
|
NEXUS_PERMISSION_DENIED = 72,
|
package/dist/exit-codes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oBAAY,QAAQ;IAElB,OAAO,IAAI;IAGX,aAAa,IAAI;IACjB,aAAa,IAAI;IACjB,UAAU,IAAI;IACd,SAAS,IAAI;IACb,gBAAgB,IAAI;IACpB,gBAAgB,IAAI;IACpB,YAAY,IAAI;IAChB,YAAY,IAAI;IAGhB,gBAAgB,KAAK;IACrB,cAAc,KAAK;IACnB,aAAa,KAAK;IAClB,mBAAmB,KAAK;IACxB,kBAAkB,KAAK;IACvB,eAAe,KAAK;IACpB,YAAY,KAAK;IACjB,cAAc,KAAK;IACnB,cAAc,KAAK;IACn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AK;IACtB,mBAAmB,KAAK;IACxB,mBAAmB,KAAK;IACxB,oBAAoB,KAAK;IACzB,sBAAsB,KAAK;IAG3B,OAAO,MAAM;IACb,cAAc,MAAM;IACpB,SAAS,MAAM;IACf,aAAa,MAAM;IAGnB;;;;;;;OAOG;IACH,cAAc,MAAM;CACrB;AAED,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEnD;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAErD;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CA0BzD;AAED,4CAA4C;AAC5C,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEtD"}
|
package/dist/exit-codes.js
CHANGED
|
@@ -61,7 +61,7 @@ export var ExitCode;
|
|
|
61
61
|
ExitCode[ExitCode["CONTEXT_CRITICAL"] = 52] = "CONTEXT_CRITICAL";
|
|
62
62
|
ExitCode[ExitCode["CONTEXT_EMERGENCY"] = 53] = "CONTEXT_EMERGENCY";
|
|
63
63
|
ExitCode[ExitCode["CONTEXT_STALE"] = 54] = "CONTEXT_STALE";
|
|
64
|
-
// === ORCHESTRATOR ERRORS (60-
|
|
64
|
+
// === ORCHESTRATOR ERRORS (60-68) ===
|
|
65
65
|
ExitCode[ExitCode["PROTOCOL_MISSING"] = 60] = "PROTOCOL_MISSING";
|
|
66
66
|
ExitCode[ExitCode["INVALID_RETURN_MESSAGE"] = 61] = "INVALID_RETURN_MESSAGE";
|
|
67
67
|
ExitCode[ExitCode["MANIFEST_ENTRY_MISSING"] = 62] = "MANIFEST_ENTRY_MISSING";
|
|
@@ -70,6 +70,28 @@ export var ExitCode;
|
|
|
70
70
|
ExitCode[ExitCode["HANDOFF_REQUIRED"] = 65] = "HANDOFF_REQUIRED";
|
|
71
71
|
ExitCode[ExitCode["RESUME_FAILED"] = 66] = "RESUME_FAILED";
|
|
72
72
|
ExitCode[ExitCode["CONCURRENT_SESSION"] = 67] = "CONCURRENT_SESSION";
|
|
73
|
+
/**
|
|
74
|
+
* E_THIN_AGENT_VIOLATION — A worker or lead agent attempted to spawn another
|
|
75
|
+
* agent, violating the thin-agent inversion-of-control rule (ORC-012).
|
|
76
|
+
* Only orchestrators may spawn subagents; non-orchestrator roles must
|
|
77
|
+
* escalate via the playbook approval gate.
|
|
78
|
+
*
|
|
79
|
+
* @task T889 Orchestration Coherence v3
|
|
80
|
+
* @task T907 Thin-agent enforcement
|
|
81
|
+
*/
|
|
82
|
+
ExitCode[ExitCode["THIN_AGENT_VIOLATION"] = 68] = "THIN_AGENT_VIOLATION";
|
|
83
|
+
/**
|
|
84
|
+
* E_ATOMICITY_VIOLATION — A worker-role spawn was attempted for a task that
|
|
85
|
+
* exceeds the atomicity budget (more than {@link MAX_WORKER_FILES} files) or
|
|
86
|
+
* lacks an explicit file-scope declaration on its acceptance criteria.
|
|
87
|
+
*
|
|
88
|
+
* Workers MUST remain atomic (≤ 3 files with declared AC.files). Violations
|
|
89
|
+
* should be split into child tasks or promoted to a lead role.
|
|
90
|
+
*
|
|
91
|
+
* @task T889 Orchestration Coherence v3
|
|
92
|
+
* @task T894 Atomicity guard (W3-3)
|
|
93
|
+
*/
|
|
94
|
+
ExitCode[ExitCode["ATOMICITY_VIOLATION"] = 69] = "ATOMICITY_VIOLATION";
|
|
73
95
|
// === NEXUS ERRORS (70-79) ===
|
|
74
96
|
ExitCode[ExitCode["NEXUS_NOT_INITIALIZED"] = 70] = "NEXUS_NOT_INITIALIZED";
|
|
75
97
|
ExitCode[ExitCode["NEXUS_PROJECT_NOT_FOUND"] = 71] = "NEXUS_PROJECT_NOT_FOUND";
|
package/dist/exit-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAN,IAAY,QAqJX;AArJD,WAAY,QAAQ;IAClB,sBAAsB;IACtB,6CAAW,CAAA;IAEX,+BAA+B;IAC/B,yDAAiB,CAAA;IACjB,yDAAiB,CAAA;IACjB,mDAAc,CAAA;IACd,iDAAa,CAAA;IACb,+DAAoB,CAAA;IACpB,+DAAoB,CAAA;IACpB,uDAAgB,CAAA;IAChB,uDAAgB,CAAA;IAEhB,mCAAmC;IACnC,gEAAqB,CAAA;IACrB,4DAAmB,CAAA;IACnB,0DAAkB,CAAA;IAClB,sEAAwB,CAAA;IACxB,oEAAuB,CAAA;IACvB,8DAAoB,CAAA;IACpB,wDAAiB,CAAA;IACjB,4DAAmB,CAAA;IACnB,4DAAmB,CAAA;IACnB,4DAAmB,CAAA;IAEnB,qCAAqC;IACrC,kEAAsB,CAAA;IACtB,8EAA4B,CAAA;IAC5B,wDAAiB,CAAA;IAEjB,iCAAiC;IACjC,4DAAmB,CAAA;IACnB,kEAAsB,CAAA;IACtB,4DAAmB,CAAA;IACnB,0DAAkB,CAAA;IAClB,kEAAsB,CAAA;IACtB,wDAAiB,CAAA;IACjB,gEAAqB,CAAA;IACrB,0EAA0B,CAAA;IAC1B,wEAAyB,CAAA;IACzB,4DAAmB,CAAA;IAEnB,sCAAsC;IACtC,gFAA6B,CAAA;IAC7B,oEAAuB,CAAA;IACvB,wDAAiB,CAAA;IACjB,0DAAkB,CAAA;IAClB,sEAAwB,CAAA;IACxB,8DAAoB,CAAA;IACpB,sEAAwB,CAAA;IACxB,4DAAmB,CAAA;IAEnB,oCAAoC;IACpC,8DAAoB,CAAA;IACpB,8DAAoB,CAAA;IACpB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C,IAAI,SAAS,CAAC;AACrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type { AcceptanceArrayInput, AcceptanceGateResultInput, AcceptanceGateSch
|
|
|
10
10
|
export { acceptanceArraySchema, acceptanceGateResultSchema, acceptanceGateSchema, acceptanceItemSchema, commandGateSchema, fileAssertionSchema, fileGateSchema, gateBaseSchema, gateResultDetailsSchema, httpGateSchema, lintGateSchema, manualGateSchema, testGateSchema, } from './acceptance-gate-schema.js';
|
|
11
11
|
export type { AdapterHealthStatus, CLEOProviderAdapter } from './adapter.js';
|
|
12
12
|
export type { AgentCredential, AgentListFilter, AgentRegistryAPI, AgentWithProjectOverride, ProjectAgentRef, TransportConfig, } from './agent-registry.js';
|
|
13
|
+
export type { AgentDoctorCode, AgentDoctorFinding, AgentRegistryExtendedFields, AgentSkillSource, AgentSpawnCapability, AgentTier, DoctorReport, ResolvedAgent, } from './agent-registry-v3.js';
|
|
13
14
|
export type { ArchiveCycleTimesReport, ArchiveDailyTrend, ArchivedTask, ArchiveLabelEntry, ArchiveMetadata, ArchiveMonthlyTrend, ArchivePhaseEntry, ArchivePriorityEntry, ArchiveReportType, ArchiveStatsEnvelope, ArchiveSummaryReport, ArchiveTrendsReport, CycleTimeDistribution, CycleTimePercentiles, } from './archive.js';
|
|
14
15
|
export type { Attachment, AttachmentKind, AttachmentMetadata, AttachmentRef, BlobAttachment, LlmsTxtAttachment, LlmtxtDocAttachment, LocalFileAttachment, UrlAttachment, } from './attachment.js';
|
|
15
16
|
export type { AttachmentMetadataSchemaInput, AttachmentRefSchemaInput, AttachmentSchemaInput, } from './attachment-schema.js';
|
|
@@ -24,7 +25,7 @@ export type { AdapterContextMonitorProvider } from './context-monitor.js';
|
|
|
24
25
|
export type { ArchiveFields, ArchiveFile, DataAccessor, DataAccessorAgentInstance, QueryTasksResult, TaskFieldUpdates, TaskQueryFilters, TransactionAccessor, } from './data-accessor.js';
|
|
25
26
|
export type { DependencyCategory, DependencyCheckResult, DependencyReport, DependencySpec, } from './dependency.js';
|
|
26
27
|
export type { AdapterManifest, DetectionPattern } from './discovery.js';
|
|
27
|
-
export { createErrorResult, createSuccessResult, formatError, getErrorMessage, isErrorResult, isErrorType, normalizeError, } from './errors.js';
|
|
28
|
+
export { createErrorResult, createSuccessResult, formatError, getErrorMessage, isErrorResult, isErrorType, normalizeError, ThinAgentViolationError, } from './errors.js';
|
|
28
29
|
export type { CommandOutputRecord, EvidenceRecord, EvidenceRecordKind, ImplDiffRecord, LintReportRecord, TestOutputRecord, ValidateSpecCheckRecord, } from './evidence-record.js';
|
|
29
30
|
export type { CommandOutputRecordInput, EvidenceRecordInput, ImplDiffRecordInput, LintReportRecordInput, TestOutputRecordInput, ValidateSpecCheckRecordInput, } from './evidence-record-schema.js';
|
|
30
31
|
export { commandOutputRecordSchema, evidenceRecordSchema, implDiffRecordSchema, lintReportRecordSchema, testOutputRecordSchema, validateSpecCheckRecordSchema, } from './evidence-record-schema.js';
|
|
@@ -42,6 +43,7 @@ export type { BrainState } from './operations/orchestrate.js';
|
|
|
42
43
|
export type { CittyArgDef, OperationParams, ParamCliDef, ParamDef, ParamType, } from './operations/params.js';
|
|
43
44
|
export { paramsToCittyArgs } from './operations/params.js';
|
|
44
45
|
export { type AgentHierarchy, type AgentHierarchyEntry, type EscalationChain, type OrchestrationHierarchyAPI, OrchestrationLevel, } from './orchestration-hierarchy.js';
|
|
46
|
+
export type { PlaybookAgenticNode, PlaybookApproval, PlaybookApprovalNode, PlaybookApprovalStatus, PlaybookDefinition, PlaybookDeterministicNode, PlaybookEdge, PlaybookEnsures, PlaybookErrorHandler, PlaybookInput, PlaybookNode, PlaybookNodeBase, PlaybookNodeOnFailure, PlaybookNodeType, PlaybookPolicy, PlaybookRequires, PlaybookRun, PlaybookRunStatus, } from './playbook.js';
|
|
45
47
|
export type { AdapterPathProvider } from './provider-paths.js';
|
|
46
48
|
export type { BottleneckTask, CompleteTaskUnblocked, ContextResult, DashboardResult, LabelCount, LeveragedTask, LogQueryResult, SequenceResult, StatsActivityMetrics, StatsAllTime, StatsCompletionMetrics, StatsCurrentState, StatsCycleTimes, StatsResult, TaskAnalysisResult, TaskDepsResult, TaskRef, TaskRefPriority, TaskSummary, } from './results.js';
|
|
47
49
|
export type { Session, SessionScope, SessionStartResult, SessionStats, SessionTaskWork, } from './session.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,GACf,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE7E,YAAY,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,E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Z,cAAc,EACd,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAE1E,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,GACf,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc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,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,wBAAwB,EACxB,SAAS,EACT,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,UAAU,EACV,eAAe,EACf,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,SAAS,GACV,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export { acceptanceArraySchema, acceptanceGateResultSchema, acceptanceGateSchema, acceptanceItemSchema, commandGateSchema, fileAssertionSchema, fileGateSchema, gateBaseSchema, gateResultDetailsSchema, httpGateSchema, lintGateSchema, manualGateSchema, testGateSchema, } from './acceptance-gate-schema.js';
|
|
10
10
|
export { attachmentMetadataSchema, attachmentRefSchema, attachmentSchema, blobAttachmentSchema, llmsTxtAttachmentSchema, llmtxtDocAttachmentSchema, localFileAttachmentSchema, urlAttachmentSchema, } from './attachment-schema.js';
|
|
11
11
|
// === Error Utilities ===
|
|
12
|
-
export { createErrorResult, createSuccessResult, formatError, getErrorMessage, isErrorResult, isErrorType, normalizeError, } from './errors.js';
|
|
12
|
+
export { createErrorResult, createSuccessResult, formatError, getErrorMessage, isErrorResult, isErrorType, normalizeError, ThinAgentViolationError, } from './errors.js';
|
|
13
13
|
// === Evidence Record Zod Schemas (runtime validation) ===
|
|
14
14
|
export { commandOutputRecordSchema, evidenceRecordSchema, implDiffRecordSchema, lintReportRecordSchema, testOutputRecordSchema, validateSpecCheckRecordSchema, } from './evidence-record-schema.js';
|
|
15
15
|
// === Exit Codes ===
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,2DAA2D;AAC3D,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,GACf,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyBH,2DAA2D;AAC3D,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,cAAc,GACf,MAAM,6BAA6B,CAAC;AA0DrC,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AA2FhC,0BAA0B;AAC1B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,EACd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/**
|
|
2
|
+
* Playbook DSL types — shared between parser, runtime, and CLI.
|
|
3
|
+
* Aligns with CLEO `.cantbook` YAML schema.
|
|
4
|
+
*
|
|
5
|
+
* @task T889 / T904 / W4-6
|
|
6
|
+
*/
|
|
7
|
+
export type PlaybookNodeType = 'agentic' | 'deterministic' | 'approval';
|
|
8
|
+
export type PlaybookRunStatus = 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
9
|
+
export type PlaybookApprovalStatus = 'pending' | 'approved' | 'rejected';
|
|
10
|
+
export type PlaybookPolicy = 'conservative' | 'permissive' | 'custom';
|
|
11
|
+
export interface PlaybookInput {
|
|
12
|
+
name: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
default?: unknown;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PlaybookEnsures {
|
|
18
|
+
outputFiles?: string[];
|
|
19
|
+
exitCode?: number;
|
|
20
|
+
schema?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PlaybookRequires {
|
|
23
|
+
from?: string;
|
|
24
|
+
fields?: string[];
|
|
25
|
+
schema?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PlaybookNodeOnFailure {
|
|
28
|
+
inject_into?: string;
|
|
29
|
+
max_iterations?: number;
|
|
30
|
+
escalate?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface PlaybookNodeBase {
|
|
33
|
+
id: string;
|
|
34
|
+
type: PlaybookNodeType;
|
|
35
|
+
description?: string;
|
|
36
|
+
depends?: string[];
|
|
37
|
+
requires?: PlaybookRequires;
|
|
38
|
+
ensures?: PlaybookEnsures;
|
|
39
|
+
on_failure?: PlaybookNodeOnFailure;
|
|
40
|
+
}
|
|
41
|
+
export interface PlaybookAgenticNode extends PlaybookNodeBase {
|
|
42
|
+
type: 'agentic';
|
|
43
|
+
skill?: string;
|
|
44
|
+
agent?: string;
|
|
45
|
+
role?: 'orchestrator' | 'lead' | 'worker';
|
|
46
|
+
inputs?: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
export interface PlaybookDeterministicNode extends PlaybookNodeBase {
|
|
49
|
+
type: 'deterministic';
|
|
50
|
+
command: string;
|
|
51
|
+
args: string[];
|
|
52
|
+
cwd?: string;
|
|
53
|
+
env?: Record<string, string>;
|
|
54
|
+
timeout_ms?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface PlaybookApprovalNode extends PlaybookNodeBase {
|
|
57
|
+
type: 'approval';
|
|
58
|
+
prompt: string;
|
|
59
|
+
policy?: PlaybookPolicy;
|
|
60
|
+
}
|
|
61
|
+
export type PlaybookNode = PlaybookAgenticNode | PlaybookDeterministicNode | PlaybookApprovalNode;
|
|
62
|
+
export interface PlaybookEdge {
|
|
63
|
+
from: string;
|
|
64
|
+
to: string;
|
|
65
|
+
contract?: {
|
|
66
|
+
requires?: string[];
|
|
67
|
+
ensures?: string[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface PlaybookErrorHandler {
|
|
71
|
+
on: 'agentic_timeout' | 'iteration_cap_exceeded' | 'contract_violation';
|
|
72
|
+
action: 'inject_hint' | 'hitl_escalate' | 'abort';
|
|
73
|
+
message?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface PlaybookDefinition {
|
|
76
|
+
version: string;
|
|
77
|
+
name: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
inputs?: PlaybookInput[];
|
|
80
|
+
nodes: PlaybookNode[];
|
|
81
|
+
edges: PlaybookEdge[];
|
|
82
|
+
error_handlers?: PlaybookErrorHandler[];
|
|
83
|
+
}
|
|
84
|
+
export interface PlaybookRun {
|
|
85
|
+
runId: string;
|
|
86
|
+
playbookName: string;
|
|
87
|
+
playbookHash: string;
|
|
88
|
+
currentNode: string | null;
|
|
89
|
+
bindings: Record<string, unknown>;
|
|
90
|
+
errorContext: string | null;
|
|
91
|
+
status: PlaybookRunStatus;
|
|
92
|
+
iterationCounts: Record<string, number>;
|
|
93
|
+
epicId?: string;
|
|
94
|
+
sessionId?: string;
|
|
95
|
+
startedAt: string;
|
|
96
|
+
completedAt?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface PlaybookApproval {
|
|
99
|
+
approvalId: string;
|
|
100
|
+
runId: string;
|
|
101
|
+
nodeId: string;
|
|
102
|
+
token: string;
|
|
103
|
+
requestedAt: string;
|
|
104
|
+
approvedAt?: string;
|
|
105
|
+
approver?: string;
|
|
106
|
+
reason?: string;
|
|
107
|
+
status: PlaybookApprovalStatus;
|
|
108
|
+
autoPassed: boolean;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=playbook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbook.d.ts","sourceRoot":"","sources":["../src/playbook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,GAAG,UAAU,CAAC;AACxE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC5F,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MA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AAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB"}
|
package/dist/playbook.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playbook.js","sourceRoot":"","sources":["../src/playbook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Registry v3 — Extended registry fields for tier-aware resolution.
|
|
3
|
+
*
|
|
4
|
+
* Introduced by T889 / T897 (agent_registry v3 migration). These types layer
|
|
5
|
+
* on top of the existing `AgentCredential` contract (see `./agent-registry.js`)
|
|
6
|
+
* to carry tier, spawn capability, orchestration level, and on-disk `.cant`
|
|
7
|
+
* provenance metadata.
|
|
8
|
+
*
|
|
9
|
+
* @see packages/core/migrations/drizzle-signaldock/*_T897_agent_registry_v3.sql
|
|
10
|
+
* @module agent-registry-v3
|
|
11
|
+
* @task T897
|
|
12
|
+
* @epic T889
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Tier / capability taxonomies
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Tier where an agent is installed or resolved from.
|
|
21
|
+
*
|
|
22
|
+
* - `project` — installed in the current project (`.cleo/agents/`)
|
|
23
|
+
* - `global` — installed at the user/global scope (`$XDG_DATA_HOME/cleo/agents/`)
|
|
24
|
+
* - `packaged` — bundled with the CLEO distribution
|
|
25
|
+
* - `fallback` — synthesized at resolve-time when no concrete `.cant` exists
|
|
26
|
+
*
|
|
27
|
+
* @task T897
|
|
28
|
+
* @epic T889
|
|
29
|
+
*/
|
|
30
|
+
export type AgentTier = 'project' | 'global' | 'packaged' | 'fallback';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Whether an agent is permitted to spawn other agents and its role in the
|
|
34
|
+
* orchestration hierarchy.
|
|
35
|
+
*
|
|
36
|
+
* - `orchestrator` — top-level coordinator, may spawn leads and workers
|
|
37
|
+
* - `lead` — may spawn workers only
|
|
38
|
+
* - `worker` — terminal; may not spawn
|
|
39
|
+
*
|
|
40
|
+
* @task T897
|
|
41
|
+
* @epic T889
|
|
42
|
+
*/
|
|
43
|
+
export type AgentSpawnCapability = 'orchestrator' | 'lead' | 'worker';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Taxonomy for the `agent_skills.source` column, identifying how a skill
|
|
47
|
+
* binding was derived.
|
|
48
|
+
*
|
|
49
|
+
* - `cant` — parsed from the agent's `.cant` manifest
|
|
50
|
+
* - `manual` — attached explicitly by a CLI call
|
|
51
|
+
* - `computed` — derived by a background indexer (e.g. doctor / index)
|
|
52
|
+
*
|
|
53
|
+
* @task T897
|
|
54
|
+
* @epic T889
|
|
55
|
+
*/
|
|
56
|
+
export type AgentSkillSource = 'cant' | 'manual' | 'computed';
|
|
57
|
+
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// Extended row / resolved envelopes
|
|
60
|
+
// ============================================================================
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Extended agent registry row fields added in the T889 / T897 v3 migration.
|
|
64
|
+
*
|
|
65
|
+
* These fields live directly on the global `signaldock.db:agents` table and
|
|
66
|
+
* supplement the pre-existing `AgentCredential` shape with tier-aware
|
|
67
|
+
* resolution metadata.
|
|
68
|
+
*
|
|
69
|
+
* @task T897
|
|
70
|
+
* @epic T889
|
|
71
|
+
*/
|
|
72
|
+
export interface AgentRegistryExtendedFields {
|
|
73
|
+
/** Tier where the row was installed / resolved from. */
|
|
74
|
+
tier: AgentTier;
|
|
75
|
+
/** `true` when the agent is permitted to spawn subagents. */
|
|
76
|
+
canSpawn: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Orchestration level (0 = orchestrator, 1 = lead, 2 = worker). Constrained
|
|
79
|
+
* to the closed interval [0, 2] by the v3 CHECK constraint.
|
|
80
|
+
*/
|
|
81
|
+
orchLevel: number;
|
|
82
|
+
/** `agent_id` of the supervising agent, or `null` for top-level agents. */
|
|
83
|
+
reportsTo: string | null;
|
|
84
|
+
/** Absolute path to the `.cant` manifest that provisioned this row. */
|
|
85
|
+
cantPath: string | null;
|
|
86
|
+
/** SHA-256 checksum of the `.cant` manifest at install time (hex-encoded). */
|
|
87
|
+
cantSha256: string | null;
|
|
88
|
+
/** Source of the install record (`seed` = bundled, `user` = CLI attach, `manual` = hand-edited). */
|
|
89
|
+
installedFrom: 'seed' | 'user' | 'manual' | null;
|
|
90
|
+
/** ISO 8601 timestamp when the row was installed. */
|
|
91
|
+
installedAt: string | null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Resolved agent record returned from the future `resolveAgent()` lookup.
|
|
96
|
+
*
|
|
97
|
+
* Aggregates tier-ranked registry state with the merged skill list and an
|
|
98
|
+
* optional alias record. Returned as an LAFS-compatible envelope so callers
|
|
99
|
+
* can inline the record in `data` without further shaping.
|
|
100
|
+
*
|
|
101
|
+
* @task T897
|
|
102
|
+
* @epic T889
|
|
103
|
+
*/
|
|
104
|
+
export interface ResolvedAgent {
|
|
105
|
+
/** Agent business identifier (matches `agents.agent_id`). */
|
|
106
|
+
agentId: string;
|
|
107
|
+
/** Tier the resolved row was sourced from. */
|
|
108
|
+
tier: AgentTier;
|
|
109
|
+
/** Absolute path to the resolved `.cant` manifest. */
|
|
110
|
+
cantPath: string;
|
|
111
|
+
/** SHA-256 checksum of the resolved `.cant` manifest (hex-encoded). */
|
|
112
|
+
cantSha256: string;
|
|
113
|
+
/** `true` when the agent may spawn subagents. */
|
|
114
|
+
canSpawn: boolean;
|
|
115
|
+
/** Orchestration level (0..2). */
|
|
116
|
+
orchLevel: number;
|
|
117
|
+
/** `agent_id` of the supervising agent, or `null`. */
|
|
118
|
+
reportsTo: string | null;
|
|
119
|
+
/** Merged skill slugs (union of catalog bindings and `.cant`-declared skills). */
|
|
120
|
+
skills: string[];
|
|
121
|
+
/** Concrete source tier of the chosen row (mirrors `tier`). */
|
|
122
|
+
source: 'project' | 'global' | 'packaged' | 'fallback';
|
|
123
|
+
/** `true` when an alias redirected the lookup to another agentId. */
|
|
124
|
+
aliasApplied: boolean;
|
|
125
|
+
/** When `aliasApplied` is true, the terminal canonical agentId the alias pointed at. */
|
|
126
|
+
aliasTarget?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Doctor diagnostic contracts
|
|
131
|
+
// ============================================================================
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Stable diagnostic codes emitted by the `cleo agent doctor` walk. Codes are
|
|
135
|
+
* frozen for the lifetime of the v3 schema; new checks MUST claim a fresh
|
|
136
|
+
* code rather than reusing a retired one.
|
|
137
|
+
*
|
|
138
|
+
* @task T897
|
|
139
|
+
* @epic T889
|
|
140
|
+
*/
|
|
141
|
+
export type AgentDoctorCode =
|
|
142
|
+
| 'D-001'
|
|
143
|
+
| 'D-002'
|
|
144
|
+
| 'D-003'
|
|
145
|
+
| 'D-004'
|
|
146
|
+
| 'D-005'
|
|
147
|
+
| 'D-006'
|
|
148
|
+
| 'D-007'
|
|
149
|
+
| 'D-008'
|
|
150
|
+
| 'D-009'
|
|
151
|
+
| 'D-010';
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Single finding produced by the agent doctor. A `fixCommand` is populated
|
|
155
|
+
* when the diagnostic is auto-remediable.
|
|
156
|
+
*
|
|
157
|
+
* @task T897
|
|
158
|
+
* @epic T889
|
|
159
|
+
*/
|
|
160
|
+
export interface AgentDoctorFinding {
|
|
161
|
+
/** Stable diagnostic code (see `AgentDoctorCode`). */
|
|
162
|
+
code: AgentDoctorCode;
|
|
163
|
+
/** Severity classification. */
|
|
164
|
+
severity: 'error' | 'warn' | 'info';
|
|
165
|
+
/** Entity under inspection (usually an `agent_id` or `.cant` path). */
|
|
166
|
+
subject: string;
|
|
167
|
+
/** Human-readable description of the finding. */
|
|
168
|
+
message: string;
|
|
169
|
+
/** Optional `cleo` command that will repair the finding when applied. */
|
|
170
|
+
fixCommand?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Aggregate doctor report envelope. `summary` tallies findings by severity
|
|
175
|
+
* for quick triage.
|
|
176
|
+
*
|
|
177
|
+
* @task T897
|
|
178
|
+
* @epic T889
|
|
179
|
+
*/
|
|
180
|
+
export interface DoctorReport {
|
|
181
|
+
/** Ordered findings, first-detected-first. */
|
|
182
|
+
findings: AgentDoctorFinding[];
|
|
183
|
+
/** Severity histogram. */
|
|
184
|
+
summary: { error: number; warn: number; info: number };
|
|
185
|
+
/** ISO 8601 timestamp when the report was generated. */
|
|
186
|
+
generatedAt: string;
|
|
187
|
+
}
|
package/src/errors.ts
CHANGED
|
@@ -7,6 +7,53 @@
|
|
|
7
7
|
* @task T5702
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { ExitCode } from './exit-codes.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Thrown when a non-orchestrator role attempts to spawn another agent,
|
|
14
|
+
* violating the thin-agent inversion-of-control rule (ORC-012).
|
|
15
|
+
*
|
|
16
|
+
* Only orchestrators may spawn subagents. Leads and workers must escalate
|
|
17
|
+
* via the playbook approval gate defined in T889 Orchestration Coherence v3.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Emitted by the spawn-guard middleware when an agent's declared role does
|
|
21
|
+
* not satisfy the orchestrator precondition. Carries `exitCode` aligned with
|
|
22
|
+
* {@link ExitCode.THIN_AGENT_VIOLATION} so the CLI can surface exit 68 to
|
|
23
|
+
* callers without additional mapping.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* throw new ThinAgentViolationError('worker-42', 'lead', 'orchestrate spawn');
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @task T889 Orchestration Coherence v3
|
|
31
|
+
* @task T907 Thin-agent enforcement
|
|
32
|
+
*/
|
|
33
|
+
export class ThinAgentViolationError extends Error {
|
|
34
|
+
/** Stable LAFS error code string for envelope emission. */
|
|
35
|
+
readonly code = 'E_THIN_AGENT_VIOLATION';
|
|
36
|
+
/** Numeric exit code aligned with {@link ExitCode.THIN_AGENT_VIOLATION}. */
|
|
37
|
+
readonly exitCode: ExitCode = ExitCode.THIN_AGENT_VIOLATION;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param agentId - The offending agent's unique identifier.
|
|
41
|
+
* @param role - The offending agent's declared role (lead, worker, etc.).
|
|
42
|
+
* @param attemptedAction - The spawn action that was blocked.
|
|
43
|
+
*/
|
|
44
|
+
constructor(
|
|
45
|
+
public readonly agentId: string,
|
|
46
|
+
public readonly role: string,
|
|
47
|
+
public readonly attemptedAction: string,
|
|
48
|
+
) {
|
|
49
|
+
super(
|
|
50
|
+
`E_THIN_AGENT_VIOLATION: agent '${agentId}' (role=${role}) attempted '${attemptedAction}'. ` +
|
|
51
|
+
'Only orchestrators may spawn. Escalate via playbook approval gate.',
|
|
52
|
+
);
|
|
53
|
+
this.name = 'ThinAgentViolationError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
10
57
|
/**
|
|
11
58
|
* Normalize any thrown value into a standardized error object.
|
|
12
59
|
*
|
package/src/exit-codes.ts
CHANGED
|
@@ -68,7 +68,7 @@ export enum ExitCode {
|
|
|
68
68
|
CONTEXT_EMERGENCY = 53,
|
|
69
69
|
CONTEXT_STALE = 54,
|
|
70
70
|
|
|
71
|
-
// === ORCHESTRATOR ERRORS (60-
|
|
71
|
+
// === ORCHESTRATOR ERRORS (60-68) ===
|
|
72
72
|
PROTOCOL_MISSING = 60,
|
|
73
73
|
INVALID_RETURN_MESSAGE = 61,
|
|
74
74
|
MANIFEST_ENTRY_MISSING = 62,
|
|
@@ -77,6 +77,29 @@ export enum ExitCode {
|
|
|
77
77
|
HANDOFF_REQUIRED = 65,
|
|
78
78
|
RESUME_FAILED = 66,
|
|
79
79
|
CONCURRENT_SESSION = 67,
|
|
80
|
+
/**
|
|
81
|
+
* E_THIN_AGENT_VIOLATION — A worker or lead agent attempted to spawn another
|
|
82
|
+
* agent, violating the thin-agent inversion-of-control rule (ORC-012).
|
|
83
|
+
* Only orchestrators may spawn subagents; non-orchestrator roles must
|
|
84
|
+
* escalate via the playbook approval gate.
|
|
85
|
+
*
|
|
86
|
+
* @task T889 Orchestration Coherence v3
|
|
87
|
+
* @task T907 Thin-agent enforcement
|
|
88
|
+
*/
|
|
89
|
+
THIN_AGENT_VIOLATION = 68,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* E_ATOMICITY_VIOLATION — A worker-role spawn was attempted for a task that
|
|
93
|
+
* exceeds the atomicity budget (more than {@link MAX_WORKER_FILES} files) or
|
|
94
|
+
* lacks an explicit file-scope declaration on its acceptance criteria.
|
|
95
|
+
*
|
|
96
|
+
* Workers MUST remain atomic (≤ 3 files with declared AC.files). Violations
|
|
97
|
+
* should be split into child tasks or promoted to a lead role.
|
|
98
|
+
*
|
|
99
|
+
* @task T889 Orchestration Coherence v3
|
|
100
|
+
* @task T894 Atomicity guard (W3-3)
|
|
101
|
+
*/
|
|
102
|
+
ATOMICITY_VIOLATION = 69,
|
|
80
103
|
|
|
81
104
|
// === NEXUS ERRORS (70-79) ===
|
|
82
105
|
NEXUS_NOT_INITIALIZED = 70,
|
package/src/index.ts
CHANGED
|
@@ -56,6 +56,17 @@ export type {
|
|
|
56
56
|
ProjectAgentRef,
|
|
57
57
|
TransportConfig,
|
|
58
58
|
} from './agent-registry.js';
|
|
59
|
+
// === Agent Registry v3 (T889 / T897 — tier-aware resolution extensions) ===
|
|
60
|
+
export type {
|
|
61
|
+
AgentDoctorCode,
|
|
62
|
+
AgentDoctorFinding,
|
|
63
|
+
AgentRegistryExtendedFields,
|
|
64
|
+
AgentSkillSource,
|
|
65
|
+
AgentSpawnCapability,
|
|
66
|
+
AgentTier,
|
|
67
|
+
DoctorReport,
|
|
68
|
+
ResolvedAgent,
|
|
69
|
+
} from './agent-registry-v3.js';
|
|
59
70
|
// === Archive Types ===
|
|
60
71
|
export type {
|
|
61
72
|
ArchiveCycleTimesReport,
|
|
@@ -200,6 +211,7 @@ export {
|
|
|
200
211
|
isErrorResult,
|
|
201
212
|
isErrorType,
|
|
202
213
|
normalizeError,
|
|
214
|
+
ThinAgentViolationError,
|
|
203
215
|
} from './errors.js';
|
|
204
216
|
// === Evidence Record Types (IVTR typed proof artifacts) ===
|
|
205
217
|
export type {
|
|
@@ -347,6 +359,27 @@ export {
|
|
|
347
359
|
type OrchestrationHierarchyAPI,
|
|
348
360
|
OrchestrationLevel,
|
|
349
361
|
} from './orchestration-hierarchy.js';
|
|
362
|
+
// === Playbook DSL Types (T889 / T904 / W4-6) ===
|
|
363
|
+
export type {
|
|
364
|
+
PlaybookAgenticNode,
|
|
365
|
+
PlaybookApproval,
|
|
366
|
+
PlaybookApprovalNode,
|
|
367
|
+
PlaybookApprovalStatus,
|
|
368
|
+
PlaybookDefinition,
|
|
369
|
+
PlaybookDeterministicNode,
|
|
370
|
+
PlaybookEdge,
|
|
371
|
+
PlaybookEnsures,
|
|
372
|
+
PlaybookErrorHandler,
|
|
373
|
+
PlaybookInput,
|
|
374
|
+
PlaybookNode,
|
|
375
|
+
PlaybookNodeBase,
|
|
376
|
+
PlaybookNodeOnFailure,
|
|
377
|
+
PlaybookNodeType,
|
|
378
|
+
PlaybookPolicy,
|
|
379
|
+
PlaybookRequires,
|
|
380
|
+
PlaybookRun,
|
|
381
|
+
PlaybookRunStatus,
|
|
382
|
+
} from './playbook.js';
|
|
350
383
|
export type { AdapterPathProvider } from './provider-paths.js';
|
|
351
384
|
// === Result Types (Dashboard, Stats, Log, Context, Sequence, Analysis, Deps) ===
|
|
352
385
|
export type {
|
package/src/playbook.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playbook DSL types — shared between parser, runtime, and CLI.
|
|
3
|
+
* Aligns with CLEO `.cantbook` YAML schema.
|
|
4
|
+
*
|
|
5
|
+
* @task T889 / T904 / W4-6
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type PlaybookNodeType = 'agentic' | 'deterministic' | 'approval';
|
|
9
|
+
export type PlaybookRunStatus = 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
10
|
+
export type PlaybookApprovalStatus = 'pending' | 'approved' | 'rejected';
|
|
11
|
+
export type PlaybookPolicy = 'conservative' | 'permissive' | 'custom';
|
|
12
|
+
|
|
13
|
+
export interface PlaybookInput {
|
|
14
|
+
name: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
default?: unknown;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PlaybookEnsures {
|
|
21
|
+
outputFiles?: string[];
|
|
22
|
+
exitCode?: number;
|
|
23
|
+
schema?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PlaybookRequires {
|
|
27
|
+
from?: string;
|
|
28
|
+
fields?: string[];
|
|
29
|
+
schema?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PlaybookNodeOnFailure {
|
|
33
|
+
inject_into?: string;
|
|
34
|
+
max_iterations?: number;
|
|
35
|
+
escalate?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PlaybookNodeBase {
|
|
39
|
+
id: string;
|
|
40
|
+
type: PlaybookNodeType;
|
|
41
|
+
description?: string;
|
|
42
|
+
depends?: string[];
|
|
43
|
+
requires?: PlaybookRequires;
|
|
44
|
+
ensures?: PlaybookEnsures;
|
|
45
|
+
on_failure?: PlaybookNodeOnFailure;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PlaybookAgenticNode extends PlaybookNodeBase {
|
|
49
|
+
type: 'agentic';
|
|
50
|
+
skill?: string;
|
|
51
|
+
agent?: string;
|
|
52
|
+
role?: 'orchestrator' | 'lead' | 'worker';
|
|
53
|
+
inputs?: Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface PlaybookDeterministicNode extends PlaybookNodeBase {
|
|
57
|
+
type: 'deterministic';
|
|
58
|
+
command: string;
|
|
59
|
+
args: string[];
|
|
60
|
+
cwd?: string;
|
|
61
|
+
env?: Record<string, string>;
|
|
62
|
+
timeout_ms?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface PlaybookApprovalNode extends PlaybookNodeBase {
|
|
66
|
+
type: 'approval';
|
|
67
|
+
prompt: string;
|
|
68
|
+
policy?: PlaybookPolicy;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type PlaybookNode = PlaybookAgenticNode | PlaybookDeterministicNode | PlaybookApprovalNode;
|
|
72
|
+
|
|
73
|
+
export interface PlaybookEdge {
|
|
74
|
+
from: string;
|
|
75
|
+
to: string;
|
|
76
|
+
contract?: {
|
|
77
|
+
requires?: string[];
|
|
78
|
+
ensures?: string[];
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface PlaybookErrorHandler {
|
|
83
|
+
on: 'agentic_timeout' | 'iteration_cap_exceeded' | 'contract_violation';
|
|
84
|
+
action: 'inject_hint' | 'hitl_escalate' | 'abort';
|
|
85
|
+
message?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface PlaybookDefinition {
|
|
89
|
+
version: string;
|
|
90
|
+
name: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
inputs?: PlaybookInput[];
|
|
93
|
+
nodes: PlaybookNode[];
|
|
94
|
+
edges: PlaybookEdge[];
|
|
95
|
+
error_handlers?: PlaybookErrorHandler[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface PlaybookRun {
|
|
99
|
+
runId: string;
|
|
100
|
+
playbookName: string;
|
|
101
|
+
playbookHash: string;
|
|
102
|
+
currentNode: string | null;
|
|
103
|
+
bindings: Record<string, unknown>;
|
|
104
|
+
errorContext: string | null;
|
|
105
|
+
status: PlaybookRunStatus;
|
|
106
|
+
iterationCounts: Record<string, number>;
|
|
107
|
+
epicId?: string;
|
|
108
|
+
sessionId?: string;
|
|
109
|
+
startedAt: string;
|
|
110
|
+
completedAt?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface PlaybookApproval {
|
|
114
|
+
approvalId: string;
|
|
115
|
+
runId: string;
|
|
116
|
+
nodeId: string;
|
|
117
|
+
token: string;
|
|
118
|
+
requestedAt: string;
|
|
119
|
+
approvedAt?: string;
|
|
120
|
+
approver?: string;
|
|
121
|
+
reason?: string;
|
|
122
|
+
status: PlaybookApprovalStatus;
|
|
123
|
+
autoPassed: boolean;
|
|
124
|
+
}
|