Skip to content

Expose the backend-neutral AcpTrace consumer API to poe-code SDK users #391

Description

@kamilio

Summary

The Braintrust simplification correctly moved spawn trace construction into the pure, backend-neutral acpToTrace(ctx) -> AcpTrace path in @poe-code/acp-telemetry. Braintrust and OTEL are now optional emitters over the same trace value.

External poe-code SDK consumers cannot currently use that intended neutral path from the published package:

  • @poe-code/acp-telemetry is marked private: true and is not published.
  • poe-code does not re-export acpToTrace, AcpTrace, or a ready-made trace consumer middleware.
  • SpawnOptions.middlewares is public, but its AcpMiddleware type comes from the non-published @poe-code/agent-spawn package.

Use case

Persist every completed Poe Code ACP trace directly in a consumer-owned database without routing through Braintrust or re-emitting it as OTEL.

The desired consumer code is conceptually:

const middleware = async (ctx, next) => {
  await next();
  await database.insert(acpToTrace(ctx));
};

await spawn("codex", { prompt, middlewares: [middleware] });

This is exactly the architecture enabled by the Braintrust refactor, but the converter/type API is not reachable from a normal npm installation.

Expected capability

Expose a supported backend-neutral trace consumer API from published poe-code. Any of these would solve it:

  1. Re-export acpToTrace, AcpTrace, AcpTraceSpan, and the required middleware/context types from poe-code.
  2. Publish @poe-code/acp-telemetry and the necessary public middleware types.
  3. Add a traceSink/onTrace spawn option that receives each completed AcpTrace value.

A traceSink option would be the simplest consumer API and would avoid requiring users to reproduce event-stream-finalization middleware behavior.

Acceptance criteria

  • A normal npm poe-code SDK consumer can receive each completed backend-neutral AcpTrace value.
  • No Braintrust or OpenTelemetry dependency/configuration is required.
  • Streaming and non-streaming ACP spawn paths emit exactly once after trace data is complete.
  • Aborted/failed runs have documented behavior.
  • SDK types are exported from published packages without unresolved private workspace-package imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions