dsh-github-copilot 0.4.0-alpha.100

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 (156) hide show
  1. package/AGENTS.md +312 -0
  2. package/CHANGELOG.md +479 -0
  3. package/CONTRIBUTING.md +46 -0
  4. package/LICENSE +21 -0
  5. package/README.md +203 -0
  6. package/README.zh.md +202 -0
  7. package/SECURITY.md +29 -0
  8. package/cordis.patch.yml +16 -0
  9. package/deployment-baseline.json +1299 -0
  10. package/docs/agent-readiness.md +110 -0
  11. package/docs/auto-task-routing.md +234 -0
  12. package/docs/automatic-model-routing.md +205 -0
  13. package/docs/copilot-accounts.md +236 -0
  14. package/docs/copilot-compaction.md +120 -0
  15. package/docs/copilot-usage.md +125 -0
  16. package/docs/dual-model.md +66 -0
  17. package/docs/image-input-compatibility.md +64 -0
  18. package/docs/images/copilot-accounts-credits.png +0 -0
  19. package/docs/images/copilot-accounts.png +0 -0
  20. package/docs/images/copilot-model-preferences.png +0 -0
  21. package/docs/images/copilot-search-routing.png +0 -0
  22. package/docs/images/dual-model-desktop.png +0 -0
  23. package/docs/images/dual-model-mobile.png +0 -0
  24. package/docs/images/dual-model-provenance.json +35 -0
  25. package/docs/images/parent-model-follow.png +0 -0
  26. package/docs/manual-compaction-recovery.md +64 -0
  27. package/docs/model-compatibility-acceptance.md +164 -0
  28. package/docs/npm-distribution.md +149 -0
  29. package/docs/official-first-016-alpha2.md +66 -0
  30. package/docs/official-first-020-rc1.md +32 -0
  31. package/docs/official-first-020-rc2.md +16 -0
  32. package/docs/session-search-routing.md +133 -0
  33. package/docs/single-route-migration.md +130 -0
  34. package/docs/web-lifecycle-rc2.md +55 -0
  35. package/lib/client.js +10822 -0
  36. package/lib/client.js.map +1 -0
  37. package/lib/copilot-identity-DRZY_d2X.js +15 -0
  38. package/lib/index.js +11689 -0
  39. package/lib/manual-compaction-recovery.js +315 -0
  40. package/lib/remote.js +734 -0
  41. package/lib/request-budget-DLY_aRq0.js +87 -0
  42. package/lib/routed-web.js +120 -0
  43. package/lib/search-routing-CqysPLve.js +792 -0
  44. package/lib/types/account-model-auth.d.ts +15 -0
  45. package/lib/types/account-model-catalog.d.ts +70 -0
  46. package/lib/types/account-model-source.d.ts +85 -0
  47. package/lib/types/agent-compaction.d.ts +4 -0
  48. package/lib/types/authorization-controller.d.ts +119 -0
  49. package/lib/types/auto-assessment-evidence.d.ts +46 -0
  50. package/lib/types/auto-model-host.d.ts +27 -0
  51. package/lib/types/auto-model-intent.d.ts +36 -0
  52. package/lib/types/auto-model-presentation.d.ts +57 -0
  53. package/lib/types/auto-model-routing.d.ts +59 -0
  54. package/lib/types/auto-selection-explanation.d.ts +9 -0
  55. package/lib/types/auto-task-assessment.d.ts +47 -0
  56. package/lib/types/auto-task-classifier.d.ts +9 -0
  57. package/lib/types/background-compaction.d.ts +30 -0
  58. package/lib/types/client.d.ts +115 -0
  59. package/lib/types/compact-account.d.ts +42 -0
  60. package/lib/types/compaction-pressure.d.ts +23 -0
  61. package/lib/types/compatibility.d.ts +17 -0
  62. package/lib/types/config.d.ts +89 -0
  63. package/lib/types/content-file.d.ts +10 -0
  64. package/lib/types/context-evidence-ui.d.ts +11 -0
  65. package/lib/types/context-evidence.d.ts +108 -0
  66. package/lib/types/context-usage.d.ts +4 -0
  67. package/lib/types/copilot-account-presentation.d.ts +7 -0
  68. package/lib/types/copilot-accounts-card.d.ts +30 -0
  69. package/lib/types/copilot-accounts-host.d.ts +75 -0
  70. package/lib/types/copilot-accounts-remote.d.ts +77 -0
  71. package/lib/types/copilot-accounts-types.d.ts +42 -0
  72. package/lib/types/copilot-auth.d.ts +25 -0
  73. package/lib/types/copilot-grant.d.ts +11 -0
  74. package/lib/types/copilot-identity.d.ts +11 -0
  75. package/lib/types/copilot-request.d.ts +11 -0
  76. package/lib/types/copilot-stream-liveness.d.ts +23 -0
  77. package/lib/types/copilot-usage-card.d.ts +30 -0
  78. package/lib/types/copilot-usage-host.d.ts +58 -0
  79. package/lib/types/copilot-usage-normalize.d.ts +9 -0
  80. package/lib/types/copilot-usage-remote.d.ts +63 -0
  81. package/lib/types/copilot-usage-types.d.ts +20 -0
  82. package/lib/types/copilot-usage-ui.d.ts +4 -0
  83. package/lib/types/current-provider.d.ts +59 -0
  84. package/lib/types/deepseek-search-fallback.d.ts +11 -0
  85. package/lib/types/dual-model-host.d.ts +119 -0
  86. package/lib/types/dual-model-remote.d.ts +63 -0
  87. package/lib/types/dual-model-types.d.ts +34 -0
  88. package/lib/types/external-link.d.ts +3 -0
  89. package/lib/types/failure.d.ts +38 -0
  90. package/lib/types/http.d.ts +48 -0
  91. package/lib/types/image-input-admission.d.ts +5 -0
  92. package/lib/types/index.d.ts +39 -0
  93. package/lib/types/manual-compaction-recovery.d.ts +52 -0
  94. package/lib/types/migration-status.d.ts +50 -0
  95. package/lib/types/model-exclusions.d.ts +15 -0
  96. package/lib/types/model-preferences-card.d.ts +9 -0
  97. package/lib/types/model-protocol.d.ts +31 -0
  98. package/lib/types/native-select-style.d.ts +4 -0
  99. package/lib/types/parent-model-follow-card.d.ts +41 -0
  100. package/lib/types/parent-model-follow.d.ts +44 -0
  101. package/lib/types/pi-provider-bridge.d.ts +22 -0
  102. package/lib/types/plan.d.ts +148 -0
  103. package/lib/types/pre-step-pressure.d.ts +8 -0
  104. package/lib/types/preview-provider.d.ts +66 -0
  105. package/lib/types/preview-route.d.ts +74 -0
  106. package/lib/types/probe.d.ts +39 -0
  107. package/lib/types/reasoning-presentation.d.ts +55 -0
  108. package/lib/types/remote-codec.d.ts +10 -0
  109. package/lib/types/remote.d.ts +199 -0
  110. package/lib/types/replay-recovery-host.d.ts +28 -0
  111. package/lib/types/replay-recovery-remote.d.ts +14 -0
  112. package/lib/types/replay-recovery-types.d.ts +24 -0
  113. package/lib/types/replay-recovery-ui.d.ts +26 -0
  114. package/lib/types/replay-recovery.d.ts +17 -0
  115. package/lib/types/request-body-evidence.d.ts +34 -0
  116. package/lib/types/request-body-timeout-marker.d.ts +2 -0
  117. package/lib/types/request-body-timeout.d.ts +4 -0
  118. package/lib/types/request-budget.d.ts +58 -0
  119. package/lib/types/request-upload-evidence.d.ts +23 -0
  120. package/lib/types/response-error-body.d.ts +3 -0
  121. package/lib/types/responses-reasoning-text.d.ts +24 -0
  122. package/lib/types/responses-reasoning.d.ts +7 -0
  123. package/lib/types/responses-replay-compat.d.ts +30 -0
  124. package/lib/types/route-ownership.d.ts +70 -0
  125. package/lib/types/routed-web.d.ts +50 -0
  126. package/lib/types/search-backend.d.ts +16 -0
  127. package/lib/types/search-routing-host.d.ts +19 -0
  128. package/lib/types/search-routing-policy.d.ts +18 -0
  129. package/lib/types/search-routing-remote.d.ts +20 -0
  130. package/lib/types/search-routing.d.ts +43 -0
  131. package/lib/types/search-tool-routing.d.ts +22 -0
  132. package/lib/types/serialize.d.ts +106 -0
  133. package/lib/types/settings-reader.d.ts +16 -0
  134. package/lib/types/sse.d.ts +28 -0
  135. package/lib/types/temporary-models.d.ts +25 -0
  136. package/lib/types/tool-schema-compat.d.ts +17 -0
  137. package/lib/types/traditional-search.d.ts +17 -0
  138. package/lib/types/turn-model-provenance.d.ts +45 -0
  139. package/lib/types/turn-selection-card.d.ts +10 -0
  140. package/lib/types/turn-selection-host.d.ts +11 -0
  141. package/lib/types/turn-selection-remote.d.ts +13 -0
  142. package/lib/types/turn-selection.d.ts +119 -0
  143. package/lib/types/turn-usage-evidence.d.ts +66 -0
  144. package/lib/types/turn-usage-notice.d.ts +7 -0
  145. package/lib/types/types.d.ts +69 -0
  146. package/lib/types/usage.d.ts +26 -0
  147. package/lib/types/watchdog.d.ts +22 -0
  148. package/lib/types/web-delegate.d.ts +12 -0
  149. package/lib/types/web-search-routing-card.d.ts +16 -0
  150. package/lib/types/web-search-routing-config.d.ts +12 -0
  151. package/lib/types/wire-anthropic.d.ts +37 -0
  152. package/lib/types/wire.d.ts +56 -0
  153. package/lib/web-delegate.js +9 -0
  154. package/output/auto-model-mockup/index.html +207 -0
  155. package/package.json +236 -0
  156. package/scripts/check-search-composition.mjs +191 -0
