- vendor/t3code submodule pinned to 42c9107983; deps in package.json aligned with the upstream catalog, including upstream's effect@4.1.5 patch via patchedDependencies (patches/effect@4.1.5.patch) - nix flake.nix devShell provides bun locally (no guix home install) - scripts/link-vendor.ts now copies the vendored packages into node_modules/@t3tools and applies tscPatches for the spots where classic tsc can't infer what upstream's Effect language service can, so `bun run typecheck` runs clean under full strict mode - protocol drift fixes across model/ui/client: usage-limit copy, context window snapshot, checkpoint totals, turn diff summaries, alert observation, "once" schedules, composer trigger kinds, PR keying, thread menu state, secret request answers, terminal summaries, snapshot-required shell events, revert checkpoint lookup - new parity features over the typed RPC: fork a turn into a new thread, rewind a message with its attachments restored to the composer, guest share links and turn-into-project in the thread menu - tests updated and added (301 pass); typecheck, lint and build clean Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
57 lines
2.6 KiB
TypeScript
57 lines
2.6 KiB
TypeScript
// Exposes the pinned T3 Code workspace packages under node_modules/@t3tools so
|
|
// their package export maps resolve. They are TypeScript sources Bun runs as-is.
|
|
// The packages are copied (not symlinked) so the small set of classic-tsc
|
|
// false positives below can be patched in the copy; vendor/ itself stays pristine.
|
|
import { cp, lstat, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
const root = join(import.meta.dir, "..");
|
|
const packagesDir = join(root, "vendor/t3code/packages");
|
|
const scopeDir = join(root, "node_modules/@t3tools");
|
|
await mkdir(scopeDir, { recursive: true });
|
|
for (const name of await readdir(packagesDir)) {
|
|
const dest = join(scopeDir, name);
|
|
await lstat(dest).then(() => rm(dest, { recursive: true, force: true }), () => {});
|
|
await cp(join(packagesDir, name), dest, { recursive: true });
|
|
}
|
|
|
|
// Upstream type-checks these sources with effect-tsgo plus the Effect language
|
|
// service, which infers callback parameter types classic tsc cannot. Patch the
|
|
// copies so `bun run typecheck` (classic tsc) stays clean. Each entry is applied
|
|
// only if the original text is still present; if an upstream bump changes the
|
|
// code, re-run typecheck and update the list.
|
|
const tscPatches: ReadonlyArray<{ file: string; from: string; to: string }> = [
|
|
{
|
|
file: "client-runtime/src/rpc/session.ts",
|
|
from: "send: (clientId, request, transferables) =>",
|
|
to: "send: (clientId: any, request: any, transferables: any) =>",
|
|
},
|
|
];
|
|
for (const { file, from, to } of tscPatches) {
|
|
const path = join(scopeDir, file);
|
|
const source = await readFile(path, "utf8");
|
|
if (source.includes(from)) await writeFile(path, source.replace(from, to));
|
|
}
|
|
|
|
// Upstream resolves "@pierre/words/core" and "@pierre/words/wasm" through its web app's
|
|
// tsconfig paths (apps/web/tsconfig.json), not through the package's exports map. Bun does
|
|
// not apply those paths to files under vendor/, so add the two subpaths to the installed
|
|
// package's exports here. The files ship in the tgz (dist/core.js, dist/words.wasm.mjs).
|
|
const wordsManifest = join(root, "node_modules/@pierre/words/package.json");
|
|
try {
|
|
const manifest = JSON.parse(await readFile(wordsManifest, "utf8")) as {
|
|
exports?: Record<string, unknown>;
|
|
};
|
|
if (manifest.exports && !("./core" in manifest.exports)) {
|
|
manifest.exports["./core"] = {
|
|
types: "./dist/core.d.ts",
|
|
import: "./dist/core.js",
|
|
default: "./dist/core.js",
|
|
};
|
|
manifest.exports["./wasm"] = "./dist/words.wasm.mjs";
|
|
await writeFile(wordsManifest, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
}
|
|
} catch {
|
|
// @pierre/words not installed yet; nothing to patch.
|
|
}
|