Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
Expand All @@ -13,7 +14,6 @@ import {
decodeHostFrame,
type AgentGraphClientSnapshot,
type AgentGraphOperatorInspection,
RuntimeHostProtocolError,
} from '../protocol/index.js';

const fingerprint = `sha256:${'a'.repeat(64)}` as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import type { ArtifactRecord } from '@maka/core/artifacts';
Expand All @@ -15,7 +16,6 @@ import {
encodeArtifactQueryResult,
encodeProtocolMessage,
RUNTIME_HOST_MAX_MESSAGE_BYTES,
RuntimeHostProtocolError,
} from '../protocol/index.js';
import { encodeArtifactProjection } from '../protocol/artifact.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ import {
RUNTIME_HOST_PROTOCOL_VERSION,
type RequestFrame,
} from '../protocol/index.js';
import {
openRuntimeHostAccessAuthority,
startExecutionRuntimeHostService,
} from '../server/index.js';
import { openRuntimeHostAccessAuthority } from '../server/access-authority.js';
import { startExecutionRuntimeHostService } from '../server/execution-service.js';
import { authorizeRuntimeHostOperation } from '../server/connection-authority.js';

const PROTOCOL = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import { SCHEDULED_TASK_NATIVE_EFFECT_SERVICE_ID } from '@maka/runtime/scheduled-task-tools';
Expand All @@ -8,7 +9,6 @@ import {
decodeClientCapabilityResult,
decodeClientFrame,
decodeHostFrame,
RuntimeHostProtocolError,
} from '../protocol/index.js';

