@agfpd/iapeer 0.4.111 → 0.4.113

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.111",
3
+ "version": "0.4.113",
4
4
  "description": "Run Claude Code and Codex CLI as local background agents that message each other, wake on demand, and share one memory.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "agfpd",
@@ -53,9 +53,9 @@
53
53
  "test": "IAPEER_TEST_SANDBOX=1 bun test",
54
54
  "typecheck": "tsc --noEmit",
55
55
  "preversion": "npm run test && npm run typecheck",
56
- "release": "npm version patch && npm publish && git push origin main --follow-tags",
57
- "release:minor": "npm version minor && npm publish && git push origin main --follow-tags",
58
- "release:major": "npm version major && npm publish && git push origin main --follow-tags",
56
+ "release": "npm version patch && git push origin main --follow-tags",
57
+ "release:minor": "npm version minor && git push origin main --follow-tags",
58
+ "release:major": "npm version major && git push origin main --follow-tags",
59
59
  "prepublishOnly": "test -z \"$(git status --porcelain)\" || (echo 'release: working tree is dirty — commit or stash before release' >&2 && exit 1)"
60
60
  },
61
61
  "publishConfig": {
package/src/cli/index.ts CHANGED
@@ -450,7 +450,7 @@ export async function addRuntime(
450
450
  delete cleanEnv.PEER_PERSONALITY
451
451
  delete cleanEnv.PEER_RUNTIME
452
452
  delete cleanEnv.PEER_IDENTITY
453
- const { initPeer } = await import('../init/index.ts')
453
+ const { initPeer, hasClaudeMcpWiring } = await import('../init/index.ts')
454
454
  const out: AddRuntimeOutcome[] = []
455
455
  for (const p of targets) {
456
456
  // Skip an infra-DEFAULT peer only when the runtime being added is AGENTIC: giving a
@@ -467,9 +467,12 @@ export async function addRuntime(
467
467
  // Short-circuiting on the declaration alone would report "already" while the channel
468
468
  // does not exist — so for infra, converge: a missing plist means there IS work to do.
469
469
  // initPeer is idempotent, so the repair costs nothing when everything is in place.
470
+ // Same for claude: declared on a codex-born peer ≠ its `.mcp.json` wiring exists.
470
471
  const realized = isInfraRuntime(runtime)
471
472
  ? existsSync(resolveAlwaysOnTarget(p.personality, runtime as Runtime, env).path)
472
- : true
473
+ : runtime === 'claude'
474
+ ? hasClaudeMcpWiring(p.cwd)
475
+ : true
473
476
  if (p.runtimes.includes(runtime as Runtime) && realized) {
474
477
  out.push({ personality: p.personality, action: 'already' })
475
478
  continue
@@ -481,7 +484,10 @@ export async function addRuntime(
481
484
  out.push({
482
485
  personality: p.personality,
483
486
  action: 'added',
484
- detail: [repair ? 'declared but no plist — channel re-provisioned' : undefined, ...warns].filter(Boolean).join(' | ') || undefined,
487
+ detail:
488
+ [repair ? (isInfraRuntime(runtime) ? 'declared but no plist — channel re-provisioned' : 'declared but not wired — runtime re-provisioned') : undefined, ...warns]
489
+ .filter(Boolean)
490
+ .join(' | ') || undefined,
485
491
  })
486
492
  } catch (e) {
487
493
  out.push({ personality: p.personality, action: 'failed', detail: e instanceof Error ? e.message : String(e) })
package/src/init/index.ts CHANGED
@@ -599,6 +599,18 @@ export async function initPeer(opts: InitPeerOptions): Promise<InitPeerResult> {
599
599
  function hasClaudeMarker(cwd: string): boolean {
600
600
  return existsSync(join(cwd, '.claude'))
601
601
  }
602
+ /** Claude side REALIZED: the cwd's `.mcp.json` carries the foundation daemon server.
603
+ * A peer born codex-primary declares claude but never got this wiring (init wires
604
+ * claude only for a claude primary / `.claude` marker) → a claude session without
605
+ * send_to_peer (live, fleet switch 2026-10-17). */
606
+ export function hasClaudeMcpWiring(cwd: string): boolean {
607
+ try {
608
+ const doc = JSON.parse(readFileSync(join(cwd, '.mcp.json'), 'utf8')) as { mcpServers?: Record<string, unknown> }
609
+ return Boolean(doc.mcpServers?.[IAPEER_MCP_SERVER_NAME])
610
+ } catch {
611
+ return false
612
+ }
613
+ }
602
614
  function hasCodexMarker(cwd: string): boolean {
603
615
  return existsSync(join(cwd, '.codex'))
604
616
  }
@@ -363,9 +363,15 @@ export const claudeAdapter: RuntimeAdapter = {
363
363
  * - anything else (incl. the post-select "Resuming…" load state) → null (wait).
364
364
  */
365
365
  bootDialogKeys(pane: string): string[] | null {
366
- if (pane.includes('Resume from summary') || pane.includes('Bypass Permissions mode')) {
366
+ if (pane.includes('Resume from summary')) {
367
367
  return /❯\s*2\./.test(pane) ? ['Enter'] : ['Down']
368
368
  }
369
+ // Bypass accept: 2.1.30x dropped the "1."/"2." numbering ("❯ No, exit" / "Yes, I
370
+ // accept") — matching only "❯ 2." Down-toggled forever (live, 2026-10-17). Confirm
371
+ // once the cursor is SEEN on the Yes row, numbered or not.
372
+ if (pane.includes('Bypass Permissions mode')) {
373
+ return /❯\s*(?:2\.\s*)?Yes,?\s*I\s*accept/.test(pane) ? ['Enter'] : ['Down']
374
+ }
369
375
  // Folder-trust: older claude defaulted the cursor to "1. Yes, proceed", but 2.1.30x
370
376
  // renders "❯ No, exit" / "Yes, I trust this folder" with the DEFAULT on exit — a bare
371
377
  // Enter cleanly exits the peer (live: claude-boris child-exit 5s after first wake,