dsh-github-copilot 0.4.0-alpha.38 → 0.4.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1602,7 +1602,7 @@ let GitHubCopilotUsageController = (() => {
1602
1602
  //#endregion
1603
1603
  //#region package.json
1604
1604
  var name$1 = "dsh-github-copilot";
1605
- var version = "0.4.0-alpha.38";
1605
+ var version = "0.4.0-alpha.40";
1606
1606
  //#endregion
1607
1607
  //#region lib/types/probe.js
1608
1608
  /**
@@ -3744,10 +3744,10 @@ async function createDeepSeekSearchFallback(ctx, owner, canContinue) {
3744
3744
  * @module dsh-github-copilot/compatibility
3745
3745
  */
3746
3746
  const DSH_COMPATIBILITY = {
3747
- release: "0.2.0-rc.1",
3748
- developmentRelease: "0.2.0-rc.1",
3749
- peerRange: "0.2.0-rc.1",
3750
- supportedReleases: ["0.2.0-rc.1"],
3747
+ release: "0.2.0-rc.2",
3748
+ developmentRelease: "0.2.0-rc.2",
3749
+ peerRange: "0.2.0-rc.2",
3750
+ supportedReleases: ["0.2.0-rc.2"],
3751
3751
  requiredApis: [
3752
3752
  "agentDefaultModel.currentSelection",
3753
3753
  "authorization.describe",
@@ -4323,9 +4323,6 @@ function service(ctx, name, methods) {
4323
4323
  for (const method of methods) if (typeof Reflect.get(candidate, method) !== "function") throw new Error(`github-copilot: required DSH API "${name}.${method}" is unavailable`);
4324
4324
  return candidate;
4325
4325
  }
4326
- function messageOf(error) {
4327
- return error instanceof Error ? error.message : String(error);
4328
- }
4329
4326
  function providerModels(value) {
4330
4327
  if (!Array.isArray(value)) return void 0;
4331
4328
  const models = [];
@@ -4691,30 +4688,36 @@ let GitHubCopilotAuthorizationController = (() => {
4691
4688
  this.notices = [];
4692
4689
  this.failure = void 0;
4693
4690
  this.reconciliationFailed = false;
4694
- const running = authorization.begin({
4695
- key: GITHUB_COPILOT_CREDENTIAL_KEY,
4696
- method: oauth.id,
4697
- interaction: {
4698
- notify: (notice) => {
4699
- this.notices = [...this.notices, { ...notice }];
4700
- },
4701
- prompt: (prompt) => {
4702
- if (prompt.kind === "text" && /GitHub Enterprise URL\/domain/i.test(prompt.message)) return Promise.resolve("");
4703
- return Promise.reject(/* @__PURE__ */ new Error(`github-copilot: this browser bridge cannot answer authorization prompt "${prompt.message}"`));
4691
+ let begun;
4692
+ try {
4693
+ begun = authorization.begin({
4694
+ key: GITHUB_COPILOT_CREDENTIAL_KEY,
4695
+ method: oauth.id,
4696
+ interaction: {
4697
+ notify: (notice) => {
4698
+ this.notices = [...this.notices, { ...notice }];
4699
+ },
4700
+ prompt: (prompt) => {
4701
+ if (prompt.kind === "text" && /GitHub Enterprise URL\/domain/i.test(prompt.message)) return Promise.resolve("");
4702
+ return Promise.reject(/* @__PURE__ */ new Error("github-copilot: this browser bridge cannot answer the authorization prompt"));
4703
+ }
4704
4704
  }
4705
- }
4706
- }).then(async (outcome) => {
4705
+ });
4706
+ } catch {
4707
+ begun = Promise.reject(/* @__PURE__ */ new Error("github-copilot: authorization.begin failed"));
4708
+ }
4709
+ const running = begun.then(async (outcome) => {
4707
4710
  if (outcome.status === "authorized") {
4708
4711
  this.notices = [];
4709
4712
  await this.ensureProviderProfile();
4713
+ if (this.reconciliationFailed) this.failure = "COPILOT_ROUTE_REPAIR_FAILED";
4710
4714
  return;
4711
4715
  }
4712
4716
  this.notices = [];
4713
- }).catch((error) => {
4717
+ }).catch(() => {
4714
4718
  this.notices = [];
4715
- this.failure = messageOf(error);
4716
- this.ctx.logger.error("github-copilot: GitHub Copilot authorization failed");
4717
- this.ctx.logger.error(error);
4719
+ this.failure = "COPILOT_AUTHORIZATION_BEGIN_FAILED";
4720
+ this.ctx.logger.error("github-copilot: authorization.begin failed (COPILOT_AUTHORIZATION_BEGIN_FAILED)");
4718
4721
  }).finally(() => {
4719
4722
  this.attempt = void 0;
4720
4723
  });
@@ -6375,12 +6378,7 @@ var PreviewAdapter = class extends PiAiAdapter {
6375
6378
  requestFailure = budgetFailure(calculated);
6376
6379
  throw requestFailure;
6377
6380
  }
6378
- const prefix = estimateContextTokens({
6379
- messages: [],
6380
- ...context.systemPrompt === void 0 ? {} : { systemPrompt: context.systemPrompt },
6381
- ...context.tools === void 0 ? {} : { tools: context.tools }
6382
- }).tokens;
6383
- const fresh = context.messages.reduce((tokens, message) => tokens + estimateMessageTokens(message), prefix);
6381
+ const fresh = context.messages.reduce((tokens, message) => tokens + estimateMessageTokens(message), 0);
6384
6382
  const admitted = assessRequestBudget(Math.max(estimateContextTokens(context).tokens, fresh), calculated.budget);
6385
6383
  if (!admitted.ok) {
6386
6384
  requestFailure = budgetFailure(admitted);
@@ -6,10 +6,10 @@
6
6
  */
7
7
  import type { Context } from '@deepseek-ai/cordis';
8
8
  export declare const DSH_COMPATIBILITY: {
9
- readonly release: "0.2.0-rc.1";
10
- readonly developmentRelease: "0.2.0-rc.1";
11
- readonly peerRange: "0.2.0-rc.1";
12
- readonly supportedReleases: readonly ["0.2.0-rc.1"];
9
+ readonly release: "0.2.0-rc.2";
10
+ readonly developmentRelease: "0.2.0-rc.2";
11
+ readonly peerRange: "0.2.0-rc.2";
12
+ readonly supportedReleases: readonly ["0.2.0-rc.2"];
13
13
  readonly requiredApis: readonly ["agentDefaultModel.currentSelection", "authorization.describe", "authorization.begin", "authorization.cancel", "credentials.describeRecord", "credentials.readRecord", "credentials.listRecords", "credentials.modifyRecord", "credentials.deleteRecord", "settings.describe", "settings.mutate", "web.registerSearchProvider", "systemPrompt.section", "context.on", "context.effect", "context.plugin"];
14
14
  };
15
15
  /** Assert every required Core service shape before registering any effects. */
@@ -1,4 +1,4 @@
1
- import type { Api, Context as PiContext, Model, StreamOptions } from '@earendil-works/pi-ai';
1
+ import type { Api, Model, StreamOptions, TranscriptContext } from '@earendil-works/pi-ai';
2
2
  import type { AccountModelApi, AccountModelDescriptor } from './account-model-catalog.ts';
3
3
  import type { CoreCompatibleProvider } from './pi-provider-bridge.ts';
4
4
  import type { GitHubCopilotOAuthCredential } from './copilot-grant.ts';
@@ -21,7 +21,7 @@ export interface PreviewProviderGuard {
21
21
  export interface AccountProviderGuard extends PreviewProviderGuard {
22
22
  readonly selectedModelId?: string;
23
23
  /** Per-dispatch admission after native context conversion, before starting a model wire. */
24
- inspectRequest?(model: Model<Api>, context: PiContext, options?: StreamOptions): void;
24
+ inspectRequest?(model: Model<Api>, context: TranscriptContext, options?: StreamOptions): void;
25
25
  assertEntitled(credential: GitHubCopilotOAuthCredential, modelId: string): void;
26
26
  }
27
27
  /** The independent prompt limit is retained for the route's budget guard, not folded into context capacity. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-github-copilot",
3
3
  "description": "DSH companion for GitHub Copilot sign-in, account-aware model profiles, tool compatibility, and provider-hosted search.",
4
- "version": "0.4.0-alpha.38",
4
+ "version": "0.4.0-alpha.40",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -56,6 +56,7 @@
56
56
  "docs/dual-model.md",
57
57
  "docs/official-first-016-alpha2.md",
58
58
  "docs/official-first-020-rc1.md",
59
+ "docs/official-first-020-rc2.md",
59
60
  "docs/copilot-compaction.md",
60
61
  "docs/copilot-usage.md",
61
62
  "docs/images/dual-model-provenance.json",
@@ -78,26 +79,26 @@
78
79
  "license": "MIT",
79
80
  "engines": {
80
81
  "node": ">=22.19.0",
81
- "dsh": "0.2.0-rc.1"
82
+ "dsh": "0.2.0-rc.2"
82
83
  },
83
84
  "peerDependencies": {
84
85
  "@deepseek-ai/cordis": "^4.0.2",
85
- "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
86
- "@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.1",
87
- "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.1",
88
- "@deepseek-ai/dsh-authorization": "0.2.0-rc.1",
89
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.1",
90
- "@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.1",
91
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1",
92
- "@deepseek-ai/dsh-credentials": "0.2.0-rc.1",
93
- "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.1",
94
- "@deepseek-ai/dsh-llm": "0.2.0-rc.1",
95
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.1",
96
- "@deepseek-ai/dsh-scope": "0.2.0-rc.1",
97
- "@deepseek-ai/dsh-settings": "0.2.0-rc.1",
98
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.1",
99
- "@deepseek-ai/dsh-web": "0.2.0-rc.1",
100
- "@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.1",
86
+ "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
87
+ "@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
88
+ "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
89
+ "@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
90
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
91
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
92
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
93
+ "@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
94
+ "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
95
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
96
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
97
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.2",
98
+ "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
99
+ "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
100
+ "@deepseek-ai/dsh-web": "0.2.0-rc.2",
101
+ "@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.2",
101
102
  "@deepseek-ai/schemastery": "^3.18.2"
102
103
  },
103
104
  "peerDependenciesMeta": {
@@ -124,36 +125,36 @@
124
125
  }
125
126
  },
126
127
  "dependencies": {
127
- "@earendil-works/pi-ai": "0.85.1",
128
+ "@earendil-works/pi-ai": "0.87.1",
128
129
  "zod": "^4.4.3"
129
130
  },
130
131
  "devDependencies": {
131
132
  "@deepseek-ai/cordis": "^4.0.2",
132
- "@deepseek-ai/dsh-agent": "0.2.0-rc.1",
133
- "@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.1",
134
- "@deepseek-ai/dsh-api-gateway": "0.2.0-rc.1",
135
- "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.1",
136
- "@deepseek-ai/dsh-app-boot": "0.2.0-rc.1",
137
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.1",
138
- "@deepseek-ai/dsh-authorization": "0.2.0-rc.1",
139
- "@deepseek-ai/dsh-client-connection": "0.2.0-rc.1",
140
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.1",
141
- "@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.1",
142
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1",
143
- "@deepseek-ai/dsh-credentials": "0.2.0-rc.1",
144
- "@deepseek-ai/dsh-fs": "0.2.0-rc.1",
145
- "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.1",
146
- "@deepseek-ai/dsh-llm": "0.2.0-rc.1",
147
- "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.1",
148
- "@deepseek-ai/dsh-scope": "0.2.0-rc.1",
149
- "@deepseek-ai/dsh-settings": "0.2.0-rc.1",
150
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1",
151
- "@deepseek-ai/dsh-tool-web": "0.2.0-rc.1",
152
- "@deepseek-ai/dsh-tools": "0.2.0-rc.1",
153
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.1",
154
- "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.1",
155
- "@deepseek-ai/dsh-web": "0.2.0-rc.1",
156
- "@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.1",
133
+ "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
134
+ "@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
135
+ "@deepseek-ai/dsh-api-gateway": "0.2.0-rc.2",
136
+ "@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
137
+ "@deepseek-ai/dsh-app-boot": "0.2.0-rc.2",
138
+ "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
139
+ "@deepseek-ai/dsh-authorization": "0.2.0-rc.2",
140
+ "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
141
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
142
+ "@deepseek-ai/dsh-client-ui-settings-models": "0.2.0-rc.2",
143
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
144
+ "@deepseek-ai/dsh-credentials": "0.2.0-rc.2",
145
+ "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
146
+ "@deepseek-ai/dsh-launch-environment": "0.2.0-rc.2",
147
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
148
+ "@deepseek-ai/dsh-llm-pi-ai": "0.2.0-rc.2",
149
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.2",
150
+ "@deepseek-ai/dsh-settings": "0.2.0-rc.2",
151
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
152
+ "@deepseek-ai/dsh-tool-web": "0.2.0-rc.2",
153
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
154
+ "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
155
+ "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
156
+ "@deepseek-ai/dsh-web": "0.2.0-rc.2",
157
+ "@deepseek-ai/dsh-web-search-deepseek": "0.2.0-rc.2",
157
158
  "@deepseek-ai/schemastery": "^3.18.2",
158
159
  "@types/node": "^22.0.0",
159
160
  "@types/react": "~18.3.1",
@@ -107,7 +107,7 @@ function candidateViable(entries, baseline) {
107
107
  /** Read and compose the proposed normal launch without loadProfile's initialization/normalization writes. */
108
108
  export async function inspectProfileSearchComposition({ profileDir, home, installAnchor, patches = [] }, suppliedBoot) {
109
109
  const native = suppliedBoot ?? await import(pathToFileURL(createRequire(installAnchor).resolve('@deepseek-ai/dsh-app-boot')).href)
110
- const { readProfileManifest, resolveBundleDir, loadOverlayPatches, loadOptionalPatches, composeEntries } = native
110
+ const { readProfileManifest, resolveBundleDir, bundlePatchPaths, loadOverlayPatches, loadOptionalPatches, composeEntries } = native
111
111
  const bin = 'copilot-search-preflight'
112
112
  const manifest = readProfileManifest(bin, profileDir)
113
113
  const reasons = new Set()
@@ -135,8 +135,8 @@ export async function inspectProfileSearchComposition({ profileDir, home, instal
135
135
  addCandidate()
136
136
  continue
137
137
  }
138
- if (typeof bundle.dsh?.bundle?.patch !== 'string') throw new Error('INVALID_BUNDLE_MANIFEST')
139
- const layer = loadOverlayPatches(bin, resolve(directory, bundle.dsh.bundle.patch))
138
+ const layer = bundlePatchPaths(directory, bundle.dsh?.bundle)
139
+ .flatMap(file => loadOverlayPatches(bin, file))
140
140
  layers.push(layer)
141
141
  baselineLayers.push(layer)
142
142
  }