dsh-github-copilot 0.4.1 → 0.4.2-alpha.10

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 (46) hide show
  1. package/AGENTS.md +26 -3
  2. package/CHANGELOG.md +108 -0
  3. package/README.md +61 -21
  4. package/README.zh.md +46 -17
  5. package/deployment-baseline.json +25 -2
  6. package/docs/auto-high-cost.md +20 -8
  7. package/docs/auto-iteration-review.json +12 -12
  8. package/docs/auto-task-routing.md +85 -10
  9. package/docs/copilot-accounts.md +6 -0
  10. package/docs/copilot-compaction.md +1 -1
  11. package/docs/plugin-diagnostics.md +159 -6
  12. package/lib/client.js +774 -52
  13. package/lib/client.js.map +1 -1
  14. package/lib/diagnostics-analysis.js +4 -2
  15. package/lib/diagnostics-types-C1BD6ayS.js +655 -0
  16. package/lib/index.js +1816 -1050
  17. package/lib/manual-compaction-recovery.js +1 -1
  18. package/lib/remote.js +253 -1
  19. package/lib/routed-web.js +1 -1
  20. package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
  21. package/lib/types/auto-assessment-evidence.d.ts +32 -0
  22. package/lib/types/auto-model-host.d.ts +1 -0
  23. package/lib/types/auto-task-assessment.d.ts +1 -0
  24. package/lib/types/auto-task-classifier.d.ts +2 -1
  25. package/lib/types/compaction-continuation.d.ts +1 -1
  26. package/lib/types/config.d.ts +18 -2
  27. package/lib/types/context-evidence.d.ts +4 -4
  28. package/lib/types/copilot-auth.d.ts +2 -1
  29. package/lib/types/copilot-usage-remote.d.ts +1 -1
  30. package/lib/types/diagnostics-analysis.d.ts +3 -2
  31. package/lib/types/diagnostics-card.d.ts +1 -0
  32. package/lib/types/diagnostics-collector.d.ts +14 -0
  33. package/lib/types/diagnostics-host.d.ts +114 -3
  34. package/lib/types/diagnostics-remote.d.ts +11 -9
  35. package/lib/types/diagnostics-types.d.ts +486 -30
  36. package/lib/types/native-settings-style.d.ts +1 -1
  37. package/lib/types/preview-provider.d.ts +8 -2
  38. package/lib/types/preview-route.d.ts +1 -1
  39. package/lib/types/remote.d.ts +1 -1
  40. package/lib/types/request-body-composition.d.ts +17 -0
  41. package/lib/types/request-body-evidence.d.ts +2 -1
  42. package/lib/types/request-diagnostics.d.ts +278 -0
  43. package/lib/types/session-continuation-types.d.ts +2 -2
  44. package/lib/types/turn-selection.d.ts +18 -1
  45. package/package.json +2 -2
  46. package/lib/diagnostics-types-FVf6zjob.js +0 -182
package/lib/client.js CHANGED
@@ -444,7 +444,7 @@ window.__ModuleLoader__.load({
444
444
  [data-copilot-native-ui] summary {
445
445
  width: fit-content; max-width: 100%; padding: 2px 4px; margin-left: -4px;
446
446
  border-radius: var(--dsw-radius-sm, 8px); cursor: pointer;
447
- font-size: 12px; line-height: 18px; font-weight: 500;
447
+ font: inherit; font-weight: 500;
448
448
  color: var(--dsw-alias-label-secondary, GrayText); list-style: none;
449
449
  }
450
450
  [data-copilot-native-ui] summary::-webkit-details-marker { display: none; }
@@ -1475,6 +1475,7 @@ window.__ModuleLoader__.load({
1475
1475
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1476
1476
  }
1477
1477
  const anyString = /^[\s\S]{0,}$/;
1478
+ const integer$3 = /^-?\d+$/;
1478
1479
  const number$1 = /^-?\d+(?:\.\d+)?$/;
1479
1480
  const boolean$1 = /^(?:true|false)$/i;
1480
1481
  const lowercase = /^[^A-Z]*$/;
@@ -1811,7 +1812,7 @@ window.__ModuleLoader__.load({
1811
1812
  };
1812
1813
  //#endregion
1813
1814
  //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1814
- const version$2 = {
1815
+ const version$3 = {
1815
1816
  major: 4,
1816
1817
  minor: 6,
1817
1818
  patch: 5
@@ -1823,7 +1824,7 @@ window.__ModuleLoader__.load({
1823
1824
  inst ?? (inst = {});
1824
1825
  inst._zod.def = def;
1825
1826
  inst._zod.bag = inst._zod.bag || {};
1826
- inst._zod.version = version$2;
1827
+ inst._zod.version = version$3;
1827
1828
  const defChecks = inst._zod.def.checks;
1828
1829
  const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1829
1830
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
@@ -2856,6 +2857,138 @@ window.__ModuleLoader__.load({
2856
2857
  result.value = merged.data;
2857
2858
  return result;
2858
2859
  }
2860
+ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2861
+ $ZodType.init(inst, def);
2862
+ const memo = globalConfig.memoizer;
2863
+ memo?.attach(inst);
2864
+ inst._zod.parse = (payload, ctx) => {
2865
+ const input = payload.value;
2866
+ if (!isPlainObject(input)) {
2867
+ payload.issues.push({
2868
+ expected: "record",
2869
+ code: "invalid_type",
2870
+ input,
2871
+ inst
2872
+ });
2873
+ return payload;
2874
+ }
2875
+ const proms = [];
2876
+ const values = def.keyType._zod.values;
2877
+ if (values && !def.partial) {
2878
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2879
+ const recordKeys = /* @__PURE__ */ new Set();
2880
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2881
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
2882
+ if (key === "__proto__") continue;
2883
+ const keyResult = def.keyType._zod.run({
2884
+ value: key,
2885
+ issues: []
2886
+ }, ctx);
2887
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2888
+ if (keyResult.issues.length) {
2889
+ payload.issues.push({
2890
+ code: "invalid_key",
2891
+ origin: "record",
2892
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2893
+ input: key,
2894
+ path: [key],
2895
+ inst
2896
+ });
2897
+ continue;
2898
+ }
2899
+ const outKey = keyResult.value;
2900
+ if (outKey === "__proto__") continue;
2901
+ const result = def.valueType._zod.run({
2902
+ value: input[key],
2903
+ issues: []
2904
+ }, ctx);
2905
+ if (result instanceof Promise) proms.push(result.then((result) => {
2906
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2907
+ payload.value[outKey] = result.value;
2908
+ }));
2909
+ else {
2910
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2911
+ payload.value[outKey] = result.value;
2912
+ }
2913
+ }
2914
+ let unrecognized;
2915
+ for (const key in input) if (!recordKeys.has(key)) {
2916
+ if (def.mode === "loose") {
2917
+ if (key === "__proto__") continue;
2918
+ payload.value[key] = input[key];
2919
+ } else {
2920
+ unrecognized = unrecognized ?? [];
2921
+ unrecognized.push(key);
2922
+ }
2923
+ }
2924
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
2925
+ code: "unrecognized_keys",
2926
+ input,
2927
+ inst,
2928
+ keys: unrecognized,
2929
+ continue: true
2930
+ });
2931
+ } else {
2932
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2933
+ let unrecognized;
2934
+ for (const key of Reflect.ownKeys(input)) {
2935
+ if (key === "__proto__") continue;
2936
+ if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
2937
+ let keyResult = def.keyType._zod.run({
2938
+ value: key,
2939
+ issues: []
2940
+ }, ctx);
2941
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2942
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
2943
+ const retryResult = def.keyType._zod.run({
2944
+ value: Number(key),
2945
+ issues: []
2946
+ }, ctx);
2947
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
2948
+ if (retryResult.issues.length === 0) keyResult = retryResult;
2949
+ }
2950
+ if (keyResult.issues.length) {
2951
+ if (def.mode === "loose") payload.value[key] = input[key];
2952
+ else if (values) {
2953
+ unrecognized = unrecognized ?? [];
2954
+ unrecognized.push(key);
2955
+ } else payload.issues.push({
2956
+ code: "invalid_key",
2957
+ origin: "record",
2958
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2959
+ input: key,
2960
+ path: [key],
2961
+ inst
2962
+ });
2963
+ continue;
2964
+ }
2965
+ const outKey = keyResult.value;
2966
+ if (outKey === "__proto__") continue;
2967
+ const result = def.valueType._zod.run({
2968
+ value: input[key],
2969
+ issues: []
2970
+ }, ctx);
2971
+ if (result instanceof Promise) proms.push(result.then((result) => {
2972
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2973
+ payload.value[outKey] = result.value;
2974
+ }));
2975
+ else {
2976
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2977
+ payload.value[outKey] = result.value;
2978
+ }
2979
+ }
2980
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
2981
+ code: "unrecognized_keys",
2982
+ input,
2983
+ inst,
2984
+ keys: unrecognized,
2985
+ continue: true
2986
+ });
2987
+ }
2988
+ if (proms.length) return Promise.all(proms).then(() => payload);
2989
+ return payload;
2990
+ };
2991
+ });
2859
2992
  const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
2860
2993
  $ZodType.init(inst, def);
2861
2994
  const values = getEnumValues(def.entries);
@@ -4744,6 +4877,107 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4744
4877
  json.allOf = allOf;
4745
4878
  ctx.intersections.push(allOf);
4746
4879
  };
