@agfpd/iapeer 0.4.11 → 0.4.13

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": "@agfpd/iapeer",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "Foundation core for the iapeer multi-agent ecosystem: identity, registry, storage, codec.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "agfpd",
package/src/cli/index.ts CHANGED
@@ -1545,10 +1545,13 @@ export async function runCli(argv: string[], env: NodeJS.ProcessEnv = process.en
1545
1545
  } else if (warns.length > 0 && flags.json !== true) {
1546
1546
  lines.push(`⚠ ${peer.personality}: ${warns.map(i => i.field).join(', ')}`)
1547
1547
  }
1548
- // Migration candidate: conformant, but the default_runtime warn fired
1549
- // (legacy-only field or diverged mirror). Errored profiles are NEVER
1548
+ // Migration candidate (Phase-3): conformant AND still carrying the legacy `runtime` field —
1549
+ // a warn-fired legacy-only/diverged shape OR an in-sync mirror. In Phase-3 ANY `runtime`
1550
+ // field is stripped, so the candidate set is "has a runtime field", not just "warn fired"
1551
+ // (an in-sync mirror does not warn, but must still be cleaned). Errored profiles are NEVER
1550
1552
  // rewritten — migration heals shape, it does not guess at broken data.
1551
- if (errs.length === 0 && warns.some(i => i.field === 'default_runtime')) {
1553
+ const hasLegacyRuntime = !!raw && typeof raw === 'object' && (raw as Record<string, unknown>).runtime !== undefined
1554
+ if (errs.length === 0 && (warns.some(i => i.field === 'default_runtime') || hasLegacyRuntime)) {
1552
1555
  legacyRuntimeProfiles.push({ personality: peer.personality, cwd: peer.cwd })
1553
1556
  }
1554
1557
  }
@@ -1568,16 +1571,15 @@ export async function runCli(argv: string[], env: NodeJS.ProcessEnv = process.en
1568
1571
  out(`\n${index.peers.length} peers · ${errors} error(s) · ${driftCount} index↔local drift(s)\n`)
1569
1572
  }
1570
1573
  if (flags.fix === true) {
1571
- // Phase-2 data migration (staged default_runtime story): rewrite conformant
1572
- // local profiles still on the legacy field shape — the writer now emits
1573
- // `default_runtime` + the in-sync legacy `runtime` mirror. Runs BEFORE the
1574
- // reindex so the healed index is projected from migrated locals.
1574
+ // Phase-3 data migration (default_runtime story complete): rewrite conformant local profiles
1575
+ // still carrying the legacy `runtime` field — the writer now emits ONLY `default_runtime` and
1576
+ // STRIPS the mirror. Runs BEFORE the reindex so the healed index is projected from clean locals.
1575
1577
  const migrated: string[] = []
1576
1578
  for (const p of legacyRuntimeProfiles) {
1577
1579
  if (migrateProfileRuntimeField(p.cwd)) migrated.push(p.personality)
1578
1580
  }
1579
1581
  if (migrated.length > 0) {
1580
- out(`migrated runtime→default_runtime (legacy mirror kept): ${migrated.join(', ')}\n`)
1582
+ out(`stripped legacy \`runtime\` mirror (default_runtime only): ${migrated.join(', ')}\n`)
1581
1583
  }
1582
1584
  if (driftCount > 0 || errors === 0) {
1583
1585
  const { healed, missing } = await reindexFromLocals({ env })
@@ -183,8 +183,10 @@ export function migrateProfileRuntimeField(cwd: string): boolean {
183
183
  }
184
184
  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return false
185
185
  const obj = raw as Record<string, unknown>
186
- const inShape =
187
- isRuntime(obj.default_runtime) && (obj.runtime === undefined || obj.runtime === obj.default_runtime)
186
+ // Phase-3: in-shape = default_runtime present AND NO legacy `runtime` field at all. An in-sync mirror
187
+ // (runtime === default_runtime) is NO LONGER in shape — it must be stripped (writePeerProfileAtomic
188
+ // drops it), so `verify --fix` cleans every profile still carrying the mirror.
189
+ const inShape = isRuntime(obj.default_runtime) && obj.runtime === undefined
188
190
  if (inShape) return false
189
191
  const profile = readPeerProfile(cwd)
190
192
  if (!profile) return false