@agfpd/iapeer 0.4.9 → 0.4.11
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
package/src/identity/index.ts
CHANGED
|
@@ -213,8 +213,11 @@ export function readPeerProfile(cwd: string = process.cwd()): PeerProfile | null
|
|
|
213
213
|
// the `iapeer init --personality` override (a deliberately-named peer in a folder
|
|
214
214
|
// whose basename differs), so the heal stays a flagged drift, not a silent rewrite.
|
|
215
215
|
const personality = validatePersonality(obj.personality, 'peer-profile personality')
|
|
216
|
-
// default_runtime is the contract field name (the routing/wake/first-launch default)
|
|
217
|
-
//
|
|
216
|
+
// default_runtime is the contract field name (the routing/wake/first-launch default). Phase-3:
|
|
217
|
+
// foundation no longer WRITES the legacy `runtime` mirror (see writePeerProfileAtomic), but the
|
|
218
|
+
// read-fallback is KEPT as a dormant defensive net — it tolerates a legacy-shaped profile (restored
|
|
219
|
+
// backup / hand-edit) at a 1-token cost. All real writers emit default_runtime (foundation +
|
|
220
|
+
// telegram-runtime 0.19.4). Consistent with the registry read-fallback (§3 defensive keep).
|
|
218
221
|
const runtime = validateRuntime(obj.default_runtime ?? obj.runtime, 'peer-profile default_runtime')
|
|
219
222
|
const interfaces = normalizeInterfaces(obj.interfaces, `${IAPEER_DIR}/${PEER_PROFILE_FILE}`)
|
|
220
223
|
const intelligence = normalizeIntelligence(obj.intelligence, runtime)
|
|
@@ -292,18 +295,20 @@ export function writePeerProfileAtomic(cwd: string, profile: PeerProfileWrite):
|
|
|
292
295
|
const merged: Record<string, unknown> = {
|
|
293
296
|
...existing,
|
|
294
297
|
personality: profile.personality,
|
|
295
|
-
// Phase-
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
// Spawned-Peer, external scripts) stay alive with zero blast radius. Phase 3
|
|
299
|
-
// (gated on every reader shipping dual-read) removes the mirror.
|
|
298
|
+
// Phase-3 (default_runtime migration complete): emit ONLY the contract field `default_runtime` —
|
|
299
|
+
// the legacy `runtime` mirror is removed. All readers switched: telegram-runtime 0.19.4 reads
|
|
300
|
+
// default_runtime and no longer re-seeds the mirror on mutation; foundation reads default_runtime.
|
|
300
301
|
default_runtime: profile.runtime,
|
|
301
|
-
runtime: profile.runtime,
|
|
302
302
|
runtimes: profile.runtimes,
|
|
303
303
|
description,
|
|
304
304
|
intelligence,
|
|
305
305
|
...(profile.interfaces ? { interfaces: profile.interfaces } : {}),
|
|
306
306
|
}
|
|
307
|
+
// Phase-3: actively STRIP the legacy `runtime` mirror — it is a CONTRACT field superseded by
|
|
308
|
+
// default_runtime (not an owner field to preserve via `...existing`). This removes a lingering mirror
|
|
309
|
+
// on the next write of any already-migrated profile AND heals a diverged `runtime` (default_runtime
|
|
310
|
+
// governs). Owner sections (initial_prompt, wake_policy, expansion, notifier, …) stay preserved.
|
|
311
|
+
delete merged.runtime
|
|
307
312
|
// C2 — initial_prompt: an explicit value in the write wins; otherwise the existing
|
|
308
313
|
// on-disk value is preserved verbatim by `...existing` (a caller that doesn't own
|
|
309
314
|
// it never wipes it). Only a non-empty string sets it.
|
|
@@ -50,9 +50,6 @@ import { dirname } from 'path'
|
|
|
50
50
|
import { writeFileAtomic } from '../storage/index.ts'
|
|
51
51
|
import { codexGlobalConfigPath } from './nativeMemory.ts'
|
|
52
52
|
|
|
53
|
-
/** The codex-cli version the hash algorithm + key format were verified on. */
|
|
54
|
-
export const TRUST_HOOKS_TESTED_CODEX_VERSION = '0.138.0'
|
|
55
|
-
|
|
56
53
|
/** hooks.json event names → the snake_case labels codex keys state with
|
|
57
54
|
* (upstream `hook_event_key_label`). */
|
|
58
55
|
const EVENT_LABELS: Record<string, string> = {
|
package/src/registry/index.ts
CHANGED
|
@@ -158,9 +158,11 @@ function normalizePeer(raw: unknown): PeerRecord {
|
|
|
158
158
|
)}"`,
|
|
159
159
|
)
|
|
160
160
|
}
|
|
161
|
-
// default_runtime is the contract field
|
|
162
|
-
//
|
|
163
|
-
//
|
|
161
|
+
// default_runtime is the contract field. Phase-3 (registry): foundation no longer WRITES the legacy
|
|
162
|
+
// `runtime` mirror (see writePeersIndexAtomic), but the read-fallback is KEPT as a dormant defensive
|
|
163
|
+
// net — it tolerates a legacy-shaped entry (restored backup / hand-edit) at a 1-token cost. All real
|
|
164
|
+
// readers switched (telegram → default_runtime, notifier → cwd-only); registry is single-writer so
|
|
165
|
+
// new entries are default_runtime-only. Full fallback removal is a future final cleanup.
|
|
164
166
|
const defaultRuntime = obj.default_runtime ?? obj.runtime
|
|
165
167
|
if (!isRuntime(defaultRuntime)) {
|
|
166
168
|
throw new IapError(
|
|
@@ -315,15 +317,15 @@ function writePeersIndexAtomic(paths: PeersPaths, index: PeersIndex): void {
|
|
|
315
317
|
// Persist the RAW intelligence verbatim (legacy-safe round-trip) and DROP the
|
|
316
318
|
// intelligenceRaw shadow field from the on-disk shape — the file carries the
|
|
317
319
|
// legacy vocab the live IAP reads, never the foundation's in-memory normalization.
|
|
318
|
-
// Phase-
|
|
319
|
-
//
|
|
320
|
-
//
|
|
320
|
+
// Phase-3 (registry): the disk shape carries ONLY the contract field `default_runtime` — the legacy
|
|
321
|
+
// `runtime` mirror is removed (all registry readers switched: telegram → default_runtime, notifier →
|
|
322
|
+
// cwd-only, foundation → default_runtime). Local per-peer profiles keep their mirror until the paired
|
|
323
|
+
// telegram writePeerProfile follow-up.
|
|
321
324
|
const peersForDisk = [...index.peers]
|
|
322
325
|
.sort((a, b) => a.personality.localeCompare(b.personality))
|
|
323
326
|
.map(peer => ({
|
|
324
327
|
personality: peer.personality,
|
|
325
328
|
default_runtime: peer.runtime,
|
|
326
|
-
runtime: peer.runtime,
|
|
327
329
|
runtimes: peer.runtimes,
|
|
328
330
|
description: peer.description,
|
|
329
331
|
intelligence: peer.intelligenceRaw ?? peer.intelligence,
|
package/src/supervisor/paths.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Supervisor session paths — under a configurable run dir (NOT hardcoded). Prod resolves it to
|
|
2
2
|
// ~/.iapeer/state/supervisor via the storage layer; tests pass a temp dir, so the daemon's
|
|
3
3
|
// socket/pid files never touch a real location.
|
|
4
|
-
import { renameSync,
|
|
4
|
+
import { renameSync, writeFileSync } from 'node:fs'
|
|
5
5
|
import { readFileSync } from 'node:fs'
|
|
6
6
|
import { join } from 'node:path'
|
|
7
7
|
import { pluginStateDir } from '../storage/index.ts'
|
|
@@ -57,12 +57,3 @@ export function readGeometry(runDir: string, session: string): { cols: number; r
|
|
|
57
57
|
}
|
|
58
58
|
return null
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
/** Remove the geometry sidecar (shutdown cleanup); best-effort. */
|
|
62
|
-
export function clearGeometry(runDir: string, session: string): void {
|
|
63
|
-
try {
|
|
64
|
-
unlinkSync(geometryPath(runDir, session))
|
|
65
|
-
} catch {
|
|
66
|
-
/* */
|
|
67
|
-
}
|
|
68
|
-
}
|