@cluesmith/codev 2.0.0-rc.71 → 2.0.0-rc.73
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/dashboard/dist/assets/{index-C7FtNK6Y.css → index-4n9zpWLY.css} +1 -1
- package/dashboard/dist/assets/{index-CDAINZKT.js → index-CH_utkcW.js} +32 -27
- package/dashboard/dist/assets/index-CH_utkcW.js.map +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +17 -7
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/spawn-roles.d.ts +80 -0
- package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -0
- package/dist/agent-farm/commands/spawn-roles.js +278 -0
- package/dist/agent-farm/commands/spawn-roles.js.map +1 -0
- package/dist/agent-farm/commands/spawn-worktree.d.ts +96 -0
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -0
- package/dist/agent-farm/commands/spawn-worktree.js +305 -0
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -0
- package/dist/agent-farm/commands/spawn.d.ts +5 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +65 -725
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts +82 -0
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-instances.js +441 -0
- package/dist/agent-farm/servers/tower-instances.js.map +1 -0
- package/dist/agent-farm/servers/tower-routes.d.ts +34 -0
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-routes.js +1445 -0
- package/dist/agent-farm/servers/tower-routes.js.map +1 -0
- package/dist/agent-farm/servers/tower-server.d.ts +5 -2
- package/dist/agent-farm/servers/tower-server.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +74 -2860
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +119 -0
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-terminals.js +629 -0
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -0
- package/dist/agent-farm/servers/tower-tunnel.d.ts +34 -0
- package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-tunnel.js +299 -0
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -0
- package/dist/agent-farm/servers/tower-types.d.ts +85 -0
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-types.js +6 -0
- package/dist/agent-farm/servers/tower-types.js.map +1 -0
- package/dist/agent-farm/servers/tower-utils.d.ts +51 -0
- package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-utils.js +161 -0
- package/dist/agent-farm/servers/tower-utils.js.map +1 -0
- package/dist/agent-farm/servers/tower-websocket.d.ts +25 -0
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -0
- package/dist/agent-farm/servers/tower-websocket.js +171 -0
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +11 -1
- package/dist/commands/init.js.map +1 -1
- package/package.json +1 -1
- package/templates/tower.html +11 -20
- package/dashboard/dist/assets/index-CDAINZKT.js.map +0 -1
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🏗️</text></svg>">
|
|
7
7
|
<title>Agent Farm Dashboard</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-CH_utkcW.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="./assets/index-4n9zpWLY.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA0P/C;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAkE9D"}
|
|
@@ -5,8 +5,9 @@ import { readFileSync } from 'node:fs';
|
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
import { dirname, join } from 'node:path';
|
|
7
7
|
import { logger, fatal } from '../utils/logger.js';
|
|
8
|
-
import { loadState
|
|
8
|
+
import { loadState } from '../state.js';
|
|
9
9
|
import { TowerClient } from '../lib/tower-client.js';
|
|
10
|
+
import { getConfig } from '../utils/index.js';
|
|
10
11
|
const MAX_FILE_SIZE = 48 * 1024; // 48KB limit per spec
|
|
11
12
|
/**
|
|
12
13
|
* Format message from architect to builder
|
|
@@ -108,12 +109,21 @@ function detectProjectRoot() {
|
|
|
108
109
|
return null;
|
|
109
110
|
}
|
|
110
111
|
/**
|
|
111
|
-
* Find the architect terminal ID
|
|
112
|
+
* Find the architect terminal ID by querying the Tower API.
|
|
113
|
+
*
|
|
114
|
+
* The architect terminal is tracked in the Tower's global.db / in-memory state,
|
|
115
|
+
* NOT in the local state.db (setArchitect is never called in production).
|
|
116
|
+
* We query the Tower's project status endpoint to find the architect terminal.
|
|
112
117
|
*/
|
|
113
|
-
function findArchitectTerminalId() {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
async function findArchitectTerminalId() {
|
|
119
|
+
const client = new TowerClient();
|
|
120
|
+
const config = getConfig();
|
|
121
|
+
const status = await client.getProjectStatus(config.projectRoot);
|
|
122
|
+
if (status) {
|
|
123
|
+
const architectTerminal = status.terminals.find((t) => t.type === 'architect');
|
|
124
|
+
if (architectTerminal) {
|
|
125
|
+
return architectTerminal.id;
|
|
126
|
+
}
|
|
117
127
|
}
|
|
118
128
|
throw new Error('Architect not running. Use "af status" to check.');
|
|
119
129
|
}
|
|
@@ -121,7 +131,7 @@ function findArchitectTerminalId() {
|
|
|
121
131
|
* Send a message to the architect (from a builder)
|
|
122
132
|
*/
|
|
123
133
|
async function sendToArchitect(fromBuilderId, message, options) {
|
|
124
|
-
const terminalId = findArchitectTerminalId();
|
|
134
|
+
const terminalId = await findArchitectTerminalId();
|
|
125
135
|
const client = new TowerClient();
|
|
126
136
|
const towerRunning = await client.isRunning();
|
|
127
137
|
if (!towerRunning) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAA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AO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role and prompt template utilities for spawn command.
|
|
3
|
+
* Spec 0105: Tower Server Decomposition — Phase 7
|
|
4
|
+
*
|
|
5
|
+
* Handles template rendering, prompt building, and role loading
|
|
6
|
+
* for builder sessions.
|
|
7
|
+
*/
|
|
8
|
+
import type { SpawnOptions, Config, ProtocolDefinition } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Context object for rendering builder-prompt.md templates
|
|
11
|
+
*/
|
|
12
|
+
export interface TemplateContext {
|
|
13
|
+
protocol_name: string;
|
|
14
|
+
mode: 'strict' | 'soft';
|
|
15
|
+
mode_soft: boolean;
|
|
16
|
+
mode_strict: boolean;
|
|
17
|
+
project_id?: string;
|
|
18
|
+
input_description: string;
|
|
19
|
+
spec?: {
|
|
20
|
+
path: string;
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
plan?: {
|
|
24
|
+
path: string;
|
|
25
|
+
name: string;
|
|
26
|
+
};
|
|
27
|
+
issue?: {
|
|
28
|
+
number: number;
|
|
29
|
+
title: string;
|
|
30
|
+
body: string;
|
|
31
|
+
};
|
|
32
|
+
task_text?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Simple Handlebars-like template renderer
|
|
36
|
+
* Supports: {{variable}}, {{#if condition}}...{{/if}}, {{object.property}}
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderTemplate(template: string, context: TemplateContext): string;
|
|
39
|
+
/**
|
|
40
|
+
* Build the prompt using protocol template or fallback to inline prompt
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildPromptFromTemplate(config: Config, protocolName: string, context: TemplateContext): string;
|
|
43
|
+
/**
|
|
44
|
+
* Build a resume notice to prepend to the builder prompt.
|
|
45
|
+
* Tells the builder this is a resumed session and to check existing porch state.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildResumeNotice(_projectId: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Load a protocol-specific role if it exists
|
|
50
|
+
*/
|
|
51
|
+
export declare function loadProtocolRole(config: Config, protocolName: string): {
|
|
52
|
+
content: string;
|
|
53
|
+
source: string;
|
|
54
|
+
} | null;
|
|
55
|
+
/**
|
|
56
|
+
* Find a spec file by project ID
|
|
57
|
+
*/
|
|
58
|
+
export declare function findSpecFile(codevDir: string, projectId: string): Promise<string | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Validate that a protocol exists
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateProtocol(config: Config, protocolName: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Load and parse a protocol.json file
|
|
65
|
+
*/
|
|
66
|
+
export declare function loadProtocol(config: Config, protocolName: string): ProtocolDefinition | null;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve which protocol to use based on precedence:
|
|
69
|
+
* 1. Explicit --protocol flag when used as override (with other input modes)
|
|
70
|
+
* 2. Explicit --use-protocol flag (backwards compatibility)
|
|
71
|
+
* 3. Spec file **Protocol**: header (for --project mode)
|
|
72
|
+
* 4. Hardcoded defaults (spir for specs, bugfix for issues)
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveProtocol(options: SpawnOptions, config: Config): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve the builder mode (strict vs soft)
|
|
77
|
+
* Precedence: explicit flags > protocol defaults > input type defaults
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveMode(options: SpawnOptions, protocol: ProtocolDefinition | null): 'strict' | 'soft';
|
|
80
|
+
//# sourceMappingURL=spawn-roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-roles.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn-roles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,YAAY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G,IAAI,CAAC,CAwB9F;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAqB3E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAY5F;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC5F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,kBAAkB,GAAG,IAAI,GAClC,QAAQ,GAAG,MAAM,CAanB"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role and prompt template utilities for spawn command.
|
|
3
|
+
* Spec 0105: Tower Server Decomposition — Phase 7
|
|
4
|
+
*
|
|
5
|
+
* Handles template rendering, prompt building, and role loading
|
|
6
|
+
* for builder sessions.
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from 'node:path';
|
|
9
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
10
|
+
import { readdir } from 'node:fs/promises';
|
|
11
|
+
import { logger, fatal } from '../utils/logger.js';
|
|
12
|
+
import { loadRolePrompt } from '../utils/roles.js';
|
|
13
|
+
/**
|
|
14
|
+
* Get nested value from object using dot notation
|
|
15
|
+
*/
|
|
16
|
+
function getNestedValue(obj, path) {
|
|
17
|
+
const parts = path.split('.');
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
let current = obj;
|
|
20
|
+
for (const part of parts) {
|
|
21
|
+
if (current === null || current === undefined)
|
|
22
|
+
return undefined;
|
|
23
|
+
current = current[part];
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Simple Handlebars-like template renderer
|
|
29
|
+
* Supports: {{variable}}, {{#if condition}}...{{/if}}, {{object.property}}
|
|
30
|
+
*/
|
|
31
|
+
export function renderTemplate(template, context) {
|
|
32
|
+
let result = template;
|
|
33
|
+
// Process {{#if condition}}...{{/if}} blocks
|
|
34
|
+
// eslint-disable-next-line no-constant-condition
|
|
35
|
+
while (true) {
|
|
36
|
+
const ifMatch = result.match(/\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/);
|
|
37
|
+
if (!ifMatch)
|
|
38
|
+
break;
|
|
39
|
+
const [fullMatch, condition, content] = ifMatch;
|
|
40
|
+
const value = getNestedValue(context, condition);
|
|
41
|
+
result = result.replace(fullMatch, value ? content : '');
|
|
42
|
+
}
|
|
43
|
+
// Process {{variable}} and {{object.property}} substitutions
|
|
44
|
+
result = result.replace(/\{\{(\w+(?:\.\w+)*)\}\}/g, (_, path) => {
|
|
45
|
+
const value = getNestedValue(context, path);
|
|
46
|
+
if (value === undefined || value === null)
|
|
47
|
+
return '';
|
|
48
|
+
return String(value);
|
|
49
|
+
});
|
|
50
|
+
// Clean up any double newlines left from removed sections
|
|
51
|
+
result = result.replace(/\n{3,}/g, '\n\n');
|
|
52
|
+
return result.trim();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Load builder-prompt.md template for a protocol
|
|
56
|
+
*/
|
|
57
|
+
function loadBuilderPromptTemplate(config, protocolName) {
|
|
58
|
+
const templatePath = resolve(config.codevDir, 'protocols', protocolName, 'builder-prompt.md');
|
|
59
|
+
if (existsSync(templatePath)) {
|
|
60
|
+
return readFileSync(templatePath, 'utf-8');
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build a fallback prompt when no template exists
|
|
66
|
+
*/
|
|
67
|
+
function buildFallbackPrompt(protocolName, context) {
|
|
68
|
+
const modeInstructions = context.mode === 'strict'
|
|
69
|
+
? `## Mode: STRICT
|
|
70
|
+
Porch orchestrates your work. Run: \`porch next\` to get your next tasks.`
|
|
71
|
+
: `## Mode: SOFT
|
|
72
|
+
You follow the protocol yourself. The architect monitors your work and verifies compliance.`;
|
|
73
|
+
let prompt = `# ${protocolName.toUpperCase()} Builder (${context.mode} mode)
|
|
74
|
+
|
|
75
|
+
You are implementing ${context.input_description}.
|
|
76
|
+
|
|
77
|
+
${modeInstructions}
|
|
78
|
+
|
|
79
|
+
## Protocol
|
|
80
|
+
Follow the ${protocolName.toUpperCase()} protocol: \`codev/protocols/${protocolName}/protocol.md\`
|
|
81
|
+
Read and internalize the protocol before starting any work.
|
|
82
|
+
`;
|
|
83
|
+
if (context.spec) {
|
|
84
|
+
prompt += `\n## Spec\nRead the specification at: \`${context.spec.path}\`\n`;
|
|
85
|
+
}
|
|
86
|
+
if (context.plan) {
|
|
87
|
+
prompt += `\n## Plan\nFollow the implementation plan at: \`${context.plan.path}\`\n`;
|
|
88
|
+
}
|
|
89
|
+
if (context.issue) {
|
|
90
|
+
prompt += `\n## Issue #${context.issue.number}
|
|
91
|
+
**Title**: ${context.issue.title}
|
|
92
|
+
|
|
93
|
+
**Description**:
|
|
94
|
+
${context.issue.body || '(No description provided)'}
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
if (context.task_text) {
|
|
98
|
+
prompt += `\n## Task\n${context.task_text}\n`;
|
|
99
|
+
}
|
|
100
|
+
return prompt;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Build the prompt using protocol template or fallback to inline prompt
|
|
104
|
+
*/
|
|
105
|
+
export function buildPromptFromTemplate(config, protocolName, context) {
|
|
106
|
+
const template = loadBuilderPromptTemplate(config, protocolName);
|
|
107
|
+
if (template) {
|
|
108
|
+
logger.info(`Using template: protocols/${protocolName}/builder-prompt.md`);
|
|
109
|
+
return renderTemplate(template, context);
|
|
110
|
+
}
|
|
111
|
+
// Fallback: no template found, return a basic prompt
|
|
112
|
+
logger.debug(`No template found for ${protocolName}, using inline prompt`);
|
|
113
|
+
return buildFallbackPrompt(protocolName, context);
|
|
114
|
+
}
|
|
115
|
+
// =============================================================================
|
|
116
|
+
// Resume Context
|
|
117
|
+
// =============================================================================
|
|
118
|
+
/**
|
|
119
|
+
* Build a resume notice to prepend to the builder prompt.
|
|
120
|
+
* Tells the builder this is a resumed session and to check existing porch state.
|
|
121
|
+
*/
|
|
122
|
+
export function buildResumeNotice(_projectId) {
|
|
123
|
+
return `## RESUME SESSION
|
|
124
|
+
|
|
125
|
+
This is a **resumed** builder session. A previous session was working in this worktree.
|
|
126
|
+
|
|
127
|
+
Start by running \`porch next\` to check your current state and get next tasks.
|
|
128
|
+
If porch state exists, continue from where the previous session left off.
|
|
129
|
+
If porch reports "not found", run \`porch init\` to re-initialize.
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// Role Loading
|
|
134
|
+
// =============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Load a protocol-specific role if it exists
|
|
137
|
+
*/
|
|
138
|
+
export function loadProtocolRole(config, protocolName) {
|
|
139
|
+
const protocolRolePath = resolve(config.codevDir, 'protocols', protocolName, 'role.md');
|
|
140
|
+
if (existsSync(protocolRolePath)) {
|
|
141
|
+
return { content: readFileSync(protocolRolePath, 'utf-8'), source: 'protocol' };
|
|
142
|
+
}
|
|
143
|
+
// Fall back to builder role
|
|
144
|
+
return loadRolePrompt(config, 'builder');
|
|
145
|
+
}
|
|
146
|
+
// =============================================================================
|
|
147
|
+
// Protocol Resolution
|
|
148
|
+
// =============================================================================
|
|
149
|
+
/**
|
|
150
|
+
* Find a spec file by project ID
|
|
151
|
+
*/
|
|
152
|
+
export async function findSpecFile(codevDir, projectId) {
|
|
153
|
+
const specsDir = resolve(codevDir, 'specs');
|
|
154
|
+
if (!existsSync(specsDir)) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
const files = await readdir(specsDir);
|
|
158
|
+
// Try exact match first (e.g., "0001-feature.md")
|
|
159
|
+
for (const file of files) {
|
|
160
|
+
if (file.startsWith(projectId) && file.endsWith('.md')) {
|
|
161
|
+
return resolve(specsDir, file);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// Try partial match (e.g., just "0001")
|
|
165
|
+
for (const file of files) {
|
|
166
|
+
if (file.startsWith(projectId + '-') && file.endsWith('.md')) {
|
|
167
|
+
return resolve(specsDir, file);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Validate that a protocol exists
|
|
174
|
+
*/
|
|
175
|
+
export function validateProtocol(config, protocolName) {
|
|
176
|
+
const protocolDir = resolve(config.codevDir, 'protocols', protocolName);
|
|
177
|
+
const protocolFile = resolve(protocolDir, 'protocol.md');
|
|
178
|
+
if (!existsSync(protocolDir)) {
|
|
179
|
+
const protocolsDir = resolve(config.codevDir, 'protocols');
|
|
180
|
+
let available = '';
|
|
181
|
+
if (existsSync(protocolsDir)) {
|
|
182
|
+
const dirs = readdirSync(protocolsDir, { withFileTypes: true })
|
|
183
|
+
.filter((d) => d.isDirectory())
|
|
184
|
+
.map((d) => d.name);
|
|
185
|
+
if (dirs.length > 0) {
|
|
186
|
+
available = `\n\nAvailable protocols: ${dirs.join(', ')}`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
fatal(`Protocol not found: ${protocolName}${available}`);
|
|
190
|
+
}
|
|
191
|
+
if (!existsSync(protocolFile)) {
|
|
192
|
+
fatal(`Protocol ${protocolName} exists but has no protocol.md file`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Load and parse a protocol.json file
|
|
197
|
+
*/
|
|
198
|
+
export function loadProtocol(config, protocolName) {
|
|
199
|
+
const protocolJsonPath = resolve(config.codevDir, 'protocols', protocolName, 'protocol.json');
|
|
200
|
+
if (!existsSync(protocolJsonPath)) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const content = readFileSync(protocolJsonPath, 'utf-8');
|
|
205
|
+
return JSON.parse(content);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
logger.warn(`Warning: Failed to parse ${protocolJsonPath}`);
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Resolve which protocol to use based on precedence:
|
|
214
|
+
* 1. Explicit --protocol flag when used as override (with other input modes)
|
|
215
|
+
* 2. Explicit --use-protocol flag (backwards compatibility)
|
|
216
|
+
* 3. Spec file **Protocol**: header (for --project mode)
|
|
217
|
+
* 4. Hardcoded defaults (spir for specs, bugfix for issues)
|
|
218
|
+
*/
|
|
219
|
+
export async function resolveProtocol(options, config) {
|
|
220
|
+
const inputModes = [
|
|
221
|
+
options.project, options.task, options.shell, options.worktree, options.issue,
|
|
222
|
+
].filter(Boolean);
|
|
223
|
+
const protocolAsOverride = options.protocol && inputModes.length > 0;
|
|
224
|
+
if (protocolAsOverride) {
|
|
225
|
+
validateProtocol(config, options.protocol);
|
|
226
|
+
return options.protocol.toLowerCase();
|
|
227
|
+
}
|
|
228
|
+
if (options.useProtocol) {
|
|
229
|
+
validateProtocol(config, options.useProtocol);
|
|
230
|
+
return options.useProtocol.toLowerCase();
|
|
231
|
+
}
|
|
232
|
+
if (options.project) {
|
|
233
|
+
const specFile = await findSpecFile(config.codevDir, options.project);
|
|
234
|
+
if (specFile) {
|
|
235
|
+
const specContent = readFileSync(specFile, 'utf-8');
|
|
236
|
+
const match = specContent.match(/\*\*Protocol\*\*:\s*(\w+)/i);
|
|
237
|
+
if (match) {
|
|
238
|
+
const protocolFromSpec = match[1].toLowerCase();
|
|
239
|
+
try {
|
|
240
|
+
validateProtocol(config, protocolFromSpec);
|
|
241
|
+
return protocolFromSpec;
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
logger.warn(`Warning: Protocol "${match[1]}" from spec not found, using default`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (options.project)
|
|
250
|
+
return 'spir';
|
|
251
|
+
if (options.issue)
|
|
252
|
+
return 'bugfix';
|
|
253
|
+
if (options.protocol)
|
|
254
|
+
return options.protocol.toLowerCase();
|
|
255
|
+
if (options.task)
|
|
256
|
+
return 'spir';
|
|
257
|
+
return 'spir';
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Resolve the builder mode (strict vs soft)
|
|
261
|
+
* Precedence: explicit flags > protocol defaults > input type defaults
|
|
262
|
+
*/
|
|
263
|
+
export function resolveMode(options, protocol) {
|
|
264
|
+
if (options.strict && options.soft) {
|
|
265
|
+
fatal('--strict and --soft are mutually exclusive');
|
|
266
|
+
}
|
|
267
|
+
if (options.strict)
|
|
268
|
+
return 'strict';
|
|
269
|
+
if (options.soft)
|
|
270
|
+
return 'soft';
|
|
271
|
+
if (protocol?.defaults?.mode) {
|
|
272
|
+
return protocol.defaults.mode;
|
|
273
|
+
}
|
|
274
|
+
if (options.project)
|
|
275
|
+
return 'strict';
|
|
276
|
+
return 'soft';
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=spawn-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-roles.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn-roles.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAe,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgCnD;;GAEG;AACH,SAAS,cAAc,CAAC,GAAoB,EAAE,IAAY;IACxD,MAAM,KAA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AAC,CAAC,CAAC,sCAAsC,CAAC,CAAC;gBACpF,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,OAAO,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC;IACnC,IAAI,OAAO,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC5D,IAAI,OAAO,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC;IAChC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,OAAqB,EACrB,QAAmC;IAEnC,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACnC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IACpC,IAAI,OAAO,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC;IAEhC,IAAI,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7B,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git worktree management, session creation, and pre-spawn utilities.
|
|
3
|
+
* Spec 0105: Tower Server Decomposition — Phase 7
|
|
4
|
+
*
|
|
5
|
+
* Handles worktree creation, dependency checking, porch initialization,
|
|
6
|
+
* bugfix collision detection, GitHub issue fetching, pre-spawn hooks,
|
|
7
|
+
* and terminal session creation via the Tower REST API.
|
|
8
|
+
*/
|
|
9
|
+
import type { Config, ProtocolDefinition } from '../types.js';
|
|
10
|
+
export declare const DEFAULT_TOWER_PORT = 4100;
|
|
11
|
+
/**
|
|
12
|
+
* Check for required dependencies
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkDependencies(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Create git branch and worktree
|
|
17
|
+
*/
|
|
18
|
+
export declare function createWorktree(config: Config, branchName: string, worktreePath: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Pre-initialize porch in a worktree so the builder doesn't need to self-correct.
|
|
21
|
+
* Non-fatal: logs a warning on failure since the builder can still init manually.
|
|
22
|
+
*/
|
|
23
|
+
export declare function initPorchInWorktree(worktreePath: string, protocol: string, projectId: string, projectName: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* GitHub issue structure from gh issue view --json
|
|
26
|
+
*/
|
|
27
|
+
export interface GitHubIssue {
|
|
28
|
+
title: string;
|
|
29
|
+
body: string;
|
|
30
|
+
state: string;
|
|
31
|
+
comments: Array<{
|
|
32
|
+
body: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
author: {
|
|
35
|
+
login: string;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Generate a slug from an issue title (max 30 chars, lowercase, alphanumeric + hyphens)
|
|
41
|
+
*/
|
|
42
|
+
export declare function slugify(title: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch a GitHub issue via gh CLI
|
|
45
|
+
*/
|
|
46
|
+
export declare function fetchGitHubIssue(issueNumber: number): Promise<GitHubIssue>;
|
|
47
|
+
/**
|
|
48
|
+
* Check for collision conditions before spawning bugfix
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkBugfixCollisions(issueNumber: number, worktreePath: string, issue: GitHubIssue, force: boolean): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Execute pre-spawn hooks defined in protocol.json
|
|
53
|
+
* Hooks are data-driven but reuse existing implementation logic
|
|
54
|
+
*/
|
|
55
|
+
export declare function executePreSpawnHooks(protocol: ProtocolDefinition | null, context: {
|
|
56
|
+
issueNumber?: number;
|
|
57
|
+
issue?: GitHubIssue;
|
|
58
|
+
worktreePath?: string;
|
|
59
|
+
force?: boolean;
|
|
60
|
+
noComment?: boolean;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Validate that a worktree exists and is valid for resuming
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateResumeWorktree(worktreePath: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Create a terminal session via the Tower REST API.
|
|
68
|
+
* The Tower server must be running (port 4100).
|
|
69
|
+
*/
|
|
70
|
+
export declare function createPtySession(config: Config, command: string, args: string[], cwd: string, registration?: {
|
|
71
|
+
projectPath: string;
|
|
72
|
+
type: 'builder' | 'shell';
|
|
73
|
+
roleId: string;
|
|
74
|
+
}): Promise<{
|
|
75
|
+
terminalId: string;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Start a terminal session for a builder
|
|
79
|
+
*/
|
|
80
|
+
export declare function startBuilderSession(config: Config, builderId: string, worktreePath: string, baseCmd: string, prompt: string, roleContent: string | null, roleSource: string | null): Promise<{
|
|
81
|
+
terminalId: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Start a shell session (no worktree, just node-pty)
|
|
85
|
+
*/
|
|
86
|
+
export declare function startShellSession(config: Config, shellId: string, baseCmd: string): Promise<{
|
|
87
|
+
terminalId: string;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Build a launch script for worktree mode (no initial prompt)
|
|
91
|
+
*/
|
|
92
|
+
export declare function buildWorktreeLaunchScript(worktreePath: string, baseCmd: string, role: {
|
|
93
|
+
content: string;
|
|
94
|
+
source: string;
|
|
95
|
+
} | null): string;
|
|
96
|
+
//# sourceMappingURL=spawn-worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-worktree.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/spawn-worktree.ts"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