Preflight
Path:
loom-builder/src/preflight.tsRelative: src/preflight.tsSubproject: loom-builderCategory: dispatch-systemLines: 183Bytes: 6,119Imports: 6Exports: 4
Content Preview
- import { readFileSync } from "node:fs";
- import { globSync } from "glob";
- import { resolve, relative } from "node:path";
- import type { DispatchSpec } from "./types.js";
- import { lintSpec, ensureValidation } from "./spec_lint.js";
- import { preferredPiExecutable, validatePiExecutable } from "./pi-executable.js";
- const TOKENS_PER_BYTE = 1 / 4; // conservative estimate: 1 token ≈ 4 bytes
- const PREFLIGHT_THRESHOLD = 100_000; // refuse dispatch above 100K estimated tokens
- /**
- * Estimate input tokens