4880
+ /** JSON object keys are always strings, so a numeric record key schema is re-expressed over the
4881
+ * numeric-string form the record parser matches. Deferred to `finalize`, after the flatten: a key
4882
+ * behind a wrapper only carries its own `type` before then, and a union key only has its branches.
4883
+ *
4884
+ * A numeric bound cannot apply to a property name, so `minimum` and its siblings are dropped rather
4885
+ * than carried over: keeping them beside `type: "string"` reproduces the match-nothing schema this
4886
+ * exists to fix. A key that carries one therefore emits wider than the record parses — `z.record(z.number().min(5), V)`
4887
+ * accepts `"3"` — which is the deliberate trade, since throwing on it would reject an ordinary schema
4888
+ * outright. */
4889
+ function stringifyKeyNames(bySchema, json, visited) {
4890
+ if (json.$ref) {
4891
+ if (visited.has(json)) return json;
4892
+ visited.add(json);
4893
+ const def = bySchema.get(json)?.def;
4894
+ if (!def) return json;
4895
+ const inlined = stringifyKeyNames(bySchema, def, visited);
4896
+ return inlined === def ? json : inlined;
4897
+ }
4898
+ for (const keyword of ["anyOf", "oneOf"]) {
4899
+ const branches = json[keyword];
4900
+ if (!Array.isArray(branches)) continue;
4901
+ const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
4902
+ if (mapped.some((branch, i) => branch !== branches[i])) json = {
4903
+ ...json,
4904
+ [keyword]: mapped
4905
+ };
4906
+ }
4907
+ const types = Array.isArray(json.type) ? json.type : [json.type];
4908
+ const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
4909
+ const values = json.enum ?? (json.const !== void 0 ? [json.const] : void 0);
4910
+ if (!numericType && !values?.some((v) => typeof v === "number")) return json;
4911
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
4912
+ if (rest.enum) rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
4913
+ else if (typeof rest.const === "number") rest.const = String(rest.const);
4914
+ if (!numericType) return rest;
4915
+ rest.type = "string";
4916
+ if (!values) rest.pattern = (types.includes("number") ? number$1 : integer$3).source;
4917
+ return rest;
4918
+ }
4919
+ /** Every record of one conversion, so the carriers are found in a single pass rather than once per record. */
4920
+ const pendingRecords = /* @__PURE__ */ new WeakMap();
4921
+ function rewriteKeyNames(ctx) {
4922
+ const bySchema = /* @__PURE__ */ new Map();
4923
+ for (const entry of ctx.seen.values()) if (entry.def && !bySchema.has(entry.schema)) bySchema.set(entry.schema, entry);
4924
+ const rewrites = /* @__PURE__ */ new Map();
4925
+ for (const record of pendingRecords.get(ctx) ?? []) {
4926
+ const seen = ctx.seen.get(record);
4927
+ const names = (seen?.def ?? seen?.schema)?.propertyNames;
4928
+ if (!names || names === true || rewrites.has(names)) continue;
4929
+ const rewritten = stringifyKeyNames(bySchema, names, /* @__PURE__ */ new Set());
4930
+ if (rewritten !== names) rewrites.set(names, rewritten);
4931
+ }
4932
+ if (!rewrites.size) return;
4933
+ for (const entry of ctx.seen.values()) for (const carrier of [entry.schema, entry.def]) {
4934
+ const rewritten = carrier && rewrites.get(carrier.propertyNames);
4935
+ if (rewritten) carrier.propertyNames = rewritten;
4936
+ }
4937
+ }
4938
+ const recordProcessor = (schema, ctx, _json, params) => {
4939
+ const json = _json;
4940
+ const def = schema._zod.def;
4941
+ json.type = "object";
4942
+ const keyType = def.keyType;
4943
+ const patterns = aggregateChecks(keyType).patterns;
4944
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
4945
+ const valueSchema = processSchema(def.valueType, ctx, {
4946
+ ...params,
4947
+ path: [
4948
+ ...params.path,
4949
+ "patternProperties",
4950
+ "*"
4951
+ ]
4952
+ });
4953
+ json.patternProperties = {};
4954
+ for (const pattern of patterns) assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
4955
+ } else {
4956
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
4957
+ json.propertyNames = processSchema(def.keyType, ctx, {
4958
+ ...params,
4959
+ path: [...params.path, "propertyNames"]
4960
+ });
4961
+ let pending = pendingRecords.get(ctx);
4962
+ if (!pending) {
4963
+ pending = [];
4964
+ pendingRecords.set(ctx, pending);
4965
+ ctx.deferred.push(() => rewriteKeyNames(ctx));
4966
+ }
4967
+ pending.push(schema);
4968
+ }
4969
+ json.additionalProperties = processSchema(def.valueType, ctx, {
4970
+ ...params,
4971
+ path: [...params.path, "additionalProperties"]
4972
+ });
4973
+ }
4974
+ const keyValues = keyType._zod.values;
4975
+ const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== void 0;
4976
+ if (keyValues && !def.partial && !omittableOnInput) {
4977
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
4978
+ if (validKeyValues.length > 0) json.required = validKeyValues.map(String);
4979
+ }
4980
+ };
4747
4981
  const nullableProcessor = (schema, ctx, json, params) => {
4748
4982
  const def = schema._zod.def;
4749
4983
  const inner = processSchema(def.innerType, ctx, params);
@@ -5531,6 +5765,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5531
5765
  right
5532
5766
  });
5533
5767
  }
5768
+ const ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
5769
+ _ensureDefaultMemoizer();
5770
+ $ZodRecord.init(inst, def);
5771
+ ZodType.init(inst, def);
5772
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
5773
+ inst.keyType = def.keyType;
5774
+ inst.valueType = def.valueType;
5775
+ });
5776
+ function partialRecord(keyType, valueType, params) {
5777
+ return new ZodRecord({
5778
+ type: "record",
5779
+ keyType,
5780
+ valueType,
5781
+ ...normalizeParams(params),
5782
+ partial: true
5783
+ });
5784
+ }
5534
5785
  const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
5535
5786
  $ZodEnum.init(inst, def);
5536
5787
  ZodType.init(inst, def);
@@ -5986,6 +6237,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5986
6237
  //#endregion
