codex-copilot-dx 1.2.5 → 1.2.7

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.
@@ -16,6 +16,7 @@ import { resolveClaudeModel } from "../claude-models.mjs";
16
16
  import { modelReasoningEfforts } from "../provider-metadata.mjs";
17
17
  import { limitM365CacheTtl } from "./m365-messages-policy.mjs";
18
18
  import { createM365ConversationGuard } from "./m365-conversation-accounts.mjs";
19
+ import { m365NetworkDiagnostic } from "./m365-network-diagnostic.mjs";
19
20
 
20
21
  export const M365_API_BASE = "https://df.loki.delve.office.com/api/v1/llmapi";
21
22
  const SOFT_TTL_MS = 2 * 60 * 60 * 1000;
@@ -74,6 +75,7 @@ export function createM365Provider({ home, env = process.env, account: accountOv
74
75
  const guardConversation = createM365ConversationGuard({ home });
75
76
  let catalog = null, account = null, catalogAt = 0, state = "idle", reason = null, flight = null, controller = null, generation = 0;
76
77
  let network = null, networkFlight = null, cacheTtlAdjustments = 0;
78
+ let networkDiagnostic = null;
77
79
  const registry = { models: null, source: "unavailable", cacheState: "none", cacheSavedAtMs: null,
78
80
  refreshInFlight: false, generation: 0, lastError: null, lastErrorAtMs: null };
79
81
  const profile = () => account ? `m365:${m365AccountKey(account)}` : "m365:unavailable";
@@ -85,7 +87,7 @@ export function createM365Provider({ home, env = process.env, account: accountOv
85
87
  const start = createNetwork || (await import("./m365-network.mjs")).createM365Network;
86
88
  const opened = await start({ env, signal });
87
89
  if (state === "disabled") { opened.close();throw m365Error("m365_disabled"); }
88
- network = opened;return opened.fetch;
90
+ network = opened;networkDiagnostic = null;return opened.fetch;
89
91
  })().finally(() => { if (networkFlight === pending) networkFlight = null; });
90
92
  networkFlight = pending;
91
93
  }
@@ -128,7 +130,8 @@ export function createM365Provider({ home, env = process.env, account: accountOv
128
130
  } catch (error) {
129
131
  if (options.signal?.aborted) throw options.signal.reason || error;
130
132
  throw Object.assign(new Error(redactDiagnosticText(String(error.message).split(credential.token).join("[redacted]"))), {
131
- code: /^m365_[a-z0-9_]+$/.test(error.code || "") ? error.code : "m365_network_error", statusCode: 502 });
133
+ code: /^m365_[a-z0-9_]+$/.test(error.code || "") ? error.code : "m365_network_error", statusCode: 502,
134
+ network_diagnostic: m365NetworkDiagnostic(error.network_diagnostic) });
132
135
  }
133
136
  }
134
137
 
@@ -156,6 +159,7 @@ export function createM365Provider({ home, env = process.env, account: accountOv
156
159
  })().catch(error => {
157
160
  if (current === generation) {
158
161
  state = "unavailable";reason = /^m365_[a-z0-9_]+$/.test(error.code || "") ? error.code : "m365_unavailable";
162
+ networkDiagnostic = m365NetworkDiagnostic(error.network_diagnostic);
159
163
  registry.lastError = reason;registry.lastErrorAtMs = now();
160
164
  }
161
165
  throw error;
@@ -249,6 +253,7 @@ export function createM365Provider({ home, env = process.env, account: accountOv
249
253
  },
250
254
  snapshot: () => ({ ...auth.snapshot(), state, reason: reason || auth.snapshot().reason, account: account ? { login: account.login, tenant: account.tenant, selection_source: account.selection_source || "legacy" } : null,
251
255
  network: network?.snapshot() || null,
256
+ network_diagnostic: networkDiagnostic ? { ...networkDiagnostic } : null,
252
257
  cache_ttl_adjustments: cacheTtlAdjustments,
253
258
  models: { total: catalog?.data.length || 0, claude: m365Models(catalog, "claude").length, gpt: m365Models(catalog, "gpt").length,
254
259
  source: registry.source, refreshed_at: catalogAt ? new Date(catalogAt).toISOString() : null }, refresh_in_flight: Boolean(flight) }),