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
5 changes: 4 additions & 1 deletion src/permission/reactor-authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import { getLogger } from "@intx/log";

import { LOG_NAMESPACE_ROOT } from "../branding.js";
import { ToolCall, type ToolCall as ToolCallType } from "@intx/types/runtime";
import {
ToolCall,
type ToolCall as ToolCallType,
} from "@intx/types/runtime-core";
import { type } from "arktype";

import type { AuthzCallResult } from "@intx/inference";
Expand Down
2 changes: 1 addition & 1 deletion src/session/optimized-context-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TokenUsage,
type ConversationTurn,
type PendingOperation,
} from "@intx/types/runtime";
} from "@intx/types/runtime-core";
import { getLogger } from "@intx/log";
import {
createSegmentedJSONLWriter,
Expand Down
2 changes: 1 addition & 1 deletion src/session/pending-approval-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ApprovalSnapshot,
type PendingOperation,
ToolCall,
} from "@intx/types/runtime";
} from "@intx/types/runtime-core";

/**
* A pending operation as it rests in session state (metadata.json, or a turn
Expand Down
64 changes: 64 additions & 0 deletions src/session/runtime-core-import.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Loading the @intx/types/runtime barrel evaluates inference-events.ts and
// builds the InferenceEvent union. Session modules that need runtime values
// import @intx/types/runtime-core so that boot does not pay for the union.

import { expect, test } from "bun:test";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";

const repoRoot = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"../..",
);

const probe = `
import { mock } from "bun:test";
mock.module("@intx/types/inference-events", () => {
throw new Error("evaluated-inference-events");
});
const specifier = process.env.PROBE_SPECIFIER;
if (specifier === undefined || specifier.length === 0) {
throw new Error("missing PROBE_SPECIFIER");
}
for (const target of specifier.split(",")) {
await import(target);
}
`;

function importUnderProbe(specifier: string): {
status: number | null;
stderr: string;
} {
const result = spawnSync("bun", ["-e", probe], {
cwd: repoRoot,
encoding: "utf8",
env: { ...process.env, PROBE_SPECIFIER: specifier },
});
return {
status: result.status,
stderr: result.stderr,
};
}

const sessionBootModules = [
"./src/session/optimized-context-store.ts",
"./src/session/pending-approval-record.ts",
"./src/session/summarizer.ts",
].join(",");

test("the runtime barrel evaluates the inference event union", () => {
const result = importUnderProbe("@intx/types/runtime");
expect(result.status).not.toBe(0);
expect(result.stderr).toContain("evaluated-inference-events");
});

test(
"session value imports do not evaluate the inference event union",
() => {
const result = importUnderProbe(sessionBootModules);
expect(result.stderr).not.toContain("evaluated-inference-events");
expect(result.status).toBe(0);
},
{ timeout: 60_000 },
);
2 changes: 1 addition & 1 deletion src/session/summarizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
type ConversationTurn,
type InferenceSource,
type RetryPolicy,
} from "@intx/types/runtime";
} from "@intx/types/runtime-core";
import { LOG_NAMESPACE_ROOT } from "../branding.js";
import { NOOP_TELEMETRY, type Telemetry } from "../telemetry/index.js";
import {
Expand Down
Loading