dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5

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 (209) hide show
  1. package/AGENTS.md +439 -0
  2. package/CHANGELOG.md +875 -0
  3. package/CONTRIBUTING.md +55 -0
  4. package/LICENSE +21 -0
  5. package/README.md +366 -0
  6. package/README.zh.md +341 -0
  7. package/SECURITY.md +29 -0
  8. package/cordis.patch.yml +16 -0
  9. package/deployment-baseline.json +1580 -0
  10. package/docs/account-management-experience.md +143 -0
  11. package/docs/agent-readiness.md +110 -0
  12. package/docs/auto-high-cost.md +255 -0
  13. package/docs/auto-iteration-review.json +22 -0
  14. package/docs/auto-review-sampling.md +60 -0
  15. package/docs/auto-task-routing.md +341 -0
  16. package/docs/automatic-model-routing.md +236 -0
  17. package/docs/copilot-accounts.md +424 -0
  18. package/docs/copilot-compaction.md +148 -0
  19. package/docs/copilot-usage.md +133 -0
  20. package/docs/dual-model.md +66 -0
  21. package/docs/evidence-driven-iteration.md +86 -0
  22. package/docs/image-input-compatibility.md +64 -0
  23. package/docs/images/copilot-accounts-credits.png +0 -0
  24. package/docs/images/copilot-accounts.png +0 -0
  25. package/docs/images/copilot-current-provenance.json +39 -0
  26. package/docs/images/copilot-model-preferences.png +0 -0
  27. package/docs/images/copilot-search-routing.png +0 -0
  28. package/docs/images/copilot-session-continuation.png +0 -0
  29. package/docs/images/dual-model-desktop.png +0 -0
  30. package/docs/images/dual-model-mobile.png +0 -0
  31. package/docs/images/dual-model-provenance.json +35 -0
  32. package/docs/images/parent-model-follow.png +0 -0
  33. package/docs/manual-compaction-recovery.md +109 -0
  34. package/docs/mockups/copilot-account-dropdown.html +71 -0
  35. package/docs/mockups/copilot-account-management.html +393 -0
  36. package/docs/model-compatibility-acceptance.md +182 -0
  37. package/docs/npm-distribution.md +202 -0
  38. package/docs/official-first-016-alpha2.md +66 -0
  39. package/docs/official-first-020-rc1.md +32 -0
  40. package/docs/official-first-020-rc2.md +17 -0
  41. package/docs/official-first-021-alpha4.md +157 -0
  42. package/docs/official-first-021-alpha5.md +83 -0
  43. package/docs/plugin-diagnostics.md +605 -0
  44. package/docs/session-continuation.md +141 -0
  45. package/docs/session-search-routing.md +133 -0
  46. package/docs/single-route-migration.md +131 -0
  47. package/docs/web-lifecycle-rc2.md +55 -0
  48. package/lib/client.js +13236 -0
  49. package/lib/client.js.map +1 -0
  50. package/lib/copilot-identity-DRZY_d2X.js +15 -0
  51. package/lib/diagnostics-analysis-io.js +78 -0
  52. package/lib/diagnostics-analysis.js +427 -0
  53. package/lib/diagnostics-types-CF-qg8Do.js +708 -0
  54. package/lib/index.js +15661 -0
  55. package/lib/manual-compaction-recovery.js +485 -0
  56. package/lib/remote.js +1507 -0
  57. package/lib/request-budget-DLY_aRq0.js +87 -0
  58. package/lib/routed-web.js +120 -0
  59. package/lib/search-routing-CV2hs8as.js +792 -0
  60. package/lib/types/account-dropdown.d.ts +22 -0
  61. package/lib/types/account-model-auth.d.ts +15 -0
  62. package/lib/types/account-model-catalog.d.ts +70 -0
  63. package/lib/types/account-model-source.d.ts +85 -0
  64. package/lib/types/agent-compaction.d.ts +4 -0
  65. package/lib/types/authorization-code-clipboard.d.ts +4 -0
  66. package/lib/types/authorization-controller.d.ts +121 -0
  67. package/lib/types/auto-allocation-card.d.ts +9 -0
  68. package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
  69. package/lib/types/auto-allocation-evidence.d.ts +44 -0
  70. package/lib/types/auto-allocation.d.ts +47 -0
  71. package/lib/types/auto-assessment-evidence.d.ts +111 -0
  72. package/lib/types/auto-model-host.d.ts +30 -0
  73. package/lib/types/auto-model-intent.d.ts +36 -0
  74. package/lib/types/auto-model-presentation.d.ts +57 -0
  75. package/lib/types/auto-model-routing.d.ts +64 -0
  76. package/lib/types/auto-review-sampling.d.ts +6 -0
  77. package/lib/types/auto-selection-explanation.d.ts +9 -0
  78. package/lib/types/auto-task-assessment.d.ts +49 -0
  79. package/lib/types/auto-task-classifier.d.ts +10 -0
  80. package/lib/types/background-compaction.d.ts +30 -0
  81. package/lib/types/client.d.ts +129 -0
  82. package/lib/types/compact-account.d.ts +42 -0
  83. package/lib/types/compaction-continuation-ui.d.ts +29 -0
  84. package/lib/types/compaction-continuation.d.ts +48 -0
  85. package/lib/types/compaction-input-estimate.d.ts +28 -0
  86. package/lib/types/compaction-pressure.d.ts +23 -0
  87. package/lib/types/compaction-replay.d.ts +18 -0
  88. package/lib/types/compatibility.d.ts +17 -0
  89. package/lib/types/composer-notice-style.d.ts +7 -0
  90. package/lib/types/config.d.ts +141 -0
  91. package/lib/types/content-file.d.ts +10 -0
  92. package/lib/types/context-evidence-ui.d.ts +28 -0
  93. package/lib/types/context-evidence.d.ts +256 -0
  94. package/lib/types/context-usage.d.ts +4 -0
  95. package/lib/types/copilot-account-presentation.d.ts +7 -0
  96. package/lib/types/copilot-accounts-card.d.ts +43 -0
  97. package/lib/types/copilot-accounts-host.d.ts +93 -0
  98. package/lib/types/copilot-accounts-remote.d.ts +85 -0
  99. package/lib/types/copilot-accounts-types.d.ts +43 -0
  100. package/lib/types/copilot-auth.d.ts +31 -0
  101. package/lib/types/copilot-grant.d.ts +11 -0
  102. package/lib/types/copilot-identity.d.ts +11 -0
  103. package/lib/types/copilot-request.d.ts +11 -0
  104. package/lib/types/copilot-stream-liveness.d.ts +23 -0
  105. package/lib/types/copilot-usage-card.d.ts +51 -0
  106. package/lib/types/copilot-usage-host.d.ts +61 -0
  107. package/lib/types/copilot-usage-normalize.d.ts +9 -0
  108. package/lib/types/copilot-usage-remote.d.ts +63 -0
  109. package/lib/types/copilot-usage-types.d.ts +20 -0
  110. package/lib/types/copilot-usage-ui.d.ts +4 -0
  111. package/lib/types/current-provider.d.ts +59 -0
  112. package/lib/types/deepseek-search-fallback.d.ts +11 -0
  113. package/lib/types/diagnostics-analysis-io.d.ts +23 -0
  114. package/lib/types/diagnostics-analysis.d.ts +298 -0
  115. package/lib/types/diagnostics-card.d.ts +12 -0
  116. package/lib/types/diagnostics-client.d.ts +13 -0
  117. package/lib/types/diagnostics-collector.d.ts +50 -0
  118. package/lib/types/diagnostics-host.d.ts +183 -0
  119. package/lib/types/diagnostics-remote.d.ts +113 -0
  120. package/lib/types/diagnostics-types.d.ts +893 -0
  121. package/lib/types/dual-model-host.d.ts +119 -0
  122. package/lib/types/dual-model-remote.d.ts +63 -0
  123. package/lib/types/dual-model-types.d.ts +34 -0
  124. package/lib/types/external-link.d.ts +3 -0
  125. package/lib/types/failure.d.ts +38 -0
  126. package/lib/types/http.d.ts +48 -0
  127. package/lib/types/image-input-admission.d.ts +5 -0
  128. package/lib/types/index.d.ts +39 -0
  129. package/lib/types/manual-compaction-recovery.d.ts +67 -0
  130. package/lib/types/migration-status.d.ts +50 -0
  131. package/lib/types/model-exclusions.d.ts +15 -0
  132. package/lib/types/model-preferences-card.d.ts +9 -0
  133. package/lib/types/model-protocol.d.ts +31 -0
  134. package/lib/types/native-select-style.d.ts +4 -0
  135. package/lib/types/native-settings-style.d.ts +10 -0
  136. package/lib/types/parent-model-follow-card.d.ts +32 -0
  137. package/lib/types/parent-model-follow.d.ts +44 -0
  138. package/lib/types/pi-provider-bridge.d.ts +22 -0
  139. package/lib/types/plan.d.ts +148 -0
  140. package/lib/types/pre-step-pressure.d.ts +8 -0
  141. package/lib/types/preview-provider.d.ts +77 -0
  142. package/lib/types/preview-route.d.ts +76 -0
  143. package/lib/types/probe.d.ts +39 -0
  144. package/lib/types/remote-codec.d.ts +10 -0
  145. package/lib/types/remote.d.ts +202 -0
  146. package/lib/types/replay-recovery-host.d.ts +28 -0
  147. package/lib/types/replay-recovery-remote.d.ts +14 -0
  148. package/lib/types/replay-recovery-types.d.ts +24 -0
  149. package/lib/types/replay-recovery-ui.d.ts +28 -0
  150. package/lib/types/replay-recovery.d.ts +17 -0
  151. package/lib/types/request-body-composition.d.ts +17 -0
  152. package/lib/types/request-body-evidence.d.ts +37 -0
  153. package/lib/types/request-body-timeout-marker.d.ts +2 -0
  154. package/lib/types/request-body-timeout.d.ts +4 -0
  155. package/lib/types/request-budget.d.ts +58 -0
  156. package/lib/types/request-diagnostics.d.ts +278 -0
  157. package/lib/types/request-upload-evidence.d.ts +23 -0
  158. package/lib/types/response-error-body.d.ts +3 -0
  159. package/lib/types/responses-reasoning-text.d.ts +24 -0
  160. package/lib/types/responses-reasoning.d.ts +7 -0
  161. package/lib/types/responses-replay-compat.d.ts +31 -0
  162. package/lib/types/responses-request-compression.d.ts +33 -0
  163. package/lib/types/route-ownership.d.ts +70 -0
  164. package/lib/types/routed-web.d.ts +50 -0
  165. package/lib/types/search-backend.d.ts +16 -0
  166. package/lib/types/search-routing-host.d.ts +19 -0
  167. package/lib/types/search-routing-policy.d.ts +18 -0
  168. package/lib/types/search-routing-remote.d.ts +20 -0
  169. package/lib/types/search-routing.d.ts +43 -0
  170. package/lib/types/search-tool-routing.d.ts +22 -0
  171. package/lib/types/serialize.d.ts +106 -0
  172. package/lib/types/session-accounts-controller.d.ts +20 -0
  173. package/lib/types/session-accounts-host.d.ts +33 -0
  174. package/lib/types/session-accounts-remote.d.ts +114 -0
  175. package/lib/types/session-accounts.d.ts +38 -0
  176. package/lib/types/session-continuation-host.d.ts +45 -0
  177. package/lib/types/session-continuation-remote.d.ts +22 -0
  178. package/lib/types/session-continuation-types.d.ts +62 -0
  179. package/lib/types/session-continuation-ui.d.ts +49 -0
  180. package/lib/types/session-continuation.d.ts +14 -0
  181. package/lib/types/settings-reader.d.ts +16 -0
  182. package/lib/types/sse.d.ts +28 -0
  183. package/lib/types/temporary-models.d.ts +25 -0
  184. package/lib/types/tool-schema-compat.d.ts +17 -0
  185. package/lib/types/traditional-search.d.ts +17 -0
  186. package/lib/types/turn-model-provenance.d.ts +45 -0
  187. package/lib/types/turn-request-models.d.ts +55 -0
  188. package/lib/types/turn-selection-card.d.ts +24 -0
  189. package/lib/types/turn-selection-host.d.ts +35 -0
  190. package/lib/types/turn-selection-remote.d.ts +17 -0
  191. package/lib/types/turn-selection.d.ts +186 -0
  192. package/lib/types/turn-usage-evidence.d.ts +66 -0
  193. package/lib/types/turn-usage-notice.d.ts +7 -0
  194. package/lib/types/types.d.ts +69 -0
  195. package/lib/types/usage.d.ts +26 -0
  196. package/lib/types/watchdog.d.ts +22 -0
  197. package/lib/types/web-delegate.d.ts +12 -0
  198. package/lib/types/web-search-routing-card.d.ts +16 -0
  199. package/lib/types/web-search-routing-config.d.ts +12 -0
  200. package/lib/types/wire-anthropic.d.ts +37 -0
  201. package/lib/types/wire.d.ts +56 -0
  202. package/lib/web-delegate.js +9 -0
  203. package/output/auto-model-mockup/index.html +207 -0
  204. package/package.json +261 -0
  205. package/scripts/analyze-diagnostics.mjs +91 -0
  206. package/scripts/check-search-composition.mjs +191 -0
  207. package/scripts/iteration-review.mjs +53 -0
  208. package/scripts/release-policy.mjs +353 -0
  209. package/scripts/select-core-release.mjs +11 -0
