@quolu/lattice 0.72.1 → 0.73.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.72.1",
3
+ "version": "0.73.0",
4
4
  "description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
5
5
  "author": {
6
6
  "name": "Quo / クオ at kitepon.dev",
@@ -76,7 +76,14 @@ function canonicalReporting(value) {
76
76
  return !value.enabled || (value.endpoint !== undefined && value.credential_file !== undefined);
77
77
  }
78
78
 
79
+ // このOSで収集に対応するか。Windowsはstoreの所有者と権限をPOSIXの形で確かめられない(`ensureSafeDir`)ので
80
+ // 対応しない。設定が有効でも記録は作らず、工場へは`disabled`でなく`unsupported`と答える——設定は有効なのに
81
+ // 製品が黙って無効と答えると、受け側は故障と区別できない。
82
+ const collectionSupported = (options = {}) => (options.platform ?? hostPlatform()) !== 'win32';
83
+ const inactiveCollection = (options = {}) => (collectionSupported(options) ? 'disabled' : 'unsupported');
84
+
79
85
  function collectionEnabled(options = {}) {
86
+ if (!collectionSupported(options)) return false;
80
87
  const env = options.env ?? process.env;
81
88
  try {
82
89
  const path = options.configPath ?? defaultFactoryReporterConfigPath(env);
@@ -264,7 +271,7 @@ function snapshot(options = {}) {
264
271
  runtime_errors: rows.filter((record) => record.status === 'open').map(({ product_version, error_code, component, status, severity, fingerprint, message_template, count, first_seen, last_seen, state_schema_version, safe_context }) => ({ product_version, error_code, component, status, severity, fingerprint, message_template, occurrence_count: count, first_seen, last_seen, state_schema_version, ...(safe_context === undefined ? {} : { safe_context }) })),
265
272
  resolutions: rows.filter((record) => record.status === 'resolved').map(({ fingerprint, resolved_at, reason_code }) => ({ fingerprint, resolved_at, reason_code })),
266
273
  diagnostics: {
267
- collection: enabled ? 'enabled' : 'disabled',
274
+ collection: enabled ? 'enabled' : inactiveCollection(options),
268
275
  status: enabled ? 'ready' : 'not_applicable',
269
276
  total_count: store.records.length,
270
277
  pending_count: store.records.filter((record) => record.sequence > store.acknowledged_through).length,
@@ -279,7 +286,7 @@ export function runtimeErrorsSnapshot(afterCursor = 0, limit = MAX_RECORDS, opti
279
286
 
280
287
  export function runtimeErrorsDiagnostics(options = {}) {
281
288
  if (!collectionEnabled(options)) {
282
- return { schema: DIAGNOSTICS_SCHEMA, collection: 'disabled', status: 'not_applicable', total_count: 0, open_count: 0, pending_count: 0, high_watermark: 0, acknowledged_through: 0 };
289
+ return { schema: DIAGNOSTICS_SCHEMA, collection: inactiveCollection(options), status: 'not_applicable', total_count: 0, open_count: 0, pending_count: 0, high_watermark: 0, acknowledged_through: 0 };
283
290
  }
284
291
  try {
285
292
  const { path } = optionsFor(options);
@@ -300,7 +307,7 @@ export function runtimeErrorsDiagnostics(options = {}) {
300
307
  }
301
308
 
302
309
  export function recordRuntimeError(code, options = {}) {
303
- if (!collectionEnabled(options)) return { status: 'disabled' };
310
+ if (!collectionEnabled(options)) return { status: inactiveCollection(options) };
304
311
  const definition = definitions[code];
305
312
  if (!definition) throw Error('unknown_runtime_code');
306
313
  const { path } = optionsFor(options);