5987
6238
  //#region lib/types/auto-assessment-evidence.js
5988
6239
  const milliseconds = number().int().min(0).max(Number.MAX_SAFE_INTEGER);
6240
+ const candidateCount = number().int().min(0).max(512);
6241
+ const candidateScan = object({
6242
+ candidates: candidateCount,
6243
+ eligible: candidateCount,
6244
+ rejected: partialRecord(_enum([
6245
+ "excluded",
6246
+ "configured-id",
6247
+ "category",
6248
+ "input",
6249
+ "reasoning-disable-unproven",
6250
+ "budget"
6251
+ ]), candidateCount)
6252
+ }).strict().refine((value) => value.eligible + Object.values(value.rejected).reduce((sum, count) => sum + count, 0) === value.candidates, "Inconsistent candidate counts");
5989
6253
  const SemanticAssessmentEvidenceSchema = object({
5990
6254
  modelId: string().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u).optional(),
5991
6255
  budgetMs: milliseconds.refine((value) => value > 0),
@@ -6006,7 +6270,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6006
6270
  "valid",
6007
6271
  "invalid",
6008
6272
  "context-omitted"
6009
- ])
6273
+ ]),
6274
+ candidateScan: candidateScan.optional(),
6275
+ preparationFailure: _enum(["native-off-unavailable"]).optional()
6010
6276
  }).strict().superRefine((value, ctx) => {
6011
6277
  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({
6012
6278
  code: "custom",
@@ -6521,6 +6787,219 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6521
6787
  }))
6522
6788
  };
6523
6789
  //#endregion
6790
+ //#region lib/types/auto-allocation-diagnostics.js
6791
+ const AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS = 1024;
6792
+ const dayMs = 864e5;
6793
+ const integer$2 = number().int().min(0).max(Number.MAX_SAFE_INTEGER);
6794
+ const version$2 = string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/);
6795
+ const assessmentOutcome = _enum([
6796
+ "local-known",
6797
+ "local-unknown",
6798
+ "semantic-known",
6799
+ "semantic-unknown",
6800
+ "disabled",
6801
+ "unavailable",
6802
+ "invalid-result",
6803
+ "timeout",
6804
+ "failed",
6805
+ "context-omitted"
6806
+ ]);
6807
+ const allocationRow = object({
6808
+ day: integer$2.multipleOf(dayMs),
6809
+ version: version$2,
6810
+ policyVersion: string().min(1).max(64),
6811
+ modelId: string().min(1).max(512),
6812
+ targetCategory: _enum([
6813
+ "powerful",
6814
+ "versatile",
6815
+ "lightweight"
6816
+ ]),
6817
+ category: _enum([
6818
+ "powerful",
6819
+ "versatile",
6820
+ "lightweight",
6821
+ "unknown"
6822
+ ]),
6823
+ demand: _enum([
6824
+ "simple",
6825
+ "routine",
6826
+ "complex",
6827
+ "unknown"
6828
+ ]),
6829
+ assessmentSource: _enum(["local", "semantic"]),
6830
+ assessmentOutcome: assessmentOutcome.optional(),
6831
+ method: _enum(["weighted-distribution", "only-candidate"]),
6832
+ fallback: boolean(),
6833
+ highCost: boolean(),
6834
+ previous: boolean(),
6835
+ weight: number().positive().max(1.5),
6836
+ opportunities: integer$2.min(1),
6837
+ expectedSelections: number().finite().nonnegative().max(Number.MAX_SAFE_INTEGER),
6838
+ selections: integer$2
6839
+ }).strict();
6840
+ const noFitRow = object({
6841
+ day: integer$2.multipleOf(dayMs),
6842
+ version: version$2,
6843
+ policyVersion: string().min(1).max(64),
6844
+ targetCategory: _enum([
6845
+ "powerful",
6846
+ "versatile",
6847
+ "lightweight"
6848
+ ]),
6849
+ category: _enum([
6850
+ "powerful",
6851
+ "versatile",
6852
+ "lightweight",
6853
+ "unknown"
6854
+ ]),
6855
+ demand: _enum([
6856
+ "simple",
6857
+ "routine",
6858
+ "complex",
6859
+ "unknown"
6860
+ ]),
6861
+ assessmentSource: _enum(["local", "semantic"]),
6862
+ assessmentOutcome: assessmentOutcome.optional(),
6863
+ decisions: integer$2.min(1)
6864
+ }).strict();
6865
+ const AutoAllocationDiagnosticsSchema = object({
6866
+ status: _enum(["observed", "not-collected"]),
6867
+ rows: array(allocationRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
6868
+ noFitRows: array(noFitRow).max(AUTO_ALLOCATION_DIAGNOSTIC_MAX_ROWS),
6869
+ observationStart: integer$2.nullable(),
6870
+ observationEnd: integer$2.nullable(),
6871
+ completeHistory: literal(false),
6872
+ rowsTruncated: boolean(),
6873
+ dropped: integer$2,
6874
+ expired: integer$2,
6875
+ saturated: integer$2,
6876
+ restarts: integer$2
6877
+ }).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");
6878
+ //#endregion
6879
+ //#region lib/types/request-diagnostics.js
6880
+ const integer$1 = number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
6881
+ const composition = discriminatedUnion("state", [object({
6882
+ state: literal("complete"),
6883
+ totalBytes: integer$1,
6884
+ conversationBytes: integer$1,
6885
+ toolSchemaBytes: integer$1,
6886
+ systemBytes: integer$1,
6887
+ otherBytes: integer$1,
6888
+ imageBlockBytes: integer$1,
6889
+ opaqueReplayBytes: integer$1,
6890
+ remainingConversationBytes: integer$1
6891
+ }).strict(), object({
6892
+ state: _enum([
6893
+ "unavailable",
6894
+ "size-limit",
6895
+ "work-limit",
6896
+ "invalid-json",
6897
+ "unsupported-shape",
6898
+ "cancelled",
6899
+ "time-limit"
6900
+ ]),
6901
+ totalBytes: integer$1.optional()
6902
+ }).strict()]);
6903
+ const upload = discriminatedUnion("state", [
6904
+ object({
6905
+ state: literal("observed"),
6906
+ bodyWrite: _enum(["observed", "not-observed"]),
6907
+ bodyWriteCompleteMs: integer$1.optional(),
6908
+ nativeResponseHeadersMs: integer$1.optional(),
6909
+ alpn: _enum([
6910
+ "h2",
6911
+ "http/1.1",
6912
+ "unavailable"
6913
+ ]),
6914
+ nodeWritableBufferBytes: integer$1.optional()
6915
+ }).strict(),
6916
+ object({ state: _enum(["unavailable", "work-limit"]) }).strict(),
6917
+ object({
6918
+ state: literal("ambiguous"),
6919
+ requestCount: integer$1
6920
+ }).strict()
6921
+ ]);
6922
+ const CredentialChangeReasonSchema = _enum([
6923
+ "qualified",
6924
+ "unknown-source",
6925
+ "account-changed",
6926
+ "endpoint-changed",
6927
+ "entitlements-changed",
6928
+ "expired",
6929
+ "auth-mismatch",
6930
+ "duplicate-notification",
6931
+ "missing-notification",
6932
+ "commit-mismatch",
6933
+ "write-failed",
6934
+ "write-conflict"
6935
+ ]);
6936
+ const CredentialChangeSchema = object({
6937
+ changeId: string().uuid(),
6938
+ observedAt: integer$1,
6939
+ version: string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
6940
+ phase: _enum(["notification", "commit"]),
6941
+ reason: CredentialChangeReasonSchema,
6942
+ preparing: integer$1,
6943
+ dispatched: integer$1,
6944
+ alreadyAborted: integer$1,
6945
+ preserved: integer$1,
6946
+ revoked: integer$1
6947
+ }).strict();
6948
+ const RequestDiagnosticsSchema = object({
6949
+ rows: array(object({
6950
+ streamId: string().uuid(),
6951
+ dispatchIndex: integer$1.min(1),
6952
+ version: string().max(64).regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/),
6953
+ startedAt: integer$1,
6954
+ elapsedMs: integer$1,
6955
+ model: string().max(128).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/),
6956
+ protocol: _enum([
6957
+ "openai-responses",
6958
+ "openai-completions",
6959
+ "anthropic-messages"
6960
+ ]),
6961
+ composition,
6962
+ encoding: _enum([
6963
+ "identity",
6964
+ "gzip",
6965
+ "unknown"
6966
+ ]),
6967
+ wireBytes: integer$1.optional(),
6968
+ upload: upload.optional(),
6969
+ responseHeadersMs: integer$1.optional(),
6970
+ httpStatus: integer$1.min(100).max(599).optional(),
6971
+ outcome: _enum([
6972
+ "http-error",
6973
+ "transport-error",
6974
+ "stream-done",
6975
+ "stream-error",
6976
+ "cancelled",
6977
+ "interrupted"
6978
+ ]),
6979
+ reason: _enum([
6980
+ "none",
6981
+ "unknown",
6982
+ "request-body-timeout",
6983
+ "caller-abort",
6984
+ "credential-changed",
6985
+ "disposed",
6986
+ "byte-idle-timeout",
6987
+ "signal-abort"
6988
+ ])
6989
+ }).strict()).max(128),
6990
+ dropped: integer$1,
6991
+ evicted: integer$1,
6992
+ pending: integer$1.max(128).optional(),
6993
+ interruptedOnReopen: integer$1.optional(),
6994
+ credentialChanges: object({
6995
+ rows: array(CredentialChangeSchema).max(128),
6996
+ dropped: integer$1,
6997
+ evicted: integer$1,
6998
+ pending: integer$1.max(128).optional(),
6999
+ interruptedOnReopen: integer$1.optional()
7000
+ }).strict().optional()
7001
+ }).strict();
7002
+ //#endregion
6524
7003
  //#region lib/types/diagnostics-types.js