package/lib/remote.js ADDED
@@ -0,0 +1,1507 @@
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$9 = {
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$8 = {
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 GITHUB_ACCOUNT_LOGIN_PATTERN = /^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$/u;
134
+ const COPILOT_ACCOUNTS_DIAGNOSTICS = [
135
+ "COPILOT_ACCOUNTS_SELECTOR_INVALID",
136
+ "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE",
137
+ "COPILOT_ACCOUNTS_SELECTED_MISSING",
138
+ "COPILOT_ACCOUNTS_CREDENTIALS_UNAVAILABLE",
139
+ "COPILOT_ACCOUNTS_CHANGED",
140
+ "COPILOT_ACCOUNTS_BUSY",
141
+ "COPILOT_ACCOUNTS_CONFLICT",
142
+ "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN",
143
+ "COPILOT_ACCOUNTS_MODELS_FAILED",
144
+ "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
145
+ "COPILOT_ACCOUNTS_IDENTITY_INVALID",
146
+ "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT",
147
+ "COPILOT_ACCOUNTS_IDENTITY_TLS",
148
+ "COPILOT_ACCOUNTS_IDENTITY_NETWORK",
149
+ "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED",
150
+ "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED",
151
+ "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR",
152
+ "COPILOT_ACCOUNTS_IDENTITY_CHANGED",
153
+ "COPILOT_ACCOUNTS_DUPLICATE",
154
+ "COPILOT_ACCOUNTS_ENTERPRISE_UNSUPPORTED",
155
+ "COPILOT_ACCOUNTS_ROUTE_BLOCKED",
156
+ "COPILOT_ACCOUNTS_EVIDENCE_INCOMPLETE",
157
+ "COPILOT_ACCOUNTS_LIMIT",
158
+ "COPILOT_ACCOUNTS_AUTH_FAILED",
159
+ "COPILOT_ACCOUNTS_AUTH_UNAVAILABLE",
160
+ "COPILOT_ACCOUNTS_ACTIVE_REMOVE_BLOCKED",
161
+ "COPILOT_ACCOUNTS_REMOVE_FAILED",
162
+ "COPILOT_ACCOUNTS_DISPOSED"
163
+ ];
164
+ //#endregion
165
+ //#region lib/types/copilot-usage-remote.js
166
+ const amount = z.number().finite().nonnegative().max(COPILOT_USAGE_MAX_AMOUNT);
167
+ const timestamp = z.number().int().nonnegative().max(COPILOT_USAGE_MAX_TIMESTAMP);
168
+ const CopilotUsageViewSchema = z.object({
169
+ accountId: z.string().max(36).regex(COPILOT_ACCOUNT_ID_PATTERN).optional(),
170
+ state: z.enum([
171
+ "ready",
172
+ "stale",
173
+ "unavailable",
174
+ "signed-out"
175
+ ]),
176
+ billing: z.enum([
177
+ "credits",
178
+ "requests",
179
+ "unknown"
180
+ ]),
181
+ budget: z.enum([
182
+ "individual",
183
+ "pooled",
184
+ "unknown"
185
+ ]),
186
+ used: amount.optional(),
187
+ remaining: amount.optional(),
188
+ limit: amount.positive().optional(),
189
+ percentUsed: z.number().finite().min(0).max(100).optional(),
190
+ resetAt: timestamp.optional(),
191
+ observedAt: timestamp.optional(),
192
+ diagnostic: z.enum(COPILOT_USAGE_DIAGNOSTICS).optional()
193
+ }).strict().superRefine((view, ctx) => {
194
+ const invalid = () => ctx.addIssue({
195
+ code: "custom",
196
+ message: "Invalid account quota snapshot"
197
+ });
198
+ const hasAmounts = [
199
+ view.used,
200
+ view.remaining,
201
+ view.limit,
202
+ view.percentUsed
203
+ ].some((value) => value !== void 0);
204
+ if (view.state === "unavailable" || view.state === "signed-out") {
205
+ if (hasAmounts || view.observedAt !== void 0 || view.resetAt !== void 0 || view.diagnostic === void 0) invalid();
206
+ if (view.state === "signed-out" && (view.billing !== "unknown" || view.budget !== "unknown")) invalid();
207
+ return;
208
+ }
209
+ if (!hasAmounts || view.observedAt === void 0 || view.billing === "unknown" || view.budget === "unknown") invalid();
210
+ if (view.state === "stale" && view.diagnostic === void 0) invalid();
211
+ if (view.state === "ready" && view.diagnostic !== void 0) invalid();
212
+ if (view.budget === "pooled" && (view.billing !== "credits" || view.used === void 0 || view.remaining !== void 0 || view.limit !== void 0 || view.percentUsed !== void 0)) invalid();
213
+ if (view.limit !== void 0) {
214
+ if (view.used !== void 0 && view.used > view.limit || view.remaining !== void 0 && view.remaining > view.limit) invalid();
215
+ 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();
216
+ if (view.remaining !== void 0 && view.percentUsed !== void 0 && Math.abs((1 - view.remaining / view.limit) * 100 - view.percentUsed) > 1) invalid();
217
+ }
218
+ });
219
+ const contribution$7 = {
220
+ package: "dsh-github-copilot",
221
+ descriptors: ["get", "refresh"].map((method) => ({
222
+ id: `dsh-github-copilot:githubCopilotUsage.${method}`,
223
+ namespace: "githubCopilotUsage",
224
+ service: "githubCopilotUsage",
225
+ method,
226
+ invocation: { kind: "direct" },
227
+ parameters: [],
228
+ result: strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema)
229
+ }))
230
+ };
231
+ //#endregion
232
+ //#region lib/types/auto-assessment-evidence.js
233
+ const milliseconds = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
234
+ const candidateCount = z.number().int().min(0).max(512);
235
+ const AssessmentProjectionSchema = z.object({
236
+ retainedMessages: z.number().int().min(0).max(12),
237
+ historyOmitted: z.boolean(),
238
+ taskTextLimited: z.boolean(),
239
+ continuationAnchor: z.enum([
240
+ "not-needed",
241
+ "retained",
242
+ "missing"
243
+ ])
244
+ }).strict().refine((value) => value.taskTextLimited || value.retainedMessages > 0 && value.continuationAnchor !== "missing", "Inconsistent task text evidence");
245
+ const ClassifierRejectionSchema = z.enum([
246
+ "excluded",
247
+ "configured-id",
248
+ "category",
249
+ "input",
250
+ "reasoning-disable-unproven",
251
+ "budget"
252
+ ]);
253
+ const candidateScan = z.object({
254
+ candidates: candidateCount,
255
+ eligible: candidateCount,
256
+ rejected: z.partialRecord(ClassifierRejectionSchema, candidateCount)
257
+ }).strict().refine((value) => value.eligible + Object.values(value.rejected).reduce((sum, count) => sum + count, 0) === value.candidates, "Inconsistent candidate counts");
258
+ const SemanticAssessmentEvidenceSchema = z.object({
259
+ modelId: z.string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u).optional(),
260
+ budgetMs: milliseconds.refine((value) => value > 0),
261
+ elapsedMs: milliseconds,
262
+ stage: z.enum([
263
+ "preparing",
264
+ "model-selected",
265
+ "adapter-started",
266
+ "text-received",
267
+ "finished"
268
+ ]),
269
+ adapterStartedMs: milliseconds.optional(),
270
+ firstTextMs: milliseconds.optional(),
271
+ nativeFinish: z.enum(["stop", "non-stop"]).optional(),
272
+ outputCharacters: z.number().int().min(0).max(2049),
273
+ validation: z.enum([
274
+ "not-validated",
275
+ "valid",
276
+ "invalid",
277
+ "context-omitted"
278
+ ]),
279
+ candidateScan: candidateScan.optional(),
280
+ preparationFailure: z.enum(["native-off-unavailable"]).optional(),
281
+ projection: AssessmentProjectionSchema.optional(),
282
+ classifierDemand: z.enum([
283
+ "simple",
284
+ "routine",
285
+ "complex",
286
+ "unknown"
287
+ ]).optional()
288
+ }).strict().superRefine((value, ctx) => {
289
+ 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({
290
+ code: "custom",
291
+ message: "Inconsistent assessment timing"
292
+ });
293
+ if (value.stage === "model-selected" && value.modelId === void 0 || [
294
+ "adapter-started",
295
+ "text-received",
296
+ "finished"
297
+ ].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 || value.classifierDemand !== void 0 && !["valid", "context-omitted"].includes(value.validation)) ctx.addIssue({
298
+ code: "custom",
299
+ message: "Inconsistent assessment phase"
300
+ });
301
+ });
302
+ //#endregion
303
+ //#region lib/types/auto-task-assessment.js
304
+ const TaskAssessmentSchema = z.object({
305
+ demand: z.enum([
306
+ "simple",
307
+ "routine",
308
+ "complex",
309
+ "unknown"
310
+ ]),
311
+ signals: z.array(z.enum([
312
+ "isolated-greeting",
313
+ "bounded-transformation",
314
+ "reasoning",
315
+ "investigation",
316
+ "continuation",
317
+ "context-omitted",
318
+ "insufficient-evidence"
319
+ ])).max(7)
320
+ }).strict();
321
+ //#endregion
322
+ //#region lib/types/auto-allocation.js
323
+ const AUTO_ALLOCATION_POLICIES = [
324
+ "high-cost-v1",
325
+ "high-cost-v2",
326
+ "high-cost-v3",
327
+ "high-cost-v4"
328
+ ];
329
+ const categories = [
330
+ "powerful",
331
+ "versatile",
332
+ "lightweight",
333
+ "unknown"
334
+ ];
335
+ function autoCategoryWeight(category, target) {
336
+ if (category === "unknown") return .02;
337
+ return [
338
+ 1,
339
+ .25,
340
+ .05
341
+ ][(target === "powerful" ? [
342
+ "powerful",
343
+ "versatile",
344
+ "lightweight"
345
+ ] : target === "lightweight" ? [
346
+ "lightweight",
347
+ "versatile",
348
+ "powerful"
349
+ ] : [
350
+ "versatile",
351
+ "powerful",
352
+ "lightweight"
353
+ ]).indexOf(category)];
354
+ }
355
+ const AutoAllocationSchema = z.object({
356
+ policyVersion: z.enum(AUTO_ALLOCATION_POLICIES),
357
+ targetCategory: z.enum([
358
+ "powerful",
359
+ "versatile",
360
+ "lightweight"
361
+ ]).optional(),
362
+ deferredHighCostCount: z.number().int().min(0).max(511).optional(),
363
+ selectedModelId: z.string().min(1).max(512),
364
+ candidates: z.array(z.object({
365
+ modelId: z.string().min(1).max(512),
366
+ category: z.enum(categories).optional(),
367
+ categoryWeight: z.number().positive().max(1).optional(),
368
+ highCost: z.boolean(),
369
+ previous: z.boolean(),
370
+ weight: z.number().positive().max(1.5),
371
+ expectedShare: z.number().positive().max(1)
372
+ }).strict()).min(1).max(512)
373
+ }).strict().refine((value) => {
374
+ const total = value.candidates.reduce((sum, row) => sum + row.weight, 0);
375
+ const legacy = value.policyVersion === "high-cost-v1";
376
+ const soft = value.policyVersion === "high-cost-v4";
377
+ const decay = value.policyVersion === "high-cost-v3" || soft;
378
+ const categoryValid = soft ? value.targetCategory !== void 0 && value.candidates.every((row) => row.category !== void 0 && row.categoryWeight === autoCategoryWeight(row.category, value.targetCategory)) : value.targetCategory === void 0 && value.candidates.every((row) => row.category === void 0 && row.categoryWeight === void 0);
379
+ const tierValid = legacy || decay ? value.deferredHighCostCount === void 0 : value.deferredHighCostCount !== void 0 && value.candidates.length + value.deferredHighCostCount <= 512 && value.candidates.every((row) => row.highCost === value.candidates[0].highCost) && (!value.candidates[0].highCost || value.deferredHighCostCount === 0);
380
+ return categoryValid && tierValid && new Set(value.candidates.map((row) => row.modelId)).size === value.candidates.length && value.candidates.some((row) => row.modelId === value.selectedModelId) && value.candidates.filter((row) => row.previous).length <= 1 && value.candidates.every((row) => row.weight === (decay && row.highCost && row.previous ? 2 : (row.highCost ? 20 : 100) * (row.previous && (legacy || !row.highCost) ? 1.5 : 1)) * (soft ? Math.round(row.categoryWeight * 100) : 100) / 1e4 && Math.abs(row.expectedShare - row.weight / total) <= 1e-12);
381
+ }, { message: "Invalid allocation policy evidence" });
382
+ //#endregion
383
+ //#region lib/types/auto-allocation-evidence.js
384
+ const AutoAllocationSummarySchema = z.object({
385
+ policyVersion: z.enum(AUTO_ALLOCATION_POLICIES),
386
+ scope: z.literal("viewed-session-host-lifetime"),
387
+ status: z.enum(["observed", "not-collected"]),
388
+ retainedDecisions: z.number().int().nonnegative().max(128),
389
+ noFitDecisions: z.number().int().nonnegative().max(128),
390
+ omittedPolicyDecisions: z.number().int().nonnegative().max(128).optional(),
391
+ rowsTruncated: z.boolean(),
392
+ completeHistory: z.literal(false),
393
+ observationStart: z.number().int().nonnegative().nullable(),
394
+ observationEnd: z.number().int().nonnegative().nullable(),
395
+ rows: z.array(z.object({
396
+ modelId: z.string().min(1).max(512),
397
+ category: z.enum([
398
+ "powerful",
399
+ "versatile",
400
+ "lightweight",
401
+ "unknown"
402
+ ]),
403
+ highCost: z.boolean(),
404
+ previous: z.boolean(),
405
+ weight: z.number().positive().max(1.5),
406
+ opportunities: z.number().int().positive().max(128),
407
+ expectedSelections: z.number().nonnegative().max(128),
408
+ selections: z.number().int().nonnegative().max(128)
409
+ }).strict()).max(512)
410
+ }).strict();
411
+ //#endregion
412
+ //#region lib/types/turn-selection.js
413
+ const ExplanationSchema = z.object({
414
+ allocationPolicy: z.literal("high-cost-v4").optional(),
415
+ assessment: TaskAssessmentSchema.extend({
416
+ source: z.enum(["local", "semantic"]),
417
+ diagnostic: z.enum([
418
+ "disabled",
419
+ "unavailable",
420
+ "invalid-result",
421
+ "timeout",
422
+ "failed",
423
+ "context-omitted"
424
+ ]).optional(),
425
+ semantic: SemanticAssessmentEvidenceSchema.optional()
426
+ }).strict(),
427
+ targetCategory: z.enum([
428
+ "powerful",
429
+ "versatile",
430
+ "lightweight"
431
+ ]),
432
+ selectedCategory: z.enum([
433
+ "powerful",
434
+ "versatile",
435
+ "lightweight",
436
+ "unknown"
437
+ ]),
438
+ categoryCandidateCount: z.number().int().min(0).max(512),
439
+ method: z.enum([
440
+ "continuity",
441
+ "equal-distribution",
442
+ "weighted-distribution",
443
+ "only-candidate",
444
+ "no-fit"
445
+ ]),
446
+ fallback: z.boolean(),
447
+ allocation: AutoAllocationSchema.optional()
448
+ }).strict();
449
+ const TurnSelectionSchema = z.discriminatedUnion("mode", [
450
+ z.object({ mode: z.literal("unknown") }).strict(),
451
+ z.object({ mode: z.literal("manual") }).strict(),
452
+ z.object({
453
+ mode: z.literal("auto"),
454
+ preference: z.enum([
455
+ "efficiency",
456
+ "balance",
457
+ "intelligence"
458
+ ]),
459
+ reason: z.enum([
460
+ "short-text-turn",
461
+ "standard-turn",
462
+ "large-structured-turn",
463
+ "image-capability"
464
+ ]),
465
+ candidateCount: z.number().int().positive(),
466
+ fittingCandidateCount: z.number().int().nonnegative().optional(),
467
+ explanation: ExplanationSchema.optional()
468
+ }).strict()
469
+ ]);
470
+ //#endregion
471
+ //#region lib/types/turn-request-models.js
472
+ const count = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
473
+ const route = z.object({
474
+ provider: z.string().trim().min(1).max(1024),
475
+ model: z.string().trim().min(1).max(1024)
476
+ }).strict();
477
+ const RequestedModelsSchema = z.object({
478
+ routes: z.array(route).max(32),
479
+ incomplete: z.boolean()
480
+ }).strict();
481
+ const row = RequestedModelsSchema.extend({ turn: count }).strict();
482
+ z.object({
483
+ active: z.object({
484
+ turn: count,
485
+ step: count.nullable()
486
+ }).strict().nullable(),
487
+ turns: z.array(row).max(128)
488
+ }).strict();
489
+ //#endregion
490
+ //#region lib/types/turn-selection-remote.js
491
+ const contribution$6 = {
492
+ package: "dsh-github-copilot",
493
+ descriptors: [
494
+ {
495
+ id: "dsh-github-copilot:githubCopilotTurnSelection.get",
496
+ namespace: "githubCopilotTurnSelection",
497
+ service: "githubCopilotTurnSelection",
498
+ method: "get",
499
+ invocation: { kind: "direct" },
500
+ parameters: [{
501
+ name: "agent",
502
+ wire: "agentId",
503
+ source: "lookup",
504
+ lookup: "agent",
505
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
506
+ }, {
507
+ name: "turn",
508
+ wire: "turn",
509
+ source: "json",
510
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
511
+ }],
512
+ result: strictRemoteCodec("dsh-github-copilot#TurnSelection", TurnSelectionSchema)
513
+ },
514
+ {
515
+ id: "dsh-github-copilot:githubCopilotTurnSelection.requestedModels",
516
+ namespace: "githubCopilotTurnSelection",
517
+ service: "githubCopilotTurnSelection",
518
+ method: "requestedModels",
519
+ invocation: { kind: "direct" },
520
+ parameters: [{
521
+ name: "agent",
522
+ wire: "agentId",
523
+ source: "lookup",
524
+ lookup: "agent",
525
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
526
+ }, {
527
+ name: "turn",
528
+ wire: "turn",
529
+ source: "json",
530
+ codec: strictRemoteCodec("dsh-github-copilot#TurnSelectionTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
531
+ }],
532
+ result: strictRemoteCodec("dsh-github-copilot#RequestedModels", RequestedModelsSchema)
533
+ },
534
+ {
535
+ id: "dsh-github-copilot:githubCopilotTurnSelection.allocationSummary",
536
+ namespace: "githubCopilotTurnSelection",
537
+ service: "githubCopilotTurnSelection",
538
+ method: "allocationSummary",
539
+ invocation: { kind: "direct" },
540
+ parameters: [{
541
+ name: "agent",
542
+ wire: "agentId",
543
+ source: "lookup",
544
+ lookup: "agent",
545
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
546
+ }],
547
+ result: strictRemoteCodec("dsh-github-copilot#AutoAllocationSummary", AutoAllocationSummarySchema)
548
+ }
549
+ ]
550
+ };
551
+ //#endregion
552
+ //#region lib/types/replay-recovery-types.js
553
+ const ReplayRecoveryDurationSchema = z.enum(["next-turn", "session"]);
554
+ const ReplayRecoveryViewSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("unavailable") }).strict(), z.object({
555
+ state: z.enum(["available", "enabled"]),
556
+ revision: z.string().uuid(),
557
+ itemCount: z.number().int().positive().max(512),
558
+ model: z.string().min(1).max(256),
559
+ duration: ReplayRecoveryDurationSchema.optional(),
560
+ expiresAt: z.number().int().nonnegative().optional()
561
+ }).strict()]);
562
+ //#endregion
563
+ //#region lib/types/replay-recovery-remote.js
564
+ const agent$1 = {
565
+ name: "agent",
566
+ wire: "agentId",
567
+ source: "lookup",
568
+ lookup: "agent",
569
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
570
+ };
571
+ const contribution$5 = {
572
+ package: "dsh-github-copilot",
573
+ descriptors: [
574
+ {
575
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.get",
576
+ namespace: "githubCopilotReplayRecovery",
577
+ service: "githubCopilotReplayRecovery",
578
+ method: "get",
579
+ invocation: { kind: "direct" },
580
+ parameters: [agent$1],
581
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
582
+ },
583
+ {
584
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.authorize",
585
+ namespace: "githubCopilotReplayRecovery",
586
+ service: "githubCopilotReplayRecovery",
587
+ method: "authorize",
588
+ invocation: { kind: "direct" },
589
+ parameters: [
590
+ agent$1,
591
+ {
592
+ name: "revision",
593
+ wire: "revision",
594
+ source: "json",
595
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", z.string().uuid())
596
+ },
597
+ {
598
+ name: "duration",
599
+ wire: "duration",
600
+ source: "json",
601
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryDuration", ReplayRecoveryDurationSchema)
602
+ }
603
+ ],
604
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
605
+ },
606
+ {
607
+ id: "dsh-github-copilot:githubCopilotReplayRecovery.setEnabled",
608
+ namespace: "githubCopilotReplayRecovery",
609
+ service: "githubCopilotReplayRecovery",
610
+ method: "setEnabled",
611
+ invocation: { kind: "direct" },
612
+ parameters: [
613
+ agent$1,
614
+ {
615
+ name: "revision",
616
+ wire: "revision",
617
+ source: "json",
618
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryRevision", z.string().uuid())
619
+ },
620
+ {
621
+ name: "enabled",
622
+ wire: "enabled",
623
+ source: "json",
624
+ codec: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryEnabled", z.boolean())
625
+ }
626
+ ],
627
+ result: strictRemoteCodec("dsh-github-copilot#ReplayRecoveryView", ReplayRecoveryViewSchema)
628
+ }
629
+ ]
630
+ };
631
+ //#endregion
632
+ //#region lib/types/copilot-accounts-remote.js
633
+ const CopilotAccountIdSchema = z.string().max(36).regex(COPILOT_ACCOUNT_ID_PATTERN);
634
+ const revision = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
635
+ const CopilotAccountsViewSchema = z.object({
636
+ state: z.enum(["ready", "error"]),
637
+ activeAccountId: CopilotAccountIdSchema,
638
+ revision: revision.optional(),
639
+ writable: z.boolean(),
640
+ switchable: z.boolean(),
641
+ accounts: z.array(z.object({
642
+ id: CopilotAccountIdSchema,
643
+ configured: z.boolean(),
644
+ identityState: z.enum([
645
+ "ready",
646
+ "unavailable",
647
+ "unknown"
648
+ ]),
649
+ identity: z.object({
650
+ login: z.string().min(1).max(39).regex(GITHUB_ACCOUNT_LOGIN_PATTERN),
651
+ userId: z.number().int().positive().max(Number.MAX_SAFE_INTEGER)
652
+ }).strict().optional()
653
+ }).strict()).max(32),
654
+ operation: z.enum([
655
+ "authorizing",
656
+ "verifying",
657
+ "switching"
658
+ ]).optional(),
659
+ notices: z.array(z.object({
660
+ message: z.string().min(1).max(512),
661
+ url: z.literal("https://github.com/login/device").optional(),
662
+ code: z.string().min(1).max(32).regex(/^[A-Z0-9-]+$/u).optional()
663
+ }).strict()).max(8),
664
+ diagnostic: z.enum(COPILOT_ACCOUNTS_DIAGNOSTICS).optional()
665
+ }).strict().superRefine((view, ctx) => {
666
+ const invalid = () => ctx.addIssue({
667
+ code: "custom",
668
+ message: "Invalid account evidence"
669
+ });
670
+ if (view.state === "error" !== (view.diagnostic !== void 0)) invalid();
671
+ if (view.switchable && (!view.writable || view.operation !== void 0 || view.state !== "ready" && view.diagnostic !== "COPILOT_ACCOUNTS_SELECTED_MISSING")) invalid();
672
+ if (view.writable && view.revision === void 0) invalid();
673
+ if (new Set(view.accounts.map((row) => row.id)).size !== view.accounts.length) invalid();
674
+ for (const row of view.accounts) {
675
+ if (row.identityState === "ready" !== (row.identity !== void 0)) invalid();
676
+ if (row.identity !== void 0 && !row.configured) invalid();
677
+ }
678
+ });
679
+ const contribution$4 = {
680
+ package: "dsh-github-copilot",
681
+ descriptors: [
682
+ "get",
683
+ "refreshIdentity",
684
+ "ensureIdentity",
685
+ "add",
686
+ "cancel",
687
+ "switchAccount",
688
+ "removeAccount",
689
+ "reauthorize"
690
+ ].map((method) => ({
691
+ id: `dsh-github-copilot:githubCopilotAccounts.${method}`,
692
+ namespace: "githubCopilotAccounts",
693
+ service: "githubCopilotAccounts",
694
+ method,
695
+ invocation: { kind: "direct" },
696
+ parameters: method === "switchAccount" || method === "removeAccount" || method === "reauthorize" ? [{
697
+ name: "accountId",
698
+ wire: "accountId",
699
+ source: "json",
700
+ codec: strictRemoteCodec("dsh-github-copilot#CopilotAccountId", CopilotAccountIdSchema)
701
+ }, {
702
+ name: "expectedRevision",
703
+ wire: "expectedRevision",
704
+ source: "json",
705
+ codec: strictRemoteCodec("dsh-github-copilot#CopilotAccountsRevision", revision)
706
+ }] : [],
707
+ result: strictRemoteCodec("dsh-github-copilot#CopilotAccountsView", CopilotAccountsViewSchema)
708
+ }))
709
+ };
710
+ //#endregion
711
+ //#region lib/types/session-accounts-remote.js
712
+ const SessionAccountViewSchema = z.object({
713
+ source: z.enum(["global", "session"]),
714
+ accountId: CopilotAccountIdSchema,
715
+ globalAccountId: CopilotAccountIdSchema,
716
+ runningAccountId: CopilotAccountIdSchema.optional(),
717
+ accounts: CopilotAccountsViewSchema
718
+ }).strict().refine((view) => view.accountId === view.accounts.activeAccountId, { message: "Session account identity mismatch" });
719
+ const TurnAccountViewSchema = z.discriminatedUnion("state", [z.object({ state: z.literal("unknown") }).strict(), z.object({
720
+ state: z.literal("recorded"),
721
+ accountId: CopilotAccountIdSchema,
722
+ source: z.enum(["global", "session"]),
723
+ identity: CopilotAccountsViewSchema.shape.accounts.element.shape.identity
724
+ }).strict()]);
725
+ const agent = {
726
+ name: "agent",
727
+ wire: "agentId",
728
+ source: "lookup",
729
+ lookup: "agent",
730
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
731
+ };
732
+ const contribution$3 = {
733
+ package: "dsh-github-copilot",
734
+ descriptors: [
735
+ "get",
736
+ "set",
737
+ "refreshIdentity",
738
+ "ensureIdentity",
739
+ "usage",
740
+ "refreshUsage",
741
+ "turn"
742
+ ].map((method) => ({
743
+ id: `dsh-github-copilot:githubCopilotSessionAccount.${method}`,
744
+ namespace: "githubCopilotSessionAccount",
745
+ service: "githubCopilotSessionAccount",
746
+ method,
747
+ invocation: { kind: "direct" },
748
+ parameters: [agent, ...method === "set" ? [{
749
+ name: "accountId",
750
+ wire: "accountId",
751
+ source: "json",
752
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountChoice", CopilotAccountIdSchema.nullable())
753
+ }, {
754
+ name: "revision",
755
+ wire: "revision",
756
+ source: "json",
757
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountRevision", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
758
+ }] : method === "turn" ? [{
759
+ name: "turn",
760
+ wire: "turn",
761
+ source: "json",
762
+ codec: strictRemoteCodec("dsh-github-copilot#SessionAccountTurn", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
763
+ }] : []],
764
+ result: method === "usage" || method === "refreshUsage" ? strictRemoteCodec("dsh-github-copilot#CopilotUsageView", CopilotUsageViewSchema) : method === "turn" ? strictRemoteCodec("dsh-github-copilot#TurnAccountView", TurnAccountViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionAccountView", SessionAccountViewSchema)
765
+ }))
766
+ };
767
+ //#endregion
768
+ //#region lib/types/session-continuation-types.js
769
+ const CompactionContinuationStatusSchema = z.object({
770
+ id: z.string().min(1).max(256),
771
+ state: z.enum([
772
+ "running",
773
+ "completed",
774
+ "failed",
775
+ "cancelled",
776
+ "blocked"
777
+ ])
778
+ }).strict();
779
+ z.object({
780
+ id: z.string().nullable(),
781
+ running: z.boolean()
782
+ }).strict();
783
+ const SessionContinuationPreferenceSchema = z.object({
784
+ sessionId: z.string().min(1).max(256).refine((value) => !/[\p{Cc}\p{Cf}]/u.test(value)),
785
+ version: z.literal(1),
786
+ consentedAt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
787
+ enabled: z.boolean().optional()
788
+ }).strict();
789
+ z.array(SessionContinuationPreferenceSchema).max(2048).refine((rows) => new Set(rows.map((row) => row.sessionId)).size === rows.length);
790
+ z.array(z.object({
791
+ enabled: z.boolean(),
792
+ changedAt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)
793
+ }).strict()).max(2048).refine((rows) => rows.every((row, index) => index === 0 || row.changedAt > rows[index - 1].changedAt));
794
+ const ContinuationDefaultViewSchema = z.object({
795
+ enabled: z.boolean(),
796
+ revision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)
797
+ }).strict();
798
+ const SessionContinuationViewSchema = z.object({
799
+ enabled: z.boolean(),
800
+ revision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
801
+ activeTurnEnabled: z.boolean().optional(),
802
+ source: z.enum(["default", "session"]).optional(),
803
+ nextTurnAuthorized: z.boolean().optional(),
804
+ compaction: CompactionContinuationStatusSchema.optional()
805
+ }).strict();
806
+ //#endregion
807
+ //#region lib/types/session-continuation-remote.js
808
+ const contribution$2 = {
809
+ package: "dsh-github-copilot",
810
+ descriptors: [
811
+ "get",
812
+ "set",
813
+ "authorizeNext",
814
+ "defaults",
815
+ "setDefault"
816
+ ].map((method) => ({
817
+ id: `dsh-github-copilot:githubCopilotSessionContinuation.${method}`,
818
+ namespace: "githubCopilotSessionContinuation",
819
+ service: "githubCopilotSessionContinuation",
820
+ method,
821
+ invocation: { kind: "direct" },
822
+ parameters: [...method === "defaults" || method === "setDefault" ? [] : [{
823
+ name: "agent",
824
+ wire: "agentId",
825
+ source: "lookup",
826
+ lookup: "agent",
827
+ codec: strictRemoteCodec("@deepseek-ai/dsh-session/types#SessionId", z.string().min(1).max(256))
828
+ }], ...method === "set" || method === "authorizeNext" || method === "setDefault" ? [{
829
+ name: "revision",
830
+ wire: "revision",
831
+ source: "json",
832
+ codec: strictRemoteCodec("dsh-github-copilot#SessionContinuationRevision", z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER))
833
+ }, {
834
+ name: "enabled",
835
+ wire: "enabled",
836
+ source: "json",
837
+ codec: strictRemoteCodec("dsh-github-copilot#SessionContinuationEnabled", method === "set" ? z.boolean().nullable() : z.boolean())
838
+ }] : []],
839
+ result: method === "defaults" || method === "setDefault" ? strictRemoteCodec("dsh-github-copilot#ContinuationDefaultView", ContinuationDefaultViewSchema) : strictRemoteCodec("dsh-github-copilot#SessionContinuationView", SessionContinuationViewSchema)
840
+ }))
841
+ };
842
+ //#endregion
843
+ //#region lib/types/auto-allocation-diagnostics.js
844
+ const AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS = 1024;
845
+ const dayMs = 864e5;
846
+ const integer$2 = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
847
+ const version$1 = z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
848
+ const assessmentOutcome = z.enum([
849
+ "local-known",
850
+ "local-unknown",
851
+ "semantic-known",
852
+ "semantic-unknown",
853
+ "disabled",
854
+ "unavailable",
855
+ "invalid-result",
856
+ "timeout",
857
+ "failed",
858
+ "context-omitted"
859
+ ]);
860
+ const allocationRow = z.object({
861
+ day: integer$2.multipleOf(dayMs),
862
+ version: version$1,
863
+ policyVersion: z.string().min(1).max(64),
864
+ modelId: z.string().min(1).max(512),
865
+ targetCategory: z.enum([
866
+ "powerful",
867
+ "versatile",
868
+ "lightweight"
869
+ ]),
870
+ category: z.enum([
871
+ "powerful",
872
+ "versatile",
873
+ "lightweight",
874
+ "unknown"
875
+ ]),
876
+ demand: z.enum([
877
+ "simple",
878
+ "routine",
879
+ "complex",
880
+ "unknown"
881
+ ]),
882
+ assessmentSource: z.enum(["local", "semantic"]),
883
+ assessmentOutcome: assessmentOutcome.optional(),
884
+ method: z.enum(["weighted-distribution", "only-candidate"]),
885
+ fallback: z.boolean(),
886
+ highCost: z.boolean(),
887
+ previous: z.boolean(),
888
+ weight: z.number().positive().max(1.5),
889
+ opportunities: integer$2.min(1),
890
+ expectedSelections: z.number().finite().nonnegative().max(Number.MAX_SAFE_INTEGER),
891
+ selections: integer$2
892
+ }).strict();
893
+ const noFitRow = z.object({
894
+ day: integer$2.multipleOf(dayMs),
895
+ version: version$1,
896
+ policyVersion: z.string().min(1).max(64),
897
+ targetCategory: z.enum([
898
+ "powerful",
899
+ "versatile",
900
+ "lightweight"
901
+ ]),
902
+ category: z.enum([
903
+ "powerful",
904
+ "versatile",
905
+ "lightweight",
906
+ "unknown"
907
+ ]),
908
+ demand: z.enum([
909
+ "simple",
910
+ "routine",
911
+ "complex",
912
+ "unknown"
913
+ ]),
914
+ assessmentSource: z.enum(["local", "semantic"]),
915
+ assessmentOutcome: assessmentOutcome.optional(),
916
+ decisions: integer$2.min(1)
917
+ }).strict();
918
+ const AutoAllocationDiagnosticsSchema = z.object({
919
+ status: z.enum(["observed", "not-collected"]),
920
+ rows: z.array(allocationRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
921
+ noFitRows: z.array(noFitRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
922
+ observationStart: integer$2.nullable(),
923
+ observationEnd: integer$2.nullable(),
924
+ completeHistory: z.literal(false),
925
+ rowsTruncated: z.boolean(),
926
+ dropped: integer$2,
927
+ expired: integer$2,
928
+ saturated: integer$2,
929
+ restarts: integer$2
930
+ }).strict().refine((value) => JSON.stringify(value).length <= 15e5, "Auto allocation diagnostic capacity exceeded").refine((value) => value.rows.length + value.noFitRows.length <= AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS, "Auto allocation row capacity exceeded").refine(({ observationStart, observationEnd }) => observationStart === null ? observationEnd === null : observationEnd !== null && observationEnd >= observationStart, "Auto allocation observation window is inconsistent");
931
+ //#endregion
932
+ //#region lib/types/request-diagnostics.js
933
+ const integer$1 = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
934
+ const composition = z.discriminatedUnion("state", [z.object({
935
+ state: z.literal("complete"),
936
+ totalBytes: integer$1,
937
+ conversationBytes: integer$1,
938
+ toolSchemaBytes: integer$1,
939
+ systemBytes: integer$1,
940
+ otherBytes: integer$1,
941
+ imageBlockBytes: integer$1,
942
+ opaqueReplayBytes: integer$1,
943
+ remainingConversationBytes: integer$1
944
+ }).strict(), z.object({
945
+ state: z.enum([
946
+ "unavailable",
947
+ "size-limit",
948
+ "work-limit",
949
+ "invalid-json",
950
+ "unsupported-shape",
951
+ "cancelled",
952
+ "time-limit"
953
+ ]),
954
+ totalBytes: integer$1.optional()
955
+ }).strict()]);
956
+ const upload = z.discriminatedUnion("state", [
957
+ z.object({
958
+ state: z.literal("observed"),
959
+ bodyWrite: z.enum(["observed", "not-observed"]),
960
+ bodyWriteCompleteMs: integer$1.optional(),
961
+ nativeResponseHeadersMs: integer$1.optional(),
962
+ alpn: z.enum([
963
+ "h2",
964
+ "http/1.1",
965
+ "unavailable"
966
+ ]),
967
+ nodeWritableBufferBytes: integer$1.optional()
968
+ }).strict(),
969
+ z.object({ state: z.enum(["unavailable", "work-limit"]) }).strict(),
970
+ z.object({
971
+ state: z.literal("ambiguous"),
972
+ requestCount: integer$1
973
+ }).strict()
974
+ ]);
975
+ const CredentialChangeReasonSchema = z.enum([
976
+ "qualified",
977
+ "unknown-source",
978
+ "account-changed",
979
+ "endpoint-changed",
980
+ "entitlements-changed",
981
+ "expired",
982
+ "auth-mismatch",
983
+ "duplicate-notification",
984
+ "missing-notification",
985
+ "commit-mismatch",
986
+ "write-failed",
987
+ "write-conflict"
988
+ ]);
989
+ const CredentialChangeSchema = z.object({
990
+ changeId: z.string().uuid(),
991
+ observedAt: integer$1,
992
+ version: z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
993
+ phase: z.enum(["notification", "commit"]),
994
+ reason: CredentialChangeReasonSchema,
995
+ preparing: integer$1,
996
+ dispatched: integer$1,
997
+ alreadyAborted: integer$1,
998
+ preserved: integer$1,
999
+ revoked: integer$1
1000
+ }).strict();
1001
+ const RequestDiagnosticSchema = z.object({
1002
+ streamId: z.string().uuid(),
1003
+ dispatchIndex: integer$1.min(1),
1004
+ version: z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
1005
+ startedAt: integer$1,
1006
+ elapsedMs: integer$1,
1007
+ model: z.string().max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
1008
+ protocol: z.enum([
1009
+ "openai-responses",
1010
+ "openai-completions",
1011
+ "anthropic-messages"
1012
+ ]),
1013
+ composition,
1014
+ encoding: z.enum([
1015
+ "identity",
1016
+ "gzip",
1017
+ "unknown"
1018
+ ]),
1019
+ wireBytes: integer$1.optional(),
1020
+ upload: upload.optional(),
1021
+ responseHeadersMs: integer$1.optional(),
1022
+ httpStatus: integer$1.min(100).max(599).optional(),
1023
+ outcome: z.enum([
1024
+ "http-error",
1025
+ "transport-error",
1026
+ "stream-done",
1027
+ "stream-error",
1028
+ "cancelled",
1029
+ "interrupted"
1030
+ ]),
1031
+ reason: z.enum([
1032
+ "none",
1033
+ "unknown",
1034
+ "request-body-timeout",
1035
+ "caller-abort",
1036
+ "credential-changed",
1037
+ "disposed",
1038
+ "byte-idle-timeout",
1039
+ "signal-abort"
1040
+ ])
1041
+ }).strict();
1042
+ const RequestDiagnosticsSchema = z.object({
1043
+ rows: z.array(RequestDiagnosticSchema).max(128),
1044
+ dropped: integer$1,
1045
+ evicted: integer$1,
1046
+ pending: integer$1.max(128).optional(),
1047
+ interruptedOnReopen: integer$1.optional(),
1048
+ credentialChanges: z.object({
1049
+ rows: z.array(CredentialChangeSchema).max(128),
1050
+ dropped: integer$1,
1051
+ evicted: integer$1,
1052
+ pending: integer$1.max(128).optional(),
1053
+ interruptedOnReopen: integer$1.optional()
1054
+ }).strict().optional()
1055
+ }).strict();
1056
+ //#endregion
1057
+ //#region lib/types/diagnostics-types.js
1058
+ const DIAGNOSTICS_OPERATIONS = [
1059
+ "account-global-switch",
1060
+ "account-session-select",
1061
+ "account-session-inherit",
1062
+ "identity-read",
1063
+ "identity-flight",
1064
+ "compaction",
1065
+ "compaction-summary",
1066
+ "collection"
1067
+ ];
1068
+ const DIAGNOSTICS_STAGES = [
1069
+ "admitted",
1070
+ "rpc-invoked",
1071
+ "host-received",
1072
+ "identity-validation",
1073
+ "model-validation",
1074
+ "cas",
1075
+ "readback",
1076
+ "response-received",
1077
+ "decoded",
1078
+ "client-settled",
1079
+ "summary-attempt",
1080
+ "checkpoint-committed",
1081
+ "ended",
1082
+ "cache-hit",
1083
+ "joined-flight",
1084
+ "cooldown",
1085
+ "dispatched"
1086
+ ];
1087
+ const DIAGNOSTICS_METRICS = [
1088
+ "started",
1089
+ "stage",
1090
+ "success",
1091
+ "no-op",
1092
+ "cancelled",
1093
+ "policy-rejected",
1094
+ "revoked",
1095
+ "environment-fault",
1096
+ "failed",
1097
+ "unknown",
1098
+ "interrupted",
1099
+ "dropped",
1100
+ "paused",
1101
+ "expired",
1102
+ "clock-discontinuity",
1103
+ "pending-sample"
1104
+ ];
1105
+ const DIAGNOSTICS_REASONS = [
1106
+ "none",
1107
+ "unknown",
1108
+ "rpc-unavailable",
1109
+ "decode-invalid",
1110
+ "COPILOT_ACCOUNTS_BUSY",
1111
+ "COPILOT_ACCOUNTS_CONFLICT",
1112
+ "COPILOT_ACCOUNTS_CHANGED",
1113
+ "COPILOT_ACCOUNTS_COMMIT_UNCERTAIN",
1114
+ "COPILOT_ACCOUNTS_IDENTITY_TIMEOUT",
1115
+ "COPILOT_ACCOUNTS_IDENTITY_UNAVAILABLE",
1116
+ "COPILOT_ACCOUNTS_MODELS_FAILED",
1117
+ "COPILOT_ACCOUNTS_SETTINGS_UNAVAILABLE",
1118
+ "COPILOT_ACCOUNTS_IDENTITY_TLS",
1119
+ "COPILOT_ACCOUNTS_IDENTITY_NETWORK",
1120
+ "COPILOT_ACCOUNTS_IDENTITY_RATE_LIMITED",
1121
+ "COPILOT_ACCOUNTS_IDENTITY_AUTH_REJECTED",
1122
+ "COPILOT_ACCOUNTS_IDENTITY_HTTP_ERROR",
1123
+ "COPILOT_ACCOUNTS_IDENTITY_INVALID",
1124
+ "COPILOT_SESSION_ACCOUNTS_UNAVAILABLE",
1125
+ "COPILOT_SESSION_ACCOUNTS_SETTINGS_UNAVAILABLE",
1126
+ "COPILOT_SESSION_ACCOUNTS_COMMIT_UNCERTAIN",
1127
+ "COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH",
1128
+ "CONTEXT_WINDOW_EXCEEDED",
1129
+ "COPILOT_MANUAL_RECOVERY_FIXED_PREFIX",
1130
+ "COPILOT_MANUAL_RECOVERY_INDIVISIBLE",
1131
+ "COPILOT_MANUAL_RECOVERY_TOKEN_METER_UNAVAILABLE",
1132
+ "COPILOT_MANUAL_RECOVERY_TOKEN_ESTIMATE_INVALID",
1133
+ "COPILOT_MANUAL_RECOVERY_CALL_LIMIT",
1134
+ "COPILOT_MANUAL_RECOVERY_EMPTY_SUMMARY",
1135
+ "COPILOT_MANUAL_RECOVERY_UNBALANCED"
1136
+ ];
1137
+ const DIAGNOSTICS_MAX_ROWS = 4096;
1138
+ const DIAGNOSTICS_MAX_BYTES = 2097152;
1139
+ const integer = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
1140
+ const version = z.string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
1141
+ const DiagnosticsRowSchema = z.object({
1142
+ hour: integer.multipleOf(36e5),
1143
+ version,
1144
+ layer: z.enum(["client", "host"]),
1145
+ operation: z.enum(DIAGNOSTICS_OPERATIONS),
1146
+ stage: z.enum(DIAGNOSTICS_STAGES),
1147
+ metric: z.enum(DIAGNOSTICS_METRICS),
1148
+ reason: z.enum(DIAGNOSTICS_REASONS),
1149
+ bucket: z.number().int().min(0).max(7),
1150
+ count: integer.min(1)
1151
+ }).strict();
1152
+ const DiagnosticsPendingSchema = z.object({
1153
+ version,
1154
+ operation: z.enum(DIAGNOSTICS_OPERATIONS),
1155
+ stage: z.enum(DIAGNOSTICS_STAGES),
1156
+ bucket: z.number().int().min(0).max(7),
1157
+ count: integer.min(1).max(128)
1158
+ }).strict();
1159
+ const DiagnosticsSnapshotSchema = z.object({
1160
+ schemaVersion: z.literal(1),
1161
+ coverageVersion: z.literal(1),
1162
+ epoch: integer,
1163
+ updatedAt: integer,
1164
+ rows: z.array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
1165
+ autoAllocation: AutoAllocationDiagnosticsSchema.optional(),
1166
+ requests: RequestDiagnosticsSchema.optional(),
1167
+ pending: z.array(DiagnosticsPendingSchema).max(128),
1168
+ dropped: integer,
1169
+ clientDropped: integer,
1170
+ clientUnconfirmed: integer,
1171
+ saturated: integer,
1172
+ evicted: integer,
1173
+ interrupted: integer
1174
+ }).strict().refine((value) => value.pending.reduce((sum, row) => sum + row.count, 0) <= 128, "Diagnostics pending capacity exceeded").refine((value) => JSON.stringify(value).length <= DIAGNOSTICS_MAX_BYTES, "Diagnostics capacity exceeded");
1175
+ const DiagnosticsViewSchema = z.object({
1176
+ enabled: z.boolean(),
1177
+ autoAllocationEnabled: z.boolean(),
1178
+ requestEnabled: z.boolean().optional(),
1179
+ state: z.enum([
1180
+ "loading",
1181
+ "ready",
1182
+ "unavailable",
1183
+ "error"
1184
+ ]),
1185
+ diagnostic: z.enum([
1186
+ "none",
1187
+ "storage-unavailable",
1188
+ "storage-invalid",
1189
+ "storage-write-failed",
1190
+ "profile-unavailable",
1191
+ "settings-unavailable",
1192
+ "settings-conflict",
1193
+ "client-report-failed",
1194
+ "client-report-revoked",
1195
+ "closed"
1196
+ ]),
1197
+ persistedAt: integer.optional(),
1198
+ dirty: z.boolean(),
1199
+ snapshot: DiagnosticsSnapshotSchema
1200
+ }).strict();
1201
+ //#endregion
1202
+ //#region lib/types/diagnostics-remote.js
1203
+ const ClientDiagnosticsBatchSchema = z.object({
1204
+ epoch: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1205
+ rows: z.array(DiagnosticsRowSchema.refine((row) => row.layer === "client")).max(128),
1206
+ dropped: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
1207
+ unconfirmed: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
1208
+ }).strict();
1209
+ const result$1 = strictRemoteCodec("dsh-github-copilot#DiagnosticsView", DiagnosticsViewSchema);
1210
+ const contribution$1 = {
1211
+ package: "dsh-github-copilot",
1212
+ descriptors: [
1213
+ {
1214
+ method: "get",
1215
+ parameters: []
1216
+ },
1217
+ {
1218
+ method: "clear",
1219
+ parameters: []
1220
+ },
1221
+ {
1222
+ method: "setEnabled",
1223
+ parameters: [{
1224
+ name: "enabled",
1225
+ wire: "enabled",
1226
+ source: "json",
1227
+ codec: strictRemoteCodec("dsh-github-copilot#DiagnosticsEnabled", z.boolean())
1228
+ }]
1229
+ },
1230
+ {
1231
+ method: "setAutoAllocationEnabled",
1232
+ parameters: [{
1233
+ name: "enabled",
1234
+ wire: "enabled",
1235
+ source: "json",
1236
+ codec: strictRemoteCodec("dsh-github-copilot#AutoAllocationDiagnosticsEnabled", z.boolean())
1237
+ }]
1238
+ },
1239
+ {
1240
+ method: "setRequestEnabled",
1241
+ parameters: [{
1242
+ name: "enabled",
1243
+ wire: "enabled",
1244
+ source: "json",
1245
+ codec: strictRemoteCodec("dsh-github-copilot#RequestDiagnosticsEnabled", z.boolean())
1246
+ }]
1247
+ },
1248
+ {
1249
+ method: "recordClient",
1250
+ parameters: [{
1251
+ name: "batch",
1252
+ wire: "batch",
1253
+ source: "json",
1254
+ codec: strictRemoteCodec("dsh-github-copilot#ClientDiagnosticsBatch", ClientDiagnosticsBatchSchema)
1255
+ }]
1256
+ }
1257
+ ].map((descriptor) => ({
1258
+ ...descriptor,
1259
+ id: `dsh-github-copilot:githubCopilotDiagnostics.${descriptor.method}`,
1260
+ namespace: "githubCopilotDiagnostics",
1261
+ service: "githubCopilotDiagnostics",
1262
+ invocation: { kind: "direct" },
1263
+ result: result$1
1264
+ }))
1265
+ };
1266
+ //#endregion
1267
+ //#region lib/types/remote.js
1268
+ /**
1269
+ * Client-safe Remote contribution for the plugin-owned authorization bridge.
1270
+ */
1271
+ const direct = { kind: "direct" };
1272
+ const GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotAuthorizationView";
1273
+ const GitHubCopilotAuthorizationViewSchema = z.object({
1274
+ phase: z.enum([
1275
+ "signed-out",
1276
+ "authorizing",
1277
+ "signed-in",
1278
+ "error"
1279
+ ]),
1280
+ configured: z.boolean(),
1281
+ writable: z.boolean(),
1282
+ inFlight: z.boolean(),
1283
+ notices: z.array(z.object({
1284
+ message: z.string(),
1285
+ url: z.string().optional(),
1286
+ code: z.string().optional()
1287
+ }).strict()),
1288
+ catalog: z.object({
1289
+ state: z.enum([
1290
+ "current",
1291
+ "partially-outdated",
1292
+ "outdated"
1293
+ ]),
1294
+ accountModelCount: z.number().int().nonnegative(),
1295
+ supportedModelCount: z.number().int().nonnegative(),
1296
+ unknownModelIds: z.array(z.string()),
1297
+ temporarilyUnavailableModelIds: z.array(z.string()).optional(),
1298
+ previewModelIds: z.array(z.string()).optional()
1299
+ }).strict().optional(),
1300
+ accountModels: z.object({
1301
+ state: z.enum([
1302
+ "idle",
1303
+ "loading",
1304
+ "ready",
1305
+ "stale",
1306
+ "error",
1307
+ "disposed",
1308
+ "unconfigured",
1309
+ "unavailable"
1310
+ ]),
1311
+ models: z.array(z.object({
1312
+ id: z.string(),
1313
+ name: z.string(),
1314
+ api: z.string()
1315
+ }).strict()).max(512),
1316
+ rejected: z.array(z.object({
1317
+ id: z.string().optional(),
1318
+ code: z.string()
1319
+ }).strict()).max(1024),
1320
+ warnings: z.array(z.object({
1321
+ id: z.string(),
1322
+ code: z.string()
1323
+ }).strict()).max(1024).optional(),
1324
+ discoveredAt: z.number().int().nonnegative().optional(),
1325
+ error: z.string().optional()
1326
+ }).strict().optional(),
1327
+ modelPreferences: z.object({
1328
+ state: z.enum(["ready", "error"]),
1329
+ writable: z.boolean(),
1330
+ revision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),
1331
+ excludedModelIds: z.array(z.string().min(1).max(512)).max(512),
1332
+ lockedModelIds: z.array(z.string().min(1).max(512)).max(512),
1333
+ unavailableExcludedModelIds: z.array(z.string().min(1).max(512)).max(512),
1334
+ highCostModelIds: z.array(z.string().min(1).max(512)).max(512).optional(),
1335
+ error: z.enum([
1336
+ "COPILOT_MODEL_PREFERENCES_UNAVAILABLE",
1337
+ "COPILOT_MODEL_SETTINGS_UNAVAILABLE",
1338
+ "COPILOT_MODEL_SETTINGS_INVALID",
1339
+ "COPILOT_MODEL_SELECTION_UNAVAILABLE",
1340
+ "COPILOT_MODEL_EXCLUSION_SELECTED",
1341
+ "COPILOT_MODEL_EXCLUSION_CONFLICT",
1342
+ "COPILOT_MODEL_EXCLUSION_SAVE_FAILED"
1343
+ ]).optional()
1344
+ }).strict().optional(),
1345
+ route: z.object({
1346
+ state: z.enum([
1347
+ "ready",
1348
+ "needs-repair",
1349
+ "not-configured",
1350
+ "conflict",
1351
+ "error"
1352
+ ]),
1353
+ diagnosticCode: z.enum([
1354
+ "ROUTE_READ_FAILED",
1355
+ "RECONCILIATION_FAILED",
1356
+ "ROUTE_CONFLICT"
1357
+ ]).optional()
1358
+ }).strict().optional(),
1359
+ error: z.string().optional(),
1360
+ authorizationMilestone: z.enum([
1361
+ "AUTHORIZATION_REQUESTED",
1362
+ "INTERACTION_PROMPT_OBSERVED",
1363
+ "INTERACTION_NOTICE_OBSERVED"
1364
+ ]).optional()
1365
+ }).strict();
1366
+ const result = strictRemoteCodec(GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema);
1367
+ const GitHubCopilotModelPreferencesViewSchema = GitHubCopilotAuthorizationViewSchema.shape.modelPreferences.unwrap();
1368
+ const GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL = "dsh-github-copilot#GitHubCopilotMigrationStatus";
1369
+ const selectionSchema = z.object({
1370
+ provider: z.string().min(1).max(512),
1371
+ model: z.string().min(1).max(512),
1372
+ reasoningEffort: z.string().min(1).max(512).optional()
1373
+ }).strict();
1374
+ /** Independent Ops result: strict at every object level; no account or private Session data. */
1375
+ const GitHubCopilotMigrationStatusSchema = z.object({
1376
+ plugin: z.object({
1377
+ name: z.literal("dsh-github-copilot"),
1378
+ version: z.string().min(1).max(512)
1379
+ }).strict(),
1380
+ protocolVersion: z.literal(1),
1381
+ historyScope: z.literal("live-agents-only"),
1382
+ observedAt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
1383
+ capabilities: z.object({
1384
+ agentsList: z.boolean(),
1385
+ sessionProjections: z.boolean(),
1386
+ settingsCas: z.boolean(),
1387
+ providerRegistry: z.boolean(),
1388
+ defaultSelection: z.boolean()
1389
+ }).strict(),
1390
+ complete: z.object({
1391
+ sessions: z.boolean(),
1392
+ defaultSelection: z.boolean(),
1393
+ routes: z.boolean()
1394
+ }).strict(),
1395
+ defaultSelection: selectionSchema.nullable(),
1396
+ sessions: z.array(z.object({
1397
+ id: z.string().min(1).max(512),
1398
+ status: z.enum(["idle", "running"]),
1399
+ effectiveSelection: selectionSchema.nullable(),
1400
+ selectionSource: z.enum([
1401
+ "pending",
1402
+ "request-header",
1403
+ "default",
1404
+ "unknown"
1405
+ ]),
1406
+ activeRequestSelection: selectionSchema.nullable()
1407
+ }).strict()).max(1024),
1408
+ routes: z.object({
1409
+ nativeConfigured: z.boolean().nullable(),
1410
+ nativeRegistered: z.boolean().nullable(),
1411
+ managedRegistered: z.boolean().nullable()
1412
+ }).strict()
1413
+ }).strict();
1414
+ const contribution = {
1415
+ package: "dsh-github-copilot",
1416
+ descriptors: [
1417
+ ...[
1418
+ "status",
1419
+ "reconcile",
1420
+ "discoverModels",
1421
+ "ensureModels",
1422
+ "start",
1423
+ "cancel",
1424
+ "signOut"
1425
+ ].map((method) => ({
1426
+ id: `dsh-github-copilot:githubCopilot.${method}`,
1427
+ service: "githubCopilotAuthorization",
1428
+ namespace: "githubCopilot",
1429
+ method,
1430
+ invocation: direct,
1431
+ parameters: [],
1432
+ result
1433
+ })),
1434
+ ...["excludeModel", "restoreModel"].map((method) => ({
1435
+ id: `dsh-github-copilot:githubCopilot.${method}`,
1436
+ service: "githubCopilotAuthorization",
1437
+ namespace: "githubCopilot",
1438
+ method,
1439
+ invocation: direct,
1440
+ parameters: [{
1441
+ name: "modelId",
1442
+ wire: "modelId",
1443
+ source: "json",
1444
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
1445
+ }],
1446
+ result
1447
+ })),
1448
+ {
1449
+ id: "dsh-github-copilot:githubCopilot.setModelExcluded",
1450
+ service: "githubCopilotAuthorization",
1451
+ namespace: "githubCopilot",
1452
+ method: "setModelExcluded",
1453
+ invocation: direct,
1454
+ parameters: [{
1455
+ name: "modelId",
1456
+ wire: "modelId",
1457
+ source: "json",
1458
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
1459
+ }, {
1460
+ name: "excluded",
1461
+ wire: "excluded",
1462
+ source: "json",
1463
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelExcluded", z.boolean())
1464
+ }],
1465
+ result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
1466
+ },
1467
+ {
1468
+ id: "dsh-github-copilot:githubCopilot.setModelHighCost",
1469
+ service: "githubCopilotAuthorization",
1470
+ namespace: "githubCopilot",
1471
+ method: "setModelHighCost",
1472
+ invocation: direct,
1473
+ parameters: [{
1474
+ name: "modelId",
1475
+ wire: "modelId",
1476
+ source: "json",
1477
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelId", z.string().min(1).max(512))
1478
+ }, {
1479
+ name: "highCost",
1480
+ wire: "highCost",
1481
+ source: "json",
1482
+ codec: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelHighCost", z.boolean())
1483
+ }],
1484
+ result: strictRemoteCodec("dsh-github-copilot#GitHubCopilotModelPreferencesView", GitHubCopilotModelPreferencesViewSchema)
1485
+ },
1486
+ {
1487
+ id: "dsh-github-copilot:githubCopilot.migrationStatus",
1488
+ service: "githubCopilotAuthorization",
1489
+ namespace: "githubCopilot",
1490
+ method: "migrationStatus",
1491
+ invocation: direct,
1492
+ parameters: [],
1493
+ result: strictRemoteCodec(GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotMigrationStatusSchema)
1494
+ },
1495
+ ...contribution$9.descriptors,
1496
+ ...contribution$8.descriptors,
1497
+ ...contribution$7.descriptors,
1498
+ ...contribution$6.descriptors,
1499
+ ...contribution$5.descriptors,
1500
+ ...contribution$4.descriptors,
1501
+ ...contribution$3.descriptors,
1502
+ ...contribution$2.descriptors,
1503
+ ...contribution$1.descriptors
1504
+ ]
1505
+ };
1506
+ //#endregion
1507
+ export { GITHUB_COPILOT_AUTHORIZATION_VIEW_TYPE_SYMBOL, GITHUB_COPILOT_MIGRATION_STATUS_TYPE_SYMBOL, GitHubCopilotAuthorizationViewSchema, GitHubCopilotMigrationStatusSchema, GitHubCopilotModelPreferencesViewSchema, contribution as default };