Skip to content

bug(prime): stock 0.9.5 compiled standalone binary lacks dist/index.js, breaking PrimeAgentDaemonBridge #728

Closed

Description

@rynfar

Summary & Empirical Verification

In upstream release v0.9.5, Prime Agent introduced standalone compiled binary distributions (prime-agent-0.9.5-darwin-arm64.tar.gz, etc.) compiled with Bun (entrypointPath: "/$bunfs/root/prime-agent"), which are now preferred by the default installer over global npm installations.

We conducted an empirical test using the stock v0.9.5 release archives in an isolated environment.

1. Does the compiled binary archive contain dist/index.js?

No.
Inspecting prime-agent-0.9.5-darwin-arm64.tar.gz reveals:

prime-agent (Mach-O 64-bit executable arm64)
package.json
install.sh
README.md
CHANGELOG.md
LICENSE
prime-agent-runtime/

There is no dist/ directory and no dist/index.js. However, the bundled package.json retains:

{
  "name": "@earendil-works/pi-coding-agent",
  "version": "0.9.5",
  "main": "./dist/index.js",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js"
    }
  }
}

2. Does Pylon's PrimeAgentDaemonBridge resolve it?

No.
When PrimeAgentDaemonBridge.locatePrimeAgentPublicPackage is given the path to the compiled executable, it crawls up to package.json, identifies the package, and calls resolvePublicEntry to find ./dist/index.js.
Because dist/index.js does not exist on disk, it fails with:

{
  "_tag": "PrimeAgentDaemonBridgeError",
  "binaryPath": ".../compiled/prime-agent",
  "reason": "invalid-public-entry",
  "detail": "The prime-agent public export './dist/index.js' is missing or unsafe.",
  "cause": {
    "errno": -2,
    "code": "ENOENT",
    "syscall": "realpath",
    "path": ".../compiled/dist/index.js"
  }
}

3. Does the compiled daemon start and respond to ping / handshake?

Yes.
When spawned directly with:

./prime-agent --mode daemon --daemon-socket /tmp/prime-verify-095.sock --offline

The binary starts immediately, binds the UNIX domain socket, and upon client connection emits a fully valid daemon_hello payload:

{
  "type": "daemon_hello",
  "socketPath": "/tmp/prime-verify-095.sock",
  "protocol": { "name": "prime-agent.daemon", "version": 7 },
  "schemaId": "protocol-7-schema-28-92bc5368a082",
  "schemaRevision": 28,
  "appVersion": "0.9.5",
  "runtime": {
    "buildId": "a7d791bc1be09793ed5f3ec05bf4cccbc60679ea",
    "executablePath": ".../compiled/prime-agent",
    "entrypointPath": "//root/prime-agent"
  },
  "serverCapabilities": [
    "attach_snapshot",
    "event_sequence",
    "extension_ui",
    "slim_attach",
    "chunked_snapshot",
    "client_owned_sessions",
    "delete_rlm_subagent",
    "heartbeat_catalog",
    "heartbeat_management",
    "model_catalog",
    "side_question_transcript",
    "transient_bash",
    "session_input_admission",
    "prompt_admission_cancellation",
    "owned_prompt_cancellation",
    "queue_message_mutation",
    "authoritative_child_roster",
    "owned_session_recovery_context",
    "rlm_quiescence_barrier",
    "session_input_pause",
    "acp_mcp_servers",
    "agent_roster",
    "direct_peer_transport"
  ]
}

Root Cause & Impact

  • Pylon's current PrimeAgentDaemonBridge architecture relies on importing dist/index.js via Node ESM to obtain the in-process SDK classes (DaemonClient, DaemonAgentConnection, etc.).
  • When users install stock Prime Agent via the new compiled installer, Pylon cannot attach to or manage the daemon, despite the daemon binary being fully functional on the machine.
  • Conversely, installations via the npm package (prime-agent-0.9.5.tgz) or source checkouts contain dist/index.js and work normally.

Suggested Solutions

  1. Self-contained IPC Client: Pylon can vendor / implement its own minimal Node IPC client for the prime-agent.daemon protocol (protocol 7, JSON newline framing over UNIX socket) so Pylon does not depend on finding dist/index.js inside the external executable's installation directory.
  2. Fallback to Bundled / Fallback SDK: If dist/index.js is not found at the executable's root, fall back to Pylon's internal or bundled @earendil-works/pi-coding-agent SDK for the client classes while spawning the external compiled executable as the daemon process.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions