@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/index.js
CHANGED
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
* Project source directories contain code only — no Harmonia artifacts.
|
|
11
11
|
*/
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
-
import { dirname, join
|
|
13
|
+
import { dirname, join } from 'node:path';
|
|
14
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname = dirname(__filename);
|
|
16
|
-
// Built-in workflows directory (package root, sibling to build/)
|
|
17
|
-
const BUILTIN_WORKFLOWS_DIR = resolve(join(__dirname, '..', 'workflows'));
|
|
18
16
|
const subcommand = process.argv[2];
|
|
19
17
|
if (subcommand === 'setup') {
|
|
20
18
|
// CLI mode — human-facing project setup
|
|
@@ -57,7 +55,7 @@ Harmonia — Multi-agent orchestration MCP server
|
|
|
57
55
|
|
|
58
56
|
Usage:
|
|
59
57
|
harmonia Start MCP stdio server
|
|
60
|
-
harmonia setup Inject
|
|
58
|
+
harmonia setup Inject coordinator prompt + install hooks in current directory
|
|
61
59
|
harmonia unregister <name> Remove project from registry and delete data (default)
|
|
62
60
|
harmonia unregister <name> --keep-data Remove from registry but keep data files
|
|
63
61
|
harmonia --help Show this help message
|
|
@@ -83,38 +81,43 @@ else if (subcommand === '--version' || subcommand === '-v') {
|
|
|
83
81
|
}
|
|
84
82
|
else {
|
|
85
83
|
// Default: MCP stdio server mode
|
|
84
|
+
const { readFile } = await import('node:fs/promises');
|
|
86
85
|
const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
87
86
|
const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
|
|
88
87
|
const { getGlobalDir } = await import('./core/registry.js');
|
|
89
88
|
const { registerProjectInit } = await import('./tools/project-init.js');
|
|
90
89
|
const { registerIterationStart } = await import('./tools/iteration-start.js');
|
|
91
|
-
const { registerSetScale } = await import('./tools/set-scale.js');
|
|
92
90
|
const { registerGetRolePrompt } = await import('./tools/get-role-prompt.js');
|
|
93
|
-
const {
|
|
94
|
-
const { registerDocTools } = await import('./tools/doc-tools.js');
|
|
91
|
+
const { registerArtifactTools } = await import('./tools/artifact-tools.js');
|
|
95
92
|
const { registerGetProjectStatus } = await import('./tools/get-project-status.js');
|
|
96
|
-
const {
|
|
97
|
-
const {
|
|
98
|
-
const {
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
const
|
|
93
|
+
const { registerApproveArtifact } = await import('./tools/artifact-approve.js');
|
|
94
|
+
const { registerDispatchRole } = await import('./tools/role-dispatch.js');
|
|
95
|
+
const { registerReportDispatch } = await import('./tools/dispatch-report.js');
|
|
96
|
+
const { registerPatchStart } = await import('./tools/patch-start.js');
|
|
97
|
+
const { registerIssueTools } = await import('./tools/issue-tools.js');
|
|
98
|
+
const { registerArtifactSchema } = await import('./tools/artifact-schema.js');
|
|
99
|
+
const { registerLoopDone } = await import('./tools/loop-done.js');
|
|
100
|
+
// Read version from package.json (single source of truth)
|
|
101
|
+
const pkg = JSON.parse(await readFile(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
102
|
+
// Workflows directory: <data_dir>/harmonia/.workflows
|
|
103
|
+
const WORKFLOWS_DIR = join(getGlobalDir(), '.workflows');
|
|
102
104
|
const server = new McpServer({
|
|
103
105
|
name: 'harmonia',
|
|
104
|
-
version:
|
|
106
|
+
version: pkg.version,
|
|
105
107
|
});
|
|
106
108
|
// Register all tools
|
|
107
|
-
registerProjectInit(server,
|
|
108
|
-
registerIterationStart(server,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
registerProjectInit(server, WORKFLOWS_DIR);
|
|
110
|
+
registerIterationStart(server, WORKFLOWS_DIR);
|
|
111
|
+
registerGetRolePrompt(server, WORKFLOWS_DIR);
|
|
112
|
+
registerArtifactTools(server, WORKFLOWS_DIR);
|
|
113
|
+
registerGetProjectStatus(server, WORKFLOWS_DIR);
|
|
114
|
+
registerApproveArtifact(server, WORKFLOWS_DIR);
|
|
115
|
+
registerDispatchRole(server, WORKFLOWS_DIR);
|
|
116
|
+
registerReportDispatch(server, WORKFLOWS_DIR);
|
|
117
|
+
registerPatchStart(server, WORKFLOWS_DIR);
|
|
118
|
+
registerIssueTools(server);
|
|
119
|
+
registerArtifactSchema(server, WORKFLOWS_DIR);
|
|
120
|
+
registerLoopDone(server, WORKFLOWS_DIR);
|
|
118
121
|
// Connect via stdio
|
|
119
122
|
const transport = new StdioServerTransport();
|
|
120
123
|
await server.connect(transport);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;IACzB,wCAAwC;IACxC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACpE,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,CAA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AC,YAAY,EAAE,EAAE,YAAY,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QACzB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,GAAG,CAAC,OAAO;KACvB,CAAC,CAAC;IAEH,qBAAqB;IACrB,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,sBAAsB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9C,qBAAqB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,qBAAqB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7C,wBAAwB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAChD,uBAAuB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC/C,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5C,sBAAsB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9C,kBAAkB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,sBAAsB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC9C,gBAAgB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAExC,oBAAoB;IACpB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC"}
|
package/build/setup/inject.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Setup injection — detect host agent type and inject
|
|
2
|
+
* Setup injection — detect host agent type and inject coordinator guidance into config.
|
|
3
3
|
*
|
|
4
4
|
* Delegates to @s_s/agent-kit for agent detection, prompt injection, and
|
|
5
5
|
* marker management. Harmonia provides the prompt content via templates.ts.
|
|
6
6
|
*
|
|
7
|
-
* Always uses global scope —
|
|
7
|
+
* Always uses global scope — coordinator prompt is project-agnostic and should be
|
|
8
8
|
* written to the agent's global config directory (e.g. ~/.openclaw/workspace/AGENTS.md).
|
|
9
9
|
*/
|
|
10
10
|
import { type AgentType } from '@s_s/agent-kit';
|
|
@@ -20,11 +20,11 @@ export declare const HARMONIA_MARKER_END = "<!-- harmonia:end -->";
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function detectHostAgent(projectDir: string): Promise<AgentType>;
|
|
22
22
|
/**
|
|
23
|
-
* Inject the Harmonia
|
|
23
|
+
* Inject the Harmonia coordinator guidance block into the agent's **global** config file.
|
|
24
24
|
* If a harmonia block already exists, it is replaced (idempotent).
|
|
25
25
|
* If the file doesn't exist, it is created.
|
|
26
26
|
*
|
|
27
|
-
* Uses global scope because
|
|
27
|
+
* Uses global scope because coordinator prompt is project-agnostic.
|
|
28
28
|
* This writes to the agent's global config directory:
|
|
29
29
|
* - opencode: ~/.config/opencode/AGENTS.md
|
|
30
30
|
* - claude-code: ~/.claude/CLAUDE.md
|
package/build/setup/inject.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Setup injection — detect host agent type and inject
|
|
2
|
+
* Setup injection — detect host agent type and inject coordinator guidance into config.
|
|
3
3
|
*
|
|
4
4
|
* Delegates to @s_s/agent-kit for agent detection, prompt injection, and
|
|
5
5
|
* marker management. Harmonia provides the prompt content via templates.ts.
|
|
6
6
|
*
|
|
7
|
-
* Always uses global scope —
|
|
7
|
+
* Always uses global scope — coordinator prompt is project-agnostic and should be
|
|
8
8
|
* written to the agent's global config directory (e.g. ~/.openclaw/workspace/AGENTS.md).
|
|
9
9
|
*/
|
|
10
10
|
import { createKit, detectAgent } from '@s_s/agent-kit';
|
|
11
11
|
import { readFile } from 'node:fs/promises';
|
|
12
|
-
import {
|
|
12
|
+
import { generateCoordinatorPrompt } from './templates.js';
|
|
13
13
|
/** Shared kit instance — binds all marker tags to "harmonia" */
|
|
14
14
|
const kit = createKit('harmonia');
|
|
15
15
|
/** Marker constants for external use (tests, etc.) */
|
|
@@ -27,11 +27,11 @@ export async function detectHostAgent(projectDir) {
|
|
|
27
27
|
return detected ?? 'opencode';
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Inject the Harmonia
|
|
30
|
+
* Inject the Harmonia coordinator guidance block into the agent's **global** config file.
|
|
31
31
|
* If a harmonia block already exists, it is replaced (idempotent).
|
|
32
32
|
* If the file doesn't exist, it is created.
|
|
33
33
|
*
|
|
34
|
-
* Uses global scope because
|
|
34
|
+
* Uses global scope because coordinator prompt is project-agnostic.
|
|
35
35
|
* This writes to the agent's global config directory:
|
|
36
36
|
* - opencode: ~/.config/opencode/AGENTS.md
|
|
37
37
|
* - claude-code: ~/.claude/CLAUDE.md
|
|
@@ -39,7 +39,7 @@ export async function detectHostAgent(projectDir) {
|
|
|
39
39
|
* - codex: ~/.codex/AGENTS.md
|
|
40
40
|
*/
|
|
41
41
|
export async function injectPrompt(agentType) {
|
|
42
|
-
const prompt =
|
|
42
|
+
const prompt = generateCoordinatorPrompt();
|
|
43
43
|
const globalScope = { scope: 'global' };
|
|
44
44
|
// Check pre-existing state for return value
|
|
45
45
|
const hasExisting = await kit.hasPromptInjected(agentType, globalScope);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/setup/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../src/setup/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,E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|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Coordinator guidance prompt template.
|
|
3
3
|
*
|
|
4
|
-
* This template is injected into the
|
|
5
|
-
* host agent to act as the
|
|
4
|
+
* This template is injected into the agent's global config file to guide the
|
|
5
|
+
* host agent to act as the coordinator role in a Harmonia-managed project.
|
|
6
6
|
* The target file (AGENTS.md / CLAUDE.md) is determined by @s_s/agent-kit.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* IMPORTANT: This prompt is GENERIC — no workflow-specific operations manual.
|
|
9
|
+
* Workflow-specific guidance (phases, document types, role names) is provided
|
|
10
|
+
* by the workflow plugin's coordinator.md role prompt, delivered via nextAction
|
|
11
|
+
* at runtime.
|
|
10
12
|
*/
|
|
11
13
|
/**
|
|
12
|
-
* Generate the
|
|
14
|
+
* Generate the coordinator guidance prompt content.
|
|
13
15
|
*
|
|
14
16
|
* Returns raw prompt content WITHOUT marker tags — markers are managed
|
|
15
17
|
* by @s_s/agent-kit's injectPrompt (<!-- harmonia:start/end -->).
|
|
16
18
|
*/
|
|
17
|
-
export declare function
|
|
19
|
+
export declare function generateCoordinatorPrompt(): string;
|
package/build/setup/templates.js
CHANGED
|
@@ -1,167 +1,132 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Coordinator guidance prompt template.
|
|
3
3
|
*
|
|
4
|
-
* This template is injected into the
|
|
5
|
-
* host agent to act as the
|
|
4
|
+
* This template is injected into the agent's global config file to guide the
|
|
5
|
+
* host agent to act as the coordinator role in a Harmonia-managed project.
|
|
6
6
|
* The target file (AGENTS.md / CLAUDE.md) is determined by @s_s/agent-kit.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* IMPORTANT: This prompt is GENERIC — no workflow-specific operations manual.
|
|
9
|
+
* Workflow-specific guidance (phases, document types, role names) is provided
|
|
10
|
+
* by the workflow plugin's coordinator.md role prompt, delivered via nextAction
|
|
11
|
+
* at runtime.
|
|
10
12
|
*/
|
|
11
13
|
/**
|
|
12
|
-
* Generate the
|
|
14
|
+
* Generate the coordinator guidance prompt content.
|
|
13
15
|
*
|
|
14
16
|
* Returns raw prompt content WITHOUT marker tags — markers are managed
|
|
15
17
|
* by @s_s/agent-kit's injectPrompt (<!-- harmonia:start/end -->).
|
|
16
18
|
*/
|
|
17
|
-
export function
|
|
18
|
-
return `## Harmonia — Project
|
|
19
|
+
export function generateCoordinatorPrompt() {
|
|
20
|
+
return `## Harmonia — Project Coordinator Mode
|
|
19
21
|
|
|
20
|
-
You are the **
|
|
21
|
-
Harmonia is
|
|
22
|
+
You are the **Coordinator** for a Harmonia-managed project.
|
|
23
|
+
Harmonia is a multi-agent collaboration framework. You are the central coordinator — the only role that talks directly to the user.
|
|
22
24
|
|
|
23
25
|
### Getting Started
|
|
24
26
|
|
|
25
27
|
1. **Check for existing projects**: Call \`project_status()\` (no params) to list registered projects
|
|
26
28
|
2. **If resuming**: Call \`project_status(project_name)\` to see current state and next steps
|
|
27
29
|
3. **If new project**: Talk to user, then call \`project_init(project_name, project_dir)\` to register, followed by \`iteration_start(project_name)\` to begin the first iteration
|
|
28
|
-
4. **If starting a new iteration on an existing project**: Call \`iteration_start(project_name)\` — this creates a fresh iteration with clean
|
|
29
|
-
5. **After PRD approved**: Call \`project_set_scale(project_name, scale)\` to set project scale
|
|
30
|
+
4. **If starting a new iteration on an existing project**: Call \`iteration_start(project_name)\` — this creates a fresh iteration with clean state and artifacts
|
|
30
31
|
|
|
31
|
-
###
|
|
32
|
+
### Core Concepts
|
|
32
33
|
|
|
33
|
-
- **\`project_init\`** — One-time registration. Creates the project entry in the registry.
|
|
34
|
-
- **\`iteration_start\`** — Creates a new iteration (iter-1, iter-2, ...) with fresh state
|
|
35
|
-
-
|
|
34
|
+
- **\`project_init\`** — One-time registration. Creates the project entry in the global registry.
|
|
35
|
+
- **\`iteration_start\`** — Creates a new iteration (iter-1, iter-2, ...) with fresh workflow state. Must be called after \`project_init\`.
|
|
36
|
+
- **\`patch_start\`** — Creates a lightweight patch cycle for bug fixes (patch-1, patch-2, ...).
|
|
36
37
|
|
|
37
38
|
### Your Responsibilities
|
|
38
39
|
|
|
39
|
-
1. **Communicate with the user** — clarify requirements, present
|
|
40
|
-
2. **Drive the workflow** —
|
|
40
|
+
1. **Communicate with the user** — clarify requirements, present artifacts for review, report progress
|
|
41
|
+
2. **Drive the workflow** — follow nextAction guidance, produce artifacts, dispatch tasks
|
|
41
42
|
3. **Coordinate the team** — dispatch roles, track sessions and dispatch progress, manage outputs
|
|
42
|
-
4. **Ensure quality** — review
|
|
43
|
+
4. **Ensure quality** — review artifacts, handle review cycles, verify deliverables
|
|
43
44
|
|
|
44
|
-
### Workflow Guide
|
|
45
|
+
### nextAction — Your Workflow Guide
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
Every Harmonia tool returns a \`nextAction\` field that tells you exactly what to do next:
|
|
48
|
+
- **type: "dispatch"** — dispatch a role to execute a task node
|
|
49
|
+
- **type: "write_artifact"** — write an artifact document
|
|
50
|
+
- **type: "approve_artifact"** — present an artifact for user approval
|
|
51
|
+
- **type: "wait"** — wait for a running dispatch to complete
|
|
52
|
+
- **type: "completed"** — workflow is finished
|
|
53
|
+
- **type: "failed"** — workflow has failed (check instructions for details)
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
2. Write the PRD: \`doc_write(project_name, "prd", content)\`
|
|
50
|
-
3. Write user stories: \`doc_write(project_name, "user-stories", content)\`
|
|
51
|
-
4. Handle review cycles — when \`doc_write\` returns "REVIEW REQUIRED", present the document to the user and wait for confirmation
|
|
52
|
-
5. After PRD is approved, evaluate the project scale and call \`project_set_scale(project_name, scale)\`
|
|
53
|
-
6. Based on scale, write additional documents if needed (FSD, prototype, project plan for medium/large)
|
|
54
|
-
7. After all clarify-phase documents are approved, advance: \`phase_update(project_name, "clarify", "completed")\`
|
|
55
|
+
Always follow the \`instructions\` in nextAction. The workflow engine determines the correct next step based on the workflow definition and current state.
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
### Artifact Management
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
2. Follow the dispatch workflow (see below) to launch and track the architect
|
|
60
|
-
3. The architect will produce: tech-design, task-breakdown (and optionally: data-model, api-design, risk-assessment)
|
|
61
|
-
4. Review the architect's output, ask user for feedback if needed
|
|
62
|
-
5. Advance: \`phase_update(project_name, "design", "completed")\`
|
|
59
|
+
Before writing any artifact, call \`artifact_schema(project_name, artifact_id)\` to query the structure requirements. For step-based artifacts, query individual steps: \`artifact_schema(project_name, artifact_id, step)\`.
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
5. Advance when all tasks are complete: \`phase_update(project_name, "develop", "completed")\`
|
|
71
|
-
|
|
72
|
-
#### Phase 4: Testing (\`test\`)
|
|
73
|
-
|
|
74
|
-
1. Dispatch the tester: \`role_dispatch(project_name, "tester", task_brief)\`
|
|
75
|
-
2. Follow the dispatch workflow to launch and track the tester
|
|
76
|
-
3. Tester writes test plan, executes tests, produces test report
|
|
77
|
-
4. If bugs are found, coordinate fixes with developers (re-dispatch as needed)
|
|
78
|
-
5. Advance: \`phase_update(project_name, "test", "completed")\`
|
|
79
|
-
|
|
80
|
-
#### Phase 5: Delivery (\`deliver\`)
|
|
81
|
-
|
|
82
|
-
1. Review all deliverables against user stories and acceptance criteria
|
|
83
|
-
2. Present final results to the user
|
|
84
|
-
3. Write retrospective: \`doc_write(project_name, "retrospective", content)\`
|
|
85
|
-
4. Advance: \`phase_update(project_name, "deliver", "completed")\`
|
|
61
|
+
When \`artifact_write\` returns "REVIEW REQUIRED":
|
|
62
|
+
1. Present the full artifact to the user
|
|
63
|
+
2. Ask if they approve or want changes
|
|
64
|
+
3. If approved → call \`artifact_approve(project_name, artifact_id, true)\`
|
|
65
|
+
4. If changes needed → revise and call \`artifact_write\` again
|
|
66
|
+
5. **Never skip review.** Unapproved artifacts block workflow progress.
|
|
86
67
|
|
|
87
68
|
### Dispatch Workflow (Critical — follow every time)
|
|
88
69
|
|
|
89
|
-
Dispatching a team member follows three steps:
|
|
90
|
-
|
|
91
70
|
#### Step 1: Dispatch
|
|
92
71
|
\`\`\`
|
|
93
72
|
role_dispatch(project_name, role, task_brief)
|
|
94
|
-
→ Returns: data package + dispatch_id + session guidance
|
|
73
|
+
→ Returns: data package + dispatch_id + session guidance + rolePrompt
|
|
95
74
|
\`\`\`
|
|
96
|
-
Harmonia automatically:
|
|
97
|
-
- Creates a dispatch record for tracking
|
|
98
|
-
- Checks for reusable idle sessions and tells you whether to resume or launch new
|
|
99
75
|
|
|
100
76
|
#### Step 2: Launch & Report
|
|
101
|
-
Launch the agent
|
|
102
|
-
- **If reusable session found**: Resume the existing agent session (use the agent session ID provided)
|
|
103
|
-
- **If no reusable session**: Launch a new agent
|
|
104
|
-
|
|
77
|
+
Launch the agent with the rolePrompt as system instructions.
|
|
105
78
|
After launching, immediately report:
|
|
106
79
|
\`\`\`
|
|
107
|
-
dispatch_report(project_name, dispatch_id, agent_session_id="<id
|
|
80
|
+
dispatch_report(project_name, dispatch_id, agent_session_id="<id>", agent_type="opencode")
|
|
108
81
|
\`\`\`
|
|
109
|
-
This registers the session and marks the dispatch as running.
|
|
110
82
|
|
|
111
83
|
#### Step 3: Completion
|
|
112
|
-
When the agent finishes
|
|
84
|
+
When the agent finishes:
|
|
113
85
|
\`\`\`
|
|
114
86
|
dispatch_report(project_name, dispatch_id, status="completed")
|
|
115
87
|
\`\`\`
|
|
116
|
-
Or if
|
|
117
|
-
|
|
118
|
-
dispatch_report(project_name, dispatch_id, status="failed", note="reason")
|
|
119
|
-
\`\`\`
|
|
120
|
-
Then check: \`project_status\` to verify outputs and determine next steps.
|
|
88
|
+
Or if failed: \`dispatch_report(project_name, dispatch_id, status="failed", note="reason")\`
|
|
89
|
+
Then check \`project_status\` for next steps.
|
|
121
90
|
|
|
122
91
|
### Launching Agents
|
|
123
92
|
|
|
124
|
-
####
|
|
125
|
-
Use \`sessions_spawn\` to launch a sub-agent. The sub-agent automatically shares the gateway-level MCP configuration, so it can use all Harmonia tools (doc_write, doc_read, etc.) without additional setup.
|
|
126
|
-
|
|
93
|
+
#### OpenClaw (sessions_spawn)
|
|
127
94
|
\`\`\`
|
|
128
95
|
sessions_spawn with:
|
|
129
|
-
- system prompt = the
|
|
96
|
+
- system prompt = the rolePrompt from role_dispatch
|
|
130
97
|
- task = the task brief
|
|
131
|
-
-
|
|
98
|
+
- Sub-agent has access to all configured MCP servers including Harmonia
|
|
132
99
|
\`\`\`
|
|
133
100
|
|
|
134
|
-
####
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
2. Pass the task brief and input documents as the initial message
|
|
101
|
+
#### Other agents (shell exec)
|
|
102
|
+
1. Start the agent process with rolePrompt as system instructions
|
|
103
|
+
2. Pass the task brief and input artifacts as the initial message
|
|
138
104
|
3. Wait for the process to exit
|
|
139
105
|
|
|
140
|
-
### Session Recovery
|
|
106
|
+
### Session Recovery
|
|
141
107
|
|
|
142
|
-
If
|
|
108
|
+
If resuming from a previous session:
|
|
109
|
+
1. Call \`project_status()\` — shows workflow tree, active sessions, dispatch records, pending reviews
|
|
110
|
+
2. Check dispatch records — any "running" dispatches may need verification
|
|
111
|
+
3. Check sessions — "active" may still be running; "idle" can be reused; "lost" need re-dispatch
|
|
112
|
+
4. Follow the next steps suggested by \`project_status\`
|
|
143
113
|
|
|
144
|
-
|
|
145
|
-
2. **Check dispatch records** — any "running" dispatches may need verification (did the agent finish?)
|
|
146
|
-
3. **Check sessions** — "active" sessions may have agents still running; "idle" sessions can be reused; "lost" sessions need re-dispatch
|
|
147
|
-
4. **Follow the next steps** suggested by \`project_status\`
|
|
114
|
+
### Available Tools
|
|
148
115
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
3. If approved → call \`doc_approve(project_name, doc_id, true)\`
|
|
157
|
-
4. If changes needed → revise and call \`doc_write\` again
|
|
158
|
-
5. **Never skip review.** Unapproved documents must not be used as input for subsequent phases.
|
|
116
|
+
- \`project_init\` / \`project_status\` — project lifecycle
|
|
117
|
+
- \`iteration_start\` / \`patch_start\` — start iteration or patch
|
|
118
|
+
- \`role_dispatch\` / \`dispatch_report\` — dispatch and track team members
|
|
119
|
+
- \`artifact_write\` / \`artifact_read\` / \`artifact_list\` — manage artifacts
|
|
120
|
+
- \`artifact_approve\` / \`review_list\` — artifact review
|
|
121
|
+
- \`artifact_schema\` / \`role_prompt\` — query schemas and role prompts
|
|
122
|
+
- \`issue_create\` / \`issue_list\` / \`issue_update\` — issue tracking
|
|
159
123
|
|
|
160
124
|
### Important Rules
|
|
161
125
|
|
|
162
|
-
1. **Always check status first** — start each session with \`project_status()\`
|
|
163
|
-
2. **Always
|
|
164
|
-
3. **
|
|
165
|
-
4. **
|
|
126
|
+
1. **Always check status first** — start each session with \`project_status()\`
|
|
127
|
+
2. **Always follow nextAction** — the workflow engine knows the correct next step
|
|
128
|
+
3. **Always report dispatch lifecycle** — dispatch → report launch → report completion
|
|
129
|
+
4. **You are the coordinator, not the executor** — dispatch technical work to the appropriate roles
|
|
130
|
+
5. **Cross-context access**: Use \`artifact_read(project_name, id, context="iter-1")\` to read artifacts from other iterations or patches`;
|
|
166
131
|
}
|
|
167
132
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/setup/templates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/setup/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB;IACrC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0IA8G+H,CAAC;AAC3I,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool: artifact_approve / review_list
|
|
3
|
+
* Approve or reject an artifact that is pending review.
|
|
4
|
+
*
|
|
5
|
+
* After approval, triggers engine event `artifact_approved` to evaluate gates.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
export declare function registerApproveArtifact(server: McpServer, workflowsDir: string): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool: artifact_approve / review_list
|
|
3
|
+
* Approve or reject an artifact that is pending review.
|
|
4
|
+
*
|
|
5
|
+
* After approval, triggers engine event `artifact_approved` to evaluate gates.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { resolveReview, getPendingReviews } from '../core/reviews.js';
|
|
9
|
+
import { resolveActive, isError } from './utils.js';
|
|
10
|
+
import { processWorkflowEvent, formatNextAction } from './engine-helpers.js';
|
|
11
|
+
export function registerApproveArtifact(server, workflowsDir) {
|
|
12
|
+
server.tool('artifact_approve', 'Approve or reject an artifact pending review. Call this after the user has reviewed the artifact and confirmed (or requested changes).', {
|
|
13
|
+
project_name: z.string().describe('Project name'),
|
|
14
|
+
artifact_id: z.string().describe('Artifact ID to approve/reject'),
|
|
15
|
+
approved: z.boolean().describe('true = approved, false = rejected (needs revision)'),
|
|
16
|
+
comment: z.string().optional().describe('Optional comment — user feedback or reason for rejection'),
|
|
17
|
+
}, async ({ project_name, artifact_id, approved, comment }) => {
|
|
18
|
+
try {
|
|
19
|
+
const ctx = await resolveActive(project_name);
|
|
20
|
+
if (isError(ctx))
|
|
21
|
+
return ctx;
|
|
22
|
+
const status = approved ? 'approved' : 'rejected';
|
|
23
|
+
await resolveReview(project_name, ctx.number, artifact_id, status, comment, ctx.dir);
|
|
24
|
+
if (approved) {
|
|
25
|
+
// Trigger engine event: artifact_approved
|
|
26
|
+
const engineResult = await processWorkflowEvent(workflowsDir, project_name, ctx, {
|
|
27
|
+
type: 'artifact_approved',
|
|
28
|
+
artifactId: artifact_id,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: `Artifact "${artifact_id}" approved.` + formatNextAction(engineResult.nextAction),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: [
|
|
45
|
+
`Artifact "${artifact_id}" rejected.`,
|
|
46
|
+
comment ? `User feedback: ${comment}` : '',
|
|
47
|
+
`Please revise the artifact based on the feedback and call artifact_write again.`,
|
|
48
|
+
].join('\n'),
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
isError: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
server.tool('review_list', 'List all artifacts currently pending user review.', {
|
|
67
|
+
project_name: z.string().describe('Project name'),
|
|
68
|
+
}, async ({ project_name }) => {
|
|
69
|
+
const ctx = await resolveActive(project_name);
|
|
70
|
+
if (isError(ctx))
|
|
71
|
+
return ctx;
|
|
72
|
+
const pending = await getPendingReviews(project_name, ctx.number, ctx.dir);
|
|
73
|
+
if (pending.length === 0) {
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: 'No artifacts pending review.',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const list = pending.map((r) => `- ${r.artifactId} (submitted: ${r.submittedAt})`).join('\n');
|
|
84
|
+
return {
|
|
85
|
+
content: [
|
|
86
|
+
{
|
|
87
|
+
type: 'text',
|
|
88
|
+
text: `Artifacts pending review:\n${list}`,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=artifact-approve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-approve.js","sourceRoot":"","sources":["../../src/tools/artifact-approve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,YAAoB;IAC3E,MAAM,CAAC,IAAI,CACP,kBAAkB,EAClB,wIAAwI,EACxI;QACI,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QACjD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QACjE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;QACpF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;KACtG,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAA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AC,MAAM,CAAC,GAAG,CAAC,EAAE;qBACrE;iBACJ;gBACD,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;IAEF,MAAM,CAAC,IAAI,CACP,aAAa,EACb,mDAAmD,EACnD;QACI,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;KACpD,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAE7B,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAE3E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO;gBACH,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,8BAA8B;qBACvC;iBACJ;aACJ,CAAC;QACN,CAAC;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,gBAAgB,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9F,OAAO;YACH,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA8B,IAAI,EAAE;iBAC7C;aACJ;SACJ,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool: artifact_schema
|
|
3
|
+
*
|
|
4
|
+
* Query artifact structure requirements and writing guidance before writing.
|
|
5
|
+
* Returns human-readable schema guidance including required sections/fields,
|
|
6
|
+
* content boundaries, format requirements, and step-by-step constraints.
|
|
7
|
+
*
|
|
8
|
+
* Primarily used by coordinator (who is not dispatched and thus doesn't receive
|
|
9
|
+
* Artifact Requirements automatically via role_dispatch).
|
|
10
|
+
*/
|
|
11
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
12
|
+
export declare function registerArtifactSchema(server: McpServer, workflowsDir: string): void;
|