@evomap/evolver-cli 2.0.0-beta.7 → 2.0.0-beta.8

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/dist/reuse.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { assetstore, hub as hubNs } from '@evomap/evolver-core';
2
2
  import type { ConnectPublicOptions, PublicHelloOptions, PublicHubCapability } from '@evomap/evolver-adapter-public';
3
3
  declare const REUSE_CONTRACT = "reuse.v1";
4
- export type ReuseStatus = 'ok' | 'dry_run' | 'invalid_arg' | 'missing_id' | 'unsupported' | 'not_found' | 'unauthorized' | 'unavailable' | 'network' | 'rate_limited' | 'internal_error';
4
+ export type ReuseStatus = 'ok' | 'dry_run' | 'invalid_arg' | 'missing_id' | 'unsupported' | 'not_found' | 'unauthorized' | 'unavailable' | 'network' | 'rate_limited' | 'integrity_failed' | 'internal_error';
5
5
  /** The stable reuse.v1 machine contract printed to stdout on success AND failure. Field set is locked by the
6
6
  * consumer (evox-desktop `evolverReuseEnvelope`, #1008): { ok, contract, status, reason, message }. */
7
7
  export interface ReuseEnvelope {
package/dist/reuse.js CHANGED
@@ -167,18 +167,30 @@ export function parseReuseArgs(argv) {
167
167
  const runId = flagValue(argv, '--run');
168
168
  return { ok: true, value: { id, mode: modeRaw === 'direct' ? 'direct' : 'reference', ...(runId ? { runId } : {}) } };
169
169
  }
170
+ // Integrity rejection is a first-class outcome, not an internal fault: the hub demonstrably rewrites
171
+ // delivered payloads (injected `validation`, wholesale `payload_backfill_reason` synthesis — #570), so the
172
+ // desktop adapter needs a typed reason to tell "this asset cannot be verified" apart from "the engine broke".
173
+ // Messages are fixed strings by construction (hard rule 2: nothing dynamic can reach a stream).
174
+ class ReuseIntegrityError extends Error {
175
+ }
176
+ const INTEGRITY_MISMATCH_MESSAGE = 'hub-delivered content does not match the asset content fingerprint';
177
+ const INTEGRITY_BACKFILLED_MESSAGE = 'hub delivered a synthesized payload for this asset; the original published content is unavailable for verification';
178
+ function integrityError(content) {
179
+ const backfilled = stringField(content, 'payload_backfill_reason') !== undefined;
180
+ return new ReuseIntegrityError(backfilled ? INTEGRITY_BACKFILLED_MESSAGE : INTEGRITY_MISMATCH_MESSAGE);
181
+ }
170
182
  async function ingestHubAsset(store, deps, asset, requestedId) {
171
183
  const cleaned = stripHubMetadata(unwrapHubAssetContent(asset));
172
184
  const actualAssetId = wire.computeAssetId(cleaned);
173
185
  const contentAssetId = stringField(cleaned, 'asset_id');
174
186
  if (!actualAssetId || !contentAssetId || actualAssetId !== contentAssetId) {
175
- throw new Error('asset integrity verification failed');
187
+ throw integrityError(cleaned);
176
188
  }
177
189
  if (isContentAssetId(requestedId) && actualAssetId !== requestedId) {
178
- throw new Error('asset integrity verification failed');
190
+ throw integrityError(cleaned);
179
191
  }
180
192
  if (!isContentAssetId(requestedId) && stringField(cleaned, 'id') !== requestedId) {
181
- throw new Error('asset integrity verification failed');
193
+ throw integrityError(cleaned);
182
194
  }
183
195
  await assertNoLocalReuseIdConflict(cleaned, store);
184
196
  const provenance = new assetstore.ProvenanceStore(storeBaseDir(store, deps));
@@ -270,6 +282,9 @@ function hubErrorField(body) {
270
282
  return typeof err === 'string' ? err : undefined;
271
283
  }
272
284
  function mapError(e) {
285
+ if (e instanceof ReuseIntegrityError) {
286
+ return { ok: false, status: 'integrity_failed', message: e.message };
287
+ }
273
288
  if (e instanceof AuthError) {
274
289
  // hubFetch raises AuthError for BOTH 401 and 403, so the hub's anti-abuse 403
275
290
  // (`bulk_fetch_blocked: IP antibody active`) used to be misreported as "log in" — it is an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver-cli",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-beta.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "evolver CLI (status/watch/cycles/rebuild-views/...)",
@@ -20,12 +20,12 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@evomap/evolver-core": "2.0.0-beta.7",
24
- "@evomap/evolver-adapter-public": "2.0.0-beta.7",
25
- "@evomap/evolver-mcp": "2.0.0-beta.7",
26
- "@evomap/evolver-proxy": "2.0.0-beta.7",
27
- "@evomap/evolver-runtime-adapters": "2.0.0-beta.7",
28
- "@evomap/evolver-webui": "2.0.0-beta.7"
23
+ "@evomap/evolver-core": "2.0.0-beta.8",
24
+ "@evomap/evolver-adapter-public": "2.0.0-beta.8",
25
+ "@evomap/evolver-mcp": "2.0.0-beta.8",
26
+ "@evomap/evolver-proxy": "2.0.0-beta.8",
27
+ "@evomap/evolver-runtime-adapters": "2.0.0-beta.8",
28
+ "@evomap/evolver-webui": "2.0.0-beta.8"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",