Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ site/*.timestamp-*.mjs

# Generated by deps from pinned public Claude source.
packages/acp/generated/

# Generated by deps from pinned public tty source and its local patch.
packages/cli/generated/
5 changes: 4 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// the exact indentation the rule tests assert on.
// `packages/*/npm` is generated dnt output, written by a test while the
// battery runs; format-checking it fails on a file nobody wrote by hand.
// `packages/cli/generated` is the prepared terminal runtime, held to the
// hashes its recipe records.
// The retained-repository history fixtures are journals an older revision
// emitted, held to the SHA-256 their own receipt records: reserializing one
// changes the bytes the evidence is, and the suite that continues them
Expand All @@ -16,6 +18,7 @@
"packages/workflow/vendor/cloudflare-computer-dofs/**",
"packages/acp/vendor/acpx/**",
"packages/acp/vendor/adapters/claude/sdk-transform.mjs",
"packages/cli/src/repl/vendor/freedom/**"
"packages/cli/src/repl/vendor/freedom/**",
"packages/cli/generated/**"
]
}
6 changes: 0 additions & 6 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"test:node": "tsx scripts/runtime-tests.ts node",
"test:bun": "bun scripts/runtime-tests.ts bun",
"test:deno": "deno task test",
"lint": "oxlint -c .oxlintrc.json --ignore-pattern 'scripts/tests/fixtures/**' --ignore-pattern '**/npm/**' --ignore-pattern 'packages/workflow/vendor/cloudflare-computer-dofs/**' --ignore-pattern 'packages/acp/vendor/acpx/**' --ignore-pattern 'packages/cli/src/repl/vendor/freedom/**' packages scripts && oxlint -c .oxlint-prose.json site smoke-test && node scripts/lint-architecture.js && oxfmt --check packages scripts && pnpm run lint:dead-code",
"lint": "oxlint -c .oxlintrc.json --ignore-pattern 'scripts/tests/fixtures/**' --ignore-pattern '**/npm/**' --ignore-pattern 'packages/workflow/vendor/cloudflare-computer-dofs/**' --ignore-pattern 'packages/acp/vendor/acpx/**' --ignore-pattern 'packages/cli/src/repl/vendor/freedom/**' --ignore-pattern 'packages/cli/generated/**' packages scripts && oxlint -c .oxlint-prose.json site smoke-test && node scripts/lint-architecture.js && oxfmt --check packages scripts && pnpm run lint:dead-code",
"lint:dead-code": "knip --config knip.json --no-progress --no-config-hints --include files,exports,types",
"fmt": "oxfmt --write packages scripts"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
},
"imports": {
"marked": "npm:marked@^17.0.4",
"@bomb.sh/tty": "npm:@bomb.sh/tty@0.9.0",
"@effectionx/stream-helpers": "npm:@effectionx/stream-helpers@0.8.3",
"@standard-schema/spec": "npm:@standard-schema/spec@^1.0.0",
"zod": "npm:zod@^4.3.6",
"@agentclientprotocol/sdk": "npm:@agentclientprotocol/sdk@1.3.0"
},
"publish": {
"exclude": ["!generated/tty/**", "vendor/tty/**"]
}
}
1 change: 0 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"dependencies": {
"@agentclientprotocol/sdk": "1.3.0",
"@bomb.sh/tty": "0.9.0",
"@effectionx/stream-helpers": "0.8.3",
"@executablemd/acp": "workspace:*",
"@executablemd/core": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/repl/fitting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import { boundaries, caretRow } from "./caret.ts";
import type { ReplCaret, ReplCaretRow } from "./caret.ts";

import { close, fit, open, text } from "@bomb.sh/tty";
import type { Op } from "@bomb.sh/tty";
import { close, fit, open, text } from "../../generated/tty/mod.js";
import type { Op } from "../../generated/tty/mod.js";
import { Err, Ok } from "effection";
import type { Operation, Result } from "effection";
import type { ReplRenderer } from "./renderer.ts";
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/repl/history-rail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* to reach one of them, which is the whole point of retaining it.
*/

import { close, fit, open, text } from "@bomb.sh/tty";
import type { Op } from "@bomb.sh/tty";
import { close, fit, open, text } from "../../generated/tty/mod.js";
import type { Op } from "../../generated/tty/mod.js";
import { Err, Ok } from "effection";
import type { Operation, Result } from "effection";
import { tokenRuns } from "./description.ts";
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/repl/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@
* those passes are one result in the order the terminal sent them.
*/

import { createInput, type Input, type InputEvent, type ScanResult } from "@bomb.sh/tty";
import {
createInput,
type Input,
type InputEvent,
type ScanResult,
} from "../../generated/tty/mod.js";
import { type Operation, resource, until } from "effection";

import type { ReplInputEvent, ReplKey } from "./description.ts";
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/repl/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
* cannot hit — so every size and inset here is stated as whole cells.
*/

import { close, fixed, fit, grow, open, text } from "@bomb.sh/tty";
import type { Op, OpenElement, SizingAxis } from "@bomb.sh/tty";
import { close, fixed, fit, grow, open, text } from "../../generated/tty/mod.js";
import type { Op, OpenElement, SizingAxis } from "../../generated/tty/mod.js";
import { runText } from "./description.ts";
import type { ReplPreparedRail } from "./history-rail.ts";
import type { ReplTokenRun } from "./description.ts";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/repl/presentation-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* selection keeps `*`, and focus keeps `>`.
*/

import { rgba } from "@bomb.sh/tty";
import { rgba } from "../../generated/tty/mod.js";

/**
* What one row is, out of the closed set this screen draws.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/repl/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/

import { Err, Ok, type Operation, resource, type Result, until } from "effection";
import { createTerm, type Op, type PointerEvent, type Term } from "@bomb.sh/tty";
import { createTerm, type Op, type PointerEvent, type Term } from "../../generated/tty/mod.js";
import type { ReplInputEvent } from "./description.ts";
import type { ReplBounds } from "./layout.ts";
import type { ReplTerminalSize } from "./terminal.ts";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/repl/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
progressiveInput,
type Setting,
settings,
} from "@bomb.sh/tty";
} from "../../generated/tty/mod.js";
import { ReplTerminal, type ReplTerminalSize } from "./terminal.ts";
import { ReplClock } from "./frame.ts";
import { type ReplPhysicalInput, useReplDecoder } from "./input.ts";
Expand Down
17 changes: 14 additions & 3 deletions packages/cli/tests/repl-boundaries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,20 @@ describe("REPL boundaries: what production code cannot reach", () => {
expect(manifest.includes(rejected)).toBe(false);
expect(packaged.includes(rejected)).toBe(false);
}
// The one dependency this stack did add, at the exact version it pinned.
expect(manifest).toContain('"@bomb.sh/tty": "npm:@bomb.sh/tty@0.9.0"');
expect(packaged).toContain('"@bomb.sh/tty": "0.9.0"');
// The terminal engine is the prepared local runtime, not an external
// dependency: the published 0.9.0 package shares a width between texts with
// one cache hash (#1216).
expect(manifest.includes("@bomb.sh/tty")).toBe(false);
expect(packaged.includes("@bomb.sh/tty")).toBe(false);
expect(manifest).toContain('"!generated/tty/**"');
expect(yield* read(join(CLI, "vendor", "tty", "recipe.json"))).toContain(
'"url": "https://registry.npmjs.org/@bomb.sh/tty/-/tty-0.9.0.tgz"',
);
for (const path of yield* authored()) {
expect([path.slice(CLI.length), (yield* code(path)).includes('from "@bomb.sh/tty"')]).toEqual(
[path.slice(CLI.length), false],
);
}
});

it("S1: no production REPL module retains a provider's raw request", function* () {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/repl-focus-navigation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { describe, it } from "@executablemd/test-support/bdd";
import { expect } from "@executablemd/test-support/expect";
import { createInput } from "@bomb.sh/tty";
import { createInput } from "../generated/tty/mod.js";
import { until } from "effection";
import type { Operation, Result } from "effection";

Expand Down
58 changes: 58 additions & 0 deletions packages/cli/tests/repl-journey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,64 @@ describe("REPL original complete History and cold catalog", () => {
expect(yield* readTextFile(hot.path)).toBe(bytes);
released(page.repl.terminal);
});

it("EC2: an entry whose texts once shared one measured width reopens exact, with no work", function* () {
// The two prose lines hashed alike in the published engine's measurement
// cache, which gave the second one the first one's width (#1216).
const short = "synthetic sample synthetic sample synthetic sample 022aa2";
const long =
"synthetic sample synthetic sample synthetic sample synthetic sample synthetic sample 01fda4";
const colliding = `${short}\n\n${long}\n`;
const dataRoot = yield* useTemporary("xmd-cold-collision-");
const hot = yield* scoped(function* () {
const page = yield* referencePageFor(dataRoot);
yield* runSource(page, colliding);
yield* entrySettles(page, 1, "ok");
yield* runSource(page, FIRST_COLD);
yield* entrySettles(page, 2, "ok");
const expected = expectedPositions(yield* retainedModel(page));
yield* selectCatalog(page, "entry-1");
return {
expected,
location: yield* leaveWithLocation(page),
path: yield* executionJournal(page),
};
});
const bytes = yield* readTextFile(hot.path);
const host = yield* useMountedHost({ dataRoot, includes: [REFERENCE_DIRECTORY] });
yield* noNewExecution();
const work = yield* performedWork();
const page = yield* useReplPage({ host, location: hot.location, size: WIDE });
const exact = (one: ScreenReading): boolean =>
one.shows("022aa2") && one.shows("01fda4") && trail(one).includes("Entry 1");
expect(page.screen().shows("HEAD · SETTLED")).toBe(true);
expect(exact(page.screen())).toBe(true);
yield* openHistory(page);
yield* page.press(hot.expected[0] ?? "");
yield* page.until("the first prefix", (one) => one.shows("[live]"));
yield* closeDrawer(page);
expect(exact(page.screen())).toBe(true);
yield* page.press("[live]");
yield* page.until("the settled head", (one) => !one.shows("[live]"));
yield* selectCatalog(page, "entry-2");
expect(trail(page.screen())).toContain("Entry 2");
yield* selectCatalog(page, "entry-1");
for (const size of [NARROW, { columns: 120, rows: 30 }, WIDE]) {
const shown = yield* page.resize(size);
expect(shown.rows.filter((row) => row.length > size.columns)).toEqual([]);
expect(exact(shown)).toBe(true);
}
expect((yield* retainedModel(page)).entries.map((one) => one.source)).toEqual([
colliding,
FIRST_COLD,
]);
expect(yield* leaveWithLocation(page)).not.toBe("");
expect(work.compiles).toBe(0);
expect(work.asked).toBe(0);
expect(work.reads.filter((one) => one.endsWith(".md"))).toEqual([]);
expect(yield* readTextFile(hot.path)).toBe(bytes);
released(page.repl.terminal);
});
});
function referencePageFor(dataRoot: string): Operation<ReplPage> {
return useReplPage({ dataRoot, includes: [REFERENCE_DIRECTORY], size: WIDE });
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/repl-presentation-style.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { parseTodo } from "../src/repl/todo/document.ts";

import { beforeAll, describe, it } from "@executablemd/test-support/bdd";
import { expect } from "@executablemd/test-support/expect";
import { close, fit, open, text } from "@bomb.sh/tty";
import { close, fit, open, text } from "../generated/tty/mod.js";
import {
collect,
Elicitation,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/tests/repl-terminal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ import { useGrid, usePresenter } from "./fixtures/repl/presentation.ts";
import type { Observed, Presenter } from "./fixtures/repl/presentation.ts";
import { referenceEvents } from "./fixtures/repl/reference.ts";
import { useTerminalScreen } from "./support/terminal-screen.ts";
import { close, fixed, open, percent, text } from "@bomb.sh/tty";
import type { Op } from "@bomb.sh/tty";
import { close, fixed, open, percent, text } from "../generated/tty/mod.js";
import type { Op } from "../generated/tty/mod.js";
import { nearestCommonAncestor, ReplClock, useReplFrames } from "../src/repl/frame.ts";
import type { ReplFrameSubscription } from "../src/repl/frame.ts";
import { useReplDecoder } from "../src/repl/input.ts";
Expand Down
Loading
Loading