text stringlengths 3 8.33k | repo stringclasses 52
values | path stringlengths 6 141 | language stringclasses 35
values | sha stringlengths 64 64 | chunk_index int32 0 273 | n_tokens int32 1 896 |
|---|---|---|---|---|---|---|
import { closeSync, mkdirSync, openSync } from 'node:fs';
import path from 'node:path';
import { resolveContainedPath } from '../core/contained-path';
import { inspectStateRoot } from '../core/state-ownership';
import { type ConfigDependencies, loadRuntimeConfig } from '../lib/config';
import {
type CatalogDatabase,
... | codex-hackathon | src/catalog/connection.ts | TypeScript | a7bce174dc5a401797dab2eb2bc8c447d27928a7ee992f97c58c2e015afcf91b | 0 | 896 |
{
if (this.#closed) return;
this.#closed = true;
this.#database.close();
}
pragmas(): CatalogPragmas {
if (this.#closed) throw new Error('Catalog connection is closed.');
return inspectPragmas(this.#database);
}
schemaVersion(): number {
if (this.#closed) throw new Error('Catalog connection is closed.... | codex-hackathon | src/catalog/connection.ts | TypeScript | f1c052c7ec24c9e72afa35fdde655fec2771c520f89b64234b8bedde8bdf49ff | 1 | 642 |
import { spawnSync } from 'node:child_process';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import type { CatalogDatabase } from './migration-... | codex-hackathon | src/catalog/migration-runner.test.ts | TypeScript | 476c92aa5bc9820c5fbc473a50a3015724a2e1e544e0b98dd7c5e7eb4179d442 | 0 | 896 |
.close();
const future = await database();
runCatalogMigrations(future);
future
.query('INSERT INTO schema_migrations (migration_number, name, checksum) VALUES (?, ?, ?)')
.run(4, '0004-future.sql', '1'.repeat(64));
expect(() => runCatalogMigrations(future)).toThrow('newer');
future.close();
});
});
| codex-hackathon | src/catalog/migration-runner.test.ts | TypeScript | ede3d5651de022b0e780724e6b96fc192570af7d1cb2f1ea15fac45254c12824 | 1 | 97 |
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
export interface CatalogStatement<Row, Parameters extends readonly unknown[]> {
get(...parameters: Parameters): Row | null;
run(...parameters: Parameters): unknown;
all(...parameters: Parameters): Row[];
}
export interface CatalogDat... | codex-hackathon | src/catalog/migration-runner.ts | TypeScript | 542b1b075e6afbe91c6e8a1e452a9f8e3d71cffb1b5d55903d52b988f827fcdc | 0 | 896 |
ledger is invalid: ${error instanceof Error ? error.message : String(error)}`,
);
}
}
function verifyLedger(
recorded: readonly RecordedMigration[],
manifest: readonly LoadedMigration[],
): void {
for (let index = 0; index < recorded.length; index += 1) {
const expectedNumber = index + 1;
const row = recorde... | codex-hackathon | src/catalog/migration-runner.ts | TypeScript | 878456f55752d29d292d5e5ad4961612c49318e48e61020397bae51d99d0e995 | 1 | 532 |
import { describe, expect, it } from 'vitest';
import {
COMMAND_TREE,
type CommandLeaf,
CommandTreeInvariantError,
type OwnerPhase,
parseCommand,
projectHelp,
validateCommandTree,
} from './command-tree';
interface ExpectedCommand {
readonly path: string;
readonly ownerPhase: OwnerPhase;
readonly args?: read... | codex-hackathon | src/cli/command-tree.test.ts | TypeScript | 6c198f2393bbeb4265a18dc07161b99097440d7df47cfb815148d511db29697b | 0 | 896 |
.toBe(entry.ownerPhase);
});
it('records every parse-only flag and allowed value in the catalog', () => {
const shapes = Object.fromEntries(
COMMAND_TREE.filter((command) => command.options.length > 0).map((command) => [
command.path.join(' '),
command.options.map((option) => ({
name: option.name,
... | codex-hackathon | src/cli/command-tree.test.ts | TypeScript | e7192654252acbe8275db829a728a9dbfcfed1355e5efe2276d908589f484225 | 1 | 896 |
']).rows.map((row) => row.command)).toEqual([
'dataset build',
'dataset validate',
'dataset inspect',
'dataset push',
]);
});
it.each([
[[], 'help'],
[['--json'], 'help'],
[['repos', 'set', 'demo'], 'INVALID_ARGUMENT'],
[['repos', 'set', '--mode', 'included'], 'INVALID_ARGUMENT'],
[['dataset'... | codex-hackathon | src/cli/command-tree.test.ts | TypeScript | 85fa15ae4e51c3f67e2c65a56687d968937d76e103c9c71a285e859af9fa93cc | 2 | 643 |
export type OwnerPhase = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
export type CommandAvailability = 'implemented' | 'unavailable';
export interface CommandArgumentSpec {
readonly name: string;
readonly required: boolean;
}
export interface CommandOptionSpec {
readonly name: `--${string}`;
readonly kind: 'flag' | 'value';
... | codex-hackathon | src/cli/command-tree.ts | TypeScript | 8021de68780577d18aec939090c0d936bf17767196f68a761e4dbb5509a43e34 | 0 | 896 |
3),
command(['metrics', 'show'], 'Show engineering metrics', 3),
command(['evidence', 'build'], 'Build provenance-rich accepted-state evidence', 4),
command(['preferences', 'build'], 'Build the hierarchical preference profile', 4),
command(['dataset', 'build'], 'Build a versioned Hugging Face-native dataset', 5, {
... | codex-hackathon | src/cli/command-tree.ts | TypeScript | 31ba007d2ce0fdc8d33b47f1b7c5369ce92046fc726f1666c764e01bb36fcb16 | 1 | 896 |
-z0-9-]*$/.test(part))) {
throw new CommandTreeInvariantError(
'Every command leaf and alias must have a valid literal path.',
);
}
const key = path.join(' ');
const existing = paths.get(key);
if (existing) {
throw new CommandTreeInvariantError(
`Duplicate command or alias path: ${key} (${exist... | codex-hackathon | src/cli/command-tree.ts | TypeScript | 3e2d924a17cc66b20b42bb6991296575ce3653b486cd7e0d4c06e6d5a097a688 | 2 | 896 |
;
}
for (const argument of leaf.arguments) Object.freeze(argument);
Object.freeze(leaf.path);
if (leaf.aliases) Object.freeze(leaf.aliases);
Object.freeze(leaf.arguments);
Object.freeze(leaf.options);
Object.freeze(leaf);
}
return Object.freeze(tree);
}
export const COMMAND_TREE: readonly CommandLeaf[]... | codex-hackathon | src/cli/command-tree.ts | TypeScript | b149e097f22c04fe5ad644fbee16c1040acfbf5a54cafd512527334e9584cd93 | 3 | 896 |
[index] ?? '';
if (!token.startsWith('--')) {
positional.push(token);
continue;
}
const equalsIndex = token.indexOf('=');
const name = (equalsIndex === -1 ? token : token.slice(0, equalsIndex)) as `--${string}`;
const specification = leaf.options.find((option) => option.name === name);
if (!specificat... | codex-hackathon | src/cli/command-tree.ts | TypeScript | 1a0e97a1724d836092cbd3066c3d7278326eccf699c16d91584bcd770f6f107a | 4 | 896 |
=== '--help' || argument === '-h') help = true;
else tokens.push(argument);
}
if (tokens.length === 0) return { kind: 'help', json, path: [] };
const leadingOption = tokens[0];
if (leadingOption?.startsWith('--')) {
return errorResult(
json,
'INVALID_ARGUMENT',
[],
leadingOption,
`Unknown or mis... | codex-hackathon | src/cli/command-tree.ts | TypeScript | c60f39ad2d33f93672f2840383a325da696c4a15c405cdfab0d2d29e364ceb25 | 5 | 896 |
leaf) => isPrefix(path, leaf.path));
if (descendants.length === 0) {
throw new CommandTreeInvariantError(`Cannot project help for unknown path: ${path.join(' ')}.`);
}
return {
scope: 'parent',
title: `mlx ${path.join(' ')}`,
introduction: null,
usage: `mlx ${path.join(' ')} <command> [options]`,
descrip... | codex-hackathon | src/cli/command-tree.ts | TypeScript | 5ff83a8d19126e370352252afe17ed4192c1dc5cfc9f077bf783f1e778e3d6ca | 6 | 193 |
import { mkdtemp, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import type { DoctorResult } from '../core/doctor';
import { runDoctor } from './doctor';
import { runInit } from './init';
import { renderHuman } fro... | codex-hackathon | src/cli/doctor.test.ts | TypeScript | 4e69d6482b581847141c60476a7e455870eb32ba00b1b375dd82a963258193d7 | 0 | 896 |
',
foreignKeys: true,
concurrency: { status: 'pass', contenders: 2, committedWrites: 50 },
multiOwnerMutationAllowed: true,
}),
});
expect(execution.exitCode).toBe(5);
expect(execution.envelope).toMatchObject({
ok: false,
status: 'collision',
error: { code: 'EXECUTABLE_COLLISION' },
da... | codex-hackathon | src/cli/doctor.test.ts | TypeScript | 37a8709fc1ce8958142fdf68c661267dc51b10cb330745f5288265e03082ed60 | 1 | 429 |
import { lstat, readFile, realpath, stat } from 'node:fs/promises';
import path from 'node:path';
import { type DoctorFsPort, type DoctorResult, inspectExecutableCandidates } from '../core/doctor';
import { type SqliteCapabilityEvidence, probeSqliteCapability } from '../core/sqlite-capability';
import type { CommandExe... | codex-hackathon | src/cli/doctor.ts | TypeScript | a5f562b53c0a0778c534a6c97b8d915f0c433f53eb3e6c6cb9913d5342286705 | 0 | 896 |
fs ?? NODE_DOCTOR_FS,
));
const probeSqlite = dependencies.probeSqlite ?? (async () => await probeSqliteCapability());
const [result, sqlite] = await Promise.all([
inspectExecutable(),
probeSqlite().catch(failedSqliteProbe),
]);
return envelope({ ...result, sqlite, catalogOwner: catalogOwnerEvidence(sqlite) ... | codex-hackathon | src/cli/doctor.ts | TypeScript | e57098153f76bd5d31fb9adbcc88aceacba7507c47936fa117c3d4b1d6778c8f | 1 | 78 |
import { homedir } from 'node:os';
import { type ResolveMlxHomeInput, resolveMlxHome } from '../core/mlx-home';
import {
type StateInitializationResult,
type StateOwnershipFs,
initializeStateRoot,
} from '../core/state-ownership';
export type InitResult =
| StateInitializationResult
| {
readonly ok: false;
... | codex-hackathon | src/cli/init.ts | TypeScript | b4fb83d016181dcbe05e6053a42813b5e23d5eb5aebb10996c7e024ce3862711 | 0 | 271 |
import { describe, expect, it } from 'vitest';
import { type CliDependencies, type CliIo, EXIT_CODES, runCli } from './main';
const IO: CliIo = { columns: 80, isTTY: false };
describe('runCli', () => {
it('returns equivalent successful root help for bare and explicit help', async () => {
const bare = await runCli(... | codex-hackathon | src/cli/main.test.ts | TypeScript | 36b3334964c4fed014d50985822ab0ee24385798d0e2496478cbb1d66cb8dfeb | 0 | 896 |
(['dataset', 'build', '--json'], IO, {});
expect(first).toEqual(second);
});
it('uses the built-in read-only doctor handler when no override is supplied', async () => {
const absent = Object.assign(new Error('missing'), { code: 'ENOENT' });
const result = await runCli(['doctor', '--json'], IO, {
doctor: {
... | codex-hackathon | src/cli/main.test.ts | TypeScript | f6bac87904dea232662a9b6d48ec21f6b3358f338d65c83e0b8b5a0dec83cddb | 1 | 311 |
import {
type CommandLeaf,
type OwnerPhase,
PHASE_NAMES,
parseCommand,
projectHelp,
} from './command-tree';
import type { DoctorDependencies } from './doctor';
import type { InitDependencies, InitResult } from './init';
import { renderHuman } from './render-human';
import { renderJson } from './render-json';
exp... | codex-hackathon | src/cli/main.ts | TypeScript | 6e768f6260f4ab454e94e9e6599b62cb61970c8c0fbf07d4ab3262c40b4a4e3c | 0 | 896 |
{
code: 'UNAVAILABLE',
message: 'This command is defined but is not available in Phase 1.',
ownerPhase: leaf.ownerPhase,
}),
exitCode: EXIT_CODES.UNAVAILABLE,
};
}
function renderResult(
execution: CommandExecution,
json: boolean,
io: CliIo,
dependencies: CliDependencies,
): CliRunResult {
if (json)... | codex-hackathon | src/cli/main.ts | TypeScript | 3a226d2d8bb3dc4fcb76a28c4b8745b88af0092a09e443f25bae37a025a4ee31 | 1 | 548 |
import type {
CommandArgumentSpec,
CommandOptionSpec,
HelpProjection,
HelpRow,
} from './command-tree';
import { PHASE_NAMES } from './command-tree';
import type { CliEnvelope } from './main';
function hex(code: number, width: number): string {
return code.toString(16).padStart(width, '0');
}
export function san... | codex-hackathon | src/cli/render-human.ts | TypeScript | 7912b4b766f66e034df1d983f4ae30bb6354846e66a671b8f6babad96849091f | 0 | 896 |
function optionDescription(option: CommandOptionSpec): string {
if (option.name === '--json') return 'Emit one machine-readable JSON object';
if (option.name === '--help') return 'Show help';
if (option.name === '--private') return 'Require a private destination';
return `Set ${option.name.slice(2)}`;
}
function r... | codex-hackathon | src/cli/render-human.ts | TypeScript | a9a1c309771f1bbee76c425d2c78c0b735f90f567ebccdbbc32ac58d523dc75c | 1 | 896 |
\n');
}
function renderParseError(envelope: CliEnvelope): string {
if (
!envelope.error ||
(envelope.error.code !== 'INVALID_ARGUMENT' && envelope.error.code !== 'UNKNOWN_COMMAND')
) {
throw new Error('INTERNAL_INVARIANT: parse-error envelope has no parse error.');
}
const command = sanitizeTerminalText(enve... | codex-hackathon | src/cli/render-human.ts | TypeScript | 7cd6fa0fc997a20210ef52aa6ee9463c117c30a835ee0d28584041774b278c46 | 2 | 896 |
,
`Multi-owner mutation: ${result.sqlite.multiOwnerMutationAllowed ? 'allowed' : 'not allowed'}`,
);
}
if (result.catalogOwner) {
lines.push(
`Catalog owner: ${result.catalogOwner.required ? result.catalogOwner.status : 'not required'}`,
);
if (result.catalogOwner.required && result.catalogOwner.action)... | codex-hackathon | src/cli/render-human.ts | TypeScript | 34eafd04dd068ca777d163f7cddab7af89a39209f11b55dcd9818297e6a0d4f6 | 3 | 533 |
import type { CliEnvelope } from './main';
export function renderJson(envelope: CliEnvelope): string {
const orderedEnvelope: CliEnvelope = {
schemaVersion: envelope.schemaVersion,
ok: envelope.ok,
command: envelope.command,
status: envelope.status,
data: envelope.data,
error: envelope.error,
};
return ... | codex-hackathon | src/cli/render-json.ts | TypeScript | 73a40dd6706482c9b454b9024897a4f5bb74e6561711f92de054a15df16b1fa3 | 0 | 83 |
import { describe, expect, it } from 'vitest';
import { projectHelp } from './command-tree';
import type { CliEnvelope } from './main';
import { renderHuman, sanitizeTerminalText } from './render-human';
import { renderJson } from './render-json';
function rootHelpEnvelope(): CliEnvelope {
return {
schemaVersion: '... | codex-hackathon | src/cli/renderers.test.ts | TypeScript | 40e62de5def12a06111447b2a34320568970da54537b03016aee466ef8a0602b | 0 | 896 |
mlx dataset --help');
expect(output).toContain(`${'工程'.repeat(60)}\\x1b`);
expect(output).not.toContain(String.fromCharCode(27));
expect(output).not.toContain('…');
});
it('is byte-equivalent for repeated controlled human outcomes', () => {
const envelope = unavailableEnvelope();
expect(renderHuman(envelop... | codex-hackathon | src/cli/renderers.test.ts | TypeScript | 9c060a10aff92aa38166819954890c981c393e3e56cfc89b6f20c46c9380039c | 1 | 138 |
import { Box, Text } from 'ink';
import React from 'react';
const MAX_LINES = 20;
interface LogViewProps {
lines: string[];
title?: string;
}
export function LogView({ lines, title }: LogViewProps) {
const visible = lines.slice(-MAX_LINES);
return (
<Box flexDirection="column" borderStyle="single" borderColor... | codex-hackathon | src/components/log-view.tsx | TypeScript | bab8b26f976e8b9f93272564de0326c97b0331c00004f8c91f399f4bfaa55a19 | 0 | 191 |
import { Box, Text } from 'ink';
import Spinner from 'ink-spinner';
import type React from 'react';
export interface StageInfo {
id: string;
label: string;
status: 'pending' | 'running' | 'done' | 'error';
detail?: string;
}
interface PipelineViewProps {
stages: StageInfo[];
title?: string;
}
function statusIc... | codex-hackathon | src/components/pipeline-view.tsx | TypeScript | 75709edbf1e05c5db399392be689e359ccf977d372af0e8c2fa72d19d736ea79 | 0 | 334 |
import { Box, Text } from 'ink';
import Spinner from 'ink-spinner';
import React from 'react';
export interface TrainState {
mode: 'sft' | 'grpo';
iter: number;
totalIters: number;
loss?: number;
tokPerSec?: number;
status: 'running' | 'done' | 'error' | 'rollback';
message?: string;
}
interface TrainViewProps... | codex-hackathon | src/components/train-view.tsx | TypeScript | 972932b41cc6bec7f7ea2c1aa9e495572232279ff211a0cb071111ce9548c0c0 | 0 | 515 |
import { describe, expect, it } from 'vitest';
import { validateArchiveEntry } from './archive-path';
describe('validateArchiveEntry', () => {
it.each([
'/etc/passwd',
'../escape',
'a/../../escape',
'C:\\escape',
'\\\\host\\share',
'bad\0name',
])('rejects unsafe member %s', (name) => expect(validateArch... | codex-hackathon | src/core/archive-path.test.ts | TypeScript | cd9836a4391f4de7efc3e243b55741ed340bd5b45f00774180ea36329662f155 | 0 | 275 |
import path from 'node:path';
export type ArchivePathResult =
| { readonly ok: true; readonly member: string; readonly linkTarget?: string }
| {
readonly ok: false;
readonly code: 'NUL' | 'ABSOLUTE' | 'TRAVERSAL' | 'INVALID_LINK_TARGET';
readonly input: string;
readonly reason: string;
};
function in... | codex-hackathon | src/core/archive-path.ts | TypeScript | 8492324cc7f7b7b85d33f273e3875e836fced6dee22e2e483ee72b291aa550ae | 0 | 524 |
import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import { resolveContainedPath } from './contained-path';
const roots: string[] = [];
function root(): string {
... | codex-hackathon | src/core/contained-path.test.ts | TypeScript | 2fb87739dc6e8e1e28378ced0c09fc1ba6f37f0e4d5b172f8347be88c855c4f7 | 0 | 557 |
import { lstatSync, realpathSync } from 'node:fs';
import path from 'node:path';
export type ContainedPathFailureCode =
| 'INVALID_ROOT'
| 'ABSOLUTE_PATH'
| 'TRAVERSAL'
| 'SYMLINK'
| 'OUTSIDE_ROOT'
| 'INSPECTION_FAILED';
export type ContainedPathResult =
| { readonly ok: true; readonly path: string; readonly r... | codex-hackathon | src/core/contained-path.ts | TypeScript | ffc54725384935e2563cb6fb843c3c86f3f091267d1aaf371b9372c790c55ae9 | 0 | 890 |
import { createHash } from 'node:crypto';
import {
chmod,
lstat,
mkdir,
mkdtemp,
readFile,
readlink,
realpath,
rm,
stat,
symlink,
writeFile,
} from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
const roots: strin... | codex-hackathon | src/core/doctor.test.ts | TypeScript | aa8735452a629f126e0eb475bc0c14b4d905247c5ebd317e2cd00333444fd65b | 0 | 896 |
packageRoot, 'src/cli.tsx');
const markerPath = path.join(packageRoot, 'mlx.package.json');
await executable(declaredEntry);
await writeFile(markerPath, `${JSON.stringify(marker)}\n`, 'utf8');
const ownedDir = path.join(root, 'owned');
const foreignDir = path.join(root, 'foreign');
const relativeDir = 'rela... | codex-hackathon | src/core/doctor.test.ts | TypeScript | bb495330d303a8cbf4fdc733f897769ff24228a9feb261ebc6d76ad8b96ac80b | 1 | 896 |
declaredEntry,
markerPath,
[nonExecutable, broken, cycle, interrupted, markerMismatch]
.map((candidate) => path.dirname(candidate))
.join(path.delimiter),
),
nodePort(
markerPath,
new Set([declaredEntry, nonExecutable, interrupted, markerMismatch]),
new Set([interrupted]),
),
);... | codex-hackathon | src/core/doctor.test.ts | TypeScript | 8f747f88bdfff8fe9bee57ae3ff3ad29be1b8276fbc21a9b96edc5134c200352 | 2 | 896 |
stringify(value) === JSON.stringify(sequential[0])),
).toBe(true);
expect(notFound).toMatchObject({ classification: 'not-found', candidates: [] });
expect(await snapshot(sentinelPaths)).toEqual(before);
await expect(readFile(path.join(root, 'execution-sentinel'))).rejects.toMatchObject({
code: 'ENOENT',
})... | codex-hackathon | src/core/doctor.test.ts | TypeScript | de243e5e9348aba3c4cfe1abe9adf63ae7e5e1f4053fb43005a23cb9c1a2afa3 | 3 | 102 |
import type { Stats } from 'node:fs';
import path from 'node:path';
export interface PackageOwnershipMarker {
readonly schemaVersion: string;
readonly productId: string;
readonly packageName: string;
readonly executable: string;
readonly entry: string;
}
export interface DoctorFsPort {
readonly lstat: (path: st... | codex-hackathon | src/core/doctor.ts | TypeScript | 1a10536d27e60597f0bb68613c45bcd574b5160cc6b84f52c63183532f94f885 | 0 | 896 |
unknown = JSON.parse(await fs.readTextFile(input.markerPath));
return markerMatches(parsed, input.expectedMarker)
? { valid: true, error: null }
: { valid: false, error: 'marker mismatch: packaged ownership evidence is invalid' };
} catch (error) {
return { valid: false, error: inspectionError('marker read',... | codex-hackathon | src/core/doctor.ts | TypeScript | 1d1c9311d2782bcb36364cb60d779bdb4747a8ff3d3c16a9cb61345f80fc563f | 1 | 792 |
import path from 'node:path';
import { describe, expect, it } from 'vitest';
interface ResolverModule {
resolveMlxHome(input: {
readonly env: Readonly<Record<string, string | undefined>>;
readonly homedir: () => string;
}):
| { readonly ok: true; readonly root: string; readonly source: 'default' | 'override' }... | codex-hackathon | src/core/mlx-home.test.ts | TypeScript | 5452d44dd7d9c62f52f56d101935ce37e97cd67f5d864d3e86f545e4d64dd809 | 0 | 623 |
import path from 'node:path';
export type MlxHomeResult =
| {
readonly ok: true;
readonly root: string;
readonly source: 'default' | 'override';
}
| {
readonly ok: false;
readonly code: 'INVALID_MLX_HOME';
readonly input: string;
readonly reason: string;
readonly action: string;
};
exp... | codex-hackathon | src/core/mlx-home.ts | TypeScript | 6347b3dc66333234d2e42e319709922dc9c9fc9717c0012aa7d720c3b0517d22 | 0 | 265 |
import { spawnSync } from 'node:child_process';
import { mkdtempSync, readdirSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import { runInit } from '../cli/init'... | codex-hackathon | src/core/sqlite-capability.test.ts | TypeScript | 764f60572175037821b5c89b0d6475e543a10754d20396852c9917e821c62b5b | 0 | 740 |
import { randomUUID } from 'node:crypto';
import { mkdirSync, rmSync } from 'node:fs';
import path from 'node:path';
import { type ConfigDependencies, loadRuntimeConfig } from '../lib/config';
import { resolveContainedPath } from './contained-path';
import { inspectStateRoot } from './state-ownership';
const CONTENDER... | codex-hackathon | src/core/sqlite-capability.ts | TypeScript | 7617121866d2f9295012eb60acaa4f654c3c606865b53f09e0dff4b63e9500f6 | 0 | 896 |
= await Promise.all(children.map(async (child) => await child.exited));
const errors = await Promise.all(
children.map(async (child) => {
if (!child.stderr) return '';
return (await new Response(child.stderr).text()).trim();
}),
);
if (timedOut) throw new Error('SQLite concurrency probe timed out.')... | codex-hackathon | src/core/sqlite-capability.ts | TypeScript | 81785e5b20068d278417441b31fd4233d336cd8fd62cad9b8b817c0a4e88259c | 1 | 860 |
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
interface OwnershipModule {
STATE_OWNERSHIP_FILENAME: string;
inspectStateRoot(input: { readonly root: string ... | codex-hackathon | src/core/state-ownership.test.ts | TypeScript | 379b9b4b993844fe6e338aad644ee91ffeb75c997da4c601ef498c2ca881fcf2 | 0 | 896 |
target = path.join(parent, 'target');
await mkdir(target);
const rootLink = path.join(parent, 'root-link');
await symlink(target, rootLink);
expect(await module.initializeStateRoot({ root: rootLink, adopt: true })).toMatchObject({
ok: false,
status: 'unsafe',
changed: false,
});
for (const [name, ... | codex-hackathon | src/core/state-ownership.test.ts | TypeScript | adb820d174d1ef521f04b28c9ad80f85fa9e0388d8d688b27193ac1e692315a4 | 1 | 527 |
import { lstat, mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { z } from 'zod';
export const STATE_OWNERSHIP_FILENAME = '.mlx-state-owner.json';
const StateOwnershipManifestSchema = z
.object({
schemaVersion: z.literal('1'),
product: z.literal('mlx-personal-coding-pip... | codex-hackathon | src/core/state-ownership.ts | TypeScript | 225c5f99e22d6d0a7eae3ae8297bbbc7dd6195a7a260f703b9f0b413616ca1fa | 0 | 896 |
} catch (error) {
return {
status: 'unsafe',
root,
reason: `The state ownership marker could not be read: ${error instanceof Error ? error.message : String(error)}`,
};
}
let parsed: unknown;
try {
parsed = JSON.parse(raw);
} catch {
return { status: 'unsafe', root, reason: 'The state ownership mar... | codex-hackathon | src/core/state-ownership.ts | TypeScript | 6f87316efcb55119cefaef766d50399ed5f176e2d5e5125a9833441c89920eb2 | 1 | 896 |
changed: false,
manifest: createdRoot.manifest,
};
}
if (createdRoot.status !== 'unowned') {
return {
ok: false,
status: 'unsafe',
root,
changed: false,
reason:
createdRoot.status === 'unsafe'
? createdRoot.reason
: 'The state root disappeared while it was being initialized.',
a... | codex-hackathon | src/core/state-ownership.ts | TypeScript | 3a275dc24c280d2c235273e478a5be838090aa5fb24e173d3b74d8525b3a30c3 | 2 | 106 |
import { execFile } from 'node:child_process';
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import { promisify } from 'node:util';
import { describe, expect, it, vi } from 'vitest';
interface FixtureSource {
path: string;
category: string;
allo... | codex-hackathon | src/identity/audit.test.ts | TypeScript | ae4890ae1116c79602803fe5fdf521ab732aeb79294f2c86cde8377b43e8aecf | 0 | 896 |
[
['README.md', `MLX utilities\n\n${fixture.appleDistinction}\n`],
['generated/help.txt', 'codex command help\n'],
[
'generated/package-description.txt',
`${fixture.canonicalPhrase}. Shared executable name.\n`,
],
]);
options.readText.mockImplementation(async (sourcePath: string) => {
const s... | codex-hackathon | src/identity/audit.test.ts | TypeScript | 1047da237cdfd634db989d5502e687e59d5a4c4773c08916014023845d7e6e19 | 1 | 896 |
ruleId === 'unsafe-source-path')).toBe(true);
});
it('finds no identity drift in scoped retained source and fresh package/help output', async () => {
const { auditIdentity } = await loadAuditModule();
const repositoryRoot = path.resolve(import.meta.dirname, '../..');
const packageJson = JSON.parse(
await re... | codex-hackathon | src/identity/audit.test.ts | TypeScript | bdd9e8207ce11cd3252007ac92b9a22fe70f8bfbbc385318aecbd4b46afb17b4 | 2 | 699 |
import { readFile, realpath } from 'node:fs/promises';
import path from 'node:path';
export const CANONICAL_PRODUCT_INTRODUCTION =
'MLX — the personal coding dataset and model pipeline' as const;
const CATEGORY_ORDER = [
'configuration',
'apple-distinction',
'first-mention',
'forbidden-branding',
] as const;
co... | codex-hackathon | src/identity/audit.ts | TypeScript | 9f7df95ae0c90eae9ef2b55aa2d79102437d3e813843bdf20e7742be2f826efc | 0 | 896 |
throw new Error('Identity source resolves outside the configured root.');
}
return await readFile(canonicalFile, 'utf8');
}
function validatesExclusion(
exclusion: IdentityAuditExclusion,
rulesById: ReadonlyMap<string, IdentityAuditRule>,
sourcesByPath: ReadonlyMap<string, IdentityAuditSource>,
): boolean {
cons... | codex-hackathon | src/identity/audit.ts | TypeScript | 374c42719c257cc6c80716979caa1559e4ae192d0bfa85cc8b7a94d651ecb296 | 1 | 896 |
source.path,
ruleId: 'source-read-failed',
message: 'A declared identity source could not be read inside the configured root.',
});
}
}
for (const rule of options.rules) {
for (const sourcePath of rule.paths) {
if (excluded.has(`${sourcePath}\0${rule.id}`)) continue;
const content = sourceConten... | codex-hackathon | src/identity/audit.ts | TypeScript | 11840e39804094cb7f00d8dcd4c4cae7ef83da5365de50693a5b0a5fbd1a1c76 | 2 | 278 |
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import {
ConfigError,
type ResolvedConfig,
formatConfig,
getConfigValue,
getProj... | codex-hackathon | src/lib/config.test.ts | TypeScript | 98f9568dafae62d6a76a0ae2886c404eb9fe6d760d15ad6dcf3dd2d7a4528080 | 0 | 896 |
;
it('accesses deeply nested key', () => {
expect(getConfigValue(config, 'data.trajCounts.singleTurn')).toBe(200);
});
});
describe('formatConfig', () => {
it('produces readable flat output', () => {
const root = mkdtempSync(path.join(tmpdir(), 'mlx-format-'));
const config = loadConfig({ env: { MLX_HOME: ro... | codex-hackathon | src/lib/config.test.ts | TypeScript | 7213796b4df30107f1d4c7c0b73e97712a72a0dbdd38c1208c3d95d0c3256079 | 1 | 896 |
, contents);
expect(() => loadConfig({ env: { MLX_HOME: root } })).toThrowError(ConfigError);
expect(readFileSync(configPath, 'utf8')).toBe(contents);
}
});
it('keeps writes explicit and confined to MLX_HOME/config', () => {
const root = makeRoot();
const previous = process.env.MLX_HOME;
process.env.ML... | codex-hackathon | src/lib/config.test.ts | TypeScript | a9ead6bf05c33ad80514576f992eca21334c35c6200802513c154b5ee4ae97dd | 2 | 220 |
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
import { homedir } from 'node:os';
import { dirname, join } from 'node:path';
import { z } from 'zod';
import { resolveContainedPath } from '../core/contained-path';
import { resolveMlxHome } from '../core/mlx-home';
const strictObje... | codex-hackathon | src/lib/config.ts | TypeScript | 8ef446824971c4a2ac7e9c8110c164711cee126493d9621064cc81a453a7850c | 0 | 896 |
string): Record<string, unknown> {
try {
const parsed: unknown = JSON.parse(readFileSync(filePath, 'utf8'));
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
throw new Error('the top-level JSON value must be an object');
}
return parsed as Record<string, unknown>;
} catch (erro... | codex-hackathon | src/lib/config.ts | TypeScript | c2b3bb0c22de75fc2b5443c7f6f6df461631dbc2306199287b9b66f3030e739d | 1 | 896 |
return getUserConfigPath(dependencies);
}
export function loadRuntimeConfig(dependencies: ConfigDependencies = {}): RuntimeConfig {
const env = dependencies.env ?? process.env;
const root = resolveRoot({ ...dependencies, env });
const configPath = contained(root, 'config/config.json', 'paths.config');
const raw = ... | codex-hackathon | src/lib/config.ts | TypeScript | 31818c23c115d5e776f2ec58c6e5608ad07a81fafb606ec2fbf87e1341a2e739 | 2 | 896 |
null, '\t')}\n`, { flag: 'wx' });
renameSync(temporaryPath, configPath);
} finally {
rmSync(temporaryPath, { force: true });
}
}
export function formatConfig(config: ResolvedConfig): string {
const lines: string[] = [];
function walk(object: Record<string, unknown>, prefix: string): void {
for (const [key, v... | codex-hackathon | src/lib/config.ts | TypeScript | 228d8c1d730d96915c773bf8fc20b518f4f2aaf2b383f734c42659e89c3d647e | 3 | 215 |
import { getModel } from '@/lib/model';
import { streamText } from 'ai';
import type { ContextStore } from './context-store';
function buildSystemPrompt(context: ContextStore): string {
const parts: string[] = [
'MLX — the personal coding dataset and model pipeline retains this assistant only as unreachable brownfi... | codex-hackathon | src/lib/conversation.ts | TypeScript | 450533d52458aabd7997bb48584923a093ecb5b5ded1b69f8f89d5c35a287ec5 | 0 | 790 |
import { type ChildProcess, spawn } from 'node:child_process';
const DEFAULT_PORT = 8080;
const POLL_INTERVAL_MS = 500;
const DEFAULT_TIMEOUT_MS = 120_000;
export interface ServerOptions {
model?: string;
port?: number;
}
export function startModelServer(opts: ServerOptions = {}): ChildProcess {
const model = opt... | codex-hackathon | src/lib/server-manager.ts | TypeScript | d195a97ab09d79a4110b452e4c6feaa098cd821fa53be585d138633f95404d73 | 0 | 346 |
import { createHash } from 'node:crypto';
import { describe, expect, it } from 'vitest';
const moduleUrl = new URL('./inventory-schema.ts', import.meta.url).href;
async function loadSchemaModule(): Promise<Record<string, unknown>> {
try {
return (await import(moduleUrl)) as Record<string, unknown>;
} catch (erro... | codex-hackathon | src/migration/inventory-schema.test.ts | TypeScript | 396076ac57122f6f1bf1796a539bde474e916f1496e9d3ffb15fc06a615c89d7 | 0 | 896 |
category) => category !== 'product-string').map((category) => {
const exactLocator =
category === 'script'
? { path: 'scripts/train.sh', kind: 'file', value: 'scripts/train.sh' }
: category === 'planning-artifact'
? {
path: '.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation... | codex-hackathon | src/migration/inventory-schema.test.ts | TypeScript | 990980f89f36b5b9738158a821d6da0f9a1c63fc2b1a9b73335ed5bb58292fb4 | 1 | 745 |
import { createHash } from 'node:crypto';
import { z } from 'zod';
export const MIGRATION_CATEGORIES = [
'legacy-command',
'executable-name',
'runtime-path',
'generated-artifact',
'script',
'product-string',
'dynamic-tool-path',
'ios-component',
'planning-artifact',
] as const;
export const RUNTIME_STATE_CL... | codex-hackathon | src/migration/inventory-schema.ts | TypeScript | ba37dd25fb228aa07e75034b0102a78926abb3441dfc7510169a2e9c2a25a74e | 0 | 896 |
: z.number().int().nonnegative(),
status: z.literal('reconciled'),
});
const RECORD_CATEGORY_COVERAGE_SCHEMA = CATEGORY_COVERAGE_BASE.extend({
policy: z.literal('records'),
zeroEvidence: z.never().optional(),
}).strict();
const ZERO_CATEGORY_COVERAGE_SCHEMA = CATEGORY_COVERAGE_BASE.extend({
policy: z.literal('evi... | codex-hackathon | src/migration/inventory-schema.ts | TypeScript | da28e602f1915703d4806baf8bc3f98fa2d67d3ade18c66fceca8260824764de | 1 | 896 |
z.enum(['blocked', 'eligible']),
}).strict();
export const MIGRATION_RECORD_SCHEMA = z
.discriminatedUnion('disposition', [NON_REMOVE_RECORD_SCHEMA, REMOVE_RECORD_SCHEMA])
.superRefine((record, context) => {
if (record.id !== createMigrationRecordId(record.category, record.locator)) {
context.addIssue({
cod... | codex-hackathon | src/migration/inventory-schema.ts | TypeScript | 0a12dc935b8faf338c90a1d4391396883c7ffe06b0673a613a06df90adc5032b | 2 | 896 |
records.some((record, index) => record !== sorted[index])) {
context.addIssue({
code: z.ZodIssueCode.custom,
path: ['records'],
message: 'Records must use deterministic category and code-point locator order.',
});
}
});
export type MigrationInventory = z.output<typeof MIGRATION_INVENTORY_SCHEMA>;
| codex-hackathon | src/migration/inventory-schema.ts | TypeScript | 5f1afe3be3f3589e697c624d0dca163af1ba2dfcee21a2b46ea5797885bebd53 | 3 | 79 |
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const moduleUrl = new URL('./removal-gate.ts', import.meta.url).href;
async function loadRemovalModule(): Promise<Record<string, unknown>> {
try {
return (await import(moduleUrl)) as Re... | codex-hackathon | src/migration/removal-gate.test.ts | TypeScript | 1615d2761d5d96da2e08fda3fba58fa0c7e55fefa02e17c9d74d2b6ce7f70caa | 0 | 896 |
placeholder', 'mock', 'fixture', 'replay', 'unavailable'])(
'blocks disallowed %s evidence individually',
async (kind) => {
const module = await loadRemovalModule();
const compute = requireExport<
(record: unknown, context: unknown) => { eligible: boolean; reasons: string[] }
>(module, 'computeRemovalE... | codex-hackathon | src/migration/removal-gate.test.ts | TypeScript | c2e62329004d2341d5e5e6b1889f12ea079b85e2a117c7937884de79ad67e8ff | 1 | 896 |
-review');
const result = compute(record, context);
expect(result.eligible).toBe(false);
expect(result.reasons.join(' ')).toMatch(/legacy|target|source|digest/i);
});
it('blocks deletion when required identity replacement evidence is absent', async () => {
const module = await loadRemovalModule();
const ev... | codex-hackathon | src/migration/removal-gate.test.ts | TypeScript | 06352485eda4ada0a2ec1dc5d8491a1b99c98caeb6f991be65a75c67bbc6afb2 | 2 | 810 |
import { createHash } from 'node:crypto';
import {
ALLOWED_REPLACEMENT_EVIDENCE_KINDS,
type MigrationRecord,
type ReplacementEvidence,
migrationLocatorKey,
} from './inventory-schema';
const ALLOWED_EVIDENCE = new Set<string>(ALLOWED_REPLACEMENT_EVIDENCE_KINDS);
export interface RemovalEligibilityContext {
read... | codex-hackathon | src/migration/removal-gate.ts | TypeScript | 319fc004ad34914d130dcbd2ba87760715f01d7d91d4b340613b31425a3fa5e4 | 0 | 896 |
find(
(candidate) => candidate.kind === evidence.kind && candidate.locator === evidence.locator,
);
if (!current) {
reasons.push(`Replacement evidence locator is absent: ${evidence.locator}.`);
continue;
}
if (current.digest !== evidence.digest) {
reasons.push(`Replacement evidence digest is stale: ... | codex-hackathon | src/migration/removal-gate.ts | TypeScript | 0304e644d0599615fe0582214d009e16fe2851c8d996070881d2c350b70183e0 | 1 | 367 |
import { spawnSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import { MIGRATION_INVENTO... | codex-hackathon | src/migration/render-review.test.ts | TypeScript | 56fb27dda0936611d839b13f3b7782b035a38ac2d58572524496aff484604984 | 0 | 896 |
renderMigrationReview(canonicalInventory()), 'utf8');
const passing = spawnSync(
'bun',
['src/migration/render-review.ts', '--check', jsonPath, reviewPath],
{ encoding: 'utf8' },
);
expect(passing.status).toBe(0);
writeFileSync(reviewPath, 'drifted but must not be rewritten\n', 'utf8');
const failin... | codex-hackathon | src/migration/render-review.test.ts | TypeScript | c7ada73ff94eff3520dadbdeb0d2fa394368935439c13fa5ed0c43036d19d020 | 1 | 203 |
import { readFileSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
import {
MIGRATION_INVENTORY_SCHEMA,
type MigrationInventory,
RUNTIME_STATE_CLASSES,
compareMigrationRecords,
} from './inventory-schema';
import { reconcileInventory, scanLegacyAss... | codex-hackathon | src/migration/render-review.ts | TypeScript | b4c5a804720ca2ddfde2dc27460a1ac4c041b666afb407f6a63bd8e12e4738f2 | 0 | 896 |
if (categoryRecords.length === 0) {
lines.push(
`- **EVIDENCED ZERO:** ${inline(coverage.zeroEvidence ?? 'No records discovered.')}`,
'',
);
continue;
}
for (const record of categoryRecords) {
lines.push(
`- **${record.id}** — \`${inline(record.locator.path)}#${record.locator.kind}=${inline(... | codex-hackathon | src/migration/render-review.ts | TypeScript | cabab25c7cb3f7ace700771e3ea7627458d63421dca0cf5fe57ddcc8c5f32631 | 1 | 836 |
import { readFileSync } from 'node:fs';
import { describe, expect, it, vi } from 'vitest';
const moduleUrl = new URL('./repository-scanner.ts', import.meta.url).href;
async function loadScannerModule(): Promise<Record<string, unknown>> {
try {
return (await import(moduleUrl)) as Record<string, unknown>;
} catch ... | codex-hackathon | src/migration/repository-scanner.test.ts | TypeScript | 8cbc1a0f0fa04a1cbad3c31ae66fbce5fb47eea13089559934e57a11738abdb9 | 0 | 896 |
eval-gen/04-02-SUMMARY.md',
'04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md',
'04-data-eval-gen/04-03-SUMMARY.md',
'04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md',
'04-data-eval-gen/04-04-SUMMARY.md',
'04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md',
'04-data-eval-gen/04-05-SUMMARY.md',
'04-d... | codex-hackathon | src/migration/repository-scanner.test.ts | TypeScript | f85de5c46da753c8909eece04ff395a6861280cbb9f931d1c4b65844e942459d | 1 | 896 |
string',
rule: 'historical-internal-record',
reason: 'Historical provenance is not public product copy.',
},
],
unopenedSensitivePaths: [
'.env.local',
'/Users/operator',
'.mlx/mirrors/private.git',
'data/models/e4b',
'data/adapters/private',
'data/raw-traces/session.json',
... | codex-hackathon | src/migration/repository-scanner.test.ts | TypeScript | ea116547ee2ec83b319c39b9062dfcd75211c5c03fd222b22fcd352726e160e9 | 2 | 896 |
({
category,
policy: 'records',
discoveredCount: discovered.filter((item) => item.category === category).length,
recordCount: records.filter((item) => item.category === category).length,
status: 'reconciled',
}));
expect(reconcileInventory(discovered, records, categories).ok).toBe(true);
expect(re... | codex-hackathon | src/migration/repository-scanner.test.ts | TypeScript | 7f0c44da70ce78640ba32dbb289dcc3672c428a2b18ccac284506badb445ee94 | 3 | 558 |
import {
type CategoryCoverage,
type ExactLocator,
MIGRATION_CATEGORIES,
type MigrationCategory,
type MigrationRecord,
PATH_EXCLUSION_SCHEMA,
type PathExclusion,
compareCodePoint,
compareMigrationRecords,
exactLocatorKey,
migrationLocatorKey,
} from './inventory-schema';
export type { MigrationCategory } fr... | codex-hackathon | src/migration/repository-scanner.ts | TypeScript | f88e43d1024f21bdce7914950f24a8d881642275f1548a6de1e4ace467919fc0 | 0 | 896 |
locator: { ...declaration.locator } });
}
const included = discovered.filter((locator) => !isExcluded(locator, exclusions));
const keys = included.map(({ category, locator }) => migrationLocatorKey(category, locator));
const duplicates = keys.filter((key, index) => keys.indexOf(key) !== index);
if (duplicates.len... | codex-hackathon | src/migration/repository-scanner.ts | TypeScript | 3a50dbf26fe5b6719e13dc7893013b8bc160ce5c03fb9ef03fee65932354f998 | 1 | 880 |
import { spawnSync } from 'node:child_process';
import { mkdtempSync, realpathSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import { type CatalogDatabase, runCa... | codex-hackathon | src/runs/run-manifest.test.ts | TypeScript | 63771be76bc276c63ddd4636dbc7895afbb154edb5c45c3a598d7dcc68eb7200 | 0 | 896 |
immutable catalog lineage', async () => {
if (!requireBunRuntime()) return;
const { database, store } = await fixture();
const output = store.put(Buffer.from('verified output'));
createRun(database, {
runId: 'run-1',
stageKey: digest('a'),
stageType: 'compile',
createdAt: '2026-07-16T10:00:00.000Z',... | codex-hackathon | src/runs/run-manifest.test.ts | TypeScript | dcc9a7e0e0430f8c01b76a235ae698be4ab419ad815751b50c0faf3a371fca89 | 1 | 756 |
import { createHash } from 'node:crypto';
import { z } from 'zod';
import type { CatalogDatabase } from '../catalog/migration-runner';
import type { ObjectStore } from '../storage/object-store';
const digestSchema = z.string().regex(/^[0-9a-f]{64}$/);
const identifierSchema = z
.string()
.min(1)
.max(256)
.refine(... | codex-hackathon | src/runs/run-manifest.ts | TypeScript | 7a4a58287bd92752f09dfc822266f80d7087b443d40cb7bb6a5b1d24b925ea7e | 0 | 896 |
value === 'object') {
return Object.fromEntries(
Object.entries(value)
.sort(([left], [right]) => compareCodePoints(left, right))
.map(([key, item]) => [key, canonicalValue(item)]),
);
}
return value;
}
export function canonicalJsonBytes(value: unknown): Buffer {
return Buffer.from(JSON.stringify(can... | codex-hackathon | src/runs/run-manifest.ts | TypeScript | 6d752685b6a68b4dcaae197b62764354d4265f9c6dcb3f69d2fb2bcd2e414de7 | 1 | 896 |
;
if (!record) throw new RunManifestError('RUN_NOT_FOUND', 'Run insert was not durable.');
return record;
}
function nextEventSequence(database: CatalogDatabase, runId: string): number {
return (
database
.query<{ readonly sequence: number }, [string]>(
'SELECT coalesce(max(sequence), 0) + 1 AS sequence FR... | codex-hackathon | src/runs/run-manifest.ts | TypeScript | e839503947cd5e1b4240a0c37e6f0ee8aa4eb1a800272514710b23eac14d4798 | 2 | 896 |
, size) VALUES (?, ?) ON CONFLICT(digest) DO NOTHING',
)
.run(object.digest, object.size);
const changed = database
.query<never, [string, number, string, string]>(
`UPDATE runs SET status = 'committed', manifest_digest = ?, manifest_size = ?, terminal_at = ?
WHERE run_id = ? AND status = 'run... | codex-hackathon | src/runs/run-manifest.ts | TypeScript | ef4e0107cb83a4d9a0dc428de7115f8c14423b4f2c35f5fcdb92115638a29e2c | 3 | 687 |
import { spawnSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import { mkdtempSync, realpathSync, rmSync, truncateSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { afterEach, beforeAll, describe, expect, ... | codex-hackathon | src/runs/stage-reuse.test.ts | TypeScript | 12c48022fc5e9fa84d68d55a631975b14a71c9997204abe80cacf80ac49a92c2 | 0 | 896 |
} = await fixture();
let count = 0;
const execute = () => {
count += 1;
const output = store.put(Buffer.from(`output-${count}`));
return {
outputs: [{ name: 'result', digest: output.digest, size: output.size }],
validation: [{ name: 'schema', status: 'pass' as const }],
};
};
const first = c... | codex-hackathon | src/runs/stage-reuse.test.ts | TypeScript | 8982bce0af79d6d7ad13983429b4f863eec9694590b7935c3c12227dc52006f5 | 1 | 850 |
import { createHash } from 'node:crypto';
import { z } from 'zod';
import type { CatalogDatabase } from '../catalog/migration-runner';
import type { ObjectStore } from '../storage/object-store';
import {
appendRunEvent,
canonicalJsonBytes,
commitRunManifest,
createRun,
getRunRecord,
verifyCommittedRun,
} from './... | codex-hackathon | src/runs/stage-reuse.ts | TypeScript | a4398ec1a933766b41f28d1d78a95c4a147d0e0c5e67216df19a2e3799d10c5e | 0 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.