agent-orchestrator-mcp-server 0.4.1 → 0.4.3
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/package.json
CHANGED
|
@@ -26,11 +26,15 @@ export interface AgentRootValidationResult {
|
|
|
26
26
|
* Validate a start_session request against the allowed agent roots constraints.
|
|
27
27
|
*
|
|
28
28
|
* When ALLOWED_AGENT_ROOTS is set:
|
|
29
|
-
* - git_root must match one of the allowed agent roots
|
|
29
|
+
* - git_root (and optionally branch/subdirectory) must match one of the allowed agent roots
|
|
30
30
|
* - mcp_servers must exactly match the default_mcp_servers of that agent root
|
|
31
31
|
* (no more, no less — any deviation is rejected)
|
|
32
32
|
*
|
|
33
|
+
* When multiple allowed agent roots share the same git_root, branch and subdirectory
|
|
34
|
+
* are used to disambiguate. This is critical for monorepo setups where multiple agent
|
|
35
|
+
* roots point to the same repository but different subdirectories.
|
|
36
|
+
*
|
|
33
37
|
* Returns { valid: true } if the request is allowed, or { valid: false, error: string } if not.
|
|
34
38
|
*/
|
|
35
|
-
export declare function validateAgentRootConstraints(allowedRoots: string[] | null, agentRoots: AgentRootInfo[], gitRoot?: string, mcpServers?: string[]): AgentRootValidationResult;
|
|
39
|
+
export declare function validateAgentRootConstraints(allowedRoots: string[] | null, agentRoots: AgentRootInfo[], gitRoot?: string, mcpServers?: string[], branch?: string, subdirectory?: string): AgentRootValidationResult;
|
|
36
40
|
//# sourceMappingURL=allowed-agent-roots.d.ts.map
|
|
@@ -39,18 +39,34 @@ export function filterAgentRoots(agentRoots, allowedRoots) {
|
|
|
39
39
|
* Validate a start_session request against the allowed agent roots constraints.
|
|
40
40
|
*
|
|
41
41
|
* When ALLOWED_AGENT_ROOTS is set:
|
|
42
|
-
* - git_root must match one of the allowed agent roots
|
|
42
|
+
* - git_root (and optionally branch/subdirectory) must match one of the allowed agent roots
|
|
43
43
|
* - mcp_servers must exactly match the default_mcp_servers of that agent root
|
|
44
44
|
* (no more, no less — any deviation is rejected)
|
|
45
45
|
*
|
|
46
|
+
* When multiple allowed agent roots share the same git_root, branch and subdirectory
|
|
47
|
+
* are used to disambiguate. This is critical for monorepo setups where multiple agent
|
|
48
|
+
* roots point to the same repository but different subdirectories.
|
|
49
|
+
*
|
|
46
50
|
* Returns { valid: true } if the request is allowed, or { valid: false, error: string } if not.
|
|
47
51
|
*/
|
|
48
|
-
export function validateAgentRootConstraints(allowedRoots, agentRoots, gitRoot, mcpServers) {
|
|
52
|
+
export function validateAgentRootConstraints(allowedRoots, agentRoots, gitRoot, mcpServers, branch, subdirectory) {
|
|
49
53
|
if (allowedRoots === null) {
|
|
50
54
|
return { valid: true };
|
|
51
55
|
}
|
|
52
|
-
// Find
|
|
53
|
-
const
|
|
56
|
+
// Find all allowed agent roots that match by git_root
|
|
57
|
+
const candidates = agentRoots.filter((root) => allowedRoots.includes(root.name) && root.git_root === gitRoot);
|
|
58
|
+
// When multiple candidates share the same git_root, disambiguate using branch and subdirectory
|
|
59
|
+
let matchingRoot;
|
|
60
|
+
if (candidates.length > 1) {
|
|
61
|
+
matchingRoot = candidates.find((root) => {
|
|
62
|
+
const branchMatch = !branch || (root.default_branch ?? 'main') === branch;
|
|
63
|
+
const subdirMatch = !subdirectory || root.default_subdirectory === subdirectory;
|
|
64
|
+
return branchMatch && subdirMatch;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
matchingRoot = candidates[0];
|
|
69
|
+
}
|
|
54
70
|
if (!matchingRoot) {
|
|
55
71
|
const allowedNames = allowedRoots.join(', ');
|
|
56
72
|
const allowedGitRoots = agentRoots
|
|
@@ -35,11 +35,11 @@ export const ActionSessionSchema = z.object({
|
|
|
35
35
|
const TOOL_DESCRIPTION = `Perform an action on an agent session.
|
|
36
36
|
|
|
37
37
|
**Actions:**
|
|
38
|
-
- **follow_up**: Send a follow-up prompt to
|
|
39
|
-
- **pause**: Pause a running session, transitioning it to "needs_input" status
|
|
40
|
-
- **restart**: Restart
|
|
38
|
+
- **follow_up**: Send a follow-up prompt to an idle session (requires "prompt" parameter)
|
|
39
|
+
- **pause**: Pause a running session, transitioning it to idle "needs_input" status
|
|
40
|
+
- **restart**: Restart an idle or failed session without providing new input
|
|
41
41
|
- **archive**: Archive a session (marks as completed)
|
|
42
|
-
- **unarchive**: Restore an archived session to "needs_input" status
|
|
42
|
+
- **unarchive**: Restore an archived session to idle "needs_input" status
|
|
43
43
|
- **change_mcp_servers**: Update the MCP servers for a session (requires "mcp_servers" parameter)
|
|
44
44
|
- **fork**: Fork a session from a specific transcript message (requires "message_index")
|
|
45
45
|
- **refresh**: Refresh a single session's status from the execution provider
|
|
@@ -41,7 +41,7 @@ const TOOL_DESCRIPTION = `Get detailed information about a specific agent sessio
|
|
|
41
41
|
|
|
42
42
|
**Use cases:**
|
|
43
43
|
- View detailed session information
|
|
44
|
-
- Check session status and progress
|
|
44
|
+
- Check session status and progress (use transcript to determine if a "needs_input" session has completed its task or needs follow-up)
|
|
45
45
|
- Retrieve session transcript for review
|
|
46
46
|
- Review logs for debugging
|
|
47
47
|
- Inspect subagent transcripts`;
|
|
@@ -28,14 +28,14 @@ const TOOL_DESCRIPTION = `Quick title-based search for agent sessions in the Age
|
|
|
28
28
|
- Find a specific session by ID (set id parameter)
|
|
29
29
|
- Search sessions by title keyword (set query parameter)
|
|
30
30
|
- List all sessions with optional status filter
|
|
31
|
-
- Monitor sessions
|
|
31
|
+
- Monitor sessions that have completed or need attention (status: "needs_input")
|
|
32
32
|
|
|
33
33
|
**Returns:** A list of matching sessions with their status, configuration, and metadata.
|
|
34
34
|
|
|
35
35
|
**Session statuses:**
|
|
36
36
|
- waiting: Session created, waiting to start
|
|
37
37
|
- running: Agent is actively executing
|
|
38
|
-
- needs_input: Agent
|
|
38
|
+
- needs_input: Agent has completed its current work and is idle. May indicate the task is done (most common) or that the agent needs additional input to continue. Check the session transcript to determine which case applies.
|
|
39
39
|
- failed: Session encountered an error
|
|
40
40
|
- archived: Session completed and archived`;
|
|
41
41
|
/** Maximum characters to display for prompt preview */
|
|
@@ -129,7 +129,7 @@ export function startSessionTool(_server, clientFactory) {
|
|
|
129
129
|
configs = await client.getConfigs();
|
|
130
130
|
setConfigsCache(configs);
|
|
131
131
|
}
|
|
132
|
-
const validation = validateAgentRootConstraints(allowedRoots, configs.agent_roots, validatedArgs.git_root, validatedArgs.mcp_servers);
|
|
132
|
+
const validation = validateAgentRootConstraints(allowedRoots, configs.agent_roots, validatedArgs.git_root, validatedArgs.mcp_servers, validatedArgs.branch, validatedArgs.subdirectory);
|
|
133
133
|
if (!validation.valid) {
|
|
134
134
|
return {
|
|
135
135
|
content: [{ type: 'text', text: `Error starting session: ${validation.error}` }],
|