6525
7004
  const DIAGNOSTICS_OPERATIONS = [
6526
7005
  "account-global-switch",
@@ -6627,6 +7106,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6627
7106
  epoch: integer,
6628
7107
  updatedAt: integer,
6629
7108
  rows: array(DiagnosticsRowSchema).max(DIAGNOSTICS_MAX_ROWS),
7109
+ autoAllocation: AutoAllocationDiagnosticsSchema.optional(),
7110
+ requests: RequestDiagnosticsSchema.optional(),
6630
7111
  pending: array(DiagnosticsPendingSchema).max(128),
6631
7112
  dropped: integer,
6632
7113
  clientDropped: integer,
@@ -6637,6 +7118,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6637
7118
  }).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");
6638
7119
  const DiagnosticsViewSchema = object({
6639
7120
  enabled: boolean(),
7121
+ autoAllocationEnabled: boolean(),
7122
+ requestEnabled: boolean().optional(),
6640
7123
  state: _enum([
6641
7124
  "loading",
6642
7125
  "ready",
@@ -6728,6 +7211,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6728
7211
  codec: strictRemoteCodec("dsh-github-copilot#DiagnosticsEnabled", boolean())
6729
7212
  }]
6730
7213
  },
7214
+ {
7215
+ method: "setAutoAllocationEnabled",
7216
+ parameters: [{
7217
+ name: "enabled",
7218
+ wire: "enabled",
7219
+ source: "json",
7220
+ codec: strictRemoteCodec("dsh-github-copilot#AutoAllocationDiagnosticsEnabled", boolean())
7221
+ }]
7222
+ },
7223
+ {
7224
+ method: "setRequestEnabled",
7225
+ parameters: [{
7226
+ name: "enabled",
7227
+ wire: "enabled",
7228
+ source: "json",
7229
+ codec: strictRemoteCodec("dsh-github-copilot#RequestDiagnosticsEnabled", boolean())
7230
+ }]
7231
+ },
6731
7232
  {
6732
7233
  method: "recordClient",
6733
7234
  parameters: [{
@@ -6988,7 +7489,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6988
7489
  };
6989
7490
  //#endregion
6990
7491
  //#region package.json
6991
- var version = "0.4.1";
7492
+ var version = "0.4.2-alpha.10";
6992
7493
  //#endregion
6993
7494
  //#region lib/types/diagnostics-client.js
6994
7495
  let owner;
@@ -7217,6 +7718,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7217
7718
  };
7218
7719
  }, [remote]);
7219
7720
  const rows = view?.snapshot.rows ?? [];
7721
+ const requests = view?.snapshot.requests;
7722
+ const credentials = requests?.credentialChanges;
7723
+ const auto = view?.snapshot.autoAllocation;
7724
+ const autoOpportunities = auto?.rows.reduce((sum, row) => sum + row.opportunities, 0) ?? 0;
7725
+ const autoExpected = auto?.rows.reduce((sum, row) => sum + row.expectedSelections, 0) ?? 0;
7726
+ const autoSelections = auto?.rows.reduce((sum, row) => sum + row.selections, 0) ?? 0;
7727
+ const autoNoFit = auto?.noFitRows.reduce((sum, row) => sum + row.decisions, 0) ?? 0;
7728
+ const autoWindow = auto === void 0 || auto.observationStart === null || auto.observationEnd === null ? "No retained observation window" : `${new Date(auto.observationStart).toISOString().slice(0, 10)} – ${new Date(auto.observationEnd).toISOString().slice(0, 10)} UTC`;
7729
+ const autoRows = auto ? [...auto.rows.map((row) => ({
7730
+ key: JSON.stringify([
7731
+ row.day,
7732
+ row.version,
7733
+ row.policyVersion,
7734
+ row.modelId,
7735
+ row.targetCategory,
7736
+ row.category,
7737
+ row.demand,
7738
+ row.assessmentSource,
7739
+ row.assessmentOutcome,
7740
+ row.method,
7741
+ row.fallback,
7742
+ row.highCost,
7743
+ row.previous
7744
+ ]),
7745
+ day: row.day,
7746
+ policy: row.policyVersion,
7747
+ model: row.modelId,
7748
+ cohort: `${row.targetCategory} → ${row.category} · ${row.demand} · ${row.assessmentSource} · assessment: ${row.assessmentOutcome ?? "not recorded"} · ${row.method}` + (row.fallback ? " · fallback" : "") + (row.highCost ? " · high-cost" : "") + (row.previous ? " · continuity" : ""),
7749
+ opportunities: row.opportunities,
7750
+ expected: row.expectedSelections,
7751
+ selected: row.selections,
7752
+ noFit: null
7753
+ })), ...auto.noFitRows.map((row) => ({
7754
+ key: JSON.stringify([
7755
+ row.day,
7756
+ row.version,
7757
+ row.policyVersion,
7758
+ row.targetCategory,
7759
+ row.category,
7760
+ row.demand,
7761
+ row.assessmentSource,
7762
+ row.assessmentOutcome
7763
+ ]),
7764
+ day: row.day,
7765
+ policy: row.policyVersion,
7766
+ model: "—",
7767
+ cohort: `${row.targetCategory} → ${row.category} · ${row.demand} · ${row.assessmentSource} · assessment: ${row.assessmentOutcome ?? "not recorded"} · no fit`,
7768
+ opportunities: null,
7769
+ expected: null,
7770
+ selected: null,
7771
+ noFit: row.decisions
7772
+ }))].sort((left, right) => right.day - left.day || left.policy.localeCompare(right.policy) || left.model.localeCompare(right.model)) : [];
7220
7773
  const populations = [...new Set(rows.filter((row) => row.operation !== "collection").map((row) => `${row.layer}/${row.operation}`))];
