{"modulePath":"github.com/entireio/cli","version":"v0.13.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package opencodev2\n\nPackage opencodev2 converts an OpenCode 2 session export to the OpenCode 1 shape every reader of OpenCode sessions takes: the transcript library's Convert and OpenCode adapter, and the CLI's OpenCode agent. It imports only the standard library (the library's dependency guard).\n\n## Constants\n\n```go\nconst NativeKey = \"opencode2\"\n```\nNativeKey is the message info key that keeps the OpenCode 2 messages a converted message came from, verbatim. Every reader ignores it; the CLI's OpenCode resume uses it to give OpenCode 2 back the exact session it exported, which the 1.x shape alone cannot reproduce.\n\n## Functions\n\n```go\nfunc IsExport(data []byte) bool\n```\nIsExport reports whether data is an OpenCode 2 export: its messages carry a top-level \"type\" rather than an \"info\" object. An export is written by one OpenCode version, so the first message decides; it is read with a streaming decoder, so a 1.x export (every stored transcript) costs one message's decode, not the whole file's. An export with no messages is the same in both versions.\n\n```go\nfunc Normalize(data []byte) ([]byte, error)\n```\nNormalize converts an OpenCode 2 export to the OpenCode 1 shape and returns other payloads unchanged. The conversion is deterministic, so re-exporting the same session yields the same message indices; transcript offsets stored between turns depend on that.\n\nEach converted message carries its source messages under info\\[NativeKey]: the 2.x message itself, plus any that convert to nothing (idle markers, kinds this version does not know) after it. Both messages of a converted compaction carry the key, the summary with none.\n\n","path":"github.com/entireio/cli/internal/transcript/opencodev2","name":"opencodev2","synopsis":"Package opencodev2 converts an OpenCode 2 session export to the OpenCode 1 shape every reader of OpenCode sessions takes: the transcript library's Convert and OpenCode adapter, and the CLI's OpenCode agent.","isRedistributable":true}
