Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ All scripts live in `bin/`. The bash scripts source the bundled [opsh](https://g

## Seed Data

`bin/seed` creates the full dev dataset: users, tenants, agents, roles, grants, credentials, and offerings. It requires a running hub (the dev orchestrator handles this when `--seed` is passed). See the Quick Start section for seed account credentials.
`bin/seed` creates the full dev dataset: users, tenants, workflows, roles, grants, credentials, and offerings. It requires a running hub (the dev orchestrator handles this when `--seed` is passed). See the Quick Start section for seed account credentials.

## Project Structure

Expand Down
34 changes: 17 additions & 17 deletions LAYOUT.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test-unit: FORCE
# (port 0, mkdtemp dirs, unique schemas) and none rely on fresh module state,
# so sharing the registry across files is safe.
test-workflow: FORCE
$(BUN) test --timeout 120000 --parallel=$(WF_PARALLEL) --no-isolate tests/workflow-deploy/multistep-signal.test.ts tests/workflow-deploy/hub-link-reconnect.test.ts tests/workflow-deploy/reconnect-reemits-parked-correlation.test.ts tests/workflow-deploy/interrupted-pack-reconnect-recovery.test.ts tests/workflow-deploy/deploy-window-reconnect-recovery.test.ts tests/workflow-deploy/midrun-signal-survives-reconnect.test.ts tests/workflow-deploy/multistep-perstep-reroute-reconnect.test.ts tests/workflow-deploy/crash-restart-reconnect-resumes.test.ts tests/workflow-deploy/crash-respawn-fifo.test.ts tests/workflow-deploy/crash-loop-latch.test.ts tests/workflow-deploy/on-trigger-signal-delivery.test.ts tests/workflow-deploy/on-trigger-between-events-restart.test.ts tests/workflow-deploy/on-trigger-body-sleep-restart-resumes.test.ts tests/workflow-deploy/sleep-restart-keeps-authority.test.ts tests/workflow-deploy/sleep-restart-hub-access.test.ts tests/workflow-deploy/on-trigger-agent-body.test.ts tests/workflow-deploy/on-trigger-action-body.test.ts tests/workflow-deploy/on-trigger-loop-body.test.ts tests/workflow-deploy/single-step-real-agent.test.ts tests/workflow-deploy/map-fan-out-real-agent.test.ts tests/workflow-deploy/multistep-signed-send.test.ts tests/workflow-deploy/single-step-message-input.test.ts tests/workflow-deploy/single-step-posix-tool.test.ts tests/workflow-deploy/single-step-credential-tool.test.ts tests/workflow-deploy/credential-bound-route-deploy.test.ts tests/workflow-deploy/action-step-credential.test.ts tests/workflow-deploy/action-hub-access.test.ts tests/workflow-deploy/tool-hub-access.test.ts tests/workflow-deploy/invoker-hub-access.test.ts tests/workflow-deploy/body-hub-access.test.ts tests/workflow-deploy/revoked-creator-grant-running-run.test.ts tests/workflow-deploy/expired-run-grant-running-run.test.ts tests/workflow-deploy/tarball-route-deploy.test.ts tests/workflow-deploy/folded-tools-failover-real-agent.test.ts tests/workflow-deploy/single-step-grants-bridge.test.ts tests/workflow-deploy/single-step-pinned-ask-tool.test.ts tests/workflow-deploy/single-step-per-run-grants.test.ts tests/workflow-deploy/approval-tracer-roundtrip.test.ts tests/workflow-deploy/scope-always-roundtrip.test.ts tests/workflow-deploy/childworkflow-scope-always-roundtrip.test.ts tests/workflow-deploy/mail-trigger-derived-grants-roundtrip.test.ts tests/workflow-deploy/mail-trigger-run-completes-real-route.test.ts tests/workflow-deploy/inbound-mail-enforcement-real-route.test.ts tests/workflow-deploy/run-mail-send-real-route.test.ts tests/workflow-deploy/mail-federation-derived-grants-roundtrip.test.ts tests/workflow-deploy/mail-federation-run-completes.test.ts tests/workflow-deploy/single-step-event-threading.test.ts tests/workflow-deploy/single-step-conversation-durability.test.ts tests/workflow-deploy/multistep-conversation-failover.test.ts tests/workflow-deploy/per-level-pipeline-real-agents.test.ts tests/workflow-deploy/dispatch-orchestrator-real-agents.test.ts tests/workflow-deploy/single-step-full-lifecycle.test.ts tests/workflow-deploy/single-step-mail-loop.test.ts tests/workflow-deploy/single-step-mail-in-reply-to.test.ts tests/workflow-deploy/single-step-mail-wait-wake.test.ts tests/workflow-deploy/single-step-mail-two-turn-thread.test.ts tests/workflow-deploy/single-step-mail-interactive-turns.test.ts tests/workflow-deploy/single-step-mail-flag-expunge.test.ts tests/workflow-deploy/cross-process-custom-adapter.test.ts tests/workflow-deploy/conversation-state-wal.test.ts tests/workflow-deploy/conversation-state-connector-seed.test.ts tests/workflow-deploy/drain-roundtrip.test.ts tests/workflow-deploy/fixtures/child-workflow.test.ts tests/workflow-deploy/child-workflow-roundtrip.test.ts tests/workflow-deploy/child-workflow-tool-invoke-roundtrip.test.ts tests/workflow-deploy/child-workflow-inherited-grants-roundtrip.test.ts tests/workflow-deploy/on-trigger-childworkflow-roundtrip.test.ts tests/workflow-deploy/loop-roundtrip.test.ts tests/workflow-deploy/loop-nested-roundtrip.test.ts tests/workflow-deploy/loop-action-roundtrip.test.ts tests/workflow-deploy/all-action-deploy.test.ts tests/workflow-deploy/sidecar-runs-no-workflow-code.test.ts tests/workflow-deploy/onfailure-action-roundtrip.test.ts tests/workflow-deploy/loop-await-signal-restart-resumes.test.ts tests/workflow-deploy/loop-childworkflow-roundtrip.test.ts tests/workflow-deploy/loop-work-then-signal-restart-resumes.test.ts tests/workflow-deploy/loop-await-signal-drain-roundtrip.test.ts tests/workflow-deploy/loop-childworkflow-inflight-grandchild-drain.test.ts tests/workflow-deploy/childworkflow-restart-resumes.test.ts tests/workflow-deploy/body-action-restart-effect-once.test.ts tests/workflow-deploy/body-action-crash-mid-effect.test.ts tests/workflow-deploy/childworkflow-drain-wait-resumes.test.ts tests/workflow-deploy/childworkflow-unanswerable-gate.test.ts tests/workflow-deploy/on-trigger-drain-roundtrip.test.ts tests/workflow-deploy/unresolvable-director.test.ts tests/workflow-deploy/fifo-mail.test.ts tests/workflow-deploy/mail-edge-cases.test.ts tests/workflow-deploy/run-event-batching.test.ts tests/workflow-deploy/walking-skeleton.e2e.test.ts tests/workflow-deploy/asset-source.e2e.test.ts tests/workflow-deploy/source-workflow.e2e.test.ts tests/workflow-deploy/source-monorepo.e2e.test.ts tests/workflow-deploy/source-monorepo-many.e2e.test.ts tests/workflow-deploy/source-tamper-reject.e2e.test.ts tests/workflow-deploy/source-catalog.e2e.test.ts tests/workflow-deploy/source-mixed-closure.e2e.test.ts tests/workflow-deploy/source-closure-director.e2e.test.ts tests/workflow-deploy/source-credential.e2e.test.ts tests/workflow-deploy/source-inline-tool.e2e.test.ts tests/workflow-deploy/source-posix-lsp.e2e.test.ts tests/workflow-deploy/loop-tool-invoke-roundtrip.test.ts tests/workflow-deploy/child-workflow-loop-tool-invoke-roundtrip.test.ts tests/workflow-deploy/on-trigger-tool-invoke-roundtrip.test.ts tests/workflow-deploy/on-trigger-credential-tool.test.ts tests/workflow-deploy/loop-map-tool-invoke-roundtrip.test.ts tests/workflow-deploy/loop-nested-tool-invoke-roundtrip.test.ts
$(BUN) test --timeout 120000 --parallel=$(WF_PARALLEL) --no-isolate tests/workflow-deploy/multistep-signal.test.ts tests/workflow-deploy/hub-link-reconnect.test.ts tests/workflow-deploy/reconnect-reemits-parked-correlation.test.ts tests/workflow-deploy/interrupted-pack-reconnect-recovery.test.ts tests/workflow-deploy/deploy-window-reconnect-recovery.test.ts tests/workflow-deploy/midrun-signal-survives-reconnect.test.ts tests/workflow-deploy/multistep-perstep-reroute-reconnect.test.ts tests/workflow-deploy/crash-restart-reconnect-resumes.test.ts tests/workflow-deploy/crash-respawn-fifo.test.ts tests/workflow-deploy/crash-loop-latch.test.ts tests/workflow-deploy/on-trigger-signal-delivery.test.ts tests/workflow-deploy/on-trigger-between-events-restart.test.ts tests/workflow-deploy/on-trigger-body-sleep-restart-resumes.test.ts tests/workflow-deploy/sleep-restart-keeps-authority.test.ts tests/workflow-deploy/sleep-restart-hub-access.test.ts tests/workflow-deploy/on-trigger-agent-body.test.ts tests/workflow-deploy/on-trigger-action-body.test.ts tests/workflow-deploy/on-trigger-loop-body.test.ts tests/workflow-deploy/single-step-real-agent.test.ts tests/workflow-deploy/map-fan-out-real-agent.test.ts tests/workflow-deploy/multistep-signed-send.test.ts tests/workflow-deploy/single-step-message-input.test.ts tests/workflow-deploy/single-step-posix-tool.test.ts tests/workflow-deploy/single-step-credential-tool.test.ts tests/workflow-deploy/credential-bound-route-deploy.test.ts tests/workflow-deploy/action-step-credential.test.ts tests/workflow-deploy/action-hub-access.test.ts tests/workflow-deploy/tool-hub-access.test.ts tests/workflow-deploy/invoker-hub-access.test.ts tests/workflow-deploy/body-hub-access.test.ts tests/workflow-deploy/revoked-creator-grant-running-run.test.ts tests/workflow-deploy/expired-run-grant-running-run.test.ts tests/workflow-deploy/tarball-route-deploy.test.ts tests/workflow-deploy/folded-tools-failover-real-agent.test.ts tests/workflow-deploy/single-step-grants-bridge.test.ts tests/workflow-deploy/single-step-pinned-ask-tool.test.ts tests/workflow-deploy/single-step-per-run-grants.test.ts tests/workflow-deploy/approval-tracer-roundtrip.test.ts tests/workflow-deploy/scope-always-roundtrip.test.ts tests/workflow-deploy/childworkflow-scope-always-roundtrip.test.ts tests/workflow-deploy/mail-trigger-derived-grants-roundtrip.test.ts tests/workflow-deploy/mail-trigger-run-completes-real-route.test.ts tests/workflow-deploy/inbound-mail-enforcement-real-route.test.ts tests/workflow-deploy/run-mail-send-real-route.test.ts tests/workflow-deploy/mail-federation-derived-grants-roundtrip.test.ts tests/workflow-deploy/mail-federation-run-completes.test.ts tests/workflow-deploy/single-step-event-threading.test.ts tests/workflow-deploy/single-step-conversation-durability.test.ts tests/workflow-deploy/multistep-conversation-failover.test.ts tests/workflow-deploy/per-level-pipeline-real-agents.test.ts tests/workflow-deploy/dispatch-orchestrator-real-agents.test.ts tests/workflow-deploy/single-step-full-lifecycle.test.ts tests/workflow-deploy/single-step-mail-loop.test.ts tests/workflow-deploy/single-step-mail-in-reply-to.test.ts tests/workflow-deploy/single-step-mail-wait-wake.test.ts tests/workflow-deploy/single-step-mail-two-turn-thread.test.ts tests/workflow-deploy/single-step-mail-interactive-turns.test.ts tests/workflow-deploy/single-step-mail-flag-expunge.test.ts tests/workflow-deploy/cross-process-custom-adapter.test.ts tests/workflow-deploy/conversation-state-wal.test.ts tests/workflow-deploy/conversation-state-connector-seed.test.ts tests/workflow-deploy/drain-roundtrip.test.ts tests/workflow-deploy/fixtures/child-workflow.test.ts tests/workflow-deploy/child-workflow-roundtrip.test.ts tests/workflow-deploy/child-workflow-tool-invoke-roundtrip.test.ts tests/workflow-deploy/child-workflow-inherited-grants-roundtrip.test.ts tests/workflow-deploy/on-trigger-childworkflow-roundtrip.test.ts tests/workflow-deploy/loop-roundtrip.test.ts tests/workflow-deploy/loop-nested-roundtrip.test.ts tests/workflow-deploy/loop-action-roundtrip.test.ts tests/workflow-deploy/all-action-deploy.test.ts tests/workflow-deploy/sidecar-runs-no-workflow-code.test.ts tests/workflow-deploy/onfailure-action-roundtrip.test.ts tests/workflow-deploy/loop-await-signal-restart-resumes.test.ts tests/workflow-deploy/loop-childworkflow-roundtrip.test.ts tests/workflow-deploy/loop-work-then-signal-restart-resumes.test.ts tests/workflow-deploy/loop-await-signal-drain-roundtrip.test.ts tests/workflow-deploy/loop-childworkflow-inflight-grandchild-drain.test.ts tests/workflow-deploy/childworkflow-restart-resumes.test.ts tests/workflow-deploy/body-action-restart-effect-once.test.ts tests/workflow-deploy/body-action-crash-mid-effect.test.ts tests/workflow-deploy/childworkflow-drain-wait-resumes.test.ts tests/workflow-deploy/childworkflow-unanswerable-gate.test.ts tests/workflow-deploy/on-trigger-drain-roundtrip.test.ts tests/workflow-deploy/unresolvable-director.test.ts tests/workflow-deploy/fifo-mail.test.ts tests/workflow-deploy/mail-edge-cases.test.ts tests/workflow-deploy/run-event-batching.test.ts tests/workflow-deploy/walking-skeleton.e2e.test.ts tests/workflow-deploy/asset-source.e2e.test.ts tests/workflow-deploy/asset-tool-restarts.e2e.test.ts tests/workflow-deploy/source-workflow.e2e.test.ts tests/workflow-deploy/source-monorepo.e2e.test.ts tests/workflow-deploy/source-monorepo-many.e2e.test.ts tests/workflow-deploy/source-tamper-reject.e2e.test.ts tests/workflow-deploy/source-catalog.e2e.test.ts tests/workflow-deploy/source-mixed-closure.e2e.test.ts tests/workflow-deploy/source-closure-director.e2e.test.ts tests/workflow-deploy/source-credential.e2e.test.ts tests/workflow-deploy/source-inline-tool.e2e.test.ts tests/workflow-deploy/source-posix-lsp.e2e.test.ts tests/workflow-deploy/loop-tool-invoke-roundtrip.test.ts tests/workflow-deploy/child-workflow-loop-tool-invoke-roundtrip.test.ts tests/workflow-deploy/on-trigger-tool-invoke-roundtrip.test.ts tests/workflow-deploy/on-trigger-credential-tool.test.ts tests/workflow-deploy/loop-map-tool-invoke-roundtrip.test.ts tests/workflow-deploy/loop-nested-tool-invoke-roundtrip.test.ts

# The core integration pass: inference, hub-api, and db suites that need
# real Postgres and the extended timeout. Files run in parallel
Expand Down
4 changes: 2 additions & 2 deletions apps/admin-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ client, and renders the TanStack Router defined in `src/router.tsx`.
The router gates every authenticated route behind a `/api/me`
session check (redirecting to `/login` on failure) and exposes the
tenant-management console: a dashboard plus per-tenant pages for
agents, instances, principals, roles, grants, credentials, wallets,
approvals, principals, roles, grants, credentials, wallets,
offerings, models, model providers, model offerings, and workflows,
each with a list and detail view.
each with a list and detail view, plus a detail view for each run.

Develop with `bun run dev` (Vite dev server), build with
`bun run build`, and preview a production build with
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ operators run.

`src/index.ts` opens the Postgres connection (`@intx/db`),
constructs the better-auth wrapper and grant store, generates the
hub's deploy signing key, and builds the agent-repo, asset, and
hub's commit signing key, and builds the agent-repo, asset, and
session services from `@intx/hub-sessions`. It then assembles the
Hono app with `createApp` from `@intx/hub-api`, mounts the sidecar
WebSocket upgrade handler, and exports a Bun server object
Expand Down
67 changes: 5 additions & 62 deletions apps/hub/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import {
type WsHandle,
} from "@intx/hub-sessions";
import { generateKeyPair } from "@intx/crypto";
import { hexEncode } from "@intx/types";
import { MAX_SIDECAR_FRAME_BYTES } from "@intx/types/sidecar";
import { upgradeWebSocket, websocket } from "hono/bun";
import { setup, getLogger } from "@intx/log";
Expand Down Expand Up @@ -206,36 +205,9 @@ export async function createHubServer({
}

const hubSigningKey = await generateKeyPair();
log.info("Generated hub deploy signing key");

// Write-path GC for the hub's agent-state repos. Each accepted state
// pack strands the prior tip's objects and adds a pack, and each deploy
// commit strands loose objects; left alone the repo grows without bound.
// The hub reclaims on the write path once a repo crosses
// HUB_AGENT_GC_PACK_THRESHOLD packs or HUB_AGENT_GC_LOOSE_THRESHOLD loose
// objects, and warns once it crosses HUB_AGENT_GC_WARN_BYTES. Retention
// is fixed to keep-history and not operator-configurable: the hub is the
// long-term archive of an agent's state graph, and tip-only would prune
// the commit ancestry the hub's subscriber-seq and history replay derive
// from git.log.
const DEFAULT_HUB_AGENT_GC_PACK_THRESHOLD = 64;
const DEFAULT_HUB_AGENT_GC_LOOSE_THRESHOLD = 2048;
const DEFAULT_HUB_AGENT_GC_WARN_BYTES = 256 * 1024 * 1024;

function readPositiveIntEnv(name: string, fallback: number): number {
const raw = process.env[name];
if (raw === undefined || raw.trim() === "") return fallback;
const value = Number(raw);
if (!Number.isInteger(value) || value <= 0) {
throw new Error(
`${name} must be a positive integer; got ${JSON.stringify(raw)}`,
);
}
return value;
}
log.info("Generated hub signing key");

// Like `readPositiveIntEnv` but with no fallback: returns `undefined` when the
// var is unset so the caller can omit the field and let the consumer apply its
// Returns `undefined` when the var is unset so the caller can omit the field and let the consumer apply its
// own default, instead of duplicating that default here.
function readOptionalPositiveIntEnv(name: string): number | undefined {
const raw = process.env[name];
Expand Down Expand Up @@ -297,45 +269,18 @@ export async function createHubServer({
const agentRepoStore = createAgentRepoStore({
dataDir: hubDataDir,
signingKey: hubSigningKey,
gc: {
packThreshold: readPositiveIntEnv(
"HUB_AGENT_GC_PACK_THRESHOLD",
DEFAULT_HUB_AGENT_GC_PACK_THRESHOLD,
),
looseThreshold: readPositiveIntEnv(
"HUB_AGENT_GC_LOOSE_THRESHOLD",
DEFAULT_HUB_AGENT_GC_LOOSE_THRESHOLD,
),
warnBytes: readPositiveIntEnv(
"HUB_AGENT_GC_WARN_BYTES",
DEFAULT_HUB_AGENT_GC_WARN_BYTES,
),
retention: "keep-history",
},
});

// The asset service shares the agent-repo store's substrate so skill
// assets land under the same on-disk root and reuse the same signing
// key for commit signatures. It is consumed by the session service for
// per-attachment pack fan-out, by the smart-HTTP asset routes for clone
// and push, and by the mail-triggered run-grants materializer to hydrate
// a receiving deployment's definition. The E2E test seeds fixtures
// directly through this service object.
// The asset service shares the agent-repo store's substrate so assets land
// under the same on-disk root and reuse the same signing key for commit
// signatures. It backs the asset REST and smart-HTTP routes.
const httpRegistries = new Map([
["npmjs", { url: "https://registry.npmjs.org" }],
]);

const assetService = createAssetService({
db,
repoStore: agentRepoStore.repoStore,
// Reserve every configured HTTP registry name so a `package-registry`
// asset cannot silently shadow it at session launch. The session
// service's per-launch registry assembly applies asset-wins-on-name-
// collision (see `session-service.ts` `assetIndex` build), which
// turns a same-named asset into an opaque reroute of the public
// npm registry; rejecting at creation surfaces the collision at
// intent time instead of debugging an unexpected reroute later.
reservedPackageRegistryNames: new Set(httpRegistries.keys()),
});

// Shared by pack ingestion and lifecycle recovery so recovery never claims a
Expand Down Expand Up @@ -404,7 +349,6 @@ export async function createHubServer({
const probeTimeoutMs = readOptionalPositiveIntEnv("HUB_PROBE_TIMEOUT_MS");

const sidecarRouter = createSidecarRouter({
hubPublicKey: hexEncode(hubSigningKey.publicKey),
authenticateSidecar: async ({ token }) => sidecarCredentials.resolve(token),
validateSidecarIdentity: sidecarCredentials.isCurrent,
withExecutableWorkflowRun: (target, send, signal) =>
Expand Down Expand Up @@ -458,7 +402,6 @@ export async function createHubServer({
sidecarRouter,
sidecarAllocationRouter: sidecarRouter,
agentRepoStore,
assetService,
db,
toolPackageRegistries: {
httpRegistries,
Expand Down
Loading
Loading