7221
7774
  const count = (metrics, population) => rows.filter((row) => metrics.includes(row.metric) && `${row.layer}/${row.operation}` === population).reduce((sum, row) => sum + row.count, 0);
7222
7775
  const control = (label, action, disabled = false) => (0, react.createElement)("button", {
@@ -7228,45 +7781,171 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7228
7781
  return (0, react.createElement)("section", {
7229
7782
  "aria-label": "Local diagnostics",
7230
7783
  "data-copilot-native-ui": true,
7784
+ "data-copilot-diagnostics": true,
7231
7785
  style: section
7232
- }, (0, react.createElement)("style", null, nativeSettingsCss), (0, react.createElement)("h3", { style: nativeHeadingStyle }, "Local diagnostics"), (0, react.createElement)("p", { style: {
7233
- margin: 0,
7234
- lineHeight: 1.5,
7235
- maxWidth: "70ch"
7236
- } }, "Account, Checking and compaction counts stay in this profile. No identities, conversation content or raw errors. No upload, scheduled analysis or automatic repair."), (0, react.createElement)("p", {
7237
- role: "status",
7238
- style: { margin: 0 }
7239
- }, !remote ? "Diagnostics controls are unavailable in this connection." : !view ? busy ? "Reading local collection status…" : "Collection status is unknown." : `${view.enabled ? view.state === "ready" ? "Collection enabled" : "Collection configured on; not collecting" : "Collection paused"} · Storage ${view.state}` + (view.diagnostic === "none" ? "" : ` · ${view.diagnostic}`) + (view.dirty ? " · Not all observations are persisted yet" : "")), failed ? (0, react.createElement)("p", {
7786
+ }, (0, react.createElement)("style", null, nativeSettingsCss + "\n[data-copilot-diagnostics] details { min-width: 0; }"), (0, react.createElement)("h3", { style: nativeHeadingStyle }, "Local diagnostics"), (0, react.createElement)("p", { style: {
7787
+ ...nativeCaptionStyle,
7788
+ margin: 0
7789
+ } }, "Expand a diagnostic group to inspect its evidence. Collection controls are independent; opening a group does not enable collection."), failed ? (0, react.createElement)("p", {
7240
7790
  role: "alert",
7241
7791
  style: { margin: 0 }
7242
- }, "Could not confirm the operation. Read status before retrying; no write is automatically replayed.") : null, clientDiagnosticsReportingFailed() ? (0, react.createElement)("p", {
7243
- role: "alert",
7792
+ }, "Could not confirm the operation. Read status before retrying; no write is automatically replayed.") : null, (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Auto allocation observations", (0, react.createElement)("span", { style: {
7793
+ ...nativeCaptionStyle,
7794
+ marginInlineStart: 8
7795
+ } }, !view ? "Status unknown" : `${view.autoAllocationEnabled ? "Enabled" : "Paused"} · ${auto ? `${autoRows.length} retained strata` : "Evidence unavailable"}`)), (0, react.createElement)("p", {
7796
+ role: "status",
7244
7797
  style: { margin: 0 }
7245
- }, "Some Client observations could not be confirmed. Client counts are incomplete; Host counts are separate.") : null, (0, react.createElement)("div", { style: {
7246
- display: "flex",
7247
- flexWrap: "wrap",
7248
- gap: 8
7249
- } }, control("Read status", () => {
7250
- run((value) => value.get());
7251
- }, !remote), control(view?.enabled ? "Pause collection" : "Enable local collection", () => {
7252
- run((value) => value.setEnabled(!view?.enabled));
7253
- }, !remote || !view || !view.enabled && view.state !== "ready"), control("Clear local aggregates", () => setConfirmClear(true), !remote || !view || view.state !== "ready")), confirmClear ? (0, react.createElement)("div", {
7254
- role: "group",
7255
- "aria-label": "Confirm clearing local diagnostics"
7256
- }, (0, react.createElement)("p", null, "Delete collected aggregates only? Collection keeps its current enabled/paused setting. This does not clear account settings or conversation history."), control("Confirm clear", () => {
7257
- setConfirmClear(false);
7258
- run((value) => value.clear());
7259
- }), control("Cancel", () => setConfirmClear(false))) : null, view && populations.length ? (0, react.createElement)("div", { style: {
7798
+ }, !view ? busy ? "Reading observation status…" : "Observation status is unknown." : `${view.autoAllocationEnabled ? view.state === "ready" ? "Enabled" : "Enabled · storage unavailable" : "Paused"} · ${auto === void 0 ? "Auto observations unavailable in this snapshot" : auto.status === "observed" ? "Data observed" : view.state === "ready" ? "No observations collected" : "Observation status unavailable"}` + (view.dirty ? " · Latest changes not fully persisted" : "")), auto ? (0, react.createElement)("p", { style: { margin: 0 } }, `${autoWindow} · ${auto.rows.length + auto.noFitRows.length} retained strata · ${auto.rowsTruncated ? "row limit reached" : "row limit not reached"}` + (auto.dropped ? ` · ${auto.dropped} dropped` : "") + (auto.expired ? ` · ${auto.expired} expired` : "") + (auto.restarts ? ` · ${auto.restarts} restarts observed` : "") + (auto.saturated ? ` · ${auto.saturated} counters saturated` : "")) : null, autoRows.length ? (0, react.createElement)("div", { style: {
7799
+ overflowX: "auto",
7800
+ minWidth: 0
7801
+ } }, (0, react.createElement)("table", { style: {
7802
+ width: "100%",
7803
+ borderCollapse: "collapse",
7804
+ textAlign: "left",
7805
+ font: "inherit"
7806
+ } }, (0, react.createElement)("caption", { style: {
7807
+ ...nativeCaptionStyle,
7808
+ textAlign: "left",
7809
+ marginBottom: 8
7810
+ } }, "Daily aggregates by matching policy, model and decision cohort"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7811
+ "Date (UTC)",
7812
+ "Policy",
7813
+ "Model",
7814
+ "Cohort",
7815
+ "Opportunities",
7816
+ "Expected",
7817
+ "Selected",
7818
+ "No-fit"
7819
+ ].map((label) => (0, react.createElement)("th", {
7820
+ key: label,
7821
+ scope: "col",
7822
+ style: {
7823
+ padding: 6,
7824
+ font: "inherit",
7825
+ fontWeight: 500,
7826
+ textAlign: label === "Cohort" || label === "Model" ? "left" : "right"
7827
+ }
7828
+ }, label)))), (0, react.createElement)("tbody", null, ...autoRows.map((row) => (0, react.createElement)("tr", { key: row.key }, (0, react.createElement)("td", { style: {
7829
+ padding: 6,
7830
+ whiteSpace: "nowrap"
7831
+ } }, new Date(row.day).toISOString().slice(0, 10)), (0, react.createElement)("td", { style: {
7832
+ padding: 6,
7833
+ overflowWrap: "anywhere"
7834
+ } }, row.policy), (0, react.createElement)("td", { style: {
7835
+ padding: 6,
7836
+ overflowWrap: "anywhere"
7837
+ } }, row.model), (0, react.createElement)("td", { style: {
7838
+ padding: 6,
7839
+ minWidth: 220
7840
+ } }, row.cohort), (0, react.createElement)("td", { style: {
7841
+ padding: 6,
7842
+ textAlign: "right"
7843
+ } }, row.opportunities ?? "—"), (0, react.createElement)("td", { style: {
7844
+ padding: 6,
7845
+ textAlign: "right"
7846
+ } }, row.expected === null ? "—" : row.expected.toFixed(3)), (0, react.createElement)("td", { style: {
7847
+ padding: 6,
7848
+ textAlign: "right"
7849
+ } }, row.selected ?? "—"), (0, react.createElement)("td", { style: {
7850
+ padding: 6,
7851
+ textAlign: "right"
7852
+ } }, row.noFit ?? "—")))))) : null, auto?.status === "observed" && autoRows.length === 0 ? (0, react.createElement)("p", { style: { margin: 0 } }, "No retained strata in this snapshot; this does not mean there were no decisions.") : !auto ? (0, react.createElement)("p", { style: { margin: 0 } }, "Auto allocation aggregates are unavailable in this snapshot.") : view && auto.status !== "observed" && view.state !== "ready" ? (0, react.createElement)("p", { style: { margin: 0 } }, "Storage is not ready; retained Auto observation status is unknown.") : view && auto.status !== "observed" ? (0, react.createElement)("p", { style: { margin: 0 } }, "No retained observations yet.") : null, autoRows.length ? (0, react.createElement)("p", { style: {
7853
+ ...nativeCaptionStyle,
7854
+ margin: 0
7855
+ } }, `${autoOpportunities} candidate opportunities · ${autoExpected.toFixed(3)} expected selections · ${autoSelections} actual selections · ${autoNoFit} no-fit decisions. Compare expected and selected counts only within matching cohorts; these are not execution, quality or billing evidence. Assessment outcomes explain classification only, not the supplier root cause. Legacy reasons are not recorded; sum Selected or No-fit, not candidate opportunities, when counting decisions by outcome.`) : null), view ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Physical request observations", (0, react.createElement)("span", { style: {
7856
+ ...nativeCaptionStyle,
7857
+ marginInlineStart: 8
7858
+ } }, `${view.requestEnabled === void 0 ? "Status unknown" : view.requestEnabled ? "Enabled" : "Paused"} · ${requests?.rows.length ?? 0} retained`)), (0, react.createElement)("p", { style: { margin: 0 } }, requests ? `${requests.rows.length} retained requests · ${requests.pending ?? 0} sampled pending · ${requests.dropped} dropped · ${requests.evicted} expired/evicted · ${requests.interruptedOnReopen ?? 0} interrupted on reopen` : "No retained request observations. This does not establish zero failures or enabled collection."), (0, react.createElement)("p", { style: {
7859
+ ...nativeCaptionStyle,
7860
+ margin: 0
7861
+ } }, "Managed native adapter dispatches only. Local body-write completion is not supplier receipt. Stream-done is a native terminal observation, not tool execution or billing success. No Core retry count or Session/turn attribution is inferred."), requests?.rows.length ? (0, react.createElement)("div", { style: {
7862
+ overflowX: "auto",
7863
+ minWidth: 0
7864
+ } }, (0, react.createElement)("table", { style: {
7865
+ width: "100%",
7866
+ borderCollapse: "collapse",
7867
+ textAlign: "left",
7868
+ font: "inherit"
7869
+ } }, (0, react.createElement)("caption", { style: {
7870
+ ...nativeCaptionStyle,
7871
+ textAlign: "left",
7872
+ marginBottom: 8
7873
+ } }, "Latest retained physical requests"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7874
+ "Time (UTC)",
7875
+ "Model",
7876
+ "Outcome / reason",
7877
+ "HTTP",
7878
+ "JSON / wire bytes",
7879
+ "Headers / body-write ms"
7880
+ ].map((label) => (0, react.createElement)("th", {
7881
+ key: label,
7882
+ scope: "col",
7883
+ style: {
7884
+ padding: 6,
7885
+ font: "inherit",
7886
+ fontWeight: 500
7887
+ }
7888
+ }, label)))), (0, react.createElement)("tbody", null, ...requests.rows.slice().sort((left, right) => right.startedAt - left.startedAt).map((row, index) => (0, react.createElement)("tr", { key: `${row.streamId}/${row.dispatchIndex}/${index}` }, (0, react.createElement)("td", { style: {
7889
+ padding: 6,
7890
+ whiteSpace: "nowrap"
7891
+ } }, new Date(row.startedAt).toISOString()), (0, react.createElement)("td", { style: {
7892
+ padding: 6,
7893
+ overflowWrap: "anywhere"
7894
+ } }, row.model), (0, react.createElement)("td", { style: {
7895
+ padding: 6,
7896
+ overflowWrap: "anywhere"
7897
+ } }, `${row.outcome} / ${row.reason}`), (0, react.createElement)("td", { style: { padding: 6 } }, row.httpStatus ?? "—"), (0, react.createElement)("td", { style: { padding: 6 } }, `${row.composition.totalBytes ?? "unknown"} / ${row.wireBytes ?? "unknown"} (${row.encoding}; composition ${row.composition.state})`), (0, react.createElement)("td", { style: { padding: 6 } }, `${row.responseHeadersMs ?? "unknown"} / ${row.upload?.state === "observed" ? row.upload.bodyWriteCompleteMs ?? "unknown" : "unknown"}`)))))) : null) : null, view ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Credential change observations", (0, react.createElement)("span", { style: {
7898
+ ...nativeCaptionStyle,
7899
+ marginInlineStart: 8
7900
+ } }, credentials ? `${credentials.rows.length} retained` : "Not recorded")), (0, react.createElement)("p", { style: {
7901
+ ...nativeCaptionStyle,
7902
+ margin: 0
7903
+ } }, "Uses the independent request-observation consent. Fixed qualification and commit reasons only; no credentials, account or Session identifiers. Unknown source does not identify an external writer. Counts describe live managed wires at each observation, not native retries or successful completion."), credentials ? (0, react.createElement)("p", { style: { margin: 0 } }, `${credentials.dropped} dropped · ${credentials.evicted} expired/evicted · ${credentials.pending ?? 0} sampled pending · ${credentials.interruptedOnReopen ?? 0} interrupted on reopen. Matching random change IDs join notification and commit observations only; no historical incident is reconstructed.`) : (0, react.createElement)("p", { style: { margin: 0 } }, "Credential-change evidence was not recorded in this snapshot. This does not establish zero changes or failures."), credentials?.rows.length ? (0, react.createElement)("div", { style: {
7260
7904
  overflowX: "auto",
7261
7905
  minWidth: 0
7262
7906
  } }, (0, react.createElement)("table", { style: {
7263
7907
  width: "100%",
7264
7908
  borderCollapse: "collapse",
7265
- textAlign: "left"
7909
+ textAlign: "left",
7910
+ font: "inherit"
7266
7911
  } }, (0, react.createElement)("caption", { style: {
7912
+ ...nativeCaptionStyle,
7267
7913
  textAlign: "left",
7268
7914
  marginBottom: 8
7269
- } }, "Retained observations · independent Client and Host populations"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7915
+ } }, "Latest retained credential-change decisions"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7916
+ "Time (UTC)",
7917
+ "Change ID",
7918
+ "Phase / reason",
7919
+ "Preparing / dispatched",
7920
+ "Preserved / revoked",
7921
+ "Already aborted"
7922
+ ].map((label) => (0, react.createElement)("th", {
7923
+ key: label,
7924
+ scope: "col",
7925
+ style: {
7926
+ padding: 6,
7927
+ font: "inherit",
7928
+ fontWeight: 500
7929
+ }
7930
+ }, label)))), (0, react.createElement)("tbody", null, ...credentials.rows.slice().sort((left, right) => right.observedAt - left.observedAt).map((row, index) => (0, react.createElement)("tr", { key: `${row.changeId}/${row.phase}/${index}` }, (0, react.createElement)("td", { style: {
7931
+ padding: 6,
7932
+ whiteSpace: "nowrap"
7933
+ } }, new Date(row.observedAt).toISOString()), (0, react.createElement)("td", { style: {
7934
+ padding: 6,
7935
+ overflowWrap: "anywhere"
7936
+ } }, row.changeId), (0, react.createElement)("td", { style: { padding: 6 } }, `${row.phase} / ${row.reason}`), (0, react.createElement)("td", { style: { padding: 6 } }, `${row.preparing} / ${row.dispatched}`), (0, react.createElement)("td", { style: { padding: 6 } }, `${row.preserved} / ${row.revoked}`), (0, react.createElement)("td", { style: { padding: 6 } }, row.alreadyAborted)))))) : null) : null, view && populations.length ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Account and compaction observations"), (0, react.createElement)("div", { style: {
7937
+ overflowX: "auto",
7938
+ minWidth: 0
7939
+ } }, (0, react.createElement)("table", { style: {
7940
+ width: "100%",
7941
+ borderCollapse: "collapse",
7942
+ textAlign: "left",
7943
+ font: "inherit"
7944
+ } }, (0, react.createElement)("caption", { style: {
7945
+ ...nativeCaptionStyle,
7946
+ textAlign: "left",
7947
+ marginBottom: 8
7948
+ } }, "Independent Client and Host populations"), (0, react.createElement)("thead", null, (0, react.createElement)("tr", null, ...[
7270
7949
  "Population",
7271
7950
  "Started",
7272
7951
  "Success",
@@ -7277,10 +7956,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7277
7956
  ].map((label) => (0, react.createElement)("th", {
7278
7957
  key: label,
7279
7958
  scope: "col",
7280
- style: { padding: 6 }
7959
+ style: {
7960
+ padding: 6,
7961
+ font: "inherit",
7962
+ fontWeight: 500
7963
+ }
7281
7964
  }, label)))), (0, react.createElement)("tbody", null, ...populations.map((population) => (0, react.createElement)("tr", { key: population }, (0, react.createElement)("th", {
7282
7965
  scope: "row",
7283
- style: { padding: 6 }
7966
+ style: {
7967
+ padding: 6,
7968
+ font: "inherit",
7969
+ fontWeight: 500
7970
+ }
7284
7971
  }, population), ...[
7285
7972
  "started",
7286
7973
  "success",
@@ -7296,12 +7983,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7296
7983
  "revoked",
7297
7984
  "environment-fault",
7298
7985
  "unknown"
7299
- ], population))))))) : null, view && !populations.length ? (0, react.createElement)("p", null, "No retained operation observations. This is not evidence of zero failures.") : null, view ? (0, react.createElement)("p", { style: {
7300
- margin: 0,
7301
- fontSize: 12,
7302
- lineHeight: "18px"
7303
- } }, `Host pending: ${view.snapshot.pending.reduce((sum, row) => sum + row.count, 0)}. Host dropped: ${view.snapshot.dropped}; Client dropped: ${view.snapshot.clientDropped}; Client unconfirmed: ${view.snapshot.clientUnconfirmed}; evicted/expired: ${view.snapshot.evicted}; saturated: ${view.snapshot.saturated}. Retention: 14 days, at most 4,096 aggregate rows and 2 MiB. Client pending samples are periodic observations, not a live outstanding count. Other settled includes policy rejection, revocation, environment faults and unknown/no-checkpoint results; JSON preserves each category. Stock/custom-engine physical summaries, native recovery opt-out, OAuth, quota and unwrapped RPCs are not covered.`) : null, view ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Review aggregate-only JSON"), (0, react.createElement)("p", null, "Review before sharing. This includes build versions, hour windows and fixed diagnostic counts, never account or Session identifiers."), control("Prepare current JSON", () => setExported(true)), exported ? (0, react.createElement)("textarea", {
7304
- "aria-label": "Local diagnostics aggregate JSON",
7986
+ ], population)))))))) : null, view && !populations.length ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Account and compaction observations"), (0, react.createElement)("p", null, "No retained operation observations. This is not evidence of zero failures.")) : null, (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Collection controls"), (0, react.createElement)("p", { style: { margin: 0 } }, view?.requestEnabled === void 0 ? "Request observations unavailable in this snapshot." : `Request observations ${view.requestEnabled ? "enabled" : "paused"}. ${requests?.rows.length ?? 0} retained physical requests; ${requests?.dropped ?? 0} dropped; ${requests?.evicted ?? 0} expired/evicted.`), (0, react.createElement)("p", { style: {
7987
+ ...nativeCaptionStyle,
7988
+ margin: 0
7989
+ } }, "Separate opt-in: retain at most 128 content-free physical requests and 128 credential-change observations for 24 hours within the shared storage cap. Includes model, payload byte counts, transport timing, HTTP status, terminal categories and fixed credential qualification reasons, not bodies, credentials, URLs, headers or Session/turn IDs. Random stream IDs correlate native SDK dispatches only; dispatch index is not a Core retry count."), (0, react.createElement)("p", {
7990
+ role: "status",
7991
+ style: { margin: 0 }
7992
+ }, !remote ? "Diagnostics controls are unavailable in this connection." : !view ? busy ? "Reading local collection status…" : "Collection status is unknown." : `${view.enabled ? view.state === "ready" ? "Local collection enabled" : "Local collection configured on; storage not ready" : "Local collection paused"} · Storage ${view.state}` + (view.diagnostic === "none" ? "" : ` · ${view.diagnostic}`) + (view.dirty ? " · Not all observations are persisted yet" : "")), clientDiagnosticsReportingFailed() ? (0, react.createElement)("p", {
7993
+ role: "alert",
7994
+ style: { margin: 0 }
7995
+ }, "Some Client observations could not be confirmed. Client counts are incomplete; Host counts are separate.") : null, (0, react.createElement)("div", { style: {
7996
+ display: "flex",
7997
+ flexWrap: "wrap",
7998
+ gap: 8
7999
+ } }, control("Read status", () => {
8000
+ run((value) => value.get());
8001
+ }, !remote), control(view?.enabled ? "Pause collection" : "Enable local collection", () => {
8002
+ run((value) => value.setEnabled(!view?.enabled));
8003
+ }, !remote || !view || !view.enabled && view.state !== "ready"), control(view?.autoAllocationEnabled ? "Pause Auto allocation observation" : "Enable Auto allocation observation", () => {
8004
+ run((value) => value.setAutoAllocationEnabled(!view?.autoAllocationEnabled));
8005
+ }, !remote || !view || !view.autoAllocationEnabled && view.state !== "ready"), control(view?.requestEnabled ? "Pause request observations" : "Enable request observations", () => {
8006
+ run((value) => value.setRequestEnabled(!view?.requestEnabled));
8007
+ }, !remote || !view || view.requestEnabled === void 0 || !view.requestEnabled && view.state !== "ready"), control("Clear local diagnostics", () => setConfirmClear(true), !remote || !view || view.state !== "ready")), confirmClear ? (0, react.createElement)("div", {
8008
+ role: "group",
8009
+ "aria-label": "Confirm clearing local diagnostics"
8010
+ }, (0, react.createElement)("p", null, "Delete collected aggregates and request observations? Collection controls keep their current enabled/paused settings. This does not clear account settings or conversation history."), control("Confirm clear", () => {
8011
+ setConfirmClear(false);
8012
+ run((value) => value.clear());
8013
+ }), control("Cancel", () => setConfirmClear(false))) : null), view ? (0, react.createElement)("details", null, (0, react.createElement)("summary", null, "Data scope, limits and JSON"), (0, react.createElement)("p", { style: { margin: 0 } }, "Aggregates stay in this profile for 14 days; request observations for 24 hours. Auto rows contain policy/model/cohort dimensions and aggregate counts only; no Session or turn IDs, conversation content, upload or automatic tuning. Expired counts are strata, not removed decisions."), (0, react.createElement)("p", { style: { margin: 0 } }, `Host pending: ${view.snapshot.pending.reduce((sum, row) => sum + row.count, 0)}. Host dropped: ${view.snapshot.dropped}; Client dropped: ${view.snapshot.clientDropped}; Client unconfirmed: ${view.snapshot.clientUnconfirmed}; evicted/expired: ${view.snapshot.evicted}; saturated: ${view.snapshot.saturated}. At most 4,096 aggregate rows and 2 MiB. Client pending samples are periodic observations, not a live outstanding count. Other settled includes policy rejection, revocation, environment faults and unknown/no-checkpoint results. Stock/custom-engine physical summaries, native recovery opt-out, OAuth, quota and unwrapped RPCs are not covered.`), (0, react.createElement)("details", null, (0, react.createElement)("summary", null, requests ? "Review local diagnostics JSON" : "Review aggregate-only JSON"), (0, react.createElement)("p", { style: { margin: 0 } }, "Review before sharing. This includes build versions and diagnostic counts; when request observations were enabled it also includes request times, model IDs, byte counts and random stream IDs, never account or Session identifiers. Client timing does not prove supplier receipt or fault ownership."), control("Prepare current JSON", () => setExported(true)), exported ? (0, react.createElement)("textarea", {
8014
+ "aria-label": requests ? "Local diagnostics JSON" : "Local diagnostics aggregate JSON",
7305
8015
  readOnly: true,
7306
8016
  value: JSON.stringify(view, null, 2),
7307
8017
  rows: 12,
@@ -7310,7 +8020,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7310
8020
  boxSizing: "border-box",
7311
8021
  font: "inherit"
7312
8022
  }
7313
- }) : null) : null);
8023
+ }) : null)) : null);
7314
8024
  }
