dsh-github-copilot 0.4.0-alpha.61 → 0.4.0-alpha.63

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,7 +1646,7 @@ let GitHubCopilotUsageController = (() => {
1646
1646
  //#endregion
1647
1647
  //#region package.json
1648
1648
  var name$1 = "dsh-github-copilot";
1649
- var version = "0.4.0-alpha.61";
1649
+ var version = "0.4.0-alpha.63";
1650
1650
  //#endregion
1651
1651
  //#region lib/types/probe.js
1652
1652
  /**
@@ -2067,8 +2067,10 @@ const WebSearchRoutingConfigSchema = z.object({
2067
2067
  */
2068
2068
  /** Keep native live references at the boundary; request code consumes plain snapshots. */
2069
2069
  function readInlineConfig(config) {
2070
+ const exclusions = readConfigValue(config.excludedModelIds);
2070
2071
  return {
2071
2072
  ...config,
2073
+ excludedModelIds: exclusions === void 0 ? void 0 : Array.from(exclusions),
2072
2074
  searchModel: readConfigValue(config.searchModel),
2073
2075
  searchRouting: readConfigValue(config.searchRouting),
2074
2076
  temporaryRouteBackup: readConfigValue(config.temporaryRouteBackup)
@@ -2087,7 +2089,7 @@ const Config = z.object({
2087
2089
  probeTimeoutMs: z.number().step(1).min(1).max(MAX_TIMEOUT_MS).default(3e4),
2088
2090
  accountModelTtlMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(864e5),
2089
2091
  accountModelFailureCooldownMs: z.number().step(1).min(0).max(MAX_TIMEOUT_MS).default(3e5),
2090
- excludedModelIds: z.array(z.string()).default([]).hidden(),
2092
+ excludedModelIds: z.array(z.string()).default([]).hidden().volatile(),
2091
2093
  requestBudgetSafetyTokens: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_REQUEST_BUDGET_POLICY.safetyTokens),
2092
2094
  requestBudgetPressureRatio: z.number().step(.01).min(.01).max(1).default(DEFAULT_REQUEST_BUDGET_POLICY.pressureRatio),
2093
2095
  compactionReasoning: z.union(["prefer-low", "preserve"]).default(DEFAULT_REQUEST_BUDGET_POLICY.compactionReasoning),
@@ -4426,25 +4428,44 @@ function selectedFixedModelIds(ctx) {
4426
4428
  }
4427
4429
  }
4428
4430
  function modelPreferencesView(ctx, accountModels, error) {
4431
+ const unavailable = (diagnostic) => ({
4432
+ state: "error",
4433
+ writable: false,
4434
+ excludedModelIds: [],
4435
+ lockedModelIds: [],
4436
+ unavailableExcludedModelIds: [],
4437
+ error: diagnostic
4438
+ });
4439
+ let settings;
4440
+ let descriptor;
4429
4441
  try {
4430
- const descriptor = service(ctx, "settings", ["describe", "mutate"]).describe({ redactSecrets: true }).find((item) => item.ns === GITHUB_COPILOT_SETTINGS_NAMESPACE$1);
4431
- if (descriptor === void 0 || !Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) return void 0;
4432
- const excludedModelIds = normalizeExcludedModelIds(object$3(descriptor.value)?.excludedModelIds);
4433
- const lockedModelIds = selectedFixedModelIds(ctx);
4434
- if (lockedModelIds === void 0) return void 0;
4435
- const available = new Set(accountModels?.models.map((model) => model.id) ?? []);
4436
- return {
4437
- state: error === void 0 ? "ready" : "error",
4438
- writable: true,
4439
- revision: descriptor.revision,
4440
- excludedModelIds,
4441
- lockedModelIds,
4442
- unavailableExcludedModelIds: excludedModelIds.filter((id) => !available.has(id)),
4443
- ...error === void 0 ? {} : { error }
4444
- };
4442
+ settings = service(ctx, "settings", ["describe", "mutate"]);
4443
+ descriptor = settings.describe({ redactSecrets: true }).find((item) => item.ns === GITHUB_COPILOT_SETTINGS_NAMESPACE$1);
4445
4444
  } catch {
4446
- return;
4445
+ return unavailable("COPILOT_MODEL_SETTINGS_UNAVAILABLE");
4447
4446
  }
4447
+ if (descriptor === void 0) return unavailable("COPILOT_MODEL_SETTINGS_UNAVAILABLE");
4448
+ if (!Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
4449
+ let excludedModelIds;
4450
+ try {
4451
+ const raw = object$3(descriptor.value);
4452
+ if (raw === void 0) return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
4453
+ excludedModelIds = normalizeExcludedModelIds(raw.excludedModelIds);
4454
+ } catch {
4455
+ return unavailable("COPILOT_MODEL_SETTINGS_INVALID");
4456
+ }
4457
+ const lockedModelIds = selectedFixedModelIds(ctx);
4458
+ const diagnostic = lockedModelIds === void 0 ? "COPILOT_MODEL_SELECTION_UNAVAILABLE" : error;
4459
+ const available = new Set(accountModels?.models.map((model) => model.id) ?? []);
4460
+ return {
4461
+ state: diagnostic === void 0 ? "ready" : "error",
4462
+ writable: lockedModelIds !== void 0,
4463
+ revision: descriptor.revision,
4464
+ excludedModelIds,
4465
+ lockedModelIds: lockedModelIds ?? [],
4466
+ unavailableExcludedModelIds: excludedModelIds.filter((id) => !available.has(id)),
4467
+ ...diagnostic === void 0 ? {} : { error: diagnostic }
4468
+ };
4448
4469
  }
4449
4470
  function validateGrant(record) {
4450
4471
  if (record.kind !== "grant") throw new Error("github-copilot: the configured credential is not an OAuth grant");
@@ -4932,7 +4953,7 @@ let GitHubCopilotAuthorizationController = (() => {
4932
4953
  return this.status();
4933
4954
  }
4934
4955
  const current = modelPreferencesView(this.ctx, accountModelsView(this.ctx));
4935
- if (current === void 0 || current.revision === void 0) {
4956
+ if (!current.writable || current.revision === void 0) {
4936
4957
  this.modelPreferenceFailure = "COPILOT_MODEL_PREFERENCES_UNAVAILABLE";
4937
4958
  return this.status();
4938
4959
  }
package/lib/remote.js CHANGED
@@ -314,6 +314,9 @@ const GitHubCopilotAuthorizationViewSchema = z.object({
314
314
  unavailableExcludedModelIds: z.array(z.string().min(1).max(512)).max(512),
315
315
  error: z.enum([
316
316
  "COPILOT_MODEL_PREFERENCES_UNAVAILABLE",
317
+ "COPILOT_MODEL_SETTINGS_UNAVAILABLE",
318
+ "COPILOT_MODEL_SETTINGS_INVALID",
319
+ "COPILOT_MODEL_SELECTION_UNAVAILABLE",
317
320
  "COPILOT_MODEL_EXCLUSION_SELECTED",
318
321
  "COPILOT_MODEL_EXCLUSION_CONFLICT",
319
322
  "COPILOT_MODEL_EXCLUSION_SAVE_FAILED"
@@ -58,7 +58,7 @@ export interface GitHubCopilotModelPreferencesView {
58
58
  readonly excludedModelIds: readonly string[];
59
59
  readonly lockedModelIds: readonly string[];
60
60
  readonly unavailableExcludedModelIds: readonly string[];
61
- readonly error?: 'COPILOT_MODEL_PREFERENCES_UNAVAILABLE' | 'COPILOT_MODEL_EXCLUSION_SELECTED' | 'COPILOT_MODEL_EXCLUSION_CONFLICT' | 'COPILOT_MODEL_EXCLUSION_SAVE_FAILED';
61
+ readonly error?: 'COPILOT_MODEL_PREFERENCES_UNAVAILABLE' | 'COPILOT_MODEL_EXCLUSION_SELECTED' | 'COPILOT_MODEL_EXCLUSION_CONFLICT' | 'COPILOT_MODEL_EXCLUSION_SAVE_FAILED' | 'COPILOT_MODEL_SETTINGS_UNAVAILABLE' | 'COPILOT_MODEL_SETTINGS_INVALID' | 'COPILOT_MODEL_SELECTION_UNAVAILABLE';
62
62
  }
63
63
  export interface GitHubCopilotAuthorizationView {
64
64
  readonly phase: GitHubCopilotAuthorizationPhase;
@@ -50,12 +50,14 @@ export interface InlineConfig {
50
50
  /** Internal JSON backup of route leaves temporarily owned by the GPT-6 overlay. */
51
51
  temporaryRouteBackup?: string;
52
52
  }
53
- export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup'> & {
53
+ export type LiveInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds'> & {
54
+ excludedModelIds?: string[] | LiveSetting<ArrayLike<string>>;
54
55
  searchModel?: string | LiveSetting<string | undefined>;
55
56
  searchRouting?: WebSearchRoutingConfig | LiveSetting<WebSearchRoutingConfig | undefined>;
56
57
  temporaryRouteBackup?: string | LiveSetting<string | undefined>;
57
58
  };
58
- export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup'> & {
59
+ export type ResolvedInlineConfig = Omit<InlineConfig, 'searchModel' | 'searchRouting' | 'temporaryRouteBackup' | 'excludedModelIds'> & {
60
+ excludedModelIds: LiveSetting<ArrayLike<string>>;
59
61
  searchModel: LiveSetting<string | undefined>;
60
62
  searchRouting: LiveSetting<WebSearchRoutingConfig>;
61
63
  temporaryRouteBackup: LiveSetting<string | undefined>;
@@ -91,6 +91,9 @@ export declare const GitHubCopilotAuthorizationViewSchema: z.ZodObject<{
91
91
  COPILOT_MODEL_EXCLUSION_SELECTED: "COPILOT_MODEL_EXCLUSION_SELECTED";
92
92
  COPILOT_MODEL_EXCLUSION_CONFLICT: "COPILOT_MODEL_EXCLUSION_CONFLICT";
93
93
  COPILOT_MODEL_EXCLUSION_SAVE_FAILED: "COPILOT_MODEL_EXCLUSION_SAVE_FAILED";
94
+ COPILOT_MODEL_SETTINGS_UNAVAILABLE: "COPILOT_MODEL_SETTINGS_UNAVAILABLE";
95
+ COPILOT_MODEL_SETTINGS_INVALID: "COPILOT_MODEL_SETTINGS_INVALID";
96
+ COPILOT_MODEL_SELECTION_UNAVAILABLE: "COPILOT_MODEL_SELECTION_UNAVAILABLE";
94
97
  }>>;
95
98
  }, z.core.$strict>>;
96
99
  route: z.ZodOptional<z.ZodObject<{
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.61",
4
+ "version": "0.4.0-alpha.63",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "registry": "https://registry.npmjs.org/",