@xagent-ai/cli 1.3.6 → 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 +9 -0
- package/README_CN.md +9 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -1
- package/dist/mcp.d.ts +8 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +53 -20
- package/dist/mcp.js.map +1 -1
- package/dist/sdk-output-adapter.d.ts +79 -0
- package/dist/sdk-output-adapter.d.ts.map +1 -1
- package/dist/sdk-output-adapter.js +118 -0
- package/dist/sdk-output-adapter.js.map +1 -1
- package/dist/session.d.ts +88 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +351 -5
- package/dist/session.js.map +1 -1
- package/dist/slash-commands.d.ts.map +1 -1
- package/dist/slash-commands.js +3 -5
- package/dist/slash-commands.js.map +1 -1
- package/dist/smart-approval.d.ts.map +1 -1
- package/dist/smart-approval.js +1 -0
- package/dist/smart-approval.js.map +1 -1
- package/dist/system-prompt-generator.d.ts +15 -1
- package/dist/system-prompt-generator.d.ts.map +1 -1
- package/dist/system-prompt-generator.js +36 -27
- package/dist/system-prompt-generator.js.map +1 -1
- package/dist/team-manager/index.d.ts +6 -0
- package/dist/team-manager/index.d.ts.map +1 -0
- package/dist/team-manager/index.js +6 -0
- package/dist/team-manager/index.js.map +1 -0
- package/dist/team-manager/message-broker.d.ts +128 -0
- package/dist/team-manager/message-broker.d.ts.map +1 -0
- package/dist/team-manager/message-broker.js +638 -0
- package/dist/team-manager/message-broker.js.map +1 -0
- package/dist/team-manager/team-coordinator.d.ts +45 -0
- package/dist/team-manager/team-coordinator.d.ts.map +1 -0
- package/dist/team-manager/team-coordinator.js +887 -0
- package/dist/team-manager/team-coordinator.js.map +1 -0
- package/dist/team-manager/team-store.d.ts +49 -0
- package/dist/team-manager/team-store.d.ts.map +1 -0
- package/dist/team-manager/team-store.js +436 -0
- package/dist/team-manager/team-store.js.map +1 -0
- package/dist/team-manager/teammate-spawner.d.ts +86 -0
- package/dist/team-manager/teammate-spawner.d.ts.map +1 -0
- package/dist/team-manager/teammate-spawner.js +605 -0
- package/dist/team-manager/teammate-spawner.js.map +1 -0
- package/dist/team-manager/types.d.ts +164 -0
- package/dist/team-manager/types.d.ts.map +1 -0
- package/dist/team-manager/types.js +27 -0
- package/dist/team-manager/types.js.map +1 -0
- package/dist/tools.d.ts +41 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +288 -32
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +20 -0
- package/src/mcp.ts +64 -25
- package/src/sdk-output-adapter.ts +177 -0
- package/src/session.ts +423 -15
- package/src/slash-commands.ts +3 -7
- package/src/smart-approval.ts +1 -0
- package/src/system-prompt-generator.ts +59 -26
- package/src/team-manager/index.ts +5 -0
- package/src/team-manager/message-broker.ts +751 -0
- package/src/team-manager/team-coordinator.ts +1117 -0
- package/src/team-manager/team-store.ts +558 -0
- package/src/team-manager/teammate-spawner.ts +800 -0
- package/src/team-manager/types.ts +206 -0
- package/src/tools.ts +316 -33
|
@@ -23,18 +23,36 @@ export interface ToolSchema {
|
|
|
23
23
|
bestPractices: string[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export interface TeamContext {
|
|
27
|
+
teamId: string;
|
|
28
|
+
memberId: string;
|
|
29
|
+
memberName: string;
|
|
30
|
+
memberRole: string;
|
|
31
|
+
leadId?: string;
|
|
32
|
+
brokerPort?: number;
|
|
33
|
+
initialTaskId?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
export class SystemPromptGenerator {
|
|
27
37
|
private toolRegistry: ToolRegistry;
|
|
28
38
|
private executionMode: ExecutionMode;
|
|
29
39
|
private agentConfig?: AgentConfig;
|
|
30
40
|
private mcpManager?: MCPManager;
|
|
41
|
+
private teamContext?: TeamContext;
|
|
31
42
|
private cachedEnvironmentInfo: string;
|
|
32
43
|
|
|
33
|
-
constructor(
|
|
44
|
+
constructor(
|
|
45
|
+
toolRegistry: ToolRegistry,
|
|
46
|
+
executionMode: ExecutionMode,
|
|
47
|
+
agentConfig?: AgentConfig,
|
|
48
|
+
mcpManager?: MCPManager,
|
|
49
|
+
teamContext?: TeamContext
|
|
50
|
+
) {
|
|
34
51
|
this.toolRegistry = toolRegistry;
|
|
35
52
|
this.executionMode = executionMode;
|
|
36
53
|
this.agentConfig = agentConfig;
|
|
37
54
|
this.mcpManager = mcpManager;
|
|
55
|
+
this.teamContext = teamContext;
|
|
38
56
|
this.cachedEnvironmentInfo = this.generateEnvironmentInfo();
|
|
39
57
|
}
|
|
40
58
|
|
|
@@ -92,6 +110,41 @@ export class SystemPromptGenerator {
|
|
|
92
110
|
- **Current Date**: ${currentDate} (Timezone: ${timeZone})${psSyntaxRules}`;
|
|
93
111
|
}
|
|
94
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Generate team context information for teammate agents
|
|
115
|
+
*/
|
|
116
|
+
private generateTeamContextInfo(): string {
|
|
117
|
+
if (!this.teamContext) return '';
|
|
118
|
+
|
|
119
|
+
const { teamId, memberId, memberName, memberRole, leadId, initialTaskId } = this.teamContext;
|
|
120
|
+
|
|
121
|
+
let teamInfo = `
|
|
122
|
+
|
|
123
|
+
## Team Context Information
|
|
124
|
+
|
|
125
|
+
You are running as a **${memberRole}** in a team.
|
|
126
|
+
|
|
127
|
+
### Your Identity
|
|
128
|
+
- **Team ID**: ${teamId}
|
|
129
|
+
- **Your Member ID**: ${memberId}
|
|
130
|
+
- **Your Name**: ${memberName}
|
|
131
|
+
- **Your Role**: ${memberRole}`;
|
|
132
|
+
|
|
133
|
+
if (leadId) {
|
|
134
|
+
teamInfo += `
|
|
135
|
+
- **Lead Member ID**: ${leadId}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (initialTaskId) {
|
|
139
|
+
teamInfo += `
|
|
140
|
+
- **Initial Task ID**: ${initialTaskId}`;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
teamInfo += `**Important**: Use \`team(team_action="get_status", team_id="${teamId}")\` to get the complete team status including lead_id and all other members before starting your work.`;
|
|
144
|
+
|
|
145
|
+
return teamInfo;
|
|
146
|
+
}
|
|
147
|
+
|
|
95
148
|
async generateEnhancedSystemPrompt(baseSystemPrompt: string): Promise<string> {
|
|
96
149
|
let localTools = this.toolRegistry.getAll().filter(
|
|
97
150
|
tool => tool.allowedModes.includes(this.executionMode)
|
|
@@ -111,6 +164,11 @@ export class SystemPromptGenerator {
|
|
|
111
164
|
// Add system environment information (cached in constructor)
|
|
112
165
|
enhancedPrompt += this.cachedEnvironmentInfo;
|
|
113
166
|
|
|
167
|
+
// Add team context information if running in team mode
|
|
168
|
+
if (this.teamContext) {
|
|
169
|
+
enhancedPrompt += this.generateTeamContextInfo();
|
|
170
|
+
}
|
|
171
|
+
|
|
114
172
|
// Only add tool-related content if tools are available
|
|
115
173
|
if (allAvailableTools.length > 0) {
|
|
116
174
|
// Pre-load skills for dynamic generation
|
|
@@ -140,31 +198,6 @@ ${executionStrategy}
|
|
|
140
198
|
- Use tools efficiently - avoid redundant calls
|
|
141
199
|
- When in doubt, ask the user for clarification
|
|
142
200
|
- Maintain context across tool calls to build a coherent solution`;
|
|
143
|
-
} else {
|
|
144
|
-
// No tools available - explicitly tell the AI not to use tools
|
|
145
|
-
enhancedPrompt += `
|
|
146
|
-
|
|
147
|
-
## IMPORTANT: READ-ONLY MODE
|
|
148
|
-
|
|
149
|
-
You are in DEFAULT mode (read-only mode). You CANNOT use any tools or functions.
|
|
150
|
-
|
|
151
|
-
STRICT PROHIBITIONS:
|
|
152
|
-
- DO NOT attempt to call any functions, tools, or commands
|
|
153
|
-
- DO NOT output any tool call syntax, such as:
|
|
154
|
-
- <function_calls>...</function_calls>
|
|
155
|
-
- ToolName(params)
|
|
156
|
-
- Function call format
|
|
157
|
-
- Any similar syntax
|
|
158
|
-
- DO NOT simulate tool calls or pretend to use tools
|
|
159
|
-
- DO NOT output code that would execute tools
|
|
160
|
-
|
|
161
|
-
REQUIRED BEHAVIOR:
|
|
162
|
-
- Respond ONLY with plain text
|
|
163
|
-
- Answer questions based on your knowledge
|
|
164
|
-
- If you need to read files or perform actions, ask the user to switch modes
|
|
165
|
-
- Tell the user they can use "/mode yolo" or "/mode accept_edits" to enable tools
|
|
166
|
-
|
|
167
|
-
Remember: You are in a conversational mode, not a tool-execution mode. Just talk to the user!`;
|
|
168
201
|
}
|
|
169
202
|
|
|
170
203
|
return enhancedPrompt;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { TeamStore, getTeamStore } from './team-store.js';
|
|
3
|
+
export { TeammateSpawner, getTeammateSpawner } from './teammate-spawner.js';
|
|
4
|
+
export { TeamCoordinator, getTeamCoordinator } from './team-coordinator.js';
|
|
5
|
+
export { MessageBroker, MessageClient, getMessageBroker, removeMessageBroker, setTeammateClient, getTeammateClient, clearTeammateClient } from './message-broker.js';
|