Add MCP thread management and Codex turn mapping
- Add scoped thread list, read, send, wait, and interrupt tools - Track creation provenance and map provider turns across adapters - Centralize thread lifecycle operations in a management service
This commit is contained in:
1 parent
1f90765b5f
commit
fdcbae983d
38 files changed
+2085
-48
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import { expect, it } from "@effect/vitest";
|
||||
import {
|
||||
CommandId,
|
||||
type OrchestrationV2Command,
|
||||
ProjectId,
|
||||
ProviderInstanceId,
|
||||
RunId,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
|
||||
import { withCreationProvenance } from "./ThreadManagementService.ts";
|
||||
|
||||
it("stamps authoritative provenance on commands that create threads or messages", () => {
|
||||
const command: OrchestrationV2Command = {
|
||||
type: "thread.create",
|
||||
createdBy: "agent",
|
||||
creationSource: "mcp",
|
||||
commandId: CommandId.make("command:thread-management:create"),
|
||||
threadId: ThreadId.make("thread:thread-management:create"),
|
||||
projectId: ProjectId.make("project:thread-management"),
|
||||
title: "Thread management",
|
||||
modelSelection: {
|
||||
instanceId: ProviderInstanceId.make("codex"),
|
||||
model: "gpt-5-codex",
|
||||
},
|
||||
runtimeMode: "full-access",
|
||||
interactionMode: "default",
|
||||
branch: null,
|
||||
worktreePath: null,
|
||||
};
|
||||
|
||||
expect(
|
||||
withCreationProvenance(command, {
|
||||
createdBy: "user",
|
||||
creationSource: "web",
|
||||
}),
|
||||
).toMatchObject({
|
||||
createdBy: "user",
|
||||
creationSource: "web",
|
||||
});
|
||||
});
|
||||
|
||||
it("leaves commands that do not create durable authored content unchanged", () => {
|
||||
const command: OrchestrationV2Command = {
|
||||
type: "run.interrupt",
|
||||
commandId: CommandId.make("command:thread-management:interrupt"),
|
||||
threadId: ThreadId.make("thread:thread-management:interrupt"),
|
||||
runId: RunId.make("run:thread-management:interrupt"),
|
||||
};
|
||||
|
||||
expect(
|
||||
withCreationProvenance(command, {
|
||||
createdBy: "user",
|
||||
creationSource: "web",
|
||||
}),
|
||||
).toBe(command);
|
||||
});
|
||||
Reference in new issue
Block a user