@agfpd/iapeer 0.2.30 → 0.2.31

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.2.30",
3
+ "version": "0.2.31",
4
4
  "description": "Foundation core for the iapeer multi-agent ecosystem: identity, registry, storage, codec.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -195,6 +195,29 @@ describe('remove (registry record via the locked writer)', () => {
195
195
  expect(hasEphemeralArmed(loadLifecycleConfig(e2), 'claude-silentworker')).toBe(true)
196
196
  })
197
197
 
198
+ test('self-done ephemeral check keys on the CANONICAL registry cwd, not process.cwd() (live false-warning, scriber 11.06)', async () => {
199
+ // an ephemeral peer registered with a cwd carrying wake_policy:ephemeral
200
+ const cwd = join(root, 'worker')
201
+ mkdirSync(join(cwd, '.iapeer'), { recursive: true })
202
+ writeFileSync(join(cwd, '.iapeer', 'peer-profile.json'), JSON.stringify({ personality: 'worker', runtime: 'claude', wake_policy: 'ephemeral' }))
203
+ await upsertPeer({ personality: 'worker', runtime: 'claude', cwd, intelligence: 'artificial' }, { rootDir: root })
204
+ const e = { ...env(), PEER_IDENTITY: 'claude-worker' }
205
+ let captured = ''
206
+ const origWrite = process.stdout.write
207
+ process.stdout.write = ((s: string | Uint8Array) => {
208
+ captured += typeof s === 'string' ? s : Buffer.from(s).toString('utf8')
209
+ return true
210
+ }) as typeof process.stdout.write
211
+ try {
212
+ // invoked from THIS test process's cwd (≠ peer cwd) — the warning must NOT fire
213
+ expect(await runCli(['self-done'], e)).toBe(0)
214
+ expect(captured).toContain('armed claude-worker')
215
+ expect(captured).not.toContain('marker is inert')
216
+ } finally {
217
+ process.stdout.write = origWrite
218
+ }
219
+ })
220
+
198
221
  test('purges identity-keyed lifecycle state with the record — a namesake newborn must not inherit a dead peer\'s parking (boris 10.06)', async () => {
199
222
  await register('reborn')
200
223
  const e = env()
package/src/cli/index.ts CHANGED
@@ -1058,7 +1058,16 @@ export async function runCli(argv: string[], env: NodeJS.ProcessEnv = process.en
1058
1058
  }
1059
1059
  const cfg = loadLifecycleConfig(env)
1060
1060
  setEphemeralArmed(cfg, identity)
1061
- const ephemeral = isEphemeralPeer(process.cwd())
1061
+ // The ephemeral check keys on the peer's CANONICAL cwd (registry), NOT on
1062
+ // process.cwd(): the verb is invoked from wherever the agent's shell
1063
+ // happens to be (scriber lives in the vault half the time), and a foreign
1064
+ // cwd made this warning LIE — «marker is inert» on a genuinely ephemeral
1065
+ // peer (live case scriber 11.06: the false warning sent doc/scriber down a
1066
+ // wrong root-cause chase). The marker itself was never affected — it is
1067
+ // identity-keyed and supervise checks the SESSION's canonical cwd.
1068
+ const addr = parseSessionName(identity)!
1069
+ const canonicalCwd = findPeer(readPeersIndex({ env }), addr.personality)?.cwd ?? process.cwd()
1070
+ const ephemeral = isEphemeralPeer(canonicalCwd)
1062
1071
  out(
1063
1072
  `self-done: armed ${identity} for the quiet-window reap (no one woken)` +
1064
1073
  (ephemeral ? '' : ' — NOTE: this peer is not wake_policy:ephemeral, the marker is inert') +