package/lib/remote.js ADDED
@@ -0,0 +1,734 @@
1
+ import { z } from "zod";
2
+ //#region lib/types/remote-codec.js
3
+ /** Client-safe bridge between legacy schema codecs and alpha.2 create factories. */
4
+ function strictRemoteCodec(typeSymbol, schema) {
5
+ return {
6
+ mode: "strict",
7
+ typeSymbol,
8
+ schema,
9
+ create: () => schema
10
+ };
11
+ }
12
+ //#endregion
13
+ //#region lib/types/dual-model-remote.js
14
+ const id = z.string().min(1).max(512);
15
+ const revision$1 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
16
+ const DualModelConfigSchema = z.object({
17
+ enabled: z.boolean(),
18
+ plannerModel: z.string().max(512),
19
+ executorModel: z.string().max(512)
20
+ }).strict();
21
+ const DualModelViewSchema = z.object({
22
+ supported: z.boolean(),
23
+ diagnostic: z.string().min(1).max(128).optional(),
24
+ writable: z.boolean(),
25
+ revision: revision$1.nullable(),
26
+ configuration: DualModelConfigSchema,
27
+ models: z.array(z.object({
28
+ id,
29
+ name: z.string().min(1).max(1024)
30
+ }).strict()).max(512),
31
+ workspaces: z.array(z.object({
32
+ id,
33
+ name: z.string().min(1).max(1024)
34
+ }).strict()).max(1024)
35
+ }).strict();
36
+ const DualModelSaveSchema = z.object({
37
+ configuration: DualModelConfigSchema,
38
+ expectedRevision: revision$1
39
+ }).strict();
40
+ const DualModelCreateSchema = z.object({
41
+ requestId: z.string().uuid(),
42
+ workspaceId: id,
43
+ expectedRevision: revision$1
44
+ }).strict();
45
+ const DualModelCreateResultSchema = z.object({ sessionId: id }).strict();
46
+ const contribution$6 = {
47
+ package: "dsh-github-copilot",
48
+ descriptors: [
49
+ {
50
+ id: "dsh-github-copilot:githubCopilotDualModel.view",
51
+ namespace: "githubCopilotDualModel",
52
+ service: "githubCopilotDualModel",
53
+ method: "view",
54
+ invocation: { kind: "direct" },
55
+ parameters: [],
56
+ result: strictRemoteCodec("dsh-github-copilot#DualModelView", DualModelViewSchema)
57
+ },
58
+ {
59
+ id: "dsh-github-copilot:githubCopilotDualModel.save",
60
+ namespace: "githubCopilotDualModel",
61
+ service: "githubCopilotDualModel",
62
+ method: "save",
63
+ invocation: { kind: "direct" },
64
+ parameters: [{
65
+ name: "input",
66
+ wire: "input",
67
+ source: "json",
68
+ codec: strictRemoteCodec("dsh-github-copilot#DualModelSaveRequest", DualModelSaveSchema)
69
+ }],
70
+ result: strictRemoteCodec("dsh-github-copilot#DualModelView", DualModelViewSchema)
71
+ },
72
+ {
73
+ id: "dsh-github-copilot:githubCopilotDualModel.create",
74
+ namespace: "githubCopilotDualModel",
75
+ service: "githubCopilotDualModel",
76
+ method: "create",
77
+ invocation: { kind: "direct" },
78
+ parameters: [{
79
+ name: "input",
80
+ wire: "input",
81
+ source: "json",
82
+ codec: strictRemoteCodec("dsh-github-copilot#DualModelCreateRequest", DualModelCreateSchema)
83
+ }],
84
+ result: strictRemoteCodec("dsh-github-copilot#DualModelCreateResult", DualModelCreateResultSchema)
85
+ }
86
+ ]
87
+ };
88
+ const contribution$5 = {
89
+ package: "dsh-github-copilot",
90
+ descriptors: [{
91
+ id: "dsh-github-copilot:githubCopilotSearchRouting.providers",
92
+ namespace: "githubCopilotSearchRouting",
93
+ service: "githubCopilotSearchRouting",
94
+ method: "providers",
95
+ invocation: { kind: "direct" },
96
+ parameters: [],
97
+ result: strictRemoteCodec("dsh-github-copilot#SearchProviderCatalog", z.object({
98
+ supported: z.boolean(),
99
+ providers: z.array(z.object({ id: z.string().min(1).max(512) }).strict()).max(512)
100
+ }).strict())
101
+ }]
102
+ };
103
+ //#endregion
104
+ //#region lib/types/copilot-usage-types.js
105
+ const COPILOT_USAGE_MAX_AMOUNT = 0xe8d4a51000;
106
+ const COPILOT_USAGE_MAX_TIMESTAMP = 0xe677d21fdbff;
107
+ const COPILOT_USAGE_DIAGNOSTICS = [
108
+ "COPILOT_USAGE_SIGNED_OUT",
109
+ "COPILOT_USAGE_INVALID_GRANT",
110
+ "COPILOT_USAGE_CREDENTIALS_UNAVAILABLE",
111
+ "COPILOT_USAGE_ENTERPRISE_UNSUPPORTED",
112
+ "COPILOT_USAGE_ACCOUNT_CHANGED",
113
+ "COPILOT_USAGE_DISPOSED",
114
+ "COPILOT_USAGE_BILLING_UNKNOWN",
115
+ "COPILOT_USAGE_SNAPSHOT_MISSING",
116
+ "COPILOT_USAGE_INVALID_RESPONSE",
117
+ "COPILOT_USAGE_POOLED_UNAVAILABLE",
118
+ "COPILOT_USAGE_POOLED_EXHAUSTED",
119
+ "COPILOT_USAGE_NO_ALLOCATION",
120
+ "COPILOT_USAGE_NETWORK",
121
+ "COPILOT_USAGE_TLS",
122
+ "COPILOT_USAGE_TRUST_UNAVAILABLE",
123
+ "COPILOT_USAGE_TIMEOUT",
124
+ "COPILOT_USAGE_BODY_TOO_LARGE",
125
+ "COPILOT_USAGE_REDIRECT",
126
+ "COPILOT_USAGE_AUTH_REJECTED",
127
+ "COPILOT_USAGE_HTTP_ERROR",
128
+ "COPILOT_USAGE_RATE_LIMITED"
129
+ ];
130
+ //#endregion
131
+ //#region lib/types/copilot-accounts-types.js
132
+ const COPILOT_ACCOUNT_ID_PATTERN = /^(?:canonical|[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/u;
133
+ const COPILOT_ACCOUNTS_DIAGNOSTICS = [
134
+ "COPILOT_ACCOUNTS_SELECTOR_INVALID",
135
+ "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE",
136
+ "COPILOT_ACCOUNTS_SELECTED_MISSING",
137
+ "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE",
138
+ "COPILOT_ACCOUNTS_CHANGED",
139
+ "COPILOT_ACCOUNTS_BUSY",
140
+ "COPILOT_ACCOUNTS_CONFLICT",
141
+ "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN",
142
+ "COPILOT_ACCOUNTS_MODELS_FAILED",
143
+ "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
144
+ "COPILOT_ACCOUNTS_IDENTITY_INVALID",
145
+ "COPILOT_ACCOUNTS_IDENTITY_CHANGED",
146
+ "COPILOT_ACCOUNTS_DUPLICATE",
147
+ "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED",
148
+ "COPILOT_ACCOUNTS_ROUTE_BLOCKED",
149
+ "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE",
150
+ "COPILOT_ACCOUNTS_LIMIT",
151
+ "COPILOT_ACCOUNTS_AUTH_FAILED",
152
+ "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE",
153
+ "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED",
154
+ "COPILOT_ACCOUNTS_REMOVE_FAILED",
155
+ "COPILOT_ACCOUNTS_DISPOSED"
156
+ ];
157
+ //#endregion
158
+ //#region lib/types/copilot-usage-remote.js
159
+ const amount = z.number().finite().nonnegative().max(COPILOT_USAGE_MAX_AMOUNT);
160
+ const timestamp = z.number().int().nonnegative().max(COPILOT_USAGE_MAX_TIMESTAMP);
161
+ const CopilotUsageViewSchema = z.object({
162
+ accountId: z.string().max(36).regex(COPILOT_ACCOUNT_ID_PATTERN).optional(),
163
+ state: z.enum([
164
+ "ready",
165
+ "stale",
166
+ "unavailable",
167
+ "signed-out"
168
+ ]),
169
+ billing: z.enum([
170
+ "credits",
171
+ "requests",
172
+ "unknown"
173
+ ]),
174
+ budget: z.enum([
175
+ "individual",
176
+ "pooled",
177
+ "unknown"
178
+ ]),
179
+ used: amount.optional(),
180
+ remaining: amount.optional(),
181
+ limit: amount.positive().optional(),
182
+ percentUsed: z.number().finite().min(0).max(100).optional(),
183
+ resetAt: timestamp.optional(),
184
+ observedAt: timestamp.optional(),
185
+ diagnostic: z.enum(COPILOT_USAGE_DIAGNOSTICS).optional()
186
+ }).strict().superRefine((view, ctx) => {
187
+ const invalid = () => ctx.addIssue({
188
+ code: "custom",
189
+ message: "Invalid account quota snapshot"
190
+ });
191
+ const hasAmounts = [
192
+ view.used,
193
+ view.remaining,
194
+ view.limit,
195
+ view.percentUsed
196
+ ].some((value) => value !== void 0);
197
+ if (view.state === "unavailable" || view.state === "signed-out") {
198
+ if (hasAmounts || view.observedAt !== void 0 || view.resetAt !== void 0 || view.diagnostic === void 0) invalid();
199
+ if (view.state === "signed-out" && (view.billing !== "unknown" || view.budget !== "unknown")) invalid();
200
+ return;
201
+ }
202
+ if (!hasAmounts || view.observedAt === void 0 || view.billing === "unknown" || view.budget === "unknown") invalid();
203
+ if (view.state === "stale" && view.diagnostic === void 0) invalid();
204
+ if (view.state === "ready" && view.diagnostic !== void 0) invalid();
205
+ if (view.budget === "pooled" && (view.billing !== "credits" || view.used === void 0 || view.remaining !== void 0 || view.limit !== void 0 || view.percentUsed !== void 0)) invalid();
206
+ if (view.limit !== void 0) {
207
+ if (view.used !== void 0 && view.used > view.limit || view.remaining !== void 0 && view.remaining > view.limit) invalid();
208
+ if (view.used !== void 0 && view.remaining !== void 0 && Math.abs(view.used + view.remaining - view.limit) > Math.max(1e-8, view.limit * 1e-12)) invalid();
209
+ if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
210
+ }
211
+ });
212
+ const contribution$4 = {
213
+ package: "dsh-github-copilot",
214
+ descriptors: ["get", "refresh"].map((method) => ({
215
+ id: `dsh-github-copilot:githubCopilotUsage.${method}`,
216
+ namespace: "githubCopilotUsage",
217
+ service: "githubCopilotUsage",
218
+ method,
219
+ invocation: { kind: "direct" },
220
+ parameters: [],
221
+ result: strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema)
222
+ }))
223
+ };
224
+ //#endregion
225
+ //#region lib/types/auto-assessment-evidence.js
226
+ const milliseconds = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
227
+ const SemanticAssessmentEvidenceSchema = z.object({
228
+ modelId: z.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u).optional(),
229
+ budgetMs: milliseconds.refine((value) => value > 0),
230
+ elapsedMs: milliseconds,
231
+ stage: z.enum([
232
+ "preparing",
233
+ "model-selected",
234
+ "adapter-started",
235
+ "text-received",
236
+ "finished"
237
+ ]),
238
+ adapterStartedMs: milliseconds.optional(),
239
+ firstTextMs: milliseconds.optional(),
240
+ nativeFinish: z.enum(["stop", "non-stop"]).optional(),
241
+ outputCharacters: z.number().int().min(0).max(2049),
242
+ validation: z.enum([
243
+ "not-validated",
244
+ "valid",
245
+ "invalid",
246
+ "context-omitted"
247
+ ])
248
+ }).strict().superRefine((value, ctx) => {
249
+ if (value.adapterStartedMs !== void 0 && value.adapterStartedMs > value.elapsedMs || value.firstTextMs !== void 0 && (value.adapterStartedMs === void 0 || value.firstTextMs < value.adapterStartedMs || value.firstTextMs > value.elapsedMs)) ctx.addIssue({
250
+ code: "custom",
251
+ message: "Inconsistent assessment timing"
252
+ });
253
+ if (value.stage === "model-selected" && value.modelId === void 0 || [
254
+ "adapter-started",
255
+ "text-received",
256
+ "finished"
257
+ ].includes(value.stage) && value.adapterStartedMs === void 0 || value.stage === "text-received" && value.firstTextMs === void 0 || value.stage === "finished" && value.nativeFinish === void 0 || value.nativeFinish !== void 0 && value.stage !== "finished" || value.outputCharacters > 0 && value.firstTextMs === void 0 || value.firstTextMs !== void 0 && value.outputCharacters === 0) ctx.addIssue({
258
+ code: "custom",
259
+ message: "Inconsistent assessment phase"
260
+ });
261
+ });
262
+ //#endregion
263
+ //#region lib/types/auto-task-assessment.js
264
+ const TaskAssessmentSchema = z.object({
265
+ demand: z.enum([
266
+ "simple",
267
+ "routine",
268
+ "complex",
269
+ "unknown"
270
+ ]),
271
+ signals: z.array(z.enum([
272
+ "isolated-greeting",
273
+ "bounded-transformation",
274
+ "reasoning",
275
+ "investigation",
276
+ "continuation",
277
+ "context-omitted",
278
+ "insufficient-evidence"
279
+ ])).max(7)
280
+ }).strict();
281
+ //#endregion
282
+ //#region lib/types/turn-selection.js
283
+ const ExplanationSchema = z.object({
284
+ assessment: TaskAssessmentSchema.extend({
285
+ source: z.enum(["local", "semantic"]),
286
+ diagnostic: z.enum([
287
+ "disabled",
288
+ "unavailable",
289
+ "invalid-result",
290
+ "timeout",
291
+ "failed",
292
+ "context-omitted"
293
+ ]).optional(),
294
+ semantic: SemanticAssessmentEvidenceSchema.optional()
295
+ }).strict(),
296
+ targetCategory: z.enum([
297
+ "powerful",
298
+ "versatile",
299
+ "lightweight"
300
+ ]),
301
+ selectedCategory: z.enum([
302
+ "powerful",
303
+ "versatile",
304
+ "lightweight",
305
+ "unknown"
306
+ ]),
307
+ categoryCandidateCount: z.number().int().min(0).max(512),
308
+ method: z.enum([
309
+ "continuity",
310
+ "equal-distribution",
311
+ "only-candidate",
312
+ "no-fit"
313
+ ]),
314
+ fallback: z.boolean()
315
+ }).strict();
316
+ const TurnSelectionSchema = z.discriminatedUnion("mode", [
317
+ z.object({ mode: z.literal("unknown") }).strict(),
318
+ z.object({ mode: z.literal("manual") }).strict(),
319
+ z.object({
320
+ mode: z.literal("auto"),
321
+ preference: z.enum([
322
+ "efficiency",
323
+ "balance",
324
+ "intelligence"
325
+ ]),
326
+ reason: z.enum([
327
+ "short-text-turn",
328
+ "standard-turn",
329
+ "large-structured-turn",
330
+ "image-capability"
331
+ ]),
332
+ candidateCount: z.number().int().positive(),
333
+ fittingCandidateCount: z.number().int().nonnegative().optional(),
334
+ explanation: ExplanationSchema.optional()
335
+ }).strict()
336
+ ]);
337
+ //#endregion
338
+ //#region lib/types/turn-selection-remote.js
339
+ const contribution$3 = {
340
+ package: "dsh-github-copilot",
341
+ descriptors: [{
342
+ id: "dsh-github-copilot:githubCopilotTurnSelection.get",
343
+ namespace: "githubCopilotTurnSelection",
344
+ service: "githubCopilotTurnSelection",
345
+ method: "get",
346
+ invocation: { kind: "direct" },
347
+ parameters: [{
348
+ name: "agent",
349
+ wire: "agentId",
350
+ source: "lookup",
351
+ lookup: "agent",
352
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
353
+ }, {
354
+ name: "turn",
355
+ wire: "turn",
356
+ source: "json",
357
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
358
+ }],
359
+ result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
360
+ }]
361
+ };
362
+ //#endregion
363
+ //#region lib/types/replay-recovery-types.js
364
+ const ReplayRecoveryDurationSchema = z.enum(["next-turn", "session"]);
365
+ const ReplayRecoveryViewSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("unavailable") }).strict(), z.object({
366
+ state: z.enum(["available", "enabled"]),
367
+ revision: z.string().uuid(),
368
+ itemCount: z.number().int().positive().max(512),
369
+ model: z.string().min(1).max(256),
370
+ duration: ReplayRecoveryDurationSchema.optional(),
371
+ expiresAt: z.number().int().nonnegative().optional()
372
+ }).strict()]);
373
+ //#endregion
374
+ //#region lib/types/replay-recovery-remote.js
375
+ const agent = {
376
+ name: "agent",
377
+ wire: "agentId",
378
+ source: "lookup",
379
+ lookup: "agent",
380
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
381
+ };
382
+ const contribution$2 = {
383
+ package: "dsh-github-copilot",
384
+ descriptors: [
385
+ {
386
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.get",
387
+ namespace: "githubCopilotReplayRecovery",
388
+ service: "githubCopilotReplayRecovery",
389
+ method: "get",
390
+ invocation: { kind: "direct" },
391
+ parameters: [agent],
392
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
393
+ },
394
+ {
395
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.authorize",
396
+ namespace: "githubCopilotReplayRecovery",
397
+ service: "githubCopilotReplayRecovery",
398
+ method: "authorize",
399
+ invocation: { kind: "direct" },
400
+ parameters: [
401
+ agent,
402
+ {
403
+ name: "revision",
404
+ wire: "revision",
405
+ source: "json",
406
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", z.string().uuid())
407
+ },
408
+ {
409
+ name: "duration",
410
+ wire: "duration",
411
+ source: "json",
412
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryDuration", ReplayRecoveryDurationSchema)
413
+ }
414
+ ],
415
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
416
+ },
417
+ {
418
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.setEnabled",
419
+ namespace: "githubCopilotReplayRecovery",
420
+ service: "githubCopilotReplayRecovery",
421
+ method: "setEnabled",
422
+ invocation: { kind: "direct" },
423
+ parameters: [
424
+ agent,
425
+ {
426
+ name: "revision",
427
+ wire: "revision",
428
+ source: "json",
429
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", z.string().uuid())
430
+ },
431
+ {
432
+ name: "enabled",
433
+ wire: "enabled",
434
+ source: "json",
435
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryEnabled", z.boolean())
436
+ }
437
+ ],
438
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
439
+ }
440
+ ]
441
+ };
442
+ //#endregion
443
+ //#region lib/types/copilot-accounts-remote.js
444
+ const CopilotAccountIdSchema = z.string().max(36).regex(COPILOT_ACCOUNT_ID_PATTERN);
445
+ const revision = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
446
+ const CopilotAccountsViewSchema = z.object({
447
+ state: z.enum(["ready", "error"]),
448
+ activeAccountId: CopilotAccountIdSchema,
449
+ revision: revision.optional(),
450
+ writable: z.boolean(),
451
+ switchable: z.boolean(),
452
+ accounts: z.array(z.object({
453
+ id: CopilotAccountIdSchema,
454
+ configured: z.boolean(),
455
+ identityState: z.enum([
456
+ "ready",
457
+ "unavailable",
458
+ "unknown"
459
+ ]),
460
+ identity: z.object({
461
+ login: z.string().min(1).max(39).regex(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/u),
462
+ userId: z.number().int().positive().max(Number.MAX_SAFE_INTEGER)
463
+ }).strict().optional()
464
+ }).strict()).max(32),
465
+ operation: z.enum(["authorizing", "switching"]).optional(),
466
+ notices: z.array(z.object({
467
+ message: z.string().min(1).max(512),
468
+ url: z.literal("https://github.com/login/device").optional(),
469
+ code: z.string().min(1).max(32).regex(/^[A-Z0-9-]+$/u).optional()
470
+ }).strict()).max(8),
471
+ diagnostic: z.enum(COPILOT_ACCOUNTS_DIAGNOSTICS).optional()
472
+ }).strict().superRefine((view, ctx) => {
473
+ const invalid = () => ctx.addIssue({
474
+ code: "custom",
475
+ message: "Invalid account evidence"
476
+ });
477
+ if (view.state === "error" !== (view.diagnostic !== void 0)) invalid();
478
+ if (view.switchable && (!view.writable || view.operation !== void 0 || view.state !== "ready" && view.diagnostic !== "COPILOT_ACCOUNTS_SELECTED_MISSING")) invalid();
479
+ if (view.writable && view.revision === void 0) invalid();
480
+ if (new Set(view.accounts.map((row) => row.id)).size !== view.accounts.length) invalid();
481
+ for (const row of view.accounts) {
482
+ if (row.identityState === "ready" !== (row.identity !== void 0)) invalid();
483
+ if (row.identity !== void 0 && !row.configured) invalid();
484
+ }
485
+ });
486
+ const contribution$1 = {
487
+ package: "dsh-github-copilot",
488
+ descriptors: [
489
+ "get",
490
+ "refreshIdentity",
491
+ "add",
492
+ "cancel",
493
+ "switchAccount",
494
+ "removeAccount",
495
+ "reauthorize"
496
+ ].map((method) => ({
497
+ id: `dsh-github-copilot:githubCopilotAccounts.${method}`,
498
+ namespace: "githubCopilotAccounts",
499
+ service: "githubCopilotAccounts",
500
+ method,
501
+ invocation: { kind: "direct" },
502
+ parameters: method === "switchAccount" || method === "removeAccount" || method === "reauthorize" ? [{
503
+ name: "accountId",
504
+ wire: "accountId",
505
+ source: "json",
506
+ codec: strictRemoteCodec("dsh-github-copilot#CopilotAccountId", CopilotAccountIdSchema)
507
+ }, {
508
+ name: "expectedRevision",
509
+ wire: "expectedRevision",
510
+ source: "json",
511
+ codec: strictRemoteCodec("dsh-github-copilot#CopilotAccountsRevision", revision)
512
+ }] : [],
513
+ result: strictRemoteCodec("dsh-github-copilot#CopilotAccountsView", CopilotAccountsViewSchema)
514
+ }))
515
+ };
516
+ //#endregion
517
+ //#region lib/types/remote.js
518
+ /**
519
+ * Client-safe Remote contribution for the plugin-owned authorization bridge.
520
+ */
521
+ const direct = { kind: "direct" };
522
+ const GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotAuthorizationView";
523
+ const GitHubCopilotAuthorizationViewSchema = z.object({
524
+ phase: z.enum([
525
+ "signed-out",
526
+ "authorizing",
527
+ "signed-in",
528
+ "error"
529
+ ]),
530
+ configured: z.boolean(),
531
+ writable: z.boolean(),
532
+ inFlight: z.boolean(),
533
+ notices: z.array(z.object({
534
+ message: z.string(),
535
+ url: z.string().optional(),
536
+ code: z.string().optional()
537
+ }).strict()),
538
+ catalog: z.object({
539
+ state: z.enum([
540
+ "current",
541
+ "partially-outdated",
542
+ "outdated"
543
+ ]),
544
+ accountModelCount: z.number().int().nonnegative(),
545
+ supportedModelCount: z.number().int().nonnegative(),
546
+ unknownModelIds: z.array(z.string()),
547
+ temporarilyUnavailableModelIds: z.array(z.string()).optional(),
548
+ previewModelIds: z.array(z.string()).optional()
549
+ }).strict().optional(),
550
+ accountModels: z.object({
551
+ state: z.enum([
552
+ "idle",
553
+ "loading",
554
+ "ready",
555
+ "stale",
556
+ "error",
557
+ "disposed",
558
+ "unconfigured",
559
+ "unavailable"
560
+ ]),
561
+ models: z.array(z.object({
562
+ id: z.string(),
563
+ name: z.string(),
564
+ api: z.string()
565
+ }).strict()).max(512),
566
+ rejected: z.array(z.object({
567
+ id: z.string().optional(),
568
+ code: z.string()
569
+ }).strict()).max(1024),
570
+ warnings: z.array(z.object({
571
+ id: z.string(),
572
+ code: z.string()
573
+ }).strict()).max(1024).optional(),
574
+ discoveredAt: z.number().int().nonnegative().optional(),
575
+ error: z.string().optional()
576
+ }).strict().optional(),
577
+ modelPreferences: z.object({
578
+ state: z.enum(["ready", "error"]),
579
+ writable: z.boolean(),
580
+ revision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
581
+ excludedModelIds: z.array(z.string().min(1).max(512)).max(512),
582
+ lockedModelIds: z.array(z.string().min(1).max(512)).max(512),
583
+ unavailableExcludedModelIds: z.array(z.string().min(1).max(512)).max(512),
584
+ error: z.enum([
585
+ "COPILOT_MODEL_PREFERENCES_UNAVAILABLE",
586
+ "COPILOT_MODEL_SETTINGS_UNAVAILABLE",
587
+ "COPILOT_MODEL_SETTINGS_INVALID",
588
+ "COPILOT_MODEL_SELECTION_UNAVAILABLE",
589
+ "COPILOT_MODEL_EXCLUSION_SELECTED",
590
+ "COPILOT_MODEL_EXCLUSION_CONFLICT",
591
+ "COPILOT_MODEL_EXCLUSION_SAVE_FAILED"
592
+ ]).optional()
593
+ }).strict().optional(),
594
+ route: z.object({
595
+ state: z.enum([
596
+ "ready",
597
+ "needs-repair",
598
+ "not-configured",
599
+ "conflict",
600
+ "error"
601
+ ]),
602
+ diagnosticCode: z.enum([
603
+ "ROUTE_READ_FAILED",
604
+ "RECONCILIATION_FAILED",
605
+ "ROUTE_CONFLICT"
606
+ ]).optional()
607
+ }).strict().optional(),
608
+ error: z.string().optional(),
609
+ authorizationMilestone: z.enum([
610
+ "AUTHORIZATION_REQUESTED",
611
+ "INTERACTION_PROMPT_OBSERVED",
612
+ "INTERACTION_NOTICE_OBSERVED"
613
+ ]).optional()
614
+ }).strict();
615
+ const result = strictRemoteCodec(GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema);
616
+ const GitHubCopilotModelPreferencesViewSchema = GitHubCopilotAuthorizationViewSchema.shape.modelPreferences.unwrap();
617
+ const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
618
+ const selectionSchema = z.object({
619
+ provider: z.string().min(1).max(512),
620
+ model: z.string().min(1).max(512),
621
+ reasoningEffort: z.string().min(1).max(512).optional()
622
+ }).strict();
623
+ /** Independent Ops result: strict at every object level; no account or private Session data. */
624
+ const GitHubCopilotMigrationStatusSchema = z.object({
625
+ plugin: z.object({
626
+ name: z.literal("dsh-github-copilot"),
627
+ version: z.string().min(1).max(512)
628
+ }).strict(),
629
+ protocolVersion: z.literal(1),
630
+ historyScope: z.literal("live-agents-only"),
631
+ observedAt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
632
+ capabilities: z.object({
633
+ agentsList: z.boolean(),
634
+ sessionProjections: z.boolean(),
635
+ settingsCas: z.boolean(),
636
+ providerRegistry: z.boolean(),
637
+ defaultSelection: z.boolean()
638
+ }).strict(),
639
+ complete: z.object({
640
+ sessions: z.boolean(),
641
+ defaultSelection: z.boolean(),
642
+ routes: z.boolean()
643
+ }).strict(),
644
+ defaultSelection: selectionSchema.nullable(),
645
+ sessions: z.array(z.object({
646
+ id: z.string().min(1).max(512),
647
+ status: z.enum(["idle", "running"]),
648
+ effectiveSelection: selectionSchema.nullable(),
649
+ selectionSource: z.enum([
650
+ "pending",
651
+ "request-header",
652
+ "default",
653
+ "unknown"
654
+ ]),
655
+ activeRequestSelection: selectionSchema.nullable()
656
+ }).strict()).max(1024),
657
+ routes: z.object({
658
+ nativeConfigured: z.boolean().nullable(),
659
+ nativeRegistered: z.boolean().nullable(),
660
+ managedRegistered: z.boolean().nullable()
661
+ }).strict()
662
+ }).strict();
663
+ const contribution = {
664
+ package: "dsh-github-copilot",
665
+ descriptors: [
666
+ ...[
667
+ "status",
668
+ "reconcile",
669
+ "discoverModels",
670
+ "ensureModels",
671
+ "start",
672
+ "cancel",
673
+ "signOut"
674
+ ].map((method) => ({
675
+ id: `dsh-github-copilot:githubCopilot.${method}`,
676
+ service: "githubCopilotAuthorization",
677
+ namespace: "githubCopilot",
678
+ method,
679
+ invocation: direct,
680
+ parameters: [],
681
+ result
682
+ })),
683
+ ...["excludeModel", "restoreModel"].map((method) => ({
684
+ id: `dsh-github-copilot:githubCopilot.${method}`,
685
+ service: "githubCopilotAuthorization",
686
+ namespace: "githubCopilot",
687
+ method,
688
+ invocation: direct,
689
+ parameters: [{
690
+ name: "modelId",
691
+ wire: "modelId",
692
+ source: "json",
693
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
694
+ }],
695
+ result
696
+ })),
697
+ {
698
+ id: "dsh-github-copilot:githubCopilot.setModelExcluded",
699
+ service: "githubCopilotAuthorization",
700
+ namespace: "githubCopilot",
701
+ method: "setModelExcluded",
702
+ invocation: direct,
703
+ parameters: [{
704
+ name: "modelId",
705
+ wire: "modelId",
706
+ source: "json",
707
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
708
+ }, {
709
+ name: "excluded",
710
+ wire: "excluded",
711
+ source: "json",
712
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelExcluded", z.boolean())
713
+ }],
714
+ result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
715
+ },
716
+ {
717
+ id: "dsh-github-copilot:githubCopilot.migrationStatus",
718
+ service: "githubCopilotAuthorization",
719
+ namespace: "githubCopilot",
720
+ method: "migrationStatus",
721
+ invocation: direct,
722
+ parameters: [],
723
+ result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
724
+ },
725
+ ...contribution$6.descriptors,
726
+ ...contribution$5.descriptors,
727
+ ...contribution$4.descriptors,
728
+ ...contribution$3.descriptors,
729
+ ...contribution$2.descriptors,
730
+ ...contribution$1.descriptors
731
+ ]
732
+ };
733
+ //#endregion
734
+ export { GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema, GitHubCopilotMigrationStatusSchema, GitHubCopilotModelPreferencesViewSchema, contribution as default };