dsh-github-copilot 0.4.0-alpha.86 → 0.4.0-alpha.87

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
@@ -1646,27 +1646,11 @@ let GitHubCopilotUsageController = (() => {
1646
1646
  };
1647
1647
  })();
1648
1648
  //#endregion
1649
- //#region lib/types/context-usage-guard.js
1649
+ //#region lib/types/context-usage.js
1650
1650
  /** All observed counters are zero, not proof that an attempted prompt was empty. */
1651
1651
  function isZeroContextUsage(usage) {
1652
1652
  return usage.inputTokens === 0 && usage.outputTokens === 0 && (usage.cacheReadTokens ?? 0) === 0 && (usage.cacheWriteTokens ?? 0) === 0 && (usage.totalTokens ?? 0) === 0 && (usage.reasoningTokens ?? 0) === 0;
1653
1653
  }
1654
- /**
1655
- * Native pi-ai emits terminal usage immediately before finish, including a
1656
- * default zero sample when no provider usage arrived. Delay only that sample;
1657
- * failed, cancelled or truncated attempts must not reset Core's last reading.
1658
- */
1659
- async function* guardContextUsage(stream) {
1660
- let pending;
1661
- for await (const chunk of stream) {
1662
- if (pending !== void 0) {
1663
- if (chunk.type !== "finish" || chunk.reason.kind !== "error" && chunk.reason.kind !== "aborted") yield pending;
1664
- pending = void 0;
1665
- }
1666
- if (chunk.type === "usage" && isZeroContextUsage(chunk.usage)) pending = chunk;
1667
- else yield chunk;
1668
- }
1669
- }
1670
1654
  //#endregion
1671
1655
  //#region lib/types/context-evidence.js
1672
1656
  const COPILOT_CONTEXT_EVIDENCE = "githubCopilotContextEvidence";
@@ -1847,7 +1831,7 @@ function installContextEvidence(ctx) {
1847
1831
  //#endregion
1848
1832
  //#region package.json
1849
1833
  var name$1 = "dsh-github-copilot";
1850
- var version = "0.4.0-alpha.86";
1834
+ var version = "0.4.0-alpha.87";
1851
1835
  //#endregion
1852
1836
  //#region lib/types/probe.js
1853
1837
  /**
@@ -8478,7 +8462,7 @@ var PreviewAdapter = class extends PiAiAdapter {
8478
8462
  }
8479
8463
  guardedStream(lease, options) {
8480
8464
  const owner = this;
8481
- return guardContextUsage((async function* () {
8465
+ return (async function* () {
8482
8466
  owner.lifetime.start(lease);
8483
8467
  owned(options.provider);
8484
8468
  if (options.model !== lease.descriptor.id) throw failure("COPILOT_PREVIEW_MODEL_MISMATCH");
@@ -8578,7 +8562,7 @@ var PreviewAdapter = class extends PiAiAdapter {
8578
8562
  if (cause instanceof LlmError && cause.code === "UNKNOWN_MODEL") await owner.refreshRejected(lease.snapshot, signal);
8579
8563
  throw requestFailure ?? cause;
8580
8564
  }
8581
- })());
8565
+ })();
8582
8566
  }
8583
8567
  excludedModels() {
8584
8568
  return excludedModelSet(this.accountModelSettings().excludedModelIds);
@@ -0,0 +1,4 @@
1
+ import type { TokenUsage } from '@deepseek-ai/dsh-llm';
2
+ /** All observed counters are zero, not proof that an attempted prompt was empty. */
3
+ export declare function isZeroContextUsage(usage: TokenUsage): boolean;
4
+ //# sourceMappingURL=context-usage.d.ts.map
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.86",
4
+ "version": "0.4.0-alpha.87",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",
@@ -1,10 +0,0 @@
1
- import type { StreamChunk, TokenUsage } from '@deepseek-ai/dsh-llm';
2
- /** All observed counters are zero, not proof that an attempted prompt was empty. */
3
- export declare function isZeroContextUsage(usage: TokenUsage): boolean;
4
- /**
5
- * Native pi-ai emits terminal usage immediately before finish, including a
6
- * default zero sample when no provider usage arrived. Delay only that sample;
7
- * failed, cancelled or truncated attempts must not reset Core's last reading.
8
- */
9
- export declare function guardContextUsage(stream: AsyncIterable<StreamChunk>): AsyncGenerator<StreamChunk>;
10
- //# sourceMappingURL=context-usage-guard.d.ts.map