codeburn/packages/core/package.json
iamtoruk afaf9ffc8a refactor(core): tail migrations — crush, zcode, zed, forge, goose (phase 8, sqlite batch 1)
Category B (sqlite) variant of the bridge migration: the sqlite driver and every
SQL query stay CLI-side. Each provider's `readRecords` opens the database, runs
the same queries as before, and hands the resulting rows (blob and all) to a
pure core decoder; `toProviderCall` maps the rich, cost-free decode back onto
ParsedProviderCall, where cost re-enters via the parser.ts pricing pass.

Per provider:
- crush: session row + dominant-model query -> one combined record. Crush stores
  cost in dollars, so a row with cost > 0 carries `measuredCostUSD` (costBasis
  'measured'); a zero-cost row falls back to token estimation, arm order intact.
- zcode: model_usage + tool_usage row sets -> one composite record. Each turn's
  tools still attach to the first non-skipped usage row of that turn only.
- zed: threads rows handed over compressed; zstd decompression, JSON parsing and
  per-request/cumulative-remainder accounting are pure. The Node >= 22.15 zstd
  capability check stays host-side.
- forge: conversation row handed over with `context` still serialized; JSON
  parsing and per-message decode are pure. Bash base-name extraction (and its
  strip-ansi dependency) stays CLI-side over the decoder's raw command strings.
- goose: session + assistant tool-message + first-user-message rows, BLOB
  columns pre-converted to text host-side, bundled into one composite record.

Validator fixes (original behavior is the authority):
- forge: the draft replaced the pre-migration `mapToolName` switch with an
  object-literal lookup. Tool names come straight from conversation JSON, so
  names colliding with Object.prototype members ("constructor", "toString",
  "__proto__", "hasOwnProperty") resolved to inherited Functions / the prototype
  object and were pushed into `tools` as non-strings instead of falling through
  to the identity default. Restored the switch and pinned the arm in the fixture.
- zed: the draft routed the "skipped N unreadable Zed threads" notice into
  record diagnostics, which the bridge discards, silently dropping a warning the
  pre-migration decode printed. Re-emitted host-side from the diagnostics count
  and pinned with a stderr assertion.
- Fixture coverage extended for the arms that were regression-blind: forge's
  prototype-named tool calls, zed's aggregate stderr line, and goose's
  single-turn `toolSequence` omission plus the unparseable-timestamp fallback.

Parity was verified independently of the bridge tests with a git-show harness
that runs the same fixtures through the pre-migration provider files and asserts
field-for-field equality, including the extra arms above.
2026-07-26 18:27:44 -07:00

155 lines
4.6 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"
}
},
"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"
}
}