feat(plugin-sdk): export transcript.runtime subpath#80208
Conversation
Adds a new `openclaw/plugin-sdk/transcript.runtime` public subpath re-exporting `appendAssistantMessageToSessionTranscript` and `appendExactAssistantMessageToSessionTranscript` from the existing internal `src/config/sessions/transcript.runtime.ts` module. Channel plugins that need to record outbound assistant messages directly into a session transcript (e.g. agent-link, where the sender's outbound is initiated from a session distinct from the one the reply will be delivered to) currently have no public way to do so. Existing `recordInboundSession` only covers user turns. The new entry follows the existing plugin-sdk subpath conventions: listed in scripts/lib/plugin-sdk-entrypoints.json and synced into package.json exports via scripts/sync-plugin-sdk-exports.mjs.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: merged #95030 supersedes this narrower raw helper export with the documented Canonical path: Keep the merged So I’m closing this here and keeping the remaining discussion on #95030. Review detailsBest possible solution: Keep the merged Do we have a high-confidence way to reproduce the issue? Not applicable. This is a public SDK surface PR rather than a bug report; source inspection and the merged replacement PR establish the current behavior. Is this the best way to solve the issue? No, this PR is no longer the best path. Current main uses a documented Security review: Security review needs attention: The diff has no supply-chain change, but the proposed raw public transcript writer subpath would expand durable plugin write authority after a structured replacement exists.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against ad304e790d0c; fix evidence: commit 7a0d36f3d0e1, main fix timestamp 2026-06-20T21:01:07Z. |
|
The five red checks ( Concretely, each of the three underlying failures reproduces on
None of these touch the files this PR modifies ( The relevant gates for this change are green:
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
recordInboundSessioncovers user turns only;appendAssistantMessageToSessionTranscriptalready exists in the source tree but is not exported viapackage.json.openclaw/plugin-sdk/transcript.runtime— one new re-export file, one entry inscripts/lib/plugin-sdk-entrypoints.json, four lines inpackage.jsonexportsauto-generated byscripts/sync-plugin-sdk-exports.mjs.Change Type
Scope
Linked Issue/PR
N/A — small DX gap discovered while building a third-party
agent-linkchannel plugin that needs to persist a sender's outbound assistant turn into its own session transcript when the send is issued from a different session than where the peer's reply will land.Real behavior proof (required for external PRs)
Behavior or issue addressed:
await import("openclaw/plugin-sdk/transcript.runtime")cannot resolve in published builds because the subpath is missing frompackage.jsonexports, even thoughappendAssistantMessageToSessionTranscriptexists in the source tree atsrc/config/sessions/transcript.runtime.ts.Real environment tested: Linux x86_64, Node v25, pnpm 10.33.2. Local clone of this branch. No mocks — the proof is a real
node --import tsxinvocation against the actual source file the new subpath re-exports, plus an inspection of the generated.d.tsartifact.Exact steps or command run after this patch:
Evidence after fix (terminal output, copied live):
Same
node --import tsxinvocation against the linuxbrew-installed[email protected](without this patch) fails withERR_MODULE_NOT_FOUNDfor theopenclaw/plugin-sdk/transcript.runtimespecifier, confirming the gap this PR closes.Observed result after fix: The new subpath resolves through Node's source-level resolver. The strict-smoke build emits
dist/plugin-sdk/transcript.runtime.d.tswhose body matches theexport * from "./src/..."shape used by existing public entries (e.g.session-store-runtime.d.ts). BothappendAssistantMessageToSessionTranscriptandappendExactAssistantMessageToSessionTranscriptare reachable as functions through the new public surface.What was not tested: The full
pnpm build(tsdown), fullpnpm check, and fullpnpm testlanes were not exercised in my local environment because tsdown is killed by SIGKILL on this 3.8 GB host after several minutes of progress-less heap growth. Repo CI is the source of truth for those lanes. The mechanical change is isomorphic to existing entries, so a mismatch would surface inscripts/check-plugin-sdk-subpath-exports.mjs,pnpm plugin-sdk:check-exports, or the strict-smoke lane — all three are green locally.Before evidence (optional but encouraged): Same
node --import tsxinvocation pointing the specifier at the linuxbrew-installed[email protected]returns:Root Cause (if applicable)
N/A — this is an exposure gap, not a regression. The helpers existed; the export entry was missing.
Regression Test Plan (if applicable)
scripts/check-plugin-sdk-subpath-exports.mjs,scripts/sync-plugin-sdk-exports.mjs --check,pnpm build:plugin-sdk:strict-smoke.openclaw/plugin-sdk/<subpath>referenced in source is listed inplugin-sdk-entrypoints.jsonandpackage.jsonexports.User-visible / Behavior Changes
None. New public subpath; existing imports unchanged.
Diagram (if applicable)
N/A.
Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
agent-linkpluginSteps
pnpm install --frozen-lockfilepnpm build:plugin-sdk:strict-smokenode --import tsx --eval "import('./src/plugin-sdk/transcript.runtime.ts').then(m => console.log(Object.keys(m).sort()))"Expected
[ 'appendAssistantMessageToSessionTranscript', 'appendExactAssistantMessageToSessionTranscript' ]Actual
Matches expected; see evidence block above.
Evidence
Human Verification (required)
.d.ts; mechanical isomorphism with existing entries (the subpath-exports check, the sync check, and the strict-smoke build all green); negative case against the published linuxbrew install reproducesERR_MODULE_NOT_FOUND.pnpm plugin-sdk:check-exportsconfirmspackage.jsonexports are in sync with the entrypoint list;pnpm lint:extensions:no-plugin-sdk-wildcard-reexportsconfirms the new file uses named exports, not wildcards; boundary report (scripts/check-sdk-package-extension-import-boundary.mjs --json) returns[].pnpm check, fullpnpm testlanes (local RAM constraint). Repo CI is authoritative there.Review Conversations
Compatibility / Migration
Yes(additive)NoNoRisks and Mitigations
AI-assisted
This PR was prepared with Claude Code (claude-opus-4.7) assistance. Reviewed and authored by @clriesco.