feat: introduce MEMBER_DELEGATE_DESCRIPTION for action mode protocols
- Added MEMBER_DELEGATE_DESCRIPTION constant to centralize the delegate instructions for action mode protocols, improving code maintainability. - Updated buildActionModeProtocolText to utilize the new constant, enhancing clarity and reducing duplication. - Enhanced messageStore and TeamProvisioningService to support filePath handling in attachments, improving metadata management. - Updated type definitions to reflect the addition of MEMBER_DELEGATE_DESCRIPTION in the protocols interface.
This commit is contained in:
parent
a61178105b
commit
0d0364cfd3
7 changed files with 21 additions and 7 deletions
|
|
@ -40,6 +40,7 @@ module.exports = {
|
||||||
agentBlocks,
|
agentBlocks,
|
||||||
protocols: {
|
protocols: {
|
||||||
buildActionModeProtocolText: tasks.buildActionModeProtocolText,
|
buildActionModeProtocolText: tasks.buildActionModeProtocolText,
|
||||||
|
MEMBER_DELEGATE_DESCRIPTION: tasks.MEMBER_DELEGATE_DESCRIPTION,
|
||||||
buildProcessProtocolText: tasks.buildProcessProtocolText,
|
buildProcessProtocolText: tasks.buildProcessProtocolText,
|
||||||
},
|
},
|
||||||
tasks,
|
tasks,
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,9 @@ function normalizeAttachments(attachments) {
|
||||||
filename: String(item.filename || '').trim(),
|
filename: String(item.filename || '').trim(),
|
||||||
mimeType: String(item.mimeType || '').trim(),
|
mimeType: String(item.mimeType || '').trim(),
|
||||||
size: Number(item.size || 0),
|
size: Number(item.size || 0),
|
||||||
|
...(typeof item.filePath === 'string' && item.filePath.trim()
|
||||||
|
? { filePath: item.filePath.trim() }
|
||||||
|
: {}),
|
||||||
}))
|
}))
|
||||||
.filter((item) => item.id && item.filename && item.mimeType && Number.isFinite(item.size));
|
.filter((item) => item.id && item.filename && item.mimeType && Number.isFinite(item.size));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -368,10 +368,11 @@ function buildActionModeProtocolText(delegateDescription) {
|
||||||
].join('\n');
|
].join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MEMBER_DELEGATE_DESCRIPTION =
|
||||||
|
'Do not implement yourself. Pass the task with full context (what you know, what is needed) to your team lead or another teammate and let them handle it.';
|
||||||
|
|
||||||
function buildMemberActionModeProtocol() {
|
function buildMemberActionModeProtocol() {
|
||||||
return buildActionModeProtocolText(
|
return buildActionModeProtocolText(MEMBER_DELEGATE_DESCRIPTION);
|
||||||
'Do not implement yourself. Pass the task with full context (what you know, what is needed) to your team lead or another teammate and let them handle it.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildMemberTaskProtocol(teamName) {
|
function buildMemberTaskProtocol(teamName) {
|
||||||
|
|
@ -616,6 +617,7 @@ module.exports = {
|
||||||
softDeleteTask,
|
softDeleteTask,
|
||||||
startTask,
|
startTask,
|
||||||
buildActionModeProtocolText,
|
buildActionModeProtocolText,
|
||||||
|
MEMBER_DELEGATE_DESCRIPTION,
|
||||||
buildProcessProtocolText,
|
buildProcessProtocolText,
|
||||||
memberBriefing,
|
memberBriefing,
|
||||||
taskBriefing,
|
taskBriefing,
|
||||||
|
|
|
||||||
1
mcp-server/src/agent-teams-controller.d.ts
vendored
1
mcp-server/src/agent-teams-controller.d.ts
vendored
|
|
@ -102,6 +102,7 @@ declare module 'agent-teams-controller' {
|
||||||
/** Context-free protocol text builders, shared across lead and member prompts. */
|
/** Context-free protocol text builders, shared across lead and member prompts. */
|
||||||
export interface ProtocolsApi {
|
export interface ProtocolsApi {
|
||||||
buildActionModeProtocolText(delegateDescription: string): string;
|
buildActionModeProtocolText(delegateDescription: string): string;
|
||||||
|
MEMBER_DELEGATE_DESCRIPTION: string;
|
||||||
buildProcessProtocolText(teamName: string): string;
|
buildProcessProtocolText(teamName: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,6 @@ import type {
|
||||||
const logger = createLogger('Service:TeamProvisioning');
|
const logger = createLogger('Service:TeamProvisioning');
|
||||||
const { createController, protocols } = agentTeamsControllerModule;
|
const { createController, protocols } = agentTeamsControllerModule;
|
||||||
const TEAM_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,127}$/;
|
const TEAM_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,127}$/;
|
||||||
const MEMBER_DELEGATE_DESCRIPTION =
|
|
||||||
'Do not implement yourself. Pass the task with full context (what you know, what is needed) to your team lead or another teammate and let them handle it.';
|
|
||||||
const RUN_TIMEOUT_MS = 300_000;
|
const RUN_TIMEOUT_MS = 300_000;
|
||||||
const VERIFY_TIMEOUT_MS = 15_000;
|
const VERIFY_TIMEOUT_MS = 15_000;
|
||||||
const VERIFY_POLL_MS = 500;
|
const VERIFY_POLL_MS = 500;
|
||||||
|
|
@ -423,7 +421,9 @@ function buildMemberSpawnPrompt(
|
||||||
const workflowBlock = member.workflow?.trim()
|
const workflowBlock = member.workflow?.trim()
|
||||||
? `\n\nYour workflow and how you should behave:${formatWorkflowBlock(member.workflow, '')}`
|
? `\n\nYour workflow and how you should behave:${formatWorkflowBlock(member.workflow, '')}`
|
||||||
: '';
|
: '';
|
||||||
const actionModeProtocol = protocols.buildActionModeProtocolText(MEMBER_DELEGATE_DESCRIPTION);
|
const actionModeProtocol = protocols.buildActionModeProtocolText(
|
||||||
|
protocols.MEMBER_DELEGATE_DESCRIPTION
|
||||||
|
);
|
||||||
return `You are ${member.name}, a ${role} on team "${displayName}" (${teamName}).${workflowBlock}
|
return `You are ${member.name}, a ${role} on team "${displayName}" (${teamName}).${workflowBlock}
|
||||||
|
|
||||||
${getAgentLanguageInstruction()}
|
${getAgentLanguageInstruction()}
|
||||||
|
|
@ -455,7 +455,7 @@ function buildReconnectMemberSpawnPrompt(
|
||||||
? `\n\nYour workflow and how you should behave:${formatWorkflowBlock(member.workflow, ' ')}`
|
? `\n\nYour workflow and how you should behave:${formatWorkflowBlock(member.workflow, ' ')}`
|
||||||
: '';
|
: '';
|
||||||
const actionModeProtocol = indentMultiline(
|
const actionModeProtocol = indentMultiline(
|
||||||
protocols.buildActionModeProtocolText(MEMBER_DELEGATE_DESCRIPTION),
|
protocols.buildActionModeProtocolText(protocols.MEMBER_DELEGATE_DESCRIPTION),
|
||||||
' '
|
' '
|
||||||
);
|
);
|
||||||
return ` For "${member.name}":
|
return ` For "${member.name}":
|
||||||
|
|
|
||||||
|
|
@ -253,6 +253,9 @@ export class TeamTaskReader {
|
||||||
mimeType: String(a.mimeType).trim(),
|
mimeType: String(a.mimeType).trim(),
|
||||||
size: a.size,
|
size: a.size,
|
||||||
addedAt: a.addedAt,
|
addedAt: a.addedAt,
|
||||||
|
...('filePath' in a && typeof a.filePath === 'string'
|
||||||
|
? { filePath: a.filePath }
|
||||||
|
: {}),
|
||||||
}));
|
}));
|
||||||
return filtered.length > 0 ? filtered : undefined;
|
return filtered.length > 0 ? filtered : undefined;
|
||||||
})()
|
})()
|
||||||
|
|
@ -288,6 +291,9 @@ export class TeamTaskReader {
|
||||||
mimeType: String(a.mimeType).trim(),
|
mimeType: String(a.mimeType).trim(),
|
||||||
size: a.size,
|
size: a.size,
|
||||||
addedAt: a.addedAt,
|
addedAt: a.addedAt,
|
||||||
|
...(a.filePath != null && typeof a.filePath === 'string'
|
||||||
|
? { filePath: a.filePath }
|
||||||
|
: {}),
|
||||||
}))
|
}))
|
||||||
: undefined,
|
: undefined,
|
||||||
reviewState: getReviewStateFromTask({
|
reviewState: getReviewStateFromTask({
|
||||||
|
|
|
||||||
1
src/types/agent-teams-controller.d.ts
vendored
1
src/types/agent-teams-controller.d.ts
vendored
|
|
@ -89,6 +89,7 @@ declare module 'agent-teams-controller' {
|
||||||
/** Context-free protocol text builders, shared across lead and member prompts. */
|
/** Context-free protocol text builders, shared across lead and member prompts. */
|
||||||
export interface ProtocolsApi {
|
export interface ProtocolsApi {
|
||||||
buildActionModeProtocolText(delegateDescription: string): string;
|
buildActionModeProtocolText(delegateDescription: string): string;
|
||||||
|
MEMBER_DELEGATE_DESCRIPTION: string;
|
||||||
buildProcessProtocolText(teamName: string): string;
|
buildProcessProtocolText(teamName: string): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue