mcp-subagents-opencode 1.0.0 → 1.2.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.
Files changed (159) hide show
  1. package/build/helpers.d.ts +43 -0
  2. package/build/helpers.d.ts.map +1 -1
  3. package/build/helpers.js +99 -8
  4. package/build/helpers.js.map +1 -1
  5. package/build/index.js +17 -3
  6. package/build/index.js.map +1 -1
  7. package/build/models.d.ts +27 -14
  8. package/build/models.d.ts.map +1 -1
  9. package/build/models.js +78 -39
  10. package/build/models.js.map +1 -1
  11. package/build/server/register-notifications.d.ts +5 -0
  12. package/build/server/register-notifications.d.ts.map +1 -1
  13. package/build/server/register-notifications.js +28 -3
  14. package/build/server/register-notifications.js.map +1 -1
  15. package/build/server/register-resources.d.ts.map +1 -1
  16. package/build/server/register-resources.js +9 -4
  17. package/build/server/register-resources.js.map +1 -1
  18. package/build/server/register-tasks.d.ts.map +1 -1
  19. package/build/server/register-tasks.js +13 -6
  20. package/build/server/register-tasks.js.map +1 -1
  21. package/build/server/register-tools.d.ts.map +1 -1
  22. package/build/server/register-tools.js +4 -3
  23. package/build/server/register-tools.js.map +1 -1
  24. package/build/services/model-discovery.d.ts +56 -0
  25. package/build/services/model-discovery.d.ts.map +1 -0
  26. package/build/services/model-discovery.js +259 -0
  27. package/build/services/model-discovery.js.map +1 -0
  28. package/build/services/opencode-client.d.ts +15 -1
  29. package/build/services/opencode-client.d.ts.map +1 -1
  30. package/build/services/opencode-client.js +229 -8
  31. package/build/services/opencode-client.js.map +1 -1
  32. package/build/services/opencode-spawner.d.ts +8 -2
  33. package/build/services/opencode-spawner.d.ts.map +1 -1
  34. package/build/services/opencode-spawner.js +331 -28
  35. package/build/services/opencode-spawner.js.map +1 -1
  36. package/build/services/output-file.d.ts +7 -5
  37. package/build/services/output-file.d.ts.map +1 -1
  38. package/build/services/output-file.js +28 -31
  39. package/build/services/output-file.js.map +1 -1
  40. package/build/services/task-manager.d.ts +6 -2
  41. package/build/services/task-manager.d.ts.map +1 -1
  42. package/build/services/task-manager.js +34 -5
  43. package/build/services/task-manager.js.map +1 -1
  44. package/build/services/task-persistence.d.ts +3 -3
  45. package/build/services/task-persistence.d.ts.map +1 -1
  46. package/build/services/task-persistence.js +15 -13
  47. package/build/services/task-persistence.js.map +1 -1
  48. package/build/services/template-home.d.ts +25 -0
  49. package/build/services/template-home.d.ts.map +1 -0
  50. package/build/services/template-home.js +105 -0
  51. package/build/services/template-home.js.map +1 -0
  52. package/build/templates/index.d.ts +1 -0
  53. package/build/templates/index.d.ts.map +1 -1
  54. package/build/templates/index.js +34 -7
  55. package/build/templates/index.js.map +1 -1
  56. package/build/templates/overlays/coder-csharp.mdx +6 -0
  57. package/build/templates/overlays/coder-go.mdx +6 -0
  58. package/build/templates/overlays/coder-java.mdx +6 -0
  59. package/build/templates/overlays/coder-kotlin.mdx +6 -0
  60. package/build/templates/overlays/coder-nextjs.mdx +6 -0
  61. package/build/templates/overlays/coder-python.mdx +6 -0
  62. package/build/templates/overlays/coder-react.mdx +6 -0
  63. package/build/templates/overlays/coder-ruby.mdx +6 -0
  64. package/build/templates/overlays/coder-rust.mdx +6 -0
  65. package/build/templates/overlays/coder-supabase.mdx +6 -0
  66. package/build/templates/overlays/coder-supastarter.mdx +6 -0
  67. package/build/templates/overlays/coder-swift.mdx +6 -0
  68. package/build/templates/overlays/coder-tauri.mdx +6 -0
  69. package/build/templates/overlays/coder-triggerdev.mdx +6 -0
  70. package/build/templates/overlays/coder-typescript.mdx +6 -0
  71. package/build/templates/overlays/coder-vue.mdx +6 -0
  72. package/build/templates/overlays/planner-architecture.mdx +6 -0
  73. package/build/templates/overlays/planner-bugfix.mdx +6 -0
  74. package/build/templates/overlays/planner-feature.mdx +6 -0
  75. package/build/templates/overlays/planner-migration.mdx +6 -0
  76. package/build/templates/overlays/planner-refactor.mdx +6 -0
  77. package/build/templates/overlays/researcher-library.mdx +6 -0
  78. package/build/templates/overlays/researcher-performance.mdx +6 -0
  79. package/build/templates/overlays/researcher-security.mdx +6 -0
  80. package/build/templates/overlays/tester-graphql.mdx +6 -0
  81. package/build/templates/overlays/tester-playwright.mdx +6 -0
  82. package/build/templates/overlays/tester-rest.mdx +6 -0
  83. package/build/templates/overlays/tester-suite.mdx +6 -0
  84. package/build/templates/super-coder.mdx +21 -0
  85. package/build/templates/super-planner.mdx +21 -0
  86. package/build/templates/super-researcher.mdx +21 -0
  87. package/build/templates/super-tester.mdx +21 -0
  88. package/build/tools/answer-question.d.ts.map +1 -1
  89. package/build/tools/answer-question.js +4 -3
  90. package/build/tools/answer-question.js.map +1 -1
  91. package/build/tools/cancel-task.d.ts.map +1 -1
  92. package/build/tools/cancel-task.js +6 -2
  93. package/build/tools/cancel-task.js.map +1 -1
  94. package/build/tools/send-message.d.ts.map +1 -1
  95. package/build/tools/send-message.js +13 -2
  96. package/build/tools/send-message.js.map +1 -1
  97. package/build/tools/shared-spawn.d.ts.map +1 -1
  98. package/build/tools/shared-spawn.js +19 -2
  99. package/build/tools/shared-spawn.js.map +1 -1
  100. package/build/tools/spawn-agent.d.ts +1 -1
  101. package/build/tools/spawn-agent.js +5 -5
  102. package/build/tools/spawn-agent.js.map +1 -1
  103. package/package.json +1 -1
  104. package/build/services/account-manager.d.ts +0 -88
  105. package/build/services/account-manager.d.ts.map +0 -1
  106. package/build/services/account-manager.js +0 -239
  107. package/build/services/account-manager.js.map +0 -1
  108. package/build/services/claude-code-runner.d.ts +0 -15
  109. package/build/services/claude-code-runner.d.ts.map +0 -1
  110. package/build/services/claude-code-runner.js +0 -475
  111. package/build/services/claude-code-runner.js.map +0 -1
  112. package/build/services/exhaustion-fallback.d.ts +0 -27
  113. package/build/services/exhaustion-fallback.d.ts.map +0 -1
  114. package/build/services/exhaustion-fallback.js +0 -30
  115. package/build/services/exhaustion-fallback.js.map +0 -1
  116. package/build/services/fallback-orchestrator.d.ts +0 -16
  117. package/build/services/fallback-orchestrator.d.ts.map +0 -1
  118. package/build/services/fallback-orchestrator.js +0 -48
  119. package/build/services/fallback-orchestrator.js.map +0 -1
  120. package/build/services/sdk-client-manager.d.ts +0 -149
  121. package/build/services/sdk-client-manager.d.ts.map +0 -1
  122. package/build/services/sdk-client-manager.js +0 -632
  123. package/build/services/sdk-client-manager.js.map +0 -1
  124. package/build/services/sdk-session-adapter.d.ts +0 -203
  125. package/build/services/sdk-session-adapter.d.ts.map +0 -1
  126. package/build/services/sdk-session-adapter.js +0 -1088
  127. package/build/services/sdk-session-adapter.js.map +0 -1
  128. package/build/services/sdk-spawner.d.ts +0 -42
  129. package/build/services/sdk-spawner.d.ts.map +0 -1
  130. package/build/services/sdk-spawner.js +0 -488
  131. package/build/services/sdk-spawner.js.map +0 -1
  132. package/build/services/session-hooks.d.ts +0 -24
  133. package/build/services/session-hooks.d.ts.map +0 -1
  134. package/build/services/session-hooks.js +0 -130
  135. package/build/services/session-hooks.js.map +0 -1
  136. package/build/services/session-snapshot.d.ts +0 -19
  137. package/build/services/session-snapshot.d.ts.map +0 -1
  138. package/build/services/session-snapshot.js +0 -203
  139. package/build/services/session-snapshot.js.map +0 -1
  140. package/build/tools/spawn-coder.d.ts +0 -70
  141. package/build/tools/spawn-coder.d.ts.map +0 -1
  142. package/build/tools/spawn-coder.js +0 -71
  143. package/build/tools/spawn-coder.js.map +0 -1
  144. package/build/tools/spawn-planner.d.ts +0 -70
  145. package/build/tools/spawn-planner.d.ts.map +0 -1
  146. package/build/tools/spawn-planner.js +0 -71
  147. package/build/tools/spawn-planner.js.map +0 -1
  148. package/build/tools/spawn-researcher.d.ts +0 -70
  149. package/build/tools/spawn-researcher.d.ts.map +0 -1
  150. package/build/tools/spawn-researcher.js +0 -70
  151. package/build/tools/spawn-researcher.js.map +0 -1
  152. package/build/tools/spawn-task.d.ts +0 -74
  153. package/build/tools/spawn-task.d.ts.map +0 -1
  154. package/build/tools/spawn-task.js +0 -107
  155. package/build/tools/spawn-task.js.map +0 -1
  156. package/build/tools/spawn-tester.d.ts +0 -70
  157. package/build/tools/spawn-tester.d.ts.map +0 -1
  158. package/build/tools/spawn-tester.js +0 -69
  159. package/build/tools/spawn-tester.js.map +0 -1
