chore: migrate from bun to pnpm + vitest + esbuild
- Replace bun:test with vitest across all packages - Replace bun build with esbuild - Replace bun:sqlite with better-sqlite3 - Fix OCAS Store API: store.put/get → store.cas.put/get - Fix vitest vi.mock hoisting (vi.hoisted) - Add pnpm-workspace.yaml and pnpm-lock.yaml - Update all package.json test/build scripts WIP: 8 failures remain in agent-hermes (bun engines check + sqlite migration) Refs #26
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import type { ThreadId } from "@united-workforce/protocol";
|
||||
import type { AgentContext } from "@united-workforce/util-agent";
|
||||
import { buildClaudeCodePrompt } from "../src/claude-code.js";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { createMemoryStore, walk } from "@ocas/core";
|
||||
import {
|
||||
parseClaudeCodeJsonOutput,
|
||||
@@ -278,7 +278,7 @@ describe("storeClaudeCodeDetail", () => {
|
||||
expect(output).toBe("The answer");
|
||||
expect(sessionId).toBe("abc-123");
|
||||
|
||||
const node = await store.get(detailHash);
|
||||
const node = await store.cas.get(detailHash);
|
||||
expect(node).not.toBeNull();
|
||||
expect(node!.payload.model).toBe("claude-sonnet-4.5");
|
||||
expect(node!.payload.stopReason).toBe("end_turn");
|
||||
@@ -286,7 +286,7 @@ describe("storeClaudeCodeDetail", () => {
|
||||
expect(node!.payload.turns).toHaveLength(2);
|
||||
|
||||
// Verify turn CAS nodes
|
||||
const turn0 = await store.get(node!.payload.turns[0]);
|
||||
const turn0 = await store.cas.get(node!.payload.turns[0]);
|
||||
expect(turn0).not.toBeNull();
|
||||
expect(turn0!.payload.role).toBe("assistant");
|
||||
expect(turn0!.payload.content).toBe("hello");
|
||||
@@ -466,7 +466,7 @@ describe("storeClaudeCodeDetail — incomplete results", () => {
|
||||
expect(output).toBe("Partial output");
|
||||
expect(sessionId).toBe("sess-incomplete");
|
||||
|
||||
const node = await store.get(detailHash);
|
||||
const node = await store.cas.get(detailHash);
|
||||
expect(node).not.toBeNull();
|
||||
expect(node!.payload.subtype).toBe("incomplete");
|
||||
expect(node!.payload.stopReason).toBe("incomplete_no_result_line");
|
||||
@@ -480,7 +480,7 @@ describe("storeClaudeCodeRawOutput", () => {
|
||||
const rawText = "Claude produced plain text without JSON";
|
||||
const hash = await storeClaudeCodeRawOutput(store, rawText);
|
||||
expect(hash).toHaveLength(13);
|
||||
const node = await store.get(hash);
|
||||
const node = await store.cas.get(hash);
|
||||
expect(node).not.toBeNull();
|
||||
expect(node!.payload.text).toBe(rawText);
|
||||
});
|
||||
|
||||
@@ -12,20 +12,19 @@
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"bun": "./src/index.ts",
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "echo 'Use bun run release from repo root' && exit 1",
|
||||
"test": "bun test __tests__/",
|
||||
"test:ci": "bun test __tests__/"
|
||||
"prepublishOnly": "echo 'Use pnpm run release from repo root' && exit 1",
|
||||
"test": "vitest run __tests__/",
|
||||
"test:ci": "vitest run __tests__/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ocas/core": "^0.1.1",
|
||||
"@united-workforce/util-agent": "workspace:^",
|
||||
"@united-workforce/util": "workspace:^"
|
||||
"@ocas/core": "^0.2.2",
|
||||
"@united-workforce/util": "workspace:^",
|
||||
"@united-workforce/util-agent": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.8.3"
|
||||
|
||||
@@ -290,7 +290,7 @@ export async function storeClaudeCodeDetail(
|
||||
// Store each turn as an individual CAS node
|
||||
const turnHashes: string[] = [];
|
||||
for (const turn of parsed.turns) {
|
||||
const hash = await store.put(schemas.turn, turn);
|
||||
const hash = await store.cas.put(schemas.turn, turn);
|
||||
turnHashes.push(hash);
|
||||
}
|
||||
|
||||
@@ -306,12 +306,12 @@ export async function storeClaudeCodeDetail(
|
||||
turns: turnHashes,
|
||||
};
|
||||
|
||||
const detailHash = await store.put(schemas.detail, detail);
|
||||
const detailHash = await store.cas.put(schemas.detail, detail);
|
||||
return { detailHash, output: parsed.result, sessionId: parsed.sessionId };
|
||||
}
|
||||
|
||||
/** Fallback: store raw text output when JSON parsing fails. */
|
||||
export async function storeClaudeCodeRawOutput(store: Store, rawOutput: string): Promise<string> {
|
||||
const schemas = await registerSchemas(store);
|
||||
return store.put(schemas.rawOutput, { text: rawOutput });
|
||||
return store.cas.put(schemas.rawOutput, { text: rawOutput });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user