@s_s/harmonia 1.2.0 → 1.4.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 +140 -392
- package/build/cli/setup.d.ts +4 -2
- package/build/cli/setup.js +44 -18
- package/build/cli/setup.js.map +1 -1
- package/build/core/action-registry.d.ts +36 -0
- package/build/core/action-registry.js +53 -0
- package/build/core/action-registry.js.map +1 -0
- package/build/core/artifacts.d.ts +66 -0
- package/build/core/artifacts.js +178 -0
- package/build/core/artifacts.js.map +1 -0
- package/build/core/dispatch.d.ts +18 -11
- package/build/core/dispatch.js +43 -33
- package/build/core/dispatch.js.map +1 -1
- package/build/core/issues.d.ts +37 -0
- package/build/core/issues.js +100 -0
- package/build/core/issues.js.map +1 -0
- package/build/core/overrides.d.ts +19 -26
- package/build/core/overrides.js +32 -98
- package/build/core/overrides.js.map +1 -1
- package/build/core/plugin.d.ts +86 -0
- package/build/core/plugin.js +332 -0
- package/build/core/plugin.js.map +1 -0
- package/build/core/registry.d.ts +36 -3
- package/build/core/registry.js +63 -5
- package/build/core/registry.js.map +1 -1
- package/build/core/reviews.d.ts +13 -13
- package/build/core/reviews.js +31 -32
- package/build/core/reviews.js.map +1 -1
- package/build/core/schema.d.ts +43 -15
- package/build/core/schema.js +124 -20
- package/build/core/schema.js.map +1 -1
- package/build/core/state.d.ts +29 -22
- package/build/core/state.js +49 -81
- package/build/core/state.js.map +1 -1
- package/build/core/steps.d.ts +15 -15
- package/build/core/steps.js +32 -33
- package/build/core/steps.js.map +1 -1
- package/build/core/tree-utils.d.ts +52 -0
- package/build/core/tree-utils.js +226 -0
- package/build/core/tree-utils.js.map +1 -0
- package/build/core/types.d.ts +417 -117
- package/build/core/types.js +15 -1
- package/build/core/types.js.map +1 -1
- package/build/core/workflow-engine.d.ts +68 -0
- package/build/core/workflow-engine.js +821 -0
- package/build/core/workflow-engine.js.map +1 -0
- package/build/core/workflow-validator.d.ts +22 -0
- package/build/core/workflow-validator.js +489 -0
- package/build/core/workflow-validator.js.map +1 -0
- package/build/index.js +28 -25
- package/build/index.js.map +1 -1
- package/build/setup/inject.d.ts +4 -4
- package/build/setup/inject.js +6 -6
- package/build/setup/inject.js.map +1 -1
- package/build/setup/templates.d.ts +9 -7
- package/build/setup/templates.js +68 -103
- package/build/setup/templates.js.map +1 -1
- package/build/tools/artifact-approve.d.ts +8 -0
- package/build/tools/artifact-approve.js +94 -0
- package/build/tools/artifact-approve.js.map +1 -0
- package/build/tools/artifact-schema.d.ts +12 -0
- package/build/tools/artifact-schema.js +148 -0
- package/build/tools/artifact-schema.js.map +1 -0
- package/build/tools/artifact-tools.d.ts +18 -0
- package/build/tools/artifact-tools.js +465 -0
- package/build/tools/artifact-tools.js.map +1 -0
- package/build/tools/{report-dispatch.d.ts → dispatch-report.d.ts} +7 -3
- package/build/tools/dispatch-report.js +261 -0
- package/build/tools/dispatch-report.js.map +1 -0
- package/build/tools/engine-helpers.d.ts +41 -0
- package/build/tools/engine-helpers.js +182 -0
- package/build/tools/engine-helpers.js.map +1 -0
- package/build/tools/get-project-status.d.ts +6 -4
- package/build/tools/get-project-status.js +308 -246
- package/build/tools/get-project-status.js.map +1 -1
- package/build/tools/get-role-prompt.d.ts +1 -1
- package/build/tools/get-role-prompt.js +7 -41
- package/build/tools/get-role-prompt.js.map +1 -1
- package/build/tools/issue-tools.d.ts +10 -0
- package/build/tools/issue-tools.js +169 -0
- package/build/tools/issue-tools.js.map +1 -0
- package/build/tools/iteration-start.d.ts +7 -4
- package/build/tools/iteration-start.js +51 -20
- package/build/tools/iteration-start.js.map +1 -1
- package/build/tools/loop-done.d.ts +11 -0
- package/build/tools/loop-done.js +109 -0
- package/build/tools/loop-done.js.map +1 -0
- package/build/tools/patch-start.d.ts +16 -0
- package/build/tools/patch-start.js +122 -0
- package/build/tools/patch-start.js.map +1 -0
- package/build/tools/project-init.d.ts +5 -5
- package/build/tools/project-init.js +47 -18
- package/build/tools/project-init.js.map +1 -1
- package/build/tools/role-dispatch.d.ts +55 -0
- package/build/tools/role-dispatch.js +508 -0
- package/build/tools/role-dispatch.js.map +1 -0
- package/build/tools/utils.d.ts +40 -0
- package/build/tools/utils.js +97 -0
- package/build/tools/utils.js.map +1 -0
- package/package.json +1 -1
- package/{build/hooks/claude-code.js → workflows/dev/hooks/claude.js} +34 -23
- package/{build → workflows/dev}/hooks/content.js +27 -18
- package/workflows/dev/hooks/index.js +52 -0
- package/{build → workflows/dev}/hooks/openclaw.js +31 -20
- package/{build → workflows/dev}/hooks/opencode.js +31 -20
- package/workflows/dev/roles/architect.md +68 -28
- package/workflows/dev/roles/coordinator.md +103 -0
- package/workflows/dev/roles/developer.md +5 -5
- package/workflows/dev/roles/tester.md +19 -19
- package/workflows/dev/schemas/api-contract.json +42 -0
- package/workflows/dev/schemas/api-design.json +30 -13
- package/workflows/dev/schemas/data-model.json +20 -7
- package/workflows/dev/schemas/prd.completeness-check.json +6 -5
- package/workflows/dev/schemas/prd.draft.json +13 -5
- package/workflows/dev/schemas/prd.final.json +34 -11
- package/workflows/dev/schemas/prd.json +29 -11
- package/workflows/dev/schemas/prd.requirements.json +6 -5
- package/workflows/dev/schemas/prototype.json +6 -2
- package/workflows/dev/schemas/task-breakdown.coarse.json +4 -3
- package/workflows/dev/schemas/task-breakdown.dependencies.json +5 -4
- package/workflows/dev/schemas/task-breakdown.detailed.json +8 -3
- package/workflows/dev/schemas/task-breakdown.final.json +8 -3
- package/workflows/dev/schemas/task-breakdown.json +8 -3
- package/workflows/dev/schemas/tech-design.analysis.json +6 -5
- package/workflows/dev/schemas/tech-design.draft.json +14 -5
- package/workflows/dev/schemas/tech-design.final.json +39 -13
- package/workflows/dev/schemas/tech-design.json +34 -13
- package/workflows/dev/schemas/tech-design.research.json +21 -0
- package/workflows/dev/schemas/test-plan.json +17 -7
- package/workflows/dev/schemas/test-report.json +26 -9
- package/workflows/dev/schemas/user-stories.json +7 -3
- package/workflows/dev/tools/index.js +23 -0
- package/workflows/dev/workflow.json +234 -101
- package/build/core/docs.d.ts +0 -32
- package/build/core/docs.js +0 -91
- package/build/core/docs.js.map +0 -1
- package/build/core/workflow.d.ts +0 -33
- package/build/core/workflow.js +0 -140
- package/build/core/workflow.js.map +0 -1
- package/build/hooks/claude-code.d.ts +0 -20
- package/build/hooks/claude-code.js.map +0 -1
- package/build/hooks/content.d.ts +0 -43
- package/build/hooks/content.js.map +0 -1
- package/build/hooks/install.d.ts +0 -40
- package/build/hooks/install.js +0 -63
- package/build/hooks/install.js.map +0 -1
- package/build/hooks/openclaw.d.ts +0 -24
- package/build/hooks/openclaw.js.map +0 -1
- package/build/hooks/opencode.d.ts +0 -29
- package/build/hooks/opencode.js.map +0 -1
- package/build/tools/approve-doc.d.ts +0 -6
- package/build/tools/approve-doc.js +0 -108
- package/build/tools/approve-doc.js.map +0 -1
- package/build/tools/dispatch-role.d.ts +0 -16
- package/build/tools/dispatch-role.js +0 -277
- package/build/tools/dispatch-role.js.map +0 -1
- package/build/tools/doc-tools.d.ts +0 -16
- package/build/tools/doc-tools.js +0 -389
- package/build/tools/doc-tools.js.map +0 -1
- package/build/tools/override-tools.d.ts +0 -6
- package/build/tools/override-tools.js +0 -129
- package/build/tools/override-tools.js.map +0 -1
- package/build/tools/report-dispatch.js +0 -194
- package/build/tools/report-dispatch.js.map +0 -1
- package/build/tools/set-scale.d.ts +0 -6
- package/build/tools/set-scale.js +0 -107
- package/build/tools/set-scale.js.map +0 -1
- package/build/tools/setup-project.d.ts +0 -8
- package/build/tools/setup-project.js +0 -116
- package/build/tools/setup-project.js.map +0 -1
- package/build/tools/update-phase.d.ts +0 -12
- package/build/tools/update-phase.js +0 -159
- package/build/tools/update-phase.js.map +0 -1
- package/workflows/dev/roles/pm.md +0 -99
- package/workflows/dev/schemas/deploy.json +0 -20
- package/workflows/dev/schemas/fsd.json +0 -25
- package/workflows/dev/schemas/project-plan.json +0 -20
- package/workflows/dev/schemas/retrospective.json +0 -20
- package/workflows/dev/schemas/risk-assessment.json +0 -15
- package/workflows/dev/schemas/tech-design.api-contract.json +0 -20
package/build/core/types.d.ts
CHANGED
|
@@ -1,109 +1,225 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core type definitions for Harmonia.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Architecture: Core provides composable collaboration primitives.
|
|
5
|
+
* Workflow plugins use these primitives to define specific processes.
|
|
6
|
+
*
|
|
7
|
+
* This file defines:
|
|
8
|
+
* - Workflow node types (task, sequence, parallel, gate, loop)
|
|
9
|
+
* - Workflow state (node-based, not phase-based)
|
|
10
|
+
* - Engine types (nextAction, events, gate evaluation)
|
|
11
|
+
* - Artifact system
|
|
12
|
+
* - Plugin interface
|
|
13
|
+
* - Session & Dispatch tracking
|
|
14
|
+
* - Override configuration (simplified to 2-layer)
|
|
15
|
+
* - Sequential step tracking
|
|
16
|
+
* - Issue tracking
|
|
17
|
+
* - Review state
|
|
4
18
|
*/
|
|
5
|
-
|
|
19
|
+
/** Agent type for spawning team member agents (re-exported from @s_s/agent-kit) */
|
|
20
|
+
import type { AgentType } from '@s_s/agent-kit';
|
|
21
|
+
export type { AgentType };
|
|
22
|
+
export type NodeType = 'task' | 'sequence' | 'parallel' | 'gate' | 'loop';
|
|
23
|
+
/** Hook configuration for beforeDispatch / afterComplete */
|
|
24
|
+
export interface NodeHook {
|
|
25
|
+
/** Extra prompt text to inject */
|
|
26
|
+
inject?: string[];
|
|
27
|
+
/** Registered action names to execute synchronously */
|
|
28
|
+
actions?: string[];
|
|
29
|
+
}
|
|
30
|
+
/** Failure handler for task and parallel nodes */
|
|
31
|
+
export interface FailureHandler {
|
|
32
|
+
/** Target node ID to jump back to (must satisfy ancestor-chain constraint) */
|
|
33
|
+
goto: string;
|
|
34
|
+
/** Max retry count; omit for unlimited */
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
/** Floating node ID to jump to when retries exhausted */
|
|
37
|
+
onExhausted?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Goto target for gate fail paths */
|
|
40
|
+
export interface GotoTarget {
|
|
41
|
+
/** Target node ID to jump back to */
|
|
42
|
+
goto: string;
|
|
43
|
+
/** Max retry count; omit for unlimited */
|
|
44
|
+
maxRetries?: number;
|
|
45
|
+
/** Floating node ID to jump to when retries exhausted */
|
|
46
|
+
onExhausted?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Task node — work unit assigned to a role */
|
|
49
|
+
export interface TaskNode {
|
|
50
|
+
type: 'task';
|
|
51
|
+
id: string;
|
|
52
|
+
/** Role ID that executes this task */
|
|
53
|
+
role: string;
|
|
54
|
+
/** Artifact IDs this task needs as input (resolved to name + path references at dispatch time) */
|
|
55
|
+
inputArtifacts?: string[];
|
|
56
|
+
/** Optional timeout in seconds */
|
|
57
|
+
timeout?: number;
|
|
58
|
+
/** Optional failure handler */
|
|
59
|
+
onFailed?: FailureHandler;
|
|
60
|
+
/** Hook before dispatching to role */
|
|
61
|
+
beforeDispatch?: NodeHook;
|
|
62
|
+
/** Hook after task completion */
|
|
63
|
+
afterComplete?: NodeHook;
|
|
64
|
+
}
|
|
65
|
+
/** Sequence node — children execute in order */
|
|
66
|
+
export interface SequenceNode {
|
|
67
|
+
type: 'sequence';
|
|
68
|
+
id: string;
|
|
69
|
+
children: WorkflowNode[];
|
|
70
|
+
}
|
|
71
|
+
/** Parallel node — children execute simultaneously */
|
|
72
|
+
export interface ParallelNode {
|
|
73
|
+
type: 'parallel';
|
|
74
|
+
id: string;
|
|
75
|
+
/** Required: how to handle child failures */
|
|
76
|
+
failStrategy: 'fail-fast' | 'wait-all';
|
|
77
|
+
children: WorkflowNode[];
|
|
78
|
+
/** Optional failure handler */
|
|
79
|
+
onFailed?: FailureHandler;
|
|
80
|
+
}
|
|
81
|
+
/** Gate condition types */
|
|
82
|
+
export interface ArtifactExistsCondition {
|
|
83
|
+
type: 'artifact_exists';
|
|
84
|
+
/** Artifact ID to check */
|
|
85
|
+
artifact: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ArtifactApprovedCondition {
|
|
88
|
+
type: 'artifact_approved';
|
|
89
|
+
/** Artifact ID to check */
|
|
90
|
+
artifact: string;
|
|
91
|
+
}
|
|
92
|
+
export type ArtifactFieldOperator = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'contains' | 'in';
|
|
93
|
+
export interface ArtifactFieldCondition {
|
|
94
|
+
type: 'artifact_field';
|
|
95
|
+
/** Artifact ID to check */
|
|
96
|
+
artifact: string;
|
|
97
|
+
/** Field path within the artifact */
|
|
98
|
+
field: string;
|
|
99
|
+
/** Comparison operator */
|
|
100
|
+
operator: ArtifactFieldOperator;
|
|
101
|
+
/** Expected value */
|
|
102
|
+
value: unknown;
|
|
103
|
+
}
|
|
104
|
+
export type GateCondition = ArtifactExistsCondition | ArtifactApprovedCondition | ArtifactFieldCondition;
|
|
105
|
+
/** Gate node — condition check with pass/fail paths */
|
|
106
|
+
export interface GateNode {
|
|
107
|
+
type: 'gate';
|
|
108
|
+
id: string;
|
|
109
|
+
/** All conditions must be met for pass */
|
|
110
|
+
conditions: GateCondition[];
|
|
111
|
+
/** Path when all conditions pass (inline node) */
|
|
112
|
+
pass: WorkflowNode;
|
|
113
|
+
/** Path when conditions fail — inline node or goto */
|
|
114
|
+
fail: WorkflowNode | GotoTarget;
|
|
115
|
+
}
|
|
116
|
+
/** Loop node — repeated execution of a sub-workflow with iteration state */
|
|
117
|
+
export interface LoopNode {
|
|
118
|
+
type: 'loop';
|
|
6
119
|
id: string;
|
|
120
|
+
/** Maximum iterations (safety cap) */
|
|
121
|
+
maxIterations: number;
|
|
122
|
+
/** The sub-workflow to repeat each iteration */
|
|
123
|
+
body: WorkflowNode;
|
|
124
|
+
/** Optional failure handler */
|
|
125
|
+
onFailed?: FailureHandler;
|
|
126
|
+
}
|
|
127
|
+
/** Union of all workflow node types */
|
|
128
|
+
export type WorkflowNode = TaskNode | SequenceNode | ParallelNode | GateNode | LoopNode;
|
|
129
|
+
/** Complete workflow definition loaded from workflow.json */
|
|
130
|
+
export interface WorkflowDefinition {
|
|
7
131
|
name: string;
|
|
8
|
-
roles: string[];
|
|
9
|
-
inputs?: string[];
|
|
10
|
-
outputs: string[];
|
|
11
132
|
description: string;
|
|
133
|
+
version?: string;
|
|
134
|
+
/** Author of this workflow */
|
|
135
|
+
author?: string;
|
|
136
|
+
/** Coordinator role ID — every workflow must have one */
|
|
137
|
+
coordinator: string;
|
|
138
|
+
/** Root node of the workflow tree */
|
|
139
|
+
root: WorkflowNode;
|
|
140
|
+
/** Standalone nodes referenced by onExhausted/onFailed */
|
|
141
|
+
floatingNodes?: TaskNode[];
|
|
12
142
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface DocStepDefinition {
|
|
143
|
+
/** Step definition within an artifact (for sequential mode) */
|
|
144
|
+
export interface ArtifactStepDefinition {
|
|
16
145
|
/** Step ID, e.g. "requirements", "draft", "final" */
|
|
17
146
|
id: string;
|
|
18
147
|
/** Human-readable name */
|
|
19
148
|
name: string;
|
|
20
|
-
/** Output format for this step
|
|
149
|
+
/** Output format for this step */
|
|
21
150
|
format: 'json' | 'md';
|
|
22
151
|
/** Description shown to agent */
|
|
23
152
|
description: string;
|
|
24
153
|
}
|
|
25
|
-
|
|
154
|
+
/** Artifact definition — metadata for an artifact type */
|
|
155
|
+
export interface ArtifactDefinition {
|
|
156
|
+
/** Human-readable name */
|
|
26
157
|
name: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/** Whether this doc requires user review/approval after creation */
|
|
158
|
+
/** File format: "md" (default), "html", or "json" */
|
|
159
|
+
format?: 'md' | 'html' | 'json';
|
|
160
|
+
/** Whether this artifact requires user review/approval */
|
|
31
161
|
review?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
author?: string;
|
|
47
|
-
phases: PhaseDefinition[];
|
|
48
|
-
docs: Record<string, DocDefinition>;
|
|
49
|
-
scale_criteria: {
|
|
50
|
-
description: string;
|
|
51
|
-
dimensions: Record<string, ScaleDimension>;
|
|
52
|
-
};
|
|
162
|
+
/** Unmanaged output — not managed by artifact_write (e.g. code written directly by agent) */
|
|
163
|
+
unmanaged?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Output directory template using placeholders:
|
|
166
|
+
* - `{global}` → `<data_dir>/<project>/iter-N/artifacts/`
|
|
167
|
+
* - `{project}` → `<projectDir>/`
|
|
168
|
+
* - `{context}` → `iter-N` or `patch-N` (must follow `{global}` or `{project}`)
|
|
169
|
+
*
|
|
170
|
+
* When undefined, defaults to `{global}` behavior.
|
|
171
|
+
* File name is always `<artifactId>.<ext>` — output only controls the directory.
|
|
172
|
+
*/
|
|
173
|
+
output?: string;
|
|
174
|
+
/** Sequential steps — when defined, artifact_write requires step parameter */
|
|
175
|
+
steps?: ArtifactStepDefinition[];
|
|
53
176
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
* Validation checks that the document contains a heading matching the primary
|
|
57
|
-
* pattern or one of the aliases.
|
|
58
|
-
*/
|
|
59
|
-
export interface DocSchemaSection {
|
|
177
|
+
/** A required section (heading) in a markdown artifact */
|
|
178
|
+
export interface ArtifactSchemaSection {
|
|
60
179
|
/** Primary heading text, e.g. "## 项目概述" */
|
|
61
180
|
heading: string;
|
|
62
|
-
/**
|
|
63
|
-
required:
|
|
181
|
+
/** Whether this section is required */
|
|
182
|
+
required: boolean;
|
|
64
183
|
/** Alternative heading texts that satisfy this requirement */
|
|
65
184
|
aliases?: string[];
|
|
66
185
|
}
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
* Used by write_doc to validate content structure before writing.
|
|
70
|
-
*/
|
|
71
|
-
export interface DocSchema {
|
|
72
|
-
/** Required sections for markdown documents */
|
|
73
|
-
sections?: DocSchemaSection[];
|
|
74
|
-
/** Required HTML tags for html-format documents (e.g. ["html", "body", "nav"]) */
|
|
75
|
-
htmlTags?: string[];
|
|
76
|
-
/** Required top-level JSON fields (for JSON step artifacts) */
|
|
77
|
-
jsonFields?: DocSchemaJsonField[];
|
|
78
|
-
/** Minimum content length in characters (optional) */
|
|
79
|
-
minLength?: number;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* A required top-level field in a JSON document.
|
|
83
|
-
* Used for validating structured step artifacts.
|
|
84
|
-
*/
|
|
85
|
-
export interface DocSchemaJsonField {
|
|
186
|
+
/** A required top-level field in a JSON artifact */
|
|
187
|
+
export interface ArtifactSchemaJsonField {
|
|
86
188
|
/** Field name (top-level key in JSON) */
|
|
87
189
|
field: string;
|
|
88
|
-
/**
|
|
89
|
-
required:
|
|
190
|
+
/** Whether this field is required */
|
|
191
|
+
required: boolean;
|
|
90
192
|
/** Expected type: "string", "array", "object", "number", "boolean" */
|
|
91
193
|
type?: string;
|
|
92
194
|
/** If type is "array", minimum number of items */
|
|
93
195
|
minItems?: number;
|
|
94
196
|
}
|
|
197
|
+
/** Schema definition for an artifact type */
|
|
198
|
+
export interface ArtifactSchema {
|
|
199
|
+
/** Required sections for markdown artifacts */
|
|
200
|
+
sections?: ArtifactSchemaSection[];
|
|
201
|
+
/** Required HTML tags for html-format artifacts */
|
|
202
|
+
htmlTags?: string[];
|
|
203
|
+
/** Required top-level JSON fields */
|
|
204
|
+
jsonFields?: ArtifactSchemaJsonField[];
|
|
205
|
+
/** Minimum content length in characters */
|
|
206
|
+
minLength?: number;
|
|
207
|
+
/** Human-readable guidance for agents */
|
|
208
|
+
guidance?: string;
|
|
209
|
+
}
|
|
95
210
|
export interface RoleCapability {
|
|
96
211
|
/** Unique ID for this capability */
|
|
97
212
|
id: string;
|
|
98
|
-
/** Human-readable description
|
|
213
|
+
/** Human-readable description */
|
|
99
214
|
description: string;
|
|
100
|
-
/** Associated
|
|
101
|
-
|
|
215
|
+
/** Associated artifact ID — if set, this capability produces this artifact */
|
|
216
|
+
artifact?: string;
|
|
102
217
|
}
|
|
103
218
|
export interface RoleFrontmatter {
|
|
104
|
-
model
|
|
219
|
+
model?: string;
|
|
105
220
|
session: 'none' | 'persistent' | 'optional';
|
|
106
221
|
parallel: boolean;
|
|
222
|
+
agent?: string;
|
|
107
223
|
/** Capabilities this role provides (used by override system) */
|
|
108
224
|
capabilities?: RoleCapability[];
|
|
109
225
|
}
|
|
@@ -112,42 +228,200 @@ export interface RoleDefinition {
|
|
|
112
228
|
frontmatter: RoleFrontmatter;
|
|
113
229
|
prompt: string;
|
|
114
230
|
}
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
export type ProjectScale = 'small' | 'medium' | 'large';
|
|
121
|
-
export interface PhaseState {
|
|
231
|
+
export type NodeStatus = 'pending' | 'active' | 'completed' | 'failed' | 'cancelled' | 'skipped';
|
|
232
|
+
export type ContextType = 'iteration' | 'patch';
|
|
233
|
+
/** Runtime state of a single node */
|
|
234
|
+
export interface NodeState {
|
|
235
|
+
/** Node ID (matches definition) */
|
|
122
236
|
id: string;
|
|
123
|
-
status
|
|
237
|
+
/** Current status */
|
|
238
|
+
status: NodeStatus;
|
|
239
|
+
/** Number of times this node has been retried (0 = first execution) */
|
|
240
|
+
retryCount: number;
|
|
241
|
+
/** When this node became active */
|
|
124
242
|
startedAt?: string;
|
|
243
|
+
/** When this node completed (or failed) */
|
|
125
244
|
completedAt?: string;
|
|
126
|
-
|
|
245
|
+
/** Error message if failed */
|
|
246
|
+
error?: string;
|
|
127
247
|
}
|
|
128
|
-
|
|
248
|
+
/** Runtime state for loop nodes (extends NodeState) */
|
|
249
|
+
export interface LoopNodeState extends NodeState {
|
|
250
|
+
/** Current iteration index (0-based) */
|
|
251
|
+
currentIteration: number;
|
|
252
|
+
/** Whether loop_done has been called — loop will terminate after current iteration completes */
|
|
253
|
+
done: boolean;
|
|
254
|
+
}
|
|
255
|
+
/** Complete workflow state (persisted in state.json) */
|
|
256
|
+
export interface WorkflowState {
|
|
129
257
|
/** Project name (unique identifier) */
|
|
130
258
|
projectName: string;
|
|
131
259
|
/** Absolute path to the project source directory */
|
|
132
260
|
projectDir: string;
|
|
133
|
-
/** Workflow name, e.g. "dev" */
|
|
261
|
+
/** Workflow plugin name, e.g. "dev" */
|
|
134
262
|
workflow: string;
|
|
135
|
-
/**
|
|
263
|
+
/** Context type: iteration or patch */
|
|
264
|
+
type: ContextType;
|
|
265
|
+
/** Iteration or patch number */
|
|
136
266
|
iteration: number;
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
phases: PhaseState[];
|
|
143
|
-
/** Timestamp of project initialization */
|
|
267
|
+
/** Currently active node ID (null when workflow is completed or not started) */
|
|
268
|
+
activeNodeId: string | null;
|
|
269
|
+
/** State of every node, keyed by node ID */
|
|
270
|
+
nodes: Record<string, NodeState>;
|
|
271
|
+
/** Timestamp of state initialization */
|
|
144
272
|
createdAt: string;
|
|
145
273
|
/** Last updated timestamp */
|
|
146
274
|
updatedAt: string;
|
|
275
|
+
/** Optional metadata (e.g. patch description, linked issue) */
|
|
276
|
+
meta?: Record<string, unknown>;
|
|
277
|
+
}
|
|
278
|
+
/** Per-condition evaluation detail */
|
|
279
|
+
export interface GateConditionResult {
|
|
280
|
+
/** The condition that was evaluated */
|
|
281
|
+
condition: GateCondition;
|
|
282
|
+
/** Whether the condition was met */
|
|
283
|
+
met: boolean;
|
|
284
|
+
/** Actual value found (for artifact_field conditions) */
|
|
285
|
+
actualValue?: unknown;
|
|
286
|
+
}
|
|
287
|
+
/** Gate evaluation result */
|
|
288
|
+
export interface GateEvaluationResult {
|
|
289
|
+
/** Whether all conditions passed */
|
|
290
|
+
passed: boolean;
|
|
291
|
+
/** Per-condition evaluation details */
|
|
292
|
+
conditions: GateConditionResult[];
|
|
293
|
+
}
|
|
294
|
+
/** nextAction type — tells the coordinator what to do next */
|
|
295
|
+
export type NextActionType = 'dispatch' | 'write_artifact' | 'approve_artifact' | 'wait' | 'completed' | 'failed' | 'evaluate_gate' | 'none';
|
|
296
|
+
/** Unified nextAction return structure */
|
|
297
|
+
export interface NextAction {
|
|
298
|
+
/** What the coordinator should do */
|
|
299
|
+
type: NextActionType;
|
|
300
|
+
/** Target node ID (if applicable) */
|
|
301
|
+
nodeId?: string;
|
|
302
|
+
/** Role to dispatch (if type is 'dispatch') */
|
|
303
|
+
role?: string;
|
|
304
|
+
/** Human-readable instructions for the coordinator */
|
|
305
|
+
instructions: string;
|
|
306
|
+
/** Fully assembled prompt for the team member (if dispatching) */
|
|
307
|
+
rolePrompt?: string;
|
|
308
|
+
/** Gate evaluation results (if coming from a gate fail/goto) */
|
|
309
|
+
gateResults?: GateEvaluationResult;
|
|
310
|
+
/** Parallel dispatch targets (when dispatching multiple tasks simultaneously) */
|
|
311
|
+
parallelDispatch?: Array<{
|
|
312
|
+
nodeId: string;
|
|
313
|
+
role: string;
|
|
314
|
+
}>;
|
|
315
|
+
}
|
|
316
|
+
/** Events that trigger engine state transitions */
|
|
317
|
+
export type WorkflowEvent = {
|
|
318
|
+
type: 'node_completed';
|
|
319
|
+
nodeId: string;
|
|
320
|
+
result?: unknown;
|
|
321
|
+
} | {
|
|
322
|
+
type: 'node_failed';
|
|
323
|
+
nodeId: string;
|
|
324
|
+
error: string;
|
|
325
|
+
} | {
|
|
326
|
+
type: 'artifact_written';
|
|
327
|
+
artifactId: string;
|
|
328
|
+
} | {
|
|
329
|
+
type: 'artifact_approved';
|
|
330
|
+
artifactId: string;
|
|
331
|
+
} | {
|
|
332
|
+
type: 'dispatch_requested';
|
|
333
|
+
nodeId: string;
|
|
334
|
+
} | {
|
|
335
|
+
type: 'query_status';
|
|
336
|
+
} | {
|
|
337
|
+
type: 'loop_done';
|
|
338
|
+
nodeId: string;
|
|
339
|
+
};
|
|
340
|
+
/** Context passed to action handlers */
|
|
341
|
+
export interface ActionContext {
|
|
342
|
+
/** Current node ID */
|
|
343
|
+
nodeId: string;
|
|
344
|
+
/** Current node's role */
|
|
345
|
+
role: string;
|
|
346
|
+
/** Current retry count (0 = first execution) */
|
|
347
|
+
retryCount: number;
|
|
348
|
+
/** Project name */
|
|
349
|
+
projectName: string;
|
|
350
|
+
/** Plugin-specific configuration (opaque to Core) */
|
|
351
|
+
pluginConfig: unknown;
|
|
352
|
+
/** Gate evaluation results (if arriving via goto from gate fail) */
|
|
353
|
+
gateResults?: GateEvaluationResult;
|
|
354
|
+
/** Current workflow state snapshot */
|
|
355
|
+
workflowState: WorkflowState;
|
|
356
|
+
/** Artifact access API */
|
|
357
|
+
artifacts: {
|
|
358
|
+
read: (artifactId: string) => Promise<string>;
|
|
359
|
+
list: () => Promise<string[]>;
|
|
360
|
+
};
|
|
361
|
+
/** Task completion result (only in afterComplete) */
|
|
362
|
+
taskResult?: unknown;
|
|
363
|
+
/** Current loop iteration index (0-based), only set when task is inside a loop */
|
|
364
|
+
loopIteration?: number;
|
|
365
|
+
}
|
|
366
|
+
/** Return value from action handlers */
|
|
367
|
+
export interface ActionResult {
|
|
368
|
+
/** Dynamic prompt text to inject */
|
|
369
|
+
inject?: string[];
|
|
370
|
+
/** Additional data to pass downstream */
|
|
371
|
+
data?: unknown;
|
|
372
|
+
}
|
|
373
|
+
/** Action handler function signature */
|
|
374
|
+
export type ActionHandler = (context: ActionContext) => Promise<ActionResult>;
|
|
375
|
+
/** Hook creator function signature */
|
|
376
|
+
export type HookCreator = (agentType: AgentType, context: HookCreatorContext) => unknown;
|
|
377
|
+
/** Context passed to plugin's createHooks function */
|
|
378
|
+
export interface HookCreatorContext {
|
|
379
|
+
/** defineHooks function from agent-kit */
|
|
380
|
+
defineHooks: unknown;
|
|
381
|
+
/** Harmonia data directory */
|
|
382
|
+
dataDir: string;
|
|
383
|
+
/** Project name */
|
|
384
|
+
projectName: string;
|
|
385
|
+
}
|
|
386
|
+
/** Complete loaded workflow plugin */
|
|
387
|
+
export interface WorkflowPlugin {
|
|
388
|
+
/** Plugin name (matches workflow name) */
|
|
389
|
+
name: string;
|
|
390
|
+
/** Workflow tree definition */
|
|
391
|
+
definition: WorkflowDefinition;
|
|
392
|
+
/** Role definitions keyed by role ID */
|
|
393
|
+
roles: Record<string, RoleDefinition>;
|
|
394
|
+
/** Artifact schemas keyed by artifact ID */
|
|
395
|
+
artifactSchemas: Record<string, ArtifactSchema>;
|
|
396
|
+
/** Artifact definitions keyed by artifact ID */
|
|
397
|
+
artifactDefinitions: Record<string, ArtifactDefinition>;
|
|
398
|
+
/** Registered actions (from tools/index.js) */
|
|
399
|
+
actions?: Record<string, ActionHandler>;
|
|
400
|
+
/** Hook creator (from hooks/index.js) */
|
|
401
|
+
hooks?: HookCreator;
|
|
402
|
+
/** Plugin-specific configuration (from config.json) */
|
|
403
|
+
config?: unknown;
|
|
404
|
+
/** Filesystem path to the plugin directory */
|
|
405
|
+
pluginDir: string;
|
|
406
|
+
}
|
|
407
|
+
/** Plugin entry in config.json */
|
|
408
|
+
export interface PluginEntry {
|
|
409
|
+
/** Workflow name */
|
|
410
|
+
name?: string;
|
|
411
|
+
/** Filesystem path to the plugin directory */
|
|
412
|
+
path: string;
|
|
413
|
+
/** Plugin-specific configuration */
|
|
414
|
+
config?: unknown;
|
|
415
|
+
}
|
|
416
|
+
/** Global config.json structure */
|
|
417
|
+
export interface GlobalConfig {
|
|
418
|
+
/** Registered workflow plugins */
|
|
419
|
+
workflows: Record<string, PluginEntry>;
|
|
147
420
|
}
|
|
148
421
|
export type ReviewStatus = 'pending' | 'approved' | 'rejected';
|
|
149
|
-
export interface
|
|
150
|
-
|
|
422
|
+
export interface ReviewState {
|
|
423
|
+
/** Artifact ID */
|
|
424
|
+
artifactId: string;
|
|
151
425
|
status: ReviewStatus;
|
|
152
426
|
submittedAt: string;
|
|
153
427
|
reviewedAt?: string;
|
|
@@ -159,13 +433,13 @@ export interface SessionRecord {
|
|
|
159
433
|
id: string;
|
|
160
434
|
/** Role this session belongs to */
|
|
161
435
|
role: string;
|
|
162
|
-
/** Actual session ID from the host agent
|
|
436
|
+
/** Actual session ID from the host agent */
|
|
163
437
|
agentSessionId?: string;
|
|
164
438
|
/** Agent type used for this session */
|
|
165
439
|
agentType?: AgentType;
|
|
166
440
|
/** Current session status */
|
|
167
441
|
status: SessionStatus;
|
|
168
|
-
/**
|
|
442
|
+
/** Coordinator-defined label */
|
|
169
443
|
label?: string;
|
|
170
444
|
/** When this session was created */
|
|
171
445
|
createdAt: string;
|
|
@@ -184,7 +458,9 @@ export interface DispatchRecord {
|
|
|
184
458
|
taskBrief: string;
|
|
185
459
|
/** Current dispatch status */
|
|
186
460
|
status: DispatchStatus;
|
|
187
|
-
/**
|
|
461
|
+
/** Node ID this dispatch is for */
|
|
462
|
+
nodeId?: string;
|
|
463
|
+
/** Expected output artifact IDs from this dispatch */
|
|
188
464
|
expectedOutputs: string[];
|
|
189
465
|
/** When this dispatch was created */
|
|
190
466
|
createdAt: string;
|
|
@@ -203,43 +479,32 @@ export interface CapabilityOverride {
|
|
|
203
479
|
tool: string;
|
|
204
480
|
/** MCP server name (required when type is "mcp") */
|
|
205
481
|
server?: string;
|
|
206
|
-
/** Static parameters to always pass
|
|
482
|
+
/** Static parameters to always pass */
|
|
207
483
|
params?: Record<string, unknown>;
|
|
208
|
-
/** Additional notes for prompt generation
|
|
484
|
+
/** Additional notes for prompt generation */
|
|
209
485
|
notes?: string;
|
|
210
486
|
}
|
|
211
|
-
/** Agent type for spawning team member agents (re-exported from @s_s/agent-kit) */
|
|
212
|
-
import type { AgentType } from '@s_s/agent-kit';
|
|
213
|
-
export type { AgentType };
|
|
214
487
|
/** Per-role override configuration */
|
|
215
488
|
export interface RoleOverride {
|
|
216
489
|
/** Agent type to use for this role */
|
|
217
490
|
agent?: AgentType;
|
|
218
|
-
/** Model to use
|
|
491
|
+
/** Model to use (overrides role's default) */
|
|
219
492
|
model?: string;
|
|
220
|
-
/** Capability overrides
|
|
493
|
+
/** Capability overrides */
|
|
221
494
|
capabilities?: Record<string, CapabilityOverride>;
|
|
222
495
|
}
|
|
223
496
|
/**
|
|
224
|
-
* Override configuration
|
|
225
|
-
*
|
|
226
|
-
* review: boolean | Record<docId, boolean>
|
|
227
|
-
* - boolean: global toggle for all docs
|
|
228
|
-
* - Record: per-doc toggle
|
|
229
|
-
*
|
|
230
|
-
* roles: Record<roleId, RoleOverride>
|
|
231
|
-
* - agent: agent type for spawning
|
|
232
|
-
* - model: model override
|
|
233
|
-
* - capabilities: Record<capabilityId, CapabilityOverride>
|
|
497
|
+
* Override configuration (project-level only, no global layer).
|
|
498
|
+
* Merges: project-level > workflow defaults.
|
|
234
499
|
*/
|
|
235
500
|
export interface OverrideConfig {
|
|
236
|
-
/** Review overrides — global toggle or per-
|
|
501
|
+
/** Review overrides — global toggle or per-artifact */
|
|
237
502
|
review?: boolean | Record<string, boolean>;
|
|
238
503
|
/** Role overrides (agent, model, capabilities) */
|
|
239
504
|
roles?: Record<string, RoleOverride>;
|
|
240
505
|
}
|
|
241
506
|
/** Step completion record */
|
|
242
|
-
export interface
|
|
507
|
+
export interface ArtifactStepRecord {
|
|
243
508
|
/** Step ID */
|
|
244
509
|
stepId: string;
|
|
245
510
|
/** When this step was completed */
|
|
@@ -247,14 +512,49 @@ export interface DocStepRecord {
|
|
|
247
512
|
/** File path of the step artifact (relative to project data dir) */
|
|
248
513
|
artifactPath: string;
|
|
249
514
|
}
|
|
250
|
-
/** Per-
|
|
251
|
-
export interface
|
|
252
|
-
/**
|
|
253
|
-
|
|
515
|
+
/** Per-artifact step tracking state */
|
|
516
|
+
export interface ArtifactStepState {
|
|
517
|
+
/** Artifact ID */
|
|
518
|
+
artifactId: string;
|
|
254
519
|
/** Completed steps (in order) */
|
|
255
|
-
completedSteps:
|
|
256
|
-
/** Whether the final
|
|
520
|
+
completedSteps: ArtifactStepRecord[];
|
|
521
|
+
/** Whether the final artifact has been written */
|
|
257
522
|
finalized: boolean;
|
|
258
523
|
/** Finalized at timestamp */
|
|
259
524
|
finalizedAt?: string;
|
|
260
525
|
}
|
|
526
|
+
export type IssueStatus = 'open' | 'closed';
|
|
527
|
+
export type IssueSource = 'test' | 'user-feedback';
|
|
528
|
+
export interface IssueResolvedBy {
|
|
529
|
+
type: ContextType;
|
|
530
|
+
number: number;
|
|
531
|
+
}
|
|
532
|
+
export interface Issue {
|
|
533
|
+
/** Auto-generated ID, e.g. "issue-1" */
|
|
534
|
+
id: string;
|
|
535
|
+
/** Short title */
|
|
536
|
+
title: string;
|
|
537
|
+
/** Detailed description */
|
|
538
|
+
description: string;
|
|
539
|
+
/** Where this issue was discovered */
|
|
540
|
+
source: IssueSource;
|
|
541
|
+
/** Which iteration this issue relates to */
|
|
542
|
+
iteration: number;
|
|
543
|
+
/** How this issue was resolved (set when closing) */
|
|
544
|
+
resolvedBy?: IssueResolvedBy;
|
|
545
|
+
/** Current status */
|
|
546
|
+
status: IssueStatus;
|
|
547
|
+
/** When this issue was created */
|
|
548
|
+
createdAt: string;
|
|
549
|
+
/** When this issue was closed */
|
|
550
|
+
closedAt?: string;
|
|
551
|
+
}
|
|
552
|
+
/** Validation error from workflow validator */
|
|
553
|
+
export interface ValidationError {
|
|
554
|
+
/** Error type */
|
|
555
|
+
type: 'duplicate_id' | 'invalid_goto' | 'cycle' | 'missing_fail_strategy' | 'invalid_floating_ref' | 'invalid_role_ref' | 'invalid_coordinator' | 'invalid_artifact_output' | 'invalid_input_artifact' | 'other';
|
|
556
|
+
/** Human-readable error message */
|
|
557
|
+
message: string;
|
|
558
|
+
/** Node ID where the error was found (if applicable) */
|
|
559
|
+
nodeId?: string;
|
|
560
|
+
}
|
package/build/core/types.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core type definitions for Harmonia.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Architecture: Core provides composable collaboration primitives.
|
|
5
|
+
* Workflow plugins use these primitives to define specific processes.
|
|
6
|
+
*
|
|
7
|
+
* This file defines:
|
|
8
|
+
* - Workflow node types (task, sequence, parallel, gate, loop)
|
|
9
|
+
* - Workflow state (node-based, not phase-based)
|
|
10
|
+
* - Engine types (nextAction, events, gate evaluation)
|
|
11
|
+
* - Artifact system
|
|
12
|
+
* - Plugin interface
|
|
13
|
+
* - Session & Dispatch tracking
|
|
14
|
+
* - Override configuration (simplified to 2-layer)
|
|
15
|
+
* - Sequential step tracking
|
|
16
|
+
* - Issue tracking
|
|
17
|
+
* - Review state
|
|
4
18
|
*/
|
|
5
19
|
export {};
|
|
6
20
|
//# sourceMappingURL=types.js.map
|
package/build/core/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|