claude-tempo 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +1 -1
- package/dist/tools/load-lineup.d.ts +2 -2
- package/dist/tools/load-lineup.js +62 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -284,7 +284,7 @@ async function main() {
|
|
|
284
284
|
(0, unschedule_1.registerUnscheduleTool)(mcpServer, client, config);
|
|
285
285
|
(0, schedules_1.registerSchedulesTool)(mcpServer, client, config);
|
|
286
286
|
(0, save_lineup_1.registerSaveLineupTool)(mcpServer, client, config, getPlayerId, isConductor);
|
|
287
|
-
(0, load_lineup_1.registerLoadLineupTool)(mcpServer, client, config, getPlayerId, isBridgeMode ? 'copilot' : 'claude');
|
|
287
|
+
(0, load_lineup_1.registerLoadLineupTool)(mcpServer, client, config, getPlayerId, isBridgeMode ? 'copilot' : 'claude', handle, setPlayerId, isConductor);
|
|
288
288
|
(0, agent_types_1.registerAgentTypesTool)(mcpServer);
|
|
289
289
|
(0, who_am_i_1.registerWhoAmITool)(mcpServer, handle, getPlayerId);
|
|
290
290
|
(0, broadcast_1.registerBroadcastTool)(mcpServer, client, config, getPlayerId, handle);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { Client } from '@temporalio/client';
|
|
2
|
+
import { Client, WorkflowHandle } from '@temporalio/client';
|
|
3
3
|
import { Config } from '../config';
|
|
4
4
|
import { AgentType } from '../types';
|
|
5
|
-
export declare function registerLoadLineupTool(server: McpServer, client: Client, config: Config, getPlayerId: () => string, ownAgentType?: AgentType): void;
|
|
5
|
+
export declare function registerLoadLineupTool(server: McpServer, client: Client, config: Config, getPlayerId: () => string, ownAgentType?: AgentType, handle?: WorkflowHandle, setPlayerId?: (id: string) => void, isConductor?: boolean): void;
|
|
@@ -19,7 +19,7 @@ const log = (...args) => console.error('[claude-tempo:load-lineup]', ...args);
|
|
|
19
19
|
function sleep(ms) {
|
|
20
20
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
21
|
}
|
|
22
|
-
function registerLoadLineupTool(server, client, config, getPlayerId, ownAgentType = 'claude') {
|
|
22
|
+
function registerLoadLineupTool(server, client, config, getPlayerId, ownAgentType = 'claude', handle, setPlayerId, isConductor) {
|
|
23
23
|
(0, helpers_1.defineTool)(server, 'load_lineup', 'Load an ensemble lineup — recruits players and creates schedules.', {
|
|
24
24
|
name: zod_1.z.string().max(validation_1.PLAYER_NAME_MAX).optional().describe('Name of a saved lineup (from ~/.claude-tempo/ensembles/)'),
|
|
25
25
|
path: zod_1.z.string().max(validation_1.PATH_MAX).optional().describe('Explicit file path to a lineup YAML file'),
|
|
@@ -76,6 +76,64 @@ function registerLoadLineupTool(server, client, config, getPlayerId, ownAgentTyp
|
|
|
76
76
|
const lineup = (0, agent_types_1.loadAndResolveLineup)(filePath);
|
|
77
77
|
const recruited = [];
|
|
78
78
|
const failed = [];
|
|
79
|
+
const conductorActions = [];
|
|
80
|
+
// Apply conductor section if present and this session is the conductor
|
|
81
|
+
if (lineup.conductor && isConductor && handle) {
|
|
82
|
+
// Apply conductor name
|
|
83
|
+
if (lineup.conductor.name && lineup.conductor.name !== getPlayerId()) {
|
|
84
|
+
try {
|
|
85
|
+
// Check if the name is already taken
|
|
86
|
+
const existing = await (0, resolve_1.resolveSession)(client, config.ensemble, lineup.conductor.name);
|
|
87
|
+
if (existing && existing.workflowId !== handle.workflowId) {
|
|
88
|
+
failed.push(`conductor name "${lineup.conductor.name}": already taken by another session`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
await handle.signal('setName', lineup.conductor.name);
|
|
92
|
+
if (setPlayerId)
|
|
93
|
+
setPlayerId(lineup.conductor.name);
|
|
94
|
+
conductorActions.push(`name → ${lineup.conductor.name}`);
|
|
95
|
+
log(`Conductor name set to "${lineup.conductor.name}"`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
failed.push(`conductor name: ${err}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Apply conductor type (update metadata)
|
|
103
|
+
if (lineup.conductor.type) {
|
|
104
|
+
try {
|
|
105
|
+
const typeInfo = (0, agent_types_1.resolveAgentType)(lineup.conductor.type);
|
|
106
|
+
if (typeInfo) {
|
|
107
|
+
await handle.signal('updateMetadata', {
|
|
108
|
+
playerType: typeInfo.name,
|
|
109
|
+
playerTypeDescription: typeInfo.description || '',
|
|
110
|
+
});
|
|
111
|
+
conductorActions.push(`type → ${typeInfo.name}`);
|
|
112
|
+
log(`Conductor type set to "${typeInfo.name}"`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
failed.push(`conductor type "${lineup.conductor.type}": agent type not found`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
failed.push(`conductor type: ${err}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Send conductor instructions
|
|
123
|
+
if (lineup.conductor.instructions) {
|
|
124
|
+
try {
|
|
125
|
+
await handle.signal('receiveMessage', {
|
|
126
|
+
from: 'lineup',
|
|
127
|
+
text: lineup.conductor.instructions,
|
|
128
|
+
});
|
|
129
|
+
conductorActions.push('instructions delivered');
|
|
130
|
+
log('Conductor instructions delivered');
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
failed.push(`conductor instructions: ${err}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
79
137
|
// Recruit players sequentially
|
|
80
138
|
for (const player of lineup.players) {
|
|
81
139
|
const playerName = player.name;
|
|
@@ -296,6 +354,9 @@ function registerLoadLineupTool(server, client, config, getPlayerId, ownAgentTyp
|
|
|
296
354
|
}
|
|
297
355
|
// Build summary
|
|
298
356
|
const lines = [`Loaded lineup **${lineup.name}**.`];
|
|
357
|
+
if (conductorActions.length > 0) {
|
|
358
|
+
lines.push(`Conductor: ${conductorActions.join(', ')}`);
|
|
359
|
+
}
|
|
299
360
|
if (recruited.length > 0) {
|
|
300
361
|
lines.push(`Recruited: ${recruited.join(', ')}`);
|
|
301
362
|
}
|