Retain the existing event-sourced application data plane for projects and shell state while making orchestration v2 the sole agent runtime. Adapt v2 events and receipts to the shared infrastructure and remove the v1 provider reactors.
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { expect, it } from "@effect/vitest";
|
|
import {
|
|
EnvironmentId,
|
|
PreviewAutomationUnavailableError,
|
|
ProviderInstanceId,
|
|
ThreadId,
|
|
} from "@t3tools/contracts";
|
|
import * as Effect from "effect/Effect";
|
|
|
|
import * as McpInvocationContext from "./McpInvocationContext.ts";
|
|
|
|
it.effect("reports the scoped credential context when preview capability is unavailable", () => {
|
|
const invocation: McpInvocationContext.McpInvocationScope = {
|
|
environmentId: EnvironmentId.make("environment-1"),
|
|
threadId: ThreadId.make("thread-1"),
|
|
providerSessionId: "provider-session-1",
|
|
providerInstanceId: ProviderInstanceId.make("codex"),
|
|
capabilities: new Set(),
|
|
issuedAt: 1,
|
|
};
|
|
|
|
return Effect.gen(function* () {
|
|
const error = yield* McpInvocationContext.requireMcpCapability("preview").pipe(
|
|
Effect.provideService(McpInvocationContext.McpInvocationContext, invocation),
|
|
Effect.flip,
|
|
);
|
|
|
|
expect(error).toBeInstanceOf(PreviewAutomationUnavailableError);
|
|
expect(error).toMatchObject({
|
|
capability: "preview",
|
|
environmentId: invocation.environmentId,
|
|
threadId: invocation.threadId,
|
|
providerSessionId: invocation.providerSessionId,
|
|
providerInstanceId: invocation.providerInstanceId,
|
|
});
|
|
expect(error.message).toBe("MCP credential does not grant the preview capability.");
|
|
});
|
|
});
|