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,
|
||||
protocols: {
|
||||
buildActionModeProtocolText: tasks.buildActionModeProtocolText,
|
||||
MEMBER_DELEGATE_DESCRIPTION: tasks.MEMBER_DELEGATE_DESCRIPTION,
|
||||
buildProcessProtocolText: tasks.buildProcessProtocolText,
|
||||
},
|
||||
tasks,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ function normalizeAttachments(attachments) {
|
|||
filename: String(item.filename || '').trim(),
|
||||
mimeType: String(item.mimeType || '').trim(),
|
||||
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));
|
||||
|
||||
|
|
|
|||
|
|
@ -368,10 +368,11 @@ function buildActionModeProtocolText(delegateDescription) {
|
|||
].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() {
|
||||
return buildActionModeProtocolText(
|
||||
'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.'
|
||||
);
|
||||
return buildActionModeProtocolText(MEMBER_DELEGATE_DESCRIPTION);
|
||||
}
|
||||
|
||||
function buildMemberTaskProtocol(teamName) {
|
||||
|
|
@ -616,6 +617,7 @@ module.exports = {
|
|||
softDeleteTask,
|
||||
startTask,
|
||||
buildActionModeProtocolText,
|
||||
MEMBER_DELEGATE_DESCRIPTION,
|
||||
buildProcessProtocolText,
|
||||
memberBriefing,
|
||||
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. */
|
||||
export interface ProtocolsApi {
|
||||
buildActionModeProtocolText(delegateDescription: string): string;
|
||||
MEMBER_DELEGATE_DESCRIPTION: string;
|
||||
buildProcessProtocolText(teamName: string): string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ import type {
|
|||
const logger = createLogger('Service:TeamProvisioning');
|
||||
const { createController, protocols } = agentTeamsControllerModule;
|
||||
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 VERIFY_TIMEOUT_MS = 15_000;
|
||||
const VERIFY_POLL_MS = 500;
|
||||
|
|
@ -423,7 +421,9 @@ function buildMemberSpawnPrompt(
|
|||
const workflowBlock = member.workflow?.trim()
|
||||
? `\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}
|
||||
|
||||
${getAgentLanguageInstruction()}
|
||||
|
|
@ -455,7 +455,7 @@ function buildReconnectMemberSpawnPrompt(
|
|||
? `\n\nYour workflow and how you should behave:${formatWorkflowBlock(member.workflow, ' ')}`
|
||||
: '';
|
||||
const actionModeProtocol = indentMultiline(
|
||||
protocols.buildActionModeProtocolText(MEMBER_DELEGATE_DESCRIPTION),
|
||||
protocols.buildActionModeProtocolText(protocols.MEMBER_DELEGATE_DESCRIPTION),
|
||||
' '
|
||||
);
|
||||
return ` For "${member.name}":
|
||||
|
|
|
|||
|
|
@ -253,6 +253,9 @@ export class TeamTaskReader {
|
|||
mimeType: String(a.mimeType).trim(),
|
||||
size: a.size,
|
||||
addedAt: a.addedAt,
|
||||
...('filePath' in a && typeof a.filePath === 'string'
|
||||
? { filePath: a.filePath }
|
||||
: {}),
|
||||
}));
|
||||
return filtered.length > 0 ? filtered : undefined;
|
||||
})()
|
||||
|
|
@ -288,6 +291,9 @@ export class TeamTaskReader {
|
|||
mimeType: String(a.mimeType).trim(),
|
||||
size: a.size,
|
||||
addedAt: a.addedAt,
|
||||
...(a.filePath != null && typeof a.filePath === 'string'
|
||||
? { filePath: a.filePath }
|
||||
: {}),
|
||||
}))
|
||||
: undefined,
|
||||
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. */
|
||||
export interface ProtocolsApi {
|
||||
buildActionModeProtocolText(delegateDescription: string): string;
|
||||
MEMBER_DELEGATE_DESCRIPTION: string;
|
||||
buildProcessProtocolText(teamName: string): string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue