codeburn/packages/core/package.json
iamtoruk 4808b115cc refactor(core): opencode-session shared decode into core — opencode, kilo-code (phase 8, shared batch S2)
Unifies the three-file OpenCode decode family — session-message.ts,
sqlite-session-parser.ts, and opencode-file-parser.ts — into a single core
module, packages/core/src/providers/opencode-session, exposing a two-arm
tagged envelope (kind: 'sqlite' | 'file') over one shared assistant-turn
builder. The SQLite driver, both WITH RECURSIVE session_tree queries,
blobToText, discovery, and extractBashCommands all stay CLI-side.

session-message.ts shrinks to the discovery-side sanitize helper;
sqlite-session-parser.ts and opencode-file-parser.ts keep their SQL and
directory walks and expose readRecords adapters. No decode logic remains
CLI-side in any of the three.

kilo-code is now fully converted: both arms — cline task dirs via the batch-S1
core vscode-cline module and SQLite via the new module — run through core
decodes from one bridged provider, and the thin createClineParser adapter S1
retained is deleted.

The CODEBURN_VERBOSE zero-yield notice is reconstructed host-side by
zed-style decode wrappers, byte-identical for both the OpenCode and KiloCode
labels, with parseFailCount/roleSkipCount derived from the decode's
malformed-json / unknown-shape diagnostics. The session-level SQLite fallback
is pre-fetched onto the envelope instead of queried lazily — output-neutral,
changing only I/O volume — and keeps its distinct key shape, emitting no
skills/subagentTypes keys.

Validator fixes on top of the migration:

- opencode's file arm emitted a spurious SQLite verbose stderr line, reporting
  a previous SQLite source's session id and message count, because the
  readRecords -> decode count handoff was never cleared when switching arms.
  The handoff is now reset on the file path. Pinned by a new regression test.
- The S8 and F9 dedup goldens did not actually pin add-after-build: the SQLite
  fixture used two different message ids, and both file fixtures were degenerate
  (the CLI one wrote the same filename twice and silently overwrote; the core
  one shared a text part across both messages, so the "skipped" message built
  successfully). All four now fail if seenKeys.add is hoisted above the build.
- Added key-presence gates to the goldens, since toEqual accepts a
  present-but-undefined key: the session-level fallback must omit
  skills/subagentTypes, a message-arm call per arm must carry them, and
  fallbackCostUSD must be present for cost 0 and absent for an absent cost.

Goldens were captured pre-migration and re-verified against the original tree
by restoring 38172892's sources in place; all 36 pass on both sides.

Pre-existing issues moved verbatim and left alone: the bare-Record tool map
with a truthy hit check in normalizeToolName (prototype leak on names like
'constructor'), opencode.ts's duplicated display-only tool map, and the dead
inner role guard in the SQLite arm. Every new lookup introduced by the
unification is a Map.
2026-07-26 22:55:34 -07:00

187 lines
5.8 KiB
JSON

{
"name": "@codeburn/core",
"version": "0.9.19",
"description": "Shared, provider-agnostic core for CodeBurn (parsing, pricing, models). Skeleton — populated in later phases of the core extraction.",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./schema": {
"types": "./dist/schema.d.ts",
"import": "./dist/schema.js"
},
"./observations": {
"types": "./dist/observations.d.ts",
"import": "./dist/observations.js"
},
"./diagnostics": {
"types": "./dist/diagnostics.d.ts",
"import": "./dist/diagnostics.js"
},
"./fingerprint": {
"types": "./dist/fingerprint.d.ts",
"import": "./dist/fingerprint.js"
},
"./contracts": {
"types": "./dist/contracts.d.ts",
"import": "./dist/contracts.js"
},
"./detectors": {
"types": "./dist/detectors/index.d.ts",
"import": "./dist/detectors/index.js"
},
"./providers/claude": {
"types": "./dist/providers/claude/index.d.ts",
"import": "./dist/providers/claude/index.js"
},
"./providers/codebuff": {
"types": "./dist/providers/codebuff/index.d.ts",
"import": "./dist/providers/codebuff/index.js"
},
"./providers/codewhale": {
"types": "./dist/providers/codewhale/index.d.ts",
"import": "./dist/providers/codewhale/index.js"
},
"./providers/codex": {
"types": "./dist/providers/codex/index.d.ts",
"import": "./dist/providers/codex/index.js"
},
"./providers/grok": {
"types": "./dist/providers/grok/index.d.ts",
"import": "./dist/providers/grok/index.js"
},
"./providers/kimi": {
"types": "./dist/providers/kimi/index.d.ts",
"import": "./dist/providers/kimi/index.js"
},
"./providers/qwen": {
"types": "./dist/providers/qwen/index.d.ts",
"import": "./dist/providers/qwen/index.js"
},
"./providers/zerostack": {
"types": "./dist/providers/zerostack/index.d.ts",
"import": "./dist/providers/zerostack/index.js"
},
"./providers/droid": {
"types": "./dist/providers/droid/index.d.ts",
"import": "./dist/providers/droid/index.js"
},
"./providers/mux": {
"types": "./dist/providers/mux/index.d.ts",
"import": "./dist/providers/mux/index.js"
},
"./providers/openclaw": {
"types": "./dist/providers/openclaw/index.d.ts",
"import": "./dist/providers/openclaw/index.js"
},
"./providers/open-design": {
"types": "./dist/providers/open-design/index.d.ts",
"import": "./dist/providers/open-design/index.js"
},
"./providers/lingtai-tui": {
"types": "./dist/providers/lingtai-tui/index.d.ts",
"import": "./dist/providers/lingtai-tui/index.js"
},
"./providers/gemini": {
"types": "./dist/providers/gemini/index.d.ts",
"import": "./dist/providers/gemini/index.js"
},
"./providers/kimicode": {
"types": "./dist/providers/kimicode/index.d.ts",
"import": "./dist/providers/kimicode/index.js"
},
"./providers/pi": {
"types": "./dist/providers/pi/index.d.ts",
"import": "./dist/providers/pi/index.js"
},
"./providers/crush": {
"types": "./dist/providers/crush/index.d.ts",
"import": "./dist/providers/crush/index.js"
},
"./providers/zcode": {
"types": "./dist/providers/zcode/index.d.ts",
"import": "./dist/providers/zcode/index.js"
},
"./providers/zed": {
"types": "./dist/providers/zed/index.d.ts",
"import": "./dist/providers/zed/index.js"
},
"./providers/forge": {
"types": "./dist/providers/forge/index.d.ts",
"import": "./dist/providers/forge/index.js"
},
"./providers/goose": {
"types": "./dist/providers/goose/index.d.ts",
"import": "./dist/providers/goose/index.js"
},
"./providers/hermes": {
"types": "./dist/providers/hermes/index.d.ts",
"import": "./dist/providers/hermes/index.js"
},
"./providers/warp": {
"types": "./dist/providers/warp/index.d.ts",
"import": "./dist/providers/warp/index.js"
},
"./providers/cursor-agent": {
"types": "./dist/providers/cursor-agent/index.d.ts",
"import": "./dist/providers/cursor-agent/index.js"
},
"./providers/quickdesk": {
"types": "./dist/providers/quickdesk/index.d.ts",
"import": "./dist/providers/quickdesk/index.js"
},
"./providers/devin": {
"types": "./dist/providers/devin/index.d.ts",
"import": "./dist/providers/devin/index.js"
},
"./providers/copilot": {
"types": "./dist/providers/copilot/index.d.ts",
"import": "./dist/providers/copilot/index.js"
},
"./providers/vscode-cline": {
"types": "./dist/providers/vscode-cline/index.d.ts",
"import": "./dist/providers/vscode-cline/index.js"
},
"./providers/opencode-session": {
"types": "./dist/providers/opencode-session/index.d.ts",
"import": "./dist/providers/opencode-session/index.js"
}
},
"files": [
"dist",
"schemas"
],
"scripts": {
"build": "tsup",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"emit-schemas": "tsx scripts/emit-schemas.mts"
},
"engines": {
"node": ">=22.13.0"
},
"dependencies": {
"zod": "^3.25.76"
},
"devDependencies": {
"@types/node": "^22.0.0",
"ajv": "^8.17.1",
"tsup": "^8.0.0",
"tsx": "^4.19.0",
"typescript": "^5.5.0",
"vitest": "^3.1.0",
"zod-to-json-schema": "^3.24.1"
},
"author": "AgentSeal <hello@agentseal.org>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/getagentseal/codeburn.git",
"directory": "packages/core"
}
}