From 77654b3b5b3db3778b795f65bb966d30acc5d711 Mon Sep 17 00:00:00 2001 From: NekoPunch Date: Sun, 6 Sep 2026 17:06:25 -0700 Subject: [PATCH] chore(cleanup): drop verified dead exports and unused types Remove the dead code that the knip sweep across every workspace and the repository root surfaced, with each symbol verified consumer-free by a repo-wide grep spanning .ts, .tsx, .mjs, .ps1, .py and workflow files: - unused exported functions, types and helpers in runtime (context-budget-helpers, model-history's text-only projection subtree, agent-run-inspect, stream-graph-supervisor-tools, runtime-event-backfill, model-adapter, workspace-executor, compaction-boundary, memory-extraction-proposal, filesystem-authority, plugin-runtime's alias), runtime-host (agent-graph-coordinator, host-kernel, client-capability-coordinator's type re-export, peer-mesh), storage (workspace-version-authority-internal, a fixture's unused helper), cli (workspace-root's type re-exports, an unused wrapper, an unused union) and core (the computer-use action-type alias); - the storage readHead registration plumbing that only fed the deleted readWorkspaceHeadInternal (the live store method and its tests stay); - two dead root-script exports and two ambient .d.mts declarations that no module resolution reaches; - two project-catalog path-limit constants unexported, declared as a compatible extension at the current epoch (123, rebased onto main). Kept deliberately: the decode/encode and PAGE/RANGE codec alias pairs whose both names have live consumers stay as plain aliases so the page and range bounds and the wire contract remain true by construction. Their knip duplicates finding is handled by a scoped ignoreIssues exception for the three alias files in the follow-up gate PR instead of restructuring the declarations. The website keeps its exact cookie@2.0.1 pin: astro's prerenderer resolves it through the website root. The scan configuration that surfaced these (knip.json workspaces) and the CI wiring live in the follow-up gate PR; this PR is deletions only. No behaviour change. Generated-by: Claude Code --- packages/cli/src/activation-command.ts | 1 - .../cli/src/runtime-host-service-manager.ts | 4 - packages/cli/src/workspace-root.ts | 4 - packages/core/src/computer-use.ts | 1 - .../project-catalog-path-limit-unexport.json | 5 + packages/runtime-host/src/peer-mesh/limits.ts | 1 - packages/runtime-host/src/peer-mesh/model.ts | 2 - .../src/protocol/project-catalog.ts | 4 +- .../src/server/agent-graph-coordinator.ts | 6 - .../server/client-capability-coordinator.ts | 2 - .../runtime-host/src/server/host-kernel.ts | 2 - .../src/__tests__/provider-contract-matrix.ts | 2 - packages/runtime/src/agent-run-inspect.ts | 21 --- packages/runtime/src/compaction-boundary.ts | 40 ----- .../runtime/src/context-budget-helpers.ts | 17 -- packages/runtime/src/filesystem-authority.ts | 22 --- .../runtime/src/memory-extraction-proposal.ts | 1 - packages/runtime/src/model-adapter.ts | 2 - packages/runtime/src/model-history.ts | 165 ------------------ packages/runtime/src/plugin-runtime.ts | 6 +- .../runtime/src/runtime-event-backfill.ts | 2 +- .../src/stream-graph-supervisor-tools.ts | 6 - packages/runtime/src/workspace-executor.ts | 4 - .../fixtures/control-directory-hygiene.ts | 27 +-- .../src/claude-code-session-adapter.ts | 2 - packages/storage/src/sqlite-runtime-store.ts | 2 - .../workspace-version-authority-internal.ts | 17 -- scripts/third-party-closure.mjs | 18 +- 28 files changed, 15 insertions(+), 371 deletions(-) create mode 100644 packages/runtime-host/protocol-compatible-changes/project-catalog-path-limit-unexport.json diff --git a/packages/cli/src/activation-command.ts b/packages/cli/src/activation-command.ts index 17511f233b..2da182ec9a 100644 --- a/packages/cli/src/activation-command.ts +++ b/packages/cli/src/activation-command.ts @@ -42,7 +42,6 @@ const ACTIVATION_STIMULUS_TYPES = new Set(['message', 'schedule', 'system']); export type MakaActivationStatus = 'completed' | 'blocked' | 'retryable_failure' | 'fatal_failure'; -export type MakaActivationBlockedReason = 'permission_denied' | 'permission_required'; export type MakaActivationRequiredAction = 'grant_permission' | 'retry_activation'; export interface MakaActivationOptions { diff --git a/packages/cli/src/runtime-host-service-manager.ts b/packages/cli/src/runtime-host-service-manager.ts index 117eb6b128..7f4be78c4e 100644 --- a/packages/cli/src/runtime-host-service-manager.ts +++ b/packages/cli/src/runtime-host-service-manager.ts @@ -1237,10 +1237,6 @@ async function normalizeStateRoot(requestedRoot: string): Promise { } } -export async function resolveRuntimeHostManagedStateRoot(requestedRoot: string): Promise { - return normalizeStateRoot(requestedRoot); -} - async function normalizeProjectDirectoryRoots( roots: readonly { readonly label: string; readonly path: string }[], ): Promise { diff --git a/packages/cli/src/workspace-root.ts b/packages/cli/src/workspace-root.ts index 06a6a668e3..c9f71f920c 100644 --- a/packages/cli/src/workspace-root.ts +++ b/packages/cli/src/workspace-root.ts @@ -24,8 +24,4 @@ export { resolveMakaClientDataRoot, resolveMakaDataRoots, resolveMakaWorkspaceRoot, - type DeriveMakaDataRootsInput, - type MakaDataRoots, - type ResolveMakaClientDataRootInput, - type ResolveMakaWorkspaceRootInput, } from '@maka/storage/workspace-root'; diff --git a/packages/core/src/computer-use.ts b/packages/core/src/computer-use.ts index bf50285a65..bd3cc2d2e3 100644 --- a/packages/core/src/computer-use.ts +++ b/packages/core/src/computer-use.ts @@ -159,7 +159,6 @@ export interface ComputerUseBoundAction extends ComputerUseFrameIdentity { export const CU_ACTION_TYPES = ['screenshot', 'type', 'key', 'wait'] as const; -export const COMPUTER_USE_ACTION_TYPES = CU_ACTION_TYPES; export type CuActionType = (typeof CU_ACTION_TYPES)[number]; /** diff --git a/packages/runtime-host/protocol-compatible-changes/project-catalog-path-limit-unexport.json b/packages/runtime-host/protocol-compatible-changes/project-catalog-path-limit-unexport.json new file mode 100644 index 0000000000..fdb3c2eab1 --- /dev/null +++ b/packages/runtime-host/protocol-compatible-changes/project-catalog-path-limit-unexport.json @@ -0,0 +1,5 @@ +{ + "epoch": 133, + "files": ["packages/runtime-host/src/protocol/project-catalog.ts"], + "reason": "Unexports two path-limit constants that are referenced only inside project-catalog.ts itself; no wire codec, frame, or error-code shape changes and no consumer imports either name" +} diff --git a/packages/runtime-host/src/peer-mesh/limits.ts b/packages/runtime-host/src/peer-mesh/limits.ts index 6eecb5b69f..9116fe8e03 100644 --- a/packages/runtime-host/src/peer-mesh/limits.ts +++ b/packages/runtime-host/src/peer-mesh/limits.ts @@ -21,7 +21,6 @@ export const PEER_MESH_MAX_MEMBERS = 64; export const PEER_MESH_MAX_MESHES = 16; export const PEER_MESH_MAX_PENDING_INVITATIONS = 32; export const PEER_MESH_MAX_INVITATION_RECORDS = PEER_MESH_MAX_PENDING_INVITATIONS * 3; -export const PEER_MESH_MAX_ROUTE_HINTS = 16; export const PEER_MESH_MAX_TRANSIT_RELAY_ADDRESSES = 256; export const PEER_MESH_MAX_TRANSIT_ADDRESSES_PER_RELAY = 4; export const PEER_MESH_MEMBER_ADVERTISEMENT_MAX_BYTES = 2 * 1024; diff --git a/packages/runtime-host/src/peer-mesh/model.ts b/packages/runtime-host/src/peer-mesh/model.ts index 07327e9edb..449a7d9f31 100644 --- a/packages/runtime-host/src/peer-mesh/model.ts +++ b/packages/runtime-host/src/peer-mesh/model.ts @@ -39,10 +39,8 @@ export { PEER_MESH_MAX_MEMBERS, PEER_MESH_MAX_MESHES, PEER_MESH_MAX_PENDING_INVITATIONS, - PEER_MESH_MAX_ROUTE_HINTS, PEER_MESH_MAX_TRANSIT_ADDRESSES_PER_RELAY, PEER_MESH_MAX_TRANSIT_RELAY_ADDRESSES, - PEER_MESH_MEMBER_ADVERTISEMENT_MAX_BYTES, } from './limits.js'; export interface PeerMeshRosterV1 { diff --git a/packages/runtime-host/src/protocol/project-catalog.ts b/packages/runtime-host/src/protocol/project-catalog.ts index cc0ed727dd..5fbc080bb3 100644 --- a/packages/runtime-host/src/protocol/project-catalog.ts +++ b/packages/runtime-host/src/protocol/project-catalog.ts @@ -34,14 +34,14 @@ export const PROJECT_CATALOG_PAGE_MAX_ITEMS = 64; export const PROJECT_CATALOG_PAGE_MAX_BYTES = 48 * 1024; export const PROJECT_CATALOG_CURSOR_MAX_BYTES = 128; export const PROJECT_CATALOG_NAME_MAX_BYTES = 16 * 1024; -export const PROJECT_CATALOG_PATH_MAX_BYTES = 4 * 1024; +const PROJECT_CATALOG_PATH_MAX_BYTES = 4 * 1024; export const PROJECT_DIRECTORY_PAGE_MAX_ITEMS = 128; export const PROJECT_DIRECTORY_PAGE_MAX_BYTES = 32 * 1024; export const PROJECT_DIRECTORY_MAX_ENTRIES = 4_096; export const PROJECT_DIRECTORY_MAX_ROOTS = 8; export const PROJECT_DIRECTORY_MAX_SEGMENTS = 64; export const PROJECT_DIRECTORY_ROOT_LABEL_MAX_BYTES = 128; -export const PROJECT_DIRECTORY_ROOT_PATH_MAX_BYTES = PROJECT_CATALOG_PATH_MAX_BYTES; +const PROJECT_DIRECTORY_ROOT_PATH_MAX_BYTES = PROJECT_CATALOG_PATH_MAX_BYTES; export const PROJECT_DIRECTORY_SEGMENT_MAX_BYTES = 255; const PROJECT_DIRECTORY_ROOT_TEXT_ENCODER = new TextEncoder(); diff --git a/packages/runtime-host/src/server/agent-graph-coordinator.ts b/packages/runtime-host/src/server/agent-graph-coordinator.ts index 6060b12631..166655fb6b 100644 --- a/packages/runtime-host/src/server/agent-graph-coordinator.ts +++ b/packages/runtime-host/src/server/agent-graph-coordinator.ts @@ -211,12 +211,6 @@ export function projectAgentGraphClientSnapshot( return projectSnapshot(snapshot); } -export function projectAgentGraphOperatorInspection( - inspection: RuntimeAgentGraphOperatorInspection, -): AgentGraphOperatorInspection { - return projectInspection(inspection); -} - function projectSnapshot(snapshot: RuntimeAgentGraphClientSnapshot): AgentGraphClientSnapshot { const operators = snapshot.operators.slice(0, AGENT_GRAPH_MAX_OPERATORS).map(projectOperator); const visibleOperatorIds = new Set(operators.map((operator) => operator.operatorId)); diff --git a/packages/runtime-host/src/server/client-capability-coordinator.ts b/packages/runtime-host/src/server/client-capability-coordinator.ts index 0a82ffd537..53f6872ff7 100644 --- a/packages/runtime-host/src/server/client-capability-coordinator.ts +++ b/packages/runtime-host/src/server/client-capability-coordinator.ts @@ -45,7 +45,6 @@ import { import { ClientCapabilityInvocationBroker, ClientCapabilityInvocationError, - type ClientCapabilityInvocationFailure, } from './client-capability-invocation-broker.js'; import type { ClientCapabilityOperationHandlerMap, @@ -78,7 +77,6 @@ const DESKTOP_BROWSER_TOOLS = new Set([ const DESKTOP_SETTINGS_TOOLS = new Set(['MakaClientSettingsGet', 'MakaClientSettingsUpdate']); export { ClientCapabilityInvocationError }; -export type { ClientCapabilityInvocationFailure }; export interface ClientCapabilitySnapshot { readonly registrationIds: readonly string[]; diff --git a/packages/runtime-host/src/server/host-kernel.ts b/packages/runtime-host/src/server/host-kernel.ts index ca9ffb71bf..84650f1c59 100644 --- a/packages/runtime-host/src/server/host-kernel.ts +++ b/packages/runtime-host/src/server/host-kernel.ts @@ -182,8 +182,6 @@ interface RuntimeHostKernelCommonOptions { }; } -export type RuntimeHostLifecycleMode = 'ephemeral' | 'service'; - export type RuntimeHostKernelOptions = RuntimeHostKernelCommonOptions & ( | { diff --git a/packages/runtime/src/__tests__/provider-contract-matrix.ts b/packages/runtime/src/__tests__/provider-contract-matrix.ts index 6bf1fd7187..d10c6d267b 100644 --- a/packages/runtime/src/__tests__/provider-contract-matrix.ts +++ b/packages/runtime/src/__tests__/provider-contract-matrix.ts @@ -62,8 +62,6 @@ export const PROVIDER_CONTRACT_DIMENSIONS = [ export type ProviderContractDimension = (typeof PROVIDER_CONTRACT_DIMENSIONS)[number]; -export type ProviderContractCellState = 'generated' | 'override' | 'not-applicable'; - /** The four request wires a generated cell can be executed against. */ export type ProviderContractWire = | 'openai-chat' diff --git a/packages/runtime/src/agent-run-inspect.ts b/packages/runtime/src/agent-run-inspect.ts index b53cef5443..f9ff341ee3 100644 --- a/packages/runtime/src/agent-run-inspect.ts +++ b/packages/runtime/src/agent-run-inspect.ts @@ -162,27 +162,6 @@ export async function inspectAgentRunReadModel( }; } -export async function inspectSessionRunReadModels( - runStore: AgentRunInspectReader, - runtimeEventStore: RuntimeEventInspectReader, - sessionId: string, - options: Pick = {}, -): Promise { - const invocations = await runtimeEventStore.listSessionInvocations(sessionId); - const models: AgentRunInspectModel[] = []; - for (const invocation of invocations) { - models.push( - await inspectAgentRunReadModel(runStore, runtimeEventStore, { - sessionId, - runId: invocation.runId, - invocation, - ...(options.isFatalReadError ? { isFatalReadError: options.isFatalReadError } : {}), - }), - ); - } - return models; -} - // A run is not its invocation: a continuation is a new run on the invocation it // resumes. This reader is addressed by run, so it looks the invocation up by the // id it was actually given. diff --git a/packages/runtime/src/compaction-boundary.ts b/packages/runtime/src/compaction-boundary.ts index aa71b9d9cf..54bcfe2e2a 100644 --- a/packages/runtime/src/compaction-boundary.ts +++ b/packages/runtime/src/compaction-boundary.ts @@ -39,46 +39,6 @@ export interface CompactionCoverage { providerMessageSourceIds?: readonly string[]; } -export interface CompactionArchiveRef { - kind: 'toolResult' | 'runtimeEventSource' | 'compactSource'; - sessionId?: string; - turnId?: string; - runtimeEventId?: string; - toolCallId?: string; - toolName?: string; - artifactId: string; - bodySha256: string; - originalEstimatedTokens?: number; - originalBytes?: number; -} - -export interface CompactionBoundary { - kind: CompactionBoundaryKind; - stage: CompactionStage; - schemaVersion: number; - boundaryId: string; - predecessorBoundaryId?: string; - cumulativeCoverageDigest?: string; - sessionId: string; - createdAt?: number; - highWaterName?: string; - highWaterSeq?: number; - coverage: CompactionCoverage; - preservedAnchor?: { - headProviderMessageSourceIds?: readonly string[]; - headRuntimeEventIds?: readonly string[]; - tailRuntimeEventIds?: readonly string[]; - tailProviderMessageSourceIds?: readonly string[]; - tailTurnIds?: readonly string[]; - }; - archiveRefs?: readonly CompactionArchiveRef[]; - sourceHashes?: readonly string[]; - renderedText?: string; - estimatedTokens?: number; - validationStatus?: 'valid' | 'invalid' | 'notValidated'; - validationReason?: string; -} - export interface CompactionDecision { stage: CompactionStage; sourceKind: CompactionSourceKind; diff --git a/packages/runtime/src/context-budget-helpers.ts b/packages/runtime/src/context-budget-helpers.ts index b66e78aa1b..866f6b1be7 100644 --- a/packages/runtime/src/context-budget-helpers.ts +++ b/packages/runtime/src/context-budget-helpers.ts @@ -50,23 +50,10 @@ export function turnKey(event: RuntimeEvent): string { return event.turnId || ''; } -export function uniqueSorted(values: readonly string[]): string[] { - return [...new Set(values.filter((value) => value.length > 0))].sort(); -} - export function sha256(text: string): string { return createHash('sha256').update(text).digest('hex'); } -export function stableStringify(value: unknown): string { - if (value === undefined) return ''; - try { - return JSON.stringify(value) ?? ''; - } catch { - return String(value); - } -} - export function finitePositive(value: number | undefined): number | undefined { return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) @@ -76,7 +63,3 @@ export function finitePositive(value: number | undefined): number | undefined { export function utf8ByteLength(text: string): number { return Buffer.byteLength(text, 'utf8'); } - -export function optionalNonNegativeFiniteNumber(value: unknown): boolean { - return value === undefined || (typeof value === 'number' && Number.isFinite(value) && value >= 0); -} diff --git a/packages/runtime/src/filesystem-authority.ts b/packages/runtime/src/filesystem-authority.ts index 2e46d2de00..53935db373 100644 --- a/packages/runtime/src/filesystem-authority.ts +++ b/packages/runtime/src/filesystem-authority.ts @@ -45,28 +45,6 @@ export interface FilesystemTargetIdentity { readonly ino: string; } -/** - * The full target descriptor captured at lock acquisition (the earliest point a - * mutation commits to a path). Modelled as a discriminated union so that - * "the target had no identity to compare" is an explicit `missing` case, - * never an accidentally-absent optional field. A later "skip the identity - * check" change cannot compile without handling the `missing` arm, which is - * what closes the "no identity → CAS passes" regression class. - * - * - `missing`: the path did not exist at capture (a create, or a write to a - * brand-new file). There is no inode to pin; the missing→existing transition - * is detected by `O_EXCL` / `wx` instead. - * - the other variants carry the captured inode, which the worker compares - * against the on-disk inode immediately before mutating. - */ -export type FilesystemTargetDescriptor = - | { readonly enforcementPath: string; readonly targetType: 'missing' } - | { - readonly enforcementPath: string; - readonly targetType: 'file' | 'directory' | 'symlink' | 'other'; - readonly identity: FilesystemTargetIdentity; - }; - /** * The outcome a mutation can report. Distinct from "did the tool call succeed" * — a tool that fails to apply is `rejected`; a tool that may have applied diff --git a/packages/runtime/src/memory-extraction-proposal.ts b/packages/runtime/src/memory-extraction-proposal.ts index e24bedb2eb..6685e2ac24 100644 --- a/packages/runtime/src/memory-extraction-proposal.ts +++ b/packages/runtime/src/memory-extraction-proposal.ts @@ -58,7 +58,6 @@ const memoryProposalItemSchema = z const canonicalMemoryItemSchema = memoryProposalItemSchema.omit({ evidence: true }); export type MemoryProposalItem = z.infer; -export type CanonicalMemoryItem = z.infer; const memoryCanonicalizationSchema = z .object({ diff --git a/packages/runtime/src/model-adapter.ts b/packages/runtime/src/model-adapter.ts index 8ea09b9e84..cd10443b8d 100644 --- a/packages/runtime/src/model-adapter.ts +++ b/packages/runtime/src/model-adapter.ts @@ -49,8 +49,6 @@ export type { ModelStepOutcome, ModelFinishReason, ModelFailure, - ModelFailureKind, - ModelRequestMetadata, ModelToolSet, } from './model-protocol.js'; diff --git a/packages/runtime/src/model-history.ts b/packages/runtime/src/model-history.ts index ea452dbbcf..9075969977 100644 --- a/packages/runtime/src/model-history.ts +++ b/packages/runtime/src/model-history.ts @@ -256,22 +256,6 @@ export function groupEventsByTurn( })); } -// ============================================================================ -// Output type -// ============================================================================ - -/** - * One model-facing history entry. `content` is the canonical - * RuntimeEventContent (discriminated by `kind`); `role` is the - * model-history lane the entry plays for the next model call. - */ -export interface ModelHistoryEntry { - role: RuntimeEventRole; - content: RuntimeEventContent; - ts: number; - eventId: string; -} - export interface TextModelMessage { role: 'user' | 'assistant' | 'system'; content: string; @@ -509,94 +493,10 @@ export interface RuntimeEventModelReplayPlan { hasProviderNativeSemantics: boolean; } -// ============================================================================ -// Options -// ============================================================================ - -export interface BuildModelHistoryOptions { - /** - * Include function_call / function_response entries. Default `true`. - * Set `false` for providers whose replay format cannot represent prior - * tool turns (the V0.1 ai-sdk text-only replay path). - */ - includeToolEvents?: boolean; - /** - * Include system-role events (system notes / instructions). Default - * `false`. System instructions are normally injected fresh by the - * runner each turn, not replayed from durable history. - */ - includeSystemEvents?: boolean; - /** - * Include thinking-content entries. Default `false`. Thinking replay - * is provider-specific (Anthropic signed signatures); callers that - * need it opt in and reattach signatures from the event content. - */ - includeThinking?: boolean; -} - // ============================================================================ // Projection // ============================================================================ -/** - * Build the model-visible history from a RuntimeEvent stream. - * - * Events SHOULD be supplied in causal order; the projection preserves - * input order. Partial events are always excluded — callers MUST NOT - * replay transient streaming chunks into the next model call. - * - * The default options match the durable-history policy: user/model text - * and tool calls/responses are kept; thinking, system notes, token usage, - * permission acks, and diagnostics are dropped. - */ -export function buildModelHistoryFromRuntimeEvents( - events: readonly RuntimeEvent[], - options: BuildModelHistoryOptions = {}, -): ModelHistoryEntry[] { - const includeToolEvents = options.includeToolEvents ?? true; - const includeSystemEvents = options.includeSystemEvents ?? false; - const includeThinking = options.includeThinking ?? false; - - const out: ModelHistoryEntry[] = []; - for (const event of events) { - // 1. Never replay transient streaming chunks. - if (isPartialRuntimeEvent(event)) continue; - - // 2. Only model-visible content kinds (text/thinking/function_*). - if (!runtimeEventHasModelVisibleContent(event)) continue; - - const content = event.content; - if (!content) continue; - - // 3. System-role events are UI notes by default; opt in for - // model-injected system instructions. - if (event.role === 'system' && !includeSystemEvents) continue; - - // 4. Thinking replay is provider-specific; opt in. - if (content.kind === 'thinking' && !includeThinking) continue; - - // 5. Tool function_call / function_response; opt out for text-only. - if ( - !includeToolEvents && - (content.kind === 'function_call' || content.kind === 'function_response') - ) { - continue; - } - - out.push({ - role: event.role, - content, - ts: event.ts, - eventId: event.id, - }); - } - return out; -} - -export interface RuntimeEventTextMessageOptions { - includeSystemEvents?: boolean; -} - export interface BuildRuntimeEventModelReplayPlanOptions { includeSystemEvents?: boolean; /** @@ -1054,47 +954,6 @@ export function buildRuntimeEventModelReplayPlan( }; } -/** - * Convert projected RuntimeEvent history into the current AI SDK text-only - * message shape. Tool/function and thinking entries are intentionally skipped. - */ -export function buildTextModelMessagesFromRuntimeEvents( - events: readonly RuntimeEvent[], - options: RuntimeEventTextMessageOptions = {}, -): TextModelMessage[] { - const history = buildModelHistoryFromRuntimeEvents(events, { - includeToolEvents: false, - includeSystemEvents: options.includeSystemEvents ?? false, - includeThinking: false, - }); - const out: TextModelMessage[] = []; - for (const entry of history) { - if (entry.content.kind !== 'text') continue; - if (entry.role === 'tool') continue; - if (entry.role === 'system' && !options.includeSystemEvents) continue; - const role = - entry.role === 'model' - ? 'assistant' - : entry.role === 'user' - ? 'user' - : entry.role === 'system' - ? 'system' - : undefined; - if (!role) continue; - const steering = entry.content.steering === true && role === 'user'; - out.push({ - role, - content: steering - ? buildSteeringEnvelope(formatTextWithInlineRefs(entry.content)) - : formatTextWithInlineRefs(entry.content), - // Keep the structured identity even in the text-only shape: dedupe - // against the live injection set works by ledger event id. - ...(steering ? { providerOptions: steeringProviderOptions(entry.eventId) } : {}), - }); - } - return out; -} - function modelTextRole(role: RuntimeEventRole): TextModelMessage['role'] | undefined { switch (role) { case 'user': @@ -1199,30 +1058,6 @@ export function steeringMessagesMissingFromBase( }); } -/** - * The messages with THIS TURN'S injected steering removed (transport-retry - * base). Only the injected set may be stripped: the retry attempt's own - * request projection re-appends exactly that accumulator, while a historical, - * ledger-replayed steering message (same marker, different event id) is part - * of the base that nothing re-appends — stripping it would erase it from - * every post-retry request. - */ -export function stripSteeringMessages( - messages: readonly ModelMessage[], - injected: readonly ModelMessage[], -): ModelMessage[] { - const ids = new Set(); - for (const message of injected) { - const eventId = steeringEventIdOf(message); - if (eventId !== undefined) ids.add(eventId); - } - if (ids.size === 0) return [...messages]; - return messages.filter((message) => { - const eventId = steeringEventIdOf(message); - return eventId === undefined || !ids.has(eventId); - }); -} - /** * Fold a user turn's inline references into its model-facing text. Attachments * render as a name/type block with exact Read instructions when the reference diff --git a/packages/runtime/src/plugin-runtime.ts b/packages/runtime/src/plugin-runtime.ts index 5565a5fa27..90e6292973 100644 --- a/packages/runtime/src/plugin-runtime.ts +++ b/packages/runtime/src/plugin-runtime.ts @@ -622,12 +622,10 @@ export function fiberStateName(state: FiberState): MakaCompositionEntryStatus { ] as MakaCompositionEntryStatus; } -export function isCanonicalPluginId(value: unknown): value is string { +export function isCanonicalExtensionId(value: unknown): value is string { return typeof value === 'string' && value.length <= 128 && ID_PATTERN.test(value); } -export const isCanonicalExtensionId = isCanonicalPluginId; - function cloneCompositionEntry(entry: MakaCompositionEntry): MakaCompositionEntry { return { ...entry, @@ -685,7 +683,7 @@ export function isCanonicalExtensionScopeId(value: unknown): value is string { } function validatePluginId(value: unknown, label: string): asserts value is string { - if (!isCanonicalPluginId(value)) { + if (!isCanonicalExtensionId(value)) { throw new MakaPluginRuntimeError('invalid_entry', `Invalid ${label}`); } } diff --git a/packages/runtime/src/runtime-event-backfill.ts b/packages/runtime/src/runtime-event-backfill.ts index 4c33befd1f..df7a49d894 100644 --- a/packages/runtime/src/runtime-event-backfill.ts +++ b/packages/runtime/src/runtime-event-backfill.ts @@ -31,7 +31,7 @@ import type { import type { RuntimeEvent, RuntimeEventStatus } from '@maka/core/runtime-event'; import { createRuntimeEventId } from '@maka/core/runtime-event'; -export const RUNTIME_EVENT_BACKFILL_STATE_KEY = 'makaRuntimeRecovery'; +const RUNTIME_EVENT_BACKFILL_STATE_KEY = 'makaRuntimeRecovery'; export type RuntimeEventBackfillDiagnosticCode = | 'skipped_high_risk_message' diff --git a/packages/runtime/src/stream-graph-supervisor-tools.ts b/packages/runtime/src/stream-graph-supervisor-tools.ts index 0657ba9501..df4328bbe5 100644 --- a/packages/runtime/src/stream-graph-supervisor-tools.ts +++ b/packages/runtime/src/stream-graph-supervisor-tools.ts @@ -50,12 +50,6 @@ import type { MakaTool, MakaToolContext } from './tool-runtime.js'; export const VIEW_AGENT_GRAPH_TOOL_NAME = 'view_agent_graph'; export const UPDATE_AGENT_GRAPH_TOOL_NAME = 'update_agent_graph'; export const YIELD_AGENT_GRAPH_TOOL_NAME = 'yield_agent_graph'; -export const AGENT_GRAPH_SUPERVISOR_TOOL_NAMES = [ - VIEW_AGENT_GRAPH_TOOL_NAME, - UPDATE_AGENT_GRAPH_TOOL_NAME, - YIELD_AGENT_GRAPH_TOOL_NAME, -] as const; - const TOOL_VIEW_MAX_TERMINAL_WORK = 64; const TOOL_VIEW_MAX_STOPPED_TARGETS = 64; const TOOL_VIEW_MAX_INSTRUCTION_CHARS = 2_000; diff --git a/packages/runtime/src/workspace-executor.ts b/packages/runtime/src/workspace-executor.ts index 6fa76ee09f..f6fb22c7c9 100644 --- a/packages/runtime/src/workspace-executor.ts +++ b/packages/runtime/src/workspace-executor.ts @@ -44,10 +44,6 @@ import type { ImageMimeType } from './image-file.js'; const execAsync = promisify(exec); const execFileAsync = promisify(execFile); -export type WorkspaceIsolationKind = ToolExecutionFacts['isolation']; -export type WorkspaceWriteBackMode = ToolExecutionFacts['writeBack']; -export type WorkspaceNetworkMode = ToolExecutionFacts['network']; -export type WorkspaceSecretMode = ToolExecutionFacts['secrets']; export type WorkspaceExecutorFacts = ToolExecutionFacts; export const LOCAL_WORKSPACE_EXECUTOR_FACTS: WorkspaceExecutorFacts = { diff --git a/packages/storage/src/__tests__/fixtures/control-directory-hygiene.ts b/packages/storage/src/__tests__/fixtures/control-directory-hygiene.ts index b4b969adbc..b0e9db3a26 100644 --- a/packages/storage/src/__tests__/fixtures/control-directory-hygiene.ts +++ b/packages/storage/src/__tests__/fixtures/control-directory-hygiene.ts @@ -17,12 +17,11 @@ * under the License. */ -import { readFile, rm } from 'node:fs/promises'; +import { rm } from 'node:fs/promises'; import { join } from 'node:path'; import { resolveRootControlNamespace, resolveRootOwnershipNamespace, - STORAGE_ROOT_MARKER_FILE, } from '../../root-authority.js'; // A storage root's control directory lives under the real OS account home, not @@ -42,30 +41,6 @@ export async function removeControlDirectory(rootId: string): Promise { ]); } -/** - * Removes the control directory belonging to a storage root path, reading the - * rootId from the root's own marker file. - * - * Only usable while the root still exists. A test that removes or quarantines - * its root before teardown has already destroyed the marker that names the - * control directory, so such tests must record the rootId at resolution time - * with `trackControlDirectory` instead. - */ -export async function removeControlDirectoryForRootPath(rootPath: string): Promise { - const marker = await readFile(join(rootPath, STORAGE_ROOT_MARKER_FILE), 'utf8').catch( - () => undefined, - ); - if (marker === undefined) return; - let rootId: unknown; - try { - rootId = (JSON.parse(marker) as { rootId?: unknown }).rootId; - } catch { - return; - } - if (typeof rootId !== 'string') return; - await removeControlDirectory(rootId); -} - const trackedRootIds = new Set(); /** diff --git a/packages/storage/src/claude-code-session-adapter.ts b/packages/storage/src/claude-code-session-adapter.ts index 0d5cb83b28..73de404977 100644 --- a/packages/storage/src/claude-code-session-adapter.ts +++ b/packages/storage/src/claude-code-session-adapter.ts @@ -354,8 +354,6 @@ function timestampMs(record: TranscriptRecord): number | undefined { return undefined; } -export default ClaudeCodeSessionAdapter; - /* ------------------------------------------------------------------ * * Transcript -> StoredMessage[] * ------------------------------------------------------------------ */ diff --git a/packages/storage/src/sqlite-runtime-store.ts b/packages/storage/src/sqlite-runtime-store.ts index 8e731946c0..292090846a 100644 --- a/packages/storage/src/sqlite-runtime-store.ts +++ b/packages/storage/src/sqlite-runtime-store.ts @@ -1912,14 +1912,12 @@ export class SqliteRuntimeStore } private registerWorkspaceBaselineAuthorityWriter(): void { - const readWorkspaceHead = this.readWorkspaceHead.bind(this); registerWorkspaceBaselineAuthorityWriterInternal( this, (input, rootId) => this.#commitWorkspaceBaseline(input, rootId), (input, rootId) => this.#commitWorkspaceSuccessor(input, rootId), (input, rootId) => this.#commitManagedMutationTerminal(input, rootId), (rootId) => this.#bindWorkspaceStorageRoot(rootId), - readWorkspaceHead, (workspaceInstanceId) => this.#readActiveManagedMutation(workspaceInstanceId), ); } diff --git a/packages/storage/src/workspace-version-authority-internal.ts b/packages/storage/src/workspace-version-authority-internal.ts index 2ecf8985e8..4a149ae51a 100644 --- a/packages/storage/src/workspace-version-authority-internal.ts +++ b/packages/storage/src/workspace-version-authority-internal.ts @@ -81,10 +81,6 @@ type WorkspaceSuccessorCandidateVerifier = ( candidateOutcome: object, ) => WorkspaceSuccessorAuthorityInput; type ManagedMutationNoEffectVerifier = (noEffectOutcome: object) => ManagedMutationNoEffectClaimV1; -type WorkspaceHeadReader = ( - workspaceId: string, - workspaceEpochId: string, -) => Promise; export interface ManagedMutationReservationRecordV1 { readonly workspaceInstanceId: string; readonly repositoryId: string; @@ -111,7 +107,6 @@ interface WorkspaceBaselineAuthorityRegistration { candidateVerifier?: WorkspaceSuccessorCandidateVerifier; noEffectVerifier?: ManagedMutationNoEffectVerifier; readonly terminalWriter: ManagedMutationTerminalAuthorityWriter; - readonly readHead: WorkspaceHeadReader; readonly readActiveManagedMutation: ManagedMutationReservationReader; readonly bindStorageRoot: WorkspaceStorageRootBinder; boundRootId?: string; @@ -128,7 +123,6 @@ export function registerWorkspaceBaselineAuthorityWriterInternal( successorWriter: WorkspaceSuccessorAuthorityWriter, terminalWriter: ManagedMutationTerminalAuthorityWriter, bindStorageRoot: WorkspaceStorageRootBinder, - readHead: WorkspaceHeadReader, readActiveManagedMutation: ManagedMutationReservationReader, ): void { if (workspaceBaselineAuthorityWriters.has(store)) { @@ -138,7 +132,6 @@ export function registerWorkspaceBaselineAuthorityWriterInternal( writer, successorWriter, terminalWriter, - readHead, readActiveManagedMutation, bindStorageRoot, }); @@ -153,16 +146,6 @@ export function readActiveManagedMutationInternal( return registration.readActiveManagedMutation(workspaceInstanceId); } -export function readWorkspaceHeadInternal( - store: object, - workspaceId: string, - workspaceEpochId: string, -): Promise { - const registration = workspaceBaselineAuthorityWriters.get(store); - if (!registration) throw new Error('Workspace baseline authority reader is unavailable'); - return registration.readHead(workspaceId, workspaceEpochId); -} - /** * Storage-internal authority seam. This module is deliberately absent from the * @maka/storage package exports. The schema-9 reader, migration, and projection diff --git a/scripts/third-party-closure.mjs b/scripts/third-party-closure.mjs index 0db154c40a..4ae4a9963d 100644 --- a/scripts/third-party-closure.mjs +++ b/scripts/third-party-closure.mjs @@ -136,20 +136,10 @@ export function collectWorkspaceClosure({ workspaceName, manifestPath }) { } /** - * Every package name that may legitimately appear under the workspace's - * packaged `node_modules` — the production closure, workspace packages - * included. electron-builder walks exactly this graph, so anything in the - * archive outside it is a leak regardless of how it got there. - */ -export function collectProductionNames(workspaceName) { - return new Set(collectProductionClosure(workspaceName).keys()); -} - -/** - * The same closure as `collectProductionNames`, keyed by name with the exact - * versions npm resolved. Verifying by name alone accepted an archive carrying - * a different version of a permitted package, which is the shape a - * substitution attack takes: a name that belongs, at a version that does not. + * The production closure, keyed by name with the exact versions npm resolved. + * Verifying by name alone accepted an archive carrying a different version of + * a permitted package, which is the shape a substitution attack takes: a name + * that belongs, at a version that does not. * * A workspace package has no version in the tree; it maps to `undefined`, and * the archive's own manifest is compared against that the same way.