describe('Client Capability protocol', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import { decodeClientFrame, decodeHostFrame } from '../protocol/index.js';
import { RuntimeHostProtocolError } from '../protocol/errors.js';

const EXPECTED = {
connectionId: '00000000-0000-4000-8000-000000000001',
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime-host/src/__tests__/context-protocol.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { decodeClientFrame, decodeHostFrame, RuntimeHostProtocolError } from '../protocol/index.js';
import { decodeClientFrame, decodeHostFrame } from '../protocol/index.js';

test('context operations preserve bounded exact wire values', () => {
assert.deepEqual(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import type { AgentRunInspectDocument, SessionInspectDocument } from '@maka/core/execution-inspect';
Expand All @@ -7,7 +8,6 @@ import {
EXECUTION_INSPECT_CANDIDATE_MAX_ITEMS,
EXECUTION_INSPECT_RESULT_MAX_BYTES,
HOST_OPERATION_SPECS,
RuntimeHostProtocolError,
} from '../protocol/index.js';

describe('execution inspect protocol', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
Expand All @@ -6,7 +7,6 @@ import {
decodeExternalSessionSourceQueryResult,
EXTERNAL_SESSION_PAGE_MAX_ITEMS,
HOST_OPERATION_SPECS,
RuntimeHostProtocolError,
} from '../protocol/index.js';

describe('external Session protocol', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { createServer, Socket, type Server } from 'node:net';
import { test } from 'node:test';
Expand All @@ -6,7 +7,6 @@ import {
RUNTIME_HOST_COMPATIBILITY_EPOCH,
RUNTIME_HOST_MAX_MESSAGE_BYTES,
RUNTIME_HOST_PROTOCOL_VERSION,
RuntimeHostProtocolError,
} from '../protocol/index.js';
import { FramedTransport, RuntimeHostTransportError } from '../transport/framed-transport.js';
import { frameLocalIpcProtocolMessage } from '../transport/local-ipc-framing.js';
Expand Down
67 changes: 33 additions & 34 deletions packages/runtime-host/src/__tests__/host-kernel.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import { defineInteractiveRuntimeHostComposition } from '../server/host-composition.js';
import assert from 'node:assert/strict';
import { execFile, fork, type ChildProcess } from 'node:child_process';
Expand Down Expand Up @@ -42,22 +43,23 @@ import {
RUNTIME_HOST_COMPATIBILITY_EPOCH,
RUNTIME_HOST_MAX_MESSAGE_BYTES,
RUNTIME_HOST_PROTOCOL_VERSION,
RuntimeHostProtocolError,
type ClientFrame,
type ClientSurface,
} from '../protocol/index.js';
import {
RuntimeHostKernel,
RuntimeHostProcessTerminationRequiredError,
startInteractiveRuntimeHostCandidate,
type InteractiveRuntimeHostCandidateOptions,
type InteractiveRuntimeHostCandidateResult,
type RuntimeHostComposition,
type RuntimeHostCompositionContext,
type RuntimeHostCompositionFactory,
type RuntimeHostCompositionSource,
type RuntimeHostKernelOptions,
} from '../server/index.js';
} from '../server/host-kernel.js';
import {
startInteractiveRuntimeHostCandidate,
type InteractiveRuntimeHostCandidateOptions,
type InteractiveRuntimeHostCandidateResult,
} from '../server/candidate.js';
import type { RuntimeHostCompositionSource } from '../server/host-composition.js';
import { createUnavailableDomainOperationHandlers } from '../server/operation-dispatcher.js';
import { HostConfigurationChangeService } from '../server/configuration-change-service.js';
import { HostSessionCatalogChangeService } from '../server/session-catalog-change-service.js';
Expand Down Expand Up @@ -2059,25 +2061,23 @@ describe('non-serving Runtime Host kernel', () => {
}),
RangeError,
);
await assert.rejects(
() =>
connectRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
clientInstanceId: '',
}),
await assert.rejects(() =>
connectRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
clientInstanceId: '',
}),
RuntimeHostProtocolError,
);
await assert.rejects(
() =>
connectOrSpawnRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
compositionId: 'Invalid Composition',
candidateEntrypoint: KERNEL_CANDIDATE_ENTRYPOINT,
}),
await assert.rejects(() =>
connectOrSpawnRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
compositionId: 'Invalid Composition',
candidateEntrypoint: KERNEL_CANDIDATE_ENTRYPOINT,
}),
RuntimeHostProtocolError,
);
await assertPathMissing(paths.root);
Expand All @@ -2088,17 +2088,16 @@ describe('non-serving Runtime Host kernel', () => {
});
assert.equal(candidate.kind, 'winner');
if (candidate.kind !== 'winner') return;
await assert.rejects(
() =>
connectOrSpawnRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
compositionId: KERNEL_COMPOSITION.descriptor.id,
candidateEntrypoint: KERNEL_CANDIDATE_ENTRYPOINT,
clientInstanceId: 'x'.repeat(129),
electionDeadlineMs: 100,
}),
await assert.rejects(() =>
connectOrSpawnRuntimeHost({
rootPath: paths.root,
surface: 'tui',
protocol: CURRENT_PROTOCOL,
compositionId: KERNEL_COMPOSITION.descriptor.id,
candidateEntrypoint: KERNEL_CANDIDATE_ENTRYPOINT,
clientInstanceId: 'x'.repeat(129),
electionDeadlineMs: 100,
}),
RuntimeHostProtocolError,
);
assert.equal(candidate.host.state, 'ready');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import type { InteractionRecord, StoredInteractionRequest } from '@maka/storage/interaction-store';
Expand All @@ -8,7 +9,6 @@ import {
decodeSessionInteractionProjection,
HOST_OPERATION_SPECS,
INTERACTION_MAX_PENDING_PER_SESSION,
RuntimeHostProtocolError,
} from '../protocol/index.js';
import {
answerOutcome,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
Expand All @@ -8,7 +9,6 @@ import {
MEMORY_ENTRY_PAGE_MAX_ITEMS,
MEMORY_RESULT_MAX_BYTES,
RUNTIME_HOST_MAX_MESSAGE_BYTES,
RuntimeHostProtocolError,
} from '../protocol/index.js';

const revision = `sha256:${'a'.repeat(64)}` as const;
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-host/src/__tests__/oauth-protocol.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { test } from 'node:test';
import {
Expand All @@ -6,7 +7,6 @@ import {
decodeOAuthPresentationRequest,
decodeOAuthPresentationResult,
OAUTH_PRESENTATION_AUTHORIZATION_CODE_MAX_LENGTH,
RuntimeHostProtocolError,
} from '../protocol/index.js';

test('OAuth login protocol binds attempt identity and closes terminal projections', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
Expand All @@ -6,7 +7,6 @@ import {
decodeProjectCatalogQueryResult,
HOST_OPERATION_SPECS,
PROJECT_CATALOG_PAGE_MAX_ITEMS,
RuntimeHostProtocolError,
} from '../protocol/index.js';

const projectPath = process.platform === 'win32' ? 'C:\\workspace' : '/workspace';
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-host/src/__tests__/protocol.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import { MAX_ATTACHMENT_BYTES, MAX_ATTACHMENT_COUNT } from '@maka/core/attachments';
Expand Down Expand Up @@ -25,7 +26,6 @@ import {
TURN_MESSAGE_CONTENT_MAX_BYTES,
TURN_MESSAGE_TEXT_MAX_BYTES,
RUNTIME_POLICY_OPERATION_SPECS,
RuntimeHostProtocolError,
} from '../protocol/index.js';
import { HOST_BOOTSTRAP_OPERATION_SPECS } from '../protocol/host-status.js';
import { composeOperationSpecMaps } from '../protocol/operation-spec.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
Expand All @@ -6,7 +7,6 @@ import {
decodeSessionCatalogItem,
decodeSessionCatalogQueryResult,
HOST_OPERATION_SPECS,
RuntimeHostProtocolError,
SESSION_CATALOG_PAGE_MAX_ITEMS,
type SessionCatalogProjection,
} from '../protocol/index.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { fork, type ChildProcess } from 'node:child_process';
import { randomUUID } from 'node:crypto';
Expand Down Expand Up @@ -27,7 +28,6 @@ import {
encodeProtocolMessage,
RUNTIME_HOST_COMPATIBILITY_EPOCH,
RUNTIME_HOST_PROTOCOL_VERSION,
RuntimeHostProtocolError,
type ClientFrame,
type SessionCatalogItem,
type SessionCatalogProjection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { test } from 'node:test';
import {
decodeClientFrame,
decodeHostFrame,
RuntimeHostProtocolError,
SESSION_EFFECT_OPERATION_SPECS,
SESSION_RECAP_RAW_MAX_BYTES,
} from '../protocol/index.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
decodeClientFrame,
decodeHostFrame,
HOST_OPERATION_SPECS,
RuntimeHostProtocolError,
type SessionCatalogProjection,
} from '../protocol/index.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { describe, test } from 'node:test';
import {
decodeClientFrame,
decodeHostFrame,
HOST_OPERATION_SPECS,
RuntimeHostProtocolError,
type SessionCatalogProjection,
} from '../protocol/index.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import test from 'node:test';
import {
Expand All @@ -7,7 +8,6 @@ import {
encodeProtocolMessage,
HOST_OPERATION_SPECS,
RUNTIME_HOST_MAX_MESSAGE_BYTES,
RuntimeHostProtocolError,
SESSION_TRANSCRIPT_PAGE_MAX_BYTES,
} from '../protocol/index.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { mkdir, mkdtemp, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
Expand All @@ -17,7 +18,6 @@ import {
type SkillCatalogPreviewUpdateResult,
type SkillCatalogRevision,
} from '../protocol/index.js';
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import { SkillCatalogRepository } from '../server/skill-catalog-repository.js';

const REVISION = `sha256:${'a'.repeat(64)}` as SkillCatalogRevision;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { chmod, mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
Expand All @@ -9,11 +10,7 @@ import {
buildStarterSkillTemplate,
createManagedSkillLock,
} from '@maka/runtime/skills';
import {
decodeHostFrame,
isSkillCatalogProjectRootLexicallyAbsolute,
RuntimeHostProtocolError,
} from '../protocol/index.js';
import { decodeHostFrame, isSkillCatalogProjectRootLexicallyAbsolute } from '../protocol/index.js';
import type {
SkillCatalogGovernanceItem,
SkillCatalogQueryResult,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RuntimeHostProtocolError } from '../protocol/errors.js';
import assert from 'node:assert/strict';
import { randomUUID } from 'node:crypto';
import { mkdtemp, rm } from 'node:fs/promises';
Expand All @@ -18,7 +19,6 @@ import {
RUNTIME_HOST_COMPATIBILITY_EPOCH,
RUNTIME_HOST_PROTOCOL_VERSION,
RUNTIME_HOST_REGISTRATION_SCHEMA_VERSION,
RuntimeHostProtocolError,
type HostFrame,
type OperationInput,
type OperationOutput,
Expand Down
Loading
Loading