You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the next internal layer after #4: a bounded asynchronous Prime SDK session host that can create, attach, observe, and authoritatively dispose one client-owned native Prime session. This is a host-only contract slice. It does not register a Comet harness or expose a user-visible provider.
Production session-host work is blocked on the reviewed public proof/options contract produced by Prime zeronsh#13, which must let Comet enforce a finite inbound byte limit before DaemonClient connects. The exact export and constructor contract must be cross-reviewed on zeronsh#13; do not pre-decide it here. Never infer safety from package version, branch, constructor arity, method presence, daemon schema, or server capability. Stock 0.8.1 must fail locally before session creation because its public client attaches the JSONL reader without a limit.
Prime zeronsh#8, zeronsh#11, and zeronsh#13 are all prerequisites to the production merge and real smoke. The reproducibly identified fork artifact must contain one reviewed Prime tracker head with the accepted outcomes from all three; this issue does not prescribe their internal merge order. Deterministic fake-SDK infrastructure may be developed earlier, but it cannot be presented or merged as a production session path.
This slice still keeps reconnect/recovery disabled. zeronsh#11 is required here because even the initial attach consumes snapshot transfer and this issue claims authoritative worker/descriptor settlement; reconnect and saved-session recovery remain separate later work.
Contract
Continue loading only the already validated public root ESM export.
Construct the client with a reviewed finite inbound byte limit before connecting, and verify support through that explicit public contract rather than an ignored extra JavaScript argument.
Use one long-lived asynchronous Node host with correlation IDs that separately demultiplexes command responses and unsolicited session events. Never reuse the foundation bridge's request/next-line bootstrap shape.
Create a client_owned session with a bounded, allowlisted runtime config rooted in the local working directory and private Prime session tree.
Validate the create result before attach. Use ownedSession: true, disable reconnect for this slice, and set supportsExtensionUi: false until Comet implements that request/response surface.
Let the public DaemonAgentConnection advertise its documented attach-side capabilities. A daemon hello offer alone never proves the negotiated intersection.
Keep correlated prompt lifecycle inactive and unexposed in Comet even if the fork SDK internally auto-advertises it after seeing a server offer. supportsCorrelatedPromptLifecycle() is server-offer evidence only. A later prompt issue needs an approved public negotiated-capability proof before it can use the extension.
Obtain and validate the initial snapshot/cursor without publishing raw Prime payloads.
Expose only a non-serializable internal PrimeSessionLease and bounded normalized host events. activeSessionId, native sessionId, sessionFile, socket paths, package paths, environment values, and raw payloads must remain inside crates/harness/src/prime/**.
Never place a native Prime identifier in RunRequest.resume, AgentEvent::*::session_id, a Comet document, RPC, log, or error. Durable resume needs a later opaque Comet-handle-to-local-Prime mapping design.
Lifecycle and process ownership
Bound every host command, frame, pending-request count, event queue, startup, attach, snapshot, disposal, and child-process wait.
Isolate the SDK host with an explicit environment, finite V8 heap, owned process group, cancellation handoff, and privacy-safe typed errors.
If creation succeeds but attach or caller cancellation fails, issue bounded complete_owned_session cleanup.
Normal close must obtain a validated successful owning-client complete_owned_session response before DaemonAgentConnection.dispose(), then close the client and reap the SDK host. dispose() alone is not proof because it swallows completion errors. A successful supervisor response is meaningful only because it awaits worker stop, removes the worker, and deletes its descriptor.
Dropping or cancelling a Rust future must transfer both the SDK-host process and any created native-session cleanup obligation to a bounded reaper. Killing only the Node host is not proof that a detached Prime worker stopped.
On SDK-host crash, a different bootstrap client cannot complete the session because the supervisor enforces ownerClientId. The reaper must wait for the daemon's client-disconnect cleanup and prove the worker/descriptor is absent. If it cannot prove absence, poison and shut down this private daemon and return cleanup-uncertain; never report clean disposal.
Do not shut down the daemon while a session lease is live except for that fail-closed poisoned-owner recovery. Reconcile worker/descriptor state before reporting clean disposal.
Tests
Use deterministic local fake public-SDK/daemon fixtures with no model, credential, network, or active Prime checkout dependency. Cover:
response/event interleaving, reverse-order concurrent responses, and event-before-response;
duplicate, unknown, and stale response IDs; EOF/overflow rejecting all waiters; close/cancel overtaking an in-flight operation rather than waiting behind a global promise queue;
reviewed bounded-ingress proof/options contract required before create;
constructor byte limit forwarded to the SDK;
stock server offers versus attach-side client capability advertisement;
create/attach/initial snapshot success;
unknown events and capabilities degrading locally without raw forwarding;
oversized/no-newline control frames and bounded event queues;
timeout and cancellation at connect, create, attach, snapshot, and dispose;
attach failure after create invokes owning-client complete_owned_session and validates the response;
host crash waits for client-disconnect cleanup and proves worker/descriptor absence; unverifiable cleanup poisons/shuts down the daemon and returns cleanup-uncertain;
graceful and forced SDK-host descendant cleanup;
native identifiers and raw payloads absent from surfaced events/errors;
authoritative owned-worker/descriptor settlement before success;
No branch or worktree is claimed yet. After the dependency gate is satisfied, use a fresh Comet worktree from origin/main and declare the exact branch, files, tests, dependencies, and merge order here before editing.
Expected area: crates/harness/src/prime/session/**, a dedicated session-host shim, focused changes to the existing Prime foundation seams, and focused tests only.
Outcome
Add the next internal layer after #4: a bounded asynchronous Prime SDK session host that can create, attach, observe, and authoritatively dispose one client-owned native Prime session. This is a host-only contract slice. It does not register a Comet harness or expose a user-visible provider.
Parent umbrella: #1
Merged daemon foundation: #3 / #4
Prime SDK ingress dependency: pylon-code/prime-agent#13
Prime reviewed-upstream gate: pylon-code/prime-agent#8
Prime snapshot/worker-integrity gate: pylon-code/prime-agent#11
Pylon consumer: pylon-code/pylon#114
Dependency gate
Production session-host work is blocked on the reviewed public proof/options contract produced by Prime zeronsh#13, which must let Comet enforce a finite inbound byte limit before
DaemonClientconnects. The exact export and constructor contract must be cross-reviewed on zeronsh#13; do not pre-decide it here. Never infer safety from package version, branch, constructor arity, method presence, daemon schema, or server capability. Stock 0.8.1 must fail locally before session creation because its public client attaches the JSONL reader without a limit.Prime zeronsh#8, zeronsh#11, and zeronsh#13 are all prerequisites to the production merge and real smoke. The reproducibly identified fork artifact must contain one reviewed Prime tracker head with the accepted outcomes from all three; this issue does not prescribe their internal merge order. Deterministic fake-SDK infrastructure may be developed earlier, but it cannot be presented or merged as a production session path.
This slice still keeps reconnect/recovery disabled. zeronsh#11 is required here because even the initial attach consumes snapshot transfer and this issue claims authoritative worker/descriptor settlement; reconnect and saved-session recovery remain separate later work.
Contract
DaemonClient,DaemonAgentConnection.attach, and the reviewed public bounded-ingress proof/options contract from Prime Interest in adding Grok Build support? zeronsh/comet#13.client_ownedsession with a bounded, allowlisted runtime config rooted in the local working directory and private Prime session tree.ownedSession: true, disable reconnect for this slice, and setsupportsExtensionUi: falseuntil Comet implements that request/response surface.DaemonAgentConnectionadvertise its documented attach-side capabilities. A daemon hello offer alone never proves the negotiated intersection.supportsCorrelatedPromptLifecycle()is server-offer evidence only. A later prompt issue needs an approved public negotiated-capability proof before it can use the extension.PrimeSessionLeaseand bounded normalized host events.activeSessionId, nativesessionId,sessionFile, socket paths, package paths, environment values, and raw payloads must remain insidecrates/harness/src/prime/**.RunRequest.resume,AgentEvent::*::session_id, a Comet document, RPC, log, or error. Durable resume needs a later opaque Comet-handle-to-local-Prime mapping design.Lifecycle and process ownership
complete_owned_sessioncleanup.complete_owned_sessionresponse beforeDaemonAgentConnection.dispose(), then close the client and reap the SDK host.dispose()alone is not proof because it swallows completion errors. A successful supervisor response is meaningful only because it awaits worker stop, removes the worker, and deletes its descriptor.ownerClientId. The reaper must wait for the daemon's client-disconnect cleanup and prove the worker/descriptor is absent. If it cannot prove absence, poison and shut down this private daemon and returncleanup-uncertain; never report clean disposal.Tests
Use deterministic local fake public-SDK/daemon fixtures with no model, credential, network, or active Prime checkout dependency. Cover:
complete_owned_sessionand validates the response;cleanup-uncertain;Initial ownership
No branch or worktree is claimed yet. After the dependency gate is satisfied, use a fresh Comet worktree from
origin/mainand declare the exact branch, files, tests, dependencies, and merge order here before editing.Expected area:
crates/harness/src/prime/session/**, a dedicated session-host shim, focused changes to the existing Prime foundation seams, and focused tests only.Non-goals
HarnessId::PrimeAgent, registry/settings/model/UI integrationMerge order
HarnessId::PrimeAgentregistration.Acceptance