@qduc/term2 0.3.0 → 0.3.1
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/dist/hooks/use-model-selection.d.ts.map +1 -1
- package/dist/hooks/use-model-selection.js +32 -11
- package/dist/hooks/use-model-selection.js.map +1 -1
- package/dist/hooks/use-model-selection.test.js +107 -10
- package/dist/hooks/use-model-selection.test.js.map +1 -1
- package/dist/providers/ai-sdk-message-normalizer.d.ts +8 -0
- package/dist/providers/ai-sdk-message-normalizer.d.ts.map +1 -0
- package/dist/providers/ai-sdk-message-normalizer.js +70 -0
- package/dist/providers/ai-sdk-message-normalizer.js.map +1 -0
- package/dist/providers/ai-sdk-message-normalizer.test.d.ts +2 -0
- package/dist/providers/ai-sdk-message-normalizer.test.d.ts.map +1 -0
- package/dist/providers/ai-sdk-message-normalizer.test.js +195 -0
- package/dist/providers/ai-sdk-message-normalizer.test.js.map +1 -0
- package/dist/providers/ai-sdk-openai-compatible.provider.d.ts.map +1 -1
- package/dist/providers/ai-sdk-openai-compatible.provider.js +2 -1
- package/dist/providers/ai-sdk-openai-compatible.provider.js.map +1 -1
- package/dist/providers/ai-sdk-openrouter.provider.d.ts +16 -0
- package/dist/providers/ai-sdk-openrouter.provider.d.ts.map +1 -0
- package/dist/providers/ai-sdk-openrouter.provider.js +22 -0
- package/dist/providers/ai-sdk-openrouter.provider.js.map +1 -0
- package/dist/providers/ai-sdk-openrouter.provider.test.d.ts +2 -0
- package/dist/providers/ai-sdk-openrouter.provider.test.d.ts.map +1 -0
- package/dist/providers/ai-sdk-openrouter.provider.test.js +70 -0
- package/dist/providers/ai-sdk-openrouter.provider.test.js.map +1 -0
- package/dist/providers/openrouter.provider.js +4 -3
- package/dist/providers/openrouter.provider.js.map +1 -1
- package/dist/scripts/eval-auto-approval/dataset.d.ts +1 -1
- package/dist/services/stream-event-parsing.js +1 -1
- package/dist/services/stream-event-parsing.js.map +1 -1
- package/dist/services/stream-event-parsing.test.js +13 -0
- package/dist/services/stream-event-parsing.test.js.map +1 -1
- package/package.json +2 -1
- package/readme.md +29 -24
- package/dist/agent.lite-mode.test.d.ts +0 -2
- package/dist/agent.lite-mode.test.d.ts.map +0 -1
- package/dist/agent.lite-mode.test.js +0 -39
- package/dist/agent.lite-mode.test.js.map +0 -1
- package/dist/components/ModelSelectionMenu.error-tabs.test.d.ts +0 -2
- package/dist/components/ModelSelectionMenu.error-tabs.test.d.ts.map +0 -1
- package/dist/components/ModelSelectionMenu.error-tabs.test.js +0 -18
- package/dist/components/ModelSelectionMenu.error-tabs.test.js.map +0 -1
- package/dist/components/TextInput.d.ts +0 -42
- package/dist/components/TextInput.d.ts.map +0 -1
- package/dist/components/TextInput.js +0 -398
- package/dist/components/TextInput.js.map +0 -1
- package/dist/components/TextInput.test.d.ts +0 -2
- package/dist/components/TextInput.test.d.ts.map +0 -1
- package/dist/components/TextInput.test.js +0 -75
- package/dist/components/TextInput.test.js.map +0 -1
- package/dist/debug_ask_mentor.d.ts +0 -2
- package/dist/debug_ask_mentor.d.ts.map +0 -1
- package/dist/debug_ask_mentor.js +0 -73
- package/dist/debug_ask_mentor.js.map +0 -1
- package/dist/lib/shell.d.ts +0 -7
- package/dist/lib/shell.d.ts.map +0 -1
- package/dist/lib/shell.js +0 -56
- package/dist/lib/shell.js.map +0 -1
- package/dist/modes/companion/command-index.d.ts +0 -26
- package/dist/modes/companion/command-index.d.ts.map +0 -1
- package/dist/modes/companion/command-index.js +0 -50
- package/dist/modes/companion/command-index.js.map +0 -1
- package/dist/modes/companion/command-index.test.d.ts +0 -2
- package/dist/modes/companion/command-index.test.d.ts.map +0 -1
- package/dist/modes/companion/command-index.test.js +0 -86
- package/dist/modes/companion/command-index.test.js.map +0 -1
- package/dist/modes/companion/companion-app.d.ts +0 -12
- package/dist/modes/companion/companion-app.d.ts.map +0 -1
- package/dist/modes/companion/companion-app.js +0 -297
- package/dist/modes/companion/companion-app.js.map +0 -1
- package/dist/modes/companion/companion-session.d.ts +0 -63
- package/dist/modes/companion/companion-session.d.ts.map +0 -1
- package/dist/modes/companion/companion-session.js +0 -146
- package/dist/modes/companion/companion-session.js.map +0 -1
- package/dist/modes/companion/companion-session.test.d.ts +0 -2
- package/dist/modes/companion/companion-session.test.d.ts.map +0 -1
- package/dist/modes/companion/companion-session.test.js +0 -28
- package/dist/modes/companion/companion-session.test.js.map +0 -1
- package/dist/modes/companion/components/status-bar.d.ts +0 -13
- package/dist/modes/companion/components/status-bar.d.ts.map +0 -1
- package/dist/modes/companion/components/status-bar.js +0 -26
- package/dist/modes/companion/components/status-bar.js.map +0 -1
- package/dist/modes/companion/context-buffer.d.ts +0 -65
- package/dist/modes/companion/context-buffer.d.ts.map +0 -1
- package/dist/modes/companion/context-buffer.js +0 -156
- package/dist/modes/companion/context-buffer.js.map +0 -1
- package/dist/modes/companion/context-buffer.test.d.ts +0 -2
- package/dist/modes/companion/context-buffer.test.d.ts.map +0 -1
- package/dist/modes/companion/context-buffer.test.js +0 -154
- package/dist/modes/companion/context-buffer.test.js.map +0 -1
- package/dist/modes/companion/event-detector.d.ts +0 -46
- package/dist/modes/companion/event-detector.d.ts.map +0 -1
- package/dist/modes/companion/event-detector.js +0 -169
- package/dist/modes/companion/event-detector.js.map +0 -1
- package/dist/modes/companion/event-detector.test.d.ts +0 -2
- package/dist/modes/companion/event-detector.test.d.ts.map +0 -1
- package/dist/modes/companion/event-detector.test.js +0 -121
- package/dist/modes/companion/event-detector.test.js.map +0 -1
- package/dist/modes/companion/index.d.ts +0 -33
- package/dist/modes/companion/index.d.ts.map +0 -1
- package/dist/modes/companion/index.js +0 -21
- package/dist/modes/companion/index.js.map +0 -1
- package/dist/modes/companion/input-key-mapper.d.ts +0 -3
- package/dist/modes/companion/input-key-mapper.d.ts.map +0 -1
- package/dist/modes/companion/input-key-mapper.js +0 -31
- package/dist/modes/companion/input-key-mapper.js.map +0 -1
- package/dist/modes/companion/input-key-mapper.test.d.ts +0 -2
- package/dist/modes/companion/input-key-mapper.test.d.ts.map +0 -1
- package/dist/modes/companion/input-key-mapper.test.js +0 -26
- package/dist/modes/companion/input-key-mapper.test.js.map +0 -1
- package/dist/modes/companion/input-parser.d.ts +0 -53
- package/dist/modes/companion/input-parser.d.ts.map +0 -1
- package/dist/modes/companion/input-parser.js +0 -114
- package/dist/modes/companion/input-parser.js.map +0 -1
- package/dist/modes/companion/input-parser.test.d.ts +0 -2
- package/dist/modes/companion/input-parser.test.d.ts.map +0 -1
- package/dist/modes/companion/input-parser.test.js +0 -123
- package/dist/modes/companion/input-parser.test.js.map +0 -1
- package/dist/modes/companion/mode-manager.d.ts +0 -41
- package/dist/modes/companion/mode-manager.d.ts.map +0 -1
- package/dist/modes/companion/mode-manager.js +0 -56
- package/dist/modes/companion/mode-manager.js.map +0 -1
- package/dist/modes/companion/mode-manager.test.d.ts +0 -2
- package/dist/modes/companion/mode-manager.test.d.ts.map +0 -1
- package/dist/modes/companion/mode-manager.test.js +0 -65
- package/dist/modes/companion/mode-manager.test.js.map +0 -1
- package/dist/modes/companion/output-classifier.d.ts +0 -15
- package/dist/modes/companion/output-classifier.d.ts.map +0 -1
- package/dist/modes/companion/output-classifier.js +0 -77
- package/dist/modes/companion/output-classifier.js.map +0 -1
- package/dist/modes/companion/output-classifier.test.d.ts +0 -2
- package/dist/modes/companion/output-classifier.test.d.ts.map +0 -1
- package/dist/modes/companion/output-classifier.test.js +0 -133
- package/dist/modes/companion/output-classifier.test.js.map +0 -1
- package/dist/modes/companion/pty-wrapper.d.ts +0 -46
- package/dist/modes/companion/pty-wrapper.d.ts.map +0 -1
- package/dist/modes/companion/pty-wrapper.js +0 -143
- package/dist/modes/companion/pty-wrapper.js.map +0 -1
- package/dist/modes/companion/safety-classifier.d.ts +0 -31
- package/dist/modes/companion/safety-classifier.d.ts.map +0 -1
- package/dist/modes/companion/safety-classifier.js +0 -140
- package/dist/modes/companion/safety-classifier.js.map +0 -1
- package/dist/modes/companion/safety-classifier.test.d.ts +0 -2
- package/dist/modes/companion/safety-classifier.test.d.ts.map +0 -1
- package/dist/modes/companion/safety-classifier.test.js +0 -151
- package/dist/modes/companion/safety-classifier.test.js.map +0 -1
- package/dist/modes/companion/summarizer.d.ts +0 -24
- package/dist/modes/companion/summarizer.d.ts.map +0 -1
- package/dist/modes/companion/summarizer.js +0 -132
- package/dist/modes/companion/summarizer.js.map +0 -1
- package/dist/modes/companion/terminal-history.d.ts +0 -27
- package/dist/modes/companion/terminal-history.d.ts.map +0 -1
- package/dist/modes/companion/terminal-history.js +0 -142
- package/dist/modes/companion/terminal-history.js.map +0 -1
- package/dist/prompts/simple-mentor.md +0 -215
- package/dist/providers/github-copilot/converters.d.ts +0 -45
- package/dist/providers/github-copilot/converters.d.ts.map +0 -1
- package/dist/providers/github-copilot/converters.js +0 -118
- package/dist/providers/github-copilot/converters.js.map +0 -1
- package/dist/providers/github-copilot/converters.test.d.ts +0 -2
- package/dist/providers/github-copilot/converters.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/converters.test.js +0 -162
- package/dist/providers/github-copilot/converters.test.js.map +0 -1
- package/dist/providers/github-copilot/github-copilot.provider.d.ts +0 -2
- package/dist/providers/github-copilot/github-copilot.provider.d.ts.map +0 -1
- package/dist/providers/github-copilot/github-copilot.provider.js +0 -75
- package/dist/providers/github-copilot/github-copilot.provider.js.map +0 -1
- package/dist/providers/github-copilot/github-copilot.provider.test.d.ts +0 -2
- package/dist/providers/github-copilot/github-copilot.provider.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/github-copilot.provider.test.js +0 -26
- package/dist/providers/github-copilot/github-copilot.provider.test.js.map +0 -1
- package/dist/providers/github-copilot/index.d.ts +0 -4
- package/dist/providers/github-copilot/index.d.ts.map +0 -1
- package/dist/providers/github-copilot/index.js +0 -4
- package/dist/providers/github-copilot/index.js.map +0 -1
- package/dist/providers/github-copilot/model.d.ts +0 -24
- package/dist/providers/github-copilot/model.d.ts.map +0 -1
- package/dist/providers/github-copilot/model.delta.test.d.ts +0 -2
- package/dist/providers/github-copilot/model.delta.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/model.delta.test.js +0 -15
- package/dist/providers/github-copilot/model.delta.test.js.map +0 -1
- package/dist/providers/github-copilot/model.js +0 -498
- package/dist/providers/github-copilot/model.js.map +0 -1
- package/dist/providers/github-copilot/model.test.d.ts +0 -2
- package/dist/providers/github-copilot/model.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/model.test.js +0 -63
- package/dist/providers/github-copilot/model.test.js.map +0 -1
- package/dist/providers/github-copilot/provider.d.ts +0 -15
- package/dist/providers/github-copilot/provider.d.ts.map +0 -1
- package/dist/providers/github-copilot/provider.js +0 -25
- package/dist/providers/github-copilot/provider.js.map +0 -1
- package/dist/providers/github-copilot/provider.test.d.ts +0 -2
- package/dist/providers/github-copilot/provider.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/provider.test.js +0 -52
- package/dist/providers/github-copilot/provider.test.js.map +0 -1
- package/dist/providers/github-copilot/utils.d.ts +0 -20
- package/dist/providers/github-copilot/utils.d.ts.map +0 -1
- package/dist/providers/github-copilot/utils.js +0 -142
- package/dist/providers/github-copilot/utils.js.map +0 -1
- package/dist/providers/github-copilot/utils.test.d.ts +0 -2
- package/dist/providers/github-copilot/utils.test.d.ts.map +0 -1
- package/dist/providers/github-copilot/utils.test.js +0 -21
- package/dist/providers/github-copilot/utils.test.js.map +0 -1
- package/dist/safety-checker.js +0 -57
- package/dist/services/check_mock.d.ts +0 -2
- package/dist/services/check_mock.d.ts.map +0 -1
- package/dist/services/check_mock.js +0 -22
- package/dist/services/check_mock.js.map +0 -1
- package/dist/services/conversation-service.test.d.ts +0 -2
- package/dist/services/conversation-service.test.d.ts.map +0 -1
- package/dist/services/conversation-service.test.js +0 -156
- package/dist/services/conversation-service.test.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -10
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js +0 -55
- package/dist/tools/bash.js.map +0 -1
- package/dist/utils/command-safety.d.ts +0 -21
- package/dist/utils/command-safety.d.ts.map +0 -1
- package/dist/utils/command-safety.devnull.test.d.ts +0 -2
- package/dist/utils/command-safety.devnull.test.d.ts.map +0 -1
- package/dist/utils/command-safety.devnull.test.js +0 -13
- package/dist/utils/command-safety.devnull.test.js.map +0 -1
- package/dist/utils/command-safety.js +0 -348
- package/dist/utils/command-safety.js.map +0 -1
- package/dist/utils/extract-command-messages.test.d.ts +0 -2
- package/dist/utils/extract-command-messages.test.d.ts.map +0 -1
- package/dist/utils/extract-command-messages.test.js +0 -64
- package/dist/utils/extract-command-messages.test.js.map +0 -1
- package/dist/utils/provider-traffic-extractor.repro.test.d.ts +0 -2
- package/dist/utils/provider-traffic-extractor.repro.test.d.ts.map +0 -1
- package/dist/utils/provider-traffic-extractor.repro.test.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-copilot.provider.test.d.ts","sourceRoot":"","sources":["../../../source/providers/github-copilot/github-copilot.provider.test.ts"],"names":[],"mappings":"AAIA,OAAO,8BAA8B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { getProvider } from '../registry.js';
|
|
3
|
-
// Import to trigger registration
|
|
4
|
-
import './github-copilot.provider.js';
|
|
5
|
-
test('github-copilot provider is registered', (t) => {
|
|
6
|
-
const provider = getProvider('github-copilot');
|
|
7
|
-
t.truthy(provider);
|
|
8
|
-
t.is(provider.id, 'github-copilot');
|
|
9
|
-
t.is(provider.label, 'GitHub Copilot');
|
|
10
|
-
});
|
|
11
|
-
test('github-copilot provider has createRunner function', (t) => {
|
|
12
|
-
const provider = getProvider('github-copilot');
|
|
13
|
-
t.truthy(provider);
|
|
14
|
-
t.is(typeof provider.createRunner, 'function');
|
|
15
|
-
});
|
|
16
|
-
test('github-copilot provider has fetchModels function', (t) => {
|
|
17
|
-
const provider = getProvider('github-copilot');
|
|
18
|
-
t.truthy(provider);
|
|
19
|
-
t.is(typeof provider.fetchModels, 'function');
|
|
20
|
-
});
|
|
21
|
-
test('github-copilot provider has empty sensitiveSettingKeys', (t) => {
|
|
22
|
-
const provider = getProvider('github-copilot');
|
|
23
|
-
t.truthy(provider);
|
|
24
|
-
t.deepEqual(provider.sensitiveSettingKeys, []);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=github-copilot.provider.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"github-copilot.provider.test.js","sourceRoot":"","sources":["../../../source/providers/github-copilot/github-copilot.provider.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,iCAAiC;AACjC,OAAO,8BAA8B,CAAC;AAEtC,IAAI,CAAC,uCAAuC,EAAE,CAAC,CAAC,EAAE,EAAE;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC,CAAC,EAAE,CAAC,QAAS,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;IACrC,CAAC,CAAC,EAAE,CAAC,QAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mDAAmD,EAAE,CAAC,CAAC,EAAE,EAAE;IAC5D,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC,CAAC,EAAE,CAAC,OAAO,QAAS,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,kDAAkD,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3D,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC,CAAC,EAAE,CAAC,OAAO,QAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wDAAwD,EAAE,CAAC,CAAC,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE/C,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC,CAAC,SAAS,CAAC,QAAS,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/providers/github-copilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/providers/github-copilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Model, type ModelRequest, type ModelResponse, type ResponseStreamEvent } from '@openai/agents-core';
|
|
2
|
-
import { CopilotClient, type CopilotSession } from '@github/copilot-sdk';
|
|
3
|
-
import type { ILoggingService, ISettingsService } from '../../services/service-interfaces.js';
|
|
4
|
-
export declare let sharedClient: CopilotClient | null;
|
|
5
|
-
export declare function getClient(): Promise<CopilotClient>;
|
|
6
|
-
export declare function extractCopilotTextDelta(accumulated: string, incoming: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Force stop the shared client (for cleanup/error recovery)
|
|
9
|
-
*/
|
|
10
|
-
export declare function forceStopClient(): Promise<void>;
|
|
11
|
-
export declare class GitHubCopilotModel implements Model {
|
|
12
|
-
#private;
|
|
13
|
-
name: string;
|
|
14
|
-
constructor(deps: {
|
|
15
|
-
settingsService: ISettingsService;
|
|
16
|
-
loggingService: ILoggingService;
|
|
17
|
-
modelId?: string;
|
|
18
|
-
sessionMap?: Map<string, string>;
|
|
19
|
-
activeSessions?: Map<string, CopilotSession>;
|
|
20
|
-
});
|
|
21
|
-
getResponse(request: ModelRequest): Promise<ModelResponse>;
|
|
22
|
-
getStreamedResponse(request: ModelRequest): AsyncIterable<ResponseStreamEvent>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../source/providers/github-copilot/model.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAC3B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKzE,OAAO,KAAK,EACR,eAAe,EACf,gBAAgB,EACnB,MAAM,sCAAsC,CAAC;AAa9C,eAAO,IAAI,YAAY,EAAE,aAAa,GAAG,IAAW,CAAC;AAErD,wBAAsB,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAMxD;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuBrF;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CASrD;AAED,qBAAa,kBAAmB,YAAW,KAAK;;IAC5C,IAAI,EAAE,MAAM,CAAC;gBAOD,IAAI,EAAE;QACd,eAAe,EAAE,gBAAgB,CAAC;QAClC,cAAc,EAAE,eAAe,CAAC;QAChC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;KAChD;IAaK,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAqCzD,mBAAmB,CACtB,OAAO,EAAE,YAAY,GACtB,aAAa,CAAC,mBAAmB,CAAC;CAgbxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.delta.test.d.ts","sourceRoot":"","sources":["../../../source/providers/github-copilot/model.delta.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import { extractCopilotTextDelta } from './model.js';
|
|
3
|
-
test('extractCopilotTextDelta returns full chunk when no accumulation', t => {
|
|
4
|
-
t.is(extractCopilotTextDelta('', 'Hello'), 'Hello');
|
|
5
|
-
});
|
|
6
|
-
test('extractCopilotTextDelta returns only new suffix when chunk repeats accumulation', t => {
|
|
7
|
-
t.is(extractCopilotTextDelta('Hello', 'Hello world'), ' world');
|
|
8
|
-
});
|
|
9
|
-
test('extractCopilotTextDelta returns empty string when chunk equals accumulation', t => {
|
|
10
|
-
t.is(extractCopilotTextDelta('Hello', 'Hello'), '');
|
|
11
|
-
});
|
|
12
|
-
test('extractCopilotTextDelta returns chunk when it is not a prefix match', t => {
|
|
13
|
-
t.is(extractCopilotTextDelta('Hello', 'Hi there'), 'Hi there');
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=model.delta.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.delta.test.js","sourceRoot":"","sources":["../../../source/providers/github-copilot/model.delta.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,IAAI,CAAC,iEAAiE,EAAE,CAAC,CAAC,EAAE;IACxE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,iFAAiF,EAAE,CAAC,CAAC,EAAE;IACxF,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,6EAA6E,EAAE,CAAC,CAAC,EAAE;IACpF,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,qEAAqE,EAAE,CAAC,CAAC,EAAE;IAC5E,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC"}
|
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { CopilotClient } from '@github/copilot-sdk';
|
|
5
|
-
// Load simple.md system prompt (same as other providers)
|
|
6
|
-
const SIMPLE_PROMPT_PATH = path.join(import.meta.dirname, '../../prompts/simple.md');
|
|
7
|
-
const SIMPLE_PROMPT = fs.readFileSync(SIMPLE_PROMPT_PATH, 'utf-8').trim();
|
|
8
|
-
import { buildMessagesFromRequest, extractFunctionToolsFromRequest, normalizeUsage, } from './converters.js';
|
|
9
|
-
// Global map to store pending tool resolutions: SessionID -> CallID -> ResolveFunction
|
|
10
|
-
// This allows us to "detach" the tool execution from the SDK's internal loop
|
|
11
|
-
// and hand it over to the Agent Runner, then resume it later.
|
|
12
|
-
const pendingResolutions = new Map();
|
|
13
|
-
// Singleton client - SDK manages CLI process lifecycle
|
|
14
|
-
export let sharedClient = null;
|
|
15
|
-
export async function getClient() {
|
|
16
|
-
if (!sharedClient) {
|
|
17
|
-
sharedClient = new CopilotClient();
|
|
18
|
-
await sharedClient.start();
|
|
19
|
-
}
|
|
20
|
-
return sharedClient;
|
|
21
|
-
}
|
|
22
|
-
export function extractCopilotTextDelta(accumulated, incoming) {
|
|
23
|
-
if (!incoming)
|
|
24
|
-
return '';
|
|
25
|
-
if (!accumulated)
|
|
26
|
-
return incoming;
|
|
27
|
-
// 1. If incoming starts with accumulated, it's definitely an accumulation
|
|
28
|
-
if (incoming.startsWith(accumulated)) {
|
|
29
|
-
return incoming.slice(accumulated.length);
|
|
30
|
-
}
|
|
31
|
-
// 2. Check for overlap: find the longest suffix of 'accumulated' that is a prefix of 'incoming'
|
|
32
|
-
// We only check up to a reasonable length to avoid O(N^2) on very long outputs,
|
|
33
|
-
// though usually deltas are small.
|
|
34
|
-
const maxOverlap = Math.min(accumulated.length, incoming.length);
|
|
35
|
-
for (let len = maxOverlap; len > 0; len--) {
|
|
36
|
-
const suffix = accumulated.slice(-len);
|
|
37
|
-
const prefix = incoming.slice(0, len);
|
|
38
|
-
if (suffix === prefix) {
|
|
39
|
-
return incoming.slice(len);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// 3. No overlap found, treat as a pure delta
|
|
43
|
-
return incoming;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Force stop the shared client (for cleanup/error recovery)
|
|
47
|
-
*/
|
|
48
|
-
export async function forceStopClient() {
|
|
49
|
-
if (sharedClient) {
|
|
50
|
-
try {
|
|
51
|
-
await sharedClient.forceStop();
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
// Ignore errors during cleanup
|
|
55
|
-
}
|
|
56
|
-
sharedClient = null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export class GitHubCopilotModel {
|
|
60
|
-
name;
|
|
61
|
-
#modelId;
|
|
62
|
-
#settingsService;
|
|
63
|
-
#loggingService;
|
|
64
|
-
#sessionMap;
|
|
65
|
-
#activeSessions;
|
|
66
|
-
constructor(deps) {
|
|
67
|
-
this.name = 'GitHubCopilot';
|
|
68
|
-
this.#settingsService = deps.settingsService;
|
|
69
|
-
this.#loggingService = deps.loggingService;
|
|
70
|
-
this.#sessionMap = deps.sessionMap || new Map();
|
|
71
|
-
this.#activeSessions = deps.activeSessions || new Map();
|
|
72
|
-
this.#modelId =
|
|
73
|
-
deps.modelId ||
|
|
74
|
-
this.#settingsService.get('agent.github-copilot.model') ||
|
|
75
|
-
this.#settingsService.get('agent.model') ||
|
|
76
|
-
'gpt-4o';
|
|
77
|
-
}
|
|
78
|
-
async getResponse(request) {
|
|
79
|
-
// For non-streaming requests, collect all events and build response
|
|
80
|
-
const events = [];
|
|
81
|
-
for await (const event of this.getStreamedResponse(request)) {
|
|
82
|
-
events.push(event);
|
|
83
|
-
}
|
|
84
|
-
// Find the response_done event
|
|
85
|
-
const doneEvent = events.find((e) => e.type === 'response_done');
|
|
86
|
-
if (doneEvent?.response) {
|
|
87
|
-
return {
|
|
88
|
-
responseId: doneEvent.response.id || randomUUID(),
|
|
89
|
-
output: doneEvent.response.output || [],
|
|
90
|
-
usage: normalizeUsage(doneEvent.response.usage),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
// Fallback: build response from accumulated events
|
|
94
|
-
const textDeltas = events
|
|
95
|
-
.filter((e) => e.type === 'output_text_delta')
|
|
96
|
-
.map((e) => e.delta)
|
|
97
|
-
.join('');
|
|
98
|
-
return {
|
|
99
|
-
responseId: randomUUID(),
|
|
100
|
-
output: textDeltas ? [{
|
|
101
|
-
type: 'message',
|
|
102
|
-
role: 'assistant',
|
|
103
|
-
status: 'completed',
|
|
104
|
-
content: [{ type: 'output_text', text: textDeltas }],
|
|
105
|
-
}] : [],
|
|
106
|
-
usage: normalizeUsage({}),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
async *getStreamedResponse(request) {
|
|
110
|
-
const client = await getClient();
|
|
111
|
-
const resolvedModelId = this.#resolveModelFromRequest(request) || this.#modelId;
|
|
112
|
-
const messages = buildMessagesFromRequest(request, resolvedModelId, this.#loggingService);
|
|
113
|
-
this.#loggingService.debug('GitHubCopilot stream start', {
|
|
114
|
-
messageCount: messages.length,
|
|
115
|
-
modelId: resolvedModelId,
|
|
116
|
-
previousResponseId: request.previousResponseId,
|
|
117
|
-
});
|
|
118
|
-
const tools = extractFunctionToolsFromRequest(request);
|
|
119
|
-
// Wrap tools with the "Trap" handler that suspends execution
|
|
120
|
-
const copilotTools = tools.map((t) => ({
|
|
121
|
-
name: t.function.name,
|
|
122
|
-
description: t.function.description,
|
|
123
|
-
parameters: t.function.parameters,
|
|
124
|
-
handler: async (_args, invocation) => {
|
|
125
|
-
this.#loggingService.debug('Copilot tool trap activated', {
|
|
126
|
-
tool: invocation.toolName,
|
|
127
|
-
callId: invocation.toolCallId,
|
|
128
|
-
});
|
|
129
|
-
return new Promise((resolve) => {
|
|
130
|
-
if (!pendingResolutions.has(invocation.sessionId)) {
|
|
131
|
-
pendingResolutions.set(invocation.sessionId, new Map());
|
|
132
|
-
}
|
|
133
|
-
pendingResolutions.get(invocation.sessionId).set(invocation.toolCallId, resolve);
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
}));
|
|
137
|
-
let session;
|
|
138
|
-
try {
|
|
139
|
-
// Check if we can resume a previous session
|
|
140
|
-
const prevSessionId = request.previousResponseId
|
|
141
|
-
? this.#sessionMap.get(request.previousResponseId)
|
|
142
|
-
: undefined;
|
|
143
|
-
// First, try to get a cached session object
|
|
144
|
-
const cachedSession = prevSessionId
|
|
145
|
-
? this.#activeSessions.get(prevSessionId)
|
|
146
|
-
: undefined;
|
|
147
|
-
if (cachedSession) {
|
|
148
|
-
// Reuse the cached session - just update tool handlers with fresh callbacks
|
|
149
|
-
this.#loggingService.debug('Reusing cached GitHubCopilot session', {
|
|
150
|
-
sessionId: prevSessionId,
|
|
151
|
-
});
|
|
152
|
-
session = cachedSession;
|
|
153
|
-
// Re-register tools to get fresh Promise callbacks for this turn
|
|
154
|
-
session.registerTools(copilotTools);
|
|
155
|
-
}
|
|
156
|
-
else if (prevSessionId) {
|
|
157
|
-
// Session ID exists but no cached object - need to resume from server
|
|
158
|
-
this.#loggingService.debug('Resuming GitHubCopilot session from server', {
|
|
159
|
-
sessionId: prevSessionId,
|
|
160
|
-
});
|
|
161
|
-
session = await client.resumeSession(prevSessionId, {
|
|
162
|
-
streaming: true,
|
|
163
|
-
tools: copilotTools,
|
|
164
|
-
});
|
|
165
|
-
// Cache the resumed session for future turns
|
|
166
|
-
this.#activeSessions.set(session.sessionId, session);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// No previous session - create a new one
|
|
170
|
-
this.#loggingService.debug('Creating new GitHubCopilot session');
|
|
171
|
-
session = await client.createSession({
|
|
172
|
-
model: resolvedModelId,
|
|
173
|
-
streaming: true,
|
|
174
|
-
tools: copilotTools,
|
|
175
|
-
availableTools: copilotTools.map((t) => t.name),
|
|
176
|
-
systemMessage: {
|
|
177
|
-
mode: 'replace',
|
|
178
|
-
content: SIMPLE_PROMPT,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
// Cache the new session for future turns
|
|
182
|
-
this.#activeSessions.set(session.sessionId, session);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
catch (err) {
|
|
186
|
-
this.#loggingService.error('GitHubCopilot session creation/resumption failed', {
|
|
187
|
-
error: err.message,
|
|
188
|
-
});
|
|
189
|
-
// Emit error as a model event since ResponseStreamEvent doesn't have error type
|
|
190
|
-
yield {
|
|
191
|
-
type: 'model',
|
|
192
|
-
event: { type: 'error', message: `Failed to create/resume Copilot session: ${err.message}` },
|
|
193
|
-
};
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const state = {
|
|
197
|
-
accumulated: '',
|
|
198
|
-
accumulatedReasoningText: '',
|
|
199
|
-
accumulatedToolCalls: [],
|
|
200
|
-
responseId: randomUUID(),
|
|
201
|
-
usageData: null,
|
|
202
|
-
};
|
|
203
|
-
// Track new sessionId for future resumption
|
|
204
|
-
this.#sessionMap.set(state.responseId, session.sessionId);
|
|
205
|
-
// Set up event handlers and collect events via async iteration
|
|
206
|
-
const eventQueue = [];
|
|
207
|
-
let resolveNext = null;
|
|
208
|
-
let done = false;
|
|
209
|
-
let error = null;
|
|
210
|
-
const pushEvent = (event) => {
|
|
211
|
-
if (resolveNext) {
|
|
212
|
-
resolveNext({ value: event, done: false });
|
|
213
|
-
resolveNext = null;
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
eventQueue.push(event);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
// Track unsubscribe function for cleanup
|
|
220
|
-
let unsubscribeEvents = null;
|
|
221
|
-
const finish = (err) => {
|
|
222
|
-
done = true;
|
|
223
|
-
error = err || null;
|
|
224
|
-
// Unsubscribe from events to prevent handler accumulation
|
|
225
|
-
if (unsubscribeEvents) {
|
|
226
|
-
unsubscribeEvents();
|
|
227
|
-
unsubscribeEvents = null;
|
|
228
|
-
}
|
|
229
|
-
// If there was an error, remove session from cache so a fresh one is created next time
|
|
230
|
-
if (err && session) {
|
|
231
|
-
this.#activeSessions.delete(session.sessionId);
|
|
232
|
-
}
|
|
233
|
-
if (resolveNext) {
|
|
234
|
-
if (err) {
|
|
235
|
-
resolveNext = null;
|
|
236
|
-
throw err;
|
|
237
|
-
}
|
|
238
|
-
resolveNext({ value: undefined, done: true });
|
|
239
|
-
resolveNext = null;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
// Register event handlers on the session (returns unsubscribe function)
|
|
243
|
-
unsubscribeEvents = session.on((event) => {
|
|
244
|
-
try {
|
|
245
|
-
switch (event.type) {
|
|
246
|
-
case 'assistant.message_delta':
|
|
247
|
-
// Streaming text chunk
|
|
248
|
-
if (event.data?.deltaContent) {
|
|
249
|
-
const delta = extractCopilotTextDelta(state.accumulated, event.data.deltaContent);
|
|
250
|
-
if (delta) {
|
|
251
|
-
state.accumulated += delta;
|
|
252
|
-
pushEvent({
|
|
253
|
-
type: 'output_text_delta',
|
|
254
|
-
delta,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
break;
|
|
259
|
-
case 'assistant.reasoning_delta':
|
|
260
|
-
// Streaming reasoning (O1/O3 models)
|
|
261
|
-
if (event.data?.deltaContent) {
|
|
262
|
-
state.accumulatedReasoningText += event.data.deltaContent;
|
|
263
|
-
// Emit as model event for reasoning channel
|
|
264
|
-
pushEvent({
|
|
265
|
-
type: 'model',
|
|
266
|
-
event: {
|
|
267
|
-
type: 'reasoning_delta',
|
|
268
|
-
content: event.data.deltaContent,
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
case 'tool.execution_start':
|
|
274
|
-
// Tool call requested
|
|
275
|
-
if (event.data) {
|
|
276
|
-
const toolCall = {
|
|
277
|
-
type: 'function_call',
|
|
278
|
-
callId: event.data.callId || randomUUID(),
|
|
279
|
-
name: event.data.toolName,
|
|
280
|
-
arguments: typeof event.data.args === 'string'
|
|
281
|
-
? event.data.args
|
|
282
|
-
: JSON.stringify(event.data.args || {}),
|
|
283
|
-
};
|
|
284
|
-
state.accumulatedToolCalls.push(toolCall);
|
|
285
|
-
// Check if this is a user tool that requires external handling
|
|
286
|
-
// We look it up in our 'copilotTools' list
|
|
287
|
-
const isUserTool = copilotTools.some((t) => t.name === event.data.toolName);
|
|
288
|
-
if (isUserTool) {
|
|
289
|
-
this.#loggingService.debug('Detaching stream for user tool execution', {
|
|
290
|
-
tool: event.data.toolName,
|
|
291
|
-
callId: toolCall.callId,
|
|
292
|
-
});
|
|
293
|
-
// Yield the function call event to the Runner (streaming)
|
|
294
|
-
pushEvent({
|
|
295
|
-
type: 'model',
|
|
296
|
-
event: {
|
|
297
|
-
type: 'function_call',
|
|
298
|
-
callId: toolCall.callId,
|
|
299
|
-
name: toolCall.name,
|
|
300
|
-
arguments: toolCall.arguments,
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
// IMPORTANT: Emit response_done so the Runner captures the responseId.
|
|
304
|
-
// This allows the next turn to pass 'previousResponseId' correctly,
|
|
305
|
-
// which we need to look up the session and resume the suspended tool.
|
|
306
|
-
const output = this.#buildStreamOutput(state);
|
|
307
|
-
pushEvent({
|
|
308
|
-
type: 'response_done',
|
|
309
|
-
response: {
|
|
310
|
-
id: state.responseId,
|
|
311
|
-
usage: normalizeUsage(state.usageData),
|
|
312
|
-
output,
|
|
313
|
-
},
|
|
314
|
-
});
|
|
315
|
-
// SIGNAL COMPLETION OF THIS STREAM SEGMENT
|
|
316
|
-
finish();
|
|
317
|
-
return; // Stop processing further events in this loop
|
|
318
|
-
}
|
|
319
|
-
// If it's an internal tool (like report_intent), we just let it run
|
|
320
|
-
// The SDK will call the internal handler, get the result, and continue streaming
|
|
321
|
-
// We don't emit anything to the Runner yet.
|
|
322
|
-
}
|
|
323
|
-
break;
|
|
324
|
-
case 'session.usage':
|
|
325
|
-
// Usage data
|
|
326
|
-
if (event.data) {
|
|
327
|
-
state.usageData = event.data;
|
|
328
|
-
}
|
|
329
|
-
break;
|
|
330
|
-
case 'session.idle':
|
|
331
|
-
// Session complete - emit response_done
|
|
332
|
-
this.#loggingService.debug('GitHubCopilot stream done', {
|
|
333
|
-
text: state.accumulated,
|
|
334
|
-
toolCalls: state.accumulatedToolCalls.length,
|
|
335
|
-
});
|
|
336
|
-
const output = this.#buildStreamOutput(state);
|
|
337
|
-
pushEvent({
|
|
338
|
-
type: 'response_done',
|
|
339
|
-
response: {
|
|
340
|
-
id: state.responseId,
|
|
341
|
-
usage: normalizeUsage(state.usageData),
|
|
342
|
-
output,
|
|
343
|
-
},
|
|
344
|
-
});
|
|
345
|
-
finish();
|
|
346
|
-
break;
|
|
347
|
-
case 'session.error':
|
|
348
|
-
// Handle errors
|
|
349
|
-
this.#loggingService.error('GitHubCopilot session error', {
|
|
350
|
-
error: event.data?.message,
|
|
351
|
-
});
|
|
352
|
-
// Emit error as a model event since ResponseStreamEvent doesn't have error type
|
|
353
|
-
pushEvent({
|
|
354
|
-
type: 'model',
|
|
355
|
-
event: { type: 'error', message: event.data?.message || 'Unknown error' },
|
|
356
|
-
});
|
|
357
|
-
finish(new Error(event.data?.message || 'Session error'));
|
|
358
|
-
break;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
catch (err) {
|
|
362
|
-
this.#loggingService.error('GitHubCopilot event processing error', {
|
|
363
|
-
error: err.message,
|
|
364
|
-
eventType: event.type,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
// Send the messages to start the conversation
|
|
369
|
-
// Check if we are in "Resume/Tool Output" mode
|
|
370
|
-
const sessionResolutions = pendingResolutions.get(session.sessionId);
|
|
371
|
-
let isResumingTool = false;
|
|
372
|
-
if (sessionResolutions && sessionResolutions.size > 0) {
|
|
373
|
-
// Look for tool outputs in the request input that match pending traps
|
|
374
|
-
// The Runner appends the output to the history
|
|
375
|
-
if (request.input && Array.isArray(request.input)) {
|
|
376
|
-
for (const item of request.input) {
|
|
377
|
-
// Check for function_call_output type (mapped from SDK)
|
|
378
|
-
if (item.type === 'function_call_output' &&
|
|
379
|
-
item.callId &&
|
|
380
|
-
sessionResolutions.has(item.callId)) {
|
|
381
|
-
const callId = item.callId;
|
|
382
|
-
const output = item.output;
|
|
383
|
-
this.#loggingService.debug('Resolving suspended tool call', {
|
|
384
|
-
callId,
|
|
385
|
-
outputLength: output?.length,
|
|
386
|
-
});
|
|
387
|
-
const resolve = sessionResolutions.get(callId);
|
|
388
|
-
resolve(output); // UNBLOCK the SDK handler!
|
|
389
|
-
sessionResolutions.delete(callId);
|
|
390
|
-
isResumingTool = true;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
// Only send a new prompt if we are NOT resuming a tool call
|
|
396
|
-
if (!isResumingTool) {
|
|
397
|
-
try {
|
|
398
|
-
// Build the prompt from the last user message
|
|
399
|
-
const lastUserMessage = messages.filter(m => m.role === 'user').pop();
|
|
400
|
-
const prompt = lastUserMessage?.content || '';
|
|
401
|
-
if (prompt) {
|
|
402
|
-
await session.send({
|
|
403
|
-
prompt,
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
// If no prompt and no tool resume, we might assume it's just a continue?
|
|
408
|
-
// Or maybe we should send an empty space to trigger generation?
|
|
409
|
-
// For now, assume if prompt is empty it might be an issue, but let's try sending it.
|
|
410
|
-
// Actually Copilot SDK might error on empty prompt.
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
catch (err) {
|
|
414
|
-
this.#loggingService.error('GitHubCopilot send failed', {
|
|
415
|
-
error: err.message,
|
|
416
|
-
});
|
|
417
|
-
yield {
|
|
418
|
-
type: 'model',
|
|
419
|
-
event: { type: 'error', message: `Failed to send message: ${err.message}` },
|
|
420
|
-
};
|
|
421
|
-
try {
|
|
422
|
-
await session.abort();
|
|
423
|
-
}
|
|
424
|
-
catch {
|
|
425
|
-
// Ignore abort errors
|
|
426
|
-
}
|
|
427
|
-
// Clean up event handler before returning
|
|
428
|
-
if (unsubscribeEvents) {
|
|
429
|
-
unsubscribeEvents();
|
|
430
|
-
unsubscribeEvents = null;
|
|
431
|
-
}
|
|
432
|
-
// Remove session from cache on error
|
|
433
|
-
this.#activeSessions.delete(session.sessionId);
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
// If isResumingTool is true, we simply let the event loop below capture the continuation events!
|
|
438
|
-
// Yield events as they come in
|
|
439
|
-
while (!done || eventQueue.length > 0) {
|
|
440
|
-
if (eventQueue.length > 0) {
|
|
441
|
-
yield eventQueue.shift();
|
|
442
|
-
}
|
|
443
|
-
else if (!done) {
|
|
444
|
-
// Wait for next event
|
|
445
|
-
yield await new Promise((resolve) => {
|
|
446
|
-
resolveNext = (result) => {
|
|
447
|
-
if (result.done) {
|
|
448
|
-
// Signal completion
|
|
449
|
-
resolve({ type: 'model', event: '[DONE]' });
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
resolve(result.value);
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
if (error) {
|
|
459
|
-
throw error;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
#buildStreamOutput(state) {
|
|
463
|
-
const output = [];
|
|
464
|
-
// Add assistant message if there's text content
|
|
465
|
-
if (state.accumulated) {
|
|
466
|
-
output.push({
|
|
467
|
-
type: 'message',
|
|
468
|
-
role: 'assistant',
|
|
469
|
-
status: 'completed',
|
|
470
|
-
content: [{ type: 'output_text', text: state.accumulated }],
|
|
471
|
-
...(state.accumulatedReasoningText
|
|
472
|
-
? { reasoning: state.accumulatedReasoningText }
|
|
473
|
-
: {}),
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
// Add tool calls as separate output items
|
|
477
|
-
for (const toolCall of state.accumulatedToolCalls) {
|
|
478
|
-
output.push({
|
|
479
|
-
type: 'function_call',
|
|
480
|
-
callId: toolCall.callId,
|
|
481
|
-
name: toolCall.name,
|
|
482
|
-
arguments: toolCall.arguments,
|
|
483
|
-
status: 'completed',
|
|
484
|
-
...(state.accumulatedReasoningText
|
|
485
|
-
? { reasoning: state.accumulatedReasoningText }
|
|
486
|
-
: {}),
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
return output;
|
|
490
|
-
}
|
|
491
|
-
#resolveModelFromRequest(req) {
|
|
492
|
-
if (req?.providerData?.model) {
|
|
493
|
-
return req.providerData.model;
|
|
494
|
-
}
|
|
495
|
-
return undefined;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
//# sourceMappingURL=model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../source/providers/github-copilot/model.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAuB,MAAM,qBAAqB,CAAC;AAEzE,yDAAyD;AACzD,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;AACrF,MAAM,aAAa,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;AAK1E,OAAO,EACH,wBAAwB,EACxB,+BAA+B,EAC/B,cAAc,GACjB,MAAM,iBAAiB,CAAC;AAEzB,uFAAuF;AACvF,6EAA6E;AAC7E,8DAA8D;AAC9D,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAA8C,CAAC;AAEjF,uDAAuD;AACvD,MAAM,CAAC,IAAI,YAAY,GAAyB,IAAI,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,SAAS;IAC3B,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,YAAY,GAAG,IAAI,aAAa,EAAE,CAAC;QACnC,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,YAAY,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,WAAmB,EAAE,QAAgB;IACzE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW;QAAE,OAAO,QAAQ,CAAC;IAElC,0EAA0E;IAC1E,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,C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