diff --git a/apps/hub/package.json b/apps/hub/package.json index 418d0c4db0..9257b6c754 100644 --- a/apps/hub/package.json +++ b/apps/hub/package.json @@ -15,6 +15,7 @@ "@chat-adapter/state-memory": "^4.35.0", "@corbits/agent-directory": "workspace:*", "@corbits/agent-lifecycle": "workspace:*", + "@corbits/agent-runtime": "workspace:*", "@corbits/approvals": "workspace:*", "@corbits/artifacts": "github:corbitsdev/corbits-artifacts#dc435ba749b4378f19e5de772159c2a57e932938", "@corbits/artifacts-hub": "workspace:*", diff --git a/packages/chat/test/noop-inference.test.ts b/apps/hub/src/e2e/noop-inference.test.ts similarity index 98% rename from packages/chat/test/noop-inference.test.ts rename to apps/hub/src/e2e/noop-inference.test.ts index c160631aaf..8b89fee9c3 100644 --- a/packages/chat/test/noop-inference.test.ts +++ b/apps/hub/src/e2e/noop-inference.test.ts @@ -9,7 +9,7 @@ // up here, not only when a real workbench host tries to use it. import { describe, expect, test } from "bun:test"; import { type } from "arktype"; -import { createNoopInferenceRoutes } from "../src/noop-inference"; +import { createNoopInferenceRoutes } from "./noop-inference"; const ContentBlockDelta = type({ type: "'content_block_delta'", diff --git a/packages/chat/src/noop-inference.ts b/apps/hub/src/e2e/noop-inference.ts similarity index 100% rename from packages/chat/src/noop-inference.ts rename to apps/hub/src/e2e/noop-inference.ts diff --git a/apps/hub/src/grant-conditions.ts b/apps/hub/src/grant-conditions.ts new file mode 100644 index 0000000000..bac60ca472 --- /dev/null +++ b/apps/hub/src/grant-conditions.ts @@ -0,0 +1,12 @@ +import { timeWindowEvaluator } from "@intx/authz"; +import type { ConditionRegistry } from "@intx/types/authz"; + +/** + * Grant conditions the hub evaluates on every mount that takes a + * `conditionRegistry`. Nothing here is chat-specific: `time_window` is + * `@intx/authz`'s own evaluator, matching the default `mountHubRoutes` + * builds when no registry is supplied. + */ +export const grantConditionRegistry: ConditionRegistry = { + time_window: timeWindowEvaluator, +}; diff --git a/apps/hub/src/index.ts b/apps/hub/src/index.ts index ead26347e8..f8ed4dcabe 100644 --- a/apps/hub/src/index.ts +++ b/apps/hub/src/index.ts @@ -30,8 +30,6 @@ import { createEnvKeyCredentialCipher, createNoopCredentialCipher, } from "@intx/crypto"; -import { timeWindowEvaluator } from "@intx/authz"; -import type { ConditionRegistry } from "@intx/types/authz"; import type { CredentialCipher } from "@intx/types"; import { createApp, @@ -50,27 +48,18 @@ import { isPlannerCreatedDefinitionName } from "@corbits/agent-directory"; import { DEFAULT_TURN_CLAIM_TTL_MS, - createArtifactDeliveryHandler, - createDrizzleAgentTurnStore, - createInMemoryTurnClaimStore, createWorkbenchHostInferencePreferencesResolver, createWorkbenchSubscriberRegistry, - createWorkbenchTurnQueue, createTurnCancelRegistry, - createChatOrchestrator, createChatRoutes, createDrizzleBlockResponseStore, createDrizzleChatStore, - createDrizzleClientIdStore, createDrizzleNativePrincipalStore, createDrizzlePinStore, createDrizzleReactionStore, createDrizzleRoomMessageStore, createDrizzleThreadStore, - createDrizzleTurnMailCorrelationStore, - createDrizzleWriteClaimStore, createHubChatPlatform, - createNoopInferenceRoutes, createRelaunchNoticePoster, createRunTriggerClient, createWorkflowParticipantRoutes, @@ -83,6 +72,16 @@ import { tagCredentialCipher, verifyInternalRunTriggerToken, } from "@corbits/chat"; +import { + createArtifactDeliveryHandler, + createChatOrchestrator, + createDrizzleAgentTurnStore, + createDrizzleClientIdStore, + createDrizzleTurnMailCorrelationStore, + createDrizzleWriteClaimStore, + createInMemoryTurnClaimStore, + createWorkbenchTurnQueue, +} from "@corbits/agent-runtime"; import { createDrizzleMailboxWriter, type MailboxFanoutDeps, @@ -173,6 +172,8 @@ import { } from "@intx/hub-sessions"; import { createLaunchCaches } from "./launch-caches"; import { hubErrorHandler } from "./hub-error-handler"; +import { grantConditionRegistry } from "./grant-conditions"; +import { createNoopInferenceRoutes } from "./e2e/noop-inference"; import { wireMailRedelivery } from "./mail-redelivery"; import { getLogger, setup } from "@intx/log"; import { hexEncode } from "@intx/types"; @@ -1152,16 +1153,11 @@ export async function createHub(config: HubConfig) { // Presence rooms are ephemeral and process-local by design. const presenceRoomRegistry = createPresenceRoomRegistry(); - // Chat's own grant store/condition registry, built the same way - // `createApp` builds its default when none is supplied (see - // `@intx/hub-api`'s `mountHubRoutes`): a db-backed grant store and - // the time-window condition evaluator. `createRequireGrant` is the - // published construction the platform's own internal instance is - // not exported for. + // The hub's own grant store, built the same way `createApp` builds its + // default when none is supplied (see `@intx/hub-api`'s + // `mountHubRoutes`). `createRequireGrant` is the published construction + // the platform's own internal instance is not exported for. const chatGrantStore = createGrantStore(db); - const chatConditionRegistry: ConditionRegistry = { - time_window: timeWindowEvaluator, - }; // CL-6345: arm the grant-allowance gate declared up at `lookups`. The // one annotation today is `mcp_call` (registered under both its bare // and pinned-namespaced names): a downstream MCP tool the server @@ -1213,7 +1209,7 @@ export async function createHub(config: HubConfig) { }; }, grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, approvalStore: createApprovalStore(db), signalCorrelationStore: createSignalCorrelationStore(db), }, @@ -1229,7 +1225,7 @@ export async function createHub(config: HubConfig) { registry: presenceRoomRegistry, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), }), ); @@ -1555,7 +1551,7 @@ export async function createHub(config: HubConfig) { turnCancellation, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), isInvitableDefinition: isPickerListableDefinition, turnTimeoutMs: DEFAULT_TURN_CLAIM_TTL_MS, @@ -1662,7 +1658,7 @@ export async function createHub(config: HubConfig) { store: insightsUsage.store, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), runTraceReader: createDrizzleRunTraceReader(db), latencyStore: insightsLatency.store, @@ -1687,7 +1683,7 @@ export async function createHub(config: HubConfig) { db, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), }), ); @@ -1703,7 +1699,7 @@ export async function createHub(config: HubConfig) { db, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), runNow: async (args) => runNowScheduledDefinition( @@ -1738,7 +1734,7 @@ export async function createHub(config: HubConfig) { store: evalRuns.store, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), }), ); @@ -1879,7 +1875,7 @@ export async function createHub(config: HubConfig) { assetService, repoStore: agentRepoStore.repoStore, grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), }), ); @@ -1889,7 +1885,7 @@ export async function createHub(config: HubConfig) { registry: commandRegistry, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), workbenchBelongsToTenant: async (tenantId, chatId) => (await chatStore.getWorkbenchSettings(tenantId, chatId)) !== @@ -1918,7 +1914,7 @@ export async function createHub(config: HubConfig) { store: webhookTriggerStore, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), workflowDefinitionInTenant: async (tenantId, definitionId) => { const row = await db.query.workflowDefinition.findFirst({ @@ -2012,7 +2008,7 @@ export async function createHub(config: HubConfig) { registry: CONNECTOR_REGISTRY, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), log: (line) => log.info`${line}`, // Same env bag the OAuth connect flow itself reads below, so @@ -2108,7 +2104,7 @@ export async function createHub(config: HubConfig) { createCatalogBlockRoutes({ requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), log: (line) => log.info`${line}`, inferencePreferences: (tenantId) => @@ -2197,7 +2193,7 @@ export async function createHub(config: HubConfig) { hubUrl: config.baseUrl, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), log: (line) => log.info`${line}`, presets: MCP_PRESETS, @@ -2214,7 +2210,7 @@ export async function createHub(config: HubConfig) { hubUrl: config.baseUrl, requireGrant: createRequireGrant({ grantStore: chatGrantStore, - conditionRegistry: chatConditionRegistry, + conditionRegistry: grantConditionRegistry, }), log: (line) => log.info`${line}`, credentialCipher, diff --git a/bun.lock b/bun.lock index 0c156c55d1..d356ea64a9 100644 --- a/bun.lock +++ b/bun.lock @@ -40,6 +40,7 @@ "@chat-adapter/state-memory": "^4.35.0", "@corbits/agent-directory": "workspace:*", "@corbits/agent-lifecycle": "workspace:*", + "@corbits/agent-runtime": "workspace:*", "@corbits/approvals": "workspace:*", "@corbits/artifacts": "github:corbitsdev/corbits-artifacts#dc435ba749b4378f19e5de772159c2a57e932938", "@corbits/artifacts-hub": "workspace:*", @@ -290,12 +291,24 @@ "name": "@corbits/agent-runtime", "version": "0.0.1", "dependencies": { + "@corbits/agent-events": "workspace:*", + "@corbits/approvals": "workspace:*", + "@corbits/chat": "workspace:*", + "@corbits/collections": "workspace:*", + "@corbits/connections": "workspace:*", + "@corbits/error-sink": "workspace:*", + "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", + "@corbits/turn-artifacts": "workspace:*", "@corbits/workflows": "workspace:*", "@intx/agent": "workspace:*", + "@intx/db": "workspace:*", + "@intx/hub-sessions": "workspace:*", + "@intx/log": "0.3.0", "@intx/types": "workspace:*", "@intx/workflow": "workspace:*", "@intx/workflow-deploy": "workspace:*", "arktype": "catalog:", + "drizzle-orm": "catalog:", }, "devDependencies": { "@types/bun": "catalog:", @@ -3599,8 +3612,18 @@ "@changesets/write/prettier": ["prettier@2.8.8", "", { "bin": { "prettier": "bin-prettier.js" } }, "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="], + "@corbits/artifacts-hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#dc435ba", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/hub-api": "^0.2.2", "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-dc435ba", "sha512-VksIyrrJY9nRke0QyjgqGdW3gLD73Bi3+CzpJWG+l8vRJKdUxVi7ms2Mp95NmJXr4TpVX6i1z4odufX/QBxnSw=="], + + "@corbits/chat-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/context-menu/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + "@corbits/plugins-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/settings-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], @@ -3631,6 +3654,12 @@ "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.9", "", {}, "sha512-brTTsvFRt5C1gGHtPst/281UjPD5t9fBqbgoMPlVWy11ZLTPfu7HxK4ZYqO9H7o/yC9rSTCI85EaQ4OoY12qYw=="], + "@workbench/hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#dc435ba", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/hub-api": "^0.2.2", "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-dc435ba", "sha512-VksIyrrJY9nRke0QyjgqGdW3gLD73Bi3+CzpJWG+l8vRJKdUxVi7ms2Mp95NmJXr4TpVX6i1z4odufX/QBxnSw=="], + + "@workbench/sidecar/@corbits/oauth-core": ["@corbits/oauth-core@github:corbitsdev/corbits-oauth-core#e1e69e6", { "dependencies": { "arktype": "2.2.3" } }, "corbitsdev-corbits-oauth-core-e1e69e6", "sha512-wUrD73iVyk/Dtb4yRn3hCh6N8syfsEvAkRz4XYqT0FIB3sYDSMYEWHcDMJx9nq64my/HBOeN1J6PHIOtpjhtPg=="], + + "@workbench/web/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], "better-call/@better-auth/utils": ["@better-auth/utils@0.5.0", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA=="], diff --git a/packages/agent-runtime/package.json b/packages/agent-runtime/package.json index d61b7af831..866f50ba96 100644 --- a/packages/agent-runtime/package.json +++ b/packages/agent-runtime/package.json @@ -13,12 +13,24 @@ "test": "bun test" }, "dependencies": { + "@corbits/agent-events": "workspace:*", + "@corbits/approvals": "workspace:*", + "@corbits/chat": "workspace:*", + "@corbits/collections": "workspace:*", + "@corbits/connections": "workspace:*", + "@corbits/error-sink": "workspace:*", + "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", + "@corbits/turn-artifacts": "workspace:*", "@corbits/workflows": "workspace:*", "@intx/agent": "workspace:*", + "@intx/db": "workspace:*", + "@intx/hub-sessions": "workspace:*", + "@intx/log": "0.3.0", "@intx/types": "workspace:*", "@intx/workflow": "workspace:*", "@intx/workflow-deploy": "workspace:*", - "arktype": "catalog:" + "arktype": "catalog:", + "drizzle-orm": "catalog:" }, "devDependencies": { "@types/bun": "catalog:", diff --git a/packages/chat/src/agent-turns.test.ts b/packages/agent-runtime/src/agent-turns.test.ts similarity index 100% rename from packages/chat/src/agent-turns.test.ts rename to packages/agent-runtime/src/agent-turns.test.ts diff --git a/packages/chat/src/agent-turns.ts b/packages/agent-runtime/src/agent-turns.ts similarity index 99% rename from packages/chat/src/agent-turns.ts rename to packages/agent-runtime/src/agent-turns.ts index fdbd5bfc23..14a83f8715 100644 --- a/packages/chat/src/agent-turns.ts +++ b/packages/agent-runtime/src/agent-turns.ts @@ -17,8 +17,8 @@ import { } from "@corbits/agent-runtime"; import { and, asc, desc, eq, inArray, lt, sql } from "drizzle-orm"; -import { agentTurns } from "./schema"; -import type { ChatDb } from "./store"; +import { agentTurns } from "@corbits/chat/schema"; +import type { ChatDb } from "@corbits/chat/store"; import { CHAT_TURN_TIMEOUT_MS } from "./turn-claims"; export type AgentTurnStatus = "running" | "completed" | "failed" | "cancelled"; diff --git a/packages/chat/src/artifact-delivery.test.ts b/packages/agent-runtime/src/artifact-delivery.test.ts similarity index 100% rename from packages/chat/src/artifact-delivery.test.ts rename to packages/agent-runtime/src/artifact-delivery.test.ts diff --git a/packages/chat/src/artifact-delivery.ts b/packages/agent-runtime/src/artifact-delivery.ts similarity index 96% rename from packages/chat/src/artifact-delivery.ts rename to packages/agent-runtime/src/artifact-delivery.ts index 4eb81025a1..a8b6c67f88 100644 --- a/packages/chat/src/artifact-delivery.ts +++ b/packages/agent-runtime/src/artifact-delivery.ts @@ -12,7 +12,7 @@ import { type PersistedArtifact, } from "@corbits/turn-artifacts"; -import type { FilePart } from "./parts"; +import type { FilePart } from "@corbits/chat/parts"; function mediaTypeForArtifactKind(kind: string): string { return kind === "text" ? "text/plain" : "application/octet-stream"; diff --git a/packages/chat/src/chat-orchestrator.test.ts b/packages/agent-runtime/src/chat-orchestrator.test.ts similarity index 100% rename from packages/chat/src/chat-orchestrator.test.ts rename to packages/agent-runtime/src/chat-orchestrator.test.ts diff --git a/packages/chat/src/chat-orchestrator.ts b/packages/agent-runtime/src/chat-orchestrator.ts similarity index 98% rename from packages/chat/src/chat-orchestrator.ts rename to packages/agent-runtime/src/chat-orchestrator.ts index 9a50f55e89..da7312ceaa 100644 --- a/packages/chat/src/chat-orchestrator.ts +++ b/packages/agent-runtime/src/chat-orchestrator.ts @@ -50,33 +50,39 @@ import { type ConnectorRegistry, } from "@corbits/connections/registry"; import { artifactPartsForFinalizedTurn } from "./artifact-delivery"; -import type { ApproveBlockData } from "./blocks"; -import { encodeParts } from "./codec"; -import { mailMessageIdFor } from "./mail-headers"; -import { consumerFacingInferenceText } from "./consumer-inference-text"; -import type { ConnectedProviderLister } from "./inference-preferences"; -import { mentionedParticipants } from "./mentions"; -import { domainOf, localPartOf } from "./agent-address"; +import type { ApproveBlockData } from "@corbits/chat/blocks"; +import { encodeParts } from "@corbits/chat/codec"; +import { mailMessageIdFor } from "@corbits/chat/mail-headers"; +import { consumerFacingInferenceText } from "@corbits/chat/consumer-inference-text"; +import type { ConnectedProviderLister } from "@corbits/chat/inference-preferences"; +import { mentionedParticipants } from "@corbits/chat/mentions"; +import { domainOf, localPartOf } from "@corbits/chat/agent-address"; import { readBindingByAddressAnyTenant, resolveLiveAgent, -} from "./agent-binding"; -import { parseParticipants, type ParticipantRecord } from "./participants"; -import type { Part, TextPart } from "./parts"; -import type { ChatPlatform } from "./platform-port"; -import { postRoomMessage, type RoomMessageStore } from "./room-messages"; +} from "@corbits/chat/agent-binding"; +import { + parseParticipants, + type ParticipantRecord, +} from "@corbits/chat/participants"; +import type { Part, TextPart } from "@corbits/chat/parts"; +import type { ChatPlatform } from "@corbits/chat/platform-port"; +import { + postRoomMessage, + type RoomMessageStore, +} from "@corbits/chat/room-messages"; import type { AgentTurn, AgentTurnStore } from "./agent-turns"; import { mailIdFromBracketMessageId, type TurnMailCorrelationStore, } from "./turn-mail-correlation"; -import type { ChatStore } from "./store"; -import type { ThreadStore } from "./threads"; +import type { ChatStore } from "@corbits/chat/store"; +import type { ThreadStore } from "@corbits/chat/threads"; import { TOOLS_UNSUPPORTED_CONSUMER_MESSAGE, isToolsUnsupportedInferenceText, -} from "./tools-unsupported"; -import type { WorkbenchSubscriberRegistry } from "./workbench-events"; +} from "@corbits/chat/tools-unsupported"; +import type { WorkbenchSubscriberRegistry } from "@corbits/chat/workbench-events"; import type { WriteClaimStore } from "./write-claims"; const log = getLogger(["chat", "orchestrator"]); diff --git a/packages/chat/src/client-ids.ts b/packages/agent-runtime/src/client-ids.ts similarity index 98% rename from packages/chat/src/client-ids.ts rename to packages/agent-runtime/src/client-ids.ts index eddb240fb5..1c88961c48 100644 --- a/packages/chat/src/client-ids.ts +++ b/packages/agent-runtime/src/client-ids.ts @@ -17,7 +17,7 @@ import { and, eq, inArray } from "drizzle-orm"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; -import { messageClientIds } from "./schema"; +import { messageClientIds } from "@corbits/chat/schema"; export interface ClientIdRow { readonly tenantId: string; diff --git a/packages/agent-runtime/src/index.ts b/packages/agent-runtime/src/index.ts index 17e9e4e8bc..4757dd382f 100644 --- a/packages/agent-runtime/src/index.ts +++ b/packages/agent-runtime/src/index.ts @@ -13,3 +13,74 @@ export { type AgentRuntimeSourceTree, type RenderAgentRuntimeSourceTreeInput, } from "./source-tree"; + +export { + AGENT_TURNS_PAGE_SIZE, + createDrizzleAgentTurnStore, + createInMemoryAgentTurnStore, +} from "./agent-turns"; +export type { + AgentTurn, + AgentTurnStatus, + AgentTurnStore, + FinishAgentTurnInput, + StartAgentTurnInput, +} from "./agent-turns"; +export { + CHAT_TURN_TIMEOUT_MS, + createInMemoryTurnClaimStore, +} from "./turn-claims"; +export type { TurnClaim, TurnClaimStore, TurnClaimToken } from "./turn-claims"; +export { createWorkbenchTurnQueue, TurnQueuedEvent } from "./turn-queue"; +export type { + DispatchTurnBatch, + QueuedTurn, + WorkbenchTurnQueue, + WorkbenchTurnQueueDeps, +} from "./turn-queue"; +export { + createInMemoryClientIdStore, + createDrizzleClientIdStore, +} from "./client-ids"; +export type { + ClientIdRow, + ClientIdStore, + ClientIdDb, + RecordClientIdInput, +} from "./client-ids"; +export { + createArtifactDeliveryHandler, + createChatOrchestrator, +} from "./chat-orchestrator"; +export type { + ChatOrchestrator, + ChatOrchestratorDeps, +} from "./chat-orchestrator"; +export { + createDrizzleWriteClaimStore, + createInMemoryWriteClaimStore, +} from "./write-claims"; +export type { + WriteClaim, + WriteClaimDb, + WriteClaimStore, + WriteClaimSurface, +} from "./write-claims"; +export { + createDrizzleTurnMailCorrelationStore, + createInMemoryTurnMailCorrelationStore, + mailIdFromBracketMessageId, +} from "./turn-mail-correlation"; +export type { + RecordTurnMailInput, + TurnMailCorrelationDb, + TurnMailCorrelationStore, + TurnMailSource, +} from "./turn-mail-correlation"; +export { AGENT_TURN_STALE_MS } from "./agent-turns"; +export { POSTED_APPROVAL_GUARD_TTL_MS } from "./chat-orchestrator"; + +export { + artifactPartsForFinalizedTurn, + artifactPartsForToolCall, +} from "./artifact-delivery"; diff --git a/packages/chat/src/turn-claims.test.ts b/packages/agent-runtime/src/turn-claims.test.ts similarity index 100% rename from packages/chat/src/turn-claims.test.ts rename to packages/agent-runtime/src/turn-claims.test.ts diff --git a/packages/chat/src/turn-claims.ts b/packages/agent-runtime/src/turn-claims.ts similarity index 100% rename from packages/chat/src/turn-claims.ts rename to packages/agent-runtime/src/turn-claims.ts diff --git a/packages/chat/src/turn-mail-correlation.test.ts b/packages/agent-runtime/src/turn-mail-correlation.test.ts similarity index 100% rename from packages/chat/src/turn-mail-correlation.test.ts rename to packages/agent-runtime/src/turn-mail-correlation.test.ts diff --git a/packages/chat/src/turn-mail-correlation.ts b/packages/agent-runtime/src/turn-mail-correlation.ts similarity index 97% rename from packages/chat/src/turn-mail-correlation.ts rename to packages/agent-runtime/src/turn-mail-correlation.ts index d055c211b3..3821894c13 100644 --- a/packages/chat/src/turn-mail-correlation.ts +++ b/packages/agent-runtime/src/turn-mail-correlation.ts @@ -14,8 +14,8 @@ import { and, eq } from "drizzle-orm"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; -import { localPartOf } from "./agent-address"; -import { turnMailCorrelation } from "./schema"; +import { localPartOf } from "@corbits/chat/agent-address"; +import { turnMailCorrelation } from "@corbits/chat/schema"; export type TurnMailSource = { readonly tenantId: string; diff --git a/packages/chat/src/turn-queue-report-error.test.ts b/packages/agent-runtime/src/turn-queue-report-error.test.ts similarity index 100% rename from packages/chat/src/turn-queue-report-error.test.ts rename to packages/agent-runtime/src/turn-queue-report-error.test.ts diff --git a/packages/chat/src/turn-queue.test.ts b/packages/agent-runtime/src/turn-queue.test.ts similarity index 99% rename from packages/chat/src/turn-queue.test.ts rename to packages/agent-runtime/src/turn-queue.test.ts index e99afd17b0..5abe6aaf8c 100644 --- a/packages/chat/src/turn-queue.test.ts +++ b/packages/agent-runtime/src/turn-queue.test.ts @@ -2,7 +2,7 @@ import { beforeEach, describe, expect, mock, test } from "bun:test"; import { createInMemoryTurnClaimStore } from "./turn-claims"; import type { TurnClaimStore } from "./turn-claims"; import type { QueuedTurn } from "./turn-queue"; -import type { ChatWorkbenchEvent } from "./platform-port"; +import type { ChatWorkbenchEvent } from "@corbits/chat/platform-port"; // Stub the error sink: the queue reports dispatch/drain failures through // `reportError` and keeps draining — the keeper test below pins the refId diff --git a/packages/chat/src/turn-queue.ts b/packages/agent-runtime/src/turn-queue.ts similarity index 98% rename from packages/chat/src/turn-queue.ts rename to packages/agent-runtime/src/turn-queue.ts index c4d5ce439f..5ed4b3b954 100644 --- a/packages/chat/src/turn-queue.ts +++ b/packages/agent-runtime/src/turn-queue.ts @@ -18,9 +18,9 @@ import { reportError } from "@corbits/error-sink"; import { getLogger } from "@intx/log"; import { type } from "arktype"; -import type { Part as PartType } from "./parts"; +import type { Part as PartType } from "@corbits/chat/parts"; import type { TurnClaimStore, TurnClaimToken } from "./turn-claims"; -import type { WorkbenchSubscriberRegistry } from "./workbench-events"; +import type { WorkbenchSubscriberRegistry } from "@corbits/chat/workbench-events"; const log = getLogger(["chat", "turn-queue"]); diff --git a/packages/chat/src/write-claims.ts b/packages/agent-runtime/src/write-claims.ts similarity index 98% rename from packages/chat/src/write-claims.ts rename to packages/agent-runtime/src/write-claims.ts index 8d326671b0..c0f7cb1617 100644 --- a/packages/chat/src/write-claims.ts +++ b/packages/agent-runtime/src/write-claims.ts @@ -16,7 +16,7 @@ import { and, eq } from "drizzle-orm"; import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"; -import { finalizedTurnWriteClaim } from "./schema"; +import { finalizedTurnWriteClaim } from "@corbits/chat/schema"; export type WriteClaimSurface = "memory" | "artifact" | "digest"; diff --git a/packages/chat/package.json b/packages/chat/package.json index cdaa8792e1..8d466f3d48 100644 --- a/packages/chat/package.json +++ b/packages/chat/package.json @@ -19,7 +19,18 @@ "./workbench-host-naming": "./src/workbench-host-naming.ts", "./display-name": "./src/display-name.ts", "./id-leak-guard": "./src/id-leak-guard.ts", - "./mailbox-fanout": "./src/mailbox-fanout.ts" + "./mailbox-fanout": "./src/mailbox-fanout.ts", + "./schema": "./src/schema.ts", + "./store": "./src/store.ts", + "./threads": "./src/threads.ts", + "./codec": "./src/codec.ts", + "./mail-headers": "./src/mail-headers.ts", + "./platform-port": "./src/platform-port.ts", + "./room-messages": "./src/room-messages.ts", + "./workbench-events": "./src/workbench-events.ts", + "./agent-binding": "./src/agent-binding.ts", + "./tools-unsupported": "./src/tools-unsupported.ts", + "./inference-preferences": "./src/inference-preferences.ts" }, "scripts": { "typecheck": "tsc --noEmit", diff --git a/packages/chat/src/index.ts b/packages/chat/src/index.ts index 58ea287210..8d99c6358d 100644 --- a/packages/chat/src/index.ts +++ b/packages/chat/src/index.ts @@ -107,28 +107,11 @@ export { ChatPresenceSnapshotEventData, } from "./stream-events"; -export { - AGENT_TURNS_PAGE_SIZE, - createDrizzleAgentTurnStore, - createInMemoryAgentTurnStore, -} from "./agent-turns"; -export type { - AgentTurn, - AgentTurnStatus, - AgentTurnStore, - FinishAgentTurnInput, - StartAgentTurnInput, -} from "./agent-turns"; export { assembleTurnContext, contextItemFor } from "./turn-context"; export type { AssembleTurnContextInput, TurnContextThreadScope, } from "./turn-context"; -export { - CHAT_TURN_TIMEOUT_MS, - createInMemoryTurnClaimStore, -} from "./turn-claims"; -export type { TurnClaim, TurnClaimStore, TurnClaimToken } from "./turn-claims"; export { AGENT_DM_DEFINITION_ID_KEY, AGENT_DM_KIND, @@ -136,13 +119,6 @@ export { isAgentDmSettings, } from "./agent-dm-mode"; export { recordSourcesDigest } from "./agent-binding"; -export { createWorkbenchTurnQueue, TurnQueuedEvent } from "./turn-queue"; -export type { - DispatchTurnBatch, - QueuedTurn, - WorkbenchTurnQueue, - WorkbenchTurnQueueDeps, -} from "./turn-queue"; export { createTurnCancelRegistry, TurnCancelledError, @@ -222,19 +198,6 @@ export type { export { createInMemoryPinStore, createDrizzlePinStore } from "./pins"; export type { PinRow, PinStore, PinDb, PinMessageInput } from "./pins"; -export { - createInMemoryClientIdStore, - createDrizzleClientIdStore, -} from "./client-ids"; -export type { - ClientIdRow, - ClientIdStore, - ClientIdDb, - RecordClientIdInput, -} from "./client-ids"; - -export { createNoopInferenceRoutes } from "./noop-inference"; - export { joinRunParticipant } from "./run-participant"; export type { JoinRunParticipantDeps, @@ -354,38 +317,6 @@ export type { export { resolveWorkbenchIdForAgentFrame } from "./mail-headers"; -export { - createArtifactDeliveryHandler, - createChatOrchestrator, -} from "./chat-orchestrator"; -export type { - ChatOrchestrator, - ChatOrchestratorDeps, -} from "./chat-orchestrator"; - -export { - createDrizzleWriteClaimStore, - createInMemoryWriteClaimStore, -} from "./write-claims"; -export type { - WriteClaim, - WriteClaimDb, - WriteClaimStore, - WriteClaimSurface, -} from "./write-claims"; - -export { - createDrizzleTurnMailCorrelationStore, - createInMemoryTurnMailCorrelationStore, - mailIdFromBracketMessageId, -} from "./turn-mail-correlation"; -export type { - RecordTurnMailInput, - TurnMailCorrelationDb, - TurnMailCorrelationStore, - TurnMailSource, -} from "./turn-mail-correlation"; - export { createWorkbenchHostInferencePreferencesResolver, listDefaultInferencePreferences, @@ -396,11 +327,6 @@ export type { DefaultInferencePreferenceLister, } from "./inference-preferences"; -export { - artifactPartsForFinalizedTurn, - artifactPartsForToolCall, -} from "./artifact-delivery"; - export { createWorkflowParticipantRoutes } from "./workflow-participant-routes"; export type { CreateWorkflowParticipantRoutesDeps, diff --git a/packages/chat/src/routes.ts b/packages/chat/src/routes.ts index 1c6e2cf2e7..f3e654250d 100644 --- a/packages/chat/src/routes.ts +++ b/packages/chat/src/routes.ts @@ -37,7 +37,7 @@ import { } from "./reactions"; import { isKnownReactionEmoji } from "./reaction-emoji"; import type { PinRow, PinStore } from "./pins"; -import type { ClientIdStore } from "./client-ids"; +import type { ClientIdStore } from "@corbits/agent-runtime"; import { presetForKind } from "./kinds"; import { localPartOf } from "./agent-address"; import { @@ -89,16 +89,16 @@ import { createWorkbenchPresenceRegistry, type WorkbenchPresenceRegistry, } from "./workbench-presence"; -import { createInMemoryTurnClaimStore } from "./turn-claims"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; import { createWorkbenchTurnQueue, type WorkbenchTurnQueue, -} from "./turn-queue"; +} from "@corbits/agent-runtime"; import { createTurnCancelRegistry, type TurnCancelRegistry, } from "./turn-cancellation"; -import type { TurnMailCorrelationStore } from "./turn-mail-correlation"; +import type { TurnMailCorrelationStore } from "@corbits/agent-runtime"; import type { ChatPlatform } from "./platform-port"; import type { ChatStore } from "./store"; import { @@ -110,7 +110,7 @@ import type { CommandRegistry, CommandResult } from "@corbits/commands"; import { InferenceResolutionError } from "./model-unavailable"; import { DefinitionProjectionMissingError } from "@corbits/workflows"; import type { NativePrincipal, NativePrincipalStore } from "./native-principal"; -import type { AgentTurnStore } from "./agent-turns"; +import type { AgentTurnStore } from "@corbits/agent-runtime"; import type { ThreadStore } from "./threads"; import { ThreadDepthCapError } from "./threads"; import { diff --git a/packages/chat/src/send-run-mail.ts b/packages/chat/src/send-run-mail.ts index 86412bd9d1..5e03ccfd26 100644 --- a/packages/chat/src/send-run-mail.ts +++ b/packages/chat/src/send-run-mail.ts @@ -25,7 +25,7 @@ import type { DB } from "@intx/db"; import type { SidecarRouter } from "@intx/hub-sessions"; import type { CryptoProvider, MessageAttachment } from "@intx/types/runtime"; -import { mailIdFromBracketMessageId } from "./turn-mail-correlation"; +import { mailIdFromBracketMessageId } from "@corbits/agent-runtime"; import type { RunTriggerClient } from "./run-trigger-client"; export type RunMailDeps = { diff --git a/packages/chat/src/workbench-reply-activity.ts b/packages/chat/src/workbench-reply-activity.ts index 5762ca729b..495f3fdd85 100644 --- a/packages/chat/src/workbench-reply-activity.ts +++ b/packages/chat/src/workbench-reply-activity.ts @@ -1,4 +1,4 @@ -import type { AgentTurnStore } from "./agent-turns"; +import type { AgentTurnStore } from "@corbits/agent-runtime"; import type { RoomMessageStore } from "./room-messages"; export type WorkbenchLiveState = "idle" | "working" | "reply-ready"; diff --git a/packages/chat/src/workbench-service.timeouts.test.ts b/packages/chat/src/workbench-service.timeouts.test.ts index 73791cc837..877fac0cb3 100644 --- a/packages/chat/src/workbench-service.timeouts.test.ts +++ b/packages/chat/src/workbench-service.timeouts.test.ts @@ -7,7 +7,7 @@ // numbers those mechanics are configured with). import { describe, expect, test } from "bun:test"; -import { CHAT_TURN_TIMEOUT_MS } from "./turn-claims"; +import { CHAT_TURN_TIMEOUT_MS } from "@corbits/agent-runtime"; import { DEFAULT_TURN_DISPATCH_TIMEOUT_MS, DEFAULT_WAIT_UNTIL_FREE_TIMEOUT_MS, diff --git a/packages/chat/src/workbench-service.ts b/packages/chat/src/workbench-service.ts index d82b989280..e4c61973f9 100644 --- a/packages/chat/src/workbench-service.ts +++ b/packages/chat/src/workbench-service.ts @@ -24,7 +24,7 @@ import { assembleTurnContext, type TurnContextThreadScope, } from "./turn-context"; -import type { AgentTurnStore } from "./agent-turns"; +import type { AgentTurnStore } from "@corbits/agent-runtime"; import type { ThreadStore } from "./threads"; import { TurnCancelledError, @@ -64,10 +64,10 @@ import { mailboxSubjectOf, type MailboxFanoutDeps, } from "./mailbox-fanout"; -import type { TurnMailCorrelationStore } from "./turn-mail-correlation"; +import type { TurnMailCorrelationStore } from "@corbits/agent-runtime"; import type { WorkbenchSubscriberRegistry } from "./workbench-events"; -import type { QueuedTurn, WorkbenchTurnQueue } from "./turn-queue"; -import { CHAT_TURN_TIMEOUT_MS } from "./turn-claims"; +import type { QueuedTurn, WorkbenchTurnQueue } from "@corbits/agent-runtime"; +import { CHAT_TURN_TIMEOUT_MS } from "@corbits/agent-runtime"; import type { ChatStore } from "./store"; import { withTimeout } from "./with-timeout"; diff --git a/packages/chat/test/agent-turn-dispatch.test.ts b/packages/chat/test/agent-turn-dispatch.test.ts index 53fece41da..863f33b923 100644 --- a/packages/chat/test/agent-turn-dispatch.test.ts +++ b/packages/chat/test/agent-turn-dispatch.test.ts @@ -7,7 +7,7 @@ import { describe, expect, test } from "bun:test"; import { InferenceResolutionError } from "../src/model-unavailable"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createChatRoutes } from "../src/routes"; import { buildDeps, diff --git a/packages/chat/test/agent-turns-routes.test.ts b/packages/chat/test/agent-turns-routes.test.ts index f254793c05..277eb6484c 100644 --- a/packages/chat/test/agent-turns-routes.test.ts +++ b/packages/chat/test/agent-turns-routes.test.ts @@ -3,8 +3,8 @@ // "no store, no feature" 404 every optional chat store already follows. import { describe, expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; -import type { AgentTurn } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; +import type { AgentTurn } from "@corbits/agent-runtime"; import { createChatRoutes } from "../src/routes"; import { buildDeps, diff --git a/packages/chat/test/agent-turns.drizzle.test.ts b/packages/chat/test/agent-turns.drizzle.test.ts index ed96215f3c..69982cb69f 100644 --- a/packages/chat/test/agent-turns.drizzle.test.ts +++ b/packages/chat/test/agent-turns.drizzle.test.ts @@ -17,7 +17,7 @@ import { e2eDatabaseUrl } from "../../../scripts/e2e/database-url"; import { AGENT_TURN_STALE_MS, createDrizzleAgentTurnStore, -} from "../src/agent-turns"; +} from "@corbits/agent-runtime"; import { applyChatMigrations } from "../src/migrations"; import { createDrizzleRoomMessageStore } from "../src/room-messages"; import { listWorkbenchLiveState } from "../src/workbench-reply-activity"; diff --git a/packages/chat/test/chat-orchestrator.test.ts b/packages/chat/test/chat-orchestrator.test.ts index d372492140..4f4e544072 100644 --- a/packages/chat/test/chat-orchestrator.test.ts +++ b/packages/chat/test/chat-orchestrator.test.ts @@ -23,8 +23,8 @@ import { createArtifactDeliveryHandler, createChatOrchestrator, POSTED_APPROVAL_GUARD_TTL_MS, -} from "../src/chat-orchestrator"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +} from "@corbits/agent-runtime"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { parseBlock } from "../src/blocks"; import type { ChatPlatform, ChatWorkbenchEvent } from "../src/platform-port"; import { @@ -35,9 +35,9 @@ import { } from "../src/room-messages"; import type { WorkbenchSettingsRow } from "../src/store"; import { createInMemoryThreadStore } from "../src/threads"; -import { createInMemoryTurnMailCorrelationStore } from "../src/turn-mail-correlation"; +import { createInMemoryTurnMailCorrelationStore } from "@corbits/agent-runtime"; import type { WorkbenchSubscriberRegistry } from "../src/workbench-events"; -import { createInMemoryWriteClaimStore } from "../src/write-claims"; +import { createInMemoryWriteClaimStore } from "@corbits/agent-runtime"; // A fresh claim store per test, unless a test explicitly wants to share // one across two separately-constructed orchestrators/handlers to prove diff --git a/packages/chat/test/commands.test.ts b/packages/chat/test/commands.test.ts index c4d42c3991..04dbfc6b72 100644 --- a/packages/chat/test/commands.test.ts +++ b/packages/chat/test/commands.test.ts @@ -9,7 +9,7 @@ import { createCommandRegistry, createWorkflowCommandPlugin, } from "@corbits/commands"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { startWorkflowCommand } from "../src/workbench-service"; import { buildDeps, diff --git a/packages/chat/test/connect-pending.test.ts b/packages/chat/test/connect-pending.test.ts index 060d1cd3da..804d77b4e5 100644 --- a/packages/chat/test/connect-pending.test.ts +++ b/packages/chat/test/connect-pending.test.ts @@ -8,11 +8,11 @@ // waking anyone. import { expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createInMemoryChatStore } from "../src/store"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; -import { createInMemoryTurnClaimStore } from "../src/turn-claims"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; import { CONNECTION_CONNECTED_EVENT, settleConnectedService, diff --git a/packages/chat/test/dispatch-turn-abort.test.ts b/packages/chat/test/dispatch-turn-abort.test.ts index 07b8171bc2..ea248583a7 100644 --- a/packages/chat/test/dispatch-turn-abort.test.ts +++ b/packages/chat/test/dispatch-turn-abort.test.ts @@ -8,7 +8,7 @@ // attach to a running row again. import { describe, expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; import { TurnCancelledError } from "../src/turn-cancellation"; import { dispatchTurn } from "../src/workbench-service"; diff --git a/packages/chat/test/dispatch-turn-mail-headers.test.ts b/packages/chat/test/dispatch-turn-mail-headers.test.ts index ad425300e0..1cf1c5b66b 100644 --- a/packages/chat/test/dispatch-turn-mail-headers.test.ts +++ b/packages/chat/test/dispatch-turn-mail-headers.test.ts @@ -10,8 +10,8 @@ import type { MailContent } from "../src/codec"; import { createInMemoryChatStore } from "../src/store"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; import { createInMemoryThreadStore } from "../src/threads"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; -import { createInMemoryTurnClaimStore } from "../src/turn-claims"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; import { createTurnCancelRegistry } from "../src/turn-cancellation"; import { dispatchTurn, sendWorkbenchMessage } from "../src/workbench-service"; import { mailMessageIdFor } from "../src/mail-headers"; diff --git a/packages/chat/test/mail-threading.test.ts b/packages/chat/test/mail-threading.test.ts index 355dd52a17..62a6e1015a 100644 --- a/packages/chat/test/mail-threading.test.ts +++ b/packages/chat/test/mail-threading.test.ts @@ -9,8 +9,8 @@ import { dispatchTurn } from "../src/workbench-service"; import type { MailContent } from "../src/codec"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; import { createInMemoryThreadStore } from "../src/threads"; -import { createInMemoryTurnMailCorrelationStore } from "../src/turn-mail-correlation"; -import { mailIdFromBracketMessageId } from "../src/turn-mail-correlation"; +import { createInMemoryTurnMailCorrelationStore } from "@corbits/agent-runtime"; +import { mailIdFromBracketMessageId } from "@corbits/agent-runtime"; const TENANT = "ten_1"; const WORKBENCH = "ins_workbench1"; diff --git a/packages/chat/test/mailbox-fanout.test.ts b/packages/chat/test/mailbox-fanout.test.ts index cf9750fdb2..18daecc625 100644 --- a/packages/chat/test/mailbox-fanout.test.ts +++ b/packages/chat/test/mailbox-fanout.test.ts @@ -20,8 +20,8 @@ import type { ParticipantRecord } from "../src/participants"; import { sendWorkbenchMessage } from "../src/workbench-service"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; import { createInMemoryChatStore } from "../src/store"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; -import { createInMemoryTurnClaimStore } from "../src/turn-claims"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; import { createTurnCancelRegistry } from "../src/turn-cancellation"; function inMemoryWriter(): { diff --git a/packages/chat/test/sse-message-headers.test.ts b/packages/chat/test/sse-message-headers.test.ts index a5fb02d077..bc45a94b22 100644 --- a/packages/chat/test/sse-message-headers.test.ts +++ b/packages/chat/test/sse-message-headers.test.ts @@ -12,8 +12,8 @@ import { postRoomMessage } from "../src/room-messages"; import { ChatMessageEventData } from "../src/stream-events"; import { createInMemoryChatStore } from "../src/store"; import { createInMemoryThreadStore } from "../src/threads"; -import { createInMemoryTurnClaimStore } from "../src/turn-claims"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; import { createTurnCancelRegistry } from "../src/turn-cancellation"; import type { MailboxWriter } from "../src/mailbox-fanout"; import type { ParticipantRecord } from "../src/participants"; diff --git a/packages/chat/test/turn-cancel-route.test.ts b/packages/chat/test/turn-cancel-route.test.ts index 5d5f4a67f6..067f85cc02 100644 --- a/packages/chat/test/turn-cancel-route.test.ts +++ b/packages/chat/test/turn-cancel-route.test.ts @@ -5,7 +5,7 @@ // workbench, and the shape of the response. import { describe, expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createChatRoutes } from "../src/routes"; import { buildDeps, diff --git a/packages/chat/test/turn-cancellation-dispatch.test.ts b/packages/chat/test/turn-cancellation-dispatch.test.ts index b277bb02ba..6ac7503260 100644 --- a/packages/chat/test/turn-cancellation-dispatch.test.ts +++ b/packages/chat/test/turn-cancellation-dispatch.test.ts @@ -14,7 +14,7 @@ // ceiling: it can record the outcome, not stop the underlying work. import { describe, expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createChatRoutes } from "../src/routes"; import { createTurnCancelRegistry } from "../src/turn-cancellation"; import { createWorkbenchSubscriberRegistry } from "../src/workbench-events"; diff --git a/packages/chat/test/turn-claim-failure.test.ts b/packages/chat/test/turn-claim-failure.test.ts index eb31abd87d..e713bf9a98 100644 --- a/packages/chat/test/turn-claim-failure.test.ts +++ b/packages/chat/test/turn-claim-failure.test.ts @@ -7,8 +7,8 @@ import { describe, expect, test } from "bun:test"; import { createChatRoutes } from "../src/routes"; -import type { TurnClaimStore } from "../src/turn-claims"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; +import type { TurnClaimStore } from "@corbits/agent-runtime"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; import { buildDeps, createWorkbench, diff --git a/packages/chat/test/turn-dispatch-deadline.test.ts b/packages/chat/test/turn-dispatch-deadline.test.ts index 769f335722..2d80f3c3eb 100644 --- a/packages/chat/test/turn-dispatch-deadline.test.ts +++ b/packages/chat/test/turn-dispatch-deadline.test.ts @@ -9,7 +9,7 @@ // bounds stay as diagnostics; this is the backstop. import { describe, expect, test } from "bun:test"; -import { createInMemoryAgentTurnStore } from "../src/agent-turns"; +import { createInMemoryAgentTurnStore } from "@corbits/agent-runtime"; import { createChatRoutes } from "../src/routes"; import { buildDeps, diff --git a/packages/chat/test/turn-mail-correlation.drizzle.test.ts b/packages/chat/test/turn-mail-correlation.drizzle.test.ts index 4a87aaf17f..2d091ff856 100644 --- a/packages/chat/test/turn-mail-correlation.drizzle.test.ts +++ b/packages/chat/test/turn-mail-correlation.drizzle.test.ts @@ -16,7 +16,7 @@ import postgres from "postgres"; import { e2eDatabaseUrl } from "../../../scripts/e2e/database-url"; import { applyChatMigrations } from "../src/migrations"; -import { createDrizzleTurnMailCorrelationStore } from "../src/turn-mail-correlation"; +import { createDrizzleTurnMailCorrelationStore } from "@corbits/agent-runtime"; import { dbGate } from "../../../scripts/e2e/db-gate"; function scratchUrlFor(e2eUrl: string): string { diff --git a/packages/chat/test/workbench-reply-activity.test.ts b/packages/chat/test/workbench-reply-activity.test.ts index e7366d7180..5e4f082363 100644 --- a/packages/chat/test/workbench-reply-activity.test.ts +++ b/packages/chat/test/workbench-reply-activity.test.ts @@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test"; import { createInMemoryAgentTurnStore, AGENT_TURN_STALE_MS, -} from "../src/agent-turns"; +} from "@corbits/agent-runtime"; import { createInMemoryRoomMessageStore } from "../src/room-messages"; import { listWorkbenchLiveState } from "../src/workbench-reply-activity"; import { createChatRoutes } from "../src/routes"; diff --git a/packages/chat/test/workbench-service.test.ts b/packages/chat/test/workbench-service.test.ts index 163d3a3403..035fe18012 100644 --- a/packages/chat/test/workbench-service.test.ts +++ b/packages/chat/test/workbench-service.test.ts @@ -34,7 +34,7 @@ import { createInMemoryRoomMessageStore, postRoomMessage, } from "../src/room-messages"; -import { createInMemoryTurnMailCorrelationStore } from "../src/turn-mail-correlation"; +import { createInMemoryTurnMailCorrelationStore } from "@corbits/agent-runtime"; import { createWorkbenchSubscriberRegistry } from "../src/workbench-events"; import type { ChatWorkbenchEvent } from "../src/platform-port"; diff --git a/packages/chat/test/workflow-participant-routes.test.ts b/packages/chat/test/workflow-participant-routes.test.ts index 92fc530401..48353e4a8f 100644 --- a/packages/chat/test/workflow-participant-routes.test.ts +++ b/packages/chat/test/workflow-participant-routes.test.ts @@ -16,8 +16,8 @@ import { type WorkflowParticipantRunScope, type WorkflowRunAuthenticator, } from "../src/workflow-participant-routes"; -import { createInMemoryTurnClaimStore } from "../src/turn-claims"; -import { createWorkbenchTurnQueue } from "../src/turn-queue"; +import { createInMemoryTurnClaimStore } from "@corbits/agent-runtime"; +import { createWorkbenchTurnQueue } from "@corbits/agent-runtime"; import { createTurnCancelRegistry } from "../src/turn-cancellation"; import { fakePlatform, TENANT } from "./test-support"; diff --git a/packages/chat/test/write-claims.drizzle.test.ts b/packages/chat/test/write-claims.drizzle.test.ts index 1672914d94..e4508b5e6f 100644 --- a/packages/chat/test/write-claims.drizzle.test.ts +++ b/packages/chat/test/write-claims.drizzle.test.ts @@ -16,7 +16,7 @@ import postgres from "postgres"; import { e2eDatabaseUrl } from "../../../scripts/e2e/database-url"; import { applyChatMigrations } from "../src/migrations"; -import { createDrizzleWriteClaimStore } from "../src/write-claims"; +import { createDrizzleWriteClaimStore } from "@corbits/agent-runtime"; import { dbGate } from "../../../scripts/e2e/db-gate"; function scratchUrlFor(e2eUrl: string): string {