7315
8025
  //#endregion
7316
8026
  //#region lib/types/reasoning-presentation.js
@@ -7701,21 +8411,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7701
8411
  "context-omitted": "incomplete context"
7702
8412
  }[explanation.assessment.diagnostic]}); failure was not treated as simplicity.`;
7703
8413
  const evidence = explanation.assessment.semantic;
8414
+ const scan = evidence?.candidateScan;
8415
+ const rejectionLabels = {
8416
+ excluded: zh ? "已排除" : "excluded",
8417
+ "configured-id": zh ? "非指定模型" : "configured ID mismatch",
8418
+ category: zh ? "非轻量分类" : "not lightweight",
8419
+ input: zh ? "不支持文本" : "text unsupported",
8420
+ "reasoning-disable-unproven": zh ? "关闭 reasoning 未获证明" : "reasoning disable unproven",
8421
+ budget: zh ? "输入预算不足" : "insufficient input budget"
8422
+ };
8423
+ const candidateDetail = scan === void 0 ? "" : zh ? ` 候选检查:${scan.candidates} 个模型,${scan.eligible} 个合格。首个排除原因:${Object.entries(scan.rejected).filter(([, count]) => count > 0).map(([reason, count]) => `${rejectionLabels[reason]} ${count}`).join(";") || "无"}。` : ` Candidate scan: ${scan.candidates} models, ${scan.eligible} eligible. First rejection reasons: ${Object.entries(scan.rejected).filter(([, count]) => count > 0).map(([reason, count]) => `${rejectionLabels[reason]} ${count}`).join("; ") || "none"}.`;
8424
+ const preparationDetail = evidence?.preparationFailure === void 0 ? "" : zh ? " 原生模型准备未提供 off 控制;未发起分类调用。" : "Native model preparation did not expose off; classifier call was not started.";
8425
+ const semantic = evidence === void 0 ? void 0 : zh ? `辅助分类模型:${evidence.modelId ?? "未选定"}。判断总耗时 ${evidence.elapsedMs} ms,等待预算 ${evidence.budgetMs} ms。${evidence.adapterStartedMs === void 0 ? "尚未开始适配器调用。" : `适配器调用始于 ${evidence.adapterStartedMs} ms。`}${evidence.firstTextMs === void 0 ? "未观察到文本输出。" : `首次文本输出于 ${evidence.firstTextMs} ms。`}${evidence.nativeFinish === void 0 ? "未观察到原生结束。" : evidence.nativeFinish === "stop" ? "观察到原生正常结束。" : "观察到原生非正常结束。"}结果校验:${{
8426
+ "not-validated": "未完成",
8427
+ valid: "通过",
8428
+ invalid: "无效",
8429
+ "context-omitted": "通过格式校验,但上下文省略阻止降级"
8430
+ }[evidence.validation]}。这些是辅助判断阶段,不证明网络或模型慢的具体原因,也不是正式回答的 Usage。` : `Auxiliary classifier: ${evidence.modelId ?? "not selected"}. Assessment total ${evidence.elapsedMs} ms; budget ${evidence.budgetMs} ms. ${evidence.adapterStartedMs === void 0 ? "Adapter call not started." : `Adapter call started at ${evidence.adapterStartedMs} ms.`} ${evidence.firstTextMs === void 0 ? "No text output observed." : `First text at ${evidence.firstTextMs} ms.`} ${evidence.nativeFinish === void 0 ? "No native finish observed." : evidence.nativeFinish === "stop" ? "Native stop observed." : "Native non-stop finish observed."} Result validation: ${{
8431
+ "not-validated": "not completed",
8432
+ valid: "passed",
8433
+ invalid: "invalid",
8434
+ "context-omitted": "format passed; omitted context prevented downshift"
8435
+ }[evidence.validation]}. These auxiliary milestones do not prove a network/model latency cause and are not main-answer Usage.`;
7704
8436
  return {
7705
8437
  conclusion,
7706
8438
  choice,
7707
8439
  diagnostic,
7708
- semantic: evidence === void 0 ? void 0 : zh ? `辅助分类模型:${evidence.modelId ?? "未选定"}。判断总耗时 ${evidence.elapsedMs} ms,等待预算 ${evidence.budgetMs} ms。${evidence.adapterStartedMs === void 0 ? "尚未开始适配器调用。" : `适配器调用始于 ${evidence.adapterStartedMs} ms。`}${evidence.firstTextMs === void 0 ? "未观察到文本输出。" : `首次文本输出于 ${evidence.firstTextMs} ms。`}${evidence.nativeFinish === void 0 ? "未观察到原生结束。" : evidence.nativeFinish === "stop" ? "观察到原生正常结束。" : "观察到原生非正常结束。"}结果校验:${{
7709
- "not-validated": "未完成",
7710
- valid: "通过",
7711
- invalid: "无效",
7712
- "context-omitted": "通过格式校验,但上下文省略阻止降级"
7713
- }[evidence.validation]}。这些是辅助判断阶段,不证明网络或模型慢的具体原因,也不是正式回答的 Usage。` : `Auxiliary classifier: ${evidence.modelId ?? "not selected"}. Assessment total ${evidence.elapsedMs} ms; budget ${evidence.budgetMs} ms. ${evidence.adapterStartedMs === void 0 ? "Adapter call not started." : `Adapter call started at ${evidence.adapterStartedMs} ms.`} ${evidence.firstTextMs === void 0 ? "No text output observed." : `First text at ${evidence.firstTextMs} ms.`} ${evidence.nativeFinish === void 0 ? "No native finish observed." : evidence.nativeFinish === "stop" ? "Native stop observed." : "Native non-stop finish observed."} Result validation: ${{
7714
- "not-validated": "not completed",
7715
- valid: "passed",
7716
- invalid: "invalid",
7717
- "context-omitted": "format passed; omitted context prevented downshift"
7718
- }[evidence.validation]}. These auxiliary milestones do not prove a network/model latency cause and are not main-answer Usage.`,
8440
+ semantic: semantic === void 0 ? void 0 : `${semantic}${candidateDetail}${preparationDetail}`,
7719
8441
  assessment: `${zh ? "判断来源:" : "Assessment: "}${explanation.assessment.source === "semantic" ? zh ? "语义分类" : "semantic classification" : zh ? "本地规则" : "local rules"}${explanation.assessment.signals.length ? ` — ${explanation.assessment.signals.map((signal) => signals[signal]).join(zh ? "、" : ", ")}` : ""}`
7720
8442
  };
7721
8443
  }