Skip to content

Port delivery engine to session.synthetic + context hook #72

Description

@frap129

Question

Port the delivery engine (src/delivery/) from v1's synthetic-part injection via the chat.message hook to v2's primitives:

  • Durable delivery (session-durable rules): v1 appended a synthetic text part to the user message via chat.message; v2 uses ctx.session.synthetic({ sessionID, text, metadata?, delivery?: "steer"|"queue" }). Verify: does steer/queue delivery timing match v1's "append to current user message before dispatch" semantics? If not, choose the closest and document the divergence.
  • Transient delivery (ephemeral rules: agent/model/branch/tools): v1 used experimental.chat.messages.transform (one transient message per matching turn); v2 equivalent is the ctx.session.hook("context", ...). It runs per model dispatch (incl. tool continuations and compaction) and is never persisted — verify our "one transient message per matching turn" logic works against a per-dispatch-not-per-turn hook (may inject on tool continuations too; decide accept/adjust).
  • Awaited no-reply admission (durable rule first matched by live File observation): v1 session.prompt with noReply → v2 ctx.session.prompt(..., { resume: false }). Keep transient fallback + retry-when-persistence-fails semantics.
  • Preserve the existing codec/history-port (src/delivery/codec.ts, history port) or replace them if v2's session.context() read makes them obsolete.

Activity

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

Metadata

Metadata

Assignees

Labels

v2Part of the opencode v2 migration effortwayfinder:taskWork required to unblock a wayfinding decision

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions