mcp-subagents-opencode 1.0.0 → 1.1.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/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/build/models.d.ts +27 -14
- package/build/models.d.ts.map +1 -1
- package/build/models.js +78 -39
- package/build/models.js.map +1 -1
- package/build/services/model-discovery.d.ts +56 -0
- package/build/services/model-discovery.d.ts.map +1 -0
- package/build/services/model-discovery.js +259 -0
- package/build/services/model-discovery.js.map +1 -0
- package/build/services/template-home.d.ts +25 -0
- package/build/services/template-home.d.ts.map +1 -0
- package/build/services/template-home.js +105 -0
- package/build/services/template-home.js.map +1 -0
- package/build/templates/index.d.ts +1 -0
- package/build/templates/index.d.ts.map +1 -1
- package/build/templates/index.js +34 -7
- package/build/templates/index.js.map +1 -1
- package/build/templates/overlays/coder-csharp.mdx +6 -0
- package/build/templates/overlays/coder-go.mdx +6 -0
- package/build/templates/overlays/coder-java.mdx +6 -0
- package/build/templates/overlays/coder-kotlin.mdx +6 -0
- package/build/templates/overlays/coder-nextjs.mdx +6 -0
- package/build/templates/overlays/coder-python.mdx +6 -0
- package/build/templates/overlays/coder-react.mdx +6 -0
- package/build/templates/overlays/coder-ruby.mdx +6 -0
- package/build/templates/overlays/coder-rust.mdx +6 -0
- package/build/templates/overlays/coder-supabase.mdx +6 -0
- package/build/templates/overlays/coder-supastarter.mdx +6 -0
- package/build/templates/overlays/coder-swift.mdx +6 -0
- package/build/templates/overlays/coder-tauri.mdx +6 -0
- package/build/templates/overlays/coder-triggerdev.mdx +6 -0
- package/build/templates/overlays/coder-typescript.mdx +6 -0
- package/build/templates/overlays/coder-vue.mdx +6 -0
- package/build/templates/overlays/planner-architecture.mdx +6 -0
- package/build/templates/overlays/planner-bugfix.mdx +6 -0
- package/build/templates/overlays/planner-feature.mdx +6 -0
- package/build/templates/overlays/planner-migration.mdx +6 -0
- package/build/templates/overlays/planner-refactor.mdx +6 -0
- package/build/templates/overlays/researcher-library.mdx +6 -0
- package/build/templates/overlays/researcher-performance.mdx +6 -0
- package/build/templates/overlays/researcher-security.mdx +6 -0
- package/build/templates/overlays/tester-graphql.mdx +6 -0
- package/build/templates/overlays/tester-playwright.mdx +6 -0
- package/build/templates/overlays/tester-rest.mdx +6 -0
- package/build/templates/overlays/tester-suite.mdx +6 -0
- package/build/templates/super-coder.mdx +21 -0
- package/build/templates/super-planner.mdx +21 -0
- package/build/templates/super-researcher.mdx +21 -0
- package/build/templates/super-tester.mdx +21 -0
- package/build/tools/spawn-agent.d.ts +1 -1
- package/build/tools/spawn-agent.js +5 -5
- package/build/tools/spawn-agent.js.map +1 -1
- package/package.json +1 -1
- package/build/services/account-manager.d.ts +0 -88
- package/build/services/account-manager.d.ts.map +0 -1
- package/build/services/account-manager.js +0 -239
- package/build/services/account-manager.js.map +0 -1
- package/build/services/claude-code-runner.d.ts +0 -15
- package/build/services/claude-code-runner.d.ts.map +0 -1
- package/build/services/claude-code-runner.js +0 -475
- package/build/services/claude-code-runner.js.map +0 -1
- package/build/services/exhaustion-fallback.d.ts +0 -27
- package/build/services/exhaustion-fallback.d.ts.map +0 -1
- package/build/services/exhaustion-fallback.js +0 -30
- package/build/services/exhaustion-fallback.js.map +0 -1
- package/build/services/fallback-orchestrator.d.ts +0 -16
- package/build/services/fallback-orchestrator.d.ts.map +0 -1
- package/build/services/fallback-orchestrator.js +0 -48
- package/build/services/fallback-orchestrator.js.map +0 -1
- package/build/services/sdk-client-manager.d.ts +0 -149
- package/build/services/sdk-client-manager.d.ts.map +0 -1
- package/build/services/sdk-client-manager.js +0 -632
- package/build/services/sdk-client-manager.js.map +0 -1
- package/build/services/sdk-session-adapter.d.ts +0 -203
- package/build/services/sdk-session-adapter.d.ts.map +0 -1
- package/build/services/sdk-session-adapter.js +0 -1088
- package/build/services/sdk-session-adapter.js.map +0 -1
- package/build/services/sdk-spawner.d.ts +0 -42
- package/build/services/sdk-spawner.d.ts.map +0 -1
- package/build/services/sdk-spawner.js +0 -488
- package/build/services/sdk-spawner.js.map +0 -1
- package/build/services/session-hooks.d.ts +0 -24
- package/build/services/session-hooks.d.ts.map +0 -1
- package/build/services/session-hooks.js +0 -130
- package/build/services/session-hooks.js.map +0 -1
- package/build/services/session-snapshot.d.ts +0 -19
- package/build/services/session-snapshot.d.ts.map +0 -1
- package/build/services/session-snapshot.js +0 -203
- package/build/services/session-snapshot.js.map +0 -1
- package/build/tools/spawn-coder.d.ts +0 -70
- package/build/tools/spawn-coder.d.ts.map +0 -1
- package/build/tools/spawn-coder.js +0 -71
- package/build/tools/spawn-coder.js.map +0 -1
- package/build/tools/spawn-planner.d.ts +0 -70
- package/build/tools/spawn-planner.d.ts.map +0 -1
- package/build/tools/spawn-planner.js +0 -71
- package/build/tools/spawn-planner.js.map +0 -1
- package/build/tools/spawn-researcher.d.ts +0 -70
- package/build/tools/spawn-researcher.d.ts.map +0 -1
- package/build/tools/spawn-researcher.js +0 -70
- package/build/tools/spawn-researcher.js.map +0 -1
- package/build/tools/spawn-task.d.ts +0 -74
- package/build/tools/spawn-task.d.ts.map +0 -1
- package/build/tools/spawn-task.js +0 -107
- package/build/tools/spawn-task.js.map +0 -1
- package/build/tools/spawn-tester.d.ts +0 -70
- package/build/tools/spawn-tester.d.ts.map +0 -1
- package/build/tools/spawn-tester.js +0 -69
- package/build/tools/spawn-tester.js.map +0 -1
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK Client Manager - Manages CopilotClient instances for the MCP server.
|
|
3
|
-
*
|
|
4
|
-
* Provides a singleton pattern for managing Copilot SDK clients per workspace,
|
|
5
|
-
* handling authentication, lifecycle, and multi-account PAT token rotation.
|
|
6
|
-
*
|
|
7
|
-
* Multi-Account Support:
|
|
8
|
-
* - Integrates with AccountManager for round-robin PAT token rotation
|
|
9
|
-
* - Automatically switches tokens on rate limit (429) or server errors (5xx)
|
|
10
|
-
* - Resets to first token on MCP reconnect
|
|
11
|
-
*
|
|
12
|
-
* User Input (ask_user) Support:
|
|
13
|
-
* - Registers onUserInputRequest handler for SDK questions
|
|
14
|
-
* - Forwards questions to QuestionRegistry for MCP client handling
|
|
15
|
-
*/
|
|
16
|
-
import { CopilotClient, type CopilotSession, type SessionConfig } from '@github/copilot-sdk';
|
|
17
|
-
declare class SDKClientManager {
|
|
18
|
-
private clients;
|
|
19
|
-
private pendingClients;
|
|
20
|
-
private isShuttingDown;
|
|
21
|
-
private staleSessionTimer;
|
|
22
|
-
private sweepCycle;
|
|
23
|
-
/**
|
|
24
|
-
* Initialize the client manager (call on MCP connect).
|
|
25
|
-
* Initializes the account manager and resets to first token.
|
|
26
|
-
*/
|
|
27
|
-
initialize(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Reset the client manager (call on MCP reconnect).
|
|
30
|
-
* Clears all clients and resets account rotation to first token.
|
|
31
|
-
*/
|
|
32
|
-
reset(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Get or create a CopilotClient for the given workspace.
|
|
35
|
-
* Uses the current token from account manager.
|
|
36
|
-
*/
|
|
37
|
-
getClient(cwd: string): Promise<CopilotClient>;
|
|
38
|
-
/**
|
|
39
|
-
* Create a new CopilotClient with the specified configuration.
|
|
40
|
-
*/
|
|
41
|
-
private createClient;
|
|
42
|
-
/**
|
|
43
|
-
* Create a session using the SDK client for the given workspace.
|
|
44
|
-
* Includes user input handler for SDK ask_user tool support.
|
|
45
|
-
*/
|
|
46
|
-
createSession(cwd: string, sessionId: string, config: Omit<SessionConfig, 'sessionId'>, taskId?: string): Promise<CopilotSession>;
|
|
47
|
-
/**
|
|
48
|
-
* Resume an existing session.
|
|
49
|
-
* Includes user input handler for SDK ask_user tool support.
|
|
50
|
-
*/
|
|
51
|
-
resumeSession(cwd: string, sessionId: string, config?: Partial<SessionConfig>, taskId?: string): Promise<CopilotSession>;
|
|
52
|
-
/**
|
|
53
|
-
* Get an active session by ID.
|
|
54
|
-
*/
|
|
55
|
-
getSession(sessionId: string): CopilotSession | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Destroy a session and remove it from tracking.
|
|
58
|
-
*/
|
|
59
|
-
destroySession(sessionId: string): Promise<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* Abort a running session.
|
|
62
|
-
*/
|
|
63
|
-
abortSession(sessionId: string): Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* Rotate to the next account on error.
|
|
66
|
-
* Returns the new client if rotation was successful.
|
|
67
|
-
*
|
|
68
|
-
* @param cwd - Workspace directory
|
|
69
|
-
* @param reason - Reason for rotation (e.g., 'rate_limit_429', 'server_error_500')
|
|
70
|
-
*/
|
|
71
|
-
rotateOnError(cwd: string, reason: string): Promise<{
|
|
72
|
-
success: boolean;
|
|
73
|
-
client?: CopilotClient;
|
|
74
|
-
error?: string;
|
|
75
|
-
allExhausted?: boolean;
|
|
76
|
-
}>;
|
|
77
|
-
/**
|
|
78
|
-
* RC-7: Remove client entries with no active sessions that belong to non-current tokens.
|
|
79
|
-
* Prevents gradual resource leak from accumulated stale clients after rotation.
|
|
80
|
-
*/
|
|
81
|
-
private cleanupStaleClients;
|
|
82
|
-
/**
|
|
83
|
-
* Start the periodic stale-session sweeper. Timer is unref()'d so it
|
|
84
|
-
* doesn't prevent the process from exiting.
|
|
85
|
-
*/
|
|
86
|
-
private startStaleSessionSweeper;
|
|
87
|
-
/**
|
|
88
|
-
* Ping each client to detect dead/crashed CLI processes. Removes dead
|
|
89
|
-
* clients from the pool and force-stops them.
|
|
90
|
-
*/
|
|
91
|
-
private checkClientHealth;
|
|
92
|
-
/**
|
|
93
|
-
* Sweep all tracked sessions. If the corresponding task (looked up by
|
|
94
|
-
* sessionId which equals taskId by convention) is terminal or missing,
|
|
95
|
-
* destroy the session with a timeout. Then recycle PTY leakers.
|
|
96
|
-
*/
|
|
97
|
-
private sweepStaleSessions;
|
|
98
|
-
/**
|
|
99
|
-
* Detect server-side sessions that we're not tracking locally (orphaned from
|
|
100
|
-
* crashes). Uses listSessions() and deletes any not in our tracking map.
|
|
101
|
-
*/
|
|
102
|
-
private detectOrphanedSessions;
|
|
103
|
-
/**
|
|
104
|
-
* For each client entry, check PTY FD count via lsof. If count exceeds
|
|
105
|
-
* threshold and no active sessions remain, recycle the client (stop it
|
|
106
|
-
* and remove from map so the next getClient() creates a fresh one).
|
|
107
|
-
*/
|
|
108
|
-
private recyclePtyLeakers;
|
|
109
|
-
/**
|
|
110
|
-
* Check if rotation should happen based on error.
|
|
111
|
-
*/
|
|
112
|
-
shouldRotateOnError(statusCode?: number, errorMessage?: string): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Check authentication status for current token.
|
|
115
|
-
*/
|
|
116
|
-
checkAuthStatus(cwd: string): Promise<{
|
|
117
|
-
isAuthenticated: boolean;
|
|
118
|
-
login?: string;
|
|
119
|
-
tokenIndex: number;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* List available models.
|
|
123
|
-
*/
|
|
124
|
-
listModels(cwd: string): Promise<Array<{
|
|
125
|
-
id: string;
|
|
126
|
-
name: string;
|
|
127
|
-
}>>;
|
|
128
|
-
/**
|
|
129
|
-
* Shutdown all clients gracefully.
|
|
130
|
-
*/
|
|
131
|
-
shutdown(): Promise<void>;
|
|
132
|
-
/**
|
|
133
|
-
* Get statistics about active clients, sessions, and account rotation.
|
|
134
|
-
*/
|
|
135
|
-
getStats(): {
|
|
136
|
-
pools: number;
|
|
137
|
-
clients: number;
|
|
138
|
-
sessions: number;
|
|
139
|
-
accounts: {
|
|
140
|
-
total: number;
|
|
141
|
-
current: number;
|
|
142
|
-
rotations: number;
|
|
143
|
-
available: number;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export declare const sdkClientManager: SDKClientManager;
|
|
148
|
-
export {};
|
|
149
|
-
//# sourceMappingURL=sdk-client-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client-manager.d.ts","sourceRoot":"","sources":["../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