@@ -1,24 +0,0 @@
1
- /**
2
- * Session Hooks Service - Implements SDK SessionHooks for lifecycle control.
3
- *
4
- * Provides:
5
- * - Structured error handling with retry decisions
6
- * - Session lifecycle monitoring (start, end)
7
- * - Pre/post tool use hooks for logging and allow/deny decisions
8
- * - Centralized hook management per task
9
- *
10
- * Note: Tool execution metrics are tracked by sdk-session-adapter using
11
- * toolCallId-based matching, which is more accurate than the toolName-based
12
- * matching previously done here. This file no longer tracks tool metrics
13
- * to avoid duplicate/conflicting writes to task.sessionMetrics.toolMetrics.
14
- *
15
- * Uses SessionHooks interface from the SDK.
16
- */
17
- import type { SessionHooks } from '@github/copilot-sdk';
18
- /**
19
- * Create session hooks for a specific task.
20
- * These hooks integrate SDK lifecycle events with our task management.
21
- * Returns SessionHooks with single handler functions as expected by the SDK.
22
- */
23
- export declare function createSessionHooks(taskId: string): SessionHooks;
24
- //# sourceMappingURL=session-hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-hooks.d.ts","sourceRoot":"","sources":["../../src/services/session-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EACV,YAAY,EAWb,MAAM,qBAAqB,CAAC;AAI7B;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA4H/D"}
@@ -1,130 +0,0 @@
1
- /**
2
- * Session Hooks Service - Implements SDK SessionHooks for lifecycle control.
3
- *
4
- * Provides:
5
- * - Structured error handling with retry decisions
6
- * - Session lifecycle monitoring (start, end)
7
- * - Pre/post tool use hooks for logging and allow/deny decisions
8
- * - Centralized hook management per task
9
- *
10
- * Note: Tool execution metrics are tracked by sdk-session-adapter using
11
- * toolCallId-based matching, which is more accurate than the toolName-based
12
- * matching previously done here. This file no longer tracks tool metrics
13
- * to avoid duplicate/conflicting writes to task.sessionMetrics.toolMetrics.
14
- *
15
- * Uses SessionHooks interface from the SDK.
16
- */
17
- import { taskManager } from './task-manager.js';
18
- /**
19
- * Create session hooks for a specific task.
20
- * These hooks integrate SDK lifecycle events with our task management.
21
- * Returns SessionHooks with single handler functions as expected by the SDK.
22
- */
23
- export function createSessionHooks(taskId) {
24
- return {
25
- /**
26
- * Called when a session starts.
27
- * Logs session start and sets up monitoring.
28
- */
29
- onSessionStart: async (input) => {
30
- console.error(`[session-hooks] Session started for task ${taskId}: source=${input.source}`);
31
- // Hook lifecycle → file only (internal metadata)
32
- taskManager.appendOutputFileOnly(taskId, `[hooks] Session ${input.source === 'resume' ? 'resumed' : 'started'}`);
33
- // Initialize session metrics
34
- const task = taskManager.getTask(taskId);
35
- if (task && !task.sessionMetrics) {
36
- taskManager.updateTask(taskId, {
37
- sessionMetrics: {
38
- quotas: {},
39
- toolMetrics: {},
40
- activeSubagents: [],
41
- completedSubagents: [],
42
- turnCount: 0,
43
- totalTokens: { input: 0, output: 0 },
44
- },
45
- });
46
- }
47
- return {
48
- additionalContext: `Task ID: ${taskId}`,
49
- };
50
- },
51
- /**
52
- * Called when a session ends.
53
- * Logs session end and generates summary.
54
- */
55
- onSessionEnd: async (input) => {
56
- console.error(`[session-hooks] Session ended for task ${taskId}: reason=${input.reason}`);
57
- // Hook lifecycle → file only
58
- taskManager.appendOutputFileOnly(taskId, `[hooks] Session ended: ${input.reason}`);
59
- // Generate session summary if available
60
- if (input.finalMessage) {
61
- return {
62
- sessionSummary: input.finalMessage,
63
- };
64
- }
65
- return undefined;
66
- },
67
- /**
68
- * Called when an error occurs.
69
- * Provides structured error handling with retry decisions.
70
- */
71
- onErrorOccurred: async (input) => {
72
- const errorMsg = String(input.error);
73
- console.error(`[session-hooks] Error for task ${taskId}: context=${input.errorContext}, recoverable=${input.recoverable}`);
74
- // Create structured failure context
75
- const failureContext = {
76
- errorType: input.errorContext,
77
- errorContext: input.errorContext,
78
- recoverable: input.recoverable,
79
- message: errorMsg,
80
- };
81
- // Update task with failure context
82
- taskManager.updateTask(taskId, { failureContext });
83
- taskManager.appendOutput(taskId, `[hooks] Error: ${input.errorContext} - ${errorMsg.slice(0, 100)}`);
84
- // Determine error handling strategy
85
- if (input.recoverable) {
86
- // For recoverable errors, suggest retry
87
- return {
88
- errorHandling: 'retry',
89
- retryCount: 3,
90
- userNotification: `Recoverable error in ${input.errorContext}: ${errorMsg.slice(0, 100)}`,
91
- };
92
- }
93
- // For non-recoverable errors in tool execution, skip the tool
94
- if (input.errorContext === 'tool_execution') {
95
- return {
96
- errorHandling: 'skip',
97
- userNotification: `Tool execution failed: ${errorMsg.slice(0, 100)}`,
98
- };
99
- }
100
- // For model call errors, abort (let the adapter handle rotation)
101
- if (input.errorContext === 'model_call') {
102
- return {
103
- errorHandling: 'abort',
104
- userNotification: `Model call failed: ${errorMsg.slice(0, 100)}`,
105
- };
106
- }
107
- return undefined;
108
- },
109
- /**
110
- * Called before a tool is executed.
111
- * Logs tool start. Metrics are tracked by sdk-session-adapter.
112
- */
113
- onPreToolUse: async (input) => {
114
- console.error(`[session-hooks] Tool starting for task ${taskId}: ${input.toolName}`);
115
- return {
116
- permissionDecision: 'allow',
117
- };
118
- },
119
- /**
120
- * Called after a tool is executed.
121
- * Logs tool completion. Metrics are tracked by sdk-session-adapter.
122
- */
123
- onPostToolUse: async (input) => {
124
- const isSuccess = input.toolResult?.resultType === 'success';
125
- console.error(`[session-hooks] Tool completed for task ${taskId}: ${input.toolName} (${isSuccess ? 'success' : 'failure'})`);
126
- return undefined;
127
- },
128
- };
129
- }
130
- //# sourceMappingURL=session-hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-hooks.js","sourceRoot":"","sources":["../../src/services/session-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAeH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;GAIG;AACH,MAAM,UAAU,kBAAk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AK,CAAC,YAAY,KAAK,YAAY,EAAE,CAAC;gBACxC,OAAO;oBACL,aAAa,EAAE,OAAO;oBACtB,gBAAgB,EAAE,sBAAsB,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;iBACjE,CAAC;YACJ,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QAED;;;WAGG;QACH,YAAY,EAAE,KAAK,EAAE,KAA0B,EAAwC,EAAE;YACvF,OAAO,CAAC,KAAK,CAAC,0CAA0C,MAAM,KAAK,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAErF,OAAO;gBACL,kBAAkB,EAAE,OAAO;aAC5B,CAAC;QACJ,CAAC;QAED;;;WAGG;QACH,aAAa,EAAE,KAAK,EAAE,KAA2B,EAAyC,EAAE;YAC1F,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,EAAE,UAAU,KAAK,SAAS,CAAC;YAC7D,OAAO,CAAC,KAAK,CAAC,2CAA2C,MAAM,KAAK,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;YAE7H,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Session Snapshot Builder
3
- *
4
- * Extracts bounded context from a Copilot session for handoff to Claude Agent SDK.
5
- * Provides last N turns with message truncation to prevent excessive context size.
6
- */
7
- import type { CopilotSession } from '@github/copilot-sdk';
8
- import { TaskState } from '../types.js';
9
- /**
10
- * Build handoff prompt from session snapshot.
11
- * Includes original prompt and bounded recent context.
12
- */
13
- export declare function buildHandoffPrompt(task: TaskState, maxTurns?: number, reason?: string): string;
14
- /**
15
- * Build handoff prompt with structured SDK history when available.
16
- * Falls back to output-file snapshot if session history is unavailable.
17
- */
18
- export declare function buildHandoffPromptFromSession(task: TaskState, session: CopilotSession | undefined, maxTurns?: number, reason?: string): Promise<string>;
19
- //# sourceMappingURL=session-snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-snapshot.d.ts","sourceRoot":"","sources":["../../src/services/session-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AA+HxC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAE,MAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CA8CzG;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,QAAQ,GAAE,MAAkB,EAC5B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CA2CjB"}
@@ -1,203 +0,0 @@
1
- /**
2
- * Session Snapshot Builder
3
- *
4
- * Extracts bounded context from a Copilot session for handoff to Claude Agent SDK.
5
- * Provides last N turns with message truncation to prevent excessive context size.
6
- */
7
- import { readFileSync } from 'fs';
8
- const MAX_TURNS = 5; // Max number of turns to include
9
- const MAX_MESSAGE_LENGTH = 2000; // Max chars per message
10
- const MAX_TOTAL_LENGTH = 20000; // Max total snapshot size
11
- /**
12
- * Parse output file and extract recent message pairs.
13
- * Simple heuristic: split on common markers.
14
- */
15
- function parseOutputFile(filePath) {
16
- try {
17
- const content = readFileSync(filePath, 'utf-8');
18
- const pairs = [];
19
- // Split by common output markers
20
- const lines = content.split('\n');
21
- let currentAssistant = '';
22
- let isAssistant = false;
23
- for (const line of lines) {
24
- // Detect assistant output (simple heuristic - lines without user markers)
25
- if (line.startsWith('[') || line.startsWith('>') || line.trim().length === 0) {
26
- // System/tool output, skip
27
- continue;
28
- }
29
- // Accumulate assistant output
30
- if (!isAssistant) {
31
- isAssistant = true;
32
- currentAssistant = '';
33
- }
34
- currentAssistant += line + '\n';
35
- }
36
- // If we have any output, treat it as one big assistant turn
37
- if (currentAssistant.trim()) {
38
- pairs.push({
39
- user: '',
40
- assistant: currentAssistant.trim(),
41
- });
42
- }
43
- return pairs;
44
- }
45
- catch (error) {
46
- console.warn(`[session-snapshot] Failed to read output file: ${error}`);
47
- return [];
48
- }
49
- }
50
- /**
51
- * Truncate a message to max length with ellipsis.
52
- */
53
- function truncateMessage(msg, maxLength) {
54
- if (msg.length <= maxLength) {
55
- return msg;
56
- }
57
- return msg.slice(0, maxLength - 3) + '...';
58
- }
59
- function pairsFromSessionEvents(events) {
60
- const pairs = [];
61
- let pendingUser = '';
62
- let pendingAssistant = '';
63
- const flush = () => {
64
- if (pendingUser.trim() || pendingAssistant.trim()) {
65
- pairs.push({
66
- user: pendingUser.trim(),
67
- assistant: pendingAssistant.trim(),
68
- });
69
- }
70
- pendingUser = '';
71
- pendingAssistant = '';
72
- };
73
- for (const event of events) {
74
- if (event.type === 'user.message') {
75
- if (pendingAssistant.trim()) {
76
- flush();
77
- }
78
- const content = event.data.content?.trim();
79
- if (content) {
80
- pendingUser = content;
81
- }
82
- continue;
83
- }
84
- if (event.type === 'assistant.message') {
85
- const content = event.data.content?.trim();
86
- if (!content)
87
- continue;
88
- if (pendingAssistant.trim()) {
89
- pendingAssistant += '\n\n' + content;
90
- }
91
- else {
92
- pendingAssistant = content;
93
- }
94
- flush();
95
- }
96
- }
97
- flush();
98
- return pairs;
99
- }
100
- function fallbackReasonIntro(reason) {
101
- switch (reason) {
102
- case 'copilot_startup_no_accounts':
103
- return 'No Copilot account is currently available, so you are taking over before initial execution.';
104
- case 'copilot_accounts_exhausted':
105
- return 'All Copilot accounts are currently exhausted, so you are taking over.';
106
- case 'copilot_rate_limited':
107
- return 'The Copilot session is rate-limited and cannot continue within policy, so you are taking over.';
108
- case 'copilot_non_rotatable_error':
109
- return 'The Copilot session hit a non-rotatable error, so you are taking over.';
110
- case 'copilot_unhandled_error':
111
- return 'The Copilot path hit an unhandled error, so you are taking over.';
112
- default:
113
- return 'The previous Copilot path cannot continue, so you are taking over.';
114
- }
115
- }
116
- /**
117
- * Build handoff prompt from session snapshot.
118
- * Includes original prompt and bounded recent context.
119
- */
120
- export function buildHandoffPrompt(task, maxTurns = MAX_TURNS, reason) {
121
- const parts = [];
122
- // Header explaining the handoff
123
- parts.push('You are continuing a task that started with GitHub Copilot SDK.');
124
- parts.push(fallbackReasonIntro(reason));
125
- parts.push('');
126
- // Original prompt
127
- parts.push(`Original task prompt:\n${task.prompt}`);
128
- parts.push('');
129
- // Extract recent context if output file exists
130
- if (task.outputFilePath) {
131
- const pairs = parseOutputFile(task.outputFilePath);
132
- const recentPairs = pairs.slice(-maxTurns);
133
- if (recentPairs.length > 0) {
134
- parts.push('Recent context from the Copilot session:');
135
- parts.push('');
136
- for (const pair of recentPairs) {
137
- if (pair.user) {
138
- const truncated = truncateMessage(pair.user, MAX_MESSAGE_LENGTH);
139
- parts.push(`User: ${truncated}`);
140
- parts.push('');
141
- }
142
- if (pair.assistant) {
143
- const truncated = truncateMessage(pair.assistant, MAX_MESSAGE_LENGTH);
144
- parts.push(`Assistant: ${truncated}`);
145
- parts.push('');
146
- }
147
- }
148
- }
149
- }
150
- // Footer with instruction
151
- parts.push('Please continue working on this task. Pick up where the Copilot session left off.');
152
- // Join and enforce total length limit
153
- const snapshot = parts.join('\n');
154
- if (snapshot.length > MAX_TOTAL_LENGTH) {
155
- return snapshot.slice(0, MAX_TOTAL_LENGTH - 100) + '\n\n...[context truncated]\n\nPlease continue working on the original task.';
156
- }
157
- return snapshot;
158
- }
159
- /**
160
- * Build handoff prompt with structured SDK history when available.
161
- * Falls back to output-file snapshot if session history is unavailable.
162
- */
163
- export async function buildHandoffPromptFromSession(task, session, maxTurns = MAX_TURNS, reason) {
164
- if (!session) {
165
- return buildHandoffPrompt(task, maxTurns, reason);
166
- }
167
- try {
168
- const events = await session.getMessages();
169
- const pairs = pairsFromSessionEvents(events);
170
- if (pairs.length === 0) {
171
- return buildHandoffPrompt(task, maxTurns, reason);
172
- }
173
- const parts = [];
174
- parts.push('You are continuing a task that started with GitHub Copilot SDK.');
175
- parts.push(fallbackReasonIntro(reason));
176
- parts.push('');
177
- parts.push(`Original task prompt:\n${task.prompt}`);
178
- parts.push('');
179
- parts.push('Recent context from structured Copilot session history:');
180
- parts.push('');
181
- for (const pair of pairs.slice(-maxTurns)) {
182
- if (pair.user) {
183
- parts.push(`User: ${truncateMessage(pair.user, MAX_MESSAGE_LENGTH)}`);
184
- parts.push('');
185
- }
186
- if (pair.assistant) {
187
- parts.push(`Assistant: ${truncateMessage(pair.assistant, MAX_MESSAGE_LENGTH)}`);
188
- parts.push('');
189
- }
190
- }
191
- parts.push('Please continue working on this task. Pick up where the Copilot session left off.');
192
- const snapshot = parts.join('\n');
193
- if (snapshot.length > MAX_TOTAL_LENGTH) {
194
- return snapshot.slice(0, MAX_TOTAL_LENGTH - 100) + '\n\n...[context truncated]\n\nPlease continue working on the original task.';
195
- }
196
- return snapshot;
197
- }
198
- catch (error) {
199
- console.warn(`[session-snapshot] Failed to load session history: ${error}`);
200
- return buildHandoffPrompt(task, maxTurns, reason);
201
- }
202
- }
203
- //# sourceMappingURL=session-snapshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-snapshot.js","sourceRoot":"","sources":["../../src/services/session-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAIlC,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,iCAAiC;AACtD,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAC,wBAAwB;AACzD,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,0BAA0B;AAO1D;;;GAGG;AACH,SAAS,eAAe,CAAC,QAAgB;IACvC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,KAA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AClC,IAAI,QAAQ,CAAC,MAAM,GAAG,gBAAgB,EAAE,CAAC;YACvC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,GAAG,GAAG,CAAC,GAAG,6EAA6E,CAAC;QACnI,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,sDAAsD,KAAK,EAAE,CAAC,CAAC;QAC5E,OAAO,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
@@ -1,70 +0,0 @@
1
- export declare const spawnCoderTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {
7
- prompt: {
8
- type: string;
9
- description: string;
10
- };
11
- context_files: {
12
- type: string;
13
- items: {
14
- type: string;
15
- properties: {
16
- path: {
17
- type: string;
18
- description: string;
19
- };
20
- description: {
21
- type: string;
22
- description: string;
23
- };
24
- };
25
- required: string[];
26
- };
27
- description: string;
28
- };
29
- language: {
30
- type: string;
31
- enum: ("typescript" | "python" | "rust" | "go" | "java" | "ruby" | "swift" | "csharp" | "kotlin" | "react" | "nextjs" | "vue" | "supabase" | "tauri" | "triggerdev" | "supastarter" | "general")[];
32
- description: string;
33
- };
34
- model: {
35
- type: string;
36
- enum: ("claude-opus-4.6" | "claude-haiku-4.5" | "claude-sonnet-4.5")[];
37
- description: string;
38
- };
39
- cwd: {
40
- type: string;
41
- description: string;
42
- };
43
- timeout: {
44
- type: string;
45
- description: string;
46
- };
47
- autonomous: {
48
- type: string;
49
- description: string;
50
- };
51
- depends_on: {
52
- type: string;
53
- items: {
54
- type: string;
55
- };
56
- description: string;
57
- };
58
- labels: {
59
- type: string;
60
- items: {
61
- type: string;
62
- };
63
- description: string;
64
- };
65
- };
66
- required: string[];
67
- };
68
- };
69
- export declare const handleSpawnCoder: (args: unknown, ctx?: import("../types.js").ToolContext) => import("./shared-spawn.js").SpawnHandlerResult;
70
- //# sourceMappingURL=spawn-coder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn-coder.d.ts","sourceRoot":"","sources":["../../src/tools/spawn-coder.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4D1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,4GAM3B,CAAC"}
@@ -1,71 +0,0 @@
1
- import { SpawnCoderSchema, CODER_LANGUAGES } from '../utils/sanitize.js';
2
- import { MODEL_IDS, DEFAULT_MODEL } from '../models.js';
3
- import { createSpawnHandler } from './shared-spawn.js';
4
- export const spawnCoderTool = {
5
- name: 'spawn_coder',
6
- description: `Spawn an autonomous coding agent. Runs isolated — your brief + context_files are its ONLY context.
7
-
8
- **Required:** prompt (min 1000 chars) + context_files (min 1 .md file).
9
-
10
- **Prompt must include:** OBJECTIVE (what to build), FILES TO MODIFY (absolute paths), SUCCESS CRITERIA (testable), CONSTRAINTS (what NOT to do), PATTERNS TO FOLLOW (reference files).
11
-
12
- **Cross-reference outputs:**
13
- - Planner: \`.agent-workspace/plans/[topic]/05-handoff/builder-briefing.md\`
14
- - Researcher: \`.agent-workspace/researches/[topic]/HANDOFF.md\`
15
-
16
- **Workflow:** spawn_planner → spawn_coder → spawn_tester. Use \`depends_on\` to chain.
17
- Check status: \`task:///all\` or \`task:///{id}\``,
18
- inputSchema: {
19
- type: 'object',
20
- properties: {
21
- prompt: {
22
- type: 'string',
23
- description: `Min 1000 chars. Complete implementation brief: OBJECTIVE, FILES TO MODIFY (absolute paths), SUCCESS CRITERIA, CONSTRAINTS, PATTERNS TO FOLLOW, CONTEXT. Agent cannot see your conversation — everything must be in the prompt.`,
24
- },
25
- context_files: {
26
- type: 'array',
27
- items: {
28
- type: 'object',
29
- properties: {
30
- path: { type: 'string', description: 'Absolute path to a .md file.' },
31
- description: { type: 'string', description: 'What this file contains.' },
32
- },
33
- required: ['path'],
34
- },
35
- description: `Min 1 Markdown (.md) file required. Attach planner handoffs, specs, or your own brief. Max 20 files, 200KB each, 500KB total.`,
36
- },
37
- language: {
38
- type: 'string',
39
- enum: [...CODER_LANGUAGES],
40
- description: `Language/framework specialization overlay. Languages: typescript, python, rust, go, java, ruby, swift, csharp, kotlin. Frameworks: react, nextjs, vue, supabase, tauri, triggerdev, supastarter. Default: general (infers from codebase).`,
41
- },
42
- model: {
43
- type: 'string',
44
- enum: MODEL_IDS,
45
- description: `Default: ${DEFAULT_MODEL}. Use claude-haiku-4.5 for simple single-file changes.`,
46
- },
47
- cwd: { type: 'string', description: 'Absolute path to working directory.' },
48
- timeout: { type: 'number', description: 'Max ms. Default: 1800000 (30min).' },
49
- autonomous: { type: 'boolean', description: 'Default: true.' },
50
- depends_on: {
51
- type: 'array',
52
- items: { type: 'string' },
53
- description: 'Task IDs that must complete first.',
54
- },
55
- labels: {
56
- type: 'array',
57
- items: { type: 'string' },
58
- description: 'Labels for grouping (max 10).',
59
- },
60
- },
61
- required: ['prompt', 'context_files'],
62
- },
63
- };
64
- export const handleSpawnCoder = createSpawnHandler({
65
- schema: SpawnCoderSchema,
66
- toolName: 'spawn_coder',
67
- taskType: 'super-coder',
68
- validationHint: 'Required: `prompt` (min 1000 chars) + `context_files` (min 1 .md file).',
69
- getSpecialization: (parsed) => parsed.language,
70
- });
71
- //# sourceMappingURL=spawn-coder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn-coder.js","sourceRoot":"","sources":["../../src/tools/spawn-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC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,+BAA+B;aAC7C;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;KACtC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;IACjD,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,aAAa;IACvB,QAAQ,EAAE,aAAa;IACvB,cAAc,EAAE,yEAAyE;IACzF,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ;CAC/C,CAAC,CAAC"}
@@ -1,70 +0,0 @@
1
- export declare const spawnPlannerTool: {
2
- name: string;
3
- description: string;
4
- inputSchema: {
5
- type: "object";
6
- properties: {
7
- prompt: {
8
- type: string;
9
- description: string;
10
- };
11
- context_files: {
12
- type: string;
13
- items: {
14
- type: string;
15
- properties: {
16
- path: {
17
- type: string;
18
- description: string;
19
- };
20
- description: {
21
- type: string;
22
- description: string;
23
- };
24
- };
25
- required: string[];
26
- };
27
- description: string;
28
- };
29
- planning_type: {
30
- type: string;
31
- enum: ("feature" | "bugfix" | "migration" | "refactor" | "architecture")[];
32
- description: string;
33
- };
34
- model: {
35
- type: string;
36
- enum: ("claude-opus-4.6" | "claude-haiku-4.5" | "claude-sonnet-4.5")[];
37
- description: string;
38
- };
39
- cwd: {
40
- type: string;
41
- description: string;
42
- };
43
- timeout: {
44
- type: string;
45
- description: string;
46
- };
47
- autonomous: {
48
- type: string;
49
- description: string;
50
- };
51
- depends_on: {
52
- type: string;
53
- items: {
54
- type: string;
55
- };
56
- description: string;
57
- };
58
- labels: {
59
- type: string;
60
- items: {
61
- type: string;
62
- };
63
- description: string;
64
- };
65
- };
66
- required: string[];
67
- };
68
- };
69
- export declare const handleSpawnPlanner: (args: unknown, ctx?: import("../types.js").ToolContext) => import("./shared-spawn.js").SpawnHandlerResult;
70
- //# sourceMappingURL=spawn-planner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn-planner.d.ts","sourceRoot":"","sources":["../../src/tools/spawn-planner.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,4GAO7B,CAAC"}