@codemieai/code 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -56
- package/bin/codemie-copilot.js +224 -0
- package/bin/codemie-pi.js +18 -0
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +16 -10
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +43 -19
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/agent-aliases.d.ts +17 -0
- package/dist/agents/core/agent-aliases.d.ts.map +1 -0
- package/dist/agents/core/agent-aliases.js +41 -0
- package/dist/agents/core/agent-aliases.js.map +1 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts +19 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
- package/dist/agents/core/session/session-origin-audit.d.ts +13 -0
- package/dist/agents/core/session/session-origin-audit.d.ts.map +1 -1
- package/dist/agents/core/session/session-origin-audit.js +34 -0
- package/dist/agents/core/session/session-origin-audit.js.map +1 -1
- package/dist/agents/core/session/stale-session-reconciliation.d.ts +42 -0
- package/dist/agents/core/session/stale-session-reconciliation.d.ts.map +1 -0
- package/dist/agents/core/session/stale-session-reconciliation.js +141 -0
- package/dist/agents/core/session/stale-session-reconciliation.js.map +1 -0
- package/dist/agents/core/session/types.d.ts +19 -0
- package/dist/agents/core/session/types.d.ts.map +1 -1
- package/dist/agents/core/session/types.js +17 -1
- package/dist/agents/core/session/types.js.map +1 -1
- package/dist/agents/core/types.d.ts +11 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex.reconciliation.d.ts +15 -35
- package/dist/agents/plugins/codex/codex.reconciliation.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex.reconciliation.js +8 -139
- package/dist/agents/plugins/codex/codex.reconciliation.js.map +1 -1
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.d.ts +146 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.js +12 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.d.ts +15 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.js +15 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.d.ts +8 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.js +195 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.d.ts +11 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.js +21 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts +14 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js +263 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.d.ts +43 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.js +343 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.d.ts +10 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.js +41 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.d.ts +37 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.js +96 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.d.ts +17 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.js +58 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/index.d.ts +3 -0
- package/dist/agents/plugins/copilot-cli/index.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/index.js +3 -0
- package/dist/agents/plugins/copilot-cli/index.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.d.ts +18 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.js +313 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.d.ts +16 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.js +22 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.js.map +1 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.d.ts +12 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.d.ts.map +1 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.js +27 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.js.map +1 -0
- package/dist/agents/plugins/pi/extension/README.md +68 -0
- package/dist/agents/plugins/pi/extension/index.js +161 -0
- package/dist/agents/plugins/pi/extension/package.json +8 -0
- package/dist/agents/plugins/pi/index.d.ts +3 -0
- package/dist/agents/plugins/pi/index.d.ts.map +1 -0
- package/dist/agents/plugins/pi/index.js +3 -0
- package/dist/agents/plugins/pi/index.js.map +1 -0
- package/dist/agents/plugins/pi/pi.extension.d.ts +60 -0
- package/dist/agents/plugins/pi/pi.extension.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.extension.js +201 -0
- package/dist/agents/plugins/pi/pi.extension.js.map +1 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.d.ts +63 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.js +266 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.js.map +1 -0
- package/dist/agents/plugins/pi/pi.models.d.ts +20 -0
- package/dist/agents/plugins/pi/pi.models.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.models.js +201 -0
- package/dist/agents/plugins/pi/pi.models.js.map +1 -0
- package/dist/agents/plugins/pi/pi.packages.d.ts +11 -0
- package/dist/agents/plugins/pi/pi.packages.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.packages.js +35 -0
- package/dist/agents/plugins/pi/pi.packages.js.map +1 -0
- package/dist/agents/plugins/pi/pi.paths.d.ts +37 -0
- package/dist/agents/plugins/pi/pi.paths.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.paths.js +146 -0
- package/dist/agents/plugins/pi/pi.paths.js.map +1 -0
- package/dist/agents/plugins/pi/pi.plugin.d.ts +30 -0
- package/dist/agents/plugins/pi/pi.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.plugin.js +453 -0
- package/dist/agents/plugins/pi/pi.plugin.js.map +1 -0
- package/dist/agents/plugins/pi/pi.session.d.ts +114 -0
- package/dist/agents/plugins/pi/pi.session.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.session.js +388 -0
- package/dist/agents/plugins/pi/pi.session.js.map +1 -0
- package/dist/agents/plugins/pi/pi.setup.d.ts +2 -0
- package/dist/agents/plugins/pi/pi.setup.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.setup.js +33 -0
- package/dist/agents/plugins/pi/pi.setup.js.map +1 -0
- package/dist/agents/plugins/pi/pi.types.d.ts +143 -0
- package/dist/agents/plugins/pi/pi.types.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.types.js +74 -0
- package/dist/agents/plugins/pi/pi.types.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.d.ts +17 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.js +98 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.d.ts +52 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.js +189 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.d.ts +14 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.js +51 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.js.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.d.ts +52 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.js +716 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.d.ts +104 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.js +595 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.js.map +1 -0
- package/dist/agents/registry.d.ts +20 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +29 -2
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/analytics/agent-labels.d.ts +3 -0
- package/dist/cli/commands/analytics/agent-labels.d.ts.map +1 -0
- package/dist/cli/commands/analytics/agent-labels.js +20 -0
- package/dist/cli/commands/analytics/agent-labels.js.map +1 -0
- package/dist/cli/commands/analytics/cost/cost-enricher.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/cost-enricher.js +12 -0
- package/dist/cli/commands/analytics/cost/cost-enricher.js.map +1 -1
- package/dist/cli/commands/analytics/cost/types.d.ts +10 -0
- package/dist/cli/commands/analytics/cost/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts +24 -0
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.js +253 -54
- package/dist/cli/commands/analytics/cost/usage-readers.js.map +1 -1
- package/dist/cli/commands/analytics/formatter.d.ts.map +1 -1
- package/dist/cli/commands/analytics/formatter.js +10 -2
- package/dist/cli/commands/analytics/formatter.js.map +1 -1
- package/dist/cli/commands/analytics/index.d.ts.map +1 -1
- package/dist/cli/commands/analytics/index.js +22 -0
- package/dist/cli/commands/analytics/index.js.map +1 -1
- package/dist/cli/commands/analytics/native-loader.d.ts +21 -4
- package/dist/cli/commands/analytics/native-loader.d.ts.map +1 -1
- package/dist/cli/commands/analytics/native-loader.js +267 -88
- package/dist/cli/commands/analytics/native-loader.js.map +1 -1
- package/dist/cli/commands/analytics/report/client/app.js +77 -15
- package/dist/cli/commands/analytics/report/payload-builder.d.ts.map +1 -1
- package/dist/cli/commands/analytics/report/payload-builder.js +32 -2
- package/dist/cli/commands/analytics/report/payload-builder.js.map +1 -1
- package/dist/cli/commands/analytics/report/types.d.ts +11 -0
- package/dist/cli/commands/analytics/report/types.d.ts.map +1 -1
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +71 -29
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +9 -7
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +4 -2
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +3 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +87 -63
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +6 -4
- package/dist/cli/commands/uninstall.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +7 -5
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/first-time.d.ts.map +1 -1
- package/dist/cli/first-time.js +10 -9
- package/dist/cli/first-time.js.map +1 -1
- package/dist/providers/core/auth-validation.d.ts +7 -2
- package/dist/providers/core/auth-validation.d.ts.map +1 -1
- package/dist/providers/core/auth-validation.js +11 -5
- package/dist/providers/core/auth-validation.js.map +1 -1
- package/dist/providers/core/types.d.ts +16 -0
- package/dist/providers/core/types.d.ts.map +1 -1
- package/dist/providers/core/types.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts +8 -3
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js +46 -11
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.d.ts +23 -13
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.js +75 -18
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.d.ts +21 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.d.ts.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.js +133 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts +2 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.js +4 -2
- package/dist/providers/plugins/sso/proxy/plugins/index.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/types.d.ts +11 -0
- package/dist/providers/plugins/sso/proxy/plugins/types.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.d.ts +2 -0
- package/dist/providers/plugins/sso/proxy/sso.proxy.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.js +37 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.js.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.js +13 -0
- package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js +6 -0
- package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.d.ts +0 -6
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.js +28 -19
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +39 -22
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/utils/interactive.d.ts +14 -0
- package/dist/utils/interactive.d.ts.map +1 -0
- package/dist/utils/interactive.js +16 -0
- package/dist/utils/interactive.js.map +1 -0
- package/package.json +6 -5
- package/scripts/copy-plugins.js +6 -0
- package/scripts/release.sh +54 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shapes for GitHub Copilot CLI local session state.
|
|
3
|
+
*
|
|
4
|
+
* Two sources per session directory (`~/.copilot/session-state/<uuid>/`):
|
|
5
|
+
* - `workspace.yaml` — manifest; present in every session directory
|
|
6
|
+
* - `events.jsonl` — transcript; present only from the schema-bearing CLI versions
|
|
7
|
+
*
|
|
8
|
+
* The `events.jsonl` schema is undocumented by GitHub. Every field is therefore optional
|
|
9
|
+
* and every consumer must degrade rather than throw.
|
|
10
|
+
*/
|
|
11
|
+
/** Parsed `~/.copilot/session-state/<uuid>/workspace.yaml`. */
|
|
12
|
+
export interface CopilotWorkspaceManifest {
|
|
13
|
+
id: string;
|
|
14
|
+
cwd?: string;
|
|
15
|
+
gitRoot?: string;
|
|
16
|
+
repository?: string;
|
|
17
|
+
hostType?: string;
|
|
18
|
+
branch?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Epoch ms. */
|
|
21
|
+
createdAt?: number;
|
|
22
|
+
/** Epoch ms. */
|
|
23
|
+
updatedAt?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Raw `workspace.yaml` key shape, before camelCase normalization. */
|
|
26
|
+
export interface RawWorkspaceYaml {
|
|
27
|
+
id?: string;
|
|
28
|
+
cwd?: string;
|
|
29
|
+
git_root?: string;
|
|
30
|
+
repository?: string;
|
|
31
|
+
host_type?: string;
|
|
32
|
+
branch?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
created_at?: string;
|
|
35
|
+
updated_at?: string;
|
|
36
|
+
}
|
|
37
|
+
/** One line of `events.jsonl`. */
|
|
38
|
+
export interface CopilotEvent {
|
|
39
|
+
type?: string;
|
|
40
|
+
data?: unknown;
|
|
41
|
+
id?: string;
|
|
42
|
+
parentId?: string | null;
|
|
43
|
+
timestamp?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Per-model usage buckets exactly as Copilot writes them.
|
|
47
|
+
*
|
|
48
|
+
* These follow the OpenAI convention: `inputTokens` is INCLUSIVE of `cacheReadTokens`,
|
|
49
|
+
* and `reasoningTokens` is a subset of `outputTokens`. Copilot applies that convention to
|
|
50
|
+
* every provider it proxies, including Anthropic models. Conversion into the repository's
|
|
51
|
+
* Anthropic-convention `TokenUsage` happens in exactly one place — `readCopilotCli` in
|
|
52
|
+
* `src/cli/commands/analytics/cost/usage-readers.ts`.
|
|
53
|
+
*/
|
|
54
|
+
export interface CopilotUsageBuckets {
|
|
55
|
+
inputTokens?: number;
|
|
56
|
+
outputTokens?: number;
|
|
57
|
+
cacheReadTokens?: number;
|
|
58
|
+
cacheWriteTokens?: number;
|
|
59
|
+
reasoningTokens?: number;
|
|
60
|
+
}
|
|
61
|
+
/** `data` of a `session.shutdown` event — the authoritative per-model usage rollup. */
|
|
62
|
+
export interface CopilotShutdownData {
|
|
63
|
+
shutdownType?: string;
|
|
64
|
+
/** GitHub's actual billing unit; does not track token volume. */
|
|
65
|
+
totalPremiumRequests?: number;
|
|
66
|
+
totalApiDurationMs?: number;
|
|
67
|
+
codeChanges?: {
|
|
68
|
+
linesAdded?: number;
|
|
69
|
+
linesRemoved?: number;
|
|
70
|
+
filesModified?: string[];
|
|
71
|
+
};
|
|
72
|
+
modelMetrics?: Record<string, {
|
|
73
|
+
requests?: {
|
|
74
|
+
count?: number;
|
|
75
|
+
cost?: number;
|
|
76
|
+
};
|
|
77
|
+
usage?: CopilotUsageBuckets;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/** `data` of a `session.start` event. */
|
|
81
|
+
export interface CopilotSessionStartData {
|
|
82
|
+
sessionId?: string;
|
|
83
|
+
copilotVersion?: string;
|
|
84
|
+
producer?: string;
|
|
85
|
+
startTime?: string;
|
|
86
|
+
context?: {
|
|
87
|
+
cwd?: string;
|
|
88
|
+
gitRoot?: string;
|
|
89
|
+
branch?: string;
|
|
90
|
+
headCommit?: string;
|
|
91
|
+
repository?: string;
|
|
92
|
+
hostType?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** `data` of an `assistant.message` event — the per-turn fallback token source. */
|
|
96
|
+
export interface CopilotAssistantMessageData {
|
|
97
|
+
messageId?: string;
|
|
98
|
+
model?: string;
|
|
99
|
+
turnId?: string;
|
|
100
|
+
/** Present per turn; sums exactly to the shutdown rollup's `outputTokens`. */
|
|
101
|
+
outputTokens?: number;
|
|
102
|
+
requestId?: string;
|
|
103
|
+
toolRequests?: Array<{
|
|
104
|
+
toolCallId?: string;
|
|
105
|
+
name?: string;
|
|
106
|
+
arguments?: unknown;
|
|
107
|
+
}>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `data` of a `tool.execution_start` event.
|
|
111
|
+
*
|
|
112
|
+
* The tool NAME and arguments live here only — `tool.execution_complete` carries neither,
|
|
113
|
+
* so the two events must be paired by `toolCallId` to attribute a call to a tool.
|
|
114
|
+
*/
|
|
115
|
+
export interface CopilotToolStartData {
|
|
116
|
+
toolCallId?: string;
|
|
117
|
+
toolName?: string;
|
|
118
|
+
turnId?: string;
|
|
119
|
+
arguments?: {
|
|
120
|
+
path?: string;
|
|
121
|
+
/** Present on `create`. */
|
|
122
|
+
file_text?: string;
|
|
123
|
+
/** Present on `edit`. */
|
|
124
|
+
old_str?: string;
|
|
125
|
+
new_str?: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* `data` of a `tool.execution_complete` event.
|
|
130
|
+
*
|
|
131
|
+
* Outcome is the boolean `success` — there is no `status` string and no tool name.
|
|
132
|
+
*/
|
|
133
|
+
export interface CopilotToolCompleteData {
|
|
134
|
+
toolCallId?: string;
|
|
135
|
+
success?: boolean;
|
|
136
|
+
error?: unknown;
|
|
137
|
+
result?: unknown;
|
|
138
|
+
model?: string;
|
|
139
|
+
turnId?: string;
|
|
140
|
+
}
|
|
141
|
+
/** `data` of a `skill.invoked` event — feeds the report's session-source classification. */
|
|
142
|
+
export interface CopilotSkillInvokedData {
|
|
143
|
+
skill?: string;
|
|
144
|
+
name?: string;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=copilot-cli-event-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli-event-types.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli-event-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,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,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,4FAA4F;AAC5F,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shapes for GitHub Copilot CLI local session state.
|
|
3
|
+
*
|
|
4
|
+
* Two sources per session directory (`~/.copilot/session-state/<uuid>/`):
|
|
5
|
+
* - `workspace.yaml` — manifest; present in every session directory
|
|
6
|
+
* - `events.jsonl` — transcript; present only from the schema-bearing CLI versions
|
|
7
|
+
*
|
|
8
|
+
* The `events.jsonl` schema is undocumented by GitHub. Every field is therefore optional
|
|
9
|
+
* and every consumer must degrade rather than throw.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=copilot-cli-event-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli-event-types.js","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli-event-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Copilot CLI identifiers.
|
|
3
|
+
*
|
|
4
|
+
* These live apart from `copilot-cli.plugin.ts` so the session adapter can use them
|
|
5
|
+
* without importing the plugin, which imports the adapter — a cycle.
|
|
6
|
+
*/
|
|
7
|
+
/** Internal agent key. Disambiguates the CLI from the VS Code / JetBrains extensions. */
|
|
8
|
+
export declare const COPILOT_CLI_AGENT_NAME = "copilot-cli";
|
|
9
|
+
/** User-facing label shown in the analytics report and terminal output. */
|
|
10
|
+
export declare const COPILOT_CLI_DISPLAY_NAME = "GitHub Copilot CLI";
|
|
11
|
+
/** User-facing short name used by install/uninstall surfaces. */
|
|
12
|
+
export declare const COPILOT_CLI_INSTALL_ALIAS = "copilot";
|
|
13
|
+
/** Runtime client type used for managed Copilot sessions. */
|
|
14
|
+
export declare const COPILOT_CLI_CLIENT_TYPE = "codemie-copilot";
|
|
15
|
+
//# sourceMappingURL=copilot-cli.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.constants.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,iEAAiE;AACjE,eAAO,MAAM,yBAAyB,YAAY,CAAC;AAEnD,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Copilot CLI identifiers.
|
|
3
|
+
*
|
|
4
|
+
* These live apart from `copilot-cli.plugin.ts` so the session adapter can use them
|
|
5
|
+
* without importing the plugin, which imports the adapter — a cycle.
|
|
6
|
+
*/
|
|
7
|
+
/** Internal agent key. Disambiguates the CLI from the VS Code / JetBrains extensions. */
|
|
8
|
+
export const COPILOT_CLI_AGENT_NAME = 'copilot-cli';
|
|
9
|
+
/** User-facing label shown in the analytics report and terminal output. */
|
|
10
|
+
export const COPILOT_CLI_DISPLAY_NAME = 'GitHub Copilot CLI';
|
|
11
|
+
/** User-facing short name used by install/uninstall surfaces. */
|
|
12
|
+
export const COPILOT_CLI_INSTALL_ALIAS = 'copilot';
|
|
13
|
+
/** Runtime client type used for managed Copilot sessions. */
|
|
14
|
+
export const COPILOT_CLI_CLIENT_TYPE = 'codemie-copilot';
|
|
15
|
+
//# sourceMappingURL=copilot-cli.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.constants.js","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEpD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,iEAAiE;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAEnD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CopilotModelResolution {
|
|
2
|
+
selectedModel: string;
|
|
3
|
+
availableModels: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare function isCopilotCompatibleModelName(modelName: string | undefined): modelName is string;
|
|
6
|
+
export declare function resolveCopilotModel(env: NodeJS.ProcessEnv): Promise<CopilotModelResolution>;
|
|
7
|
+
export declare function assertExplicitCopilotModelAllowed(model: string, availableModels: string[]): void;
|
|
8
|
+
//# sourceMappingURL=copilot-cli.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.models.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.models.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AA6CD,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,IAAI,MAAM,CAO/F;AAgHD,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqDjG;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAehG"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { fetchCodeMieLlmModels } from '../../../providers/plugins/sso/sso.http-client.js';
|
|
2
|
+
import { CodeMieSSO } from '../../../providers/plugins/sso/sso.auth.js';
|
|
3
|
+
import { ConfigurationError } from '../../../utils/errors.js';
|
|
4
|
+
import { logger } from '../../../utils/logger.js';
|
|
5
|
+
const COPILOT_INCOMPATIBLE_MODEL_PATTERNS = [
|
|
6
|
+
/embedding/i,
|
|
7
|
+
/rerank/i,
|
|
8
|
+
/whisper/i,
|
|
9
|
+
/tts/i,
|
|
10
|
+
/moderation/i,
|
|
11
|
+
/image/i,
|
|
12
|
+
/vision-only/i,
|
|
13
|
+
];
|
|
14
|
+
const GPT_FAMILY_PATTERNS = [
|
|
15
|
+
/\bgpt\b/i,
|
|
16
|
+
];
|
|
17
|
+
const CLAUDE_FAMILY_PATTERNS = [
|
|
18
|
+
/claude/i,
|
|
19
|
+
/anthropic/i,
|
|
20
|
+
/sonnet/i,
|
|
21
|
+
/opus/i,
|
|
22
|
+
/haiku/i,
|
|
23
|
+
];
|
|
24
|
+
function getModelId(model) {
|
|
25
|
+
return model.deployment_name || model.base_name || model.label;
|
|
26
|
+
}
|
|
27
|
+
function getSearchText(model) {
|
|
28
|
+
return [
|
|
29
|
+
model.deployment_name,
|
|
30
|
+
model.base_name,
|
|
31
|
+
model.label,
|
|
32
|
+
model.provider,
|
|
33
|
+
].filter(Boolean).join(' ').toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
export function isCopilotCompatibleModelName(modelName) {
|
|
36
|
+
if (!modelName)
|
|
37
|
+
return false;
|
|
38
|
+
if (COPILOT_INCOMPATIBLE_MODEL_PATTERNS.some((pattern) => pattern.test(modelName))) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return GPT_FAMILY_PATTERNS.some((pattern) => pattern.test(modelName))
|
|
42
|
+
|| CLAUDE_FAMILY_PATTERNS.some((pattern) => pattern.test(modelName));
|
|
43
|
+
}
|
|
44
|
+
function isCopilotCompatibleModel(model) {
|
|
45
|
+
if (!model.enabled)
|
|
46
|
+
return false;
|
|
47
|
+
if (model.features?.tools === false || model.features?.streaming === false) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const id = getModelId(model);
|
|
51
|
+
if (!id || !isCopilotCompatibleModelName(id)) {
|
|
52
|
+
const searchText = getSearchText(model);
|
|
53
|
+
if (!isCopilotCompatibleModelName(searchText)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
function extractVersionParts(text) {
|
|
60
|
+
const lower = text.toLowerCase();
|
|
61
|
+
const gptMatch = lower.match(/gpt[-.]?(\d+)(?:[-.](\d+))?(?:[-.](\d+))?/);
|
|
62
|
+
const claudeDateMatch = lower.match(/(20\d{2})[-.]?(\d{2})[-.]?(\d{2})/);
|
|
63
|
+
const claudeGenMatch = lower.match(/claude(?:[-_.]?(\d+))?(?:[-_.](\d+))?/);
|
|
64
|
+
const version = [
|
|
65
|
+
gptMatch?.[1] ?? claudeGenMatch?.[1],
|
|
66
|
+
gptMatch?.[2] ?? claudeGenMatch?.[2],
|
|
67
|
+
gptMatch?.[3],
|
|
68
|
+
].map((part) => (part ? Number(part) : 0));
|
|
69
|
+
if (claudeDateMatch) {
|
|
70
|
+
version.push(Number(claudeDateMatch[1]), Number(claudeDateMatch[2]), Number(claudeDateMatch[3]));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
version.push(0, 0, 0);
|
|
74
|
+
}
|
|
75
|
+
return version;
|
|
76
|
+
}
|
|
77
|
+
function rankModel(model) {
|
|
78
|
+
const id = getModelId(model);
|
|
79
|
+
if (!id) {
|
|
80
|
+
throw new ConfigurationError('Cannot rank Copilot model without a model identifier');
|
|
81
|
+
}
|
|
82
|
+
const searchText = getSearchText(model);
|
|
83
|
+
const preferredGpt55Bonus = /gpt[-_.]?5[-_.]?5(?:[-_.]|$)/i.test(searchText) ? 1 : 0;
|
|
84
|
+
const preferredGpt54Bonus = /gpt[-_.]?5[-_.]?4(?:[-_.]|$)/i.test(searchText) ? 1 : 0;
|
|
85
|
+
const preferredGptCodexBonus = /gpt[-_.]?5[-_.]?[23].*codex/i.test(searchText) ? 1 : 0;
|
|
86
|
+
const preferredClaudeBonus = /claude[-_.]?(?:sonnet[-_.]?)?(?:4(?:[-_.]5|[-_.]6)?|5)(?:[-_.]|$)/i.test(searchText) ? 1 : 0;
|
|
87
|
+
const gptFamilyBonus = GPT_FAMILY_PATTERNS.some((pattern) => pattern.test(searchText)) ? 1 : 0;
|
|
88
|
+
const claudeFamilyBonus = CLAUDE_FAMILY_PATTERNS.some((pattern) => pattern.test(searchText)) ? 1 : 0;
|
|
89
|
+
const defaultBonus = model.default ? 1 : 0;
|
|
90
|
+
const toolBonus = model.features?.tools === false ? 0 : 1;
|
|
91
|
+
const streamingBonus = model.features?.streaming === false ? 0 : 1;
|
|
92
|
+
const temperatureBonus = model.features?.temperature === false ? 1 : 0;
|
|
93
|
+
return {
|
|
94
|
+
model,
|
|
95
|
+
id,
|
|
96
|
+
score: [
|
|
97
|
+
preferredGpt55Bonus,
|
|
98
|
+
preferredGpt54Bonus,
|
|
99
|
+
preferredGptCodexBonus,
|
|
100
|
+
gptFamilyBonus,
|
|
101
|
+
preferredClaudeBonus,
|
|
102
|
+
claudeFamilyBonus,
|
|
103
|
+
temperatureBonus,
|
|
104
|
+
toolBonus,
|
|
105
|
+
streamingBonus,
|
|
106
|
+
...extractVersionParts(searchText),
|
|
107
|
+
defaultBonus,
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function compareRankedModels(a, b) {
|
|
112
|
+
const max = Math.max(a.score.length, b.score.length);
|
|
113
|
+
for (let i = 0; i < max; i++) {
|
|
114
|
+
const diff = (b.score[i] ?? 0) - (a.score[i] ?? 0);
|
|
115
|
+
if (diff !== 0)
|
|
116
|
+
return diff;
|
|
117
|
+
}
|
|
118
|
+
return a.id.localeCompare(b.id);
|
|
119
|
+
}
|
|
120
|
+
async function fetchCodeMieModelsForCopilot(env) {
|
|
121
|
+
const jwtToken = env.CODEMIE_JWT_TOKEN;
|
|
122
|
+
const baseUrl = env.CODEMIE_BASE_URL;
|
|
123
|
+
if (jwtToken && baseUrl) {
|
|
124
|
+
logger.debug('[copilot-cli-models] Fetching CodeMie model list via JWT auth');
|
|
125
|
+
return fetchCodeMieLlmModels(baseUrl, jwtToken);
|
|
126
|
+
}
|
|
127
|
+
const codeMieUrl = env.CODEMIE_URL;
|
|
128
|
+
if (codeMieUrl) {
|
|
129
|
+
const sso = new CodeMieSSO();
|
|
130
|
+
const credentials = await sso.getStoredCredentials(codeMieUrl);
|
|
131
|
+
if (!credentials) {
|
|
132
|
+
throw new ConfigurationError(`SSO credentials not found for ${codeMieUrl}. Run: codemie setup or codemie profile login --url ${codeMieUrl}`);
|
|
133
|
+
}
|
|
134
|
+
logger.debug('[copilot-cli-models] Fetching CodeMie model list via SSO auth');
|
|
135
|
+
return fetchCodeMieLlmModels(credentials.apiUrl, credentials.cookies);
|
|
136
|
+
}
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
export async function resolveCopilotModel(env) {
|
|
140
|
+
const currentModel = env.CODEMIE_MODEL;
|
|
141
|
+
const modelSource = (env.CODEMIE_MODEL_SOURCE || 'default');
|
|
142
|
+
let rawModels = [];
|
|
143
|
+
try {
|
|
144
|
+
rawModels = await fetchCodeMieModelsForCopilot(env);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (isCopilotCompatibleModelName(currentModel)) {
|
|
148
|
+
const configuredModel = currentModel;
|
|
149
|
+
logger.debug('[copilot-cli-models] Failed to fetch CodeMie models; keeping compatible configured model', {
|
|
150
|
+
error: error instanceof Error ? error.message : String(error),
|
|
151
|
+
model: configuredModel,
|
|
152
|
+
});
|
|
153
|
+
return { selectedModel: configuredModel, availableModels: [configuredModel] };
|
|
154
|
+
}
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
const rankedModels = rawModels
|
|
158
|
+
.filter(isCopilotCompatibleModel)
|
|
159
|
+
.map(rankModel)
|
|
160
|
+
.sort(compareRankedModels);
|
|
161
|
+
if (rankedModels.length === 0) {
|
|
162
|
+
if (isCopilotCompatibleModelName(currentModel)) {
|
|
163
|
+
const configuredModel = currentModel;
|
|
164
|
+
logger.debug('[copilot-cli-models] CodeMie returned no explicitly compatible Copilot models; keeping configured model');
|
|
165
|
+
return { selectedModel: configuredModel, availableModels: [configuredModel] };
|
|
166
|
+
}
|
|
167
|
+
throw new ConfigurationError('No CodeMie model compatible with GitHub Copilot CLI is available. ' +
|
|
168
|
+
'Use a model with tool calling and streaming support, such as gpt-5.5 or claude-sonnet-4.6.');
|
|
169
|
+
}
|
|
170
|
+
const selectedModel = rankedModels[0].id;
|
|
171
|
+
const rankedIds = rankedModels.map((entry) => entry.id);
|
|
172
|
+
const shouldPreserveConfiguredModel = modelSource === 'cli' || modelSource === 'env';
|
|
173
|
+
const effectiveModel = shouldPreserveConfiguredModel && currentModel && rankedIds.includes(currentModel)
|
|
174
|
+
? currentModel
|
|
175
|
+
: selectedModel;
|
|
176
|
+
if (currentModel && currentModel !== effectiveModel) {
|
|
177
|
+
logger.info(`[copilot-cli-models] Using ${effectiveModel} for Copilot instead of profile model ${currentModel}`);
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
selectedModel: effectiveModel,
|
|
181
|
+
availableModels: rankedModels.map((entry) => entry.id),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export function assertExplicitCopilotModelAllowed(model, availableModels) {
|
|
185
|
+
if (!isCopilotCompatibleModelName(model)) {
|
|
186
|
+
throw new ConfigurationError(`Model "${model}" is not compatible with codemie-copilot. ` +
|
|
187
|
+
`Use a GPT-family or Claude-family model with tool calling and streaming support` +
|
|
188
|
+
`${availableModels.length ? ` such as: ${availableModels.join(', ')}` : '.'}`);
|
|
189
|
+
}
|
|
190
|
+
if (availableModels.length > 0 && !availableModels.includes(model)) {
|
|
191
|
+
throw new ConfigurationError(`Model "${model}" is not available in CodeMie for codemie-copilot. ` +
|
|
192
|
+
`Available models: ${availableModels.join(', ')}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=copilot-cli.models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.models.js","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAelD,MAAM,mCAAmC,GAAa;IACpD,YAAY;IACZ,SAAS;IACT,UAAU;IACV,MAAM;IACN,aAAa;IACb,QAAQ;IACR,cAAc;CACf,CAAC;AAEF,MAAM,mBAAmB,GAAa;IACpC,UAAU;CACX,CAAC;AAEF,MAAM,sBAAsB,GAAa;IACvC,SAAS;IACT,YAAY;IACZ,SAAS;IACT,OAAO;IACP,QAAQ;CACT,CAAC;AAEF,SAAS,UAAU,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,eAAe,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC;AACjE,CAAC;AAED,SAAS,aAAa,CAAC,KAAe;IACpC,OAAO;QACL,KAAK,CAAC,eAAe;QACrB,KAAK,CAAC,S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A4B,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,kBAAkB,CAC1B,UAAU,KAAK,4CAA4C;YAC3D,iFAAiF;YACjF,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAC9E,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,kBAAkB,CAC1B,UAAU,KAAK,qDAAqD;YACpE,qBAAqB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot CLI storage locations.
|
|
3
|
+
*
|
|
4
|
+
* Copilot honors `COPILOT_HOME` as an override of `~/.copilot`. Discovery that ignores it
|
|
5
|
+
* silently returns zero sessions for anyone who sets it.
|
|
6
|
+
*/
|
|
7
|
+
/** `~/.copilot`, or `$COPILOT_HOME` when set. */
|
|
8
|
+
export declare function getCopilotHome(): string;
|
|
9
|
+
/** Directory holding one subdirectory per session. */
|
|
10
|
+
export declare function getCopilotSessionStateRoot(): string;
|
|
11
|
+
//# sourceMappingURL=copilot-cli.paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.paths.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,MAAM,CAMvC;AAED,sDAAsD;AACtD,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot CLI storage locations.
|
|
3
|
+
*
|
|
4
|
+
* Copilot honors `COPILOT_HOME` as an override of `~/.copilot`. Discovery that ignores it
|
|
5
|
+
* silently returns zero sessions for anyone who sets it.
|
|
6
|
+
*/
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import { resolveHomeDir } from '../../../utils/paths.js';
|
|
9
|
+
/** `~/.copilot`, or `$COPILOT_HOME` when set. */
|
|
10
|
+
export function getCopilotHome() {
|
|
11
|
+
const override = process.env.COPILOT_HOME?.trim();
|
|
12
|
+
if (override) {
|
|
13
|
+
return override;
|
|
14
|
+
}
|
|
15
|
+
return resolveHomeDir('.copilot');
|
|
16
|
+
}
|
|
17
|
+
/** Directory holding one subdirectory per session. */
|
|
18
|
+
export function getCopilotSessionStateRoot() {
|
|
19
|
+
return join(getCopilotHome(), 'session-state');
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=copilot-cli.paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.paths.js","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,iDAAiD;AACjD,MAAM,UAAU,cAAc;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAClD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,cAAc,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,eAAe,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AgentMetadata } from '../../core/types.js';
|
|
2
|
+
import { BaseAgentAdapter } from '../../core/BaseAgentAdapter.js';
|
|
3
|
+
import type { SessionAdapter } from '../../core/session/BaseSessionAdapter.js';
|
|
4
|
+
export { COPILOT_CLI_AGENT_NAME, COPILOT_CLI_CLIENT_TYPE, COPILOT_CLI_DISPLAY_NAME, } from './copilot-cli.constants.js';
|
|
5
|
+
export declare const CopilotCliPluginMetadata: AgentMetadata;
|
|
6
|
+
export declare class CopilotCliPlugin extends BaseAgentAdapter {
|
|
7
|
+
private sessionAdapter;
|
|
8
|
+
constructor();
|
|
9
|
+
getSessionAdapter(): SessionAdapter;
|
|
10
|
+
protected setupProxy(env: NodeJS.ProcessEnv): Promise<void>;
|
|
11
|
+
isInstalled(): Promise<boolean>;
|
|
12
|
+
getVersion(): Promise<string | null>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=copilot-cli.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-cli.plugin.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/copilot-cli/copilot-cli.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAe/E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAoEpC,eAAO,MAAM,wBAAwB,EAAE,aAyKtC,CAAC;AAEF,qBAAa,gBAAiB,SAAQ,gBAAgB;IACpD,OAAO,CAAC,cAAc,CAA+B;;IAMrD,iBAAiB,IAAI,cAAc;cAOV,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB3D,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAO/B,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAapD"}
|