diff --git a/DESIGN.md b/DESIGN.md
index 9924f21bf91..3692c8f242a 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -43,6 +43,10 @@ action on the left and the primary action on the right. A step owns its whole
footer: do not render Save & exit in a separate parent block below it. Check this
alignment in every step and conditional state, not just the first screen.
+Completed Slack setup is a success view: show the full agent avatar, success message,
+and one centered Done action. Omit Save & exit after the connection has been
+confirmed. The shared footer rule applies to its unfinished setup steps.
+
## Mobile navigation and text fields
The fixed bottom navigation uses an opaque surface so scrolling content cannot
diff --git a/README.md b/README.md
index a0db4476643..e433acfdc1b 100644
--- a/README.md
+++ b/README.md
@@ -14,8 +14,12 @@
-
+
+
+
+
+
diff --git a/cli/src/__tests__/worktree.test.ts b/cli/src/__tests__/worktree.test.ts
index bf867b9c7ea..e4e57e09bfa 100644
--- a/cli/src/__tests__/worktree.test.ts
+++ b/cli/src/__tests__/worktree.test.ts
@@ -1472,6 +1472,36 @@ describe("worktree helpers", () => {
}
});
+ it("creates an explicitly empty worktree without inherited signing secrets or deferred copying", async () => {
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-worktree-empty-"));
+ const originalCwd = process.cwd();
+ const originalJwt = process.env.PAPERCLIP_AGENT_JWT_SECRET;
+ const originalSigning = process.env.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET;
+ try {
+ const repoRoot = path.join(tempRoot, "repo");
+ fs.mkdirSync(repoRoot, { recursive: true });
+ process.chdir(repoRoot);
+ process.env.PAPERCLIP_AGENT_JWT_SECRET = "source-jwt-secret";
+ process.env.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET = "source-signing-secret";
+ await worktreeInitCommand({ empty: true, fromConfig: path.join(tempRoot, "missing.json"), home: path.join(tempRoot, "instances") });
+ const env = fs.readFileSync(path.join(repoRoot, ".paperclip/.env"), "utf8");
+ expect(env).not.toContain("source-jwt-secret");
+ expect(env).not.toContain("source-signing-secret");
+ expect(env).toContain("PAPERCLIP_AGENT_JWT_SECRET=");
+ expect(fs.existsSync(path.join(repoRoot, ".paperclip/seed-manifest.json"))).toBe(false);
+ expect(fs.existsSync(path.join(repoRoot, ".paperclip/seed-pending"))).toBe(false);
+ expect(fs.existsSync(path.join(repoRoot, ".paperclip/seed-empty"))).toBe(true);
+ await worktreeInitCommand({ seed: false, force: true, fromConfig: path.join(tempRoot, "missing.json"), home: path.join(tempRoot, "instances") });
+ expect(fs.existsSync(path.join(repoRoot, ".paperclip/seed-empty"))).toBe(false);
+ expect(readWorktreeSeedManifest(path.join(repoRoot, ".paperclip/config.json"))?.state).toBe("pending");
+ } finally {
+ process.chdir(originalCwd);
+ if (originalJwt === undefined) delete process.env.PAPERCLIP_AGENT_JWT_SECRET; else process.env.PAPERCLIP_AGENT_JWT_SECRET = originalJwt;
+ if (originalSigning === undefined) delete process.env.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET; else process.env.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET = originalSigning;
+ fs.rmSync(tempRoot, { recursive: true, force: true });
+ }
+ });
+
it("persists the current agent jwt secret into the worktree env file", async () => {
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-worktree-jwt-"));
const repoRoot = path.join(tempRoot, "repo");
diff --git a/cli/src/commands/worktree-lib.ts b/cli/src/commands/worktree-lib.ts
index 8d3aa01f6fe..f4524c38a8e 100644
--- a/cli/src/commands/worktree-lib.ts
+++ b/cli/src/commands/worktree-lib.ts
@@ -8,6 +8,7 @@ export const WORKTREE_SEED_MODES = ["minimal", "full"] as const;
export const WORKTREE_SEED_MANIFEST = "seed-manifest.json";
export const WORKTREE_SEED_PENDING_MARKER = "seed-pending";
export const WORKTREE_SEED_COMPLETE_MARKER = "seed-complete";
+export const WORKTREE_SEED_EMPTY_MARKER = "seed-empty";
export const WORKTREE_SEED_LOCK_MARKER = "seed.lock";
export type WorktreeSeedMode = (typeof WORKTREE_SEED_MODES)[number];
@@ -98,6 +99,7 @@ export type WorktreeSeedMarkerPaths = {
manifest: string;
pending: string;
complete: string;
+ empty: string;
lock: string;
};
@@ -107,6 +109,7 @@ export function resolveWorktreeSeedMarkerPaths(configPath: string): WorktreeSeed
manifest: path.resolve(configDir, WORKTREE_SEED_MANIFEST),
pending: path.resolve(configDir, WORKTREE_SEED_PENDING_MARKER),
complete: path.resolve(configDir, WORKTREE_SEED_COMPLETE_MARKER),
+ empty: path.resolve(configDir, WORKTREE_SEED_EMPTY_MARKER),
lock: path.resolve(configDir, WORKTREE_SEED_LOCK_MARKER),
};
}
diff --git a/cli/src/commands/worktree.ts b/cli/src/commands/worktree.ts
index 8acbe10b047..69f4c570e41 100644
--- a/cli/src/commands/worktree.ts
+++ b/cli/src/commands/worktree.ts
@@ -16,7 +16,7 @@ import {
import os from "node:os";
import path from "node:path";
import { execFileSync } from "node:child_process";
-import { randomUUID } from "node:crypto";
+import { randomBytes, randomUUID } from "node:crypto";
import { createServer } from "node:net";
import { Readable } from "node:stream";
import * as p from "@clack/prompts";
@@ -118,6 +118,7 @@ type WorktreeInitOptions = {
serverPort?: number;
dbPort?: number;
seed?: boolean;
+ empty?: boolean;
seedMode?: string;
preserveLiveWork?: boolean;
force?: boolean;
@@ -245,6 +246,7 @@ export type EnsureWorktreeSeededResult = {
| "seeded"
| "verified_manifest"
| "complete_marker"
+ | "explicitly_empty"
| "legacy_unmarked"
| "legacy_database";
details?: SeedWorktreeDatabaseResult;
@@ -2221,6 +2223,9 @@ export async function ensureWorktreeSeeded(
): Promise {
const configPath = resolveConfigPath(opts.config);
const markers = resolveWorktreeSeedMarkerPaths(configPath);
+ if (existsSync(markers.empty)) {
+ return { seeded: false, reason: "explicitly_empty" };
+ }
const initialManifest = readWorktreeSeedManifest(configPath);
if (initialManifest?.state === "verified") {
return { seeded: false, reason: "verified_manifest" };
@@ -2282,6 +2287,9 @@ export async function ensureWorktreeSeeded(
mkdirSync(path.dirname(markers.lock), { recursive: true });
const releaseLock = await acquireWorktreeSeedLock(markers.lock);
try {
+ if (existsSync(markers.empty)) {
+ return { seeded: false, reason: "explicitly_empty" };
+ }
// These checks deliberately happen under the cross-process lock. A second
// service process waits for the first seed transaction, then observes the
// verified manifest instead of cloning the same database concurrently.
@@ -2434,8 +2442,10 @@ async function runWorktreeInit(opts: WorktreeInitOptions): Promise {
rmSync(paths.configPath, { force: true });
rmSync(paths.envPath, { force: true });
const seedMarkers = resolveWorktreeSeedMarkerPaths(paths.configPath);
+ rmSync(seedMarkers.manifest, { force: true });
rmSync(seedMarkers.pending, { force: true });
rmSync(seedMarkers.complete, { force: true });
+ rmSync(seedMarkers.empty, { force: true });
rmSync(paths.instanceRoot, { recursive: true, force: true });
}
@@ -2464,6 +2474,11 @@ async function runWorktreeInit(opts: WorktreeInitOptions): Promise {
});
try {
+ // Persist the no-copy choice before the config becomes visible to managed startup.
+ if (opts.empty) {
+ mkdirSync(paths.repoConfigDir, { recursive: true });
+ writeFileSync(resolveWorktreeSeedMarkerPaths(paths.configPath).empty, "Explicitly empty instance; automatic database copying is disabled.\n", { mode: 0o600 });
+ }
writeConfig(selectedConfig, paths.configPath);
writeWorktreePortRegistry(paths.homeDir, [
...registeredConfigPaths,
@@ -2471,6 +2486,7 @@ async function runWorktreeInit(opts: WorktreeInitOptions): Promise {
]);
} catch (error) {
rmSync(paths.configPath, { force: true });
+ if (opts.empty) rmSync(resolveWorktreeSeedMarkerPaths(paths.configPath).empty, { force: true });
throw error;
}
@@ -2481,18 +2497,20 @@ async function runWorktreeInit(opts: WorktreeInitOptions): Promise {
};
},
);
- markWorktreeSeedPending({
- configPath: paths.configPath,
- sourceConfigPath,
- targetInstanceId: instanceId,
- seedMode,
- });
+ if (!opts.empty) {
+ markWorktreeSeedPending({
+ configPath: paths.configPath,
+ sourceConfigPath,
+ targetInstanceId: instanceId,
+ seedMode,
+ });
+ }
const sourceEnvEntries = readPaperclipEnvEntries(resolvePaperclipEnvFile(sourceConfigPath));
const existingAgentJwtSecret =
- nonEmpty(sourceEnvEntries.PAPERCLIP_AGENT_JWT_SECRET) ??
+ opts.empty ? randomBytes(32).toString("base64url") : nonEmpty(sourceEnvEntries.PAPERCLIP_AGENT_JWT_SECRET) ??
nonEmpty(process.env.PAPERCLIP_AGENT_JWT_SECRET);
const existingToolActionSigningSecret =
- nonEmpty(sourceEnvEntries.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET) ??
+ opts.empty ? randomBytes(32).toString("base64url") : nonEmpty(sourceEnvEntries.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET) ??
nonEmpty(process.env.PAPERCLIP_TOOL_ACTION_SIGNING_SECRET);
mergePaperclipEnvEntries(
{
@@ -2511,7 +2529,7 @@ async function runWorktreeInit(opts: WorktreeInitOptions): Promise {
let seedExecutionQuarantineSummary: SeededWorktreeExecutionQuarantineSummary | null = null;
let pausedScheduledRoutineCount: number | null = null;
let reboundWorkspaceSummary: SeedWorktreeDatabaseResult["reboundWorkspaces"] = [];
- if (opts.seed !== false) {
+ if (!opts.empty && opts.seed !== false) {
if (!sourceConfig) {
throw new Error(
`Cannot seed worktree database because source config was not found at ${sourceConfigPath}. Use --no-seed or provide --from-config.`,
@@ -2601,6 +2619,8 @@ export async function worktreeEnsureSeededCommand(opts: WorktreeEnsureSeededOpti
spinner.stop("Seeded isolated worktree database (minimal).");
} else if (result.reason === "legacy_database") {
spinner.stop("Validated and adopted an existing legacy worktree database.");
+ } else if (result.reason === "explicitly_empty") {
+ spinner.stop("Explicitly empty instance; automatic database copying is disabled.");
} else {
spinner.stop("Worktree database already has a verified seed manifest.");
}
@@ -2618,7 +2638,7 @@ export async function worktreeEnsureSeededCommand(opts: WorktreeEnsureSeededOpti
);
}
}
- p.outro(pc.green("Worktree database seed complete."));
+ p.outro(pc.green(result.reason === "explicitly_empty" ? "Empty worktree ready." : "Worktree database seed complete."));
} catch (error) {
spinner.stop(pc.red("Failed to seed worktree database."));
throw error;
@@ -4320,6 +4340,8 @@ async function runWorktreeReseed(opts: WorktreeReseedOptions): Promise {
expectedCompanyId: nonEmpty(process.env.PAPERCLIP_SEED_EXPECTED_COMPANY_ID) ?? undefined,
seedDatabase: seedWorktreeDatabase,
});
+ // An operator-confirmed successful reseed replaces the earlier empty-instance choice.
+ rmSync(markers.empty, { force: true });
spinner.stop(`Reseeded ${targetEndpoint.label} (${seedMode}).`);
p.log.message(pc.dim(`Source: ${source.configPath}`));
p.log.message(pc.dim(`Target: ${targetEndpoint.configPath}`));
@@ -4456,6 +4478,7 @@ export function registerWorktreeCommands(program: Command): void {
.option("--seed-mode ", "Seed profile: minimal or full (default: minimal)", "minimal")
.option("--preserve-live-work", "Do not quarantine copied agent work or workspace runtime services in the seeded worktree", false)
.option("--no-seed", "Skip database seeding from the source instance")
+ .option("--empty", "Create an empty instance without immediate or deferred database copying", false)
.option("--force", "Replace existing repo-local config and isolated instance data", false)
.action(worktreeMakeCommand);
@@ -4473,6 +4496,7 @@ export function registerWorktreeCommands(program: Command): void {
.option("--seed-mode ", "Seed profile: minimal or full (default: minimal)", "minimal")
.option("--preserve-live-work", "Do not quarantine copied agent work or workspace runtime services in the seeded worktree", false)
.option("--no-seed", "Skip database seeding from the source instance")
+ .option("--empty", "Create an empty instance without immediate or deferred database copying", false)
.option("--force", "Replace existing repo-local config and isolated instance data", false)
.action(worktreeInitCommand);
diff --git a/doc/DATABASE.md b/doc/DATABASE.md
index 91976e8e21b..7799ead39ed 100644
--- a/doc/DATABASE.md
+++ b/doc/DATABASE.md
@@ -226,15 +226,15 @@ When authoring migrations or one-time backfills:
- Split schema changes, index creation, and data backfill into separate phases so each step has clear locking and rollback behavior.
- Treat the `check:migrations` CI gate as the enforcement backstop for these rules. If it flags a migration, rewrite the migration or add a suppression comment with the indexed predicate, batch bound, and reason the remaining scan is safe.
-Private-task migration `0313` is explicitly allowlisted in the
-Paperclip executor to run outside a file-wide transaction. Its idempotent
+Private-task migrations `0313` and `0314` are explicitly allowlisted in the
+Paperclip executor to run outside a file-wide transaction. Their idempotent
keyset batches commit every 1,000 rows, and migration history is recorded only
when all batches finish. The executor repairs invalid concurrent indexes on
retry. A reserved connection holds a session advisory lock across all batch
commits, so concurrent migrators recheck history only after the preceding runner
finishes. Privacy triggers are replaced atomically. Bootstrap uses the same
executor; other migrations remain transactional
-per file. Apply this migration through `pnpm db:migrate` using a direct
+per file. Apply these migrations through `pnpm db:migrate` using a direct
connection, before enabling the new server and UI.
## Migration snapshots
@@ -631,3 +631,53 @@ reads and server startup do not provision them. Normal backups preserve identity
rows and need the matching secrets master key for recovery. Both development seed
modes omit identity rows, including with live-work preservation, so copied agents
get fresh identities. See [Agent cryptographic identity](AGENT-IDENTITY.md).
+
+### Slack app registration
+
+`chat_slack_registrations` stores one company-scoped app registration per chat
+endpoint. A composite foreign key binds `(company_id, endpoint_id)` to the
+endpoint's company. It contains the creation request ID, immutable manifest
+snapshot/hash, OAuth callback URI, app/client IDs, vault references, installation
+identity, status, safe failure code, creator, and timestamps. It contains no
+plaintext configuration token, OAuth code, signing/client secret, or bot token.
+
+Creation records `creating` before dispatch. An interrupted attempt becomes
+`uncertain`; a new request needs explicit confirmation that no app exists.
+`install` means the app exists. `credentials_saved` means the OAuth bot token is
+vaulted and connection checks can resume. `configured` means runtime credentials
+are durably bound; staged duplicates are cleaned and the client secret remains
+available for reauthorization. `removed` invalidates registration and keeps the
+safe app management link for provider-side cleanup.
+
+`chat_endpoints.setup.slackAvatar` records optional avatar provisioning as
+`pending`, `uploaded` with its confirmation timestamp, or `failed` with a fixed
+safe error code. It survives reloads and restarts. App credentials are durably
+bound before icon upload; an interrupted upload never triggers another app
+creation. This JSON state stores no token, image URL, or provider error payload.
+
+`chat_endpoints.setup.slackAccount` stores the OAuth installer’s Slack ID, the
+initiating Paperclip user ID, pending/linked status, durable welcome-DM and
+optional verification-DM status, and the returned DM channel ID. It stores no
+user OAuth token or provider payload.
+The account uses the existing company-scoped `chat_identity_links` table; it
+preserves conflicting/revoked links and does not change on reauthorization.
+Both message dispatches move pending → sending before network I/O, then sent/failed;
+a restart or ambiguous response moves sending → uncertain without replay.
+Signed Request URL verification can precede installation. Internal setup state
+retains a signing-secret fingerprint and observed URL so configuration preserves
+that evidence only for the same secret and callback. No plaintext secret is stored
+in setup state, and the fingerprint is excluded from endpoint responses.
+For automatically registered apps, `webhookVerifiedAt` also records successful
+delivery of an authenticated message/app-mention event to the current callback
+URL. The current signing secret, saved app/workspace/bot binding, active connection,
+and runtime generation are checked before recording it. This is Paperclip's
+connection evidence, not Slack's settings-page URL-verification flag. Activity
+identifies this evidence as `authenticated_event`; no message body is recorded.
+
+Slack install attempts use `tool_oauth_states` with the `slack-install.` namespace.
+They expire after ten minutes, bind the company/connection/endpoint, registration
+request ID, app ID, initiating actor/session, callback URI, and requested scopes,
+and are atomically deleted before code exchange. The `code_verifier` column holds
+this non-secret binding for this namespace; Slack bot installation does not use
+PKCE. Removal and manual recovery invalidate outstanding attempts under the same
+credential-mutation lease used by configuration.
diff --git a/doc/DEVELOPING.md b/doc/DEVELOPING.md
index fede68c1399..24fbd4ce96e 100644
--- a/doc/DEVELOPING.md
+++ b/doc/DEVELOPING.md
@@ -92,6 +92,12 @@ The vite dev server serves an unbundled module graph. This is fast to reload on
The preview server binds `0.0.0.0` and accepts any Host, so a tailnet or LAN address (e.g. `http://.ts.net:3101/`) works out of the box. The `/api` proxy sets `x-forwarded-host` and `x-forwarded-proto`, which the server's board mutation guard uses to trust the browser's Origin — mutations from `:3101` succeed against the API on `:3100` without further configuration. An HTTPS tunnel in front of the preview server (ngrok, tailscale funnel) is also supported: the tunnel's `x-forwarded-proto` header is preserved when set.
+Static UI mode compresses built JavaScript, CSS, and HTML with Brotli or gzip
+when the browser supports it. Hashed assets retain their immutable cache policy;
+byte-range responses retain their original representation. This reduces initial
+page downloads through bandwidth-limited HTTPS tunnels such as Tailscale Funnel.
+API responses and MCP transports keep their existing compression behavior.
+
## Storybook
The board UI Storybook keeps stories and Storybook config under `ui/storybook/` so component review files stay out of the app source routes.
@@ -103,6 +109,11 @@ pnpm build-storybook
These run the `@paperclipai/ui` Storybook on port `6006` and build the static output to `ui/storybook-static/`.
+**HTML artifacts** covers secure rendered/raw attachment previews, interactive
+reports, security probes, workspace previews, and opening a report from a task.
+See [HTML artifact previews](html-artifact-previews.md) for the security boundary,
+supported content, and browser verification command.
+
**Composer → New task** includes agent/user/project/task mentions, skill and
routine slash commands, and populated rich chips on desktop and mobile. Agent
mentions use the same avatars in suggestions, inserted chips, and the mocked
@@ -163,6 +174,16 @@ checkout, including a non-primary checkout. Changing projects clears the
previous worktree choice. Switching from reuse to a new worktree or the project
workspace restores the project default checkout. Task creation uses the selected company and has
no separate heading or settings control.
+
+Task execution-policy controls apply the shared schema defaults when stages or
+participants are omitted. An invalid policy shows an unavailable notice and
+disables policy edits while leaving other task properties usable. Refresh to
+retry. Optional browser error monitoring reports only a fixed field category,
+once per mounted control; it never includes the policy or task identifiers.
+Edits in the reviewer and monitor controls retain an explicitly configured
+review-round limit when the last reviewer or monitor is removed, so adding a
+reviewer later uses the saved limit.
+
Fresh tasks start with an empty request and the last task assignee chosen in that
company, including a human. If that assignee is unavailable, the CEO is the
default, or the first eligible agent when the company has no CEO. Explicit launch
@@ -617,25 +638,34 @@ case.
### Slack chat setup in a test drive
Enable **Chat connectors** in Instance Settings, then open **Connectors → Slack →
-Chat with an agent**. Before connecting, configure a public HTTPS URL that Slack
-can reach. The setup page shows this requirement above the app details.
-Slack app name, bot display name, and slash command are editable while the
-connection is a draft; valid edits save when a field loses focus. **Create Slack
-app** opens Slack with the generated manifest prefilled. **View Slack App Manifest**
-opens the read-only manifest in a modal to inspect or copy it. Once connected,
-the app details are locked so reconnecting cannot silently change the registered
-command. Slack still requires workspace selection, installation approval, and
-copying the bot token and signing secret back into Paperclip.
+Chat with an agent**. Before creating an app, configure a public HTTPS board URL
+and webhook ingress that Slack can reach. The setup page shows this prerequisite;
+a loopback test drive can exercise the UI before HTTPS is configured.
-After Slack verifies its Events Request URL, the wizard asks you to send
-`/ connect`. This command works before a sender or channel is
-allowed to start work. It records the Slack identity and sends a private,
-one-time confirmation link that expires after 15 minutes; it creates no task
-and grants no access. You can confirm **This is my Slack account** in the wizard,
-or follow the private link and sign into Paperclip. Both paths check company
-membership before linking, and future messages use the linked user's current
-permissions. The wizard only lists identities that sent the connect command to
-this endpoint during the current test.
+New Slack connections use five steps: choose an agent, enter an app configuration
+token, install the app, verify Slack delivery, and try a conversation. Agent
+selection generates readable defaults for the Slack app name, bot display name,
+and slash command; edit them under **Advanced** if needed. **Get your App
+configuration token** opens Slack app settings. Enter the temporary token directly
+into Paperclip, then select **Create Slack app**. Paperclip creates the app,
+vaults its credentials, and attempts avatar upload before discarding the token.
+App details lock after creation dispatch, including an uncertain result.
+
+**Install in Slack** obtains the bot token through OAuth, links the installing
+Slack account to the Paperclip account that started installation, and sends one
+welcome DM. Approve with your own Slack account. After Slack verifies the Events
+Request URL, use **Open your Slack DM**, send the suggested message, and continue
+in the thread. **Done** finishes setup; the conversation test is optional.
+See [Automatic Slack app setup](connections/SLACK-AUTOMATIC-SETUP.md) for
+HTTPS configuration and recovery.
+
+**Create manually** and **Use an existing app** are under **Advanced** on the
+token step. These paths retain manual credential entry and a separate personal
+account-linking step. Send `/ connect` to discover your identity
+without starting work, then confirm **This is my Slack account** in the wizard
+or use the private confirmation link. The link expires after 15 minutes and
+requires company membership. Future messages use the linked user's current
+permissions. Additional or different accounts can be linked later in **Access**.
New Slack connections disable **Allow unlinked people** by default. The Access
page includes the shareable connect command and instructions for other users.
@@ -653,14 +683,11 @@ company. Preview, access-request, and confirmation APIs also enforce the chat
connector rollout flag on the server; invitees cannot read board experimental
settings before they join. Expired or consumed tokens grant no access.
-The final wizard step suggests `@ you there?`, then continuing in
-the agent's thread. Select the bot from Slack's @mention suggestions so the
-message includes a real mention. It detects a message or task command from the current user's
-linked Slack identity during this setup session and shows a checkmark. This
-conversation test is optional: **I've sent the test message** and **Skip test and
-finish** both finish setup once webhook verification and account linking are
-complete. The separate strict connection-test API retains its conversation and
-delivery checks.
+The manual path suggests `@ you there?`, then continuing in the agent's
+thread. Select the bot from Slack's @mention suggestions so the message includes
+a real mention. **Done** finishes setup once webhook verification and required
+account linking are complete, whether or not a test message was sent. The
+separate strict connection-test API retains its conversation and delivery checks.
### Chat activity pagination and callback diagnostics
@@ -749,6 +776,36 @@ PAPERCLIP_HOME=/custom/path PAPERCLIP_INSTANCE_ID=dev pnpm paperclipai run
No Docker or external database is required for this mode.
+## Issue Privacy Rollout
+
+`PAPERCLIP_ISSUE_PRIVACY_MODE` controls the canonical opt-in issue/project privacy predicate:
+
+- `enforce` (default): return private issues only to implicit principals, issue grantees, or private-project access members; hide private projects from non-members
+- `shadow`: log structured would-deny decisions but preserve existing reads; use only for rollout diagnosis
+- `off`: skip the predicate and shadow logging
+
+Grant checks read current database state; there is no positive privacy cache.
+Sharing a task grants access to that task and its private descendants. Parents
+and siblings need separate grants. An agent's access is intersected with its
+run's responsible user's current access.
+
+`enforce` is the production default. `shadow` and `off` disclose private data and
+are only temporary diagnostic overrides. The old branch's historical sign-off
+does not qualify the current runtime. See [ISSUE-PRIVACY.md](./ISSUE-PRIVACY.md)
+for the model, validation coverage, break-glass behavior, and residual risks.
+
+Issue-bound heartbeat runs inherit the same read predicate through the stored
+`heartbeat_runs.scope_kind = 'issue'` and `issue_id` binding. Issue deletion
+nulls the foreign key but preserves the explicit issue scope as a fail-closed
+tombstone. Workspace-operation history is either deleted with its direct issue
+or run binding, or remains bound to that fail-closed run tombstone, so it cannot
+become company-level maintenance data through foreign-key nulling. In enforce mode, direct run detail, transcript,
+event, log, and workspace-operation reads return `404` to non-members. Company
+run-history and live-run lists retain a metadata-only row with timing, status,
+token usage, and cost for budget oversight; issue identifiers, summaries, and
+run content are omitted. Runs without an issue binding keep company-level
+maintenance-run visibility.
+
## Storage in Dev (Auto-Handled)
For local development, the default storage provider is `local_disk`, which persists uploaded images/attachments at:
@@ -823,10 +880,12 @@ If a repository is detached or its source configuration changes, its previous ta
## Config Freshness
-Agent, project, environment, secret, skill, and workspace config edits are sampled at the next run boundary. A heartbeat that is already running finishes with the config it started with.
+Agent, project, environment, secret, skill, and workspace config edits are sampled at the next run boundary. A heartbeat that is already running finishes with the config it started with. Native runners project explicitly configured task environment variables into provider processes and tool commands, including custom `PAPERCLIP_*` names such as `PAPERCLIP_PAGE_BUCKET`. Adding, changing, or removing a projected variable replaces a retained provider process at the next run boundary. Unchanged variables permit process reuse. The projection contains names only; secret values stay in the child environment. Ambient host secrets are not projected. Native projections allow up to 128 variable names, 64 KiB per entry, and 256 KiB of values in total. These native launch limits do not apply to legacy adapter configuration. Runtime authority, provider login credentials, and process-loader settings use their existing restricted paths.
When effective run config changes, Paperclip may intentionally skip a saved adapter session, refresh persisted workspace runtime config, replace a reused execution workspace, or avoid reusing a sandbox/environment lease. Fresh execution can lose adapter-specific session, workspace, or sandbox state; correctness of the next run's config takes priority over continuity. Plain environment values affect freshness through value hashes; run result JSON and workspace operation logs expose only the non-sensitive freshness decision categories, without storing secret values, full env maps, provider credentials, or private path details.
+An explicit `reuse_existing` Git workspace keeps its recorded source repository, including after its project-workspace row is deleted or the project primary changes. The server verifies the original company, project, repository origin, and worktree registration before reuse. It does not attach a deleted association to the new primary. A conflicting explicit project-workspace selection, missing source identity, or an unverified legacy local checkout blocks the run. Restore the original source. Before intentionally clearing the existing-workspace binding to choose a new repository, review and preserve its retained work. Missing worktrees may be reconstructed only from the verified original source; current project defaults are not a fallback.
+
## Workspace Git Scan Protection
Paperclip applies one process-wide scheduler to expensive host-side workspace Git enumeration, including changed-file browsing, runtime/finalization cleanliness guards, and adapter sandbox-sync snapshots. The scheduler defaults to two active scans and a bounded queue of 32. Identical buffered scans of the same canonical worktree share one subprocess, while successful changed-file listings are cached for 10 seconds. Streaming snapshot scans have caller-owned sinks, so they use separate jobs in the same queue and are never cached or coalesced. Correctness-sensitive runtime guards bypass the result cache.
@@ -885,7 +944,16 @@ Seed modes:
- `minimal` keeps core app state like companies, projects, issues, comments, approvals, and auth state, preserves schema for all tables, but omits row data from heavy operational history such as heartbeat runs, wake requests, activity logs, runtime services, and agent session state
- `full` makes a full logical clone of the source instance
-- `--no-seed` creates an empty isolated instance
+- `--no-seed` defers database copying until the worktree is first used
+- `--empty` creates an empty isolated instance, with fresh signing secrets and no deferred copy; use this for synthetic test drives
+
+`--empty` persists a `.paperclip/seed-empty` marker before writing the instance config.
+The CLI and managed runtime provisioner honor it even when a registered source
+instance is present. An explicit successful `worktree reseed`, or a replacement
+`worktree init --force` without `--empty`, clears the choice.
+While that marker exists, startup uses the instance's saved JWT and tool-action
+signing keys even if the shell inherited another instance's keys. Better Auth
+uses its saved key or the fresh instance JWT key. Missing saved keys stop startup.
Seeded worktree instances quarantine copied live execution by default for both `minimal` and `full` seeds. During restore, Paperclip disables copied agent timer heartbeats, resets copied `running` agents to `idle`, blocks and unassigns copied agent-owned `in_progress` issues, and unassigns copied agent-owned `todo`/`in_review` issues. This keeps a freshly booted worktree from starting agents for work already owned by the source instance. Pass `--preserve-live-work` only when you intentionally want the isolated worktree to resume copied assignments.
@@ -984,7 +1052,8 @@ The workspace UI surfaces `Provisioning database`, `Validating clone`, `Ready`,
| `--server-port ` | Preferred server port |
| `--db-port ` | Preferred embedded Postgres port |
| `--seed-mode ` | Seed profile: `minimal` or `full` (default: `minimal`) |
-| `--no-seed` | Skip database seeding from the source instance |
+| `--no-seed` | Defer database copying until first use |
+| `--empty` | Create an empty instance with fresh signing secrets and disable automatic copying |
| `--force` | Replace existing repo-local config and isolated instance data |
Examples:
@@ -1085,7 +1154,8 @@ Managed workspace repair uses this same verified full-reseed contract through `P
| `--server-port ` | Preferred server port |
| `--db-port ` | Preferred embedded Postgres port |
| `--seed-mode ` | Seed profile: `minimal` or `full` (default: `minimal`) |
-| `--no-seed` | Skip database seeding from the source instance |
+| `--no-seed` | Defer database copying until first use |
+| `--empty` | Create an empty instance with fresh signing secrets and disable automatic copying |
| `--force` | Replace existing repo-local config and isolated instance data |
Examples:
@@ -1144,6 +1214,37 @@ In Vite middleware mode, Paperclip gives HMR a dedicated HTTP server bound to th
When a workspace service runs Paperclip for browser OAuth QA, configure its `expose.urlTemplate` with the canonical URL the browser can reach. Paperclip preserves explicit `PAPERCLIP_PUBLIC_URL` or `BETTER_AUTH_URL` settings; otherwise it uses a valid exposed HTTPS origin (or loopback HTTP) as the managed runtime fallback for Better Auth and `/api/tools/oauth/callback`. Internal service names such as `http://paperclip-dev:` are rejected unless that hostname is genuinely the browser route. Use a unique origin per isolated worktree. See [Execution Workspaces And Runtime Services](../docs/guides/board-operator/execution-workspaces-and-runtime-services.md#browser-reachable-origins-for-oauth-qa) for configuration and verification.
+## Heartbeat Service Extractions
+
+Keep relevant heartbeat extractions and their focused tests in `server/src/services/heartbeat/`.
+
+Task assignment Markdown is rendered by `server/src/services/heartbeat/task-markdown.ts`.
+`heartbeat.ts` calls the renderer and re-exports it for existing callers. Keep prompt
+formatting changes in the renderer and its tests, separate from run orchestration.
+
+Run-log formatting is in `server/src/services/heartbeat/run-log.ts`. It bounds
+stored event payloads, redacts and shortens log chunks, and caps stdout/stderr
+excerpts. `heartbeat.ts` keeps event writes, current-user redaction, and live
+event delivery. Existing public helpers remain available from `heartbeat.ts`.
+
+Workspace preparation is in `server/src/services/heartbeat/workspaces.ts`. It
+owns managed checkout materialization, workspace validation and reuse, referenced
+project resolution, and session/workspace configuration freshness. Its
+`createHeartbeatWorkspaceResolver(db)` factory binds the run workspace resolvers
+to a service's database. The checkout single-flight map stays at module scope so
+all service instances share in-flight materialization. Existing public helpers
+and the workspace validation error class remain available from `heartbeat.ts`.
+Keep workspace policy changes separate from scheduling and run execution changes.
+
+Run preparation is in `server/src/services/heartbeat/run-preparation.ts`. It owns
+issue and wake context, responsible-user resolution, routine environment snapshots,
+skill mentions, adapter environment configuration, and MCP/tool access setup.
+`createHeartbeatRunPreparation(db)` binds the context loaders to a service's database
+without doing database work during construction. `heartbeat.ts` keeps queueing,
+dispatch, retries, cancellation, and execution order, and re-exports the existing
+public helpers and configuration-incomplete error class. Keep preparation policy
+changes in this module and its tests.
+
## Wake Context Delivery
Built-in adapters deliver wake context through the run prompt, including structured
@@ -1235,6 +1336,15 @@ agent workspace. The host `HOME` itself, a directory that contains it, a
filesystem root, a `CODEX_HOME` overlap, or a canonical path outside the
assigned workspace is rejected before provider startup.
+Fresh remote Codex Runner runs recover from a supported image CLI that is too old
+for the selected model. Preparation selects the closest compatible older model
+of the same class, then the stable Runner default. The task shows a warning with
+the requested model, effective model, and CLI version. Agent and task settings
+stay unchanged. Update the image CLI to restore the requested model on later
+runs. Explicit `PAPERCLIP_RUNNER_REMOTE_CODEX_PATH` and
+`PAPERCLIP_RUNNER_REMOTE_CODEX_NPM_SPEC` settings take precedence. See
+[execution semantics](execution-semantics.md#remote-codex-model-compatibility).
+
### Sandbox ACP input delivery
The legacy sandbox process bridge retries recognized Daytona and Cloudflare
@@ -1311,6 +1421,14 @@ registers a correlated recovery request before it signals the dev supervisor.
An uncoordinated server restart uses the same durable recovery classifier
without trusting a handoff marker.
+Recovery retains each run's saved execution prompt, revision, and context
+digest across server upgrades. The shared parser validates the saved prompt's
+SHA-256 and aggregate context digest. The revision is non-empty metadata; it
+does not need to match the current release or a catalog of past prompts. New
+runs use the current prompt. Do not rewrite saved execution inputs to the latest
+prompt. Existing execution-schema, ownership, checkpoint, and permission checks
+still determine whether recovery can proceed.
+
Startup binds the HTTP and PRP listener before it classifies native runs. Public
health reports a startup state until every candidate is reattached, dispatched
for same-run resume, finalized from durable evidence, or held for explicit
diff --git a/doc/HERMES_GATEWAY_ONBOARDING.md b/doc/HERMES_GATEWAY_ONBOARDING.md
index 257a067f88c..d958c68367d 100644
--- a/doc/HERMES_GATEWAY_ONBOARDING.md
+++ b/doc/HERMES_GATEWAY_ONBOARDING.md
@@ -53,6 +53,15 @@ Paperclip can usually store `http://127.0.0.1:8642` as the gateway URL. For
Docker, LAN, tailnet, or reverse-proxy setups, use a URL reachable by the
Paperclip server process.
+If a run reports a loopback connection refusal, check the listener from the
+Paperclip server's host or container. Its loopback address does not refer to
+your browser's machine or an agent sandbox. `hermes_gateway` does not start
+Hermes: start the API server at the configured address, or set `apiBaseUrl`
+to its reachable address. Choose `hermes_local` when Paperclip should launch
+the Hermes CLI itself. Connection guidance does not prove whether a remote
+run was accepted before a redirect failed; the task remains failed and the
+normal failure reporting and retry rules still apply.
+
Plain HTTP is accepted for loopback. Non-loopback HTTP is denied by default in
the join flow; use HTTPS for real remote gateways. For private local
development only, the join payload can set
diff --git a/doc/ISSUE-PRIVACY.md b/doc/ISSUE-PRIVACY.md
new file mode 100644
index 00000000000..fde0b89e48c
--- /dev/null
+++ b/doc/ISSUE-PRIVACY.md
@@ -0,0 +1,204 @@
+# Private tasks and projects
+
+Paperclip work is company-open by default. A task or project can instead be
+marked private when its title, discussion, documents, attachments, work
+products, or agent run traces should be limited to named participants.
+
+## Who can read private work
+
+A private task is readable by its responsible user, creating user, current
+user or agent assignee, active task grantees, and members of its private
+project. Restrictions flow down through children and run-created handoffs. Sharing or
+assigning a task grants access to that task and its descendants; ancestors and
+siblings require a separate grant. An assignment grant stays
+active until it is explicitly revoked. Current assignment, ownership, private-project
+membership, and inherited access remain independent reasons for access. The
+sharing panel shows the source; revoking one grant does not remove other reasons.
+Making a parent private protects existing descendants in the same transaction.
+Moving a task under a private parent inherits privacy. A child cannot be made
+public while it inherits a private boundary; making a parent public leaves its
+existing private children private.
+
+Private projects have a separate access-member list. A task-level grant can
+expose one task without exposing its containing private project. Direct reads
+by non-members return `404`, and list, count, search, attention, status-card,
+activity, run-history, and tree-control surfaces apply the same predicate.
+Visible blocker and mention edges may show a locked identifier-only stub; they
+never include the private task's title or content.
+
+Audit logs remain company-wide because they are the sanctioned oversight path.
+They contain entity identifiers rather than private task content. Dashboard and
+sidebar aggregate counts also remain company-wide: they may include private
+work in totals, but do not expose titles, descriptions, or identifiers. The
+issue list/count APIs themselves are viewer-filtered.
+
+## Audited break-glass
+
+Company owners and admins do not silently inherit private-task access. A normal
+task detail request still returns `404`. When an owner or admin has a legitimate
+emergency need, they must deliberately request the task with
+`?breakGlass=true`.
+
+Every successful break-glass read writes both:
+
+- an `issue.break_glass_read` audit row containing the actor, task id, and time;
+- a warning system notice on the private task so its owners can see that access occurred.
+
+The flag does not change the canonical read predicate, create a grant, or make
+future reads implicit. Non-admin members and agents cannot use it.
+
+Cloud customer-success inspection is a separate operator capability. When an
+operator enables it, the dedicated Cloud-signed permit can read private task
+content within its company scope. Ordinary users, agent API keys, and plugins
+cannot use that permit. Cloud enforces the inspection grant, expiration,
+revocation, replay protection, and audit trail; this path does not create a task
+grant or a task break-glass notice. Operators who require task ACLs on every
+content read must leave `PAPERCLIP_CUSTOMER_SUCCESS_INSPECTION_ENABLED` disabled.
+See [Cloud customer-success inspection support](CUSTOMER-SUCCESS-INSPECTION.md).
+
+## Agent runs and shared-agent residual risk
+
+Issue-bound run detail, events, transcripts, logs, and workspace operations use
+the task ACL. Run authority is the intersection of the agent and the run's responsible user.
+Reusing an agent does not transfer a different user's private-task permission.
+Company run lists retain only timing/status/token/cost metadata for
+non-members so budget oversight continues without exposing task identity or run
+content.
+
+Workspace operation records retain their original task and run sources even if
+those entities are deleted or the operation is relinked. Deletion preserves the
+audit record; unresolved sources make its details and log inaccessible. A
+company-scoped run does not override a private task linked to the operation.
+
+> **Residual risk — trusted agents (`trust-agent`).** Paperclip enforces privacy
+> on reads from the control plane, but an agent that legitimately processes a
+> private task may write learned content into shared persistent memory, its home
+> directory, an external tool, or a later public response. V1 deliberately
+> trusts the agent not to exfiltrate that context. Use isolated execution
+> workspaces and appropriately trusted agents for sensitive work; task ACLs are
+> not a sandbox or data-loss-prevention system.
+
+## Plugins and notification/digest surfaces
+
+Plugins (including any Slack notifier or digest plugin) are **non-member
+principals**: they hold no company membership, task grant, or private-project
+access. Rather than an allowlist of individually patched methods, the plugin
+host centralizes the synthetic non-member check into shared helpers
+(`requirePluginReadableIssue`, `pluginReadableIssueIdsByIds`,
+`pluginRedactRelationSummary`) and routes **every** issue-derived read through
+them. The complete inventory of issue-derived reads and their disposition:
+
+- **Direct issue content** — `issues.list` (SQL predicate), `issues.get`,
+ `issues.listComments`, `issues.listAttachments`, `issues.getAttachmentContent`,
+ `issueDocuments.list`, `issueDocuments.get`: a private task is filtered from
+ list results, returns `null`/empty on soft reads, and reports "not found"
+ (indistinguishable from missing) on document reads.
+- **Subtree / orchestration** — `issues.getSubtree` and
+ `issues.getOrchestrationSummary`: a private *root* reports "not found"; an
+ open root drops private descendants **before** any relation, document, run,
+ or assignee is fetched, so no private row or its metadata enters the payload.
+- **Relationship metadata** — `issues.getRelations` (and the summaries echoed
+ by `issues.setBlockedBy` / `addBlockers` / `removeBlockers`, and the subtree
+ relation maps): blocker/blocks edges pointing at a private task are dropped,
+ recursing into nested terminal blockers, so its title, status, and assignee
+ never surface even on a public task.
+- **Interactions** — `issues.listInteractions`: a private task yields no
+ interaction payloads.
+
+A synthetic `{ type: "none" }` actor resolves to the same public-only scope as
+any other non-member. This is why a digest broadcast to a shared channel —
+whose audience is non-members by definition — cannot carry private issue
+content. Writes that operate on a task must also satisfy its read predicate; plugin
+capabilities do not substitute for task access. Returned relationship summaries
+remain redacted.
+
+There is intentionally **no plugin oversight exception**: unlike the
+company-wide audit log, no plugin read path bypasses the predicate. A plugin
+that must surface private work would need an explicit, separately designed
+oversight capability; none exists today.
+
+> **Residual metadata disclosure.** A plugin still learns aggregate,
+> content-free signals about private work that mirror the accepted
+> dashboard/count disclosure: `issues.getOrchestrationSummary` returns
+> company-wide `openBudgetIncidents`. Its `costs`/token roll-up is limited to
+> the readable subtree, and unreadable relationship edges are omitted entirely.
+> No private title, body, comment, attachment, identifier, relationship target,
+> or locked-edge signal is exposed.
+
+## Rollout modes
+
+`PAPERCLIP_ISSUE_PRIVACY_MODE=enforce` is the default. `shadow` records
+structured would-deny decisions without enforcing them and exists only for
+rollout diagnosis. `off` disables the task predicate. Operators should not use
+`shadow` or `off` when private-task confidentiality is required.
+
+The production gate includes positive and negative checks: an authorized reader
+can read a shared child and its descendants, an unrelated reader cannot, and a
+warm HTTP or live subscription loses that grant after revocation. Privacy grants
+are read from the database without a cross-request positive cache.
+
+## Migration and current runtime integration
+
+Migration `0313_private_task_access.sql` adds the task/project ACL tables and
+backfills privacy parent edges with indexed keyset batches. Run binding is derived
+from native task identity, explicit issue identity, or legacy `issueId`/`taskId` context. Missing
+source tasks remain issue-scoped tombstones. Context changes cannot turn those
+runs into company-wide history. The migration is idempotent for preview installs;
+existing explicit grants are preserved. Operators upgrading an unreleased preview
+should inspect root grants created under its former whole-tree sharing semantics.
+
+Migration `0314_private_task_draft_assets.sql` accompanies enforcement and binds
+historical inline images to their first owned task. Unbound drafts remain
+uploader-only under the new asset-content guard.
+
+Both privacy migrations use the Paperclip migration executor's explicit
+nontransactional path. Indexes on existing tables build concurrently; invalid builds are repaired on
+retry. DDL statements commit individually and each 1,000-row
+keyset batch commits before advancing, releasing schema and row locks. The
+migration journal is written only after all batches succeed; an interruption
+leaves the migration pending and its idempotent statements can be replayed.
+Bootstrap uses the same executor, and other migrations retain a transaction per
+file. Apply these migrations with `pnpm db:migrate`, before enabling the new
+server or private-task UI.
+
+Private output uses the same predicate on native tool searches and task context,
+linked approvals, training exports, execution workspace APIs, stored run-response
+assets, and WebSocket delivery. Workspace access requires permission for every
+linked task. Chat publications recheck recipient identity and task access at the
+provider boundary: private output is withheld from shared channels and from DMs
+whose known recipients no longer qualify. This does not revoke Gmail or other
+connection credentials; connection permissions continue to apply independently.
+
+## CI leak-test inventory
+
+The privacy regression gate is part of the normal server Vitest suite. Its
+surface coverage is intentionally distributed beside the routes and services
+it protects:
+
+| Surface | Non-member regression coverage |
+| --- | --- |
+| Downward sharing, responsible-user intersection, mutation denial, provenance, live revocation | `privacy-production-review.test.ts` |
+| Task detail, list, count, grants, documents, work products | `issue-access-grants-routes.test.ts`, `company-search-service.test.ts` |
+| Search and machine extract | `company-search-service.test.ts`, `company-search-extract-service.test.ts` |
+| Attention feed | `attention-service.test.ts` |
+| Status-card hydrate and dry-run | `status-cards.test.ts` |
+| Activity stream | `activity-service.test.ts`, `activity-routes.test.ts` |
+| Run list, live run, detail, transcript, events, logs, operation history | `heartbeat-run-privacy-routes.test.ts` |
+| Tree holds and tree control | `issue-tree-control-routes.test.ts` |
+| Blocker and mention identifier-only stubs | `issue-access-grants-routes.test.ts` |
+| Attachment content | `issue-attachment-routes.test.ts` |
+| Private-project list and direct read | `projects-list-archived-routes.test.ts` |
+| Plugin issue reads (list, get, comments, attachments, orchestration, subtree, relations, interactions, documents) | `plugin-orchestration-apis.test.ts` |
+
+Adding a new task-derived read surface requires a non-member fixture in this
+gate before the surface can ship.
+
+Project privacy management belongs to its recorded creator (the responsible user
+for agent-created projects), the personal-project owner, and administrators.
+Project read membership alone never allows publishing the project or changing
+its audience. Legacy projects recover ownership from their creation audit event;
+when that evidence is missing, an administrator manages their privacy.
+
+### Task privacy management hints
+
+`GET /api/issues/:id/privacy-constraints` is available only to a principal who can read and manage that task. It returns the blocked scope kind and whether publishing leaves a personal project. It does not return protected parent or project names, identifiers, owners, or contents. This lets task owners manage their task without requiring access to its surrounding project. Visibility writes still enforce the canonical rules under the privacy-tree lock; these hints do not authorize a write.
diff --git a/doc/PRODUCT.md b/doc/PRODUCT.md
index 502b1d42dd9..e53dcafe773 100644
--- a/doc/PRODUCT.md
+++ b/doc/PRODUCT.md
@@ -30,6 +30,15 @@ Example: A CEO agent's adapter config tells it to "review what your executives a
Then you define who reports to the CEO: a CTO managing programmers, a CMO managing the marketing team, and so on. Every agent in the tree gets their own adapter configuration.
+Each person also has a personal primary agent per company. Their first human-created
+agent becomes primary automatically; they can choose another from its profile.
+An existing primary is replaced only after confirmation. The crown appears on the
+profile and roster, while the primary stays first in the Agents sidebar without a
+sidebar crown. Stars remain independent. Task drafts, explicit assignments, and
+recent choices take precedence over the primary; Chat similarly reopens a valid
+recent conversation before falling back to the primary. Opening Chat does not
+start execution. This preference does not change the org chart or permissions.
+
### Agent Execution
Paperclip supports several ways to run an agent's heartbeat:
@@ -135,7 +144,7 @@ Paperclip’s core identity is a **control plane for autonomous AI companies**,
- Do not make the core product a general chat app. The current product definition is explicitly task/comment-centric and “not a chatbot,” and that boundary is valuable.
- Do not build a complete Jira/GitHub replacement. The repo/docs already position Paperclip as organization orchestration, not focused on pull-request review.
- Do not build enterprise-grade RBAC first. Paperclip now has authenticated mode, company memberships, instance roles, and permission grants, but fine-grained enterprise governance should remain secondary to the core company control plane.
-- Do not interpret agent-level privacy flags as a project/issue privacy feature in V1; work visibility stays company-scoped.
+- Do not interpret agent-profile privacy flags as project/issue privacy. Work remains company-open by default, while explicitly private issues and projects use their own task ACLs.
- Do not lead with raw bash logs and transcripts. Default view should be human-readable intent/progress, with raw detail beneath.
- Do not force users to understand provider/API-key plumbing unless absolutely necessary. There are active onboarding/auth issues already; friction here is clearly real.
@@ -232,3 +241,12 @@ to Tasks. A Views menu on the task list covers the inbox views (Mine, Unread,
Blocked, Recent, Everything) and the task-status views (All, Active, Backlog,
Done). Bare `/issues` opens the last-used view, defaulting to Mine; links that
carry a task filter open All. Old `/inbox` links redirect to the matching view.
+
+### CSV file previews
+
+Task attachment and workspace file tabs render CSV files as tables by default.
+The first record supplies column headers. Row numbers, row and column counts,
+and sticky headers help operators scan exports. Rendered and raw view icons
+remain next to download; raw view preserves the original source. The table
+shows up to 500 data rows and 100 columns, with a notice when the preview is
+limited. Download retains the complete file.
diff --git a/doc/SPEC-implementation.md b/doc/SPEC-implementation.md
index 1efb6cbfc8c..df952bf5250 100644
--- a/doc/SPEC-implementation.md
+++ b/doc/SPEC-implementation.md
@@ -37,7 +37,7 @@ These decisions close open questions from `SPEC.md` for V1.
| Company model | Company is first-order; all business entities are company-scoped |
| Board | Single human board operator per deployment |
| Org graph | Strict tree (`reports_to` nullable root); no multi-manager reporting |
-| Visibility | Company-scoped visibility: board + all in-company agents can see all work objects by default; public/private deployment flags affect external exposure only and do **not** imply project/issue privacy |
+| Visibility | Issues remain company-open by default. Opt-in `private` issues use task ACLs; deployment exposure flags remain independent of work-object privacy. |
| Communication | Tasks + comments only (no separate chat system) |
| Task ownership | Single assignee; atomic checkout required for `in_progress` transition |
| Task watchdogs | A task watchdog is an explicitly configured, issue-subtree-scoped verification and recovery capacity. It may restore live task paths inside the watched subtree; for issue-thread interaction resolution it is an ordinary agent subject to the same audience and containment checks, not board authority, active-run output monitoring, or general liveness recovery. |
@@ -220,6 +220,8 @@ Invariant: at least one root `company` level goal per company.
- `goal_id` uuid fk `goals.id` null
- `name` text not null
- `description` text null
+- `visibility` enum-like text: `open | private`, default `open`
+- `personal_owner_user_id` text null; unique with `company_id` when present
- `status` enum: `backlog | planned | in_progress | completed | cancelled`
- `lead_agent_id` uuid fk `agents.id` null
- `target_date` date null
@@ -258,6 +260,9 @@ retain their titles and default to no generation request.
- `project_workspace_id` uuid fk `project_workspaces.id` null
- `goal_id` uuid fk `goals.id` null
- `parent_id` uuid fk `issues.id` null
+- `visibility` enum-like text: `open | private`, default `open`
+- `privacy_root_issue_id` uuid fk `issues.id` null; private-boundary metadata
+- `privacy_parent_issue_id` uuid fk `issues.id` null; downward access inheritance, including standalone run-created handoffs
- `title` text not null
- `description` text null
- `status` enum: `backlog | todo | in_progress | in_review | done | blocked | cancelled`
@@ -310,11 +315,39 @@ Invariants:
- `author_user_id` uuid fk `users.id` null
- `body` text not null
+## 7.7.1 `issue_access_grants`
+
+- `issue_id` uuid fk `issues.id` not null
+- `subject_type` enum-like text: `user | agent`
+- `subject_id` text not null
+- `source` enum-like text: `explicit | assignment | project`
+- `granted_by_user_id` text null
+- `granted_by_agent_id` uuid fk `agents.id` null
+- `created_at` timestamptz not null
+- `revoked_at` timestamptz null
+
+An issue is readable when it is open outside a private project, the actor is an implicit principal (`responsible_user_id`, `created_by_user_id`, `assignee_user_id`, or current `assignee_agent_id`), the actor has an unrevoked grant on the issue or a private ancestor, or the actor is an access member of its private project. This is one canonical predicate shared by detail, list, count, search, and run-derived reads. Instance administrators retain platform-wide access; company owner/admin roles do not imply private-issue read access. Sharing a child covers that child and descendants; ancestors and siblings require separate access. Agent reads also require the responsible user to qualify. A private parent protects existing and newly created descendants; making a parent public does not publish private descendants.
+
+## 7.7.2 `project_access_members`
+
+Authorization membership for private projects, distinct from the personal-sidebar `project_memberships` table:
+
+- `id` uuid pk
+- `company_id` uuid fk `companies.id` not null
+- `project_id` uuid fk `projects.id` not null
+- `subject_type` enum-like text: `user | agent`
+- `subject_id` text not null
+- `created_at` timestamptz not null
+- unique `(project_id, subject_type, subject_id)`
+
+Private projects are absent from list and search results for non-members, and direct reads return `404`. An issue-level grant can still expose its issue without exposing the containing project. A user's `My private tasks` project is created lazily and concurrency-safely on their first unprojected private task; the owning user is its initial and non-removable project member. An agent-created private root also grants that creator issue-level access while retaining the responsible user as the human principal.
+
## 7.8 `heartbeat_runs`
- `id` uuid pk
- `company_id` uuid fk not null
- `agent_id` uuid fk not null
+- `issue_id` uuid fk `issues.id` null; first-class binding for issue-scoped run confidentiality
- `invocation_source` enum: `scheduler | manual | callback`
- `status` enum: `queued | running | succeeded | failed | cancelled | timed_out`
- `started_at` timestamptz null
@@ -417,6 +450,7 @@ Operational policy:
- `cost_events(company_id, occurred_at)`
- `cost_events(company_id, agent_id, occurred_at)`
- `heartbeat_runs(company_id, agent_id, started_at desc)`
+- `heartbeat_runs(company_id, issue_id, created_at)`
- `approvals(company_id, status, type)`
- `activity_log(company_id, created_at desc)`
- `assets(company_id, created_at desc)`
@@ -453,6 +487,7 @@ Operational policy:
- Attachment reads are company-scoped and expose stable path metadata: `contentPath`/`openPath` for inline-safe viewing and `downloadPath` for forced download.
- Inline-safe responses use `Content-Disposition: inline`; unsafe types and explicit download requests use `attachment`.
- Script-capable content such as HTML is always served as an attachment with `X-Content-Type-Options: nosniff` and a sandboxed, deny-by-default CSP; it is never rendered inline on the Paperclip origin.
+ - The board can fetch bounded HTML source for a rich preview in an opaque-origin iframe (`sandbox="allow-scripts"`, without `allow-same-origin`). A trusted CSP precedes artifact markup and blocks remote subresources, API connections, forms, and embeds. Rendered/raw icons sit beside Download. Workspace HTML previews return UTF-8 inside JSON under the existing text limits. See `doc/html-artifact-previews.md`.
- Video attachments are inline-safe and support single `Range: bytes=start-end` requests with `206`, `Content-Range`, and `Accept-Ranges: bytes` for browser playback/seeking.
- Attachment-backed artifact work products use `type: "artifact"`, `provider: "paperclip"`, and metadata with `attachmentId`, `contentType`, `byteSize`, `contentPath`, `openPath`, `downloadPath`, and optional `originalFilename`.
- Workspace-only file references use work product `metadata.resourceRef` with `kind: "workspace_file"`, `issueId`, `workspaceKind` (`execution_workspace` or `project_workspace`), `workspaceId`, `relativePath`, optional `line`/`column`, and `displayPath`. These references point at files in a workspace; they do not replace attachment-backed artifacts for deliverables that must be inspectable without workspace access.
@@ -508,6 +543,32 @@ Decision-desk triage uses company-scoped sidecars rather than adding queue field
- `decision_archive_notification_outbox` records one retry-safe origin-agent notification per source/archive version. The 90-day internal sweeper archives only unkept rows and coalesces delivery per origin agent.
- Queue membership never grants source visibility. Item writes re-authorize the referenced source, and queue reads re-authorize every member before returning rows or counts.
+## 7.17 Personal primary agent (2026-10-07)
+
+`user_company_preferences` has a unique company/user key, nullable `primary_agent_id`,
+and sticky `primary_agent_initialized` flag. GET/PUT
+`/api/companies/:companyId/primary-agent/me` derives the human identity from auth,
+checks company access and agent visibility, rejects agent actors, and audits changes.
+PUT accepts an approved, non-terminated agent; choosing a previously left agent
+rejoins it under the existing membership rules. There is no explicit removal UI or
+nullable PUT. Leaving, termination, and deletion clear the reference without
+allowing a later creation to initialize it again. Pausing and errors retain it.
+
+Initialization runs in the human-attributed creation transaction, including
+onboarding, with uniqueness arbitrating concurrent creation. System provisioning
+and agent-authored hires cannot initialize a human preference. Migration backfill
+uses the earliest attributable human creation, preserving empty initialized state
+when the original is gone, terminated, or left; unknown ownership stays unset.
+
+The profile is the only setting surface. Replacing a primary requires the reviewed
+avatar-to-avatar confirmation. A first choice has no modal. Only the profile and
+roster show the accessible crown; the Agents sidebar pins the primary first without
+duplication. Tasks preserve explicit/draft assignments, then choose a recent
+eligible assignee, the eligible primary, or the existing fallback. Chat preserves
+a valid recent conversation, then opens the primary, then retains its chooser.
+Navigation alone does not create an execution. Failed preference mutations restore
+the previous state and offer retry. Preferences and caches are company/user scoped.
+
## 8. State Machines
## 8.1 Agent Status
@@ -706,7 +767,7 @@ changes so both agent and board edits are visible in the issue activity stream.
## 9.4 Permission Terminology and Default Visibility Rule
-Paperclip V1 keeps a company-scoped visibility model as the default because centralized authorization and scoped work-object controls are not yet a core V1 control surface.
+Paperclip keeps company-scoped visibility as the default. The task-ACL foundation adds opt-in private issues while preserving `open` for all existing and unspecified issues.
The approved term set is:
@@ -720,8 +781,8 @@ The approved term set is:
## 9.5 Core V1 Rule: what “private” means
- A **private marker** on an agent profile (where represented) does **not** make company-visible work private.
-- Company-visible work objects (issues, comments, work products, costs, activity, project/task state) remain visible to the board and in-company agents by default.
-- Project/issue-level privacy, scoped assignment-only object visibility, and organization-wide custom ACLs are deferred to Pro/Enterprise controls.
+- Work objects remain company-open by default. An issue or project can opt into the shared private-read predicate.
+- Organization-wide custom ACL policy remains deferred to Pro/Enterprise controls.
## 9.6 V1 vs Pro/Enterprise Controls (recommended target split)
@@ -732,7 +793,7 @@ The approved term set is:
| Profile visibility | Full profile visibility for coordination and audit | Optional profile redaction / selective sharing for external surfaces |
| Config visibility | Board full read with redacted secret fields; agent config read/write constrained by own agent identity | Scoped config visibility controls and central policy enforcement |
| Assignment/invocation | Assignment creates execution authority; board can reassign or force release | Delegation policies and scoped invokers with deny-listed tool classes |
-| Work-object visibility | All issues and projects in-company are visible to board and agents | Project/issue ACLs and reviewer-only channels |
+| Work-object visibility | Company-open by default; opt-in private issues/projects with explicit user or agent access | Policy-driven ACLs and reviewer-only channels |
| Tool/secret policy | Secret refs, log redaction, and adapter-level command/webhook restrictions | Tool allowlists with centralized policy evaluation |
| Company skills | Open to authenticated company agents; core enforces invariants and any stored restriction policy | Paperclip EE policy editor, protected-skill controls, presets, simulation, and policy audit UX |
| Inbox management | Responsible agent may archive/unarchive its responsible user's Mine items under a default-open user policy; explicit cross-user access requires saved target-user opt-in or `inbox:manage`; all mutations are audited | Policy administration UX, organization presets, simulations, bulk controls, and richer audit/reporting surfaces |
@@ -1139,6 +1200,9 @@ Invites tab does not hide this Cloud action.
- `POST /companies/:companyId/issues`
- `GET /issues/:issueId`
- `PATCH /issues/:issueId`
+- `GET /issues/:issueId/access-grants`
+- `POST /issues/:issueId/access-grants`
+- `POST /issues/:issueId/access-grants/:grantId/revoke`
- `GET /issues/:issueId/documents`
- `GET /issues/:issueId/documents/:key`
- `PUT /issues/:issueId/documents/:key`
@@ -1198,6 +1262,11 @@ assignee/run ownership checks, and the `issue.released` activity event still app
- `POST /companies/:companyId/projects`
- `GET /projects/:projectId`
- `PATCH /projects/:projectId`
+- `GET /projects/:projectId/access-members`
+- `POST /projects/:projectId/access-members`
+- `DELETE /projects/:projectId/access-members/:memberId`
+
+Project list, search, direct reads, and nested project routes apply private-project access. Non-members receive the same not-found behavior as missing projects.
## 10.6 Current-user Resource Memberships
@@ -1485,6 +1554,20 @@ for contracts, recovery behavior, Storybook, and acceptance workflows.
Board may override by raising budget or explicitly resuming agent.
+Native runs retain final usage receipts during a bounded accounting-only drain
+after a governed wait cancels provider work. This does not accept late messages,
+tool calls, or new completion proposals. Missing or incomplete receipts continue
+to block budget admission.
+A controller that detaches for server restart loses checkpoint and completion
+write authority. A closing event stream is not proof that the governed run
+finished; the replacement controller must adopt and settle the original run.
+
+Complete direct Anthropic API receipts for `claude-sonnet-5` can use a versioned
+list-price estimate when the provider supplies no run price. The receipt records
+the rates and assumptions. Aggregate cache writes use the one-hour rate because
+their TTL is unknown. Estimates are not invoices. Other models, billers, unknown
+billing types, and incomplete receipts remain unpriced.
+
## 13.3 Cost Event Ingestion
`POST /companies/:companyId/cost-events` body:
@@ -1970,6 +2053,13 @@ configuration, plugin packages and outstanding hosted release gates. The
[delivery plan](plans/2026-09-30-paperclip-public-mcp-and-plugins.md) separates
external agent participation and granted third-party tools into later releases.
+The experimental OpenAI Dot Runner provider uses a separate `/mcp/runner`
+agent OAuth resource. It reuses the public gateway's browser/device consent,
+client metadata verification and signed event delivery, but requires one-use
+agent pairing and normal run admission. Personal grants cannot authorize
+Runner operations. See [OpenAI Dot Runner](openai-dot-runner.md) for the
+self-hosted release boundary and remaining account qualification.
+
### Experimental AI connection routing
Opt-in plugin routers may represent a pool as an AI runtime binding. Core keeps
@@ -1990,6 +2080,16 @@ remove stale instructions after edits or access revocation. See
[Connection instructions](connections/CONNECTION-INSTRUCTIONS.md) for contracts,
UI conventions, custom adapter integration, and initial memory templates.
+### Remote Codex model compatibility
+
+Fresh remote Codex Runner preparation can replace a model whose verified CLI
+minimum exceeds the supported image CLI version. It selects a compatible older
+model in the same class, then the stable Runner default, and saves that effective
+model before checkpoint selection. A visible task warning and local run-log event
+record the substitution. This does not change agent settings, rewrite admitted
+executions, or bypass artifact, ownership, permission, and budget gates. See
+[remote Codex compatibility](execution-semantics.md#remote-codex-model-compatibility).
+
### Native provider capacity retry
Committed, run-bound Codex `serverOverloaded` terminal failures display the model
@@ -2008,3 +2108,9 @@ as free-form text in the instance database. Legacy agents use the default
in standard, ask, and planning modes. Submission never changes task disposition
or routes feedback externally. See [Agent commentary](agent-commentary.md) for
authentication, replay, document-sized limits, inspection, and deletion semantics.
+
+## Company decision-model service
+
+Company Settings → General can configure one shared API-key connection for optional internal decisions. V1 supports OpenAI Decisions and Jev through OpenRouter. Companies start unconfigured; background sponsorship defaults on when configured, while an explicit off setting persists. Human and agent calls retain current responsible-user, connection audience, resource, and agent installation checks. Only explicitly registered internal background features can use company sponsorship.
+
+The internal service provides local-only availability and bounded, reauthorized execution. It records metadata-only invocation history and independent fractional service charges in the existing cost ledger, applying company and applicable agent/project budgets under the accounting lock. Unknown dispatch charges retain reservations until audited resolution. Settings/testing require connection management permission; history uses existing cost visibility. See [decision-models.md](decision-models.md) for the contract, supported models, accounting, privacy, and endpoints.
diff --git a/doc/SPEC.md b/doc/SPEC.md
index 6731f25c509..3608565f43f 100644
--- a/doc/SPEC.md
+++ b/doc/SPEC.md
@@ -91,6 +91,13 @@ The Board sets Company-level budgets. The CEO can set budgets for Agents below t
## 2. Agent Model [DRAFT]
+A human's personal primary agent is a company-scoped navigation and assignment
+preference, independent of the org chart, roles, stars, and authority. First human
+creation initializes it automatically. Later explicit choices persist across
+devices; recent task/chat choices take precedence. The profile owns the setting
+and replacement confirmation. See the personal-primary addendum in
+`SPEC-implementation.md` for persistence and lifecycle rules.
+
Every employee is an agent. Agents are the workforce.
### Cryptographic identity
@@ -178,7 +185,7 @@ Hierarchical reporting structure. CEO at top, reports cascade down.
**Full visibility across the org.** Every agent can see the entire org chart, all tasks, all agents. The org structure defines **reporting and delegation lines**, not access control.
-Visibility settings on an agent profile (where supported) do not alter company-level visibility for tasks, projects, issues, comments, costs, or activity. Those work-object privacy controls are not a V1 feature until centralized scoped authorization is in place.
+Visibility settings on an agent profile do not control task privacy. Work is company-open by default; opt-in private tasks and projects use centralized authorization as specified in `SPEC-implementation.md` and `ISSUE-PRIVACY.md`. Sharing a child grants access to it and its descendants. Ancestors and siblings require separate access.
Each agent publishes a short description of their responsibilities and capabilities — almost like skills ("when I'm relevant"). This lets other agents discover who can help with what.
@@ -326,6 +333,8 @@ recipients must be valid and authorized in the company before a question is
saved. See `SPEC-implementation.md` §9.8.1 for the resolver contract.
+Experimental Agent Chat presents one persistent task per person and agent as a simplified conversation. Chat has a searchable secondary sidebar with agent avatars; adding an agent starts or reopens their single conversation. It retains the task composer, transcript, tools, attachments, documents, and existing Subtasks panel, with the task's selected visibility. New execution tasks are ordinary project tasks, not structural children of the conversation; private-source restrictions still flow through their run provenance. Idle conversations wait for a message without entering execution-task work queues. Agents clarify goals here and create assigned tasks for substantial execution. `/new` resets provider context at an ordered session boundary within the same task while preserving visible history. `enableAgentChat` is disabled by default; the V1 lifecycle and rollout contract is specified in `SPEC-implementation.md`.
+
### Implications
- An agent's "inbox" is: tasks assigned to them + comments on tasks they're involved in
@@ -487,6 +496,10 @@ No separate "agent API" vs. "board API." Same endpoints, different authorization
Paperclip manages task-linked work artifacts: issue documents (rich-text plans, specs, notes attached to issues) and file attachments. Agents read and write these through the API as part of normal task execution. Full delivery infrastructure (code repos, deployments, production runtime) remains the agent's domain — Paperclip orchestrates the work, not the build pipeline.
+Self-contained HTML reports can render in an opaque-origin sandbox. The report
+cannot access the board's cookies, storage, or DOM. Users can switch to the raw
+source beside Download, which returns the original file.
+
Users may start a task with only a prompt. Paperclip uses a short prompt slice as
its initial title and asks the assigned agent to name the task early. Explicit
user titles are preserved, and naming does not change task execution state.
@@ -716,6 +729,12 @@ configuration, plugin packages and outstanding hosted release gates. The
[delivery plan](plans/2026-09-30-paperclip-public-mcp-and-plugins.md) separates
external agent participation and granted third-party tools into later releases.
+The experimental OpenAI Dot Runner provider uses a separate `/mcp/runner`
+agent OAuth resource. It reuses browser/device consent and signed event delivery
+while preserving agent pairing, normal run admission and task authority.
+Personal grants cannot authorize Runner operations. See
+[OpenAI Dot Runner](openai-dot-runner.md) for its supported release boundary.
+
### Experimental connection routing
A virtual AI connection can rotate new task/agent allocations through an
@@ -731,3 +750,7 @@ as free-form text in the instance database. Legacy agents use the default
in standard, ask, and planning modes. Submission never changes task disposition
or routes feedback externally. See [Agent commentary](agent-commentary.md) for
authentication, replay, document-sized limits, inspection, and deletion semantics.
+
+### Managed decision models
+
+A company may configure a shared decision model for optional Paperclip features. The instance owns credential resolution, authorization, budget admission, and attributable service charges. Company-sponsored background use is enabled by default during configuration; explicit opt-out persists. User and agent requests keep their own access boundaries and cannot become sponsored background requests after denial. Availability is a cheap local capability check, and metadata-only request history makes service usage inspectable. The implemented V1 contract is in [decision-models.md](decision-models.md).
diff --git a/doc/acp-run-lifecycle.md b/doc/acp-run-lifecycle.md
index 0e75f3e7d7f..f5a4019b8d8 100644
--- a/doc/acp-run-lifecycle.md
+++ b/doc/acp-run-lifecycle.md
@@ -58,6 +58,15 @@ removes it if startup fails. The child's environment values remain unchanged.
If the launch shell fails before the wrapper emits a protocol event, the run
log retains the shell's stderr alongside the exit code.
+The process-session bridge also writes one bounded terminal diagnostic to the
+run's stderr. It distinguishes a remote event, input delivery failure, output
+poll failure, output stream failure, and unexpected authenticated proxy closure.
+Exit codes and signals are validated; unavailable values are `unknown`. The line
+contains no raw error message, command, path, or environment value. It records
+the first observed terminal event, not proof of remote shutdown. An error frame
+drains to the local proxy before the connection closes, and a failed or stalled
+diagnostic write does not delay failure delivery or teardown.
+
The settlement sequence is the one live cleanup owner for every settled path. It
claims the ledger once, makes the pure reuse decision, then runs the ordered
steps:
diff --git a/doc/adapter-model-audit-2026-10-02.md b/doc/adapter-model-audit-2026-10-02.md
index 5c86e25bd68..133e81b2e3c 100644
--- a/doc/adapter-model-audit-2026-10-02.md
+++ b/doc/adapter-model-audit-2026-10-02.md
@@ -10,7 +10,7 @@ No agent defaults or saved model selections are migrated.
| Adapter | Changes from the audit |
| --- | --- |
-| Codex and the Codex runner catalog | Add GPT-6.1 Sol (`gpt-6.1-sol`). Expose efforts through Ultra and Fast mode, as documented. Keep `gpt-5.6-sol` as the default. |
+| Codex and the Codex runner catalog | Add GPT-6.1 Sol (`gpt-6.1-sol`). Expose efforts through Ultra and Fast mode, as documented. Keep `gpt-5.6-sol` as the default. Follow-up (October 6, 2026): with ChatGPT sign-in the Codex backend accepts `gpt-6.1-sol` only from Codex CLI 0.159.0 or newer (0.156.1 and older are rejected with "The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account."), and `gpt-6-sol` / `gpt-6-luna` entered the bundled catalog in 0.157.0. The adapter now records these floors; the environment Test and the remote runner compare the installed `codex --version` against them, so a sandbox image baked before the pin moved reports the stale CLI instead of an account error. |
| Claude on Bedrock | Add Sonnet 5.5 (`us.anthropic.claude-sonnet-5-5`), using the catalog's existing US inference-profile convention. Sonnet 5.5 IDs (direct or Bedrock-qualified) get the documented `xhigh` and `max` efforts and require Claude Code 2.1.284 or later on the CLI lane. |
| OpenCode | Add `openai/gpt-6.1-sol` and `anthropic/claude-sonnet-5-5` to the static fallback used by remote environments. Both IDs are present in the OpenCode model registry. |
| Claude Code (direct) | No change in this audit. [#14993](https://github.com/paperclipai/paperclip/pull/14993) (merged October 5, 2026, superseding #14816) adds Sonnet 5.5 (`claude-sonnet-5-5`, Claude Code 2.1.284 or later) and refreshes the Claude runtime. |
diff --git a/doc/connections/CONNECTION-SEARCH.md b/doc/connections/CONNECTION-SEARCH.md
index 9c0630e21e1..594b10a66ec 100644
--- a/doc/connections/CONNECTION-SEARCH.md
+++ b/doc/connections/CONNECTION-SEARCH.md
@@ -57,6 +57,12 @@ grants consent. A provider connection is not proof that its underlying app is
authorized. Multiple matching aggregator apps are returned as candidates; the
agent searches the selected `aggregator.targetService` to get its provider question.
+A fuzzy or partial external app match remains a suggestion alongside authorized
+installed capability matches. It cannot replace those matches with a mandatory
+provider question. For example, a query for a page service can return the
+installed page tools alongside a Page X suggestion; selecting the exact Page X
+service is required before that external route asks for provider consent.
+
## Regression coverage
```sh
@@ -69,3 +75,10 @@ Circleback/Attio/ClickUp, indexed Executor tools, and provider consent. The nati
tool authority test searches a paragraph longer than the old 200-character limit
and then creates a real connection interaction. Existing tests retain checks for
private metadata, administrative denials, stale identities, and saved declines.
+
+When `connection_request` rejects an unknown `toolNames` entry, its error includes
+up to twenty exact names from that eligible connection's active tool catalog.
+This is discovery metadata: the request still fails with 422, grants no access,
+and creates no approval card. The agent must select the needed exact names and
+submit a new request; normal user approval, catalog-version and policy checks
+still apply. Ineligible connections and inactive catalog entries are excluded.
diff --git a/doc/connections/README.md b/doc/connections/README.md
index 35e628797fb..5f5b4d09741 100644
--- a/doc/connections/README.md
+++ b/doc/connections/README.md
@@ -206,3 +206,6 @@ translate the intent into Apps v2:
Do not add new work to the retired v1 branch. If an old ticket still describes a
valid product gap, retarget it to an active Apps v2 issue or close it as
superseded with a link to the replacement.
+
+For Slack chat bot creation, installation, recovery, and live qualification, see
+[Automatic Slack app setup](SLACK-AUTOMATIC-SETUP.md).
diff --git a/doc/connections/SLACK-AUTOMATIC-SETUP.md b/doc/connections/SLACK-AUTOMATIC-SETUP.md
new file mode 100644
index 00000000000..8ac45b0b234
--- /dev/null
+++ b/doc/connections/SLACK-AUTOMATIC-SETUP.md
@@ -0,0 +1,241 @@
+# Automatic Slack app setup
+
+New Slack bot drafts default to automatic setup. Existing drafts without a
+`slackSetupMethod` remain manual. Paperclip uses Slack's Manifest API and OAuth
+v2 directly; neither the operator nor the assisting agent needs the Slack CLI.
+
+## Operator setup
+
+1. Enable Chat connectors in Experimental settings and select an agent in
+ Connectors → Slack → Chat with an agent.
+ Once an agent is selected, Advanced reveals the generated app name, bot name,
+ and slash command. Defaults use the agent name without random suffixes.
+2. On App configuration access token, select **Get your App configuration access token**. In
+ [Slack app settings](https://api.slack.com/apps), open **Your App Configuration
+ Tokens → Generate Token**, select the workspace, and paste the temporary
+ **Access Token** directly into Paperclip's password field. Do not supply
+ its refresh token. Select **Create Slack app**.
+3. After creation and configuration succeed, Paperclip advances to **Install Slack app**
+ and opens Slack installation in a new window. Approve installation in the intended
+ workspace. If the window is blocked or closed, select **Install in Slack**.
+ If workspace policy requires administrator approval, return to this saved
+ draft when approval is available. The existing app is reused. Paperclip links
+ the Slack account returned by OAuth to the signed-in Paperclip account that
+ started installation and sends one welcome DM: “Hi, I’m . Your Slack
+ account is connected to Paperclip.” Use your own Slack account.
+4. On **Send a message to your agent**, select **Open Slack** and send a message.
+ Paperclip checks incoming events automatically. A signed message event from the
+ saved app/workspace or Slack's signed challenge completes the check. The same
+ fourth screen then shows **Success** with a checkmark and **Done**; there is no
+ separate Try it screen. The welcome-message event can complete this check before
+ you send a message. Slack may still display an unverified URL.
+ If the wizard keeps waiting, expand **Didn’t work?** for Event Subscriptions,
+ Request URL, and Retry instructions. Opening a settings link is not proof.
+ A failed welcome DM does not block setup; open Slack and message the bot directly.
+
+Avatar provisioning is automatic and has no wizard step. Failed or interrupted
+uploads do not block onboarding; manual upload remains available in the saved
+connection’s **Settings → Agent avatar** section.
+
+Automatic creation now omits event subscriptions from the initial manifest,
+saves the returned signing secret, then applies the full canonical manifest with
+`apps.manifest.update`. This removes the creation-time signing-secret race.
+The 2026-10-07 live experiment did not receive a URL challenge after this update;
+Slack nevertheless delivered an event, and the operator confirmed receiving an
+agent response without clicking Retry. A manifest update alone never advances verification.
+Manual creation continues to use the full canonical manifest.
+
+Slack's settings-page Request URL verification remains distinct from Paperclip's
+connection check. Automatic setup accepts an authenticated message/app-mention
+event only after the runtime accepts the request, with the current signing secret,
+expected app/workspace/bot binding, current callback URL, and active connection.
+Manual setup retains the signed-challenge requirement. Paperclip
+can answer a signed challenge as soon as creation has saved the signing secret,
+even before OAuth installation finishes. This path performs no Slack API calls
+and does not initialize the bot runtime or wait for the creation operation's lease.
+Pre-install verification survives configuration only for the same signing secret
+and webhook URL. It does not authorize installation or activate the connection.
+The verification DM is queued separately from the HTTP acknowledgement, with
+durable pending/sending/sent state. Repeated challenges do not send another DM; failed or ambiguous sends do
+not block setup or replay automatically. Background recovery processes pending
+messages and quarantines sends interrupted by a restart.
+
+Paperclip captures the signing secret and client secret from creation and obtains
+the bot token during installation. Durable secrets are stored in the company
+vault and are not returned by setup APIs or added to the agent prompt. The
+temporary configuration token is used for app creation, `apps.manifest.update`, and `apps.icon.set`, then
+discarded after the request. Save & exit keeps
+the draft and all saved non-secret progress.
+
+**Create manually** and **Use an existing app** are under Advanced on the token step.
+**Create manually** uses the same generated manifest. **Use an existing app**
+keeps the existing credential-entry workflow. These paths retain explicit
+personal account linking through the displayed `/command connect` command.
+To connect a different account after setup, use the connection’s Access page.
+Both options remain available for
+recovery on the same draft. The selected automatic, manual, or existing-app method
+is saved, so an existing-app draft reopens at credential entry. Agent instructions require the user to enter the temporary token and handle login/admin approval.
+
+**Invite people** copies instructions for the saved app’s `connect` command.
+Each recipient gets their own expiring confirmation link in Slack and confirms
+their identity while signed in to Paperclip. New organization members require
+membership approval. Existing members can self-link; disconnecting an identity
+does not permanently block that member from reconnecting. Guest access remains
+a separate, explicit setting for restricted work.
+
+The person joining runs `/ connect` themselves (for example,
+`/maya connect`), without an `@person` argument. The command discovers their
+identity without starting agent work or granting access. Slack conversation
+agents receive this saved command on each fresh or resumed turn, alongside the
+confirmation and membership-approval instructions. If the saved command is
+unavailable, they refer the connection manager to **Access → Invite people**
+instead of guessing from the agent name. Inviting a person or bot to a Slack
+channel does not grant that person Paperclip access.
+
+**Allowed Channels** updates every five seconds while Slack Settings is open.
+Inviting the bot to a new channel enables replies and writes there automatically;
+no additional Paperclip configuration is required. An explicit off switch stays
+off across repeated invitations, reconnects, and inventory refreshes.
+
+A bare @mention starts a normal agent conversation. Paperclip creates the task,
+subscribes to the Slack thread, and starts the agent; later replies in that thread
+continue the same task without another mention. Normal account and channel access
+rules still apply, and repeated Slack deliveries do not create duplicate tasks.
+
+Agents can ask interactive questions in Slack through Paperclip's saved
+`ask_user_questions` interactions. Native runners use `request_human_input`;
+legacy adapters use the issue-interactions API documented in the injected
+Paperclip skill. Slack shows native answer buttons or an **Answer questions**
+button and form, depending on the question and connection capabilities.
+Submitting an answer wakes the assigned agent on the same task.
+This works even when the adapter's built-in question tool is unavailable.
+
+The app icon upload and Settings download use the agent’s 512×512 PNG on
+Paperclip’s dark-mode background (`#171717`). Slack flattens transparent app icons
+onto white, so this export has an opaque background before upload. Normal
+Paperclip avatars retain transparency. Existing Slack apps need an icon re-upload
+to adopt the new background; changing Paperclip does not replace their saved icon.
+
+
+## Deployment
+
+Automatic setup requires a canonical public HTTPS board origin and a public HTTPS
+webhook ingress. The server derives URLs and permissions from its configuration;
+the browser cannot supply a manifest, scopes, or callback destination.
+
+- The OAuth redirect is `/api/chat-slack/oauth/callback`.
+ It uses the existing authenticated board callback path and Cloud bootstrap
+ checks. Keep board authentication enabled.
+- Webhook URLs use `PAPERCLIP_CHAT_WEBHOOK_PUBLIC_URL` when configured, otherwise
+ the canonical board origin. They end in `/api/chat-webhooks//slack`.
+ A separate webhook ingress must route signed webhook requests to the instance.
+- Avatar upload renders the assigned agent's preset PNG on the server and sends
+ its bytes through `apps.icon.set` as multipart form data. Slack does not need to
+ fetch an image from the tenant's authenticated board origin. The image is
+ 512 × 512 with the Paperclip dark background. The temporary configuration
+ token stays in the Authorization header and is discarded after setup.
+- Cloud resolves its current canonical origin from its claimed runtime identity.
+ Self-hosted deployments use the configured authentication public base URL
+ (`PAPERCLIP_AUTH_PUBLIC_BASE_URL` or `PAPERCLIP_PUBLIC_URL`).
+ Both URLs must have valid certificates and be reachable by their intended
+ callers. A private Tailscale Serve address is insufficient for Slack webhooks.
+- Origin changes invalidate outstanding authorization attempts. Restore the saved
+ origins or reconcile the existing Slack app and use manual recovery. Never
+ loosen authentication or signature verification to bypass a failed callback.
+
+## Recovery and invariants
+
+| Saved state | Operator action |
+| --- | --- |
+| Invalid/expired configuration token | Generate a new configuration token and retry. Draft details are preserved. |
+| Creation uncertain after timeout/restart | Inspect Slack app settings. Recover an existing app manually on this draft. Start another creation only after explicitly confirming that no app exists. |
+| App saved; event configuration pending after failure/restart | Enter an app configuration access token and select Retry app configuration. The same saved app and canonical manifest are reused; installation is blocked until this update succeeds. |
+| App created; installation declined/pending | Install the saved app again. No configuration token is needed. |
+| Revoked bot token or uninstalled app | Start fresh installation authorization for the same saved app. Existing workspace, bot, and account bindings are preserved; consent started before revocation cannot restore the connection. |
+| Authorization expired or code exchange uncertain | Start fresh installation authorization. Used codes are never replayed. |
+| Credentials saved; connection check failed | Use Retry connecting. Paperclip reuses vaulted credentials. If Slack access changed or the token was revoked, use Authorize in Slack again for the same app. |
+| Wrong app/workspace/bot or missing scopes | Correct the installation of this app. Activation remains blocked. |
+| Avatar upload failed or interrupted | Continue setup with the saved app. Optionally upload the avatar from Settings later. The configuration token is not retained for retries. |
+| Existing or revoked personal account link conflicts | Manage account links in Access settings. Installation never overwrites someone else’s link or restores a revoked link. |
+| Welcome DM failed or interrupted | Continue setup and open Slack directly. A saved dispatch is never replayed after refresh, restart, or reauthorization. |
+| Removed connection | Pending state and app-registration secrets are invalidated. Remove the customer's app separately through its Slack management link if desired. |
+
+App details are immutable after creation dispatch, including when the outcome is
+uncertain. The endpoint's existing credential lease serializes creation,
+configuration, recovery, and removal across server processes. Generic connection
+removal uses the same lock. The unique-bot constraint still applies.
+
+Registration secrets are separate from runtime credentials. The received bot token
+is vaulted before `auth.test`, inventory, and configuration. Staged bot/signing
+secret copies are deleted only after runtime binding commits. Client credentials
+remain in the registration vault for subsequent authorization. OAuth’s
+`authed_user.id` identifies the installer; the bot token confirms that person’s
+workspace through `users.info`. Company membership and existing identity-link
+constraints are checked before linking. Reauthorization preserves the original
+linked account. Welcome-DM dispatch is saved before calling `chat.postMessage`;
+an interrupted dispatch becomes uncertain instead of sending a duplicate.
+The welcome contains no confirmation token and starts no agent work. Local activity
+records contain safe IDs and outcome codes. This feature adds no telemetry.
+
+## Verification
+
+Focused checks:
+
+```sh
+pnpm exec vitest run packages/shared/src/slack-app-manifest.test.ts ui/src/pages/apps/chat/SlackAutomaticSetup.test.tsx
+pnpm exec vitest run server/src/__tests__/chat-channels.integration.test.ts -t 'automatic Slack registration'
+pnpm exec playwright test --config tests/e2e/playwright.config.ts tests/e2e/chat-adapters-ui-providers.spec.ts
+pnpm check:token-gates
+```
+
+The Storybook stories under **Connections / Slack / Automatic setup** render the
+production wizard with simulated provider responses. They cover the automatic
+journey, manual setup, pending/declined installation, uncertain creation, saved
+credential recovery, avatar failure without an extra wizard step, verification
+waiting, welcome-DM failure, and mobile layouts. These are fixture checks.
+
+Partial live qualification on 2026-10-07 used an isolated authenticated instance
+behind TryCloudflare and the operator's authorized Slack installation. The
+operator created and installed the app through the wizard. Safe activity recorded
+successful avatar upload, installer linking, and welcome delivery. A signed
+Request URL challenge was recorded after Retry; the later verification
+confirmation was sent to the already-linked DM using that saved receipt, without
+creating another app. No credentials or OAuth codes are included in this evidence.
+The new pre-install challenge path, notification concurrency/restart recovery,
+revocation, removal, and provider failure cases passed deterministic fixtures.
+In a subsequent two-phase creation run, Slack accepted the manifest update but
+sent no URL challenge. An Events API callback returned HTTP 200, and the operator
+confirmed a real agent reply without clicking Retry. The new automatic advancement
+based on that kind of event is covered by fixtures; the operator subsequently confirmed live automatic advancement after another message.
+Same-thread follow-up, reauthorization, and removal qualification remain outstanding.
+
+For live acceptance, use an isolated HTTPS Paperclip instance, a dedicated test
+app, and an explicitly authorized Slack workspace and destination. Have the user
+enter the configuration token directly. Verify app creation, consent return,
+signed URL verification, avatar status, automatic installer linking, welcome DM,
+a real message and same-thread follow-up, the assigned agent run, and Slack delivery. Resume an
+interrupted setup, reauthorize the same app, and remove the Paperclip connection
+with an outstanding attempt. Record sanitized IDs/links and outcomes, without
+secret fields, OAuth codes, or provider payloads. Record live results separately
+from deterministic fixtures.
+
+Provider references: [Manifest creation API](https://docs.slack.dev/reference/methods/apps.manifest.create/),
+[OAuth installation](https://docs.slack.dev/authentication/installing-with-oauth/),
+[Manifest reference](https://docs.slack.dev/reference/app-manifest/),
+[App icon API](https://docs.slack.dev/reference/methods/apps.icon.set/),
+[Sending a DM](https://docs.slack.dev/reference/methods/chat.postMessage/).
+
+## Agent behavior checks
+
+Slack per-turn guidance covers saved interactive questions, automatic final
+replies, current-chat file handoff, explicit actions, delivery uncertainty, and
+action policies. Tool-description changes refresh the stored catalog without
+re-enabling removed tools or changing their review ownership.
+
+The [connector probe catalog](../../server/src/services/connectors/slack/evals/README.md)
+keeps eleven manual acceptance probes next to that guidance, with related
+deterministic checks selectable through `pnpm test:slack-connector`. No automated
+model campaign is registered by that command. An attended legacy Codex test on
+2026-10-07 delivered real Slack choices, accepted an answer, resumed the same
+task, and returned a correct reply; other probes and runtimes remain unqualified
+until their own provider evidence is recorded.
diff --git a/doc/decision-models.md b/doc/decision-models.md
new file mode 100644
index 00000000000..f41bf6acb4e
--- /dev/null
+++ b/doc/decision-models.md
@@ -0,0 +1,73 @@
+# Company decision models
+
+Company Settings → General → **Decision model** configures one shared API connection for optional Paperclip features. New companies remain unconfigured. A connection manager selects or adds an OpenAI or OpenRouter connection, saves, and can run a small billed setup test. Test answers appear only in that session; request metadata and charges appear under Activity → Costs → Decisions.
+
+**Allow company-sponsored background decisions defaults on.** Saving authorizes internal background features to charge the selected connection without a responsible human. An explicit off setting survives later edits, including changing the connection or omitting the field from an update. Deleting the selected connection or grant preserves the setting and blocks calls until a valid replacement is selected. Disabling decisions prevents new calls. It does not cancel or erase calls already dispatched.
+
+V1 supports native OpenAI Decisions (`gpt-6-luna`) and OpenRouter Decisions (`typesafe/jev-1.13`). It accepts company-owned API keys only. Personal grants, subscription credentials, custom endpoints, fallback chains, images, and public agent/plugin execution tools are outside this version. Decision compatibility is separate from CLI-adapter compatibility.
+
+## Internal service
+
+Register a feature once in its server module, then call `decisionModelService(db)` with trusted server context:
+
+```ts
+const classifyTask = defineDecisionFeature("tasks.classify");
+const service = decisionModelService(db, { budgetHooks });
+const context = { companyId, actor: req.actor, feature: classifyTask, issueId };
+const available = await service.availability(context);
+if (!available.available) return existingBehavior();
+const result = await service.decide(context, {
+ state: { title: task.title },
+ questions: {
+ billing: { type: "boolean", instructions: "Is this about billing?" },
+ team: { type: "choice", instructions: "Which team should handle it?",
+ criteria: { billing: "Payments", support: "Product support" } },
+ urgency: { type: "score", instructions: "How urgent is it?",
+ criteria: ["Routine", "Soon", "Immediately"] },
+ },
+});
+```
+
+The setup test is the only product caller in this release. Future callers must supply the existing budget enforcement hooks, handle unavailable/failure outcomes, and select their own thresholds. Boolean answers are probabilities, choice answers select a category, and scores use the ordered criteria's zero-based positions. Available distributions and provider confidence are preserved in returned answers. `succeeded` and `failed` results include an invocation ID and usage with reported, estimated, or unknown cost. Refusals and invalid responses never become invented answers.
+
+`availability` reads local configuration and permissions only. It does not decrypt credentials, contact a provider, or promise reachability/budget admission. `availabilityForRequest()` returns a memoizing function; keep that function and its context object within one request. Dispatch never trusts this cached authorization.
+
+Human calls use the authenticated user and retain the connection's audience checks. Agent calls reread the active persisted run and its current responsible user, check that user's current membership/resource access, and require an applicable agent/company connection installation. Task and project references must belong to that run/company. Attribution snapshots the effective identity at dispatch. Explicit internal system contexts additionally require a feature registered with `{ background: true }` and company sponsorship. A denied user/agent call cannot fall back to system context.
+
+Credentials are resolved through the existing secret service immediately before admission, with the actual user/agent/system audit attribution. Authorization, connection/configuration revisions, current run identity, and budgets are rechecked before dispatch. Requests allow 1–20 named questions, text/JSON state, and at most 32 KB serialized request data. Execution is limited to 30 seconds and SDK paid retries are disabled.
+
+## Accounting and privacy
+
+`decision_invocations` records feature, actor/responsible user, applicable task/project/agent/run and identity revision, connection/grant, provider/model, request ID, timing, status, question types/count, token counters, and a cost-ledger reference. It does not store state, question text, answers, or raw provider payloads. SDK input/output telemetry is disabled and provider errors are reduced to bounded codes. These are local database records, not first-party telemetry events.
+
+Cost events have `usageKind: decision` and may have no agent. Agentless reporting uses **Paperclip services**. The public agent cost-reporting API still requires an agent; only the internal service receipt path accepts agentless charges. Decision events snapshot responsible-user attribution; historical run costs continue to use their existing attribution rules. Decision events have no heartbeat receipt reference, so run receipt reconciliation cannot count them again.
+
+Admission and settlement use the company accounting lock. Company and applicable agent/project budgets include held reservations and observed spend. Reservations use the largest configured applicable reservation amount. Settlement is idempotent. Explicit provider authentication/validation/rate-limit rejection releases the hold when no model work occurred. Uncertain dispatches, timeouts, and unknown prices remain unpriced with the reservation held. Startup/periodic accounting recovery marks stale invocations interrupted without resubmitting them. Use the existing audited cost adjustment workflow to resolve the charge and release its hold, including a verified zero charge when appropriate.
+
+OpenRouter-reported USD costs are converted to fractional cents. OpenAI uses a dedicated, versioned Decisions rate snapshot: $0.10 per million input tokens for the bounded short requests at the native default endpoint. No chat-model price is substituted. Missing usage or an unsupported rate stays unknown; it is never displayed as a free request. The ledger retains seven decimal places in cents. Pricing provenance accompanies the cost event and remains available to accounting corrections.
+
+History follows company cost visibility and rechecks task access before returning task/run links. It shows the latest 100 requests in the selected date window. Input/output contents remain absent after refresh.
+
+## HTTP surface
+
+All paths are under `/api/companies/:companyId/decision-model`:
+
+| Method/path | Access and behavior |
+| --- | --- |
+| `GET /` | Board; returns manager capability and settings/compatible choices to connection managers |
+| `PUT /` | Connection manager; validates and audits configuration |
+| `GET /availability` | Authenticated company caller; local authorization check |
+| `POST /test` | Connection manager; fixed server-owned three-question sample, ignoring client prompts/identity |
+| `GET /history` | Existing company cost-read rules; date bounds and limit up to 500 |
+
+There is no general HTTP decision execution endpoint.
+
+## Provider dependencies and verification
+
+The experimental Vercel contract is hidden behind Paperclip-owned types. Dependencies are pinned to `ai@7.0.130`, `@ai-sdk/openai@4.0.86`, and `@openrouter/ai-sdk-provider@3.1.0`. That OpenRouter release calls its compatible model factory `evaluationModel`; the wrapper adapts it to the current Decisions interface. Upgrade these together and rerun native wire-format tests.
+
+CI owns lockfile updates. Before a direct Docker build of a feature checkout whose dependency manifests changed, refresh the local build context with `pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile`. Do not commit that generated lockfile; the hosted Docker workflow performs the same preparation and the lockfile bot updates master.
+
+References: [OpenAI Decisions](https://developers.openai.com/api/docs/guides/decisions), [Vercel AI SDK](https://ai-sdk.dev/docs/reference/ai-sdk-core/decide), [OpenRouter Decisions](https://openrouter.ai/docs/api/api-reference/alphadecisions/submit-a-decisions-questions-and-answers-request).
+
+Automated coverage lives in the provider contract and database-backed decision service tests. Provider tests use actual pinned SDK adapters with simulated HTTP responses; they do not establish live account/model availability. Storybook's **Decision models** group uses production components and includes settings states, metadata history, and a settings-to-history journey. A live acceptance check must run the fixed setup test with each authorized shared provider connection and inspect the corresponding persisted invocation/charge. Record live and simulated evidence separately.
diff --git a/doc/dot-runner-prototype.md b/doc/dot-runner-prototype.md
new file mode 100644
index 00000000000..2fa38e719be
--- /dev/null
+++ b/doc/dot-runner-prototype.md
@@ -0,0 +1,311 @@
+# OpenAI Dot runner prototype
+
+The reference prototype is now accompanied by an experimental Rust Runner
+provider, dedicated `/mcp/runner` agent connection and durable broker. See
+[OpenAI Dot with Paperclip Runner](openai-dot-runner.md) for setup and the
+current qualification limits. The transport proof below remains specific to
+this reference harness.
+
+Built 2026-10-02 on the public MCP foundation from `codex/paperclip-mcp-experimental-setting`
+(commit `a88448f77`), merged into the fresh `codex/dot-events-prototype` worktree.
+
+This is a working **protocol prototype**, not a production-selectable Dot
+agent. The default demo's Dot peer and task authority are synthetic. That demo
+does not contact OpenAI, spend model credits, or modify an existing company.
+The optional live lab below is intended to connect an actual Dot. The new provider
+implements the runner's `HarnessDriver` contract and executes through
+`HarnessDriverBackend`; it does not use the legacy HTTP adapter.
+
+## Try it
+
+After installing and building workspace dependencies:
+
+```sh
+pnpm prototype:dot
+```
+
+The command creates a temporary PostgreSQL database, company, user and task;
+creates a real OAuth grant through PKCE and consent; starts two loopback HTTP
+servers; subscribes to a signed event; and drives a runner assignment to
+completion through authenticated MCP. It prints each successful stage and
+removes the temporary state. Its synthetic Dot peer deliberately retries a
+write concurrently to prove there is only one report. No credentials are
+printed. This is a CLI demo, not a mock UI or a connection to your Dot account.
+
+Fresh-worktree preparation (use the repository's pinned pnpm version):
+
+```sh
+pnpm install --no-frozen-lockfile
+pnpm --filter '@paperclipai/server^...' --filter '!@paperclipai/paperclip-runner' --filter '!@paperclipai/ui' build
+```
+
+The local callback uses an injected transport restricted to one fixed synthetic
+HTTPS URL and rewrites it to loopback. The production event transport retains
+its HTTPS, public-IP DNS pinning and no-redirect checks.
+
+## Connect a real Dot to the disposable lab
+
+The separate live lab uses the real remote webhook transport, with no synthetic
+Dot peer or callback override. It still uses synthetic task admission and one
+projected `save_report` tool, so it is a transport acceptance test, not production
+agent scheduling. It requires an existing Dot account with custom plugins.
+
+Expose **only port 43127** through an HTTPS tunnel, then run:
+
+```sh
+cloudflared tunnel --protocol http2 --url http://127.0.0.1:43127 --no-autoupdate
+DOT_LAB_ORIGIN=https://YOUR-TUNNEL-HOST pnpm prototype:dot:live
+```
+
+Add `https://YOUR-TUNNEL-HOST/mcp/paperclip` as an OAuth MCP plugin in the
+account that owns the Dot. The consent page waits for local operator approval.
+The lab prints a local `control.json` path; it contains a temporary credential,
+must stay local, and is removed when the lab stops. The separate control port
+(43128 by default) must never be tunneled. Inspect the pending client and return
+origin before approving its exact request ID:
+
+```sh
+node server/scripts/dot-runner-live-control.mjs /path/to/control.json status
+node server/scripts/dot-runner-live-control.mjs /path/to/control.json approve REQUEST_ID
+```
+
+The consent page then returns to ChatGPT. Give Dot the standing instruction
+printed by the lab, including the exact company and inbox task IDs. Wait for a
+verified `paperclip.dot.work_available` subscription in `status`, then publish
+the assignment from Paperclip's side:
+
+```sh
+node server/scripts/dot-runner-live-control.mjs /path/to/control.json queue
+node server/scripts/dot-runner-live-control.mjs /path/to/control.json status
+```
+
+The expected result is a signed event delivery, Dot reading and accepting the
+assignment, a report saying `17 + 25 = 42`, and a structured runner completion.
+A delivered webhook alone is not a passing test. `status` exposes the report,
+runner transcript and delivery outcome only over authenticated loopback.
+Keep the lab and tunnel running while ChatGPT loads the newly installed tools;
+the plugin directory can list them before Dot can invoke them. A stopped quick
+tunnel cannot be reused just by restarting the lab. A new tunnel address needs
+a plugin configured for that address and fresh OAuth consent. Restarting the
+lab also discards its OAuth client registrations and grants.
+Stop the lab with the local control command (`... control.json stop`), then stop
+the tunnel after the test. Use this command for reliable cleanup; development
+process wrappers may terminate on a signal before asynchronous cleanup finishes.
+The lab expires after two hours,
+revokes its connection on graceful shutdown, and deletes its temporary database
+and encryption key. It never opens the user's existing Paperclip database.
+
+## Two directions, two explicit identities
+
+```mermaid
+sequenceDiagram
+ participant Host as Paperclip host
+ participant Runner as Dot runner bridge
+ participant MCP as OAuth MCP + event outbox
+ participant Dot as OpenAI Dot
+ Host->>Runner: Admitted task + explicit grant/agent binding
+ Runner->>MCP: Persist work_available references
+ MCP->>Dot: Signed webhook wakeup
+ Dot-->>MCP: Receipt (does not mean work started)
+ Dot->>MCP: Read inbox and assignment; accept
+ MCP->>Runner: Authenticated, bound commands
+ Runner-->>Host: PRP turn.started
+ Dot->>MCP: Call projected tools / report progress / propose result
+ MCP->>Runner: Check current authority; deduplicate request ID
+ Runner-->>Host: PRP progress and structured result
+ Note over Host: Paperclip decides final task disposition
+ Dot->>MCP: Personal Paperclip reads/writes while idle
+ Note over MCP: These retain the consenting person's identity
+```
+
+Dot's always-available personal tools come from the merged public MCP connection.
+They act as the person who consented. Agent participation is separate: a trusted
+host binds an already admitted run to one OAuth grant, company, agent, task,
+session and turn. Connecting or selecting a task never grants impersonation.
+The registry has no MCP registration tool and no generic API executor.
+
+## What is implemented
+
+- `DotHarnessDriver`: one turn per admitted run, explicit acceptance, bounded
+ lifetime, projected tools, progress and validated `paperclip.run_result.v1`
+ completion. Reports normal PRP events consumed by the existing native backend.
+- `createDotRunnerMcpBridge`: six tools on the existing authenticated endpoint:
+ `paperclip_dot_inbox`, `paperclip_dot_read`, `paperclip_dot_accept`,
+ `paperclip_dot_tool`, `paperclip_dot_progress`, `paperclip_dot_finish`.
+ Bound tools are visible only to the selected grant with write consent.
+- Optional `paperclip.dot.work_available` event on the existing durable outbox.
+ Its `companyId` and `taskId` identify a designated standing inbox task. Each
+ assignment can concern a different task; the event carries only IDs, and Dot
+ retrieves the current assignment through authenticated tools. Existing
+ authorization, encrypted callback material, signed verification, retry,
+ expiration, rotation and unsubscribe behavior are reused.
+- Matching duplicate commands share one receipt, including simultaneous writes.
+ A changed retry is rejected. Ambiguous writes remain `unknown` and are not
+ redispatched. Per-run receipts are memory-only in this prototype.
+- Revocation/expiry prevents further accepted commands and ends event waiting.
+ The live host authority callback runs for each new operation and before
+ returning tool output. The host's tool dispatcher must enforce atomic domain
+ permissions, pause, ownership, approvals and budget checks at the actual write.
+- Usage and cost remain unknown. Delivery does not fabricate a started turn.
+ Result acceptance proposes a disposition; it does not directly set issue status.
+
+## Host wiring and the production gap
+
+The detailed implementation proposal is in
+[OpenAI Dot as a production Runner provider](plans/2026-10-02-openai-dot-runner-adapter.md).
+
+The default app does **not** construct the bridge or advertise the Dot event.
+The host must explicitly pass `enableDotPrototype: true` to
+`createPublicMcpEvents`, pass the bridge as the fourth argument to
+`publicMcpIngressRoutes`, and register a driver for a trusted admitted run.
+The lab demonstrates that composition with synthetic admission and a single
+synthetic projected tool. There is no production scheduling integration yet.
+
+Do not enable this by supplying a fake Codex profile to the native execution
+factory or by creating a heartbeat row from an MCP request. Production needs:
+
+1. An explicit governed agent binding/consent and a qualified Dot provider in
+ native admission, with task checkout, budgets, pause and policy checks.
+2. Durable provider mailbox and command receipts, reconnect/recovery and
+ reconciliation of uncertain tool outcomes. The event outbox already persists;
+ this prototype's runner registry does not. After restart it refuses recovery.
+3. Server-owned runtime tool projection/dispatch with ordinary audit receipts.
+ The lab tool is not the production runner tool authority.
+4. A stop policy that can handle remote autonomy honestly. Revoking Paperclip
+ access cannot prove that Dot or its child tasks stopped. Active close reports
+ `provider stop is unconfirmed`; interruption, steering and resume are not
+ advertised. `dot-bridge:` identifies this bridge, not an OpenAI task.
+5. A reachable staging deployment, real Dot plugin onboarding, and a live
+ event-triggered assignment before claiming client compatibility or release
+ readiness. Hosted use also needs the companion Cloud broker deployed.
+
+An existing in-flight external write can finish after revocation. Do not retry
+with a fresh request ID to force a result. Inspect authoritative task state.
+Unregister completed runs to release the bounded in-process registry.
+
+## Intended live onboarding
+
+1. Connect the existing Paperclip MCP plugin in developer mode and consent to
+ the team and requested writes.
+2. Explicitly bind that connection to the chosen Dot agent after the production
+ admission work above. Show the identity and the standing inbox task.
+3. Give Dot one standing instruction to subscribe to `paperclip.dot.work_available`
+ for that inbox, inspect current assignments, accept intended work, use the
+ projected tools, and finish with a structured result. Treat duplicate events
+ as wakeups, never as another task. Avoid comment-acknowledgement loops.
+4. Assign work in Paperclip and verify the entire loop with the actual account.
+
+OpenAI now documents MCP Events for dots. Private developer-mode testing does
+not require a public directory listing; public distribution is a separate review.
+See [MCP Events](https://developers.openai.com/plugins/build/mcp-events),
+[developer mode](https://developers.openai.com/api/docs/guides/developer-mode),
+and [app review](https://developers.openai.com/plugins/deploy/app-review).
+
+## Verification
+
+```sh
+pnpm --filter @paperclipai/paperclip-runner exec vitest run src/drivers/dot/dot-harness-driver.test.ts
+pnpm --filter @paperclipai/server exec vitest run src/__tests__/public-mcp.test.ts
+pnpm prototype:dot
+```
+
+Runner tests cover native PRP validation, cross-company/grant/turn rejection,
+unknown outcomes, concurrent retries, expiry, live authority checks, malformed
+results, late writes, revocation and unsupported recovery. The MCP suite checks
+real OAuth, event signatures, the opt-in catalog, personal-tool coexistence and
+revocation. The CLI demo uses real TCP for both directions.
+
+Recorded validation: eight runner tests passed; all 37 MCP tests passed; the
+changed Dot scenario passed again after the final uncertainty-handling fix;
+runner and server TypeScript checks passed; the loopback CLI demo passed.
+Shared/server dependency builds and the runner TypeScript build also passed.
+The repository-wide test/build, Rust provider qualification and hosted Cloud
+acceptance were not run. Actual Dot acceptance is recorded below. This is not
+a PR-ready production provider handoff.
+
+Live-lab setup on 2026-10-02: the isolated server started, its public OAuth
+discovery endpoint returned 200, and unauthenticated MCP requests returned 401.
+The live script passed an explicit TypeScript check, and the 37 MCP regression
+tests passed again after changing the bridge to a structural driver interface.
+During that initial setup, no actual Dot connected or subscribed: native desktop automation was unavailable,
+and the inspected browser account showed Dot creation rather than an existing
+Dot. The temporary tunnel subsequently expired; it and the lab were stopped.
+The later attempts below used the correct existing Dot account.
+
+### Actual Dot attempt, 2026-10-02
+
+With the existing Dot open in the correct Chrome profile, the user approved
+installing the private `Paperclip Dot Lab` plugin and its lab-only OAuth grant.
+The first real callback exposed a lab bug: OAuth consent request IDs are opaque
+`pcmcp_request_` tokens, not UUIDs. The live script now validates that format.
+Restarting the disposable database also erased ChatGPT's cached public client
+registration. The exact public client ID and redirect URI were restored only in
+the verified one-company lab database; no grant or token was inserted directly.
+The normal consent and PKCE exchange then completed successfully.
+
+Chrome briefly showed `ERR_BLOCKED_BY_CLIENT`; after the user handled/retried the
+page, it showed the ordinary stale-client server error instead. The browser
+block's originating component was not identified. No browser protection was
+disabled. It should not be confused with the separately diagnosed OAuth error.
+
+Observed live results:
+
+- ChatGPT called authenticated `server/discover`, `tools/list`, and `events/list`
+ using MCP 2026-07-28; all returned HTTP 200.
+- The plugin UI showed its connected account, 10 read tools, 6 write tools, and
+ all four event definitions, including the six Dot runner actions.
+- Dot found `paperclip.dot.work_available` and recognized its argument schema.
+ Initially it reported no Paperclip action tools in its runtime, including the
+ read-only `paperclip_connection`. An explicit @ mention did not make them
+ available immediately.
+- Dot also reported that its event-subscription route requires a successful
+ read-only connection check, so the reduced event-only test could not proceed.
+- The lab observed **zero `tools/call` or `events/subscribe` requests**, zero
+ subscriptions, and zero deliveries. No assignment was queued and no report
+ was saved. This is live discovery/connection evidence, **not** an end-to-end
+ task or event-wakeup pass.
+
+The first lab and tunnel were stopped too early, revoking the temporary grant
+and deleting its database. Dot subsequently reported that the action tools had
+become available, but its connection check failed against that offline endpoint.
+This does not establish a Dot runtime incompatibility. A fresh lab and tunnel
+were connected as `Paperclip Dot Lab Retry`; the new server observed Dot calling
+`paperclip_connection` successfully. The first plugin definition remains
+installed with its expired endpoint. Production still needs the admission,
+durable mailbox, recovery and tool-authority work above.
+
+### Successful real Dot retry, 2026-10-02
+
+The replacement private plugin completed fresh dynamic client registration,
+normal OAuth consent and PKCE without manual database repairs. It used the real
+Dot in the user's Chrome account and the public HTTPS tunnel. The lab retained
+the ordinary callback verification, DNS/IP pinning and webhook signing checks.
+
+Observed server evidence (UTC):
+
+| Time | Observation |
+| --- | --- |
+| 22:16:30 | Dot called `paperclip_connection` successfully. |
+| 22:17:00 | `events/subscribe` succeeded; the verified `paperclip.dot.work_available` subscription was present. |
+| 22:17:24 | The operator queued the single assignment. Its webhook was observed as `delivered` after one attempt. |
+| 22:17:48 | Dot called `paperclip_dot_inbox` after the event, without another chat prompt. |
+| 22:17:56 | Dot read the assignment using `paperclip_dot_read`. |
+| 22:18:10 | Dot accepted it; the native Runner emitted `turn.started`. |
+| 22:18:23 | Dot called `save_report` through `paperclip_dot_tool`; the lab saved exactly one report: `Dot received the Paperclip event. 17 + 25 = 42.` |
+| 22:18:38 | Dot submitted a valid `paperclip.run_result.v1`; the Runner emitted `run.result.proposed`, `turn.completed` and `run.terminal` with state `succeeded`. |
+| 22:18:50 | `events/unsubscribe` succeeded; no subscription remained. |
+
+Dot's final chat message confirmed event receipt and completion. It could not
+confirm complete unsubscription from its client response, but the server
+independently recorded the successful unsubscribe. Removing the subscription
+also removed its delivery rows, so delivery was verified before that cleanup.
+Dot separately disclosed an accidental cloud desktop app inventory call during
+setup; it reported opening no app content and stopping immediately. This test
+proves the transport and Runner handshake, not isolation of Dot's other tools.
+
+This is a **real event-triggered, two-way transport acceptance pass** using the
+new Runner backend. It still uses synthetic admission, one disposable task and
+one projected tool. It does not establish production scheduling, recovery,
+budget enforcement, arbitrary personal API operations, or reliable remote stop.
+The replacement lab was left running for inspection under its two-hour expiry;
+the test subscription was removed and no further assignment was queued.
diff --git a/doc/evals.md b/doc/evals.md
index bdc4b26dea2..713ea8bcafd 100644
--- a/doc/evals.md
+++ b/doc/evals.md
@@ -1,5 +1,11 @@
# Paperclip evaluation guide
+The [Slack connector probe catalog](../server/src/services/connectors/slack/evals/README.md)
+organizes eleven manual model acceptance probes and a selector for existing
+deterministic regressions (`pnpm test:slack-connector`). It is not a registered
+model campaign; transport fixtures do not prove that an agent chooses a tool
+or that a real Slack interaction completes.
+
The explicit-only [live provider connection suite](../tests/runner-e2e/PROVIDER-CONNECTIONS.md)
is a Product E2E workflow for fresh subscription/API-key/gateway connections,
with attended login and independent artifact checks against local or staging targets.
diff --git a/doc/execution-semantics.md b/doc/execution-semantics.md
index fe946031175..fe62494d668 100644
--- a/doc/execution-semantics.md
+++ b/doc/execution-semantics.md
@@ -211,6 +211,22 @@ New comments received during an execution hold retain their individual deferred
The conversation groups repeated empty pre-start reconciliation cancellations into a neutral waiting notice. Started runs, actual startup failures, and run history remain inspectable. No historical run records are deleted.
+An unstarted legacy conversation retry waits on its existing `scheduled_retry`
+row while a previous execution still owns a process or environment lease. Each
+sweep moves the next check forward without creating another run or incrementing
+retry accounting. The wait survives a controller restart. A queued retry that
+encounters the same ownership hold returns to that scheduled state. Once
+ownership is released, normal promotion and dispatch gates still apply,
+including reassignment, cancellation, budget limits, and no-replay holds.
+The **Retry now** action returns `waiting` with the saved retry schedule while
+cleanup holds ownership. Its controls show the wait without claiming that a run
+started, and another click can check the gate again.
+
+Recovery instructions in a wake describe only an active or escalated recovery
+action. Resolving or cancelling that action removes its repair instructions from
+subsequent wakes, so the original worker can resume the task. This prompt change
+does not clear any persisted execution reconciliation hold.
+
Workspace contention (`workspace_busy`) displays **Waiting for workspace** and
continues automatically when the workspace is available. Internal scheduling
attempts remain in the run log without conversation cancellation markers,
@@ -501,6 +517,24 @@ Warm sandbox reuse must match the current host Git tip and branch as well as the
file snapshot and saved stamp, including managed nested repositories. A history
or branch mismatch restages the host before the next run begins.
+### Remote Codex model compatibility
+
+Fresh remote Codex Runner runs check the selected image CLI before saving the
+native execution input. If the CLI is in the supported app-server version window
+but below the selected model's verified minimum, preparation chooses the newest
+compatible older model of the same class (`sol`, `luna`, `astra`, or `terra`),
+then the stable Runner default. Each candidate is considered once; this selection
+does not replay a provider turn or consume a failure-retry attempt.
+
+The effective model is saved in the execution input before checkpoint selection,
+so launch, recovery, and usage accounting share that identity. The requested
+agent and task settings stay unchanged. A task warning and `runner.model_fallback`
+run-log event name both models and the image CLI version. An explicit remote
+Codex artifact or npm install pin retains precedence. Persisted executions are
+not rewritten, and unknown models, invalid CLI builds, and artifact failures keep
+their existing verification and recovery rules. Capacity and authentication
+failures do not trigger this startup substitution.
+
### Native provider model capacity
A committed Codex `turn.failed` event with `codexErrorInfo: serverOverloaded`,
@@ -656,6 +690,21 @@ An issue monitor is a one-shot deferred action path for agent-owned issues in `i
Use a monitor when the current assignee owns a future check against an async system or external service. Examples include Greptile review loops, GitHub checks, Vercel deployments, or provider jobs where the agent should come back later and decide what happens next.
+Native runners in standard execution use `set_task_monitor({ taskId?, idempotencyKey, monitor })`. Omit `taskId` for the current task. An explicit target must be accessible, in the same company, assigned to the caller with no human assignee, and `in_progress` or `in_review`. Runtime-management permission still applies. Ask, planning, and review-only runs cannot use this tool. Generic `call_api` lifecycle restrictions remain in force.
+
+To wait for a check:
+
+1. Set a future `monitor.nextCheckAt` and short `monitor.notes` describing the check, with optional service context and bounds.
+2. Confirm the receipt's persisted task ID, monitor state, next-check time, and bounds.
+3. Call `paperclip_finish` with `reportedWorkDisposition: "yielded"` and `continuation: { kind: "monitor", summary, idempotencyKey }`. Report outstanding work honestly; the scheduled check may still block completion.
+4. End the run. Paperclip keeps the task active, releases execution ownership, and the one-shot scheduler later wakes it with `issue_monitor_due`. This does not enqueue an immediate continuation. On resume, `get_task_context.activeTask.monitor` includes the consumed monitor’s notes and attempt count.
+
+Only a valid persisted monitor on the current task authorizes that finish; scheduling another owned task does not. Authority is checked again under the final disposition lock. A timer that becomes due during an active native execution remains scheduled until execution releases it. Dispatch checks the current schedule, claim, status, and assignee so an older dispatch cannot clear a replacement monitor.
+
+The service name `AI provider quota` is reserved for server-owned recovery of legacy runs. Native task monitors reject it; use ordinary service context and notes when scheduling a provider-usage check.
+
+Use a new idempotency key to replace the schedule or clear it with `monitor: null`. Retrying the original call returns current monitor state without re-arming a consumed, replaced, or cleared timer. Monitor changes, audit activity, and mutation receipts are committed together, and unrelated execution/review policy is preserved. Legacy agents continue to use the issue API.
+
Monitor policy lives under `executionPolicy.monitor` and includes:
- `nextCheckAt`: when Paperclip should wake the assignee
@@ -1351,6 +1400,23 @@ controller must recover it through the authenticated ownership checks. This
preserves active work and queued messages without treating a server restart as
user cancellation.
+When a native turn creates a governed approval wait, its checkpoint retains the
+exact committed triggering event and yielded disposition before interrupting the
+provider. Shutdown gives these turns a shared, bounded 20-second window to finish
+settling their usage and terminal evidence before detaching. Recovery verifies
+the trigger against the retained event ledger and settles that same turn, even
+if the user has already answered the interaction. It replays retained accounting
+through the ordinary control-plane observers without starting another model turn.
+When a later heartbeat run reuses the provider session, it clears that prior
+run's wait marker along with its terminal, result and pending-request authority.
+Already-numbered cancellation acknowledgements and cancelled/expired runtime requests
+are retained during shutdown so recovery can replay a contiguous journal. They
+carry no permission to start work. Stream closure, stream failure or drain timeout
+after complete usage leaves the saved wait unfinalized until a provider terminal
+is retained; complete token counters alone cannot certify a stopped provider.
+A timeout, missing accounting, or an unproven provider terminal remains a failure;
+the saved wait does not certify successful provider execution.
+
Before either shutdown path exits, idle warm sessions close through their
normal suspend-and-checkpoint path. Remote sessions therefore leave verified
backup authority for the next controller even though their last run is already
diff --git a/doc/html-artifact-previews.md b/doc/html-artifact-previews.md
new file mode 100644
index 00000000000..cfb9fafbe99
--- /dev/null
+++ b/doc/html-artifact-previews.md
@@ -0,0 +1,43 @@
+# HTML artifact previews
+
+HTML attachments and workspace `.html`/`.htm` files open rendered by default.
+The eye and code icons beside Download switch between the report and its original
+source. Download always returns the original file. Empty and oversized attachments
+use the existing text-viewer states and limits.
+
+The shared `HtmlArtifactPreview` uses `srcdoc` in an iframe with
+`sandbox="allow-scripts"`. **Never add `allow-same-origin`.** Its opaque origin
+prevents artifact JavaScript from reading Paperclip cookies, storage, or the parent
+DOM. Forms, popups, downloads from inside the frame, and top navigation are not
+granted. The host does not accept messages or privileged requests from artifacts.
+
+A trusted CSP is installed before any artifact markup. It permits inline scripts
+and styles for self-contained tables, charts, filtering, and other report controls.
+It blocks API connections, remote scripts/styles/images/fonts/media, child frames,
+objects, base URLs, and form submissions. Embedded data images/fonts/media work.
+An artifact's own CSP cannot weaken the first policy. No artifact HTML is parsed
+or inserted into the host DOM. The iframe sends no referrer.
+
+This supports self-contained reports. Reports that need CDN libraries or external
+resources must embed them instead. Ordinary external links cannot open new tabs
+or navigate the host. The sandbox does allow navigation within the artifact frame;
+its opaque-origin restrictions remain after navigation. This is not a claim of
+complete network isolation or protection against resource exhaustion by scripts.
+
+Attachment HTTP serving retains forced download, `nosniff`, and its existing
+sandbox CSP. Workspace previews return bounded UTF-8 inside JSON, and workspace
+downloads retain `Content-Disposition: attachment`. No database or API shape changes
+are needed.
+
+Review **HTML artifacts** in Storybook for the production viewer, security probes,
+workspace panel/file sheet, and a task-to-report journey. Run the browser security
+checks with:
+
+```sh
+pnpm exec playwright test --config tests/html-preview/playwright.config.ts
+```
+
+These checks use Chromium and simulated report data. They verify working report
+controls, raw mode, cookie/storage/parent access denials, blocked resource and API
+requests, and denied top navigation/popups. They do not replace testing the actual
+attachment journey in a running Paperclip instance.
diff --git a/doc/idle-sleep-safety.md b/doc/idle-sleep-safety.md
new file mode 100644
index 00000000000..61f0977f044
--- /dev/null
+++ b/doc/idle-sleep-safety.md
@@ -0,0 +1,98 @@
+# Automatic idle sleep safety
+
+`GET /api/instance/task-drain?idleSleepSafety=1&ownerId=` adds an
+instance-wide `idleSleepSafety` report for instance administrators and signed
+Cloud control callers. Ordinary task drains keep their existing behavior.
+Company members and agents cannot read this report.
+
+## Hosting protocol
+
+1. Hold external admission at the hosting layer. Queue user requests for wake or
+ abort sleep when activity arrives. Do not send traffic into an instance that
+ is being stopped.
+2. Send `POST /api/instance/task-drain` with
+ `{ "purpose": "idle", "ttlMs": 120000 }`. Idle holds require a TTL from 5 to
+ 300 seconds. Save the returned `ownerId` and `expiresAt`. An existing drain
+ returns 409. An unsupported purpose must leave automatic sleep disabled.
+3. Poll the report with that exact owner. Only
+ `{ "version": 1, "backgroundWork": "none" }` permits sleep. Require the same
+ `ownerId`, `draining: true`, zero run/wake counters, and enough remaining TTL
+ for the provider stop. `present`, `unknown`, missing fields, or errors must
+ keep the instance awake. Do not interpret `quiescent` alone as authorization.
+4. Revalidate the same hold immediately before stopping the instance. Keep
+ external admission closed through the provider stop. Never use an old report
+ after a restart, expired hold, changed owner, or failed validation.
+5. If sleep is abandoned, send `DELETE /api/instance/task-drain?ownerId=`.
+ A missing or stale owner cannot release another controller's idle hold. The
+ TTL clears an abandoned hold if the controller loses its response.
+
+An idle hold rejects new tenant HTTP requests and WebSocket upgrades with 503
+and `Retry-After: 1`. Health checks and authenticated task-drain control remain
+available. Ordinary deploy drains do not enable this HTTP gate. The host must
+handle retry/wake at its ingress before enabling automatic sleep.
+Health and control mutations remain tracked through completion, including
+signed bootstrap writes. Only the task-drain read skips request tracking.
+Its authentication finishes under a separate work token before entering the
+report, so it counts concurrent writes without blocking on its own scan.
+
+## Accepted work and cleanup
+
+HTTP admission is installed before body parsing, authentication, webhooks and
+MCP ingress. The Express adapter tracks handler promises in nested routers and
+error middleware. Sending a response or losing the client does not complete an
+async handler. A callback-only handler that abandons its response without ending it remains a
+sleep blocker. An async route that settles after a disconnect releases its
+request token; normal cancellation does not permanently block sleep. New routes must be registered before this adapter is installed.
+Fire-and-forget work must have durable queue state or use `trackIdleWork`; a
+response is never a substitute for tracking that work.
+Accepted live-event WebSocket authentication remains counted until its promise
+settles, including after the raw socket closes. Detached startup reconciliation
+for built-in agents, managed homes and persisted runtime services also remains
+counted after readiness until its writes settle.
+
+Scheduler work already in flight remains counted until its promise settles.
+Idle holds pause new scheduler admissions. Database backup promises remain
+counted through success or failure. Configured periodic backups also block
+sleep until a host owns a durable wake schedule for them. A generation counter invalidates a
+scan if tracked work both starts and finishes during inspection. Reports remain
+unknown until startup recovery and HTTP tracking are installed.
+
+The report inspects accounting and sandbox-cleanup spools directly. Any entry,
+including malformed JSON, temporary files and failed write probes, blocks sleep.
+Read errors and invalid spool paths return unknown. Recovery readers that skip
+bad records cannot certify an empty spool.
+
+An orphan cleanup token starts before its spool write and remains held through
+buffering, queue splices, flush retries and buffer overflow. It ends only after
+the database owns cleanup. Queued usage receipts stay counted until capture
+settles. If receipt capture and the database failure fence both fail, a token
+continues to block sleep until the failure fence is durably written. A query
+that updates zero rows does not clear that debt. Unrecoverable cleanup requires
+operator reconciliation; this API does not discard it to save compute.
+
+## Persisted work and limits
+
+The report checks all companies in one bounded read-only database transaction.
+Queued and orphaned runs, timers, retries, accounting debt, unfinished issues,
+cleanup, active routines, integrations, external API credentials, and plugin
+work block sleep. Completed ordinary run history does not. Less common work
+sources conservatively block on any retained records. Active issue watchdogs
+block sleep even when their watched issue is complete and no review has started.
+Missing migrations, malformed configuration and database errors produce unknown
+without exposing SQL or tenant data.
+
+Every enabled plugin blocks sleep. A version label does not prove that arbitrary
+worker code has no background activity. No plugin approval or configuration
+bypass is supported. Scheduled and externally triggered work needs a durable
+host wake mechanism before this restriction can be relaxed.
+
+This is a single-process admission protocol. A restart clears the owner. The
+host must serialize sleep with deploy/wake operations and bind its final check
+to the instance it stops. An unexpected restart after the final check can still
+race an external provider stop; a process-local report cannot fence that remote
+operation by itself. Multiple replicas require shared fencing. The protocol
+does not make existing in-memory-only debt survive an unplanned process crash.
+
+Related public PR #13413 adds runtime-service controller requirements and uses
+the same `purpose: "idle"` / `ownerId` vocabulary. This report conservatively
+blocks all retained runtime-service state instead of approving such services.
diff --git a/doc/observability.md b/doc/observability.md
index 5c1e57c1784..b62a1263309 100644
--- a/doc/observability.md
+++ b/doc/observability.md
@@ -269,9 +269,9 @@ environment variables: `SENTRY_DSN_FRONTEND` for the browser and
`SENTRY_DSN_BACKEND` for the server. Each variable is optional. A
specific variable always wins for its own component; a legacy variable,
`SENTRY_DSN`, supplies a component that has no specific value set. An
-empty string counts as absent for all three variables. The feature uses
-built-in Sentry options only. It adds no `beforeSend` hook and no custom
-filter code.
+empty string counts as absent for all three variables. SDK configuration uses
+built-in Sentry options only. It adds no `beforeSend` hook. The run-failure
+reporter selects reportable outcomes before calling the SDK, as described below.
The server is inactive when the backend DSN resolves to `null`; then it
imports no Sentry package. The browser is inactive when the front-end DSN
@@ -434,6 +434,60 @@ They do not change the ambient Sentry scope, whose isolation is unavailable
without an OpenTelemetry context manager. Later, unrelated exceptions must
not inherit a previous run's identity or fingerprint.
+Known missing-secret configuration blockers are kept in the task's run log,
+blocked state, and owner recovery action, without a Sentry run-failure event.
+This requires a failed `configuration_incomplete` run in the preparing stage,
+a setup-phase report, explicit proof that provider work did not start, and a
+nonempty list of recognized missing or inactive secret bindings. Process exit
+evidence, unknown binding reasons, secret-provider failures, ambiguous missing
+secret-definition lookups remain reportable. This filter does not change task
+recovery, credentials, or execution policy.
+
+A workspace policy conflict also stays local when the resolver proves that an
+explicit `local_path` or `non_git_path` project workspace has no repository URL,
+Git confirms the selected directory is not a repository, and the task requests
+a Git worktree. The run must fail during setup before provider work starts.
+Its existing validation error, blocked task and board recovery action remain.
+Local Git command failures, permissions, corrupt repositories, fallback paths,
+and generic missing or unrestorable workspaces remain reportable. The error text
+or `workspace_validation_failed` code alone never suppresses them.
+
+Recognized external connection failures also stay in the local run result instead
+of producing application-error events in Sentry. Their producer records a closed
+`connectionFailure` descriptor: schema version, provider, operation, and reason.
+It contains no URL, host, path, credential, or remote response. This classification
+does not change the run's failed state, task recovery action, retry policy, or
+whether remote work may have been accepted.
+
+- Managed remote Git clones classify known authentication, repository access,
+ invalid URL, DNS (including machine-specific SSH aliases), connection, TLS,
+ rate-limit, and upstream failures from the actual clone subprocess. Setup must
+ fail before provider work starts. Every failed workspace candidate must have
+ proven connection evidence; a mixed or unknown failure remains reportable.
+ Local/file clones, credential-provider exceptions, local checkout or copy
+ failures, process signals, and repository corruption remain reportable. Remote
+ fetch failures already return workspace warnings; their classification is not
+ transferred to a later failure resolving a local base ref.
+- Hermes gateway configuration validation and the initial create-run request use
+ exact config, HTTP, or structured transport evidence. Missing configuration,
+ rejected credentials, unavailable endpoints, rate limits, and upstream outages
+ remain visible to the run owner. Unknown protocol/parser errors, missing run
+ identifiers, untyped terminal failures, and timeouts after accepted work remain
+ reportable. Stream/poll errors retain their existing retry and logging behavior.
+
+Expected pre-provider waits for a shared project workspace, a credential rotation
+lock, or an exhausted AI connection pool carry a server-owned expected
+cancellation receipt. They retain existing retry and lock behavior without a
+Sentry cancellation event. A later failed retry still reports its actual error;
+the wait code alone is not sufficient to suppress an event.
+
+MCP tool discovery records recognized outbound HTTP/transport failures through
+server-only provenance. These failures preserve the response status, stored
+connection health, audit record, local context, and first-party telemetry while
+skipping only Sentry. A proven missing OAuth scope returns an actionable 422
+response with its reconnect guidance. Unknown responses, parsing errors, local
+callbacks, database errors, and unproven network-looking messages still report.
+
The `run_failure` context also includes the recorded process `exitCode` and
`signal`, so a generic adapter error can still distinguish a nonzero exit from
a signal termination. Exit codes must fit the database's signed 32-bit integer;
@@ -515,6 +569,19 @@ and native runs:
- `run_exception_0` through `run_exception_3`: exception names, codes, HTTP
statuses, and request IDs for a caught exception and up to three causes.
+The orphan reaper records a bounded `processLossDiagnostic` before status writes
+or cleanup. For `process_lost` failures, `run_execution` includes
+`processLossPidRecorded`, `processLossGroupRecorded`, and `processLossLocalCheck`
+(`not_observed_alive`, `not_checked`, or `no_identifiers`). It also includes
+`processLossRunPredatesObserver`, `processLossObserverUptimeMs`, and
+`processLossLastOutputAgeMs` when the timestamps are available and valid. Ages
+above seven days are omitted. These are observations, not proof of an OOM,
+provider failure, or deployment. The last-output age can include system output.
+`processLossRetryEligible` records eligibility for the existing process-loss retry
+at detection; it does not claim that a retry was queued or succeeded. This data
+contains no process IDs, task text, paths, or credentials and changes no recovery
+or ownership decisions.
+
ACP turns record `acpLastEventAgeMs`, `acpObservedEventCount`,
`acpPendingToolCount`, and `acpToolInventoryComplete` at finalization, before
usage reads, error logging, and cleanup. The age measures time since the last
@@ -541,6 +608,29 @@ or `restore_failed`. Unknown values are omitted. Workspace paths and arbitrary
pre-restore result data are not included. A later successful run does not, by
itself, establish that an earlier failed restore recovered the workspace files.
+For `workspace_validation_failed` with `git_worktree_not_reusable`, `run_execution`
+includes `workspaceValidationReason` and an allowlisted `workspaceValidationReasonCode`:
+`missing_worktree`, `not_a_git_checkout`, `not_registered`, `wrong_repository_root`,
+`branch_mismatch`, or `git_inspection_failed`. The last code distinguishes an
+unsuccessful or truncated Git registration inspection from confirmed absence in
+a complete list. Its optional `workspaceValidationInspection*` fields identify
+the fixed command `worktree_list`, failure (`spawn_failed`, `nonzero_exit`, or
+`output_truncated`), an allowlisted OS error code (or `unknown`), and an exit code
+from 1 through 255. No paths, repository or branch names, IDs, command output, or
+arbitrary messages enter these fields. Validation still blocks reuse; it does
+not repair Git metadata, change the selected repository, or retry the task.
+
+For explicit reuse of a retained Git workspace, `persisted_workspace_source_conflict`
+uses the same two fields with the fixed reason codes `source_scope_mismatch`,
+`explicit_project_workspace_conflict`, `source_path_unproven`,
+`source_registration_unproven`, `source_repository_mismatch`, or
+`source_repository_unavailable`. These distinguish an unverified original source
+from a missing Git registration. Paths, repository URLs, and workspace IDs stay
+out of the diagnostic fields. The task remains blocked until its original source
+is available or the owner intentionally selects a different workspace. A failed
+Git registration probe retains `git_inspection_failed` and the same bounded
+inspection fields, including when it occurs during original-source selection.
+
When available, the saved `workspaceRestoreDiagnostic` adds the bounded fields
`workspaceRestorePhase`, `workspaceRestoreStep`, `workspaceRestoreErrorCode`,
`workspaceRestoreHttpStatus`, and `workspaceRestoreExitCode` to `run_execution`.
@@ -554,6 +644,13 @@ integers from 1 through 255. These fields accompany a known restore failure code
only. They omit error messages, raw command lines, paths, process output, and arbitrary
cause data. Git error wrappers preserve only these safe codes and numbers for
diagnostics, without adding the original error as a cause.
+Native sandbox `environmentSyncOut` failures carry the same allowlisted codes
+and bounded HTTP/exit statuses across the plugin worker RPC boundary. The host
+revalidates that optional envelope and retains it only for restore diagnostics.
+The envelope excludes provider messages, response bodies, names, paths, and
+credentials. The existing RPC error message and code remain unchanged, as do
+restore classification, retries, and source retention. Older workers without the
+envelope still report `unknown` when no structured cause is available.
For `git_integration`, optional `workspaceRestoreGitCommand` identifies the fixed
command family: `rev_parse`, `symbolic_ref`, `merge_base`, `merge_tree`,
`commit_tree`, `update_ref`, or `log`. `workspaceRestoreGitFailureKind` is
diff --git a/doc/openai-dot-runner.md b/doc/openai-dot-runner.md
new file mode 100644
index 00000000000..358dd0de041
--- /dev/null
+++ b/doc/openai-dot-runner.md
@@ -0,0 +1,389 @@
+# OpenAI Dot with Paperclip Runner
+
+OpenAI Dot is an experimental provider of `paperclip_runner`. A dedicated
+agent OAuth connection and MCP Events wake an existing Dot. The Rust Runner
+owns the assignment lifecycle and durable tool receipts. Dot uses Paperclip's
+existing agent permissions and task tools, including document writes and
+completion feedback.
+
+This first version supports a self-hosted instance with a local Runner
+controller and a stable public HTTPS origin. Hosted agent-broker and remote
+controller deployments are not qualified. The feature is off by default.
+
+## Enable and pair
+
+1. Configure `PAPERCLIP_PUBLIC_URL` to the instance's stable HTTPS origin and
+ enable **Assistant connections (MCP)** and **OpenAI Dot**
+ in **Instance settings → Experimental**. The instance must use authenticated
+ sign-in. These settings are saved and take effect without a restart; the old
+ `PAPERCLIP_ENABLE_OPENAI_DOT` environment flag no longer enables the provider.
+2. In **Add agent**, choose the standalone **OpenAI Dot** option.
+ Acknowledge that its provider billing is external and unmetered, then save it.
+ Approve the agent if company policy requires it. Dot uses the shared Runner
+ internally; its own experimental toggle does not require enabling the general
+ **Paperclip Runner** option and does not enable other Runner providers.
+3. In the agent configuration, choose **Pair Dot**, then **Set up with Dot**.
+ The shared setup-prompt component copies the MCP URL, one-use pairing code,
+ expiry, and event instructions. Paste the prompt into your Dot so it can add
+ or reuse the private plugin and finish OAuth in its own browser. Dot enters
+ the one-use code on the Paperclip connection page and chooses
+ **Connect Dot with pairing code**. Entering a valid code first shows the
+ exact company, agent, permissions, and ongoing revocable access duration;
+ previewing consumes no code and creates no grant. No operator sign-in in Dot’s browser is
+ needed. The personal `/mcp/paperclip` connection
+ cannot execute as Dot.
+4. The OAuth code approval pairs Dot atomically. Attach the connected plugin
+ to the Dot conversation if ChatGPT has not exposed its action tools. Dot calls
+ `paperclip_dot_inbox` to verify access, then subscribes to
+ `paperclip.dot.mailbox_updated` with the setup company and inbox binding IDs.
+ Its callback must pass the signed webhook verification. The prompt stays
+ only in page memory and disappears when its code expires; if you leave the
+ page or the code expires, revoke the pending connection and pair again.
+5. Choose **Test event delivery**. Dot drains `paperclip_dot_inbox` and confirms
+ the readiness challenge. Readiness requires this round trip, not just an
+ HTTP acknowledgement from the callback.
+6. Assign a task to the agent. Normal scheduling, checkout, company access,
+ budgets and approval rules still determine admission.
+
+Only the operator's one-use pairing code is displayed. OAuth tokens and callback
+signing secrets stay on the server and never enter the Runner descriptor,
+task prompt or saved adapter config. Pairing codes expire after 15 minutes.
+
+The dedicated connection uses the merged MCP gateway's PKCE browser and device
+flows, including verified client metadata documents and organization hints.
+Its issuer is `/mcp/runner/oauth`; the personal issuer remains ``.
+The shared consent page identifies Dot agent access. A code issued by an
+operator preapproves only its selected company and agent; redemption rechecks
+current operator membership, agent availability, all experimental prerequisites,
+expiry, revocation, and the authorization request’s organization hint. Redemption
+consumes the code and attaches the grant atomically; it creates no board session.
+Manual browser and device consent still require an operator role. Device codes and browser requests stay bound to their original resource
+and organization. The gateway's Connections invitations remain personal
+assistant invitations; use the agent's Dot connection panel for Runner pairing.
+
+Database migration `0317_messy_famine.sql` adds only Dot tables and extensions
+after the merged gateway migrations. It is safe to reapply. The earlier
+prototype migration number is retired; published master migrations are intact.
+
+Company package imports use the same independent Dot option. An unpaired imported
+Dot can be saved after the external billing acknowledgement; pair it before
+assigning work. The dev launcher also prepares the shared Runner binary when
+Dot is enabled, even when the general Runner option is off.
+
+## Troubleshoot plugin OAuth discovery
+
+Use the exact server URL `/mcp/runner` with OAuth authentication. The
+resource metadata lives at `/.well-known/oauth-protected-resource/mcp/runner`;
+its authorization server is `/mcp/runner/oauth`, with discovery at
+`/.well-known/oauth-authorization-server/mcp/runner/oauth`. Both metadata URLs
+must return JSON without a login or redirect. An unauthenticated MCP request
+returns `401` with a `WWW-Authenticate` header pointing to the resource metadata.
+The server advertises both CIMD and Dynamic Client Registration; use CIMD when
+ChatGPT discovers it. A manually entered client secret is not required.
+ChatGPT’s CIMD prefers `private_key_jwt` but explicitly lists `none` among its
+supported methods. Paperclip selects the public PKCE method it advertises and
+rejects clients whose published capabilities do not include that method.
+
+The browser authorization page must also be reachable from Dot’s computer.
+Discovery and browser reachability are separate checks: a temporary tunnel may
+work for ChatGPT’s MCP service while Dot’s browser blocks its hostname. If the
+same instance already has another trusted public HTTPS browser ingress, set
+`PAPERCLIP_MCP_AUTHORIZATION_ORIGIN` to that origin and allow its hostname in the
+instance configuration. The advertised authorization endpoint, consent pages,
+and device verification pages use that origin. The MCP resource, issuer, token
+endpoint and PKCE validation remain on `PAPERCLIP_PUBLIC_URL`. Consent mutations
+accept only these explicitly configured origins; this does not allow arbitrary
+return destinations or expose another instance.
+
+If ChatGPT times out, compare its retry with the server access log. No incoming
+MCP or discovery request means that attempt did not reach Paperclip; entering
+OAuth URLs manually does not repair that connection. Verify public reachability
+from outside the tailnet: MagicDNS on the host can route a Tailscale URL directly
+to the private tailnet address even when the same URL uses Funnel externally.
+Check the public ingress separately before concluding that public access works.
+The plugin builder's timeout alone does not establish a blocked port or a
+missing discovery document. See [OpenAI's authentication guidance](https://developers.openai.com/plugins/build/auth).
+
+## Assignment protocol
+
+Events contain mailbox references. Dot drains the inbox after its saved cursor,
+reads the assignment, and explicitly accepts it before executing tools. A
+webhook `2xx` does not mean Dot accepted or started the task. Duplicate or
+out-of-order events must not create another assignment.
+
+Dot invokes catalogued tools through `paperclip_dot_tool`. Every operation uses
+a UUID request ID. A pending response is reconciled with
+`paperclip_dot_operation_status` or retried with **the same ID and arguments**.
+Changing arguments under the same ID is rejected. An unknown write must never
+be retried under a new ID. Idle intake returns its assignment when available.
+If admission is still pending, retry `paperclip_dot_request_turn` with the same
+ID and exact prompt to inspect the same intake; no second task or human nudge
+is required. Events also notify work queued behind another active assignment.
+
+Dot calls `paperclip_finish` or `paperclip_block` through the tool bridge, then
+ends the external turn with `paperclip_dot_finish` using exactly the accepted
+structured report. Paperclip's ordinary result and status finalizers decide
+the task disposition. Dot can also discover its assigned tasks and request
+normal admission with `paperclip_dot_tasks` and `paperclip_dot_request_work`.
+
+The completion tool returns its canonical accepted report. The final turn can
+repeat either that canonical report or the exact original accepted arguments;
+the Runner persists and emits the canonical report. Changed reports are rejected.
+Work requests use a durable admission receipt keyed by binding, generation and
+request ID. Retries read that receipt, even after a task finishes, and cannot
+enqueue another run or move the same request to another task. A Dot runs one
+assignment at a time; competing tasks stay queued regardless of the agent's
+configured concurrency. During setup the connection panel continues checking
+for a verified event subscription without requiring a manual refresh.
+Mailbox writers and cursor reads serialize through the binding row so a cursor
+cannot skip a tool result whose transaction commits later. A paused Dot can
+receive fence notices and acknowledge them, but cannot read tasks or execute
+tools; those narrow inbox reads leave its task cursor unchanged.
+
+## Limits and recovery
+
+- One active assignment per binding. Acceptance expires after 10 minutes;
+ execution authority starts with a two-hour lease. Accepted, still-authorized assignments can renew with `paperclip_dot_renew` for up to two hours ahead, within a 24-hour total bound. Fifteen minutes without useful
+ activity is shown in the connection panel as requiring attention.
+- No mounted workspace, selectable model, native Dot thread identifier,
+ provider usage or provider cost. Text deliverables use Paperclip documents.
+ Assigned skills are read from verified pinned bundles; app tools use the assigned MCP gateway. The optional workspace bridge provides files, sandboxed commands, and verified downloadable artifacts without mounting files into OpenAI. Workspace calls serialize within the local controller, including hash checks and writes, so overlapping edits cannot both commit against the same observed hash. Definite file/skill read failures return bounded error receipts rather than leaving tool calls pending. Commands require Linux bubblewrap with a private PID namespace; there is no unrestricted fallback. macOS file tools remain available, but commands are disabled because sandbox-exec cannot contain detached descendants. Networking and injected credentials are excluded from commands; use assigned app tools for services.
+- Cancel, pause, reassignment and revocation fence Paperclip authority. They do
+ not confirm that Dot stopped all external activity. A fence acknowledgement
+ records receipt only.
+- Controller recovery restores the same bridge and assignment. A missing or
+ invalid advertised checkpoint requires reconciliation. Automatic bounded
+ retries do not create replacement Dot assignments. A tool effect still in
+ flight when its controller detaches stays pending if its exact outcome was
+ not durably recorded; recovery does not execute that write again.
+- Keep the public origin stable. Subscriptions expire and must be renewed;
+ reconnection drains current mailbox references rather than claiming event
+replay. Disabling new Dot work does not grant old assignments new authority.
+
+Resubscribing verifies the Dot callback again and publishes a fresh mailbox
+reference for its existing outstanding assignment. It does not create another
+assignment or replay tool effects. OAuth revocation and refresh-token replay
+also revoke the matching binding, fence its assignments, and cancel waiting
+Paperclip runs. Revoking an old grant cannot revoke a replacement binding.
+Reopening an agent form restores the binding reference from the server so a
+previously completed pairing remains visible. Completing pairing also saves the exact binding reference and a configuration revision atomically; revocation clears only that matching reference. A separate form save is unnecessary.
+
+## Verification evidence
+
+`server/src/__tests__/dot-runner.test.ts` uses an isolated PostgreSQL database,
+real Rust Runner, dedicated PKCE OAuth, a signed synthetic callback, normal
+semantic authority, a document write and the ordinary status finalizer. It
+checks duplicate writes, changed-argument rejection, membership loss and
+revocation. Runner tests cover bridge reattachment, missing checkpoints,
+closed launch fields, expiry and late effect receipts after fencing.
+
+The earlier real-Dot account experiment proved OAuth and signed wake/report
+transport through the reference harness; see `dot-runner-prototype.md`. That
+proof does not qualify this new dedicated endpoint against a real account.
+The dedicated adapter was subsequently qualified against a real Dot account
+on 2026-10-07, as recorded below.
+On 2026-10-06, a hands-on browser test used a fresh authenticated instance with
+synthetic account, company, and agent data through its public HTTPS origin.
+It verified the experimental prerequisites, saved toggle behavior, Dot harness,
+dedicated MCP URL, one-use pairing instructions, and revocation. The instance
+was created with `worktree init --empty`, so it copied no private instance data
+or signing keys. At that point, real Dot pairing, event delivery, and task
+completion had not yet been qualified.
+
+On 2026-10-07, the real Dot account completed the dedicated endpoint acceptance
+in that empty synthetic test-drive. Dot created the private ChatGPT plugin and
+reviewed the exact agent grant. The human approved the connection in Codex;
+Codex submitted that actual consent through the existing plugin Connect flow.
+Dot could not verify an agent relay of human approval, so this did not rely on
+impersonating the human or overriding Dot's policy. Codex attached the connected
+app to the Dot conversation when its tools were not initially exposed. No
+human operated Dot's computer. Dot verified its inbox and enabled its signed
+MCP Events subscription. A Paperclip readiness challenge woke Dot without a
+manual chat message and was confirmed successfully.
+
+The first task exposed a missing Dot descriptor in ordinary heartbeat admission.
+Admission now inspects the dedicated bridge's actual capabilities without
+starting a broker or provider process; it does not route Dot through the
+Codex-compatible JSON-RPC facade. A normal UI retry then completed **DOT-1**:
+mailbox item 2 woke Dot, which accepted the assignment, used the projected tool
+catalog to write and read back `dot-runner-acceptance`, and submitted accepted
+structured completion. The document contains the exact synthetic nonce and
+has one revision authored by the Dot agent. The ordinary native finalizer
+committed **Done**, with a succeeded run, exit code 0, no remaining work, and
+no verification caveats. Provider usage and cost remained null.
+
+The expanded catalog was also exercised by the real Dot. It created a task
+assigned to the verified human owner, read a pinned skill, wrote an attributed
+cross-task comment and task document, ran a sandboxed command in the earlier macOS prototype, incorporated a
+follow-up comment, renewed its lease, and registered a downloadable report.
+The report's downloaded bytes and SHA-256 matched its receipt. An initially
+missing fixture exposed a read exception that left the operation pending and
+prevented turn closure. The test operator cancelled that run; Dot acknowledged
+its fence without repeating its work.
+
+After the fix, Dot initiated a new intake with `paperclip_dot_request_turn`,
+created **hello from idle** for the human owner, observed a terminal
+`runner_bridge_file_not_found` error, and continued successfully. It wrote,
+read, executed, and registered the 20-byte `idle-runner-verified` proof. Its
+ordinary run succeeded with exit code 0 and the finalizer committed **Done**.
+The offer needed a direct inbox check because no automation wake was observed
+in that conversation. Intake now returns an available assignment and instructs
+same-request polling while admission is pending. The earlier event-only
+readiness and assignment proof remains valid; webhook delivery alone never
+establishes that the external Dot has started work.
+
+Assigned MCP gateway relay is exercised through real Rust and authenticated
+Runner authority with a synthetic gateway. No live third-party app account
+call is claimed. Inbound task file contents are available through an explicit attachment-reading grant; the server does not automatically stage or send files.
+
+Inspect these persisted synthetic acceptance records in the test-drive:
+
+- Task: `a3ecdff5-41b0-400a-8146-51317c0b864e` (DOT-1).
+- Run: `9a44feeb-2779-4217-8210-092852019511`.
+- Assignment: `fbee1530-5a20-41d0-8f8f-226ef45f8a58`.
+- Document: `3f094689-6346-4a9c-8138-7c08df5da6b1`, revision
+ `033be018-f6f6-4b6b-a10f-e892627e12e3`.
+
+After the admission fix, 34 Runner/driver tests and 13 real Rust/broker integration
+tests passed. Full workspace typecheck and build passed. The earlier full
+repository test attempt remains incomplete after unrelated failures and a
+workspace snapshot stress timeout. This live qualification covers the current
+local-controller endpoint; it does not establish a green full suite, hosted
+broker qualification, or a permanent public ingress. The temporary tunnel must
+be replaced with a stable origin for continued use.
+
+The current integration includes master through `a6306ba60`, including the
+assistant configuration and tool expansion in #15380. Dot still uses its own
+agent resource and cannot receive personal configuration permission. Full
+workspace typecheck and build, UI token gates, and 198 focused tests passed
+after this merge. The empty-worktree tests and clone-migration regression also
+passed. These checks do not replace the full repository CI and review gates.
+
+Local verification on 2026-10-03:
+
+| Check | Result |
+| --- | --- |
+| `pnpm -r typecheck`, `pnpm build`, UI token gates | Passed |
+| Rust workspace library tests | 312 passed |
+| PRP schema tests and CI shard selection tests | 13 and 24 passed |
+| Control-plane and Dot driver regression tests | 97 passed, including late callback retirement |
+| Real Rust / PostgreSQL Dot integration | 2 passed |
+| Agent configuration route tests | 36 passed, including unpaired create and conversion |
+| Stable shared package lane | 837 passed |
+| Adapter utilities and Codex adapter source tests | 1,883 passed, 12 skipped |
+| Root `pnpm test:run` attempt | Server group: 744 files passed, 2 failed, 4 skipped; 14,997 tests passed. Wrapper stopped at that failed group. |
+
+The root run's failures were a Calendar socket reset and a Git scan load
+assertion (497 of 498 expected joined requests). Both failing cases passed in
+isolation. A subsequent stable database lane passed 126 tests but failed one
+embedded PostgreSQL startup; that test also passed in isolation. These results
+do not establish a completely green repository suite or release readiness.
+
+Gateway integration on 2026-10-06 merged master through `c365a16e3`, including
+the released browser/device consent and assistant invitations (#14846 and
+#14933). Initial integration verification passed full workspace typecheck and
+build, token gates, 125 gateway/consent/admission tests, five Dot integration
+tests, 20 consent/Connections UI tests, 318 Rust library tests, 123 Runner/Dot
+recovery tests and 13 PRP schema tests.
+
+The local root `pnpm test:run` was stopped after 2 hours 47 minutes when review
+fixes made it stale; it did not complete and is not a passing result. Fresh
+PR CI verifies the final branch. The review fixes cover reconnect wakeups,
+OAuth disconnect and refresh replay, binding-reference restoration, board-only
+OpenAPI coverage and prior protocol-version assumptions. Current results and
+remaining qualification are tracked in [PR #15402](https://github.com/paperclipai/paperclip/pull/15402).
+
+After those fixes, full workspace typecheck and token gates passed again.
+Focused verification passed 89 gateway, Dot, OpenAPI, connection-instruction
+and pairing UI tests, 40 protocol/runtime compatibility tests, and the real
+Runner protocol-upgrade/replacement test.
+
+PR CI exposed a clean-shutdown race: Rust could exit after the durable shutdown
+receipt was acknowledged but before the Dot SDK's next poll. The adapter now
+recognizes that confirmed clean exit and still requires reconciliation after
+an unexpected exit. A real Rust regression reproduces the failing order and
+passes with the fix. Four driver tests and 11 integration/pairing tests passed,
+including a failed connection refresh after successful revocation. Revocation
+clears the cached binding before refetch so that failure cannot restore it.
+
+Visual review uses the production `DotRunnerConnection` component in the
+`Assistant connections/Dot Runner` Storybook stories. Pairing, event-test
+waiting and revocation were exercised in the browser with synthetic API
+responses. These screenshots show preview data, not a qualified Dot account:
+
+
+
+
+
+
+## Starting work from a Dot conversation
+
+Call `paperclip_dot_capabilities` to discover the bound agent, responsible person, permissions, prerequisites and active assignment. An idle Dot can call `paperclip_dot_request_turn` with a prompt and stable UUID. Paperclip creates one visible, agent-authored intake task and admits it through the ordinary heartbeat/Runner path. Retries reuse the task and wake receipt; the same UUID with a different prompt is rejected. Company and agent pause, grants, budgets, task assignment permissions and single-assignment ownership apply. The intake is work attributed to the Dot, not a fabricated operator message or an OAuth permission expansion.
+
+Read and accept the resulting assignment, then call its catalog through `paperclip_dot_tool`. Use `get_identity` and paginated `list_people` to identify the owner. `create_task` accepts either `assigneeActorId` for an agent or `assigneeUserId` for an active company person. `reassign_task` also accepts a person and checks the previous agent/person and status version before the ownership change. Human tasks do not wake agents.
+
+The shared catalog adds `get_task`, `comment_on_task`, `list_task_documents`, `read_task_document`, and `write_task_document` through the existing authenticated REST authority. Company boundaries, task visibility, mode restrictions, document revisions, locks and mutation receipts still apply. `call_api` remains the discovery-based route for other authorized control-plane actions.
+
+`list_assigned_skills` and `read_assigned_skill` read the turn's exact pinned skill versions, with manifest and file digest checks. Assigned app tools are projected by the existing MCP gateway; its permission checks, approvals, receipts and revocations remain authoritative. Credentials are kept on Paperclip. Newly granted app tools arrive in a continuation with a new pinned catalog.
+
+Enable **Workspace files and commands** on the agent to expose `workspace_list`, `workspace_read`, `workspace_write`, and `workspace_run`. The server binds these to the admitted execution workspace. File paths reject absolute paths, traversal and symlinks. Paperclip instance state under `.paperclip` is excluded from file tools, uploads, and sandbox commands. Linux commands mask existing instance directories and the workspace root instance directory with read-only empty mounts. The command protection scan fails closed above 4,096 directories. macOS supports file tools and publishing; `workspace_run` is neither advertised nor executable there because its file sandbox cannot contain detached descendants. New writes require an absent file; overwrites require its observed SHA-256. Commands have bounded output/time and an OS sandbox, use a workspace-local home, and do not inherit credentials. Linux commands run in a private PID namespace. Command completion, timeout, or live authority loss terminates its supervisor and all descendants, including children that start a new session. Register requested files with `register_deliverable` before finishing. Workspace mutation attempts are reserved durably before effects; an interrupted attempt returns an unknown outcome instead of replaying a possible effect. Inspect state before deciding another mutation.
+
+Mailbox `follow_up` entries reference new comments on an accepted assignment. Read `get_task_history` and incorporate them at a safe boundary. This supplies new input without claiming OpenAI steering support. `paperclip_dot_tasks` pages by the last task ID. Each assignment allows up to 4,000 broker operations; lower domain-specific limits still apply. A fenced assignment's control acknowledgement remains available at that limit. `hire_agent` creates a distinct unpaired Paperclip Dot teammate; the operator still pairs a separate OpenAI Dot. No existing binding or workspace permission is inherited.
+
+
+## Tool inventory
+
+The top-level MCP catalog contains these 15 transport and lifecycle tools:
+`paperclip_dot_capabilities`, `paperclip_dot_request_turn`, `paperclip_dot_tasks`,
+`paperclip_dot_request_work`, `paperclip_dot_pair`, `paperclip_dot_inbox`,
+`paperclip_dot_read`, `paperclip_dot_accept`, `paperclip_dot_tool`,
+`paperclip_dot_progress`, `paperclip_dot_finish`, `paperclip_dot_operation_status`,
+`paperclip_dot_confirm_event`, `paperclip_dot_renew`, `paperclip_dot_control_ack`.
+
+After accepting work, use `paperclip_dot_tool` with a name from the assignment's
+actual catalog. Availability depends on work mode, permissions, assigned apps,
+and workspace/attachment bindings. Advertising a tool does not bypass its
+server-side authorization.
+
+| Area | Runner tools |
+| --- | --- |
+| Identity and people | `get_identity`, `list_people`, `list_agents`, `get_agent` |
+| Task work | `get_task_context`, `get_task_history`, `search_tasks`, `get_task`, `report_progress`, `set_task_title`, `set_task_monitor`, `create_task`, `reassign_task`, `set_dependencies`, `comment_on_task` |
+| Human input and approvals | `request_human_input`, `list_approvals`, `get_approval`, `get_approval_context` |
+| Documents | `list_documents`, `read_document`, `list_document_revisions`, `write_document`, `list_task_documents`, `read_task_document`, `write_task_document` |
+| Agent instructions | `read_agent_instructions`, `update_agent_instructions`, `get_agent_instruction_history`, `restore_agent_instructions` |
+| Skills | `create_skill`, `update_skill`, `list_assigned_skills`, `read_assigned_skill` |
+| Projects | `create_project`, `list_projects`, `list_project_repositories` |
+| Apps and control-plane APIs | `connections_search`, `connection_request`, `search_api`, `call_api`, `hire_agent`; assigned gateway tools are discovered from the actual catalog, or via `paperclip_search_assigned_tools` / `paperclip_call_assigned_tool` for large catalogs |
+| Workspace and output | `workspace_list`, `workspace_read`, `workspace_write`, `workspace_run`, `register_deliverable` |
+| Task attachments | `list_task_attachments`, `read_task_attachment` when **Read task attachments** is enabled |
+| Bound chat inputs | `list_chat_attachments`, `reuse_chat_attachment`; `read_chat_attachment` and `read_current_wake_comments` require verified server bindings |
+| Feedback | `submit_complaint`, `submit_suggestion` |
+| Completion | `paperclip_finish`, `paperclip_block`; a separate review run offers its limited read catalog and `resolve_review` |
+
+Enable **Read task attachments** on the Dot agent to expose `list_task_attachments`
+and `read_task_attachment` on new assignments. This setting is off by default,
+requires operator consent, and sends file contents to OpenAI. It is independent
+of **Workspace files and commands** and is never inherited by a hired teammate.
+Reads are restricted to the current run's assigned task and company, recheck
+live run/binding/setting authority before returning, verify byte size and
+SHA-256, and return at most 12,000 bytes per page from files up to 16 MiB.
+Each run keeps a verified in-memory copy bounded to 16 MiB and 20 files;
+subsequent pages reuse those bytes and recheck file metadata and live access.
+Closing the run clears the cache. Agent configuration routes reject attempts
+to change the operator-owned attachment, workspace, and pairing flags.
+Text pages preserve UTF-8 boundaries; binary files use base64. Pass the returned
+SHA-256 on subsequent pages to detect changes. Missing, oversized or corrupt
+files return terminal errors. Read audit entries contain metadata, never file
+contents. Revocation blocks further reads, but cannot withdraw bytes already
+sent to OpenAI. Files and filenames remain untrusted input. There is no public
+attachment URL or Paperclip credential exposed to Dot. Generic `call_api`
+attachment and workspace downloads cannot bypass these settings; use the scoped
+read tools. Raw asset reads and uploads are limited to API captures and output
+artifacts from the current run. API uploads from workspace paths require the
+workspace grant and the same confined root as workspace tools.
+
+A plugin upgraded during a running Dot conversation can retain an old top-level
+tool catalog. Refresh its tools in ChatGPT plugin settings and reattach it.
+Inspect the real exposed actions before claiming new idle or lease actions
+are available. The assignment catalog is read on each new assignment.
diff --git a/doc/plans/2026-10-02-openai-dot-runner-adapter.md b/doc/plans/2026-10-02-openai-dot-runner-adapter.md
new file mode 100644
index 00000000000..61fb2c43a5b
--- /dev/null
+++ b/doc/plans/2026-10-02-openai-dot-runner-adapter.md
@@ -0,0 +1,988 @@
+# OpenAI Dot as a production Paperclip Runner provider
+
+Date: 2026-10-02
+
+Status: Experimental self-hosted adapter and full Runner extension implemented; real-account qualification and remaining limits are recorded in the dated checkpoints below
+
+Branch: `codex/dot-events-prototype`
+
+Scope: Original production design with the implementation status recorded below. The adapter remains off by default.
+
+## Implementation status
+
+Implemented the dedicated agent OAuth resource, one-use pairing and readiness
+challenge, scoped durable mailbox and operation receipts, PRP v3 external
+operations, native input v6 without a workspace or credentials, Rust Dot
+executor, normal task tool/completion authority, provider configuration and
+connection UI. Tests exercise the real Rust Runner and ordinary task status
+finalizer, plus bridge reattachment and missing-checkpoint refusal.
+
+The current supported deployment is self-hosted with a local controller and
+stable public HTTPS. The October 7 real-account checkpoint qualifies the dedicated `/mcp/runner`
+path. The earlier account proof covered only the reference harness transport. The complete fault matrix and hosted agent-broker
+qualification below remain future qualification work.
+
+The original adapter rejected assigned skills and third-party MCP bindings.
+The user subsequently authorized their governed Runner integration. The full
+extension now reads pinned skill files and relays assigned gateway tools.
+Workspace files and sandboxed commands require an explicit per-agent opt-in.
+Automatic inbound attachment staging remains disabled pending separate scope
+approval. See [the adapter runbook](../openai-dot-runner.md).
+
+## 1. Recommendation
+
+Add **OpenAI Dot** as a provider of the existing `paperclip_runner` adapter:
+
+```json
+{
+ "adapterType": "paperclip_runner",
+ "adapterConfig": {
+ "provider": "openai_dot",
+ "dotBindingId": "",
+ "lifecycleMode": "per_turn"
+ }
+}
+```
+
+The provider uses MCP Events to notify an existing Dot and authenticated MCP
+tools to receive its actions. Rust `runnerd` owns the provider state machine and
+PRP lifecycle. Paperclip owns connection authorization, durable mailboxes,
+admission, tool effects, budgets, approvals, and final task disposition.
+
+The implementation is a new Runner provider, not a new legacy `execute()`
+adapter. Keep `paperclip_runner` in the server/UI/CLI registries. The older
+`create-agent-adapter` skill remains useful for configuration, diagnostics and
+cross-surface consistency; its process-spawning package recipe does not define
+this provider's execution architecture.
+
+The branch now integrates the merged public MCP foundation (`e34abee67`,
+#14846) and scoped browser/device assistant invitations (`22a3ea341`, #14933)
+from master. The preliminary foundation at `a88448f77` is superseded.
+This does not imply that the companion Cloud broker is deployed or qualified.
+
+### Gateway reconciliation — 2026-10-06
+
+The canonical worktree remains `dot-events-prototype/paperclip` on
+`codex/dot-events-prototype`. Master was merged through `c365a16e3`.
+The shared consent implementation now creates distinct agent-purpose grants
+for both browser and device flows, validates request resource and organization
+ownership, and rejects viewer approval. Dot has a separate issuer and scope.
+Verified client metadata, durable verification quotas, event secret rotation,
+subscription refresh races and warm-standby gates use the merged implementation.
+Personal and Dot event workers consume their own subscription resources.
+
+The generated Dot-only migration is now `0317_messy_famine.sql`, after the
+published master migrations. Its table, column, index and constraint additions
+are safe to reapply. Both consent UIs retain the merged organization branding
+and request layout while explaining agent access. Runner provider selection
+uses the current shared harness selector.
+
+Targeted gateway, Dot, onboarding and UI verification passed 125 tests before
+the added migration replay check. Full workspace typecheck/build and token
+gates passed. Runner recovery verification passed 123 tests and the Rust
+workspace passed 318 library tests. The local full repository attempt was
+stopped after 2 hours 47 minutes when review fixes made it stale. Final branch
+CI and review are tracked in [PR #15402](https://github.com/paperclipai/paperclip/pull/15402);
+the adapter runbook records verification limits.
+
+The other gateway chat's subsequent assistant-tool expansion is still separate
+work and is not part of this integration. Real-account qualification of the
+dedicated Runner endpoint remains outstanding. Assigned skill files and
+third-party MCP bindings remain unsupported.
+
+### Evidence and limits
+
+The real-Dot test on October 2 demonstrated:
+
+1. Private custom-plugin installation and ordinary OAuth connection.
+2. Dot successfully calling `paperclip_connection`.
+3. A verified MCP Events subscription and signed webhook delivery.
+4. Dot fetching and accepting an assignment without a second chat prompt.
+5. Dot invoking a projected tool and saving exactly one test report.
+6. A valid structured result, native `turn.completed`, and `run.terminal` with
+ state `succeeded`.
+7. Server-confirmed unsubscription.
+
+The native test used TypeScript `HarnessDriverBackend`, synthetic admission,
+an in-memory driver registry and one synthetic tool. It did not exercise Rust
+runnerd, normal task checkout/finalization, restart recovery, usage accounting,
+or workspace execution. Those are implementation requirements below.
+
+The test also exposed two onboarding details: action tools may become available
+after their directory listing appears, and restarting a disposable lab destroys
+OAuth state. A stable deployment and a real readiness check are essential.
+
+## 2. Product contract
+
+### Paperclip initiates work
+
+A user selects **Paperclip Runner → OpenAI Dot**, connects their Dot, and assigns
+it an ordinary task. Existing scheduling admits the task. Paperclip sends a
+small event; Dot retrieves the current assignment, explicitly accepts it, uses
+the projected tools, and submits its result. The task thread shows delivery,
+acceptance, progress, outputs, and completion separately.
+
+Paperclip can enqueue work whenever its ordinary rules allow. Delivery and
+execution are asynchronous. A webhook acknowledgement is never presented as
+proof that Dot started work.
+
+### Dot initiates interaction
+
+Preserve both directions and make the acting identity explicit:
+
+| Context | Authority | Supported behavior |
+| --- | --- | --- |
+| User asks their Dot to use Paperclip | Existing personal MCP connection | Read company work, create/delegate tasks, add feedback, retrieve results; actor is the consenting person. |
+| Dot executes an assigned Runner turn | Dedicated agent connection plus admitted assignment | Invoke the same authorized semantic tools as another Runner provider; actor is the assigned agent and run. |
+| Dot wants to start work while idle as the agent | Dedicated connection's `request_work` operation | Submit a bounded wake request referencing an authorized task and intent. Normal scheduling decides whether to admit a run before exposing its mutation tools. |
+
+Idle `request_work` must support a company-scoped planning/intake task for
+agent-initiated ideas, so proactive work does not depend on an already assigned
+engineering task. The intake task is an ordinary governed work object, created
+through existing task rules; it is not the event mailbox or an execution bypass.
+Actual task creation, delegation and writes then use the admitted tool catalog.
+
+Do not silently give an agent the consenting person's authority. A personal
+connection remains optional and independent. If the same Dot also has personal
+Paperclip access or other plugins, Paperclip cannot prevent it from acting
+through those separately authorized channels. Users needing strict separation
+must use a Dot/account without those broader connections.
+
+### First release boundaries
+
+- One active assignment per binding. Additional tasks remain in normal queues;
+ do not admit a large backlog into provider sessions waiting for acceptance.
+- One active agent binding per dedicated OAuth grant. Multi-agent multiplexing
+ through one Dot connection is deferred.
+- Standard, planning and ask tasks use normal Paperclip tool policy. Only
+ capabilities actually exposed to this provider are offered.
+- Start with control-plane work: research coordination, task decomposition,
+ documents, comments, approvals and assigned connector tools. A Dot is not
+ presumed to share the Paperclip repository or local filesystem.
+- Follow-up messages are durable task messages and subsequent assignments.
+ Active steering is unavailable in v1. The UI must say when a message is queued.
+- Model selection, token usage, provider-native session reset, private reasoning,
+ global interruption, and control of Dot's other tools are unavailable.
+- Public reachability is required. No Chrome automation, ChatGPT cookies,
+ undocumented task endpoints, or expiring development tunnels in production.
+
+## 3. Architecture and ownership
+
+```mermaid
+sequenceDiagram
+ participant App as Paperclip scheduler/controller
+ participant Runner as Rust runnerd: Dot provider
+ participant Broker as Durable Dot mailbox + public MCP
+ participant Dot as OpenAI Dot
+ App->>Runner: Authenticated PRP prepare/open/start
+ Runner->>App: Durable external dispatch request
+ App->>Broker: Commit assignment + wakeup item
+ Broker->>Dot: Signed MCP Event with references
+ Dot->>Broker: Read and accept assignment
+ Broker->>App: Durable bound operation
+ App->>Runner: PRP external operation
+ Runner-->>App: turn.started
+ Dot->>Broker: Call projected tool
+ Broker->>App: Durable bound operation
+ App->>Runner: PRP external operation
+ Runner->>App: Normal semantic tool request
+ App->>App: Existing authorization + domain effect + receipt
+ App-->>Runner: Normal semantic_tool.result
+ Runner-->>App: External operation result
+ App-->>Broker: Persist receipt
+ Broker-->>Dot: Tool result
+ Dot->>Broker: Propose structured completion
+ Broker->>App: Durable bound operation
+ App->>Runner: PRP external operation
+ Runner-->>App: Validated result + terminal events
+ App->>App: Existing completion feedback and finalizer
+```
+
+The apparent round trip through the controller is intentional: MCP is the
+provider's transport, while Runner remains the execution lifecycle. Avoid a
+second tool dispatcher or finalizer hidden in the MCP route.
+
+### Component responsibilities
+
+| Component | Owns | Must not own |
+| --- | --- | --- |
+| Public MCP/OAuth | Authenticate each call, resource/scope checks, bounded input, callback verification | Creating an admitted run from supplied IDs; arbitrary agent impersonation |
+| Dot broker in server | Pairing, bindings, mailbox, delivery state, request deduplication, routing to the current controller | Domain effects or provider terminal decisions |
+| Rust Dot provider | Turn acceptance, provider command ordering, projected-call mapping, durable provider receipts, PRP events and checkpoints | DB access, company policy, OAuth secrets, issue status writes |
+| Existing native controller | Admission, PRP ownership/leases, semantic dispatch, governed waits and finalization | Pretending a webhook receipt proves execution |
+| Dot | Retrieve work, perform reasoning, invoke exposed tools, propose result | Selecting its company/agent/run authority or bypassing finalization |
+
+Runner receives no ChatGPT credential, MCP OAuth token, webhook URL/signing key,
+or unrestricted Paperclip API key. Reuse the authenticated PRP connection for
+the app-owned broker port. Do not add a second generic HTTP control API solely
+to get operations into runnerd.
+
+The Runner package remains standalone: define the broker port and envelopes in
+the package; implement them in Paperclip server without importing server or DB
+code into `packages/paperclip-runner`.
+
+## 4. Production Runner integration
+
+### Provider identity and configuration
+
+Proposed identifiers:
+
+- Provider: `openai_dot`.
+- Driver: `openai_dot_mcp`.
+- Execution kind: `remote_service`; the local runnerd process is only the
+ controller-side transport, not the Dot's execution process.
+- Service: `openai_dot`.
+- Provider session ID: `null` unless a documented provider identity becomes
+ available. A user-entered Dot URL is a display link, not authentication.
+- Model: `null`, displayed as **Managed by Dot**.
+- Provider version: our qualified bridge/protocol revision, clearly labelled;
+ do not claim it pins OpenAI's hosted implementation.
+
+Agent config contains only binding references and validated operational limits.
+The server resolves the binding into an immutable per-run snapshot containing
+company, agent, connection, binding generation, catalog revision, deadlines and
+protocol revision. Tasks cannot override that identity or supply callback URLs.
+
+### Contract changes
+
+The current native input is a closed `paperclip.native-execution-input.v5`
+contract. Introduce the next input revision with a Dot provider variant; retain
+v1–v5 parsing and recovery for existing providers. Update JSON Schema,
+TypeScript and Rust together, plus export/compatibility manifests and fixtures.
+Do not repurpose a Codex or ACPX profile.
+
+The new input must also distinguish provider workspace access from the Runner's
+own state directory. Dot's workspace-access variant is `none`; it receives no
+provider cwd. Adapt the execution-input builder and filesystem preparation
+guards accordingly instead of satisfying existing mandatory cwd fields with a
+made-up project path. A project/task may still exist in Paperclip without its
+checkout being mounted into this provider.
+
+Add a small, versioned external-provider transport extension over PRP. Proposed
+logical messages, with final names fixed in the contract PR:
+
+| Direction | Message | Meaning |
+| --- | --- | --- |
+| Runner → controller | `external_provider.dispatch_requested` | Persist a particular assignment/mailbox revision and notify its bound connection. |
+| Controller → Runner | `external_provider.operation` | Deliver a validated accept/tool/progress/finish/control-ack operation with its stable request identity. |
+| Runner → controller | `external_provider.operation_settled` | Persist the exact accepted/rejected/pending/unknown/result receipt for that operation. |
+
+These are closed provider-neutral transport envelopes, not raw OpenAI messages.
+Bind every envelope to company, agent, run, session, turn, binding generation,
+assignment revision and request digest. Negotiate the new command/event schema
+revision and capability explicitly; older binaries reject it before execution.
+The existing v2 enums cannot be expanded invisibly in persisted old contracts.
+
+Reads of assignment/receipt projections may come directly from the authorized
+broker database. Mutating lifecycle operations enter the live Runner. Normal
+`semantic_tool` dispatch, `paperclip_finish`/`paperclip_block` validation,
+completion feedback and PRP finalization remain authoritative.
+
+Command acknowledgement means the external operation was durably admitted to
+the Runner, not that its tool effect finished. A tool operation must release
+the command-processing lane while waiting for `semantic_tool.result`; otherwise
+the result command would deadlock behind the operation waiting for that result.
+Settlement is a separate correlated event, preserved across reconnects.
+
+### Rust and TypeScript surfaces
+
+- Add `dot_provider_backend.rs` and bounded Dot provider checkpoint/state code
+ in `runner/crates/runner-core/src/`.
+- Extend `NativeProviderCommandExecutor` selection and recovery. Detect a Dot
+ checkpoint alongside the existing Codex/ACPX/managed state; conflicting
+ provider checkpoint authorities must fail closed.
+- Reuse `ProviderToolBridge` for catalog validation, semantic call identities,
+ bounded pending/results and retained receipts.
+- Add the production Dot branch to the native backend factory and the runnerd
+ transport facade. Existing names such as `createRunnerdCodexTransport` carry
+ several providers today; extend the real provider switch rather than routing
+ Dot through a standalone TypeScript fallback.
+- Evolve `DotHarnessDriver` into the TypeScript reference/conformance
+ implementation of the same durable contract. The current memory-only lab
+ remains explicitly a lab until replaced by that implementation.
+- Teach native execution preparation and projection about **waiting for Dot**.
+ Audit the Codex defaults in `prepare-native-run.ts` so persisted profile,
+ driver identity and initial phase match the admitted Dot provider.
+- Run the lightweight Dot provider controller on the trusted execution host in
+ v1. Do not provision a code sandbox just to wait for a remote Dot. Remote
+ runner placement is a separate qualified deployment profile.
+
+### Capabilities reported to Paperclip
+
+| Capability | v1 behavior |
+| --- | --- |
+| Typed events / structured result | Supported for bridge-observed actions and validated results. |
+| Dynamic tools | Supported through current run-owned projection and normal dispatch. |
+| Read / reconciliation | Supported for durable mailbox, operation and Runner state. |
+| Native provider session resume | Unsupported; no documented Dot thread/session API. |
+| Bridge recovery after restart | Required; recover the same assignment and receipts, not a new Dot conversation. |
+| Steering / immediate interruption | Unsupported. |
+| Queued follow-up | App queue supported; do not advertise provider-native steering/follow-up guarantees. |
+| Usage / cost / model controls | Unknown or unavailable; never zero-filled or inferred from elapsed time. |
+| Native skills/MCP injection | Unsupported; expose assigned knowledge/tools through authenticated reads and projection. |
+| Native runtime permission/input control | Unsupported; use Paperclip's durable task interactions and response wakes. |
+| Goals / child-thread lineage | Unsupported. |
+
+The capability model must distinguish recovering our bridge from resuming an
+OpenAI session. Add an explicit recovery/stop description if the current booleans
+cannot express this, rather than setting `resume` or `interruption` to true.
+
+## 5. Authorization and pairing
+
+### Dedicated agent OAuth resource
+
+Add a dedicated agent resource, proposed `/mcp/runner`, sharing the existing
+OAuth/DCR/PKCE implementation and event transport. Its grant has a distinct
+purpose and `paperclip:agent` scope, optionally with `offline_access`. It never
+implicitly grants personal `paperclip:write` authority.
+
+The existing `/mcp/paperclip` resource and its personal consent semantics stay
+intact. Make the principal a discriminated personal/delegated-agent type; do not
+manufacture a board actor in an agent call. Recheck the grant's consenting user,
+membership, company availability and explicit agent delegation on every call.
+Update discovery and token audience checks for each exact resource.
+
+Pairing sequence:
+
+1. An authorized operator selects an existing/new Dot agent and starts setup.
+ Apply the normal hiring/configuration approval rules.
+2. Paperclip creates an expiring one-use pairing intent bound to company,
+ agent, initiating operator, requested delegation and protocol revision.
+3. The user installs/connects the dedicated Dot runner plugin using OAuth and
+ explicit agent consent. No agent API key is pasted into a prompt.
+4. A generated setup instruction asks Dot to complete pairing, perform a
+ read-only connection check, and subscribe to the exact binding mailbox.
+5. Pairing consumes the one-use intent and binds the grant. Callback verification
+ associates the subscription with that binding generation.
+6. A harmless challenge travels through the same event → MCP → Runner path.
+ Ready means the challenge completed, not merely that tools were listed.
+
+Store only a hash of the pairing code, bound to the initiating user and company.
+Reject expired/replayed codes, cross-company grants, duplicate active bindings,
+and any attempt by a personal grant to claim agent tools automatically.
+
+OAuth identifies an authorized client connection, not cryptographically a
+particular Dot chat. The callback identifies the subscription destination; it
+does not prove exclusive possession by one model or thread. Treat the binding
+as delegated connection authority and state that limitation in the product.
+Enforce one active assignment even if two chats use the same connection.
+
+### Per-operation authority
+
+Before accepting or replaying an operation, check:
+
+- resource, grant purpose/scopes, active membership and agent binding;
+- company, agent, assignment, run, session and turn;
+- binding generation, current assignment revision and authority deadline;
+- active controller lease/fence and task ownership;
+- agent/company pause, budget admission and applicable work-mode restrictions;
+- current projected tool permission, grants and governed approvals.
+
+Recheck at the domain mutation boundary and before returning sensitive results.
+Revoked authority must not obtain cached results simply because its request ID
+is valid. A current authorized operator can reconcile retained outcomes.
+
+Revoking/replacing a binding increments its generation and fences all old
+callbacks. Fresh consent creates a new binding generation; it never silently
+adopts active work from an older connection.
+
+## 6. Durable state and event delivery
+
+Use additive, company-scoped tables. Final naming can follow existing schema
+conventions, but these ownership boundaries are required:
+
+| Record | Key data and constraints |
+| --- | --- |
+| `dot_agent_bindings` | Company, agent, consenting user, dedicated grant, generation, readiness, protocol revision, created/revoked timestamps. Unique active agent binding and active grant binding. |
+| `dot_runner_assignments` | Immutable run/session/turn and completion-contract binding, binding generation, catalog digest, prompt/runtime-context references, status, deadlines and accepted/completed timestamps. Unique run/turn; at most one live assignment per binding. |
+| `dot_runner_operations` | Assignment, request ID, operation, canonical input digest, PRP command/call IDs, status and bounded result/reference. Unique request ID within assignment; no silent argument changes. |
+| `dot_mailbox_items` | Durable actionable item for assignment, continuation, pending tool result or control request; immutable ID, assignment revision, visibility/consumption state and stable notification identity. |
+
+Do not duplicate canonical task comments, documents, transcripts, result rows or
+finalization decisions in these tables. Store references and bounded transport
+snapshots only. Callback secrets remain in the existing encrypted event store;
+OAuth tokens remain hashed at rest. Restrict sensitive assignment/result
+retention to the same authorized data and storage policy as normal native runs.
+
+Reuse `mcp_event_subscriptions` and `mcp_event_deliveries`. Their current
+task-only subscription and activity-log scan are insufficient for a real agent
+mailbox. Add a tagged resource binding (`task` or `dot_binding`) and a typed
+mailbox notification source, with constraints so a row cannot represent both.
+Preserve current task-event authorization and behavior. Delivery uniqueness must
+cover subscription + source notification, not just an incidental task comment.
+
+No synthetic inbox issue is needed for the production transport. Activity
+logging records mutations, but an arbitrary `activityLog` row must not be able
+to manufacture a Runner assignment.
+
+### Event definition
+
+Use one production event, proposed `paperclip.dot.mailbox_updated`, filtered by
+`companyId` and `bindingId`. The prototype's task-filtered
+`paperclip.dot.work_available` stays a lab contract; migrate setup instructions
+explicitly rather than changing its schema in place.
+
+The event carries only bounded references: binding generation, mailbox item ID,
+assignment/run/turn references where applicable, item kind and mailbox revision.
+No prompts, company secrets, document bodies or authority-bearing bearer tokens.
+Dot reads current state through authenticated tools; event text grants no rights.
+
+Commit the assignment/mailbox item and notification intent atomically after
+admission. Publish only committed, currently authorized work. Reuse signed
+verification, public-IP checks/DNS pinning, no redirects, encrypted callback
+material, secret rotation, bounded retries and `410`/`413` handling.
+
+Delivery success, Dot acceptance and Runner completion are separate durable
+facts. Keep an audit-safe delivery summary attached to the assignment even if
+unsubscription removes transport rows; the lab demonstrated why that matters.
+
+### Subscription gaps and duplicates
+
+- Follow the protocol's `refreshBefore`; surface expiration/disconnection.
+- Do not promise replay while the server returns `cursor: null`.
+- On initial subscription or verified resubscription, atomically arrange a new
+ wakeup for each still-actionable mailbox item. The item/assignment ID remains
+ the same. Reconnection must neither lose old work nor create a second run.
+- Webhook retries preserve event ID. A deliberate reconnect/reminder notification
+ has its own event ID but refers to the same mailbox item.
+- Dot drains a bounded page of actionable items after a wakeup, acknowledging
+ items individually. Batched, duplicate and out-of-order events are expected.
+- Never generate another wakeup merely because Dot reported progress or posted
+ a comment. Prevent self-wake and completion-comment loops.
+
+## 7. Operation protocol and idempotency
+
+Retain the prototype's conceptual operations and add pairing/status support.
+Schemas are versioned, bounded and validated before persistence.
+
+| Operation | Behavior |
+| --- | --- |
+| Connection/pairing | Read readiness or consume a one-use pairing intent; cannot create an admitted task run. |
+| Inbox/read | Return only current bound work, prompt context, tool catalog references and completion contract. |
+| Accept | Atomically claim the current assignment once; only Runner acceptance emits `turn.started`. |
+| Tool | Map a stable external operation into a normal semantic tool call. |
+| Progress | Append bounded progress through PRP; apply ordinary useful-progress/watchdog rules. |
+| Finish | Propose the canonical structured result; run normal completion feedback and finalization. |
+| Operation status | Read a durable pending/completed/rejected/unknown receipt without redispatch. |
+| Request work | Create an idempotent ordinary wake request while idle; never self-assign by accepting arbitrary IDs. |
+| Control acknowledgement | Record cooperative acknowledgement without claiming global provider shutdown. |
+
+Use `requestId` plus assignment binding as the external operation identity. The
+server reserves it before routing to the current controller. Canonical input
+digest mismatch is an explicit conflict. Derive stable PRP command and semantic
+call IDs from that identity and preserve them across recovery.
+
+The broker receipt and existing semantic effect receipt have different jobs:
+the former tracks delivery of a provider operation; the latter proves the
+domain effect. Reuse `PaperclipRunnerToolAuthority` and its mutation receipts.
+Do not implement writes by calling the public personal MCP executor.
+
+### Lost replies and slow operations
+
+Wait only a bounded interval for an MCP response. If work is still durably
+pending, return an operation reference. A later mailbox result item wakes Dot
+when the receipt settles. A status read or retry with the same ID can also
+retrieve it. This is operation reconciliation, not polling the inbox for work.
+
+Distinguish:
+
+- **Pending:** a durable operation is still being processed; do not dispatch it
+ again merely because the HTTP request ended.
+- **Completed/rejected:** exact recorded result can be returned to a currently
+ authorized retry.
+- **Unknown:** an effect may have happened without a confirmed receipt. Block
+ redispatch, including restart recovery, until the existing domain receipt or
+ authoritative resource resolves it.
+
+No exactly-once claim for arbitrary remote writes. Use at-least-once transport
+with durable identity, existing domain idempotency and explicit uncertainty.
+Receipt exhaustion stops admission rather than evicting IDs still replayable.
+
+Finish shares the same ledger. A duplicate result cannot create another
+terminal or finalize twice. Changed completion content under the same ID is a
+conflict. A stale contract revision returns actionable feedback instead of
+marking the task done. The production path requires real criterion bindings;
+the lab's empty completion criteria are not its production contract.
+
+## 8. Lifecycle, recovery and cancellation
+
+### Assignment state
+
+```mermaid
+stateDiagram-v2
+ [*] --> Queued: normal scheduling
+ Queued --> Offered: admission + durable dispatch
+ Offered --> Accepted: explicit current-generation accept
+ Accepted --> Running: first execution activity
+ Running --> AwaitingInput: governed wait
+ Running --> ResultProposed: finish
+ ResultProposed --> Settled: normal finalizer
+ Offered --> Fenced: cancel / expire / revoke
+ Accepted --> Fenced: cancel / expire / revoke
+ Running --> Fenced: cancel / expire / revoke
+ Fenced --> Reconciliation: drain in-flight effects
+ AwaitingInput --> Settled: yielded turn
+ Settled --> [*]
+```
+
+An answered interaction produces a new, ordinarily admitted continuation with
+current context and a new authority epoch. Do not hold a network request open
+through a human approval. Dot's memory may persist, but it must read the new
+Paperclip assignment and contract before taking further actions.
+
+Suggested initial operational defaults, configurable by operators and subject
+to qualification: one active assignment, ten-minute acceptance deadline,
+two-hour maximum authority lifetime, and attention after fifteen minutes
+without useful activity. A warning is not automatic reassignment. Silence can
+mean Dot is doing external work; it does not prove termination.
+
+Successful webhook receipt without acceptance gets no unbounded reminder loop.
+At the acceptance deadline, show a recoverable connection/acceptance failure.
+An operator retry republishes a wakeup for the same still-valid assignment or
+creates a fenced successor only after reconciliation. Transport failures use
+the existing bounded delivery retry policy.
+
+### Crash matrix
+
+| Failure point | Required recovery |
+| --- | --- |
+| Before assignment commit | No event exists; ordinary admission can retry its stable intent. |
+| After commit, before send | Event worker finds the durable notification. |
+| After webhook receipt, before accept | Same assignment remains offered; do not synthesize a started turn. |
+| During accept / response lost | Same request returns the accepted receipt; one `turn.started`. |
+| Tool committed, response lost | Reconcile existing semantic receipt; never repeat the effect with a fresh ID. |
+| Paperclip controller restarts | Restore current lease/generation, route persisted operations, replay PRP acknowledgements. |
+| runnerd restarts | Restore exact Dot provider checkpoint; verify binding/catalog/assignment identities before replay. |
+| Both restart | Reconcile server records and Runner checkpoint by identity/digest; unresolved divergence becomes operator-visible, not a new assignment. |
+| Subscription expires | Preserve pending work; mark delivery unavailable; wake actionable items after verified reconnection. |
+| OAuth/binding revoked | Reject callbacks and cached-result access; retain authorized audit/reconciliation state. |
+| Old Dot continues after replacement | Reject all old-generation mutations and results. |
+| Storage/replay limit exceeded | Stop accepting new operations, retain uncertainty, surface actionable recovery. |
+
+The existing controller generation and provider-attempt counter stay distinct
+from the Dot binding generation. A server failover does not automatically
+create a new provider attempt or grant new authority to a remote model.
+
+Enforce generation/lease comparisons atomically when routing and mutating state;
+an in-memory check followed by an unfenced write is insufficient across server
+replicas. The broker stores a pending accept reservation, and projects it as
+accepted only from the Runner's durable acceptance evidence.
+
+### Stop semantics
+
+Pause, cancel, budget stop, reassignment and revocation first fence Paperclip
+authority in the same governed path used by other providers. Prevent new tool
+dispatch, hide obsolete inbox work, and reconcile already dispatched effects.
+Optionally send a cooperative stop mailbox item while the connection remains
+authorized for that narrowly scoped acknowledgement.
+
+Represent these facts separately:
+
+1. Paperclip authority revoked.
+2. Paperclip-controlled effects settled or unresolved.
+3. Dot acknowledged the stop request, if observed.
+4. OpenAI/global external activity stopped: **unconfirmed**.
+
+Killing runnerd does not kill Dot. A model acknowledgement does not prove that
+its child tasks or other plugins stopped. Do not let existing PID/process-death
+recovery logic treat either as a safe global replacement proof.
+
+After fencing and settling Paperclip effects, the run can record cancellation
+of Paperclip participation. Automatic replacement after an accepted assignment
+remains disabled where external activity might duplicate work. Surface the
+uncertainty and require the existing operator recovery path for such cases.
+
+## 9. Tools, context, files and accounting
+
+### Runtime context
+
+Build assignments through the existing native execution-input constructor,
+including task/wake context, agent instructions, completion contract, current
+questions and policy. Add read-on-demand projected operations for assigned skill
+content and large context; pin revisions and recheck authorization on reads.
+
+Use existing deferred tool discovery when catalogs exceed transport limits.
+Expose the core task tools and assigned connector tools through the same
+`PaperclipRunnerToolAuthority` and assignment snapshot used by other providers.
+An old catalog does not preserve revoked grants.
+
+Do not export local environment variables, credential bindings' secret values,
+absolute host paths or a general-purpose server shell to Dot. Instructions to
+respect a work mode do not replace server-side tool policy.
+
+### Workspaces and deliverables
+
+In v1, Dot has no shared filesystem. Suppress filesystem-dependent tools unless
+their execution location and authority are explicitly supported. A local path
+reported by Dot is never a path on the Paperclip server. Do not synthesize a
+fake cwd or pass it to existing file-upload helpers.
+
+Support durable text/Markdown outputs through existing document tools. For
+binary outputs, design a separate bounded, authenticated artifact-ingress
+contract or a qualified remote-workspace file reader. Bind any upload to the
+company, task, agent and originating run; verify bytes/hash and create normal
+attachment/work-product records. Do not fetch arbitrary model-supplied URLs.
+Binary transfer is a later capability gate, not a reason to delay the initial
+task/document provider.
+
+### Accounting
+
+Record provider usage and provider cost as unknown. Preserve separately measured
+costs of Paperclip-mediated paid tools. No guessed token counts or zero-cost run
+records. Display **Dot usage is managed outside Paperclip**.
+
+Continue normal budget checks before admission and every paid/mutating action.
+Budget exhaustion prevents new Paperclip work and fences the binding's current
+run. Since token spend and external execution are unobservable, Paperclip cannot
+promise a hard dollar cap on Dot's own activity. A policy requiring fully metered
+provider spend must make this provider ineligible. Otherwise require the
+operator's explicit selection of an externally billed/unmetered provider
+profile, plus concurrency, operation-count and authority-time limits.
+
+This distinction is a product contract, not permission to weaken existing
+company budget hard stops for costs Paperclip actually controls.
+
+## 10. Onboarding and ongoing UX
+
+1. Choose **Paperclip Runner → OpenAI Dot**.
+2. Show stable MCP endpoint and connection/pairing flow. Cloud deployments use
+ the stable broker once its agent-resource routing is implemented; self-hosted
+ deployments use authenticated public HTTPS.
+3. Connect the dedicated plugin, review the named company/agent delegation, and
+ copy/open the setup instruction in the user's existing Dot.
+4. Display separate setup stages: authenticated, tools callable, subscription
+ verified, test event received, test completed.
+5. Enable assignment only after the challenge completes. A slow tool refresh
+ shows **Waiting for Dot's tools** with retry guidance.
+6. Offer a real first task and display its result in the normal task surface.
+
+Keep normal environment diagnostics read-only. **Send test event** is a separate
+explicit action because it wakes an external model. Persist the setup test and
+its receipts so refreshing the page or retrying does not create multiple tests.
+
+Configuration shows binding owner, named agent, connection health, last successful
+test, last acceptance, subscription expiration and reconnect/disconnect actions.
+Do not show unused cwd, executable, model/effort or token-budget controls.
+
+Run UI distinguishes **Queued**, **Waiting for Dot**, **Accepted**, **Working**,
+**Waiting for input**, **Finalizing**, and **Needs reconnection/reconciliation**.
+These are projections over normal execution and bridge records, not a second
+issue-status system. Stop messaging describes the scope of what Paperclip can
+stop. Missing provider transcript detail is labelled as unavailable.
+
+The stable plugin description/instructions teach one standing subscription, inbox
+draining, exact identity/request-ID reuse, structured completion, current-context
+reads and no comment echo loops. Plugin directory listing is separate from
+private testing; workspace policy and public distribution review still apply.
+
+Any Apps catalog entry must follow `doc/connections/CONNECTOR-PLAYBOOK.md`.
+Do not model a user-entered Dot URL as a normal outbound MCP server connection:
+here, Dot is the MCP client.
+
+## 11. Implementation sequence and file map
+
+Deliver each slice behind a default-off Dot provider flag as well as the
+existing Runner/public-MCP requirements. Disabled means no new admission;
+preserve authorized cleanup/reconciliation of previously admitted work.
+
+### Slice 1 — Contracts and deterministic production topology
+
+**Change:** Define the Dot provider, binding snapshot, external-provider port,
+operation receipts, capability limitations and next native/PRP schema revisions.
+Add TypeScript/Rust parity fixtures and a scripted external peer.
+
+**Files:**
+
+- `packages/adapter-utils/src/paperclip-runner-permissions.ts`
+- `packages/paperclip-runner/protocol/schemas/` and protocol fixtures
+- `packages/paperclip-runner/src/contracts/{native-execution,harness-driver,types}.ts`
+- `packages/paperclip-runner/src/backends/native-backend-factory.ts`
+- Runner compatibility/export declarations and corresponding Rust protocol code
+
+**Exit:** A qualified test artifact recognizes Dot and rejects incompatible
+profiles/envelopes before dispatch; old-provider fixtures still pass. No
+production picker entry yet.
+
+### Slice 2 — Scoped connection, pairing and mailbox persistence
+
+**Change:** Dedicated agent OAuth resource/purpose, scoped binding, migrations,
+mailbox/operation records and event-source support. Retain personal MCP behavior.
+
+**Files:**
+
+- `packages/db/src/schema/public_mcp.ts`, new Dot schema module and exports
+- Generated migration via `pnpm db:generate`
+- `packages/shared/src/types/` and `validators/` for public configuration/status
+- `server/src/routes/public-mcp.ts`, agent-binding management routes
+- `server/src/services/public-mcp/{oauth,events,event-webhooks,dot-runner}.ts`
+- New `server/src/services/dot-runner/` binding, mailbox and operation services
+
+**Exit:** Restart-persistent pairing/subscriptions/receipts; cross-company,
+personal-to-agent escalation, callback verification and revocation tests pass.
+Operations can be stored safely before a controller is available.
+
+### Slice 3 — Rust provider and authenticated broker port
+
+**Change:** Implement the Dot executor, durable checkpoint, acceptance boundary,
+PRP external operation delivery and normal `ProviderToolBridge` integration.
+The app port implements only transport persistence/routing.
+
+**Files:**
+
+- New `runner/crates/runner-core/src/dot_provider_backend.rs` and state module
+- `runner/crates/runner-core/src/native_provider_backend.rs`
+- `runner/crates/runner-core/src/provider_bridge.rs` where shared extension is needed
+- Runner durable command/event validation and provider descriptor projection
+- `packages/paperclip-runner/src/drivers/dot/` reference/conformance implementation
+- Runnerd transport facade and `server/src/services/native-runtime/runner-prp-coordinator.ts`
+
+**Exit:** A real Rust runnerd and scripted MCP peer complete an assignment through
+the app-owned tool authority. Killing either process at a receipt boundary does
+not repeat a committed effect. The memory-only prototype is not used by this test.
+
+### Slice 4 — Normal task admission, tools and finalization
+
+**Change:** Select `openai_dot` from normal scheduling, acquire checkout and
+controller authority, construct the immutable input, publish admitted work and
+route results through existing completion feedback/status policy.
+
+**Files:**
+
+- `server/src/services/native-runtime/{provider-profile,runtime-mode,prepare-native-run,native-execution-input}.ts`
+- `server/src/services/native-runtime/native-session-executor.ts`
+- `server/src/services/native-runtime/paperclip-runner-tool-authority.ts`
+- `server/src/services/native-runtime/{native-run-coordinator-store,native-run-finalizer,status-arbiter}.ts`
+- Narrow integration points in `server/src/services/heartbeat.ts`
+
+**Exit:** Assign a real test issue to the Dot agent; it writes a normal document
+and proposes completion; the ordinary finalizer decides issue status. Reads,
+mutations, work modes, approvals and budget denials use existing authorities.
+
+### Slice 5 — Continuations, stop and recovery
+
+**Change:** Restore exact assignments across controller/runner restarts, deliver
+slow-operation results, implement question/approval response wakes, and fence
+cancelled/paused/reassigned work without claiming external shutdown.
+
+**Files:**
+
+- `server/src/services/native-runtime/{native-restart-recovery,native-session-resume,native-runner-ownership}.ts`
+- `server/src/services/{acknowledged-native-stop,remote-execution-termination,execution-recovery-attempt}.ts`
+- Existing interaction/continuation services and Dot mailbox reconciliation
+- Rust Dot recovery/checkpoint tests and protocol fixtures
+
+**Exit:** Fault matrix in section 8 passes, with no duplicate writes or stale
+callback authority. Unknown effects produce visible reconciliation, not an
+automatic retry storm. A long human wait survives process restarts.
+
+### Slice 6 — Product onboarding and read models
+
+**Change:** Provider configuration, pairing/challenge UI, normal diagnostics,
+connection health, run phase/stop semantics, and CLI watch output.
+
+**Files:**
+
+- `ui/src/adapters/paperclip-runner/index.ts` and its configuration components
+- Agent creation/configuration and assistant-connection views/API clients
+- Shared provider/connection status types and experimental-setting contracts
+- CLI Runner event formatting/config diagnostics
+- `integrations/assistant-plugins/` setup instructions/package as appropriate
+
+**Exit:** A user can connect an existing Dot and complete the first task without
+terminal commands, UUID transcription, database edits or browser automation.
+UI follows `DESIGN.md`/design skill, token gates and standard form footers.
+
+### Slice 7 — Hosted routing and deployment qualification
+
+**Change:** Stable public endpoints, agent-resource routing and grant purpose in
+the Cloud broker, membership/revocation checks, key persistence, readiness and
+sleep/wake behavior. Keep the account-to-tenant routing authority server-owned.
+
+**Ownership:** Instance-side changes in this repo; Cloud broker/deployment
+changes in the companion Cloud repository. Track that dependency explicitly.
+
+**Exit:** Hosted and directly reachable self-hosted tests separately pass.
+Private-network-only installs report the missing reachability prerequisite.
+No temporary tunnel URL is shipped as configuration.
+
+### Slice 8 — Real-account acceptance and release gate
+
+**Change:** Full-stack evaluation fixtures, real Dot acceptance evidence,
+operational docs and qualified provider catalog entry.
+
+**Exit:** Real user onboarding → real assigned issue → signed wakeup → accepted
+turn → normal tool effect/document → structured result → ordinary finalization,
+plus restart, duplicate-delivery, revoke and cancellation scenarios. Record exact
+artifact/contract revisions and distinguish simulator from real-account results.
+
+Critical path: 1 → 2 → 3 → 4 → 5 → 8. Slice 6 consumes the status contracts;
+slice 7 is required before advertising hosted support. A hidden vertical slice
+after 4 is useful for real testing, but qualification requires 5 and 8.
+
+## 12. Verification and release criteria
+
+### Deterministic checks
+
+- Shared TS/Rust fixtures: invalid version, wrong binding, stale generation,
+ changed request input, duplicate accept/finish and terminal ordering.
+- Persistent DB tests: atomic assignment/outbox, uniqueness under concurrent
+ acceptance, one active assignment, subscription gap repair, lease takeover,
+ retention limits and unsubscribe audit preservation.
+- Actual semantic authority tests: repeated task/document/comment effects,
+ approval gates, planning/ask restrictions, membership loss, budget stop,
+ grant revocation before/after dispatch and response replay.
+- Recovery tests: crash at every commit/ack boundary; preserve uncertain writes;
+ conflicting snapshots fail closed; no fresh request IDs on automatic retry.
+- Boundary tests: no personal privilege through the agent resource, forged Dot
+ URLs have no authority, no callback SSRF/redirects, stale catalog cannot call
+ removed tools, large input/output stays bounded, and no credentials in logs.
+- Control tests: accepted-but-silent Dot, stop/finish race, in-flight write after
+ cancellation, late result after reassignment, duplicate/batched/out-of-order
+ events and slow operation completion.
+- Context tests: current wake comments, assigned instructions/skills, question
+ answers and completion revisions survive continuation without leaking another
+ run's context or claiming native provider session resume.
+
+### Live qualification
+
+Use a disposable company with real scheduling and the built Rust artifact.
+Record dispatch-to-webhook, webhook-to-accept and accept-to-result durations as
+observations, not an OpenAI SLA. Repeat after a server restart and after OAuth
+refresh. Verify that a task assigned while disconnected resumes once after
+reconnection. Test two queued tasks and a human-question continuation.
+
+Prove subscription removal/revocation from server state, not just Dot's prose.
+Test pending external activity separately from Paperclip authority revocation.
+Record unknown usage honestly. Keep the endpoint up through the entire test.
+
+### Commands and evidence
+
+Start with targeted Runner contract/driver, MCP, DB and native-runtime tests.
+Use the repository's Runner and Product E2E eval skills when implementing their
+fixtures. Run Rust/TypeScript parity, build/package compatibility and standalone
+consumer checks for changed public Runner contracts.
+
+Before a PR-ready handoff, run:
+
+```sh
+pnpm -r typecheck
+pnpm test:run
+pnpm build
+pnpm check:token-gates # when UI changes are present
+pnpm --filter @paperclipai/paperclip-runner verify
+```
+
+Browser/product suites are opt-in and required for the onboarding/live acceptance
+slice, not for each small contract edit. Update the PR template in full and
+attach inspectable evidence to the implementation issue/work product.
+
+Keep operational counters in the run log or configured OpenTelemetry path.
+First-party Telemetry is a separate opt-out data path: any new Telemetry events
+require its generated contract, README update and privacy review. Do not add
+prompts, callback URLs, document bodies or credential material to any diagnostic.
+
+Release requires all of the following:
+
+1. Normal task admission and finalization through Rust runnerd.
+2. Dedicated agent delegation and current-authority enforcement.
+3. Durable transport/operation recovery without duplicated known effects.
+4. Accurate stop, usage, model and workspace limitations in UI and API.
+5. Real-account onboarding and multi-turn acceptance at a stable URL.
+6. No regressions in existing Runner providers or personal MCP connections.
+7. Rollback can disable new Dot work while retaining safe cleanup and receipts.
+
+## 13. Deliberate deferrals and open validation
+
+Defer provider-native steering, remote kill guarantees, model selection,
+multi-agent sharing of one connection, verified provider thread identity,
+token accounting, arbitrary repository access and binary file transfer until a
+documented capability and corresponding qualification exist.
+
+Before public availability, validate long-duration event subscriptions and
+refresh in the real Dot client; tool-catalog propagation after reconnect; large
+catalog/result behavior; and hosted app approval/distribution requirements for
+the selected release channel. The successful short lab test proves none of
+those by itself.
+
+The largest implementation risk is accidentally treating Dot as a controllable
+process. The design must continue to work when it is an independent remote
+assistant that can be delayed, retain unrelated context, or keep doing things
+outside Paperclip after its Paperclip authority ends.
+
+## 14. Sources and implementation anchors
+
+- [Prototype and actual live acceptance](../dot-runner-prototype.md)
+- [Runner architecture](../architecture/paperclip-runner.md)
+- [Runner package ownership and production boundary](../../packages/paperclip-runner/README.md)
+- [Public MCP identity, tools and hosted broker](../public-mcp.md)
+- [Current Dot reference driver](../../packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts)
+- [Current MCP bridge](../../server/src/services/public-mcp/dot-runner.ts)
+- [Native provider selection](../../server/src/services/native-runtime/provider-profile.ts)
+- [Production native executor](../../server/src/services/native-runtime/native-session-executor.ts)
+- [Rust provider dispatch](../../packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs)
+- [Production tool authority](../../server/src/services/native-runtime/paperclip-runner-tool-authority.ts)
+- [OpenAI MCP Events](https://developers.openai.com/plugins/build/mcp-events),
+ checked 2026-10-02: Dot support, asynchronous webhook acknowledgement,
+ callback verification, refresh, ordering and delivery limits.
+- [OpenAI plugin quickstart](https://developers.openai.com/plugins/quickstart)
+- [OpenAI Dot documentation](https://learn.chatgpt.com/docs/dots)
+
+This plan is saved in the existing isolated worktree. There is no assigned
+Paperclip issue or authenticated issue-artifact context in this Codex chat, so
+it is a repository plan rather than an uploaded issue artifact. When execution
+is assigned in Paperclip, link this plan as its plan document/work product.
+
+
+## 15. First-time onboarding checkpoint — 2026-10-07
+
+The live onboarding attempt found and fixed two authorization problems. ChatGPT’s client metadata prefers `private_key_jwt` while also publishing `none` as a supported method; Paperclip now negotiates the supported public-client method while retaining S256 PKCE. Dot’s browser blocks the temporary Cloudflare hostname even though ChatGPT’s MCP discovery service reaches it. An optional `PAPERCLIP_MCP_AUTHORIZATION_ORIGIN` separates the browser authorization ingress from the MCP resource, issuer, and token ingress. Both routes use existing operator-approved tunnels; no new hosted infrastructure was created.
+
+An operator-issued, expiring, one-use pairing capability now lets Dot approve its exact agent grant without receiving an operator password or board session. The preview validates the pending request, binding, company, current operator membership, and agent status, and displays company, agent, permitted task operations, and access duration before submission. Approval and binding consumption are atomic, and the resulting token remains restricted to the Runner resource and exact agent. The copied setup prompt uses this path and retains the user-requested plugin-creation authorization paragraph. The live attempt also exposed a plugin-name collision and uncertainty about entering the code; the prompt now handles an existing name for another URL, and both the prompt and consent page explain that code entry previews access while submitting Connect grants it.
+
+The synthetic test-drive remains separate from production. Dot created the fresh custom plugin and reached the Tailscale consent page. It entered the code, confirmed the exact company, agent, permissions, and duration in its own scope preview, and stopped before submitting Connect. The human approved the exact connection in Codex. Dot could not verify an agent relay of that approval, so Codex completed the actual consent through the existing private plugin Connect action using the direct human authorization. The registered ChatGPT callback exchanged the real OAuth token successfully. Attaching the already connected app to the Dot conversation exposed its tools; Dot verified its inbox, created and verified the mailbox event subscription, and confirmed a readiness challenge triggered from Paperclip with no manual chat wakeup. The connection is ready. The first ordinary task exposed a heartbeat descriptor omission before dispatch; admission now uses the real dedicated Dot bridge descriptor, rather than the JSON-RPC facade. Its regression test verifies the same capabilities as execution without starting a process or broker. The normal UI retry completed DOT-1 through the real Rust Runner without a manual chat wakeup. Dot accepted mailbox item 2, wrote and read back the exact-nonce document, and completed both reporting steps. The ordinary finalizer committed Done; run `9a44feeb-2779-4217-8210-092852019511` succeeded with exit code 0, no remaining work or verification caveats, and unknown provider usage/cost retained as null. The live connection and local-controller task path are qualified; stable production ingress and hosted/remote modes remain outside this acceptance.
+
+Verification: the focused OAuth/onboarding API suite passed 11 cases, the affected UI suites passed 27 cases, the relevant server/UI typechecks and token gates passed, and the workspace build passed. The earlier focused Runner/MCP suites also passed. A full `test:run` was stopped after unrelated failures and a 300-second workspace snapshot stress timeout; isolated tool-access and event-sequencing rechecks passed, but the full suite is incomplete. After the admission fix, 34 Runner/driver tests and 13 real Rust/broker integration tests passed, and full workspace typecheck and build passed again. The full repository suite is still incomplete, so this checkpoint is not a PR-ready verification claim.
+
+During deployment, macOS exhausted its PostgreSQL shared-memory IDs. One confirmed unused PostgreSQL interlock with zero attachments and an exited creator was reclaimed; no running database was stopped. Another development instance had occupied the old API port during the outage, so this test-drive and its existing public tunnels were moved to port 3109. The temporary MCP tunnel hostname consequently changed; fresh plugin onboarding must use the current runtime prompt rather than an old copied URL or expired pairing code.
+
+
+## 2026-10-07 full Runner capability extension
+
+User authorized implementation and live qualification of all six expansion areas. Delivery scope: idle request admission with normal run ownership; human assignees and person discovery; authorized cross-task tools; pinned skill reads and assigned MCP gateway relay; explicitly enabled host workspace tools and verified artifacts; truthful capability discovery; rolling lease renewal, pagination and follow-up input. Preserve provider limits for model choice, usage, cost, and unconfirmed global external stopping.
+
+Acceptance: an idle Dot creates a hello task assigned to the responsible person; an assigned Dot reads a pinned skill, uses an authorized assigned gateway tool, produces a verified downloadable file, handles follow-up input, renews its lease, and cannot continue mutations after fencing. Verify replay, company isolation, budget stops and permission denials. Do not reseed the synthetic test-drive from production.
+
+
+### Full Runner acceptance checkpoint
+
+The real Dot created **hello** assigned to the verified responsible human, read
+its pinned synthetic skill, used attributed cross-task comments and documents,
+ran a sandboxed command, incorporated a follow-up comment, renewed its lease,
+and registered a report whose downloaded bytes and SHA-256 matched the receipt.
+A missing initial fixture exposed a definite read exception without a terminal
+receipt; the operator cancelled that run and Dot acknowledged its fence. Read
+failures now settle as bounded errors. A real Rust regression proves that later
+tools and finalization still work after a missing-file error.
+
+Dot then initiated its own **DOT-4** intake through `paperclip_dot_request_turn`,
+created **hello from idle** for the human owner, verified the missing-file error,
+and wrote/read/executed/registered `idle-proof.txt`. The downloaded 20-byte file
+contains `idle-runner-verified` and matches its registered SHA-256. Both
+completion steps succeeded; the normal run exited 0 and the ordinary finalizer
+committed Done. The offer required a direct inbox check; no automation wake was
+observed for that offer. Intake responses now include an available assignment
+and instruct stable same-request polling while admission is pending.
+
+Review also found overlapping hash-based writes and missing lock entries.
+Workspace calls now serialize across the local controller's canonical workspace
+lane; a concurrent-write regression permits one commit and rejects the stale
+edit. The lockfile includes compression and the existing manifest dependencies.
+OpenAPI includes the capability-authenticated pairing preview and redemption
+routes. The expanded API catalog's comparison fixture has been synchronized.
+
+Real Rust/PostgreSQL qualification covers the configured assigned gateway with
+a synthetic service, not a live external app account. Linux command sandboxing,
+hosted/remote controllers, provider-native control and the complete future fault
+matrix remain outside this supported local-controller acceptance. Automatic
+inbound attachment staging remains disabled. Full local suite and fresh PR CI
+are tracked in PR #15414 and are not assumed green from targeted checks.
diff --git a/doc/plans/2026-10-02-pi-production-readiness.md b/doc/plans/2026-10-02-pi-production-readiness.md
index 20567a4229a..45146fdfa2c 100644
--- a/doc/plans/2026-10-02-pi-production-readiness.md
+++ b/doc/plans/2026-10-02-pi-production-readiness.md
@@ -20,6 +20,8 @@ accepts the caller's explicit native model; no allowlist, hardcoded default or
fallback is added. Pi profile 19 has command digest
`sha256:b7647ebf97f802ca053ec3384c912bf0e8d18eba308d27397bb1d95a37220825`.
+The merge onto newer master uses Pi profile 20 (`sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e`). Its declaration differs from profile 19 only in the revision and the shared sandbox source hash: master adds configured task environment keys in the Codex-only branch. Pi runtime, wrapper, extension, closures, model configuration, credential environment and recovery identity hashes are unchanged. The seven live results above remain evidence for their original profile 19 source; profile 20 integration is verified by current-head tests and CI.
+
| Core path | Canonical campaign | Retained evidence |
| --- | --- | --- |
| Four typed questions, browser reconnects and exact saved answers | `pi-core19-0-1791477277` | 42 files; SHA256 `5c0c5fdfeca97b689a0f299935fd5cb62d65c38a056b8ff4f2dfc888cd795b24` |
@@ -109,6 +111,8 @@ harness `ee3b094d35719e4dd7cbc791d1924205c4fa474f` and immutable image
Their canonical results and independent cleanup pass; their host stops normally.
They do not substitute for the seven fresh profile-19 results above.
+The merge onto newer master uses Pi profile 20 (`sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e`). Its declaration differs from profile 19 only in the revision and the shared sandbox source hash: master adds configured task environment keys in the Codex-only branch. Pi runtime, wrapper, extension, closures, model configuration, credential environment and recovery identity hashes are unchanged. The seven live results above remain evidence for their original profile 19 source; profile 20 integration is verified by current-head tests and CI.
+
| Core path | Canonical campaign | Retained evidence |
| --- | --- | --- |
| File edit, one exact successful command, authenticated public download, registered deliverable, finish, Done and finalized copy-back | `pi-core-0-1791470879` | 23 files; archive SHA256 `9a1c41e2ccad75f89a069ff571a3aa9f8cb94ae80c1bd397f7c886338b9a09bd`; definition 5 |
diff --git a/doc/plans/2026-10-07-native-connection-evidence-repair.md b/doc/plans/2026-10-07-native-connection-evidence-repair.md
new file mode 100644
index 00000000000..7444aa2ef7b
--- /dev/null
+++ b/doc/plans/2026-10-07-native-connection-evidence-repair.md
@@ -0,0 +1,47 @@
+# Native connection evidence and continuation repair
+
+## Finish line
+
+Fix the observed decline-grading races and qualify an explicit per-turn native
+completion reminder. Keep the prompt reduction in #15489 draft. Do not merge.
+
+## Changes and evidence
+
+The evaluator waits for the final successful lead run's attributed saved reply
+before grading a decline, with the original deadline unchanged. Wrong wording
+still fails. Both explanation checks recognize the observed unavailable/rejected
+and "wasn't able to pull" responses. The exact grading input is retained before
+later refreshes. A recorded tool-action rejection may await its bound continuation
+within the same deadline, just like an executed approval.
+
+Compact resumed inputs remind the provider to obtain an accepted completion or
+block report for the current turn. Earlier reports and final prose are not a
+replacement. The strict native result gate, original connection prompt, tool
+catalog, permission enforcement and automatic retry policy remain in place.
+This is an instruction repair hypothesis; local tests alone do not establish
+that a model will follow it.
+
+## Bounded comparison
+
+Freeze a common evaluator baseline on master `fc6304dfe5f2e446e09bd052a7b45f51e930f250`.
+Use identical evaluator, fixture, prompt, model, profile, permission and budget
+inputs in both variants. The candidate alone adds the compact per-turn reminder.
+Select the fifteen explicit `native-connection-guidance` local cells: five
+connection stories across native Codex `gpt-5.6-sol`, ACPX Claude `claude-sonnet-5`,
+and OpenCode `openrouter/deepseek/deepseek-v4-flash-0731`. One attempt per variant
+and cell, no automatic retries, 720000 ms cell deadlines, 1000-cent company and
+agent hard stops, and three concurrent cells per campaign. Count every actual
+run, including failures; preserve source and grader hashes and incomplete billing.
+
+The old campaigns 37688433682 and 37688449963 remain original 11/15 and 12/15
+results with two new failures. This follow-up does not regrade or qualify those
+trees. A passing workflow command is not a behavioral grade. Inspect saved output,
+accepted reports, exact pairs, decisions, tool use and cleanup before readiness.
+
+## Validation so far
+
+- 25 focused evaluator tests pass, including delayed/missing/wrong-run replies,
+ incorrect output, and accepted/rejected continuation deadlines.
+- 194 native contract, instruction-delivery and session tests pass. A correct
+ visible provider answer without a semantic completion still fails closed.
+- Full validation and the fresh paired live comparison are pending.
diff --git a/doc/plans/2026-10-07-personal-primary-agent.md b/doc/plans/2026-10-07-personal-primary-agent.md
new file mode 100644
index 00000000000..9ce1100de55
--- /dev/null
+++ b/doc/plans/2026-10-07-personal-primary-agent.md
@@ -0,0 +1,180 @@
+# Personal primary agent
+
+## Current boundary
+
+The user approved the revised Storybook design on 2026-10-07 and requested full
+implementation plus acceptance testing in a real isolated test drive. This branch
+now includes persistence, API wiring, and production defaults.
+
+- Branch: `codex/personal-primary-agent-storybook`.
+- Preview: http://localhost:6017/?path=/story/primary-agent-00-review-guide--start-here
+- Source: `ui/storybook/stories/primary-agent/` (one feature folder).
+- Shared presentation: `ui/src/components/primary-agent/PrimaryAgentPresentation.tsx`.
+- Stories keep simulated state as the approved reference. The application now
+ mounts a separate provider backed by a user/company preference endpoint.
+- Delivery includes real test-drive acceptance on desktop/mobile and required
+ repository checks. After reviewing the working feature, the user requested a
+ pull request with passing checks and merge into master.
+
+## Agreed product contract
+
+Each person has one primary agent per company, marked with an accessible
+"My primary agent" crown on the profile and agent list. Neither the Agents
+sidebar nor the Chat sidebar shows a crown. Different people can choose different agents; the
+preference will persist across devices. Crowning does not change roles,
+reporting lines, permissions, tasks, routines, or shared Board Operations.
+
+- The first human-attributed creation silently initializes the primary, including
+ onboarding. Later creations, system provisioning, and agent-authored hires do
+ not replace or establish a person's preference.
+- Tasks preserve explicit assignments and restored drafts, then prefer a recent
+ eligible assignee, then the primary, then the existing fallback.
+- Chat reopens a valid recent conversation, otherwise the primary's conversation,
+ otherwise its existing chooser. Opening Chat does not start execution.
+- The individual agent page offers Set as my primary beneath the agent details.
+ Kebab menus have no primary action, and there is no explicit removal option.
+ Standalone component examples do not offer this action. The current primary
+ shows its crown with no redundant set action. When a primary already exists,
+ switching requires a modal with the two agents' avatars and an arrow above.
+ The incoming primary has an outlined avatar and a crown beside its name:
+ "This will make [new name] your primary agent, do you want to do this?"
+ Cancel leaves the current primary unchanged. When none exists,
+ choosing one applies immediately without the modal. Stars remain independent.
+ Failures roll back and offer an actionable retry. These review decisions
+ supersede the original menu, removal, and immediate-switching design.
+- The primary stays first in the Agents sidebar, even when idle; other ordering
+ is preserved and the primary appears only once in that section.
+- Pausing and errors retain the crown and existing execution restrictions.
+ Leaving or terminating clears it without resetting initialization. Crowning a
+ previously left agent rejoins it under existing membership rules.
+
+## Review coverage and implementation notes
+
+Stories use the actual streamlined and classic Layout components, roster/profile
+pages, composer, Chat pages/navigation, existing menus, and shared crown components.
+Fixtures include idle/active, first-created result, absent/cleared/unavailable,
+paused/error, independent stars, long names, loading, failed mutations, desktop,
+mobile, and light theme. Interactive stories cover setting from the profile,
+absence of primary menu actions, leaving, starring, rollback/retry, and opening
+a task or Chat after switching, cancellation, and first choice without confirmation.
+
+The streamlined Sidebar now includes the reviewed Agents section by default.
+Stories can still supply it through Layout's existing sidebar slot for review.
+The icon rail is retired in SidebarContext; collapsed coverage uses the supported
+collapsible Agents section plus the mobile drawer. No rail is reintroduced.
+
+Reloading resets the fixture preference. Task fallback is simulated through the
+existing composer's defaults/recent-assignee input. Chat entry routing and the
+first-created result are also simulations. These stories are design references,
+not evidence of authorization, persistence, concurrency, or real execution.
+
+## Verification at review handoff
+
+- UI TypeScript build (`tsc -b ui`).
+- 61 existing tests across SidebarAgents, AgentActionButtons, EntityRow, Agents,
+ and AgentOverview.
+- Token gates and palette/character synchronization checks.
+- Full static Storybook build.
+- Browser walkthroughs: switch crown and sidebar order, independent stars,
+ rollback and Retry, leave/rejoin, direct profile action, task assignment/draft
+ precedence, recent Chat history, Chat fallback/chooser, and mobile drawer,
+ composer, and profile at 390 by 844.
+
+## Implementation delivered
+
+1. Added a company/user preference with nullable primaryAgentId and initialization
+ state; enforce uniqueness. Synchronize db/shared/server/ui contracts.
+2. Added authenticated GET/PUT `/api/companies/:companyId/primary-agent/me`, deriving
+ the user from authentication, enforcing company access and agent visibility,
+ rejecting agent actors, and recording mutation activity.
+3. Initialized transactionally during human-attributed creation. Concurrent
+ creations establish one primary and cannot overwrite an explicit choice or
+ lifecycle-cleared preference. Backfill from the earliest attributable human creation;
+ if that original agent is gone or terminated, leave the crown empty. Unknown
+ ownership remains unset.
+4. Added lifecycle cleanup and existing membership rejoin behavior. Connected a
+ user/company-scoped query hook to the reviewed presentation and defaults.
+5. Verified concurrency, backfill, lifecycle cleanup, user/company isolation
+ (including local trusted mode), drafts, recent selections, unavailable agents,
+ and real desktop/mobile task and Chat journeys.
+
+## Real test-drive acceptance (2026-10-07)
+
+- Isolated CLI test drive: `/tmp/paperclip-primary-agent-test-drive`, company
+ **Primary Agent Test Drive**, prefix `PRI`, at http://localhost:3104.
+- Maia was crowned automatically through the real creation API. Creating Alex
+ preserved Maia. The simplified creation wizard's model-connection step rejected
+ the disposable placeholder credential; Alex was created through the real API
+ with the existing local Codex login instead. No creation-wizard success is claimed.
+- Desktop: profile-only setting, cancel/confirm, persistence after reload, roster
+ crown, sidebar ordering, absent sidebar crowns and menu actions, leave/clear,
+ first choice without a modal, rejoin, and paused crown retention passed.
+- Fresh browser-origin task composer selected Alex from the primary. After switching
+ to Maia, the composer preserved recent Alex and Chat reopened Alex's recent
+ conversation. An existing draft on the other origin remained intact.
+- Opening Chat used the primary with no new execution. Sending a message produced
+ **“Alex received this primary-agent chat.”** from a successful real Codex run.
+- Real task **PRI-3, Acknowledge Alex’s task receipt**, completed with
+ **“Task received by Alex”** and status `done`. The initial probe used an unsupported
+ `gpt-5.4` subscription model; both agents were changed to `gpt-6.1-sol`, the successful
+ checks were repeated, and the obsolete probe task was cancelled.
+- Mobile at 390 × 844: the reviewed modal fits, confirmation switches the crown,
+ and the page has no horizontal overflow. Viewport override reset afterward.
+- Focused tests cover initialization, simultaneous creation/selection, audit order,
+ leave races, backfill, visibility boundaries, viewer self-service, auth-derived
+ user/company isolation, optimistic rollback/retry, session retry, task defaults,
+ and recent Chat precedence.
+
+## Verification results
+
+- Repository typecheck passed with `pnpm -r --workspace-concurrency=1 typecheck`.
+ Final server/UI typechecks also passed after the last feature refinements.
+- `pnpm build`, `pnpm check:token-gates`, and `git diff --check` passed.
+- Entire UI suite: **698 files, 7,760 tests passed**.
+- Entire DB suite, run serially: **47 files, 166 tests passed**. Parallel attempts
+ failed to initialize embedded PostgreSQL before migrations; the serial run
+ resolves that migration-verification concern.
+- Focused primary/default/provider checks passed: **106 tests** across final
+ runs (9 database/API tests, plus provider, composer, and Chat tests).
+- Existing onboarding, hire idempotency, resource membership, and company import
+ suites passed: **125 tests**. Legacy approval plus terminalization checks:
+ **15 tests passed**. Import/approval expectations now assert original creator
+ attribution rather than dropping the new creation option.
+- **Repository-wide tests are not green.** `pnpm test:run` was stopped after
+ roughly an hour with failures, rather than being represented as a complete pass.
+ `adapter-cost-failure-paths.test.ts` still has OpenCode timeout failures in a
+ fresh rerun. `workspace-git-snapshot-streaming.test.ts` timed out after 300 seconds.
+ Heartbeat database-setup timeouts passed isolated reruns. The broad run began
+ before the final edits and also reported primary/approval failures; those suites
+ passed in fresh processes against final source. Later broad-run groups did not
+ complete. These local failures remain disclosed; PR checks must pass on the
+ current head before merge.
+
+The final-code test drive remains running at http://localhost:3104 with **Alex**
+primary and **Maia's profile** open. Choose **Set as my primary**, confirm, and
+reload to try persistence. New Task and Chat retain recent Alex choices by design;
+the primary is their fallback when no eligible recent choice or draft exists.
+
+## Pull request verification
+
+- PR: https://github.com/paperclipai/paperclip/pull/15470. The user authorized
+ passing PR checks and merging into master.
+- The rebased branch passes repository typecheck and build, token gates, and
+ 114 focused tests. Migration replay now runs twice without replacing choices.
+- The earlier OpenCode timeouts pass all 31 tests with an isolated XDG config
+ directory; the local config copy caused the delay. The large Git streaming test
+ also passes when run alone (296 seconds).
+- Initial CI identified stale creation-option assertions and app remounts on
+ company changes. Preserve mounted app children and bind each pending mutation
+ to its original user/company. Refresh membership caches for primary changes
+ received from other devices.
+- Security review identified agent mappings in company activity. Preference
+ events now record only the affected user and action, with no selected agent IDs.
+ An authenticated cross-user activity endpoint test covers this boundary.
+- Review fixes pass 96 database/permission-route tests and 127 provider,
+ live-update, and skill-route tests. Final merge requires fresh-head CI and review.
+- The affected browser suites pass all 10 tests, including onboarding, archived
+ company navigation, Chat fallback without execution, and slow-CPU reloads.
+- The second PR run passed 52 checks and Greptile 5/5, with one OpenAPI inventory
+ failure. Both personal endpoints now have board-only request/response contracts
+ in OpenAPI. Its 14 tests and the remaining 28 tests in that shard pass locally.
diff --git a/doc/plans/2026-10-08-wait-resume-ownership.md b/doc/plans/2026-10-08-wait-resume-ownership.md
new file mode 100644
index 00000000000..1dc289aac82
--- /dev/null
+++ b/doc/plans/2026-10-08-wait-resume-ownership.md
@@ -0,0 +1,81 @@
+# Waiting and resuming: runtime ownership and evidence
+
+## Finish line
+
+Map the section 5 waiting/resume boundary, strengthen the existing continuation
+oracle where it can accept broken state, and measure a small current-source
+sample before proposing instruction removal. This change adds eval checks and
+an ownership map. It does not remove agent instructions or change scheduling.
+
+## Ownership map
+
+| Operation | Authority and code | Instruction decision |
+| --- | --- | --- |
+| Ask a durable question | Native `request_human_input` persists an interaction with a mutation receipt in `server/src/services/native-runtime/paperclip-runner-tool-authority.ts`. `packages/paperclip-runner/src/native-session-runtime.ts` records a governed wait; `server/src/services/native-runtime/status-arbiter.ts` selects `in_review` for the yielded response wake. The finalizer and status committer apply the decision. | Keep the short native routing instruction and tool contract. No manual status PATCH is needed on this path. |
+| Ask through legacy API/skill | `server/src/services/issue-thread-interactions.ts` creates the interaction; the legacy caller separately moves the task to `in_review`. `server/src/routes/issues.ts` checks the review path. `skills/paperclip/SKILL.md` describes those two operations. | Keep the legacy save-question, then set-waiting-state instructions. Interaction creation alone does not own that transition. |
+| Deliver a human answer | `issue-thread-interactions.ts` validates the resolver and commits the answer plus `issueQuestionResponseDeliveries` in one transaction. `question-response-delivery.ts` owns delivery claims, replay fences and continuation wake receipts. Completed-task historical answers do not enqueue new work. | Agents must use the actual answer and respect the requested scope; they need not manufacture a wake or poll for it. |
+| Resume a provider's built-in question | `server/src/services/native-runtime/native-question-bridge.ts` binds the persisted question to its source run and provider request. It tries the original paused request before a fresh-wake fallback. | Keep this distinct from a semantic question that yields a terminal run. A running run is valid only with the pending native request's identity. |
+| Deliver approval/review outcomes | `queueResolvedInteractionContinuationWakeup` in `server/src/routes/issues.ts`, `native-interaction-bridge.ts`, and native review dispatch/participant services preserve authoritative targets and outcomes. | Clarification is not approval. Reviewer authority, exact plan revision and rejected-action boundaries remain necessary. |
+| Keep dependencies blocked and waits healthy | Native status arbitration and `server/src/services/recovery/legacy-continuation.ts` retain governance, dependency, budget and ownership gates. `pre-dispatch-review-wait.ts` distinguishes a verified no-provider review wait from an executed cancellation. | Keep first-class blockers distinct from human questions/review. Prose alone cannot create an actionable wait or authorize recovery. |
+| Finish after a response | Native completion goes through assessment/status commit; legacy completion uses the status/comment API (optionally the installed helper). Task documents and activity remain durable server records. | Runtime completion and legacy API bookkeeping are different contracts. This audit does not justify removing the latter. |
+
+## Existing coverage and gaps
+
+- `continuation`: real answer changes, clarification without approval, revised
+ plans retaining approval, untrusted handoff text, child reuse after restart,
+ native question documentation, and the provider-question bridge. These use
+ existing browser/API/provider journeys, not a new harness.
+- `everyday-workflows`: agent review handoff and service approval/decline cover
+ additional reviewer and tool authorization paths.
+- `context-integrity`: ordered comment continuation retains identical repeated
+ user wording. It does not make every repeated agent comment a defect.
+- `continuation-accounting` and the server question-response delivery tests:
+ durable receipts, duplicate delivery, restart, late gates and bounded repair.
+ These remain separate from task quality and instruction qualification.
+
+The old lifecycle oracle could accept a pending question with a stale execution
+lock, wrong waiting status, retry/recovery/monitor, a changed assignee, a lost
+intermediate run, or a missing/replaced second answer. New mutation calibrations
+reject those records even when the final task is done. Positive calibrations
+retain both terminal semantic waits and a correctly bound paused provider run.
+The existing content, approval and artifact checks still apply.
+
+All waiting checkpoints now carry task activity from the public API. This is
+successful persisted mutation evidence, not a failed-attempt counter. Final
+output count already rejects duplicate deliverables; there is no blanket rule
+that repeated comments or document revisions are invalid. A future instruction
+comparison must inspect attributed writes and revisions, preserving legitimate
+progress comments and actual failures. This slice does not prove that every
+possible duplicate status write or premature effect is absent.
+
+## Bounded live measurement
+
+Use the existing trusted Product E2E workflow with the branch under test frozen
+to its resolved source revision. Select exactly these four local cells, one
+attempt each, with no automatic retries and verified 1,000-cent company/agent
+hard stops before task creation:
+
+- `continuation.legacy-codex.local.answer-updates-scope`
+- `continuation.legacy-claude.local.answer-updates-scope`
+- `continuation.runner-codex.local.question-tool-documentation`
+- `continuation.runner-acpx-claude.local.question-tool-documentation`
+
+This is a current-source canary of question waiting/resume and the stronger
+oracle. It is not a candidate/baseline instruction comparison. The two native
+cells ask two sequential questions; the legacy cells ask one scope question.
+They cannot be pooled into a model ranking or a cost comparison. Record actual
+runs, source/workflow/grader identities, original grades, cleanup and incomplete
+billing coverage. Keep prior grades unchanged. Failed attempts need diagnosis,
+not a reroll to produce a green total.
+
+Approval/review, dependency unblock, provider-native paused questions, crash
+races and remote execution are outside this four-cell sample. Their existing
+deterministic/live suites are catalogued above, not newly qualified here.
+
+## Next instruction decision
+
+Retain the legacy waiting transition until the API owns it atomically (a separate
+product change) or matched evidence supports another valid contract. Native
+waiting is already runtime-owned. Any proposed native text reduction should
+first measure the remaining prompt/tool bytes and run matched approval/question
+cases; do not move legacy API instructions into native tool descriptions.
diff --git a/doc/run-log-events.md b/doc/run-log-events.md
index ed8f723652c..9641c092e72 100644
--- a/doc/run-log-events.md
+++ b/doc/run-log-events.md
@@ -7,6 +7,12 @@ event needs no operator endpoint.
## Native PRP Run-Log Events
+Fresh remote Codex model substitution emits `runner.model_fallback` on the
+system stream with `warn` severity. Its payload contains `requestedModel`,
+`effectiveModel`, and `codexCliVersion`. It records a preparation choice before
+provider launch, not a failed turn or a retry. The same substitution appears as
+a system warning in the task conversation. It remains local run-log data.
+
The hidden native coordinator writes each validated PRP event to the bound
run's existing event stream before it acknowledges the runner. The row keeps
the PRP `eventType`, source instance, source event ID, source sequence, protocol
@@ -280,6 +286,14 @@ warnings and errors remain visible.
Recovery lifecycle events retain the original structured failure code, retry attempt, next retry time, and predecessor/successor identifiers. Durable status delivery uses an idempotency marker; delivery grants no provider authority. Failed publication is retried without repeating provider work. These records are not first-party Telemetry.
+An unstarted legacy conversation retry waiting for execution cleanup retains
+`resultJson.executionWait` with the issue, blocking run, and
+`execution_owner_active` cause. A local lifecycle event records the wait and the
+unchanged scheduled retry attempt once per blocking run. Repeated scheduler
+checks update the same retry row without repeating that event. Promotion removes
+this ownership-wait marker after cleanup; other execution holds retain their
+existing dispatch gates.
+
If execution-continuation setup finds that a task no longer exists, is closed,
or its owner changed, the existing cancellation settlement records
`continuation_task_ownership_changed`. The run and wake request become cancelled
@@ -335,6 +349,12 @@ the enclosing workspace task. The original error and restore safety policy are
unchanged. These lines stay in the instance run log and its configured durable
storage, and are not new first-party telemetry events.
+Native sandbox `environmentSyncOut` errors preserve allowlisted error codes and
+bounded HTTP/exit statuses across worker RPC for this diagnostic line. The host
+revalidates the envelope and keeps the original failure and recovery policy.
+Provider messages, paths, response bodies, credentials, and arbitrary error data
+are not copied into the new envelope. Older workers can still report `unknown`.
+
The optional `step` identifies the failed restore operation. For
`phase=workspace` and `step=git_integration`, `gitCommand` identifies one fixed
command family (`rev_parse`, `symbolic_ref`, `merge_base`, `merge_tree`,
diff --git a/doc/runner-api-tools.md b/doc/runner-api-tools.md
index 62451ba6b2c..a8dd849d49e 100644
--- a/doc/runner-api-tools.md
+++ b/doc/runner-api-tools.md
@@ -1,7 +1,10 @@
# Runner API escape hatch
`search_api` and `call_api` extend the native runner when an available dedicated
-operation cannot express the requested work. Existing tools remain preferred;
+operation cannot express the requested work. Use `set_task_monitor` to schedule or clear a one-shot task check; after confirming
+the receipt, finish with `yielded` and `continuation.kind: "monitor"` to await that
+task’s timer. `call_api` still rejects monitor/execution-policy lifecycle writes.
+Existing tools remain preferred;
agents do not have to search before using them. Only two tool definitions are
advertised. The API catalog is returned on demand, never injected into the
initial prompt.
diff --git a/doc/screenshots/openai-dot-runner/connected.jpg b/doc/screenshots/openai-dot-runner/connected.jpg
new file mode 100644
index 00000000000..458d610bc1f
Binary files /dev/null and b/doc/screenshots/openai-dot-runner/connected.jpg differ
diff --git a/doc/screenshots/openai-dot-runner/experimental-settings.jpg b/doc/screenshots/openai-dot-runner/experimental-settings.jpg
new file mode 100644
index 00000000000..3babb477de0
Binary files /dev/null and b/doc/screenshots/openai-dot-runner/experimental-settings.jpg differ
diff --git a/doc/screenshots/openai-dot-runner/harness.jpg b/doc/screenshots/openai-dot-runner/harness.jpg
new file mode 100644
index 00000000000..5c0377030f3
Binary files /dev/null and b/doc/screenshots/openai-dot-runner/harness.jpg differ
diff --git a/doc/screenshots/openai-dot-runner/pairing.jpg b/doc/screenshots/openai-dot-runner/pairing.jpg
new file mode 100644
index 00000000000..89e81c93254
Binary files /dev/null and b/doc/screenshots/openai-dot-runner/pairing.jpg differ
diff --git a/doc/workspace-restore-locks.md b/doc/workspace-restore-locks.md
index 60a00fc0b7c..62acf88b793 100644
--- a/doc/workspace-restore-locks.md
+++ b/doc/workspace-restore-locks.md
@@ -54,3 +54,46 @@ is safe to remove from its age, an absent PID, or a successful task response.
This change prevents new orphaned ownership. It cannot recover file changes
that an earlier failed collection discarded.
+
+## Required remote restore failures
+
+When a legacy sandbox run cannot copy required workspace files back, the server
+keeps the original allocation for repair. It writes the failed run, the exact
+lease retention intent, and a board-owned repair hold in one transaction. The
+hold survives reassignment and conversation resets and coexists with newer
+recovery incidents; it never supersedes them.
+Cleanup stops that allocation and verifies its provider receipt. It does not
+use ordinary ephemeral destruction or return the source to warm reuse. Stop
+failures use the existing cleanup retry and backoff policy.
+
+The retained source uses `retain_on_failure`. A stopped source can still incur
+provider storage charges. It stays available until an operator recovers or
+explicitly discards it; elapsed time never proves that its files were copied.
+The task's `GET /api/issues/:id/recovery-actions` response lists these repair holds
+alongside any newer active incident, including the original lease IDs. Inspect
+those exact leases through `GET /api/environment-leases/:leaseId`,
+confirm that cleanup stopped them, recover the missing files, and record
+`workspaceRepairEvidence` through the existing recovery-action resolution API.
+Send `POST /api/issues/:id/recovery-actions/resolve` with the exact recovery action
+ID, `outcome: "restored"`, the task's **unchanged**
+`sourceIssueStatus`, and `executionReconciliation` for the recorded source run.
+Only a board operator can record this repair. It preserves the current task
+owner, conversation generation, status, and execution locks. It does not queue a
+continuation or replay the stopped run; after repair, any new work still follows
+the normal admission rules.
+The board currently shows repair guidance and an Inspect run link, not a repair
+form. Recording the decision is an operator API/runbook workflow; the recovery
+API response contains the exact action and lease IDs. Provider access may require
+an instance administrator or Cloud support. This change does not add a repair UI.
+Then use the provider's operator console to remove that exact retained
+allocation when its files are no longer needed. Verify its immutable provider
+allocation ID against the recorded lease before removal. The ordinary reusable
+sandbox cleanup does not select `retain_on_failure` sources; do not use
+environment deletion as proof that this allocation was removed. Keep the
+environment and its provider credentials until recovery is complete. Recording a
+repair decision does not automatically destroy it.
+
+A new message, Retry, or `/new` cannot clear this workspace repair hold. Ordinary
+local lock-timeout retries and runs without a required remote copy-back failure
+keep their existing policy. This change preserves future failures; it cannot
+recover files from an allocation that was already destroyed.
diff --git a/package.json b/package.json
index 59d19e8cca7..d37129f05ed 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,8 @@
"dev:ui": "pnpm --filter @paperclipai/ui dev",
"dev:mobile": "pnpm --filter @paperclipai/ui build && pnpm --filter @paperclipai/ui preview",
"dev:both": "node scripts/dev-both.mjs",
+ "prototype:dot": "pnpm --filter @paperclipai/server exec tsx scripts/dot-runner-demo.ts",
+ "prototype:dot:live": "pnpm --filter @paperclipai/server exec tsx scripts/dot-runner-live.ts",
"storybook": "pnpm --filter @paperclipai/ui storybook",
"build-storybook": "pnpm --filter @paperclipai/ui build-storybook",
"build": "pnpm run preflight:workspace-links && pnpm -r build",
@@ -71,6 +73,7 @@
"test:e2e:runner:models:update": "node cli/node_modules/tsx/dist/cli.mjs tests/runner-e2e/openrouter-models-update.ts",
"test:e2e:runner:history:publish": "node cli/node_modules/tsx/dist/cli.mjs tests/runner-e2e/history-publish.ts",
"test:runner-recovery": "vitest run server/src/services/native-runtime/native-replacement-evidence.test.ts server/src/services/native-runtime/stopped-codex-turn.test.ts server/src/services/native-runtime/native-safe-replacement.test.ts",
+ "test:slack-connector": "node server/src/services/connectors/slack/evals/run-regressions.mjs",
"test:e2e:browser-context": "playwright test --config tests/e2e/playwright-company-context.config.ts",
"test:e2e:runner:browser-support": "playwright test --config tests/runner-e2e/playwright-support.config.ts",
"test:e2e:runner:unit": "vitest run --config tests/runner-e2e/vitest.config.ts && node --test tests/runner-e2e/native-completion-checks.test.mjs tests/runner-e2e/native-completion-git-source.test.mjs tests/runner-e2e/native-completion-source-contract.test.mjs",
diff --git a/packages/adapter-utils/src/connection-failure.test.ts b/packages/adapter-utils/src/connection-failure.test.ts
new file mode 100644
index 00000000000..602e01fd9ec
--- /dev/null
+++ b/packages/adapter-utils/src/connection-failure.test.ts
@@ -0,0 +1,105 @@
+import { describe, expect, it } from "vitest";
+import { readConnectionFailure } from "./connection-failure.js";
+
+describe("readConnectionFailure", () => {
+ const git = { schemaVersion: 1, provider: "git", operation: "clone", reason: "authentication_failed" };
+ const gateway = { schemaVersion: 1, provider: "hermes_gateway", operation: "create_run", reason: "connection_refused" };
+ const mcp = { schemaVersion: 1, provider: "mcp_http", operation: "discover_tools", reason: "connection_refused" };
+
+ it.each([
+ "authentication_failed", "repository_unavailable", "invalid_remote", "dns_failure", "connection_refused",
+ "network_unreachable", "connection_reset", "connection_timeout", "tls_failure", "rate_limited", "remote_unavailable",
+ ])("accepts the Git clone reason %s", (reason) => {
+ const input = { ...git, reason };
+ expect(readConnectionFailure(input)).toEqual(input);
+ });
+
+ it.each(["endpoint_missing", "endpoint_invalid", "insecure_transport", "credentials_missing"])(
+ "accepts the gateway configuration reason %s", (reason) => {
+ const input = { ...gateway, operation: "configuration", reason };
+ expect(readConnectionFailure(input)).toEqual(input);
+ },
+ );
+
+ it.each([
+ "authentication_failed", "endpoint_not_found", "rate_limited", "remote_unavailable", "connection_refused",
+ "dns_failure", "network_unreachable", "connection_reset", "connection_timeout", "tls_failure",
+ ])("accepts the gateway request reason %s", (reason) => {
+ const input = { ...gateway, reason };
+ expect(readConnectionFailure(input)).toEqual(input);
+ });
+
+ it.each([
+ "authentication_failed", "endpoint_not_found", "rate_limited", "remote_unavailable", "connection_refused",
+ "dns_failure", "network_unreachable", "connection_reset", "connection_timeout", "tls_failure",
+ ])("accepts the MCP tool discovery request reason %s", (reason) => {
+ const input = { ...mcp, reason };
+ expect(readConnectionFailure(input)).toEqual(input);
+ });
+
+ it.each([
+ { ...git, operation: "fetch" },
+ { ...git, operation: "create_run" },
+ { ...git, reason: "endpoint_not_found" },
+ { ...gateway, operation: "clone" },
+ { ...gateway, operation: "poll_status" },
+ { ...gateway, operation: "stop_run" },
+ { ...gateway, operation: "configuration" },
+ { ...gateway, reason: "credentials_missing" },
+ { ...gateway, reason: "repository_unavailable" },
+ { ...gateway, reason: "timeout" },
+ { ...gateway, reason: "unknown" },
+ { ...gateway, provider: "other_gateway" },
+ { ...gateway, provider: "hermes_local" },
+ { ...mcp, operation: "create_run" },
+ { ...mcp, operation: "clone" },
+ { ...mcp, operation: "configuration" },
+ { ...mcp, operation: "call_tool" },
+ { ...mcp, reason: "credentials_missing" },
+ { ...mcp, reason: "repository_unavailable" },
+ { ...gateway, operation: "discover_tools" },
+ { ...git, operation: "discover_tools" },
+ ])("rejects an unsupported provider/operation/reason combination: %j", (input) => {
+ expect(readConnectionFailure(input)).toBeNull();
+ });
+
+ it.each([
+ undefined, null, false, 1, "connection_refused", [], [gateway], {},
+ { ...gateway, schemaVersion: 0 }, { ...gateway, schemaVersion: 2 }, { ...gateway, schemaVersion: "1" },
+ { ...gateway, schemaVersion: null }, { ...gateway, schemaVersion: undefined },
+ { ...gateway, provider: null }, { ...gateway, provider: ["hermes_gateway"] },
+ { ...gateway, operation: null }, { ...gateway, operation: 1 },
+ { ...gateway, reason: null }, { ...gateway, reason: 1 }, { ...gateway, reason: ["connection_refused"] },
+ { ...gateway, reason: { code: "ECONNREFUSED" } },
+ { provider: "hermes_gateway", operation: "create_run", reason: "connection_refused" },
+ { ...gateway, reason: "connection_refused " }, { ...gateway, reason: "CONNECTION_REFUSED" },
+ ])("rejects unknown versions or malformed values: %j", (input) => {
+ expect(readConnectionFailure(input)).toBeNull();
+ });
+
+ it.each([
+ { url: "https://private.example.test" },
+ { account: "private-account" },
+ { token: "synthetic-secret" },
+ { remoteRunAccepted: false },
+ { providerWorkStarted: false },
+ { details: { message: "private diagnostics" } },
+ { extra: undefined },
+ ])("rejects extra metadata instead of broadening the bounded marker: %j", (extra) => {
+ expect(readConnectionFailure({ ...gateway, ...extra })).toBeNull();
+ });
+
+ it("rejects unknown own fields even when a prototype supplies a valid descriptor", () => {
+ const input = Object.assign(Object.create(gateway), { a: 1, b: 2, c: 3, d: 4 });
+ expect(readConnectionFailure(input)).toBeNull();
+ });
+
+ it("returns an independent bounded value without mutating its producer's input", () => {
+ const input = Object.freeze({ ...gateway });
+ const output = readConnectionFailure(input);
+ expect(output).toEqual(gateway);
+ expect(output).not.toBe(input);
+ expect(input).toEqual(gateway);
+ expect(Object.keys(output ?? {}).sort()).toEqual(["operation", "provider", "reason", "schemaVersion"]);
+ });
+});
diff --git a/packages/adapter-utils/src/connection-failure.ts b/packages/adapter-utils/src/connection-failure.ts
new file mode 100644
index 00000000000..a5a3e5895d2
--- /dev/null
+++ b/packages/adapter-utils/src/connection-failure.ts
@@ -0,0 +1,58 @@
+/**
+ * A bounded producer-owned explanation of an external connection failure.
+ * This changes error reporting only: it never proves remote acceptance,
+ * authorizes a retry, or turns a failed run into a success.
+ */
+const gitReasons = [
+ "authentication_failed", "repository_unavailable", "invalid_remote",
+ "dns_failure", "connection_refused", "network_unreachable", "connection_reset",
+ "connection_timeout", "tls_failure", "rate_limited", "remote_unavailable",
+] as const;
+const hermesConfigurationReasons = [
+ "endpoint_missing", "endpoint_invalid", "insecure_transport", "credentials_missing",
+] as const;
+const hermesRequestReasons = [
+ "authentication_failed", "endpoint_not_found", "rate_limited", "remote_unavailable",
+ "connection_refused", "dns_failure", "network_unreachable", "connection_reset",
+ "connection_timeout", "tls_failure",
+] as const;
+
+export type GitConnectionFailure = {
+ schemaVersion: 1;
+ provider: "git";
+ operation: "clone";
+ reason: typeof gitReasons[number];
+};
+
+export type ConnectionFailure = GitConnectionFailure | {
+ schemaVersion: 1;
+ provider: "hermes_gateway";
+} & ({
+ operation: "configuration";
+ reason: typeof hermesConfigurationReasons[number];
+} | {
+ operation: "create_run";
+ reason: typeof hermesRequestReasons[number];
+}) | {
+ schemaVersion: 1;
+ provider: "mcp_http";
+ operation: "discover_tools";
+ reason: typeof hermesRequestReasons[number];
+};
+
+/** Unknown versions, combinations and extra payload fields remain reportable. */
+export function readConnectionFailure(value: unknown): ConnectionFailure | null {
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
+ const record = value as Record;
+ const keys = Object.keys(record);
+ if (keys.length !== 4 || !keys.every((key) => ["schemaVersion", "provider", "operation", "reason"].includes(key)) ||
+ record.schemaVersion !== 1 || typeof record.reason !== "string") return null;
+ let reasons: readonly string[];
+ if (record.provider === "git" && record.operation === "clone") reasons = gitReasons;
+ else if (record.provider === "hermes_gateway" && record.operation === "configuration") reasons = hermesConfigurationReasons;
+ else if (record.provider === "hermes_gateway" && record.operation === "create_run") reasons = hermesRequestReasons;
+ else if (record.provider === "mcp_http" && record.operation === "discover_tools") reasons = hermesRequestReasons;
+ else return null;
+ if (!reasons.includes(record.reason)) return null;
+ return { schemaVersion: 1, provider: record.provider, operation: record.operation, reason: record.reason } as ConnectionFailure;
+}
diff --git a/packages/adapter-utils/src/execution-target-sandbox.test.ts b/packages/adapter-utils/src/execution-target-sandbox.test.ts
index 51ab309890f..0655c9f0b26 100644
--- a/packages/adapter-utils/src/execution-target-sandbox.test.ts
+++ b/packages/adapter-utils/src/execution-target-sandbox.test.ts
@@ -1107,6 +1107,7 @@ describe("sandbox adapter execution targets", () => {
// ACP keeps stdin open while it waits for a handshake. A remote child can
// exit before replying; that must close the proxy and fail the handshake.
const output = "final output\n".repeat(16_384);
+ const logs: string[] = [];
const bridge = await startAdapterExecutionTargetProcessSessionBridge({
runId: "run-open-stdin",
target: {
@@ -1124,11 +1125,16 @@ describe("sandbox adapter execution targets", () => {
env: {},
timeoutSec: 10,
streamOutputViaSession,
+ onLog: async (stream, chunk) => { if (stream === "stderr") logs.push(chunk); },
});
expect(bridge).not.toBeNull();
try {
const result = await runProxyWithInput(bridge!.agentCommand, "initialize\n", true);
expect(result.code).toBe(exitCode ?? 1);
+ const terminal = logs.filter((line) => line.includes("ACP process session terminal:"));
+ expect(terminal).toEqual([
+ `[paperclip] ACP process session terminal: source=remote_event outcome=${exitCode === null ? "error" : "exit"} exitCode=${exitCode ?? "unknown"} signal=unknown.\n`,
+ ]);
if (exitCode === null) {
expect(result.stdout).toBe("");
expect(result.stderr).toContain("ENOENT");
@@ -1141,6 +1147,194 @@ describe("sandbox adapter execution targets", () => {
}
}, 15_000);
+ it("flushes remote errors under backpressure and retains only bounded terminal evidence", async () => {
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-terminal-flush-"));
+ cleanupDirs.push(rootDir);
+ const delegate = createLocalSandboxRunner();
+ const logs: string[] = [];
+ let emit!: (frame: string) => Promise;
+ let complete!: () => void;
+ let failInput!: (error: Error) => void;
+ let inputStarted = false;
+ const inputFailure = new Promise((_resolve, reject) => { failInput = reject; });
+ void inputFailure.catch(() => {});
+ const commandComplete = new Promise((resolve) => { complete = resolve; });
+ const frame = {
+ type: "error", message: "synthetic-private-detail".repeat(200_000),
+ code: 1e100, signal: "untrusted-private-signal",
+ };
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
+ runId: "terminal-flush", adapterKey: "acpx", runtimeRootDir: rootDir,
+ target: {
+ kind: "remote", transport: "sandbox", remoteCwd: rootDir,
+ runner: { execute: async (input) => {
+ if (!input.useSession) {
+ const script = input.args?.[1] ?? "";
+ if (script.startsWith("mkdir -p") && script.includes("/stdin/000000000001.json")) {
+ inputStarted = true;
+ return inputFailure;
+ }
+ return delegate.execute(input);
+ }
+ emit = async (text) => { await input.onLog?.("stdout", text); };
+ await commandComplete;
+ return { exitCode: 1, stdout: "", stderr: "", timedOut: false, signal: null, pid: null, startedAt: null };
+ } },
+ },
+ command: "cat", args: [], cwd: rootDir, env: {}, streamOutputViaSession: true,
+ onLog: async (stream, chunk) => { if (stream === "stderr") logs.push(chunk); },
+ });
+ let peer: net.Socket | undefined;
+ try {
+ const source = await readFile(bridge!.agentCommand, "utf8");
+ const port = Number(/port: (\d+)/.exec(source)![1]);
+ const token = JSON.parse(/const token = (".*?");/.exec(source)![1]) as string;
+ peer = net.createConnection({ host: "127.0.0.1", port });
+ peer.on("error", () => {});
+ peer.setEncoding("utf8");
+ let output = "";
+ peer.on("data", (chunk) => { output += chunk; });
+ const closed = new Promise((resolve) => peer!.once("close", resolve));
+ await new Promise((resolve) => peer!.once("connect", resolve));
+ peer.write(JSON.stringify({ token, type: "hello" }) + "\n");
+ // Confirm authentication by receiving a marker before applying backpressure.
+ await emit(JSON.stringify({ type: "data", stream: "stdout", data: "" }) + "\n");
+ await waitForCondition(() => output.length > 0, "Missing authenticated marker.");
+ output = "";
+ peer.write(JSON.stringify({ token, type: "stdin", data: "aW5wdXQ=" }) + "\n");
+ await waitForCondition(() => inputStarted, "Input write did not start.");
+ peer.pause();
+ // The real wrapper emits error then exit when a child fails to spawn.
+ // A later frame must not write after end() and abort the pending error.
+ await emit([
+ frame,
+ { type: "exit", code: 1 },
+ { type: "data", stream: "stdout", data: "bGF0ZQ==" },
+ { type: "shutdownAck" },
+ ].map((event) => JSON.stringify(event) + "\n").join(""));
+ // The reverse race matters too: an already-accepted input write can
+ // reject after the remote error started draining. Its end(data) must
+ // not abort or replace the first terminal frame.
+ failInput(new Error("synthetic-private-input-detail"));
+ await waitForCondition(
+ () => logs.some((line) => line.includes("ACP process session input delivery failed.")),
+ "Input failure was not handled.",
+ );
+ peer.resume();
+ await closed;
+ expect(JSON.parse(output)).toEqual(frame);
+ expect(logs.filter((line) => line.includes("ACP process session terminal:"))).toEqual([
+ "[paperclip] ACP process session terminal: source=remote_event outcome=error exitCode=unknown signal=unknown.\n",
+ ]);
+ } finally {
+ failInput(new Error("test cleanup"));
+ complete();
+ peer?.destroy();
+ await bridge?.stop();
+ }
+ }, 15_000);
+
+ it("reports a streamed transport failure even when diagnostic persistence stalls", async () => {
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-terminal-stream-"));
+ cleanupDirs.push(rootDir);
+ const delegate = createLocalSandboxRunner();
+ const logs: string[] = [];
+ let releaseLog!: () => void;
+ const stalledLog = new Promise((resolve) => { releaseLog = resolve; });
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
+ runId: "terminal-stream", adapterKey: "acpx", runtimeRootDir: rootDir,
+ target: {
+ kind: "remote", transport: "sandbox", remoteCwd: rootDir,
+ runner: { execute: async (input) => {
+ if (input.useSession) throw new Error("synthetic-private-provider-detail");
+ return delegate.execute(input);
+ } },
+ },
+ command: "cat", args: [], cwd: rootDir, env: {}, streamOutputViaSession: true,
+ onLog: async (stream, chunk) => {
+ if (stream === "stderr") { logs.push(chunk); await stalledLog; }
+ },
+ });
+ try {
+ const result = await runProxyWithInput(bridge!.agentCommand, "", true);
+ expect(result.code).toBe(1);
+ expect(logs).toEqual([
+ "[paperclip] ACP process session terminal: source=output_stream outcome=error exitCode=unknown signal=unknown.\n",
+ ]);
+ } finally {
+ releaseLog();
+ await bridge?.stop();
+ }
+ }, 10_000);
+
+ it("closes a failed output poll without waiting for the run log", async () => {
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-terminal-poll-"));
+ cleanupDirs.push(rootDir);
+ const delegate = createLocalSandboxRunner();
+ const logs: string[] = [];
+ let releaseLog!: () => void;
+ const stalledLog = new Promise((resolve) => { releaseLog = resolve; });
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
+ runId: "terminal-poll", adapterKey: "acpx", runtimeRootDir: rootDir,
+ target: {
+ kind: "remote", transport: "sandbox", remoteCwd: rootDir,
+ runner: { execute: async (input) => {
+ const script = input.args?.[1] ?? "";
+ if (script.includes("/events'/*.json")) throw new Error("synthetic-private-provider-detail");
+ return delegate.execute(input);
+ } },
+ },
+ command: "cat", args: [], cwd: rootDir, env: {},
+ onLog: async (stream, chunk) => {
+ if (stream === "stderr") { logs.push(chunk); await stalledLog; }
+ },
+ });
+ try {
+ const result = await runProxyWithInput(bridge!.agentCommand, "", true);
+ expect(result.code).toBe(1);
+ expect(logs).toEqual([
+ "[paperclip] ACP process session terminal: source=output_poll outcome=error exitCode=unknown signal=unknown.\n",
+ ]);
+ } finally {
+ releaseLog();
+ await bridge?.stop();
+ }
+ }, 10_000);
+
+ it("records an unexpected authenticated proxy close once and ignores unauthenticated peers", async () => {
+ const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-terminal-proxy-"));
+ cleanupDirs.push(rootDir);
+ const logs: string[] = [];
+ const bridge = await startAdapterExecutionTargetProcessSessionBridge({
+ runId: "terminal-proxy", adapterKey: "acpx", runtimeRootDir: rootDir,
+ target: { kind: "remote", transport: "sandbox", remoteCwd: rootDir, runner: createLocalSandboxRunner() },
+ command: "cat", args: [], cwd: rootDir, env: {},
+ onLog: async (stream, chunk) => { if (stream === "stderr") logs.push(chunk); },
+ });
+ try {
+ const source = await readFile(bridge!.agentCommand, "utf8");
+ const port = Number(/port: (\d+)/.exec(source)![1]);
+ const token = JSON.parse(/const token = (".*?");/.exec(source)![1]) as string;
+ for (const authenticated of [false, true]) {
+ const peer = net.createConnection({ host: "127.0.0.1", port });
+ peer.on("error", () => {});
+ const closed = new Promise((resolve) => peer.once("close", resolve));
+ await new Promise((resolve) => peer.once("connect", resolve));
+ if (authenticated) peer.end(JSON.stringify({ token, type: "hello" }) + "\n");
+ else peer.end();
+ await closed;
+ if (!authenticated) expect(logs).toEqual([]);
+ }
+ await waitForCondition(() => logs.length === 1, "Missing proxy-close diagnostic.");
+ await bridge!.stop();
+ expect(logs.filter((line) => line.includes("ACP process session terminal:"))).toEqual([
+ "[paperclip] ACP process session terminal: source=proxy_close outcome=error exitCode=unknown signal=unknown.\n",
+ ]);
+ } finally {
+ await bridge?.stop();
+ }
+ }, 10_000);
+
it("buffers sandbox process session output until the local proxy connects", async () => {
const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-process-session-buffer-"));
cleanupDirs.push(rootDir);
diff --git a/packages/adapter-utils/src/execution-target.ts b/packages/adapter-utils/src/execution-target.ts
index 73b841d9833..c70c02d7b91 100644
--- a/packages/adapter-utils/src/execution-target.ts
+++ b/packages/adapter-utils/src/execution-target.ts
@@ -2170,6 +2170,26 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
}
};
let pollTimer: NodeJS.Timeout | null = null;
+ let terminalEvidenceRecorded = false;
+ const recordTerminalEvidence = (
+ source: "remote_event" | "input_delivery" | "output_poll" | "output_stream" | "proxy_close",
+ event: { type?: string; code?: number | null; signal?: string | null },
+ ) => {
+ if (terminalEvidenceRecorded) return;
+ terminalEvidenceRecorded = true;
+ // Remote frames are untrusted. Keep the retained diagnostic bounded and
+ // independent of messages, commands, paths, payloads, and provider errors.
+ const outcome = event.type === "exit" ? "exit" : "error";
+ const code = typeof event.code === "number" && Number.isInteger(event.code)
+ && event.code >= 0 && event.code <= 255 ? event.code : "unknown";
+ const signal = typeof event.signal === "string" && [
+ "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", "SIGFPE", "SIGKILL",
+ "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGBUS", "SIGXCPU", "SIGXFSZ",
+ ].includes(event.signal) ? event.signal : "unknown";
+ logFailureWithoutWaiting(
+ `[paperclip] ACP process session terminal: source=${source} outcome=${outcome} exitCode=${code} signal=${signal}.\n`,
+ );
+ };
const pendingRemoteEvents: Array<{
type?: string;
stream?: "stdout" | "stderr";
@@ -2196,22 +2216,30 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
const writeRemoteEventToSocket = (event: (typeof pendingRemoteEvents)[number]) => {
if (!socket) return false;
+ // `stopping` can already be set by a terminal frame buffered before auth.
+ // Use the socket's outbound state instead: once end() has been called,
+ // another write would destroy it and truncate the frame still draining.
+ // This also covers input-delivery failure, which ends the socket directly.
+ if (socket.writableEnded || socket.destroyed) return true;
socket.write(jsonLine(event));
- if (event.type === "exit") {
+ if (event.type === "exit" || event.type === "error") {
stopping = true;
+ // Flush the terminal frame and all earlier output before closing. An
+ // immediate destroy can discard the cause and leave only connection_close.
socket.end();
- } else if (event.type === "error") {
- stopping = true;
- socket.destroy();
}
return true;
};
- const deliverRemoteEvent = (event: (typeof pendingRemoteEvents)[number]) => {
+ const deliverRemoteEvent = (
+ event: (typeof pendingRemoteEvents)[number],
+ source: "remote_event" | "output_poll" | "output_stream" = "remote_event",
+ ) => {
if (event.type === "shutdownAck") {
signalShutdownAcknowledged();
return;
}
+ if (event.type === "exit" || event.type === "error") recordTerminalEvidence(source, event);
if (socket) {
writeRemoteEventToSocket(event);
return;
@@ -2253,6 +2281,7 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
nextSocket.on("close", () => {
clearTimeout(authTimer);
liveSockets.delete(nextSocket);
+ if (authenticated && !stopping) recordTerminalEvidence("proxy_close", { type: "error" });
});
nextSocket.on("data", (chunk) => {
connectionBuffer += chunk;
@@ -2309,11 +2338,17 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
} catch {
stdinDeliveryFailed = true;
stopping = true;
+ recordTerminalEvidence("input_delivery", { type: "error" });
const message = "ACP process session input delivery failed.";
// Flush the diagnostic before closing; destroy() can discard it
// and leave only ACP's generic connection_close error. Do not
// expose provider error text, which may contain a command payload.
- nextSocket.end(jsonLine({ type: "error", message }));
+ // A remote terminal frame may already be draining while this
+ // accepted stdin write fails. end(data) would write after end
+ // and discard that first failure just like socket.write(data).
+ if (!nextSocket.writableEnded && !nextSocket.destroyed) {
+ nextSocket.end(jsonLine({ type: "error", message }));
+ }
// stop() awaits this input chain before sending shutdown. Run-log
// persistence must not hold teardown open when it stalls or fails.
logFailureWithoutWaiting(`[paperclip] ${message}\n`);
@@ -2345,8 +2380,8 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
}
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
- await onLog("stderr", `[paperclip] ACP process session bridge poll failed: ${message}\n`);
- deliverRemoteEvent({ type: "error", message });
+ // A stuck log sink must not strand the adapter waiting for this failure.
+ deliverRemoteEvent({ type: "error", message }, "output_poll");
return;
} finally {
if (!stopping) {
@@ -2472,14 +2507,15 @@ export async function startAdapterExecutionTargetProcessSessionBridge(input: {
deliverRemoteEvent({
type: "exit",
code: typeof result.exitCode === "number" ? result.exitCode : null,
- });
+ signal: result.signal,
+ }, "output_stream");
}
} catch (error) {
if (!stopping) {
deliverRemoteEvent({
type: "error",
message: error instanceof Error ? error.message : String(error),
- });
+ }, "output_stream");
}
}
})();
diff --git a/packages/adapter-utils/src/paperclip-runner-permissions.ts b/packages/adapter-utils/src/paperclip-runner-permissions.ts
index 90b1b138872..68e126a8b1e 100644
--- a/packages/adapter-utils/src/paperclip-runner-permissions.ts
+++ b/packages/adapter-utils/src/paperclip-runner-permissions.ts
@@ -1,5 +1,5 @@
export type PaperclipRunnerProvider =
- "codex" | "opencode" | "claude_managed" | "aws_agentcore" | "acpx";
+ "codex" | "opencode" | "claude_managed" | "aws_agentcore" | "acpx" | "openai_dot";
export type CodexPermissionMode = "never" | "on-request" | "untrusted";
export type OpenCodePermissionMode = "allow" | "ask" | "deny";
@@ -103,6 +103,7 @@ export const PAPERCLIP_RUNNER_PERMISSION_CAPABILITIES = {
description:
"AWS AgentCore runs non-interactively under its qualified harness profile and Paperclip policy.",
},
+ openai_dot: { configurable: false, defaultMode: "provider-managed", options: [], description: "Dot uses the admitted Paperclip tool catalog. OpenAI manages its model and other tools; provider usage and global interruption are unavailable." },
acpx: {
configurable: true,
configKey: "acpxPermissionMode",
@@ -147,7 +148,7 @@ export function isPaperclipRunnerProvider(
value === "opencode" ||
value === "claude_managed" ||
value === "aws_agentcore" ||
- value === "acpx"
+ value === "acpx" || value === "openai_dot"
);
}
diff --git a/packages/adapter-utils/src/server-utils.test.ts b/packages/adapter-utils/src/server-utils.test.ts
index f2ea940969b..068486bc9f2 100644
--- a/packages/adapter-utils/src/server-utils.test.ts
+++ b/packages/adapter-utils/src/server-utils.test.ts
@@ -935,6 +935,20 @@ describe("runChildProcess", () => {
});
describe("renderPaperclipWakePrompt", () => {
+ it.each([false, true])("renders the runtime checkout flag for ordinary task wakes (resume=%s)", resumedSession => {
+ const payload = { reason: "issue_assigned", issue: { id: "issue-1", status: "in_progress" },
+ comments: [], commentWindow: { requestedCount: 0, includedCount: 0, missingCount: 0 },
+ fallbackFetchNeeded: false };
+ const claimed = renderPaperclipWakePrompt({ ...payload, checkedOutByHarness: true }, { resumedSession });
+ expect(claimed).toContain(resumedSession ? "checkout: already claimed by the harness for this run" :
+ "The harness already checked out this issue for the current run.");
+ for (const checkedOutByHarness of [false, undefined]) {
+ const unclaimed = renderPaperclipWakePrompt({ ...payload, checkedOutByHarness }, { resumedSession });
+ expect(unclaimed).not.toContain("checkout: already claimed");
+ expect(unclaimed).not.toContain("The harness already checked out this issue for the current run.");
+ }
+ });
+
it("leaves conversation disposition and accepted-plan handoff to the injected chat policy", () => {
const payload = {
reason: "issue_commented",
@@ -1131,6 +1145,7 @@ describe("renderPaperclipWakePrompt", () => {
);
expect(prompt).toContain("server-authenticated github chat turn");
expect(prompt).toContain("Make zero Paperclip API calls");
+ expect(prompt).toContain("text answer that does not require structured human input");
expect(prompt).toContain("answer directly");
expect(prompt).toContain("exactly one semantic completion");
expect(prompt).toContain("summary is the user-visible final answer");
diff --git a/packages/adapter-utils/src/server-utils.ts b/packages/adapter-utils/src/server-utils.ts
index d4acfa8698a..32f52368c77 100644
--- a/packages/adapter-utils/src/server-utils.ts
+++ b/packages/adapter-utils/src/server-utils.ts
@@ -2384,10 +2384,10 @@ function renderPaperclipWakePromptBody(
...(externalChatReaderTurn
? [
"The inline comment batch is incomplete. Before answering, call `read_current_wake_comments` without a cursor, then pass each returned `nextCursor` until `complete` is true. That closed reader exposes only the exact comments accepted for this run. Attachment entries marked `metadata_only` are not readable bytes; state that limitation instead of inferring their contents.",
- "After the complete read, answer every accepted comment in order. Make zero other Paperclip API calls: do not fetch broader task history, inbox, status, artifacts, workspace, or provider connections; do not post progress or completion comments; do not write task status; and do not check out the issue again.",
+ "After the complete read, answer every accepted comment in order. For a text answer that does not require structured human input, use the supplied context. Make zero other Paperclip API calls: do not fetch broader task history, inbox, status, artifacts, workspace, or provider connections; do not post progress or completion comments; do not write task status; and do not check out the issue again.",
]
: [
- "For a self-contained text request, answer directly from the supplied task and wake context. Make zero Paperclip API calls: do not refetch the issue, inbox, status, artifacts, workspace, or provider connections; do not post progress or completion comments; do not write task status; and do not check out the issue again.",
+ "For a self-contained text answer that does not require structured human input, answer directly from the supplied task and wake context. Make zero Paperclip API calls: do not refetch the issue, inbox, status, artifacts, workspace, or provider connections; do not post progress or completion comments; do not write task status; and do not check out the issue again.",
]),
"The harness owns task state and persists your final assistant response. If the runtime offers a semantic completion operation, emit exactly one semantic completion and do not duplicate that response in a Paperclip comment or status update.",
"The semantic completion summary is the user-visible final answer. Include every requested answer, exact value, description, and any actionable file-access or delivery limitation there; a statement that you read, checked, or prepared something is not a substitute. Private progress commentary is not delivered as the final answer.",
@@ -4263,6 +4263,9 @@ export function normalizePaperclipRunnerAdapterConfig(
): Record {
if (adapterType !== "paperclip_runner") return config;
config = normalizeLegacyRunnerProvider(config);
+ if (config.provider === "openai_dot") {
+ return normalizePaperclipOperationalSkillPreference(adapterType, { lifecycleMode: "per_turn", ...config });
+ }
const next: Record = {
provider: "codex",
codexPermissionMode:
diff --git a/packages/adapters/codex-local/src/index.test.ts b/packages/adapters/codex-local/src/index.test.ts
index 5269c9b0174..fcb53825d60 100644
--- a/packages/adapters/codex-local/src/index.test.ts
+++ b/packages/adapters/codex-local/src/index.test.ts
@@ -1,12 +1,58 @@
import { describe, expect, it } from "vitest";
import {
+ CODEX_CHATGPT_MODEL_REJECTION_RE,
+ codexCliVersionAtLeast,
codexLocalReasoningEffortsForModel,
DEFAULT_CODEX_LOCAL_MODEL,
isCodexLocalFastModeSupported,
+ minimumCodexCliVersionForModel,
models,
normalizeCodexModel,
+ parseCodexCliVersionOutput,
} from "./index.js";
+describe("codex model CLI floors", () => {
+ it("records the oldest Codex CLI verified to run each gated model with ChatGPT sign-in", () => {
+ expect(minimumCodexCliVersionForModel("gpt-6.1-sol")).toBe("0.159.0");
+ expect(minimumCodexCliVersionForModel(" gpt-6.1-sol ")).toBe("0.159.0");
+ expect(minimumCodexCliVersionForModel("gpt-6-sol")).toBe("0.157.0");
+ expect(minimumCodexCliVersionForModel("gpt-6-luna")).toBe("0.157.0");
+ });
+
+ it.each([DEFAULT_CODEX_LOCAL_MODEL, "gpt-5.6", "gpt-6-astra", "gpt-5.5", "custom-model", "", null, undefined])(
+ "has no floor for %s so callers skip the version probe", (model) => {
+ expect(minimumCodexCliVersionForModel(model)).toBeNull();
+ },
+ );
+
+ it("compares stable versions numerically and rejects prerelease or ambiguous input", () => {
+ expect(codexCliVersionAtLeast("0.159.0", "0.159.0")).toBe(true);
+ expect(codexCliVersionAtLeast("0.160.1", "0.159.0")).toBe(true);
+ expect(codexCliVersionAtLeast("1.0.0", "0.159.0")).toBe(true);
+ expect(codexCliVersionAtLeast("0.156.1", "0.159.0")).toBe(false);
+ expect(codexCliVersionAtLeast("0.16.0", "0.159.0")).toBe(false);
+ expect(codexCliVersionAtLeast("0.160.0-alpha.1", "0.159.0")).toBe(false);
+ expect(codexCliVersionAtLeast("", "0.159.0")).toBe(false);
+ });
+
+ it("parses only a single stable `codex-cli x.y.z` line from --version output", () => {
+ expect(parseCodexCliVersionOutput("codex-cli 0.160.0\n")).toBe("0.160.0");
+ expect(parseCodexCliVersionOutput("WARNING: PATH unchanged\r\ncodex-cli 0.156.0\r\n")).toBe("0.156.0");
+ expect(parseCodexCliVersionOutput("codex-cli 0.162.0-alpha.17")).toBeNull();
+ expect(parseCodexCliVersionOutput("codex 0.160.0")).toBeNull();
+ expect(parseCodexCliVersionOutput("codex-cli 0.149.0\ncodex-cli 0.160.0")).toBeNull();
+ expect(parseCodexCliVersionOutput("")).toBeNull();
+ });
+
+ it("matches the backend's ChatGPT model rejection and captures the model", () => {
+ const match = CODEX_CHATGPT_MODEL_REJECTION_RE.exec(
+ "{\"type\":\"error\",\"status\":400,\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account.\"}}",
+ );
+ expect(match?.[1]).toBe("gpt-6.1-sol");
+ expect(CODEX_CHATGPT_MODEL_REJECTION_RE.test("Model metadata for `gpt-6.1-sol` not found")).toBe(false);
+ });
+});
+
describe("codex local adapter metadata", () => {
it("advertises current Codex-capable OpenAI models without changing the default", () => {
const modelIds = models.map((model) => model.id);
diff --git a/packages/adapters/codex-local/src/index.ts b/packages/adapters/codex-local/src/index.ts
index f1036a67828..0ffe729b928 100644
--- a/packages/adapters/codex-local/src/index.ts
+++ b/packages/adapters/codex-local/src/index.ts
@@ -85,6 +85,60 @@ export function codexLocalReasoningEffortsForModel(
}
}
+// The Codex backend accepts a model for ChatGPT sign-in only from a client that identifies as a
+// recent enough CLI (the request carries the CLI version). An older `codex` fails every turn with
+// "The '' model is not supported when using Codex with a ChatGPT account.", which reads
+// like an account problem when it is really a stale install, typically a sandbox image baked
+// before the catalog gained the model. Record the oldest stable release verified to work so the
+// Test and the remote runner can name the actual gap. Omit models with no verified floor; the
+// install pin in the runner and images is always at or above every floor listed here.
+const CODEX_LOCAL_MODEL_MINIMUM_CLI_VERSIONS: Readonly> = {
+ // 0.156.1 and older are rejected (openai/codex#49396); 0.159.0 and 0.159.2 are accepted
+ // (openai/codex#49464). No stable release between those was verified either way.
+ "gpt-6.1-sol": "0.159.0",
+ // Codex 0.157.0 release notes: "Add GPT-6 Sol and Luna to the model catalog".
+ "gpt-6-sol": "0.157.0",
+ "gpt-6-luna": "0.157.0",
+};
+
+export function minimumCodexCliVersionForModel(model: string | null | undefined): string | null {
+ return CODEX_LOCAL_MODEL_MINIMUM_CLI_VERSIONS[normalizeCodexModel(model)] ?? null;
+}
+
+const STABLE_CODEX_CLI_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
+
+function stableCodexCliVersionParts(version: string): number[] | null {
+ const match = STABLE_CODEX_CLI_VERSION.exec(version.trim());
+ if (!match) return null;
+ const parts = match.slice(1).map(Number);
+ return parts.every(Number.isSafeInteger) ? parts : null;
+}
+
+/** Read the version from `codex --version` output; prerelease or ambiguous output yields null. */
+export function parseCodexCliVersionOutput(output: string): string | null {
+ const versions = output
+ .split(/\r?\n/)
+ .map((line) => /^codex-cli (\S+)$/.exec(line.trim())?.[1])
+ .filter((version): version is string => version !== undefined);
+ if (versions.length !== 1 || !stableCodexCliVersionParts(versions[0]!)) return null;
+ return versions[0]!;
+}
+
+export function codexCliVersionAtLeast(version: string, minimum: string): boolean {
+ const parsedVersion = stableCodexCliVersionParts(version);
+ const parsedMinimum = stableCodexCliVersionParts(minimum);
+ if (!parsedVersion || !parsedMinimum) return false;
+ for (let index = 0; index < parsedMinimum.length; index += 1) {
+ if (parsedVersion[index] !== parsedMinimum[index]) {
+ return parsedVersion[index]! > parsedMinimum[index]!;
+ }
+ }
+ return true;
+}
+
+export const CODEX_CHATGPT_MODEL_REJECTION_RE =
+ /The '([^']+)' model is not supported when using Codex with a ChatGPT account\./;
+
export function isCodexLocalKnownModel(model: string | null | undefined): boolean {
const normalizedModel = normalizeModelId(model);
if (!normalizedModel) return false;
@@ -175,6 +229,7 @@ Notes:
- Paperclip injects desired local skills into the effective CODEX_HOME/skills/ directory at execution time so Codex can discover "$paperclip" and related skills without polluting the project working directory. For new and updated agents, Paperclip assigns an isolated managed home at ~/.paperclip/instances//companies//agents//codex-home/skills/; when CODEX_HOME is explicitly overridden in adapter config, that override is used instead.
- New and updated codex_local agents persist an empty OPENAI_API_KEY override by default so a host-level OPENAI_API_KEY cannot leak into Codex runs through process inheritance. Explicit CODEX_HOME overrides must not point at the shared company codex-home, $CODEX_HOME, or ~/.codex.
- Some model/tool combinations reject certain effort levels (for example minimal with web search enabled).
+- With ChatGPT sign-in, the Codex backend accepts a model only from a recent enough Codex CLI: GPT-6.1 Sol needs 0.159.0 or newer, GPT-6 Sol and GPT-6 Luna need 0.157.0 or newer. An older CLI fails every turn with "The '' model is not supported when using Codex with a ChatGPT account." The environment Test and the remote runner compare the installed \`codex --version\` against these floors before running; in a managed sandbox, the fix is a sandbox image that ships the Codex version Paperclip pins.
- Fast mode is supported on GPT-6 (astra/sol/luna), GPT-6.1 Sol, GPT-5.6 (sol/terra/luna), GPT-5.5, GPT-5.4 and manual model IDs. When enabled for those models, Paperclip applies \`service_tier="fast"\` and \`features.fast_mode=true\`.
- When Paperclip realizes a workspace/runtime for a run, it injects PAPERCLIP_WORKSPACE_* and PAPERCLIP_RUNTIME_* env vars for agent-side tooling.
- The ACP engine keeps its workspace sandbox and enables network access on each turn. Explicit sandbox_workspace_write.network_access overrides in extraArgs (or env.PAPERCLIP_CODEX_ACP_NETWORK_ACCESS="false") disable it; execution-target network denial wins. The bundled ACP patch is needed because upstream mode presets override Codex config.toml on every turn.
diff --git a/packages/adapters/codex-local/src/server/acp.cli-version.test.ts b/packages/adapters/codex-local/src/server/acp.cli-version.test.ts
new file mode 100644
index 00000000000..0ed7dce3a5f
--- /dev/null
+++ b/packages/adapters/codex-local/src/server/acp.cli-version.test.ts
@@ -0,0 +1,182 @@
+import fs from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { AdapterExecutionTarget } from "@paperclipai/adapter-utils/execution-target";
+
+const { ensureAdapterExecutionTargetCommandResolvable, runAdapterExecutionTargetProcess } = vi.hoisted(() => ({
+ ensureAdapterExecutionTargetCommandResolvable: vi.fn(async () => {}),
+ runAdapterExecutionTargetProcess: vi.fn(async () => ({
+ exitCode: 0,
+ signal: null,
+ timedOut: false,
+ stdout: "codex-cli 0.156.0\n",
+ stderr: "",
+ pid: 1,
+ startedAt: new Date().toISOString(),
+ })),
+}));
+
+vi.mock("@paperclipai/adapter-utils/execution-target", async () => {
+ const actual = await vi.importActual(
+ "@paperclipai/adapter-utils/execution-target",
+ );
+ return { ...actual, ensureAdapterExecutionTargetCommandResolvable, runAdapterExecutionTargetProcess };
+});
+
+import { testCodexAcpEnvironment } from "./acp.js";
+
+describe("codex ACP lane model CLI floor", () => {
+ let cwd: string;
+
+ beforeEach(async () => {
+ cwd = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-codex-acp-version-"));
+ vi.stubEnv("CODEX_HOME", await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-codex-acp-home-")));
+ vi.stubEnv("PAPERCLIP_HOME", await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-codex-acp-instance-")));
+ vi.stubEnv("PAPERCLIP_INSTANCE_ID", "default");
+ });
+
+ afterEach(async () => {
+ vi.clearAllMocks();
+ vi.unstubAllEnvs();
+ await fs.rm(cwd, { recursive: true, force: true }).catch(() => undefined);
+ });
+
+ function sandboxTarget(): AdapterExecutionTarget {
+ return {
+ kind: "remote",
+ transport: "sandbox",
+ providerKey: "daytona",
+ remoteCwd: "/remote/workspace",
+ runner: {
+ execute: async () => ({
+ exitCode: 0,
+ signal: null,
+ timedOut: false,
+ stdout: "",
+ stderr: "",
+ pid: null,
+ startedAt: new Date().toISOString(),
+ }),
+ },
+ };
+ }
+
+ it("fails the sandbox Test when the shared codex is older than the model's floor", async () => {
+ const result = await testCodexAcpEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { cwd, model: "gpt-6.1-sol", env: { OPENAI_API_KEY: "sk-test" } },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("fail");
+ expect(result.checks.find((check) => check.code === "codex_cli_version_incompatible")).toMatchObject({
+ level: "error",
+ message: "gpt-6.1-sol requires Codex CLI 0.159.0 or newer with ChatGPT sign-in.",
+ detail: "Detected Codex CLI 0.156.0.",
+ });
+ expect(runAdapterExecutionTargetProcess).toHaveBeenCalledTimes(1);
+ const call = runAdapterExecutionTargetProcess.mock.calls[0] as unknown as [
+ string,
+ AdapterExecutionTarget,
+ string,
+ string[],
+ { env: Record },
+ ];
+ expect(call[1]).toMatchObject({ kind: "remote", transport: "sandbox" });
+ expect(call[2]).toBe("codex");
+ expect(call[3]).toEqual(["--version"]);
+ expect(call[4].env).toEqual({ OPENAI_API_KEY: "sk-test" });
+ });
+
+ it("probes the codex the agent's configured env selects, not the image default", async () => {
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce({
+ exitCode: 0,
+ signal: null,
+ timedOut: false,
+ stdout: "codex-cli 0.160.0\n",
+ stderr: "",
+ pid: 1,
+ startedAt: new Date().toISOString(),
+ });
+
+ const result = await testCodexAcpEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: {
+ cwd,
+ model: "gpt-6.1-sol",
+ env: {
+ OPENAI_API_KEY: "sk-test",
+ PATH: "/opt/codex-0.160.0/bin:/usr/local/bin:/usr/bin",
+ CODEX_HOME: "/remote/codex-home",
+ PAPERCLIP_CODEX_ACP_NETWORK_ACCESS: false,
+ },
+ },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("pass");
+ expect(result.checks.find((check) => check.code === "codex_cli_version_compatible")).toMatchObject({
+ message: "Codex CLI 0.160.0 satisfies the 0.159.0 minimum for gpt-6.1-sol.",
+ });
+ expect(runAdapterExecutionTargetProcess).toHaveBeenCalledTimes(1);
+ const call = runAdapterExecutionTargetProcess.mock.calls[0] as unknown as [
+ string,
+ AdapterExecutionTarget,
+ string,
+ string[],
+ { env: Record },
+ ];
+ expect(call[3]).toEqual(["--version"]);
+ // String-valued entries are forwarded exactly as the ACP run receives them;
+ // non-string values are dropped the same way buildCodexAcpConfig consumers do.
+ expect(call[4].env).toEqual({
+ OPENAI_API_KEY: "sk-test",
+ PATH: "/opt/codex-0.160.0/bin:/usr/local/bin:/usr/bin",
+ CODEX_HOME: "/remote/codex-home",
+ });
+ });
+
+ it("passes the sandbox Test when the shared codex satisfies the floor", async () => {
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce({
+ exitCode: 0,
+ signal: null,
+ timedOut: false,
+ stdout: "codex-cli 0.160.0\n",
+ stderr: "",
+ pid: 1,
+ startedAt: new Date().toISOString(),
+ });
+
+ const result = await testCodexAcpEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { cwd, model: "gpt-6.1-sol", env: { OPENAI_API_KEY: "sk-test" } },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("pass");
+ expect(result.checks.find((check) => check.code === "codex_cli_version_compatible")).toMatchObject({
+ message: "Codex CLI 0.160.0 satisfies the 0.159.0 minimum for gpt-6.1-sol.",
+ });
+ });
+
+ it("does not probe the sandbox for models without a verified floor", async () => {
+ const result = await testCodexAcpEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { cwd, model: "gpt-5.6-sol", env: { OPENAI_API_KEY: "sk-test" } },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("pass");
+ expect(runAdapterExecutionTargetProcess).not.toHaveBeenCalled();
+ expect(result.checks.some((check) => check.code.startsWith("codex_cli_version_"))).toBe(false);
+ });
+});
diff --git a/packages/adapters/codex-local/src/server/acp.ts b/packages/adapters/codex-local/src/server/acp.ts
index 7eb2b87bfd6..ed57d8aa983 100644
--- a/packages/adapters/codex-local/src/server/acp.ts
+++ b/packages/adapters/codex-local/src/server/acp.ts
@@ -49,6 +49,7 @@ import {
stageCodexHomeForSync,
} from "./codex-home.js";
import { ADAPTER_AUTH_MISSING_CHECK_CODE } from "./auth-check.js";
+import { checkCodexCliVersionForModel } from "./cli-version.js";
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
const packageRootDir = path.resolve(moduleDir, "../..");
@@ -648,6 +649,32 @@ export async function testCodexAcpEnvironment(
}
}
+ if (targetIsRemote && commandResolvable) {
+ // The ACP server spawns the shared `codex` installed in the environment.
+ // Models with a verified CLI floor are checked against that executable so
+ // a stale sandbox image is named here, before a run fails on every turn
+ // with the backend's "not supported when using Codex with a ChatGPT
+ // account" rejection. Models without a floor skip the probe.
+ //
+ // Remote ACP runs receive the adapter's string-valued env entries (see
+ // buildCodexAcpConfig), so the probe gets the same ones. An agent that
+ // selects its Codex install through PATH is then measured against that
+ // install rather than the image default.
+ const probeEnv: Record = {};
+ for (const [key, value] of Object.entries(envConfig)) {
+ if (typeof value === "string") probeEnv[key] = value;
+ }
+ const versionCheck = await checkCodexCliVersionForModel({
+ runId: `codex-acp-envtest-${Date.now()}-${Math.random().toString(16).slice(2)}`,
+ model: asString(config.model, ""),
+ command: "codex",
+ target,
+ cwd: resolveAdapterExecutionTargetCwd(target, asString(config.cwd, ""), process.cwd()),
+ env: probeEnv,
+ });
+ if (versionCheck) checks.push(versionCheck.check);
+ }
+
const mode = firstNonEmptyString(config.mode, config.acpMode) ?? DEFAULT_ACP_ENGINE_MODE;
const warmHandleIdleMs = asNumber(
config.warmHandleIdleMs ?? config.acpWarmHandleIdleMs,
diff --git a/packages/adapters/codex-local/src/server/cli-version.ts b/packages/adapters/codex-local/src/server/cli-version.ts
new file mode 100644
index 00000000000..aaafc9479af
--- /dev/null
+++ b/packages/adapters/codex-local/src/server/cli-version.ts
@@ -0,0 +1,125 @@
+import type { AdapterEnvironmentCheck } from "@paperclipai/adapter-utils";
+import type { AdapterExecutionTarget } from "@paperclipai/adapter-utils/execution-target";
+import { runAdapterExecutionTargetProcess } from "@paperclipai/adapter-utils/execution-target";
+import {
+ CODEX_CHATGPT_MODEL_REJECTION_RE,
+ codexCliVersionAtLeast,
+ minimumCodexCliVersionForModel,
+ normalizeCodexModel,
+ parseCodexCliVersionOutput,
+} from "../index.js";
+
+export const CODEX_CLI_VERSION_INCOMPATIBLE_CHECK_CODE = "codex_cli_version_incompatible";
+export const CODEX_CLI_VERSION_COMPATIBLE_CHECK_CODE = "codex_cli_version_compatible";
+export const CODEX_HELLO_PROBE_MODEL_REJECTED_CHECK_CODE = "codex_hello_probe_model_rejected";
+
+/**
+ * Run `codex --version` where the run would execute it. Never cached: an
+ * operator may upgrade Codex, or promote a new sandbox image, while the
+ * Paperclip server keeps running, and the next Test should see the change.
+ */
+export async function readCodexCommandVersion(input: {
+ runId: string;
+ command: string;
+ target: AdapterExecutionTarget | null | undefined;
+ cwd: string;
+ env: Record;
+}): Promise {
+ try {
+ const result = await runAdapterExecutionTargetProcess(
+ input.runId,
+ input.target,
+ input.command,
+ ["--version"],
+ {
+ cwd: input.cwd,
+ env: input.env,
+ timeoutSec: 20,
+ graceSec: 5,
+ onLog: async () => {},
+ },
+ );
+ if (result.timedOut || result.exitCode !== 0) return null;
+ return parseCodexCliVersionOutput(`${result.stdout}\n${result.stderr}`);
+ } catch {
+ return null;
+ }
+}
+
+function sandboxUpgradeHint(targetIsSandbox: boolean): string {
+ return targetIsSandbox
+ ? "Promote a sandbox image that ships the Codex CLI version Paperclip pins, then retry the Test. Adding a model to the catalog does not update the Codex CLI baked into existing sandbox images."
+ : "Upgrade Codex (for example `npm install -g @openai/codex@latest`) where this agent runs, then retry the Test.";
+}
+
+/**
+ * Compare the installed Codex CLI with the floor the configured model needs
+ * for ChatGPT sign-in. Returns null when the model has no verified floor, so
+ * callers skip the version probe entirely for such models.
+ */
+export async function checkCodexCliVersionForModel(input: {
+ runId: string;
+ model: string | null | undefined;
+ command: string;
+ target: AdapterExecutionTarget | null | undefined;
+ cwd: string;
+ env: Record;
+}): Promise<{ check: AdapterEnvironmentCheck; compatible: boolean; detectedVersion: string | null } | null> {
+ const minimum = minimumCodexCliVersionForModel(input.model);
+ if (!minimum) return null;
+ const model = normalizeCodexModel(input.model);
+ const targetIsSandbox = input.target?.kind === "remote" && input.target.transport === "sandbox";
+ const detected = await readCodexCommandVersion(input);
+ if (detected && codexCliVersionAtLeast(detected, minimum)) {
+ return {
+ compatible: true,
+ detectedVersion: detected,
+ check: {
+ code: CODEX_CLI_VERSION_COMPATIBLE_CHECK_CODE,
+ level: "info",
+ message: `Codex CLI ${detected} satisfies the ${minimum} minimum for ${model}.`,
+ },
+ };
+ }
+ return {
+ compatible: false,
+ detectedVersion: detected,
+ check: {
+ code: CODEX_CLI_VERSION_INCOMPATIBLE_CHECK_CODE,
+ level: "error",
+ message: `${model} requires Codex CLI ${minimum} or newer with ChatGPT sign-in.`,
+ detail: detected
+ ? `Detected Codex CLI ${detected}.`
+ : "Could not determine the installed Codex CLI version from `codex --version`.",
+ hint: sandboxUpgradeHint(targetIsSandbox),
+ },
+ };
+}
+
+/**
+ * The backend rejects a model for ChatGPT sign-in with one fixed sentence.
+ * Map it to a dedicated check so the cause (stale CLI, or a plan that does
+ * not include the model) is named instead of a generic probe failure.
+ */
+export function codexHelloProbeModelRejectionCheck(input: {
+ evidence: string;
+ detectedVersion: string | null;
+ targetIsSandbox: boolean;
+}): AdapterEnvironmentCheck | null {
+ const match = CODEX_CHATGPT_MODEL_REJECTION_RE.exec(input.evidence);
+ if (!match) return null;
+ const model = match[1]!;
+ const minimum = minimumCodexCliVersionForModel(model);
+ const versionNote = input.detectedVersion
+ ? ` Detected Codex CLI ${input.detectedVersion}.`
+ : "";
+ return {
+ code: CODEX_HELLO_PROBE_MODEL_REJECTED_CHECK_CODE,
+ level: "error",
+ message: `The Codex backend rejected ${model} for this ChatGPT account.`,
+ detail: `${match[0]}${versionNote}`,
+ hint: minimum
+ ? `${model} needs Codex CLI ${minimum} or newer with ChatGPT sign-in. ${sandboxUpgradeHint(input.targetIsSandbox)} If the CLI is already new enough, the plan does not include this model (Enterprise and Edu administrators must enable it) or the rollout has not reached the account; choose another model or use an OpenAI API key.`
+ : `The ChatGPT plan does not include ${model}, the rollout has not reached the account, or the installed Codex CLI is older than the model requires. ${sandboxUpgradeHint(input.targetIsSandbox)} Otherwise choose another model or use an OpenAI API key.`,
+ };
+}
diff --git a/packages/adapters/codex-local/src/server/test.remote.test.ts b/packages/adapters/codex-local/src/server/test.remote.test.ts
index 6376a001ae8..9efe9ebfd90 100644
--- a/packages/adapters/codex-local/src/server/test.remote.test.ts
+++ b/packages/adapters/codex-local/src/server/test.remote.test.ts
@@ -253,6 +253,125 @@ describe("codex remote environment diagnostics", () => {
expect(probeCall?.[3]).toContain("--skip-git-repo-check");
});
+ // `sandboxTarget()` is declared later in this describe block; function
+ // declarations hoist, so the version-floor cases below reuse it.
+ function versionProbeResult(stdout: string) {
+ return {
+ exitCode: 0,
+ signal: null,
+ timedOut: false,
+ stdout,
+ stderr: "",
+ pid: 111,
+ startedAt: new Date().toISOString(),
+ };
+ }
+
+ it("fails before the hello probe when the sandbox Codex CLI is older than the model's floor", async () => {
+ // A sandbox image baked before gpt-6.1-sol reached the catalog still runs
+ // Codex 0.156.0. The backend would reject every turn with "not supported
+ // when using Codex with a ChatGPT account"; the Test must name the real
+ // gap (the CLI in the image) instead of running that doomed probe.
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce(versionProbeResult("codex-cli 0.156.0\n"));
+
+ const result = await testEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { engine: "cli", command: "codex", model: "gpt-6.1-sol" },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("fail");
+ const incompatible = result.checks.find((check) => check.code === "codex_cli_version_incompatible");
+ expect(incompatible).toMatchObject({
+ level: "error",
+ message: "gpt-6.1-sol requires Codex CLI 0.159.0 or newer with ChatGPT sign-in.",
+ detail: "Detected Codex CLI 0.156.0.",
+ });
+ expect(incompatible?.hint).toContain("sandbox image");
+ expect(result.checks.some((check) => check.code === "codex_hello_probe_skipped_cli_version")).toBe(true);
+ expect(result.checks.some((check) => check.code.startsWith("codex_hello_probe_") && !check.code.includes("skipped"))).toBe(false);
+ expect(runAdapterExecutionTargetProcess).toHaveBeenCalledTimes(1);
+ const versionCall = runAdapterExecutionTargetProcess.mock.calls[0] as unknown as [string, AdapterExecutionTarget, string, string[]];
+ expect(versionCall[2]).toBe("codex");
+ expect(versionCall[3]).toEqual(["--version"]);
+ expect(prepareAdapterExecutionTargetRuntime).not.toHaveBeenCalled();
+ });
+
+ it("runs the hello probe when the sandbox Codex CLI satisfies the model's floor", async () => {
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce(versionProbeResult("codex-cli 0.160.0\n"));
+
+ const result = await testEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { engine: "cli", command: "codex", model: "gpt-6.1-sol" },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("pass");
+ expect(result.checks.find((check) => check.code === "codex_cli_version_compatible")).toMatchObject({
+ level: "info",
+ message: "Codex CLI 0.160.0 satisfies the 0.159.0 minimum for gpt-6.1-sol.",
+ });
+ expect(result.checks.some((check) => check.code === "codex_hello_probe_passed")).toBe(true);
+ expect(runAdapterExecutionTargetProcess).toHaveBeenCalledTimes(2);
+ });
+
+ it("skips the version probe for models without a verified floor", async () => {
+ const result = await testEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { engine: "cli", command: "codex", model: "gpt-5.6-sol" },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("pass");
+ expect(result.checks.some((check) => check.code.startsWith("codex_cli_version_"))).toBe(false);
+ expect(runAdapterExecutionTargetProcess).toHaveBeenCalledTimes(1);
+ const helloCall = runAdapterExecutionTargetProcess.mock.calls[0] as unknown as [string, AdapterExecutionTarget, string, string[]];
+ expect(helloCall[3]).not.toEqual(["--version"]);
+ });
+
+ it("names the backend's ChatGPT model rejection instead of a generic probe failure", async () => {
+ // The CLI is new enough, but the account's plan or rollout does not include
+ // the model. The backend answers with one fixed sentence; surface it with
+ // the detected CLI version so the operator can tell the two causes apart.
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce(versionProbeResult("codex-cli 0.160.0\n"));
+ runAdapterExecutionTargetProcess.mockResolvedValueOnce({
+ exitCode: 1,
+ signal: null,
+ timedOut: false,
+ stdout: "",
+ stderr: "ERROR: {\"type\":\"error\",\"status\":400,\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account.\"}}",
+ pid: 222,
+ startedAt: new Date().toISOString(),
+ });
+
+ const result = await testEnvironment({
+ companyId: "company-1",
+ adapterType: "codex_local",
+ config: { engine: "cli", command: "codex", model: "gpt-6.1-sol" },
+ executionTarget: sandboxTarget(),
+ environmentName: "QA Daytona",
+ });
+
+ expect(result.status).toBe("fail");
+ const rejected = result.checks.find((check) => check.code === "codex_hello_probe_model_rejected");
+ expect(rejected).toMatchObject({
+ level: "error",
+ message: "The Codex backend rejected gpt-6.1-sol for this ChatGPT account.",
+ detail: "The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account. Detected Codex CLI 0.160.0.",
+ });
+ expect(rejected?.hint).toContain("0.159.0");
+ expect(rejected?.hint).toContain("plan");
+ expect(result.checks.some((check) => check.code === "codex_hello_probe_failed")).toBe(false);
+ // Not an auth failure: the managed-connection flow must not invalidate the credential.
+ expect(result.checks.some((check) => check.code === "codex_hello_probe_auth_required")).toBe(false);
+ });
+
it("emits the canonical adapter_auth_missing check when a sandbox hello probe reports missing auth", async () => {
// The sandbox has no seedable credentials, so the hello probe returns an
// authentication-required error. The Test must emit the neutral canonical
diff --git a/packages/adapters/codex-local/src/server/test.ts b/packages/adapters/codex-local/src/server/test.ts
index 0679b0c7b90..10cbcb8d395 100644
--- a/packages/adapters/codex-local/src/server/test.ts
+++ b/packages/adapters/codex-local/src/server/test.ts
@@ -37,6 +37,7 @@ import {
} from "./codex-auth-cache.js";
import { resolveCodexExecutionEngineForRun, testCodexAcpEnvironment } from "./acp.js";
import { ADAPTER_AUTH_MISSING_CHECK_CODE } from "./auth-check.js";
+import { checkCodexCliVersionForModel, codexHelloProbeModelRejectionCheck } from "./cli-version.js";
function summarizeStatus(checks: AdapterEnvironmentCheck[]): AdapterEnvironmentTestResult["status"] {
if (checks.some((check) => check.level === "error")) return "fail";
@@ -383,7 +384,34 @@ export async function testEnvironment(
const canRunProbe =
checks.every((check) => check.code !== "codex_cwd_invalid" && check.code !== "codex_command_unresolvable");
- if (canRunProbe) {
+ // Models with a verified CLI floor are compared against the installed Codex
+ // before the hello probe. A probe on an older CLI only produces the backend's
+ // "not supported when using Codex with a ChatGPT account" rejection, which
+ // hides the real gap: the CLI (often a stale sandbox image), not the account.
+ let detectedCliVersion: string | null = null;
+ let configuredModelIsCompatible = true;
+ if (canRunProbe && commandLooksLike(command, "codex")) {
+ const versionCheck = await checkCodexCliVersionForModel({
+ runId,
+ model: asString(config.model, ""),
+ command,
+ target,
+ cwd,
+ env,
+ });
+ if (versionCheck) {
+ checks.push(versionCheck.check);
+ configuredModelIsCompatible = versionCheck.compatible;
+ detectedCliVersion = versionCheck.detectedVersion;
+ }
+ }
+ if (canRunProbe && !configuredModelIsCompatible) {
+ checks.push({
+ code: "codex_hello_probe_skipped_cli_version",
+ level: "info",
+ message: "Skipped hello probe because the installed Codex CLI cannot use the configured model.",
+ });
+ } else if (canRunProbe) {
if (!commandLooksLike(command, "codex")) {
checks.push({
code: "codex_hello_probe_skipped_custom_command",
@@ -525,7 +553,12 @@ export async function testEnvironment(
});
}
} else {
- checks.push({
+ const modelRejection = codexHelloProbeModelRejectionCheck({
+ evidence: `${parsed.errorMessage ?? ""}\n${providerStderr}\n${probe.stdout}`,
+ detectedVersion: detectedCliVersion,
+ targetIsSandbox,
+ });
+ checks.push(modelRejection ?? {
code: "codex_hello_probe_failed",
level: "error",
message: "Codex hello probe failed.",
diff --git a/packages/adapters/codex-local/src/ui/build-config.test.ts b/packages/adapters/codex-local/src/ui/build-config.test.ts
index 57a61248c6c..82db065ae3c 100644
--- a/packages/adapters/codex-local/src/ui/build-config.test.ts
+++ b/packages/adapters/codex-local/src/ui/build-config.test.ts
@@ -118,6 +118,11 @@ describe("buildCodexLocalConfig", () => {
});
describe("buildPaperclipRunnerConfig", () => {
+ it.each([undefined, false, true])("preserves Dot attachment consent in create/import forms: %s", value => {
+ const config = buildPaperclipRunnerConfig(makeValues({ adapterType: "paperclip_runner", adapterSchemaValues: { provider: "openai_dot", dotAttachmentAccess: value } }));
+ expect(config.dotAttachmentAccess).toBe(value === true);
+ expect(config.dotWorkspaceAccess).toBe(false);
+ });
it("keeps only settings implemented by the Codex runner profile", () => {
const config = buildPaperclipRunnerConfig(makeValues({
codexEngine: "acp",
diff --git a/packages/adapters/cursor-local/src/server/execute.test.ts b/packages/adapters/cursor-local/src/server/execute.test.ts
index 866cdd952e0..61f5a05dd3f 100644
--- a/packages/adapters/cursor-local/src/server/execute.test.ts
+++ b/packages/adapters/cursor-local/src/server/execute.test.ts
@@ -291,6 +291,15 @@ exit 7
const remoteWorkspace = path.join(rootDir, "remote-workspace");
const systemHomeDir = path.join(rootDir, "system-home");
const managedCaptureDir = path.join(rootDir, "managed-capture");
+ const fixtureBinDir = path.join(rootDir, "fixture-bin");
+ const networkAttemptPath = path.join(rootDir, "network-attempted");
+ await fs.mkdir(fixtureBinDir, { recursive: true });
+ // A regression in installer interception must fail locally, not download
+ // and execute the real CLI or depend on an external server's latency.
+ await fs.writeFile(path.join(fixtureBinDir, "curl"), `#!/bin/sh
+: > "$FIXTURE_CURL_ATTEMPT_PATH"
+exit 97
+`, { mode: 0o755 });
await fs.mkdir(managedCaptureDir, { recursive: true });
await fs.mkdir(workspaceDir, { recursive: true });
await fs.mkdir(remoteWorkspace, { recursive: true });
@@ -337,6 +346,7 @@ printf '%s\\n' '{"type":"result","subtype":"success","session_id":"cursor-sessio
const runnerState = {
commands: [] as string[],
+ installCommands: [] as string[],
};
// The managed-runtime restore path probes the generated archive with
// `wc -c` before reading bounded `dd | base64` chunks. Keep this fixture's
@@ -345,11 +355,23 @@ printf '%s\\n' '{"type":"result","subtype":"success","session_id":"cursor-sessio
const runner = {
execute: async (input: { command: string; args?: string[]; env?: Record; stdin?: string }) => {
runnerState.commands.push(input.command);
+ const args = [...(input.args ?? [])];
+ if (args[1] === SANDBOX_INSTALL_COMMAND) {
+ runnerState.installCommands.push(args[1]);
+ args[1] = buildInstallSimulationCommand(
+ path.join(systemHomeDir, ".local", "bin", "agent"),
+ managedCaptureDir,
+ );
+ }
// Exercise actual bounded file reads during managed-home restoration;
// reporting empty success for every shell command hides missing bytes.
- return runChildProcess(`cursor-fresh-lease-${runnerState.commands.length}`, input.command, input.args ?? [], {
+ return runChildProcess(`cursor-fresh-lease-${runnerState.commands.length}`, input.command, args, {
cwd: remoteWorkspace,
- env: { ...input.env, PATH: `${input.env?.PATH ?? ""}:/usr/bin:/bin` },
+ env: {
+ ...input.env,
+ PATH: `${fixtureBinDir}:${input.env?.PATH ?? ""}:/usr/bin:/bin`,
+ FIXTURE_CURL_ATTEMPT_PATH: networkAttemptPath,
+ },
stdin: input.stdin,
timeoutSec: 30,
graceSec: 5,
@@ -402,7 +424,11 @@ printf '%s\\n' '{"type":"result","subtype":"success","session_id":"cursor-sessio
});
expect(result.exitCode).toBe(0);
+ await expect(fs.stat(networkAttemptPath)).rejects.toMatchObject({ code: "ENOENT" });
+ expect(runnerState.installCommands).toEqual([SANDBOX_INSTALL_COMMAND]);
expect(prepareInputs).toHaveLength(2);
+ expect(prepareInputs[1].env.HOME).toBeTruthy();
+ expect(prepareInputs[1].env.HOME).not.toBe(systemHomeDir);
expect(finalPreparedCommand).not.toBeNull();
expect(finalPreparedCommand).toMatch(/\.local\/(bin|sbin)\/agent$/);
const resolvedCommand = runMeta.find(Boolean)?.command as string | undefined;
diff --git a/packages/adapters/hermes/README.md b/packages/adapters/hermes/README.md
index fb9d267e7bf..1ee190c753c 100644
--- a/packages/adapters/hermes/README.md
+++ b/packages/adapters/hermes/README.md
@@ -312,6 +312,43 @@ up where the last one left off, maintaining conversation context,
memories, and tool state across heartbeats. The `sessionCodec` validates
and migrates session state between runs.
+### Managed instructions and resumed turns
+
+The local adapter reads `instructionsFilePath` on every run. It sends that
+bundle, its relative-reference base directory, and the standard Paperclip API
+guidance through Hermes's native `HERMES_EPHEMERAL_SYSTEM_PROMPT` overlay.
+Hermes applies this overlay at each model request, including after context
+compression. It does not append the overlay to saved user turns. This requires
+a Hermes CLI that supports the [documented environment hook](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/reference/environment-variables.md).
+
+Fresh sessions, resumed sessions, and session resets all receive the current
+bundle. Edits take effect on the next run; removing the bundle removes it from
+the next overlay. The server's session compatibility and conversation generation
+checks still control session reuse. A missing or failed resume remains a failed
+run and requires an explicit session reset; it does not automatically restart
+work. The next fresh run receives the complete current instruction overlay.
+
+The `-q` user turn contains current runtime identity, task/wake context, handoff
+content, and the rendered custom `promptTemplate`, if configured. Custom templates
+run on every normal wake. `quiet` changes CLI display only. Disabling persistence
+uses full fresh-session context even if old session parameters are supplied.
+
+An explicit `HERMES_EPHEMERAL_SYSTEM_PROMPT` in `env` is preserved before the
+Paperclip overlay. Hermes gives this environment hook precedence over its profile's
+configured personality/system prompt. Put required additional profile guidance in
+that explicit environment value or in the managed bundle. Paperclip does not write
+Hermes profile files or modify the parent process environment. Existing copies in
+old user turns remain in history until Hermes compresses them or the session resets.
+
+Run the credential-free capture-process regression tests with:
+
+```sh
+pnpm --filter @paperclipai/hermes-paperclip-adapter test -- src/server/execute.instructions.test.ts
+```
+
+These tests verify actual child-process arguments and environment, not provider
+billing, model behavior, or measured token savings.
+
### Skills Integration
The adapter scans two skill sources and merges them:
diff --git a/packages/adapters/hermes/src/gateway/server/execute.test.ts b/packages/adapters/hermes/src/gateway/server/execute.test.ts
index 2bec8c9e4de..39393432a73 100644
--- a/packages/adapters/hermes/src/gateway/server/execute.test.ts
+++ b/packages/adapters/hermes/src/gateway/server/execute.test.ts
@@ -607,6 +607,74 @@ describe("execute", () => {
expect(result.errorMessage).toContain("host.docker.internal");
});
+ it.each([
+ ["http://127.0.0.1:8642", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642 }],
+ ["http://[::1]:8642", { code: "ECONNREFUSED", syscall: "connect", address: "::1", port: 8642 }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", errors: [
+ { code: "ECONNREFUSED", syscall: "connect", address: "::1", port: 8642 },
+ { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642 },
+ ] }],
+ ["https://localhost", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 443 }],
+ ["http://localhost", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 80 }],
+ ])("explains the server-side loopback gateway at %s without claiming non-dispatch", async (apiBaseUrl, cause) => {
+ const fetchMock = vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) => {
+ throw Object.assign(new Error("fetch failed"), { cause });
+ });
+ vi.stubGlobal("fetch", fetchMock);
+ const ctx = makeCtx({ apiBaseUrl, apiKey: "gateway-private-key" });
+ ctx.onDispatch = vi.fn();
+ const result = await execute(ctx);
+
+ expect(result.errorMessage).toContain("refers to the Paperclip server, not an agent sandbox");
+ expect(result.errorMessage).toContain("adapterConfig.apiBaseUrl");
+ expect(result.errorMessage).toContain("hermes_local");
+ expect(result.errorMessage).not.toContain("gateway-private-key");
+ expect(result.errorMeta).toEqual({ category: "gateway_loopback_connection_refused", phase: "create_run" });
+ expect(result).toMatchObject({ exitCode: 1, signal: null, timedOut: false,
+ errorCode: "hermes_gateway_connect_failed", errorFamily: "transient_upstream", retryNotBefore: null });
+ expect(result.executionRecovery).toBeUndefined();
+ expect(result.resultJson).toEqual({ connectionFailure: {
+ schemaVersion: 1, provider: "hermes_gateway", operation: "create_run", reason: "connection_refused",
+ } });
+ expect(ctx.onDispatch).toHaveBeenCalledOnce();
+ expect(fetchMock).toHaveBeenCalledOnce();
+ expect(fetchMock.mock.calls[0]?.[1]?.redirect).toBeUndefined();
+ });
+
+ it.each([
+ ["https://gateway.example.test:8642", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642 }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", syscall: "connect", address: "192.0.2.1", port: 8642 }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 9000 }],
+ ["http://127.0.0.2:8642", { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642 }],
+ ["http://localhost:8642", { code: "ETIMEDOUT", syscall: "connect", address: "127.0.0.1", port: 8642 }],
+ ["http://localhost:8642", { code: "EHOSTUNREACH", syscall: "connect", address: "127.0.0.1", port: 8642 }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", address: "127.0.0.1", port: 8642 }],
+ ["http://localhost:8642", { message: "ECONNREFUSED connect 127.0.0.1:8642" }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", errors: [] }],
+ ["http://localhost:8642", { code: "ECONNREFUSED", errors: [
+ { code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642 },
+ { code: "ETIMEDOUT", syscall: "connect", address: "::1", port: 8642 },
+ ] }],
+ ])("keeps ambiguous or nonmatching transport errors generic at %s", async (apiBaseUrl, cause) => {
+ vi.stubGlobal("fetch", vi.fn(async () => { throw Object.assign(new Error("fetch failed"), { cause }); }));
+ const result = await execute(makeCtx({ apiBaseUrl, apiKey: "secret-key" }));
+ expect(result.errorCode).toBe("hermes_gateway_connect_failed");
+ expect(result.errorMessage).not.toContain("refers to the Paperclip server");
+ expect(result.errorMeta).toEqual({});
+ expect(result.executionRecovery).toBeUndefined();
+ });
+
+ it("does not infer loopback refusal from an HTTP provider response", async () => {
+ vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({
+ code: "ECONNREFUSED", syscall: "connect", address: "127.0.0.1", port: 8642,
+ }), { status: 503 })));
+ const result = await execute(makeCtx({ apiBaseUrl: "http://127.0.0.1:8642", apiKey: "secret-key" }));
+ expect(result.errorCode).toBe("hermes_gateway_upstream_error");
+ expect(result.errorMeta?.category).toBeUndefined();
+ expect(result.errorMessage).not.toContain("refers to the Paperclip server");
+ expect(result.executionRecovery).toBeUndefined();
+ });
+
it("redacts echoed auth material from HTTP error payloads", async () => {
vi.stubGlobal(
"fetch",
@@ -672,6 +740,189 @@ describe("execute", () => {
});
});
+describe("gateway connection failure reporting", () => {
+ const config = { apiBaseUrl: "https://gateway.example.test", apiKey: "gateway-private-key" };
+ const marker = (operation: string, reason: string) => ({
+ schemaVersion: 1, provider: "hermes_gateway", operation, reason,
+ });
+
+ it.each([
+ [{}, "api_base_url_missing", "endpoint_missing"],
+ [{ apiBaseUrl: "not a URL" }, "api_base_url_invalid", "endpoint_invalid"],
+ [{ apiBaseUrl: "ftp://gateway.example.test" }, "api_base_url_invalid", "endpoint_invalid"],
+ [{ apiBaseUrl: "http://gateway.example.test" }, "plain_http_remote_denied", "insecure_transport"],
+ [{ apiBaseUrl: config.apiBaseUrl }, "api_key_missing", "credentials_missing"],
+ ])("classifies configuration failure %s without dispatch", async (settings, code, reason) => {
+ const fetchMock = vi.fn();
+ vi.stubGlobal("fetch", fetchMock);
+ const ctx = makeCtx(settings);
+ ctx.onDispatch = vi.fn();
+ const result = await execute(ctx);
+ expect(result).toMatchObject({ exitCode: 1, signal: null, timedOut: false,
+ errorCode: `hermes_gateway_${code}`, resultJson: { connectionFailure: marker("configuration", reason) } });
+ expect(result.errorMessage).toBeTruthy();
+ expect(ctx.onDispatch).not.toHaveBeenCalled();
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ [401, "auth_failed", "authentication_failed", null],
+ [403, "auth_failed", "authentication_failed", null],
+ [404, "runs_unsupported", "endpoint_not_found", null],
+ [429, "rate_limited", "rate_limited", "transient_upstream"],
+ [500, "upstream_error", "remote_unavailable", "transient_upstream"],
+ [503, "upstream_error", "remote_unavailable", "transient_upstream"],
+ [599, "upstream_error", "remote_unavailable", "transient_upstream"],
+ ])("classifies HTTP %i without changing retry or dispatch behavior", async (status, code, reason, errorFamily) => {
+ const fetchMock = vi.fn(async () => new Response(JSON.stringify({ detail: "remote failure" }), {
+ status, headers: { "retry-after": "7" },
+ }));
+ vi.stubGlobal("fetch", fetchMock);
+ const ctx = makeCtx(config);
+ ctx.onDispatch = vi.fn();
+ const result = await execute(ctx);
+ expect(result).toMatchObject({ exitCode: 1, signal: null, timedOut: false,
+ errorCode: `hermes_gateway_${code}`, errorFamily, retryNotBefore: "7",
+ errorMeta: { status, body: { detail: "remote failure" } },
+ resultJson: { connectionFailure: marker("create_run", reason) } });
+ expect(result.errorMessage).toContain(`Hermes gateway HTTP ${status}`);
+ expect(result.executionRecovery).toBeUndefined();
+ expect(ctx.onDispatch).toHaveBeenCalledOnce();
+ expect(fetchMock).toHaveBeenCalledOnce();
+ expect(Object.keys(result.resultJson ?? {})).toEqual(["connectionFailure"]);
+ });
+
+ it.each([
+ ["ECONNREFUSED", "connection_refused"], ["ENOTFOUND", "dns_failure"], ["EAI_AGAIN", "dns_failure"],
+ ["EHOSTUNREACH", "network_unreachable"], ["ENETUNREACH", "network_unreachable"],
+ ["ECONNRESET", "connection_reset"], ["EPIPE", "connection_reset"], ["UND_ERR_SOCKET", "connection_reset"],
+ ["ETIMEDOUT", "connection_timeout"], ["UND_ERR_CONNECT_TIMEOUT", "connection_timeout"],
+ ["UND_ERR_HEADERS_TIMEOUT", "connection_timeout"], ["UND_ERR_BODY_TIMEOUT", "connection_timeout"],
+ ["CERT_HAS_EXPIRED", "tls_failure"], ["CERT_NOT_YET_VALID", "tls_failure"],
+ ["DEPTH_ZERO_SELF_SIGNED_CERT", "tls_failure"], ["SELF_SIGNED_CERT_IN_CHAIN", "tls_failure"],
+ ["UNABLE_TO_VERIFY_LEAF_SIGNATURE", "tls_failure"], ["UNABLE_TO_GET_ISSUER_CERT_LOCALLY", "tls_failure"],
+ ["ERR_TLS_CERT_ALTNAME_INVALID", "tls_failure"],
+ ])("classifies structured fetch cause %s", async (code, reason) => {
+ vi.stubGlobal("fetch", vi.fn(async () => {
+ throw new TypeError("fetch failed", { cause: Object.assign(new Error("external transport failed"), { code }) });
+ }));
+ const result = await execute(makeCtx(config));
+ expect(result).toMatchObject({ exitCode: 1, signal: null, timedOut: false,
+ errorCode: "hermes_gateway_connect_failed", errorFamily: "transient_upstream", retryNotBefore: null,
+ resultJson: { connectionFailure: marker("create_run", reason) } });
+ expect(result.errorMessage).toContain(code);
+ expect(result.executionRecovery).toBeUndefined();
+ });
+
+ it("classifies a network failure reading the create response without rewriting its error", async () => {
+ const response = new Response("unread");
+ vi.spyOn(response, "text").mockRejectedValue(new TypeError("terminated", { cause: { code: "UND_ERR_SOCKET" } }));
+ vi.stubGlobal("fetch", vi.fn(async () => response));
+ const result = await execute(makeCtx(config));
+ expect(result).toMatchObject({ exitCode: 1, signal: null, timedOut: false,
+ errorCode: "hermes_gateway_protocol_error", errorFamily: null, errorMessage: "terminated",
+ resultJson: { connectionFailure: marker("create_run", "connection_reset") } });
+ expect(result.executionRecovery).toBeUndefined();
+ });
+
+ it("requires every aggregate member to prove the same external failure", async () => {
+ vi.stubGlobal("fetch", vi.fn(async () => { throw new TypeError("fetch failed", { cause: {
+ code: "ECONNREFUSED", errors: [{ code: "ECONNREFUSED" }, { code: "ECONNREFUSED" }],
+ } }); }));
+ const result = await execute(makeCtx(config));
+ expect(result.resultJson).toEqual({ connectionFailure: marker("create_run", "connection_refused") });
+ });
+
+ it.each([
+ undefined, { message: "ECONNREFUSED" }, { code: "ERR_INTERNAL_ASSERTION" }, { code: "toString" },
+ { code: "ECONNREFUSED", errors: [] }, { code: "ECONNREFUSED", errors: "invalid" },
+ { code: "ECONNREFUSED", errors: Array.from({ length: 9 }, () => ({ code: "ECONNREFUSED" })) },
+ { code: "ECONNREFUSED", errors: [{ code: "ECONNREFUSED" }, { code: "ETIMEDOUT" }] },
+ { code: "ECONNREFUSED", errors: [{ code: "ECONNREFUSED" }, new TypeError("internal bug")] },
+ { code: "ERR_INTERNAL_ASSERTION", errors: [{ code: "ECONNREFUSED" }] },
+ { code: "ECONNRESET", name: "AbortError" },
+ ])("keeps unknown, mixed, or internal transport causes reportable: %j", async (cause) => {
+ vi.stubGlobal("fetch", vi.fn(async () => { throw new TypeError("ECONNREFUSED", { cause }); }));
+ const result = await execute(makeCtx(config));
+ expect(result.errorCode).toBe("hermes_gateway_connect_failed");
+ expect(result.resultJson).toBeUndefined();
+ });
+
+ it("keeps abort failures reportable even if their cause looks like a transport error", async () => {
+ const aborted = Object.assign(new Error("cancelled", { cause: { code: "ECONNRESET" } }), { name: "AbortError" });
+ vi.stubGlobal("fetch", vi.fn(async () => { throw aborted; }));
+ const result = await execute(makeCtx(config));
+ expect(result.resultJson).toBeUndefined();
+ expect(result.errorCode).toBe("hermes_gateway_connect_failed");
+ });
+
+ it.each([400, 409, 422])("does not trust HTTP %i body claims about connection failures", async (status) => {
+ vi.stubGlobal("fetch", vi.fn(async () => new Response(JSON.stringify({
+ error: "ECONNREFUSED", connectionFailure: marker("create_run", "connection_refused"),
+ }), { status })));
+ const result = await execute(makeCtx(config));
+ expect(result.errorCode).toBe("hermes_gateway_protocol_error");
+ expect(result.resultJson).toBeUndefined();
+ });
+
+ it.each(["not json", JSON.stringify({ status: "running", connectionFailure: marker("create_run", "connection_refused") })])(
+ "keeps malformed successful create responses reportable", async (body) => {
+ vi.stubGlobal("fetch", vi.fn(async () => new Response(body)));
+ const result = await execute(makeCtx(config));
+ expect(result.errorCode).toBe("hermes_gateway_protocol_error");
+ expect(result.resultJson).toBeUndefined();
+ },
+ );
+
+ it("does not classify a local response reader TypeError", async () => {
+ const response = new Response("unread");
+ vi.spyOn(response, "text").mockRejectedValue(new TypeError("cannot read property of undefined"));
+ vi.stubGlobal("fetch", vi.fn(async () => response));
+ const result = await execute(makeCtx(config));
+ expect(result.errorCode).toBe("hermes_gateway_protocol_error");
+ expect(result.resultJson).toBeUndefined();
+ });
+
+ it("does not trust a callback error with forged gateway codes or markers", async () => {
+ const fetchMock = vi.fn();
+ vi.stubGlobal("fetch", fetchMock);
+ const ctx = makeCtx(config);
+ ctx.onDispatch = () => { throw Object.assign(new Error("callback bug"), {
+ code: "hermes_gateway_auth_failed", status: 401, cause: { code: "ECONNREFUSED" },
+ connectionFailure: marker("create_run", "authentication_failed"),
+ }); };
+ const result = await execute(ctx);
+ expect(result.resultJson).toBeUndefined();
+ expect(fetchMock).not.toHaveBeenCalled();
+ });
+
+ it.each(["completed", "failed", "cancelled"])("does not classify remote terminal %s from text or a forged marker", (status) => {
+ const result = mapFinalResultForTest({
+ terminal: { runId: "run-remote", status, payload: {
+ error: "ECONNREFUSED", code: "ECONNREFUSED",
+ connectionFailure: marker("create_run", "connection_refused"),
+ } }, outputChunks: [], sessionKey: null, strategy: "none",
+ });
+ expect(result.resultJson?.connectionFailure).toBeUndefined();
+ expect(result.errorCode).toBe(status === "completed" ? undefined : status === "failed" ? "hermes_gateway_run_failed" : "hermes_gateway_cancelled");
+ });
+
+ it("retains an ambiguous accepted-run timeout after stream, poll, and stop connection failures", async () => {
+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
+ if (String(input).endsWith("/v1/runs")) return new Response(JSON.stringify({ run_id: "run-accepted" }));
+ throw new TypeError("fetch failed", { cause: { code: "ECONNRESET" } });
+ });
+ vi.stubGlobal("fetch", fetchMock);
+ const ctx = makeCtx({ ...config, timeoutSec: 0.3, pollIntervalMs: 250, eventReconnectMs: 250 });
+ const result = await execute(ctx);
+ expect(result).toMatchObject({ timedOut: true, errorCode: "hermes_gateway_timeout" });
+ expect(result.resultJson?.connectionFailure).toBeUndefined();
+ expect(result.resultJson?.run_id).toBe("run-accepted");
+ expect(fetchMock.mock.calls.some(([input]) => String(input).endsWith("/stop"))).toBe(true);
+ expect(ctx.onLog).toHaveBeenCalledWith("stderr", expect.stringContaining("status poll failed"));
+ });
+});
+
describe("testEnvironment", () => {
it("fails remote plain HTTP before probing health", async () => {
const fetchMock = vi.fn(async () => new Response("{}", { status: 200 }));
diff --git a/packages/adapters/hermes/src/gateway/server/execute.ts b/packages/adapters/hermes/src/gateway/server/execute.ts
index 41a3293b584..e4551b1cb6d 100644
--- a/packages/adapters/hermes/src/gateway/server/execute.ts
+++ b/packages/adapters/hermes/src/gateway/server/execute.ts
@@ -3,6 +3,7 @@ import type {
AdapterExecutionResult,
UsageSummary,
} from "@paperclipai/adapter-utils";
+import type { ConnectionFailure } from "@paperclipai/adapter-utils/connection-failure";
import {
asNumber,
asString,
@@ -22,6 +23,7 @@ import {
} from "../shared/constants.js";
import {
allowsInsecureRemoteHttp,
+ isLoopbackHostname,
isRemotePlainHttp,
remotePlainHttpDeniedMessage,
} from "./transport-security.js";
@@ -38,6 +40,7 @@ type HermesHttpError = Error & {
code?: string;
retryNotBefore?: string | null;
body?: unknown;
+ transportCause?: unknown;
};
type TerminalState = {
@@ -59,6 +62,72 @@ type ExecutionState = {
type TextRedactor = (value: string) => string;
+type GatewayConfigurationFailure = Extract;
+type GatewayRequestFailure = Extract;
+
+// Only errors observed at our outbound request boundary acquire this provenance.
+// A callback or remote payload cannot opt itself out of product error reporting.
+const requestConnectionFailures = new WeakMap();
+const NETWORK_FAILURE_REASONS: Readonly> = {
+ ECONNREFUSED: "connection_refused",
+ ENOTFOUND: "dns_failure",
+ EAI_AGAIN: "dns_failure",
+ EHOSTUNREACH: "network_unreachable",
+ ENETUNREACH: "network_unreachable",
+ ECONNRESET: "connection_reset",
+ EPIPE: "connection_reset",
+ UND_ERR_SOCKET: "connection_reset",
+ ETIMEDOUT: "connection_timeout",
+ UND_ERR_CONNECT_TIMEOUT: "connection_timeout",
+ UND_ERR_HEADERS_TIMEOUT: "connection_timeout",
+ UND_ERR_BODY_TIMEOUT: "connection_timeout",
+ CERT_HAS_EXPIRED: "tls_failure",
+ CERT_NOT_YET_VALID: "tls_failure",
+ DEPTH_ZERO_SELF_SIGNED_CERT: "tls_failure",
+ SELF_SIGNED_CERT_IN_CHAIN: "tls_failure",
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: "tls_failure",
+ UNABLE_TO_GET_ISSUER_CERT_LOCALLY: "tls_failure",
+ ERR_TLS_CERT_ALTNAME_INVALID: "tls_failure",
+};
+
+function gatewayConfigurationFailure(reason: GatewayConfigurationFailure["reason"]): GatewayConfigurationFailure {
+ return { schemaVersion: 1, provider: "hermes_gateway", operation: "configuration", reason };
+}
+
+function networkFailureReason(value: unknown, depth = 0): GatewayRequestFailure["reason"] | null {
+ const cause = asRecord(value);
+ if (!cause || depth > 2 || cause.name === "AbortError") return null;
+ const reason = typeof cause.code === "string" && Object.hasOwn(NETWORK_FAILURE_REASONS, cause.code)
+ ? NETWORK_FAILURE_REASONS[cause.code]!
+ : null;
+ if (cause.code !== undefined && !reason) return null;
+ if (cause.errors !== undefined) {
+ if (!Array.isArray(cause.errors) || cause.errors.length === 0 || cause.errors.length > 8) return null;
+ const reasons = cause.errors.map((error) => networkFailureReason(error, depth + 1));
+ const first = reasons[0];
+ return first && reasons.every((item) => item === first) && (!reason || reason === first) ? first : null;
+ }
+ return reason;
+}
+
+function rememberNetworkFailure(target: Error, error: unknown): void {
+ if (!(error instanceof Error) || error.name === "AbortError") return;
+ // Native fetch wraps transport errors in cause. Do not classify an arbitrary
+ // TypeError, its text, or remote JSON that happens to name a network error.
+ const reason = networkFailureReason(error.cause);
+ if (reason) requestConnectionFailures.set(target, {
+ schemaVersion: 1, provider: "hermes_gateway", operation: "create_run", reason,
+ });
+}
+
+function httpFailureReason(status: number): GatewayRequestFailure["reason"] | null {
+ if (status === 401 || status === 403) return "authentication_failed";
+ if (status === 404) return "endpoint_not_found";
+ if (status === 429) return "rate_limited";
+ if (status >= 500 && status <= 599) return "remote_unavailable";
+ return null;
+}
+
const CRITICAL_HEADERS = new Set([
"authorization",
"content-type",
@@ -377,9 +446,17 @@ async function fetchJson(input: RequestInfo | URL, init: RequestInit): Promise 8) return false;
+ return refusals.every((value) => {
+ const refusal = asRecord(value);
+ return refusal?.code === "ECONNREFUSED" && refusal.syscall === "connect" &&
+ refusal.port === port && typeof refusal.address === "string" &&
+ isLoopbackHostname(refusal.address) &&
+ (hostname === "localhost" || refusal.address.toLowerCase() === hostname);
+ });
+}
+
+function errorResult(err: unknown, baseUrl: URL, redactText: TextRedactor = sanitizeSensitiveText): AdapterExecutionResult {
const hermesError = err as HermesHttpError;
const code = hermesError.code ?? "hermes_gateway_protocol_error";
const classified = hermesError.status ? classifyHttpError(hermesError.status) : null;
+ const loopbackRefused = isConfiguredLoopbackRefusal(hermesError, baseUrl);
+ const connectionFailure = err instanceof Error ? requestConnectionFailures.get(err) : undefined;
const errorMessage = code === "hermes_gateway_auth_failed"
? `${redactErrorMessage(err, redactText)}. Check adapterConfig.apiKey matches the Hermes API_SERVER_KEY for the running gateway.`
- : redactErrorMessage(err, redactText);
+ : loopbackRefused
+ ? `${redactErrorMessage(err, redactText)}. The configured loopback gateway refers to the Paperclip server, not an agent sandbox or your browser's machine. Check that the Hermes API server is running there, or set adapterConfig.apiBaseUrl to its address reachable from the Paperclip server. Hermes Gateway connects to an already-running gateway; use hermes_local if Paperclip should launch the local Hermes CLI.`
+ : redactErrorMessage(err, redactText);
return {
exitCode: 1,
signal: null,
@@ -773,7 +875,11 @@ function errorResult(err: unknown, redactText: TextRedactor = sanitizeSensitiveT
errorFamily: classified?.family ?? (code === "hermes_gateway_connect_failed" ? "transient_upstream" : null),
retryNotBefore: hermesError.retryNotBefore ?? null,
errorMessage,
+ ...(connectionFailure ? { resultJson: { connectionFailure } } : {}),
errorMeta: {
+ // Diagnosis only: a redirected request may have received a response
+ // before refusing a later connection. This never proves non-dispatch.
+ ...(loopbackRefused ? { category: "gateway_loopback_connection_refused", phase: "create_run" } : {}),
...(hermesError.status ? { status: hermesError.status } : {}),
...(hermesError.body ? { body: redactForLog(hermesError.body, [], 0, redactText) as Record } : {}),
},
@@ -789,6 +895,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise {
+ let dir: string;
+ let command: string;
+ let instructionsFilePath: string;
+ let capturePath: string;
+
+ beforeEach(async () => {
+ dir = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-hermes-instructions-"));
+ command = path.join(dir, "hermes.cjs");
+ instructionsFilePath = path.join(dir, "instructions.md");
+ capturePath = path.join(dir, "invocations.jsonl");
+ await fs.writeFile(instructionsFilePath, INSTRUCTIONS);
+ await fs.writeFile(command, `#!${process.execPath}
+const fs = require("node:fs");
+const args = process.argv.slice(2);
+fs.appendFileSync(process.env.CAPTURE_PATH, JSON.stringify({
+ args,
+ systemPrompt: process.env.HERMES_EPHEMERAL_SYSTEM_PROMPT ?? null,
+ runId: process.env.PAPERCLIP_RUN_ID,
+}) + "\\n");
+if (process.env.FIXTURE_STDOUT) console.log(process.env.FIXTURE_STDOUT);
+if (args.includes("missing-session")) {
+ console.error("\\u001b[1;31mSession missing-session not found.\\u001b[0m");
+ process.exit(1);
+}
+if (process.env.FIXTURE_PROVIDER_ERROR) {
+ console.error(process.env.FIXTURE_PROVIDER_ERROR);
+ process.exit(1);
+}
+console.log("Fixture completed\\nsession_id: ${SESSION_ID}");
+`, { mode: 0o700 });
+ });
+
+ afterEach(async () => {
+ await fs.rm(dir, { recursive: true, force: true });
+ });
+
+ function context(overrides: Partial = {}): AdapterExecutionContext {
+ return {
+ runId: "run-fresh",
+ agent: {
+ id: "agent-synthetic", companyId: "company-synthetic", name: "Hermes fixture",
+ adapterType: "hermes_local", adapterConfig: {},
+ },
+ runtime: { sessionId: null, sessionParams: null, sessionDisplayId: null, taskKey: "task-synthetic" },
+ config: {
+ hermesCommand: command, provider: "openrouter", model: "fixture-model", cwd: dir,
+ instructionsFilePath, env: { CAPTURE_PATH: capturePath }, timeoutSec: 10, graceSec: 1,
+ },
+ context: {
+ issueId: "task-synthetic",
+ paperclipTaskMarkdownAssignment: "Complete current synthetic task.",
+ paperclipTaskMarkdownCompact: "Current synthetic task.",
+ paperclipWake: {
+ reason: "issue_commented",
+ issue: { id: "task-synthetic", title: "Synthetic task", status: "in_progress" },
+ comments: [{ id: "comment-synthetic", body: "Fresh human direction." }],
+ commentWindow: { requestedCount: 1, includedCount: 1, missingCount: 0 },
+ fallbackFetchNeeded: false,
+ },
+ },
+ onLog: async () => {},
+ ...overrides,
+ };
+ }
+
+ async function invocations(): Promise {
+ return (await fs.readFile(capturePath, "utf8")).trim().split("\n").map((line) => JSON.parse(line));
+ }
+
+ function query(invocation: Invocation): string {
+ return invocation.args[invocation.args.indexOf("-q") + 1];
+ }
+
+ it.each([false, true])("keeps instructions out of fresh and resumed user turns (conversation=%s)", async (conversationMode) => {
+ const fresh = context();
+ fresh.context.conversationMode = conversationMode;
+ const first = await execute(fresh);
+ const params = sessionCodec.deserialize(sessionCodec.serialize(first.sessionParams ?? null));
+ expect(params?.sessionId).toBe(SESSION_ID);
+ await execute({ ...fresh, runId: "run-resumed", runtime: { ...fresh.runtime, sessionParams: params } });
+
+ const [initial, resumed] = await invocations();
+ expect(initial.args).not.toContain("--resume");
+ expect(resumed.args.slice(resumed.args.indexOf("--resume"))).toEqual(["--resume", SESSION_ID]);
+ for (const invocation of [initial, resumed]) {
+ expect(invocation.systemPrompt).toContain(INSTRUCTIONS);
+ expect(invocation.systemPrompt).toContain(`Resolve any relative file references from ${dir}/`);
+ expect(query(invocation)).not.toContain(INSTRUCTIONS);
+ expect(query(invocation)).not.toContain("Safe multiline update pattern:");
+ expect(query(invocation)).toContain("Fresh human direction.");
+ expect(query(invocation)).toContain(invocation.runId);
+ expect(query(invocation)).toContain("company-synthetic");
+ expect(invocation.systemPrompt).toContain("$PAPERCLIP_API_KEY");
+ expect(invocation.systemPrompt).toContain('-H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID"');
+ expect(invocation.systemPrompt).toContain("body=$(cat <<'MD'");
+ expect(invocation.systemPrompt).toContain("--data-binary @-");
+ expect(invocation.systemPrompt).toContain('$api/issues/$PAPERCLIP_TASK_ID');
+ expect(invocation.systemPrompt).not.toContain(invocation.runId);
+ }
+ });
+
+ it("reapplies current instructions after edits and a session reset", async () => {
+ const ctx = context();
+ await execute(ctx);
+ await fs.writeFile(instructionsFilePath, "Updated governance marker.");
+ await execute({ ...ctx, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ await execute({ ...ctx, runId: "run-reset" });
+ const [, edited, reset] = await invocations();
+ for (const invocation of [edited, reset]) {
+ expect(invocation.systemPrompt).toContain("Updated governance marker.");
+ expect(invocation.systemPrompt).not.toContain(INSTRUCTIONS);
+ expect(query(invocation)).not.toContain("Updated governance marker.");
+ }
+ expect(reset.args).not.toContain("--resume");
+ });
+
+ it("uses fresh wake context when persistence is disabled despite stored session params", async () => {
+ const ctx = context();
+ const result = await execute({ ...ctx, config: { ...ctx.config, persistSession: false }, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ const [invocation] = await invocations();
+ expect(invocation.args).not.toContain("--resume");
+ expect(query(invocation)).toContain("## Paperclip Wake Payload");
+ expect(query(invocation)).not.toContain("## Paperclip Resume Delta");
+ expect(invocation.systemPrompt).toContain(INSTRUCTIONS);
+ expect(result.sessionParams).toBeUndefined();
+ });
+
+ it("keeps custom templates and quiet mode dynamic while preserving a configured system overlay", async () => {
+ const ctx = context();
+ await execute({ ...ctx, config: {
+ ...ctx.config, quiet: true, promptTemplate: "Current custom direction for {{runId}}.",
+ env: { CAPTURE_PATH: capturePath, HERMES_EPHEMERAL_SYSTEM_PROMPT: "User configured system guidance." },
+ }, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ const [invocation] = await invocations();
+ expect(invocation.args).toContain("-Q");
+ expect(query(invocation)).toContain("Current custom direction for run-fresh.");
+ expect(query(invocation)).not.toContain(INSTRUCTIONS);
+ expect(invocation.systemPrompt).toContain("User configured system guidance.");
+ expect(invocation.systemPrompt).toContain(INSTRUCTIONS);
+ });
+
+ it.each([false, true])("keeps an empty wake runnable with current identity (conversation=%s)", async (conversationMode) => {
+ await execute(context({ context: { conversationMode } }));
+ const [invocation] = await invocations();
+ expect(query(invocation)).toContain("run-fresh");
+ expect(query(invocation)).not.toContain(INSTRUCTIONS);
+ expect(invocation.systemPrompt).toContain(INSTRUCTIONS);
+ });
+
+ it("surfaces a missing session without automatically restarting work", async () => {
+ const ctx = context();
+ const result = await execute({ ...ctx, runtime: { ...ctx.runtime, sessionParams: { sessionId: "missing-session" } } });
+ const calls = await invocations();
+ expect(calls).toHaveLength(1);
+ expect(calls[0].args).toContain("--resume");
+ expect(calls[0].systemPrompt).toContain(INSTRUCTIONS);
+ expect(result.exitCode).toBe(1);
+ expect(result.sessionParams).toBeUndefined();
+ });
+
+ it("does not retry provider failures as a missing session", async () => {
+ const ctx = context();
+ const result = await execute({ ...ctx, config: { ...ctx.config, env: { CAPTURE_PATH: capturePath, FIXTURE_PROVIDER_ERROR: "Error: provider unavailable" } }, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ expect(await invocations()).toHaveLength(1);
+ expect(result.exitCode).toBe(1);
+ expect(result.errorMessage).toBe("Error: provider unavailable");
+ });
+
+ it("preserves failed work even when its output contains a missing-session diagnostic", async () => {
+ const ctx = context();
+ const result = await execute({ ...ctx, config: { ...ctx.config, env: {
+ CAPTURE_PATH: capturePath,
+ FIXTURE_STDOUT: `Already updated the task.\nSession ${SESSION_ID} not found.`,
+ FIXTURE_PROVIDER_ERROR: "Error: provider unavailable after tool execution",
+ } }, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ expect(await invocations()).toHaveLength(1);
+ expect(result.exitCode).toBe(1);
+ expect(result.summary).toContain("Already updated the task.");
+ expect(result.errorMessage).toBe("Error: provider unavailable after tool execution");
+ });
+
+ it("removes an obsolete instruction overlay when the bundle is removed", async () => {
+ const ctx = context();
+ await execute(ctx);
+ await execute({ ...ctx, config: { ...ctx.config, instructionsFilePath: undefined }, runtime: { ...ctx.runtime, sessionParams: { sessionId: SESSION_ID } } });
+ const [, resumed] = await invocations();
+ expect(resumed.systemPrompt).not.toContain(INSTRUCTIONS);
+ expect(resumed.systemPrompt).toContain("Paperclip API guidance:");
+ expect(query(resumed)).toContain("Fresh human direction.");
+ });
+});
diff --git a/packages/adapters/hermes/src/server/execute.ts b/packages/adapters/hermes/src/server/execute.ts
index 828a3e2e002..98a5d85846e 100644
--- a/packages/adapters/hermes/src/server/execute.ts
+++ b/packages/adapters/hermes/src/server/execute.ts
@@ -34,7 +34,6 @@ import {
renderTemplate,
ensureAbsoluteDirectory,
DEFAULT_PAPERCLIP_AGENT_PROMPT_TEMPLATE,
- DEFAULT_PAPERCLIP_CONVERSATION_PROMPT_TEMPLATE,
joinPromptSections,
selectPaperclipPromptSections,
stringifyPaperclipWakePayload,
@@ -82,7 +81,7 @@ export function resolveHermesCommand(config: Record): string {
// Wake-up prompt builder
// ---------------------------------------------------------------------------
-const HERMES_DEFAULT_PROMPT_TEMPLATE = [
+const HERMES_RUNTIME_IDENTITY_TEMPLATE = [
'You are "{{agent.name}}", an AI agent employee in a Paperclip-managed company.',
"",
"Paperclip runtime identity:",
@@ -90,7 +89,11 @@ const HERMES_DEFAULT_PROMPT_TEMPLATE = [
"- Company ID: {{agent.companyId}}",
"- Run ID: {{run.id}}",
"- API base: {{paperclipApiUrl}}",
- "",
+].join("\n");
+
+// Hermes applies this overlay at each API call, including after compaction,
+// without storing it in conversation history. Keep run/task deltas in -q.
+const HERMES_SYSTEM_PROMPT_TEMPLATE = [
"Paperclip API guidance:",
"- Use `curl` from the terminal for Paperclip API calls; browser/web extraction tools may not reach localhost.",
"- Use `$PAPERCLIP_API_URL`, `$PAPERCLIP_API_KEY`, and `$PAPERCLIP_RUN_ID`; do not hard-code local ports or copy secrets into comments.",
@@ -112,7 +115,7 @@ const HERMES_DEFAULT_PROMPT_TEMPLATE = [
"MD",
")",
"jq -n --arg status done --arg comment \"$body\" '{status:$status, comment:$comment}' | \\",
- " curl -sS -X PATCH \"$api/issues/{{context.issueId}}\" \\",
+ " curl -sS -X PATCH \"$api/issues/$PAPERCLIP_TASK_ID\" \\",
" -H \"Authorization: Bearer $PAPERCLIP_API_KEY\" \\",
" -H \"X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID\" \\",
" -H \"Content-Type: application/json\" \\",
@@ -141,9 +144,7 @@ export function buildPrompt(
options: { resumedSession?: boolean } = {},
): string {
const context = (ctx as any).context || {};
- const template = cfgString(config.promptTemplate) || (context.conversationMode === true
- ? DEFAULT_PAPERCLIP_CONVERSATION_PROMPT_TEMPLATE
- : HERMES_DEFAULT_PROMPT_TEMPLATE);
+ const template = cfgString(config.promptTemplate);
const taskId = cfgString(context.taskId) || cfgString(context.issueId) || cfgString(ctx.config?.taskId);
const taskTitle = cfgString(context.taskTitle) || cfgString(ctx.config?.taskTitle) || "";
const taskBody = cfgString(context.taskBody) || cfgString(ctx.config?.taskBody) || "";
@@ -200,10 +201,11 @@ export function buildPrompt(
paperclipRunIdEnv: "PAPERCLIP_RUN_ID",
};
- const rendered = isPaperclipRecoveryWakePayload(context.paperclipWake)
- ? ""
- : renderTemplate(renderConditionalSections(template, vars), vars);
+ const rendered = template && !isPaperclipRecoveryWakePayload(context.paperclipWake)
+ ? renderTemplate(renderConditionalSections(template, vars), vars)
+ : "";
return joinPromptSections([
+ renderTemplate(HERMES_RUNTIME_IDENTITY_TEMPLATE, vars),
wakePrompt,
sessionHandoffMarkdown,
taskContextMarkdown,
@@ -404,7 +406,7 @@ export async function execute(
// ── Load agent instructions file (Paperclip instruction bundles) ──────
// Paperclip can materialize managed instructions into instructionsFilePath;
- // when present, inject that bundle into the Hermes prompt.
+ // when present, reapply that bundle through Hermes's native system overlay.
const instructionsFilePath = cfgString(config.instructionsFilePath);
let agentInstructions = "";
if (instructionsFilePath) {
@@ -430,10 +432,8 @@ export async function execute(
}
// ── Build prompt ───────────────────────────────────────────────────────
- let prompt = buildPrompt(ctx, config, { resumedSession: Boolean(prevSessionId) });
- if (agentInstructions) {
- prompt = agentInstructions + "\n\n---\n\n" + prompt;
- }
+ const sessionId = persistSession ? prevSessionId : undefined;
+ const prompt = buildPrompt(ctx, config, { resumedSession: Boolean(sessionId) });
// ── Build command args ─────────────────────────────────────────────────
// Use -Q (quiet) to get clean output: just response + session_id line
@@ -474,13 +474,9 @@ export async function execute(
// system is designed for human-attended interactive sessions.
args.push("--yolo");
- if (persistSession && prevSessionId) {
- args.push("--resume", prevSessionId);
- }
-
- if (extraArgs?.length) {
- args.push(...extraArgs);
- }
+ // Failed resumes remain failures. Do not infer a safe restart from CLI text.
+ if (sessionId) args.push("--resume", sessionId);
+ if (extraArgs?.length) args.push(...extraArgs);
// ── Build environment ──────────────────────────────────────────────────
const userEnv = config.env as Record | undefined;
@@ -491,6 +487,17 @@ export async function execute(
...buildRuntimeToolsEnv(ctx.runtimeTools),
};
+ // Scope the overlay to this child process. Read the current bundle on every
+ // invocation; never infer its availability from a persisted session ID.
+ // Preserve an operator's explicit overlay before Paperclip's instructions.
+ env.HERMES_EPHEMERAL_SYSTEM_PROMPT = joinPromptSections([
+ env.HERMES_EPHEMERAL_SYSTEM_PROMPT,
+ agentInstructions,
+ renderTemplate(HERMES_SYSTEM_PROMPT_TEMPLATE, {
+ agent: ctx.agent,
+ }),
+ ]);
+
if (ctx.runId) env.PAPERCLIP_RUN_ID = ctx.runId;
// PAPERCLIP_API_KEY is never accepted from config — the harness-minted run
@@ -527,10 +534,10 @@ export async function execute(
"stdout",
`[hermes] Starting Hermes Agent (model=${model}, provider=${resolvedProvider} [${resolvedFrom}], timeout=${timeoutSec}s${maxTurns ? `, max_turns=${maxTurns}` : ""})\n`,
);
- if (prevSessionId) {
+ if (sessionId) {
await ctx.onLog(
"stdout",
- `[hermes] Resuming session: ${prevSessionId}\n`,
+ `[hermes] Resuming session: ${sessionId}\n`,
);
}
diff --git a/packages/adapters/hermes/src/server/prompt-rendering.test.ts b/packages/adapters/hermes/src/server/prompt-rendering.test.ts
index b47dca03619..dc6ba503110 100644
--- a/packages/adapters/hermes/src/server/prompt-rendering.test.ts
+++ b/packages/adapters/hermes/src/server/prompt-rendering.test.ts
@@ -234,19 +234,16 @@ test("keeps authoritative parent and ancestor context from task markdown", () =>
expect(prompt).not.toContain("check the issue body or comments for references");
});
-test("renders safe Paperclip API examples from environment variables with multiline update preservation", () => {
+test("keeps current runtime identity in the user turn without repeating static API examples", () => {
const prompt = buildPrompt(baseContext(), {
paperclipApiUrl: "http://paperclip.local/api",
});
- expect(prompt).toContain("Use `$PAPERCLIP_API_URL`, `$PAPERCLIP_API_KEY`, and `$PAPERCLIP_RUN_ID`");
- expect(prompt).toContain("Displayed command logs may redact secrets");
- expect(prompt).toContain('-H "Authorization: Bearer $PAPERCLIP_API_KEY"');
- expect(prompt).toContain('-H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID"');
- expect(prompt).toContain("body=$(cat <<'MD'");
- expect(prompt).toContain("jq -n --arg status done --arg comment \"$body\"");
- expect(prompt).toContain("--data-binary @-");
- expect(prompt).not.toContain("Authorization: Bearer <");
+ expect(prompt).toContain("- Agent ID: agent-1");
+ expect(prompt).toContain("- Company ID: company-1");
+ expect(prompt).toContain("- Run ID: run-1");
+ expect(prompt).toContain("- API base: http://paperclip.local/api");
+ expect(prompt).not.toContain("Safe multiline update pattern:");
});
test("preserves custom prompt templates while exposing runtime and wake variables", () => {
@@ -276,7 +273,7 @@ test("preserves custom prompt templates while exposing runtime and wake variable
expect(prompt).toContain('"reason":"issue_assigned"');
expect(prompt).toContain("## Paperclip Wake Payload");
expect(prompt).toContain("Issue description:\n```text\nUse the wake payload as runtime authority.\n```");
- expect(prompt).not.toContain("Paperclip runtime identity:");
+ expect(prompt).toContain("Paperclip runtime identity:");
});
test("keeps historical task markdown available to custom templates while automatic context uses assignment markdown", () => {
diff --git a/packages/db/src/client.test.ts b/packages/db/src/client.test.ts
index 0d2ff2d98a8..5b941c12965 100644
--- a/packages/db/src/client.test.ts
+++ b/packages/db/src/client.test.ts
@@ -168,6 +168,37 @@ describeEmbeddedPostgres("resetPostgresDatabase", () => {
});
describeEmbeddedPostgres("applyPendingMigrations", () => {
+ it("upgrades an older clone whose replaced connection constraint is already absent", async () => {
+ const clusterUrl = new URL(await createTempDatabase());
+ const databaseName = "missing_connection_constraint";
+ clusterUrl.pathname = "/postgres";
+ await ensurePostgresDatabase(clusterUrl.toString(), databaseName);
+ clusterUrl.pathname = "/" + databaseName;
+ const connectionString = clusterUrl.toString();
+ const prefixFolder = await fs.promises.mkdtemp(join(tmpdir(), "paperclip-migration-prefix-"));
+ cleanups.push(() => fs.promises.rm(prefixFolder, { recursive: true, force: true }));
+ await fs.promises.mkdir(join(prefixFolder, "meta"));
+ const journal = JSON.parse(await fs.promises.readFile(new URL("./migrations/meta/_journal.json", import.meta.url), "utf8"));
+ journal.entries = journal.entries.filter((entry: { idx: number }) => entry.idx < 255);
+ await fs.promises.writeFile(join(prefixFolder, "meta/_journal.json"), JSON.stringify(journal));
+ for (const entry of journal.entries) {
+ await fs.promises.copyFile(new URL(`./migrations/${entry.tag}.sql`, import.meta.url), join(prefixFolder, `${entry.tag}.sql`));
+ }
+ const sql = postgres(connectionString, { max: 1, onnotice: () => {} });
+ try {
+ await migrate(drizzle(sql), { migrationsFolder: prefixFolder });
+ await sql`ALTER TABLE "tool_connections" DROP CONSTRAINT "tool_connections_transport_check"`;
+ await applyPendingMigrations(connectionString);
+ expect((await inspectMigrations(connectionString)).status).toBe("upToDate");
+ const [constraint] = await sql<{ definition: string }[]>`
+ SELECT pg_get_constraintdef(oid) AS definition FROM pg_constraint
+ WHERE conrelid = 'tool_connections'::regclass AND conname = 'tool_connections_transport_check'
+ `;
+ expect(constraint?.definition).toContain("chat_sdk");
+ expect(constraint?.definition).toContain("runtime_auth");
+ } finally { await sql.end(); }
+ }, 30_000);
+
it("upgrades renumbered recovery migrations and replays their schema idempotently", async () => {
const connectionString = await createTempDatabase();
await applyPendingMigrations(connectionString);
diff --git a/packages/db/src/client.ts b/packages/db/src/client.ts
index 5ee2ac28df0..c1b34d21eb6 100644
--- a/packages/db/src/client.ts
+++ b/packages/db/src/client.ts
@@ -522,7 +522,13 @@ async function applyPendingMigrationsManually(
}
}
}
- await sql.unsafe(statement);
+ // Older dev schemas can lack a replaced constraint. Preserve the
+ // published SQL/hash while allowing the harmless drop to proceed.
+ const executable = statement.replace(
+ /^(\s*ALTER TABLE "[^"]+" DROP CONSTRAINT) (?!IF EXISTS\b)/i,
+ "$1 IF EXISTS ",
+ );
+ await sql.unsafe(executable);
}
await recordMigrationHistoryEntry(
diff --git a/packages/db/src/migrations/0314_private_task_draft_assets.sql b/packages/db/src/migrations/0314_private_task_draft_assets.sql
new file mode 100644
index 00000000000..a7591cf72f9
--- /dev/null
+++ b/packages/db/src/migrations/0314_private_task_draft_assets.sql
@@ -0,0 +1,28 @@
+-- Runs through the Paperclip migration executor outside a file-wide transaction.
+-- Each idempotent keyset batch commits before advancing; history is recorded last.
+-- Bind historical inline draft images to their first owned task. Unbound drafts
+-- remain uploader-only. Attachment deletion never makes the draft company-open.
+DO $$
+DECLARE cursor_id uuid := '00000000-0000-0000-0000-000000000000'; next_id uuid;
+BEGIN
+ LOOP
+ SELECT max(id::text)::uuid INTO next_id FROM (
+ SELECT id FROM assets WHERE id > cursor_id AND object_key LIKE company_id::text || '/assets/issues/drafts/%'
+ ORDER BY id LIMIT 1000
+ ) batch;
+ EXIT WHEN next_id IS NULL;
+ INSERT INTO issue_attachments (company_id, issue_id, asset_id)
+ SELECT a.company_id, first_issue.id, a.id FROM assets a
+ CROSS JOIN LATERAL (
+ SELECT i.id FROM issues i WHERE i.company_id = a.company_id
+ AND (i.created_by_user_id = a.created_by_user_id OR i.responsible_user_id = a.created_by_user_id
+ OR i.created_by_agent_id = a.created_by_agent_id)
+ AND strpos(coalesce(i.description, ''), '/api/assets/' || a.id::text || '/content') > 0
+ ORDER BY i.created_at, i.id LIMIT 1
+ ) first_issue
+ WHERE a.id > cursor_id AND a.id <= next_id AND a.object_key LIKE a.company_id::text || '/assets/issues/drafts/%'
+ ON CONFLICT DO NOTHING;
+ cursor_id := next_id;
+ COMMIT;
+ END LOOP;
+END $$;
diff --git a/packages/db/src/migrations/0315_rapid_emma_frost.sql b/packages/db/src/migrations/0315_rapid_emma_frost.sql
new file mode 100644
index 00000000000..95330211675
--- /dev/null
+++ b/packages/db/src/migrations/0315_rapid_emma_frost.sql
@@ -0,0 +1,44 @@
+CREATE TABLE IF NOT EXISTS "user_company_preferences" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "user_id" text NOT NULL,
+ "primary_agent_id" uuid,
+ "primary_agent_initialized" boolean DEFAULT false NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "user_company_preferences" ADD CONSTRAINT "user_company_preferences_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION WHEN duplicate_object THEN NULL;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ ALTER TABLE "user_company_preferences" ADD CONSTRAINT "user_company_preferences_primary_agent_id_agents_id_fk" FOREIGN KEY ("primary_agent_id") REFERENCES "public"."agents"("id") ON DELETE set null ON UPDATE no action;
+EXCEPTION WHEN duplicate_object THEN NULL;
+END $$;
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "user_company_preferences_company_user_uq" ON "user_company_preferences" USING btree ("company_id","user_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "user_company_preferences_primary_agent_idx" ON "user_company_preferences" USING btree ("primary_agent_id");--> statement-breakpoint
+-- Attribute only explicit human creation events. Select the original event
+-- before joining the agent: deletion/termination must not promote a later hire.
+WITH first_creations AS (
+ SELECT DISTINCT ON (company_id, actor_id)
+ company_id, actor_id AS user_id, entity_id AS agent_id
+ FROM activity_log
+ WHERE actor_type = 'user'
+ AND actor_id NOT IN ('', 'board', 'system', 'unknown', 'unknown-user')
+ AND entity_type = 'agent'
+ AND action IN ('agent.created', 'agent.hire_created')
+ ORDER BY company_id, actor_id, created_at, id
+)
+INSERT INTO user_company_preferences (company_id, user_id, primary_agent_id, primary_agent_initialized)
+SELECT c.company_id, c.user_id,
+ CASE WHEN a.status != 'terminated' AND m.state IS DISTINCT FROM 'left'
+ THEN a.id ELSE NULL END,
+ true
+FROM first_creations c
+LEFT JOIN agents a ON a.id::text = c.agent_id AND a.company_id = c.company_id
+LEFT JOIN agent_memberships m ON m.company_id = c.company_id AND m.user_id = c.user_id AND m.agent_id = a.id
+WHERE a.metadata->'paperclipBuiltInAgent' IS NULL
+ON CONFLICT (company_id, user_id) DO NOTHING;
diff --git a/packages/db/src/migrations/0316_premium_slayback.sql b/packages/db/src/migrations/0316_premium_slayback.sql
new file mode 100644
index 00000000000..5c2965133ce
--- /dev/null
+++ b/packages/db/src/migrations/0316_premium_slayback.sql
@@ -0,0 +1,81 @@
+-- Idempotent for installations that applied the pre-merge decision migration.
+CREATE TABLE IF NOT EXISTS "company_decision_models" (
+ "company_id" uuid PRIMARY KEY NOT NULL,
+ "connection_id" uuid,
+ "grant_id" uuid,
+ "enabled" boolean DEFAULT false NOT NULL,
+ "allow_background" boolean DEFAULT true NOT NULL,
+ "provider" text,
+ "model" text,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "company_decisions_configured" CHECK (("company_decision_models"."connection_id" is null) = ("company_decision_models"."grant_id" is null) and (not "company_decision_models"."enabled" or ("company_decision_models"."connection_id" is not null and "company_decision_models"."provider" is not null and "company_decision_models"."model" is not null)))
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "decision_invocations" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "feature" text NOT NULL,
+ "actor_type" text NOT NULL,
+ "actor_id" text NOT NULL,
+ "responsible_user_id" text,
+ "agent_id" uuid,
+ "issue_id" uuid,
+ "project_id" uuid,
+ "run_id" uuid,
+ "identity_context_id" uuid,
+ "connection_id" uuid NOT NULL,
+ "grant_id" uuid NOT NULL,
+ "provider" text NOT NULL,
+ "model" text NOT NULL,
+ "question_types" jsonb NOT NULL,
+ "status" text DEFAULT 'running' NOT NULL,
+ "error_code" text,
+ "provider_request_id" text,
+ "cost_event_id" uuid,
+ "started_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "finished_at" timestamp with time zone,
+ "duration_ms" integer,
+ "input_tokens" integer,
+ "output_tokens" integer,
+ CONSTRAINT "decision_invocations_status_check" CHECK ("decision_invocations"."status" in ('running', 'succeeded', 'failed', 'unknown'))
+);
+--> statement-breakpoint
+ALTER TABLE "budget_reservations" ALTER COLUMN "run_id" DROP NOT NULL;--> statement-breakpoint
+ALTER TABLE "budget_reservations" ALTER COLUMN "agent_id" DROP NOT NULL;--> statement-breakpoint
+ALTER TABLE "cost_events" ALTER COLUMN "agent_id" DROP NOT NULL;--> statement-breakpoint
+ALTER TABLE "budget_reservations" ADD COLUMN IF NOT EXISTS "decision_invocation_id" uuid;--> statement-breakpoint
+ALTER TABLE "cost_events" ADD COLUMN IF NOT EXISTS "usage_kind" text DEFAULT 'agent' NOT NULL;--> statement-breakpoint
+ALTER TABLE "cost_events" ADD COLUMN IF NOT EXISTS "responsible_user_id" text;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'company_decision_models_company_id_companies_id_fk' AND conrelid = 'company_decision_models'::regclass) THEN
+ ALTER TABLE "company_decision_models" ADD CONSTRAINT "company_decision_models_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'decision_invocations_company_id_companies_id_fk' AND conrelid = 'decision_invocations'::regclass) THEN
+ ALTER TABLE "decision_invocations" ADD CONSTRAINT "decision_invocations_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'decision_invocations_cost_event_id_cost_events_id_fk' AND conrelid = 'decision_invocations'::regclass) THEN
+ ALTER TABLE "decision_invocations" ADD CONSTRAINT "decision_invocations_cost_event_id_cost_events_id_fk" FOREIGN KEY ("cost_event_id") REFERENCES "public"."cost_events"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "decision_invocations_company_started_idx" ON "decision_invocations" USING btree ("company_id","started_at","id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "decision_invocations_pending_idx" ON "decision_invocations" USING btree ("started_at") WHERE "decision_invocations"."status" = 'running';--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "decision_invocations_cost_idx" ON "decision_invocations" USING btree ("cost_event_id");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "budget_reservations_decision_idx" ON "budget_reservations" USING btree ("company_id","decision_invocation_id");--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'budget_reservations_source_check' AND conrelid = 'budget_reservations'::regclass) THEN
+ ALTER TABLE "budget_reservations" ADD CONSTRAINT "budget_reservations_source_check" CHECK (("budget_reservations"."run_id" is not null)::int + ("budget_reservations"."decision_invocation_id" is not null)::int = 1);
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'cost_events_usage_kind_check' AND conrelid = 'cost_events'::regclass) THEN
+ ALTER TABLE "cost_events" ADD CONSTRAINT "cost_events_usage_kind_check" CHECK ("cost_events"."usage_kind" = 'decision' or ("cost_events"."usage_kind" = 'agent' and "cost_events"."agent_id" is not null));
+ END IF;
+END $$;
+--> statement-breakpoint
+ALTER TABLE "company_decision_models" DROP CONSTRAINT IF EXISTS "company_decision_models_connection_id_tool_connections_id_fk";
+--> statement-breakpoint
+ALTER TABLE "company_decision_models" DROP CONSTRAINT IF EXISTS "company_decision_models_grant_id_connection_grants_id_fk";
diff --git a/packages/db/src/migrations/0317_messy_famine.sql b/packages/db/src/migrations/0317_messy_famine.sql
new file mode 100644
index 00000000000..946e8628c25
--- /dev/null
+++ b/packages/db/src/migrations/0317_messy_famine.sql
@@ -0,0 +1,189 @@
+-- Dot-only additions after the merged public MCP gateway. Safe to reapply to a prototype schema.
+CREATE TABLE IF NOT EXISTS "dot_agent_bindings" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "operator_id" text NOT NULL,
+ "grant_id" uuid,
+ "generation" integer DEFAULT 1 NOT NULL,
+ "status" text DEFAULT 'pairing' NOT NULL,
+ "pairing_code_hash" text,
+ "pairing_expires_at" timestamp with time zone,
+ "dot_url" text,
+ "challenge_hash" text,
+ "challenge_expires_at" timestamp with time zone,
+ "ready_at" timestamp with time zone,
+ "revoked_at" timestamp with time zone,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "dot_mailbox_items" (
+ "id" bigserial PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "binding_id" uuid NOT NULL,
+ "binding_generation" integer NOT NULL,
+ "assignment_id" uuid,
+ "kind" text NOT NULL,
+ "source_event_id" text NOT NULL,
+ "references" jsonb NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "dot_runner_assignments" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "binding_id" uuid NOT NULL,
+ "binding_generation" integer NOT NULL,
+ "run_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "normalized_session_id" text NOT NULL,
+ "turn_id" text NOT NULL,
+ "revision" integer DEFAULT 1 NOT NULL,
+ "controller_generation" integer NOT NULL,
+ "catalog_digest" text NOT NULL,
+ "status" text NOT NULL,
+ "projection" jsonb NOT NULL,
+ "accept_by" timestamp with time zone NOT NULL,
+ "expires_at" timestamp with time zone NOT NULL,
+ "accepted_at" timestamp with time zone,
+ "settled_at" timestamp with time zone,
+ "last_activity_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "dot_runner_operations" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "assignment_id" uuid NOT NULL,
+ "request_id" uuid NOT NULL,
+ "digest" text NOT NULL,
+ "command" jsonb NOT NULL,
+ "status" text DEFAULT 'reserved' NOT NULL,
+ "outcome" jsonb,
+ "source_event_id" text,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "mcp_event_deliveries" ALTER COLUMN "activity_id" DROP NOT NULL;
+--> statement-breakpoint
+ALTER TABLE "mcp_event_subscriptions" ALTER COLUMN "task_id" DROP NOT NULL;
+--> statement-breakpoint
+ALTER TABLE "mcp_event_deliveries" ADD COLUMN IF NOT EXISTS "mailbox_item_id" integer;
+--> statement-breakpoint
+ALTER TABLE "mcp_event_subscriptions" ADD COLUMN IF NOT EXISTS "binding_id" uuid;
+--> statement-breakpoint
+ALTER TABLE "mcp_oauth_grants" ADD COLUMN IF NOT EXISTS "purpose" text DEFAULT 'personal' NOT NULL;
+--> statement-breakpoint
+ALTER TABLE "mcp_oauth_grants" ADD COLUMN IF NOT EXISTS "agent_id" uuid;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_agent_bindings_company_id_companies_id_fk' AND conrelid = 'public.dot_agent_bindings'::regclass) THEN
+ ALTER TABLE "dot_agent_bindings" ADD CONSTRAINT "dot_agent_bindings_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_agent_bindings_agent_id_agents_id_fk' AND conrelid = 'public.dot_agent_bindings'::regclass) THEN
+ ALTER TABLE "dot_agent_bindings" ADD CONSTRAINT "dot_agent_bindings_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk' AND conrelid = 'public.dot_agent_bindings'::regclass) THEN
+ ALTER TABLE "dot_agent_bindings" ADD CONSTRAINT "dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk" FOREIGN KEY ("grant_id") REFERENCES "public"."mcp_oauth_grants"("id") ON DELETE set null ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_mailbox_items_company_id_companies_id_fk' AND conrelid = 'public.dot_mailbox_items'::regclass) THEN
+ ALTER TABLE "dot_mailbox_items" ADD CONSTRAINT "dot_mailbox_items_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_mailbox_items_binding_id_dot_agent_bindings_id_fk' AND conrelid = 'public.dot_mailbox_items'::regclass) THEN
+ ALTER TABLE "dot_mailbox_items" ADD CONSTRAINT "dot_mailbox_items_binding_id_dot_agent_bindings_id_fk" FOREIGN KEY ("binding_id") REFERENCES "public"."dot_agent_bindings"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk' AND conrelid = 'public.dot_mailbox_items'::regclass) THEN
+ ALTER TABLE "dot_mailbox_items" ADD CONSTRAINT "dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk" FOREIGN KEY ("assignment_id") REFERENCES "public"."dot_runner_assignments"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_assignments_company_id_companies_id_fk' AND conrelid = 'public.dot_runner_assignments'::regclass) THEN
+ ALTER TABLE "dot_runner_assignments" ADD CONSTRAINT "dot_runner_assignments_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_assignments_binding_id_dot_agent_bindings_id_fk' AND conrelid = 'public.dot_runner_assignments'::regclass) THEN
+ ALTER TABLE "dot_runner_assignments" ADD CONSTRAINT "dot_runner_assignments_binding_id_dot_agent_bindings_id_fk" FOREIGN KEY ("binding_id") REFERENCES "public"."dot_agent_bindings"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_assignments_run_id_heartbeat_runs_id_fk' AND conrelid = 'public.dot_runner_assignments'::regclass) THEN
+ ALTER TABLE "dot_runner_assignments" ADD CONSTRAINT "dot_runner_assignments_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_assignments_agent_id_agents_id_fk' AND conrelid = 'public.dot_runner_assignments'::regclass) THEN
+ ALTER TABLE "dot_runner_assignments" ADD CONSTRAINT "dot_runner_assignments_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_operations_company_id_companies_id_fk' AND conrelid = 'public.dot_runner_operations'::regclass) THEN
+ ALTER TABLE "dot_runner_operations" ADD CONSTRAINT "dot_runner_operations_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'dot_runner_operations_assignment_id_dot_runner_assignments_id_fk' AND conrelid = 'public.dot_runner_operations'::regclass) THEN
+ ALTER TABLE "dot_runner_operations" ADD CONSTRAINT "dot_runner_operations_assignment_id_dot_runner_assignments_id_fk" FOREIGN KEY ("assignment_id") REFERENCES "public"."dot_runner_assignments"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_bindings_active_agent_uq" ON "dot_agent_bindings" USING btree ("company_id","agent_id") WHERE "dot_agent_bindings"."revoked_at" IS NULL;
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_bindings_active_grant_uq" ON "dot_agent_bindings" USING btree ("grant_id") WHERE "dot_agent_bindings"."revoked_at" IS NULL AND "dot_agent_bindings"."grant_id" IS NOT NULL;
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_bindings_pairing_code_uq" ON "dot_agent_bindings" USING btree ("pairing_code_hash");
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_mailbox_event_uq" ON "dot_mailbox_items" USING btree ("binding_id","binding_generation","source_event_id");
+--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "dot_mailbox_binding_cursor_idx" ON "dot_mailbox_items" USING btree ("binding_id","binding_generation","id");
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_assignments_turn_uq" ON "dot_runner_assignments" USING btree ("run_id","turn_id");
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_assignments_active_binding_uq" ON "dot_runner_assignments" USING btree ("binding_id") WHERE "dot_runner_assignments"."status" IN ('offered', 'accepted');
+--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "dot_assignments_company_idx" ON "dot_runner_assignments" USING btree ("company_id");
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "dot_operations_request_uq" ON "dot_runner_operations" USING btree ("assignment_id","request_id");
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'mcp_oauth_grants_agent_id_agents_id_fk' AND conrelid = 'public.mcp_oauth_grants'::regclass) THEN
+ ALTER TABLE "mcp_oauth_grants" ADD CONSTRAINT "mcp_oauth_grants_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action;
+ END IF;
+END $$;
+--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "mcp_event_deliveries_mailbox_uq" ON "mcp_event_deliveries" USING btree ("subscription_id","mailbox_item_id");
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'mcp_delivery_source_check' AND conrelid = 'public.mcp_event_deliveries'::regclass) THEN
+ ALTER TABLE "mcp_event_deliveries" ADD CONSTRAINT "mcp_delivery_source_check" CHECK (("mcp_event_deliveries"."activity_id" IS NOT NULL AND "mcp_event_deliveries"."mailbox_item_id" IS NULL) OR ("mcp_event_deliveries"."activity_id" IS NULL AND "mcp_event_deliveries"."mailbox_item_id" IS NOT NULL));
+ END IF;
+END $$;
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'mcp_subscription_resource_check' AND conrelid = 'public.mcp_event_subscriptions'::regclass) THEN
+ ALTER TABLE "mcp_event_subscriptions" ADD CONSTRAINT "mcp_subscription_resource_check" CHECK (("mcp_event_subscriptions"."task_id" IS NOT NULL AND "mcp_event_subscriptions"."binding_id" IS NULL) OR ("mcp_event_subscriptions"."task_id" IS NULL AND "mcp_event_subscriptions"."binding_id" IS NOT NULL));
+ END IF;
+END $$;
diff --git a/packages/db/src/migrations/0318_strong_blacklash.sql b/packages/db/src/migrations/0318_strong_blacklash.sql
new file mode 100644
index 00000000000..d53ac583935
--- /dev/null
+++ b/packages/db/src/migrations/0318_strong_blacklash.sql
@@ -0,0 +1,24 @@
+CREATE TABLE IF NOT EXISTS "chat_slack_registrations" (
+ "endpoint_id" uuid PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "request_id" uuid NOT NULL,
+ "status" text NOT NULL,
+ "manifest" jsonb NOT NULL,
+ "manifest_hash" text NOT NULL,
+ "callback_uri" text NOT NULL,
+ "app_id" text,
+ "client_id" text,
+ "secret_ids" jsonb DEFAULT '{}'::jsonb NOT NULL,
+ "workspace_id" text,
+ "bot_user_id" text,
+ "error_code" text,
+ "created_by_user_id" text NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "chat_slack_registration_status_check" CHECK ("chat_slack_registrations"."status" in ('creating', 'uncertain', 'failed', 'install', 'credentials_saved', 'configured', 'removed'))
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ALTER TABLE "chat_slack_registrations" ADD CONSTRAINT "chat_slack_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk" FOREIGN KEY ("company_id","endpoint_id") REFERENCES "public"."chat_endpoints"("company_id","id") ON DELETE cascade ON UPDATE no action;
+EXCEPTION WHEN duplicate_object THEN NULL;
+END $$;
diff --git a/packages/db/src/migrations/meta/0309_snapshot.json b/packages/db/src/migrations/meta/0309_snapshot.json
deleted file mode 100644
index 73605603da1..00000000000
--- a/packages/db/src/migrations/meta/0309_snapshot.json
+++ /dev/null
@@ -1,52564 +0,0 @@
-{
- "id": "593431cc-d6a8-4daf-a3e4-9e3c892d9419",
- "prevId": "00d98f2c-c054-4ca3-91eb-08211bdf418d",
- "version": "7",
- "dialect": "postgresql",
- "tables": {
- "public.activity_log": {
- "name": "activity_log",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'system'"
- },
- "actor_id": {
- "name": "actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "entity_type": {
- "name": "entity_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "entity_id": {
- "name": "entity_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "details": {
- "name": "details",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "activity_log_company_created_idx": {
- "name": "activity_log_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_log_company_agent_created_idx": {
- "name": "activity_log_company_agent_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_log_company_responsible_user_created_idx": {
- "name": "activity_log_company_responsible_user_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_log_run_id_idx": {
- "name": "activity_log_run_id_idx",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "activity_log_entity_type_id_idx": {
- "name": "activity_log_entity_type_id_idx",
- "columns": [
- {
- "expression": "entity_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "entity_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "activity_log_company_id_companies_id_fk": {
- "name": "activity_log_company_id_companies_id_fk",
- "tableFrom": "activity_log",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "activity_log_agent_id_agents_id_fk": {
- "name": "activity_log_agent_id_agents_id_fk",
- "tableFrom": "activity_log",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "activity_log_run_id_heartbeat_runs_id_fk": {
- "name": "activity_log_run_id_heartbeat_runs_id_fk",
- "tableFrom": "activity_log",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.adapter_auth_sessions": {
- "name": "adapter_auth_sessions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "environment_id": {
- "name": "environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "ai_connection": {
- "name": "ai_connection",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_grant_id": {
- "name": "connection_grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_method": {
- "name": "connection_method",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "adapter_type": {
- "name": "adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "started_by_user_id": {
- "name": "started_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "public_session_id": {
- "name": "public_session_id",
- "type": "varchar(128)",
- "primaryKey": false,
- "notNull": true
- },
- "provider_lease_id": {
- "name": "provider_lease_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'starting'"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "promotion_expires_at": {
- "name": "promotion_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "bound_at": {
- "name": "bound_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result_claim": {
- "name": "result_claim",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "adapter_auth_sessions_company_status_idx": {
- "name": "adapter_auth_sessions_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "adapter_auth_sessions_company_owner_adapter_active_uq": {
- "name": "adapter_auth_sessions_company_owner_adapter_active_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_by_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "adapter_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"adapter_auth_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'promoting', 'awaiting_code', 'submitting')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "adapter_auth_sessions_public_session_id_uq": {
- "name": "adapter_auth_sessions_public_session_id_uq",
- "columns": [
- {
- "expression": "public_session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "adapter_auth_sessions_environment_idx": {
- "name": "adapter_auth_sessions_environment_idx",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "adapter_auth_sessions_expires_idx": {
- "name": "adapter_auth_sessions_expires_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "adapter_auth_sessions_provider_lease_idx": {
- "name": "adapter_auth_sessions_provider_lease_idx",
- "columns": [
- {
- "expression": "provider_lease_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "adapter_auth_sessions_company_id_companies_id_fk": {
- "name": "adapter_auth_sessions_company_id_companies_id_fk",
- "tableFrom": "adapter_auth_sessions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "adapter_auth_sessions_environment_id_environments_id_fk": {
- "name": "adapter_auth_sessions_environment_id_environments_id_fk",
- "tableFrom": "adapter_auth_sessions",
- "tableTo": "environments",
- "columnsFrom": [
- "environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_api_keys": {
- "name": "agent_api_keys",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "key_hash": {
- "name": "key_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "scope_config": {
- "name": "scope_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_api_keys_key_hash_idx": {
- "name": "agent_api_keys_key_hash_idx",
- "columns": [
- {
- "expression": "key_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_api_keys_company_agent_idx": {
- "name": "agent_api_keys_company_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_api_keys_agent_id_agents_id_fk": {
- "name": "agent_api_keys_agent_id_agents_id_fk",
- "tableFrom": "agent_api_keys",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_api_keys_company_id_companies_id_fk": {
- "name": "agent_api_keys_company_id_companies_id_fk",
- "tableFrom": "agent_api_keys",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_config_revisions": {
- "name": "agent_config_revisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source": {
- "name": "source",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'patch'"
- },
- "rolled_back_from_revision_id": {
- "name": "rolled_back_from_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "changed_keys": {
- "name": "changed_keys",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "before_config": {
- "name": "before_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "after_config": {
- "name": "after_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_config_revisions_company_agent_created_idx": {
- "name": "agent_config_revisions_company_agent_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_config_revisions_agent_created_idx": {
- "name": "agent_config_revisions_agent_created_idx",
- "columns": [
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_config_revisions_company_id_companies_id_fk": {
- "name": "agent_config_revisions_company_id_companies_id_fk",
- "tableFrom": "agent_config_revisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_config_revisions_agent_id_agents_id_fk": {
- "name": "agent_config_revisions_agent_id_agents_id_fk",
- "tableFrom": "agent_config_revisions",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_config_revisions_created_by_agent_id_agents_id_fk": {
- "name": "agent_config_revisions_created_by_agent_id_agents_id_fk",
- "tableFrom": "agent_config_revisions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_identity_keys": {
- "name": "agent_identity_keys",
- "schema": "",
- "columns": {
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "algorithm": {
- "name": "algorithm",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "key_id": {
- "name": "key_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "public_key_pem": {
- "name": "public_key_pem",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "private_key_material": {
- "name": "private_key_material",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "agent_identity_keys_owner_fk": {
- "name": "agent_identity_keys_owner_fk",
- "tableFrom": "agent_identity_keys",
- "tableTo": "agents",
- "columnsFrom": [
- "company_id",
- "agent_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "agent_identity_keys_algorithm_check": {
- "name": "agent_identity_keys_algorithm_check",
- "value": "\"agent_identity_keys\".\"algorithm\" = 'Ed25519'"
- }
- },
- "isRLSEnabled": false
- },
- "public.agent_instruction_heads": {
- "name": "agent_instruction_heads",
- "schema": "",
- "columns": {
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "entry_file": {
- "name": "entry_file",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "revision_id": {
- "name": "revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk": {
- "name": "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk",
- "tableFrom": "agent_instruction_heads",
- "tableTo": "agent_instruction_revisions",
- "columnsFrom": [
- "company_id",
- "agent_id",
- "entry_file",
- "revision_id"
- ],
- "columnsTo": [
- "company_id",
- "agent_id",
- "entry_file",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "agent_instruction_heads_identity_uq": {
- "name": "agent_instruction_heads_identity_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "agent_id",
- "entry_file"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_instruction_revisions": {
- "name": "agent_instruction_revisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "entry_file": {
- "name": "entry_file",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content_base64": {
- "name": "content_base64",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content_hash": {
- "name": "content_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "byte_length": {
- "name": "byte_length",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "parent_revision_id": {
- "name": "parent_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "base_revision_id": {
- "name": "base_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "restored_from_revision_id": {
- "name": "restored_from_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "actor_agent_id": {
- "name": "actor_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "actor_user_id": {
- "name": "actor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_run_id": {
- "name": "source_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source": {
- "name": "source",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_instruction_revisions_history_idx": {
- "name": "agent_instruction_revisions_history_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "entry_file",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk": {
- "name": "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk",
- "tableFrom": "agent_instruction_revisions",
- "tableTo": "agents",
- "columnsFrom": [
- "company_id",
- "agent_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "agent_instruction_revisions_identity_uq": {
- "name": "agent_instruction_revisions_identity_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "agent_id",
- "entry_file",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_instruction_working_copies": {
- "name": "agent_instruction_working_copies",
- "schema": "",
- "columns": {
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "entry_file": {
- "name": "entry_file",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "base_revision_id": {
- "name": "base_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "base_hash": {
- "name": "base_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "local_root": {
- "name": "local_root",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "execution_root": {
- "name": "execution_root",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "location": {
- "name": "location",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'prepared'"
- },
- "candidate_base64": {
- "name": "candidate_base64",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "candidate_hash": {
- "name": "candidate_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error_message": {
- "name": "error_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "receipt": {
- "name": "receipt",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "process_stopped_at": {
- "name": "process_stopped_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_instruction_copies_pending_idx": {
- "name": "agent_instruction_copies_pending_idx",
- "columns": [
- {
- "expression": "state",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_instruction_copies_agent_idx": {
- "name": "agent_instruction_copies_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk": {
- "name": "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk",
- "tableFrom": "agent_instruction_working_copies",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk": {
- "name": "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk",
- "tableFrom": "agent_instruction_working_copies",
- "tableTo": "agents",
- "columnsFrom": [
- "company_id",
- "agent_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_memberships": {
- "name": "agent_memberships",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'joined'"
- },
- "starred_at": {
- "name": "starred_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_memberships_company_user_idx": {
- "name": "agent_memberships_company_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_memberships_company_user_starred_idx": {
- "name": "agent_memberships_company_user_starred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "starred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_memberships_agent_idx": {
- "name": "agent_memberships_agent_idx",
- "columns": [
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_memberships_company_user_agent_uq": {
- "name": "agent_memberships_company_user_agent_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_memberships_company_id_companies_id_fk": {
- "name": "agent_memberships_company_id_companies_id_fk",
- "tableFrom": "agent_memberships",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "agent_memberships_agent_id_agents_id_fk": {
- "name": "agent_memberships_agent_id_agents_id_fk",
- "tableFrom": "agent_memberships",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_runtime_state": {
- "name": "agent_runtime_state",
- "schema": "",
- "columns": {
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "adapter_type": {
- "name": "adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "session_id": {
- "name": "session_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "state_json": {
- "name": "state_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "last_run_id": {
- "name": "last_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_run_status": {
- "name": "last_run_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "total_input_tokens": {
- "name": "total_input_tokens",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "total_output_tokens": {
- "name": "total_output_tokens",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "total_cached_input_tokens": {
- "name": "total_cached_input_tokens",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "total_cost_cents": {
- "name": "total_cost_cents",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_runtime_state_company_agent_idx": {
- "name": "agent_runtime_state_company_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_runtime_state_company_updated_idx": {
- "name": "agent_runtime_state_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_runtime_state_agent_id_agents_id_fk": {
- "name": "agent_runtime_state_agent_id_agents_id_fk",
- "tableFrom": "agent_runtime_state",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_runtime_state_company_id_companies_id_fk": {
- "name": "agent_runtime_state_company_id_companies_id_fk",
- "tableFrom": "agent_runtime_state",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_session_goal_actions": {
- "name": "agent_session_goal_actions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "session_id": {
- "name": "session_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "request_id": {
- "name": "request_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload_json": {
- "name": "payload_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "result_json": {
- "name": "result_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "delivered_at": {
- "name": "delivered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_session_goal_actions_session_request_uniq": {
- "name": "agent_session_goal_actions_session_request_uniq",
- "columns": [
- {
- "expression": "session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "request_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_session_goal_actions_company_status_created_idx": {
- "name": "agent_session_goal_actions_company_status_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_session_goal_actions_session_created_idx": {
- "name": "agent_session_goal_actions_session_created_idx",
- "columns": [
- {
- "expression": "session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_session_goal_actions_company_id_companies_id_fk": {
- "name": "agent_session_goal_actions_company_id_companies_id_fk",
- "tableFrom": "agent_session_goal_actions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_session_goal_actions_session_id_agent_task_sessions_id_fk": {
- "name": "agent_session_goal_actions_session_id_agent_task_sessions_id_fk",
- "tableFrom": "agent_session_goal_actions",
- "tableTo": "agent_task_sessions",
- "columnsFrom": [
- "session_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_task_sessions": {
- "name": "agent_task_sessions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "adapter_type": {
- "name": "adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "task_key": {
- "name": "task_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "session_params_json": {
- "name": "session_params_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "session_display_id": {
- "name": "session_display_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_run_id": {
- "name": "last_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "goal_capability_json": {
- "name": "goal_capability_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "goal_json": {
- "name": "goal_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "goal_status": {
- "name": "goal_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "goal_desired_state": {
- "name": "goal_desired_state",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "goal_source_id": {
- "name": "goal_source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "goal_source_cursor": {
- "name": "goal_source_cursor",
- "type": "bigint",
- "primaryKey": false,
- "notNull": false
- },
- "goal_revision": {
- "name": "goal_revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "goal_observed_at": {
- "name": "goal_observed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_task_sessions_company_agent_adapter_task_uniq": {
- "name": "agent_task_sessions_company_agent_adapter_task_uniq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "adapter_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "task_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_task_sessions_company_agent_updated_idx": {
- "name": "agent_task_sessions_company_agent_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_task_sessions_company_task_updated_idx": {
- "name": "agent_task_sessions_company_task_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "task_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_task_sessions_company_id_companies_id_fk": {
- "name": "agent_task_sessions_company_id_companies_id_fk",
- "tableFrom": "agent_task_sessions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_task_sessions_agent_id_agents_id_fk": {
- "name": "agent_task_sessions_agent_id_agents_id_fk",
- "tableFrom": "agent_task_sessions",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_task_sessions_last_run_id_heartbeat_runs_id_fk": {
- "name": "agent_task_sessions_last_run_id_heartbeat_runs_id_fk",
- "tableFrom": "agent_task_sessions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "last_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agent_wakeup_requests": {
- "name": "agent_wakeup_requests",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source": {
- "name": "source",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trigger_detail": {
- "name": "trigger_detail",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queued'"
- },
- "coalesced_count": {
- "name": "coalesced_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "requested_by_actor_type": {
- "name": "requested_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "requested_by_actor_id": {
- "name": "requested_by_actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "requested_at": {
- "name": "requested_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "claimed_at": {
- "name": "claimed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agent_wakeup_requests_company_agent_status_idx": {
- "name": "agent_wakeup_requests_company_agent_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_company_requested_idx": {
- "name": "agent_wakeup_requests_company_requested_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "requested_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_agent_requested_idx": {
- "name": "agent_wakeup_requests_agent_requested_idx",
- "columns": [
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "requested_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_review_path_recovery_idempotency_uq": {
- "name": "agent_wakeup_requests_review_path_recovery_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_review_path_lost:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_disposition_repair_idempotency_uq": {
- "name": "agent_wakeup_requests_disposition_repair_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_disposition_repair:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_question_response_delivery_idempotency_uq": {
- "name": "agent_wakeup_requests_question_response_delivery_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "(\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'question-response:%' OR \"agent_wakeup_requests\".\"idempotency_key\" LIKE 'interaction:%') AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_connection_intent_delivery_idempotency_uq": {
- "name": "agent_wakeup_requests_connection_intent_delivery_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'connection-intent:%' AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_tool_action_delivery_uq": {
- "name": "agent_wakeup_requests_tool_action_delivery_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'tool-action-response:%' AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_chat_completion_uq": {
- "name": "agent_wakeup_requests_chat_completion_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'chat-completion:%'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agent_wakeup_requests_company_payload_issue_idx": {
- "name": "agent_wakeup_requests_company_payload_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "(\"payload\" ->> 'issueId')",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agent_wakeup_requests_company_id_companies_id_fk": {
- "name": "agent_wakeup_requests_company_id_companies_id_fk",
- "tableFrom": "agent_wakeup_requests",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agent_wakeup_requests_agent_id_agents_id_fk": {
- "name": "agent_wakeup_requests_agent_id_agents_id_fk",
- "tableFrom": "agent_wakeup_requests",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.agents": {
- "name": "agents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'general'"
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "icon": {
- "name": "icon",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "appearance": {
- "name": "appearance",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'idle'"
- },
- "reports_to": {
- "name": "reports_to",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "capabilities": {
- "name": "capabilities",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "adapter_type": {
- "name": "adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'process'"
- },
- "adapter_config": {
- "name": "adapter_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "runtime_config": {
- "name": "runtime_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "default_environment_id": {
- "name": "default_environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "budget_monthly_cents": {
- "name": "budget_monthly_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "spent_monthly_cents": {
- "name": "spent_monthly_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "pause_reason": {
- "name": "pause_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "paused_at": {
- "name": "paused_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "error_reason": {
- "name": "error_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "permissions": {
- "name": "permissions",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "last_heartbeat_at": {
- "name": "last_heartbeat_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "agents_company_status_idx": {
- "name": "agents_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agents_company_reports_to_idx": {
- "name": "agents_company_reports_to_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "reports_to",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "agents_company_default_environment_idx": {
- "name": "agents_company_default_environment_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "default_environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "agents_company_id_companies_id_fk": {
- "name": "agents_company_id_companies_id_fk",
- "tableFrom": "agents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agents_reports_to_agents_id_fk": {
- "name": "agents_reports_to_agents_id_fk",
- "tableFrom": "agents",
- "tableTo": "agents",
- "columnsFrom": [
- "reports_to"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "agents_default_environment_id_environments_id_fk": {
- "name": "agents_default_environment_id_environments_id_fk",
- "tableFrom": "agents",
- "tableTo": "environments",
- "columnsFrom": [
- "default_environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "agents_company_id_uq": {
- "name": "agents_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.ai_connection_defaults": {
- "name": "ai_connection_defaults",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "method": {
- "name": "method",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "ai_connection_defaults_owner_method_uq": {
- "name": "ai_connection_defaults_owner_method_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "method",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "ai_connection_defaults_company_id_companies_id_fk": {
- "name": "ai_connection_defaults_company_id_companies_id_fk",
- "tableFrom": "ai_connection_defaults",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_defaults_company_grant_fk": {
- "name": "ai_connection_defaults_company_grant_fk",
- "tableFrom": "ai_connection_defaults",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "company_id",
- "grant_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "ai_connection_defaults_provider_check": {
- "name": "ai_connection_defaults_provider_check",
- "value": "\"ai_connection_defaults\".\"provider\" in ('anthropic','openai','openrouter','xai','google')"
- },
- "ai_connection_defaults_method_check": {
- "name": "ai_connection_defaults_method_check",
- "value": "\"ai_connection_defaults\".\"method\" in ('subscription','api_key')"
- }
- },
- "isRLSEnabled": false
- },
- "public.ai_connection_pools": {
- "name": "ai_connection_pools",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_key": {
- "name": "plugin_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "ai_connection_pools_id_tool_connections_id_fk": {
- "name": "ai_connection_pools_id_tool_connections_id_fk",
- "tableFrom": "ai_connection_pools",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_pools_company_id_companies_id_fk": {
- "name": "ai_connection_pools_company_id_companies_id_fk",
- "tableFrom": "ai_connection_pools",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_pools_company_connection_fk": {
- "name": "ai_connection_pools_company_connection_fk",
- "tableFrom": "ai_connection_pools",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "company_id",
- "id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "ai_connection_pools_company_id_uq": {
- "name": "ai_connection_pools_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.ai_connection_router_cursors": {
- "name": "ai_connection_router_cursors",
- "schema": "",
- "columns": {
- "pool_id": {
- "name": "pool_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "last_member_id": {
- "name": "last_member_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- }
- },
- "indexes": {},
- "foreignKeys": {
- "ai_connection_router_cursors_pool_id_ai_connection_pools_id_fk": {
- "name": "ai_connection_router_cursors_pool_id_ai_connection_pools_id_fk",
- "tableFrom": "ai_connection_router_cursors",
- "tableTo": "ai_connection_pools",
- "columnsFrom": [
- "pool_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_router_cursors_company_id_companies_id_fk": {
- "name": "ai_connection_router_cursors_company_id_companies_id_fk",
- "tableFrom": "ai_connection_router_cursors",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_router_cursors_company_pool_fk": {
- "name": "ai_connection_router_cursors_company_pool_fk",
- "tableFrom": "ai_connection_router_cursors",
- "tableTo": "ai_connection_pools",
- "columnsFrom": [
- "company_id",
- "pool_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.ai_connection_task_pins": {
- "name": "ai_connection_task_pins",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "pool_id": {
- "name": "pool_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "task_key": {
- "name": "task_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "selection": {
- "name": "selection",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "member": {
- "name": "member",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "ai_connection_task_pins_affinity_uq": {
- "name": "ai_connection_task_pins_affinity_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "pool_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "task_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "ai_connection_task_pins_company_id_companies_id_fk": {
- "name": "ai_connection_task_pins_company_id_companies_id_fk",
- "tableFrom": "ai_connection_task_pins",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_task_pins_pool_id_ai_connection_pools_id_fk": {
- "name": "ai_connection_task_pins_pool_id_ai_connection_pools_id_fk",
- "tableFrom": "ai_connection_task_pins",
- "tableTo": "ai_connection_pools",
- "columnsFrom": [
- "pool_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_task_pins_agent_id_agents_id_fk": {
- "name": "ai_connection_task_pins_agent_id_agents_id_fk",
- "tableFrom": "ai_connection_task_pins",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_task_pins_company_pool_fk": {
- "name": "ai_connection_task_pins_company_pool_fk",
- "tableFrom": "ai_connection_task_pins",
- "tableTo": "ai_connection_pools",
- "columnsFrom": [
- "company_id",
- "pool_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_connection_task_pins_company_agent_fk": {
- "name": "ai_connection_task_pins_company_agent_fk",
- "tableFrom": "ai_connection_task_pins",
- "tableTo": "agents",
- "columnsFrom": [
- "company_id",
- "agent_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.ai_provider_defaults": {
- "name": "ai_provider_defaults",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "ai_provider_defaults_owner_provider_uq": {
- "name": "ai_provider_defaults_owner_provider_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "ai_provider_defaults_company_id_companies_id_fk": {
- "name": "ai_provider_defaults_company_id_companies_id_fk",
- "tableFrom": "ai_provider_defaults",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "ai_provider_defaults_company_grant_fk": {
- "name": "ai_provider_defaults_company_grant_fk",
- "tableFrom": "ai_provider_defaults",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "company_id",
- "grant_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "ai_provider_defaults_provider_check": {
- "name": "ai_provider_defaults_provider_check",
- "value": "\"ai_provider_defaults\".\"provider\" in ('anthropic','openai','openrouter','xai','google')"
- }
- },
- "isRLSEnabled": false
- },
- "public.announcement_dismissals": {
- "name": "announcement_dismissals",
- "schema": "",
- "columns": {
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "announcement_id": {
- "name": "announcement_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "dismissed_at": {
- "name": "dismissed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {
- "announcement_dismissals_user_id_announcement_id_pk": {
- "name": "announcement_dismissals_user_id_announcement_id_pk",
- "columns": [
- "user_id",
- "announcement_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.announcement_publications": {
- "name": "announcement_publications",
- "schema": "",
- "columns": {
- "announcement_id": {
- "name": "announcement_id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.approval_comments": {
- "name": "approval_comments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "approval_id": {
- "name": "approval_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "author_agent_id": {
- "name": "author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "approval_comments_company_idx": {
- "name": "approval_comments_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "approval_comments_approval_idx": {
- "name": "approval_comments_approval_idx",
- "columns": [
- {
- "expression": "approval_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "approval_comments_approval_created_idx": {
- "name": "approval_comments_approval_created_idx",
- "columns": [
- {
- "expression": "approval_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "approval_comments_company_id_companies_id_fk": {
- "name": "approval_comments_company_id_companies_id_fk",
- "tableFrom": "approval_comments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "approval_comments_approval_id_approvals_id_fk": {
- "name": "approval_comments_approval_id_approvals_id_fk",
- "tableFrom": "approval_comments",
- "tableTo": "approvals",
- "columnsFrom": [
- "approval_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "approval_comments_author_agent_id_agents_id_fk": {
- "name": "approval_comments_author_agent_id_agents_id_fk",
- "tableFrom": "approval_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.approvals": {
- "name": "approvals",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "requested_by_agent_id": {
- "name": "requested_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "requested_by_user_id": {
- "name": "requested_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "decision_note": {
- "name": "decision_note",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_by_user_id": {
- "name": "decided_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_at": {
- "name": "decided_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "approvals_company_status_type_idx": {
- "name": "approvals_company_status_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "approvals_company_id_companies_id_fk": {
- "name": "approvals_company_id_companies_id_fk",
- "tableFrom": "approvals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "approvals_requested_by_agent_id_agents_id_fk": {
- "name": "approvals_requested_by_agent_id_agents_id_fk",
- "tableFrom": "approvals",
- "tableTo": "agents",
- "columnsFrom": [
- "requested_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.assets": {
- "name": "assets",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "object_key": {
- "name": "object_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content_type": {
- "name": "content_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "byte_size": {
- "name": "byte_size",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "sha256": {
- "name": "sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "original_filename": {
- "name": "original_filename",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "assets_company_created_idx": {
- "name": "assets_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "assets_company_provider_idx": {
- "name": "assets_company_provider_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "assets_company_object_key_uq": {
- "name": "assets_company_object_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "assets_company_id_companies_id_fk": {
- "name": "assets_company_id_companies_id_fk",
- "tableFrom": "assets",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "assets_created_by_agent_id_agents_id_fk": {
- "name": "assets_created_by_agent_id_agents_id_fk",
- "tableFrom": "assets",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.account": {
- "name": "account",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "issuer": {
- "name": "issuer",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "account_issuer_account_id_uq": {
- "name": "account_issuer_account_id_uq",
- "columns": [
- {
- "expression": "issuer",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "account_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "account_user_id_user_id_fk": {
- "name": "account_user_id_user_id_fk",
- "tableFrom": "account",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.session": {
- "name": "session",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "session_user_id_user_id_fk": {
- "name": "session_user_id_user_id_fk",
- "tableFrom": "session",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user": {
- "name": "user",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "email_verified": {
- "name": "email_verified",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.verification": {
- "name": "verification",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.board_api_keys": {
- "name": "board_api_keys",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "key_hash": {
- "name": "key_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "board_api_keys_key_hash_idx": {
- "name": "board_api_keys_key_hash_idx",
- "columns": [
- {
- "expression": "key_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "board_api_keys_user_idx": {
- "name": "board_api_keys_user_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "board_api_keys_user_id_user_id_fk": {
- "name": "board_api_keys_user_id_user_id_fk",
- "tableFrom": "board_api_keys",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.browser_use_browsers": {
- "name": "browser_use_browsers",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "session_id": {
- "name": "session_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_browser_id": {
- "name": "provider_browser_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "browser_use_browsers_provider_uq": {
- "name": "browser_use_browsers_provider_uq",
- "columns": [
- {
- "expression": "provider_browser_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "browser_use_browsers_session_idx": {
- "name": "browser_use_browsers_session_idx",
- "columns": [
- {
- "expression": "session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "browser_use_browsers_company_id_companies_id_fk": {
- "name": "browser_use_browsers_company_id_companies_id_fk",
- "tableFrom": "browser_use_browsers",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_browsers_session_id_browser_use_sessions_id_fk": {
- "name": "browser_use_browsers_session_id_browser_use_sessions_id_fk",
- "tableFrom": "browser_use_browsers",
- "tableTo": "browser_use_sessions",
- "columnsFrom": [
- "session_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.browser_use_runs": {
- "name": "browser_use_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "session_id": {
- "name": "session_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "invocation_id": {
- "name": "invocation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_run_id": {
- "name": "provider_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "recovery_cursor": {
- "name": "recovery_cursor",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'creating'"
- },
- "detached_until": {
- "name": "detached_until",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "event_cursor": {
- "name": "event_cursor",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "events_drained": {
- "name": "events_drained",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "accounted_cents": {
- "name": "accounted_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "progress": {
- "name": "progress",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result": {
- "name": "result",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "browser_use_runs_invocation_uq": {
- "name": "browser_use_runs_invocation_uq",
- "columns": [
- {
- "expression": "invocation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "browser_use_runs_provider_uq": {
- "name": "browser_use_runs_provider_uq",
- "columns": [
- {
- "expression": "provider_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "browser_use_runs_session_idx": {
- "name": "browser_use_runs_session_idx",
- "columns": [
- {
- "expression": "session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "browser_use_runs_company_id_companies_id_fk": {
- "name": "browser_use_runs_company_id_companies_id_fk",
- "tableFrom": "browser_use_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_runs_session_id_browser_use_sessions_id_fk": {
- "name": "browser_use_runs_session_id_browser_use_sessions_id_fk",
- "tableFrom": "browser_use_runs",
- "tableTo": "browser_use_sessions",
- "columnsFrom": [
- "session_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "browser_use_runs",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.browser_use_sessions": {
- "name": "browser_use_sessions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_session_id": {
- "name": "provider_session_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'starting'"
- },
- "idle_deadline": {
- "name": "idle_deadline",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "stop_requested": {
- "name": "stop_requested",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "lease_token": {
- "name": "lease_token",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "lease_until": {
- "name": "lease_until",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "next_poll_at": {
- "name": "next_poll_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "browser_use_sessions_task_idx": {
- "name": "browser_use_sessions_task_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "browser_use_sessions_provider_uq": {
- "name": "browser_use_sessions_provider_uq",
- "columns": [
- {
- "expression": "provider_session_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "browser_use_sessions_company_id_companies_id_fk": {
- "name": "browser_use_sessions_company_id_companies_id_fk",
- "tableFrom": "browser_use_sessions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_sessions_issue_id_issues_id_fk": {
- "name": "browser_use_sessions_issue_id_issues_id_fk",
- "tableFrom": "browser_use_sessions",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_sessions_agent_id_agents_id_fk": {
- "name": "browser_use_sessions_agent_id_agents_id_fk",
- "tableFrom": "browser_use_sessions",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_sessions_connection_id_tool_connections_id_fk": {
- "name": "browser_use_sessions_connection_id_tool_connections_id_fk",
- "tableFrom": "browser_use_sessions",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_sessions_grant_id_connection_grants_id_fk": {
- "name": "browser_use_sessions_grant_id_connection_grants_id_fk",
- "tableFrom": "browser_use_sessions",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.browser_use_settings": {
- "name": "browser_use_settings",
- "schema": "",
- "columns": {
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "allowed_profile_ids": {
- "name": "allowed_profile_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "max_cost_usd": {
- "name": "max_cost_usd",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "browser_use_settings_grant_id_connection_grants_id_fk": {
- "name": "browser_use_settings_grant_id_connection_grants_id_fk",
- "tableFrom": "browser_use_settings",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "browser_use_settings_company_id_companies_id_fk": {
- "name": "browser_use_settings_company_id_companies_id_fk",
- "tableFrom": "browser_use_settings",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.budget_incidents": {
- "name": "budget_incidents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "policy_id": {
- "name": "policy_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "scope_type": {
- "name": "scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "metric": {
- "name": "metric",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "window_kind": {
- "name": "window_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "window_start": {
- "name": "window_start",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "window_end": {
- "name": "window_end",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "threshold_type": {
- "name": "threshold_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "amount_limit": {
- "name": "amount_limit",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "amount_observed": {
- "name": "amount_observed",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'open'"
- },
- "approval_id": {
- "name": "approval_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "budget_incidents_company_status_idx": {
- "name": "budget_incidents_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "budget_incidents_company_scope_idx": {
- "name": "budget_incidents_company_scope_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "budget_incidents_policy_window_threshold_idx": {
- "name": "budget_incidents_policy_window_threshold_idx",
- "columns": [
- {
- "expression": "policy_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_start",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "threshold_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"budget_incidents\".\"status\" <> 'dismissed'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "budget_incidents_company_id_companies_id_fk": {
- "name": "budget_incidents_company_id_companies_id_fk",
- "tableFrom": "budget_incidents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "budget_incidents_policy_id_budget_policies_id_fk": {
- "name": "budget_incidents_policy_id_budget_policies_id_fk",
- "tableFrom": "budget_incidents",
- "tableTo": "budget_policies",
- "columnsFrom": [
- "policy_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "budget_incidents_approval_id_approvals_id_fk": {
- "name": "budget_incidents_approval_id_approvals_id_fk",
- "tableFrom": "budget_incidents",
- "tableTo": "approvals",
- "columnsFrom": [
- "approval_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.budget_policies": {
- "name": "budget_policies",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "scope_type": {
- "name": "scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "metric": {
- "name": "metric",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'billed_cents'"
- },
- "window_kind": {
- "name": "window_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "amount": {
- "name": "amount",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "warn_percent": {
- "name": "warn_percent",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 80
- },
- "hard_stop_enabled": {
- "name": "hard_stop_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "notify_enabled": {
- "name": "notify_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "is_active": {
- "name": "is_active",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "budget_policies_company_scope_active_idx": {
- "name": "budget_policies_company_scope_active_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "is_active",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "budget_policies_company_window_idx": {
- "name": "budget_policies_company_window_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "metric",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "budget_policies_company_scope_metric_unique_idx": {
- "name": "budget_policies_company_scope_metric_unique_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "metric",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "budget_policies_company_id_companies_id_fk": {
- "name": "budget_policies_company_id_companies_id_fk",
- "tableFrom": "budget_policies",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.built_in_managed_resources": {
- "name": "built_in_managed_resources",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "bundle_key": {
- "name": "bundle_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_kind": {
- "name": "resource_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_key": {
- "name": "resource_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_id": {
- "name": "resource_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "stock_version": {
- "name": "stock_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "stock_hash": {
- "name": "stock_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "defaults_json": {
- "name": "defaults_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "built_in_managed_resources_company_idx": {
- "name": "built_in_managed_resources_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "built_in_managed_resources_resource_idx": {
- "name": "built_in_managed_resources_resource_idx",
- "columns": [
- {
- "expression": "resource_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "built_in_managed_resources_company_bundle_resource_uq": {
- "name": "built_in_managed_resources_company_bundle_resource_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bundle_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "built_in_managed_resources_company_id_companies_id_fk": {
- "name": "built_in_managed_resources_company_id_companies_id_fk",
- "tableFrom": "built_in_managed_resources",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.case_attachments": {
- "name": "case_attachments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "asset_id": {
- "name": "asset_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "case_attachments_company_case_idx": {
- "name": "case_attachments_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_attachments_asset_uq": {
- "name": "case_attachments_asset_uq",
- "columns": [
- {
- "expression": "asset_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "case_attachments_company_id_companies_id_fk": {
- "name": "case_attachments_company_id_companies_id_fk",
- "tableFrom": "case_attachments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_attachments_case_id_cases_id_fk": {
- "name": "case_attachments_case_id_cases_id_fk",
- "tableFrom": "case_attachments",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_attachments_asset_id_assets_id_fk": {
- "name": "case_attachments_asset_id_assets_id_fk",
- "tableFrom": "case_attachments",
- "tableTo": "assets",
- "columnsFrom": [
- "asset_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.case_documents": {
- "name": "case_documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "case_documents_company_case_key_uq": {
- "name": "case_documents_company_case_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_documents_document_uq": {
- "name": "case_documents_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_documents_company_case_updated_idx": {
- "name": "case_documents_company_case_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "case_documents_company_id_companies_id_fk": {
- "name": "case_documents_company_id_companies_id_fk",
- "tableFrom": "case_documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_documents_case_id_cases_id_fk": {
- "name": "case_documents_case_id_cases_id_fk",
- "tableFrom": "case_documents",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_documents_document_id_documents_id_fk": {
- "name": "case_documents_document_id_documents_id_fk",
- "tableFrom": "case_documents",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.case_events": {
- "name": "case_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_user_id": {
- "name": "actor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "actor_agent_id": {
- "name": "actor_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "case_events_case_created_idx": {
- "name": "case_events_case_created_idx",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_events_company_case_idx": {
- "name": "case_events_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "case_events_company_id_companies_id_fk": {
- "name": "case_events_company_id_companies_id_fk",
- "tableFrom": "case_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_events_case_id_cases_id_fk": {
- "name": "case_events_case_id_cases_id_fk",
- "tableFrom": "case_events",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_events_actor_agent_id_agents_id_fk": {
- "name": "case_events_actor_agent_id_agents_id_fk",
- "tableFrom": "case_events",
- "tableTo": "agents",
- "columnsFrom": [
- "actor_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "case_events_kind_check": {
- "name": "case_events_kind_check",
- "value": "\"case_events\".\"kind\" in (\n 'created',\n 'updated',\n 'fields_changed',\n 'status_changed',\n 'issue_linked',\n 'issue_unlinked',\n 'document_revised',\n 'child_linked',\n 'attachment_added',\n 'label_added',\n 'label_removed'\n )"
- },
- "case_events_actor_type_check": {
- "name": "case_events_actor_type_check",
- "value": "\"case_events\".\"actor_type\" in ('user', 'agent', 'system')"
- }
- },
- "isRLSEnabled": false
- },
- "public.case_issue_links": {
- "name": "case_issue_links",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "case_issue_links_case_issue_uq": {
- "name": "case_issue_links_case_issue_uq",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_issue_links_company_case_idx": {
- "name": "case_issue_links_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_issue_links_issue_idx": {
- "name": "case_issue_links_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "case_issue_links_company_id_companies_id_fk": {
- "name": "case_issue_links_company_id_companies_id_fk",
- "tableFrom": "case_issue_links",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_issue_links_case_id_cases_id_fk": {
- "name": "case_issue_links_case_id_cases_id_fk",
- "tableFrom": "case_issue_links",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_issue_links_issue_id_issues_id_fk": {
- "name": "case_issue_links_issue_id_issues_id_fk",
- "tableFrom": "case_issue_links",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "case_issue_links_role_check": {
- "name": "case_issue_links_role_check",
- "value": "\"case_issue_links\".\"role\" in ('origin', 'work', 'reference')"
- }
- },
- "isRLSEnabled": false
- },
- "public.case_labels": {
- "name": "case_labels",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "label_id": {
- "name": "label_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "case_labels_case_label_uq": {
- "name": "case_labels_case_label_uq",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "label_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_labels_company_case_idx": {
- "name": "case_labels_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "case_labels_label_idx": {
- "name": "case_labels_label_idx",
- "columns": [
- {
- "expression": "label_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "case_labels_company_id_companies_id_fk": {
- "name": "case_labels_company_id_companies_id_fk",
- "tableFrom": "case_labels",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_labels_case_id_cases_id_fk": {
- "name": "case_labels_case_id_cases_id_fk",
- "tableFrom": "case_labels",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "case_labels_label_id_labels_id_fk": {
- "name": "case_labels_label_id_labels_id_fk",
- "tableFrom": "case_labels",
- "tableTo": "labels",
- "columnsFrom": [
- "label_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.cases": {
- "name": "cases",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "case_number": {
- "name": "case_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "case_type": {
- "name": "case_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "summary": {
- "name": "summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'draft'"
- },
- "fields": {
- "name": "fields",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "parent_case_id": {
- "name": "parent_case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "cases_company_case_number_uq": {
- "name": "cases_company_case_number_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_identifier_uq": {
- "name": "cases_identifier_uq",
- "columns": [
- {
- "expression": "identifier",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_company_type_key_uq": {
- "name": "cases_company_type_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_company_status_idx": {
- "name": "cases_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_company_type_idx": {
- "name": "cases_company_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_company_project_idx": {
- "name": "cases_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_parent_idx": {
- "name": "cases_parent_idx",
- "columns": [
- {
- "expression": "parent_case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cases_title_search_idx": {
- "name": "cases_title_search_idx",
- "columns": [
- {
- "expression": "title",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "cases_identifier_search_idx": {
- "name": "cases_identifier_search_idx",
- "columns": [
- {
- "expression": "identifier",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "cases_summary_search_idx": {
- "name": "cases_summary_search_idx",
- "columns": [
- {
- "expression": "summary",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- }
- },
- "foreignKeys": {
- "cases_company_id_companies_id_fk": {
- "name": "cases_company_id_companies_id_fk",
- "tableFrom": "cases",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "cases_project_id_projects_id_fk": {
- "name": "cases_project_id_projects_id_fk",
- "tableFrom": "cases",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "cases_parent_case_id_cases_id_fk": {
- "name": "cases_parent_case_id_cases_id_fk",
- "tableFrom": "cases",
- "tableTo": "cases",
- "columnsFrom": [
- "parent_case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "cases_created_by_agent_id_agents_id_fk": {
- "name": "cases_created_by_agent_id_agents_id_fk",
- "tableFrom": "cases",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "cases_status_check": {
- "name": "cases_status_check",
- "value": "\"cases\".\"status\" in ('draft', 'in_progress', 'in_review', 'approved', 'done', 'cancelled')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_actions": {
- "name": "chat_actions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_id": {
- "name": "delivery_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "principal_id": {
- "name": "principal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_action_id": {
- "name": "provider_action_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'received'"
- },
- "result": {
- "name": "result",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_actions_provider_action_uq": {
- "name": "chat_actions_provider_action_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_action_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_actions_company_id_companies_id_fk": {
- "name": "chat_actions_company_id_companies_id_fk",
- "tableFrom": "chat_actions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_actions_delivery_id_chat_deliveries_id_fk": {
- "name": "chat_actions_delivery_id_chat_deliveries_id_fk",
- "tableFrom": "chat_actions",
- "tableTo": "chat_deliveries",
- "columnsFrom": [
- "delivery_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_actions_company_delivery_fk": {
- "name": "chat_actions_company_delivery_fk",
- "tableFrom": "chat_actions",
- "tableTo": "chat_deliveries",
- "columnsFrom": [
- "company_id",
- "delivery_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_actions_company_conversation_fk": {
- "name": "chat_actions_company_conversation_fk",
- "tableFrom": "chat_actions",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_actions_company_principal_fk": {
- "name": "chat_actions_company_principal_fk",
- "tableFrom": "chat_actions",
- "tableTo": "chat_external_principals",
- "columnsFrom": [
- "company_id",
- "principal_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_actions_company_endpoint_fk": {
- "name": "chat_actions_company_endpoint_fk",
- "tableFrom": "chat_actions",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.chat_agent_routes": {
- "name": "chat_agent_routes",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_endpoint_id": {
- "name": "source_endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "destination_endpoint_id": {
- "name": "destination_endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "trigger_mode": {
- "name": "trigger_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'explicit_mention'"
- },
- "max_hops": {
- "name": "max_hops",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_agent_routes_pair_uq": {
- "name": "chat_agent_routes_pair_uq",
- "columns": [
- {
- "expression": "source_endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "destination_endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_agent_routes_company_id_companies_id_fk": {
- "name": "chat_agent_routes_company_id_companies_id_fk",
- "tableFrom": "chat_agent_routes",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_agent_routes_company_source_fk": {
- "name": "chat_agent_routes_company_source_fk",
- "tableFrom": "chat_agent_routes",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "source_endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_agent_routes_company_destination_fk": {
- "name": "chat_agent_routes_company_destination_fk",
- "tableFrom": "chat_agent_routes",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "destination_endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_agent_routes_hops_check": {
- "name": "chat_agent_routes_hops_check",
- "value": "\"chat_agent_routes\".\"max_hops\" between 1 and 8"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_conversations": {
- "name": "chat_conversations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "resource_id": {
- "name": "resource_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "external_conversation_id": {
- "name": "external_conversation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_thread_id": {
- "name": "external_thread_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "session_generation": {
- "name": "session_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "external_label": {
- "name": "external_label",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_url": {
- "name": "provider_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "is_direct_message": {
- "name": "is_direct_message",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "communication_guidance": {
- "name": "communication_guidance",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "last_activity_at": {
- "name": "last_activity_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_conversations_issue_idx": {
- "name": "chat_conversations_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_conversations_thread_uq": {
- "name": "chat_conversations_thread_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "external_conversation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "external_thread_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "session_generation",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_conversations_company_id_companies_id_fk": {
- "name": "chat_conversations_company_id_companies_id_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_conversations_resource_id_chat_endpoint_resources_id_fk": {
- "name": "chat_conversations_resource_id_chat_endpoint_resources_id_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "chat_endpoint_resources",
- "columnsFrom": [
- "resource_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_conversations_issue_id_issues_id_fk": {
- "name": "chat_conversations_issue_id_issues_id_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "chat_conversations_company_issue_fk": {
- "name": "chat_conversations_company_issue_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_conversations_company_endpoint_fk": {
- "name": "chat_conversations_company_endpoint_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_conversations_company_resource_fk": {
- "name": "chat_conversations_company_resource_fk",
- "tableFrom": "chat_conversations",
- "tableTo": "chat_endpoint_resources",
- "columnsFrom": [
- "company_id",
- "resource_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_conversations_company_id_uq": {
- "name": "chat_conversations_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_conversations_state_check": {
- "name": "chat_conversations_state_check",
- "value": "\"chat_conversations\".\"state\" in ('active', 'waiting', 'completed', 'unavailable', 'endpoint_removed')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_deliveries": {
- "name": "chat_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "principal_id": {
- "name": "principal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_event_id": {
- "name": "provider_event_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "deduplication_key": {
- "name": "deduplication_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "event_kind": {
- "name": "event_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "normalized_event": {
- "name": "normalized_event",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'received'"
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "redacted_error": {
- "name": "redacted_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "received_at": {
- "name": "received_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "processed_at": {
- "name": "processed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_deliveries_work_idx": {
- "name": "chat_deliveries_work_idx",
- "columns": [
- {
- "expression": "state",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_deliveries_event_uq": {
- "name": "chat_deliveries_event_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_event_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_deliveries_dedupe_uq": {
- "name": "chat_deliveries_dedupe_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "deduplication_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_deliveries_company_id_companies_id_fk": {
- "name": "chat_deliveries_company_id_companies_id_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_deliveries_conversation_id_chat_conversations_id_fk": {
- "name": "chat_deliveries_conversation_id_chat_conversations_id_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "conversation_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_deliveries_principal_id_chat_external_principals_id_fk": {
- "name": "chat_deliveries_principal_id_chat_external_principals_id_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "chat_external_principals",
- "columnsFrom": [
- "principal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_deliveries_company_endpoint_fk": {
- "name": "chat_deliveries_company_endpoint_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_deliveries_company_conversation_fk": {
- "name": "chat_deliveries_company_conversation_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_deliveries_company_principal_fk": {
- "name": "chat_deliveries_company_principal_fk",
- "tableFrom": "chat_deliveries",
- "tableTo": "chat_external_principals",
- "columnsFrom": [
- "company_id",
- "principal_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_deliveries_company_id_uq": {
- "name": "chat_deliveries_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_deliveries_state_check": {
- "name": "chat_deliveries_state_check",
- "value": "\"chat_deliveries\".\"state\" in ('received', 'filtered', 'processing', 'processed', 'retry', 'failed')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_endpoint_leases": {
- "name": "chat_endpoint_leases",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "lease_key": {
- "name": "lease_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_endpoint_leases_active_uq": {
- "name": "chat_endpoint_leases_active_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "lease_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoint_leases_expiry_idx": {
- "name": "chat_endpoint_leases_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_endpoint_leases_company_id_companies_id_fk": {
- "name": "chat_endpoint_leases_company_id_companies_id_fk",
- "tableFrom": "chat_endpoint_leases",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_endpoint_leases_company_endpoint_fk": {
- "name": "chat_endpoint_leases_company_endpoint_fk",
- "tableFrom": "chat_endpoint_leases",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.chat_endpoint_resources": {
- "name": "chat_endpoint_resources",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_resource_id": {
- "name": "provider_resource_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "parent_provider_resource_id": {
- "name": "parent_provider_resource_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "detail": {
- "name": "detail",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_url": {
- "name": "provider_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "availability": {
- "name": "availability",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'available'"
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_endpoint_resources_endpoint_idx": {
- "name": "chat_endpoint_resources_endpoint_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoint_resources_external_uq": {
- "name": "chat_endpoint_resources_external_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_resource_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_endpoint_resources_company_id_companies_id_fk": {
- "name": "chat_endpoint_resources_company_id_companies_id_fk",
- "tableFrom": "chat_endpoint_resources",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_endpoint_resources_company_endpoint_fk": {
- "name": "chat_endpoint_resources_company_endpoint_fk",
- "tableFrom": "chat_endpoint_resources",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_endpoint_resources_company_id_uq": {
- "name": "chat_endpoint_resources_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_endpoint_resources_availability_check": {
- "name": "chat_endpoint_resources_availability_check",
- "value": "\"chat_endpoint_resources\".\"availability\" in ('available', 'unavailable', 'removed')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_endpoints": {
- "name": "chat_endpoints",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "public_id": {
- "name": "public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "publication_mode": {
- "name": "publication_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'automatic'"
- },
- "external_execution_policy": {
- "name": "external_execution_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'restricted'"
- },
- "assigned_agent_id": {
- "name": "assigned_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "sponsor_user_id": {
- "name": "sponsor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'draft'"
- },
- "deployment_mode": {
- "name": "deployment_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'direct'"
- },
- "provider_account_id": {
- "name": "provider_account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_account_label": {
- "name": "provider_account_label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "bot_external_id": {
- "name": "bot_external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "bot_username": {
- "name": "bot_username",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "bot_display_name": {
- "name": "bot_display_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "bot_avatar_url": {
- "name": "bot_avatar_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "communication_instructions": {
- "name": "communication_instructions",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "allow_direct_messages": {
- "name": "allow_direct_messages",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "allow_group_chats": {
- "name": "allow_group_chats",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "allow_unlinked_people": {
- "name": "allow_unlinked_people",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "concurrency_policy": {
- "name": "concurrency_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queue'"
- },
- "capabilities": {
- "name": "capabilities",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"threads\":false,\"directMessages\":false,\"nativeStreaming\":false,\"messageEdits\":false,\"messageDeletes\":false,\"reactions\":false,\"files\":false,\"cards\":false,\"actions\":false,\"modals\":false,\"slashCommands\":false,\"ephemeralMessages\":false,\"proactiveDirectMessages\":false}'::jsonb"
- },
- "setup": {
- "name": "setup",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"step\":\"provider_setup\"}'::jsonb"
- },
- "health_message": {
- "name": "health_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_event_at": {
- "name": "last_event_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_publication_at": {
- "name": "last_publication_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "activated_at": {
- "name": "activated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_endpoints_company_idx": {
- "name": "chat_endpoints_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_agent_idx": {
- "name": "chat_endpoints_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "assigned_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_status_idx": {
- "name": "chat_endpoints_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_public_id_uq": {
- "name": "chat_endpoints_public_id_uq",
- "columns": [
- {
- "expression": "public_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_agentmail_inbox_uq": {
- "name": "chat_endpoints_agentmail_inbox_uq",
- "columns": [
- {
- "expression": "bot_external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"provider\" = 'agentmail' and \"chat_endpoints\".\"status\" != 'archived' and \"chat_endpoints\".\"bot_external_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_connection_uq": {
- "name": "chat_endpoints_connection_uq",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_live_bot_external_uq": {
- "name": "chat_endpoints_live_bot_external_uq",
- "columns": [
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_account_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bot_external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"provider_account_id\" is not null\n and \"chat_endpoints\".\"bot_external_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_photon_number_uq": {
- "name": "chat_endpoints_photon_number_uq",
- "columns": [
- {
- "expression": "bot_external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"provider\" = 'imessage-photon' and \"chat_endpoints\".\"status\" <> 'archived' and \"chat_endpoints\".\"bot_external_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_live_discord_bot_external_uq": {
- "name": "chat_endpoints_live_discord_bot_external_uq",
- "columns": [
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bot_external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"provider\" = 'discord'\n and \"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"bot_external_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_live_global_app_bot_external_uq": {
- "name": "chat_endpoints_live_global_app_bot_external_uq",
- "columns": [
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bot_external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"provider\" in ('github', 'microsoft-teams')\n and \"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"bot_external_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_endpoints_live_bot_username_uq": {
- "name": "chat_endpoints_live_bot_username_uq",
- "columns": [
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_account_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bot_username",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"provider_account_id\" is not null\n and \"chat_endpoints\".\"bot_username\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_endpoints_company_id_companies_id_fk": {
- "name": "chat_endpoints_company_id_companies_id_fk",
- "tableFrom": "chat_endpoints",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_endpoints_assigned_agent_id_agents_id_fk": {
- "name": "chat_endpoints_assigned_agent_id_agents_id_fk",
- "tableFrom": "chat_endpoints",
- "tableTo": "agents",
- "columnsFrom": [
- "assigned_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "chat_endpoints_company_agent_fk": {
- "name": "chat_endpoints_company_agent_fk",
- "tableFrom": "chat_endpoints",
- "tableTo": "agents",
- "columnsFrom": [
- "company_id",
- "assigned_agent_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_endpoints_company_connection_fk": {
- "name": "chat_endpoints_company_connection_fk",
- "tableFrom": "chat_endpoints",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "company_id",
- "connection_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_endpoints_company_id_uq": {
- "name": "chat_endpoints_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_endpoints_publication_mode_check": {
- "name": "chat_endpoints_publication_mode_check",
- "value": "\"chat_endpoints\".\"publication_mode\" in ('automatic', 'explicit')"
- },
- "chat_endpoints_execution_policy_check": {
- "name": "chat_endpoints_execution_policy_check",
- "value": "\"chat_endpoints\".\"external_execution_policy\" in ('restricted', 'agent')"
- },
- "chat_endpoints_email_policy_check": {
- "name": "chat_endpoints_email_policy_check",
- "value": "\"chat_endpoints\".\"provider\" <> 'agentmail' or (\"chat_endpoints\".\"publication_mode\" = 'explicit' and \"chat_endpoints\".\"external_execution_policy\" = 'agent')"
- },
- "chat_endpoints_provider_check": {
- "name": "chat_endpoints_provider_check",
- "value": "\"chat_endpoints\".\"provider\" in ('slack', 'github', 'discord', 'microsoft-teams', 'telegram', 'agentmail', 'imessage-photon')"
- },
- "chat_endpoints_status_check": {
- "name": "chat_endpoints_status_check",
- "value": "\"chat_endpoints\".\"status\" in ('draft', 'verifying', 'active', 'paused', 'attention', 'revoked', 'archived')"
- },
- "chat_endpoints_deployment_check": {
- "name": "chat_endpoints_deployment_check",
- "value": "\"chat_endpoints\".\"deployment_mode\" in ('direct', 'relay')"
- },
- "chat_endpoints_concurrency_check": {
- "name": "chat_endpoints_concurrency_check",
- "value": "\"chat_endpoints\".\"concurrency_policy\" in ('burst', 'queue', 'debounce', 'drop', 'concurrent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_external_principals": {
- "name": "chat_external_principals",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_account_id": {
- "name": "provider_account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'user'"
- },
- "display_name": {
- "name": "display_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "handle": {
- "name": "handle",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "avatar_url": {
- "name": "avatar_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "is_bot": {
- "name": "is_bot",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "last_seen_at": {
- "name": "last_seen_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_external_principals_company_idx": {
- "name": "chat_external_principals_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_external_principals_external_uq": {
- "name": "chat_external_principals_external_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_account_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_external_principals_company_id_companies_id_fk": {
- "name": "chat_external_principals_company_id_companies_id_fk",
- "tableFrom": "chat_external_principals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_external_principals_company_id_uq": {
- "name": "chat_external_principals_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_external_principals_provider_check": {
- "name": "chat_external_principals_provider_check",
- "value": "\"chat_external_principals\".\"provider\" in ('slack', 'github', 'discord', 'microsoft-teams', 'telegram', 'agentmail', 'imessage-photon')"
- },
- "chat_external_principals_kind_check": {
- "name": "chat_external_principals_kind_check",
- "value": "\"chat_external_principals\".\"kind\" in ('user', 'bot', 'app', 'system')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_identity_links": {
- "name": "chat_identity_links",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "principal_id": {
- "name": "principal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "paperclip_user_id": {
- "name": "paperclip_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "confirmation_token_hash": {
- "name": "confirmation_token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "confirmed_at": {
- "name": "confirmed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_identity_links_user_idx": {
- "name": "chat_identity_links_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "paperclip_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_identity_links_endpoint_principal_uq": {
- "name": "chat_identity_links_endpoint_principal_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_identity_links_company_id_companies_id_fk": {
- "name": "chat_identity_links_company_id_companies_id_fk",
- "tableFrom": "chat_identity_links",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_identity_links_company_endpoint_fk": {
- "name": "chat_identity_links_company_endpoint_fk",
- "tableFrom": "chat_identity_links",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_identity_links_company_principal_fk": {
- "name": "chat_identity_links_company_principal_fk",
- "tableFrom": "chat_identity_links",
- "tableTo": "chat_external_principals",
- "columnsFrom": [
- "company_id",
- "principal_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_identity_links_status_check": {
- "name": "chat_identity_links_status_check",
- "value": "\"chat_identity_links\".\"status\" in ('pending', 'linked', 'revoked', 'expired')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_message_links": {
- "name": "chat_message_links",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_id": {
- "name": "delivery_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "publication_id": {
- "name": "publication_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "comment_id": {
- "name": "comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_message_id": {
- "name": "provider_message_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "direction": {
- "name": "direction",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_message_links_provider_message_uq": {
- "name": "chat_message_links_provider_message_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "conversation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_message_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_message_links_company_id_companies_id_fk": {
- "name": "chat_message_links_company_id_companies_id_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_message_links_delivery_id_chat_deliveries_id_fk": {
- "name": "chat_message_links_delivery_id_chat_deliveries_id_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_deliveries",
- "columnsFrom": [
- "delivery_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_message_links_publication_id_chat_publications_id_fk": {
- "name": "chat_message_links_publication_id_chat_publications_id_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_publications",
- "columnsFrom": [
- "publication_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_message_links_comment_id_issue_comments_id_fk": {
- "name": "chat_message_links_comment_id_issue_comments_id_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_message_links_company_endpoint_fk": {
- "name": "chat_message_links_company_endpoint_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_message_links_company_delivery_fk": {
- "name": "chat_message_links_company_delivery_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_deliveries",
- "columnsFrom": [
- "company_id",
- "delivery_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_message_links_company_publication_fk": {
- "name": "chat_message_links_company_publication_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_publications",
- "columnsFrom": [
- "company_id",
- "publication_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_message_links_company_comment_fk": {
- "name": "chat_message_links_company_comment_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "company_id",
- "comment_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_message_links_company_conversation_fk": {
- "name": "chat_message_links_company_conversation_fk",
- "tableFrom": "chat_message_links",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_message_links_direction_check": {
- "name": "chat_message_links_direction_check",
- "value": "\"chat_message_links\".\"direction\" in ('inbound', 'outbound')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_publications": {
- "name": "chat_publications",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "comment_id": {
- "name": "comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "provider_message_id": {
- "name": "provider_message_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_url": {
- "name": "provider_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "redacted_error": {
- "name": "redacted_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "published_at": {
- "name": "published_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_publications_company_id_uq": {
- "name": "chat_publications_company_id_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_publications_work_idx": {
- "name": "chat_publications_work_idx",
- "columns": [
- {
- "expression": "state",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_publications_idempotency_uq": {
- "name": "chat_publications_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_publications_company_id_companies_id_fk": {
- "name": "chat_publications_company_id_companies_id_fk",
- "tableFrom": "chat_publications",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_publications_issue_id_issues_id_fk": {
- "name": "chat_publications_issue_id_issues_id_fk",
- "tableFrom": "chat_publications",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "chat_publications_comment_id_issue_comments_id_fk": {
- "name": "chat_publications_comment_id_issue_comments_id_fk",
- "tableFrom": "chat_publications",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_publications_company_issue_fk": {
- "name": "chat_publications_company_issue_fk",
- "tableFrom": "chat_publications",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_publications_company_comment_fk": {
- "name": "chat_publications_company_comment_fk",
- "tableFrom": "chat_publications",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "company_id",
- "comment_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "chat_publications_company_endpoint_fk": {
- "name": "chat_publications_company_endpoint_fk",
- "tableFrom": "chat_publications",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_publications_company_conversation_fk": {
- "name": "chat_publications_company_conversation_fk",
- "tableFrom": "chat_publications",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_publications_state_check": {
- "name": "chat_publications_state_check",
- "value": "\"chat_publications\".\"state\" in ('pending', 'streaming', 'published', 'retry', 'delivery_unknown', 'failed', 'cancelled', 'awaiting_consent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_sdk_state": {
- "name": "chat_sdk_state",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "state_key": {
- "name": "state_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "value": {
- "name": "value",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_sdk_state_key_uq": {
- "name": "chat_sdk_state_key_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "state_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_sdk_state_expiry_idx": {
- "name": "chat_sdk_state_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_sdk_state_company_id_companies_id_fk": {
- "name": "chat_sdk_state_company_id_companies_id_fk",
- "tableFrom": "chat_sdk_state",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_sdk_state_company_endpoint_fk": {
- "name": "chat_sdk_state_company_endpoint_fk",
- "tableFrom": "chat_sdk_state",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.chat_completion_deliveries": {
- "name": "chat_completion_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status_version": {
- "name": "status_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "target_run_id": {
- "name": "target_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "response_comment_id": {
- "name": "response_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_completion_deliveries_transition_uq": {
- "name": "chat_completion_deliveries_transition_uq",
- "columns": [
- {
- "expression": "task_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status_version",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_completion_deliveries_pending_idx": {
- "name": "chat_completion_deliveries_pending_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_completion_deliveries_company_id_companies_id_fk": {
- "name": "chat_completion_deliveries_company_id_companies_id_fk",
- "tableFrom": "chat_completion_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_completion_deliveries_task_id_chat_task_handoffs_task_id_fk": {
- "name": "chat_completion_deliveries_task_id_chat_task_handoffs_task_id_fk",
- "tableFrom": "chat_completion_deliveries",
- "tableTo": "chat_task_handoffs",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "task_id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_completion_deliveries_target_run_id_heartbeat_runs_id_fk": {
- "name": "chat_completion_deliveries_target_run_id_heartbeat_runs_id_fk",
- "tableFrom": "chat_completion_deliveries",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "target_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_completion_deliveries_response_comment_id_issue_comments_id_fk": {
- "name": "chat_completion_deliveries_response_comment_id_issue_comments_id_fk",
- "tableFrom": "chat_completion_deliveries",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "response_comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.chat_task_handoffs": {
- "name": "chat_task_handoffs",
- "schema": "",
- "columns": {
- "task_id": {
- "name": "task_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "session_generation": {
- "name": "session_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_task_handoffs_source_idx": {
- "name": "chat_task_handoffs_source_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "conversation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_task_handoffs_task_id_issues_id_fk": {
- "name": "chat_task_handoffs_task_id_issues_id_fk",
- "tableFrom": "chat_task_handoffs",
- "tableTo": "issues",
- "columnsFrom": [
- "task_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_task_handoffs_company_id_companies_id_fk": {
- "name": "chat_task_handoffs_company_id_companies_id_fk",
- "tableFrom": "chat_task_handoffs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_task_handoffs_conversation_id_issues_id_fk": {
- "name": "chat_task_handoffs_conversation_id_issues_id_fk",
- "tableFrom": "chat_task_handoffs",
- "tableTo": "issues",
- "columnsFrom": [
- "conversation_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_task_handoffs_agent_id_agents_id_fk": {
- "name": "chat_task_handoffs_agent_id_agents_id_fk",
- "tableFrom": "chat_task_handoffs",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.chat_discord_command_owners": {
- "name": "chat_discord_command_owners",
- "schema": "",
- "columns": {
- "application_id": {
- "name": "application_id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "action_id": {
- "name": "action_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_discord_command_owners_application_check": {
- "name": "chat_discord_command_owners_application_check",
- "value": "\"chat_discord_command_owners\".\"application_id\" ~ '^[1-9][0-9]{16,19}$'"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_github_configurations": {
- "name": "chat_github_configurations",
- "schema": "",
- "columns": {
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "configuration": {
- "name": "configuration",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "chat_github_configurations_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "chat_github_configurations_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "chat_github_configurations",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_github_config_revision_check": {
- "name": "chat_github_config_revision_check",
- "value": "\"chat_github_configurations\".\"revision\" > 0"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_github_registrations": {
- "name": "chat_github_registrations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "state_hash": {
- "name": "state_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trusted_origin": {
- "name": "trusted_origin",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "consumed_at": {
- "name": "consumed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_github_registration_state_uq": {
- "name": "chat_github_registration_state_uq",
- "columns": [
- {
- "expression": "state_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_github_registration_endpoint_idx": {
- "name": "chat_github_registration_endpoint_idx",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_github_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "chat_github_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "chat_github_registrations",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_github_registration_status_check": {
- "name": "chat_github_registration_status_check",
- "value": "\"chat_github_registrations\".\"status\" in ('pending', 'exchanging', 'completed', 'failed')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_github_reviews": {
- "name": "chat_github_reviews",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "repository_id": {
- "name": "repository_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "repository": {
- "name": "repository",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "pull_number": {
- "name": "pull_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "head_sha": {
- "name": "head_sha",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_id": {
- "name": "delivery_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "configuration_revision": {
- "name": "configuration_revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "policy_snapshot": {
- "name": "policy_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "event": {
- "name": "event",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queued'"
- },
- "assessment": {
- "name": "assessment",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "conclusion": {
- "name": "conclusion",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "check_id": {
- "name": "check_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "check_url": {
- "name": "check_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "summary_id": {
- "name": "summary_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "summary_url": {
- "name": "summary_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "publication_receipts": {
- "name": "publication_receipts",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_github_reviews_delivery_uq": {
- "name": "chat_github_reviews_delivery_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "delivery_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_github_reviews_pull_idx": {
- "name": "chat_github_reviews_pull_idx",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "repository_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "pull_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_github_reviews_task_idx": {
- "name": "chat_github_reviews_task_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_github_reviews_run_id_heartbeat_runs_id_fk": {
- "name": "chat_github_reviews_run_id_heartbeat_runs_id_fk",
- "tableFrom": "chat_github_reviews",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "chat_github_reviews_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "chat_github_reviews_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "chat_github_reviews",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_github_reviews_company_id_issue_id_issues_company_id_id_fk": {
- "name": "chat_github_reviews_company_id_issue_id_issues_company_id_id_fk",
- "tableFrom": "chat_github_reviews",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "chat_github_reviews_company_id_uq": {
- "name": "chat_github_reviews_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "chat_github_review_pull_number_check": {
- "name": "chat_github_review_pull_number_check",
- "value": "\"chat_github_reviews\".\"pull_number\" > 0"
- },
- "chat_github_review_state_check": {
- "name": "chat_github_review_state_check",
- "value": "\"chat_github_reviews\".\"state\" in ('queued', 'running', 'completed', 'incomplete', 'error', 'superseded', 'manual_required')"
- }
- },
- "isRLSEnabled": false
- },
- "public.chat_teams_file_transfers": {
- "name": "chat_teams_file_transfers",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "publication_id": {
- "name": "publication_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "comment_id": {
- "name": "comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "attachment_id": {
- "name": "attachment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "principal_id": {
- "name": "principal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "authorized_user_id": {
- "name": "authorized_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_generation": {
- "name": "runtime_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "credential_fingerprint": {
- "name": "credential_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_generation": {
- "name": "conversation_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "source_digest": {
- "name": "source_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "authority_digest": {
- "name": "authority_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "tenant_id": {
- "name": "tenant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "bot_app_id": {
- "name": "bot_app_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "aad_object_id": {
- "name": "aad_object_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_conversation_id": {
- "name": "provider_conversation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_user_id": {
- "name": "provider_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "sha256": {
- "name": "sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "byte_size": {
- "name": "byte_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "filename": {
- "name": "filename",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "token_sha256": {
- "name": "token_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "phase": {
- "name": "phase",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'consent_pending'"
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "attempt_id": {
- "name": "attempt_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "attempt_expires_at": {
- "name": "attempt_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "consent_message_id": {
- "name": "consent_message_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "file_info_message_id": {
- "name": "file_info_message_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "response_activity_id": {
- "name": "response_activity_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "response_digest": {
- "name": "response_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "private_state": {
- "name": "private_state",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "chat_teams_file_transfers_publication_uq": {
- "name": "chat_teams_file_transfers_publication_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "publication_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_teams_file_transfers_token_uq": {
- "name": "chat_teams_file_transfers_token_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "token_sha256",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "chat_teams_file_transfers_work_idx": {
- "name": "chat_teams_file_transfers_work_idx",
- "columns": [
- {
- "expression": "phase",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "attempt_expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "chat_teams_file_transfers_company_id_companies_id_fk": {
- "name": "chat_teams_file_transfers_company_id_companies_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_teams_file_transfers_issue_id_issues_id_fk": {
- "name": "chat_teams_file_transfers_issue_id_issues_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "chat_teams_file_transfers_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "chat_teams_file_transfers_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_teams_file_transfers_company_id_publication_id_chat_publications_company_id_id_fk": {
- "name": "chat_teams_file_transfers_company_id_publication_id_chat_publications_company_id_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "chat_publications",
- "columnsFrom": [
- "company_id",
- "publication_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_teams_file_transfers_company_id_conversation_id_chat_conversations_company_id_id_fk": {
- "name": "chat_teams_file_transfers_company_id_conversation_id_chat_conversations_company_id_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "chat_teams_file_transfers_company_id_principal_id_chat_external_principals_company_id_id_fk": {
- "name": "chat_teams_file_transfers_company_id_principal_id_chat_external_principals_company_id_id_fk",
- "tableFrom": "chat_teams_file_transfers",
- "tableTo": "chat_external_principals",
- "columnsFrom": [
- "company_id",
- "principal_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "chat_teams_file_transfers_phase_check": {
- "name": "chat_teams_file_transfers_phase_check",
- "value": "\"chat_teams_file_transfers\".\"phase\" in ('consent_pending','consent_sending','consent_unknown','awaiting_consent','upload_pending','uploading','upload_unknown','file_info_pending','file_info_sending','file_info_unknown','delivered','declined','expired','cancelled','conflict')"
- },
- "chat_teams_file_transfers_bounds_check": {
- "name": "chat_teams_file_transfers_bounds_check",
- "value": "\"chat_teams_file_transfers\".\"version\" > 0 and \"chat_teams_file_transfers\".\"runtime_generation\" >= 0 and \"chat_teams_file_transfers\".\"conversation_generation\" > 0 and \"chat_teams_file_transfers\".\"byte_size\" > 0 and \"chat_teams_file_transfers\".\"byte_size\" < 62914560"
- },
- "chat_teams_file_transfers_hash_check": {
- "name": "chat_teams_file_transfers_hash_check",
- "value": "\"chat_teams_file_transfers\".\"source_digest\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"authority_digest\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"sha256\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"token_sha256\" ~ '^[a-f0-9]{64}$'"
- },
- "chat_teams_file_transfers_attempt_check": {
- "name": "chat_teams_file_transfers_attempt_check",
- "value": "(\"chat_teams_file_transfers\".\"attempt_id\" is null) = (\"chat_teams_file_transfers\".\"attempt_expires_at\" is null)"
- }
- },
- "isRLSEnabled": false
- },
- "public.cli_auth_challenges": {
- "name": "cli_auth_challenges",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "secret_hash": {
- "name": "secret_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "command": {
- "name": "command",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "client_name": {
- "name": "client_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "requested_access": {
- "name": "requested_access",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'board'"
- },
- "requested_company_id": {
- "name": "requested_company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "pending_key_hash": {
- "name": "pending_key_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "pending_key_name": {
- "name": "pending_key_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "approved_by_user_id": {
- "name": "approved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "board_api_key_id": {
- "name": "board_api_key_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "approved_at": {
- "name": "approved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "cancelled_at": {
- "name": "cancelled_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "cli_auth_challenges_secret_hash_idx": {
- "name": "cli_auth_challenges_secret_hash_idx",
- "columns": [
- {
- "expression": "secret_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cli_auth_challenges_approved_by_idx": {
- "name": "cli_auth_challenges_approved_by_idx",
- "columns": [
- {
- "expression": "approved_by_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cli_auth_challenges_requested_company_idx": {
- "name": "cli_auth_challenges_requested_company_idx",
- "columns": [
- {
- "expression": "requested_company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "cli_auth_challenges_requested_company_id_companies_id_fk": {
- "name": "cli_auth_challenges_requested_company_id_companies_id_fk",
- "tableFrom": "cli_auth_challenges",
- "tableTo": "companies",
- "columnsFrom": [
- "requested_company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "cli_auth_challenges_approved_by_user_id_user_id_fk": {
- "name": "cli_auth_challenges_approved_by_user_id_user_id_fk",
- "tableFrom": "cli_auth_challenges",
- "tableTo": "user",
- "columnsFrom": [
- "approved_by_user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk": {
- "name": "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk",
- "tableFrom": "cli_auth_challenges",
- "tableTo": "board_api_keys",
- "columnsFrom": [
- "board_api_key_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.companies": {
- "name": "companies",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "pause_reason": {
- "name": "pause_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "paused_at": {
- "name": "paused_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "issue_prefix": {
- "name": "issue_prefix",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'PAP'"
- },
- "issue_counter": {
- "name": "issue_counter",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "budget_monthly_cents": {
- "name": "budget_monthly_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "spent_monthly_cents": {
- "name": "spent_monthly_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "default_responsible_user_id": {
- "name": "default_responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "require_board_approval_for_new_agents": {
- "name": "require_board_approval_for_new_agents",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "interaction_resolver_governance": {
- "name": "interaction_resolver_governance",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "feedback_data_sharing_enabled": {
- "name": "feedback_data_sharing_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "feedback_data_sharing_consent_at": {
- "name": "feedback_data_sharing_consent_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "feedback_data_sharing_consent_by_user_id": {
- "name": "feedback_data_sharing_consent_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "feedback_data_sharing_terms_version": {
- "name": "feedback_data_sharing_terms_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "companies_issue_prefix_idx": {
- "name": "companies_issue_prefix_idx",
- "columns": [
- {
- "expression": "issue_prefix",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_logos": {
- "name": "company_logos",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "asset_id": {
- "name": "asset_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_logos_company_uq": {
- "name": "company_logos_company_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_logos_asset_uq": {
- "name": "company_logos_asset_uq",
- "columns": [
- {
- "expression": "asset_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_logos_company_id_companies_id_fk": {
- "name": "company_logos_company_id_companies_id_fk",
- "tableFrom": "company_logos",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_logos_asset_id_assets_id_fk": {
- "name": "company_logos_asset_id_assets_id_fk",
- "tableFrom": "company_logos",
- "tableTo": "assets",
- "columnsFrom": [
- "asset_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_memberships": {
- "name": "company_memberships",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "principal_type": {
- "name": "principal_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "principal_id": {
- "name": "principal_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "membership_role": {
- "name": "membership_role",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_memberships_company_principal_unique_idx": {
- "name": "company_memberships_company_principal_unique_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_memberships_principal_status_idx": {
- "name": "company_memberships_principal_status_idx",
- "columns": [
- {
- "expression": "principal_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_memberships_company_status_idx": {
- "name": "company_memberships_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_memberships_company_id_companies_id_fk": {
- "name": "company_memberships_company_id_companies_id_fk",
- "tableFrom": "company_memberships",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_onboarding_seeds": {
- "name": "company_onboarding_seeds",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision": {
- "name": "revision",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "mission": {
- "name": "mission",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_name": {
- "name": "agent_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_role": {
- "name": "agent_role",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "first_task_title": {
- "name": "first_task_title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "first_task_details": {
- "name": "first_task_details",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "applied_at": {
- "name": "applied_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_onboarding_seeds_company_uq": {
- "name": "company_onboarding_seeds_company_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_onboarding_seeds_company_id_companies_id_fk": {
- "name": "company_onboarding_seeds_company_id_companies_id_fk",
- "tableFrom": "company_onboarding_seeds",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_onboarding_seeds_goal_id_goals_id_fk": {
- "name": "company_onboarding_seeds_goal_id_goals_id_fk",
- "tableFrom": "company_onboarding_seeds",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_onboarding_seeds_agent_id_agents_id_fk": {
- "name": "company_onboarding_seeds_agent_id_agents_id_fk",
- "tableFrom": "company_onboarding_seeds",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_onboarding_seeds_issue_id_issues_id_fk": {
- "name": "company_onboarding_seeds_issue_id_issues_id_fk",
- "tableFrom": "company_onboarding_seeds",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_secret_bindings": {
- "name": "company_secret_bindings",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "secret_id": {
- "name": "secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "config_path": {
- "name": "config_path",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "version_selector": {
- "name": "version_selector",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'latest'"
- },
- "required": {
- "name": "required",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "projection_class": {
- "name": "projection_class",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unclassified'"
- },
- "projection_allowlist_key": {
- "name": "projection_allowlist_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_secret_bindings_company_idx": {
- "name": "company_secret_bindings_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_bindings_secret_idx": {
- "name": "company_secret_bindings_secret_idx",
- "columns": [
- {
- "expression": "secret_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_bindings_target_idx": {
- "name": "company_secret_bindings_target_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_bindings_target_path_uq": {
- "name": "company_secret_bindings_target_path_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "config_path",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_secret_bindings_company_id_companies_id_fk": {
- "name": "company_secret_bindings_company_id_companies_id_fk",
- "tableFrom": "company_secret_bindings",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "company_secret_bindings_secret_id_company_secrets_id_fk": {
- "name": "company_secret_bindings_secret_id_company_secrets_id_fk",
- "tableFrom": "company_secret_bindings",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_secret_proposals": {
- "name": "company_secret_proposals",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "proposed_name": {
- "name": "proposed_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "proposed_key": {
- "name": "proposed_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "proposed_description": {
- "name": "proposed_description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "justification": {
- "name": "justification",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "value_ciphertext": {
- "name": "value_ciphertext",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "value_fingerprint_sha256": {
- "name": "value_fingerprint_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "value_length": {
- "name": "value_length",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "secret_id": {
- "name": "secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "secret_proposal_id": {
- "name": "secret_proposal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "target_id": {
- "name": "target_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "config_path": {
- "name": "config_path",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "projection_class": {
- "name": "projection_class",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unclassified'"
- },
- "binding_target_policy_snapshot": {
- "name": "binding_target_policy_snapshot",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "proposer_ancestor_ids_snapshot": {
- "name": "proposer_ancestor_ids_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "target_ancestor_ids_snapshot": {
- "name": "target_ancestor_ids_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "proposed_by_agent_id": {
- "name": "proposed_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_issue_id": {
- "name": "origin_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "origin_run_id": {
- "name": "origin_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_user_id": {
- "name": "resolved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "resolution_reason": {
- "name": "resolution_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_secret_id": {
- "name": "created_secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "applied_binding_config_path": {
- "name": "applied_binding_config_path",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "ciphertext_scrubbed_at": {
- "name": "ciphertext_scrubbed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_secret_proposals_company_status_idx": {
- "name": "company_secret_proposals_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_proposals_proposer_status_idx": {
- "name": "company_secret_proposals_proposer_status_idx",
- "columns": [
- {
- "expression": "proposed_by_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_proposals_expiry_idx": {
- "name": "company_secret_proposals_expiry_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_proposals_secret_proposal_idx": {
- "name": "company_secret_proposals_secret_proposal_idx",
- "columns": [
- {
- "expression": "secret_proposal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_proposals_interaction_idx": {
- "name": "company_secret_proposals_interaction_idx",
- "columns": [
- {
- "expression": "interaction_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_secret_proposals_company_id_companies_id_fk": {
- "name": "company_secret_proposals_company_id_companies_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "company_secret_proposals_secret_id_company_secrets_id_fk": {
- "name": "company_secret_proposals_secret_id_company_secrets_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk": {
- "name": "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "company_secret_proposals",
- "columnsFrom": [
- "secret_proposal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_proposals_target_id_agents_id_fk": {
- "name": "company_secret_proposals_target_id_agents_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "agents",
- "columnsFrom": [
- "target_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_proposals_proposed_by_agent_id_agents_id_fk": {
- "name": "company_secret_proposals_proposed_by_agent_id_agents_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "agents",
- "columnsFrom": [
- "proposed_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_proposals_origin_issue_id_issues_id_fk": {
- "name": "company_secret_proposals_origin_issue_id_issues_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "issues",
- "columnsFrom": [
- "origin_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk": {
- "name": "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "origin_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk": {
- "name": "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_secret_proposals_created_secret_id_company_secrets_id_fk": {
- "name": "company_secret_proposals_created_secret_id_company_secrets_id_fk",
- "tableFrom": "company_secret_proposals",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "created_secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "company_secret_proposals_kind_check": {
- "name": "company_secret_proposals_kind_check",
- "value": "\"company_secret_proposals\".\"kind\" in ('secret', 'binding')"
- },
- "company_secret_proposals_status_check": {
- "name": "company_secret_proposals_status_check",
- "value": "\"company_secret_proposals\".\"status\" in ('pending', 'approved', 'rejected', 'withdrawn', 'expired')"
- },
- "company_secret_proposals_projection_check": {
- "name": "company_secret_proposals_projection_check",
- "value": "\"company_secret_proposals\".\"projection_class\" = 'unclassified'"
- },
- "company_secret_proposals_shape_check": {
- "name": "company_secret_proposals_shape_check",
- "value": "(\n \"company_secret_proposals\".\"kind\" = 'secret'\n and \"company_secret_proposals\".\"proposed_name\" is not null\n and \"company_secret_proposals\".\"proposed_key\" is not null\n and \"company_secret_proposals\".\"secret_id\" is null\n and \"company_secret_proposals\".\"secret_proposal_id\" is null\n and \"company_secret_proposals\".\"target_type\" is null\n and \"company_secret_proposals\".\"target_id\" is null\n and \"company_secret_proposals\".\"config_path\" is null\n ) or (\n \"company_secret_proposals\".\"kind\" = 'binding'\n and ((\"company_secret_proposals\".\"secret_id\" is not null)::int + (\"company_secret_proposals\".\"secret_proposal_id\" is not null)::int) = 1\n and \"company_secret_proposals\".\"target_type\" = 'agent'\n and \"company_secret_proposals\".\"target_id\" is not null\n and \"company_secret_proposals\".\"config_path\" is not null\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.company_secret_provider_configs": {
- "name": "company_secret_provider_configs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "display_name": {
- "name": "display_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'ready'"
- },
- "is_default": {
- "name": "is_default",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "health_status": {
- "name": "health_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "health_checked_at": {
- "name": "health_checked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "health_message": {
- "name": "health_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "health_details": {
- "name": "health_details",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "disabled_at": {
- "name": "disabled_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_secret_provider_configs_company_idx": {
- "name": "company_secret_provider_configs_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_provider_configs_company_provider_idx": {
- "name": "company_secret_provider_configs_company_provider_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_provider_configs_default_uq": {
- "name": "company_secret_provider_configs_default_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"company_secret_provider_configs\".\"is_default\" = true",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_secret_provider_configs_company_id_companies_id_fk": {
- "name": "company_secret_provider_configs_company_id_companies_id_fk",
- "tableFrom": "company_secret_provider_configs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_provider_configs_created_by_agent_id_agents_id_fk": {
- "name": "company_secret_provider_configs_created_by_agent_id_agents_id_fk",
- "tableFrom": "company_secret_provider_configs",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_secret_versions": {
- "name": "company_secret_versions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "secret_id": {
- "name": "secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "material": {
- "name": "material",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "value_sha256": {
- "name": "value_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_version_ref": {
- "name": "provider_version_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'current'"
- },
- "fingerprint_sha256": {
- "name": "fingerprint_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "rotation_job_id": {
- "name": "rotation_job_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "company_secret_versions_secret_idx": {
- "name": "company_secret_versions_secret_idx",
- "columns": [
- {
- "expression": "secret_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_versions_value_sha256_idx": {
- "name": "company_secret_versions_value_sha256_idx",
- "columns": [
- {
- "expression": "value_sha256",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_versions_fingerprint_idx": {
- "name": "company_secret_versions_fingerprint_idx",
- "columns": [
- {
- "expression": "fingerprint_sha256",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secret_versions_secret_version_uq": {
- "name": "company_secret_versions_secret_version_uq",
- "columns": [
- {
- "expression": "secret_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "version",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_secret_versions_secret_id_company_secrets_id_fk": {
- "name": "company_secret_versions_secret_id_company_secrets_id_fk",
- "tableFrom": "company_secret_versions",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_secret_versions_created_by_agent_id_agents_id_fk": {
- "name": "company_secret_versions_created_by_agent_id_agents_id_fk",
- "tableFrom": "company_secret_versions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_secrets": {
- "name": "company_secrets",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'company'"
- },
- "owner_user_id": {
- "name": "owner_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "user_secret_definition_id": {
- "name": "user_secret_definition_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_encrypted'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "managed_mode": {
- "name": "managed_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip_managed'"
- },
- "external_ref": {
- "name": "external_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_config_id": {
- "name": "provider_config_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_metadata": {
- "name": "provider_metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "ai_session_epoch": {
- "name": "ai_session_epoch",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "latest_version": {
- "name": "latest_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_resolved_at": {
- "name": "last_resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_rotated_at": {
- "name": "last_rotated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_secrets_company_idx": {
- "name": "company_secrets_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_company_scope_idx": {
- "name": "company_secrets_company_scope_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_company_owner_idx": {
- "name": "company_secrets_company_owner_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_user_definition_owner_idx": {
- "name": "company_secrets_user_definition_owner_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_secret_definition_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_company_provider_idx": {
- "name": "company_secrets_company_provider_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_provider_config_idx": {
- "name": "company_secrets_provider_config_idx",
- "columns": [
- {
- "expression": "provider_config_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_company_name_uq": {
- "name": "company_secrets_company_name_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_company_key_uq": {
- "name": "company_secrets_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_secrets_user_definition_owner_uq": {
- "name": "company_secrets_user_definition_owner_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_secret_definition_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"company_secrets\".\"scope\" = 'user' and \"company_secrets\".\"deleted_at\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_secrets_company_id_companies_id_fk": {
- "name": "company_secrets_company_id_companies_id_fk",
- "tableFrom": "company_secrets",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk": {
- "name": "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk",
- "tableFrom": "company_secrets",
- "tableTo": "user_secret_definitions",
- "columnsFrom": [
- "user_secret_definition_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_secrets_provider_config_id_company_secret_provider_configs_id_fk": {
- "name": "company_secrets_provider_config_id_company_secret_provider_configs_id_fk",
- "tableFrom": "company_secrets",
- "tableTo": "company_secret_provider_configs",
- "columnsFrom": [
- "provider_config_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_secrets_created_by_agent_id_agents_id_fk": {
- "name": "company_secrets_created_by_agent_id_agents_id_fk",
- "tableFrom": "company_secrets",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "company_secrets_scope_shape_check": {
- "name": "company_secrets_scope_shape_check",
- "value": "(\n \"company_secrets\".\"scope\" = 'company'\n and \"company_secrets\".\"owner_user_id\" is null\n and \"company_secrets\".\"user_secret_definition_id\" is null\n ) or (\n \"company_secrets\".\"scope\" = 'user'\n and \"company_secrets\".\"owner_user_id\" is not null\n and \"company_secrets\".\"user_secret_definition_id\" is not null\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.company_skill_policies": {
- "name": "company_skill_policies",
- "schema": "",
- "columns": {
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "schema_version": {
- "name": "schema_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "default_effect": {
- "name": "default_effect",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "rules": {
- "name": "rules",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "company_skill_policies_company_id_companies_id_fk": {
- "name": "company_skill_policies_company_id_companies_id_fk",
- "tableFrom": "company_skill_policies",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_source_entries": {
- "name": "company_skill_source_entries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "path": {
- "name": "path",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "inspection": {
- "name": "inspection",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "skill_id": {
- "name": "skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "selection": {
- "name": "selection",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'new'"
- },
- "present": {
- "name": "present",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "company_skill_source_entries_source_path_idx": {
- "name": "company_skill_source_entries_source_path_idx",
- "columns": [
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "path",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_source_entries_company_skill_idx": {
- "name": "company_skill_source_entries_company_skill_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_source_entries_company_id_companies_id_fk": {
- "name": "company_skill_source_entries_company_id_companies_id_fk",
- "tableFrom": "company_skill_source_entries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_source_entries_source_id_company_skill_sources_id_fk": {
- "name": "company_skill_source_entries_source_id_company_skill_sources_id_fk",
- "tableFrom": "company_skill_source_entries",
- "tableTo": "company_skill_sources",
- "columnsFrom": [
- "source_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_source_entries_skill_id_company_skills_id_fk": {
- "name": "company_skill_source_entries_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_source_entries",
- "tableTo": "company_skills",
- "columnsFrom": [
- "skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_sources": {
- "name": "company_skill_sources",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "repository_id": {
- "name": "repository_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "repository_url": {
- "name": "repository_url",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "full_name": {
- "name": "full_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "tracking_ref": {
- "name": "tracking_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "excluded_folders": {
- "name": "excluded_folders",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_attempt_at": {
- "name": "last_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_success_at": {
- "name": "last_success_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_scan_commit": {
- "name": "last_scan_commit",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "lease_token": {
- "name": "lease_token",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "lease_expires_at": {
- "name": "lease_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_sources_repository_ref_idx": {
- "name": "company_skill_sources_repository_ref_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "repository_url",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "tracking_ref",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_sources_identity_ref_idx": {
- "name": "company_skill_sources_identity_ref_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "repository_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "tracking_ref",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_sources_company_id_companies_id_fk": {
- "name": "company_skill_sources_company_id_companies_id_fk",
- "tableFrom": "company_skill_sources",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_sources_connection_id_tool_connections_id_fk": {
- "name": "company_skill_sources_connection_id_tool_connections_id_fk",
- "tableFrom": "company_skill_sources",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_comments": {
- "name": "company_skill_comments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_skill_id": {
- "name": "company_skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "parent_comment_id": {
- "name": "parent_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_agent_id": {
- "name": "author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_comments_company_skill_created_idx": {
- "name": "company_skill_comments_company_skill_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_comments_parent_idx": {
- "name": "company_skill_comments_parent_idx",
- "columns": [
- {
- "expression": "parent_comment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_comments_company_id_companies_id_fk": {
- "name": "company_skill_comments_company_id_companies_id_fk",
- "tableFrom": "company_skill_comments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_comments_company_skill_id_company_skills_id_fk": {
- "name": "company_skill_comments_company_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_comments",
- "tableTo": "company_skills",
- "columnsFrom": [
- "company_skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_comments_parent_comment_id_company_skill_comments_id_fk": {
- "name": "company_skill_comments_parent_comment_id_company_skill_comments_id_fk",
- "tableFrom": "company_skill_comments",
- "tableTo": "company_skill_comments",
- "columnsFrom": [
- "parent_comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skill_comments_author_agent_id_agents_id_fk": {
- "name": "company_skill_comments_author_agent_id_agents_id_fk",
- "tableFrom": "company_skill_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_stars": {
- "name": "company_skill_stars",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_skill_id": {
- "name": "company_skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_stars_skill_agent_idx": {
- "name": "company_skill_stars_skill_agent_idx",
- "columns": [
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_stars_skill_user_idx": {
- "name": "company_skill_stars_skill_user_idx",
- "columns": [
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_stars_company_skill_created_idx": {
- "name": "company_skill_stars_company_skill_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_stars_company_id_companies_id_fk": {
- "name": "company_skill_stars_company_id_companies_id_fk",
- "tableFrom": "company_skill_stars",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_stars_company_skill_id_company_skills_id_fk": {
- "name": "company_skill_stars_company_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_stars",
- "tableTo": "company_skills",
- "columnsFrom": [
- "company_skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_stars_agent_id_agents_id_fk": {
- "name": "company_skill_stars_agent_id_agents_id_fk",
- "tableFrom": "company_skill_stars",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_test_inputs": {
- "name": "company_skill_test_inputs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "skill_id": {
- "name": "skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_test_inputs_company_skill_name_idx": {
- "name": "company_skill_test_inputs_company_skill_name_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_test_inputs_company_skill_active_idx": {
- "name": "company_skill_test_inputs_company_skill_active_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "deleted_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_test_inputs_company_id_companies_id_fk": {
- "name": "company_skill_test_inputs_company_id_companies_id_fk",
- "tableFrom": "company_skill_test_inputs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_test_inputs_skill_id_company_skills_id_fk": {
- "name": "company_skill_test_inputs_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_test_inputs",
- "tableTo": "company_skills",
- "columnsFrom": [
- "skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_test_run_templates": {
- "name": "company_skill_test_run_templates",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_test_run_templates_company_active_idx": {
- "name": "company_skill_test_run_templates_company_active_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "deleted_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_test_run_templates_company_id_companies_id_fk": {
- "name": "company_skill_test_run_templates_company_id_companies_id_fk",
- "tableFrom": "company_skill_test_run_templates",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_test_run_templates_created_by_agent_id_agents_id_fk": {
- "name": "company_skill_test_run_templates_created_by_agent_id_agents_id_fk",
- "tableFrom": "company_skill_test_run_templates",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk": {
- "name": "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk",
- "tableFrom": "company_skill_test_run_templates",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_test_runs": {
- "name": "company_skill_test_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "skill_id": {
- "name": "skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "input_id": {
- "name": "input_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "input_snapshot": {
- "name": "input_snapshot",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "skill_version_id": {
- "name": "skill_version_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_config_snapshot": {
- "name": "agent_config_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "template_id": {
- "name": "template_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "template_name": {
- "name": "template_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "template_body": {
- "name": "template_body",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "rendered_template_body": {
- "name": "rendered_template_body",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "harness_issue_description": {
- "name": "harness_issue_description",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queued'"
- },
- "output_document_key": {
- "name": "output_document_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'output'"
- },
- "output_snapshot": {
- "name": "output_snapshot",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "superseded_at": {
- "name": "superseded_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "harness_issue_expires_at": {
- "name": "harness_issue_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "harness_issue_deleted_at": {
- "name": "harness_issue_deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_test_runs_company_skill_created_idx": {
- "name": "company_skill_test_runs_company_skill_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_test_runs_company_issue_idx": {
- "name": "company_skill_test_runs_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_test_runs_company_input_created_idx": {
- "name": "company_skill_test_runs_company_input_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "input_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_test_runs_company_status_idx": {
- "name": "company_skill_test_runs_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_test_runs_company_harness_expires_idx": {
- "name": "company_skill_test_runs_company_harness_expires_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "harness_issue_expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_test_runs_company_id_companies_id_fk": {
- "name": "company_skill_test_runs_company_id_companies_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_test_runs_skill_id_company_skills_id_fk": {
- "name": "company_skill_test_runs_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "company_skills",
- "columnsFrom": [
- "skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk": {
- "name": "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "company_skill_test_inputs",
- "columnsFrom": [
- "input_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk": {
- "name": "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "company_skill_versions",
- "columnsFrom": [
- "skill_version_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "company_skill_test_runs_agent_id_agents_id_fk": {
- "name": "company_skill_test_runs_agent_id_agents_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "company_skill_test_runs_issue_id_issues_id_fk": {
- "name": "company_skill_test_runs_issue_id_issues_id_fk",
- "tableFrom": "company_skill_test_runs",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skill_versions": {
- "name": "company_skill_versions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_skill_id": {
- "name": "company_skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision_number": {
- "name": "revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "release_id": {
- "name": "release_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "release_name": {
- "name": "release_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "released_at": {
- "name": "released_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "file_inventory": {
- "name": "file_inventory",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "author_agent_id": {
- "name": "author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skill_versions_skill_revision_idx": {
- "name": "company_skill_versions_skill_revision_idx",
- "columns": [
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revision_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_versions_skill_release_idx": {
- "name": "company_skill_versions_skill_release_idx",
- "columns": [
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "release_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"company_skill_versions\".\"release_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skill_versions_company_skill_created_idx": {
- "name": "company_skill_versions_company_skill_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "company_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skill_versions_company_id_companies_id_fk": {
- "name": "company_skill_versions_company_id_companies_id_fk",
- "tableFrom": "company_skill_versions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_versions_company_skill_id_company_skills_id_fk": {
- "name": "company_skill_versions_company_skill_id_company_skills_id_fk",
- "tableFrom": "company_skill_versions",
- "tableTo": "company_skills",
- "columnsFrom": [
- "company_skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "company_skill_versions_author_agent_id_agents_id_fk": {
- "name": "company_skill_versions_author_agent_id_agents_id_fk",
- "tableFrom": "company_skill_versions",
- "tableTo": "agents",
- "columnsFrom": [
- "author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_skills": {
- "name": "company_skills",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "folder_id": {
- "name": "folder_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "markdown": {
- "name": "markdown",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_type": {
- "name": "source_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_path'"
- },
- "source_locator": {
- "name": "source_locator",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_ref": {
- "name": "source_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "trust_level": {
- "name": "trust_level",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'markdown_only'"
- },
- "compatibility": {
- "name": "compatibility",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'compatible'"
- },
- "file_inventory": {
- "name": "file_inventory",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "icon_url": {
- "name": "icon_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "tagline": {
- "name": "tagline",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "author_name": {
- "name": "author_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "homepage_url": {
- "name": "homepage_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "categories": {
- "name": "categories",
- "type": "text[]",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'"
- },
- "sharing_scope": {
- "name": "sharing_scope",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'company'"
- },
- "public_share_token": {
- "name": "public_share_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "forked_from_skill_id": {
- "name": "forked_from_skill_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "forked_from_company_id": {
- "name": "forked_from_company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "star_count": {
- "name": "star_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "install_count": {
- "name": "install_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "fork_count": {
- "name": "fork_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "current_version_id": {
- "name": "current_version_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_skills_company_key_idx": {
- "name": "company_skills_company_key_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skills_company_name_idx": {
- "name": "company_skills_company_name_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skills_company_folder_idx": {
- "name": "company_skills_company_folder_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "folder_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skills_company_categories_idx": {
- "name": "company_skills_company_categories_idx",
- "columns": [
- {
- "expression": "categories",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "company_skills_company_sharing_scope_idx": {
- "name": "company_skills_company_sharing_scope_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "sharing_scope",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skills_company_current_version_idx": {
- "name": "company_skills_company_current_version_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "current_version_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_skills_company_forked_from_idx": {
- "name": "company_skills_company_forked_from_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "forked_from_skill_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_skills_company_id_companies_id_fk": {
- "name": "company_skills_company_id_companies_id_fk",
- "tableFrom": "company_skills",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "company_skills_folder_id_folders_id_fk": {
- "name": "company_skills_folder_id_folders_id_fk",
- "tableFrom": "company_skills",
- "tableTo": "folders",
- "columnsFrom": [
- "folder_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skills_forked_from_skill_id_company_skills_id_fk": {
- "name": "company_skills_forked_from_skill_id_company_skills_id_fk",
- "tableFrom": "company_skills",
- "tableTo": "company_skills",
- "columnsFrom": [
- "forked_from_skill_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skills_forked_from_company_id_companies_id_fk": {
- "name": "company_skills_forked_from_company_id_companies_id_fk",
- "tableFrom": "company_skills",
- "tableTo": "companies",
- "columnsFrom": [
- "forked_from_company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "company_skills_current_version_id_company_skill_versions_id_fk": {
- "name": "company_skills_current_version_id_company_skill_versions_id_fk",
- "tableFrom": "company_skills",
- "tableTo": "company_skill_versions",
- "columnsFrom": [
- "current_version_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_transfer_runs": {
- "name": "company_transfer_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "direction": {
- "name": "direction",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "actor_key": {
- "name": "actor_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "container_ref": {
- "name": "container_ref",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "manifest_sha256": {
- "name": "manifest_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "manifest": {
- "name": "manifest",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "chunk_count": {
- "name": "chunk_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "blob_count": {
- "name": "blob_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "completed_parts": {
- "name": "completed_parts",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_transfer_runs_company_idx": {
- "name": "company_transfer_runs_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_transfer_runs_idempotency_direction_idx": {
- "name": "company_transfer_runs_idempotency_direction_idx",
- "columns": [
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "direction",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_transfer_runs_actor_status_idx": {
- "name": "company_transfer_runs_actor_status_idx",
- "columns": [
- {
- "expression": "actor_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_transfer_runs_company_id_companies_id_fk": {
- "name": "company_transfer_runs_company_id_companies_id_fk",
- "tableFrom": "company_transfer_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.company_user_sidebar_preferences": {
- "name": "company_user_sidebar_preferences",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "project_order": {
- "name": "project_order",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "company_user_sidebar_preferences_company_idx": {
- "name": "company_user_sidebar_preferences_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_user_sidebar_preferences_user_idx": {
- "name": "company_user_sidebar_preferences_user_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "company_user_sidebar_preferences_company_user_uq": {
- "name": "company_user_sidebar_preferences_company_user_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "company_user_sidebar_preferences_company_id_companies_id_fk": {
- "name": "company_user_sidebar_preferences_company_id_companies_id_fk",
- "tableFrom": "company_user_sidebar_preferences",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.completion_contracts": {
- "name": "completion_contracts",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "schema_version": {
- "name": "schema_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "policy_version": {
- "name": "policy_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "risk": {
- "name": "risk",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "completion_authority": {
- "name": "completion_authority",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "incomplete_criteria_policy": {
- "name": "incomplete_criteria_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "contract_json": {
- "name": "contract_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "canonical_sha256": {
- "name": "canonical_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_actor_type": {
- "name": "created_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_actor_id": {
- "name": "created_by_actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "supersedes_contract_id": {
- "name": "supersedes_contract_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "completion_contracts_issue_revision_uq": {
- "name": "completion_contracts_issue_revision_uq",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revision",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "completion_contracts_issue_hash_uq": {
- "name": "completion_contracts_issue_hash_uq",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "canonical_sha256",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "completion_contracts_company_id_companies_id_fk": {
- "name": "completion_contracts_company_id_companies_id_fk",
- "tableFrom": "completion_contracts",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "completion_contracts_issue_company_fk": {
- "name": "completion_contracts_issue_company_fk",
- "tableFrom": "completion_contracts",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "completion_contracts_supersedes_owner_fk": {
- "name": "completion_contracts_supersedes_owner_fk",
- "tableFrom": "completion_contracts",
- "tableTo": "completion_contracts",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "supersedes_contract_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "completion_contracts_company_issue_id_uq": {
- "name": "completion_contracts_company_issue_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "issue_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.connection_event_deliveries": {
- "name": "connection_event_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_delivery_id": {
- "name": "provider_delivery_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "event": {
- "name": "event",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "installation_id": {
- "name": "installation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "repository_id": {
- "name": "repository_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "normalized_payload": {
- "name": "normalized_payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'received'"
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_created_at": {
- "name": "provider_created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "processed_at": {
- "name": "processed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_event_deliveries_company_provider_id_uq": {
- "name": "connection_event_deliveries_company_provider_id_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_delivery_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_event_deliveries_company_status_idx": {
- "name": "connection_event_deliveries_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_event_deliveries_company_id_companies_id_fk": {
- "name": "connection_event_deliveries_company_id_companies_id_fk",
- "tableFrom": "connection_event_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.connection_intent_deliveries": {
- "name": "connection_intent_deliveries",
- "schema": "",
- "columns": {
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "delivered_at": {
- "name": "delivered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_intent_deliveries_pending_idx": {
- "name": "connection_intent_deliveries_pending_idx",
- "columns": [
- {
- "expression": "delivered_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_intent_deliveries_interaction_id_issue_thread_interactions_id_fk": {
- "name": "connection_intent_deliveries_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "connection_intent_deliveries",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_intent_deliveries_company_id_companies_id_fk": {
- "name": "connection_intent_deliveries_company_id_companies_id_fk",
- "tableFrom": "connection_intent_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.cost_events": {
- "name": "cost_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "billing_code": {
- "name": "billing_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "biller": {
- "name": "biller",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "billing_type": {
- "name": "billing_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "cost_status": {
- "name": "cost_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'reported'"
- },
- "model": {
- "name": "model",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "input_tokens": {
- "name": "input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "cached_input_tokens": {
- "name": "cached_input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "output_tokens": {
- "name": "output_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "cost_cents": {
- "name": "cost_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "occurred_at": {
- "name": "occurred_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "cost_events_company_occurred_idx": {
- "name": "cost_events_company_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cost_events_company_agent_occurred_idx": {
- "name": "cost_events_company_agent_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cost_events_company_provider_occurred_idx": {
- "name": "cost_events_company_provider_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cost_events_company_biller_occurred_idx": {
- "name": "cost_events_company_biller_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "biller",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "cost_events_company_heartbeat_run_idx": {
- "name": "cost_events_company_heartbeat_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "heartbeat_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "cost_events_company_id_companies_id_fk": {
- "name": "cost_events_company_id_companies_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "cost_events_agent_id_agents_id_fk": {
- "name": "cost_events_agent_id_agents_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "cost_events_issue_id_issues_id_fk": {
- "name": "cost_events_issue_id_issues_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "cost_events_project_id_projects_id_fk": {
- "name": "cost_events_project_id_projects_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "cost_events_goal_id_goals_id_fk": {
- "name": "cost_events_goal_id_goals_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "cost_events_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "cost_events_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "cost_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.decision_archive_notification_outbox": {
- "name": "decision_archive_notification_outbox",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "archive_version": {
- "name": "archive_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "origin_agent_id": {
- "name": "origin_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_issue_id": {
- "name": "origin_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "attempt_count": {
- "name": "attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_attempt_at": {
- "name": "last_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "delivered_at": {
- "name": "delivered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_archive_notification_outbox_uq": {
- "name": "decision_archive_notification_outbox_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "archive_version",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_archive_notification_outbox_pending_idx": {
- "name": "decision_archive_notification_outbox_pending_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_archive_notification_outbox_company_id_companies_id_fk": {
- "name": "decision_archive_notification_outbox_company_id_companies_id_fk",
- "tableFrom": "decision_archive_notification_outbox",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_archive_notification_outbox_origin_agent_id_agents_id_fk": {
- "name": "decision_archive_notification_outbox_origin_agent_id_agents_id_fk",
- "tableFrom": "decision_archive_notification_outbox",
- "tableTo": "agents",
- "columnsFrom": [
- "origin_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "decision_archive_notification_outbox_status_check": {
- "name": "decision_archive_notification_outbox_status_check",
- "value": "\"decision_archive_notification_outbox\".\"status\" IN ('pending', 'delivering', 'delivered')"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_queue_items": {
- "name": "decision_queue_items",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "queue_id": {
- "name": "queue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "added_by_type": {
- "name": "added_by_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "added_by_agent_id": {
- "name": "added_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "added_by_user_id": {
- "name": "added_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "added_by_run_id": {
- "name": "added_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "added_by_agent_api_key_id": {
- "name": "added_by_agent_api_key_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_queue_items_queue_source_uq": {
- "name": "decision_queue_items_queue_source_uq",
- "columns": [
- {
- "expression": "queue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_queue_items_company_source_idx": {
- "name": "decision_queue_items_company_source_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_queue_items_company_id_companies_id_fk": {
- "name": "decision_queue_items_company_id_companies_id_fk",
- "tableFrom": "decision_queue_items",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_queue_items_added_by_agent_id_agents_id_fk": {
- "name": "decision_queue_items_added_by_agent_id_agents_id_fk",
- "tableFrom": "decision_queue_items",
- "tableTo": "agents",
- "columnsFrom": [
- "added_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk": {
- "name": "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_queue_items",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "added_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk": {
- "name": "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk",
- "tableFrom": "decision_queue_items",
- "tableTo": "agent_api_keys",
- "columnsFrom": [
- "added_by_agent_api_key_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_queue_items_queue_company_fk": {
- "name": "decision_queue_items_queue_company_fk",
- "tableFrom": "decision_queue_items",
- "tableTo": "decision_queues",
- "columnsFrom": [
- "queue_id",
- "company_id"
- ],
- "columnsTo": [
- "id",
- "company_id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "decision_queue_items_actor_check": {
- "name": "decision_queue_items_actor_check",
- "value": "(\n (\"decision_queue_items\".\"added_by_type\" = 'agent' AND \"decision_queue_items\".\"added_by_agent_id\" IS NOT NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'user' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NOT NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'system' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_queues": {
- "name": "decision_queues",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_type": {
- "name": "created_by_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_api_key_id": {
- "name": "created_by_agent_api_key_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "retention_days": {
- "name": "retention_days",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "seed_rules": {
- "name": "seed_rules",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "seed_rules_enabled": {
- "name": "seed_rules_enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_queues_company_key_uq": {
- "name": "decision_queues_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_queues_company_updated_idx": {
- "name": "decision_queues_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_queues_company_id_companies_id_fk": {
- "name": "decision_queues_company_id_companies_id_fk",
- "tableFrom": "decision_queues",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_queues_created_by_agent_id_agents_id_fk": {
- "name": "decision_queues_created_by_agent_id_agents_id_fk",
- "tableFrom": "decision_queues",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_queues_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "decision_queues_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_queues",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk": {
- "name": "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk",
- "tableFrom": "decision_queues",
- "tableTo": "agent_api_keys",
- "columnsFrom": [
- "created_by_agent_api_key_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "decision_queues_id_company_uq": {
- "name": "decision_queues_id_company_uq",
- "nullsNotDistinct": false,
- "columns": [
- "id",
- "company_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "decision_queues_creator_check": {
- "name": "decision_queues_creator_check",
- "value": "(\n (\"decision_queues\".\"created_by_type\" = 'agent' AND \"decision_queues\".\"created_by_agent_id\" IS NOT NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'user' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NOT NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'system' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n )"
- },
- "decision_queues_retention_days_check": {
- "name": "decision_queues_retention_days_check",
- "value": "\"decision_queues\".\"retention_days\" IS NULL OR (\"decision_queues\".\"retention_days\" >= 1 AND \"decision_queues\".\"retention_days\" <= 3650)"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_retention": {
- "name": "decision_retention",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_activity_at": {
- "name": "source_activity_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "keep": {
- "name": "keep",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "archived_reason": {
- "name": "archived_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_type": {
- "name": "archived_by_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_agent_id": {
- "name": "archived_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_user_id": {
- "name": "archived_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_run_id": {
- "name": "archived_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "archive_version": {
- "name": "archive_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_retention_company_source_uq": {
- "name": "decision_retention_company_source_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_retention_company_archived_idx": {
- "name": "decision_retention_company_archived_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "archived_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_retention_company_id_companies_id_fk": {
- "name": "decision_retention_company_id_companies_id_fk",
- "tableFrom": "decision_retention",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_retention_archived_by_agent_id_agents_id_fk": {
- "name": "decision_retention_archived_by_agent_id_agents_id_fk",
- "tableFrom": "decision_retention",
- "tableTo": "agents",
- "columnsFrom": [
- "archived_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_retention_archived_by_run_id_heartbeat_runs_id_fk": {
- "name": "decision_retention_archived_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_retention",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "archived_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "decision_retention_archive_actor_check": {
- "name": "decision_retention_archive_actor_check",
- "value": "(\n (\"decision_retention\".\"archived_at\" IS NULL AND \"decision_retention\".\"archived_by_type\" IS NULL AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'system' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'agent' AND \"decision_retention\".\"archived_by_agent_id\" IS NOT NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'user' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NOT NULL)\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_triage": {
- "name": "decision_triage",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "decide_by": {
- "name": "decide_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decide_by_date": {
- "name": "decide_by_date",
- "type": "date",
- "primaryKey": false,
- "notNull": false
- },
- "snoozed_until": {
- "name": "snoozed_until",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "set_by_type": {
- "name": "set_by_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "set_by_agent_id": {
- "name": "set_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "set_by_user_id": {
- "name": "set_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "set_by_run_id": {
- "name": "set_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "set_by_agent_api_key_id": {
- "name": "set_by_agent_api_key_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_triage_company_source_uq": {
- "name": "decision_triage_company_source_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_triage_company_decide_by_idx": {
- "name": "decision_triage_company_decide_by_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "decide_by",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_triage_company_id_companies_id_fk": {
- "name": "decision_triage_company_id_companies_id_fk",
- "tableFrom": "decision_triage",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_triage_set_by_agent_id_agents_id_fk": {
- "name": "decision_triage_set_by_agent_id_agents_id_fk",
- "tableFrom": "decision_triage",
- "tableTo": "agents",
- "columnsFrom": [
- "set_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_triage_set_by_run_id_heartbeat_runs_id_fk": {
- "name": "decision_triage_set_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_triage",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "set_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk": {
- "name": "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk",
- "tableFrom": "decision_triage",
- "tableTo": "agent_api_keys",
- "columnsFrom": [
- "set_by_agent_api_key_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "decision_triage_actor_check": {
- "name": "decision_triage_actor_check",
- "value": "(\n (\"decision_triage\".\"set_by_type\" = 'agent' AND \"decision_triage\".\"set_by_agent_id\" IS NOT NULL AND \"decision_triage\".\"set_by_user_id\" IS NULL)\n OR (\"decision_triage\".\"set_by_type\" = 'user' AND \"decision_triage\".\"set_by_agent_id\" IS NULL AND \"decision_triage\".\"set_by_user_id\" IS NOT NULL)\n )"
- },
- "decision_triage_decide_by_check": {
- "name": "decision_triage_decide_by_check",
- "value": "(\n (\"decision_triage\".\"decide_by\" IS NULL AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" IN ('today', 'this_week', 'whenever') AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" = 'date' AND \"decision_triage\".\"decide_by_date\" IS NOT NULL)\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_triage_events": {
- "name": "decision_triage_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "queue_id": {
- "name": "queue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_id": {
- "name": "source_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_agent_id": {
- "name": "actor_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "actor_user_id": {
- "name": "actor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "actor_run_id": {
- "name": "actor_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "agent_api_key_id": {
- "name": "agent_api_key_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "details": {
- "name": "details",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_triage_events_company_source_created_idx": {
- "name": "decision_triage_events_company_source_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_triage_events_queue_created_idx": {
- "name": "decision_triage_events_queue_created_idx",
- "columns": [
- {
- "expression": "queue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_triage_events_company_id_companies_id_fk": {
- "name": "decision_triage_events_company_id_companies_id_fk",
- "tableFrom": "decision_triage_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_triage_events_queue_id_decision_queues_id_fk": {
- "name": "decision_triage_events_queue_id_decision_queues_id_fk",
- "tableFrom": "decision_triage_events",
- "tableTo": "decision_queues",
- "columnsFrom": [
- "queue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_triage_events_actor_agent_id_agents_id_fk": {
- "name": "decision_triage_events_actor_agent_id_agents_id_fk",
- "tableFrom": "decision_triage_events",
- "tableTo": "agents",
- "columnsFrom": [
- "actor_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_triage_events_actor_run_id_heartbeat_runs_id_fk": {
- "name": "decision_triage_events_actor_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_triage_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "actor_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk": {
- "name": "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk",
- "tableFrom": "decision_triage_events",
- "tableTo": "agent_api_keys",
- "columnsFrom": [
- "agent_api_key_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "decision_triage_events_actor_check": {
- "name": "decision_triage_events_actor_check",
- "value": "(\n (\"decision_triage_events\".\"actor_type\" = 'agent' AND \"decision_triage_events\".\"actor_agent_id\" IS NOT NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'user' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NOT NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'system' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.decision_training_examples": {
- "name": "decision_training_examples",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_id": {
- "name": "source_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "cutoff_at": {
- "name": "cutoff_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "notes": {
- "name": "notes",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "notes_history": {
- "name": "notes_history",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "decision_outcome": {
- "name": "decision_outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "retention_policy": {
- "name": "retention_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'scrub_deleted_comments_v1'"
- },
- "snapshot": {
- "name": "snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_training_examples_company_created_at_idx": {
- "name": "decision_training_examples_company_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_training_examples_issue_idx": {
- "name": "decision_training_examples_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_training_examples_source_author_uq": {
- "name": "decision_training_examples_source_author_uq",
- "columns": [
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_by_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_training_examples_company_id_companies_id_fk": {
- "name": "decision_training_examples_company_id_companies_id_fk",
- "tableFrom": "decision_training_examples",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_training_examples_issue_id_issues_id_fk": {
- "name": "decision_training_examples_issue_id_issues_id_fk",
- "tableFrom": "decision_training_examples",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.decision_bundles": {
- "name": "decision_bundles",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "summary": {
- "name": "summary",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "origin_agent_id": {
- "name": "origin_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_issue_id": {
- "name": "origin_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_run_id": {
- "name": "origin_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decision_bundles_company_created_at_idx": {
- "name": "decision_bundles_company_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_bundles_company_id_companies_id_fk": {
- "name": "decision_bundles_company_id_companies_id_fk",
- "tableFrom": "decision_bundles",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_bundles_origin_agent_id_agents_id_fk": {
- "name": "decision_bundles_origin_agent_id_agents_id_fk",
- "tableFrom": "decision_bundles",
- "tableTo": "agents",
- "columnsFrom": [
- "origin_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_bundles_origin_issue_id_issues_id_fk": {
- "name": "decision_bundles_origin_issue_id_issues_id_fk",
- "tableFrom": "decision_bundles",
- "tableTo": "issues",
- "columnsFrom": [
- "origin_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_bundles_origin_run_id_heartbeat_runs_id_fk": {
- "name": "decision_bundles_origin_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decision_bundles",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "origin_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.decision_effect_executions": {
- "name": "decision_effect_executions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "decision_id": {
- "name": "decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "effect_index": {
- "name": "effect_index",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "effect_type": {
- "name": "effect_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_issue_id": {
- "name": "target_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'claimed'"
- },
- "result": {
- "name": "result",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "activity_log_id": {
- "name": "activity_log_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "executed_at": {
- "name": "executed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "decision_effect_executions_decision_effect_uq": {
- "name": "decision_effect_executions_decision_effect_uq",
- "columns": [
- {
- "expression": "decision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "effect_index",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_effect_executions_target_issue_idx": {
- "name": "decision_effect_executions_target_issue_idx",
- "columns": [
- {
- "expression": "target_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_effect_executions_decision_id_decisions_id_fk": {
- "name": "decision_effect_executions_decision_id_decisions_id_fk",
- "tableFrom": "decision_effect_executions",
- "tableTo": "decisions",
- "columnsFrom": [
- "decision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_effect_executions_target_issue_id_issues_id_fk": {
- "name": "decision_effect_executions_target_issue_id_issues_id_fk",
- "tableFrom": "decision_effect_executions",
- "tableTo": "issues",
- "columnsFrom": [
- "target_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decision_effect_executions_activity_log_id_activity_log_id_fk": {
- "name": "decision_effect_executions_activity_log_id_activity_log_id_fk",
- "tableFrom": "decision_effect_executions",
- "tableTo": "activity_log",
- "columnsFrom": [
- "activity_log_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.decision_target_issues": {
- "name": "decision_target_issues",
- "schema": "",
- "columns": {
- "decision_id": {
- "name": "decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "decision_target_issues_decision_idx": {
- "name": "decision_target_issues_decision_idx",
- "columns": [
- {
- "expression": "decision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decision_target_issues_issue_idx": {
- "name": "decision_target_issues_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decision_target_issues_decision_id_decisions_id_fk": {
- "name": "decision_target_issues_decision_id_decisions_id_fk",
- "tableFrom": "decision_target_issues",
- "tableTo": "decisions",
- "columnsFrom": [
- "decision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_target_issues_issue_id_issues_id_fk": {
- "name": "decision_target_issues_issue_id_issues_id_fk",
- "tableFrom": "decision_target_issues",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "decision_target_issues_company_id_companies_id_fk": {
- "name": "decision_target_issues_company_id_companies_id_fk",
- "tableFrom": "decision_target_issues",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "decision_target_issues_decision_id_issue_id_pk": {
- "name": "decision_target_issues_decision_id_issue_id_pk",
- "columns": [
- "decision_id",
- "issue_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.decisions": {
- "name": "decisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "bundle_id": {
- "name": "bundle_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "origin_agent_id": {
- "name": "origin_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_issue_id": {
- "name": "origin_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "origin_run_id": {
- "name": "origin_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "rule_key": {
- "name": "rule_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "options": {
- "name": "options",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "inputs": {
- "name": "inputs",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'open'"
- },
- "execution_status": {
- "name": "execution_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "chosen_option_id": {
- "name": "chosen_option_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "input_values": {
- "name": "input_values",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "decided_by_user_id": {
- "name": "decided_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_at": {
- "name": "decided_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "signed_spec": {
- "name": "signed_spec",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_snapshots": {
- "name": "target_snapshots",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "continuation_policy": {
- "name": "continuation_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'none'"
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "decisions_company_status_expires_at_idx": {
- "name": "decisions_company_status_expires_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decisions_bundle_idx": {
- "name": "decisions_bundle_idx",
- "columns": [
- {
- "expression": "bundle_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decisions_origin_issue_idx": {
- "name": "decisions_origin_issue_idx",
- "columns": [
- {
- "expression": "origin_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "decisions_company_idempotency_uq": {
- "name": "decisions_company_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"decisions\".\"idempotency_key\" IS NOT NULL",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "decisions_company_id_companies_id_fk": {
- "name": "decisions_company_id_companies_id_fk",
- "tableFrom": "decisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decisions_bundle_id_decision_bundles_id_fk": {
- "name": "decisions_bundle_id_decision_bundles_id_fk",
- "tableFrom": "decisions",
- "tableTo": "decision_bundles",
- "columnsFrom": [
- "bundle_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "decisions_origin_agent_id_agents_id_fk": {
- "name": "decisions_origin_agent_id_agents_id_fk",
- "tableFrom": "decisions",
- "tableTo": "agents",
- "columnsFrom": [
- "origin_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decisions_origin_issue_id_issues_id_fk": {
- "name": "decisions_origin_issue_id_issues_id_fk",
- "tableFrom": "decisions",
- "tableTo": "issues",
- "columnsFrom": [
- "origin_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "decisions_origin_run_id_heartbeat_runs_id_fk": {
- "name": "decisions_origin_run_id_heartbeat_runs_id_fk",
- "tableFrom": "decisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "origin_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.document_annotation_anchor_snapshots": {
- "name": "document_annotation_anchor_snapshots",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "thread_id": {
- "name": "thread_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "from_revision_id": {
- "name": "from_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "from_revision_number": {
- "name": "from_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "to_revision_id": {
- "name": "to_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "to_revision_number": {
- "name": "to_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "previous_anchor": {
- "name": "previous_anchor",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "next_anchor": {
- "name": "next_anchor",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "anchor_state": {
- "name": "anchor_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "anchor_confidence": {
- "name": "anchor_confidence",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "document_annotation_anchor_snapshots_company_thread_created_at_idx": {
- "name": "document_annotation_anchor_snapshots_company_thread_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "thread_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_anchor_snapshots_company_document_revision_idx": {
- "name": "document_annotation_anchor_snapshots_company_document_revision_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "to_revision_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "document_annotation_anchor_snapshots_company_id_companies_id_fk": {
- "name": "document_annotation_anchor_snapshots_company_id_companies_id_fk",
- "tableFrom": "document_annotation_anchor_snapshots",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk": {
- "name": "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk",
- "tableFrom": "document_annotation_anchor_snapshots",
- "tableTo": "document_annotation_threads",
- "columnsFrom": [
- "thread_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_anchor_snapshots_document_id_documents_id_fk": {
- "name": "document_annotation_anchor_snapshots_document_id_documents_id_fk",
- "tableFrom": "document_annotation_anchor_snapshots",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk": {
- "name": "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk",
- "tableFrom": "document_annotation_anchor_snapshots",
- "tableTo": "document_revisions",
- "columnsFrom": [
- "from_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk": {
- "name": "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk",
- "tableFrom": "document_annotation_anchor_snapshots",
- "tableTo": "document_revisions",
- "columnsFrom": [
- "to_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.document_annotation_comments": {
- "name": "document_annotation_comments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "thread_id": {
- "name": "thread_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "author_type": {
- "name": "author_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "author_agent_id": {
- "name": "author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_comment_id": {
- "name": "issue_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_trust": {
- "name": "source_trust",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "document_annotation_comments_company_thread_created_at_idx": {
- "name": "document_annotation_comments_company_thread_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "thread_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_company_issue_created_at_idx": {
- "name": "document_annotation_comments_company_issue_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_company_routine_created_at_idx": {
- "name": "document_annotation_comments_company_routine_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_company_case_created_at_idx": {
- "name": "document_annotation_comments_company_case_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_company_document_created_at_idx": {
- "name": "document_annotation_comments_company_document_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_issue_comment_idx": {
- "name": "document_annotation_comments_issue_comment_idx",
- "columns": [
- {
- "expression": "issue_comment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_comments_body_search_idx": {
- "name": "document_annotation_comments_body_search_idx",
- "columns": [
- {
- "expression": "body",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- }
- },
- "foreignKeys": {
- "document_annotation_comments_company_id_companies_id_fk": {
- "name": "document_annotation_comments_company_id_companies_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "document_annotation_comments_thread_id_document_annotation_threads_id_fk": {
- "name": "document_annotation_comments_thread_id_document_annotation_threads_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "document_annotation_threads",
- "columnsFrom": [
- "thread_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_comments_issue_id_issues_id_fk": {
- "name": "document_annotation_comments_issue_id_issues_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_comments_routine_id_routines_id_fk": {
- "name": "document_annotation_comments_routine_id_routines_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_comments_case_id_cases_id_fk": {
- "name": "document_annotation_comments_case_id_cases_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_comments_document_id_documents_id_fk": {
- "name": "document_annotation_comments_document_id_documents_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_comments_author_agent_id_agents_id_fk": {
- "name": "document_annotation_comments_author_agent_id_agents_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_comments_issue_comment_id_issue_comments_id_fk": {
- "name": "document_annotation_comments_issue_comment_id_issue_comments_id_fk",
- "tableFrom": "document_annotation_comments",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "issue_comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "document_annotation_comments_exactly_one_owner_chk": {
- "name": "document_annotation_comments_exactly_one_owner_chk",
- "value": "num_nonnulls(\"document_annotation_comments\".\"issue_id\", \"document_annotation_comments\".\"routine_id\", \"document_annotation_comments\".\"case_id\") = 1"
- }
- },
- "isRLSEnabled": false
- },
- "public.document_annotation_threads": {
- "name": "document_annotation_threads",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_key": {
- "name": "document_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'open'"
- },
- "anchor_state": {
- "name": "anchor_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "original_revision_id": {
- "name": "original_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "original_revision_number": {
- "name": "original_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "current_revision_id": {
- "name": "current_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "current_revision_number": {
- "name": "current_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "selected_text": {
- "name": "selected_text",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "prefix_text": {
- "name": "prefix_text",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "suffix_text": {
- "name": "suffix_text",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "normalized_start": {
- "name": "normalized_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "normalized_end": {
- "name": "normalized_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "markdown_start": {
- "name": "markdown_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "markdown_end": {
- "name": "markdown_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "anchor_confidence": {
- "name": "anchor_confidence",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'exact'"
- },
- "anchor_selector": {
- "name": "anchor_selector",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_agent_id": {
- "name": "resolved_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_user_id": {
- "name": "resolved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "document_annotation_threads_company_document_status_idx": {
- "name": "document_annotation_threads_company_document_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_threads_company_issue_status_idx": {
- "name": "document_annotation_threads_company_issue_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_threads_company_routine_status_idx": {
- "name": "document_annotation_threads_company_routine_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_threads_company_case_status_idx": {
- "name": "document_annotation_threads_company_case_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_threads_company_current_revision_open_idx": {
- "name": "document_annotation_threads_company_current_revision_open_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "current_revision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_annotation_threads_company_anchor_state_idx": {
- "name": "document_annotation_threads_company_anchor_state_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "anchor_state",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "document_annotation_threads_company_id_companies_id_fk": {
- "name": "document_annotation_threads_company_id_companies_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "document_annotation_threads_issue_id_issues_id_fk": {
- "name": "document_annotation_threads_issue_id_issues_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_threads_routine_id_routines_id_fk": {
- "name": "document_annotation_threads_routine_id_routines_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_threads_case_id_cases_id_fk": {
- "name": "document_annotation_threads_case_id_cases_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_threads_document_id_documents_id_fk": {
- "name": "document_annotation_threads_document_id_documents_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_annotation_threads_original_revision_id_document_revisions_id_fk": {
- "name": "document_annotation_threads_original_revision_id_document_revisions_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "document_revisions",
- "columnsFrom": [
- "original_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_threads_current_revision_id_document_revisions_id_fk": {
- "name": "document_annotation_threads_current_revision_id_document_revisions_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "document_revisions",
- "columnsFrom": [
- "current_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_threads_created_by_agent_id_agents_id_fk": {
- "name": "document_annotation_threads_created_by_agent_id_agents_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_annotation_threads_resolved_by_agent_id_agents_id_fk": {
- "name": "document_annotation_threads_resolved_by_agent_id_agents_id_fk",
- "tableFrom": "document_annotation_threads",
- "tableTo": "agents",
- "columnsFrom": [
- "resolved_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "document_annotation_threads_exactly_one_owner_chk": {
- "name": "document_annotation_threads_exactly_one_owner_chk",
- "value": "num_nonnulls(\"document_annotation_threads\".\"issue_id\", \"document_annotation_threads\".\"routine_id\", \"document_annotation_threads\".\"case_id\") = 1"
- }
- },
- "isRLSEnabled": false
- },
- "public.document_memberships": {
- "name": "document_memberships",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "starred_at": {
- "name": "starred_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "document_memberships_company_user_starred_idx": {
- "name": "document_memberships_company_user_starred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "starred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_memberships_company_user_document_uq": {
- "name": "document_memberships_company_user_document_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "document_memberships_company_id_companies_id_fk": {
- "name": "document_memberships_company_id_companies_id_fk",
- "tableFrom": "document_memberships",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_memberships_document_id_documents_id_fk": {
- "name": "document_memberships_document_id_documents_id_fk",
- "tableFrom": "document_memberships",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.document_revisions": {
- "name": "document_revisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision_number": {
- "name": "revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "format": {
- "name": "format",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'markdown'"
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "change_summary": {
- "name": "change_summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "document_revisions_document_revision_uq": {
- "name": "document_revisions_document_revision_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revision_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "document_revisions_company_document_created_idx": {
- "name": "document_revisions_company_document_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "document_revisions_company_id_companies_id_fk": {
- "name": "document_revisions_company_id_companies_id_fk",
- "tableFrom": "document_revisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_revisions_document_id_documents_id_fk": {
- "name": "document_revisions_document_id_documents_id_fk",
- "tableFrom": "document_revisions",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "document_revisions_created_by_agent_id_agents_id_fk": {
- "name": "document_revisions_created_by_agent_id_agents_id_fk",
- "tableFrom": "document_revisions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "document_revisions_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "document_revisions_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "document_revisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.documents": {
- "name": "documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "format": {
- "name": "format",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'markdown'"
- },
- "latest_body": {
- "name": "latest_body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "latest_revision_id": {
- "name": "latest_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "latest_revision_number": {
- "name": "latest_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "locked_at": {
- "name": "locked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "locked_by_agent_id": {
- "name": "locked_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "locked_by_user_id": {
- "name": "locked_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_trust": {
- "name": "source_trust",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "documents_company_updated_idx": {
- "name": "documents_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "documents_company_created_idx": {
- "name": "documents_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "documents_title_search_idx": {
- "name": "documents_title_search_idx",
- "columns": [
- {
- "expression": "title",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "documents_latest_body_search_idx": {
- "name": "documents_latest_body_search_idx",
- "columns": [
- {
- "expression": "latest_body",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- }
- },
- "foreignKeys": {
- "documents_company_id_companies_id_fk": {
- "name": "documents_company_id_companies_id_fk",
- "tableFrom": "documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "documents_created_by_agent_id_agents_id_fk": {
- "name": "documents_created_by_agent_id_agents_id_fk",
- "tableFrom": "documents",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "documents_updated_by_agent_id_agents_id_fk": {
- "name": "documents_updated_by_agent_id_agents_id_fk",
- "tableFrom": "documents",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "documents_locked_by_agent_id_agents_id_fk": {
- "name": "documents_locked_by_agent_id_agents_id_fk",
- "tableFrom": "documents",
- "tableTo": "agents",
- "columnsFrom": [
- "locked_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.email_endpoints": {
- "name": "email_endpoints",
- "schema": "",
- "columns": {
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "receive_mode": {
- "name": "receive_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "webhook_id": {
- "name": "webhook_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "owned_api_key_id": {
- "name": "owned_api_key_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "activation_at": {
- "name": "activation_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "sync_checkpoint": {
- "name": "sync_checkpoint",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_sync_at": {
- "name": "last_sync_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "email_endpoints_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "email_endpoints_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "email_endpoints",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "email_endpoints_receive_mode_check": {
- "name": "email_endpoints_receive_mode_check",
- "value": "\"email_endpoints\".\"receive_mode\" in ('websocket', 'webhook')"
- }
- },
- "isRLSEnabled": false
- },
- "public.email_messages": {
- "name": "email_messages",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_id": {
- "name": "conversation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_message_id": {
- "name": "provider_message_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "envelope": {
- "name": "envelope",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "text": {
- "name": "text",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "full_text": {
- "name": "full_text",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "direction": {
- "name": "direction",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "automatic": {
- "name": "automatic",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "attachment_ids": {
- "name": "attachment_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "timestamp": {
- "name": "timestamp",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "email_messages_provider_uq": {
- "name": "email_messages_provider_uq",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_message_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "email_messages_conversation_idx": {
- "name": "email_messages_conversation_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "conversation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "timestamp",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "email_messages_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "email_messages_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "email_messages",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "email_messages_company_id_conversation_id_chat_conversations_company_id_id_fk": {
- "name": "email_messages_company_id_conversation_id_chat_conversations_company_id_id_fk",
- "tableFrom": "email_messages",
- "tableTo": "chat_conversations",
- "columnsFrom": [
- "company_id",
- "conversation_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "email_messages_direction_check": {
- "name": "email_messages_direction_check",
- "value": "\"email_messages\".\"direction\" in ('inbound', 'outbound')"
- }
- },
- "isRLSEnabled": false
- },
- "public.email_sends": {
- "name": "email_sends",
- "schema": "",
- "columns": {
- "publication_id": {
- "name": "publication_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "endpoint_id": {
- "name": "endpoint_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "request": {
- "name": "request",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "actor": {
- "name": "actor",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "digest": {
- "name": "digest",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queued'"
- },
- "first_attempt_at": {
- "name": "first_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "email_sends_pending_idx": {
- "name": "email_sends_pending_idx",
- "columns": [
- {
- "expression": "endpoint_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "outcome",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"email_sends\".\"outcome\" in ('queued', 'uncertain')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "email_sends_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
- "name": "email_sends_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
- "tableFrom": "email_sends",
- "tableTo": "chat_endpoints",
- "columnsFrom": [
- "company_id",
- "endpoint_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "email_sends_company_id_publication_id_chat_publications_company_id_id_fk": {
- "name": "email_sends_company_id_publication_id_chat_publications_company_id_id_fk",
- "tableFrom": "email_sends",
- "tableTo": "chat_publications",
- "columnsFrom": [
- "company_id",
- "publication_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "email_sends_outcome_check": {
- "name": "email_sends_outcome_check",
- "value": "\"email_sends\".\"outcome\" in ('queued', 'sent', 'delivered', 'failed', 'uncertain')"
- }
- },
- "isRLSEnabled": false
- },
- "public.environment_custom_image_setup_sessions": {
- "name": "environment_custom_image_setup_sessions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "environment_id": {
- "name": "environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "template_id": {
- "name": "template_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "promoted_template_id": {
- "name": "promoted_template_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_lease_id": {
- "name": "provider_lease_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "environment_lease_id": {
- "name": "environment_lease_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'starting'"
- },
- "started_by_user_id": {
- "name": "started_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "started_by_agent_id": {
- "name": "started_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "base_template_ref": {
- "name": "base_template_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "connection_summary": {
- "name": "connection_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "connection_secret_ref": {
- "name": "connection_secret_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "environment_custom_image_setup_sessions_environment_status_idx": {
- "name": "environment_custom_image_setup_sessions_environment_status_idx",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_setup_sessions_environment_active_uq": {
- "name": "environment_custom_image_setup_sessions_environment_active_uq",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"environment_custom_image_setup_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'capturing')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_setup_sessions_template_idx": {
- "name": "environment_custom_image_setup_sessions_template_idx",
- "columns": [
- {
- "expression": "template_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_setup_sessions_promoted_template_idx": {
- "name": "environment_custom_image_setup_sessions_promoted_template_idx",
- "columns": [
- {
- "expression": "promoted_template_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_setup_sessions_expires_idx": {
- "name": "environment_custom_image_setup_sessions_expires_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_setup_sessions_provider_lease_idx": {
- "name": "environment_custom_image_setup_sessions_provider_lease_idx",
- "columns": [
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_lease_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "environment_custom_image_setup_sessions_environment_id_environments_id_fk": {
- "name": "environment_custom_image_setup_sessions_environment_id_environments_id_fk",
- "tableFrom": "environment_custom_image_setup_sessions",
- "tableTo": "environments",
- "columnsFrom": [
- "environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk": {
- "name": "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk",
- "tableFrom": "environment_custom_image_setup_sessions",
- "tableTo": "environment_custom_image_templates",
- "columnsFrom": [
- "template_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk": {
- "name": "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk",
- "tableFrom": "environment_custom_image_setup_sessions",
- "tableTo": "environment_custom_image_templates",
- "columnsFrom": [
- "promoted_template_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk": {
- "name": "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk",
- "tableFrom": "environment_custom_image_setup_sessions",
- "tableTo": "environment_leases",
- "columnsFrom": [
- "environment_lease_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk": {
- "name": "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk",
- "tableFrom": "environment_custom_image_setup_sessions",
- "tableTo": "agents",
- "columnsFrom": [
- "started_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.environment_custom_image_templates": {
- "name": "environment_custom_image_templates",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "environment_id": {
- "name": "environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "template_kind": {
- "name": "template_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "template_ref": {
- "name": "template_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_template_ref": {
- "name": "source_template_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_environment_config_fingerprint": {
- "name": "source_environment_config_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "captured_at": {
- "name": "captured_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "superseded_by_template_id": {
- "name": "superseded_by_template_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "environment_custom_image_templates_environment_status_idx": {
- "name": "environment_custom_image_templates_environment_status_idx",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_templates_environment_provider_status_idx": {
- "name": "environment_custom_image_templates_environment_provider_status_idx",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_templates_environment_active_uq": {
- "name": "environment_custom_image_templates_environment_active_uq",
- "columns": [
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"environment_custom_image_templates\".\"status\" = 'active'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_templates_superseded_by_idx": {
- "name": "environment_custom_image_templates_superseded_by_idx",
- "columns": [
- {
- "expression": "superseded_by_template_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_custom_image_templates_last_used_idx": {
- "name": "environment_custom_image_templates_last_used_idx",
- "columns": [
- {
- "expression": "last_used_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "environment_custom_image_templates_environment_id_environments_id_fk": {
- "name": "environment_custom_image_templates_environment_id_environments_id_fk",
- "tableFrom": "environment_custom_image_templates",
- "tableTo": "environments",
- "columnsFrom": [
- "environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "environment_custom_image_templates_created_by_agent_id_agents_id_fk": {
- "name": "environment_custom_image_templates_created_by_agent_id_agents_id_fk",
- "tableFrom": "environment_custom_image_templates",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk": {
- "name": "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk",
- "tableFrom": "environment_custom_image_templates",
- "tableTo": "environment_custom_image_templates",
- "columnsFrom": [
- "superseded_by_template_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.environment_leases": {
- "name": "environment_leases",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "environment_id": {
- "name": "environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "lease_policy": {
- "name": "lease_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'ephemeral'"
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_lease_id": {
- "name": "provider_lease_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "acquired_at": {
- "name": "acquired_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "released_at": {
- "name": "released_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "cleanup_status": {
- "name": "cleanup_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "environment_leases_company_environment_status_idx": {
- "name": "environment_leases_company_environment_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_leases_company_execution_workspace_idx": {
- "name": "environment_leases_company_execution_workspace_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_leases_company_issue_idx": {
- "name": "environment_leases_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_leases_heartbeat_run_idx": {
- "name": "environment_leases_heartbeat_run_idx",
- "columns": [
- {
- "expression": "heartbeat_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_leases_company_last_used_idx": {
- "name": "environment_leases_company_last_used_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "last_used_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environment_leases_provider_lease_idx": {
- "name": "environment_leases_provider_lease_idx",
- "columns": [
- {
- "expression": "provider_lease_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "environment_leases_company_id_companies_id_fk": {
- "name": "environment_leases_company_id_companies_id_fk",
- "tableFrom": "environment_leases",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "environment_leases_environment_id_environments_id_fk": {
- "name": "environment_leases_environment_id_environments_id_fk",
- "tableFrom": "environment_leases",
- "tableTo": "environments",
- "columnsFrom": [
- "environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_leases_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "environment_leases_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "environment_leases",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_leases_issue_id_issues_id_fk": {
- "name": "environment_leases_issue_id_issues_id_fk",
- "tableFrom": "environment_leases",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "environment_leases",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.environments": {
- "name": "environments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "driver": {
- "name": "driver",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "env_vars": {
- "name": "env_vars",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "environments_status_idx": {
- "name": "environments_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environments_local_driver_idx": {
- "name": "environments_local_driver_idx",
- "columns": [
- {
- "expression": "driver",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"environments\".\"driver\" = 'local'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environments_managed_sandbox_idx": {
- "name": "environments_managed_sandbox_idx",
- "columns": [
- {
- "expression": "driver",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"environments\".\"driver\" = 'sandbox' AND (\"environments\".\"metadata\" ->> 'managedByPaperclip')::boolean = true",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "environments_name_idx": {
- "name": "environments_name_idx",
- "columns": [
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.execution_workspace_runtime_leases": {
- "name": "execution_workspace_runtime_leases",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "owner_key": {
- "name": "owner_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "owner_issue_id": {
- "name": "owner_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_run_id": {
- "name": "owner_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_action": {
- "name": "last_action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "claimed_at": {
- "name": "claimed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "renewed_at": {
- "name": "renewed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "execution_workspace_runtime_leases_company_workspace_idx": {
- "name": "execution_workspace_runtime_leases_company_workspace_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspace_runtime_leases_company_owner_idx": {
- "name": "execution_workspace_runtime_leases_company_owner_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspace_runtime_leases_expires_at_idx": {
- "name": "execution_workspace_runtime_leases_expires_at_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "execution_workspace_runtime_leases_company_id_companies_id_fk": {
- "name": "execution_workspace_runtime_leases_company_id_companies_id_fk",
- "tableFrom": "execution_workspace_runtime_leases",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "execution_workspace_runtime_leases",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk": {
- "name": "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk",
- "tableFrom": "execution_workspace_runtime_leases",
- "tableTo": "issues",
- "columnsFrom": [
- "owner_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk": {
- "name": "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk",
- "tableFrom": "execution_workspace_runtime_leases",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "owner_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk": {
- "name": "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk",
- "tableFrom": "execution_workspace_runtime_leases",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "execution_workspace_runtime_leases_execution_workspace_id_unique": {
- "name": "execution_workspace_runtime_leases_execution_workspace_id_unique",
- "nullsNotDistinct": false,
- "columns": [
- "execution_workspace_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.execution_workspaces": {
- "name": "execution_workspaces",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_workspace_id": {
- "name": "project_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_issue_id": {
- "name": "source_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "mode": {
- "name": "mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "strategy_type": {
- "name": "strategy_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "cwd": {
- "name": "cwd",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "repo_url": {
- "name": "repo_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "base_ref": {
- "name": "base_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "branch_name": {
- "name": "branch_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_type": {
- "name": "provider_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_fs'"
- },
- "provider_ref": {
- "name": "provider_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "derived_from_execution_workspace_id": {
- "name": "derived_from_execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "opened_at": {
- "name": "opened_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "closed_at": {
- "name": "closed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "cleanup_eligible_at": {
- "name": "cleanup_eligible_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "cleanup_reason": {
- "name": "cleanup_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "execution_workspaces_company_project_status_idx": {
- "name": "execution_workspaces_company_project_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspaces_company_project_workspace_status_idx": {
- "name": "execution_workspaces_company_project_workspace_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspaces_company_source_issue_idx": {
- "name": "execution_workspaces_company_source_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspaces_company_last_used_idx": {
- "name": "execution_workspaces_company_last_used_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "last_used_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "execution_workspaces_company_branch_idx": {
- "name": "execution_workspaces_company_branch_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "branch_name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "execution_workspaces_company_id_companies_id_fk": {
- "name": "execution_workspaces_company_id_companies_id_fk",
- "tableFrom": "execution_workspaces",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "execution_workspaces_project_id_projects_id_fk": {
- "name": "execution_workspaces_project_id_projects_id_fk",
- "tableFrom": "execution_workspaces",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "execution_workspaces_project_workspace_id_project_workspaces_id_fk": {
- "name": "execution_workspaces_project_workspace_id_project_workspaces_id_fk",
- "tableFrom": "execution_workspaces",
- "tableTo": "project_workspaces",
- "columnsFrom": [
- "project_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "execution_workspaces_source_issue_id_issues_id_fk": {
- "name": "execution_workspaces_source_issue_id_issues_id_fk",
- "tableFrom": "execution_workspaces",
- "tableTo": "issues",
- "columnsFrom": [
- "source_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "execution_workspaces",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "derived_from_execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.external_object_mentions": {
- "name": "external_object_mentions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_issue_id": {
- "name": "source_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_record_id": {
- "name": "source_record_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "document_key": {
- "name": "document_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "property_key": {
- "name": "property_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "matched_text_redacted": {
- "name": "matched_text_redacted",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "sanitized_display_url": {
- "name": "sanitized_display_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "canonical_identity_hash": {
- "name": "canonical_identity_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "canonical_identity": {
- "name": "canonical_identity",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "object_id": {
- "name": "object_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_key": {
- "name": "provider_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "detector_key": {
- "name": "detector_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "object_type": {
- "name": "object_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "confidence": {
- "name": "confidence",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'exact'"
- },
- "created_by_plugin_id": {
- "name": "created_by_plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "external_object_mentions_company_source_issue_idx": {
- "name": "external_object_mentions_company_source_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_object_mentions_company_object_idx": {
- "name": "external_object_mentions_company_object_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_object_mentions_company_provider_idx": {
- "name": "external_object_mentions_company_provider_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_object_mentions_company_source_record_uq": {
- "name": "external_object_mentions_company_source_record_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_record_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "property_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "canonical_identity_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"external_object_mentions\".\"source_record_id\" is not null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_object_mentions_company_source_null_record_uq": {
- "name": "external_object_mentions_company_source_null_record_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "document_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "property_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "canonical_identity_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"external_object_mentions\".\"source_record_id\" is null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "external_object_mentions_company_id_companies_id_fk": {
- "name": "external_object_mentions_company_id_companies_id_fk",
- "tableFrom": "external_object_mentions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "external_object_mentions_source_issue_id_issues_id_fk": {
- "name": "external_object_mentions_source_issue_id_issues_id_fk",
- "tableFrom": "external_object_mentions",
- "tableTo": "issues",
- "columnsFrom": [
- "source_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "external_object_mentions_object_id_external_objects_id_fk": {
- "name": "external_object_mentions_object_id_external_objects_id_fk",
- "tableFrom": "external_object_mentions",
- "tableTo": "external_objects",
- "columnsFrom": [
- "object_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "external_object_mentions_created_by_plugin_id_plugins_id_fk": {
- "name": "external_object_mentions_created_by_plugin_id_plugins_id_fk",
- "tableFrom": "external_object_mentions",
- "tableTo": "plugins",
- "columnsFrom": [
- "created_by_plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.external_objects": {
- "name": "external_objects",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "provider_key": {
- "name": "provider_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "object_type": {
- "name": "object_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "sanitized_canonical_url": {
- "name": "sanitized_canonical_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "canonical_identity_hash": {
- "name": "canonical_identity_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "display_key": {
- "name": "display_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "icon_key": {
- "name": "icon_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "display_title": {
- "name": "display_title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status_key": {
- "name": "status_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status_label": {
- "name": "status_label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status_icon_key": {
- "name": "status_icon_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status_category": {
- "name": "status_category",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "status_tone": {
- "name": "status_tone",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'neutral'"
- },
- "liveness": {
- "name": "liveness",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "is_terminal": {
- "name": "is_terminal",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "data": {
- "name": "data",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "remote_version": {
- "name": "remote_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "etag": {
- "name": "etag",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_resolved_at": {
- "name": "last_resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_changed_at": {
- "name": "last_changed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error_at": {
- "name": "last_error_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "next_refresh_at": {
- "name": "next_refresh_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_started_at": {
- "name": "refresh_started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_error_code": {
- "name": "last_error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_error_message": {
- "name": "last_error_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "external_objects_company_provider_object_idx": {
- "name": "external_objects_company_provider_object_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_objects_company_provider_status_idx": {
- "name": "external_objects_company_provider_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status_category",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_objects_company_refresh_idx": {
- "name": "external_objects_company_refresh_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_refresh_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_objects_company_external_id_uq": {
- "name": "external_objects_company_external_id_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "external_objects_company_identity_uq": {
- "name": "external_objects_company_identity_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "object_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "canonical_identity_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "external_objects_company_id_companies_id_fk": {
- "name": "external_objects_company_id_companies_id_fk",
- "tableFrom": "external_objects",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "external_objects_plugin_id_plugins_id_fk": {
- "name": "external_objects_plugin_id_plugins_id_fk",
- "tableFrom": "external_objects",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.feedback_exports": {
- "name": "feedback_exports",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "feedback_vote_id": {
- "name": "feedback_vote_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "vote": {
- "name": "vote",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_only'"
- },
- "destination": {
- "name": "destination",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "export_id": {
- "name": "export_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "consent_version": {
- "name": "consent_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "schema_version": {
- "name": "schema_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip-feedback-envelope-v2'"
- },
- "bundle_version": {
- "name": "bundle_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip-feedback-bundle-v2'"
- },
- "payload_version": {
- "name": "payload_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip-feedback-v1'"
- },
- "payload_digest": {
- "name": "payload_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "payload_snapshot": {
- "name": "payload_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "target_summary": {
- "name": "target_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "redaction_summary": {
- "name": "redaction_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "attempt_count": {
- "name": "attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_attempted_at": {
- "name": "last_attempted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "exported_at": {
- "name": "exported_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "feedback_exports_feedback_vote_idx": {
- "name": "feedback_exports_feedback_vote_idx",
- "columns": [
- {
- "expression": "feedback_vote_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_exports_company_created_idx": {
- "name": "feedback_exports_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_exports_company_status_idx": {
- "name": "feedback_exports_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_exports_company_issue_idx": {
- "name": "feedback_exports_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_exports_company_project_idx": {
- "name": "feedback_exports_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_exports_company_author_idx": {
- "name": "feedback_exports_company_author_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "author_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "feedback_exports_company_id_companies_id_fk": {
- "name": "feedback_exports_company_id_companies_id_fk",
- "tableFrom": "feedback_exports",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "feedback_exports_feedback_vote_id_feedback_votes_id_fk": {
- "name": "feedback_exports_feedback_vote_id_feedback_votes_id_fk",
- "tableFrom": "feedback_exports",
- "tableTo": "feedback_votes",
- "columnsFrom": [
- "feedback_vote_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "feedback_exports_issue_id_issues_id_fk": {
- "name": "feedback_exports_issue_id_issues_id_fk",
- "tableFrom": "feedback_exports",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "feedback_exports_project_id_projects_id_fk": {
- "name": "feedback_exports_project_id_projects_id_fk",
- "tableFrom": "feedback_exports",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.feedback_votes": {
- "name": "feedback_votes",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "vote": {
- "name": "vote",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "shared_with_labs": {
- "name": "shared_with_labs",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "shared_at": {
- "name": "shared_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "consent_version": {
- "name": "consent_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "redaction_summary": {
- "name": "redaction_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "feedback_votes_company_issue_idx": {
- "name": "feedback_votes_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_votes_issue_target_idx": {
- "name": "feedback_votes_issue_target_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_votes_author_idx": {
- "name": "feedback_votes_author_idx",
- "columns": [
- {
- "expression": "author_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "feedback_votes_company_target_author_idx": {
- "name": "feedback_votes_company_target_author_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "author_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "feedback_votes_company_id_companies_id_fk": {
- "name": "feedback_votes_company_id_companies_id_fk",
- "tableFrom": "feedback_votes",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "feedback_votes_issue_id_issues_id_fk": {
- "name": "feedback_votes_issue_id_issues_id_fk",
- "tableFrom": "feedback_votes",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.finance_events": {
- "name": "finance_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "cost_event_id": {
- "name": "cost_event_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "billing_code": {
- "name": "billing_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "event_kind": {
- "name": "event_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "direction": {
- "name": "direction",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'debit'"
- },
- "biller": {
- "name": "biller",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "execution_adapter_type": {
- "name": "execution_adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "pricing_tier": {
- "name": "pricing_tier",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "region": {
- "name": "region",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "model": {
- "name": "model",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "quantity": {
- "name": "quantity",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "unit": {
- "name": "unit",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "amount_cents": {
- "name": "amount_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "currency": {
- "name": "currency",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'USD'"
- },
- "estimated": {
- "name": "estimated",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "external_invoice_id": {
- "name": "external_invoice_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata_json": {
- "name": "metadata_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "occurred_at": {
- "name": "occurred_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "finance_events_company_occurred_idx": {
- "name": "finance_events_company_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "finance_events_company_biller_occurred_idx": {
- "name": "finance_events_company_biller_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "biller",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "finance_events_company_kind_occurred_idx": {
- "name": "finance_events_company_kind_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "event_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "finance_events_company_direction_occurred_idx": {
- "name": "finance_events_company_direction_occurred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "direction",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "occurred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "finance_events_company_heartbeat_run_idx": {
- "name": "finance_events_company_heartbeat_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "heartbeat_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "finance_events_company_cost_event_idx": {
- "name": "finance_events_company_cost_event_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "cost_event_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "finance_events_company_id_companies_id_fk": {
- "name": "finance_events_company_id_companies_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "finance_events_agent_id_agents_id_fk": {
- "name": "finance_events_agent_id_agents_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "finance_events_issue_id_issues_id_fk": {
- "name": "finance_events_issue_id_issues_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "finance_events_project_id_projects_id_fk": {
- "name": "finance_events_project_id_projects_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "finance_events_goal_id_goals_id_fk": {
- "name": "finance_events_goal_id_goals_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "finance_events_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "finance_events_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "finance_events_cost_event_id_cost_events_id_fk": {
- "name": "finance_events_cost_event_id_cost_events_id_fk",
- "tableFrom": "finance_events",
- "tableTo": "cost_events",
- "columnsFrom": [
- "cost_event_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.folders": {
- "name": "folders",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "parent_id": {
- "name": "parent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "system_key": {
- "name": "system_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "folders_company_kind_position_idx": {
- "name": "folders_company_kind_position_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "position",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "folders_company_kind_root_slug_uq": {
- "name": "folders_company_kind_root_slug_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"folders\".\"parent_id\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "folders_company_kind_parent_slug_uq": {
- "name": "folders_company_kind_parent_slug_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "parent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"folders\".\"parent_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "folders_company_kind_system_key_uq": {
- "name": "folders_company_kind_system_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "system_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"folders\".\"system_key\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "folders_company_kind_parent_position_idx": {
- "name": "folders_company_kind_parent_position_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "parent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "position",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "folders_company_id_companies_id_fk": {
- "name": "folders_company_id_companies_id_fk",
- "tableFrom": "folders",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "folders_parent_id_folders_id_fk": {
- "name": "folders_parent_id_folders_id_fk",
- "tableFrom": "folders",
- "tableTo": "folders",
- "columnsFrom": [
- "parent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.goals": {
- "name": "goals",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "level": {
- "name": "level",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'task'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'planned'"
- },
- "parent_id": {
- "name": "parent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "goals_company_idx": {
- "name": "goals_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "goals_company_id_companies_id_fk": {
- "name": "goals_company_id_companies_id_fk",
- "tableFrom": "goals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "goals_parent_id_goals_id_fk": {
- "name": "goals_parent_id_goals_id_fk",
- "tableFrom": "goals",
- "tableTo": "goals",
- "columnsFrom": [
- "parent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "goals_owner_agent_id_agents_id_fk": {
- "name": "goals_owner_agent_id_agents_id_fk",
- "tableFrom": "goals",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.heartbeat_run_events": {
- "name": "heartbeat_run_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "bigserial",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "seq": {
- "name": "seq",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "event_type": {
- "name": "event_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "stream": {
- "name": "stream",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "level": {
- "name": "level",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "message": {
- "name": "message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "source_instance_id": {
- "name": "source_instance_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_event_id": {
- "name": "source_event_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "source_seq": {
- "name": "source_seq",
- "type": "bigint",
- "primaryKey": false,
- "notNull": false
- },
- "source_payload_sha256": {
- "name": "source_payload_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "protocol_schema_version": {
- "name": "protocol_schema_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "heartbeat_run_events_run_seq_uq": {
- "name": "heartbeat_run_events_run_seq_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "seq",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_run_events_run_source_event_uq": {
- "name": "heartbeat_run_events_run_source_event_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_event_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"heartbeat_run_events\".\"source_event_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_run_events_run_source_seq_uq": {
- "name": "heartbeat_run_events_run_source_seq_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_instance_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_seq",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"heartbeat_run_events\".\"source_instance_id\" is not null and \"heartbeat_run_events\".\"source_seq\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_run_events_company_run_idx": {
- "name": "heartbeat_run_events_company_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_run_events_company_created_idx": {
- "name": "heartbeat_run_events_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "heartbeat_run_events_company_id_companies_id_fk": {
- "name": "heartbeat_run_events_company_id_companies_id_fk",
- "tableFrom": "heartbeat_run_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_run_events_run_id_heartbeat_runs_id_fk": {
- "name": "heartbeat_run_events_run_id_heartbeat_runs_id_fk",
- "tableFrom": "heartbeat_run_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_run_events_agent_id_agents_id_fk": {
- "name": "heartbeat_run_events_agent_id_agents_id_fk",
- "tableFrom": "heartbeat_run_events",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.heartbeat_run_watchdog_decisions": {
- "name": "heartbeat_run_watchdog_decisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "evaluation_issue_id": {
- "name": "evaluation_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "decision": {
- "name": "decision",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "snoozed_until": {
- "name": "snoozed_until",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "heartbeat_run_watchdog_decisions_company_run_created_idx": {
- "name": "heartbeat_run_watchdog_decisions_company_run_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_run_watchdog_decisions_company_run_snooze_idx": {
- "name": "heartbeat_run_watchdog_decisions_company_run_snooze_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "snoozed_until",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "heartbeat_run_watchdog_decisions_company_id_companies_id_fk": {
- "name": "heartbeat_run_watchdog_decisions_company_id_companies_id_fk",
- "tableFrom": "heartbeat_run_watchdog_decisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk": {
- "name": "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk",
- "tableFrom": "heartbeat_run_watchdog_decisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk": {
- "name": "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk",
- "tableFrom": "heartbeat_run_watchdog_decisions",
- "tableTo": "issues",
- "columnsFrom": [
- "evaluation_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk": {
- "name": "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk",
- "tableFrom": "heartbeat_run_watchdog_decisions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "heartbeat_run_watchdog_decisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.heartbeat_runs": {
- "name": "heartbeat_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "invocation_source": {
- "name": "invocation_source",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'on_demand'"
- },
- "trigger_detail": {
- "name": "trigger_detail",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'queued'"
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "active_identity_context_id": {
- "name": "active_identity_context_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "execution_control_deadline_at": {
- "name": "execution_control_deadline_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "execution_status_delivery_id": {
- "name": "execution_status_delivery_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "wakeup_request_id": {
- "name": "wakeup_request_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "exit_code": {
- "name": "exit_code",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "signal": {
- "name": "signal",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "usage_json": {
- "name": "usage_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "result_json": {
- "name": "result_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_mode": {
- "name": "runtime_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'legacy'"
- },
- "runtime_mode_resolver_version": {
- "name": "runtime_mode_resolver_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_mode_reason": {
- "name": "runtime_mode_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_mode_resolved_at": {
- "name": "runtime_mode_resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "runner_profile_json": {
- "name": "runner_profile_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "runner_instance_id": {
- "name": "runner_instance_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "native_session_id": {
- "name": "native_session_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "native_issue_id": {
- "name": "native_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "driver_kind": {
- "name": "driver_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "driver_version": {
- "name": "driver_version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "completion_contract_id": {
- "name": "completion_contract_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "completion_contract_sha256": {
- "name": "completion_contract_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "next_event_seq": {
- "name": "next_event_seq",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "native_phase": {
- "name": "native_phase",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "native_phase_updated_at": {
- "name": "native_phase_updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "session_id_before": {
- "name": "session_id_before",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "session_id_after": {
- "name": "session_id_after",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_store": {
- "name": "log_store",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_ref": {
- "name": "log_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_bytes": {
- "name": "log_bytes",
- "type": "bigint",
- "primaryKey": false,
- "notNull": false
- },
- "log_sha256": {
- "name": "log_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_compressed": {
- "name": "log_compressed",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "stdout_excerpt": {
- "name": "stdout_excerpt",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "stderr_excerpt": {
- "name": "stderr_excerpt",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "external_run_id": {
- "name": "external_run_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "controller_boot_id": {
- "name": "controller_boot_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "controller_lease_expires_at": {
- "name": "controller_lease_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "execution_stage": {
- "name": "execution_stage",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "process_pid": {
- "name": "process_pid",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "process_group_id": {
- "name": "process_group_id",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "process_started_at": {
- "name": "process_started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_output_at": {
- "name": "last_output_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_output_seq": {
- "name": "last_output_seq",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_output_stream": {
- "name": "last_output_stream",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_output_bytes": {
- "name": "last_output_bytes",
- "type": "bigint",
- "primaryKey": false,
- "notNull": false
- },
- "retry_of_run_id": {
- "name": "retry_of_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "process_loss_retry_count": {
- "name": "process_loss_retry_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "scheduled_retry_at": {
- "name": "scheduled_retry_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "scheduled_retry_attempt": {
- "name": "scheduled_retry_attempt",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "scheduled_retry_reason": {
- "name": "scheduled_retry_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "issue_comment_status": {
- "name": "issue_comment_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'not_applicable'"
- },
- "issue_comment_satisfied_by_comment_id": {
- "name": "issue_comment_satisfied_by_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_comment_retry_queued_at": {
- "name": "issue_comment_retry_queued_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "liveness_state": {
- "name": "liveness_state",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "liveness_reason": {
- "name": "liveness_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "continuation_attempt": {
- "name": "continuation_attempt",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_useful_action_at": {
- "name": "last_useful_action_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "next_action": {
- "name": "next_action",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "context_snapshot": {
- "name": "context_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "heartbeat_runs_execution_status_delivery_idx": {
- "name": "heartbeat_runs_execution_status_delivery_idx",
- "columns": [
- {
- "expression": "execution_status_delivery_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"heartbeat_runs\".\"execution_status_delivery_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_execution_control_deadline_idx": {
- "name": "heartbeat_runs_execution_control_deadline_idx",
- "columns": [
- {
- "expression": "execution_control_deadline_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"heartbeat_runs\".\"execution_control_deadline_at\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_native_replacement_predecessor_uq": {
- "name": "heartbeat_runs_native_replacement_predecessor_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "retry_of_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"heartbeat_runs\".\"scheduled_retry_reason\" = 'native_safe_replacement'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_agent_started_idx": {
- "name": "heartbeat_runs_company_agent_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_responsible_user_idx": {
- "name": "heartbeat_runs_company_responsible_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_liveness_idx": {
- "name": "heartbeat_runs_company_liveness_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "liveness_state",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_status_last_output_idx": {
- "name": "heartbeat_runs_company_status_last_output_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "last_output_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_status_process_started_idx": {
- "name": "heartbeat_runs_company_status_process_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "process_started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_created_at_desc_idx": {
- "name": "heartbeat_runs_company_created_at_desc_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": false,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_ctx_issue_created_idx": {
- "name": "heartbeat_runs_company_ctx_issue_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "(\"context_snapshot\" ->> 'issueId')",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": false,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_ctx_task_created_idx": {
- "name": "heartbeat_runs_company_ctx_task_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "(\"context_snapshot\" ->> 'taskId')",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": false,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "heartbeat_runs_company_ctx_taskkey_created_idx": {
- "name": "heartbeat_runs_company_ctx_taskkey_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "(\"context_snapshot\" ->> 'taskKey')",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": false,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "heartbeat_runs_company_id_companies_id_fk": {
- "name": "heartbeat_runs_company_id_companies_id_fk",
- "tableFrom": "heartbeat_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_runs_agent_id_agents_id_fk": {
- "name": "heartbeat_runs_agent_id_agents_id_fk",
- "tableFrom": "heartbeat_runs",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {
- "name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",
- "tableFrom": "heartbeat_runs",
- "tableTo": "agent_wakeup_requests",
- "columnsFrom": [
- "wakeup_request_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk": {
- "name": "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk",
- "tableFrom": "heartbeat_runs",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "retry_of_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "heartbeat_runs_company_native_issue_id_uq": {
- "name": "heartbeat_runs_company_native_issue_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "native_issue_id",
- "id"
- ]
- },
- "heartbeat_runs_company_native_issue_contract_id_uq": {
- "name": "heartbeat_runs_company_native_issue_contract_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "native_issue_id",
- "id",
- "completion_contract_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.inbox_dismissals": {
- "name": "inbox_dismissals",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "item_key": {
- "name": "item_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'dismiss'"
- },
- "dismissed_at": {
- "name": "dismissed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "snoozed_until": {
- "name": "snoozed_until",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "inbox_dismissals_company_user_idx": {
- "name": "inbox_dismissals_company_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "inbox_dismissals_company_item_idx": {
- "name": "inbox_dismissals_company_item_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "item_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "inbox_dismissals_company_user_item_idx": {
- "name": "inbox_dismissals_company_user_item_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "item_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "inbox_dismissals_company_id_companies_id_fk": {
- "name": "inbox_dismissals_company_id_companies_id_fk",
- "tableFrom": "inbox_dismissals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.connection_grant_delegations": {
- "name": "connection_grant_delegations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_grant_delegations_company_agent_idx": {
- "name": "connection_grant_delegations_company_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grant_delegations_grant_agent_uq": {
- "name": "connection_grant_delegations_grant_agent_uq",
- "columns": [
- {
- "expression": "grant_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_grant_delegations_company_id_companies_id_fk": {
- "name": "connection_grant_delegations_company_id_companies_id_fk",
- "tableFrom": "connection_grant_delegations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_grant_delegations_agent_id_agents_id_fk": {
- "name": "connection_grant_delegations_agent_id_agents_id_fk",
- "tableFrom": "connection_grant_delegations",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_grant_delegations_company_grant_fk": {
- "name": "connection_grant_delegations_company_grant_fk",
- "tableFrom": "connection_grant_delegations",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "company_id",
- "grant_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.connection_grant_members": {
- "name": "connection_grant_members",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "subject_type": {
- "name": "subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "subject_id": {
- "name": "subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_grant_members_company_subject_idx": {
- "name": "connection_grant_members_company_subject_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grant_members_grant_subject_uq": {
- "name": "connection_grant_members_grant_subject_uq",
- "columns": [
- {
- "expression": "grant_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_grant_members_company_id_companies_id_fk": {
- "name": "connection_grant_members_company_id_companies_id_fk",
- "tableFrom": "connection_grant_members",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_grant_members_company_grant_fk": {
- "name": "connection_grant_members_company_grant_fk",
- "tableFrom": "connection_grant_members",
- "tableTo": "connection_grants",
- "columnsFrom": [
- "company_id",
- "grant_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "connection_grant_members_subject_type_check": {
- "name": "connection_grant_members_subject_type_check",
- "value": "\"connection_grant_members\".\"subject_type\" in ('user')"
- }
- },
- "isRLSEnabled": false
- },
- "public.connection_grants": {
- "name": "connection_grants",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "subject_user_id": {
- "name": "subject_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "subject_agent_id": {
- "name": "subject_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_tenant": {
- "name": "provider_tenant",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "credential_secret_refs": {
- "name": "credential_secret_refs",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "external_credential": {
- "name": "external_credential",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "is_default": {
- "name": "is_default",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_by_agent_id": {
- "name": "revoked_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_by_user_id": {
- "name": "revoked_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_grants_company_connection_idx": {
- "name": "connection_grants_company_connection_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grants_subject_user_idx": {
- "name": "connection_grants_subject_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grants_subject_agent_idx": {
- "name": "connection_grants_subject_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grants_user_uq": {
- "name": "connection_grants_user_uq",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grants_agent_uq": {
- "name": "connection_grants_agent_uq",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_grants_default_uq": {
- "name": "connection_grants_default_uq",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"connection_grants\".\"is_default\" = true and \"connection_grants\".\"kind\" = 'organization'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_grants_company_id_companies_id_fk": {
- "name": "connection_grants_company_id_companies_id_fk",
- "tableFrom": "connection_grants",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_grants_subject_agent_id_agents_id_fk": {
- "name": "connection_grants_subject_agent_id_agents_id_fk",
- "tableFrom": "connection_grants",
- "tableTo": "agents",
- "columnsFrom": [
- "subject_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_grants_created_by_agent_id_agents_id_fk": {
- "name": "connection_grants_created_by_agent_id_agents_id_fk",
- "tableFrom": "connection_grants",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "connection_grants_revoked_by_agent_id_agents_id_fk": {
- "name": "connection_grants_revoked_by_agent_id_agents_id_fk",
- "tableFrom": "connection_grants",
- "tableTo": "agents",
- "columnsFrom": [
- "revoked_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "connection_grants_company_connection_fk": {
- "name": "connection_grants_company_connection_fk",
- "tableFrom": "connection_grants",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "company_id",
- "connection_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "connection_grants_company_id_uq": {
- "name": "connection_grants_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "connection_grants_kind_check": {
- "name": "connection_grants_kind_check",
- "value": "\"connection_grants\".\"kind\" in ('organization', 'user', 'agent')"
- },
- "connection_grants_status_check": {
- "name": "connection_grants_status_check",
- "value": "\"connection_grants\".\"status\" in ('active', 'revoked', 'expired', 'needs_reauthorization')"
- },
- "connection_grants_credential_source_one_of_check": {
- "name": "connection_grants_credential_source_one_of_check",
- "value": "\"connection_grants\".\"external_credential\" is null or jsonb_array_length(\"connection_grants\".\"credential_secret_refs\") = 0"
- },
- "connection_grants_subject_check": {
- "name": "connection_grants_subject_check",
- "value": "(\"connection_grants\".\"kind\" = 'user' and \"connection_grants\".\"subject_user_id\" is not null and \"connection_grants\".\"subject_agent_id\" is null) or (\"connection_grants\".\"kind\" = 'agent' and \"connection_grants\".\"subject_agent_id\" is not null and \"connection_grants\".\"subject_user_id\" is null) or (\"connection_grants\".\"kind\" = 'organization' and \"connection_grants\".\"subject_user_id\" is null and \"connection_grants\".\"subject_agent_id\" is null)"
- },
- "connection_grants_default_check": {
- "name": "connection_grants_default_check",
- "value": "\"connection_grants\".\"is_default\" = false or \"connection_grants\".\"kind\" = 'organization'"
- }
- },
- "isRLSEnabled": false
- },
- "public.connection_token_issuances": {
- "name": "connection_token_issuances",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "path": {
- "name": "path",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "requested_scope": {
- "name": "requested_scope",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "issued_scope": {
- "name": "issued_scope",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "ttl_seconds": {
- "name": "ttl_seconds",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "token_hash": {
- "name": "token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "connection_token_issuances_company_created_idx": {
- "name": "connection_token_issuances_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_token_issuances_connection_created_idx": {
- "name": "connection_token_issuances_connection_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_token_issuances_agent_connection_idx": {
- "name": "connection_token_issuances_agent_connection_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "connection_token_issuances_run_idx": {
- "name": "connection_token_issuances_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "connection_token_issuances_company_id_companies_id_fk": {
- "name": "connection_token_issuances_company_id_companies_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_token_issuances_application_id_tool_applications_id_fk": {
- "name": "connection_token_issuances_application_id_tool_applications_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "connection_token_issuances_connection_id_tool_connections_id_fk": {
- "name": "connection_token_issuances_connection_id_tool_connections_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_token_issuances_agent_id_agents_id_fk": {
- "name": "connection_token_issuances_agent_id_agents_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "connection_token_issuances_run_id_heartbeat_runs_id_fk": {
- "name": "connection_token_issuances_run_id_heartbeat_runs_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "connection_token_issuances_issue_id_issues_id_fk": {
- "name": "connection_token_issuances_issue_id_issues_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "connection_token_issuances_project_id_projects_id_fk": {
- "name": "connection_token_issuances_project_id_projects_id_fk",
- "tableFrom": "connection_token_issuances",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.instance_settings": {
- "name": "instance_settings",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "singleton_key": {
- "name": "singleton_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'default'"
- },
- "default_environment_id": {
- "name": "default_environment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "general": {
- "name": "general",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "experimental": {
- "name": "experimental",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "instance_settings_singleton_key_idx": {
- "name": "instance_settings_singleton_key_idx",
- "columns": [
- {
- "expression": "singleton_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "instance_settings_default_environment_id_environments_id_fk": {
- "name": "instance_settings_default_environment_id_environments_id_fk",
- "tableFrom": "instance_settings",
- "tableTo": "environments",
- "columnsFrom": [
- "default_environment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.instance_user_roles": {
- "name": "instance_user_roles",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'instance_admin'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "instance_user_roles_user_role_unique_idx": {
- "name": "instance_user_roles_user_role_unique_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "role",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "instance_user_roles_role_idx": {
- "name": "instance_user_roles_role_idx",
- "columns": [
- {
- "expression": "role",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.invites": {
- "name": "invites",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "invite_type": {
- "name": "invite_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'company_join'"
- },
- "token_hash": {
- "name": "token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "allowed_join_types": {
- "name": "allowed_join_types",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'both'"
- },
- "defaults_payload": {
- "name": "defaults_payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "invited_by_user_id": {
- "name": "invited_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "accepted_at": {
- "name": "accepted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "invites_token_hash_unique_idx": {
- "name": "invites_token_hash_unique_idx",
- "columns": [
- {
- "expression": "token_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "invites_company_invite_state_idx": {
- "name": "invites_company_invite_state_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "invite_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revoked_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "invites_company_id_companies_id_fk": {
- "name": "invites_company_id_companies_id_fk",
- "tableFrom": "invites",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_approvals": {
- "name": "issue_approvals",
- "schema": "",
- "columns": {
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "approval_id": {
- "name": "approval_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "linked_by_agent_id": {
- "name": "linked_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "linked_by_user_id": {
- "name": "linked_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_approvals_issue_idx": {
- "name": "issue_approvals_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_approvals_approval_idx": {
- "name": "issue_approvals_approval_idx",
- "columns": [
- {
- "expression": "approval_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_approvals_company_idx": {
- "name": "issue_approvals_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_approvals_company_id_companies_id_fk": {
- "name": "issue_approvals_company_id_companies_id_fk",
- "tableFrom": "issue_approvals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_approvals_issue_id_issues_id_fk": {
- "name": "issue_approvals_issue_id_issues_id_fk",
- "tableFrom": "issue_approvals",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_approvals_approval_id_approvals_id_fk": {
- "name": "issue_approvals_approval_id_approvals_id_fk",
- "tableFrom": "issue_approvals",
- "tableTo": "approvals",
- "columnsFrom": [
- "approval_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_approvals_linked_by_agent_id_agents_id_fk": {
- "name": "issue_approvals_linked_by_agent_id_agents_id_fk",
- "tableFrom": "issue_approvals",
- "tableTo": "agents",
- "columnsFrom": [
- "linked_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "issue_approvals_pk": {
- "name": "issue_approvals_pk",
- "columns": [
- "issue_id",
- "approval_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_attachments": {
- "name": "issue_attachments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "asset_id": {
- "name": "asset_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_comment_id": {
- "name": "issue_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "originating_run_id": {
- "name": "originating_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_attachments_company_issue_idx": {
- "name": "issue_attachments_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_attachments_issue_comment_idx": {
- "name": "issue_attachments_issue_comment_idx",
- "columns": [
- {
- "expression": "issue_comment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_attachments_originating_run_idx": {
- "name": "issue_attachments_originating_run_idx",
- "columns": [
- {
- "expression": "originating_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_attachments_asset_uq": {
- "name": "issue_attachments_asset_uq",
- "columns": [
- {
- "expression": "asset_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_attachments_company_id_companies_id_fk": {
- "name": "issue_attachments_company_id_companies_id_fk",
- "tableFrom": "issue_attachments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_attachments_issue_id_issues_id_fk": {
- "name": "issue_attachments_issue_id_issues_id_fk",
- "tableFrom": "issue_attachments",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_attachments_asset_id_assets_id_fk": {
- "name": "issue_attachments_asset_id_assets_id_fk",
- "tableFrom": "issue_attachments",
- "tableTo": "assets",
- "columnsFrom": [
- "asset_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_attachments_issue_comment_id_issue_comments_id_fk": {
- "name": "issue_attachments_issue_comment_id_issue_comments_id_fk",
- "tableFrom": "issue_attachments",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "issue_comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_attachments_originating_run_id_heartbeat_runs_id_fk": {
- "name": "issue_attachments_originating_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_attachments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "originating_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_comments": {
- "name": "issue_comments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "author_agent_id": {
- "name": "author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "author_user_id": {
- "name": "author_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "on_behalf_of_user_id": {
- "name": "on_behalf_of_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "author_type": {
- "name": "author_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "derived_author_agent_id": {
- "name": "derived_author_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "derived_created_by_run_id": {
- "name": "derived_created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "derived_author_source": {
- "name": "derived_author_source",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_request_id": {
- "name": "client_request_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "conversation_session_generation": {
- "name": "conversation_session_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "presentation": {
- "name": "presentation",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_by_type": {
- "name": "deleted_by_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_by_agent_id": {
- "name": "deleted_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_by_user_id": {
- "name": "deleted_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_by_run_id": {
- "name": "deleted_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_trust": {
- "name": "source_trust",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_comments_issue_idx": {
- "name": "issue_comments_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_comments_company_idx": {
- "name": "issue_comments_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_comments_company_issue_created_at_idx": {
- "name": "issue_comments_company_issue_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_comments_company_author_issue_created_at_idx": {
- "name": "issue_comments_company_author_issue_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "author_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_comments_body_search_idx": {
- "name": "issue_comments_body_search_idx",
- "columns": [
- {
- "expression": "body",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_comments_company_id_companies_id_fk": {
- "name": "issue_comments_company_id_companies_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_comments_issue_id_issues_id_fk": {
- "name": "issue_comments_issue_id_issues_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_comments_author_agent_id_agents_id_fk": {
- "name": "issue_comments_author_agent_id_agents_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_comments_on_behalf_of_user_id_user_id_fk": {
- "name": "issue_comments_on_behalf_of_user_id_user_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "user",
- "columnsFrom": [
- "on_behalf_of_user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_comments_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_comments_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_comments_derived_author_agent_id_agents_id_fk": {
- "name": "issue_comments_derived_author_agent_id_agents_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "derived_author_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "derived_created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_comments_deleted_by_agent_id_agents_id_fk": {
- "name": "issue_comments_deleted_by_agent_id_agents_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "agents",
- "columnsFrom": [
- "deleted_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_comments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "deleted_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "issue_comments_client_request_uq": {
- "name": "issue_comments_client_request_uq",
- "nullsNotDistinct": false,
- "columns": [
- "issue_id",
- "author_user_id",
- "client_request_id"
- ]
- },
- "issue_comments_company_id_uq": {
- "name": "issue_comments_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_create_idempotency_keys": {
- "name": "issue_create_idempotency_keys",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_create_idempotency_keys_company_key_uq": {
- "name": "issue_create_idempotency_keys_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_create_idempotency_keys_issue_idx": {
- "name": "issue_create_idempotency_keys_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_create_idempotency_keys_company_created_at_idx": {
- "name": "issue_create_idempotency_keys_company_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_create_idempotency_keys_company_id_companies_id_fk": {
- "name": "issue_create_idempotency_keys_company_id_companies_id_fk",
- "tableFrom": "issue_create_idempotency_keys",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_create_idempotency_keys_issue_id_issues_id_fk": {
- "name": "issue_create_idempotency_keys_issue_id_issues_id_fk",
- "tableFrom": "issue_create_idempotency_keys",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_documents": {
- "name": "issue_documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_documents_company_issue_key_uq": {
- "name": "issue_documents_company_issue_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_documents_document_uq": {
- "name": "issue_documents_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_documents_company_issue_updated_idx": {
- "name": "issue_documents_company_issue_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_documents_company_id_companies_id_fk": {
- "name": "issue_documents_company_id_companies_id_fk",
- "tableFrom": "issue_documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_documents_issue_id_issues_id_fk": {
- "name": "issue_documents_issue_id_issues_id_fk",
- "tableFrom": "issue_documents",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_documents_document_id_documents_id_fk": {
- "name": "issue_documents_document_id_documents_id_fk",
- "tableFrom": "issue_documents",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_execution_decisions": {
- "name": "issue_execution_decisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "stage_id": {
- "name": "stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "stage_type": {
- "name": "stage_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_agent_id": {
- "name": "actor_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "actor_user_id": {
- "name": "actor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "body": {
- "name": "body",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_execution_decisions_company_issue_idx": {
- "name": "issue_execution_decisions_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_execution_decisions_stage_idx": {
- "name": "issue_execution_decisions_stage_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_execution_decisions_company_id_companies_id_fk": {
- "name": "issue_execution_decisions_company_id_companies_id_fk",
- "tableFrom": "issue_execution_decisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_execution_decisions_issue_id_issues_id_fk": {
- "name": "issue_execution_decisions_issue_id_issues_id_fk",
- "tableFrom": "issue_execution_decisions",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_execution_decisions_actor_agent_id_agents_id_fk": {
- "name": "issue_execution_decisions_actor_agent_id_agents_id_fk",
- "tableFrom": "issue_execution_decisions",
- "tableTo": "agents",
- "columnsFrom": [
- "actor_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_execution_decisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_inbox_archives": {
- "name": "issue_inbox_archives",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "archived_by_actor_type": {
- "name": "archived_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'user'"
- },
- "archived_by_agent_id": {
- "name": "archived_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_run_id": {
- "name": "archived_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_inbox_archives_company_issue_idx": {
- "name": "issue_inbox_archives_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_inbox_archives_company_user_idx": {
- "name": "issue_inbox_archives_company_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_inbox_archives_company_issue_user_idx": {
- "name": "issue_inbox_archives_company_issue_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_inbox_archives_company_id_companies_id_fk": {
- "name": "issue_inbox_archives_company_id_companies_id_fk",
- "tableFrom": "issue_inbox_archives",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_inbox_archives_issue_id_issues_id_fk": {
- "name": "issue_inbox_archives_issue_id_issues_id_fk",
- "tableFrom": "issue_inbox_archives",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_inbox_archives_archived_by_agent_id_agents_id_fk": {
- "name": "issue_inbox_archives_archived_by_agent_id_agents_id_fk",
- "tableFrom": "issue_inbox_archives",
- "tableTo": "agents",
- "columnsFrom": [
- "archived_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_inbox_archives",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "archived_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "issue_inbox_archives_archived_by_actor_type_check": {
- "name": "issue_inbox_archives_archived_by_actor_type_check",
- "value": "\"issue_inbox_archives\".\"archived_by_actor_type\" in ('user', 'agent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.issue_labels": {
- "name": "issue_labels",
- "schema": "",
- "columns": {
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "label_id": {
- "name": "label_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_labels_issue_idx": {
- "name": "issue_labels_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_labels_label_idx": {
- "name": "issue_labels_label_idx",
- "columns": [
- {
- "expression": "label_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_labels_company_idx": {
- "name": "issue_labels_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_labels_issue_id_issues_id_fk": {
- "name": "issue_labels_issue_id_issues_id_fk",
- "tableFrom": "issue_labels",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_labels_label_id_labels_id_fk": {
- "name": "issue_labels_label_id_labels_id_fk",
- "tableFrom": "issue_labels",
- "tableTo": "labels",
- "columnsFrom": [
- "label_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_labels_company_id_companies_id_fk": {
- "name": "issue_labels_company_id_companies_id_fk",
- "tableFrom": "issue_labels",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "issue_labels_pk": {
- "name": "issue_labels_pk",
- "columns": [
- "issue_id",
- "label_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_plan_decompositions": {
- "name": "issue_plan_decompositions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_issue_id": {
- "name": "source_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "accepted_plan_revision_id": {
- "name": "accepted_plan_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "accepted_interaction_id": {
- "name": "accepted_interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'in_flight'"
- },
- "request_fingerprint": {
- "name": "request_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "requested_child_count": {
- "name": "requested_child_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "requested_children": {
- "name": "requested_children",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "child_issue_ids": {
- "name": "child_issue_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_user_id": {
- "name": "owner_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "owner_run_id": {
- "name": "owner_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_plan_decompositions_company_source_status_idx": {
- "name": "issue_plan_decompositions_company_source_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_plan_decompositions_active_owner_idx": {
- "name": "issue_plan_decompositions_active_owner_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"issue_plan_decompositions\".\"status\" = 'in_flight'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_plan_decompositions_source_revision_uq": {
- "name": "issue_plan_decompositions_source_revision_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "accepted_plan_revision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_plan_decompositions_company_id_companies_id_fk": {
- "name": "issue_plan_decompositions_company_id_companies_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_plan_decompositions_source_issue_id_issues_id_fk": {
- "name": "issue_plan_decompositions_source_issue_id_issues_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "issues",
- "columnsFrom": [
- "source_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk": {
- "name": "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "document_revisions",
- "columnsFrom": [
- "accepted_plan_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk": {
- "name": "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "accepted_interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_plan_decompositions_owner_agent_id_agents_id_fk": {
- "name": "issue_plan_decompositions_owner_agent_id_agents_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk": {
- "name": "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_plan_decompositions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "owner_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_question_response_deliveries": {
- "name": "issue_question_response_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_run_id": {
- "name": "source_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "target_run_id": {
- "name": "target_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "target_turn_id": {
- "name": "target_turn_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload_sha256": {
- "name": "payload_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "delivery_mode": {
- "name": "delivery_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "attempt_count": {
- "name": "attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "error_count": {
- "name": "error_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_attempt_at": {
- "name": "last_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "acknowledged_at": {
- "name": "acknowledged_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error_code": {
- "name": "last_error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_question_response_deliveries_interaction_uq": {
- "name": "issue_question_response_deliveries_interaction_uq",
- "columns": [
- {
- "expression": "interaction_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_question_response_deliveries_correlation_uq": {
- "name": "issue_question_response_deliveries_correlation_uq",
- "columns": [
- {
- "expression": "correlation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_question_response_deliveries_pending_idx": {
- "name": "issue_question_response_deliveries_pending_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_question_response_deliveries_company_issue_idx": {
- "name": "issue_question_response_deliveries_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_question_response_deliveries_company_id_companies_id_fk": {
- "name": "issue_question_response_deliveries_company_id_companies_id_fk",
- "tableFrom": "issue_question_response_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_question_response_deliveries_issue_id_issues_id_fk": {
- "name": "issue_question_response_deliveries_issue_id_issues_id_fk",
- "tableFrom": "issue_question_response_deliveries",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk": {
- "name": "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "issue_question_response_deliveries",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk": {
- "name": "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_question_response_deliveries",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "source_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk": {
- "name": "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_question_response_deliveries",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "target_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "issue_question_response_deliveries_status_check": {
- "name": "issue_question_response_deliveries_status_check",
- "value": "\"issue_question_response_deliveries\".\"status\" IN ('pending', 'delivering', 'delivered', 'fallback_queued', 'failed')"
- },
- "issue_question_response_deliveries_mode_check": {
- "name": "issue_question_response_deliveries_mode_check",
- "value": "\"issue_question_response_deliveries\".\"delivery_mode\" IS NULL OR \"issue_question_response_deliveries\".\"delivery_mode\" IN ('steered', 'coalesced', 'wake_fallback')"
- }
- },
- "isRLSEnabled": false
- },
- "public.issue_read_states": {
- "name": "issue_read_states",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "last_read_at": {
- "name": "last_read_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_read_states_company_issue_idx": {
- "name": "issue_read_states_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_read_states_company_user_idx": {
- "name": "issue_read_states_company_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_read_states_company_issue_user_idx": {
- "name": "issue_read_states_company_issue_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_read_states_company_id_companies_id_fk": {
- "name": "issue_read_states_company_id_companies_id_fk",
- "tableFrom": "issue_read_states",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_read_states_issue_id_issues_id_fk": {
- "name": "issue_read_states_issue_id_issues_id_fk",
- "tableFrom": "issue_read_states",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_recovery_actions": {
- "name": "issue_recovery_actions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_issue_id": {
- "name": "source_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "recovery_issue_id": {
- "name": "recovery_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "owner_type": {
- "name": "owner_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'agent'"
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_user_id": {
- "name": "owner_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "previous_owner_agent_id": {
- "name": "previous_owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "return_owner_agent_id": {
- "name": "return_owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "cause": {
- "name": "cause",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "fingerprint": {
- "name": "fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "evidence": {
- "name": "evidence",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "next_action": {
- "name": "next_action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "wake_policy": {
- "name": "wake_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_policy": {
- "name": "monitor_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "attempt_count": {
- "name": "attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "max_attempts": {
- "name": "max_attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "timeout_at": {
- "name": "timeout_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_attempt_at": {
- "name": "last_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolution_note": {
- "name": "resolution_note",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_recovery_actions_company_source_status_idx": {
- "name": "issue_recovery_actions_company_source_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_recovery_actions_company_owner_status_idx": {
- "name": "issue_recovery_actions_company_owner_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "owner_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_recovery_actions_company_recovery_issue_idx": {
- "name": "issue_recovery_actions_company_recovery_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "recovery_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_recovery_actions_active_source_uq": {
- "name": "issue_recovery_actions_active_source_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_recovery_actions_active_fingerprint_uq": {
- "name": "issue_recovery_actions_active_fingerprint_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "cause",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "fingerprint",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_recovery_actions_company_id_companies_id_fk": {
- "name": "issue_recovery_actions_company_id_companies_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_recovery_actions_source_issue_id_issues_id_fk": {
- "name": "issue_recovery_actions_source_issue_id_issues_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "issues",
- "columnsFrom": [
- "source_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_recovery_actions_recovery_issue_id_issues_id_fk": {
- "name": "issue_recovery_actions_recovery_issue_id_issues_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "issues",
- "columnsFrom": [
- "recovery_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_recovery_actions_owner_agent_id_agents_id_fk": {
- "name": "issue_recovery_actions_owner_agent_id_agents_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_recovery_actions_previous_owner_agent_id_agents_id_fk": {
- "name": "issue_recovery_actions_previous_owner_agent_id_agents_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "agents",
- "columnsFrom": [
- "previous_owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_recovery_actions_return_owner_agent_id_agents_id_fk": {
- "name": "issue_recovery_actions_return_owner_agent_id_agents_id_fk",
- "tableFrom": "issue_recovery_actions",
- "tableTo": "agents",
- "columnsFrom": [
- "return_owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_reference_mentions": {
- "name": "issue_reference_mentions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_issue_id": {
- "name": "source_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_issue_id": {
- "name": "target_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "source_kind": {
- "name": "source_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_record_id": {
- "name": "source_record_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "document_key": {
- "name": "document_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "matched_text": {
- "name": "matched_text",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_reference_mentions_company_source_issue_idx": {
- "name": "issue_reference_mentions_company_source_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_reference_mentions_company_target_issue_idx": {
- "name": "issue_reference_mentions_company_target_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_reference_mentions_company_issue_pair_idx": {
- "name": "issue_reference_mentions_company_issue_pair_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_reference_mentions_company_source_mention_record_uq": {
- "name": "issue_reference_mentions_company_source_mention_record_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_record_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_reference_mentions\".\"source_record_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_reference_mentions_company_source_mention_null_record_uq": {
- "name": "issue_reference_mentions_company_source_mention_null_record_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_reference_mentions\".\"source_record_id\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_reference_mentions_company_id_companies_id_fk": {
- "name": "issue_reference_mentions_company_id_companies_id_fk",
- "tableFrom": "issue_reference_mentions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_reference_mentions_source_issue_id_issues_id_fk": {
- "name": "issue_reference_mentions_source_issue_id_issues_id_fk",
- "tableFrom": "issue_reference_mentions",
- "tableTo": "issues",
- "columnsFrom": [
- "source_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_reference_mentions_target_issue_id_issues_id_fk": {
- "name": "issue_reference_mentions_target_issue_id_issues_id_fk",
- "tableFrom": "issue_reference_mentions",
- "tableTo": "issues",
- "columnsFrom": [
- "target_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_relations": {
- "name": "issue_relations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "related_issue_id": {
- "name": "related_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_relations_company_issue_idx": {
- "name": "issue_relations_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_relations_company_related_issue_idx": {
- "name": "issue_relations_company_related_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "related_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_relations_company_type_idx": {
- "name": "issue_relations_company_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_relations_company_edge_uq": {
- "name": "issue_relations_company_edge_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "related_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_relations_company_id_companies_id_fk": {
- "name": "issue_relations_company_id_companies_id_fk",
- "tableFrom": "issue_relations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_relations_issue_id_issues_id_fk": {
- "name": "issue_relations_issue_id_issues_id_fk",
- "tableFrom": "issue_relations",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_relations_related_issue_id_issues_id_fk": {
- "name": "issue_relations_related_issue_id_issues_id_fk",
- "tableFrom": "issue_relations",
- "tableTo": "issues",
- "columnsFrom": [
- "related_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_relations_created_by_agent_id_agents_id_fk": {
- "name": "issue_relations_created_by_agent_id_agents_id_fk",
- "tableFrom": "issue_relations",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_thread_interactions": {
- "name": "issue_thread_interactions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "continuation_policy": {
- "name": "continuation_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'wake_assignee'"
- },
- "requested_resolver_policy": {
- "name": "requested_resolver_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'anyone'"
- },
- "effective_resolver_policy": {
- "name": "effective_resolver_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'anyone'"
- },
- "resolver_policy_provenance": {
- "name": "resolver_policy_provenance",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'inherited'"
- },
- "effective_resolver_policy_source": {
- "name": "effective_resolver_policy_source",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'requested'"
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "origin_comment_ids": {
- "name": "origin_comment_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "source_comment_id": {
- "name": "source_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_identity_context_id": {
- "name": "source_identity_context_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_run_id": {
- "name": "source_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "summary": {
- "name": "summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "addressee_agent_id": {
- "name": "addressee_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "addressee_user_id": {
- "name": "addressee_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_agent_id": {
- "name": "resolved_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_run_id": {
- "name": "resolved_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_user_id": {
- "name": "resolved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "result": {
- "name": "result",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_thread_interactions_issue_idx": {
- "name": "issue_thread_interactions_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_company_issue_created_at_idx": {
- "name": "issue_thread_interactions_company_issue_created_at_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_company_issue_status_idx": {
- "name": "issue_thread_interactions_company_issue_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_company_issue_idempotency_uq": {
- "name": "issue_thread_interactions_company_issue_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_thread_interactions\".\"idempotency_key\" IS NOT NULL",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_source_comment_idx": {
- "name": "issue_thread_interactions_source_comment_idx",
- "columns": [
- {
- "expression": "source_comment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_addressee_agent_idx": {
- "name": "issue_thread_interactions_addressee_agent_idx",
- "columns": [
- {
- "expression": "addressee_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_thread_interactions_addressee_user_idx": {
- "name": "issue_thread_interactions_addressee_user_idx",
- "columns": [
- {
- "expression": "addressee_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_thread_interactions_company_id_companies_id_fk": {
- "name": "issue_thread_interactions_company_id_companies_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_issue_id_issues_id_fk": {
- "name": "issue_thread_interactions_issue_id_issues_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_source_comment_id_issue_comments_id_fk": {
- "name": "issue_thread_interactions_source_comment_id_issue_comments_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "issue_comments",
- "columnsFrom": [
- "source_comment_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk": {
- "name": "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "source_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_created_by_agent_id_agents_id_fk": {
- "name": "issue_thread_interactions_created_by_agent_id_agents_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_addressee_agent_id_agents_id_fk": {
- "name": "issue_thread_interactions_addressee_agent_id_agents_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "agents",
- "columnsFrom": [
- "addressee_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_resolved_by_agent_id_agents_id_fk": {
- "name": "issue_thread_interactions_resolved_by_agent_id_agents_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "agents",
- "columnsFrom": [
- "resolved_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_thread_interactions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "resolved_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_tree_hold_members": {
- "name": "issue_tree_hold_members",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "hold_id": {
- "name": "hold_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "parent_issue_id": {
- "name": "parent_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "depth": {
- "name": "depth",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "issue_identifier": {
- "name": "issue_identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "issue_title": {
- "name": "issue_title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "issue_status": {
- "name": "issue_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "assignee_agent_id": {
- "name": "assignee_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "assignee_user_id": {
- "name": "assignee_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "active_run_id": {
- "name": "active_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "active_run_status": {
- "name": "active_run_status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "skipped": {
- "name": "skipped",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "skip_reason": {
- "name": "skip_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_tree_hold_members_hold_issue_uq": {
- "name": "issue_tree_hold_members_hold_issue_uq",
- "columns": [
- {
- "expression": "hold_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_tree_hold_members_company_issue_idx": {
- "name": "issue_tree_hold_members_company_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_tree_hold_members_hold_depth_idx": {
- "name": "issue_tree_hold_members_hold_depth_idx",
- "columns": [
- {
- "expression": "hold_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "depth",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_tree_hold_members_company_id_companies_id_fk": {
- "name": "issue_tree_hold_members_company_id_companies_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk": {
- "name": "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "issue_tree_holds",
- "columnsFrom": [
- "hold_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_tree_hold_members_issue_id_issues_id_fk": {
- "name": "issue_tree_hold_members_issue_id_issues_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_tree_hold_members_parent_issue_id_issues_id_fk": {
- "name": "issue_tree_hold_members_parent_issue_id_issues_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "issues",
- "columnsFrom": [
- "parent_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_tree_hold_members_assignee_agent_id_agents_id_fk": {
- "name": "issue_tree_hold_members_assignee_agent_id_agents_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "agents",
- "columnsFrom": [
- "assignee_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk": {
- "name": "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_tree_hold_members",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "active_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_tree_holds": {
- "name": "issue_tree_holds",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "root_issue_id": {
- "name": "root_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "mode": {
- "name": "mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "release_policy": {
- "name": "release_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_actor_type": {
- "name": "created_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'system'"
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "released_at": {
- "name": "released_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "released_by_actor_type": {
- "name": "released_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "released_by_agent_id": {
- "name": "released_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "released_by_user_id": {
- "name": "released_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "released_by_run_id": {
- "name": "released_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "release_reason": {
- "name": "release_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "release_metadata": {
- "name": "release_metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_tree_holds_company_root_status_idx": {
- "name": "issue_tree_holds_company_root_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "root_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_tree_holds_company_status_mode_idx": {
- "name": "issue_tree_holds_company_status_mode_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "mode",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_tree_holds_company_id_companies_id_fk": {
- "name": "issue_tree_holds_company_id_companies_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_tree_holds_root_issue_id_issues_id_fk": {
- "name": "issue_tree_holds_root_issue_id_issues_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "issues",
- "columnsFrom": [
- "root_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_tree_holds_created_by_agent_id_agents_id_fk": {
- "name": "issue_tree_holds_created_by_agent_id_agents_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_tree_holds_released_by_agent_id_agents_id_fk": {
- "name": "issue_tree_holds_released_by_agent_id_agents_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "agents",
- "columnsFrom": [
- "released_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_tree_holds",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "released_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_watchdogs": {
- "name": "issue_watchdogs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "watchdog_agent_id": {
- "name": "watchdog_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "instructions": {
- "name": "instructions",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "watchdog_issue_id": {
- "name": "watchdog_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_observed_fingerprint": {
- "name": "last_observed_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_reviewed_fingerprint": {
- "name": "last_reviewed_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_observed_stop_snapshot": {
- "name": "last_observed_stop_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "last_reviewed_stop_snapshot": {
- "name": "last_reviewed_stop_snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "last_triggered_at": {
- "name": "last_triggered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_completed_at": {
- "name": "last_completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "trigger_count": {
- "name": "trigger_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_run_id": {
- "name": "updated_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_watchdogs_company_issue_uq": {
- "name": "issue_watchdogs_company_issue_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_watchdogs_company_status_idx": {
- "name": "issue_watchdogs_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_watchdogs_company_agent_idx": {
- "name": "issue_watchdogs_company_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "watchdog_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_watchdogs_company_watchdog_issue_uq": {
- "name": "issue_watchdogs_company_watchdog_issue_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "watchdog_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issue_watchdogs\".\"watchdog_issue_id\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_watchdogs_company_id_companies_id_fk": {
- "name": "issue_watchdogs_company_id_companies_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_watchdogs_issue_id_issues_id_fk": {
- "name": "issue_watchdogs_issue_id_issues_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_watchdogs_watchdog_agent_id_agents_id_fk": {
- "name": "issue_watchdogs_watchdog_agent_id_agents_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "agents",
- "columnsFrom": [
- "watchdog_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_watchdogs_watchdog_issue_id_issues_id_fk": {
- "name": "issue_watchdogs_watchdog_issue_id_issues_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "issues",
- "columnsFrom": [
- "watchdog_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_watchdogs_created_by_agent_id_agents_id_fk": {
- "name": "issue_watchdogs_created_by_agent_id_agents_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_watchdogs_updated_by_agent_id_agents_id_fk": {
- "name": "issue_watchdogs_updated_by_agent_id_agents_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_watchdogs",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "updated_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issue_work_products": {
- "name": "issue_work_products",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_service_id": {
- "name": "runtime_service_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "url": {
- "name": "url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "review_state": {
- "name": "review_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'none'"
- },
- "is_primary": {
- "name": "is_primary",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "health_status": {
- "name": "health_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "summary": {
- "name": "summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "source_trust": {
- "name": "source_trust",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issue_work_products_company_issue_type_idx": {
- "name": "issue_work_products_company_issue_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_work_products_company_execution_workspace_type_idx": {
- "name": "issue_work_products_company_execution_workspace_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_work_products_company_provider_external_id_idx": {
- "name": "issue_work_products_company_provider_external_id_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "external_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issue_work_products_company_updated_idx": {
- "name": "issue_work_products_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issue_work_products_company_id_companies_id_fk": {
- "name": "issue_work_products_company_id_companies_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issue_work_products_project_id_projects_id_fk": {
- "name": "issue_work_products_project_id_projects_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_work_products_issue_id_issues_id_fk": {
- "name": "issue_work_products_issue_id_issues_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "issue_work_products_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "issue_work_products_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk": {
- "name": "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "workspace_runtime_services",
- "columnsFrom": [
- "runtime_service_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issue_work_products_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "issue_work_products_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issue_work_products",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.issues": {
- "name": "issues",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "conversation_agent_id": {
- "name": "conversation_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "conversation_user_id": {
- "name": "conversation_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "conversation_state": {
- "name": "conversation_state",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "conversation_session_generation": {
- "name": "conversation_session_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "conversation_boundary_comment_id": {
- "name": "conversation_boundary_comment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_workspace_id": {
- "name": "project_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "parent_id": {
- "name": "parent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title_needs_generation": {
- "name": "title_needs_generation",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'backlog'"
- },
- "status_version": {
- "name": "status_version",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_status_decision_id": {
- "name": "last_status_decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "work_mode": {
- "name": "work_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'standard'"
- },
- "harness_kind": {
- "name": "harness_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "priority": {
- "name": "priority",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'medium'"
- },
- "review_policy": {
- "name": "review_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "assignee_agent_id": {
- "name": "assignee_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "assignee_user_id": {
- "name": "assignee_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "checkout_run_id": {
- "name": "checkout_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_run_id": {
- "name": "execution_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_agent_name_key": {
- "name": "execution_agent_name_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "execution_locked_at": {
- "name": "execution_locked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "issue_number": {
- "name": "issue_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "origin_kind": {
- "name": "origin_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'manual'"
- },
- "origin_id": {
- "name": "origin_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "origin_run_id": {
- "name": "origin_run_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "origin_identity_context_id": {
- "name": "origin_identity_context_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "continuation_identity_context_id": {
- "name": "continuation_identity_context_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "origin_fingerprint": {
- "name": "origin_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'default'"
- },
- "request_depth": {
- "name": "request_depth",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "billing_code": {
- "name": "billing_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "assignee_adapter_overrides": {
- "name": "assignee_adapter_overrides",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "execution_policy": {
- "name": "execution_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "execution_state": {
- "name": "execution_state",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_next_check_at": {
- "name": "monitor_next_check_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_wake_requested_at": {
- "name": "monitor_wake_requested_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_last_triggered_at": {
- "name": "monitor_last_triggered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_attempt_count": {
- "name": "monitor_attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "monitor_notes": {
- "name": "monitor_notes",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "monitor_scheduled_by": {
- "name": "monitor_scheduled_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_preference": {
- "name": "execution_workspace_preference",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_settings": {
- "name": "execution_workspace_settings",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "source_trust": {
- "name": "source_trust",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "unblock_descriptor": {
- "name": "unblock_descriptor",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "blocked_transition_at": {
- "name": "blocked_transition_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "blocked_owner_notified_at": {
- "name": "blocked_owner_notified_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "cancelled_at": {
- "name": "cancelled_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "hidden_at": {
- "name": "hidden_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "issues_conversation_identity_idx": {
- "name": "issues_conversation_identity_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "conversation_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "conversation_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_status_idx": {
- "name": "issues_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_harness_kind_idx": {
- "name": "issues_company_harness_kind_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "harness_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_assignee_status_idx": {
- "name": "issues_company_assignee_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "assignee_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_assignee_user_status_idx": {
- "name": "issues_company_assignee_user_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "assignee_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_responsible_user_idx": {
- "name": "issues_company_responsible_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_parent_idx": {
- "name": "issues_company_parent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "parent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_project_idx": {
- "name": "issues_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_origin_idx": {
- "name": "issues_company_origin_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_project_workspace_idx": {
- "name": "issues_company_project_workspace_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_execution_workspace_idx": {
- "name": "issues_company_execution_workspace_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_monitor_due_idx": {
- "name": "issues_company_monitor_due_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "monitor_next_check_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_updated_idx": {
- "name": "issues_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_created_idx": {
- "name": "issues_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_open_normalized_title_created_idx": {
- "name": "issues_open_normalized_title_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "parent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "lower(regexp_replace(btrim(\"title\"), '\\s+', ' ', 'g'))",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"issues\".\"hidden_at\" is null and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_company_priority_idx": {
- "name": "issues_company_priority_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "priority",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_identifier_idx": {
- "name": "issues_identifier_idx",
- "columns": [
- {
- "expression": "identifier",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_title_search_idx": {
- "name": "issues_title_search_idx",
- "columns": [
- {
- "expression": "title",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "issues_identifier_search_idx": {
- "name": "issues_identifier_search_idx",
- "columns": [
- {
- "expression": "identifier",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "issues_description_search_idx": {
- "name": "issues_description_search_idx",
- "columns": [
- {
- "expression": "description",
- "isExpression": false,
- "asc": true,
- "nulls": "last",
- "opclass": "gin_trgm_ops"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- },
- "issues_open_routine_execution_uq": {
- "name": "issues_open_routine_execution_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_fingerprint",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'routine_execution'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"execution_run_id\" is not null\n and \"issues\".\"status\" in ('backlog', 'todo', 'in_progress', 'in_review', 'blocked')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_liveness_recovery_incident_uq": {
- "name": "issues_active_liveness_recovery_incident_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_liveness_recovery_leaf_uq": {
- "name": "issues_active_liveness_recovery_leaf_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_fingerprint",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_fingerprint\" <> 'default'\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_stale_run_evaluation_uq": {
- "name": "issues_active_stale_run_evaluation_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'stale_active_run_evaluation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_task_watchdog_uq": {
- "name": "issues_active_task_watchdog_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'task_watchdog'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_productivity_review_uq": {
- "name": "issues_active_productivity_review_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'issue_productivity_review'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_active_stranded_issue_recovery_uq": {
- "name": "issues_active_stranded_issue_recovery_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'stranded_issue_recovery'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "issues_onboarding_first_task_uq": {
- "name": "issues_onboarding_first_task_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"issues\".\"origin_kind\" = 'onboarding_first_task'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "issues_company_id_companies_id_fk": {
- "name": "issues_company_id_companies_id_fk",
- "tableFrom": "issues",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_conversation_agent_id_agents_id_fk": {
- "name": "issues_conversation_agent_id_agents_id_fk",
- "tableFrom": "issues",
- "tableTo": "agents",
- "columnsFrom": [
- "conversation_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_project_id_projects_id_fk": {
- "name": "issues_project_id_projects_id_fk",
- "tableFrom": "issues",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_project_workspace_id_project_workspaces_id_fk": {
- "name": "issues_project_workspace_id_project_workspaces_id_fk",
- "tableFrom": "issues",
- "tableTo": "project_workspaces",
- "columnsFrom": [
- "project_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issues_goal_id_goals_id_fk": {
- "name": "issues_goal_id_goals_id_fk",
- "tableFrom": "issues",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_parent_id_issues_id_fk": {
- "name": "issues_parent_id_issues_id_fk",
- "tableFrom": "issues",
- "tableTo": "issues",
- "columnsFrom": [
- "parent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_assignee_agent_id_agents_id_fk": {
- "name": "issues_assignee_agent_id_agents_id_fk",
- "tableFrom": "issues",
- "tableTo": "agents",
- "columnsFrom": [
- "assignee_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_checkout_run_id_heartbeat_runs_id_fk": {
- "name": "issues_checkout_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issues",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "checkout_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issues_execution_run_id_heartbeat_runs_id_fk": {
- "name": "issues_execution_run_id_heartbeat_runs_id_fk",
- "tableFrom": "issues",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "execution_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "issues_created_by_agent_id_agents_id_fk": {
- "name": "issues_created_by_agent_id_agents_id_fk",
- "tableFrom": "issues",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "issues_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "issues_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "issues",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "issues_company_id_uq": {
- "name": "issues_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "issues_conversation_identity_check": {
- "name": "issues_conversation_identity_check",
- "value": "(\n \"issues\".\"conversation_agent_id\" is null and \"issues\".\"conversation_user_id\" is null and \"issues\".\"conversation_state\" is null\n ) or (\n \"issues\".\"conversation_agent_id\" is not null and \"issues\".\"conversation_user_id\" is not null\n and \"issues\".\"assignee_agent_id\" = \"issues\".\"conversation_agent_id\" and \"issues\".\"assignee_agent_id\" is not null\n and \"issues\".\"assignee_user_id\" is null and \"issues\".\"conversation_state\" is not null\n and \"issues\".\"conversation_state\" in ('active', 'waiting')\n and \"issues\".\"status\" not in ('done', 'cancelled')\n )"
- }
- },
- "isRLSEnabled": false
- },
- "public.join_requests": {
- "name": "join_requests",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "invite_id": {
- "name": "invite_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "request_type": {
- "name": "request_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending_approval'"
- },
- "request_ip": {
- "name": "request_ip",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "requesting_user_id": {
- "name": "requesting_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "request_email_snapshot": {
- "name": "request_email_snapshot",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_name": {
- "name": "agent_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "adapter_type": {
- "name": "adapter_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "capabilities": {
- "name": "capabilities",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_defaults_payload": {
- "name": "agent_defaults_payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "claim_secret_hash": {
- "name": "claim_secret_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "claim_secret_expires_at": {
- "name": "claim_secret_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "claim_secret_consumed_at": {
- "name": "claim_secret_consumed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_agent_id": {
- "name": "created_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "approved_by_user_id": {
- "name": "approved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "approved_at": {
- "name": "approved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "rejected_by_user_id": {
- "name": "rejected_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "rejected_at": {
- "name": "rejected_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "join_requests_invite_unique_idx": {
- "name": "join_requests_invite_unique_idx",
- "columns": [
- {
- "expression": "invite_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "join_requests_company_status_type_created_idx": {
- "name": "join_requests_company_status_type_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "request_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "join_requests_pending_human_user_uq": {
- "name": "join_requests_pending_human_user_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "requesting_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"requesting_user_id\" IS NOT NULL",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "join_requests_pending_human_email_uq": {
- "name": "join_requests_pending_human_email_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "lower(\"request_email_snapshot\")",
- "asc": true,
- "isExpression": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"request_email_snapshot\" IS NOT NULL",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "join_requests_invite_id_invites_id_fk": {
- "name": "join_requests_invite_id_invites_id_fk",
- "tableFrom": "join_requests",
- "tableTo": "invites",
- "columnsFrom": [
- "invite_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "join_requests_company_id_companies_id_fk": {
- "name": "join_requests_company_id_companies_id_fk",
- "tableFrom": "join_requests",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "join_requests_created_agent_id_agents_id_fk": {
- "name": "join_requests_created_agent_id_agents_id_fk",
- "tableFrom": "join_requests",
- "tableTo": "agents",
- "columnsFrom": [
- "created_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.labels": {
- "name": "labels",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "labels_company_idx": {
- "name": "labels_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "labels_company_name_idx": {
- "name": "labels_company_name_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "labels_company_id_companies_id_fk": {
- "name": "labels_company_id_companies_id_fk",
- "tableFrom": "labels",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.managed_agent_profiles": {
- "name": "managed_agent_profiles",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "profile_key": {
- "name": "profile_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "display_name": {
- "name": "display_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "service": {
- "name": "service",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'anthropic_managed_agents'"
- },
- "anthropic_agent_id": {
- "name": "anthropic_agent_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "agent_version": {
- "name": "agent_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "environment_id": {
- "name": "environment_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "beta_version": {
- "name": "beta_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'managed-agents-2026-04-01'"
- },
- "default_model": {
- "name": "default_model",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'claude-sonnet-5'"
- },
- "default_max_list_cost_cents": {
- "name": "default_max_list_cost_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 100
- },
- "api_key_secret_id": {
- "name": "api_key_secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "retention_acknowledged": {
- "name": "retention_acknowledged",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "qualification": {
- "name": "qualification",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "qualified_at": {
- "name": "qualified_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "qualified_revision": {
- "name": "qualified_revision",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "managed_agent_profiles_company_idx": {
- "name": "managed_agent_profiles_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "managed_agent_profiles_company_key_uq": {
- "name": "managed_agent_profiles_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "managed_agent_profiles_company_resource_uq": {
- "name": "managed_agent_profiles_company_resource_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "anthropic_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_version",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "environment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "managed_agent_profiles_company_id_companies_id_fk": {
- "name": "managed_agent_profiles_company_id_companies_id_fk",
- "tableFrom": "managed_agent_profiles",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "managed_agent_profiles_api_key_secret_id_company_secrets_id_fk": {
- "name": "managed_agent_profiles_api_key_secret_id_company_secrets_id_fk",
- "tableFrom": "managed_agent_profiles",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "api_key_secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "managed_agent_profiles_service_check": {
- "name": "managed_agent_profiles_service_check",
- "value": "\"managed_agent_profiles\".\"service\" = 'anthropic_managed_agents'"
- },
- "managed_agent_profiles_beta_check": {
- "name": "managed_agent_profiles_beta_check",
- "value": "\"managed_agent_profiles\".\"beta_version\" = 'managed-agents-2026-04-01'"
- },
- "managed_agent_profiles_positive_budget_check": {
- "name": "managed_agent_profiles_positive_budget_check",
- "value": "\"managed_agent_profiles\".\"default_max_list_cost_cents\" > 0"
- },
- "managed_agent_profiles_qualified_revision_check": {
- "name": "managed_agent_profiles_qualified_revision_check",
- "value": "(\"managed_agent_profiles\".\"qualified_at\" IS NULL AND \"managed_agent_profiles\".\"qualified_revision\" IS NULL) OR (\"managed_agent_profiles\".\"qualified_at\" IS NOT NULL AND \"managed_agent_profiles\".\"qualification\" <> '{}'::jsonb AND \"managed_agent_profiles\".\"qualified_revision\" ~ '^sha256:[0-9a-f]{64}$')"
- }
- },
- "isRLSEnabled": false
- },
- "public.native_run_finalizations": {
- "name": "native_run_finalizations",
- "schema": "",
- "columns": {
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "phase": {
- "name": "phase",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "attempt": {
- "name": "attempt",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "lease_owner": {
- "name": "lease_owner",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "lease_expires_at": {
- "name": "lease_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "controller_boot_id": {
- "name": "controller_boot_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "controller_pid": {
- "name": "controller_pid",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "controller_process_started_at": {
- "name": "controller_process_started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "controller_generation": {
- "name": "controller_generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "recovery_state": {
- "name": "recovery_state",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "recovery_request_id": {
- "name": "recovery_request_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "recovery_history": {
- "name": "recovery_history",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "result_id": {
- "name": "result_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "assessment_id": {
- "name": "assessment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "decision_id": {
- "name": "decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "failure_code": {
- "name": "failure_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "failure_detail": {
- "name": "failure_detail",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "control_deadline_at": {
- "name": "control_deadline_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "native_run_finalizations_control_deadline_idx": {
- "name": "native_run_finalizations_control_deadline_idx",
- "columns": [
- {
- "expression": "control_deadline_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"native_run_finalizations\".\"control_deadline_at\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "native_run_finalizations_company_id_companies_id_fk": {
- "name": "native_run_finalizations_company_id_companies_id_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_finalizations_issue_company_fk": {
- "name": "native_run_finalizations_issue_company_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_finalizations_run_owner_fk": {
- "name": "native_run_finalizations_run_owner_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id"
- ],
- "columnsTo": [
- "company_id",
- "native_issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_finalizations_result_owner_fk": {
- "name": "native_run_finalizations_result_owner_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "native_run_results",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "result_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_finalizations_assessment_owner_fk": {
- "name": "native_run_finalizations_assessment_owner_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "work_assessments",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "assessment_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_finalizations_decision_owner_fk": {
- "name": "native_run_finalizations_decision_owner_fk",
- "tableFrom": "native_run_finalizations",
- "tableTo": "status_decisions",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "assessment_id",
- "decision_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "assessment_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "native_run_finalizations_assessment_requires_result_check": {
- "name": "native_run_finalizations_assessment_requires_result_check",
- "value": "\"native_run_finalizations\".\"assessment_id\" is null or \"native_run_finalizations\".\"result_id\" is not null"
- },
- "native_run_finalizations_decision_requires_assessment_check": {
- "name": "native_run_finalizations_decision_requires_assessment_check",
- "value": "\"native_run_finalizations\".\"decision_id\" is null or \"native_run_finalizations\".\"assessment_id\" is not null"
- }
- },
- "isRLSEnabled": false
- },
- "public.native_run_results": {
- "name": "native_run_results",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "turn_id": {
- "name": "turn_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "completion_contract_id": {
- "name": "completion_contract_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "caller_result_id": {
- "name": "caller_result_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "caller_dedupe_key": {
- "name": "caller_dedupe_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "server_fingerprint": {
- "name": "server_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "schema_status": {
- "name": "schema_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "rejection_code": {
- "name": "rejection_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result_json": {
- "name": "result_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "canonical_sha256": {
- "name": "canonical_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "native_run_results_run_fingerprint_uq": {
- "name": "native_run_results_run_fingerprint_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "server_fingerprint",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "native_run_results_run_caller_result_uq": {
- "name": "native_run_results_run_caller_result_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "caller_result_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "native_run_results_run_caller_dedupe_uq": {
- "name": "native_run_results_run_caller_dedupe_uq",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "caller_dedupe_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "native_run_results_company_id_companies_id_fk": {
- "name": "native_run_results_company_id_companies_id_fk",
- "tableFrom": "native_run_results",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_results_issue_company_fk": {
- "name": "native_run_results_issue_company_fk",
- "tableFrom": "native_run_results",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_results_run_contract_owner_fk": {
- "name": "native_run_results_run_contract_owner_fk",
- "tableFrom": "native_run_results",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "completion_contract_id"
- ],
- "columnsTo": [
- "company_id",
- "native_issue_id",
- "id",
- "completion_contract_id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "native_run_results_completion_contract_owner_fk": {
- "name": "native_run_results_completion_contract_owner_fk",
- "tableFrom": "native_run_results",
- "tableTo": "completion_contracts",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "completion_contract_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "native_run_results_company_issue_run_id_uq": {
- "name": "native_run_results_company_issue_run_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.pipeline_automation_executions": {
- "name": "pipeline_automation_executions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "automation_id": {
- "name": "automation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "triggering_event_id": {
- "name": "triggering_event_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "execution_issue_id": {
- "name": "execution_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "retry_of_execution_id": {
- "name": "retry_of_execution_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "generation": {
- "name": "generation",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_automation_executions_idempotency_uq": {
- "name": "pipeline_automation_executions_idempotency_uq",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "automation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "triggering_event_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_automation_executions_company_case_idx": {
- "name": "pipeline_automation_executions_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_automation_executions_routine_idx": {
- "name": "pipeline_automation_executions_routine_idx",
- "columns": [
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_automation_executions_execution_issue_idx": {
- "name": "pipeline_automation_executions_execution_issue_idx",
- "columns": [
- {
- "expression": "execution_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_automation_executions_retry_of_execution_idx": {
- "name": "pipeline_automation_executions_retry_of_execution_idx",
- "columns": [
- {
- "expression": "retry_of_execution_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_automation_executions_company_id_companies_id_fk": {
- "name": "pipeline_automation_executions_company_id_companies_id_fk",
- "tableFrom": "pipeline_automation_executions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_automation_executions_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_automation_executions_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_automation_executions",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_automation_executions_routine_id_routines_id_fk": {
- "name": "pipeline_automation_executions_routine_id_routines_id_fk",
- "tableFrom": "pipeline_automation_executions",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_automation_executions_execution_issue_id_issues_id_fk": {
- "name": "pipeline_automation_executions_execution_issue_id_issues_id_fk",
- "tableFrom": "pipeline_automation_executions",
- "tableTo": "issues",
- "columnsFrom": [
- "execution_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_automation_executions_status_check": {
- "name": "pipeline_automation_executions_status_check",
- "value": "\"pipeline_automation_executions\".\"status\" in ('succeeded', 'failed')"
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_case_blockers": {
- "name": "pipeline_case_blockers",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "blocked_by_case_id": {
- "name": "blocked_by_case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_case_blockers_case_blocked_by_uq": {
- "name": "pipeline_case_blockers_case_blocked_by_uq",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "blocked_by_case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_blockers_blocked_by_idx": {
- "name": "pipeline_case_blockers_blocked_by_idx",
- "columns": [
- {
- "expression": "blocked_by_case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_blockers_company_case_idx": {
- "name": "pipeline_case_blockers_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_case_blockers_company_id_companies_id_fk": {
- "name": "pipeline_case_blockers_company_id_companies_id_fk",
- "tableFrom": "pipeline_case_blockers",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_blockers_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_case_blockers_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_case_blockers",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_case_blockers",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "blocked_by_case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_case_blockers_no_self_block_check": {
- "name": "pipeline_case_blockers_no_self_block_check",
- "value": "\"pipeline_case_blockers\".\"case_id\" <> \"pipeline_case_blockers\".\"blocked_by_case_id\""
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_case_documents": {
- "name": "pipeline_case_documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_case_documents_company_case_key_uq": {
- "name": "pipeline_case_documents_company_case_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_documents_document_uq": {
- "name": "pipeline_case_documents_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_documents_company_case_updated_idx": {
- "name": "pipeline_case_documents_company_case_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_case_documents_company_id_companies_id_fk": {
- "name": "pipeline_case_documents_company_id_companies_id_fk",
- "tableFrom": "pipeline_case_documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_documents_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_case_documents_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_case_documents",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_documents_document_id_documents_id_fk": {
- "name": "pipeline_case_documents_document_id_documents_id_fk",
- "tableFrom": "pipeline_case_documents",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.pipeline_case_events": {
- "name": "pipeline_case_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_user_id": {
- "name": "actor_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "actor_agent_id": {
- "name": "actor_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "from_stage_id": {
- "name": "from_stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "to_stage_id": {
- "name": "to_stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_case_events_case_created_idx": {
- "name": "pipeline_case_events_case_created_idx",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_events_company_case_idx": {
- "name": "pipeline_case_events_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_case_events_company_id_companies_id_fk": {
- "name": "pipeline_case_events_company_id_companies_id_fk",
- "tableFrom": "pipeline_case_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_events_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_case_events_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_case_events",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_events_actor_agent_id_agents_id_fk": {
- "name": "pipeline_case_events_actor_agent_id_agents_id_fk",
- "tableFrom": "pipeline_case_events",
- "tableTo": "agents",
- "columnsFrom": [
- "actor_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "pipeline_case_events_from_stage_id_pipeline_stages_id_fk": {
- "name": "pipeline_case_events_from_stage_id_pipeline_stages_id_fk",
- "tableFrom": "pipeline_case_events",
- "tableTo": "pipeline_stages",
- "columnsFrom": [
- "from_stage_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "pipeline_case_events_to_stage_id_pipeline_stages_id_fk": {
- "name": "pipeline_case_events_to_stage_id_pipeline_stages_id_fk",
- "tableFrom": "pipeline_case_events",
- "tableTo": "pipeline_stages",
- "columnsFrom": [
- "to_stage_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_case_events_type_check": {
- "name": "pipeline_case_events_type_check",
- "value": "\"pipeline_case_events\".\"type\" in (\n 'ingested',\n 'updated',\n 'claimed',\n 'lease_released',\n 'lease_expired',\n 'transitioned',\n 'transition_forced',\n 'transition_suggested',\n 'suggestion_resolved',\n 'review_decided',\n 'conversation_opened',\n 'issue_linked',\n 'issue_unlinked',\n 'automation_executed',\n 'automation_failed',\n 'automation_retry_requested',\n 'automation_effects_retired',\n 'automation_retry_dispatched',\n 'blockers_set',\n 'blockers_resolved',\n 'children_terminal',\n 'upstream_drift',\n 'drift_acknowledged'\n )"
- },
- "pipeline_case_events_actor_type_check": {
- "name": "pipeline_case_events_actor_type_check",
- "value": "\"pipeline_case_events\".\"actor_type\" in ('user', 'agent', 'system')"
- },
- "pipeline_case_events_agent_run_check": {
- "name": "pipeline_case_events_agent_run_check",
- "value": "\"pipeline_case_events\".\"actor_type\" <> 'agent' or \"pipeline_case_events\".\"run_id\" is not null"
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_case_issue_links": {
- "name": "pipeline_case_issue_links",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_id": {
- "name": "case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "automation_attempt_id": {
- "name": "automation_attempt_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "retired_at": {
- "name": "retired_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "retired_by_attempt_id": {
- "name": "retired_by_attempt_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "retired_reason": {
- "name": "retired_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_case_issue_links_case_issue_uq": {
- "name": "pipeline_case_issue_links_case_issue_uq",
- "columns": [
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_issue_links_issue_idx": {
- "name": "pipeline_case_issue_links_issue_idx",
- "columns": [
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_issue_links_company_case_idx": {
- "name": "pipeline_case_issue_links_company_case_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_case_issue_links_automation_attempt_idx": {
- "name": "pipeline_case_issue_links_automation_attempt_idx",
- "columns": [
- {
- "expression": "automation_attempt_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_case_issue_links_company_id_companies_id_fk": {
- "name": "pipeline_case_issue_links_company_id_companies_id_fk",
- "tableFrom": "pipeline_case_issue_links",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_issue_links_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_case_issue_links_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_case_issue_links",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_case_issue_links_issue_id_issues_id_fk": {
- "name": "pipeline_case_issue_links_issue_id_issues_id_fk",
- "tableFrom": "pipeline_case_issue_links",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_case_issue_links_role_check": {
- "name": "pipeline_case_issue_links_role_check",
- "value": "\"pipeline_case_issue_links\".\"role\" in ('origin', 'conversation', 'work', 'automation')"
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_cases": {
- "name": "pipeline_cases",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "pipeline_id": {
- "name": "pipeline_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "stage_id": {
- "name": "stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "case_key": {
- "name": "case_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "summary": {
- "name": "summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "fields": {
- "name": "fields",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "workspace_ref": {
- "name": "workspace_ref",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "parent_case_id": {
- "name": "parent_case_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "parent_case_version": {
- "name": "parent_case_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "request_key": {
- "name": "request_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "automation_attempt_id": {
- "name": "automation_attempt_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "pending_suggestion": {
- "name": "pending_suggestion",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "lease_owner_type": {
- "name": "lease_owner_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "lease_agent_id": {
- "name": "lease_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "lease_user_id": {
- "name": "lease_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "lease_token": {
- "name": "lease_token",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "lease_expires_at": {
- "name": "lease_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "terminal_kind": {
- "name": "terminal_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "terminal_at": {
- "name": "terminal_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "retired_at": {
- "name": "retired_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "retired_by_attempt_id": {
- "name": "retired_by_attempt_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "retired_reason": {
- "name": "retired_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "hidden_from_board_at": {
- "name": "hidden_from_board_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "child_count": {
- "name": "child_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "terminal_child_count": {
- "name": "terminal_child_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "origin_run_id": {
- "name": "origin_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_cases_pipeline_case_key_uq": {
- "name": "pipeline_cases_pipeline_case_key_uq",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "case_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_parent_request_key_uq": {
- "name": "pipeline_cases_parent_request_key_uq",
- "columns": [
- {
- "expression": "parent_case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "request_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"pipeline_cases\".\"request_key\" is not null and \"pipeline_cases\".\"retired_at\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_company_idx": {
- "name": "pipeline_cases_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_pipeline_stage_idx": {
- "name": "pipeline_cases_pipeline_stage_idx",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_parent_idx": {
- "name": "pipeline_cases_parent_idx",
- "columns": [
- {
- "expression": "parent_case_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_automation_attempt_idx": {
- "name": "pipeline_cases_automation_attempt_idx",
- "columns": [
- {
- "expression": "automation_attempt_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_retired_idx": {
- "name": "pipeline_cases_retired_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "retired_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_cases_lease_expires_idx": {
- "name": "pipeline_cases_lease_expires_idx",
- "columns": [
- {
- "expression": "lease_expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"pipeline_cases\".\"lease_expires_at\" is not null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_cases_company_id_companies_id_fk": {
- "name": "pipeline_cases_company_id_companies_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_cases_pipeline_id_pipelines_id_fk": {
- "name": "pipeline_cases_pipeline_id_pipelines_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "pipelines",
- "columnsFrom": [
- "pipeline_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_cases_stage_id_pipeline_stages_id_fk": {
- "name": "pipeline_cases_stage_id_pipeline_stages_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "pipeline_stages",
- "columnsFrom": [
- "stage_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "pipeline_cases_parent_case_id_pipeline_cases_id_fk": {
- "name": "pipeline_cases_parent_case_id_pipeline_cases_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "pipeline_cases",
- "columnsFrom": [
- "parent_case_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "pipeline_cases_lease_agent_id_agents_id_fk": {
- "name": "pipeline_cases_lease_agent_id_agents_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "agents",
- "columnsFrom": [
- "lease_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "pipeline_cases_created_by_agent_id_agents_id_fk": {
- "name": "pipeline_cases_created_by_agent_id_agents_id_fk",
- "tableFrom": "pipeline_cases",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_cases_terminal_kind_check": {
- "name": "pipeline_cases_terminal_kind_check",
- "value": "\"pipeline_cases\".\"terminal_kind\" is null or \"pipeline_cases\".\"terminal_kind\" in ('done', 'cancelled')"
- },
- "pipeline_cases_lease_owner_type_check": {
- "name": "pipeline_cases_lease_owner_type_check",
- "value": "\"pipeline_cases\".\"lease_owner_type\" is null or \"pipeline_cases\".\"lease_owner_type\" in ('user', 'agent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_documents": {
- "name": "pipeline_documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "pipeline_id": {
- "name": "pipeline_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_documents_company_pipeline_key_uq": {
- "name": "pipeline_documents_company_pipeline_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_documents_document_uq": {
- "name": "pipeline_documents_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_documents_company_pipeline_updated_idx": {
- "name": "pipeline_documents_company_pipeline_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_documents_company_id_companies_id_fk": {
- "name": "pipeline_documents_company_id_companies_id_fk",
- "tableFrom": "pipeline_documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_documents_pipeline_id_pipelines_id_fk": {
- "name": "pipeline_documents_pipeline_id_pipelines_id_fk",
- "tableFrom": "pipeline_documents",
- "tableTo": "pipelines",
- "columnsFrom": [
- "pipeline_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_documents_document_id_documents_id_fk": {
- "name": "pipeline_documents_document_id_documents_id_fk",
- "tableFrom": "pipeline_documents",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.pipeline_stages": {
- "name": "pipeline_stages",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "pipeline_id": {
- "name": "pipeline_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "position": {
- "name": "position",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_stages_pipeline_key_uq": {
- "name": "pipeline_stages_pipeline_key_uq",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_stages_pipeline_position_idx": {
- "name": "pipeline_stages_pipeline_position_idx",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "position",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_stages_pipeline_id_pipelines_id_fk": {
- "name": "pipeline_stages_pipeline_id_pipelines_id_fk",
- "tableFrom": "pipeline_stages",
- "tableTo": "pipelines",
- "columnsFrom": [
- "pipeline_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "pipeline_stages_kind_check": {
- "name": "pipeline_stages_kind_check",
- "value": "\"pipeline_stages\".\"kind\" in ('working', 'review', 'done', 'cancelled')"
- }
- },
- "isRLSEnabled": false
- },
- "public.pipeline_transitions": {
- "name": "pipeline_transitions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "pipeline_id": {
- "name": "pipeline_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "from_stage_id": {
- "name": "from_stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "to_stage_id": {
- "name": "to_stage_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipeline_transitions_pipeline_edge_uq": {
- "name": "pipeline_transitions_pipeline_edge_uq",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "from_stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "to_stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_transitions_pipeline_from_idx": {
- "name": "pipeline_transitions_pipeline_from_idx",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "from_stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipeline_transitions_pipeline_to_idx": {
- "name": "pipeline_transitions_pipeline_to_idx",
- "columns": [
- {
- "expression": "pipeline_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "to_stage_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipeline_transitions_pipeline_id_pipelines_id_fk": {
- "name": "pipeline_transitions_pipeline_id_pipelines_id_fk",
- "tableFrom": "pipeline_transitions",
- "tableTo": "pipelines",
- "columnsFrom": [
- "pipeline_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_transitions_from_stage_id_pipeline_stages_id_fk": {
- "name": "pipeline_transitions_from_stage_id_pipeline_stages_id_fk",
- "tableFrom": "pipeline_transitions",
- "tableTo": "pipeline_stages",
- "columnsFrom": [
- "from_stage_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipeline_transitions_to_stage_id_pipeline_stages_id_fk": {
- "name": "pipeline_transitions_to_stage_id_pipeline_stages_id_fk",
- "tableFrom": "pipeline_transitions",
- "tableTo": "pipeline_stages",
- "columnsFrom": [
- "to_stage_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.pipelines": {
- "name": "pipelines",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "enforce_transitions": {
- "name": "enforce_transitions",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "pipelines_company_key_uq": {
- "name": "pipelines_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipelines_company_idx": {
- "name": "pipelines_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "pipelines_company_project_idx": {
- "name": "pipelines_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "pipelines_company_id_companies_id_fk": {
- "name": "pipelines_company_id_companies_id_fk",
- "tableFrom": "pipelines",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "pipelines_project_id_projects_id_fk": {
- "name": "pipelines_project_id_projects_id_fk",
- "tableFrom": "pipelines",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "pipelines_created_by_agent_id_agents_id_fk": {
- "name": "pipelines_created_by_agent_id_agents_id_fk",
- "tableFrom": "pipelines",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_company_settings": {
- "name": "plugin_company_settings",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "settings_json": {
- "name": "settings_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_company_settings_company_idx": {
- "name": "plugin_company_settings_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_company_settings_plugin_idx": {
- "name": "plugin_company_settings_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_company_settings_company_plugin_uq": {
- "name": "plugin_company_settings_company_plugin_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_company_settings_company_id_companies_id_fk": {
- "name": "plugin_company_settings_company_id_companies_id_fk",
- "tableFrom": "plugin_company_settings",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_company_settings_plugin_id_plugins_id_fk": {
- "name": "plugin_company_settings_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_company_settings",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_config": {
- "name": "plugin_config",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "config_json": {
- "name": "config_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_config_plugin_company_idx": {
- "name": "plugin_config_plugin_company_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_config_plugin_id_plugins_id_fk": {
- "name": "plugin_config_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_config",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_config_company_id_companies_id_fk": {
- "name": "plugin_config_company_id_companies_id_fk",
- "tableFrom": "plugin_config",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_database_namespaces": {
- "name": "plugin_database_namespaces",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_key": {
- "name": "plugin_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "namespace_name": {
- "name": "namespace_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "namespace_mode": {
- "name": "namespace_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'schema'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_database_namespaces_plugin_idx": {
- "name": "plugin_database_namespaces_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_database_namespaces_namespace_idx": {
- "name": "plugin_database_namespaces_namespace_idx",
- "columns": [
- {
- "expression": "namespace_name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_database_namespaces_status_idx": {
- "name": "plugin_database_namespaces_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_database_namespaces_plugin_id_plugins_id_fk": {
- "name": "plugin_database_namespaces_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_database_namespaces",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_entities": {
- "name": "plugin_entities",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "entity_type": {
- "name": "entity_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_kind": {
- "name": "scope_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "data": {
- "name": "data",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_entities_plugin_idx": {
- "name": "plugin_entities_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_entities_company_idx": {
- "name": "plugin_entities_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_entities_type_idx": {
- "name": "plugin_entities_type_idx",
- "columns": [
- {
- "expression": "entity_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_entities_scope_idx": {
- "name": "plugin_entities_scope_idx",
- "columns": [
- {
- "expression": "scope_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_entities_plugin_id_plugins_id_fk": {
- "name": "plugin_entities_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_entities",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_entities_company_id_companies_id_fk": {
- "name": "plugin_entities_company_id_companies_id_fk",
- "tableFrom": "plugin_entities",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "plugin_entities_external_idx": {
- "name": "plugin_entities_external_idx",
- "nullsNotDistinct": true,
- "columns": [
- "company_id",
- "plugin_id",
- "entity_type",
- "external_id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_job_runs": {
- "name": "plugin_job_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "job_id": {
- "name": "job_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "trigger": {
- "name": "trigger",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "duration_ms": {
- "name": "duration_ms",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "logs": {
- "name": "logs",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_job_runs_job_idx": {
- "name": "plugin_job_runs_job_idx",
- "columns": [
- {
- "expression": "job_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_job_runs_plugin_idx": {
- "name": "plugin_job_runs_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_job_runs_company_idx": {
- "name": "plugin_job_runs_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_job_runs_status_idx": {
- "name": "plugin_job_runs_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_job_runs_job_id_plugin_jobs_id_fk": {
- "name": "plugin_job_runs_job_id_plugin_jobs_id_fk",
- "tableFrom": "plugin_job_runs",
- "tableTo": "plugin_jobs",
- "columnsFrom": [
- "job_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_job_runs_plugin_id_plugins_id_fk": {
- "name": "plugin_job_runs_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_job_runs",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_job_runs_company_id_companies_id_fk": {
- "name": "plugin_job_runs_company_id_companies_id_fk",
- "tableFrom": "plugin_job_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_jobs": {
- "name": "plugin_jobs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "job_key": {
- "name": "job_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "schedule": {
- "name": "schedule",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "last_run_at": {
- "name": "last_run_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "next_run_at": {
- "name": "next_run_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_jobs_plugin_idx": {
- "name": "plugin_jobs_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_jobs_next_run_idx": {
- "name": "plugin_jobs_next_run_idx",
- "columns": [
- {
- "expression": "next_run_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_jobs_unique_idx": {
- "name": "plugin_jobs_unique_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "job_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_jobs_plugin_id_plugins_id_fk": {
- "name": "plugin_jobs_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_jobs",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_lifecycle_acknowledgments": {
- "name": "plugin_lifecycle_acknowledgments",
- "schema": "",
- "columns": {
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "event_id": {
- "name": "event_id",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "acknowledged_at": {
- "name": "acknowledged_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_lifecycle_acknowledgments_event_idx": {
- "name": "plugin_lifecycle_acknowledgments_event_idx",
- "columns": [
- {
- "expression": "event_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_lifecycle_acknowledgments_plugin_id_plugins_id_fk": {
- "name": "plugin_lifecycle_acknowledgments_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_lifecycle_acknowledgments",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_lifecycle_acknowledgments_event_id_resource_lifecycle_events_id_fk": {
- "name": "plugin_lifecycle_acknowledgments_event_id_resource_lifecycle_events_id_fk",
- "tableFrom": "plugin_lifecycle_acknowledgments",
- "tableTo": "resource_lifecycle_events",
- "columnsFrom": [
- "event_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "plugin_lifecycle_acknowledgments_plugin_id_event_id_pk": {
- "name": "plugin_lifecycle_acknowledgments_plugin_id_event_id_pk",
- "columns": [
- "plugin_id",
- "event_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_logs": {
- "name": "plugin_logs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "level": {
- "name": "level",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'info'"
- },
- "message": {
- "name": "message",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "meta": {
- "name": "meta",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_logs_plugin_time_idx": {
- "name": "plugin_logs_plugin_time_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_logs_company_idx": {
- "name": "plugin_logs_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_logs_level_idx": {
- "name": "plugin_logs_level_idx",
- "columns": [
- {
- "expression": "level",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_logs_plugin_id_plugins_id_fk": {
- "name": "plugin_logs_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_logs",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_logs_company_id_companies_id_fk": {
- "name": "plugin_logs_company_id_companies_id_fk",
- "tableFrom": "plugin_logs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_managed_resources": {
- "name": "plugin_managed_resources",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_key": {
- "name": "plugin_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_kind": {
- "name": "resource_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_key": {
- "name": "resource_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_id": {
- "name": "resource_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "defaults_json": {
- "name": "defaults_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_managed_resources_company_idx": {
- "name": "plugin_managed_resources_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_managed_resources_plugin_idx": {
- "name": "plugin_managed_resources_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_managed_resources_resource_idx": {
- "name": "plugin_managed_resources_resource_idx",
- "columns": [
- {
- "expression": "resource_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_managed_resources_company_plugin_resource_uq": {
- "name": "plugin_managed_resources_company_plugin_resource_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_managed_resources_company_id_companies_id_fk": {
- "name": "plugin_managed_resources_company_id_companies_id_fk",
- "tableFrom": "plugin_managed_resources",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_managed_resources_plugin_id_plugins_id_fk": {
- "name": "plugin_managed_resources_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_managed_resources",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_migrations": {
- "name": "plugin_migrations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_key": {
- "name": "plugin_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "namespace_name": {
- "name": "namespace_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "migration_key": {
- "name": "migration_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "checksum": {
- "name": "checksum",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "plugin_version": {
- "name": "plugin_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "applied_at": {
- "name": "applied_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "error_message": {
- "name": "error_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "plugin_migrations_plugin_key_idx": {
- "name": "plugin_migrations_plugin_key_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "migration_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_migrations_plugin_idx": {
- "name": "plugin_migrations_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_migrations_status_idx": {
- "name": "plugin_migrations_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_migrations_plugin_id_plugins_id_fk": {
- "name": "plugin_migrations_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_migrations",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_state": {
- "name": "plugin_state",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "scope_kind": {
- "name": "scope_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "namespace": {
- "name": "namespace",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'default'"
- },
- "state_key": {
- "name": "state_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "value_json": {
- "name": "value_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_state_plugin_scope_idx": {
- "name": "plugin_state_plugin_scope_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_state_plugin_id_plugins_id_fk": {
- "name": "plugin_state_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_state",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "plugin_state_unique_entry_idx": {
- "name": "plugin_state_unique_entry_idx",
- "nullsNotDistinct": true,
- "columns": [
- "plugin_id",
- "scope_kind",
- "scope_id",
- "namespace",
- "state_key"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugin_webhook_deliveries": {
- "name": "plugin_webhook_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "webhook_key": {
- "name": "webhook_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "external_id": {
- "name": "external_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "duration_ms": {
- "name": "duration_ms",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "headers": {
- "name": "headers",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugin_webhook_deliveries_plugin_idx": {
- "name": "plugin_webhook_deliveries_plugin_idx",
- "columns": [
- {
- "expression": "plugin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_webhook_deliveries_company_idx": {
- "name": "plugin_webhook_deliveries_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_webhook_deliveries_status_idx": {
- "name": "plugin_webhook_deliveries_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugin_webhook_deliveries_key_idx": {
- "name": "plugin_webhook_deliveries_key_idx",
- "columns": [
- {
- "expression": "webhook_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "plugin_webhook_deliveries_plugin_id_plugins_id_fk": {
- "name": "plugin_webhook_deliveries_plugin_id_plugins_id_fk",
- "tableFrom": "plugin_webhook_deliveries",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "plugin_webhook_deliveries_company_id_companies_id_fk": {
- "name": "plugin_webhook_deliveries_company_id_companies_id_fk",
- "tableFrom": "plugin_webhook_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.plugins": {
- "name": "plugins",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "plugin_key": {
- "name": "plugin_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "package_name": {
- "name": "package_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "version": {
- "name": "version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "api_version": {
- "name": "api_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "categories": {
- "name": "categories",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "manifest_json": {
- "name": "manifest_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'installed'"
- },
- "install_order": {
- "name": "install_order",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "package_path": {
- "name": "package_path",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "installed_at": {
- "name": "installed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "plugins_plugin_key_idx": {
- "name": "plugins_plugin_key_idx",
- "columns": [
- {
- "expression": "plugin_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "plugins_status_idx": {
- "name": "plugins_status_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.principal_permission_grants": {
- "name": "principal_permission_grants",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "principal_type": {
- "name": "principal_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "principal_id": {
- "name": "principal_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "permission_key": {
- "name": "permission_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope": {
- "name": "scope",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "granted_by_user_id": {
- "name": "granted_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "principal_permission_grants_unique_idx": {
- "name": "principal_permission_grants_unique_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "principal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "permission_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "principal_permission_grants_company_permission_idx": {
- "name": "principal_permission_grants_company_permission_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "permission_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "principal_permission_grants_company_id_companies_id_fk": {
- "name": "principal_permission_grants_company_id_companies_id_fk",
- "tableFrom": "principal_permission_grants",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.project_goals": {
- "name": "project_goals",
- "schema": "",
- "columns": {
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "project_goals_project_idx": {
- "name": "project_goals_project_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_goals_goal_idx": {
- "name": "project_goals_goal_idx",
- "columns": [
- {
- "expression": "goal_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_goals_company_idx": {
- "name": "project_goals_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "project_goals_project_id_projects_id_fk": {
- "name": "project_goals_project_id_projects_id_fk",
- "tableFrom": "project_goals",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "project_goals_goal_id_goals_id_fk": {
- "name": "project_goals_goal_id_goals_id_fk",
- "tableFrom": "project_goals",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "project_goals_company_id_companies_id_fk": {
- "name": "project_goals_company_id_companies_id_fk",
- "tableFrom": "project_goals",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {
- "project_goals_project_id_goal_id_pk": {
- "name": "project_goals_project_id_goal_id_pk",
- "columns": [
- "project_id",
- "goal_id"
- ]
- }
- },
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.project_memberships": {
- "name": "project_memberships",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'joined'"
- },
- "starred_at": {
- "name": "starred_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "project_memberships_company_user_idx": {
- "name": "project_memberships_company_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_memberships_company_user_starred_idx": {
- "name": "project_memberships_company_user_starred_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "starred_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_memberships_project_idx": {
- "name": "project_memberships_project_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_memberships_company_user_project_uq": {
- "name": "project_memberships_company_user_project_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "project_memberships_company_id_companies_id_fk": {
- "name": "project_memberships_company_id_companies_id_fk",
- "tableFrom": "project_memberships",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "project_memberships_project_id_projects_id_fk": {
- "name": "project_memberships_project_id_projects_id_fk",
- "tableFrom": "project_memberships",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.project_workspaces": {
- "name": "project_workspaces",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "source_type": {
- "name": "source_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_path'"
- },
- "cwd": {
- "name": "cwd",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "repo_url": {
- "name": "repo_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "repo_ref": {
- "name": "repo_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "default_ref": {
- "name": "default_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "visibility": {
- "name": "visibility",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'default'"
- },
- "setup_command": {
- "name": "setup_command",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "cleanup_command": {
- "name": "cleanup_command",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "remote_provider": {
- "name": "remote_provider",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "remote_workspace_ref": {
- "name": "remote_workspace_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "shared_workspace_key": {
- "name": "shared_workspace_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "is_primary": {
- "name": "is_primary",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "project_workspaces_company_project_idx": {
- "name": "project_workspaces_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_workspaces_project_primary_idx": {
- "name": "project_workspaces_project_primary_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "is_primary",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_workspaces_project_source_type_idx": {
- "name": "project_workspaces_project_source_type_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "source_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_workspaces_company_shared_key_idx": {
- "name": "project_workspaces_company_shared_key_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "shared_workspace_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "project_workspaces_project_remote_ref_idx": {
- "name": "project_workspaces_project_remote_ref_idx",
- "columns": [
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "remote_provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "remote_workspace_ref",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "project_workspaces_company_id_companies_id_fk": {
- "name": "project_workspaces_company_id_companies_id_fk",
- "tableFrom": "project_workspaces",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "project_workspaces_project_id_projects_id_fk": {
- "name": "project_workspaces_project_id_projects_id_fk",
- "tableFrom": "project_workspaces",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.projects": {
- "name": "projects",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'backlog'"
- },
- "lead_agent_id": {
- "name": "lead_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "target_date": {
- "name": "target_date",
- "type": "date",
- "primaryKey": false,
- "notNull": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "icon": {
- "name": "icon",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "env": {
- "name": "env",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "pause_reason": {
- "name": "pause_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "paused_at": {
- "name": "paused_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_policy": {
- "name": "execution_workspace_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "projects_company_idx": {
- "name": "projects_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "projects_company_id_companies_id_fk": {
- "name": "projects_company_id_companies_id_fk",
- "tableFrom": "projects",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "projects_goal_id_goals_id_fk": {
- "name": "projects_goal_id_goals_id_fk",
- "tableFrom": "projects",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "projects_lead_agent_id_agents_id_fk": {
- "name": "projects_lead_agent_id_agents_id_fk",
- "tableFrom": "projects",
- "tableTo": "agents",
- "columnsFrom": [
- "lead_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.provider_trace_records": {
- "name": "provider_trace_records",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'capturing'"
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trace_ref": {
- "name": "trace_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "frame_count": {
- "name": "frame_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "byte_count": {
- "name": "byte_count",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "digest": {
- "name": "digest",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "reason": {
- "name": "reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "requested_by": {
- "name": "requested_by",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "provider_trace_records_run_unique": {
- "name": "provider_trace_records_run_unique",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "provider_trace_records_expiry_idx": {
- "name": "provider_trace_records_expiry_idx",
- "columns": [
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "provider_trace_records_company_created_idx": {
- "name": "provider_trace_records_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "provider_trace_records_company_id_companies_id_fk": {
- "name": "provider_trace_records_company_id_companies_id_fk",
- "tableFrom": "provider_trace_records",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "provider_trace_records_run_id_heartbeat_runs_id_fk": {
- "name": "provider_trace_records_run_id_heartbeat_runs_id_fk",
- "tableFrom": "provider_trace_records",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.remote_agent_profiles": {
- "name": "remote_agent_profiles",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "profile_key": {
- "name": "profile_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "display_name": {
- "name": "display_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "service": {
- "name": "service",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "configuration": {
- "name": "configuration",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "retention_acknowledged": {
- "name": "retention_acknowledged",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "qualification": {
- "name": "qualification",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "qualified_at": {
- "name": "qualified_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "qualified_revision": {
- "name": "qualified_revision",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "remote_agent_profiles_company_idx": {
- "name": "remote_agent_profiles_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "remote_agent_profiles_company_key_uq": {
- "name": "remote_agent_profiles_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "remote_agent_profiles_company_id_companies_id_fk": {
- "name": "remote_agent_profiles_company_id_companies_id_fk",
- "tableFrom": "remote_agent_profiles",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "remote_agent_profiles_service_check": {
- "name": "remote_agent_profiles_service_check",
- "value": "\"remote_agent_profiles\".\"service\" = 'aws_bedrock_agentcore_harness'"
- },
- "remote_agent_profiles_qualified_revision_check": {
- "name": "remote_agent_profiles_qualified_revision_check",
- "value": "(\"remote_agent_profiles\".\"qualified_at\" IS NULL AND \"remote_agent_profiles\".\"qualified_revision\" IS NULL) OR (\"remote_agent_profiles\".\"qualified_at\" IS NOT NULL AND \"remote_agent_profiles\".\"qualification\" <> '{}'::jsonb AND \"remote_agent_profiles\".\"qualified_revision\" ~ '^sha256:[0-9a-f]{64}$')"
- }
- },
- "isRLSEnabled": false
- },
- "public.resource_lifecycle_events": {
- "name": "resource_lifecycle_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "bigint",
- "primaryKey": true,
- "notNull": true,
- "identity": {
- "type": "always",
- "name": "resource_lifecycle_events_id_seq",
- "schema": "public",
- "increment": "1",
- "startWith": "1",
- "minValue": "1",
- "maxValue": "9223372036854775807",
- "cache": "1",
- "cycle": false
- }
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "resource_type": {
- "name": "resource_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource_id": {
- "name": "resource_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "resource_lifecycle_events_creation_idx": {
- "name": "resource_lifecycle_events_creation_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"resource_lifecycle_events\".\"action\" = 'create'",
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "resource_lifecycle_events_company_idx": {
- "name": "resource_lifecycle_events_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "resource_lifecycle_events_resource_order_idx": {
- "name": "resource_lifecycle_events_resource_order_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "resource_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "resource_lifecycle_events_company_id_companies_id_fk": {
- "name": "resource_lifecycle_events_company_id_companies_id_fk",
- "tableFrom": "resource_lifecycle_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "resource_lifecycle_events_resource_type_check": {
- "name": "resource_lifecycle_events_resource_type_check",
- "value": "\"resource_lifecycle_events\".\"resource_type\" IN ('agent', 'project')"
- },
- "resource_lifecycle_events_action_check": {
- "name": "resource_lifecycle_events_action_check",
- "value": "\"resource_lifecycle_events\".\"action\" = 'create' OR (\"resource_lifecycle_events\".\"resource_type\" = 'project' AND \"resource_lifecycle_events\".\"action\" IN ('update', 'archive')) OR (\"resource_lifecycle_events\".\"resource_type\" = 'agent' AND \"resource_lifecycle_events\".\"action\" IN ('pause', 'resume', 'terminate'))"
- }
- },
- "isRLSEnabled": false
- },
- "public.routine_documents": {
- "name": "routine_documents",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routine_documents_company_routine_key_uq": {
- "name": "routine_documents_company_routine_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_documents_document_uq": {
- "name": "routine_documents_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_documents_company_routine_updated_idx": {
- "name": "routine_documents_company_routine_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routine_documents_company_id_companies_id_fk": {
- "name": "routine_documents_company_id_companies_id_fk",
- "tableFrom": "routine_documents",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "routine_documents_routine_id_routines_id_fk": {
- "name": "routine_documents_routine_id_routines_id_fk",
- "tableFrom": "routine_documents",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_documents_document_id_documents_id_fk": {
- "name": "routine_documents_document_id_documents_id_fk",
- "tableFrom": "routine_documents",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.routine_revisions": {
- "name": "routine_revisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision_number": {
- "name": "revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "snapshot": {
- "name": "snapshot",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "change_summary": {
- "name": "change_summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "restored_from_revision_id": {
- "name": "restored_from_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_run_id": {
- "name": "created_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routine_revisions_routine_revision_uq": {
- "name": "routine_revisions_routine_revision_uq",
- "columns": [
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revision_number",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_revisions_company_routine_created_idx": {
- "name": "routine_revisions_company_routine_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_revisions_company_responsible_user_idx": {
- "name": "routine_revisions_company_responsible_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routine_revisions_company_id_companies_id_fk": {
- "name": "routine_revisions_company_id_companies_id_fk",
- "tableFrom": "routine_revisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_revisions_routine_id_routines_id_fk": {
- "name": "routine_revisions_routine_id_routines_id_fk",
- "tableFrom": "routine_revisions",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_revisions_restored_from_revision_id_routine_revisions_id_fk": {
- "name": "routine_revisions_restored_from_revision_id_routine_revisions_id_fk",
- "tableFrom": "routine_revisions",
- "tableTo": "routine_revisions",
- "columnsFrom": [
- "restored_from_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_revisions_created_by_agent_id_agents_id_fk": {
- "name": "routine_revisions_created_by_agent_id_agents_id_fk",
- "tableFrom": "routine_revisions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_revisions_created_by_run_id_heartbeat_runs_id_fk": {
- "name": "routine_revisions_created_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "routine_revisions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "created_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.routine_runs": {
- "name": "routine_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "trigger_id": {
- "name": "trigger_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source": {
- "name": "source",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'received'"
- },
- "triggered_at": {
- "name": "triggered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "routine_revision_id": {
- "name": "routine_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "trigger_payload": {
- "name": "trigger_payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "dispatch_fingerprint": {
- "name": "dispatch_fingerprint",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "linked_issue_id": {
- "name": "linked_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "coalesced_into_run_id": {
- "name": "coalesced_into_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routine_runs_company_routine_idx": {
- "name": "routine_runs_company_routine_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_revision_idx": {
- "name": "routine_runs_revision_idx",
- "columns": [
- {
- "expression": "routine_revision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_company_responsible_user_idx": {
- "name": "routine_runs_company_responsible_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_trigger_idx": {
- "name": "routine_runs_trigger_idx",
- "columns": [
- {
- "expression": "trigger_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_dispatch_fingerprint_idx": {
- "name": "routine_runs_dispatch_fingerprint_idx",
- "columns": [
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "dispatch_fingerprint",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_linked_issue_idx": {
- "name": "routine_runs_linked_issue_idx",
- "columns": [
- {
- "expression": "linked_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_runs_trigger_idempotency_idx": {
- "name": "routine_runs_trigger_idempotency_idx",
- "columns": [
- {
- "expression": "trigger_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routine_runs_company_id_companies_id_fk": {
- "name": "routine_runs_company_id_companies_id_fk",
- "tableFrom": "routine_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_runs_routine_id_routines_id_fk": {
- "name": "routine_runs_routine_id_routines_id_fk",
- "tableFrom": "routine_runs",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_runs_trigger_id_routine_triggers_id_fk": {
- "name": "routine_runs_trigger_id_routine_triggers_id_fk",
- "tableFrom": "routine_runs",
- "tableTo": "routine_triggers",
- "columnsFrom": [
- "trigger_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_runs_routine_revision_id_routine_revisions_id_fk": {
- "name": "routine_runs_routine_revision_id_routine_revisions_id_fk",
- "tableFrom": "routine_runs",
- "tableTo": "routine_revisions",
- "columnsFrom": [
- "routine_revision_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_runs_linked_issue_id_issues_id_fk": {
- "name": "routine_runs_linked_issue_id_issues_id_fk",
- "tableFrom": "routine_runs",
- "tableTo": "issues",
- "columnsFrom": [
- "linked_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.routine_triggers": {
- "name": "routine_triggers",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "routine_id": {
- "name": "routine_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "setup_pending": {
- "name": "setup_pending",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "archived": {
- "name": "archived",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "last_webhook_delivery": {
- "name": "last_webhook_delivery",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "cron_expression": {
- "name": "cron_expression",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "timezone": {
- "name": "timezone",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "next_run_at": {
- "name": "next_run_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_fired_at": {
- "name": "last_fired_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "public_id": {
- "name": "public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "secret_id": {
- "name": "secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "signing_mode": {
- "name": "signing_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "replay_window_sec": {
- "name": "replay_window_sec",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "last_rotated_at": {
- "name": "last_rotated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_result": {
- "name": "last_result",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routine_triggers_company_routine_idx": {
- "name": "routine_triggers_company_routine_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "routine_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_triggers_company_kind_idx": {
- "name": "routine_triggers_company_kind_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_triggers_next_run_idx": {
- "name": "routine_triggers_next_run_idx",
- "columns": [
- {
- "expression": "next_run_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_triggers_public_id_idx": {
- "name": "routine_triggers_public_id_idx",
- "columns": [
- {
- "expression": "public_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routine_triggers_public_id_uq": {
- "name": "routine_triggers_public_id_uq",
- "columns": [
- {
- "expression": "public_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routine_triggers_company_id_companies_id_fk": {
- "name": "routine_triggers_company_id_companies_id_fk",
- "tableFrom": "routine_triggers",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_triggers_routine_id_routines_id_fk": {
- "name": "routine_triggers_routine_id_routines_id_fk",
- "tableFrom": "routine_triggers",
- "tableTo": "routines",
- "columnsFrom": [
- "routine_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_triggers_secret_id_company_secrets_id_fk": {
- "name": "routine_triggers_secret_id_company_secrets_id_fk",
- "tableFrom": "routine_triggers",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_triggers_created_by_agent_id_agents_id_fk": {
- "name": "routine_triggers_created_by_agent_id_agents_id_fk",
- "tableFrom": "routine_triggers",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routine_triggers_updated_by_agent_id_agents_id_fk": {
- "name": "routine_triggers_updated_by_agent_id_agents_id_fk",
- "tableFrom": "routine_triggers",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.routine_webhook_test_receipts": {
- "name": "routine_webhook_test_receipts",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "trigger_id": {
- "name": "trigger_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_key_hash": {
- "name": "delivery_key_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "received_at": {
- "name": "received_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routine_webhook_test_receipts_delivery_uq": {
- "name": "routine_webhook_test_receipts_delivery_uq",
- "columns": [
- {
- "expression": "trigger_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "delivery_key_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routine_webhook_test_receipts_company_id_companies_id_fk": {
- "name": "routine_webhook_test_receipts_company_id_companies_id_fk",
- "tableFrom": "routine_webhook_test_receipts",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routine_webhook_test_receipts_trigger_id_routine_triggers_id_fk": {
- "name": "routine_webhook_test_receipts_trigger_id_routine_triggers_id_fk",
- "tableFrom": "routine_webhook_test_receipts",
- "tableTo": "routine_triggers",
- "columnsFrom": [
- "trigger_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.routines": {
- "name": "routines",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "folder_id": {
- "name": "folder_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "goal_id": {
- "name": "goal_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "parent_issue_id": {
- "name": "parent_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "assignee_agent_id": {
- "name": "assignee_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "priority": {
- "name": "priority",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'medium'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "concurrency_policy": {
- "name": "concurrency_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'coalesce_if_active'"
- },
- "catch_up_policy": {
- "name": "catch_up_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'skip_missed'"
- },
- "activity_gate_policy": {
- "name": "activity_gate_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'always'"
- },
- "activity_gate_scope": {
- "name": "activity_gate_scope",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'company'"
- },
- "origin_kind": {
- "name": "origin_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'manual'"
- },
- "origin_id": {
- "name": "origin_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "variables": {
- "name": "variables",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "env": {
- "name": "env",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "latest_revision_id": {
- "name": "latest_revision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "latest_revision_number": {
- "name": "latest_revision_number",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 1
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_triggered_at": {
- "name": "last_triggered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_enqueued_at": {
- "name": "last_enqueued_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "routines_company_status_idx": {
- "name": "routines_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routines_company_assignee_idx": {
- "name": "routines_company_assignee_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "assignee_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routines_company_project_idx": {
- "name": "routines_company_project_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routines_company_folder_idx": {
- "name": "routines_company_folder_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "folder_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routines_company_responsible_user_idx": {
- "name": "routines_company_responsible_user_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "responsible_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "routines_company_origin_idx": {
- "name": "routines_company_origin_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "origin_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "routines_company_id_companies_id_fk": {
- "name": "routines_company_id_companies_id_fk",
- "tableFrom": "routines",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routines_project_id_projects_id_fk": {
- "name": "routines_project_id_projects_id_fk",
- "tableFrom": "routines",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "routines_folder_id_folders_id_fk": {
- "name": "routines_folder_id_folders_id_fk",
- "tableFrom": "routines",
- "tableTo": "folders",
- "columnsFrom": [
- "folder_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routines_goal_id_goals_id_fk": {
- "name": "routines_goal_id_goals_id_fk",
- "tableFrom": "routines",
- "tableTo": "goals",
- "columnsFrom": [
- "goal_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routines_parent_issue_id_issues_id_fk": {
- "name": "routines_parent_issue_id_issues_id_fk",
- "tableFrom": "routines",
- "tableTo": "issues",
- "columnsFrom": [
- "parent_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routines_assignee_agent_id_agents_id_fk": {
- "name": "routines_assignee_agent_id_agents_id_fk",
- "tableFrom": "routines",
- "tableTo": "agents",
- "columnsFrom": [
- "assignee_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "routines_created_by_agent_id_agents_id_fk": {
- "name": "routines_created_by_agent_id_agents_id_fk",
- "tableFrom": "routines",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "routines_updated_by_agent_id_agents_id_fk": {
- "name": "routines_updated_by_agent_id_agents_id_fk",
- "tableFrom": "routines",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.run_identity_contexts": {
- "name": "run_identity_contexts",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "revision": {
- "name": "revision",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "message_id": {
- "name": "message_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "parent_context_id": {
- "name": "parent_context_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "cause": {
- "name": "cause",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'accepted'"
- },
- "accepted_at": {
- "name": "accepted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "github": {
- "name": "github",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "run_identity_contexts_run_revision_idx": {
- "name": "run_identity_contexts_run_revision_idx",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "revision",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "run_identity_contexts_run_correlation_idx": {
- "name": "run_identity_contexts_run_correlation_idx",
- "columns": [
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "correlation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "run_identity_contexts_company_run_idx": {
- "name": "run_identity_contexts_company_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "run_identity_contexts_company_id_companies_id_fk": {
- "name": "run_identity_contexts_company_id_companies_id_fk",
- "tableFrom": "run_identity_contexts",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.runner_api_response_reservations": {
- "name": "runner_api_response_reservations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "asset_id": {
- "name": "asset_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "reserved_bytes": {
- "name": "reserved_bytes",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "runner_api_response_reservations_company_idx": {
- "name": "runner_api_response_reservations_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "runner_api_response_reservations_company_id_companies_id_fk": {
- "name": "runner_api_response_reservations_company_id_companies_id_fk",
- "tableFrom": "runner_api_response_reservations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "runner_api_response_reservations_run_id_heartbeat_runs_id_fk": {
- "name": "runner_api_response_reservations_run_id_heartbeat_runs_id_fk",
- "tableFrom": "runner_api_response_reservations",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "runner_api_response_reservations_asset_id_assets_id_fk": {
- "name": "runner_api_response_reservations_asset_id_assets_id_fk",
- "tableFrom": "runner_api_response_reservations",
- "tableTo": "assets",
- "columnsFrom": [
- "asset_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.secret_access_events": {
- "name": "secret_access_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "secret_id": {
- "name": "secret_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "user_secret_definition_id": {
- "name": "user_secret_definition_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "secret_scope": {
- "name": "secret_scope",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'company'"
- },
- "version": {
- "name": "version",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "responsible_user_id": {
- "name": "responsible_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "credential_owner_user_id": {
- "name": "credential_owner_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "credential_subject_type": {
- "name": "credential_subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "credential_subject_id": {
- "name": "credential_subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_id": {
- "name": "actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "consumer_type": {
- "name": "consumer_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "consumer_id": {
- "name": "consumer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "config_path": {
- "name": "config_path",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "secret_access_events_company_created_idx": {
- "name": "secret_access_events_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "secret_access_events_secret_created_idx": {
- "name": "secret_access_events_secret_created_idx",
- "columns": [
- {
- "expression": "secret_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "secret_access_events_user_definition_created_idx": {
- "name": "secret_access_events_user_definition_created_idx",
- "columns": [
- {
- "expression": "user_secret_definition_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "secret_access_events_company_credential_owner_idx": {
- "name": "secret_access_events_company_credential_owner_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "credential_owner_user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "secret_access_events_consumer_idx": {
- "name": "secret_access_events_consumer_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "consumer_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "consumer_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "secret_access_events_run_idx": {
- "name": "secret_access_events_run_idx",
- "columns": [
- {
- "expression": "heartbeat_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "secret_access_events_company_id_companies_id_fk": {
- "name": "secret_access_events_company_id_companies_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "secret_access_events_secret_id_company_secrets_id_fk": {
- "name": "secret_access_events_secret_id_company_secrets_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "company_secrets",
- "columnsFrom": [
- "secret_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk": {
- "name": "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "user_secret_definitions",
- "columnsFrom": [
- "user_secret_definition_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "secret_access_events_issue_id_issues_id_fk": {
- "name": "secret_access_events_issue_id_issues_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "secret_access_events_plugin_id_plugins_id_fk": {
- "name": "secret_access_events_plugin_id_plugins_id_fk",
- "tableFrom": "secret_access_events",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.smoke_run_steps": {
- "name": "smoke_run_steps",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "path": {
- "name": "path",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scenario_step": {
- "name": "scenario_step",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "detail": {
- "name": "detail",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "screenshot_artifact_ref": {
- "name": "screenshot_artifact_ref",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "duration_ms": {
- "name": "duration_ms",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "smoke_run_steps_company_run_idx": {
- "name": "smoke_run_steps_company_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "smoke_run_steps_company_path_idx": {
- "name": "smoke_run_steps_company_path_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "path",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "smoke_run_steps_company_id_companies_id_fk": {
- "name": "smoke_run_steps_company_id_companies_id_fk",
- "tableFrom": "smoke_run_steps",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "smoke_run_steps_run_id_smoke_runs_id_fk": {
- "name": "smoke_run_steps_run_id_smoke_runs_id_fk",
- "tableFrom": "smoke_run_steps",
- "tableTo": "smoke_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.smoke_runs": {
- "name": "smoke_runs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "trigger": {
- "name": "trigger",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'running'"
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "summary": {
- "name": "summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "smoke_runs_company_started_idx": {
- "name": "smoke_runs_company_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "smoke_runs_company_status_idx": {
- "name": "smoke_runs_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "smoke_runs_company_id_companies_id_fk": {
- "name": "smoke_runs_company_id_companies_id_fk",
- "tableFrom": "smoke_runs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.status_card_updates": {
- "name": "status_card_updates",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "card_id": {
- "name": "card_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trigger": {
- "name": "trigger",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "generation_issue_id": {
- "name": "generation_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "changes": {
- "name": "changes",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "input_tokens": {
- "name": "input_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "output_tokens": {
- "name": "output_tokens",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "cost_cents": {
- "name": "cost_cents",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "model": {
- "name": "model",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "query_version": {
- "name": "query_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "change_summary": {
- "name": "change_summary",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "error": {
- "name": "error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "status_card_updates_card_started_idx": {
- "name": "status_card_updates_card_started_idx",
- "columns": [
- {
- "expression": "card_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "status_card_updates_generation_issue_idx": {
- "name": "status_card_updates_generation_issue_idx",
- "columns": [
- {
- "expression": "generation_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "status_card_updates_card_id_status_cards_id_fk": {
- "name": "status_card_updates_card_id_status_cards_id_fk",
- "tableFrom": "status_card_updates",
- "tableTo": "status_cards",
- "columnsFrom": [
- "card_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "status_card_updates_generation_issue_id_issues_id_fk": {
- "name": "status_card_updates_generation_issue_id_issues_id_fk",
- "tableFrom": "status_card_updates",
- "tableTo": "issues",
- "columnsFrom": [
- "generation_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_card_updates_run_id_heartbeat_runs_id_fk": {
- "name": "status_card_updates_run_id_heartbeat_runs_id_fk",
- "tableFrom": "status_card_updates",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.status_cards": {
- "name": "status_cards",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "title_pinned": {
- "name": "title_pinned",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "interest_prompt": {
- "name": "interest_prompt",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "queries": {
- "name": "queries",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "query_version": {
- "name": "query_version",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "query_compiled_at": {
- "name": "query_compiled_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "query_compiled_by_agent_id": {
- "name": "query_compiled_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "refresh_policy": {
- "name": "refresh_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'compiling'"
- },
- "pending_change_count": {
- "name": "pending_change_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "pending_change_hash": {
- "name": "pending_change_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_change_at": {
- "name": "last_change_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "fingerprint": {
- "name": "fingerprint",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "fingerprint_at": {
- "name": "fingerprint_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "mentioned_issue_ids": {
- "name": "mentioned_issue_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_update_run_kind": {
- "name": "last_update_run_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_generated_at": {
- "name": "last_generated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_model": {
- "name": "last_model",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "generating_issue_id": {
- "name": "generating_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "next_eval_at": {
- "name": "next_eval_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_user_id": {
- "name": "archived_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "archived_by_agent_id": {
- "name": "archived_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "status_cards_company_archived_idx": {
- "name": "status_cards_company_archived_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "archived_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "status_cards_company_next_eval_idx": {
- "name": "status_cards_company_next_eval_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "next_eval_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "status_cards_company_id_companies_id_fk": {
- "name": "status_cards_company_id_companies_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "status_cards_created_by_agent_id_agents_id_fk": {
- "name": "status_cards_created_by_agent_id_agents_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_cards_query_compiled_by_agent_id_agents_id_fk": {
- "name": "status_cards_query_compiled_by_agent_id_agents_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "agents",
- "columnsFrom": [
- "query_compiled_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_cards_agent_id_agents_id_fk": {
- "name": "status_cards_agent_id_agents_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_cards_document_id_documents_id_fk": {
- "name": "status_cards_document_id_documents_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_cards_generating_issue_id_issues_id_fk": {
- "name": "status_cards_generating_issue_id_issues_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "issues",
- "columnsFrom": [
- "generating_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "status_cards_archived_by_agent_id_agents_id_fk": {
- "name": "status_cards_archived_by_agent_id_agents_id_fk",
- "tableFrom": "status_cards",
- "tableTo": "agents",
- "columnsFrom": [
- "archived_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.status_decision_effects": {
- "name": "status_decision_effects",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "decision_id": {
- "name": "decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "ordinal": {
- "name": "ordinal",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "effect_kind": {
- "name": "effect_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "payload": {
- "name": "payload",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_state": {
- "name": "delivery_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "attempt_count": {
- "name": "attempt_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "delivered_at": {
- "name": "delivered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "status_decision_effects_decision_ordinal_uq": {
- "name": "status_decision_effects_decision_ordinal_uq",
- "columns": [
- {
- "expression": "decision_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "ordinal",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "status_decision_effects_company_idempotency_uq": {
- "name": "status_decision_effects_company_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "status_decision_effects_company_id_companies_id_fk": {
- "name": "status_decision_effects_company_id_companies_id_fk",
- "tableFrom": "status_decision_effects",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "status_decision_effects_issue_company_fk": {
- "name": "status_decision_effects_issue_company_fk",
- "tableFrom": "status_decision_effects",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "status_decision_effects_decision_owner_fk": {
- "name": "status_decision_effects_decision_owner_fk",
- "tableFrom": "status_decision_effects",
- "tableTo": "status_decisions",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "decision_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.status_decisions": {
- "name": "status_decisions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "assessment_id": {
- "name": "assessment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "decision_version": {
- "name": "decision_version",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "policy_version": {
- "name": "policy_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "from_status": {
- "name": "from_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "to_status": {
- "name": "to_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reason_code": {
- "name": "reason_code",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "decision_json": {
- "name": "decision_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "decision_digest": {
- "name": "decision_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "application_state": {
- "name": "application_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'proposed'"
- },
- "supersedes_decision_id": {
- "name": "supersedes_decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "applied_at": {
- "name": "applied_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "status_decisions_company_issue_version_uq": {
- "name": "status_decisions_company_issue_version_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "decision_version",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "status_decisions_company_assessment_uq": {
- "name": "status_decisions_company_assessment_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "assessment_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "status_decisions_company_issue_digest_uq": {
- "name": "status_decisions_company_issue_digest_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "decision_digest",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "status_decisions_company_id_companies_id_fk": {
- "name": "status_decisions_company_id_companies_id_fk",
- "tableFrom": "status_decisions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "status_decisions_issue_company_fk": {
- "name": "status_decisions_issue_company_fk",
- "tableFrom": "status_decisions",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "status_decisions_assessment_owner_fk": {
- "name": "status_decisions_assessment_owner_fk",
- "tableFrom": "status_decisions",
- "tableTo": "work_assessments",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "assessment_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "status_decisions_supersedes_owner_fk": {
- "name": "status_decisions_supersedes_owner_fk",
- "tableFrom": "status_decisions",
- "tableTo": "status_decisions",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "supersedes_decision_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "status_decisions_company_issue_id_uq": {
- "name": "status_decisions_company_issue_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "issue_id",
- "id"
- ]
- },
- "status_decisions_company_issue_run_assessment_id_uq": {
- "name": "status_decisions_company_issue_run_assessment_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "issue_id",
- "run_id",
- "assessment_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.summary_slots": {
- "name": "summary_slots",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "scope_kind": {
- "name": "scope_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "slot_key": {
- "name": "slot_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "document_id": {
- "name": "document_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'idle'"
- },
- "failure_reason": {
- "name": "failure_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "generating_issue_id": {
- "name": "generating_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_generated_at": {
- "name": "last_generated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_generated_by_agent_id": {
- "name": "last_generated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_model": {
- "name": "last_model",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "summary_slots_document_uq": {
- "name": "summary_slots_document_uq",
- "columns": [
- {
- "expression": "document_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "summary_slots_company_scope_idx": {
- "name": "summary_slots_company_scope_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "scope_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "summary_slots_company_generating_issue_idx": {
- "name": "summary_slots_company_generating_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "generating_issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "summary_slots_company_updated_idx": {
- "name": "summary_slots_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "summary_slots_company_id_companies_id_fk": {
- "name": "summary_slots_company_id_companies_id_fk",
- "tableFrom": "summary_slots",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "summary_slots_document_id_documents_id_fk": {
- "name": "summary_slots_document_id_documents_id_fk",
- "tableFrom": "summary_slots",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "summary_slots_generating_issue_id_issues_id_fk": {
- "name": "summary_slots_generating_issue_id_issues_id_fk",
- "tableFrom": "summary_slots",
- "tableTo": "issues",
- "columnsFrom": [
- "generating_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "summary_slots_last_generated_by_agent_id_agents_id_fk": {
- "name": "summary_slots_last_generated_by_agent_id_agents_id_fk",
- "tableFrom": "summary_slots",
- "tableTo": "agents",
- "columnsFrom": [
- "last_generated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "summary_slots_company_scope_slot_uq": {
- "name": "summary_slots_company_scope_slot_uq",
- "nullsNotDistinct": true,
- "columns": [
- "company_id",
- "scope_kind",
- "scope_id",
- "slot_key"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_access_audit_events": {
- "name": "tool_access_audit_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "gateway_id": {
- "name": "gateway_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_token_id": {
- "name": "gateway_token_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_public_id": {
- "name": "gateway_public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_name": {
- "name": "client_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_entry_id": {
- "name": "catalog_entry_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'system'"
- },
- "actor_id": {
- "name": "actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "action": {
- "name": "action",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reason_code": {
- "name": "reason_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "details": {
- "name": "details",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_access_audit_company_created_idx": {
- "name": "tool_access_audit_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_access_audit_connection_idx": {
- "name": "tool_access_audit_connection_idx",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_access_audit_gateway_idx": {
- "name": "tool_access_audit_gateway_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "gateway_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_access_audit_events_company_id_companies_id_fk": {
- "name": "tool_access_audit_events_company_id_companies_id_fk",
- "tableFrom": "tool_access_audit_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk": {
- "name": "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk",
- "tableFrom": "tool_access_audit_events",
- "tableTo": "tool_mcp_gateways",
- "columnsFrom": [
- "gateway_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
- "name": "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
- "tableFrom": "tool_access_audit_events",
- "tableTo": "tool_mcp_gateway_tokens",
- "columnsFrom": [
- "gateway_token_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_access_audit_events_connection_id_tool_connections_id_fk": {
- "name": "tool_access_audit_events_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_access_audit_events",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk": {
- "name": "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk",
- "tableFrom": "tool_access_audit_events",
- "tableTo": "tool_catalog_entries",
- "columnsFrom": [
- "catalog_entry_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_action_deliveries": {
- "name": "tool_action_deliveries",
- "schema": "",
- "columns": {
- "action_request_id": {
- "name": "action_request_id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "delivered_at": {
- "name": "delivered_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_action_deliveries_pending_idx": {
- "name": "tool_action_deliveries_pending_idx",
- "columns": [
- {
- "expression": "delivered_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_action_deliveries_action_request_id_tool_action_requests_id_fk": {
- "name": "tool_action_deliveries_action_request_id_tool_action_requests_id_fk",
- "tableFrom": "tool_action_deliveries",
- "tableTo": "tool_action_requests",
- "columnsFrom": [
- "action_request_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_action_deliveries_company_id_companies_id_fk": {
- "name": "tool_action_deliveries_company_id_companies_id_fk",
- "tableFrom": "tool_action_deliveries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_action_deliveries_issue_id_issues_id_fk": {
- "name": "tool_action_deliveries_issue_id_issues_id_fk",
- "tableFrom": "tool_action_deliveries",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_action_deliveries_interaction_id_issue_thread_interactions_id_fk": {
- "name": "tool_action_deliveries_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "tool_action_deliveries",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_action_requests": {
- "name": "tool_action_requests",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "invocation_id": {
- "name": "invocation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "approval_id": {
- "name": "approval_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "canonical_arguments_hash": {
- "name": "canonical_arguments_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "canonical_arguments_summary": {
- "name": "canonical_arguments_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "signed_arguments": {
- "name": "signed_arguments",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "preview_markdown": {
- "name": "preview_markdown",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "requested_by_agent_id": {
- "name": "requested_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "requested_by_user_id": {
- "name": "requested_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_agent_id": {
- "name": "resolved_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_by_user_id": {
- "name": "resolved_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_by_agent_id": {
- "name": "decided_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "decided_by_user_id": {
- "name": "decided_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_at": {
- "name": "decided_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "resolved_at": {
- "name": "resolved_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_action_requests_company_status_idx": {
- "name": "tool_action_requests_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_action_requests_invocation_idx": {
- "name": "tool_action_requests_invocation_idx",
- "columns": [
- {
- "expression": "invocation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_action_requests_issue_idx": {
- "name": "tool_action_requests_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_action_requests_company_id_companies_id_fk": {
- "name": "tool_action_requests_company_id_companies_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_action_requests_invocation_id_tool_invocations_id_fk": {
- "name": "tool_action_requests_invocation_id_tool_invocations_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "tool_invocations",
- "columnsFrom": [
- "invocation_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_action_requests_issue_id_issues_id_fk": {
- "name": "tool_action_requests_issue_id_issues_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_action_requests_interaction_id_issue_thread_interactions_id_fk": {
- "name": "tool_action_requests_interaction_id_issue_thread_interactions_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "issue_thread_interactions",
- "columnsFrom": [
- "interaction_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_action_requests_approval_id_approvals_id_fk": {
- "name": "tool_action_requests_approval_id_approvals_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "approvals",
- "columnsFrom": [
- "approval_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_action_requests_requested_by_agent_id_agents_id_fk": {
- "name": "tool_action_requests_requested_by_agent_id_agents_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "agents",
- "columnsFrom": [
- "requested_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_action_requests_resolved_by_agent_id_agents_id_fk": {
- "name": "tool_action_requests_resolved_by_agent_id_agents_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "agents",
- "columnsFrom": [
- "resolved_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_action_requests_decided_by_agent_id_agents_id_fk": {
- "name": "tool_action_requests_decided_by_agent_id_agents_id_fk",
- "tableFrom": "tool_action_requests",
- "tableTo": "agents",
- "columnsFrom": [
- "decided_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_applications": {
- "name": "tool_applications",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "application_key": {
- "name": "application_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "type": {
- "name": "type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "plugin_id": {
- "name": "plugin_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_user_id": {
- "name": "owner_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_applications_company_idx": {
- "name": "tool_applications_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_applications_company_status_idx": {
- "name": "tool_applications_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_applications_company_name_uq": {
- "name": "tool_applications_company_name_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_applications_company_key_uq": {
- "name": "tool_applications_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "application_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_applications_company_id_companies_id_fk": {
- "name": "tool_applications_company_id_companies_id_fk",
- "tableFrom": "tool_applications",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_applications_plugin_id_plugins_id_fk": {
- "name": "tool_applications_plugin_id_plugins_id_fk",
- "tableFrom": "tool_applications",
- "tableTo": "plugins",
- "columnsFrom": [
- "plugin_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_applications_owner_agent_id_agents_id_fk": {
- "name": "tool_applications_owner_agent_id_agents_id_fk",
- "tableFrom": "tool_applications",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_call_events": {
- "name": "tool_call_events",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "event_type": {
- "name": "event_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'system'"
- },
- "actor_id": {
- "name": "actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_id": {
- "name": "gateway_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_token_id": {
- "name": "gateway_token_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_public_id": {
- "name": "gateway_public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_type": {
- "name": "client_subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_id": {
- "name": "client_subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_name": {
- "name": "client_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "mcp_session_id": {
- "name": "mcp_session_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_entry_id": {
- "name": "catalog_entry_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "invocation_id": {
- "name": "invocation_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "action_request_id": {
- "name": "action_request_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_slot_id": {
- "name": "runtime_slot_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "tool_name": {
- "name": "tool_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decision": {
- "name": "decision",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "matched_policy_ids": {
- "name": "matched_policy_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "reason_code": {
- "name": "reason_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "policy_explanation": {
- "name": "policy_explanation",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "credential_scope_summary": {
- "name": "credential_scope_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "header_policy_summary": {
- "name": "header_policy_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "latency_ms": {
- "name": "latency_ms",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "arguments_summary": {
- "name": "arguments_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "request_hash": {
- "name": "request_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "request_summary": {
- "name": "request_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "result_hash": {
- "name": "result_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result_summary": {
- "name": "result_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "result_size_bytes": {
- "name": "result_size_bytes",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "redaction_plan": {
- "name": "redaction_plan",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "rate_limit_state": {
- "name": "rate_limit_state",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error_message": {
- "name": "error_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_call_events_company_created_idx": {
- "name": "tool_call_events_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_call_events_run_idx": {
- "name": "tool_call_events_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_call_events_issue_idx": {
- "name": "tool_call_events_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_call_events_invocation_idx": {
- "name": "tool_call_events_invocation_idx",
- "columns": [
- {
- "expression": "invocation_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_call_events_gateway_idx": {
- "name": "tool_call_events_gateway_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "gateway_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_call_events_company_id_companies_id_fk": {
- "name": "tool_call_events_company_id_companies_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_call_events_agent_id_agents_id_fk": {
- "name": "tool_call_events_agent_id_agents_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_run_id_heartbeat_runs_id_fk": {
- "name": "tool_call_events_run_id_heartbeat_runs_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_issue_id_issues_id_fk": {
- "name": "tool_call_events_issue_id_issues_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_gateway_id_tool_mcp_gateways_id_fk": {
- "name": "tool_call_events_gateway_id_tool_mcp_gateways_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_mcp_gateways",
- "columnsFrom": [
- "gateway_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
- "name": "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_mcp_gateway_tokens",
- "columnsFrom": [
- "gateway_token_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_application_id_tool_applications_id_fk": {
- "name": "tool_call_events_application_id_tool_applications_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_connection_id_tool_connections_id_fk": {
- "name": "tool_call_events_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk": {
- "name": "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_catalog_entries",
- "columnsFrom": [
- "catalog_entry_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_invocation_id_tool_invocations_id_fk": {
- "name": "tool_call_events_invocation_id_tool_invocations_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_invocations",
- "columnsFrom": [
- "invocation_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_action_request_id_tool_action_requests_id_fk": {
- "name": "tool_call_events_action_request_id_tool_action_requests_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_action_requests",
- "columnsFrom": [
- "action_request_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk": {
- "name": "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk",
- "tableFrom": "tool_call_events",
- "tableTo": "tool_runtime_slots",
- "columnsFrom": [
- "runtime_slot_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_catalog_entries": {
- "name": "tool_catalog_entries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "entry_kind": {
- "name": "entry_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'tool'"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "tool_name": {
- "name": "tool_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "title": {
- "name": "title",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "input_schema": {
- "name": "input_schema",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "output_schema": {
- "name": "output_schema",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "annotations": {
- "name": "annotations",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "risk_level": {
- "name": "risk_level",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'read'"
- },
- "is_read_only": {
- "name": "is_read_only",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "is_write": {
- "name": "is_write",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "is_destructive": {
- "name": "is_destructive",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "version": {
- "name": "version",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "version_hash": {
- "name": "version_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "schema_hash": {
- "name": "schema_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "first_seen_at": {
- "name": "first_seen_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "last_seen_at": {
- "name": "last_seen_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "reviewed_at": {
- "name": "reviewed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "reviewed_by_agent_id": {
- "name": "reviewed_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "reviewed_by_user_id": {
- "name": "reviewed_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "quarantined_at": {
- "name": "quarantined_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "quarantine_reason": {
- "name": "quarantine_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_catalog_entries_company_idx": {
- "name": "tool_catalog_entries_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_catalog_entries_application_idx": {
- "name": "tool_catalog_entries_application_idx",
- "columns": [
- {
- "expression": "application_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_catalog_entries_connection_idx": {
- "name": "tool_catalog_entries_connection_idx",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_catalog_entries_company_status_idx": {
- "name": "tool_catalog_entries_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_catalog_entries_connection_name_uq": {
- "name": "tool_catalog_entries_connection_name_uq",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_catalog_entries_company_id_companies_id_fk": {
- "name": "tool_catalog_entries_company_id_companies_id_fk",
- "tableFrom": "tool_catalog_entries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_catalog_entries_application_id_tool_applications_id_fk": {
- "name": "tool_catalog_entries_application_id_tool_applications_id_fk",
- "tableFrom": "tool_catalog_entries",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_catalog_entries_connection_id_tool_connections_id_fk": {
- "name": "tool_catalog_entries_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_catalog_entries",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk": {
- "name": "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk",
- "tableFrom": "tool_catalog_entries",
- "tableTo": "agents",
- "columnsFrom": [
- "reviewed_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_connection_app_snapshots": {
- "name": "tool_connection_app_snapshots",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "credential_key": {
- "name": "credential_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "toolkit": {
- "name": "toolkit",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "accounts": {
- "name": "accounts",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "checked_at": {
- "name": "checked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "error_at": {
- "name": "error_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "tool_connection_app_snapshots_owner_toolkit_uq": {
- "name": "tool_connection_app_snapshots_owner_toolkit_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "toolkit",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_connection_app_snapshots_company_id_companies_id_fk": {
- "name": "tool_connection_app_snapshots_company_id_companies_id_fk",
- "tableFrom": "tool_connection_app_snapshots",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_connection_app_snapshots_company_connection_fk": {
- "name": "tool_connection_app_snapshots_company_connection_fk",
- "tableFrom": "tool_connection_app_snapshots",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "company_id",
- "connection_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_connection_app_syncs": {
- "name": "tool_connection_app_syncs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "credential_key": {
- "name": "credential_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "lease_id": {
- "name": "lease_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "checked": {
- "name": "checked",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "total": {
- "name": "total",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "failed": {
- "name": "failed",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "last_completed_at": {
- "name": "last_completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_connection_app_syncs_owner_key_uq": {
- "name": "tool_connection_app_syncs_owner_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "credential_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_connection_app_syncs_company_id_companies_id_fk": {
- "name": "tool_connection_app_syncs_company_id_companies_id_fk",
- "tableFrom": "tool_connection_app_syncs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_connection_app_syncs_company_connection_fk": {
- "name": "tool_connection_app_syncs_company_connection_fk",
- "tableFrom": "tool_connection_app_syncs",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "company_id",
- "connection_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_connection_installs": {
- "name": "tool_connection_installs",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_connection_installs_company_target_idx": {
- "name": "tool_connection_installs_company_target_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_connection_installs_connection_idx": {
- "name": "tool_connection_installs_connection_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_connection_installs_target_uq": {
- "name": "tool_connection_installs_target_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_connection_installs_company_id_companies_id_fk": {
- "name": "tool_connection_installs_company_id_companies_id_fk",
- "tableFrom": "tool_connection_installs",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_connection_installs_connection_id_tool_connections_id_fk": {
- "name": "tool_connection_installs_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_connection_installs",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_connection_installs_created_by_agent_id_agents_id_fk": {
- "name": "tool_connection_installs_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_connection_installs",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "tool_connection_installs_target_type_check": {
- "name": "tool_connection_installs_target_type_check",
- "value": "\"tool_connection_installs\".\"target_type\" in ('company', 'agent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.tool_connections": {
- "name": "tool_connections",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "uid": {
- "name": "uid",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "connection_kind": {
- "name": "connection_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'managed'"
- },
- "connection_purpose": {
- "name": "connection_purpose",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'tool'"
- },
- "ownership": {
- "name": "ownership",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'customer'"
- },
- "transport": {
- "name": "transport",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "auth_kind": {
- "name": "auth_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'none'"
- },
- "credential_source": {
- "name": "credential_source",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip_vault'"
- },
- "external_credential": {
- "name": "external_credential",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "credential_policy": {
- "name": "credential_policy",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'shared'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'draft'"
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "agent_instructions": {
- "name": "agent_instructions",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "transport_config": {
- "name": "transport_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "credential_refs": {
- "name": "credential_refs",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "credential_secret_refs": {
- "name": "credential_secret_refs",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "health_status": {
- "name": "health_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unchecked'"
- },
- "health_message": {
- "name": "health_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "health_checked_at": {
- "name": "health_checked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_health_at": {
- "name": "last_health_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_catalog_refresh_at": {
- "name": "last_catalog_refresh_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_connections_company_idx": {
- "name": "tool_connections_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_connections_application_idx": {
- "name": "tool_connections_application_idx",
- "columns": [
- {
- "expression": "application_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_connections_company_enabled_idx": {
- "name": "tool_connections_company_enabled_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "enabled",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_connections_company_uid_uq": {
- "name": "tool_connections_company_uid_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "uid",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_connections_company_id_companies_id_fk": {
- "name": "tool_connections_company_id_companies_id_fk",
- "tableFrom": "tool_connections",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_connections_application_id_tool_applications_id_fk": {
- "name": "tool_connections_application_id_tool_applications_id_fk",
- "tableFrom": "tool_connections",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "tool_connections_created_by_agent_id_agents_id_fk": {
- "name": "tool_connections_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_connections",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "tool_connections_company_id_uq": {
- "name": "tool_connections_company_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "tool_connections_ownership_check": {
- "name": "tool_connections_ownership_check",
- "value": "\"tool_connections\".\"ownership\" in ('platform_shared', 'platform_provisioned', 'customer', 'dcr')"
- },
- "tool_connections_transport_check": {
- "name": "tool_connections_transport_check",
- "value": "\"tool_connections\".\"transport\" in ('mcp_remote', 'rest_api', 'local_stdio', 'chat_sdk', 'runtime_auth')"
- },
- "tool_connections_purpose_check": {
- "name": "tool_connections_purpose_check",
- "value": "\"tool_connections\".\"connection_purpose\" in ('tool', 'channel', 'ai')"
- },
- "tool_connections_channel_transport_check": {
- "name": "tool_connections_channel_transport_check",
- "value": "(\n (\"tool_connections\".\"connection_purpose\" = 'tool' and \"tool_connections\".\"transport\" not in ('chat_sdk', 'runtime_auth'))\n or\n (\"tool_connections\".\"connection_purpose\" = 'channel' and (\"tool_connections\".\"transport\" = 'chat_sdk' or (\"tool_connections\".\"transport\" = 'rest_api' and \"tool_connections\".\"config\"->>'provider' = 'agentmail')))\n or\n (\"tool_connections\".\"connection_purpose\" = 'ai' and \"tool_connections\".\"transport\" = 'runtime_auth')\n )"
- },
- "tool_connections_auth_kind_check": {
- "name": "tool_connections_auth_kind_check",
- "value": "\"tool_connections\".\"auth_kind\" in ('oauth', 'api_key', 'none')"
- },
- "tool_connections_credential_source_check": {
- "name": "tool_connections_credential_source_check",
- "value": "\"tool_connections\".\"credential_source\" in ('paperclip_vault', 'vercel_connect')"
- },
- "tool_connections_credential_source_one_of_check": {
- "name": "tool_connections_credential_source_one_of_check",
- "value": "(\n (\"tool_connections\".\"credential_source\" = 'paperclip_vault' and \"tool_connections\".\"external_credential\" is null)\n or\n (\"tool_connections\".\"credential_source\" = 'vercel_connect' and \"tool_connections\".\"external_credential\" is not null and jsonb_array_length(\"tool_connections\".\"credential_refs\") = 0 and jsonb_array_length(\"tool_connections\".\"credential_secret_refs\") = 0)\n )"
- },
- "tool_connections_credential_policy_check": {
- "name": "tool_connections_credential_policy_check",
- "value": "\"tool_connections\".\"credential_policy\" in ('shared', 'per_user', 'per_user_with_fallback', 'per_agent')"
- }
- },
- "isRLSEnabled": false
- },
- "public.tool_gateway_rate_limit_counters": {
- "name": "tool_gateway_rate_limit_counters",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "counter_key": {
- "name": "counter_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "window_start_at": {
- "name": "window_start_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "window_ms": {
- "name": "window_ms",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "limit": {
- "name": "limit",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "count": {
- "name": "count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "reset_at": {
- "name": "reset_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_gateway_rate_limit_counters_company_idx": {
- "name": "tool_gateway_rate_limit_counters_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_rate_limit_counters_window_uq": {
- "name": "tool_gateway_rate_limit_counters_window_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "counter_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_start_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_gateway_rate_limit_counters_company_id_companies_id_fk": {
- "name": "tool_gateway_rate_limit_counters_company_id_companies_id_fk",
- "tableFrom": "tool_gateway_rate_limit_counters",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_gateway_sessions": {
- "name": "tool_gateway_sessions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_id": {
- "name": "gateway_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_token_id": {
- "name": "gateway_token_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_public_id": {
- "name": "gateway_public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_type": {
- "name": "client_subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_id": {
- "name": "client_subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_name": {
- "name": "client_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "mcp_session_id": {
- "name": "mcp_session_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "token_hash": {
- "name": "token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_gateway_sessions_token_hash_uq": {
- "name": "tool_gateway_sessions_token_hash_uq",
- "columns": [
- {
- "expression": "token_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_sessions_company_agent_idx": {
- "name": "tool_gateway_sessions_company_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_sessions_company_expires_idx": {
- "name": "tool_gateway_sessions_company_expires_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_sessions_run_idx": {
- "name": "tool_gateway_sessions_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_sessions_issue_idx": {
- "name": "tool_gateway_sessions_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_gateway_sessions_gateway_idx": {
- "name": "tool_gateway_sessions_gateway_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "gateway_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_gateway_sessions_company_id_companies_id_fk": {
- "name": "tool_gateway_sessions_company_id_companies_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_agent_id_agents_id_fk": {
- "name": "tool_gateway_sessions_agent_id_agents_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_run_id_heartbeat_runs_id_fk": {
- "name": "tool_gateway_sessions_run_id_heartbeat_runs_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_issue_id_issues_id_fk": {
- "name": "tool_gateway_sessions_issue_id_issues_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_project_id_projects_id_fk": {
- "name": "tool_gateway_sessions_project_id_projects_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk": {
- "name": "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "tool_mcp_gateways",
- "columnsFrom": [
- "gateway_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
- "name": "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
- "tableFrom": "tool_gateway_sessions",
- "tableTo": "tool_mcp_gateway_tokens",
- "columnsFrom": [
- "gateway_token_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_invocations": {
- "name": "tool_invocations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "idempotency_key": {
- "name": "idempotency_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "actor_type": {
- "name": "actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'system'"
- },
- "actor_id": {
- "name": "actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_id": {
- "name": "gateway_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_token_id": {
- "name": "gateway_token_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "gateway_public_id": {
- "name": "gateway_public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_type": {
- "name": "client_subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_subject_id": {
- "name": "client_subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_name": {
- "name": "client_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "mcp_session_id": {
- "name": "mcp_session_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "correlation_id": {
- "name": "correlation_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_entry_id": {
- "name": "catalog_entry_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_version_hash": {
- "name": "catalog_version_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_schema_hash": {
- "name": "catalog_schema_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_type": {
- "name": "provider_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "application_key": {
- "name": "application_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "upstream_tool_name": {
- "name": "upstream_tool_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "risk_level": {
- "name": "risk_level",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "tool_name": {
- "name": "tool_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "arguments_hash": {
- "name": "arguments_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "arguments_summary": {
- "name": "arguments_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "policy_decision": {
- "name": "policy_decision",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "matched_policy_ids": {
- "name": "matched_policy_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "policy_explanation": {
- "name": "policy_explanation",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "credential_scope_summary": {
- "name": "credential_scope_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "header_policy_summary": {
- "name": "header_policy_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "approval_state": {
- "name": "approval_state",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'not_required'"
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "upstream_request_id": {
- "name": "upstream_request_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result_hash": {
- "name": "result_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "result_summary": {
- "name": "result_summary",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "result_size_bytes": {
- "name": "result_size_bytes",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "result_artifact_id": {
- "name": "result_artifact_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "error_code": {
- "name": "error_code",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "error_message": {
- "name": "error_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "completed_at": {
- "name": "completed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_invocations_company_created_idx": {
- "name": "tool_invocations_company_created_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_invocations_run_idx": {
- "name": "tool_invocations_run_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_invocations_issue_idx": {
- "name": "tool_invocations_issue_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_invocations_gateway_idx": {
- "name": "tool_invocations_gateway_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "gateway_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_invocations_company_idempotency_uq": {
- "name": "tool_invocations_company_idempotency_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "idempotency_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_invocations_company_id_companies_id_fk": {
- "name": "tool_invocations_company_id_companies_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_invocations_agent_id_agents_id_fk": {
- "name": "tool_invocations_agent_id_agents_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_issue_id_issues_id_fk": {
- "name": "tool_invocations_issue_id_issues_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_run_id_heartbeat_runs_id_fk": {
- "name": "tool_invocations_run_id_heartbeat_runs_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_gateway_id_tool_mcp_gateways_id_fk": {
- "name": "tool_invocations_gateway_id_tool_mcp_gateways_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "tool_mcp_gateways",
- "columnsFrom": [
- "gateway_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
- "name": "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "tool_mcp_gateway_tokens",
- "columnsFrom": [
- "gateway_token_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_application_id_tool_applications_id_fk": {
- "name": "tool_invocations_application_id_tool_applications_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_connection_id_tool_connections_id_fk": {
- "name": "tool_invocations_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk": {
- "name": "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk",
- "tableFrom": "tool_invocations",
- "tableTo": "tool_catalog_entries",
- "columnsFrom": [
- "catalog_entry_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_mcp_gateway_tokens": {
- "name": "tool_mcp_gateway_tokens",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "gateway_id": {
- "name": "gateway_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "token_hash": {
- "name": "token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "token_prefix": {
- "name": "token_prefix",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "subject_type": {
- "name": "subject_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'gateway_client'"
- },
- "subject_id": {
- "name": "subject_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "client_label": {
- "name": "client_label",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "owner_note": {
- "name": "owner_note",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "allowed_actions": {
- "name": "allowed_actions",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[\"tools/list\",\"tools/call\"]'::jsonb"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expiry_override_reason": {
- "name": "expiry_override_reason",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "expiry_override_by_user_id": {
- "name": "expiry_override_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "expiry_override_by_agent_id": {
- "name": "expiry_override_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "expiry_override_at": {
- "name": "expiry_override_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_mcp_gateway_tokens_token_hash_uq": {
- "name": "tool_mcp_gateway_tokens_token_hash_uq",
- "columns": [
- {
- "expression": "token_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateway_tokens_expiry_idx": {
- "name": "tool_mcp_gateway_tokens_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateway_tokens_gateway_idx": {
- "name": "tool_mcp_gateway_tokens_gateway_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "gateway_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateway_tokens_subject_idx": {
- "name": "tool_mcp_gateway_tokens_subject_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateway_tokens_company_expires_idx": {
- "name": "tool_mcp_gateway_tokens_company_expires_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_mcp_gateway_tokens_company_id_companies_id_fk": {
- "name": "tool_mcp_gateway_tokens_company_id_companies_id_fk",
- "tableFrom": "tool_mcp_gateway_tokens",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk": {
- "name": "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk",
- "tableFrom": "tool_mcp_gateway_tokens",
- "tableTo": "tool_mcp_gateways",
- "columnsFrom": [
- "gateway_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk": {
- "name": "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk",
- "tableFrom": "tool_mcp_gateway_tokens",
- "tableTo": "agents",
- "columnsFrom": [
- "expiry_override_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk": {
- "name": "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_mcp_gateway_tokens",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_mcp_gateways": {
- "name": "tool_mcp_gateways",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "gateway_public_id": {
- "name": "gateway_public_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'gw_' || replace(gen_random_uuid()::text, '-', '')"
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "display_slug": {
- "name": "display_slug",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "''"
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "profile_id": {
- "name": "profile_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "default_profile_mode": {
- "name": "default_profile_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'gateway_only'"
- },
- "context_scope_type": {
- "name": "context_scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'none'"
- },
- "context_scope_id": {
- "name": "context_scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "agent_id": {
- "name": "agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "approval_issue_id": {
- "name": "approval_issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "auth_config": {
- "name": "auth_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"version\":1,\"bearer\":{\"enabled\":true,\"tokenPrefix\":\"pcgw\",\"defaultTtlSeconds\":7776000,\"requireFiniteExpiry\":true,\"longLivedTokenRequiresOverride\":true},\"oauth\":{\"enabled\":false,\"reservedFor\":\"v1_5\",\"dynamicClientRegistration\":false,\"authorizationCodePkce\":false}}'::jsonb"
- },
- "header_policy": {
- "name": "header_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"version\":1,\"callerPassthrough\":{\"enabled\":false,\"allowedHeaders\":[]},\"staticHeaders\":[],\"generatedMetadata\":{\"enabled\":false,\"allowedHeaders\":[]},\"responseHeaders\":{\"forwardMcpRequiredHeaders\":true,\"forwardSafeCacheHeaders\":true}}'::jsonb"
- },
- "metadata_policy": {
- "name": "metadata_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"version\":1,\"forwardCompanyId\":false,\"forwardGatewayId\":false,\"forwardProjectId\":false,\"forwardIssueId\":false,\"forwardAgentId\":false,\"forwardRunId\":false,\"forwardCorrelationId\":true}'::jsonb"
- },
- "on_demand_tools_config": {
- "name": "on_demand_tools_config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{\"enabled\":false,\"searchToolName\":\"search_tools\",\"runToolName\":\"run_tool\"}'::jsonb"
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "archived_at": {
- "name": "archived_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_mcp_gateways_company_idx": {
- "name": "tool_mcp_gateways_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateways_company_status_idx": {
- "name": "tool_mcp_gateways_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateways_profile_idx": {
- "name": "tool_mcp_gateways_profile_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateways_public_id_uq": {
- "name": "tool_mcp_gateways_public_id_uq",
- "columns": [
- {
- "expression": "gateway_public_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateways_company_slug_uq": {
- "name": "tool_mcp_gateways_company_slug_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "slug",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_mcp_gateways_company_name_uq": {
- "name": "tool_mcp_gateways_company_name_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_mcp_gateways_company_id_companies_id_fk": {
- "name": "tool_mcp_gateways_company_id_companies_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_profile_id_tool_profiles_id_fk": {
- "name": "tool_mcp_gateways_profile_id_tool_profiles_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "tool_profiles",
- "columnsFrom": [
- "profile_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "restrict",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_agent_id_agents_id_fk": {
- "name": "tool_mcp_gateways_agent_id_agents_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "agents",
- "columnsFrom": [
- "agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_project_id_projects_id_fk": {
- "name": "tool_mcp_gateways_project_id_projects_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_issue_id_issues_id_fk": {
- "name": "tool_mcp_gateways_issue_id_issues_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_approval_issue_id_issues_id_fk": {
- "name": "tool_mcp_gateways_approval_issue_id_issues_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "issues",
- "columnsFrom": [
- "approval_issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_mcp_gateways_created_by_agent_id_agents_id_fk": {
- "name": "tool_mcp_gateways_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_mcp_gateways",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_oauth_states": {
- "name": "tool_oauth_states",
- "schema": "",
- "columns": {
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "code_verifier": {
- "name": "code_verifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "created_by_actor_type": {
- "name": "created_by_actor_type",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_actor_id": {
- "name": "created_by_actor_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_session_id": {
- "name": "created_by_session_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "subject_user_id": {
- "name": "subject_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "subject_agent_id": {
- "name": "subject_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "requested_scopes": {
- "name": "requested_scopes",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "return_to": {
- "name": "return_to",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "interaction_id": {
- "name": "interaction_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_oauth_states_company_idx": {
- "name": "tool_oauth_states_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_oauth_states_connection_idx": {
- "name": "tool_oauth_states_connection_idx",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_oauth_states_actor_idx": {
- "name": "tool_oauth_states_actor_idx",
- "columns": [
- {
- "expression": "created_by_actor_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "created_by_actor_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_oauth_states_subject_agent_idx": {
- "name": "tool_oauth_states_subject_agent_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "subject_agent_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_oauth_states_expires_at_idx": {
- "name": "tool_oauth_states_expires_at_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_oauth_states_company_id_companies_id_fk": {
- "name": "tool_oauth_states_company_id_companies_id_fk",
- "tableFrom": "tool_oauth_states",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_oauth_states_connection_id_tool_connections_id_fk": {
- "name": "tool_oauth_states_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_oauth_states",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_oauth_states_subject_agent_id_agents_id_fk": {
- "name": "tool_oauth_states_subject_agent_id_agents_id_fk",
- "tableFrom": "tool_oauth_states",
- "tableTo": "agents",
- "columnsFrom": [
- "subject_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_policies": {
- "name": "tool_policies",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "policy_type": {
- "name": "policy_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "priority": {
- "name": "priority",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 100
- },
- "enabled": {
- "name": "enabled",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "selectors": {
- "name": "selectors",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "conditions": {
- "name": "conditions",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "config": {
- "name": "config",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_policies_company_enabled_idx": {
- "name": "tool_policies_company_enabled_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "enabled",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_policies_company_type_idx": {
- "name": "tool_policies_company_type_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "policy_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_policies_company_name_uq": {
- "name": "tool_policies_company_name_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_policies_company_id_companies_id_fk": {
- "name": "tool_policies_company_id_companies_id_fk",
- "tableFrom": "tool_policies",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_policies_created_by_agent_id_agents_id_fk": {
- "name": "tool_policies_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_policies",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_profile_bindings": {
- "name": "tool_profile_bindings",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "profile_id": {
- "name": "profile_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "priority": {
- "name": "priority",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 100
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_profile_bindings_company_target_idx": {
- "name": "tool_profile_bindings_company_target_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profile_bindings_target_profile_uq": {
- "name": "tool_profile_bindings_target_profile_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_profile_bindings_company_id_companies_id_fk": {
- "name": "tool_profile_bindings_company_id_companies_id_fk",
- "tableFrom": "tool_profile_bindings",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_bindings_profile_id_tool_profiles_id_fk": {
- "name": "tool_profile_bindings_profile_id_tool_profiles_id_fk",
- "tableFrom": "tool_profile_bindings",
- "tableTo": "tool_profiles",
- "columnsFrom": [
- "profile_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_bindings_created_by_agent_id_agents_id_fk": {
- "name": "tool_profile_bindings_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_profile_bindings",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_profile_entries": {
- "name": "tool_profile_entries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "profile_id": {
- "name": "profile_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "selector_type": {
- "name": "selector_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "effect": {
- "name": "effect",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'include'"
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "catalog_entry_id": {
- "name": "catalog_entry_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "tool_name": {
- "name": "tool_name",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "risk_level": {
- "name": "risk_level",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "conditions": {
- "name": "conditions",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_profile_entries_company_profile_idx": {
- "name": "tool_profile_entries_company_profile_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profile_entries_application_idx": {
- "name": "tool_profile_entries_application_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "application_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profile_entries_connection_idx": {
- "name": "tool_profile_entries_connection_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profile_entries_catalog_entry_idx": {
- "name": "tool_profile_entries_catalog_entry_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "catalog_entry_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_profile_entries_company_id_companies_id_fk": {
- "name": "tool_profile_entries_company_id_companies_id_fk",
- "tableFrom": "tool_profile_entries",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_entries_profile_id_tool_profiles_id_fk": {
- "name": "tool_profile_entries_profile_id_tool_profiles_id_fk",
- "tableFrom": "tool_profile_entries",
- "tableTo": "tool_profiles",
- "columnsFrom": [
- "profile_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_entries_application_id_tool_applications_id_fk": {
- "name": "tool_profile_entries_application_id_tool_applications_id_fk",
- "tableFrom": "tool_profile_entries",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_entries_connection_id_tool_connections_id_fk": {
- "name": "tool_profile_entries_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_profile_entries",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk": {
- "name": "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk",
- "tableFrom": "tool_profile_entries",
- "tableTo": "tool_catalog_entries",
- "columnsFrom": [
- "catalog_entry_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_profiles": {
- "name": "tool_profiles",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "profile_key": {
- "name": "profile_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "default_action": {
- "name": "default_action",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'deny'"
- },
- "new_tools_reviewed_at": {
- "name": "new_tools_reviewed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_profiles_company_status_idx": {
- "name": "tool_profiles_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profiles_company_key_uq": {
- "name": "tool_profiles_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "profile_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_profiles_company_name_uq": {
- "name": "tool_profiles_company_name_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "name",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_profiles_company_id_companies_id_fk": {
- "name": "tool_profiles_company_id_companies_id_fk",
- "tableFrom": "tool_profiles",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_rate_limit_counters": {
- "name": "tool_rate_limit_counters",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "policy_id": {
- "name": "policy_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "counter_key": {
- "name": "counter_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_type": {
- "name": "scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "window_kind": {
- "name": "window_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "window_start_at": {
- "name": "window_start_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "limit": {
- "name": "limit",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "remaining": {
- "name": "remaining",
- "type": "integer",
- "primaryKey": false,
- "notNull": true
- },
- "reset_at": {
- "name": "reset_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_rate_limit_counters_company_idx": {
- "name": "tool_rate_limit_counters_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_rate_limit_counters_window_uq": {
- "name": "tool_rate_limit_counters_window_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "policy_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "counter_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_kind",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "window_start_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_rate_limit_counters_company_id_companies_id_fk": {
- "name": "tool_rate_limit_counters_company_id_companies_id_fk",
- "tableFrom": "tool_rate_limit_counters",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_rate_limit_counters_policy_id_tool_policies_id_fk": {
- "name": "tool_rate_limit_counters_policy_id_tool_policies_id_fk",
- "tableFrom": "tool_rate_limit_counters",
- "tableTo": "tool_policies",
- "columnsFrom": [
- "policy_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_runtime_metric_counters": {
- "name": "tool_runtime_metric_counters",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "metric": {
- "name": "metric",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "bucket_start_at": {
- "name": "bucket_start_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "count": {
- "name": "count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_runtime_metric_counters_company_metric_idx": {
- "name": "tool_runtime_metric_counters_company_metric_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "metric",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bucket_start_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_runtime_metric_counters_bucket_uq": {
- "name": "tool_runtime_metric_counters_bucket_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "metric",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "bucket_start_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_runtime_metric_counters_company_id_companies_id_fk": {
- "name": "tool_runtime_metric_counters_company_id_companies_id_fk",
- "tableFrom": "tool_runtime_metric_counters",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_runtime_slots": {
- "name": "tool_runtime_slots",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "application_id": {
- "name": "application_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "connection_id": {
- "name": "connection_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_workspace_id": {
- "name": "project_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "owner_scope_type": {
- "name": "owner_scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'connection'"
- },
- "owner_scope_id": {
- "name": "owner_scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "runtime_kind": {
- "name": "runtime_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_stdio'"
- },
- "slot_key": {
- "name": "slot_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'stopped'"
- },
- "reuse_key": {
- "name": "reuse_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "workspace_scope": {
- "name": "workspace_scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "credential_scope_hash": {
- "name": "credential_scope_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider_ref": {
- "name": "provider_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "process_id": {
- "name": "process_id",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "command_template_key": {
- "name": "command_template_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "health_status": {
- "name": "health_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unchecked'"
- },
- "health_message": {
- "name": "health_message",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "last_health_check_at": {
- "name": "last_health_check_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_started_at": {
- "name": "last_started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "stopped_at": {
- "name": "stopped_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "idle_expires_at": {
- "name": "idle_expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "idle_deadline_at": {
- "name": "idle_deadline_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "last_error": {
- "name": "last_error",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'{}'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_runtime_slots_company_idx": {
- "name": "tool_runtime_slots_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_runtime_slots_connection_idx": {
- "name": "tool_runtime_slots_connection_idx",
- "columns": [
- {
- "expression": "connection_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_runtime_slots_execution_workspace_idx": {
- "name": "tool_runtime_slots_execution_workspace_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_runtime_slots_slot_key_uq": {
- "name": "tool_runtime_slots_slot_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "slot_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_runtime_slots_company_id_companies_id_fk": {
- "name": "tool_runtime_slots_company_id_companies_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_runtime_slots_application_id_tool_applications_id_fk": {
- "name": "tool_runtime_slots_application_id_tool_applications_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "tool_applications",
- "columnsFrom": [
- "application_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_runtime_slots_connection_id_tool_connections_id_fk": {
- "name": "tool_runtime_slots_connection_id_tool_connections_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "tool_connections",
- "columnsFrom": [
- "connection_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk": {
- "name": "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "project_workspaces",
- "columnsFrom": [
- "project_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "tool_runtime_slots_issue_id_issues_id_fk": {
- "name": "tool_runtime_slots_issue_id_issues_id_fk",
- "tableFrom": "tool_runtime_slots",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.tool_stdio_command_templates": {
- "name": "tool_stdio_command_templates",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "template_key": {
- "name": "template_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "command": {
- "name": "command",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "args": {
- "name": "args",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "env_keys": {
- "name": "env_keys",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "tools": {
- "name": "tools",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "disabled_at": {
- "name": "disabled_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "tool_stdio_command_templates_company_idx": {
- "name": "tool_stdio_command_templates_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_stdio_command_templates_company_status_idx": {
- "name": "tool_stdio_command_templates_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "tool_stdio_command_templates_company_key_uq": {
- "name": "tool_stdio_command_templates_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "template_key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "tool_stdio_command_templates_company_id_companies_id_fk": {
- "name": "tool_stdio_command_templates_company_id_companies_id_fk",
- "tableFrom": "tool_stdio_command_templates",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "tool_stdio_command_templates_created_by_agent_id_agents_id_fk": {
- "name": "tool_stdio_command_templates_created_by_agent_id_agents_id_fk",
- "tableFrom": "tool_stdio_command_templates",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_inbox_agent_policies": {
- "name": "user_inbox_agent_policies",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "mode": {
- "name": "mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'open'"
- },
- "allowed_agent_ids": {
- "name": "allowed_agent_ids",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "user_inbox_agent_policies_company_user_uq": {
- "name": "user_inbox_agent_policies_company_user_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_inbox_agent_policies_allowed_agent_ids_idx": {
- "name": "user_inbox_agent_policies_allowed_agent_ids_idx",
- "columns": [
- {
- "expression": "allowed_agent_ids",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "gin",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_inbox_agent_policies_company_id_companies_id_fk": {
- "name": "user_inbox_agent_policies_company_id_companies_id_fk",
- "tableFrom": "user_inbox_agent_policies",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {
- "user_inbox_agent_policies_mode_check": {
- "name": "user_inbox_agent_policies_mode_check",
- "value": "\"user_inbox_agent_policies\".\"mode\" in ('open', 'allowlist', 'disabled')"
- }
- },
- "isRLSEnabled": false
- },
- "public.user_secret_declarations": {
- "name": "user_secret_declarations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_secret_definition_id": {
- "name": "user_secret_definition_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "target_type": {
- "name": "target_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "target_id": {
- "name": "target_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "config_path": {
- "name": "config_path",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "env_key": {
- "name": "env_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "version_selector": {
- "name": "version_selector",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'latest'"
- },
- "required": {
- "name": "required",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": true
- },
- "allow_missing_override": {
- "name": "allow_missing_override",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "label": {
- "name": "label",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "user_secret_declarations_company_idx": {
- "name": "user_secret_declarations_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_declarations_definition_idx": {
- "name": "user_secret_declarations_definition_idx",
- "columns": [
- {
- "expression": "user_secret_definition_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_declarations_target_idx": {
- "name": "user_secret_declarations_target_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_declarations_company_required_idx": {
- "name": "user_secret_declarations_company_required_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "required",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_declarations_target_path_uq": {
- "name": "user_secret_declarations_target_path_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_type",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "target_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "config_path",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_declarations_required_override_idx": {
- "name": "user_secret_declarations_required_override_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "allow_missing_override",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "where": "\"user_secret_declarations\".\"allow_missing_override\" = true",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_secret_declarations_company_id_companies_id_fk": {
- "name": "user_secret_declarations_company_id_companies_id_fk",
- "tableFrom": "user_secret_declarations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk": {
- "name": "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk",
- "tableFrom": "user_secret_declarations",
- "tableTo": "user_secret_definitions",
- "columnsFrom": [
- "user_secret_definition_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_secret_definitions": {
- "name": "user_secret_definitions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "key": {
- "name": "key",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'active'"
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'local_encrypted'"
- },
- "managed_mode": {
- "name": "managed_mode",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'paperclip_managed'"
- },
- "provider_config_id": {
- "name": "provider_config_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "provider_metadata": {
- "name": "provider_metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "usage_guidance": {
- "name": "usage_guidance",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_agent_id": {
- "name": "created_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_by_user_id": {
- "name": "created_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_agent_id": {
- "name": "updated_by_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "updated_by_user_id": {
- "name": "updated_by_user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "user_secret_definitions_company_status_idx": {
- "name": "user_secret_definitions_company_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_definitions_company_provider_idx": {
- "name": "user_secret_definitions_company_provider_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "provider",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_definitions_provider_config_idx": {
- "name": "user_secret_definitions_provider_config_idx",
- "columns": [
- {
- "expression": "provider_config_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "user_secret_definitions_company_key_uq": {
- "name": "user_secret_definitions_company_key_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "key",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "where": "\"user_secret_definitions\".\"deleted_at\" is null",
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "user_secret_definitions_company_id_companies_id_fk": {
- "name": "user_secret_definitions_company_id_companies_id_fk",
- "tableFrom": "user_secret_definitions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk": {
- "name": "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk",
- "tableFrom": "user_secret_definitions",
- "tableTo": "company_secret_provider_configs",
- "columnsFrom": [
- "provider_config_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "user_secret_definitions_created_by_agent_id_agents_id_fk": {
- "name": "user_secret_definitions_created_by_agent_id_agents_id_fk",
- "tableFrom": "user_secret_definitions",
- "tableTo": "agents",
- "columnsFrom": [
- "created_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "user_secret_definitions_updated_by_agent_id_agents_id_fk": {
- "name": "user_secret_definitions_updated_by_agent_id_agents_id_fk",
- "tableFrom": "user_secret_definitions",
- "tableTo": "agents",
- "columnsFrom": [
- "updated_by_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.user_sidebar_preferences": {
- "name": "user_sidebar_preferences",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "company_order": {
- "name": "company_order",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[]'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "user_sidebar_preferences_user_uq": {
- "name": "user_sidebar_preferences_user_uq",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.work_assessments": {
- "name": "work_assessments",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "run_id": {
- "name": "run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "turn_id": {
- "name": "turn_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "contract_id": {
- "name": "contract_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "result_id": {
- "name": "result_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "trigger_kind": {
- "name": "trigger_kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "trigger_ref": {
- "name": "trigger_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "trigger_capability": {
- "name": "trigger_capability",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "trigger_actor_company_id": {
- "name": "trigger_actor_company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "prior_issue_status": {
- "name": "prior_issue_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "prior_status_version": {
- "name": "prior_status_version",
- "type": "bigint",
- "primaryKey": false,
- "notNull": true
- },
- "prior_decision_id": {
- "name": "prior_decision_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "policy_version": {
- "name": "policy_version",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "assessment_json": {
- "name": "assessment_json",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "input_digest": {
- "name": "input_digest",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "supersedes_assessment_id": {
- "name": "supersedes_assessment_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "work_assessments_company_issue_input_uq": {
- "name": "work_assessments_company_issue_input_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "input_digest",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "work_assessments_company_id_companies_id_fk": {
- "name": "work_assessments_company_id_companies_id_fk",
- "tableFrom": "work_assessments",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_trigger_actor_company_id_companies_id_fk": {
- "name": "work_assessments_trigger_actor_company_id_companies_id_fk",
- "tableFrom": "work_assessments",
- "tableTo": "companies",
- "columnsFrom": [
- "trigger_actor_company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_issue_company_fk": {
- "name": "work_assessments_issue_company_fk",
- "tableFrom": "work_assessments",
- "tableTo": "issues",
- "columnsFrom": [
- "company_id",
- "issue_id"
- ],
- "columnsTo": [
- "company_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_run_owner_fk": {
- "name": "work_assessments_run_owner_fk",
- "tableFrom": "work_assessments",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id"
- ],
- "columnsTo": [
- "company_id",
- "native_issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_contract_owner_fk": {
- "name": "work_assessments_contract_owner_fk",
- "tableFrom": "work_assessments",
- "tableTo": "completion_contracts",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "contract_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_result_owner_fk": {
- "name": "work_assessments_result_owner_fk",
- "tableFrom": "work_assessments",
- "tableTo": "native_run_results",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "result_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "work_assessments_supersedes_owner_fk": {
- "name": "work_assessments_supersedes_owner_fk",
- "tableFrom": "work_assessments",
- "tableTo": "work_assessments",
- "columnsFrom": [
- "company_id",
- "issue_id",
- "run_id",
- "supersedes_assessment_id"
- ],
- "columnsTo": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {
- "work_assessments_company_issue_run_id_uq": {
- "name": "work_assessments_company_issue_run_id_uq",
- "nullsNotDistinct": false,
- "columns": [
- "company_id",
- "issue_id",
- "run_id",
- "id"
- ]
- }
- },
- "policies": {},
- "checkConstraints": {
- "work_assessments_trigger_actor_company_check": {
- "name": "work_assessments_trigger_actor_company_check",
- "value": "\"work_assessments\".\"trigger_actor_company_id\" = \"work_assessments\".\"company_id\""
- }
- },
- "isRLSEnabled": false
- },
- "public.workspace_operations": {
- "name": "workspace_operations",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "heartbeat_run_id": {
- "name": "heartbeat_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "phase": {
- "name": "phase",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "command": {
- "name": "command",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "cwd": {
- "name": "cwd",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'running'"
- },
- "exit_code": {
- "name": "exit_code",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "log_store": {
- "name": "log_store",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_ref": {
- "name": "log_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_bytes": {
- "name": "log_bytes",
- "type": "bigint",
- "primaryKey": false,
- "notNull": false
- },
- "log_sha256": {
- "name": "log_sha256",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "log_compressed": {
- "name": "log_compressed",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
- "stdout_excerpt": {
- "name": "stdout_excerpt",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "stderr_excerpt": {
- "name": "stderr_excerpt",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "metadata": {
- "name": "metadata",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "workspace_operations_company_run_started_idx": {
- "name": "workspace_operations_company_run_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "heartbeat_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_operations_company_workspace_started_idx": {
- "name": "workspace_operations_company_workspace_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_operations_company_workspace_issue_started_idx": {
- "name": "workspace_operations_company_workspace_issue_started_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "issue_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "started_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_operations_company_id_companies_id_fk": {
- "name": "workspace_operations_company_id_companies_id_fk",
- "tableFrom": "workspace_operations",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "workspace_operations_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "workspace_operations_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "workspace_operations",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk": {
- "name": "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk",
- "tableFrom": "workspace_operations",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "heartbeat_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_operations_issue_id_issues_id_fk": {
- "name": "workspace_operations_issue_id_issues_id_fk",
- "tableFrom": "workspace_operations",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.workspace_runtime_services": {
- "name": "workspace_runtime_services",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "project_id": {
- "name": "project_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "project_workspace_id": {
- "name": "project_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "execution_workspace_id": {
- "name": "execution_workspace_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "issue_id": {
- "name": "issue_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "scope_type": {
- "name": "scope_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scope_id": {
- "name": "scope_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "service_name": {
- "name": "service_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "lifecycle": {
- "name": "lifecycle",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "reuse_key": {
- "name": "reuse_key",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "command": {
- "name": "command",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "cwd": {
- "name": "cwd",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "port": {
- "name": "port",
- "type": "integer",
- "primaryKey": false,
- "notNull": false
- },
- "url": {
- "name": "url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "provider": {
- "name": "provider",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "provider_ref": {
- "name": "provider_ref",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "owner_agent_id": {
- "name": "owner_agent_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "started_by_run_id": {
- "name": "started_by_run_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "last_used_at": {
- "name": "last_used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "started_at": {
- "name": "started_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "stopped_at": {
- "name": "stopped_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "stop_policy": {
- "name": "stop_policy",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "exposure": {
- "name": "exposure",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "exposure_handle": {
- "name": "exposure_handle",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "backend_url": {
- "name": "backend_url",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "health_status": {
- "name": "health_status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'unknown'"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "updated_at": {
- "name": "updated_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "workspace_runtime_services_company_workspace_status_idx": {
- "name": "workspace_runtime_services_company_workspace_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_runtime_services_company_execution_workspace_status_idx": {
- "name": "workspace_runtime_services_company_execution_workspace_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "execution_workspace_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_runtime_services_company_project_status_idx": {
- "name": "workspace_runtime_services_company_project_status_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "project_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "status",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_runtime_services_run_idx": {
- "name": "workspace_runtime_services_run_idx",
- "columns": [
- {
- "expression": "started_by_run_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "workspace_runtime_services_company_updated_idx": {
- "name": "workspace_runtime_services_company_updated_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "updated_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "workspace_runtime_services_company_id_companies_id_fk": {
- "name": "workspace_runtime_services_company_id_companies_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "no action",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_project_id_projects_id_fk": {
- "name": "workspace_runtime_services_project_id_projects_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "projects",
- "columnsFrom": [
- "project_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk": {
- "name": "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "project_workspaces",
- "columnsFrom": [
- "project_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk": {
- "name": "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "execution_workspaces",
- "columnsFrom": [
- "execution_workspace_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_issue_id_issues_id_fk": {
- "name": "workspace_runtime_services_issue_id_issues_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "issues",
- "columnsFrom": [
- "issue_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_owner_agent_id_agents_id_fk": {
- "name": "workspace_runtime_services_owner_agent_id_agents_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "agents",
- "columnsFrom": [
- "owner_agent_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- },
- "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk": {
- "name": "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk",
- "tableFrom": "workspace_runtime_services",
- "tableTo": "heartbeat_runs",
- "columnsFrom": [
- "started_by_run_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_event_admissions": {
- "name": "mcp_event_admissions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "subscription_id": {
- "name": "subscription_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "reserves_subscription": {
- "name": "reserves_subscription",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_event_admissions_expiry_idx": {
- "name": "mcp_event_admissions_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_event_admissions_grant_idx": {
- "name": "mcp_event_admissions_grant_idx",
- "columns": [
- {
- "expression": "grant_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_event_admissions_company_idx": {
- "name": "mcp_event_admissions_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_event_admissions_company_id_companies_id_fk": {
- "name": "mcp_event_admissions_company_id_companies_id_fk",
- "tableFrom": "mcp_event_admissions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_event_admissions_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_event_admissions_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_event_admissions",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_event_deliveries": {
- "name": "mcp_event_deliveries",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "subscription_id": {
- "name": "subscription_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "activity_id": {
- "name": "activity_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "event": {
- "name": "event",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "attempts": {
- "name": "attempts",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 0
- },
- "next_attempt_at": {
- "name": "next_attempt_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "finished_at": {
- "name": "finished_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "outcome": {
- "name": "outcome",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- }
- },
- "indexes": {
- "mcp_event_deliveries_activity_uq": {
- "name": "mcp_event_deliveries_activity_uq",
- "columns": [
- {
- "expression": "subscription_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "activity_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_event_deliveries_due_idx": {
- "name": "mcp_event_deliveries_due_idx",
- "columns": [
- {
- "expression": "next_attempt_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_event_deliveries_subscription_id_mcp_event_subscriptions_id_fk": {
- "name": "mcp_event_deliveries_subscription_id_mcp_event_subscriptions_id_fk",
- "tableFrom": "mcp_event_deliveries",
- "tableTo": "mcp_event_subscriptions",
- "columnsFrom": [
- "subscription_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_event_subscriptions": {
- "name": "mcp_event_subscriptions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "task_id": {
- "name": "task_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "arguments": {
- "name": "arguments",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "delivery_material": {
- "name": "delivery_material",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "verified_at": {
- "name": "verified_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "starts_at": {
- "name": "starts_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "stopped_at": {
- "name": "stopped_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "scanned_at": {
- "name": "scanned_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_event_subscriptions_expiry_idx": {
- "name": "mcp_event_subscriptions_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_event_subscriptions_company_idx": {
- "name": "mcp_event_subscriptions_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_event_subscriptions_company_id_companies_id_fk": {
- "name": "mcp_event_subscriptions_company_id_companies_id_fk",
- "tableFrom": "mcp_event_subscriptions",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_event_subscriptions_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_event_subscriptions_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_event_subscriptions",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_mutation_receipts": {
- "name": "mcp_mutation_receipts",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "operation": {
- "name": "operation",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "request_id": {
- "name": "request_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "arguments_hash": {
- "name": "arguments_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'reserved'"
- },
- "result": {
- "name": "result",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_mutation_receipts_request_uq": {
- "name": "mcp_mutation_receipts_request_uq",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "operation",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "request_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_mutation_receipts_company_idx": {
- "name": "mcp_mutation_receipts_company_idx",
- "columns": [
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_mutation_receipts_company_id_companies_id_fk": {
- "name": "mcp_mutation_receipts_company_id_companies_id_fk",
- "tableFrom": "mcp_mutation_receipts",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_mutation_receipts_user_id_user_id_fk": {
- "name": "mcp_mutation_receipts_user_id_user_id_fk",
- "tableFrom": "mcp_mutation_receipts",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_mutation_receipts_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_mutation_receipts_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_mutation_receipts",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_clients": {
- "name": "mcp_oauth_clients",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "registration_source_hash": {
- "name": "registration_source_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "redirect_uris": {
- "name": "redirect_uris",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "grant_types": {
- "name": "grant_types",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true,
- "default": "'[\"authorization_code\",\"refresh_token\"]'::jsonb"
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_device_requests": {
- "name": "mcp_oauth_device_requests",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "client_id": {
- "name": "client_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "device_code_hash": {
- "name": "device_code_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "user_code_hash": {
- "name": "user_code_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource": {
- "name": "resource",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scopes": {
- "name": "scopes",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "requested_company_id": {
- "name": "requested_company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "source_hash": {
- "name": "source_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "default": "'pending'"
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "interval_seconds": {
- "name": "interval_seconds",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "default": 5
- },
- "next_poll_at": {
- "name": "next_poll_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_oauth_device_code_uq": {
- "name": "mcp_oauth_device_code_uq",
- "columns": [
- {
- "expression": "device_code_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_user_code_uq": {
- "name": "mcp_oauth_user_code_uq",
- "columns": [
- {
- "expression": "user_code_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_device_expiry_idx": {
- "name": "mcp_oauth_device_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_oauth_device_requests_client_id_mcp_oauth_clients_id_fk": {
- "name": "mcp_oauth_device_requests_client_id_mcp_oauth_clients_id_fk",
- "tableFrom": "mcp_oauth_device_requests",
- "tableTo": "mcp_oauth_clients",
- "columnsFrom": [
- "client_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_oauth_device_requests_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_oauth_device_requests_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_oauth_device_requests",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_grants": {
- "name": "mcp_oauth_grants",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "company_id": {
- "name": "company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "client_id": {
- "name": "client_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource": {
- "name": "resource",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scopes": {
- "name": "scopes",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "revoked_at": {
- "name": "revoked_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_oauth_grants_user_company_idx": {
- "name": "mcp_oauth_grants_user_company_idx",
- "columns": [
- {
- "expression": "user_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- },
- {
- "expression": "company_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_oauth_grants_company_id_companies_id_fk": {
- "name": "mcp_oauth_grants_company_id_companies_id_fk",
- "tableFrom": "mcp_oauth_grants",
- "tableTo": "companies",
- "columnsFrom": [
- "company_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_oauth_grants_user_id_user_id_fk": {
- "name": "mcp_oauth_grants_user_id_user_id_fk",
- "tableFrom": "mcp_oauth_grants",
- "tableTo": "user",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_oauth_grants_client_id_mcp_oauth_clients_id_fk": {
- "name": "mcp_oauth_grants_client_id_mcp_oauth_clients_id_fk",
- "tableFrom": "mcp_oauth_grants",
- "tableTo": "mcp_oauth_clients",
- "columnsFrom": [
- "client_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_metadata_admissions": {
- "name": "mcp_oauth_metadata_admissions",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "source_hash": {
- "name": "source_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- }
- },
- "indexes": {
- "mcp_oauth_metadata_admissions_expiry_idx": {
- "name": "mcp_oauth_metadata_admissions_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_requests": {
- "name": "mcp_oauth_requests",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true
- },
- "client_id": {
- "name": "client_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "redirect_uri": {
- "name": "redirect_uri",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "resource": {
- "name": "resource",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "scopes": {
- "name": "scopes",
- "type": "jsonb",
- "primaryKey": false,
- "notNull": true
- },
- "state": {
- "name": "state",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "challenge": {
- "name": "challenge",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "requested_company_id": {
- "name": "requested_company_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": false
- },
- "code_hash": {
- "name": "code_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": false
- },
- "decided_at": {
- "name": "decided_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "consumed_at": {
- "name": "consumed_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_oauth_requests_code_uq": {
- "name": "mcp_oauth_requests_code_uq",
- "columns": [
- {
- "expression": "code_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_requests_expiry_idx": {
- "name": "mcp_oauth_requests_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_oauth_requests_client_id_mcp_oauth_clients_id_fk": {
- "name": "mcp_oauth_requests_client_id_mcp_oauth_clients_id_fk",
- "tableFrom": "mcp_oauth_requests",
- "tableTo": "mcp_oauth_clients",
- "columnsFrom": [
- "client_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- },
- "mcp_oauth_requests_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_oauth_requests_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_oauth_requests",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- },
- "public.mcp_oauth_tokens": {
- "name": "mcp_oauth_tokens",
- "schema": "",
- "columns": {
- "id": {
- "name": "id",
- "type": "uuid",
- "primaryKey": true,
- "notNull": true,
- "default": "gen_random_uuid()"
- },
- "grant_id": {
- "name": "grant_id",
- "type": "uuid",
- "primaryKey": false,
- "notNull": true
- },
- "token_hash": {
- "name": "token_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "kind": {
- "name": "kind",
- "type": "text",
- "primaryKey": false,
- "notNull": true
- },
- "used_at": {
- "name": "used_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true
- },
- "created_at": {
- "name": "created_at",
- "type": "timestamp with time zone",
- "primaryKey": false,
- "notNull": true,
- "default": "now()"
- }
- },
- "indexes": {
- "mcp_oauth_tokens_hash_uq": {
- "name": "mcp_oauth_tokens_hash_uq",
- "columns": [
- {
- "expression": "token_hash",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": true,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_tokens_grant_idx": {
- "name": "mcp_oauth_tokens_grant_idx",
- "columns": [
- {
- "expression": "grant_id",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- },
- "mcp_oauth_tokens_expiry_idx": {
- "name": "mcp_oauth_tokens_expiry_idx",
- "columns": [
- {
- "expression": "expires_at",
- "isExpression": false,
- "asc": true,
- "nulls": "last"
- }
- ],
- "isUnique": false,
- "concurrently": false,
- "method": "btree",
- "with": {}
- }
- },
- "foreignKeys": {
- "mcp_oauth_tokens_grant_id_mcp_oauth_grants_id_fk": {
- "name": "mcp_oauth_tokens_grant_id_mcp_oauth_grants_id_fk",
- "tableFrom": "mcp_oauth_tokens",
- "tableTo": "mcp_oauth_grants",
- "columnsFrom": [
- "grant_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "no action"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "policies": {},
- "checkConstraints": {},
- "isRLSEnabled": false
- }
- },
- "enums": {},
- "schemas": {},
- "sequences": {
- "public.chat_telegram_draft_ids": {
- "name": "chat_telegram_draft_ids",
- "schema": "public",
- "increment": "1",
- "startWith": "1",
- "minValue": "1",
- "maxValue": "2147483647",
- "cache": "1",
- "cycle": false
- }
- },
- "roles": {},
- "policies": {},
- "views": {},
- "_meta": {
- "columns": {},
- "schemas": {},
- "tables": {}
- }
-}
\ No newline at end of file
diff --git a/packages/db/src/migrations/meta/0314_snapshot.json b/packages/db/src/migrations/meta/0314_snapshot.json
new file mode 100644
index 00000000000..52d8ef6d49a
--- /dev/null
+++ b/packages/db/src/migrations/meta/0314_snapshot.json
@@ -0,0 +1,54905 @@
+{
+ "id": "a1aefefe-8911-4583-9c52-7c658e46e9b4",
+ "prevId": "adf783f2-c391-4fd5-b93a-d85e6d3c60a0",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.accounting_runtime_baselines": {
+ "name": "accounting_runtime_baselines",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_cents": {
+ "name": "cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cached_input_tokens": {
+ "name": "cached_input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "accounting_runtime_baselines_company_idx": {
+ "name": "accounting_runtime_baselines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "accounting_runtime_baselines_agent_id_agents_id_fk": {
+ "name": "accounting_runtime_baselines_agent_id_agents_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "accounting_runtime_baselines_company_id_companies_id_fk": {
+ "name": "accounting_runtime_baselines_company_id_companies_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_invoice_lines": {
+ "name": "billing_invoice_lines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_id": {
+ "name": "invoice_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {
+ "billing_invoice_lines_identity_idx": {
+ "name": "billing_invoice_lines_identity_idx",
+ "columns": [
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "billing_invoice_lines_company_idx": {
+ "name": "billing_invoice_lines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "billing_invoice_lines_company_id_companies_id_fk": {
+ "name": "billing_invoice_lines_company_id_companies_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "billing_invoice_lines_invoice_id_billing_invoices_id_fk": {
+ "name": "billing_invoice_lines_invoice_id_billing_invoices_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "columnsFrom": [
+ "invoice_id"
+ ],
+ "tableTo": "billing_invoices",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "billing_invoice_lines_cost_event_id_cost_events_id_fk": {
+ "name": "billing_invoice_lines_cost_event_id_cost_events_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "tableTo": "cost_events",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_invoice_lines_amount_check": {
+ "name": "billing_invoice_lines_amount_check",
+ "value": "\"billing_invoice_lines\".\"amount_cents\" >= 0"
+ },
+ "billing_invoice_lines_kind_check": {
+ "name": "billing_invoice_lines_kind_check",
+ "value": "\"billing_invoice_lines\".\"kind\" in ('inference', 'fee', 'credit')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_invoices": {
+ "name": "billing_invoices",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "biller": {
+ "name": "biller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "imported_by": {
+ "name": "imported_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_invoices_identity_idx": {
+ "name": "billing_invoices_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "billing_invoices_company_id_companies_id_fk": {
+ "name": "billing_invoices_company_id_companies_id_fk",
+ "tableFrom": "billing_invoices",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.budget_reservations": {
+ "name": "budget_reservations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'held'"
+ },
+ "provider_started_at": {
+ "name": "provider_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "budget_reservations_run_idx": {
+ "name": "budget_reservations_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "budget_reservations_active_idx": {
+ "name": "budget_reservations_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"budget_reservations\".\"state\" = 'held'",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "budget_reservations_company_id_companies_id_fk": {
+ "name": "budget_reservations_company_id_companies_id_fk",
+ "tableFrom": "budget_reservations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "budget_reservations_run_id_heartbeat_runs_id_fk": {
+ "name": "budget_reservations_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "budget_reservations",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "budget_reservations_agent_id_agents_id_fk": {
+ "name": "budget_reservations_agent_id_agents_id_fk",
+ "tableFrom": "budget_reservations",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "budget_reservations_state_check": {
+ "name": "budget_reservations_state_check",
+ "value": "\"budget_reservations\".\"state\" in ('held', 'settled', 'released')"
+ },
+ "budget_reservations_amount_check": {
+ "name": "budget_reservations_amount_check",
+ "value": "\"budget_reservations\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cost_adjustments": {
+ "name": "cost_adjustments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_line_id": {
+ "name": "invoice_line_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_cents": {
+ "name": "previous_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "corrected_cents": {
+ "name": "corrected_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_status": {
+ "name": "previous_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_pricing": {
+ "name": "previous_pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cost_adjustments_receipt_idx": {
+ "name": "cost_adjustments_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_adjustments_event_idx": {
+ "name": "cost_adjustments_event_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_adjustments_invoice_line_idx": {
+ "name": "cost_adjustments_invoice_line_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_line_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "cost_adjustments_company_id_companies_id_fk": {
+ "name": "cost_adjustments_company_id_companies_id_fk",
+ "tableFrom": "cost_adjustments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "cost_adjustments_cost_event_id_cost_events_id_fk": {
+ "name": "cost_adjustments_cost_event_id_cost_events_id_fk",
+ "tableFrom": "cost_adjustments",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "tableTo": "cost_events",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk": {
+ "name": "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk",
+ "tableFrom": "cost_adjustments",
+ "columnsFrom": [
+ "invoice_line_id"
+ ],
+ "tableTo": "billing_invoice_lines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cost_adjustments_amount_check": {
+ "name": "cost_adjustments_amount_check",
+ "value": "\"cost_adjustments\".\"previous_cents\" >= 0 and \"cost_adjustments\".\"corrected_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.provider_billing_snapshots": {
+ "name": "provider_billing_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "provider_billing_snapshots_identity_idx": {
+ "name": "provider_billing_snapshots_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "day",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "provider_billing_snapshots_company_id_companies_id_fk": {
+ "name": "provider_billing_snapshots_company_id_companies_id_fk",
+ "tableFrom": "provider_billing_snapshots",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "provider_billing_snapshots_amount_check": {
+ "name": "provider_billing_snapshots_amount_check",
+ "value": "\"provider_billing_snapshots\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.run_usage_receipts": {
+ "name": "run_usage_receipts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_json": {
+ "name": "receipt_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "complete": {
+ "name": "complete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "run_usage_receipts_source_sequence_idx": {
+ "name": "run_usage_receipts_source_sequence_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sequence",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "run_usage_receipts_run_latest_idx": {
+ "name": "run_usage_receipts_run_latest_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "received_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "run_usage_receipts_company_id_companies_id_fk": {
+ "name": "run_usage_receipts_company_id_companies_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "run_usage_receipts_run_id_heartbeat_runs_id_fk": {
+ "name": "run_usage_receipts_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "run_usage_receipts_positive_sequence": {
+ "name": "run_usage_receipts_positive_sequence",
+ "value": "\"run_usage_receipts\".\"sequence\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.activity_log": {
+ "name": "activity_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entity_id": {
+ "name": "entity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "activity_log_company_created_idx": {
+ "name": "activity_log_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "activity_log_company_agent_created_idx": {
+ "name": "activity_log_company_agent_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "activity_log_company_responsible_user_created_idx": {
+ "name": "activity_log_company_responsible_user_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "activity_log_run_id_idx": {
+ "name": "activity_log_run_id_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "activity_log_entity_type_id_idx": {
+ "name": "activity_log_entity_type_id_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "activity_log_company_id_companies_id_fk": {
+ "name": "activity_log_company_id_companies_id_fk",
+ "tableFrom": "activity_log",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "activity_log_agent_id_agents_id_fk": {
+ "name": "activity_log_agent_id_agents_id_fk",
+ "tableFrom": "activity_log",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "activity_log_run_id_heartbeat_runs_id_fk": {
+ "name": "activity_log_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "activity_log",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.adapter_auth_sessions": {
+ "name": "adapter_auth_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ai_connection": {
+ "name": "ai_connection",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_grant_id": {
+ "name": "connection_grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_method": {
+ "name": "connection_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "adapter_type": {
+ "name": "adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_by_user_id": {
+ "name": "started_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "public_session_id": {
+ "name": "public_session_id",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_lease_id": {
+ "name": "provider_lease_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'starting'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "promotion_expires_at": {
+ "name": "promotion_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bound_at": {
+ "name": "bound_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_claim": {
+ "name": "result_claim",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "adapter_auth_sessions_company_status_idx": {
+ "name": "adapter_auth_sessions_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "adapter_auth_sessions_company_owner_adapter_active_uq": {
+ "name": "adapter_auth_sessions_company_owner_adapter_active_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "adapter_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"adapter_auth_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'promoting', 'awaiting_code', 'submitting')",
+ "concurrently": false
+ },
+ "adapter_auth_sessions_public_session_id_uq": {
+ "name": "adapter_auth_sessions_public_session_id_uq",
+ "columns": [
+ {
+ "expression": "public_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "adapter_auth_sessions_environment_idx": {
+ "name": "adapter_auth_sessions_environment_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "adapter_auth_sessions_expires_idx": {
+ "name": "adapter_auth_sessions_expires_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "adapter_auth_sessions_provider_lease_idx": {
+ "name": "adapter_auth_sessions_provider_lease_idx",
+ "columns": [
+ {
+ "expression": "provider_lease_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "adapter_auth_sessions_company_id_companies_id_fk": {
+ "name": "adapter_auth_sessions_company_id_companies_id_fk",
+ "tableFrom": "adapter_auth_sessions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "adapter_auth_sessions_environment_id_environments_id_fk": {
+ "name": "adapter_auth_sessions_environment_id_environments_id_fk",
+ "tableFrom": "adapter_auth_sessions",
+ "columnsFrom": [
+ "environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_api_keys": {
+ "name": "agent_api_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_config": {
+ "name": "scope_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_api_keys_key_hash_idx": {
+ "name": "agent_api_keys_key_hash_idx",
+ "columns": [
+ {
+ "expression": "key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_api_keys_company_agent_idx": {
+ "name": "agent_api_keys_company_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_api_keys_agent_id_agents_id_fk": {
+ "name": "agent_api_keys_agent_id_agents_id_fk",
+ "tableFrom": "agent_api_keys",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_api_keys_company_id_companies_id_fk": {
+ "name": "agent_api_keys_company_id_companies_id_fk",
+ "tableFrom": "agent_api_keys",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_commentary": {
+ "name": "agent_commentary",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload_hash": {
+ "name": "payload_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_commentary_run_key_uq": {
+ "name": "agent_commentary_run_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_commentary_company_kind_created_idx": {
+ "name": "agent_commentary_company_kind_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_commentary_company_id_companies_id_fk": {
+ "name": "agent_commentary_company_id_companies_id_fk",
+ "tableFrom": "agent_commentary",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_commentary_agent_id_agents_id_fk": {
+ "name": "agent_commentary_agent_id_agents_id_fk",
+ "tableFrom": "agent_commentary",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_commentary_run_id_heartbeat_runs_id_fk": {
+ "name": "agent_commentary_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "agent_commentary",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_commentary_issue_id_issues_id_fk": {
+ "name": "agent_commentary_issue_id_issues_id_fk",
+ "tableFrom": "agent_commentary",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_commentary_kind_check": {
+ "name": "agent_commentary_kind_check",
+ "value": "\"agent_commentary\".\"kind\" in ('complaint', 'suggestion')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_config_revisions": {
+ "name": "agent_config_revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'patch'"
+ },
+ "rolled_back_from_revision_id": {
+ "name": "rolled_back_from_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changed_keys": {
+ "name": "changed_keys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "before_config": {
+ "name": "before_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "after_config": {
+ "name": "after_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_config_revisions_company_agent_created_idx": {
+ "name": "agent_config_revisions_company_agent_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_config_revisions_agent_created_idx": {
+ "name": "agent_config_revisions_agent_created_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_config_revisions_company_id_companies_id_fk": {
+ "name": "agent_config_revisions_company_id_companies_id_fk",
+ "tableFrom": "agent_config_revisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_config_revisions_agent_id_agents_id_fk": {
+ "name": "agent_config_revisions_agent_id_agents_id_fk",
+ "tableFrom": "agent_config_revisions",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_config_revisions_created_by_agent_id_agents_id_fk": {
+ "name": "agent_config_revisions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "agent_config_revisions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_identity_keys": {
+ "name": "agent_identity_keys",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "algorithm": {
+ "name": "algorithm",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_id": {
+ "name": "key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "public_key_pem": {
+ "name": "public_key_pem",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "private_key_material": {
+ "name": "private_key_material",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_identity_keys_owner_fk": {
+ "name": "agent_identity_keys_owner_fk",
+ "tableFrom": "agent_identity_keys",
+ "columnsFrom": [
+ "company_id",
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_identity_keys_algorithm_check": {
+ "name": "agent_identity_keys_algorithm_check",
+ "value": "\"agent_identity_keys\".\"algorithm\" = 'Ed25519'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_instruction_heads": {
+ "name": "agent_instruction_heads",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entry_file": {
+ "name": "entry_file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision_id": {
+ "name": "revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk": {
+ "name": "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk",
+ "tableFrom": "agent_instruction_heads",
+ "columnsFrom": [
+ "company_id",
+ "agent_id",
+ "entry_file",
+ "revision_id"
+ ],
+ "tableTo": "agent_instruction_revisions",
+ "columnsTo": [
+ "company_id",
+ "agent_id",
+ "entry_file",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_instruction_heads_identity_uq": {
+ "name": "agent_instruction_heads_identity_uq",
+ "columns": [
+ "company_id",
+ "agent_id",
+ "entry_file"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_instruction_revisions": {
+ "name": "agent_instruction_revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entry_file": {
+ "name": "entry_file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_base64": {
+ "name": "content_base64",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_length": {
+ "name": "byte_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_revision_id": {
+ "name": "parent_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_revision_id": {
+ "name": "base_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "restored_from_revision_id": {
+ "name": "restored_from_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_agent_id": {
+ "name": "actor_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_run_id": {
+ "name": "source_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_instruction_revisions_history_idx": {
+ "name": "agent_instruction_revisions_history_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entry_file",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk": {
+ "name": "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk",
+ "tableFrom": "agent_instruction_revisions",
+ "columnsFrom": [
+ "company_id",
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_instruction_revisions_identity_uq": {
+ "name": "agent_instruction_revisions_identity_uq",
+ "columns": [
+ "company_id",
+ "agent_id",
+ "entry_file",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_instruction_working_copies": {
+ "name": "agent_instruction_working_copies",
+ "schema": "",
+ "columns": {
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entry_file": {
+ "name": "entry_file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_revision_id": {
+ "name": "base_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_hash": {
+ "name": "base_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "local_root": {
+ "name": "local_root",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_root": {
+ "name": "execution_root",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'prepared'"
+ },
+ "candidate_base64": {
+ "name": "candidate_base64",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "candidate_hash": {
+ "name": "candidate_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt": {
+ "name": "receipt",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_stopped_at": {
+ "name": "process_stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_instruction_copies_pending_idx": {
+ "name": "agent_instruction_copies_pending_idx",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_instruction_copies_agent_idx": {
+ "name": "agent_instruction_copies_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk": {
+ "name": "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "agent_instruction_working_copies",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk": {
+ "name": "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk",
+ "tableFrom": "agent_instruction_working_copies",
+ "columnsFrom": [
+ "company_id",
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_memberships": {
+ "name": "agent_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'joined'"
+ },
+ "starred_at": {
+ "name": "starred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_memberships_company_user_idx": {
+ "name": "agent_memberships_company_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_memberships_company_user_starred_idx": {
+ "name": "agent_memberships_company_user_starred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "starred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_memberships_agent_idx": {
+ "name": "agent_memberships_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_memberships_company_user_agent_uq": {
+ "name": "agent_memberships_company_user_agent_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_memberships_company_id_companies_id_fk": {
+ "name": "agent_memberships_company_id_companies_id_fk",
+ "tableFrom": "agent_memberships",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "agent_memberships_agent_id_agents_id_fk": {
+ "name": "agent_memberships_agent_id_agents_id_fk",
+ "tableFrom": "agent_memberships",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_runtime_state": {
+ "name": "agent_runtime_state",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "adapter_type": {
+ "name": "adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_json": {
+ "name": "state_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_run_id": {
+ "name": "last_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_run_status": {
+ "name": "last_run_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_input_tokens": {
+ "name": "total_input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_output_tokens": {
+ "name": "total_output_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_cached_input_tokens": {
+ "name": "total_cached_input_tokens",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total_cost_cents": {
+ "name": "total_cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_runtime_state_company_agent_idx": {
+ "name": "agent_runtime_state_company_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_runtime_state_company_updated_idx": {
+ "name": "agent_runtime_state_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_runtime_state_agent_id_agents_id_fk": {
+ "name": "agent_runtime_state_agent_id_agents_id_fk",
+ "tableFrom": "agent_runtime_state",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_runtime_state_company_id_companies_id_fk": {
+ "name": "agent_runtime_state_company_id_companies_id_fk",
+ "tableFrom": "agent_runtime_state",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_session_goal_actions": {
+ "name": "agent_session_goal_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload_json": {
+ "name": "payload_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "result_json": {
+ "name": "result_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_session_goal_actions_session_request_uniq": {
+ "name": "agent_session_goal_actions_session_request_uniq",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_session_goal_actions_company_status_created_idx": {
+ "name": "agent_session_goal_actions_company_status_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_session_goal_actions_session_created_idx": {
+ "name": "agent_session_goal_actions_session_created_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_session_goal_actions_company_id_companies_id_fk": {
+ "name": "agent_session_goal_actions_company_id_companies_id_fk",
+ "tableFrom": "agent_session_goal_actions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_session_goal_actions_session_id_agent_task_sessions_id_fk": {
+ "name": "agent_session_goal_actions_session_id_agent_task_sessions_id_fk",
+ "tableFrom": "agent_session_goal_actions",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "tableTo": "agent_task_sessions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_task_sessions": {
+ "name": "agent_task_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "adapter_type": {
+ "name": "adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_key": {
+ "name": "task_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_params_json": {
+ "name": "session_params_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_display_id": {
+ "name": "session_display_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_run_id": {
+ "name": "last_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_capability_json": {
+ "name": "goal_capability_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_json": {
+ "name": "goal_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_status": {
+ "name": "goal_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_desired_state": {
+ "name": "goal_desired_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_source_id": {
+ "name": "goal_source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_source_cursor": {
+ "name": "goal_source_cursor",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_revision": {
+ "name": "goal_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "goal_observed_at": {
+ "name": "goal_observed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_task_sessions_company_agent_adapter_task_uniq": {
+ "name": "agent_task_sessions_company_agent_adapter_task_uniq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "adapter_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_task_sessions_company_agent_updated_idx": {
+ "name": "agent_task_sessions_company_agent_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_task_sessions_company_task_updated_idx": {
+ "name": "agent_task_sessions_company_task_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_task_sessions_company_id_companies_id_fk": {
+ "name": "agent_task_sessions_company_id_companies_id_fk",
+ "tableFrom": "agent_task_sessions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_task_sessions_agent_id_agents_id_fk": {
+ "name": "agent_task_sessions_agent_id_agents_id_fk",
+ "tableFrom": "agent_task_sessions",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_task_sessions_last_run_id_heartbeat_runs_id_fk": {
+ "name": "agent_task_sessions_last_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "agent_task_sessions",
+ "columnsFrom": [
+ "last_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_wakeup_requests": {
+ "name": "agent_wakeup_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger_detail": {
+ "name": "trigger_detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "coalesced_count": {
+ "name": "coalesced_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "requested_by_actor_type": {
+ "name": "requested_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_actor_id": {
+ "name": "requested_by_actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_at": {
+ "name": "requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_wakeup_requests_company_agent_status_idx": {
+ "name": "agent_wakeup_requests_company_agent_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_company_requested_idx": {
+ "name": "agent_wakeup_requests_company_requested_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requested_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_agent_requested_idx": {
+ "name": "agent_wakeup_requests_agent_requested_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requested_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_review_path_recovery_idempotency_uq": {
+ "name": "agent_wakeup_requests_review_path_recovery_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_review_path_lost:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_disposition_repair_idempotency_uq": {
+ "name": "agent_wakeup_requests_disposition_repair_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'issue_disposition_repair:%' AND \"agent_wakeup_requests\".\"status\" <> 'skipped'",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_question_response_delivery_idempotency_uq": {
+ "name": "agent_wakeup_requests_question_response_delivery_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "(\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'question-response:%' OR \"agent_wakeup_requests\".\"idempotency_key\" LIKE 'interaction:%') AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_connection_intent_delivery_idempotency_uq": {
+ "name": "agent_wakeup_requests_connection_intent_delivery_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'connection-intent:%' AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_tool_action_delivery_uq": {
+ "name": "agent_wakeup_requests_tool_action_delivery_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'tool-action-response:%' AND \"agent_wakeup_requests\".\"status\" NOT IN ('skipped', 'failed', 'cancelled')",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_chat_completion_uq": {
+ "name": "agent_wakeup_requests_chat_completion_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"agent_wakeup_requests\".\"idempotency_key\" LIKE 'chat-completion:%'",
+ "concurrently": false
+ },
+ "agent_wakeup_requests_company_payload_issue_idx": {
+ "name": "agent_wakeup_requests_company_payload_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "(\"payload\" ->> 'issueId')",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agent_wakeup_requests_company_id_companies_id_fk": {
+ "name": "agent_wakeup_requests_company_id_companies_id_fk",
+ "tableFrom": "agent_wakeup_requests",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agent_wakeup_requests_agent_id_agents_id_fk": {
+ "name": "agent_wakeup_requests_agent_id_agents_id_fk",
+ "tableFrom": "agent_wakeup_requests",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agents": {
+ "name": "agents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'general'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "appearance": {
+ "name": "appearance",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'idle'"
+ },
+ "reports_to": {
+ "name": "reports_to",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "adapter_type": {
+ "name": "adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'process'"
+ },
+ "adapter_config": {
+ "name": "adapter_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "runtime_config": {
+ "name": "runtime_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "default_environment_id": {
+ "name": "default_environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "budget_monthly_cents": {
+ "name": "budget_monthly_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spent_monthly_cents": {
+ "name": "spent_monthly_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "pause_reason": {
+ "name": "pause_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paused_at": {
+ "name": "paused_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_reason": {
+ "name": "error_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_heartbeat_at": {
+ "name": "last_heartbeat_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agents_company_status_idx": {
+ "name": "agents_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agents_company_reports_to_idx": {
+ "name": "agents_company_reports_to_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "reports_to",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "agents_company_default_environment_idx": {
+ "name": "agents_company_default_environment_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "default_environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "agents_company_id_companies_id_fk": {
+ "name": "agents_company_id_companies_id_fk",
+ "tableFrom": "agents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agents_reports_to_agents_id_fk": {
+ "name": "agents_reports_to_agents_id_fk",
+ "tableFrom": "agents",
+ "columnsFrom": [
+ "reports_to"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "agents_default_environment_id_environments_id_fk": {
+ "name": "agents_default_environment_id_environments_id_fk",
+ "tableFrom": "agents",
+ "columnsFrom": [
+ "default_environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agents_company_id_uq": {
+ "name": "agents_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_connection_defaults": {
+ "name": "ai_connection_defaults",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "method": {
+ "name": "method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_connection_defaults_owner_method_uq": {
+ "name": "ai_connection_defaults_owner_method_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "method",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "ai_connection_defaults_company_id_companies_id_fk": {
+ "name": "ai_connection_defaults_company_id_companies_id_fk",
+ "tableFrom": "ai_connection_defaults",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_defaults_company_grant_fk": {
+ "name": "ai_connection_defaults_company_grant_fk",
+ "tableFrom": "ai_connection_defaults",
+ "columnsFrom": [
+ "company_id",
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "ai_connection_defaults_provider_check": {
+ "name": "ai_connection_defaults_provider_check",
+ "value": "\"ai_connection_defaults\".\"provider\" in ('anthropic','openai','openrouter','xai','google')"
+ },
+ "ai_connection_defaults_method_check": {
+ "name": "ai_connection_defaults_method_check",
+ "value": "\"ai_connection_defaults\".\"method\" in ('subscription','api_key')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.ai_connection_pools": {
+ "name": "ai_connection_pools",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_key": {
+ "name": "plugin_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ai_connection_pools_id_tool_connections_id_fk": {
+ "name": "ai_connection_pools_id_tool_connections_id_fk",
+ "tableFrom": "ai_connection_pools",
+ "columnsFrom": [
+ "id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_pools_company_id_companies_id_fk": {
+ "name": "ai_connection_pools_company_id_companies_id_fk",
+ "tableFrom": "ai_connection_pools",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_pools_company_connection_fk": {
+ "name": "ai_connection_pools_company_connection_fk",
+ "tableFrom": "ai_connection_pools",
+ "columnsFrom": [
+ "company_id",
+ "id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ai_connection_pools_company_id_uq": {
+ "name": "ai_connection_pools_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_connection_router_cursors": {
+ "name": "ai_connection_router_cursors",
+ "schema": "",
+ "columns": {
+ "pool_id": {
+ "name": "pool_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_member_id": {
+ "name": "last_member_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "ai_connection_router_cursors_pool_id_ai_connection_pools_id_fk": {
+ "name": "ai_connection_router_cursors_pool_id_ai_connection_pools_id_fk",
+ "tableFrom": "ai_connection_router_cursors",
+ "columnsFrom": [
+ "pool_id"
+ ],
+ "tableTo": "ai_connection_pools",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_router_cursors_company_id_companies_id_fk": {
+ "name": "ai_connection_router_cursors_company_id_companies_id_fk",
+ "tableFrom": "ai_connection_router_cursors",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_router_cursors_company_pool_fk": {
+ "name": "ai_connection_router_cursors_company_pool_fk",
+ "tableFrom": "ai_connection_router_cursors",
+ "columnsFrom": [
+ "company_id",
+ "pool_id"
+ ],
+ "tableTo": "ai_connection_pools",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_connection_task_pins": {
+ "name": "ai_connection_task_pins",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pool_id": {
+ "name": "pool_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_key": {
+ "name": "task_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "selection": {
+ "name": "selection",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member": {
+ "name": "member",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_connection_task_pins_affinity_uq": {
+ "name": "ai_connection_task_pins_affinity_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pool_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "task_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "ai_connection_task_pins_company_id_companies_id_fk": {
+ "name": "ai_connection_task_pins_company_id_companies_id_fk",
+ "tableFrom": "ai_connection_task_pins",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_task_pins_pool_id_ai_connection_pools_id_fk": {
+ "name": "ai_connection_task_pins_pool_id_ai_connection_pools_id_fk",
+ "tableFrom": "ai_connection_task_pins",
+ "columnsFrom": [
+ "pool_id"
+ ],
+ "tableTo": "ai_connection_pools",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_task_pins_agent_id_agents_id_fk": {
+ "name": "ai_connection_task_pins_agent_id_agents_id_fk",
+ "tableFrom": "ai_connection_task_pins",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_task_pins_company_pool_fk": {
+ "name": "ai_connection_task_pins_company_pool_fk",
+ "tableFrom": "ai_connection_task_pins",
+ "columnsFrom": [
+ "company_id",
+ "pool_id"
+ ],
+ "tableTo": "ai_connection_pools",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_connection_task_pins_company_agent_fk": {
+ "name": "ai_connection_task_pins_company_agent_fk",
+ "tableFrom": "ai_connection_task_pins",
+ "columnsFrom": [
+ "company_id",
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_provider_defaults": {
+ "name": "ai_provider_defaults",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_provider_defaults_owner_provider_uq": {
+ "name": "ai_provider_defaults_owner_provider_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "ai_provider_defaults_company_id_companies_id_fk": {
+ "name": "ai_provider_defaults_company_id_companies_id_fk",
+ "tableFrom": "ai_provider_defaults",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "ai_provider_defaults_company_grant_fk": {
+ "name": "ai_provider_defaults_company_grant_fk",
+ "tableFrom": "ai_provider_defaults",
+ "columnsFrom": [
+ "company_id",
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "ai_provider_defaults_provider_check": {
+ "name": "ai_provider_defaults_provider_check",
+ "value": "\"ai_provider_defaults\".\"provider\" in ('anthropic','openai','openrouter','xai','google')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.announcement_dismissals": {
+ "name": "announcement_dismissals",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "announcement_id": {
+ "name": "announcement_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "announcement_dismissals_user_id_announcement_id_pk": {
+ "name": "announcement_dismissals_user_id_announcement_id_pk",
+ "columns": [
+ "user_id",
+ "announcement_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.announcement_publications": {
+ "name": "announcement_publications",
+ "schema": "",
+ "columns": {
+ "announcement_id": {
+ "name": "announcement_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.approval_comments": {
+ "name": "approval_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approval_id": {
+ "name": "approval_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_agent_id": {
+ "name": "author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "approval_comments_company_idx": {
+ "name": "approval_comments_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "approval_comments_approval_idx": {
+ "name": "approval_comments_approval_idx",
+ "columns": [
+ {
+ "expression": "approval_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "approval_comments_approval_created_idx": {
+ "name": "approval_comments_approval_created_idx",
+ "columns": [
+ {
+ "expression": "approval_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "approval_comments_company_id_companies_id_fk": {
+ "name": "approval_comments_company_id_companies_id_fk",
+ "tableFrom": "approval_comments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "approval_comments_approval_id_approvals_id_fk": {
+ "name": "approval_comments_approval_id_approvals_id_fk",
+ "tableFrom": "approval_comments",
+ "columnsFrom": [
+ "approval_id"
+ ],
+ "tableTo": "approvals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "approval_comments_author_agent_id_agents_id_fk": {
+ "name": "approval_comments_author_agent_id_agents_id_fk",
+ "tableFrom": "approval_comments",
+ "columnsFrom": [
+ "author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.approvals": {
+ "name": "approvals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_by_agent_id": {
+ "name": "requested_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_user_id": {
+ "name": "requested_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_note": {
+ "name": "decision_note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_by_user_id": {
+ "name": "decided_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "approvals_company_status_type_idx": {
+ "name": "approvals_company_status_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "approvals_company_id_companies_id_fk": {
+ "name": "approvals_company_id_companies_id_fk",
+ "tableFrom": "approvals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "approvals_requested_by_agent_id_agents_id_fk": {
+ "name": "approvals_requested_by_agent_id_agents_id_fk",
+ "tableFrom": "approvals",
+ "columnsFrom": [
+ "requested_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.assets": {
+ "name": "assets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_size": {
+ "name": "byte_size",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sha256": {
+ "name": "sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_filename": {
+ "name": "original_filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "assets_company_created_idx": {
+ "name": "assets_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "assets_company_provider_idx": {
+ "name": "assets_company_provider_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "assets_company_object_key_uq": {
+ "name": "assets_company_object_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "assets_company_id_companies_id_fk": {
+ "name": "assets_company_id_companies_id_fk",
+ "tableFrom": "assets",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "assets_created_by_agent_id_agents_id_fk": {
+ "name": "assets_created_by_agent_id_agents_id_fk",
+ "tableFrom": "assets",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issuer": {
+ "name": "issuer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_issuer_account_id_uq": {
+ "name": "account_issuer_account_id_uq",
+ "columns": [
+ {
+ "expression": "issuer",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.board_api_keys": {
+ "name": "board_api_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "board_api_keys_key_hash_idx": {
+ "name": "board_api_keys_key_hash_idx",
+ "columns": [
+ {
+ "expression": "key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "board_api_keys_user_idx": {
+ "name": "board_api_keys_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "board_api_keys_user_id_user_id_fk": {
+ "name": "board_api_keys_user_id_user_id_fk",
+ "tableFrom": "board_api_keys",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.browser_use_browsers": {
+ "name": "browser_use_browsers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_browser_id": {
+ "name": "provider_browser_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "browser_use_browsers_provider_uq": {
+ "name": "browser_use_browsers_provider_uq",
+ "columns": [
+ {
+ "expression": "provider_browser_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "browser_use_browsers_session_idx": {
+ "name": "browser_use_browsers_session_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "browser_use_browsers_company_id_companies_id_fk": {
+ "name": "browser_use_browsers_company_id_companies_id_fk",
+ "tableFrom": "browser_use_browsers",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_browsers_session_id_browser_use_sessions_id_fk": {
+ "name": "browser_use_browsers_session_id_browser_use_sessions_id_fk",
+ "tableFrom": "browser_use_browsers",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "tableTo": "browser_use_sessions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.browser_use_runs": {
+ "name": "browser_use_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invocation_id": {
+ "name": "invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_run_id": {
+ "name": "provider_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recovery_cursor": {
+ "name": "recovery_cursor",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'creating'"
+ },
+ "detached_until": {
+ "name": "detached_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_cursor": {
+ "name": "event_cursor",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "events_drained": {
+ "name": "events_drained",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "accounted_cents": {
+ "name": "accounted_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "progress": {
+ "name": "progress",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "browser_use_runs_invocation_uq": {
+ "name": "browser_use_runs_invocation_uq",
+ "columns": [
+ {
+ "expression": "invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "browser_use_runs_provider_uq": {
+ "name": "browser_use_runs_provider_uq",
+ "columns": [
+ {
+ "expression": "provider_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "browser_use_runs_session_idx": {
+ "name": "browser_use_runs_session_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "browser_use_runs_company_id_companies_id_fk": {
+ "name": "browser_use_runs_company_id_companies_id_fk",
+ "tableFrom": "browser_use_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_runs_session_id_browser_use_sessions_id_fk": {
+ "name": "browser_use_runs_session_id_browser_use_sessions_id_fk",
+ "tableFrom": "browser_use_runs",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "tableTo": "browser_use_sessions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "browser_use_runs",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.browser_use_sessions": {
+ "name": "browser_use_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_session_id": {
+ "name": "provider_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'starting'"
+ },
+ "idle_deadline": {
+ "name": "idle_deadline",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stop_requested": {
+ "name": "stop_requested",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_until": {
+ "name": "lease_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_poll_at": {
+ "name": "next_poll_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "browser_use_sessions_task_idx": {
+ "name": "browser_use_sessions_task_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "browser_use_sessions_provider_uq": {
+ "name": "browser_use_sessions_provider_uq",
+ "columns": [
+ {
+ "expression": "provider_session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "browser_use_sessions_company_id_companies_id_fk": {
+ "name": "browser_use_sessions_company_id_companies_id_fk",
+ "tableFrom": "browser_use_sessions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_sessions_issue_id_issues_id_fk": {
+ "name": "browser_use_sessions_issue_id_issues_id_fk",
+ "tableFrom": "browser_use_sessions",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_sessions_agent_id_agents_id_fk": {
+ "name": "browser_use_sessions_agent_id_agents_id_fk",
+ "tableFrom": "browser_use_sessions",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_sessions_connection_id_tool_connections_id_fk": {
+ "name": "browser_use_sessions_connection_id_tool_connections_id_fk",
+ "tableFrom": "browser_use_sessions",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_sessions_grant_id_connection_grants_id_fk": {
+ "name": "browser_use_sessions_grant_id_connection_grants_id_fk",
+ "tableFrom": "browser_use_sessions",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.browser_use_settings": {
+ "name": "browser_use_settings",
+ "schema": "",
+ "columns": {
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allowed_profile_ids": {
+ "name": "allowed_profile_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "max_cost_usd": {
+ "name": "max_cost_usd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "browser_use_settings_grant_id_connection_grants_id_fk": {
+ "name": "browser_use_settings_grant_id_connection_grants_id_fk",
+ "tableFrom": "browser_use_settings",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "browser_use_settings_company_id_companies_id_fk": {
+ "name": "browser_use_settings_company_id_companies_id_fk",
+ "tableFrom": "browser_use_settings",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.budget_incidents": {
+ "name": "budget_incidents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metric": {
+ "name": "metric",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_kind": {
+ "name": "window_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_start": {
+ "name": "window_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_end": {
+ "name": "window_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "threshold_type": {
+ "name": "threshold_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_limit": {
+ "name": "amount_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_observed": {
+ "name": "amount_observed",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "approval_id": {
+ "name": "approval_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "budget_incidents_company_status_idx": {
+ "name": "budget_incidents_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "budget_incidents_company_scope_idx": {
+ "name": "budget_incidents_company_scope_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "budget_incidents_policy_window_threshold_idx": {
+ "name": "budget_incidents_policy_window_threshold_idx",
+ "columns": [
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_start",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "threshold_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"budget_incidents\".\"status\" = 'open'",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "budget_incidents_company_id_companies_id_fk": {
+ "name": "budget_incidents_company_id_companies_id_fk",
+ "tableFrom": "budget_incidents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "budget_incidents_policy_id_budget_policies_id_fk": {
+ "name": "budget_incidents_policy_id_budget_policies_id_fk",
+ "tableFrom": "budget_incidents",
+ "columnsFrom": [
+ "policy_id"
+ ],
+ "tableTo": "budget_policies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "budget_incidents_approval_id_approvals_id_fk": {
+ "name": "budget_incidents_approval_id_approvals_id_fk",
+ "tableFrom": "budget_incidents",
+ "columnsFrom": [
+ "approval_id"
+ ],
+ "tableTo": "approvals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.budget_policies": {
+ "name": "budget_policies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metric": {
+ "name": "metric",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'billed_cents'"
+ },
+ "window_kind": {
+ "name": "window_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount": {
+ "name": "amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reservation_cents": {
+ "name": "reservation_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
+ "warn_percent": {
+ "name": "warn_percent",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 80
+ },
+ "hard_stop_enabled": {
+ "name": "hard_stop_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "unpriced_usage_policy": {
+ "name": "unpriced_usage_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'block'"
+ },
+ "notify_enabled": {
+ "name": "notify_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "enforcement_version": {
+ "name": "enforcement_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "enforcement_delivered_version": {
+ "name": "enforcement_delivered_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "budget_policies_company_scope_active_idx": {
+ "name": "budget_policies_company_scope_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "budget_policies_company_window_idx": {
+ "name": "budget_policies_company_window_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "metric",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "budget_policies_company_scope_metric_unique_idx": {
+ "name": "budget_policies_company_scope_metric_unique_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "metric",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "budget_policies_company_id_companies_id_fk": {
+ "name": "budget_policies_company_id_companies_id_fk",
+ "tableFrom": "budget_policies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "budget_policies_reservation_nonnegative": {
+ "name": "budget_policies_reservation_nonnegative",
+ "value": "\"budget_policies\".\"reservation_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.built_in_managed_resources": {
+ "name": "built_in_managed_resources",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bundle_key": {
+ "name": "bundle_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_kind": {
+ "name": "resource_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_key": {
+ "name": "resource_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stock_version": {
+ "name": "stock_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stock_hash": {
+ "name": "stock_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "defaults_json": {
+ "name": "defaults_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "built_in_managed_resources_company_idx": {
+ "name": "built_in_managed_resources_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "built_in_managed_resources_resource_idx": {
+ "name": "built_in_managed_resources_resource_idx",
+ "columns": [
+ {
+ "expression": "resource_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "built_in_managed_resources_company_bundle_resource_uq": {
+ "name": "built_in_managed_resources_company_bundle_resource_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bundle_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "built_in_managed_resources_company_id_companies_id_fk": {
+ "name": "built_in_managed_resources_company_id_companies_id_fk",
+ "tableFrom": "built_in_managed_resources",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.case_attachments": {
+ "name": "case_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "asset_id": {
+ "name": "asset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "case_attachments_company_case_idx": {
+ "name": "case_attachments_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_attachments_asset_uq": {
+ "name": "case_attachments_asset_uq",
+ "columns": [
+ {
+ "expression": "asset_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "case_attachments_company_id_companies_id_fk": {
+ "name": "case_attachments_company_id_companies_id_fk",
+ "tableFrom": "case_attachments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_attachments_case_id_cases_id_fk": {
+ "name": "case_attachments_case_id_cases_id_fk",
+ "tableFrom": "case_attachments",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_attachments_asset_id_assets_id_fk": {
+ "name": "case_attachments_asset_id_assets_id_fk",
+ "tableFrom": "case_attachments",
+ "columnsFrom": [
+ "asset_id"
+ ],
+ "tableTo": "assets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.case_documents": {
+ "name": "case_documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "case_documents_company_case_key_uq": {
+ "name": "case_documents_company_case_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_documents_document_uq": {
+ "name": "case_documents_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_documents_company_case_updated_idx": {
+ "name": "case_documents_company_case_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "case_documents_company_id_companies_id_fk": {
+ "name": "case_documents_company_id_companies_id_fk",
+ "tableFrom": "case_documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_documents_case_id_cases_id_fk": {
+ "name": "case_documents_case_id_cases_id_fk",
+ "tableFrom": "case_documents",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_documents_document_id_documents_id_fk": {
+ "name": "case_documents_document_id_documents_id_fk",
+ "tableFrom": "case_documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.case_events": {
+ "name": "case_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_agent_id": {
+ "name": "actor_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "case_events_case_created_idx": {
+ "name": "case_events_case_created_idx",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_events_company_case_idx": {
+ "name": "case_events_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "case_events_company_id_companies_id_fk": {
+ "name": "case_events_company_id_companies_id_fk",
+ "tableFrom": "case_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_events_case_id_cases_id_fk": {
+ "name": "case_events_case_id_cases_id_fk",
+ "tableFrom": "case_events",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_events_actor_agent_id_agents_id_fk": {
+ "name": "case_events_actor_agent_id_agents_id_fk",
+ "tableFrom": "case_events",
+ "columnsFrom": [
+ "actor_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "case_events_kind_check": {
+ "name": "case_events_kind_check",
+ "value": "\"case_events\".\"kind\" in (\n 'created',\n 'updated',\n 'fields_changed',\n 'status_changed',\n 'issue_linked',\n 'issue_unlinked',\n 'document_revised',\n 'child_linked',\n 'attachment_added',\n 'label_added',\n 'label_removed'\n )"
+ },
+ "case_events_actor_type_check": {
+ "name": "case_events_actor_type_check",
+ "value": "\"case_events\".\"actor_type\" in ('user', 'agent', 'system')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.case_issue_links": {
+ "name": "case_issue_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "case_issue_links_case_issue_uq": {
+ "name": "case_issue_links_case_issue_uq",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_issue_links_company_case_idx": {
+ "name": "case_issue_links_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_issue_links_issue_idx": {
+ "name": "case_issue_links_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "case_issue_links_company_id_companies_id_fk": {
+ "name": "case_issue_links_company_id_companies_id_fk",
+ "tableFrom": "case_issue_links",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_issue_links_case_id_cases_id_fk": {
+ "name": "case_issue_links_case_id_cases_id_fk",
+ "tableFrom": "case_issue_links",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_issue_links_issue_id_issues_id_fk": {
+ "name": "case_issue_links_issue_id_issues_id_fk",
+ "tableFrom": "case_issue_links",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "case_issue_links_role_check": {
+ "name": "case_issue_links_role_check",
+ "value": "\"case_issue_links\".\"role\" in ('origin', 'work', 'reference')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.case_labels": {
+ "name": "case_labels",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "case_labels_case_label_uq": {
+ "name": "case_labels_case_label_uq",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "label_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_labels_company_case_idx": {
+ "name": "case_labels_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "case_labels_label_idx": {
+ "name": "case_labels_label_idx",
+ "columns": [
+ {
+ "expression": "label_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "case_labels_company_id_companies_id_fk": {
+ "name": "case_labels_company_id_companies_id_fk",
+ "tableFrom": "case_labels",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_labels_case_id_cases_id_fk": {
+ "name": "case_labels_case_id_cases_id_fk",
+ "tableFrom": "case_labels",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "case_labels_label_id_labels_id_fk": {
+ "name": "case_labels_label_id_labels_id_fk",
+ "tableFrom": "case_labels",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "tableTo": "labels",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cases": {
+ "name": "cases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "case_number": {
+ "name": "case_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_type": {
+ "name": "case_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "fields": {
+ "name": "fields",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "parent_case_id": {
+ "name": "parent_case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cases_company_case_number_uq": {
+ "name": "cases_company_case_number_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_identifier_uq": {
+ "name": "cases_identifier_uq",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_company_type_key_uq": {
+ "name": "cases_company_type_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_company_status_idx": {
+ "name": "cases_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_company_type_idx": {
+ "name": "cases_company_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_company_project_idx": {
+ "name": "cases_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_parent_idx": {
+ "name": "cases_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cases_title_search_idx": {
+ "name": "cases_title_search_idx",
+ "columns": [
+ {
+ "expression": "title",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "cases_identifier_search_idx": {
+ "name": "cases_identifier_search_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "cases_summary_search_idx": {
+ "name": "cases_summary_search_idx",
+ "columns": [
+ {
+ "expression": "summary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "cases_company_id_companies_id_fk": {
+ "name": "cases_company_id_companies_id_fk",
+ "tableFrom": "cases",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "cases_project_id_projects_id_fk": {
+ "name": "cases_project_id_projects_id_fk",
+ "tableFrom": "cases",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "cases_parent_case_id_cases_id_fk": {
+ "name": "cases_parent_case_id_cases_id_fk",
+ "tableFrom": "cases",
+ "columnsFrom": [
+ "parent_case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "cases_created_by_agent_id_agents_id_fk": {
+ "name": "cases_created_by_agent_id_agents_id_fk",
+ "tableFrom": "cases",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cases_status_check": {
+ "name": "cases_status_check",
+ "value": "\"cases\".\"status\" in ('draft', 'in_progress', 'in_review', 'approved', 'done', 'cancelled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_actions": {
+ "name": "chat_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_id": {
+ "name": "delivery_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_action_id": {
+ "name": "provider_action_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_actions_provider_action_uq": {
+ "name": "chat_actions_provider_action_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_action_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_actions_company_id_companies_id_fk": {
+ "name": "chat_actions_company_id_companies_id_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_actions_delivery_id_chat_deliveries_id_fk": {
+ "name": "chat_actions_delivery_id_chat_deliveries_id_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "delivery_id"
+ ],
+ "tableTo": "chat_deliveries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_actions_company_delivery_fk": {
+ "name": "chat_actions_company_delivery_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "company_id",
+ "delivery_id"
+ ],
+ "tableTo": "chat_deliveries",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_actions_company_conversation_fk": {
+ "name": "chat_actions_company_conversation_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_actions_company_principal_fk": {
+ "name": "chat_actions_company_principal_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "company_id",
+ "principal_id"
+ ],
+ "tableTo": "chat_external_principals",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_actions_company_endpoint_fk": {
+ "name": "chat_actions_company_endpoint_fk",
+ "tableFrom": "chat_actions",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_agent_routes": {
+ "name": "chat_agent_routes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_endpoint_id": {
+ "name": "source_endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "destination_endpoint_id": {
+ "name": "destination_endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trigger_mode": {
+ "name": "trigger_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'explicit_mention'"
+ },
+ "max_hops": {
+ "name": "max_hops",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_agent_routes_pair_uq": {
+ "name": "chat_agent_routes_pair_uq",
+ "columns": [
+ {
+ "expression": "source_endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "destination_endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_agent_routes_company_id_companies_id_fk": {
+ "name": "chat_agent_routes_company_id_companies_id_fk",
+ "tableFrom": "chat_agent_routes",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_agent_routes_company_source_fk": {
+ "name": "chat_agent_routes_company_source_fk",
+ "tableFrom": "chat_agent_routes",
+ "columnsFrom": [
+ "company_id",
+ "source_endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_agent_routes_company_destination_fk": {
+ "name": "chat_agent_routes_company_destination_fk",
+ "tableFrom": "chat_agent_routes",
+ "columnsFrom": [
+ "company_id",
+ "destination_endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_agent_routes_hops_check": {
+ "name": "chat_agent_routes_hops_check",
+ "value": "\"chat_agent_routes\".\"max_hops\" between 1 and 8"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_conversations": {
+ "name": "chat_conversations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_conversation_id": {
+ "name": "external_conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_thread_id": {
+ "name": "external_thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "session_generation": {
+ "name": "session_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "external_label": {
+ "name": "external_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_url": {
+ "name": "provider_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_direct_message": {
+ "name": "is_direct_message",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "communication_guidance": {
+ "name": "communication_guidance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "last_activity_at": {
+ "name": "last_activity_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_conversations_issue_idx": {
+ "name": "chat_conversations_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_conversations_thread_uq": {
+ "name": "chat_conversations_thread_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "session_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_conversations_company_id_companies_id_fk": {
+ "name": "chat_conversations_company_id_companies_id_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_conversations_resource_id_chat_endpoint_resources_id_fk": {
+ "name": "chat_conversations_resource_id_chat_endpoint_resources_id_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "resource_id"
+ ],
+ "tableTo": "chat_endpoint_resources",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_conversations_issue_id_issues_id_fk": {
+ "name": "chat_conversations_issue_id_issues_id_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "chat_conversations_company_issue_fk": {
+ "name": "chat_conversations_company_issue_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_conversations_company_endpoint_fk": {
+ "name": "chat_conversations_company_endpoint_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_conversations_company_resource_fk": {
+ "name": "chat_conversations_company_resource_fk",
+ "tableFrom": "chat_conversations",
+ "columnsFrom": [
+ "company_id",
+ "resource_id"
+ ],
+ "tableTo": "chat_endpoint_resources",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_conversations_company_id_uq": {
+ "name": "chat_conversations_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_conversations_state_check": {
+ "name": "chat_conversations_state_check",
+ "value": "\"chat_conversations\".\"state\" in ('active', 'waiting', 'completed', 'unavailable', 'endpoint_removed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_deliveries": {
+ "name": "chat_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_event_id": {
+ "name": "provider_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deduplication_key": {
+ "name": "deduplication_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_kind": {
+ "name": "event_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_event": {
+ "name": "normalized_event",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "redacted_error": {
+ "name": "redacted_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_deliveries_work_idx": {
+ "name": "chat_deliveries_work_idx",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_deliveries_event_uq": {
+ "name": "chat_deliveries_event_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_deliveries_dedupe_uq": {
+ "name": "chat_deliveries_dedupe_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deduplication_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_deliveries_company_id_companies_id_fk": {
+ "name": "chat_deliveries_company_id_companies_id_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_deliveries_conversation_id_chat_conversations_id_fk": {
+ "name": "chat_deliveries_conversation_id_chat_conversations_id_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_deliveries_principal_id_chat_external_principals_id_fk": {
+ "name": "chat_deliveries_principal_id_chat_external_principals_id_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "principal_id"
+ ],
+ "tableTo": "chat_external_principals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_deliveries_company_endpoint_fk": {
+ "name": "chat_deliveries_company_endpoint_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_deliveries_company_conversation_fk": {
+ "name": "chat_deliveries_company_conversation_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_deliveries_company_principal_fk": {
+ "name": "chat_deliveries_company_principal_fk",
+ "tableFrom": "chat_deliveries",
+ "columnsFrom": [
+ "company_id",
+ "principal_id"
+ ],
+ "tableTo": "chat_external_principals",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_deliveries_company_id_uq": {
+ "name": "chat_deliveries_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_deliveries_state_check": {
+ "name": "chat_deliveries_state_check",
+ "value": "\"chat_deliveries\".\"state\" in ('received', 'filtered', 'processing', 'processed', 'retry', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_endpoint_leases": {
+ "name": "chat_endpoint_leases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lease_key": {
+ "name": "lease_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_endpoint_leases_active_uq": {
+ "name": "chat_endpoint_leases_active_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lease_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoint_leases_expiry_idx": {
+ "name": "chat_endpoint_leases_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_endpoint_leases_company_id_companies_id_fk": {
+ "name": "chat_endpoint_leases_company_id_companies_id_fk",
+ "tableFrom": "chat_endpoint_leases",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_endpoint_leases_company_endpoint_fk": {
+ "name": "chat_endpoint_leases_company_endpoint_fk",
+ "tableFrom": "chat_endpoint_leases",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_endpoint_resources": {
+ "name": "chat_endpoint_resources",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_resource_id": {
+ "name": "provider_resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_provider_resource_id": {
+ "name": "parent_provider_resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "detail": {
+ "name": "detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_url": {
+ "name": "provider_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "availability": {
+ "name": "availability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'available'"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_endpoint_resources_endpoint_idx": {
+ "name": "chat_endpoint_resources_endpoint_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoint_resources_external_uq": {
+ "name": "chat_endpoint_resources_external_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_endpoint_resources_company_id_companies_id_fk": {
+ "name": "chat_endpoint_resources_company_id_companies_id_fk",
+ "tableFrom": "chat_endpoint_resources",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_endpoint_resources_company_endpoint_fk": {
+ "name": "chat_endpoint_resources_company_endpoint_fk",
+ "tableFrom": "chat_endpoint_resources",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_endpoint_resources_company_id_uq": {
+ "name": "chat_endpoint_resources_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_endpoint_resources_availability_check": {
+ "name": "chat_endpoint_resources_availability_check",
+ "value": "\"chat_endpoint_resources\".\"availability\" in ('available', 'unavailable', 'removed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_endpoints": {
+ "name": "chat_endpoints",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "publication_mode": {
+ "name": "publication_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'automatic'"
+ },
+ "external_execution_policy": {
+ "name": "external_execution_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'restricted'"
+ },
+ "assigned_agent_id": {
+ "name": "assigned_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sponsor_user_id": {
+ "name": "sponsor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "deployment_mode": {
+ "name": "deployment_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'direct'"
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_account_label": {
+ "name": "provider_account_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_external_id": {
+ "name": "bot_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_username": {
+ "name": "bot_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_display_name": {
+ "name": "bot_display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_avatar_url": {
+ "name": "bot_avatar_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "communication_instructions": {
+ "name": "communication_instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "allow_direct_messages": {
+ "name": "allow_direct_messages",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "allow_group_chats": {
+ "name": "allow_group_chats",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "allow_unlinked_people": {
+ "name": "allow_unlinked_people",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "concurrency_policy": {
+ "name": "concurrency_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queue'"
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"threads\":false,\"directMessages\":false,\"nativeStreaming\":false,\"messageEdits\":false,\"messageDeletes\":false,\"reactions\":false,\"files\":false,\"cards\":false,\"actions\":false,\"modals\":false,\"slashCommands\":false,\"ephemeralMessages\":false,\"proactiveDirectMessages\":false}'::jsonb"
+ },
+ "setup": {
+ "name": "setup",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"step\":\"provider_setup\"}'::jsonb"
+ },
+ "health_message": {
+ "name": "health_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_event_at": {
+ "name": "last_event_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_publication_at": {
+ "name": "last_publication_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activated_at": {
+ "name": "activated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_endpoints_company_idx": {
+ "name": "chat_endpoints_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoints_agent_idx": {
+ "name": "chat_endpoints_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "assigned_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoints_status_idx": {
+ "name": "chat_endpoints_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoints_public_id_uq": {
+ "name": "chat_endpoints_public_id_uq",
+ "columns": [
+ {
+ "expression": "public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoints_agentmail_inbox_uq": {
+ "name": "chat_endpoints_agentmail_inbox_uq",
+ "columns": [
+ {
+ "expression": "bot_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"provider\" = 'agentmail' and \"chat_endpoints\".\"status\" != 'archived' and \"chat_endpoints\".\"bot_external_id\" is not null",
+ "concurrently": false
+ },
+ "chat_endpoints_connection_uq": {
+ "name": "chat_endpoints_connection_uq",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_endpoints_live_bot_external_uq": {
+ "name": "chat_endpoints_live_bot_external_uq",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bot_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"provider_account_id\" is not null\n and \"chat_endpoints\".\"bot_external_id\" is not null",
+ "concurrently": false
+ },
+ "chat_endpoints_photon_number_uq": {
+ "name": "chat_endpoints_photon_number_uq",
+ "columns": [
+ {
+ "expression": "bot_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"provider\" = 'imessage-photon' and \"chat_endpoints\".\"status\" <> 'archived' and \"chat_endpoints\".\"bot_external_id\" is not null",
+ "concurrently": false
+ },
+ "chat_endpoints_live_discord_bot_external_uq": {
+ "name": "chat_endpoints_live_discord_bot_external_uq",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bot_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"provider\" = 'discord'\n and \"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"bot_external_id\" is not null",
+ "concurrently": false
+ },
+ "chat_endpoints_live_global_app_bot_external_uq": {
+ "name": "chat_endpoints_live_global_app_bot_external_uq",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bot_external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"provider\" in ('github', 'microsoft-teams')\n and \"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"bot_external_id\" is not null",
+ "concurrently": false
+ },
+ "chat_endpoints_live_bot_username_uq": {
+ "name": "chat_endpoints_live_bot_username_uq",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bot_username",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"chat_endpoints\".\"status\" in ('verifying', 'active', 'paused', 'attention')\n and \"chat_endpoints\".\"provider_account_id\" is not null\n and \"chat_endpoints\".\"bot_username\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_endpoints_company_id_companies_id_fk": {
+ "name": "chat_endpoints_company_id_companies_id_fk",
+ "tableFrom": "chat_endpoints",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_endpoints_assigned_agent_id_agents_id_fk": {
+ "name": "chat_endpoints_assigned_agent_id_agents_id_fk",
+ "tableFrom": "chat_endpoints",
+ "columnsFrom": [
+ "assigned_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "chat_endpoints_company_agent_fk": {
+ "name": "chat_endpoints_company_agent_fk",
+ "tableFrom": "chat_endpoints",
+ "columnsFrom": [
+ "company_id",
+ "assigned_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_endpoints_company_connection_fk": {
+ "name": "chat_endpoints_company_connection_fk",
+ "tableFrom": "chat_endpoints",
+ "columnsFrom": [
+ "company_id",
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_endpoints_company_id_uq": {
+ "name": "chat_endpoints_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_endpoints_publication_mode_check": {
+ "name": "chat_endpoints_publication_mode_check",
+ "value": "\"chat_endpoints\".\"publication_mode\" in ('automatic', 'explicit')"
+ },
+ "chat_endpoints_execution_policy_check": {
+ "name": "chat_endpoints_execution_policy_check",
+ "value": "\"chat_endpoints\".\"external_execution_policy\" in ('restricted', 'agent')"
+ },
+ "chat_endpoints_email_policy_check": {
+ "name": "chat_endpoints_email_policy_check",
+ "value": "\"chat_endpoints\".\"provider\" <> 'agentmail' or (\"chat_endpoints\".\"publication_mode\" = 'explicit' and \"chat_endpoints\".\"external_execution_policy\" = 'agent')"
+ },
+ "chat_endpoints_provider_check": {
+ "name": "chat_endpoints_provider_check",
+ "value": "\"chat_endpoints\".\"provider\" in ('slack', 'github', 'discord', 'microsoft-teams', 'telegram', 'agentmail', 'imessage-photon')"
+ },
+ "chat_endpoints_status_check": {
+ "name": "chat_endpoints_status_check",
+ "value": "\"chat_endpoints\".\"status\" in ('draft', 'verifying', 'active', 'paused', 'attention', 'revoked', 'archived')"
+ },
+ "chat_endpoints_deployment_check": {
+ "name": "chat_endpoints_deployment_check",
+ "value": "\"chat_endpoints\".\"deployment_mode\" in ('direct', 'relay')"
+ },
+ "chat_endpoints_concurrency_check": {
+ "name": "chat_endpoints_concurrency_check",
+ "value": "\"chat_endpoints\".\"concurrency_policy\" in ('burst', 'queue', 'debounce', 'drop', 'concurrent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_external_principals": {
+ "name": "chat_external_principals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "handle": {
+ "name": "handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "avatar_url": {
+ "name": "avatar_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_bot": {
+ "name": "is_bot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_external_principals_company_idx": {
+ "name": "chat_external_principals_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_external_principals_external_uq": {
+ "name": "chat_external_principals_external_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_external_principals_company_id_companies_id_fk": {
+ "name": "chat_external_principals_company_id_companies_id_fk",
+ "tableFrom": "chat_external_principals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_external_principals_company_id_uq": {
+ "name": "chat_external_principals_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_external_principals_provider_check": {
+ "name": "chat_external_principals_provider_check",
+ "value": "\"chat_external_principals\".\"provider\" in ('slack', 'github', 'discord', 'microsoft-teams', 'telegram', 'agentmail', 'imessage-photon')"
+ },
+ "chat_external_principals_kind_check": {
+ "name": "chat_external_principals_kind_check",
+ "value": "\"chat_external_principals\".\"kind\" in ('user', 'bot', 'app', 'system')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_identity_links": {
+ "name": "chat_identity_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "paperclip_user_id": {
+ "name": "paperclip_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "confirmation_token_hash": {
+ "name": "confirmation_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmed_at": {
+ "name": "confirmed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_identity_links_user_idx": {
+ "name": "chat_identity_links_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "paperclip_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_identity_links_endpoint_principal_uq": {
+ "name": "chat_identity_links_endpoint_principal_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_identity_links_company_id_companies_id_fk": {
+ "name": "chat_identity_links_company_id_companies_id_fk",
+ "tableFrom": "chat_identity_links",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_identity_links_company_endpoint_fk": {
+ "name": "chat_identity_links_company_endpoint_fk",
+ "tableFrom": "chat_identity_links",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_identity_links_company_principal_fk": {
+ "name": "chat_identity_links_company_principal_fk",
+ "tableFrom": "chat_identity_links",
+ "columnsFrom": [
+ "company_id",
+ "principal_id"
+ ],
+ "tableTo": "chat_external_principals",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_identity_links_status_check": {
+ "name": "chat_identity_links_status_check",
+ "value": "\"chat_identity_links\".\"status\" in ('pending', 'linked', 'revoked', 'expired')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_message_links": {
+ "name": "chat_message_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_id": {
+ "name": "delivery_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "publication_id": {
+ "name": "publication_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_message_id": {
+ "name": "provider_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_message_links_provider_message_uq": {
+ "name": "chat_message_links_provider_message_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_message_links_company_id_companies_id_fk": {
+ "name": "chat_message_links_company_id_companies_id_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_message_links_delivery_id_chat_deliveries_id_fk": {
+ "name": "chat_message_links_delivery_id_chat_deliveries_id_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "delivery_id"
+ ],
+ "tableTo": "chat_deliveries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_message_links_publication_id_chat_publications_id_fk": {
+ "name": "chat_message_links_publication_id_chat_publications_id_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "publication_id"
+ ],
+ "tableTo": "chat_publications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_message_links_comment_id_issue_comments_id_fk": {
+ "name": "chat_message_links_comment_id_issue_comments_id_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_message_links_company_endpoint_fk": {
+ "name": "chat_message_links_company_endpoint_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_message_links_company_delivery_fk": {
+ "name": "chat_message_links_company_delivery_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id",
+ "delivery_id"
+ ],
+ "tableTo": "chat_deliveries",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_message_links_company_publication_fk": {
+ "name": "chat_message_links_company_publication_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id",
+ "publication_id"
+ ],
+ "tableTo": "chat_publications",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_message_links_company_comment_fk": {
+ "name": "chat_message_links_company_comment_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id",
+ "comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_message_links_company_conversation_fk": {
+ "name": "chat_message_links_company_conversation_fk",
+ "tableFrom": "chat_message_links",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_message_links_direction_check": {
+ "name": "chat_message_links_direction_check",
+ "value": "\"chat_message_links\".\"direction\" in ('inbound', 'outbound')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_publications": {
+ "name": "chat_publications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "provider_message_id": {
+ "name": "provider_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_url": {
+ "name": "provider_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "redacted_error": {
+ "name": "redacted_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_publications_company_id_uq": {
+ "name": "chat_publications_company_id_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_publications_work_idx": {
+ "name": "chat_publications_work_idx",
+ "columns": [
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_publications_idempotency_uq": {
+ "name": "chat_publications_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_publications_company_id_companies_id_fk": {
+ "name": "chat_publications_company_id_companies_id_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_publications_issue_id_issues_id_fk": {
+ "name": "chat_publications_issue_id_issues_id_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "chat_publications_comment_id_issue_comments_id_fk": {
+ "name": "chat_publications_comment_id_issue_comments_id_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_publications_company_issue_fk": {
+ "name": "chat_publications_company_issue_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_publications_company_comment_fk": {
+ "name": "chat_publications_company_comment_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "company_id",
+ "comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "chat_publications_company_endpoint_fk": {
+ "name": "chat_publications_company_endpoint_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_publications_company_conversation_fk": {
+ "name": "chat_publications_company_conversation_fk",
+ "tableFrom": "chat_publications",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_publications_state_check": {
+ "name": "chat_publications_state_check",
+ "value": "\"chat_publications\".\"state\" in ('pending', 'streaming', 'published', 'retry', 'delivery_unknown', 'failed', 'cancelled', 'awaiting_consent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_sdk_state": {
+ "name": "chat_sdk_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_key": {
+ "name": "state_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_sdk_state_key_uq": {
+ "name": "chat_sdk_state_key_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "state_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_sdk_state_expiry_idx": {
+ "name": "chat_sdk_state_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_sdk_state_company_id_companies_id_fk": {
+ "name": "chat_sdk_state_company_id_companies_id_fk",
+ "tableFrom": "chat_sdk_state",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_sdk_state_company_endpoint_fk": {
+ "name": "chat_sdk_state_company_endpoint_fk",
+ "tableFrom": "chat_sdk_state",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_completion_deliveries": {
+ "name": "chat_completion_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status_version": {
+ "name": "status_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "target_run_id": {
+ "name": "target_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_comment_id": {
+ "name": "response_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_completion_deliveries_transition_uq": {
+ "name": "chat_completion_deliveries_transition_uq",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_completion_deliveries_pending_idx": {
+ "name": "chat_completion_deliveries_pending_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_completion_deliveries_company_id_companies_id_fk": {
+ "name": "chat_completion_deliveries_company_id_companies_id_fk",
+ "tableFrom": "chat_completion_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_completion_deliveries_task_id_chat_task_handoffs_task_id_fk": {
+ "name": "chat_completion_deliveries_task_id_chat_task_handoffs_task_id_fk",
+ "tableFrom": "chat_completion_deliveries",
+ "columnsFrom": [
+ "task_id"
+ ],
+ "tableTo": "chat_task_handoffs",
+ "columnsTo": [
+ "task_id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_completion_deliveries_target_run_id_heartbeat_runs_id_fk": {
+ "name": "chat_completion_deliveries_target_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "chat_completion_deliveries",
+ "columnsFrom": [
+ "target_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_completion_deliveries_response_comment_id_issue_comments_id_fk": {
+ "name": "chat_completion_deliveries_response_comment_id_issue_comments_id_fk",
+ "tableFrom": "chat_completion_deliveries",
+ "columnsFrom": [
+ "response_comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_task_handoffs": {
+ "name": "chat_task_handoffs",
+ "schema": "",
+ "columns": {
+ "task_id": {
+ "name": "task_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_generation": {
+ "name": "session_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_task_handoffs_source_idx": {
+ "name": "chat_task_handoffs_source_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_task_handoffs_task_id_issues_id_fk": {
+ "name": "chat_task_handoffs_task_id_issues_id_fk",
+ "tableFrom": "chat_task_handoffs",
+ "columnsFrom": [
+ "task_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_task_handoffs_company_id_companies_id_fk": {
+ "name": "chat_task_handoffs_company_id_companies_id_fk",
+ "tableFrom": "chat_task_handoffs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_task_handoffs_conversation_id_issues_id_fk": {
+ "name": "chat_task_handoffs_conversation_id_issues_id_fk",
+ "tableFrom": "chat_task_handoffs",
+ "columnsFrom": [
+ "conversation_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_task_handoffs_agent_id_agents_id_fk": {
+ "name": "chat_task_handoffs_agent_id_agents_id_fk",
+ "tableFrom": "chat_task_handoffs",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_discord_command_owners": {
+ "name": "chat_discord_command_owners",
+ "schema": "",
+ "columns": {
+ "application_id": {
+ "name": "application_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action_id": {
+ "name": "action_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_discord_command_owners_application_check": {
+ "name": "chat_discord_command_owners_application_check",
+ "value": "\"chat_discord_command_owners\".\"application_id\" ~ '^[1-9][0-9]{16,19}$'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_github_configurations": {
+ "name": "chat_github_configurations",
+ "schema": "",
+ "columns": {
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "configuration": {
+ "name": "configuration",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "chat_github_configurations_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "chat_github_configurations_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "chat_github_configurations",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_github_config_revision_check": {
+ "name": "chat_github_config_revision_check",
+ "value": "\"chat_github_configurations\".\"revision\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_github_registrations": {
+ "name": "chat_github_registrations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_hash": {
+ "name": "state_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trusted_origin": {
+ "name": "trusted_origin",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_github_registration_state_uq": {
+ "name": "chat_github_registration_state_uq",
+ "columns": [
+ {
+ "expression": "state_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_github_registration_endpoint_idx": {
+ "name": "chat_github_registration_endpoint_idx",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_github_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "chat_github_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "chat_github_registrations",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_github_registration_status_check": {
+ "name": "chat_github_registration_status_check",
+ "value": "\"chat_github_registrations\".\"status\" in ('pending', 'exchanging', 'completed', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_github_reviews": {
+ "name": "chat_github_reviews",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pull_number": {
+ "name": "pull_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_id": {
+ "name": "delivery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "configuration_revision": {
+ "name": "configuration_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_snapshot": {
+ "name": "policy_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "assessment": {
+ "name": "assessment",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conclusion": {
+ "name": "conclusion",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "check_id": {
+ "name": "check_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "check_url": {
+ "name": "check_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary_id": {
+ "name": "summary_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary_url": {
+ "name": "summary_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "publication_receipts": {
+ "name": "publication_receipts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_github_reviews_delivery_uq": {
+ "name": "chat_github_reviews_delivery_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "delivery_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_github_reviews_pull_idx": {
+ "name": "chat_github_reviews_pull_idx",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pull_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_github_reviews_task_idx": {
+ "name": "chat_github_reviews_task_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_github_reviews_run_id_heartbeat_runs_id_fk": {
+ "name": "chat_github_reviews_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "chat_github_reviews",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "chat_github_reviews_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "chat_github_reviews_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "chat_github_reviews",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_github_reviews_company_id_issue_id_issues_company_id_id_fk": {
+ "name": "chat_github_reviews_company_id_issue_id_issues_company_id_id_fk",
+ "tableFrom": "chat_github_reviews",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_github_reviews_company_id_uq": {
+ "name": "chat_github_reviews_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "chat_github_review_pull_number_check": {
+ "name": "chat_github_review_pull_number_check",
+ "value": "\"chat_github_reviews\".\"pull_number\" > 0"
+ },
+ "chat_github_review_state_check": {
+ "name": "chat_github_review_state_check",
+ "value": "\"chat_github_reviews\".\"state\" in ('queued', 'running', 'completed', 'incomplete', 'error', 'superseded', 'manual_required')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.chat_teams_file_transfers": {
+ "name": "chat_teams_file_transfers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "publication_id": {
+ "name": "publication_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "authorized_user_id": {
+ "name": "authorized_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_generation": {
+ "name": "runtime_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_fingerprint": {
+ "name": "credential_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_generation": {
+ "name": "conversation_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_digest": {
+ "name": "source_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "authority_digest": {
+ "name": "authority_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tenant_id": {
+ "name": "tenant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bot_app_id": {
+ "name": "bot_app_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "aad_object_id": {
+ "name": "aad_object_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_conversation_id": {
+ "name": "provider_conversation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_user_id": {
+ "name": "provider_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sha256": {
+ "name": "sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_size": {
+ "name": "byte_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_sha256": {
+ "name": "token_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'consent_pending'"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "attempt_id": {
+ "name": "attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_expires_at": {
+ "name": "attempt_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consent_message_id": {
+ "name": "consent_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_info_message_id": {
+ "name": "file_info_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_activity_id": {
+ "name": "response_activity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_digest": {
+ "name": "response_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "private_state": {
+ "name": "private_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_teams_file_transfers_publication_uq": {
+ "name": "chat_teams_file_transfers_publication_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "publication_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_teams_file_transfers_token_uq": {
+ "name": "chat_teams_file_transfers_token_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "token_sha256",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "chat_teams_file_transfers_work_idx": {
+ "name": "chat_teams_file_transfers_work_idx",
+ "columns": [
+ {
+ "expression": "phase",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "attempt_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "chat_teams_file_transfers_company_id_companies_id_fk": {
+ "name": "chat_teams_file_transfers_company_id_companies_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_teams_file_transfers_issue_id_issues_id_fk": {
+ "name": "chat_teams_file_transfers_issue_id_issues_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "chat_teams_file_transfers_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "chat_teams_file_transfers_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_teams_file_transfers_company_id_publication_id_chat_publications_company_id_id_fk": {
+ "name": "chat_teams_file_transfers_company_id_publication_id_chat_publications_company_id_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "company_id",
+ "publication_id"
+ ],
+ "tableTo": "chat_publications",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_teams_file_transfers_company_id_conversation_id_chat_conversations_company_id_id_fk": {
+ "name": "chat_teams_file_transfers_company_id_conversation_id_chat_conversations_company_id_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "chat_teams_file_transfers_company_id_principal_id_chat_external_principals_company_id_id_fk": {
+ "name": "chat_teams_file_transfers_company_id_principal_id_chat_external_principals_company_id_id_fk",
+ "tableFrom": "chat_teams_file_transfers",
+ "columnsFrom": [
+ "company_id",
+ "principal_id"
+ ],
+ "tableTo": "chat_external_principals",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_teams_file_transfers_phase_check": {
+ "name": "chat_teams_file_transfers_phase_check",
+ "value": "\"chat_teams_file_transfers\".\"phase\" in ('consent_pending','consent_sending','consent_unknown','awaiting_consent','upload_pending','uploading','upload_unknown','file_info_pending','file_info_sending','file_info_unknown','delivered','declined','expired','cancelled','conflict')"
+ },
+ "chat_teams_file_transfers_bounds_check": {
+ "name": "chat_teams_file_transfers_bounds_check",
+ "value": "\"chat_teams_file_transfers\".\"version\" > 0 and \"chat_teams_file_transfers\".\"runtime_generation\" >= 0 and \"chat_teams_file_transfers\".\"conversation_generation\" > 0 and \"chat_teams_file_transfers\".\"byte_size\" > 0 and \"chat_teams_file_transfers\".\"byte_size\" < 62914560"
+ },
+ "chat_teams_file_transfers_hash_check": {
+ "name": "chat_teams_file_transfers_hash_check",
+ "value": "\"chat_teams_file_transfers\".\"source_digest\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"authority_digest\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"sha256\" ~ '^[a-f0-9]{64}$' and \"chat_teams_file_transfers\".\"token_sha256\" ~ '^[a-f0-9]{64}$'"
+ },
+ "chat_teams_file_transfers_attempt_check": {
+ "name": "chat_teams_file_transfers_attempt_check",
+ "value": "(\"chat_teams_file_transfers\".\"attempt_id\" is null) = (\"chat_teams_file_transfers\".\"attempt_expires_at\" is null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cli_auth_challenges": {
+ "name": "cli_auth_challenges",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "secret_hash": {
+ "name": "secret_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "command": {
+ "name": "command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_access": {
+ "name": "requested_access",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'board'"
+ },
+ "requested_company_id": {
+ "name": "requested_company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pending_key_hash": {
+ "name": "pending_key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pending_key_name": {
+ "name": "pending_key_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_by_user_id": {
+ "name": "approved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "board_api_key_id": {
+ "name": "board_api_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cli_auth_challenges_secret_hash_idx": {
+ "name": "cli_auth_challenges_secret_hash_idx",
+ "columns": [
+ {
+ "expression": "secret_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cli_auth_challenges_approved_by_idx": {
+ "name": "cli_auth_challenges_approved_by_idx",
+ "columns": [
+ {
+ "expression": "approved_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cli_auth_challenges_requested_company_idx": {
+ "name": "cli_auth_challenges_requested_company_idx",
+ "columns": [
+ {
+ "expression": "requested_company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "cli_auth_challenges_requested_company_id_companies_id_fk": {
+ "name": "cli_auth_challenges_requested_company_id_companies_id_fk",
+ "tableFrom": "cli_auth_challenges",
+ "columnsFrom": [
+ "requested_company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "cli_auth_challenges_approved_by_user_id_user_id_fk": {
+ "name": "cli_auth_challenges_approved_by_user_id_user_id_fk",
+ "tableFrom": "cli_auth_challenges",
+ "columnsFrom": [
+ "approved_by_user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk": {
+ "name": "cli_auth_challenges_board_api_key_id_board_api_keys_id_fk",
+ "tableFrom": "cli_auth_challenges",
+ "columnsFrom": [
+ "board_api_key_id"
+ ],
+ "tableTo": "board_api_keys",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.companies": {
+ "name": "companies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "pause_reason": {
+ "name": "pause_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paused_at": {
+ "name": "paused_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_prefix": {
+ "name": "issue_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PAP'"
+ },
+ "issue_counter": {
+ "name": "issue_counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "budget_monthly_cents": {
+ "name": "budget_monthly_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spent_monthly_cents": {
+ "name": "spent_monthly_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "default_responsible_user_id": {
+ "name": "default_responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "require_board_approval_for_new_agents": {
+ "name": "require_board_approval_for_new_agents",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "interaction_resolver_governance": {
+ "name": "interaction_resolver_governance",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "feedback_data_sharing_enabled": {
+ "name": "feedback_data_sharing_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "feedback_data_sharing_consent_at": {
+ "name": "feedback_data_sharing_consent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_data_sharing_consent_by_user_id": {
+ "name": "feedback_data_sharing_consent_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "feedback_data_sharing_terms_version": {
+ "name": "feedback_data_sharing_terms_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "companies_issue_prefix_idx": {
+ "name": "companies_issue_prefix_idx",
+ "columns": [
+ {
+ "expression": "issue_prefix",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_logos": {
+ "name": "company_logos",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "asset_id": {
+ "name": "asset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_logos_company_uq": {
+ "name": "company_logos_company_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_logos_asset_uq": {
+ "name": "company_logos_asset_uq",
+ "columns": [
+ {
+ "expression": "asset_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_logos_company_id_companies_id_fk": {
+ "name": "company_logos_company_id_companies_id_fk",
+ "tableFrom": "company_logos",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_logos_asset_id_assets_id_fk": {
+ "name": "company_logos_asset_id_assets_id_fk",
+ "tableFrom": "company_logos",
+ "columnsFrom": [
+ "asset_id"
+ ],
+ "tableTo": "assets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_memberships": {
+ "name": "company_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_type": {
+ "name": "principal_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "membership_role": {
+ "name": "membership_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_memberships_company_principal_unique_idx": {
+ "name": "company_memberships_company_principal_unique_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_memberships_principal_status_idx": {
+ "name": "company_memberships_principal_status_idx",
+ "columns": [
+ {
+ "expression": "principal_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_memberships_company_status_idx": {
+ "name": "company_memberships_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_memberships_company_id_companies_id_fk": {
+ "name": "company_memberships_company_id_companies_id_fk",
+ "tableFrom": "company_memberships",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_onboarding_seeds": {
+ "name": "company_onboarding_seeds",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mission": {
+ "name": "mission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_name": {
+ "name": "agent_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_role": {
+ "name": "agent_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_task_title": {
+ "name": "first_task_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_task_details": {
+ "name": "first_task_details",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_onboarding_seeds_company_uq": {
+ "name": "company_onboarding_seeds_company_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_onboarding_seeds_company_id_companies_id_fk": {
+ "name": "company_onboarding_seeds_company_id_companies_id_fk",
+ "tableFrom": "company_onboarding_seeds",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_onboarding_seeds_goal_id_goals_id_fk": {
+ "name": "company_onboarding_seeds_goal_id_goals_id_fk",
+ "tableFrom": "company_onboarding_seeds",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_onboarding_seeds_agent_id_agents_id_fk": {
+ "name": "company_onboarding_seeds_agent_id_agents_id_fk",
+ "tableFrom": "company_onboarding_seeds",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_onboarding_seeds_issue_id_issues_id_fk": {
+ "name": "company_onboarding_seeds_issue_id_issues_id_fk",
+ "tableFrom": "company_onboarding_seeds",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_secret_bindings": {
+ "name": "company_secret_bindings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_id": {
+ "name": "secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_path": {
+ "name": "config_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_selector": {
+ "name": "version_selector",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'latest'"
+ },
+ "required": {
+ "name": "required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "projection_class": {
+ "name": "projection_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unclassified'"
+ },
+ "projection_allowlist_key": {
+ "name": "projection_allowlist_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_secret_bindings_company_idx": {
+ "name": "company_secret_bindings_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_bindings_secret_idx": {
+ "name": "company_secret_bindings_secret_idx",
+ "columns": [
+ {
+ "expression": "secret_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_bindings_target_idx": {
+ "name": "company_secret_bindings_target_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_bindings_target_path_uq": {
+ "name": "company_secret_bindings_target_path_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "config_path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_secret_bindings_company_id_companies_id_fk": {
+ "name": "company_secret_bindings_company_id_companies_id_fk",
+ "tableFrom": "company_secret_bindings",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "company_secret_bindings_secret_id_company_secrets_id_fk": {
+ "name": "company_secret_bindings_secret_id_company_secrets_id_fk",
+ "tableFrom": "company_secret_bindings",
+ "columnsFrom": [
+ "secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_secret_proposals": {
+ "name": "company_secret_proposals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "proposed_name": {
+ "name": "proposed_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposed_key": {
+ "name": "proposed_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposed_description": {
+ "name": "proposed_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "justification": {
+ "name": "justification",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_ciphertext": {
+ "name": "value_ciphertext",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_fingerprint_sha256": {
+ "name": "value_fingerprint_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_length": {
+ "name": "value_length",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_id": {
+ "name": "secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_proposal_id": {
+ "name": "secret_proposal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config_path": {
+ "name": "config_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "projection_class": {
+ "name": "projection_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unclassified'"
+ },
+ "binding_target_policy_snapshot": {
+ "name": "binding_target_policy_snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposer_ancestor_ids_snapshot": {
+ "name": "proposer_ancestor_ids_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_ancestor_ids_snapshot": {
+ "name": "target_ancestor_ids_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proposed_by_agent_id": {
+ "name": "proposed_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_issue_id": {
+ "name": "origin_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_run_id": {
+ "name": "origin_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_user_id": {
+ "name": "resolved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_reason": {
+ "name": "resolution_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_secret_id": {
+ "name": "created_secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applied_binding_config_path": {
+ "name": "applied_binding_config_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ciphertext_scrubbed_at": {
+ "name": "ciphertext_scrubbed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_secret_proposals_company_status_idx": {
+ "name": "company_secret_proposals_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_proposals_proposer_status_idx": {
+ "name": "company_secret_proposals_proposer_status_idx",
+ "columns": [
+ {
+ "expression": "proposed_by_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_proposals_expiry_idx": {
+ "name": "company_secret_proposals_expiry_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_proposals_secret_proposal_idx": {
+ "name": "company_secret_proposals_secret_proposal_idx",
+ "columns": [
+ {
+ "expression": "secret_proposal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_proposals_interaction_idx": {
+ "name": "company_secret_proposals_interaction_idx",
+ "columns": [
+ {
+ "expression": "interaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_secret_proposals_company_id_companies_id_fk": {
+ "name": "company_secret_proposals_company_id_companies_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "company_secret_proposals_secret_id_company_secrets_id_fk": {
+ "name": "company_secret_proposals_secret_id_company_secrets_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk": {
+ "name": "company_secret_proposals_secret_proposal_id_company_secret_proposals_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "secret_proposal_id"
+ ],
+ "tableTo": "company_secret_proposals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_proposals_target_id_agents_id_fk": {
+ "name": "company_secret_proposals_target_id_agents_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "target_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_proposals_proposed_by_agent_id_agents_id_fk": {
+ "name": "company_secret_proposals_proposed_by_agent_id_agents_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "proposed_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_proposals_origin_issue_id_issues_id_fk": {
+ "name": "company_secret_proposals_origin_issue_id_issues_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "origin_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk": {
+ "name": "company_secret_proposals_origin_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "origin_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "company_secret_proposals_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_secret_proposals_created_secret_id_company_secrets_id_fk": {
+ "name": "company_secret_proposals_created_secret_id_company_secrets_id_fk",
+ "tableFrom": "company_secret_proposals",
+ "columnsFrom": [
+ "created_secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "company_secret_proposals_kind_check": {
+ "name": "company_secret_proposals_kind_check",
+ "value": "\"company_secret_proposals\".\"kind\" in ('secret', 'binding')"
+ },
+ "company_secret_proposals_status_check": {
+ "name": "company_secret_proposals_status_check",
+ "value": "\"company_secret_proposals\".\"status\" in ('pending', 'approved', 'rejected', 'withdrawn', 'expired')"
+ },
+ "company_secret_proposals_projection_check": {
+ "name": "company_secret_proposals_projection_check",
+ "value": "\"company_secret_proposals\".\"projection_class\" = 'unclassified'"
+ },
+ "company_secret_proposals_shape_check": {
+ "name": "company_secret_proposals_shape_check",
+ "value": "(\n \"company_secret_proposals\".\"kind\" = 'secret'\n and \"company_secret_proposals\".\"proposed_name\" is not null\n and \"company_secret_proposals\".\"proposed_key\" is not null\n and \"company_secret_proposals\".\"secret_id\" is null\n and \"company_secret_proposals\".\"secret_proposal_id\" is null\n and \"company_secret_proposals\".\"target_type\" is null\n and \"company_secret_proposals\".\"target_id\" is null\n and \"company_secret_proposals\".\"config_path\" is null\n ) or (\n \"company_secret_proposals\".\"kind\" = 'binding'\n and ((\"company_secret_proposals\".\"secret_id\" is not null)::int + (\"company_secret_proposals\".\"secret_proposal_id\" is not null)::int) = 1\n and \"company_secret_proposals\".\"target_type\" = 'agent'\n and \"company_secret_proposals\".\"target_id\" is not null\n and \"company_secret_proposals\".\"config_path\" is not null\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.company_secret_provider_configs": {
+ "name": "company_secret_provider_configs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ready'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "health_status": {
+ "name": "health_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_checked_at": {
+ "name": "health_checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_message": {
+ "name": "health_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_details": {
+ "name": "health_details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_at": {
+ "name": "disabled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_secret_provider_configs_company_idx": {
+ "name": "company_secret_provider_configs_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_provider_configs_company_provider_idx": {
+ "name": "company_secret_provider_configs_company_provider_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_provider_configs_default_uq": {
+ "name": "company_secret_provider_configs_default_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"company_secret_provider_configs\".\"is_default\" = true",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_secret_provider_configs_company_id_companies_id_fk": {
+ "name": "company_secret_provider_configs_company_id_companies_id_fk",
+ "tableFrom": "company_secret_provider_configs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_provider_configs_created_by_agent_id_agents_id_fk": {
+ "name": "company_secret_provider_configs_created_by_agent_id_agents_id_fk",
+ "tableFrom": "company_secret_provider_configs",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_secret_versions": {
+ "name": "company_secret_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "secret_id": {
+ "name": "secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "material": {
+ "name": "material",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_sha256": {
+ "name": "value_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_version_ref": {
+ "name": "provider_version_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'current'"
+ },
+ "fingerprint_sha256": {
+ "name": "fingerprint_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rotation_job_id": {
+ "name": "rotation_job_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "company_secret_versions_secret_idx": {
+ "name": "company_secret_versions_secret_idx",
+ "columns": [
+ {
+ "expression": "secret_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_versions_value_sha256_idx": {
+ "name": "company_secret_versions_value_sha256_idx",
+ "columns": [
+ {
+ "expression": "value_sha256",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_versions_fingerprint_idx": {
+ "name": "company_secret_versions_fingerprint_idx",
+ "columns": [
+ {
+ "expression": "fingerprint_sha256",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secret_versions_secret_version_uq": {
+ "name": "company_secret_versions_secret_version_uq",
+ "columns": [
+ {
+ "expression": "secret_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_secret_versions_secret_id_company_secrets_id_fk": {
+ "name": "company_secret_versions_secret_id_company_secrets_id_fk",
+ "tableFrom": "company_secret_versions",
+ "columnsFrom": [
+ "secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_secret_versions_created_by_agent_id_agents_id_fk": {
+ "name": "company_secret_versions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "company_secret_versions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_secrets": {
+ "name": "company_secrets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_secret_definition_id": {
+ "name": "user_secret_definition_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_encrypted'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "managed_mode": {
+ "name": "managed_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip_managed'"
+ },
+ "external_ref": {
+ "name": "external_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_config_id": {
+ "name": "provider_config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_metadata": {
+ "name": "provider_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ai_session_epoch": {
+ "name": "ai_session_epoch",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "latest_version": {
+ "name": "latest_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_resolved_at": {
+ "name": "last_resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_rotated_at": {
+ "name": "last_rotated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_secrets_company_idx": {
+ "name": "company_secrets_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_company_scope_idx": {
+ "name": "company_secrets_company_scope_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_company_owner_idx": {
+ "name": "company_secrets_company_owner_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_user_definition_owner_idx": {
+ "name": "company_secrets_user_definition_owner_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_secret_definition_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_company_provider_idx": {
+ "name": "company_secrets_company_provider_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_provider_config_idx": {
+ "name": "company_secrets_provider_config_idx",
+ "columns": [
+ {
+ "expression": "provider_config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_secrets_company_name_uq": {
+ "name": "company_secrets_company_name_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",
+ "concurrently": false
+ },
+ "company_secrets_company_key_uq": {
+ "name": "company_secrets_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"company_secrets\".\"scope\" = 'company' and \"company_secrets\".\"deleted_at\" is null",
+ "concurrently": false
+ },
+ "company_secrets_user_definition_owner_uq": {
+ "name": "company_secrets_user_definition_owner_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_secret_definition_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"company_secrets\".\"scope\" = 'user' and \"company_secrets\".\"deleted_at\" is null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_secrets_company_id_companies_id_fk": {
+ "name": "company_secrets_company_id_companies_id_fk",
+ "tableFrom": "company_secrets",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk": {
+ "name": "company_secrets_user_secret_definition_id_user_secret_definitions_id_fk",
+ "tableFrom": "company_secrets",
+ "columnsFrom": [
+ "user_secret_definition_id"
+ ],
+ "tableTo": "user_secret_definitions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_secrets_provider_config_id_company_secret_provider_configs_id_fk": {
+ "name": "company_secrets_provider_config_id_company_secret_provider_configs_id_fk",
+ "tableFrom": "company_secrets",
+ "columnsFrom": [
+ "provider_config_id"
+ ],
+ "tableTo": "company_secret_provider_configs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_secrets_created_by_agent_id_agents_id_fk": {
+ "name": "company_secrets_created_by_agent_id_agents_id_fk",
+ "tableFrom": "company_secrets",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "company_secrets_scope_shape_check": {
+ "name": "company_secrets_scope_shape_check",
+ "value": "(\n \"company_secrets\".\"scope\" = 'company'\n and \"company_secrets\".\"owner_user_id\" is null\n and \"company_secrets\".\"user_secret_definition_id\" is null\n ) or (\n \"company_secrets\".\"scope\" = 'user'\n and \"company_secrets\".\"owner_user_id\" is not null\n and \"company_secrets\".\"user_secret_definition_id\" is not null\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.company_skill_policies": {
+ "name": "company_skill_policies",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_effect": {
+ "name": "default_effect",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rules": {
+ "name": "rules",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "company_skill_policies_company_id_companies_id_fk": {
+ "name": "company_skill_policies_company_id_companies_id_fk",
+ "tableFrom": "company_skill_policies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_source_entries": {
+ "name": "company_skill_source_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inspection": {
+ "name": "inspection",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "selection": {
+ "name": "selection",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'new'"
+ },
+ "present": {
+ "name": "present",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "company_skill_source_entries_source_path_idx": {
+ "name": "company_skill_source_entries_source_path_idx",
+ "columns": [
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_source_entries_company_skill_idx": {
+ "name": "company_skill_source_entries_company_skill_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_source_entries_company_id_companies_id_fk": {
+ "name": "company_skill_source_entries_company_id_companies_id_fk",
+ "tableFrom": "company_skill_source_entries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_source_entries_source_id_company_skill_sources_id_fk": {
+ "name": "company_skill_source_entries_source_id_company_skill_sources_id_fk",
+ "tableFrom": "company_skill_source_entries",
+ "columnsFrom": [
+ "source_id"
+ ],
+ "tableTo": "company_skill_sources",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_source_entries_skill_id_company_skills_id_fk": {
+ "name": "company_skill_source_entries_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_source_entries",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_sources": {
+ "name": "company_skill_sources",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_url": {
+ "name": "repository_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_name": {
+ "name": "full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tracking_ref": {
+ "name": "tracking_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "excluded_folders": {
+ "name": "excluded_folders",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_success_at": {
+ "name": "last_success_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_scan_commit": {
+ "name": "last_scan_commit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_sources_repository_ref_idx": {
+ "name": "company_skill_sources_repository_ref_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository_url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tracking_ref",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_sources_identity_ref_idx": {
+ "name": "company_skill_sources_identity_ref_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tracking_ref",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_sources_company_id_companies_id_fk": {
+ "name": "company_skill_sources_company_id_companies_id_fk",
+ "tableFrom": "company_skill_sources",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_sources_connection_id_tool_connections_id_fk": {
+ "name": "company_skill_sources_connection_id_tool_connections_id_fk",
+ "tableFrom": "company_skill_sources",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_comments": {
+ "name": "company_skill_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_skill_id": {
+ "name": "company_skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_comment_id": {
+ "name": "parent_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_agent_id": {
+ "name": "author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_comments_company_skill_created_idx": {
+ "name": "company_skill_comments_company_skill_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_comments_parent_idx": {
+ "name": "company_skill_comments_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_comment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_comments_company_id_companies_id_fk": {
+ "name": "company_skill_comments_company_id_companies_id_fk",
+ "tableFrom": "company_skill_comments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_comments_company_skill_id_company_skills_id_fk": {
+ "name": "company_skill_comments_company_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_comments",
+ "columnsFrom": [
+ "company_skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_comments_parent_comment_id_company_skill_comments_id_fk": {
+ "name": "company_skill_comments_parent_comment_id_company_skill_comments_id_fk",
+ "tableFrom": "company_skill_comments",
+ "columnsFrom": [
+ "parent_comment_id"
+ ],
+ "tableTo": "company_skill_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skill_comments_author_agent_id_agents_id_fk": {
+ "name": "company_skill_comments_author_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_comments",
+ "columnsFrom": [
+ "author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_stars": {
+ "name": "company_skill_stars",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_skill_id": {
+ "name": "company_skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_stars_skill_agent_idx": {
+ "name": "company_skill_stars_skill_agent_idx",
+ "columns": [
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_stars_skill_user_idx": {
+ "name": "company_skill_stars_skill_user_idx",
+ "columns": [
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_stars_company_skill_created_idx": {
+ "name": "company_skill_stars_company_skill_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_stars_company_id_companies_id_fk": {
+ "name": "company_skill_stars_company_id_companies_id_fk",
+ "tableFrom": "company_skill_stars",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_stars_company_skill_id_company_skills_id_fk": {
+ "name": "company_skill_stars_company_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_stars",
+ "columnsFrom": [
+ "company_skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_stars_agent_id_agents_id_fk": {
+ "name": "company_skill_stars_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_stars",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_test_inputs": {
+ "name": "company_skill_test_inputs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_test_inputs_company_skill_name_idx": {
+ "name": "company_skill_test_inputs_company_skill_name_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_test_inputs_company_skill_active_idx": {
+ "name": "company_skill_test_inputs_company_skill_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_test_inputs_company_id_companies_id_fk": {
+ "name": "company_skill_test_inputs_company_id_companies_id_fk",
+ "tableFrom": "company_skill_test_inputs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_test_inputs_skill_id_company_skills_id_fk": {
+ "name": "company_skill_test_inputs_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_test_inputs",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_test_run_templates": {
+ "name": "company_skill_test_run_templates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_test_run_templates_company_active_idx": {
+ "name": "company_skill_test_run_templates_company_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_test_run_templates_company_id_companies_id_fk": {
+ "name": "company_skill_test_run_templates_company_id_companies_id_fk",
+ "tableFrom": "company_skill_test_run_templates",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_test_run_templates_created_by_agent_id_agents_id_fk": {
+ "name": "company_skill_test_run_templates_created_by_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_test_run_templates",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk": {
+ "name": "company_skill_test_run_templates_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_test_run_templates",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_test_runs": {
+ "name": "company_skill_test_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_id": {
+ "name": "input_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_snapshot": {
+ "name": "input_snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_version_id": {
+ "name": "skill_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_config_snapshot": {
+ "name": "agent_config_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "template_id": {
+ "name": "template_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "template_name": {
+ "name": "template_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "template_body": {
+ "name": "template_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rendered_template_body": {
+ "name": "rendered_template_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_issue_description": {
+ "name": "harness_issue_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "output_document_key": {
+ "name": "output_document_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'output'"
+ },
+ "output_snapshot": {
+ "name": "output_snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "superseded_at": {
+ "name": "superseded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_issue_expires_at": {
+ "name": "harness_issue_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "harness_issue_deleted_at": {
+ "name": "harness_issue_deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_test_runs_company_skill_created_idx": {
+ "name": "company_skill_test_runs_company_skill_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_test_runs_company_issue_idx": {
+ "name": "company_skill_test_runs_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_test_runs_company_input_created_idx": {
+ "name": "company_skill_test_runs_company_input_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "input_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_test_runs_company_status_idx": {
+ "name": "company_skill_test_runs_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_test_runs_company_harness_expires_idx": {
+ "name": "company_skill_test_runs_company_harness_expires_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "harness_issue_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_test_runs_company_id_companies_id_fk": {
+ "name": "company_skill_test_runs_company_id_companies_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_test_runs_skill_id_company_skills_id_fk": {
+ "name": "company_skill_test_runs_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk": {
+ "name": "company_skill_test_runs_input_id_company_skill_test_inputs_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "input_id"
+ ],
+ "tableTo": "company_skill_test_inputs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk": {
+ "name": "company_skill_test_runs_skill_version_id_company_skill_versions_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "skill_version_id"
+ ],
+ "tableTo": "company_skill_versions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "company_skill_test_runs_agent_id_agents_id_fk": {
+ "name": "company_skill_test_runs_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "company_skill_test_runs_issue_id_issues_id_fk": {
+ "name": "company_skill_test_runs_issue_id_issues_id_fk",
+ "tableFrom": "company_skill_test_runs",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skill_versions": {
+ "name": "company_skill_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_skill_id": {
+ "name": "company_skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision_number": {
+ "name": "revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_id": {
+ "name": "release_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_name": {
+ "name": "release_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_at": {
+ "name": "released_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_inventory": {
+ "name": "file_inventory",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "author_agent_id": {
+ "name": "author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skill_versions_skill_revision_idx": {
+ "name": "company_skill_versions_skill_revision_idx",
+ "columns": [
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skill_versions_skill_release_idx": {
+ "name": "company_skill_versions_skill_release_idx",
+ "columns": [
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "release_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"company_skill_versions\".\"release_id\" is not null",
+ "concurrently": false
+ },
+ "company_skill_versions_company_skill_created_idx": {
+ "name": "company_skill_versions_company_skill_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "company_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skill_versions_company_id_companies_id_fk": {
+ "name": "company_skill_versions_company_id_companies_id_fk",
+ "tableFrom": "company_skill_versions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_versions_company_skill_id_company_skills_id_fk": {
+ "name": "company_skill_versions_company_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skill_versions",
+ "columnsFrom": [
+ "company_skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "company_skill_versions_author_agent_id_agents_id_fk": {
+ "name": "company_skill_versions_author_agent_id_agents_id_fk",
+ "tableFrom": "company_skill_versions",
+ "columnsFrom": [
+ "author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_skills": {
+ "name": "company_skills",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "markdown": {
+ "name": "markdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_path'"
+ },
+ "source_locator": {
+ "name": "source_locator",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_ref": {
+ "name": "source_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trust_level": {
+ "name": "trust_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'markdown_only'"
+ },
+ "compatibility": {
+ "name": "compatibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compatible'"
+ },
+ "file_inventory": {
+ "name": "file_inventory",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tagline": {
+ "name": "tagline",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_name": {
+ "name": "author_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "homepage_url": {
+ "name": "homepage_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "categories": {
+ "name": "categories",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "sharing_scope": {
+ "name": "sharing_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "public_share_token": {
+ "name": "public_share_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "forked_from_skill_id": {
+ "name": "forked_from_skill_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "forked_from_company_id": {
+ "name": "forked_from_company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "star_count": {
+ "name": "star_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "install_count": {
+ "name": "install_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "fork_count": {
+ "name": "fork_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "current_version_id": {
+ "name": "current_version_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_skills_company_key_idx": {
+ "name": "company_skills_company_key_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skills_company_name_idx": {
+ "name": "company_skills_company_name_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skills_company_folder_idx": {
+ "name": "company_skills_company_folder_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skills_company_categories_idx": {
+ "name": "company_skills_company_categories_idx",
+ "columns": [
+ {
+ "expression": "categories",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "company_skills_company_sharing_scope_idx": {
+ "name": "company_skills_company_sharing_scope_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sharing_scope",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skills_company_current_version_idx": {
+ "name": "company_skills_company_current_version_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "current_version_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_skills_company_forked_from_idx": {
+ "name": "company_skills_company_forked_from_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "forked_from_skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_skills_company_id_companies_id_fk": {
+ "name": "company_skills_company_id_companies_id_fk",
+ "tableFrom": "company_skills",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "company_skills_folder_id_folders_id_fk": {
+ "name": "company_skills_folder_id_folders_id_fk",
+ "tableFrom": "company_skills",
+ "columnsFrom": [
+ "folder_id"
+ ],
+ "tableTo": "folders",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skills_forked_from_skill_id_company_skills_id_fk": {
+ "name": "company_skills_forked_from_skill_id_company_skills_id_fk",
+ "tableFrom": "company_skills",
+ "columnsFrom": [
+ "forked_from_skill_id"
+ ],
+ "tableTo": "company_skills",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skills_forked_from_company_id_companies_id_fk": {
+ "name": "company_skills_forked_from_company_id_companies_id_fk",
+ "tableFrom": "company_skills",
+ "columnsFrom": [
+ "forked_from_company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "company_skills_current_version_id_company_skill_versions_id_fk": {
+ "name": "company_skills_current_version_id_company_skill_versions_id_fk",
+ "tableFrom": "company_skills",
+ "columnsFrom": [
+ "current_version_id"
+ ],
+ "tableTo": "company_skill_versions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_transfer_runs": {
+ "name": "company_transfer_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "actor_key": {
+ "name": "actor_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "container_ref": {
+ "name": "container_ref",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "manifest_sha256": {
+ "name": "manifest_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manifest": {
+ "name": "manifest",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chunk_count": {
+ "name": "chunk_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "blob_count": {
+ "name": "blob_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "completed_parts": {
+ "name": "completed_parts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_transfer_runs_company_idx": {
+ "name": "company_transfer_runs_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_transfer_runs_idempotency_direction_idx": {
+ "name": "company_transfer_runs_idempotency_direction_idx",
+ "columns": [
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "direction",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_transfer_runs_actor_status_idx": {
+ "name": "company_transfer_runs_actor_status_idx",
+ "columns": [
+ {
+ "expression": "actor_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_transfer_runs_company_id_companies_id_fk": {
+ "name": "company_transfer_runs_company_id_companies_id_fk",
+ "tableFrom": "company_transfer_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.company_user_sidebar_preferences": {
+ "name": "company_user_sidebar_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_order": {
+ "name": "project_order",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "company_user_sidebar_preferences_company_idx": {
+ "name": "company_user_sidebar_preferences_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_user_sidebar_preferences_user_idx": {
+ "name": "company_user_sidebar_preferences_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "company_user_sidebar_preferences_company_user_uq": {
+ "name": "company_user_sidebar_preferences_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "company_user_sidebar_preferences_company_id_companies_id_fk": {
+ "name": "company_user_sidebar_preferences_company_id_companies_id_fk",
+ "tableFrom": "company_user_sidebar_preferences",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.completion_contracts": {
+ "name": "completion_contracts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "risk": {
+ "name": "risk",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completion_authority": {
+ "name": "completion_authority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "incomplete_criteria_policy": {
+ "name": "incomplete_criteria_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_json": {
+ "name": "contract_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_sha256": {
+ "name": "canonical_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_actor_type": {
+ "name": "created_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_actor_id": {
+ "name": "created_by_actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "supersedes_contract_id": {
+ "name": "supersedes_contract_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "completion_contracts_issue_revision_uq": {
+ "name": "completion_contracts_issue_revision_uq",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "completion_contracts_issue_hash_uq": {
+ "name": "completion_contracts_issue_hash_uq",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "canonical_sha256",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "completion_contracts_company_id_companies_id_fk": {
+ "name": "completion_contracts_company_id_companies_id_fk",
+ "tableFrom": "completion_contracts",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "completion_contracts_issue_company_fk": {
+ "name": "completion_contracts_issue_company_fk",
+ "tableFrom": "completion_contracts",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "completion_contracts_supersedes_owner_fk": {
+ "name": "completion_contracts_supersedes_owner_fk",
+ "tableFrom": "completion_contracts",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "supersedes_contract_id"
+ ],
+ "tableTo": "completion_contracts",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "completion_contracts_company_issue_id_uq": {
+ "name": "completion_contracts_company_issue_id_uq",
+ "columns": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.connection_event_deliveries": {
+ "name": "connection_event_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_delivery_id": {
+ "name": "provider_delivery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repository_id": {
+ "name": "repository_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "normalized_payload": {
+ "name": "normalized_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_created_at": {
+ "name": "provider_created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_event_deliveries_company_provider_id_uq": {
+ "name": "connection_event_deliveries_company_provider_id_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_delivery_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_event_deliveries_company_status_idx": {
+ "name": "connection_event_deliveries_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_event_deliveries_company_id_companies_id_fk": {
+ "name": "connection_event_deliveries_company_id_companies_id_fk",
+ "tableFrom": "connection_event_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.connection_intent_deliveries": {
+ "name": "connection_intent_deliveries",
+ "schema": "",
+ "columns": {
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_intent_deliveries_pending_idx": {
+ "name": "connection_intent_deliveries_pending_idx",
+ "columns": [
+ {
+ "expression": "delivered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_intent_deliveries_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "connection_intent_deliveries_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "connection_intent_deliveries",
+ "columnsFrom": [
+ "interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_intent_deliveries_company_id_companies_id_fk": {
+ "name": "connection_intent_deliveries_company_id_companies_id_fk",
+ "tableFrom": "connection_intent_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cost_events": {
+ "name": "cost_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_code": {
+ "name": "billing_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reported_cost_cents": {
+ "name": "reported_cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing_provenance": {
+ "name": "pricing_provenance",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "biller": {
+ "name": "biller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "billing_type": {
+ "name": "billing_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "cost_status": {
+ "name": "cost_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'reported'"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cached_input_tokens": {
+ "name": "cached_input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cost_cents": {
+ "name": "cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cost_events_company_receipt_idx": {
+ "name": "cost_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_provider_request_idx": {
+ "name": "cost_events_provider_request_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_company_project_occurred_idx": {
+ "name": "cost_events_company_project_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_unpriced_idx": {
+ "name": "cost_events_unpriced_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"cost_events\".\"cost_status\" = 'unpriced' and \"cost_events\".\"billing_type\" <> 'subscription_included'",
+ "concurrently": false
+ },
+ "cost_events_company_occurred_idx": {
+ "name": "cost_events_company_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_company_agent_occurred_idx": {
+ "name": "cost_events_company_agent_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_company_provider_occurred_idx": {
+ "name": "cost_events_company_provider_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_company_biller_occurred_idx": {
+ "name": "cost_events_company_biller_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "cost_events_company_heartbeat_run_idx": {
+ "name": "cost_events_company_heartbeat_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "heartbeat_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "cost_events_company_id_companies_id_fk": {
+ "name": "cost_events_company_id_companies_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "cost_events_agent_id_agents_id_fk": {
+ "name": "cost_events_agent_id_agents_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "cost_events_issue_id_issues_id_fk": {
+ "name": "cost_events_issue_id_issues_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "cost_events_project_id_projects_id_fk": {
+ "name": "cost_events_project_id_projects_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "cost_events_goal_id_goals_id_fk": {
+ "name": "cost_events_goal_id_goals_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "cost_events_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "cost_events_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "cost_events",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cost_events_nonnegative_amounts": {
+ "name": "cost_events_nonnegative_amounts",
+ "value": "\"cost_events\".\"cost_cents\" >= 0 and \"cost_events\".\"input_tokens\" >= 0 and \"cost_events\".\"cached_input_tokens\" >= 0 and \"cost_events\".\"output_tokens\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_archive_notification_outbox": {
+ "name": "decision_archive_notification_outbox",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "archive_version": {
+ "name": "archive_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_agent_id": {
+ "name": "origin_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_issue_id": {
+ "name": "origin_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_archive_notification_outbox_uq": {
+ "name": "decision_archive_notification_outbox_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archive_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_archive_notification_outbox_pending_idx": {
+ "name": "decision_archive_notification_outbox_pending_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_archive_notification_outbox_company_id_companies_id_fk": {
+ "name": "decision_archive_notification_outbox_company_id_companies_id_fk",
+ "tableFrom": "decision_archive_notification_outbox",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_archive_notification_outbox_origin_agent_id_agents_id_fk": {
+ "name": "decision_archive_notification_outbox_origin_agent_id_agents_id_fk",
+ "tableFrom": "decision_archive_notification_outbox",
+ "columnsFrom": [
+ "origin_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_archive_notification_outbox_status_check": {
+ "name": "decision_archive_notification_outbox_status_check",
+ "value": "\"decision_archive_notification_outbox\".\"status\" IN ('pending', 'delivering', 'delivered')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_queue_items": {
+ "name": "decision_queue_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "queue_id": {
+ "name": "queue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "added_by_type": {
+ "name": "added_by_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "added_by_agent_id": {
+ "name": "added_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "added_by_user_id": {
+ "name": "added_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "added_by_run_id": {
+ "name": "added_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "added_by_agent_api_key_id": {
+ "name": "added_by_agent_api_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_queue_items_queue_source_uq": {
+ "name": "decision_queue_items_queue_source_uq",
+ "columns": [
+ {
+ "expression": "queue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_queue_items_company_source_idx": {
+ "name": "decision_queue_items_company_source_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_queue_items_company_id_companies_id_fk": {
+ "name": "decision_queue_items_company_id_companies_id_fk",
+ "tableFrom": "decision_queue_items",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_queue_items_added_by_agent_id_agents_id_fk": {
+ "name": "decision_queue_items_added_by_agent_id_agents_id_fk",
+ "tableFrom": "decision_queue_items",
+ "columnsFrom": [
+ "added_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_queue_items_added_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_queue_items",
+ "columnsFrom": [
+ "added_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk": {
+ "name": "decision_queue_items_added_by_agent_api_key_id_agent_api_keys_id_fk",
+ "tableFrom": "decision_queue_items",
+ "columnsFrom": [
+ "added_by_agent_api_key_id"
+ ],
+ "tableTo": "agent_api_keys",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_queue_items_queue_company_fk": {
+ "name": "decision_queue_items_queue_company_fk",
+ "tableFrom": "decision_queue_items",
+ "columnsFrom": [
+ "queue_id",
+ "company_id"
+ ],
+ "tableTo": "decision_queues",
+ "columnsTo": [
+ "id",
+ "company_id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_queue_items_actor_check": {
+ "name": "decision_queue_items_actor_check",
+ "value": "(\n (\"decision_queue_items\".\"added_by_type\" = 'agent' AND \"decision_queue_items\".\"added_by_agent_id\" IS NOT NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'user' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NOT NULL)\n OR (\"decision_queue_items\".\"added_by_type\" = 'system' AND \"decision_queue_items\".\"added_by_agent_id\" IS NULL AND \"decision_queue_items\".\"added_by_user_id\" IS NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_queues": {
+ "name": "decision_queues",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_type": {
+ "name": "created_by_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_api_key_id": {
+ "name": "created_by_agent_api_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retention_days": {
+ "name": "retention_days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seed_rules": {
+ "name": "seed_rules",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "seed_rules_enabled": {
+ "name": "seed_rules_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_queues_company_key_uq": {
+ "name": "decision_queues_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_queues_company_updated_idx": {
+ "name": "decision_queues_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_queues_company_id_companies_id_fk": {
+ "name": "decision_queues_company_id_companies_id_fk",
+ "tableFrom": "decision_queues",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_queues_created_by_agent_id_agents_id_fk": {
+ "name": "decision_queues_created_by_agent_id_agents_id_fk",
+ "tableFrom": "decision_queues",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_queues_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_queues_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_queues",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk": {
+ "name": "decision_queues_created_by_agent_api_key_id_agent_api_keys_id_fk",
+ "tableFrom": "decision_queues",
+ "columnsFrom": [
+ "created_by_agent_api_key_id"
+ ],
+ "tableTo": "agent_api_keys",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "decision_queues_id_company_uq": {
+ "name": "decision_queues_id_company_uq",
+ "columns": [
+ "id",
+ "company_id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "decision_queues_creator_check": {
+ "name": "decision_queues_creator_check",
+ "value": "(\n (\"decision_queues\".\"created_by_type\" = 'agent' AND \"decision_queues\".\"created_by_agent_id\" IS NOT NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'user' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NOT NULL)\n OR (\"decision_queues\".\"created_by_type\" = 'system' AND \"decision_queues\".\"created_by_agent_id\" IS NULL AND \"decision_queues\".\"created_by_user_id\" IS NULL)\n )"
+ },
+ "decision_queues_retention_days_check": {
+ "name": "decision_queues_retention_days_check",
+ "value": "\"decision_queues\".\"retention_days\" IS NULL OR (\"decision_queues\".\"retention_days\" >= 1 AND \"decision_queues\".\"retention_days\" <= 3650)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_retention": {
+ "name": "decision_retention",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_activity_at": {
+ "name": "source_activity_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keep": {
+ "name": "keep",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_reason": {
+ "name": "archived_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_type": {
+ "name": "archived_by_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_agent_id": {
+ "name": "archived_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_user_id": {
+ "name": "archived_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_run_id": {
+ "name": "archived_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "archive_version": {
+ "name": "archive_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_retention_company_source_uq": {
+ "name": "decision_retention_company_source_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_retention_company_archived_idx": {
+ "name": "decision_retention_company_archived_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_retention_company_id_companies_id_fk": {
+ "name": "decision_retention_company_id_companies_id_fk",
+ "tableFrom": "decision_retention",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_retention_archived_by_agent_id_agents_id_fk": {
+ "name": "decision_retention_archived_by_agent_id_agents_id_fk",
+ "tableFrom": "decision_retention",
+ "columnsFrom": [
+ "archived_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_retention_archived_by_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_retention_archived_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_retention",
+ "columnsFrom": [
+ "archived_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_retention_archive_actor_check": {
+ "name": "decision_retention_archive_actor_check",
+ "value": "(\n (\"decision_retention\".\"archived_at\" IS NULL AND \"decision_retention\".\"archived_by_type\" IS NULL AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'system' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'agent' AND \"decision_retention\".\"archived_by_agent_id\" IS NOT NULL AND \"decision_retention\".\"archived_by_user_id\" IS NULL)\n OR (\"decision_retention\".\"archived_at\" IS NOT NULL AND \"decision_retention\".\"archived_by_type\" = 'user' AND \"decision_retention\".\"archived_by_agent_id\" IS NULL AND \"decision_retention\".\"archived_by_user_id\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_triage": {
+ "name": "decision_triage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decide_by": {
+ "name": "decide_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decide_by_date": {
+ "name": "decide_by_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snoozed_until": {
+ "name": "snoozed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "set_by_type": {
+ "name": "set_by_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "set_by_agent_id": {
+ "name": "set_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "set_by_user_id": {
+ "name": "set_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "set_by_run_id": {
+ "name": "set_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "set_by_agent_api_key_id": {
+ "name": "set_by_agent_api_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_triage_company_source_uq": {
+ "name": "decision_triage_company_source_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_triage_company_decide_by_idx": {
+ "name": "decision_triage_company_decide_by_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decide_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_triage_company_id_companies_id_fk": {
+ "name": "decision_triage_company_id_companies_id_fk",
+ "tableFrom": "decision_triage",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_triage_set_by_agent_id_agents_id_fk": {
+ "name": "decision_triage_set_by_agent_id_agents_id_fk",
+ "tableFrom": "decision_triage",
+ "columnsFrom": [
+ "set_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_triage_set_by_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_triage_set_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_triage",
+ "columnsFrom": [
+ "set_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk": {
+ "name": "decision_triage_set_by_agent_api_key_id_agent_api_keys_id_fk",
+ "tableFrom": "decision_triage",
+ "columnsFrom": [
+ "set_by_agent_api_key_id"
+ ],
+ "tableTo": "agent_api_keys",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_triage_actor_check": {
+ "name": "decision_triage_actor_check",
+ "value": "(\n (\"decision_triage\".\"set_by_type\" = 'agent' AND \"decision_triage\".\"set_by_agent_id\" IS NOT NULL AND \"decision_triage\".\"set_by_user_id\" IS NULL)\n OR (\"decision_triage\".\"set_by_type\" = 'user' AND \"decision_triage\".\"set_by_agent_id\" IS NULL AND \"decision_triage\".\"set_by_user_id\" IS NOT NULL)\n )"
+ },
+ "decision_triage_decide_by_check": {
+ "name": "decision_triage_decide_by_check",
+ "value": "(\n (\"decision_triage\".\"decide_by\" IS NULL AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" IN ('today', 'this_week', 'whenever') AND \"decision_triage\".\"decide_by_date\" IS NULL)\n OR (\"decision_triage\".\"decide_by\" = 'date' AND \"decision_triage\".\"decide_by_date\" IS NOT NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_triage_events": {
+ "name": "decision_triage_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "queue_id": {
+ "name": "queue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_agent_id": {
+ "name": "actor_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_run_id": {
+ "name": "actor_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_api_key_id": {
+ "name": "agent_api_key_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_triage_events_company_source_created_idx": {
+ "name": "decision_triage_events_company_source_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_triage_events_queue_created_idx": {
+ "name": "decision_triage_events_queue_created_idx",
+ "columns": [
+ {
+ "expression": "queue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_triage_events_company_id_companies_id_fk": {
+ "name": "decision_triage_events_company_id_companies_id_fk",
+ "tableFrom": "decision_triage_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_triage_events_queue_id_decision_queues_id_fk": {
+ "name": "decision_triage_events_queue_id_decision_queues_id_fk",
+ "tableFrom": "decision_triage_events",
+ "columnsFrom": [
+ "queue_id"
+ ],
+ "tableTo": "decision_queues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_triage_events_actor_agent_id_agents_id_fk": {
+ "name": "decision_triage_events_actor_agent_id_agents_id_fk",
+ "tableFrom": "decision_triage_events",
+ "columnsFrom": [
+ "actor_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_triage_events_actor_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_triage_events_actor_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_triage_events",
+ "columnsFrom": [
+ "actor_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk": {
+ "name": "decision_triage_events_agent_api_key_id_agent_api_keys_id_fk",
+ "tableFrom": "decision_triage_events",
+ "columnsFrom": [
+ "agent_api_key_id"
+ ],
+ "tableTo": "agent_api_keys",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_triage_events_actor_check": {
+ "name": "decision_triage_events_actor_check",
+ "value": "(\n (\"decision_triage_events\".\"actor_type\" = 'agent' AND \"decision_triage_events\".\"actor_agent_id\" IS NOT NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'user' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NOT NULL)\n OR (\"decision_triage_events\".\"actor_type\" = 'system' AND \"decision_triage_events\".\"actor_agent_id\" IS NULL AND \"decision_triage_events\".\"actor_user_id\" IS NULL)\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_training_examples": {
+ "name": "decision_training_examples",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cutoff_at": {
+ "name": "cutoff_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "notes_history": {
+ "name": "notes_history",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "decision_outcome": {
+ "name": "decision_outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retention_policy": {
+ "name": "retention_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'scrub_deleted_comments_v1'"
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_training_examples_company_created_at_idx": {
+ "name": "decision_training_examples_company_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_training_examples_issue_idx": {
+ "name": "decision_training_examples_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_training_examples_source_author_uq": {
+ "name": "decision_training_examples_source_author_uq",
+ "columns": [
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_training_examples_company_id_companies_id_fk": {
+ "name": "decision_training_examples_company_id_companies_id_fk",
+ "tableFrom": "decision_training_examples",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_training_examples_issue_id_issues_id_fk": {
+ "name": "decision_training_examples_issue_id_issues_id_fk",
+ "tableFrom": "decision_training_examples",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.decision_bundles": {
+ "name": "decision_bundles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_agent_id": {
+ "name": "origin_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_issue_id": {
+ "name": "origin_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_run_id": {
+ "name": "origin_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decision_bundles_company_created_at_idx": {
+ "name": "decision_bundles_company_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_bundles_company_id_companies_id_fk": {
+ "name": "decision_bundles_company_id_companies_id_fk",
+ "tableFrom": "decision_bundles",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_bundles_origin_agent_id_agents_id_fk": {
+ "name": "decision_bundles_origin_agent_id_agents_id_fk",
+ "tableFrom": "decision_bundles",
+ "columnsFrom": [
+ "origin_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_bundles_origin_issue_id_issues_id_fk": {
+ "name": "decision_bundles_origin_issue_id_issues_id_fk",
+ "tableFrom": "decision_bundles",
+ "columnsFrom": [
+ "origin_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_bundles_origin_run_id_heartbeat_runs_id_fk": {
+ "name": "decision_bundles_origin_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decision_bundles",
+ "columnsFrom": [
+ "origin_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.decision_effect_executions": {
+ "name": "decision_effect_executions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "decision_id": {
+ "name": "decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effect_index": {
+ "name": "effect_index",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effect_type": {
+ "name": "effect_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'claimed'"
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activity_log_id": {
+ "name": "activity_log_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "executed_at": {
+ "name": "executed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "decision_effect_executions_decision_effect_uq": {
+ "name": "decision_effect_executions_decision_effect_uq",
+ "columns": [
+ {
+ "expression": "decision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "effect_index",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_effect_executions_target_issue_idx": {
+ "name": "decision_effect_executions_target_issue_idx",
+ "columns": [
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_effect_executions_decision_id_decisions_id_fk": {
+ "name": "decision_effect_executions_decision_id_decisions_id_fk",
+ "tableFrom": "decision_effect_executions",
+ "columnsFrom": [
+ "decision_id"
+ ],
+ "tableTo": "decisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_effect_executions_target_issue_id_issues_id_fk": {
+ "name": "decision_effect_executions_target_issue_id_issues_id_fk",
+ "tableFrom": "decision_effect_executions",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decision_effect_executions_activity_log_id_activity_log_id_fk": {
+ "name": "decision_effect_executions_activity_log_id_activity_log_id_fk",
+ "tableFrom": "decision_effect_executions",
+ "columnsFrom": [
+ "activity_log_id"
+ ],
+ "tableTo": "activity_log",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.decision_target_issues": {
+ "name": "decision_target_issues",
+ "schema": "",
+ "columns": {
+ "decision_id": {
+ "name": "decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "decision_target_issues_decision_idx": {
+ "name": "decision_target_issues_decision_idx",
+ "columns": [
+ {
+ "expression": "decision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decision_target_issues_issue_idx": {
+ "name": "decision_target_issues_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decision_target_issues_decision_id_decisions_id_fk": {
+ "name": "decision_target_issues_decision_id_decisions_id_fk",
+ "tableFrom": "decision_target_issues",
+ "columnsFrom": [
+ "decision_id"
+ ],
+ "tableTo": "decisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_target_issues_issue_id_issues_id_fk": {
+ "name": "decision_target_issues_issue_id_issues_id_fk",
+ "tableFrom": "decision_target_issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "decision_target_issues_company_id_companies_id_fk": {
+ "name": "decision_target_issues_company_id_companies_id_fk",
+ "tableFrom": "decision_target_issues",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "decision_target_issues_decision_id_issue_id_pk": {
+ "name": "decision_target_issues_decision_id_issue_id_pk",
+ "columns": [
+ "decision_id",
+ "issue_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.decisions": {
+ "name": "decisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bundle_id": {
+ "name": "bundle_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_agent_id": {
+ "name": "origin_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_issue_id": {
+ "name": "origin_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "origin_run_id": {
+ "name": "origin_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rule_key": {
+ "name": "rule_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "inputs": {
+ "name": "inputs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "execution_status": {
+ "name": "execution_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "chosen_option_id": {
+ "name": "chosen_option_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_values": {
+ "name": "input_values",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_by_user_id": {
+ "name": "decided_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signed_spec": {
+ "name": "signed_spec",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_snapshots": {
+ "name": "target_snapshots",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "continuation_policy": {
+ "name": "continuation_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "decisions_company_status_expires_at_idx": {
+ "name": "decisions_company_status_expires_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decisions_bundle_idx": {
+ "name": "decisions_bundle_idx",
+ "columns": [
+ {
+ "expression": "bundle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decisions_origin_issue_idx": {
+ "name": "decisions_origin_issue_idx",
+ "columns": [
+ {
+ "expression": "origin_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "decisions_company_idempotency_uq": {
+ "name": "decisions_company_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"decisions\".\"idempotency_key\" IS NOT NULL",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "decisions_company_id_companies_id_fk": {
+ "name": "decisions_company_id_companies_id_fk",
+ "tableFrom": "decisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decisions_bundle_id_decision_bundles_id_fk": {
+ "name": "decisions_bundle_id_decision_bundles_id_fk",
+ "tableFrom": "decisions",
+ "columnsFrom": [
+ "bundle_id"
+ ],
+ "tableTo": "decision_bundles",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "decisions_origin_agent_id_agents_id_fk": {
+ "name": "decisions_origin_agent_id_agents_id_fk",
+ "tableFrom": "decisions",
+ "columnsFrom": [
+ "origin_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decisions_origin_issue_id_issues_id_fk": {
+ "name": "decisions_origin_issue_id_issues_id_fk",
+ "tableFrom": "decisions",
+ "columnsFrom": [
+ "origin_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "decisions_origin_run_id_heartbeat_runs_id_fk": {
+ "name": "decisions_origin_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "decisions",
+ "columnsFrom": [
+ "origin_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_annotation_anchor_snapshots": {
+ "name": "document_annotation_anchor_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_revision_id": {
+ "name": "from_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "from_revision_number": {
+ "name": "from_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "to_revision_id": {
+ "name": "to_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "to_revision_number": {
+ "name": "to_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_anchor": {
+ "name": "previous_anchor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "next_anchor": {
+ "name": "next_anchor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "anchor_state": {
+ "name": "anchor_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "anchor_confidence": {
+ "name": "anchor_confidence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_annotation_anchor_snapshots_company_thread_created_at_idx": {
+ "name": "document_annotation_anchor_snapshots_company_thread_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_anchor_snapshots_company_document_revision_idx": {
+ "name": "document_annotation_anchor_snapshots_company_document_revision_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "to_revision_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "document_annotation_anchor_snapshots_company_id_companies_id_fk": {
+ "name": "document_annotation_anchor_snapshots_company_id_companies_id_fk",
+ "tableFrom": "document_annotation_anchor_snapshots",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk": {
+ "name": "document_annotation_anchor_snapshots_thread_id_document_annotation_threads_id_fk",
+ "tableFrom": "document_annotation_anchor_snapshots",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "tableTo": "document_annotation_threads",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_anchor_snapshots_document_id_documents_id_fk": {
+ "name": "document_annotation_anchor_snapshots_document_id_documents_id_fk",
+ "tableFrom": "document_annotation_anchor_snapshots",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk": {
+ "name": "document_annotation_anchor_snapshots_from_revision_id_document_revisions_id_fk",
+ "tableFrom": "document_annotation_anchor_snapshots",
+ "columnsFrom": [
+ "from_revision_id"
+ ],
+ "tableTo": "document_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk": {
+ "name": "document_annotation_anchor_snapshots_to_revision_id_document_revisions_id_fk",
+ "tableFrom": "document_annotation_anchor_snapshots",
+ "columnsFrom": [
+ "to_revision_id"
+ ],
+ "tableTo": "document_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_annotation_comments": {
+ "name": "document_annotation_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_type": {
+ "name": "author_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_agent_id": {
+ "name": "author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_comment_id": {
+ "name": "issue_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_trust": {
+ "name": "source_trust",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_annotation_comments_company_thread_created_at_idx": {
+ "name": "document_annotation_comments_company_thread_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_company_issue_created_at_idx": {
+ "name": "document_annotation_comments_company_issue_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_company_routine_created_at_idx": {
+ "name": "document_annotation_comments_company_routine_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_company_case_created_at_idx": {
+ "name": "document_annotation_comments_company_case_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_company_document_created_at_idx": {
+ "name": "document_annotation_comments_company_document_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_issue_comment_idx": {
+ "name": "document_annotation_comments_issue_comment_idx",
+ "columns": [
+ {
+ "expression": "issue_comment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_comments_body_search_idx": {
+ "name": "document_annotation_comments_body_search_idx",
+ "columns": [
+ {
+ "expression": "body",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "document_annotation_comments_company_id_companies_id_fk": {
+ "name": "document_annotation_comments_company_id_companies_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "document_annotation_comments_thread_id_document_annotation_threads_id_fk": {
+ "name": "document_annotation_comments_thread_id_document_annotation_threads_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "tableTo": "document_annotation_threads",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_comments_issue_id_issues_id_fk": {
+ "name": "document_annotation_comments_issue_id_issues_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_comments_routine_id_routines_id_fk": {
+ "name": "document_annotation_comments_routine_id_routines_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_comments_case_id_cases_id_fk": {
+ "name": "document_annotation_comments_case_id_cases_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_comments_document_id_documents_id_fk": {
+ "name": "document_annotation_comments_document_id_documents_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_comments_author_agent_id_agents_id_fk": {
+ "name": "document_annotation_comments_author_agent_id_agents_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "document_annotation_comments_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_comments_issue_comment_id_issue_comments_id_fk": {
+ "name": "document_annotation_comments_issue_comment_id_issue_comments_id_fk",
+ "tableFrom": "document_annotation_comments",
+ "columnsFrom": [
+ "issue_comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "document_annotation_comments_exactly_one_owner_chk": {
+ "name": "document_annotation_comments_exactly_one_owner_chk",
+ "value": "num_nonnulls(\"document_annotation_comments\".\"issue_id\", \"document_annotation_comments\".\"routine_id\", \"document_annotation_comments\".\"case_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_annotation_threads": {
+ "name": "document_annotation_threads",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_key": {
+ "name": "document_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "anchor_state": {
+ "name": "anchor_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "original_revision_id": {
+ "name": "original_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "original_revision_number": {
+ "name": "original_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "current_revision_id": {
+ "name": "current_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_revision_number": {
+ "name": "current_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "selected_text": {
+ "name": "selected_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix_text": {
+ "name": "prefix_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "suffix_text": {
+ "name": "suffix_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "normalized_start": {
+ "name": "normalized_start",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_end": {
+ "name": "normalized_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "markdown_start": {
+ "name": "markdown_start",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "markdown_end": {
+ "name": "markdown_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "anchor_confidence": {
+ "name": "anchor_confidence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'exact'"
+ },
+ "anchor_selector": {
+ "name": "anchor_selector",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_agent_id": {
+ "name": "resolved_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_user_id": {
+ "name": "resolved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_annotation_threads_company_document_status_idx": {
+ "name": "document_annotation_threads_company_document_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_threads_company_issue_status_idx": {
+ "name": "document_annotation_threads_company_issue_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_threads_company_routine_status_idx": {
+ "name": "document_annotation_threads_company_routine_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_threads_company_case_status_idx": {
+ "name": "document_annotation_threads_company_case_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_threads_company_current_revision_open_idx": {
+ "name": "document_annotation_threads_company_current_revision_open_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "current_revision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_annotation_threads_company_anchor_state_idx": {
+ "name": "document_annotation_threads_company_anchor_state_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "anchor_state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "document_annotation_threads_company_id_companies_id_fk": {
+ "name": "document_annotation_threads_company_id_companies_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "document_annotation_threads_issue_id_issues_id_fk": {
+ "name": "document_annotation_threads_issue_id_issues_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_threads_routine_id_routines_id_fk": {
+ "name": "document_annotation_threads_routine_id_routines_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_threads_case_id_cases_id_fk": {
+ "name": "document_annotation_threads_case_id_cases_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_threads_document_id_documents_id_fk": {
+ "name": "document_annotation_threads_document_id_documents_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_annotation_threads_original_revision_id_document_revisions_id_fk": {
+ "name": "document_annotation_threads_original_revision_id_document_revisions_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "original_revision_id"
+ ],
+ "tableTo": "document_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_threads_current_revision_id_document_revisions_id_fk": {
+ "name": "document_annotation_threads_current_revision_id_document_revisions_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "current_revision_id"
+ ],
+ "tableTo": "document_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_threads_created_by_agent_id_agents_id_fk": {
+ "name": "document_annotation_threads_created_by_agent_id_agents_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_annotation_threads_resolved_by_agent_id_agents_id_fk": {
+ "name": "document_annotation_threads_resolved_by_agent_id_agents_id_fk",
+ "tableFrom": "document_annotation_threads",
+ "columnsFrom": [
+ "resolved_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "document_annotation_threads_exactly_one_owner_chk": {
+ "name": "document_annotation_threads_exactly_one_owner_chk",
+ "value": "num_nonnulls(\"document_annotation_threads\".\"issue_id\", \"document_annotation_threads\".\"routine_id\", \"document_annotation_threads\".\"case_id\") = 1"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_memberships": {
+ "name": "document_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "starred_at": {
+ "name": "starred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_memberships_company_user_starred_idx": {
+ "name": "document_memberships_company_user_starred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "starred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_memberships_company_user_document_uq": {
+ "name": "document_memberships_company_user_document_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "document_memberships_company_id_companies_id_fk": {
+ "name": "document_memberships_company_id_companies_id_fk",
+ "tableFrom": "document_memberships",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_memberships_document_id_documents_id_fk": {
+ "name": "document_memberships_document_id_documents_id_fk",
+ "tableFrom": "document_memberships",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_revisions": {
+ "name": "document_revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision_number": {
+ "name": "revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "format": {
+ "name": "format",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'markdown'"
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "change_summary": {
+ "name": "change_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_revisions_document_revision_uq": {
+ "name": "document_revisions_document_revision_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "document_revisions_company_document_created_idx": {
+ "name": "document_revisions_company_document_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "document_revisions_company_id_companies_id_fk": {
+ "name": "document_revisions_company_id_companies_id_fk",
+ "tableFrom": "document_revisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_revisions_document_id_documents_id_fk": {
+ "name": "document_revisions_document_id_documents_id_fk",
+ "tableFrom": "document_revisions",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "document_revisions_created_by_agent_id_agents_id_fk": {
+ "name": "document_revisions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "document_revisions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "document_revisions_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "document_revisions_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "document_revisions",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.documents": {
+ "name": "documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "format": {
+ "name": "format",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'markdown'"
+ },
+ "latest_body": {
+ "name": "latest_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "latest_revision_id": {
+ "name": "latest_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_number": {
+ "name": "latest_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked_at": {
+ "name": "locked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked_by_agent_id": {
+ "name": "locked_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locked_by_user_id": {
+ "name": "locked_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_trust": {
+ "name": "source_trust",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "documents_company_updated_idx": {
+ "name": "documents_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "documents_company_created_idx": {
+ "name": "documents_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "documents_title_search_idx": {
+ "name": "documents_title_search_idx",
+ "columns": [
+ {
+ "expression": "title",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "documents_latest_body_search_idx": {
+ "name": "documents_latest_body_search_idx",
+ "columns": [
+ {
+ "expression": "latest_body",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "documents_company_id_companies_id_fk": {
+ "name": "documents_company_id_companies_id_fk",
+ "tableFrom": "documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "documents_created_by_agent_id_agents_id_fk": {
+ "name": "documents_created_by_agent_id_agents_id_fk",
+ "tableFrom": "documents",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "documents_updated_by_agent_id_agents_id_fk": {
+ "name": "documents_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "documents",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "documents_locked_by_agent_id_agents_id_fk": {
+ "name": "documents_locked_by_agent_id_agents_id_fk",
+ "tableFrom": "documents",
+ "columnsFrom": [
+ "locked_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.email_endpoints": {
+ "name": "email_endpoints",
+ "schema": "",
+ "columns": {
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receive_mode": {
+ "name": "receive_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owned_api_key_id": {
+ "name": "owned_api_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activation_at": {
+ "name": "activation_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sync_checkpoint": {
+ "name": "sync_checkpoint",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_sync_at": {
+ "name": "last_sync_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "email_endpoints_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "email_endpoints_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "email_endpoints",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "email_endpoints_receive_mode_check": {
+ "name": "email_endpoints_receive_mode_check",
+ "value": "\"email_endpoints\".\"receive_mode\" in ('websocket', 'webhook')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.email_messages": {
+ "name": "email_messages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_id": {
+ "name": "conversation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_message_id": {
+ "name": "provider_message_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "envelope": {
+ "name": "envelope",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_text": {
+ "name": "full_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "automatic": {
+ "name": "automatic",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "attachment_ids": {
+ "name": "attachment_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "email_messages_provider_uq": {
+ "name": "email_messages_provider_uq",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "email_messages_conversation_idx": {
+ "name": "email_messages_conversation_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "timestamp",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "email_messages_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "email_messages_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "email_messages",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "email_messages_company_id_conversation_id_chat_conversations_company_id_id_fk": {
+ "name": "email_messages_company_id_conversation_id_chat_conversations_company_id_id_fk",
+ "tableFrom": "email_messages",
+ "columnsFrom": [
+ "company_id",
+ "conversation_id"
+ ],
+ "tableTo": "chat_conversations",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "email_messages_direction_check": {
+ "name": "email_messages_direction_check",
+ "value": "\"email_messages\".\"direction\" in ('inbound', 'outbound')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.email_sends": {
+ "name": "email_sends",
+ "schema": "",
+ "columns": {
+ "publication_id": {
+ "name": "publication_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request": {
+ "name": "request",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor": {
+ "name": "actor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "digest": {
+ "name": "digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "first_attempt_at": {
+ "name": "first_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "email_sends_pending_idx": {
+ "name": "email_sends_pending_idx",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "outcome",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"email_sends\".\"outcome\" in ('queued', 'uncertain')",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "email_sends_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "email_sends_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "email_sends",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "tableTo": "chat_endpoints",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "email_sends_company_id_publication_id_chat_publications_company_id_id_fk": {
+ "name": "email_sends_company_id_publication_id_chat_publications_company_id_id_fk",
+ "tableFrom": "email_sends",
+ "columnsFrom": [
+ "company_id",
+ "publication_id"
+ ],
+ "tableTo": "chat_publications",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "email_sends_outcome_check": {
+ "name": "email_sends_outcome_check",
+ "value": "\"email_sends\".\"outcome\" in ('queued', 'sent', 'delivered', 'failed', 'uncertain')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.environment_custom_image_setup_sessions": {
+ "name": "environment_custom_image_setup_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "template_id": {
+ "name": "template_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "promoted_template_id": {
+ "name": "promoted_template_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_lease_id": {
+ "name": "provider_lease_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "environment_lease_id": {
+ "name": "environment_lease_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'starting'"
+ },
+ "started_by_user_id": {
+ "name": "started_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_by_agent_id": {
+ "name": "started_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_template_ref": {
+ "name": "base_template_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_summary": {
+ "name": "connection_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_secret_ref": {
+ "name": "connection_secret_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_custom_image_setup_sessions_environment_status_idx": {
+ "name": "environment_custom_image_setup_sessions_environment_status_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_setup_sessions_environment_active_uq": {
+ "name": "environment_custom_image_setup_sessions_environment_active_uq",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"environment_custom_image_setup_sessions\".\"status\" IN ('starting', 'waiting_for_user', 'capturing')",
+ "concurrently": false
+ },
+ "environment_custom_image_setup_sessions_template_idx": {
+ "name": "environment_custom_image_setup_sessions_template_idx",
+ "columns": [
+ {
+ "expression": "template_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_setup_sessions_promoted_template_idx": {
+ "name": "environment_custom_image_setup_sessions_promoted_template_idx",
+ "columns": [
+ {
+ "expression": "promoted_template_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_setup_sessions_expires_idx": {
+ "name": "environment_custom_image_setup_sessions_expires_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_setup_sessions_provider_lease_idx": {
+ "name": "environment_custom_image_setup_sessions_provider_lease_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_lease_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "environment_custom_image_setup_sessions_environment_id_environments_id_fk": {
+ "name": "environment_custom_image_setup_sessions_environment_id_environments_id_fk",
+ "tableFrom": "environment_custom_image_setup_sessions",
+ "columnsFrom": [
+ "environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk": {
+ "name": "environment_custom_image_setup_sessions_template_id_environment_custom_image_templates_id_fk",
+ "tableFrom": "environment_custom_image_setup_sessions",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "tableTo": "environment_custom_image_templates",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk": {
+ "name": "environment_custom_image_setup_sessions_promoted_template_id_environment_custom_image_templates_id_fk",
+ "tableFrom": "environment_custom_image_setup_sessions",
+ "columnsFrom": [
+ "promoted_template_id"
+ ],
+ "tableTo": "environment_custom_image_templates",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk": {
+ "name": "environment_custom_image_setup_sessions_environment_lease_id_environment_leases_id_fk",
+ "tableFrom": "environment_custom_image_setup_sessions",
+ "columnsFrom": [
+ "environment_lease_id"
+ ],
+ "tableTo": "environment_leases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk": {
+ "name": "environment_custom_image_setup_sessions_started_by_agent_id_agents_id_fk",
+ "tableFrom": "environment_custom_image_setup_sessions",
+ "columnsFrom": [
+ "started_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_custom_image_templates": {
+ "name": "environment_custom_image_templates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "template_kind": {
+ "name": "template_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "template_ref": {
+ "name": "template_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_template_ref": {
+ "name": "source_template_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_environment_config_fingerprint": {
+ "name": "source_environment_config_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "captured_at": {
+ "name": "captured_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "superseded_by_template_id": {
+ "name": "superseded_by_template_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_custom_image_templates_environment_status_idx": {
+ "name": "environment_custom_image_templates_environment_status_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_templates_environment_provider_status_idx": {
+ "name": "environment_custom_image_templates_environment_provider_status_idx",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_templates_environment_active_uq": {
+ "name": "environment_custom_image_templates_environment_active_uq",
+ "columns": [
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"environment_custom_image_templates\".\"status\" = 'active'",
+ "concurrently": false
+ },
+ "environment_custom_image_templates_superseded_by_idx": {
+ "name": "environment_custom_image_templates_superseded_by_idx",
+ "columns": [
+ {
+ "expression": "superseded_by_template_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_custom_image_templates_last_used_idx": {
+ "name": "environment_custom_image_templates_last_used_idx",
+ "columns": [
+ {
+ "expression": "last_used_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "environment_custom_image_templates_environment_id_environments_id_fk": {
+ "name": "environment_custom_image_templates_environment_id_environments_id_fk",
+ "tableFrom": "environment_custom_image_templates",
+ "columnsFrom": [
+ "environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "environment_custom_image_templates_created_by_agent_id_agents_id_fk": {
+ "name": "environment_custom_image_templates_created_by_agent_id_agents_id_fk",
+ "tableFrom": "environment_custom_image_templates",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk": {
+ "name": "environment_custom_image_templates_superseded_by_template_id_environment_custom_image_templates_id_fk",
+ "tableFrom": "environment_custom_image_templates",
+ "columnsFrom": [
+ "superseded_by_template_id"
+ ],
+ "tableTo": "environment_custom_image_templates",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environment_leases": {
+ "name": "environment_leases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "lease_policy": {
+ "name": "lease_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ephemeral'"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_lease_id": {
+ "name": "provider_lease_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acquired_at": {
+ "name": "acquired_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_at": {
+ "name": "released_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cleanup_status": {
+ "name": "cleanup_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environment_leases_company_environment_status_idx": {
+ "name": "environment_leases_company_environment_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_leases_company_execution_workspace_idx": {
+ "name": "environment_leases_company_execution_workspace_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_leases_company_issue_idx": {
+ "name": "environment_leases_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_leases_heartbeat_run_idx": {
+ "name": "environment_leases_heartbeat_run_idx",
+ "columns": [
+ {
+ "expression": "heartbeat_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_leases_company_last_used_idx": {
+ "name": "environment_leases_company_last_used_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_used_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environment_leases_provider_lease_idx": {
+ "name": "environment_leases_provider_lease_idx",
+ "columns": [
+ {
+ "expression": "provider_lease_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "environment_leases_company_id_companies_id_fk": {
+ "name": "environment_leases_company_id_companies_id_fk",
+ "tableFrom": "environment_leases",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "environment_leases_environment_id_environments_id_fk": {
+ "name": "environment_leases_environment_id_environments_id_fk",
+ "tableFrom": "environment_leases",
+ "columnsFrom": [
+ "environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_leases_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "environment_leases_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "environment_leases",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_leases_issue_id_issues_id_fk": {
+ "name": "environment_leases_issue_id_issues_id_fk",
+ "tableFrom": "environment_leases",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "environment_leases_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "environment_leases",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.environments": {
+ "name": "environments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driver": {
+ "name": "driver",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "env_vars": {
+ "name": "env_vars",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "environments_status_idx": {
+ "name": "environments_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "environments_local_driver_idx": {
+ "name": "environments_local_driver_idx",
+ "columns": [
+ {
+ "expression": "driver",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"environments\".\"driver\" = 'local'",
+ "concurrently": false
+ },
+ "environments_managed_sandbox_idx": {
+ "name": "environments_managed_sandbox_idx",
+ "columns": [
+ {
+ "expression": "driver",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"environments\".\"driver\" = 'sandbox' AND (\"environments\".\"metadata\" ->> 'managedByPaperclip')::boolean = true",
+ "concurrently": false
+ },
+ "environments_name_idx": {
+ "name": "environments_name_idx",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.execution_workspace_runtime_leases": {
+ "name": "execution_workspace_runtime_leases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_key": {
+ "name": "owner_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_issue_id": {
+ "name": "owner_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_run_id": {
+ "name": "owner_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_action": {
+ "name": "last_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "renewed_at": {
+ "name": "renewed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "execution_workspace_runtime_leases_company_workspace_idx": {
+ "name": "execution_workspace_runtime_leases_company_workspace_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspace_runtime_leases_company_owner_idx": {
+ "name": "execution_workspace_runtime_leases_company_owner_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspace_runtime_leases_expires_at_idx": {
+ "name": "execution_workspace_runtime_leases_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "execution_workspace_runtime_leases_company_id_companies_id_fk": {
+ "name": "execution_workspace_runtime_leases_company_id_companies_id_fk",
+ "tableFrom": "execution_workspace_runtime_leases",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "execution_workspace_runtime_leases_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "execution_workspace_runtime_leases",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk": {
+ "name": "execution_workspace_runtime_leases_owner_issue_id_issues_id_fk",
+ "tableFrom": "execution_workspace_runtime_leases",
+ "columnsFrom": [
+ "owner_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk": {
+ "name": "execution_workspace_runtime_leases_owner_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "execution_workspace_runtime_leases",
+ "columnsFrom": [
+ "owner_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk": {
+ "name": "execution_workspace_runtime_leases_owner_agent_id_agents_id_fk",
+ "tableFrom": "execution_workspace_runtime_leases",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "execution_workspace_runtime_leases_execution_workspace_id_unique": {
+ "name": "execution_workspace_runtime_leases_execution_workspace_id_unique",
+ "columns": [
+ "execution_workspace_id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.execution_workspaces": {
+ "name": "execution_workspaces",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_workspace_id": {
+ "name": "project_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "strategy_type": {
+ "name": "strategy_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "cwd": {
+ "name": "cwd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_url": {
+ "name": "repo_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "base_ref": {
+ "name": "base_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "branch_name": {
+ "name": "branch_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_type": {
+ "name": "provider_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_fs'"
+ },
+ "provider_ref": {
+ "name": "provider_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "derived_from_execution_workspace_id": {
+ "name": "derived_from_execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "opened_at": {
+ "name": "opened_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cleanup_eligible_at": {
+ "name": "cleanup_eligible_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cleanup_reason": {
+ "name": "cleanup_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "execution_workspaces_company_project_status_idx": {
+ "name": "execution_workspaces_company_project_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspaces_company_project_workspace_status_idx": {
+ "name": "execution_workspaces_company_project_workspace_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspaces_company_source_issue_idx": {
+ "name": "execution_workspaces_company_source_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspaces_company_last_used_idx": {
+ "name": "execution_workspaces_company_last_used_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_used_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "execution_workspaces_company_branch_idx": {
+ "name": "execution_workspaces_company_branch_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "branch_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "execution_workspaces_company_id_companies_id_fk": {
+ "name": "execution_workspaces_company_id_companies_id_fk",
+ "tableFrom": "execution_workspaces",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "execution_workspaces_project_id_projects_id_fk": {
+ "name": "execution_workspaces_project_id_projects_id_fk",
+ "tableFrom": "execution_workspaces",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "execution_workspaces_project_workspace_id_project_workspaces_id_fk": {
+ "name": "execution_workspaces_project_workspace_id_project_workspaces_id_fk",
+ "tableFrom": "execution_workspaces",
+ "columnsFrom": [
+ "project_workspace_id"
+ ],
+ "tableTo": "project_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "execution_workspaces_source_issue_id_issues_id_fk": {
+ "name": "execution_workspaces_source_issue_id_issues_id_fk",
+ "tableFrom": "execution_workspaces",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "execution_workspaces_derived_from_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "execution_workspaces",
+ "columnsFrom": [
+ "derived_from_execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_object_mentions": {
+ "name": "external_object_mentions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_record_id": {
+ "name": "source_record_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_key": {
+ "name": "document_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "property_key": {
+ "name": "property_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "matched_text_redacted": {
+ "name": "matched_text_redacted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sanitized_display_url": {
+ "name": "sanitized_display_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canonical_identity_hash": {
+ "name": "canonical_identity_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canonical_identity": {
+ "name": "canonical_identity",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_id": {
+ "name": "object_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_key": {
+ "name": "provider_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "detector_key": {
+ "name": "detector_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_type": {
+ "name": "object_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confidence": {
+ "name": "confidence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'exact'"
+ },
+ "created_by_plugin_id": {
+ "name": "created_by_plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "external_object_mentions_company_source_issue_idx": {
+ "name": "external_object_mentions_company_source_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_object_mentions_company_object_idx": {
+ "name": "external_object_mentions_company_object_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_object_mentions_company_provider_idx": {
+ "name": "external_object_mentions_company_provider_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_object_mentions_company_source_record_uq": {
+ "name": "external_object_mentions_company_source_record_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_record_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "property_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "canonical_identity_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"external_object_mentions\".\"source_record_id\" is not null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",
+ "concurrently": false
+ },
+ "external_object_mentions_company_source_null_record_uq": {
+ "name": "external_object_mentions_company_source_null_record_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "property_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "canonical_identity_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"external_object_mentions\".\"source_record_id\" is null and \"external_object_mentions\".\"canonical_identity_hash\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "external_object_mentions_company_id_companies_id_fk": {
+ "name": "external_object_mentions_company_id_companies_id_fk",
+ "tableFrom": "external_object_mentions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "external_object_mentions_source_issue_id_issues_id_fk": {
+ "name": "external_object_mentions_source_issue_id_issues_id_fk",
+ "tableFrom": "external_object_mentions",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "external_object_mentions_object_id_external_objects_id_fk": {
+ "name": "external_object_mentions_object_id_external_objects_id_fk",
+ "tableFrom": "external_object_mentions",
+ "columnsFrom": [
+ "object_id"
+ ],
+ "tableTo": "external_objects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "external_object_mentions_created_by_plugin_id_plugins_id_fk": {
+ "name": "external_object_mentions_created_by_plugin_id_plugins_id_fk",
+ "tableFrom": "external_object_mentions",
+ "columnsFrom": [
+ "created_by_plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_objects": {
+ "name": "external_objects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_key": {
+ "name": "provider_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_type": {
+ "name": "object_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sanitized_canonical_url": {
+ "name": "sanitized_canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canonical_identity_hash": {
+ "name": "canonical_identity_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_key": {
+ "name": "display_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon_key": {
+ "name": "icon_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_title": {
+ "name": "display_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_key": {
+ "name": "status_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_label": {
+ "name": "status_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_icon_key": {
+ "name": "status_icon_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status_category": {
+ "name": "status_category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "status_tone": {
+ "name": "status_tone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'neutral'"
+ },
+ "liveness": {
+ "name": "liveness",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "is_terminal": {
+ "name": "is_terminal",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "remote_version": {
+ "name": "remote_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "etag": {
+ "name": "etag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_resolved_at": {
+ "name": "last_resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_changed_at": {
+ "name": "last_changed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_at": {
+ "name": "last_error_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_refresh_at": {
+ "name": "next_refresh_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_started_at": {
+ "name": "refresh_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_message": {
+ "name": "last_error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "external_objects_company_provider_object_idx": {
+ "name": "external_objects_company_provider_object_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_objects_company_provider_status_idx": {
+ "name": "external_objects_company_provider_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status_category",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_objects_company_refresh_idx": {
+ "name": "external_objects_company_refresh_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_refresh_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_objects_company_external_id_uq": {
+ "name": "external_objects_company_external_id_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "external_objects_company_identity_uq": {
+ "name": "external_objects_company_identity_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "object_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "canonical_identity_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "external_objects_company_id_companies_id_fk": {
+ "name": "external_objects_company_id_companies_id_fk",
+ "tableFrom": "external_objects",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "external_objects_plugin_id_plugins_id_fk": {
+ "name": "external_objects_plugin_id_plugins_id_fk",
+ "tableFrom": "external_objects",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.feedback_exports": {
+ "name": "feedback_exports",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feedback_vote_id": {
+ "name": "feedback_vote_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vote": {
+ "name": "vote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_only'"
+ },
+ "destination": {
+ "name": "destination",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "export_id": {
+ "name": "export_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consent_version": {
+ "name": "consent_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schema_version": {
+ "name": "schema_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip-feedback-envelope-v2'"
+ },
+ "bundle_version": {
+ "name": "bundle_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip-feedback-bundle-v2'"
+ },
+ "payload_version": {
+ "name": "payload_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip-feedback-v1'"
+ },
+ "payload_digest": {
+ "name": "payload_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload_snapshot": {
+ "name": "payload_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_summary": {
+ "name": "target_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redaction_summary": {
+ "name": "redaction_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempted_at": {
+ "name": "last_attempted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "exported_at": {
+ "name": "exported_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "feedback_exports_feedback_vote_idx": {
+ "name": "feedback_exports_feedback_vote_idx",
+ "columns": [
+ {
+ "expression": "feedback_vote_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_exports_company_created_idx": {
+ "name": "feedback_exports_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_exports_company_status_idx": {
+ "name": "feedback_exports_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_exports_company_issue_idx": {
+ "name": "feedback_exports_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_exports_company_project_idx": {
+ "name": "feedback_exports_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_exports_company_author_idx": {
+ "name": "feedback_exports_company_author_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "author_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "feedback_exports_company_id_companies_id_fk": {
+ "name": "feedback_exports_company_id_companies_id_fk",
+ "tableFrom": "feedback_exports",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "feedback_exports_feedback_vote_id_feedback_votes_id_fk": {
+ "name": "feedback_exports_feedback_vote_id_feedback_votes_id_fk",
+ "tableFrom": "feedback_exports",
+ "columnsFrom": [
+ "feedback_vote_id"
+ ],
+ "tableTo": "feedback_votes",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "feedback_exports_issue_id_issues_id_fk": {
+ "name": "feedback_exports_issue_id_issues_id_fk",
+ "tableFrom": "feedback_exports",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "feedback_exports_project_id_projects_id_fk": {
+ "name": "feedback_exports_project_id_projects_id_fk",
+ "tableFrom": "feedback_exports",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.feedback_votes": {
+ "name": "feedback_votes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vote": {
+ "name": "vote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shared_with_labs": {
+ "name": "shared_with_labs",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "shared_at": {
+ "name": "shared_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consent_version": {
+ "name": "consent_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redaction_summary": {
+ "name": "redaction_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "feedback_votes_company_issue_idx": {
+ "name": "feedback_votes_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_votes_issue_target_idx": {
+ "name": "feedback_votes_issue_target_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_votes_author_idx": {
+ "name": "feedback_votes_author_idx",
+ "columns": [
+ {
+ "expression": "author_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "feedback_votes_company_target_author_idx": {
+ "name": "feedback_votes_company_target_author_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "author_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "feedback_votes_company_id_companies_id_fk": {
+ "name": "feedback_votes_company_id_companies_id_fk",
+ "tableFrom": "feedback_votes",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "feedback_votes_issue_id_issues_id_fk": {
+ "name": "feedback_votes_issue_id_issues_id_fk",
+ "tableFrom": "feedback_votes",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.finance_events": {
+ "name": "finance_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_code": {
+ "name": "billing_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_kind": {
+ "name": "event_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'debit'"
+ },
+ "biller": {
+ "name": "biller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_adapter_type": {
+ "name": "execution_adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing_tier": {
+ "name": "pricing_tier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "region": {
+ "name": "region",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unit": {
+ "name": "unit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'USD'"
+ },
+ "estimated": {
+ "name": "estimated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "external_invoice_id": {
+ "name": "external_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata_json": {
+ "name": "metadata_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "finance_events_company_receipt_idx": {
+ "name": "finance_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_occurred_idx": {
+ "name": "finance_events_company_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_biller_occurred_idx": {
+ "name": "finance_events_company_biller_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_kind_occurred_idx": {
+ "name": "finance_events_company_kind_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "event_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_direction_occurred_idx": {
+ "name": "finance_events_company_direction_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "direction",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_heartbeat_run_idx": {
+ "name": "finance_events_company_heartbeat_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "heartbeat_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "finance_events_company_cost_event_idx": {
+ "name": "finance_events_company_cost_event_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "finance_events_company_id_companies_id_fk": {
+ "name": "finance_events_company_id_companies_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "finance_events_agent_id_agents_id_fk": {
+ "name": "finance_events_agent_id_agents_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "finance_events_issue_id_issues_id_fk": {
+ "name": "finance_events_issue_id_issues_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "finance_events_project_id_projects_id_fk": {
+ "name": "finance_events_project_id_projects_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "finance_events_goal_id_goals_id_fk": {
+ "name": "finance_events_goal_id_goals_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "finance_events_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "finance_events_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "finance_events_cost_event_id_cost_events_id_fk": {
+ "name": "finance_events_cost_event_id_cost_events_id_fk",
+ "tableFrom": "finance_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "tableTo": "cost_events",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.folders": {
+ "name": "folders",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "system_key": {
+ "name": "system_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "folders_company_kind_position_idx": {
+ "name": "folders_company_kind_position_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "folders_company_kind_root_slug_uq": {
+ "name": "folders_company_kind_root_slug_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"folders\".\"parent_id\" is null",
+ "concurrently": false
+ },
+ "folders_company_kind_parent_slug_uq": {
+ "name": "folders_company_kind_parent_slug_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"folders\".\"parent_id\" is not null",
+ "concurrently": false
+ },
+ "folders_company_kind_system_key_uq": {
+ "name": "folders_company_kind_system_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "system_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"folders\".\"system_key\" is not null",
+ "concurrently": false
+ },
+ "folders_company_kind_parent_position_idx": {
+ "name": "folders_company_kind_parent_position_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "folders_company_id_companies_id_fk": {
+ "name": "folders_company_id_companies_id_fk",
+ "tableFrom": "folders",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "folders_parent_id_folders_id_fk": {
+ "name": "folders_parent_id_folders_id_fk",
+ "tableFrom": "folders",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "tableTo": "folders",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.goals": {
+ "name": "goals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "level": {
+ "name": "level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'task'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'planned'"
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "goals_company_idx": {
+ "name": "goals_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "goals_company_id_companies_id_fk": {
+ "name": "goals_company_id_companies_id_fk",
+ "tableFrom": "goals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "goals_parent_id_goals_id_fk": {
+ "name": "goals_parent_id_goals_id_fk",
+ "tableFrom": "goals",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "goals_owner_agent_id_agents_id_fk": {
+ "name": "goals_owner_agent_id_agents_id_fk",
+ "tableFrom": "goals",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.heartbeat_run_events": {
+ "name": "heartbeat_run_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "seq": {
+ "name": "seq",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stream": {
+ "name": "stream",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "level": {
+ "name": "level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_instance_id": {
+ "name": "source_instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_event_id": {
+ "name": "source_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_seq": {
+ "name": "source_seq",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_payload_sha256": {
+ "name": "source_payload_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "protocol_schema_version": {
+ "name": "protocol_schema_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "heartbeat_run_events_run_seq_uq": {
+ "name": "heartbeat_run_events_run_seq_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "seq",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_run_events_run_source_event_uq": {
+ "name": "heartbeat_run_events_run_source_event_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_run_events\".\"source_event_id\" is not null",
+ "concurrently": false
+ },
+ "heartbeat_run_events_run_source_seq_uq": {
+ "name": "heartbeat_run_events_run_source_seq_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_instance_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_seq",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_run_events\".\"source_instance_id\" is not null and \"heartbeat_run_events\".\"source_seq\" is not null",
+ "concurrently": false
+ },
+ "heartbeat_run_events_company_run_idx": {
+ "name": "heartbeat_run_events_company_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_run_events_company_created_idx": {
+ "name": "heartbeat_run_events_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "heartbeat_run_events_company_id_companies_id_fk": {
+ "name": "heartbeat_run_events_company_id_companies_id_fk",
+ "tableFrom": "heartbeat_run_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_run_events_run_id_heartbeat_runs_id_fk": {
+ "name": "heartbeat_run_events_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "heartbeat_run_events",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_run_events_agent_id_agents_id_fk": {
+ "name": "heartbeat_run_events_agent_id_agents_id_fk",
+ "tableFrom": "heartbeat_run_events",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.heartbeat_run_watchdog_decisions": {
+ "name": "heartbeat_run_watchdog_decisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluation_issue_id": {
+ "name": "evaluation_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision": {
+ "name": "decision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "snoozed_until": {
+ "name": "snoozed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "heartbeat_run_watchdog_decisions_company_run_created_idx": {
+ "name": "heartbeat_run_watchdog_decisions_company_run_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_run_watchdog_decisions_company_run_snooze_idx": {
+ "name": "heartbeat_run_watchdog_decisions_company_run_snooze_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "snoozed_until",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "heartbeat_run_watchdog_decisions_company_id_companies_id_fk": {
+ "name": "heartbeat_run_watchdog_decisions_company_id_companies_id_fk",
+ "tableFrom": "heartbeat_run_watchdog_decisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk": {
+ "name": "heartbeat_run_watchdog_decisions_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "heartbeat_run_watchdog_decisions",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk": {
+ "name": "heartbeat_run_watchdog_decisions_evaluation_issue_id_issues_id_fk",
+ "tableFrom": "heartbeat_run_watchdog_decisions",
+ "columnsFrom": [
+ "evaluation_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk": {
+ "name": "heartbeat_run_watchdog_decisions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "heartbeat_run_watchdog_decisions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "heartbeat_run_watchdog_decisions_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "heartbeat_run_watchdog_decisions",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.heartbeat_runs": {
+ "name": "heartbeat_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_source": {
+ "name": "invocation_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'on_demand'"
+ },
+ "trigger_detail": {
+ "name": "trigger_detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_identity_context_id": {
+ "name": "active_identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_control_deadline_at": {
+ "name": "execution_control_deadline_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_status_delivery_id": {
+ "name": "execution_status_delivery_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "wakeup_request_id": {
+ "name": "wakeup_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signal": {
+ "name": "signal",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_accounting_pending": {
+ "name": "cost_accounting_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cost_accounted_at": {
+ "name": "cost_accounted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_projection_version": {
+ "name": "accounting_projection_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_attempt_at": {
+ "name": "accounting_last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_error": {
+ "name": "accounting_last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_attempt_count": {
+ "name": "accounting_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "usage_json": {
+ "name": "usage_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_json": {
+ "name": "result_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_mode": {
+ "name": "runtime_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'legacy'"
+ },
+ "runtime_mode_resolver_version": {
+ "name": "runtime_mode_resolver_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_mode_reason": {
+ "name": "runtime_mode_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_mode_resolved_at": {
+ "name": "runtime_mode_resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runner_profile_json": {
+ "name": "runner_profile_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runner_instance_id": {
+ "name": "runner_instance_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "native_session_id": {
+ "name": "native_session_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "native_issue_id": {
+ "name": "native_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driver_kind": {
+ "name": "driver_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "driver_version": {
+ "name": "driver_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion_contract_id": {
+ "name": "completion_contract_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion_contract_sha256": {
+ "name": "completion_contract_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_event_seq": {
+ "name": "next_event_seq",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "native_phase": {
+ "name": "native_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "native_phase_updated_at": {
+ "name": "native_phase_updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id_before": {
+ "name": "session_id_before",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id_after": {
+ "name": "session_id_after",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_store": {
+ "name": "log_store",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_ref": {
+ "name": "log_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_bytes": {
+ "name": "log_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_sha256": {
+ "name": "log_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_compressed": {
+ "name": "log_compressed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "stdout_excerpt": {
+ "name": "stdout_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stderr_excerpt": {
+ "name": "stderr_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_run_id": {
+ "name": "external_run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_boot_id": {
+ "name": "controller_boot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_lease_expires_at": {
+ "name": "controller_lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_stage": {
+ "name": "execution_stage",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_pid": {
+ "name": "process_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_group_id": {
+ "name": "process_group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_started_at": {
+ "name": "process_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_output_at": {
+ "name": "last_output_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_output_seq": {
+ "name": "last_output_seq",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_output_stream": {
+ "name": "last_output_stream",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_output_bytes": {
+ "name": "last_output_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retry_of_run_id": {
+ "name": "retry_of_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_loss_retry_count": {
+ "name": "process_loss_retry_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "scheduled_retry_at": {
+ "name": "scheduled_retry_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_retry_attempt": {
+ "name": "scheduled_retry_attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "scheduled_retry_reason": {
+ "name": "scheduled_retry_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_comment_status": {
+ "name": "issue_comment_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'not_applicable'"
+ },
+ "issue_comment_satisfied_by_comment_id": {
+ "name": "issue_comment_satisfied_by_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_comment_retry_queued_at": {
+ "name": "issue_comment_retry_queued_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "liveness_state": {
+ "name": "liveness_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "liveness_reason": {
+ "name": "liveness_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "continuation_attempt": {
+ "name": "continuation_attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_useful_action_at": {
+ "name": "last_useful_action_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_action": {
+ "name": "next_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context_snapshot": {
+ "name": "context_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "heartbeat_runs_cost_accounting_pending_idx": {
+ "name": "heartbeat_runs_cost_accounting_pending_idx",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_runs\".\"cost_accounting_pending\" = true",
+ "concurrently": false
+ },
+ "heartbeat_runs_execution_status_delivery_idx": {
+ "name": "heartbeat_runs_execution_status_delivery_idx",
+ "columns": [
+ {
+ "expression": "execution_status_delivery_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_runs\".\"execution_status_delivery_id\" is not null",
+ "concurrently": false
+ },
+ "heartbeat_runs_execution_control_deadline_idx": {
+ "name": "heartbeat_runs_execution_control_deadline_idx",
+ "columns": [
+ {
+ "expression": "execution_control_deadline_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_runs\".\"execution_control_deadline_at\" is not null",
+ "concurrently": false
+ },
+ "heartbeat_runs_native_replacement_predecessor_uq": {
+ "name": "heartbeat_runs_native_replacement_predecessor_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "retry_of_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"heartbeat_runs\".\"scheduled_retry_reason\" = 'native_safe_replacement'",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_agent_started_idx": {
+ "name": "heartbeat_runs_company_agent_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_issue_created_idx": {
+ "name": "heartbeat_runs_company_issue_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_responsible_user_idx": {
+ "name": "heartbeat_runs_company_responsible_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_liveness_idx": {
+ "name": "heartbeat_runs_company_liveness_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "liveness_state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_status_last_output_idx": {
+ "name": "heartbeat_runs_company_status_last_output_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "last_output_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_status_process_started_idx": {
+ "name": "heartbeat_runs_company_status_process_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "process_started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_created_at_desc_idx": {
+ "name": "heartbeat_runs_company_created_at_desc_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_ctx_issue_created_idx": {
+ "name": "heartbeat_runs_company_ctx_issue_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "(\"context_snapshot\" ->> 'issueId')",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_ctx_task_created_idx": {
+ "name": "heartbeat_runs_company_ctx_task_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "(\"context_snapshot\" ->> 'taskId')",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "heartbeat_runs_company_ctx_taskkey_created_idx": {
+ "name": "heartbeat_runs_company_ctx_taskkey_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "(\"context_snapshot\" ->> 'taskKey')",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "heartbeat_runs_company_id_companies_id_fk": {
+ "name": "heartbeat_runs_company_id_companies_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_runs_agent_id_agents_id_fk": {
+ "name": "heartbeat_runs_agent_id_agents_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_runs_issue_id_issues_id_fk": {
+ "name": "heartbeat_runs_issue_id_issues_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {
+ "name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "columnsFrom": [
+ "wakeup_request_id"
+ ],
+ "tableTo": "agent_wakeup_requests",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk": {
+ "name": "heartbeat_runs_retry_of_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "columnsFrom": [
+ "retry_of_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "heartbeat_runs_company_native_issue_id_uq": {
+ "name": "heartbeat_runs_company_native_issue_id_uq",
+ "columns": [
+ "company_id",
+ "native_issue_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ },
+ "heartbeat_runs_company_native_issue_contract_id_uq": {
+ "name": "heartbeat_runs_company_native_issue_contract_id_uq",
+ "columns": [
+ "company_id",
+ "native_issue_id",
+ "id",
+ "completion_contract_id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "heartbeat_runs_scope_binding_check": {
+ "name": "heartbeat_runs_scope_binding_check",
+ "value": "(\"heartbeat_runs\".\"scope_kind\" = 'company' AND \"heartbeat_runs\".\"issue_id\" IS NULL)\n OR \"heartbeat_runs\".\"scope_kind\" = 'issue'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.inbox_dismissals": {
+ "name": "inbox_dismissals",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_key": {
+ "name": "item_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'dismiss'"
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "snoozed_until": {
+ "name": "snoozed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "inbox_dismissals_company_user_idx": {
+ "name": "inbox_dismissals_company_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "inbox_dismissals_company_item_idx": {
+ "name": "inbox_dismissals_company_item_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "item_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "inbox_dismissals_company_user_item_idx": {
+ "name": "inbox_dismissals_company_user_item_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "item_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "inbox_dismissals_company_id_companies_id_fk": {
+ "name": "inbox_dismissals_company_id_companies_id_fk",
+ "tableFrom": "inbox_dismissals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.connection_grant_delegations": {
+ "name": "connection_grant_delegations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_grant_delegations_company_agent_idx": {
+ "name": "connection_grant_delegations_company_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grant_delegations_grant_agent_uq": {
+ "name": "connection_grant_delegations_grant_agent_uq",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_grant_delegations_company_id_companies_id_fk": {
+ "name": "connection_grant_delegations_company_id_companies_id_fk",
+ "tableFrom": "connection_grant_delegations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_grant_delegations_agent_id_agents_id_fk": {
+ "name": "connection_grant_delegations_agent_id_agents_id_fk",
+ "tableFrom": "connection_grant_delegations",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_grant_delegations_company_grant_fk": {
+ "name": "connection_grant_delegations_company_grant_fk",
+ "tableFrom": "connection_grant_delegations",
+ "columnsFrom": [
+ "company_id",
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.connection_grant_members": {
+ "name": "connection_grant_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_grant_members_company_subject_idx": {
+ "name": "connection_grant_members_company_subject_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grant_members_grant_subject_uq": {
+ "name": "connection_grant_members_grant_subject_uq",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_grant_members_company_id_companies_id_fk": {
+ "name": "connection_grant_members_company_id_companies_id_fk",
+ "tableFrom": "connection_grant_members",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_grant_members_company_grant_fk": {
+ "name": "connection_grant_members_company_grant_fk",
+ "tableFrom": "connection_grant_members",
+ "columnsFrom": [
+ "company_id",
+ "grant_id"
+ ],
+ "tableTo": "connection_grants",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "connection_grant_members_subject_type_check": {
+ "name": "connection_grant_members_subject_type_check",
+ "value": "\"connection_grant_members\".\"subject_type\" in ('user')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.connection_grants": {
+ "name": "connection_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_user_id": {
+ "name": "subject_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_agent_id": {
+ "name": "subject_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_tenant": {
+ "name": "provider_tenant",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_secret_refs": {
+ "name": "credential_secret_refs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "external_credential": {
+ "name": "external_credential",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_by_agent_id": {
+ "name": "revoked_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_by_user_id": {
+ "name": "revoked_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_grants_company_connection_idx": {
+ "name": "connection_grants_company_connection_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grants_subject_user_idx": {
+ "name": "connection_grants_subject_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grants_subject_agent_idx": {
+ "name": "connection_grants_subject_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grants_user_uq": {
+ "name": "connection_grants_user_uq",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grants_agent_uq": {
+ "name": "connection_grants_agent_uq",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_grants_default_uq": {
+ "name": "connection_grants_default_uq",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"connection_grants\".\"is_default\" = true and \"connection_grants\".\"kind\" = 'organization'",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_grants_company_id_companies_id_fk": {
+ "name": "connection_grants_company_id_companies_id_fk",
+ "tableFrom": "connection_grants",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_grants_subject_agent_id_agents_id_fk": {
+ "name": "connection_grants_subject_agent_id_agents_id_fk",
+ "tableFrom": "connection_grants",
+ "columnsFrom": [
+ "subject_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_grants_created_by_agent_id_agents_id_fk": {
+ "name": "connection_grants_created_by_agent_id_agents_id_fk",
+ "tableFrom": "connection_grants",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "connection_grants_revoked_by_agent_id_agents_id_fk": {
+ "name": "connection_grants_revoked_by_agent_id_agents_id_fk",
+ "tableFrom": "connection_grants",
+ "columnsFrom": [
+ "revoked_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "connection_grants_company_connection_fk": {
+ "name": "connection_grants_company_connection_fk",
+ "tableFrom": "connection_grants",
+ "columnsFrom": [
+ "company_id",
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "connection_grants_company_id_uq": {
+ "name": "connection_grants_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "connection_grants_kind_check": {
+ "name": "connection_grants_kind_check",
+ "value": "\"connection_grants\".\"kind\" in ('organization', 'user', 'agent')"
+ },
+ "connection_grants_status_check": {
+ "name": "connection_grants_status_check",
+ "value": "\"connection_grants\".\"status\" in ('active', 'revoked', 'expired', 'needs_reauthorization')"
+ },
+ "connection_grants_credential_source_one_of_check": {
+ "name": "connection_grants_credential_source_one_of_check",
+ "value": "\"connection_grants\".\"external_credential\" is null or jsonb_array_length(\"connection_grants\".\"credential_secret_refs\") = 0"
+ },
+ "connection_grants_subject_check": {
+ "name": "connection_grants_subject_check",
+ "value": "(\"connection_grants\".\"kind\" = 'user' and \"connection_grants\".\"subject_user_id\" is not null and \"connection_grants\".\"subject_agent_id\" is null) or (\"connection_grants\".\"kind\" = 'agent' and \"connection_grants\".\"subject_agent_id\" is not null and \"connection_grants\".\"subject_user_id\" is null) or (\"connection_grants\".\"kind\" = 'organization' and \"connection_grants\".\"subject_user_id\" is null and \"connection_grants\".\"subject_agent_id\" is null)"
+ },
+ "connection_grants_default_check": {
+ "name": "connection_grants_default_check",
+ "value": "\"connection_grants\".\"is_default\" = false or \"connection_grants\".\"kind\" = 'organization'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.connection_token_issuances": {
+ "name": "connection_token_issuances",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_scope": {
+ "name": "requested_scope",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "issued_scope": {
+ "name": "issued_scope",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "ttl_seconds": {
+ "name": "ttl_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "connection_token_issuances_company_created_idx": {
+ "name": "connection_token_issuances_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_token_issuances_connection_created_idx": {
+ "name": "connection_token_issuances_connection_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_token_issuances_agent_connection_idx": {
+ "name": "connection_token_issuances_agent_connection_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "connection_token_issuances_run_idx": {
+ "name": "connection_token_issuances_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "connection_token_issuances_company_id_companies_id_fk": {
+ "name": "connection_token_issuances_company_id_companies_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_token_issuances_application_id_tool_applications_id_fk": {
+ "name": "connection_token_issuances_application_id_tool_applications_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "connection_token_issuances_connection_id_tool_connections_id_fk": {
+ "name": "connection_token_issuances_connection_id_tool_connections_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_token_issuances_agent_id_agents_id_fk": {
+ "name": "connection_token_issuances_agent_id_agents_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "connection_token_issuances_run_id_heartbeat_runs_id_fk": {
+ "name": "connection_token_issuances_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "connection_token_issuances_issue_id_issues_id_fk": {
+ "name": "connection_token_issuances_issue_id_issues_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "connection_token_issuances_project_id_projects_id_fk": {
+ "name": "connection_token_issuances_project_id_projects_id_fk",
+ "tableFrom": "connection_token_issuances",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.instance_settings": {
+ "name": "instance_settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "singleton_key": {
+ "name": "singleton_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "default_environment_id": {
+ "name": "default_environment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "general": {
+ "name": "general",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "experimental": {
+ "name": "experimental",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "instance_settings_singleton_key_idx": {
+ "name": "instance_settings_singleton_key_idx",
+ "columns": [
+ {
+ "expression": "singleton_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "instance_settings_default_environment_id_environments_id_fk": {
+ "name": "instance_settings_default_environment_id_environments_id_fk",
+ "tableFrom": "instance_settings",
+ "columnsFrom": [
+ "default_environment_id"
+ ],
+ "tableTo": "environments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.instance_user_roles": {
+ "name": "instance_user_roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'instance_admin'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "instance_user_roles_user_role_unique_idx": {
+ "name": "instance_user_roles_user_role_unique_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "instance_user_roles_role_idx": {
+ "name": "instance_user_roles_role_idx",
+ "columns": [
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invites": {
+ "name": "invites",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invite_type": {
+ "name": "invite_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company_join'"
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "allowed_join_types": {
+ "name": "allowed_join_types",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'both'"
+ },
+ "defaults_payload": {
+ "name": "defaults_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "invites_token_hash_unique_idx": {
+ "name": "invites_token_hash_unique_idx",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "invites_company_invite_state_idx": {
+ "name": "invites_company_invite_state_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invite_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "invites_company_id_companies_id_fk": {
+ "name": "invites_company_id_companies_id_fk",
+ "tableFrom": "invites",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_access_grants": {
+ "name": "issue_access_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_by_agent_id": {
+ "name": "granted_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_access_grants_subject_active_issue_idx": {
+ "name": "issue_access_grants_subject_active_issue_idx",
+ "columns": [
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_access_grants_issue_idx": {
+ "name": "issue_access_grants_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_access_grants_issue_id_issues_id_fk": {
+ "name": "issue_access_grants_issue_id_issues_id_fk",
+ "tableFrom": "issue_access_grants",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_access_grants_granted_by_agent_id_agents_id_fk": {
+ "name": "issue_access_grants_granted_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_access_grants",
+ "columnsFrom": [
+ "granted_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_access_grants_subject_type_check": {
+ "name": "issue_access_grants_subject_type_check",
+ "value": "\"issue_access_grants\".\"subject_type\" in ('user', 'agent')"
+ },
+ "issue_access_grants_source_check": {
+ "name": "issue_access_grants_source_check",
+ "value": "\"issue_access_grants\".\"source\" in ('explicit', 'assignment', 'project')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_approvals": {
+ "name": "issue_approvals",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approval_id": {
+ "name": "approval_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "linked_by_agent_id": {
+ "name": "linked_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_by_user_id": {
+ "name": "linked_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_approvals_issue_idx": {
+ "name": "issue_approvals_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_approvals_approval_idx": {
+ "name": "issue_approvals_approval_idx",
+ "columns": [
+ {
+ "expression": "approval_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_approvals_company_idx": {
+ "name": "issue_approvals_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_approvals_company_id_companies_id_fk": {
+ "name": "issue_approvals_company_id_companies_id_fk",
+ "tableFrom": "issue_approvals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_approvals_issue_id_issues_id_fk": {
+ "name": "issue_approvals_issue_id_issues_id_fk",
+ "tableFrom": "issue_approvals",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_approvals_approval_id_approvals_id_fk": {
+ "name": "issue_approvals_approval_id_approvals_id_fk",
+ "tableFrom": "issue_approvals",
+ "columnsFrom": [
+ "approval_id"
+ ],
+ "tableTo": "approvals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_approvals_linked_by_agent_id_agents_id_fk": {
+ "name": "issue_approvals_linked_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_approvals",
+ "columnsFrom": [
+ "linked_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_approvals_pk": {
+ "name": "issue_approvals_pk",
+ "columns": [
+ "issue_id",
+ "approval_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_attachments": {
+ "name": "issue_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "asset_id": {
+ "name": "asset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_comment_id": {
+ "name": "issue_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "originating_run_id": {
+ "name": "originating_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_attachments_company_issue_idx": {
+ "name": "issue_attachments_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_attachments_issue_comment_idx": {
+ "name": "issue_attachments_issue_comment_idx",
+ "columns": [
+ {
+ "expression": "issue_comment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_attachments_originating_run_idx": {
+ "name": "issue_attachments_originating_run_idx",
+ "columns": [
+ {
+ "expression": "originating_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_attachments_asset_uq": {
+ "name": "issue_attachments_asset_uq",
+ "columns": [
+ {
+ "expression": "asset_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_attachments_company_id_companies_id_fk": {
+ "name": "issue_attachments_company_id_companies_id_fk",
+ "tableFrom": "issue_attachments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_attachments_issue_id_issues_id_fk": {
+ "name": "issue_attachments_issue_id_issues_id_fk",
+ "tableFrom": "issue_attachments",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_attachments_asset_id_assets_id_fk": {
+ "name": "issue_attachments_asset_id_assets_id_fk",
+ "tableFrom": "issue_attachments",
+ "columnsFrom": [
+ "asset_id"
+ ],
+ "tableTo": "assets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_attachments_issue_comment_id_issue_comments_id_fk": {
+ "name": "issue_attachments_issue_comment_id_issue_comments_id_fk",
+ "tableFrom": "issue_attachments",
+ "columnsFrom": [
+ "issue_comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_attachments_originating_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_attachments_originating_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_attachments",
+ "columnsFrom": [
+ "originating_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_comments": {
+ "name": "issue_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_agent_id": {
+ "name": "author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_user_id": {
+ "name": "author_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "on_behalf_of_user_id": {
+ "name": "on_behalf_of_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_type": {
+ "name": "author_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "derived_author_agent_id": {
+ "name": "derived_author_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "derived_created_by_run_id": {
+ "name": "derived_created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "derived_author_source": {
+ "name": "derived_author_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_request_id": {
+ "name": "client_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_session_generation": {
+ "name": "conversation_session_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "presentation": {
+ "name": "presentation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_by_type": {
+ "name": "deleted_by_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_by_agent_id": {
+ "name": "deleted_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_by_user_id": {
+ "name": "deleted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_by_run_id": {
+ "name": "deleted_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_trust": {
+ "name": "source_trust",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_comments_issue_idx": {
+ "name": "issue_comments_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_comments_company_idx": {
+ "name": "issue_comments_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_comments_company_issue_created_at_idx": {
+ "name": "issue_comments_company_issue_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_comments_company_author_issue_created_at_idx": {
+ "name": "issue_comments_company_author_issue_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "author_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_comments_body_search_idx": {
+ "name": "issue_comments_body_search_idx",
+ "columns": [
+ {
+ "expression": "body",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_comments_company_id_companies_id_fk": {
+ "name": "issue_comments_company_id_companies_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_comments_issue_id_issues_id_fk": {
+ "name": "issue_comments_issue_id_issues_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_comments_author_agent_id_agents_id_fk": {
+ "name": "issue_comments_author_agent_id_agents_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_comments_on_behalf_of_user_id_user_id_fk": {
+ "name": "issue_comments_on_behalf_of_user_id_user_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "on_behalf_of_user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_comments_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_comments_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_comments_derived_author_agent_id_agents_id_fk": {
+ "name": "issue_comments_derived_author_agent_id_agents_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "derived_author_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_comments_derived_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "derived_created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_comments_deleted_by_agent_id_agents_id_fk": {
+ "name": "issue_comments_deleted_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "deleted_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_comments_deleted_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_comments",
+ "columnsFrom": [
+ "deleted_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_comments_client_request_uq": {
+ "name": "issue_comments_client_request_uq",
+ "columns": [
+ "issue_id",
+ "author_user_id",
+ "client_request_id"
+ ],
+ "nullsNotDistinct": false
+ },
+ "issue_comments_company_id_uq": {
+ "name": "issue_comments_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_create_idempotency_keys": {
+ "name": "issue_create_idempotency_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_create_idempotency_keys_company_key_uq": {
+ "name": "issue_create_idempotency_keys_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_create_idempotency_keys_issue_idx": {
+ "name": "issue_create_idempotency_keys_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_create_idempotency_keys_company_created_at_idx": {
+ "name": "issue_create_idempotency_keys_company_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_create_idempotency_keys_company_id_companies_id_fk": {
+ "name": "issue_create_idempotency_keys_company_id_companies_id_fk",
+ "tableFrom": "issue_create_idempotency_keys",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_create_idempotency_keys_issue_id_issues_id_fk": {
+ "name": "issue_create_idempotency_keys_issue_id_issues_id_fk",
+ "tableFrom": "issue_create_idempotency_keys",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_documents": {
+ "name": "issue_documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_documents_company_issue_key_uq": {
+ "name": "issue_documents_company_issue_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_documents_document_uq": {
+ "name": "issue_documents_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_documents_company_issue_updated_idx": {
+ "name": "issue_documents_company_issue_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_documents_company_id_companies_id_fk": {
+ "name": "issue_documents_company_id_companies_id_fk",
+ "tableFrom": "issue_documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_documents_issue_id_issues_id_fk": {
+ "name": "issue_documents_issue_id_issues_id_fk",
+ "tableFrom": "issue_documents",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_documents_document_id_documents_id_fk": {
+ "name": "issue_documents_document_id_documents_id_fk",
+ "tableFrom": "issue_documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_execution_decisions": {
+ "name": "issue_execution_decisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_id": {
+ "name": "stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_type": {
+ "name": "stage_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_agent_id": {
+ "name": "actor_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_execution_decisions_company_issue_idx": {
+ "name": "issue_execution_decisions_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_execution_decisions_stage_idx": {
+ "name": "issue_execution_decisions_stage_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_execution_decisions_company_id_companies_id_fk": {
+ "name": "issue_execution_decisions_company_id_companies_id_fk",
+ "tableFrom": "issue_execution_decisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_execution_decisions_issue_id_issues_id_fk": {
+ "name": "issue_execution_decisions_issue_id_issues_id_fk",
+ "tableFrom": "issue_execution_decisions",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_execution_decisions_actor_agent_id_agents_id_fk": {
+ "name": "issue_execution_decisions_actor_agent_id_agents_id_fk",
+ "tableFrom": "issue_execution_decisions",
+ "columnsFrom": [
+ "actor_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_execution_decisions_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_execution_decisions",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_inbox_archives": {
+ "name": "issue_inbox_archives",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "archived_by_actor_type": {
+ "name": "archived_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "archived_by_agent_id": {
+ "name": "archived_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_run_id": {
+ "name": "archived_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_inbox_archives_company_issue_idx": {
+ "name": "issue_inbox_archives_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_inbox_archives_company_user_idx": {
+ "name": "issue_inbox_archives_company_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_inbox_archives_company_issue_user_idx": {
+ "name": "issue_inbox_archives_company_issue_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_inbox_archives_company_id_companies_id_fk": {
+ "name": "issue_inbox_archives_company_id_companies_id_fk",
+ "tableFrom": "issue_inbox_archives",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_inbox_archives_issue_id_issues_id_fk": {
+ "name": "issue_inbox_archives_issue_id_issues_id_fk",
+ "tableFrom": "issue_inbox_archives",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_inbox_archives_archived_by_agent_id_agents_id_fk": {
+ "name": "issue_inbox_archives_archived_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_inbox_archives",
+ "columnsFrom": [
+ "archived_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_inbox_archives_archived_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_inbox_archives",
+ "columnsFrom": [
+ "archived_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_inbox_archives_archived_by_actor_type_check": {
+ "name": "issue_inbox_archives_archived_by_actor_type_check",
+ "value": "\"issue_inbox_archives\".\"archived_by_actor_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_labels": {
+ "name": "issue_labels",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_labels_issue_idx": {
+ "name": "issue_labels_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_labels_label_idx": {
+ "name": "issue_labels_label_idx",
+ "columns": [
+ {
+ "expression": "label_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_labels_company_idx": {
+ "name": "issue_labels_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_labels_issue_id_issues_id_fk": {
+ "name": "issue_labels_issue_id_issues_id_fk",
+ "tableFrom": "issue_labels",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_labels_label_id_labels_id_fk": {
+ "name": "issue_labels_label_id_labels_id_fk",
+ "tableFrom": "issue_labels",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "tableTo": "labels",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_labels_company_id_companies_id_fk": {
+ "name": "issue_labels_company_id_companies_id_fk",
+ "tableFrom": "issue_labels",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_labels_pk": {
+ "name": "issue_labels_pk",
+ "columns": [
+ "issue_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_plan_decompositions": {
+ "name": "issue_plan_decompositions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_plan_revision_id": {
+ "name": "accepted_plan_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_interaction_id": {
+ "name": "accepted_interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'in_flight'"
+ },
+ "request_fingerprint": {
+ "name": "request_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_child_count": {
+ "name": "requested_child_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "requested_children": {
+ "name": "requested_children",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "child_issue_ids": {
+ "name": "child_issue_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_run_id": {
+ "name": "owner_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_plan_decompositions_company_source_status_idx": {
+ "name": "issue_plan_decompositions_company_source_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_plan_decompositions_active_owner_idx": {
+ "name": "issue_plan_decompositions_active_owner_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_plan_decompositions\".\"status\" = 'in_flight'",
+ "concurrently": false
+ },
+ "issue_plan_decompositions_source_revision_uq": {
+ "name": "issue_plan_decompositions_source_revision_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "accepted_plan_revision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_plan_decompositions_company_id_companies_id_fk": {
+ "name": "issue_plan_decompositions_company_id_companies_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_plan_decompositions_source_issue_id_issues_id_fk": {
+ "name": "issue_plan_decompositions_source_issue_id_issues_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk": {
+ "name": "issue_plan_decompositions_accepted_plan_revision_id_document_revisions_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "accepted_plan_revision_id"
+ ],
+ "tableTo": "document_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "issue_plan_decompositions_accepted_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "accepted_interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_plan_decompositions_owner_agent_id_agents_id_fk": {
+ "name": "issue_plan_decompositions_owner_agent_id_agents_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_plan_decompositions_owner_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_plan_decompositions",
+ "columnsFrom": [
+ "owner_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_question_response_deliveries": {
+ "name": "issue_question_response_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_run_id": {
+ "name": "source_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_run_id": {
+ "name": "target_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_turn_id": {
+ "name": "target_turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload_sha256": {
+ "name": "payload_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "delivery_mode": {
+ "name": "delivery_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "error_count": {
+ "name": "error_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error_code": {
+ "name": "last_error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_question_response_deliveries_interaction_uq": {
+ "name": "issue_question_response_deliveries_interaction_uq",
+ "columns": [
+ {
+ "expression": "interaction_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_question_response_deliveries_correlation_uq": {
+ "name": "issue_question_response_deliveries_correlation_uq",
+ "columns": [
+ {
+ "expression": "correlation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_question_response_deliveries_pending_idx": {
+ "name": "issue_question_response_deliveries_pending_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_question_response_deliveries_company_issue_idx": {
+ "name": "issue_question_response_deliveries_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_question_response_deliveries_company_id_companies_id_fk": {
+ "name": "issue_question_response_deliveries_company_id_companies_id_fk",
+ "tableFrom": "issue_question_response_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_question_response_deliveries_issue_id_issues_id_fk": {
+ "name": "issue_question_response_deliveries_issue_id_issues_id_fk",
+ "tableFrom": "issue_question_response_deliveries",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "issue_question_response_deliveries_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "issue_question_response_deliveries",
+ "columnsFrom": [
+ "interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_question_response_deliveries_source_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_question_response_deliveries",
+ "columnsFrom": [
+ "source_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_question_response_deliveries_target_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_question_response_deliveries",
+ "columnsFrom": [
+ "target_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_question_response_deliveries_status_check": {
+ "name": "issue_question_response_deliveries_status_check",
+ "value": "\"issue_question_response_deliveries\".\"status\" IN ('pending', 'delivering', 'delivered', 'fallback_queued', 'failed')"
+ },
+ "issue_question_response_deliveries_mode_check": {
+ "name": "issue_question_response_deliveries_mode_check",
+ "value": "\"issue_question_response_deliveries\".\"delivery_mode\" IS NULL OR \"issue_question_response_deliveries\".\"delivery_mode\" IN ('steered', 'coalesced', 'wake_fallback')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_read_states": {
+ "name": "issue_read_states",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_read_at": {
+ "name": "last_read_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_read_states_company_issue_idx": {
+ "name": "issue_read_states_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_read_states_company_user_idx": {
+ "name": "issue_read_states_company_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_read_states_company_issue_user_idx": {
+ "name": "issue_read_states_company_issue_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_read_states_company_id_companies_id_fk": {
+ "name": "issue_read_states_company_id_companies_id_fk",
+ "tableFrom": "issue_read_states",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_read_states_issue_id_issues_id_fk": {
+ "name": "issue_read_states_issue_id_issues_id_fk",
+ "tableFrom": "issue_read_states",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_recovery_actions": {
+ "name": "issue_recovery_actions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recovery_issue_id": {
+ "name": "recovery_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "owner_type": {
+ "name": "owner_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'agent'"
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "previous_owner_agent_id": {
+ "name": "previous_owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "return_owner_agent_id": {
+ "name": "return_owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cause": {
+ "name": "cause",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evidence": {
+ "name": "evidence",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "next_action": {
+ "name": "next_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "wake_policy": {
+ "name": "wake_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_policy": {
+ "name": "monitor_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "max_attempts": {
+ "name": "max_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timeout_at": {
+ "name": "timeout_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolution_note": {
+ "name": "resolution_note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_recovery_actions_company_source_status_idx": {
+ "name": "issue_recovery_actions_company_source_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_recovery_actions_company_owner_status_idx": {
+ "name": "issue_recovery_actions_company_owner_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "owner_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_recovery_actions_company_recovery_issue_idx": {
+ "name": "issue_recovery_actions_company_recovery_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "recovery_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_recovery_actions_active_source_uq": {
+ "name": "issue_recovery_actions_active_source_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",
+ "concurrently": false
+ },
+ "issue_recovery_actions_active_fingerprint_uq": {
+ "name": "issue_recovery_actions_active_fingerprint_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cause",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_recovery_actions\".\"status\" in ('active', 'escalated')",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_recovery_actions_company_id_companies_id_fk": {
+ "name": "issue_recovery_actions_company_id_companies_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_recovery_actions_source_issue_id_issues_id_fk": {
+ "name": "issue_recovery_actions_source_issue_id_issues_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_recovery_actions_recovery_issue_id_issues_id_fk": {
+ "name": "issue_recovery_actions_recovery_issue_id_issues_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "recovery_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_recovery_actions_owner_agent_id_agents_id_fk": {
+ "name": "issue_recovery_actions_owner_agent_id_agents_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_recovery_actions_previous_owner_agent_id_agents_id_fk": {
+ "name": "issue_recovery_actions_previous_owner_agent_id_agents_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "previous_owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_recovery_actions_return_owner_agent_id_agents_id_fk": {
+ "name": "issue_recovery_actions_return_owner_agent_id_agents_id_fk",
+ "tableFrom": "issue_recovery_actions",
+ "columnsFrom": [
+ "return_owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_reference_mentions": {
+ "name": "issue_reference_mentions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_kind": {
+ "name": "source_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_record_id": {
+ "name": "source_record_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_key": {
+ "name": "document_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "matched_text": {
+ "name": "matched_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_reference_mentions_company_source_issue_idx": {
+ "name": "issue_reference_mentions_company_source_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_reference_mentions_company_target_issue_idx": {
+ "name": "issue_reference_mentions_company_target_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_reference_mentions_company_issue_pair_idx": {
+ "name": "issue_reference_mentions_company_issue_pair_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_reference_mentions_company_source_mention_record_uq": {
+ "name": "issue_reference_mentions_company_source_mention_record_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_record_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_reference_mentions\".\"source_record_id\" is not null",
+ "concurrently": false
+ },
+ "issue_reference_mentions_company_source_mention_null_record_uq": {
+ "name": "issue_reference_mentions_company_source_mention_null_record_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_reference_mentions\".\"source_record_id\" is null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_reference_mentions_company_id_companies_id_fk": {
+ "name": "issue_reference_mentions_company_id_companies_id_fk",
+ "tableFrom": "issue_reference_mentions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_reference_mentions_source_issue_id_issues_id_fk": {
+ "name": "issue_reference_mentions_source_issue_id_issues_id_fk",
+ "tableFrom": "issue_reference_mentions",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_reference_mentions_target_issue_id_issues_id_fk": {
+ "name": "issue_reference_mentions_target_issue_id_issues_id_fk",
+ "tableFrom": "issue_reference_mentions",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_relations": {
+ "name": "issue_relations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "related_issue_id": {
+ "name": "related_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_relations_company_issue_idx": {
+ "name": "issue_relations_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_relations_company_related_issue_idx": {
+ "name": "issue_relations_company_related_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "related_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_relations_company_type_idx": {
+ "name": "issue_relations_company_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_relations_company_edge_uq": {
+ "name": "issue_relations_company_edge_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "related_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_relations_company_id_companies_id_fk": {
+ "name": "issue_relations_company_id_companies_id_fk",
+ "tableFrom": "issue_relations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_relations_issue_id_issues_id_fk": {
+ "name": "issue_relations_issue_id_issues_id_fk",
+ "tableFrom": "issue_relations",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_relations_related_issue_id_issues_id_fk": {
+ "name": "issue_relations_related_issue_id_issues_id_fk",
+ "tableFrom": "issue_relations",
+ "columnsFrom": [
+ "related_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_relations_created_by_agent_id_agents_id_fk": {
+ "name": "issue_relations_created_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_relations",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_thread_interactions": {
+ "name": "issue_thread_interactions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "continuation_policy": {
+ "name": "continuation_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'wake_assignee'"
+ },
+ "requested_resolver_policy": {
+ "name": "requested_resolver_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'anyone'"
+ },
+ "effective_resolver_policy": {
+ "name": "effective_resolver_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'anyone'"
+ },
+ "resolver_policy_provenance": {
+ "name": "resolver_policy_provenance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'inherited'"
+ },
+ "effective_resolver_policy_source": {
+ "name": "effective_resolver_policy_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'requested'"
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_comment_ids": {
+ "name": "origin_comment_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "source_comment_id": {
+ "name": "source_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_identity_context_id": {
+ "name": "source_identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_run_id": {
+ "name": "source_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "addressee_agent_id": {
+ "name": "addressee_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "addressee_user_id": {
+ "name": "addressee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_agent_id": {
+ "name": "resolved_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_run_id": {
+ "name": "resolved_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_user_id": {
+ "name": "resolved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_thread_interactions_issue_idx": {
+ "name": "issue_thread_interactions_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_thread_interactions_company_issue_created_at_idx": {
+ "name": "issue_thread_interactions_company_issue_created_at_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_thread_interactions_company_issue_status_idx": {
+ "name": "issue_thread_interactions_company_issue_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_thread_interactions_company_issue_idempotency_uq": {
+ "name": "issue_thread_interactions_company_issue_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_thread_interactions\".\"idempotency_key\" IS NOT NULL",
+ "concurrently": false
+ },
+ "issue_thread_interactions_source_comment_idx": {
+ "name": "issue_thread_interactions_source_comment_idx",
+ "columns": [
+ {
+ "expression": "source_comment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_thread_interactions_addressee_agent_idx": {
+ "name": "issue_thread_interactions_addressee_agent_idx",
+ "columns": [
+ {
+ "expression": "addressee_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_thread_interactions_addressee_user_idx": {
+ "name": "issue_thread_interactions_addressee_user_idx",
+ "columns": [
+ {
+ "expression": "addressee_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_thread_interactions_company_id_companies_id_fk": {
+ "name": "issue_thread_interactions_company_id_companies_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_thread_interactions_issue_id_issues_id_fk": {
+ "name": "issue_thread_interactions_issue_id_issues_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_thread_interactions_source_comment_id_issue_comments_id_fk": {
+ "name": "issue_thread_interactions_source_comment_id_issue_comments_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "source_comment_id"
+ ],
+ "tableTo": "issue_comments",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_thread_interactions_source_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "source_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_thread_interactions_created_by_agent_id_agents_id_fk": {
+ "name": "issue_thread_interactions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_thread_interactions_addressee_agent_id_agents_id_fk": {
+ "name": "issue_thread_interactions_addressee_agent_id_agents_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "addressee_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_thread_interactions_resolved_by_agent_id_agents_id_fk": {
+ "name": "issue_thread_interactions_resolved_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "resolved_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_thread_interactions_resolved_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_thread_interactions",
+ "columnsFrom": [
+ "resolved_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_tree_hold_members": {
+ "name": "issue_tree_hold_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hold_id": {
+ "name": "hold_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_issue_id": {
+ "name": "parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "depth": {
+ "name": "depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "issue_identifier": {
+ "name": "issue_identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_title": {
+ "name": "issue_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_status": {
+ "name": "issue_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assignee_agent_id": {
+ "name": "assignee_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_run_id": {
+ "name": "active_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_run_status": {
+ "name": "active_run_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "skipped": {
+ "name": "skipped",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "skip_reason": {
+ "name": "skip_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_tree_hold_members_hold_issue_uq": {
+ "name": "issue_tree_hold_members_hold_issue_uq",
+ "columns": [
+ {
+ "expression": "hold_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_tree_hold_members_company_issue_idx": {
+ "name": "issue_tree_hold_members_company_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_tree_hold_members_hold_depth_idx": {
+ "name": "issue_tree_hold_members_hold_depth_idx",
+ "columns": [
+ {
+ "expression": "hold_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "depth",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_tree_hold_members_company_id_companies_id_fk": {
+ "name": "issue_tree_hold_members_company_id_companies_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk": {
+ "name": "issue_tree_hold_members_hold_id_issue_tree_holds_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "hold_id"
+ ],
+ "tableTo": "issue_tree_holds",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_tree_hold_members_issue_id_issues_id_fk": {
+ "name": "issue_tree_hold_members_issue_id_issues_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_tree_hold_members_parent_issue_id_issues_id_fk": {
+ "name": "issue_tree_hold_members_parent_issue_id_issues_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "parent_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_tree_hold_members_assignee_agent_id_agents_id_fk": {
+ "name": "issue_tree_hold_members_assignee_agent_id_agents_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "assignee_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_tree_hold_members_active_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_tree_hold_members",
+ "columnsFrom": [
+ "active_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_tree_holds": {
+ "name": "issue_tree_holds",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "root_issue_id": {
+ "name": "root_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_policy": {
+ "name": "release_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_actor_type": {
+ "name": "created_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_at": {
+ "name": "released_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_by_actor_type": {
+ "name": "released_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_by_agent_id": {
+ "name": "released_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_by_user_id": {
+ "name": "released_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "released_by_run_id": {
+ "name": "released_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_reason": {
+ "name": "release_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "release_metadata": {
+ "name": "release_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_tree_holds_company_root_status_idx": {
+ "name": "issue_tree_holds_company_root_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "root_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_tree_holds_company_status_mode_idx": {
+ "name": "issue_tree_holds_company_status_mode_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "mode",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_tree_holds_company_id_companies_id_fk": {
+ "name": "issue_tree_holds_company_id_companies_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_tree_holds_root_issue_id_issues_id_fk": {
+ "name": "issue_tree_holds_root_issue_id_issues_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "root_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_tree_holds_created_by_agent_id_agents_id_fk": {
+ "name": "issue_tree_holds_created_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_tree_holds_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_tree_holds_released_by_agent_id_agents_id_fk": {
+ "name": "issue_tree_holds_released_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "released_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_tree_holds_released_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_tree_holds",
+ "columnsFrom": [
+ "released_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_watchdogs": {
+ "name": "issue_watchdogs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "watchdog_agent_id": {
+ "name": "watchdog_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "watchdog_issue_id": {
+ "name": "watchdog_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_observed_fingerprint": {
+ "name": "last_observed_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_reviewed_fingerprint": {
+ "name": "last_reviewed_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_observed_stop_snapshot": {
+ "name": "last_observed_stop_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_reviewed_stop_snapshot": {
+ "name": "last_reviewed_stop_snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_triggered_at": {
+ "name": "last_triggered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_completed_at": {
+ "name": "last_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_count": {
+ "name": "trigger_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_run_id": {
+ "name": "updated_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_watchdogs_company_issue_uq": {
+ "name": "issue_watchdogs_company_issue_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_watchdogs_company_status_idx": {
+ "name": "issue_watchdogs_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_watchdogs_company_agent_idx": {
+ "name": "issue_watchdogs_company_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "watchdog_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_watchdogs_company_watchdog_issue_uq": {
+ "name": "issue_watchdogs_company_watchdog_issue_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "watchdog_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issue_watchdogs\".\"watchdog_issue_id\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_watchdogs_company_id_companies_id_fk": {
+ "name": "issue_watchdogs_company_id_companies_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_watchdogs_issue_id_issues_id_fk": {
+ "name": "issue_watchdogs_issue_id_issues_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_watchdogs_watchdog_agent_id_agents_id_fk": {
+ "name": "issue_watchdogs_watchdog_agent_id_agents_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "watchdog_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_watchdogs_watchdog_issue_id_issues_id_fk": {
+ "name": "issue_watchdogs_watchdog_issue_id_issues_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "watchdog_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_watchdogs_created_by_agent_id_agents_id_fk": {
+ "name": "issue_watchdogs_created_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_watchdogs_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_watchdogs_updated_by_agent_id_agents_id_fk": {
+ "name": "issue_watchdogs_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_watchdogs_updated_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_watchdogs",
+ "columnsFrom": [
+ "updated_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_work_products": {
+ "name": "issue_work_products",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_service_id": {
+ "name": "runtime_service_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "review_state": {
+ "name": "review_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "is_primary": {
+ "name": "is_primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "health_status": {
+ "name": "health_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_trust": {
+ "name": "source_trust",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_work_products_company_issue_type_idx": {
+ "name": "issue_work_products_company_issue_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_work_products_company_execution_workspace_type_idx": {
+ "name": "issue_work_products_company_execution_workspace_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_work_products_company_provider_external_id_idx": {
+ "name": "issue_work_products_company_provider_external_id_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issue_work_products_company_updated_idx": {
+ "name": "issue_work_products_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issue_work_products_company_id_companies_id_fk": {
+ "name": "issue_work_products_company_id_companies_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issue_work_products_project_id_projects_id_fk": {
+ "name": "issue_work_products_project_id_projects_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_work_products_issue_id_issues_id_fk": {
+ "name": "issue_work_products_issue_id_issues_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "issue_work_products_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "issue_work_products_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk": {
+ "name": "issue_work_products_runtime_service_id_workspace_runtime_services_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "runtime_service_id"
+ ],
+ "tableTo": "workspace_runtime_services",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issue_work_products_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "issue_work_products_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issue_work_products",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issues": {
+ "name": "issues",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversation_agent_id": {
+ "name": "conversation_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_user_id": {
+ "name": "conversation_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_state": {
+ "name": "conversation_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conversation_session_generation": {
+ "name": "conversation_session_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "conversation_boundary_comment_id": {
+ "name": "conversation_boundary_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_workspace_id": {
+ "name": "project_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_root_issue_id": {
+ "name": "privacy_root_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "privacy_parent_issue_id": {
+ "name": "privacy_parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title_needs_generation": {
+ "name": "title_needs_generation",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'backlog'"
+ },
+ "status_version": {
+ "name": "status_version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_status_decision_id": {
+ "name": "last_status_decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "work_mode": {
+ "name": "work_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "harness_kind": {
+ "name": "harness_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'medium'"
+ },
+ "review_policy": {
+ "name": "review_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_agent_id": {
+ "name": "assignee_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checkout_run_id": {
+ "name": "checkout_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_run_id": {
+ "name": "execution_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_agent_name_key": {
+ "name": "execution_agent_name_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_locked_at": {
+ "name": "execution_locked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_number": {
+ "name": "issue_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'manual'"
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_run_id": {
+ "name": "origin_run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_identity_context_id": {
+ "name": "origin_identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "continuation_identity_context_id": {
+ "name": "continuation_identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_fingerprint": {
+ "name": "origin_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "request_depth": {
+ "name": "request_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "billing_code": {
+ "name": "billing_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_adapter_overrides": {
+ "name": "assignee_adapter_overrides",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_policy": {
+ "name": "execution_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_state": {
+ "name": "execution_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_next_check_at": {
+ "name": "monitor_next_check_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_wake_requested_at": {
+ "name": "monitor_wake_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_last_triggered_at": {
+ "name": "monitor_last_triggered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_attempt_count": {
+ "name": "monitor_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "monitor_notes": {
+ "name": "monitor_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monitor_scheduled_by": {
+ "name": "monitor_scheduled_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_preference": {
+ "name": "execution_workspace_preference",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_settings": {
+ "name": "execution_workspace_settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_trust": {
+ "name": "source_trust",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unblock_descriptor": {
+ "name": "unblock_descriptor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_transition_at": {
+ "name": "blocked_transition_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_owner_notified_at": {
+ "name": "blocked_owner_notified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancelled_at": {
+ "name": "cancelled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hidden_at": {
+ "name": "hidden_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issues_conversation_identity_idx": {
+ "name": "issues_conversation_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "conversation_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_status_idx": {
+ "name": "issues_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_harness_kind_idx": {
+ "name": "issues_company_harness_kind_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "harness_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_assignee_status_idx": {
+ "name": "issues_company_assignee_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "assignee_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_assignee_user_status_idx": {
+ "name": "issues_company_assignee_user_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "assignee_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_responsible_user_idx": {
+ "name": "issues_company_responsible_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_parent_idx": {
+ "name": "issues_company_parent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_privacy_parent_idx": {
+ "name": "issues_company_privacy_parent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_parent_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_privacy_root_idx": {
+ "name": "issues_company_privacy_root_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_root_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_project_idx": {
+ "name": "issues_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_origin_idx": {
+ "name": "issues_company_origin_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_project_workspace_idx": {
+ "name": "issues_company_project_workspace_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_execution_workspace_idx": {
+ "name": "issues_company_execution_workspace_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_monitor_due_idx": {
+ "name": "issues_company_monitor_due_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "monitor_next_check_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_updated_idx": {
+ "name": "issues_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_company_created_idx": {
+ "name": "issues_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_open_normalized_title_created_idx": {
+ "name": "issues_open_normalized_title_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(regexp_replace(btrim(\"title\"), '\\s+', ' ', 'g'))",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"hidden_at\" is null and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_company_priority_idx": {
+ "name": "issues_company_priority_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "priority",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_identifier_idx": {
+ "name": "issues_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "issues_title_search_idx": {
+ "name": "issues_title_search_idx",
+ "columns": [
+ {
+ "expression": "title",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "issues_identifier_search_idx": {
+ "name": "issues_identifier_search_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "issues_description_search_idx": {
+ "name": "issues_description_search_idx",
+ "columns": [
+ {
+ "expression": "description",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "gin_trgm_ops"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ },
+ "issues_open_routine_execution_uq": {
+ "name": "issues_open_routine_execution_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'routine_execution'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"execution_run_id\" is not null\n and \"issues\".\"status\" in ('backlog', 'todo', 'in_progress', 'in_review', 'blocked')",
+ "concurrently": false
+ },
+ "issues_active_liveness_recovery_incident_uq": {
+ "name": "issues_active_liveness_recovery_incident_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_active_liveness_recovery_leaf_uq": {
+ "name": "issues_active_liveness_recovery_leaf_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'harness_liveness_escalation'\n and \"issues\".\"origin_fingerprint\" <> 'default'\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_active_stale_run_evaluation_uq": {
+ "name": "issues_active_stale_run_evaluation_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'stale_active_run_evaluation'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_active_task_watchdog_uq": {
+ "name": "issues_active_task_watchdog_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'task_watchdog'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_active_productivity_review_uq": {
+ "name": "issues_active_productivity_review_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'issue_productivity_review'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_active_stranded_issue_recovery_uq": {
+ "name": "issues_active_stranded_issue_recovery_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'stranded_issue_recovery'\n and \"issues\".\"origin_id\" is not null\n and \"issues\".\"hidden_at\" is null\n and \"issues\".\"status\" not in ('done', 'cancelled')",
+ "concurrently": false
+ },
+ "issues_onboarding_first_task_uq": {
+ "name": "issues_onboarding_first_task_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"issues\".\"origin_kind\" = 'onboarding_first_task'",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "issues_company_id_companies_id_fk": {
+ "name": "issues_company_id_companies_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_conversation_agent_id_agents_id_fk": {
+ "name": "issues_conversation_agent_id_agents_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "conversation_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_project_id_projects_id_fk": {
+ "name": "issues_project_id_projects_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_project_workspace_id_project_workspaces_id_fk": {
+ "name": "issues_project_workspace_id_project_workspaces_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "project_workspace_id"
+ ],
+ "tableTo": "project_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issues_goal_id_goals_id_fk": {
+ "name": "issues_goal_id_goals_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_parent_id_issues_id_fk": {
+ "name": "issues_parent_id_issues_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_privacy_root_issue_id_issues_id_fk": {
+ "name": "issues_privacy_root_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "privacy_root_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_privacy_parent_issue_id_issues_id_fk": {
+ "name": "issues_privacy_parent_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "privacy_parent_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issues_assignee_agent_id_agents_id_fk": {
+ "name": "issues_assignee_agent_id_agents_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "assignee_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_checkout_run_id_heartbeat_runs_id_fk": {
+ "name": "issues_checkout_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "checkout_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issues_execution_run_id_heartbeat_runs_id_fk": {
+ "name": "issues_execution_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "execution_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "issues_created_by_agent_id_agents_id_fk": {
+ "name": "issues_created_by_agent_id_agents_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "issues_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "issues_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "issues",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issues_company_id_uq": {
+ "name": "issues_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "issues_visibility_check": {
+ "name": "issues_visibility_check",
+ "value": "\"issues\".\"visibility\" in ('open', 'private')"
+ },
+ "issues_conversation_identity_check": {
+ "name": "issues_conversation_identity_check",
+ "value": "(\n \"issues\".\"conversation_agent_id\" is null and \"issues\".\"conversation_user_id\" is null and \"issues\".\"conversation_state\" is null\n ) or (\n \"issues\".\"conversation_agent_id\" is not null and \"issues\".\"conversation_user_id\" is not null\n and \"issues\".\"assignee_agent_id\" = \"issues\".\"conversation_agent_id\" and \"issues\".\"assignee_agent_id\" is not null\n and \"issues\".\"assignee_user_id\" is null and \"issues\".\"conversation_state\" is not null\n and \"issues\".\"conversation_state\" in ('active', 'waiting')\n and \"issues\".\"status\" not in ('done', 'cancelled')\n )"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.join_requests": {
+ "name": "join_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "invite_id": {
+ "name": "invite_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_type": {
+ "name": "request_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending_approval'"
+ },
+ "request_ip": {
+ "name": "request_ip",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requesting_user_id": {
+ "name": "requesting_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_email_snapshot": {
+ "name": "request_email_snapshot",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_name": {
+ "name": "agent_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "adapter_type": {
+ "name": "adapter_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "capabilities": {
+ "name": "capabilities",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_defaults_payload": {
+ "name": "agent_defaults_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_secret_hash": {
+ "name": "claim_secret_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_secret_expires_at": {
+ "name": "claim_secret_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_secret_consumed_at": {
+ "name": "claim_secret_consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_agent_id": {
+ "name": "created_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_by_user_id": {
+ "name": "approved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejected_by_user_id": {
+ "name": "rejected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejected_at": {
+ "name": "rejected_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "join_requests_invite_unique_idx": {
+ "name": "join_requests_invite_unique_idx",
+ "columns": [
+ {
+ "expression": "invite_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "join_requests_company_status_type_created_idx": {
+ "name": "join_requests_company_status_type_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "join_requests_pending_human_user_uq": {
+ "name": "join_requests_pending_human_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "requesting_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"requesting_user_id\" IS NOT NULL",
+ "concurrently": false
+ },
+ "join_requests_pending_human_email_uq": {
+ "name": "join_requests_pending_human_email_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"request_email_snapshot\")",
+ "isExpression": true,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"join_requests\".\"request_type\" = 'human' AND \"join_requests\".\"status\" = 'pending_approval' AND \"join_requests\".\"request_email_snapshot\" IS NOT NULL",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "join_requests_invite_id_invites_id_fk": {
+ "name": "join_requests_invite_id_invites_id_fk",
+ "tableFrom": "join_requests",
+ "columnsFrom": [
+ "invite_id"
+ ],
+ "tableTo": "invites",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "join_requests_company_id_companies_id_fk": {
+ "name": "join_requests_company_id_companies_id_fk",
+ "tableFrom": "join_requests",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "join_requests_created_agent_id_agents_id_fk": {
+ "name": "join_requests_created_agent_id_agents_id_fk",
+ "tableFrom": "join_requests",
+ "columnsFrom": [
+ "created_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.labels": {
+ "name": "labels",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "labels_company_idx": {
+ "name": "labels_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "labels_company_name_idx": {
+ "name": "labels_company_name_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "labels_company_id_companies_id_fk": {
+ "name": "labels_company_id_companies_id_fk",
+ "tableFrom": "labels",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.managed_agent_profiles": {
+ "name": "managed_agent_profiles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profile_key": {
+ "name": "profile_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "service": {
+ "name": "service",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'anthropic_managed_agents'"
+ },
+ "anthropic_agent_id": {
+ "name": "anthropic_agent_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_version": {
+ "name": "agent_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "environment_id": {
+ "name": "environment_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "beta_version": {
+ "name": "beta_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'managed-agents-2026-04-01'"
+ },
+ "default_model": {
+ "name": "default_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'claude-sonnet-5'"
+ },
+ "default_max_list_cost_cents": {
+ "name": "default_max_list_cost_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 100
+ },
+ "api_key_secret_id": {
+ "name": "api_key_secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "retention_acknowledged": {
+ "name": "retention_acknowledged",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "qualification": {
+ "name": "qualification",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "qualified_at": {
+ "name": "qualified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "qualified_revision": {
+ "name": "qualified_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "managed_agent_profiles_company_idx": {
+ "name": "managed_agent_profiles_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "managed_agent_profiles_company_key_uq": {
+ "name": "managed_agent_profiles_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "managed_agent_profiles_company_resource_uq": {
+ "name": "managed_agent_profiles_company_resource_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "anthropic_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "environment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "managed_agent_profiles_company_id_companies_id_fk": {
+ "name": "managed_agent_profiles_company_id_companies_id_fk",
+ "tableFrom": "managed_agent_profiles",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "managed_agent_profiles_api_key_secret_id_company_secrets_id_fk": {
+ "name": "managed_agent_profiles_api_key_secret_id_company_secrets_id_fk",
+ "tableFrom": "managed_agent_profiles",
+ "columnsFrom": [
+ "api_key_secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "managed_agent_profiles_service_check": {
+ "name": "managed_agent_profiles_service_check",
+ "value": "\"managed_agent_profiles\".\"service\" = 'anthropic_managed_agents'"
+ },
+ "managed_agent_profiles_beta_check": {
+ "name": "managed_agent_profiles_beta_check",
+ "value": "\"managed_agent_profiles\".\"beta_version\" = 'managed-agents-2026-04-01'"
+ },
+ "managed_agent_profiles_positive_budget_check": {
+ "name": "managed_agent_profiles_positive_budget_check",
+ "value": "\"managed_agent_profiles\".\"default_max_list_cost_cents\" > 0"
+ },
+ "managed_agent_profiles_qualified_revision_check": {
+ "name": "managed_agent_profiles_qualified_revision_check",
+ "value": "(\"managed_agent_profiles\".\"qualified_at\" IS NULL AND \"managed_agent_profiles\".\"qualified_revision\" IS NULL) OR (\"managed_agent_profiles\".\"qualified_at\" IS NOT NULL AND \"managed_agent_profiles\".\"qualification\" <> '{}'::jsonb AND \"managed_agent_profiles\".\"qualified_revision\" ~ '^sha256:[0-9a-f]{64}$')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.native_run_finalizations": {
+ "name": "native_run_finalizations",
+ "schema": "",
+ "columns": {
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt": {
+ "name": "attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lease_owner": {
+ "name": "lease_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_boot_id": {
+ "name": "controller_boot_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_pid": {
+ "name": "controller_pid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_process_started_at": {
+ "name": "controller_process_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "controller_generation": {
+ "name": "controller_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "recovery_state": {
+ "name": "recovery_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recovery_request_id": {
+ "name": "recovery_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recovery_history": {
+ "name": "recovery_history",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "result_id": {
+ "name": "result_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assessment_id": {
+ "name": "assessment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision_id": {
+ "name": "decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_detail": {
+ "name": "failure_detail",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "control_deadline_at": {
+ "name": "control_deadline_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "native_run_finalizations_control_deadline_idx": {
+ "name": "native_run_finalizations_control_deadline_idx",
+ "columns": [
+ {
+ "expression": "control_deadline_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"native_run_finalizations\".\"control_deadline_at\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "native_run_finalizations_company_id_companies_id_fk": {
+ "name": "native_run_finalizations_company_id_companies_id_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_finalizations_issue_company_fk": {
+ "name": "native_run_finalizations_issue_company_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_finalizations_run_owner_fk": {
+ "name": "native_run_finalizations_run_owner_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "company_id",
+ "native_issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_finalizations_result_owner_fk": {
+ "name": "native_run_finalizations_result_owner_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "result_id"
+ ],
+ "tableTo": "native_run_results",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_finalizations_assessment_owner_fk": {
+ "name": "native_run_finalizations_assessment_owner_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "assessment_id"
+ ],
+ "tableTo": "work_assessments",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_finalizations_decision_owner_fk": {
+ "name": "native_run_finalizations_decision_owner_fk",
+ "tableFrom": "native_run_finalizations",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "assessment_id",
+ "decision_id"
+ ],
+ "tableTo": "status_decisions",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "assessment_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "native_run_finalizations_assessment_requires_result_check": {
+ "name": "native_run_finalizations_assessment_requires_result_check",
+ "value": "\"native_run_finalizations\".\"assessment_id\" is null or \"native_run_finalizations\".\"result_id\" is not null"
+ },
+ "native_run_finalizations_decision_requires_assessment_check": {
+ "name": "native_run_finalizations_decision_requires_assessment_check",
+ "value": "\"native_run_finalizations\".\"decision_id\" is null or \"native_run_finalizations\".\"assessment_id\" is not null"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.native_run_results": {
+ "name": "native_run_results",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completion_contract_id": {
+ "name": "completion_contract_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caller_result_id": {
+ "name": "caller_result_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "caller_dedupe_key": {
+ "name": "caller_dedupe_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "server_fingerprint": {
+ "name": "server_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema_status": {
+ "name": "schema_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rejection_code": {
+ "name": "rejection_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_json": {
+ "name": "result_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_sha256": {
+ "name": "canonical_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "native_run_results_run_fingerprint_uq": {
+ "name": "native_run_results_run_fingerprint_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "server_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "native_run_results_run_caller_result_uq": {
+ "name": "native_run_results_run_caller_result_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "caller_result_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "native_run_results_run_caller_dedupe_uq": {
+ "name": "native_run_results_run_caller_dedupe_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "caller_dedupe_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "native_run_results_company_id_companies_id_fk": {
+ "name": "native_run_results_company_id_companies_id_fk",
+ "tableFrom": "native_run_results",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_results_issue_company_fk": {
+ "name": "native_run_results_issue_company_fk",
+ "tableFrom": "native_run_results",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_results_run_contract_owner_fk": {
+ "name": "native_run_results_run_contract_owner_fk",
+ "tableFrom": "native_run_results",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "completion_contract_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "company_id",
+ "native_issue_id",
+ "id",
+ "completion_contract_id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "native_run_results_completion_contract_owner_fk": {
+ "name": "native_run_results_completion_contract_owner_fk",
+ "tableFrom": "native_run_results",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "completion_contract_id"
+ ],
+ "tableTo": "completion_contracts",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "native_run_results_company_issue_run_id_uq": {
+ "name": "native_run_results_company_issue_run_id_uq",
+ "columns": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pipeline_automation_executions": {
+ "name": "pipeline_automation_executions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "automation_id": {
+ "name": "automation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "triggering_event_id": {
+ "name": "triggering_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_issue_id": {
+ "name": "execution_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retry_of_execution_id": {
+ "name": "retry_of_execution_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_automation_executions_idempotency_uq": {
+ "name": "pipeline_automation_executions_idempotency_uq",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "automation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "triggering_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_automation_executions_company_case_idx": {
+ "name": "pipeline_automation_executions_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_automation_executions_routine_idx": {
+ "name": "pipeline_automation_executions_routine_idx",
+ "columns": [
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_automation_executions_execution_issue_idx": {
+ "name": "pipeline_automation_executions_execution_issue_idx",
+ "columns": [
+ {
+ "expression": "execution_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_automation_executions_retry_of_execution_idx": {
+ "name": "pipeline_automation_executions_retry_of_execution_idx",
+ "columns": [
+ {
+ "expression": "retry_of_execution_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_automation_executions_company_id_companies_id_fk": {
+ "name": "pipeline_automation_executions_company_id_companies_id_fk",
+ "tableFrom": "pipeline_automation_executions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_automation_executions_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_automation_executions_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_automation_executions",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_automation_executions_routine_id_routines_id_fk": {
+ "name": "pipeline_automation_executions_routine_id_routines_id_fk",
+ "tableFrom": "pipeline_automation_executions",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_automation_executions_execution_issue_id_issues_id_fk": {
+ "name": "pipeline_automation_executions_execution_issue_id_issues_id_fk",
+ "tableFrom": "pipeline_automation_executions",
+ "columnsFrom": [
+ "execution_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_automation_executions_status_check": {
+ "name": "pipeline_automation_executions_status_check",
+ "value": "\"pipeline_automation_executions\".\"status\" in ('succeeded', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_case_blockers": {
+ "name": "pipeline_case_blockers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "blocked_by_case_id": {
+ "name": "blocked_by_case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_case_blockers_case_blocked_by_uq": {
+ "name": "pipeline_case_blockers_case_blocked_by_uq",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "blocked_by_case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_blockers_blocked_by_idx": {
+ "name": "pipeline_case_blockers_blocked_by_idx",
+ "columns": [
+ {
+ "expression": "blocked_by_case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_blockers_company_case_idx": {
+ "name": "pipeline_case_blockers_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_case_blockers_company_id_companies_id_fk": {
+ "name": "pipeline_case_blockers_company_id_companies_id_fk",
+ "tableFrom": "pipeline_case_blockers",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_blockers_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_case_blockers_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_case_blockers",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_case_blockers_blocked_by_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_case_blockers",
+ "columnsFrom": [
+ "blocked_by_case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_case_blockers_no_self_block_check": {
+ "name": "pipeline_case_blockers_no_self_block_check",
+ "value": "\"pipeline_case_blockers\".\"case_id\" <> \"pipeline_case_blockers\".\"blocked_by_case_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_case_documents": {
+ "name": "pipeline_case_documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_case_documents_company_case_key_uq": {
+ "name": "pipeline_case_documents_company_case_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_documents_document_uq": {
+ "name": "pipeline_case_documents_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_documents_company_case_updated_idx": {
+ "name": "pipeline_case_documents_company_case_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_case_documents_company_id_companies_id_fk": {
+ "name": "pipeline_case_documents_company_id_companies_id_fk",
+ "tableFrom": "pipeline_case_documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_documents_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_case_documents_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_case_documents",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_documents_document_id_documents_id_fk": {
+ "name": "pipeline_case_documents_document_id_documents_id_fk",
+ "tableFrom": "pipeline_case_documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pipeline_case_events": {
+ "name": "pipeline_case_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_agent_id": {
+ "name": "actor_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "from_stage_id": {
+ "name": "from_stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "to_stage_id": {
+ "name": "to_stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_case_events_case_created_idx": {
+ "name": "pipeline_case_events_case_created_idx",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_events_company_case_idx": {
+ "name": "pipeline_case_events_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_case_events_company_id_companies_id_fk": {
+ "name": "pipeline_case_events_company_id_companies_id_fk",
+ "tableFrom": "pipeline_case_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_events_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_case_events_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_case_events",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_events_actor_agent_id_agents_id_fk": {
+ "name": "pipeline_case_events_actor_agent_id_agents_id_fk",
+ "tableFrom": "pipeline_case_events",
+ "columnsFrom": [
+ "actor_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "pipeline_case_events_from_stage_id_pipeline_stages_id_fk": {
+ "name": "pipeline_case_events_from_stage_id_pipeline_stages_id_fk",
+ "tableFrom": "pipeline_case_events",
+ "columnsFrom": [
+ "from_stage_id"
+ ],
+ "tableTo": "pipeline_stages",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "pipeline_case_events_to_stage_id_pipeline_stages_id_fk": {
+ "name": "pipeline_case_events_to_stage_id_pipeline_stages_id_fk",
+ "tableFrom": "pipeline_case_events",
+ "columnsFrom": [
+ "to_stage_id"
+ ],
+ "tableTo": "pipeline_stages",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_case_events_type_check": {
+ "name": "pipeline_case_events_type_check",
+ "value": "\"pipeline_case_events\".\"type\" in (\n 'ingested',\n 'updated',\n 'claimed',\n 'lease_released',\n 'lease_expired',\n 'transitioned',\n 'transition_forced',\n 'transition_suggested',\n 'suggestion_resolved',\n 'review_decided',\n 'conversation_opened',\n 'issue_linked',\n 'issue_unlinked',\n 'automation_executed',\n 'automation_failed',\n 'automation_retry_requested',\n 'automation_effects_retired',\n 'automation_retry_dispatched',\n 'blockers_set',\n 'blockers_resolved',\n 'children_terminal',\n 'upstream_drift',\n 'drift_acknowledged'\n )"
+ },
+ "pipeline_case_events_actor_type_check": {
+ "name": "pipeline_case_events_actor_type_check",
+ "value": "\"pipeline_case_events\".\"actor_type\" in ('user', 'agent', 'system')"
+ },
+ "pipeline_case_events_agent_run_check": {
+ "name": "pipeline_case_events_agent_run_check",
+ "value": "\"pipeline_case_events\".\"actor_type\" <> 'agent' or \"pipeline_case_events\".\"run_id\" is not null"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_case_issue_links": {
+ "name": "pipeline_case_issue_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_id": {
+ "name": "case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "automation_attempt_id": {
+ "name": "automation_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_at": {
+ "name": "retired_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_by_attempt_id": {
+ "name": "retired_by_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_reason": {
+ "name": "retired_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_case_issue_links_case_issue_uq": {
+ "name": "pipeline_case_issue_links_case_issue_uq",
+ "columns": [
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_issue_links_issue_idx": {
+ "name": "pipeline_case_issue_links_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_issue_links_company_case_idx": {
+ "name": "pipeline_case_issue_links_company_case_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_case_issue_links_automation_attempt_idx": {
+ "name": "pipeline_case_issue_links_automation_attempt_idx",
+ "columns": [
+ {
+ "expression": "automation_attempt_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_case_issue_links_company_id_companies_id_fk": {
+ "name": "pipeline_case_issue_links_company_id_companies_id_fk",
+ "tableFrom": "pipeline_case_issue_links",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_issue_links_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_case_issue_links_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_case_issue_links",
+ "columnsFrom": [
+ "case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_case_issue_links_issue_id_issues_id_fk": {
+ "name": "pipeline_case_issue_links_issue_id_issues_id_fk",
+ "tableFrom": "pipeline_case_issue_links",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_case_issue_links_role_check": {
+ "name": "pipeline_case_issue_links_role_check",
+ "value": "\"pipeline_case_issue_links\".\"role\" in ('origin', 'conversation', 'work', 'automation')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_cases": {
+ "name": "pipeline_cases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pipeline_id": {
+ "name": "pipeline_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_id": {
+ "name": "stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "case_key": {
+ "name": "case_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fields": {
+ "name": "fields",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "workspace_ref": {
+ "name": "workspace_ref",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_case_id": {
+ "name": "parent_case_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_case_version": {
+ "name": "parent_case_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_key": {
+ "name": "request_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "automation_attempt_id": {
+ "name": "automation_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "pending_suggestion": {
+ "name": "pending_suggestion",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_owner_type": {
+ "name": "lease_owner_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_agent_id": {
+ "name": "lease_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_user_id": {
+ "name": "lease_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_token": {
+ "name": "lease_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lease_expires_at": {
+ "name": "lease_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_kind": {
+ "name": "terminal_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terminal_at": {
+ "name": "terminal_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_at": {
+ "name": "retired_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_by_attempt_id": {
+ "name": "retired_by_attempt_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retired_reason": {
+ "name": "retired_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hidden_from_board_at": {
+ "name": "hidden_from_board_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "child_count": {
+ "name": "child_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "terminal_child_count": {
+ "name": "terminal_child_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "origin_run_id": {
+ "name": "origin_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_cases_pipeline_case_key_uq": {
+ "name": "pipeline_cases_pipeline_case_key_uq",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "case_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_parent_request_key_uq": {
+ "name": "pipeline_cases_parent_request_key_uq",
+ "columns": [
+ {
+ "expression": "parent_case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"pipeline_cases\".\"request_key\" is not null and \"pipeline_cases\".\"retired_at\" is null",
+ "concurrently": false
+ },
+ "pipeline_cases_company_idx": {
+ "name": "pipeline_cases_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_pipeline_stage_idx": {
+ "name": "pipeline_cases_pipeline_stage_idx",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_parent_idx": {
+ "name": "pipeline_cases_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_case_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_automation_attempt_idx": {
+ "name": "pipeline_cases_automation_attempt_idx",
+ "columns": [
+ {
+ "expression": "automation_attempt_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_retired_idx": {
+ "name": "pipeline_cases_retired_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "retired_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_cases_lease_expires_idx": {
+ "name": "pipeline_cases_lease_expires_idx",
+ "columns": [
+ {
+ "expression": "lease_expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"pipeline_cases\".\"lease_expires_at\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_cases_company_id_companies_id_fk": {
+ "name": "pipeline_cases_company_id_companies_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_cases_pipeline_id_pipelines_id_fk": {
+ "name": "pipeline_cases_pipeline_id_pipelines_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "pipeline_id"
+ ],
+ "tableTo": "pipelines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_cases_stage_id_pipeline_stages_id_fk": {
+ "name": "pipeline_cases_stage_id_pipeline_stages_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "stage_id"
+ ],
+ "tableTo": "pipeline_stages",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "pipeline_cases_parent_case_id_pipeline_cases_id_fk": {
+ "name": "pipeline_cases_parent_case_id_pipeline_cases_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "parent_case_id"
+ ],
+ "tableTo": "pipeline_cases",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "pipeline_cases_lease_agent_id_agents_id_fk": {
+ "name": "pipeline_cases_lease_agent_id_agents_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "lease_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "pipeline_cases_created_by_agent_id_agents_id_fk": {
+ "name": "pipeline_cases_created_by_agent_id_agents_id_fk",
+ "tableFrom": "pipeline_cases",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_cases_terminal_kind_check": {
+ "name": "pipeline_cases_terminal_kind_check",
+ "value": "\"pipeline_cases\".\"terminal_kind\" is null or \"pipeline_cases\".\"terminal_kind\" in ('done', 'cancelled')"
+ },
+ "pipeline_cases_lease_owner_type_check": {
+ "name": "pipeline_cases_lease_owner_type_check",
+ "value": "\"pipeline_cases\".\"lease_owner_type\" is null or \"pipeline_cases\".\"lease_owner_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_documents": {
+ "name": "pipeline_documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pipeline_id": {
+ "name": "pipeline_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_documents_company_pipeline_key_uq": {
+ "name": "pipeline_documents_company_pipeline_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_documents_document_uq": {
+ "name": "pipeline_documents_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_documents_company_pipeline_updated_idx": {
+ "name": "pipeline_documents_company_pipeline_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_documents_company_id_companies_id_fk": {
+ "name": "pipeline_documents_company_id_companies_id_fk",
+ "tableFrom": "pipeline_documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_documents_pipeline_id_pipelines_id_fk": {
+ "name": "pipeline_documents_pipeline_id_pipelines_id_fk",
+ "tableFrom": "pipeline_documents",
+ "columnsFrom": [
+ "pipeline_id"
+ ],
+ "tableTo": "pipelines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_documents_document_id_documents_id_fk": {
+ "name": "pipeline_documents_document_id_documents_id_fk",
+ "tableFrom": "pipeline_documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pipeline_stages": {
+ "name": "pipeline_stages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "pipeline_id": {
+ "name": "pipeline_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_stages_pipeline_key_uq": {
+ "name": "pipeline_stages_pipeline_key_uq",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_stages_pipeline_position_idx": {
+ "name": "pipeline_stages_pipeline_position_idx",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_stages_pipeline_id_pipelines_id_fk": {
+ "name": "pipeline_stages_pipeline_id_pipelines_id_fk",
+ "tableFrom": "pipeline_stages",
+ "columnsFrom": [
+ "pipeline_id"
+ ],
+ "tableTo": "pipelines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "pipeline_stages_kind_check": {
+ "name": "pipeline_stages_kind_check",
+ "value": "\"pipeline_stages\".\"kind\" in ('working', 'review', 'done', 'cancelled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.pipeline_transitions": {
+ "name": "pipeline_transitions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "pipeline_id": {
+ "name": "pipeline_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_stage_id": {
+ "name": "from_stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_stage_id": {
+ "name": "to_stage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipeline_transitions_pipeline_edge_uq": {
+ "name": "pipeline_transitions_pipeline_edge_uq",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "from_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "to_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_transitions_pipeline_from_idx": {
+ "name": "pipeline_transitions_pipeline_from_idx",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "from_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipeline_transitions_pipeline_to_idx": {
+ "name": "pipeline_transitions_pipeline_to_idx",
+ "columns": [
+ {
+ "expression": "pipeline_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "to_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipeline_transitions_pipeline_id_pipelines_id_fk": {
+ "name": "pipeline_transitions_pipeline_id_pipelines_id_fk",
+ "tableFrom": "pipeline_transitions",
+ "columnsFrom": [
+ "pipeline_id"
+ ],
+ "tableTo": "pipelines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_transitions_from_stage_id_pipeline_stages_id_fk": {
+ "name": "pipeline_transitions_from_stage_id_pipeline_stages_id_fk",
+ "tableFrom": "pipeline_transitions",
+ "columnsFrom": [
+ "from_stage_id"
+ ],
+ "tableTo": "pipeline_stages",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipeline_transitions_to_stage_id_pipeline_stages_id_fk": {
+ "name": "pipeline_transitions_to_stage_id_pipeline_stages_id_fk",
+ "tableFrom": "pipeline_transitions",
+ "columnsFrom": [
+ "to_stage_id"
+ ],
+ "tableTo": "pipeline_stages",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pipelines": {
+ "name": "pipelines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enforce_transitions": {
+ "name": "enforce_transitions",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "pipelines_company_key_uq": {
+ "name": "pipelines_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipelines_company_idx": {
+ "name": "pipelines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "pipelines_company_project_idx": {
+ "name": "pipelines_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "pipelines_company_id_companies_id_fk": {
+ "name": "pipelines_company_id_companies_id_fk",
+ "tableFrom": "pipelines",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "pipelines_project_id_projects_id_fk": {
+ "name": "pipelines_project_id_projects_id_fk",
+ "tableFrom": "pipelines",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "pipelines_created_by_agent_id_agents_id_fk": {
+ "name": "pipelines_created_by_agent_id_agents_id_fk",
+ "tableFrom": "pipelines",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_company_settings": {
+ "name": "plugin_company_settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "settings_json": {
+ "name": "settings_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_company_settings_company_idx": {
+ "name": "plugin_company_settings_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_company_settings_plugin_idx": {
+ "name": "plugin_company_settings_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_company_settings_company_plugin_uq": {
+ "name": "plugin_company_settings_company_plugin_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_company_settings_company_id_companies_id_fk": {
+ "name": "plugin_company_settings_company_id_companies_id_fk",
+ "tableFrom": "plugin_company_settings",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_company_settings_plugin_id_plugins_id_fk": {
+ "name": "plugin_company_settings_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_company_settings",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_config": {
+ "name": "plugin_config",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_json": {
+ "name": "config_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_config_plugin_company_idx": {
+ "name": "plugin_config_plugin_company_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_config_plugin_id_plugins_id_fk": {
+ "name": "plugin_config_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_config",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_config_company_id_companies_id_fk": {
+ "name": "plugin_config_company_id_companies_id_fk",
+ "tableFrom": "plugin_config",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_database_namespaces": {
+ "name": "plugin_database_namespaces",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_key": {
+ "name": "plugin_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "namespace_name": {
+ "name": "namespace_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "namespace_mode": {
+ "name": "namespace_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'schema'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_database_namespaces_plugin_idx": {
+ "name": "plugin_database_namespaces_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_database_namespaces_namespace_idx": {
+ "name": "plugin_database_namespaces_namespace_idx",
+ "columns": [
+ {
+ "expression": "namespace_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_database_namespaces_status_idx": {
+ "name": "plugin_database_namespaces_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_database_namespaces_plugin_id_plugins_id_fk": {
+ "name": "plugin_database_namespaces_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_database_namespaces",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_entities": {
+ "name": "plugin_entities",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entity_type": {
+ "name": "entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_entities_plugin_idx": {
+ "name": "plugin_entities_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_entities_company_idx": {
+ "name": "plugin_entities_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_entities_type_idx": {
+ "name": "plugin_entities_type_idx",
+ "columns": [
+ {
+ "expression": "entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_entities_scope_idx": {
+ "name": "plugin_entities_scope_idx",
+ "columns": [
+ {
+ "expression": "scope_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_entities_plugin_id_plugins_id_fk": {
+ "name": "plugin_entities_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_entities",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_entities_company_id_companies_id_fk": {
+ "name": "plugin_entities_company_id_companies_id_fk",
+ "tableFrom": "plugin_entities",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "plugin_entities_external_idx": {
+ "name": "plugin_entities_external_idx",
+ "columns": [
+ "company_id",
+ "plugin_id",
+ "entity_type",
+ "external_id"
+ ],
+ "nullsNotDistinct": true
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_job_runs": {
+ "name": "plugin_job_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "job_id": {
+ "name": "job_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "logs": {
+ "name": "logs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_job_runs_job_idx": {
+ "name": "plugin_job_runs_job_idx",
+ "columns": [
+ {
+ "expression": "job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_job_runs_plugin_idx": {
+ "name": "plugin_job_runs_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_job_runs_company_idx": {
+ "name": "plugin_job_runs_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_job_runs_status_idx": {
+ "name": "plugin_job_runs_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_job_runs_job_id_plugin_jobs_id_fk": {
+ "name": "plugin_job_runs_job_id_plugin_jobs_id_fk",
+ "tableFrom": "plugin_job_runs",
+ "columnsFrom": [
+ "job_id"
+ ],
+ "tableTo": "plugin_jobs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_job_runs_plugin_id_plugins_id_fk": {
+ "name": "plugin_job_runs_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_job_runs",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_job_runs_company_id_companies_id_fk": {
+ "name": "plugin_job_runs_company_id_companies_id_fk",
+ "tableFrom": "plugin_job_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_jobs": {
+ "name": "plugin_jobs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "job_key": {
+ "name": "job_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schedule": {
+ "name": "schedule",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_jobs_plugin_idx": {
+ "name": "plugin_jobs_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_jobs_next_run_idx": {
+ "name": "plugin_jobs_next_run_idx",
+ "columns": [
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_jobs_unique_idx": {
+ "name": "plugin_jobs_unique_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "job_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_jobs_plugin_id_plugins_id_fk": {
+ "name": "plugin_jobs_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_jobs",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_lifecycle_acknowledgments": {
+ "name": "plugin_lifecycle_acknowledgments",
+ "schema": "",
+ "columns": {
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "acknowledged_at": {
+ "name": "acknowledged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_lifecycle_acknowledgments_event_idx": {
+ "name": "plugin_lifecycle_acknowledgments_event_idx",
+ "columns": [
+ {
+ "expression": "event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_lifecycle_acknowledgments_plugin_id_plugins_id_fk": {
+ "name": "plugin_lifecycle_acknowledgments_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_lifecycle_acknowledgments",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_lifecycle_acknowledgments_event_id_resource_lifecycle_events_id_fk": {
+ "name": "plugin_lifecycle_acknowledgments_event_id_resource_lifecycle_events_id_fk",
+ "tableFrom": "plugin_lifecycle_acknowledgments",
+ "columnsFrom": [
+ "event_id"
+ ],
+ "tableTo": "resource_lifecycle_events",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "plugin_lifecycle_acknowledgments_plugin_id_event_id_pk": {
+ "name": "plugin_lifecycle_acknowledgments_plugin_id_event_id_pk",
+ "columns": [
+ "plugin_id",
+ "event_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_logs": {
+ "name": "plugin_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "level": {
+ "name": "level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "meta": {
+ "name": "meta",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_logs_plugin_time_idx": {
+ "name": "plugin_logs_plugin_time_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_logs_company_idx": {
+ "name": "plugin_logs_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_logs_level_idx": {
+ "name": "plugin_logs_level_idx",
+ "columns": [
+ {
+ "expression": "level",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_logs_plugin_id_plugins_id_fk": {
+ "name": "plugin_logs_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_logs",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_logs_company_id_companies_id_fk": {
+ "name": "plugin_logs_company_id_companies_id_fk",
+ "tableFrom": "plugin_logs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_managed_resources": {
+ "name": "plugin_managed_resources",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_key": {
+ "name": "plugin_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_kind": {
+ "name": "resource_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_key": {
+ "name": "resource_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "defaults_json": {
+ "name": "defaults_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_managed_resources_company_idx": {
+ "name": "plugin_managed_resources_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_managed_resources_plugin_idx": {
+ "name": "plugin_managed_resources_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_managed_resources_resource_idx": {
+ "name": "plugin_managed_resources_resource_idx",
+ "columns": [
+ {
+ "expression": "resource_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_managed_resources_company_plugin_resource_uq": {
+ "name": "plugin_managed_resources_company_plugin_resource_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_managed_resources_company_id_companies_id_fk": {
+ "name": "plugin_managed_resources_company_id_companies_id_fk",
+ "tableFrom": "plugin_managed_resources",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_managed_resources_plugin_id_plugins_id_fk": {
+ "name": "plugin_managed_resources_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_managed_resources",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_migrations": {
+ "name": "plugin_migrations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_key": {
+ "name": "plugin_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "namespace_name": {
+ "name": "namespace_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "migration_key": {
+ "name": "migration_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "checksum": {
+ "name": "checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plugin_version": {
+ "name": "plugin_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "plugin_migrations_plugin_key_idx": {
+ "name": "plugin_migrations_plugin_key_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "migration_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_migrations_plugin_idx": {
+ "name": "plugin_migrations_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_migrations_status_idx": {
+ "name": "plugin_migrations_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_migrations_plugin_id_plugins_id_fk": {
+ "name": "plugin_migrations_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_migrations",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_state": {
+ "name": "plugin_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "namespace": {
+ "name": "namespace",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "state_key": {
+ "name": "state_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_json": {
+ "name": "value_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_state_plugin_scope_idx": {
+ "name": "plugin_state_plugin_scope_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_state_plugin_id_plugins_id_fk": {
+ "name": "plugin_state_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_state",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "plugin_state_unique_entry_idx": {
+ "name": "plugin_state_unique_entry_idx",
+ "columns": [
+ "plugin_id",
+ "scope_kind",
+ "scope_id",
+ "namespace",
+ "state_key"
+ ],
+ "nullsNotDistinct": true
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugin_webhook_deliveries": {
+ "name": "plugin_webhook_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_key": {
+ "name": "webhook_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "headers": {
+ "name": "headers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugin_webhook_deliveries_plugin_idx": {
+ "name": "plugin_webhook_deliveries_plugin_idx",
+ "columns": [
+ {
+ "expression": "plugin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_webhook_deliveries_company_idx": {
+ "name": "plugin_webhook_deliveries_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_webhook_deliveries_status_idx": {
+ "name": "plugin_webhook_deliveries_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugin_webhook_deliveries_key_idx": {
+ "name": "plugin_webhook_deliveries_key_idx",
+ "columns": [
+ {
+ "expression": "webhook_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "plugin_webhook_deliveries_plugin_id_plugins_id_fk": {
+ "name": "plugin_webhook_deliveries_plugin_id_plugins_id_fk",
+ "tableFrom": "plugin_webhook_deliveries",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "plugin_webhook_deliveries_company_id_companies_id_fk": {
+ "name": "plugin_webhook_deliveries_company_id_companies_id_fk",
+ "tableFrom": "plugin_webhook_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.plugins": {
+ "name": "plugins",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "plugin_key": {
+ "name": "plugin_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "package_name": {
+ "name": "package_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "api_version": {
+ "name": "api_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "categories": {
+ "name": "categories",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "manifest_json": {
+ "name": "manifest_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'installed'"
+ },
+ "install_order": {
+ "name": "install_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "package_path": {
+ "name": "package_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "installed_at": {
+ "name": "installed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "plugins_plugin_key_idx": {
+ "name": "plugins_plugin_key_idx",
+ "columns": [
+ {
+ "expression": "plugin_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "plugins_status_idx": {
+ "name": "plugins_status_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.principal_permission_grants": {
+ "name": "principal_permission_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_type": {
+ "name": "principal_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "principal_id": {
+ "name": "principal_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_key": {
+ "name": "permission_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "principal_permission_grants_unique_idx": {
+ "name": "principal_permission_grants_unique_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "principal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "principal_permission_grants_company_permission_idx": {
+ "name": "principal_permission_grants_company_permission_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "permission_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "principal_permission_grants_company_id_companies_id_fk": {
+ "name": "principal_permission_grants_company_id_companies_id_fk",
+ "tableFrom": "principal_permission_grants",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_access_members": {
+ "name": "project_access_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_access_members_project_subject_uq": {
+ "name": "project_access_members_project_subject_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_access_members_subject_lookup_idx": {
+ "name": "project_access_members_subject_lookup_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "project_access_members_company_id_companies_id_fk": {
+ "name": "project_access_members_company_id_companies_id_fk",
+ "tableFrom": "project_access_members",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "project_access_members_project_id_projects_id_fk": {
+ "name": "project_access_members_project_id_projects_id_fk",
+ "tableFrom": "project_access_members",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_access_members_subject_type_check": {
+ "name": "project_access_members_subject_type_check",
+ "value": "\"project_access_members\".\"subject_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_goals": {
+ "name": "project_goals",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_goals_project_idx": {
+ "name": "project_goals_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_goals_goal_idx": {
+ "name": "project_goals_goal_idx",
+ "columns": [
+ {
+ "expression": "goal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_goals_company_idx": {
+ "name": "project_goals_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "project_goals_project_id_projects_id_fk": {
+ "name": "project_goals_project_id_projects_id_fk",
+ "tableFrom": "project_goals",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "project_goals_goal_id_goals_id_fk": {
+ "name": "project_goals_goal_id_goals_id_fk",
+ "tableFrom": "project_goals",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "project_goals_company_id_companies_id_fk": {
+ "name": "project_goals_company_id_companies_id_fk",
+ "tableFrom": "project_goals",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_goals_project_id_goal_id_pk": {
+ "name": "project_goals_project_id_goal_id_pk",
+ "columns": [
+ "project_id",
+ "goal_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_memberships": {
+ "name": "project_memberships",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'joined'"
+ },
+ "starred_at": {
+ "name": "starred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_memberships_company_user_idx": {
+ "name": "project_memberships_company_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_memberships_company_user_starred_idx": {
+ "name": "project_memberships_company_user_starred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "starred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_memberships_project_idx": {
+ "name": "project_memberships_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_memberships_company_user_project_uq": {
+ "name": "project_memberships_company_user_project_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "project_memberships_company_id_companies_id_fk": {
+ "name": "project_memberships_company_id_companies_id_fk",
+ "tableFrom": "project_memberships",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "project_memberships_project_id_projects_id_fk": {
+ "name": "project_memberships_project_id_projects_id_fk",
+ "tableFrom": "project_memberships",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_workspaces": {
+ "name": "project_workspaces",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_path'"
+ },
+ "cwd": {
+ "name": "cwd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_url": {
+ "name": "repo_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "repo_ref": {
+ "name": "repo_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_ref": {
+ "name": "default_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "setup_command": {
+ "name": "setup_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cleanup_command": {
+ "name": "cleanup_command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remote_provider": {
+ "name": "remote_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remote_workspace_ref": {
+ "name": "remote_workspace_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shared_workspace_key": {
+ "name": "shared_workspace_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_primary": {
+ "name": "is_primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_workspaces_company_project_idx": {
+ "name": "project_workspaces_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_workspaces_project_primary_idx": {
+ "name": "project_workspaces_project_primary_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "is_primary",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_workspaces_project_source_type_idx": {
+ "name": "project_workspaces_project_source_type_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_workspaces_company_shared_key_idx": {
+ "name": "project_workspaces_company_shared_key_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "shared_workspace_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "project_workspaces_project_remote_ref_idx": {
+ "name": "project_workspaces_project_remote_ref_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "remote_provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "remote_workspace_ref",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "project_workspaces_company_id_companies_id_fk": {
+ "name": "project_workspaces_company_id_companies_id_fk",
+ "tableFrom": "project_workspaces",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "project_workspaces_project_id_projects_id_fk": {
+ "name": "project_workspaces_project_id_projects_id_fk",
+ "tableFrom": "project_workspaces",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.projects": {
+ "name": "projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_owner_user_id": {
+ "name": "privacy_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_owner_user_id": {
+ "name": "personal_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'backlog'"
+ },
+ "lead_agent_id": {
+ "name": "lead_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_date": {
+ "name": "target_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "env": {
+ "name": "env",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pause_reason": {
+ "name": "pause_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paused_at": {
+ "name": "paused_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_policy": {
+ "name": "execution_workspace_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "projects_company_idx": {
+ "name": "projects_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "projects_company_personal_owner_uq": {
+ "name": "projects_company_personal_owner_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "personal_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"projects\".\"personal_owner_user_id\" is not null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "projects_company_id_companies_id_fk": {
+ "name": "projects_company_id_companies_id_fk",
+ "tableFrom": "projects",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "projects_goal_id_goals_id_fk": {
+ "name": "projects_goal_id_goals_id_fk",
+ "tableFrom": "projects",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "projects_lead_agent_id_agents_id_fk": {
+ "name": "projects_lead_agent_id_agents_id_fk",
+ "tableFrom": "projects",
+ "columnsFrom": [
+ "lead_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "projects_visibility_check": {
+ "name": "projects_visibility_check",
+ "value": "\"projects\".\"visibility\" in ('open', 'private')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.provider_trace_records": {
+ "name": "provider_trace_records",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'capturing'"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trace_ref": {
+ "name": "trace_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "frame_count": {
+ "name": "frame_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "byte_count": {
+ "name": "byte_count",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "digest": {
+ "name": "digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by": {
+ "name": "requested_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "provider_trace_records_run_unique": {
+ "name": "provider_trace_records_run_unique",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "provider_trace_records_expiry_idx": {
+ "name": "provider_trace_records_expiry_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "provider_trace_records_company_created_idx": {
+ "name": "provider_trace_records_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "provider_trace_records_company_id_companies_id_fk": {
+ "name": "provider_trace_records_company_id_companies_id_fk",
+ "tableFrom": "provider_trace_records",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "provider_trace_records_run_id_heartbeat_runs_id_fk": {
+ "name": "provider_trace_records_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "provider_trace_records",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.remote_agent_profiles": {
+ "name": "remote_agent_profiles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profile_key": {
+ "name": "profile_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "service": {
+ "name": "service",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "configuration": {
+ "name": "configuration",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "retention_acknowledged": {
+ "name": "retention_acknowledged",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "qualification": {
+ "name": "qualification",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "qualified_at": {
+ "name": "qualified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "qualified_revision": {
+ "name": "qualified_revision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "remote_agent_profiles_company_idx": {
+ "name": "remote_agent_profiles_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "remote_agent_profiles_company_key_uq": {
+ "name": "remote_agent_profiles_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "remote_agent_profiles_company_id_companies_id_fk": {
+ "name": "remote_agent_profiles_company_id_companies_id_fk",
+ "tableFrom": "remote_agent_profiles",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "remote_agent_profiles_service_check": {
+ "name": "remote_agent_profiles_service_check",
+ "value": "\"remote_agent_profiles\".\"service\" = 'aws_bedrock_agentcore_harness'"
+ },
+ "remote_agent_profiles_qualified_revision_check": {
+ "name": "remote_agent_profiles_qualified_revision_check",
+ "value": "(\"remote_agent_profiles\".\"qualified_at\" IS NULL AND \"remote_agent_profiles\".\"qualified_revision\" IS NULL) OR (\"remote_agent_profiles\".\"qualified_at\" IS NOT NULL AND \"remote_agent_profiles\".\"qualification\" <> '{}'::jsonb AND \"remote_agent_profiles\".\"qualified_revision\" ~ '^sha256:[0-9a-f]{64}$')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.resource_lifecycle_events": {
+ "name": "resource_lifecycle_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigint",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "name": "resource_lifecycle_events_id_seq",
+ "increment": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "startWith": "1",
+ "cache": "1",
+ "cycle": false,
+ "schema": "public",
+ "type": "always"
+ }
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "resource_lifecycle_events_creation_idx": {
+ "name": "resource_lifecycle_events_creation_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"resource_lifecycle_events\".\"action\" = 'create'",
+ "concurrently": false
+ },
+ "resource_lifecycle_events_company_idx": {
+ "name": "resource_lifecycle_events_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "resource_lifecycle_events_resource_order_idx": {
+ "name": "resource_lifecycle_events_resource_order_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "resource_lifecycle_events_company_id_companies_id_fk": {
+ "name": "resource_lifecycle_events_company_id_companies_id_fk",
+ "tableFrom": "resource_lifecycle_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "resource_lifecycle_events_resource_type_check": {
+ "name": "resource_lifecycle_events_resource_type_check",
+ "value": "\"resource_lifecycle_events\".\"resource_type\" IN ('agent', 'project')"
+ },
+ "resource_lifecycle_events_action_check": {
+ "name": "resource_lifecycle_events_action_check",
+ "value": "\"resource_lifecycle_events\".\"action\" = 'create' OR (\"resource_lifecycle_events\".\"resource_type\" = 'project' AND \"resource_lifecycle_events\".\"action\" IN ('update', 'archive')) OR (\"resource_lifecycle_events\".\"resource_type\" = 'agent' AND \"resource_lifecycle_events\".\"action\" IN ('pause', 'resume', 'terminate'))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.routine_documents": {
+ "name": "routine_documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routine_documents_company_routine_key_uq": {
+ "name": "routine_documents_company_routine_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_documents_document_uq": {
+ "name": "routine_documents_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_documents_company_routine_updated_idx": {
+ "name": "routine_documents_company_routine_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routine_documents_company_id_companies_id_fk": {
+ "name": "routine_documents_company_id_companies_id_fk",
+ "tableFrom": "routine_documents",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "routine_documents_routine_id_routines_id_fk": {
+ "name": "routine_documents_routine_id_routines_id_fk",
+ "tableFrom": "routine_documents",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_documents_document_id_documents_id_fk": {
+ "name": "routine_documents_document_id_documents_id_fk",
+ "tableFrom": "routine_documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.routine_revisions": {
+ "name": "routine_revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision_number": {
+ "name": "revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "change_summary": {
+ "name": "change_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "restored_from_revision_id": {
+ "name": "restored_from_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_run_id": {
+ "name": "created_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routine_revisions_routine_revision_uq": {
+ "name": "routine_revisions_routine_revision_uq",
+ "columns": [
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_revisions_company_routine_created_idx": {
+ "name": "routine_revisions_company_routine_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_revisions_company_responsible_user_idx": {
+ "name": "routine_revisions_company_responsible_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routine_revisions_company_id_companies_id_fk": {
+ "name": "routine_revisions_company_id_companies_id_fk",
+ "tableFrom": "routine_revisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_revisions_routine_id_routines_id_fk": {
+ "name": "routine_revisions_routine_id_routines_id_fk",
+ "tableFrom": "routine_revisions",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_revisions_restored_from_revision_id_routine_revisions_id_fk": {
+ "name": "routine_revisions_restored_from_revision_id_routine_revisions_id_fk",
+ "tableFrom": "routine_revisions",
+ "columnsFrom": [
+ "restored_from_revision_id"
+ ],
+ "tableTo": "routine_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_revisions_created_by_agent_id_agents_id_fk": {
+ "name": "routine_revisions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "routine_revisions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_revisions_created_by_run_id_heartbeat_runs_id_fk": {
+ "name": "routine_revisions_created_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "routine_revisions",
+ "columnsFrom": [
+ "created_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.routine_runs": {
+ "name": "routine_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger_id": {
+ "name": "trigger_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'received'"
+ },
+ "triggered_at": {
+ "name": "triggered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "routine_revision_id": {
+ "name": "routine_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_payload": {
+ "name": "trigger_payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dispatch_fingerprint": {
+ "name": "dispatch_fingerprint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_issue_id": {
+ "name": "linked_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "coalesced_into_run_id": {
+ "name": "coalesced_into_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routine_runs_company_routine_idx": {
+ "name": "routine_runs_company_routine_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_revision_idx": {
+ "name": "routine_runs_revision_idx",
+ "columns": [
+ {
+ "expression": "routine_revision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_company_responsible_user_idx": {
+ "name": "routine_runs_company_responsible_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_trigger_idx": {
+ "name": "routine_runs_trigger_idx",
+ "columns": [
+ {
+ "expression": "trigger_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_dispatch_fingerprint_idx": {
+ "name": "routine_runs_dispatch_fingerprint_idx",
+ "columns": [
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "dispatch_fingerprint",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_linked_issue_idx": {
+ "name": "routine_runs_linked_issue_idx",
+ "columns": [
+ {
+ "expression": "linked_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_runs_trigger_idempotency_idx": {
+ "name": "routine_runs_trigger_idempotency_idx",
+ "columns": [
+ {
+ "expression": "trigger_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routine_runs_company_id_companies_id_fk": {
+ "name": "routine_runs_company_id_companies_id_fk",
+ "tableFrom": "routine_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_runs_routine_id_routines_id_fk": {
+ "name": "routine_runs_routine_id_routines_id_fk",
+ "tableFrom": "routine_runs",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_runs_trigger_id_routine_triggers_id_fk": {
+ "name": "routine_runs_trigger_id_routine_triggers_id_fk",
+ "tableFrom": "routine_runs",
+ "columnsFrom": [
+ "trigger_id"
+ ],
+ "tableTo": "routine_triggers",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_runs_routine_revision_id_routine_revisions_id_fk": {
+ "name": "routine_runs_routine_revision_id_routine_revisions_id_fk",
+ "tableFrom": "routine_runs",
+ "columnsFrom": [
+ "routine_revision_id"
+ ],
+ "tableTo": "routine_revisions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_runs_linked_issue_id_issues_id_fk": {
+ "name": "routine_runs_linked_issue_id_issues_id_fk",
+ "tableFrom": "routine_runs",
+ "columnsFrom": [
+ "linked_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.routine_triggers": {
+ "name": "routine_triggers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "routine_id": {
+ "name": "routine_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "setup_pending": {
+ "name": "setup_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived": {
+ "name": "archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "last_webhook_delivery": {
+ "name": "last_webhook_delivery",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cron_expression": {
+ "name": "cron_expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_fired_at": {
+ "name": "last_fired_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_id": {
+ "name": "secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_mode": {
+ "name": "signing_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "replay_window_sec": {
+ "name": "replay_window_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_rotated_at": {
+ "name": "last_rotated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_result": {
+ "name": "last_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routine_triggers_company_routine_idx": {
+ "name": "routine_triggers_company_routine_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "routine_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_triggers_company_kind_idx": {
+ "name": "routine_triggers_company_kind_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_triggers_next_run_idx": {
+ "name": "routine_triggers_next_run_idx",
+ "columns": [
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_triggers_public_id_idx": {
+ "name": "routine_triggers_public_id_idx",
+ "columns": [
+ {
+ "expression": "public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routine_triggers_public_id_uq": {
+ "name": "routine_triggers_public_id_uq",
+ "columns": [
+ {
+ "expression": "public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routine_triggers_company_id_companies_id_fk": {
+ "name": "routine_triggers_company_id_companies_id_fk",
+ "tableFrom": "routine_triggers",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_triggers_routine_id_routines_id_fk": {
+ "name": "routine_triggers_routine_id_routines_id_fk",
+ "tableFrom": "routine_triggers",
+ "columnsFrom": [
+ "routine_id"
+ ],
+ "tableTo": "routines",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_triggers_secret_id_company_secrets_id_fk": {
+ "name": "routine_triggers_secret_id_company_secrets_id_fk",
+ "tableFrom": "routine_triggers",
+ "columnsFrom": [
+ "secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_triggers_created_by_agent_id_agents_id_fk": {
+ "name": "routine_triggers_created_by_agent_id_agents_id_fk",
+ "tableFrom": "routine_triggers",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routine_triggers_updated_by_agent_id_agents_id_fk": {
+ "name": "routine_triggers_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "routine_triggers",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.routine_webhook_test_receipts": {
+ "name": "routine_webhook_test_receipts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger_id": {
+ "name": "trigger_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_key_hash": {
+ "name": "delivery_key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routine_webhook_test_receipts_delivery_uq": {
+ "name": "routine_webhook_test_receipts_delivery_uq",
+ "columns": [
+ {
+ "expression": "trigger_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "delivery_key_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routine_webhook_test_receipts_company_id_companies_id_fk": {
+ "name": "routine_webhook_test_receipts_company_id_companies_id_fk",
+ "tableFrom": "routine_webhook_test_receipts",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routine_webhook_test_receipts_trigger_id_routine_triggers_id_fk": {
+ "name": "routine_webhook_test_receipts_trigger_id_routine_triggers_id_fk",
+ "tableFrom": "routine_webhook_test_receipts",
+ "columnsFrom": [
+ "trigger_id"
+ ],
+ "tableTo": "routine_triggers",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.routines": {
+ "name": "routines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "folder_id": {
+ "name": "folder_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_id": {
+ "name": "goal_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_issue_id": {
+ "name": "parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_agent_id": {
+ "name": "assignee_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'medium'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "concurrency_policy": {
+ "name": "concurrency_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'coalesce_if_active'"
+ },
+ "catch_up_policy": {
+ "name": "catch_up_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'skip_missed'"
+ },
+ "activity_gate_policy": {
+ "name": "activity_gate_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'always'"
+ },
+ "activity_gate_scope": {
+ "name": "activity_gate_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "origin_kind": {
+ "name": "origin_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'manual'"
+ },
+ "origin_id": {
+ "name": "origin_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "variables": {
+ "name": "variables",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "env": {
+ "name": "env",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_id": {
+ "name": "latest_revision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_number": {
+ "name": "latest_revision_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_triggered_at": {
+ "name": "last_triggered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_enqueued_at": {
+ "name": "last_enqueued_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "routines_company_status_idx": {
+ "name": "routines_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routines_company_assignee_idx": {
+ "name": "routines_company_assignee_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "assignee_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routines_company_project_idx": {
+ "name": "routines_company_project_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routines_company_folder_idx": {
+ "name": "routines_company_folder_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "folder_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routines_company_responsible_user_idx": {
+ "name": "routines_company_responsible_user_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "responsible_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "routines_company_origin_idx": {
+ "name": "routines_company_origin_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "origin_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "routines_company_id_companies_id_fk": {
+ "name": "routines_company_id_companies_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routines_project_id_projects_id_fk": {
+ "name": "routines_project_id_projects_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "routines_folder_id_folders_id_fk": {
+ "name": "routines_folder_id_folders_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "folder_id"
+ ],
+ "tableTo": "folders",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routines_goal_id_goals_id_fk": {
+ "name": "routines_goal_id_goals_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "goal_id"
+ ],
+ "tableTo": "goals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routines_parent_issue_id_issues_id_fk": {
+ "name": "routines_parent_issue_id_issues_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "parent_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routines_assignee_agent_id_agents_id_fk": {
+ "name": "routines_assignee_agent_id_agents_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "assignee_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "routines_created_by_agent_id_agents_id_fk": {
+ "name": "routines_created_by_agent_id_agents_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "routines_updated_by_agent_id_agents_id_fk": {
+ "name": "routines_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "routines",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.run_identity_contexts": {
+ "name": "run_identity_contexts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "parent_context_id": {
+ "name": "parent_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cause": {
+ "name": "cause",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'accepted'"
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "github": {
+ "name": "github",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "run_identity_contexts_run_revision_idx": {
+ "name": "run_identity_contexts_run_revision_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "run_identity_contexts_run_correlation_idx": {
+ "name": "run_identity_contexts_run_correlation_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "correlation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "run_identity_contexts_company_run_idx": {
+ "name": "run_identity_contexts_company_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "run_identity_contexts_company_id_companies_id_fk": {
+ "name": "run_identity_contexts_company_id_companies_id_fk",
+ "tableFrom": "run_identity_contexts",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.runner_api_response_reservations": {
+ "name": "runner_api_response_reservations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "asset_id": {
+ "name": "asset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reserved_bytes": {
+ "name": "reserved_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "runner_api_response_reservations_company_idx": {
+ "name": "runner_api_response_reservations_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "runner_api_response_reservations_company_id_companies_id_fk": {
+ "name": "runner_api_response_reservations_company_id_companies_id_fk",
+ "tableFrom": "runner_api_response_reservations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "runner_api_response_reservations_run_id_heartbeat_runs_id_fk": {
+ "name": "runner_api_response_reservations_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "runner_api_response_reservations",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "runner_api_response_reservations_asset_id_assets_id_fk": {
+ "name": "runner_api_response_reservations_asset_id_assets_id_fk",
+ "tableFrom": "runner_api_response_reservations",
+ "columnsFrom": [
+ "asset_id"
+ ],
+ "tableTo": "assets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.secret_access_events": {
+ "name": "secret_access_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_id": {
+ "name": "secret_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_secret_definition_id": {
+ "name": "user_secret_definition_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_scope": {
+ "name": "secret_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_owner_user_id": {
+ "name": "credential_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_subject_type": {
+ "name": "credential_subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_subject_id": {
+ "name": "credential_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consumer_type": {
+ "name": "consumer_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consumer_id": {
+ "name": "consumer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_path": {
+ "name": "config_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "secret_access_events_company_created_idx": {
+ "name": "secret_access_events_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "secret_access_events_secret_created_idx": {
+ "name": "secret_access_events_secret_created_idx",
+ "columns": [
+ {
+ "expression": "secret_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "secret_access_events_user_definition_created_idx": {
+ "name": "secret_access_events_user_definition_created_idx",
+ "columns": [
+ {
+ "expression": "user_secret_definition_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "secret_access_events_company_credential_owner_idx": {
+ "name": "secret_access_events_company_credential_owner_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "credential_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "secret_access_events_consumer_idx": {
+ "name": "secret_access_events_consumer_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "consumer_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "consumer_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "secret_access_events_run_idx": {
+ "name": "secret_access_events_run_idx",
+ "columns": [
+ {
+ "expression": "heartbeat_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "secret_access_events_company_id_companies_id_fk": {
+ "name": "secret_access_events_company_id_companies_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "secret_access_events_secret_id_company_secrets_id_fk": {
+ "name": "secret_access_events_secret_id_company_secrets_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "secret_id"
+ ],
+ "tableTo": "company_secrets",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk": {
+ "name": "secret_access_events_user_secret_definition_id_user_secret_definitions_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "user_secret_definition_id"
+ ],
+ "tableTo": "user_secret_definitions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "secret_access_events_issue_id_issues_id_fk": {
+ "name": "secret_access_events_issue_id_issues_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "secret_access_events_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "secret_access_events_plugin_id_plugins_id_fk": {
+ "name": "secret_access_events_plugin_id_plugins_id_fk",
+ "tableFrom": "secret_access_events",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.smoke_run_steps": {
+ "name": "smoke_run_steps",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scenario_step": {
+ "name": "scenario_step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "detail": {
+ "name": "detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "screenshot_artifact_ref": {
+ "name": "screenshot_artifact_ref",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "smoke_run_steps_company_run_idx": {
+ "name": "smoke_run_steps_company_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "smoke_run_steps_company_path_idx": {
+ "name": "smoke_run_steps_company_path_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "smoke_run_steps_company_id_companies_id_fk": {
+ "name": "smoke_run_steps_company_id_companies_id_fk",
+ "tableFrom": "smoke_run_steps",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "smoke_run_steps_run_id_smoke_runs_id_fk": {
+ "name": "smoke_run_steps_run_id_smoke_runs_id_fk",
+ "tableFrom": "smoke_run_steps",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "smoke_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.smoke_runs": {
+ "name": "smoke_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "smoke_runs_company_started_idx": {
+ "name": "smoke_runs_company_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "smoke_runs_company_status_idx": {
+ "name": "smoke_runs_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "smoke_runs_company_id_companies_id_fk": {
+ "name": "smoke_runs_company_id_companies_id_fk",
+ "tableFrom": "smoke_runs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.status_card_updates": {
+ "name": "status_card_updates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "card_id": {
+ "name": "card_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "generation_issue_id": {
+ "name": "generation_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "changes": {
+ "name": "changes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "cost_cents": {
+ "name": "cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "query_version": {
+ "name": "query_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "change_summary": {
+ "name": "change_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "status_card_updates_card_started_idx": {
+ "name": "status_card_updates_card_started_idx",
+ "columns": [
+ {
+ "expression": "card_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "status_card_updates_generation_issue_idx": {
+ "name": "status_card_updates_generation_issue_idx",
+ "columns": [
+ {
+ "expression": "generation_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "status_card_updates_card_id_status_cards_id_fk": {
+ "name": "status_card_updates_card_id_status_cards_id_fk",
+ "tableFrom": "status_card_updates",
+ "columnsFrom": [
+ "card_id"
+ ],
+ "tableTo": "status_cards",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "status_card_updates_generation_issue_id_issues_id_fk": {
+ "name": "status_card_updates_generation_issue_id_issues_id_fk",
+ "tableFrom": "status_card_updates",
+ "columnsFrom": [
+ "generation_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_card_updates_run_id_heartbeat_runs_id_fk": {
+ "name": "status_card_updates_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "status_card_updates",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.status_cards": {
+ "name": "status_cards",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title_pinned": {
+ "name": "title_pinned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "interest_prompt": {
+ "name": "interest_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "queries": {
+ "name": "queries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "query_version": {
+ "name": "query_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "query_compiled_at": {
+ "name": "query_compiled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "query_compiled_by_agent_id": {
+ "name": "query_compiled_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_policy": {
+ "name": "refresh_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compiling'"
+ },
+ "pending_change_count": {
+ "name": "pending_change_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "pending_change_hash": {
+ "name": "pending_change_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_change_at": {
+ "name": "last_change_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fingerprint_at": {
+ "name": "fingerprint_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mentioned_issue_ids": {
+ "name": "mentioned_issue_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_update_run_kind": {
+ "name": "last_update_run_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_generated_at": {
+ "name": "last_generated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_model": {
+ "name": "last_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generating_issue_id": {
+ "name": "generating_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_eval_at": {
+ "name": "next_eval_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_user_id": {
+ "name": "archived_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_agent_id": {
+ "name": "archived_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "status_cards_company_archived_idx": {
+ "name": "status_cards_company_archived_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "status_cards_company_next_eval_idx": {
+ "name": "status_cards_company_next_eval_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_eval_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "status_cards_company_id_companies_id_fk": {
+ "name": "status_cards_company_id_companies_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "status_cards_created_by_agent_id_agents_id_fk": {
+ "name": "status_cards_created_by_agent_id_agents_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_cards_query_compiled_by_agent_id_agents_id_fk": {
+ "name": "status_cards_query_compiled_by_agent_id_agents_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "query_compiled_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_cards_agent_id_agents_id_fk": {
+ "name": "status_cards_agent_id_agents_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_cards_document_id_documents_id_fk": {
+ "name": "status_cards_document_id_documents_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_cards_generating_issue_id_issues_id_fk": {
+ "name": "status_cards_generating_issue_id_issues_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "generating_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "status_cards_archived_by_agent_id_agents_id_fk": {
+ "name": "status_cards_archived_by_agent_id_agents_id_fk",
+ "tableFrom": "status_cards",
+ "columnsFrom": [
+ "archived_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.status_decision_effects": {
+ "name": "status_decision_effects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_id": {
+ "name": "decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ordinal": {
+ "name": "ordinal",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effect_kind": {
+ "name": "effect_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_state": {
+ "name": "delivery_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempt_count": {
+ "name": "attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "status_decision_effects_decision_ordinal_uq": {
+ "name": "status_decision_effects_decision_ordinal_uq",
+ "columns": [
+ {
+ "expression": "decision_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ordinal",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "status_decision_effects_company_idempotency_uq": {
+ "name": "status_decision_effects_company_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "status_decision_effects_company_id_companies_id_fk": {
+ "name": "status_decision_effects_company_id_companies_id_fk",
+ "tableFrom": "status_decision_effects",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "status_decision_effects_issue_company_fk": {
+ "name": "status_decision_effects_issue_company_fk",
+ "tableFrom": "status_decision_effects",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "status_decision_effects_decision_owner_fk": {
+ "name": "status_decision_effects_decision_owner_fk",
+ "tableFrom": "status_decision_effects",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "decision_id"
+ ],
+ "tableTo": "status_decisions",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.status_decisions": {
+ "name": "status_decisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assessment_id": {
+ "name": "assessment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_version": {
+ "name": "decision_version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "from_status": {
+ "name": "from_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_status": {
+ "name": "to_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason_code": {
+ "name": "reason_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_json": {
+ "name": "decision_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "decision_digest": {
+ "name": "decision_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_state": {
+ "name": "application_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'proposed'"
+ },
+ "supersedes_decision_id": {
+ "name": "supersedes_decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applied_at": {
+ "name": "applied_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "status_decisions_company_issue_version_uq": {
+ "name": "status_decisions_company_issue_version_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decision_version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "status_decisions_company_assessment_uq": {
+ "name": "status_decisions_company_assessment_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "assessment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "status_decisions_company_issue_digest_uq": {
+ "name": "status_decisions_company_issue_digest_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decision_digest",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "status_decisions_company_id_companies_id_fk": {
+ "name": "status_decisions_company_id_companies_id_fk",
+ "tableFrom": "status_decisions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "status_decisions_issue_company_fk": {
+ "name": "status_decisions_issue_company_fk",
+ "tableFrom": "status_decisions",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "status_decisions_assessment_owner_fk": {
+ "name": "status_decisions_assessment_owner_fk",
+ "tableFrom": "status_decisions",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "assessment_id"
+ ],
+ "tableTo": "work_assessments",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "status_decisions_supersedes_owner_fk": {
+ "name": "status_decisions_supersedes_owner_fk",
+ "tableFrom": "status_decisions",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "supersedes_decision_id"
+ ],
+ "tableTo": "status_decisions",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "status_decisions_company_issue_id_uq": {
+ "name": "status_decisions_company_issue_id_uq",
+ "columns": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ },
+ "status_decisions_company_issue_run_assessment_id_uq": {
+ "name": "status_decisions_company_issue_run_assessment_id_uq",
+ "columns": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "assessment_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.summary_slots": {
+ "name": "summary_slots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "slot_key": {
+ "name": "slot_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'idle'"
+ },
+ "failure_reason": {
+ "name": "failure_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generating_issue_id": {
+ "name": "generating_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_generated_at": {
+ "name": "last_generated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_generated_by_agent_id": {
+ "name": "last_generated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_model": {
+ "name": "last_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "summary_slots_document_uq": {
+ "name": "summary_slots_document_uq",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "summary_slots_company_scope_idx": {
+ "name": "summary_slots_company_scope_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "summary_slots_company_generating_issue_idx": {
+ "name": "summary_slots_company_generating_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "generating_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "summary_slots_company_updated_idx": {
+ "name": "summary_slots_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "summary_slots_company_id_companies_id_fk": {
+ "name": "summary_slots_company_id_companies_id_fk",
+ "tableFrom": "summary_slots",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "summary_slots_document_id_documents_id_fk": {
+ "name": "summary_slots_document_id_documents_id_fk",
+ "tableFrom": "summary_slots",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "summary_slots_generating_issue_id_issues_id_fk": {
+ "name": "summary_slots_generating_issue_id_issues_id_fk",
+ "tableFrom": "summary_slots",
+ "columnsFrom": [
+ "generating_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "summary_slots_last_generated_by_agent_id_agents_id_fk": {
+ "name": "summary_slots_last_generated_by_agent_id_agents_id_fk",
+ "tableFrom": "summary_slots",
+ "columnsFrom": [
+ "last_generated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "summary_slots_company_scope_slot_uq": {
+ "name": "summary_slots_company_scope_slot_uq",
+ "columns": [
+ "company_id",
+ "scope_kind",
+ "scope_id",
+ "slot_key"
+ ],
+ "nullsNotDistinct": true
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_access_audit_events": {
+ "name": "tool_access_audit_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "gateway_id": {
+ "name": "gateway_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_token_id": {
+ "name": "gateway_token_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_public_id": {
+ "name": "gateway_public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_entry_id": {
+ "name": "catalog_entry_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason_code": {
+ "name": "reason_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "details": {
+ "name": "details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_access_audit_company_created_idx": {
+ "name": "tool_access_audit_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_access_audit_connection_idx": {
+ "name": "tool_access_audit_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_access_audit_gateway_idx": {
+ "name": "tool_access_audit_gateway_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "gateway_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_access_audit_events_company_id_companies_id_fk": {
+ "name": "tool_access_audit_events_company_id_companies_id_fk",
+ "tableFrom": "tool_access_audit_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk": {
+ "name": "tool_access_audit_events_gateway_id_tool_mcp_gateways_id_fk",
+ "tableFrom": "tool_access_audit_events",
+ "columnsFrom": [
+ "gateway_id"
+ ],
+ "tableTo": "tool_mcp_gateways",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
+ "name": "tool_access_audit_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
+ "tableFrom": "tool_access_audit_events",
+ "columnsFrom": [
+ "gateway_token_id"
+ ],
+ "tableTo": "tool_mcp_gateway_tokens",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_access_audit_events_connection_id_tool_connections_id_fk": {
+ "name": "tool_access_audit_events_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_access_audit_events",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk": {
+ "name": "tool_access_audit_events_catalog_entry_id_tool_catalog_entries_id_fk",
+ "tableFrom": "tool_access_audit_events",
+ "columnsFrom": [
+ "catalog_entry_id"
+ ],
+ "tableTo": "tool_catalog_entries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_action_deliveries": {
+ "name": "tool_action_deliveries",
+ "schema": "",
+ "columns": {
+ "action_request_id": {
+ "name": "action_request_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivered_at": {
+ "name": "delivered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_action_deliveries_pending_idx": {
+ "name": "tool_action_deliveries_pending_idx",
+ "columns": [
+ {
+ "expression": "delivered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_action_deliveries_action_request_id_tool_action_requests_id_fk": {
+ "name": "tool_action_deliveries_action_request_id_tool_action_requests_id_fk",
+ "tableFrom": "tool_action_deliveries",
+ "columnsFrom": [
+ "action_request_id"
+ ],
+ "tableTo": "tool_action_requests",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_action_deliveries_company_id_companies_id_fk": {
+ "name": "tool_action_deliveries_company_id_companies_id_fk",
+ "tableFrom": "tool_action_deliveries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_action_deliveries_issue_id_issues_id_fk": {
+ "name": "tool_action_deliveries_issue_id_issues_id_fk",
+ "tableFrom": "tool_action_deliveries",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_action_deliveries_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "tool_action_deliveries_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "tool_action_deliveries",
+ "columnsFrom": [
+ "interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_action_requests": {
+ "name": "tool_action_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invocation_id": {
+ "name": "invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_id": {
+ "name": "approval_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "canonical_arguments_hash": {
+ "name": "canonical_arguments_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canonical_arguments_summary": {
+ "name": "canonical_arguments_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signed_arguments": {
+ "name": "signed_arguments",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "preview_markdown": {
+ "name": "preview_markdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_agent_id": {
+ "name": "requested_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by_user_id": {
+ "name": "requested_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_agent_id": {
+ "name": "resolved_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_by_user_id": {
+ "name": "resolved_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_by_agent_id": {
+ "name": "decided_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_by_user_id": {
+ "name": "decided_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_action_requests_company_status_idx": {
+ "name": "tool_action_requests_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_action_requests_invocation_idx": {
+ "name": "tool_action_requests_invocation_idx",
+ "columns": [
+ {
+ "expression": "invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_action_requests_issue_idx": {
+ "name": "tool_action_requests_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_action_requests_company_id_companies_id_fk": {
+ "name": "tool_action_requests_company_id_companies_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_action_requests_invocation_id_tool_invocations_id_fk": {
+ "name": "tool_action_requests_invocation_id_tool_invocations_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "invocation_id"
+ ],
+ "tableTo": "tool_invocations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_action_requests_issue_id_issues_id_fk": {
+ "name": "tool_action_requests_issue_id_issues_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_action_requests_interaction_id_issue_thread_interactions_id_fk": {
+ "name": "tool_action_requests_interaction_id_issue_thread_interactions_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "interaction_id"
+ ],
+ "tableTo": "issue_thread_interactions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_action_requests_approval_id_approvals_id_fk": {
+ "name": "tool_action_requests_approval_id_approvals_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "approval_id"
+ ],
+ "tableTo": "approvals",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_action_requests_requested_by_agent_id_agents_id_fk": {
+ "name": "tool_action_requests_requested_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "requested_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_action_requests_resolved_by_agent_id_agents_id_fk": {
+ "name": "tool_action_requests_resolved_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "resolved_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_action_requests_decided_by_agent_id_agents_id_fk": {
+ "name": "tool_action_requests_decided_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_action_requests",
+ "columnsFrom": [
+ "decided_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_applications": {
+ "name": "tool_applications",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_key": {
+ "name": "application_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "plugin_id": {
+ "name": "plugin_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_applications_company_idx": {
+ "name": "tool_applications_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_applications_company_status_idx": {
+ "name": "tool_applications_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_applications_company_name_uq": {
+ "name": "tool_applications_company_name_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_applications_company_key_uq": {
+ "name": "tool_applications_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "application_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_applications_company_id_companies_id_fk": {
+ "name": "tool_applications_company_id_companies_id_fk",
+ "tableFrom": "tool_applications",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_applications_plugin_id_plugins_id_fk": {
+ "name": "tool_applications_plugin_id_plugins_id_fk",
+ "tableFrom": "tool_applications",
+ "columnsFrom": [
+ "plugin_id"
+ ],
+ "tableTo": "plugins",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_applications_owner_agent_id_agents_id_fk": {
+ "name": "tool_applications_owner_agent_id_agents_id_fk",
+ "tableFrom": "tool_applications",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_call_events": {
+ "name": "tool_call_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_id": {
+ "name": "gateway_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_token_id": {
+ "name": "gateway_token_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_public_id": {
+ "name": "gateway_public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_type": {
+ "name": "client_subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_id": {
+ "name": "client_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_session_id": {
+ "name": "mcp_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_entry_id": {
+ "name": "catalog_entry_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_id": {
+ "name": "invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action_request_id": {
+ "name": "action_request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_slot_id": {
+ "name": "runtime_slot_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision": {
+ "name": "decision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "matched_policy_ids": {
+ "name": "matched_policy_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "reason_code": {
+ "name": "reason_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_explanation": {
+ "name": "policy_explanation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_scope_summary": {
+ "name": "credential_scope_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "header_policy_summary": {
+ "name": "header_policy_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "latency_ms": {
+ "name": "latency_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "arguments_summary": {
+ "name": "arguments_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_hash": {
+ "name": "request_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "request_summary": {
+ "name": "request_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_hash": {
+ "name": "result_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_size_bytes": {
+ "name": "result_size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redaction_plan": {
+ "name": "redaction_plan",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rate_limit_state": {
+ "name": "rate_limit_state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_call_events_company_created_idx": {
+ "name": "tool_call_events_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_call_events_run_idx": {
+ "name": "tool_call_events_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_call_events_issue_idx": {
+ "name": "tool_call_events_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_call_events_invocation_idx": {
+ "name": "tool_call_events_invocation_idx",
+ "columns": [
+ {
+ "expression": "invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_call_events_gateway_idx": {
+ "name": "tool_call_events_gateway_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "gateway_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_call_events_company_id_companies_id_fk": {
+ "name": "tool_call_events_company_id_companies_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_call_events_agent_id_agents_id_fk": {
+ "name": "tool_call_events_agent_id_agents_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_run_id_heartbeat_runs_id_fk": {
+ "name": "tool_call_events_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_issue_id_issues_id_fk": {
+ "name": "tool_call_events_issue_id_issues_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_gateway_id_tool_mcp_gateways_id_fk": {
+ "name": "tool_call_events_gateway_id_tool_mcp_gateways_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "gateway_id"
+ ],
+ "tableTo": "tool_mcp_gateways",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
+ "name": "tool_call_events_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "gateway_token_id"
+ ],
+ "tableTo": "tool_mcp_gateway_tokens",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_application_id_tool_applications_id_fk": {
+ "name": "tool_call_events_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_connection_id_tool_connections_id_fk": {
+ "name": "tool_call_events_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk": {
+ "name": "tool_call_events_catalog_entry_id_tool_catalog_entries_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "catalog_entry_id"
+ ],
+ "tableTo": "tool_catalog_entries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_invocation_id_tool_invocations_id_fk": {
+ "name": "tool_call_events_invocation_id_tool_invocations_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "invocation_id"
+ ],
+ "tableTo": "tool_invocations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_action_request_id_tool_action_requests_id_fk": {
+ "name": "tool_call_events_action_request_id_tool_action_requests_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "action_request_id"
+ ],
+ "tableTo": "tool_action_requests",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk": {
+ "name": "tool_call_events_runtime_slot_id_tool_runtime_slots_id_fk",
+ "tableFrom": "tool_call_events",
+ "columnsFrom": [
+ "runtime_slot_id"
+ ],
+ "tableTo": "tool_runtime_slots",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_catalog_entries": {
+ "name": "tool_catalog_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entry_kind": {
+ "name": "entry_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'tool'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_schema": {
+ "name": "input_schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "output_schema": {
+ "name": "output_schema",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "annotations": {
+ "name": "annotations",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "risk_level": {
+ "name": "risk_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'read'"
+ },
+ "is_read_only": {
+ "name": "is_read_only",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "is_write": {
+ "name": "is_write",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_destructive": {
+ "name": "is_destructive",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version_hash": {
+ "name": "version_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schema_hash": {
+ "name": "schema_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_seen_at": {
+ "name": "first_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "reviewed_at": {
+ "name": "reviewed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reviewed_by_agent_id": {
+ "name": "reviewed_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reviewed_by_user_id": {
+ "name": "reviewed_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quarantined_at": {
+ "name": "quarantined_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quarantine_reason": {
+ "name": "quarantine_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_catalog_entries_company_idx": {
+ "name": "tool_catalog_entries_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_catalog_entries_application_idx": {
+ "name": "tool_catalog_entries_application_idx",
+ "columns": [
+ {
+ "expression": "application_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_catalog_entries_connection_idx": {
+ "name": "tool_catalog_entries_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_catalog_entries_company_status_idx": {
+ "name": "tool_catalog_entries_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_catalog_entries_connection_name_uq": {
+ "name": "tool_catalog_entries_connection_name_uq",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_catalog_entries_company_id_companies_id_fk": {
+ "name": "tool_catalog_entries_company_id_companies_id_fk",
+ "tableFrom": "tool_catalog_entries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_catalog_entries_application_id_tool_applications_id_fk": {
+ "name": "tool_catalog_entries_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_catalog_entries",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_catalog_entries_connection_id_tool_connections_id_fk": {
+ "name": "tool_catalog_entries_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_catalog_entries",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk": {
+ "name": "tool_catalog_entries_reviewed_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_catalog_entries",
+ "columnsFrom": [
+ "reviewed_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_connection_app_snapshots": {
+ "name": "tool_connection_app_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_key": {
+ "name": "credential_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "toolkit": {
+ "name": "toolkit",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accounts": {
+ "name": "accounts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "checked_at": {
+ "name": "checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "error_at": {
+ "name": "error_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "tool_connection_app_snapshots_owner_toolkit_uq": {
+ "name": "tool_connection_app_snapshots_owner_toolkit_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "toolkit",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_connection_app_snapshots_company_id_companies_id_fk": {
+ "name": "tool_connection_app_snapshots_company_id_companies_id_fk",
+ "tableFrom": "tool_connection_app_snapshots",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_connection_app_snapshots_company_connection_fk": {
+ "name": "tool_connection_app_snapshots_company_connection_fk",
+ "tableFrom": "tool_connection_app_snapshots",
+ "columnsFrom": [
+ "company_id",
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_connection_app_syncs": {
+ "name": "tool_connection_app_syncs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_key": {
+ "name": "credential_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lease_id": {
+ "name": "lease_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "checked": {
+ "name": "checked",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "total": {
+ "name": "total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "failed": {
+ "name": "failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_completed_at": {
+ "name": "last_completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_connection_app_syncs_owner_key_uq": {
+ "name": "tool_connection_app_syncs_owner_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "credential_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_connection_app_syncs_company_id_companies_id_fk": {
+ "name": "tool_connection_app_syncs_company_id_companies_id_fk",
+ "tableFrom": "tool_connection_app_syncs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_connection_app_syncs_company_connection_fk": {
+ "name": "tool_connection_app_syncs_company_connection_fk",
+ "tableFrom": "tool_connection_app_syncs",
+ "columnsFrom": [
+ "company_id",
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_connection_installs": {
+ "name": "tool_connection_installs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_connection_installs_company_target_idx": {
+ "name": "tool_connection_installs_company_target_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_connection_installs_connection_idx": {
+ "name": "tool_connection_installs_connection_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_connection_installs_target_uq": {
+ "name": "tool_connection_installs_target_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_connection_installs_company_id_companies_id_fk": {
+ "name": "tool_connection_installs_company_id_companies_id_fk",
+ "tableFrom": "tool_connection_installs",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_connection_installs_connection_id_tool_connections_id_fk": {
+ "name": "tool_connection_installs_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_connection_installs",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_connection_installs_created_by_agent_id_agents_id_fk": {
+ "name": "tool_connection_installs_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_connection_installs",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "tool_connection_installs_target_type_check": {
+ "name": "tool_connection_installs_target_type_check",
+ "value": "\"tool_connection_installs\".\"target_type\" in ('company', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.tool_connections": {
+ "name": "tool_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uid": {
+ "name": "uid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_kind": {
+ "name": "connection_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'managed'"
+ },
+ "connection_purpose": {
+ "name": "connection_purpose",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'tool'"
+ },
+ "ownership": {
+ "name": "ownership",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'customer'"
+ },
+ "transport": {
+ "name": "transport",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_kind": {
+ "name": "auth_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "credential_source": {
+ "name": "credential_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip_vault'"
+ },
+ "external_credential": {
+ "name": "external_credential",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_policy": {
+ "name": "credential_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'shared'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "agent_instructions": {
+ "name": "agent_instructions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "transport_config": {
+ "name": "transport_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "credential_refs": {
+ "name": "credential_refs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "credential_secret_refs": {
+ "name": "credential_secret_refs",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "health_status": {
+ "name": "health_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unchecked'"
+ },
+ "health_message": {
+ "name": "health_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_checked_at": {
+ "name": "health_checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_health_at": {
+ "name": "last_health_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_catalog_refresh_at": {
+ "name": "last_catalog_refresh_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_connections_company_idx": {
+ "name": "tool_connections_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_connections_application_idx": {
+ "name": "tool_connections_application_idx",
+ "columns": [
+ {
+ "expression": "application_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_connections_company_enabled_idx": {
+ "name": "tool_connections_company_enabled_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_connections_company_uid_uq": {
+ "name": "tool_connections_company_uid_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "uid",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_connections_company_id_companies_id_fk": {
+ "name": "tool_connections_company_id_companies_id_fk",
+ "tableFrom": "tool_connections",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_connections_application_id_tool_applications_id_fk": {
+ "name": "tool_connections_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_connections",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "tool_connections_created_by_agent_id_agents_id_fk": {
+ "name": "tool_connections_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_connections",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "tool_connections_company_id_uq": {
+ "name": "tool_connections_company_id_uq",
+ "columns": [
+ "company_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "tool_connections_ownership_check": {
+ "name": "tool_connections_ownership_check",
+ "value": "\"tool_connections\".\"ownership\" in ('platform_shared', 'platform_provisioned', 'customer', 'dcr')"
+ },
+ "tool_connections_transport_check": {
+ "name": "tool_connections_transport_check",
+ "value": "\"tool_connections\".\"transport\" in ('mcp_remote', 'rest_api', 'local_stdio', 'chat_sdk', 'runtime_auth')"
+ },
+ "tool_connections_purpose_check": {
+ "name": "tool_connections_purpose_check",
+ "value": "\"tool_connections\".\"connection_purpose\" in ('tool', 'channel', 'ai')"
+ },
+ "tool_connections_channel_transport_check": {
+ "name": "tool_connections_channel_transport_check",
+ "value": "(\n (\"tool_connections\".\"connection_purpose\" = 'tool' and \"tool_connections\".\"transport\" not in ('chat_sdk', 'runtime_auth'))\n or\n (\"tool_connections\".\"connection_purpose\" = 'channel' and (\"tool_connections\".\"transport\" = 'chat_sdk' or (\"tool_connections\".\"transport\" = 'rest_api' and \"tool_connections\".\"config\"->>'provider' = 'agentmail')))\n or\n (\"tool_connections\".\"connection_purpose\" = 'ai' and \"tool_connections\".\"transport\" = 'runtime_auth')\n )"
+ },
+ "tool_connections_auth_kind_check": {
+ "name": "tool_connections_auth_kind_check",
+ "value": "\"tool_connections\".\"auth_kind\" in ('oauth', 'api_key', 'none')"
+ },
+ "tool_connections_credential_source_check": {
+ "name": "tool_connections_credential_source_check",
+ "value": "\"tool_connections\".\"credential_source\" in ('paperclip_vault', 'vercel_connect')"
+ },
+ "tool_connections_credential_source_one_of_check": {
+ "name": "tool_connections_credential_source_one_of_check",
+ "value": "(\n (\"tool_connections\".\"credential_source\" = 'paperclip_vault' and \"tool_connections\".\"external_credential\" is null)\n or\n (\"tool_connections\".\"credential_source\" = 'vercel_connect' and \"tool_connections\".\"external_credential\" is not null and jsonb_array_length(\"tool_connections\".\"credential_refs\") = 0 and jsonb_array_length(\"tool_connections\".\"credential_secret_refs\") = 0)\n )"
+ },
+ "tool_connections_credential_policy_check": {
+ "name": "tool_connections_credential_policy_check",
+ "value": "\"tool_connections\".\"credential_policy\" in ('shared', 'per_user', 'per_user_with_fallback', 'per_agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.tool_gateway_rate_limit_counters": {
+ "name": "tool_gateway_rate_limit_counters",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter_key": {
+ "name": "counter_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_start_at": {
+ "name": "window_start_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_ms": {
+ "name": "window_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "limit": {
+ "name": "limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reset_at": {
+ "name": "reset_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_gateway_rate_limit_counters_company_idx": {
+ "name": "tool_gateway_rate_limit_counters_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_rate_limit_counters_window_uq": {
+ "name": "tool_gateway_rate_limit_counters_window_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "counter_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_start_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_gateway_rate_limit_counters_company_id_companies_id_fk": {
+ "name": "tool_gateway_rate_limit_counters_company_id_companies_id_fk",
+ "tableFrom": "tool_gateway_rate_limit_counters",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_gateway_sessions": {
+ "name": "tool_gateway_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_id": {
+ "name": "gateway_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_token_id": {
+ "name": "gateway_token_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_public_id": {
+ "name": "gateway_public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_type": {
+ "name": "client_subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_id": {
+ "name": "client_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_session_id": {
+ "name": "mcp_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_gateway_sessions_token_hash_uq": {
+ "name": "tool_gateway_sessions_token_hash_uq",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_sessions_company_agent_idx": {
+ "name": "tool_gateway_sessions_company_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_sessions_company_expires_idx": {
+ "name": "tool_gateway_sessions_company_expires_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_sessions_run_idx": {
+ "name": "tool_gateway_sessions_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_sessions_issue_idx": {
+ "name": "tool_gateway_sessions_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_gateway_sessions_gateway_idx": {
+ "name": "tool_gateway_sessions_gateway_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "gateway_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_gateway_sessions_company_id_companies_id_fk": {
+ "name": "tool_gateway_sessions_company_id_companies_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_gateway_sessions_agent_id_agents_id_fk": {
+ "name": "tool_gateway_sessions_agent_id_agents_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_gateway_sessions_run_id_heartbeat_runs_id_fk": {
+ "name": "tool_gateway_sessions_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_gateway_sessions_issue_id_issues_id_fk": {
+ "name": "tool_gateway_sessions_issue_id_issues_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_gateway_sessions_project_id_projects_id_fk": {
+ "name": "tool_gateway_sessions_project_id_projects_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk": {
+ "name": "tool_gateway_sessions_gateway_id_tool_mcp_gateways_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "gateway_id"
+ ],
+ "tableTo": "tool_mcp_gateways",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
+ "name": "tool_gateway_sessions_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
+ "tableFrom": "tool_gateway_sessions",
+ "columnsFrom": [
+ "gateway_token_id"
+ ],
+ "tableTo": "tool_mcp_gateway_tokens",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_invocations": {
+ "name": "tool_invocations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_id": {
+ "name": "gateway_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_token_id": {
+ "name": "gateway_token_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gateway_public_id": {
+ "name": "gateway_public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_type": {
+ "name": "client_subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_subject_id": {
+ "name": "client_subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_session_id": {
+ "name": "mcp_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "correlation_id": {
+ "name": "correlation_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_entry_id": {
+ "name": "catalog_entry_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_version_hash": {
+ "name": "catalog_version_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_schema_hash": {
+ "name": "catalog_schema_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_type": {
+ "name": "provider_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_key": {
+ "name": "application_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "upstream_tool_name": {
+ "name": "upstream_tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "risk_level": {
+ "name": "risk_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments_hash": {
+ "name": "arguments_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "arguments_summary": {
+ "name": "arguments_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_decision": {
+ "name": "policy_decision",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "matched_policy_ids": {
+ "name": "matched_policy_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "policy_explanation": {
+ "name": "policy_explanation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_scope_summary": {
+ "name": "credential_scope_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "header_policy_summary": {
+ "name": "header_policy_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_state": {
+ "name": "approval_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'not_required'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "upstream_request_id": {
+ "name": "upstream_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_hash": {
+ "name": "result_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_summary": {
+ "name": "result_summary",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_size_bytes": {
+ "name": "result_size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result_artifact_id": {
+ "name": "result_artifact_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_invocations_company_created_idx": {
+ "name": "tool_invocations_company_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_invocations_run_idx": {
+ "name": "tool_invocations_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_invocations_issue_idx": {
+ "name": "tool_invocations_issue_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_invocations_gateway_idx": {
+ "name": "tool_invocations_gateway_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "gateway_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_invocations_company_idempotency_uq": {
+ "name": "tool_invocations_company_idempotency_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_invocations_company_id_companies_id_fk": {
+ "name": "tool_invocations_company_id_companies_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_invocations_agent_id_agents_id_fk": {
+ "name": "tool_invocations_agent_id_agents_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_issue_id_issues_id_fk": {
+ "name": "tool_invocations_issue_id_issues_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_run_id_heartbeat_runs_id_fk": {
+ "name": "tool_invocations_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_gateway_id_tool_mcp_gateways_id_fk": {
+ "name": "tool_invocations_gateway_id_tool_mcp_gateways_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "gateway_id"
+ ],
+ "tableTo": "tool_mcp_gateways",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk": {
+ "name": "tool_invocations_gateway_token_id_tool_mcp_gateway_tokens_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "gateway_token_id"
+ ],
+ "tableTo": "tool_mcp_gateway_tokens",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_application_id_tool_applications_id_fk": {
+ "name": "tool_invocations_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_connection_id_tool_connections_id_fk": {
+ "name": "tool_invocations_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk": {
+ "name": "tool_invocations_catalog_entry_id_tool_catalog_entries_id_fk",
+ "tableFrom": "tool_invocations",
+ "columnsFrom": [
+ "catalog_entry_id"
+ ],
+ "tableTo": "tool_catalog_entries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_mcp_gateway_tokens": {
+ "name": "tool_mcp_gateway_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "gateway_id": {
+ "name": "gateway_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_prefix": {
+ "name": "token_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'gateway_client'"
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_label": {
+ "name": "client_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "owner_note": {
+ "name": "owner_note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "allowed_actions": {
+ "name": "allowed_actions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[\"tools/list\",\"tools/call\"]'::jsonb"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiry_override_reason": {
+ "name": "expiry_override_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiry_override_by_user_id": {
+ "name": "expiry_override_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiry_override_by_agent_id": {
+ "name": "expiry_override_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiry_override_at": {
+ "name": "expiry_override_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_mcp_gateway_tokens_token_hash_uq": {
+ "name": "tool_mcp_gateway_tokens_token_hash_uq",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateway_tokens_expiry_idx": {
+ "name": "tool_mcp_gateway_tokens_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateway_tokens_gateway_idx": {
+ "name": "tool_mcp_gateway_tokens_gateway_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "gateway_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateway_tokens_subject_idx": {
+ "name": "tool_mcp_gateway_tokens_subject_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateway_tokens_company_expires_idx": {
+ "name": "tool_mcp_gateway_tokens_company_expires_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_mcp_gateway_tokens_company_id_companies_id_fk": {
+ "name": "tool_mcp_gateway_tokens_company_id_companies_id_fk",
+ "tableFrom": "tool_mcp_gateway_tokens",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk": {
+ "name": "tool_mcp_gateway_tokens_gateway_id_tool_mcp_gateways_id_fk",
+ "tableFrom": "tool_mcp_gateway_tokens",
+ "columnsFrom": [
+ "gateway_id"
+ ],
+ "tableTo": "tool_mcp_gateways",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk": {
+ "name": "tool_mcp_gateway_tokens_expiry_override_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_mcp_gateway_tokens",
+ "columnsFrom": [
+ "expiry_override_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk": {
+ "name": "tool_mcp_gateway_tokens_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_mcp_gateway_tokens",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_mcp_gateways": {
+ "name": "tool_mcp_gateways",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "gateway_public_id": {
+ "name": "gateway_public_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'gw_' || replace(gen_random_uuid()::text, '-', '')"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "display_slug": {
+ "name": "display_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_profile_mode": {
+ "name": "default_profile_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'gateway_only'"
+ },
+ "context_scope_type": {
+ "name": "context_scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'none'"
+ },
+ "context_scope_id": {
+ "name": "context_scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_issue_id": {
+ "name": "approval_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_config": {
+ "name": "auth_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"version\":1,\"bearer\":{\"enabled\":true,\"tokenPrefix\":\"pcgw\",\"defaultTtlSeconds\":7776000,\"requireFiniteExpiry\":true,\"longLivedTokenRequiresOverride\":true},\"oauth\":{\"enabled\":false,\"reservedFor\":\"v1_5\",\"dynamicClientRegistration\":false,\"authorizationCodePkce\":false}}'::jsonb"
+ },
+ "header_policy": {
+ "name": "header_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"version\":1,\"callerPassthrough\":{\"enabled\":false,\"allowedHeaders\":[]},\"staticHeaders\":[],\"generatedMetadata\":{\"enabled\":false,\"allowedHeaders\":[]},\"responseHeaders\":{\"forwardMcpRequiredHeaders\":true,\"forwardSafeCacheHeaders\":true}}'::jsonb"
+ },
+ "metadata_policy": {
+ "name": "metadata_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"version\":1,\"forwardCompanyId\":false,\"forwardGatewayId\":false,\"forwardProjectId\":false,\"forwardIssueId\":false,\"forwardAgentId\":false,\"forwardRunId\":false,\"forwardCorrelationId\":true}'::jsonb"
+ },
+ "on_demand_tools_config": {
+ "name": "on_demand_tools_config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"enabled\":false,\"searchToolName\":\"search_tools\",\"runToolName\":\"run_tool\"}'::jsonb"
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_mcp_gateways_company_idx": {
+ "name": "tool_mcp_gateways_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateways_company_status_idx": {
+ "name": "tool_mcp_gateways_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateways_profile_idx": {
+ "name": "tool_mcp_gateways_profile_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateways_public_id_uq": {
+ "name": "tool_mcp_gateways_public_id_uq",
+ "columns": [
+ {
+ "expression": "gateway_public_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateways_company_slug_uq": {
+ "name": "tool_mcp_gateways_company_slug_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_mcp_gateways_company_name_uq": {
+ "name": "tool_mcp_gateways_company_name_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_mcp_gateways_company_id_companies_id_fk": {
+ "name": "tool_mcp_gateways_company_id_companies_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_mcp_gateways_profile_id_tool_profiles_id_fk": {
+ "name": "tool_mcp_gateways_profile_id_tool_profiles_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "tableTo": "tool_profiles",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "restrict"
+ },
+ "tool_mcp_gateways_agent_id_agents_id_fk": {
+ "name": "tool_mcp_gateways_agent_id_agents_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_mcp_gateways_project_id_projects_id_fk": {
+ "name": "tool_mcp_gateways_project_id_projects_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_mcp_gateways_issue_id_issues_id_fk": {
+ "name": "tool_mcp_gateways_issue_id_issues_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_mcp_gateways_approval_issue_id_issues_id_fk": {
+ "name": "tool_mcp_gateways_approval_issue_id_issues_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "approval_issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_mcp_gateways_created_by_agent_id_agents_id_fk": {
+ "name": "tool_mcp_gateways_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_mcp_gateways",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_oauth_states": {
+ "name": "tool_oauth_states",
+ "schema": "",
+ "columns": {
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_verifier": {
+ "name": "code_verifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_actor_type": {
+ "name": "created_by_actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_actor_id": {
+ "name": "created_by_actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_session_id": {
+ "name": "created_by_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_user_id": {
+ "name": "subject_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_agent_id": {
+ "name": "subject_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_scopes": {
+ "name": "requested_scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "return_to": {
+ "name": "return_to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "interaction_id": {
+ "name": "interaction_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_oauth_states_company_idx": {
+ "name": "tool_oauth_states_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_oauth_states_connection_idx": {
+ "name": "tool_oauth_states_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_oauth_states_actor_idx": {
+ "name": "tool_oauth_states_actor_idx",
+ "columns": [
+ {
+ "expression": "created_by_actor_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_by_actor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_oauth_states_subject_agent_idx": {
+ "name": "tool_oauth_states_subject_agent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_oauth_states_expires_at_idx": {
+ "name": "tool_oauth_states_expires_at_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_oauth_states_company_id_companies_id_fk": {
+ "name": "tool_oauth_states_company_id_companies_id_fk",
+ "tableFrom": "tool_oauth_states",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_oauth_states_connection_id_tool_connections_id_fk": {
+ "name": "tool_oauth_states_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_oauth_states",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_oauth_states_subject_agent_id_agents_id_fk": {
+ "name": "tool_oauth_states_subject_agent_id_agents_id_fk",
+ "tableFrom": "tool_oauth_states",
+ "columnsFrom": [
+ "subject_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_policies": {
+ "name": "tool_policies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_type": {
+ "name": "policy_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "priority": {
+ "name": "priority",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 100
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "selectors": {
+ "name": "selectors",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "conditions": {
+ "name": "conditions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_policies_company_enabled_idx": {
+ "name": "tool_policies_company_enabled_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "enabled",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_policies_company_type_idx": {
+ "name": "tool_policies_company_type_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "policy_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_policies_company_name_uq": {
+ "name": "tool_policies_company_name_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_policies_company_id_companies_id_fk": {
+ "name": "tool_policies_company_id_companies_id_fk",
+ "tableFrom": "tool_policies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_policies_created_by_agent_id_agents_id_fk": {
+ "name": "tool_policies_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_policies",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_profile_bindings": {
+ "name": "tool_profile_bindings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "priority": {
+ "name": "priority",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 100
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_profile_bindings_company_target_idx": {
+ "name": "tool_profile_bindings_company_target_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profile_bindings_target_profile_uq": {
+ "name": "tool_profile_bindings_target_profile_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_profile_bindings_company_id_companies_id_fk": {
+ "name": "tool_profile_bindings_company_id_companies_id_fk",
+ "tableFrom": "tool_profile_bindings",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_bindings_profile_id_tool_profiles_id_fk": {
+ "name": "tool_profile_bindings_profile_id_tool_profiles_id_fk",
+ "tableFrom": "tool_profile_bindings",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "tableTo": "tool_profiles",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_bindings_created_by_agent_id_agents_id_fk": {
+ "name": "tool_profile_bindings_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_profile_bindings",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_profile_entries": {
+ "name": "tool_profile_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profile_id": {
+ "name": "profile_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "selector_type": {
+ "name": "selector_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "effect": {
+ "name": "effect",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'include'"
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "catalog_entry_id": {
+ "name": "catalog_entry_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tool_name": {
+ "name": "tool_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "risk_level": {
+ "name": "risk_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "conditions": {
+ "name": "conditions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_profile_entries_company_profile_idx": {
+ "name": "tool_profile_entries_company_profile_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profile_entries_application_idx": {
+ "name": "tool_profile_entries_application_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "application_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profile_entries_connection_idx": {
+ "name": "tool_profile_entries_connection_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profile_entries_catalog_entry_idx": {
+ "name": "tool_profile_entries_catalog_entry_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "catalog_entry_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_profile_entries_company_id_companies_id_fk": {
+ "name": "tool_profile_entries_company_id_companies_id_fk",
+ "tableFrom": "tool_profile_entries",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_entries_profile_id_tool_profiles_id_fk": {
+ "name": "tool_profile_entries_profile_id_tool_profiles_id_fk",
+ "tableFrom": "tool_profile_entries",
+ "columnsFrom": [
+ "profile_id"
+ ],
+ "tableTo": "tool_profiles",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_entries_application_id_tool_applications_id_fk": {
+ "name": "tool_profile_entries_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_profile_entries",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_entries_connection_id_tool_connections_id_fk": {
+ "name": "tool_profile_entries_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_profile_entries",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk": {
+ "name": "tool_profile_entries_catalog_entry_id_tool_catalog_entries_id_fk",
+ "tableFrom": "tool_profile_entries",
+ "columnsFrom": [
+ "catalog_entry_id"
+ ],
+ "tableTo": "tool_catalog_entries",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_profiles": {
+ "name": "tool_profiles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "profile_key": {
+ "name": "profile_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "default_action": {
+ "name": "default_action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'deny'"
+ },
+ "new_tools_reviewed_at": {
+ "name": "new_tools_reviewed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_profiles_company_status_idx": {
+ "name": "tool_profiles_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profiles_company_key_uq": {
+ "name": "tool_profiles_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "profile_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_profiles_company_name_uq": {
+ "name": "tool_profiles_company_name_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_profiles_company_id_companies_id_fk": {
+ "name": "tool_profiles_company_id_companies_id_fk",
+ "tableFrom": "tool_profiles",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_rate_limit_counters": {
+ "name": "tool_rate_limit_counters",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter_key": {
+ "name": "counter_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_kind": {
+ "name": "window_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "window_start_at": {
+ "name": "window_start_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "limit": {
+ "name": "limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reset_at": {
+ "name": "reset_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_rate_limit_counters_company_idx": {
+ "name": "tool_rate_limit_counters_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_rate_limit_counters_window_uq": {
+ "name": "tool_rate_limit_counters_window_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "policy_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "counter_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "window_start_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_rate_limit_counters_company_id_companies_id_fk": {
+ "name": "tool_rate_limit_counters_company_id_companies_id_fk",
+ "tableFrom": "tool_rate_limit_counters",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_rate_limit_counters_policy_id_tool_policies_id_fk": {
+ "name": "tool_rate_limit_counters_policy_id_tool_policies_id_fk",
+ "tableFrom": "tool_rate_limit_counters",
+ "columnsFrom": [
+ "policy_id"
+ ],
+ "tableTo": "tool_policies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_runtime_metric_counters": {
+ "name": "tool_runtime_metric_counters",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metric": {
+ "name": "metric",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "bucket_start_at": {
+ "name": "bucket_start_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_runtime_metric_counters_company_metric_idx": {
+ "name": "tool_runtime_metric_counters_company_metric_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "metric",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bucket_start_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_runtime_metric_counters_bucket_uq": {
+ "name": "tool_runtime_metric_counters_bucket_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "metric",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "bucket_start_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_runtime_metric_counters_company_id_companies_id_fk": {
+ "name": "tool_runtime_metric_counters_company_id_companies_id_fk",
+ "tableFrom": "tool_runtime_metric_counters",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_runtime_slots": {
+ "name": "tool_runtime_slots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "application_id": {
+ "name": "application_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_workspace_id": {
+ "name": "project_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_scope_type": {
+ "name": "owner_scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connection'"
+ },
+ "owner_scope_id": {
+ "name": "owner_scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runtime_kind": {
+ "name": "runtime_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_stdio'"
+ },
+ "slot_key": {
+ "name": "slot_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'stopped'"
+ },
+ "reuse_key": {
+ "name": "reuse_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_scope": {
+ "name": "workspace_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_scope_hash": {
+ "name": "credential_scope_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_ref": {
+ "name": "provider_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "process_id": {
+ "name": "process_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "command_template_key": {
+ "name": "command_template_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_status": {
+ "name": "health_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unchecked'"
+ },
+ "health_message": {
+ "name": "health_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_health_check_at": {
+ "name": "last_health_check_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_started_at": {
+ "name": "last_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idle_expires_at": {
+ "name": "idle_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idle_deadline_at": {
+ "name": "idle_deadline_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_runtime_slots_company_idx": {
+ "name": "tool_runtime_slots_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_runtime_slots_connection_idx": {
+ "name": "tool_runtime_slots_connection_idx",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_runtime_slots_execution_workspace_idx": {
+ "name": "tool_runtime_slots_execution_workspace_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_runtime_slots_slot_key_uq": {
+ "name": "tool_runtime_slots_slot_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "slot_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_runtime_slots_company_id_companies_id_fk": {
+ "name": "tool_runtime_slots_company_id_companies_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_runtime_slots_application_id_tool_applications_id_fk": {
+ "name": "tool_runtime_slots_application_id_tool_applications_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "application_id"
+ ],
+ "tableTo": "tool_applications",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_runtime_slots_connection_id_tool_connections_id_fk": {
+ "name": "tool_runtime_slots_connection_id_tool_connections_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "tableTo": "tool_connections",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk": {
+ "name": "tool_runtime_slots_project_workspace_id_project_workspaces_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "project_workspace_id"
+ ],
+ "tableTo": "project_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "tool_runtime_slots_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "tool_runtime_slots_issue_id_issues_id_fk": {
+ "name": "tool_runtime_slots_issue_id_issues_id_fk",
+ "tableFrom": "tool_runtime_slots",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tool_stdio_command_templates": {
+ "name": "tool_stdio_command_templates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "template_key": {
+ "name": "template_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "command": {
+ "name": "command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "args": {
+ "name": "args",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "env_keys": {
+ "name": "env_keys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "tools": {
+ "name": "tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_at": {
+ "name": "disabled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "tool_stdio_command_templates_company_idx": {
+ "name": "tool_stdio_command_templates_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_stdio_command_templates_company_status_idx": {
+ "name": "tool_stdio_command_templates_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "tool_stdio_command_templates_company_key_uq": {
+ "name": "tool_stdio_command_templates_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "template_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "tool_stdio_command_templates_company_id_companies_id_fk": {
+ "name": "tool_stdio_command_templates_company_id_companies_id_fk",
+ "tableFrom": "tool_stdio_command_templates",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "tool_stdio_command_templates_created_by_agent_id_agents_id_fk": {
+ "name": "tool_stdio_command_templates_created_by_agent_id_agents_id_fk",
+ "tableFrom": "tool_stdio_command_templates",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_inbox_agent_policies": {
+ "name": "user_inbox_agent_policies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "allowed_agent_ids": {
+ "name": "allowed_agent_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_inbox_agent_policies_company_user_uq": {
+ "name": "user_inbox_agent_policies_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_inbox_agent_policies_allowed_agent_ids_idx": {
+ "name": "user_inbox_agent_policies_allowed_agent_ids_idx",
+ "columns": [
+ {
+ "expression": "allowed_agent_ids",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "gin",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "user_inbox_agent_policies_company_id_companies_id_fk": {
+ "name": "user_inbox_agent_policies_company_id_companies_id_fk",
+ "tableFrom": "user_inbox_agent_policies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_inbox_agent_policies_mode_check": {
+ "name": "user_inbox_agent_policies_mode_check",
+ "value": "\"user_inbox_agent_policies\".\"mode\" in ('open', 'allowlist', 'disabled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_secret_declarations": {
+ "name": "user_secret_declarations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_secret_definition_id": {
+ "name": "user_secret_definition_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_type": {
+ "name": "target_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_id": {
+ "name": "target_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config_path": {
+ "name": "config_path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "env_key": {
+ "name": "env_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version_selector": {
+ "name": "version_selector",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'latest'"
+ },
+ "required": {
+ "name": "required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "allow_missing_override": {
+ "name": "allow_missing_override",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_secret_declarations_company_idx": {
+ "name": "user_secret_declarations_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_declarations_definition_idx": {
+ "name": "user_secret_declarations_definition_idx",
+ "columns": [
+ {
+ "expression": "user_secret_definition_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_declarations_target_idx": {
+ "name": "user_secret_declarations_target_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_declarations_company_required_idx": {
+ "name": "user_secret_declarations_company_required_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "required",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_declarations_target_path_uq": {
+ "name": "user_secret_declarations_target_path_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "target_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "config_path",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_declarations_required_override_idx": {
+ "name": "user_secret_declarations_required_override_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "allow_missing_override",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "where": "\"user_secret_declarations\".\"allow_missing_override\" = true",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "user_secret_declarations_company_id_companies_id_fk": {
+ "name": "user_secret_declarations_company_id_companies_id_fk",
+ "tableFrom": "user_secret_declarations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk": {
+ "name": "user_secret_declarations_user_secret_definition_id_user_secret_definitions_id_fk",
+ "tableFrom": "user_secret_declarations",
+ "columnsFrom": [
+ "user_secret_definition_id"
+ ],
+ "tableTo": "user_secret_definitions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_secret_definitions": {
+ "name": "user_secret_definitions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local_encrypted'"
+ },
+ "managed_mode": {
+ "name": "managed_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'paperclip_managed'"
+ },
+ "provider_config_id": {
+ "name": "provider_config_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_metadata": {
+ "name": "provider_metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usage_guidance": {
+ "name": "usage_guidance",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_agent_id": {
+ "name": "created_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_agent_id": {
+ "name": "updated_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_secret_definitions_company_status_idx": {
+ "name": "user_secret_definitions_company_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_definitions_company_provider_idx": {
+ "name": "user_secret_definitions_company_provider_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_definitions_provider_config_idx": {
+ "name": "user_secret_definitions_provider_config_idx",
+ "columns": [
+ {
+ "expression": "provider_config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "user_secret_definitions_company_key_uq": {
+ "name": "user_secret_definitions_company_key_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "where": "\"user_secret_definitions\".\"deleted_at\" is null",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "user_secret_definitions_company_id_companies_id_fk": {
+ "name": "user_secret_definitions_company_id_companies_id_fk",
+ "tableFrom": "user_secret_definitions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk": {
+ "name": "user_secret_definitions_provider_config_id_company_secret_provider_configs_id_fk",
+ "tableFrom": "user_secret_definitions",
+ "columnsFrom": [
+ "provider_config_id"
+ ],
+ "tableTo": "company_secret_provider_configs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "user_secret_definitions_created_by_agent_id_agents_id_fk": {
+ "name": "user_secret_definitions_created_by_agent_id_agents_id_fk",
+ "tableFrom": "user_secret_definitions",
+ "columnsFrom": [
+ "created_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "user_secret_definitions_updated_by_agent_id_agents_id_fk": {
+ "name": "user_secret_definitions_updated_by_agent_id_agents_id_fk",
+ "tableFrom": "user_secret_definitions",
+ "columnsFrom": [
+ "updated_by_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_sidebar_preferences": {
+ "name": "user_sidebar_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_order": {
+ "name": "company_order",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_sidebar_preferences_user_uq": {
+ "name": "user_sidebar_preferences_user_uq",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.work_assessments": {
+ "name": "work_assessments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "result_id": {
+ "name": "result_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger_kind": {
+ "name": "trigger_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trigger_ref": {
+ "name": "trigger_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_capability": {
+ "name": "trigger_capability",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_actor_company_id": {
+ "name": "trigger_actor_company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prior_issue_status": {
+ "name": "prior_issue_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prior_status_version": {
+ "name": "prior_status_version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prior_decision_id": {
+ "name": "prior_decision_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assessment_json": {
+ "name": "assessment_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_digest": {
+ "name": "input_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "supersedes_assessment_id": {
+ "name": "supersedes_assessment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "work_assessments_company_issue_input_uq": {
+ "name": "work_assessments_company_issue_input_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "input_digest",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "work_assessments_company_id_companies_id_fk": {
+ "name": "work_assessments_company_id_companies_id_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_trigger_actor_company_id_companies_id_fk": {
+ "name": "work_assessments_trigger_actor_company_id_companies_id_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "trigger_actor_company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_issue_company_fk": {
+ "name": "work_assessments_issue_company_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id",
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_run_owner_fk": {
+ "name": "work_assessments_run_owner_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "company_id",
+ "native_issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_contract_owner_fk": {
+ "name": "work_assessments_contract_owner_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "contract_id"
+ ],
+ "tableTo": "completion_contracts",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_result_owner_fk": {
+ "name": "work_assessments_result_owner_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "result_id"
+ ],
+ "tableTo": "native_run_results",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "work_assessments_supersedes_owner_fk": {
+ "name": "work_assessments_supersedes_owner_fk",
+ "tableFrom": "work_assessments",
+ "columnsFrom": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "supersedes_assessment_id"
+ ],
+ "tableTo": "work_assessments",
+ "columnsTo": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "work_assessments_company_issue_run_id_uq": {
+ "name": "work_assessments_company_issue_run_id_uq",
+ "columns": [
+ "company_id",
+ "issue_id",
+ "run_id",
+ "id"
+ ],
+ "nullsNotDistinct": false
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "work_assessments_trigger_actor_company_check": {
+ "name": "work_assessments_trigger_actor_company_check",
+ "value": "\"work_assessments\".\"trigger_actor_company_id\" = \"work_assessments\".\"company_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_operations": {
+ "name": "workspace_operations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heartbeat_run_id": {
+ "name": "heartbeat_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "command": {
+ "name": "command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cwd": {
+ "name": "cwd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "exit_code": {
+ "name": "exit_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_store": {
+ "name": "log_store",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_ref": {
+ "name": "log_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_bytes": {
+ "name": "log_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_sha256": {
+ "name": "log_sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "log_compressed": {
+ "name": "log_compressed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "stdout_excerpt": {
+ "name": "stdout_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stderr_excerpt": {
+ "name": "stderr_excerpt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_operations_company_run_started_idx": {
+ "name": "workspace_operations_company_run_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "heartbeat_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_operations_company_workspace_started_idx": {
+ "name": "workspace_operations_company_workspace_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_operations_company_workspace_issue_started_idx": {
+ "name": "workspace_operations_company_workspace_issue_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "workspace_operations_company_id_companies_id_fk": {
+ "name": "workspace_operations_company_id_companies_id_fk",
+ "tableFrom": "workspace_operations",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "workspace_operations_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "workspace_operations_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "workspace_operations",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk": {
+ "name": "workspace_operations_heartbeat_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "workspace_operations",
+ "columnsFrom": [
+ "heartbeat_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_operations_issue_id_issues_id_fk": {
+ "name": "workspace_operations_issue_id_issues_id_fk",
+ "tableFrom": "workspace_operations",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_runtime_services": {
+ "name": "workspace_runtime_services",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_workspace_id": {
+ "name": "project_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_workspace_id": {
+ "name": "execution_workspace_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope_type": {
+ "name": "scope_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "service_name": {
+ "name": "service_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "lifecycle": {
+ "name": "lifecycle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reuse_key": {
+ "name": "reuse_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "command": {
+ "name": "command",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cwd": {
+ "name": "cwd",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "port": {
+ "name": "port",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_ref": {
+ "name": "provider_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_agent_id": {
+ "name": "owner_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_by_run_id": {
+ "name": "started_by_run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stop_policy": {
+ "name": "stop_policy",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "exposure": {
+ "name": "exposure",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "exposure_handle": {
+ "name": "exposure_handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backend_url": {
+ "name": "backend_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "health_status": {
+ "name": "health_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unknown'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_runtime_services_company_workspace_status_idx": {
+ "name": "workspace_runtime_services_company_workspace_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_runtime_services_company_execution_workspace_status_idx": {
+ "name": "workspace_runtime_services_company_execution_workspace_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "execution_workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_runtime_services_company_project_status_idx": {
+ "name": "workspace_runtime_services_company_project_status_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_runtime_services_run_idx": {
+ "name": "workspace_runtime_services_run_idx",
+ "columns": [
+ {
+ "expression": "started_by_run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "workspace_runtime_services_company_updated_idx": {
+ "name": "workspace_runtime_services_company_updated_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "workspace_runtime_services_company_id_companies_id_fk": {
+ "name": "workspace_runtime_services_company_id_companies_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "no action"
+ },
+ "workspace_runtime_services_project_id_projects_id_fk": {
+ "name": "workspace_runtime_services_project_id_projects_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "tableTo": "projects",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk": {
+ "name": "workspace_runtime_services_project_workspace_id_project_workspaces_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "project_workspace_id"
+ ],
+ "tableTo": "project_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk": {
+ "name": "workspace_runtime_services_execution_workspace_id_execution_workspaces_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "execution_workspace_id"
+ ],
+ "tableTo": "execution_workspaces",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_runtime_services_issue_id_issues_id_fk": {
+ "name": "workspace_runtime_services_issue_id_issues_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "tableTo": "issues",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_runtime_services_owner_agent_id_agents_id_fk": {
+ "name": "workspace_runtime_services_owner_agent_id_agents_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "owner_agent_id"
+ ],
+ "tableTo": "agents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ },
+ "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk": {
+ "name": "workspace_runtime_services_started_by_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "workspace_runtime_services",
+ "columnsFrom": [
+ "started_by_run_id"
+ ],
+ "tableTo": "heartbeat_runs",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "set null"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_attachment_uploads": {
+ "name": "mcp_attachment_uploads",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments_hash": {
+ "name": "arguments_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_filename": {
+ "name": "original_filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_size": {
+ "name": "byte_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sha256": {
+ "name": "sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_provider": {
+ "name": "storage_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cleaned_at": {
+ "name": "cleaned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_attachment_upload_request_uq": {
+ "name": "mcp_attachment_upload_request_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_attachment_upload_expiry_idx": {
+ "name": "mcp_attachment_upload_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_attachment_uploads_company_id_companies_id_fk": {
+ "name": "mcp_attachment_uploads_company_id_companies_id_fk",
+ "tableFrom": "mcp_attachment_uploads",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_attachment_uploads_user_id_user_id_fk": {
+ "name": "mcp_attachment_uploads_user_id_user_id_fk",
+ "tableFrom": "mcp_attachment_uploads",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_event_admissions": {
+ "name": "mcp_event_admissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reserves_subscription": {
+ "name": "reserves_subscription",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_event_admissions_expiry_idx": {
+ "name": "mcp_event_admissions_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_event_admissions_grant_idx": {
+ "name": "mcp_event_admissions_grant_idx",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_event_admissions_company_idx": {
+ "name": "mcp_event_admissions_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_event_admissions_company_id_companies_id_fk": {
+ "name": "mcp_event_admissions_company_id_companies_id_fk",
+ "tableFrom": "mcp_event_admissions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_event_admissions_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_event_admissions_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_event_admissions",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_event_deliveries": {
+ "name": "mcp_event_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "activity_id": {
+ "name": "activity_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "mcp_event_deliveries_activity_uq": {
+ "name": "mcp_event_deliveries_activity_uq",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "activity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_event_deliveries_due_idx": {
+ "name": "mcp_event_deliveries_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_event_deliveries_subscription_id_mcp_event_subscriptions_id_fk": {
+ "name": "mcp_event_deliveries_subscription_id_mcp_event_subscriptions_id_fk",
+ "tableFrom": "mcp_event_deliveries",
+ "columnsFrom": [
+ "subscription_id"
+ ],
+ "tableTo": "mcp_event_subscriptions",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_event_subscriptions": {
+ "name": "mcp_event_subscriptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments": {
+ "name": "arguments",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_material": {
+ "name": "delivery_material",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "starts_at": {
+ "name": "starts_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stopped_at": {
+ "name": "stopped_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scanned_at": {
+ "name": "scanned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_event_subscriptions_expiry_idx": {
+ "name": "mcp_event_subscriptions_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_event_subscriptions_company_idx": {
+ "name": "mcp_event_subscriptions_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_event_subscriptions_company_id_companies_id_fk": {
+ "name": "mcp_event_subscriptions_company_id_companies_id_fk",
+ "tableFrom": "mcp_event_subscriptions",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_event_subscriptions_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_event_subscriptions_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_event_subscriptions",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_file_tickets": {
+ "name": "mcp_file_tickets",
+ "schema": "",
+ "columns": {
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upload_id": {
+ "name": "upload_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_file_ticket_expiry_idx": {
+ "name": "mcp_file_ticket_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_file_ticket_grant_idx": {
+ "name": "mcp_file_ticket_grant_idx",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_file_tickets_company_id_companies_id_fk": {
+ "name": "mcp_file_tickets_company_id_companies_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_file_tickets_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_file_tickets_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_file_tickets_upload_id_mcp_attachment_uploads_id_fk": {
+ "name": "mcp_file_tickets_upload_id_mcp_attachment_uploads_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "columnsFrom": [
+ "upload_id"
+ ],
+ "tableTo": "mcp_attachment_uploads",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_mutation_receipts": {
+ "name": "mcp_mutation_receipts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "operation": {
+ "name": "operation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments_hash": {
+ "name": "arguments_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'reserved'"
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_mutation_receipts_request_uq": {
+ "name": "mcp_mutation_receipts_request_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "operation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_mutation_receipts_company_idx": {
+ "name": "mcp_mutation_receipts_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_mutation_receipts_company_id_companies_id_fk": {
+ "name": "mcp_mutation_receipts_company_id_companies_id_fk",
+ "tableFrom": "mcp_mutation_receipts",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_mutation_receipts_user_id_user_id_fk": {
+ "name": "mcp_mutation_receipts_user_id_user_id_fk",
+ "tableFrom": "mcp_mutation_receipts",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_mutation_receipts_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_mutation_receipts_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_mutation_receipts",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_clients": {
+ "name": "mcp_oauth_clients",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "registration_source_hash": {
+ "name": "registration_source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[\"authorization_code\",\"refresh_token\"]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_device_requests": {
+ "name": "mcp_oauth_device_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_code_hash": {
+ "name": "device_code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_code_hash": {
+ "name": "user_code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_company_id": {
+ "name": "requested_company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "interval_seconds": {
+ "name": "interval_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 5
+ },
+ "next_poll_at": {
+ "name": "next_poll_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_oauth_device_code_uq": {
+ "name": "mcp_oauth_device_code_uq",
+ "columns": [
+ {
+ "expression": "device_code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_oauth_user_code_uq": {
+ "name": "mcp_oauth_user_code_uq",
+ "columns": [
+ {
+ "expression": "user_code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_oauth_device_expiry_idx": {
+ "name": "mcp_oauth_device_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_oauth_device_requests_client_id_mcp_oauth_clients_id_fk": {
+ "name": "mcp_oauth_device_requests_client_id_mcp_oauth_clients_id_fk",
+ "tableFrom": "mcp_oauth_device_requests",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "tableTo": "mcp_oauth_clients",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_oauth_device_requests_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_oauth_device_requests_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_oauth_device_requests",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_grants": {
+ "name": "mcp_oauth_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_oauth_grants_user_company_idx": {
+ "name": "mcp_oauth_grants_user_company_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_oauth_grants_company_id_companies_id_fk": {
+ "name": "mcp_oauth_grants_company_id_companies_id_fk",
+ "tableFrom": "mcp_oauth_grants",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "tableTo": "companies",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_oauth_grants_user_id_user_id_fk": {
+ "name": "mcp_oauth_grants_user_id_user_id_fk",
+ "tableFrom": "mcp_oauth_grants",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "user",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_oauth_grants_client_id_mcp_oauth_clients_id_fk": {
+ "name": "mcp_oauth_grants_client_id_mcp_oauth_clients_id_fk",
+ "tableFrom": "mcp_oauth_grants",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "tableTo": "mcp_oauth_clients",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_metadata_admissions": {
+ "name": "mcp_oauth_metadata_admissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "source_hash": {
+ "name": "source_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "mcp_oauth_metadata_admissions_expiry_idx": {
+ "name": "mcp_oauth_metadata_admissions_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_requests": {
+ "name": "mcp_oauth_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uri": {
+ "name": "redirect_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "challenge": {
+ "name": "challenge",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_company_id": {
+ "name": "requested_company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "code_hash": {
+ "name": "code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decided_at": {
+ "name": "decided_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "consumed_at": {
+ "name": "consumed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_oauth_requests_code_uq": {
+ "name": "mcp_oauth_requests_code_uq",
+ "columns": [
+ {
+ "expression": "code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_oauth_requests_expiry_idx": {
+ "name": "mcp_oauth_requests_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_oauth_requests_client_id_mcp_oauth_clients_id_fk": {
+ "name": "mcp_oauth_requests_client_id_mcp_oauth_clients_id_fk",
+ "tableFrom": "mcp_oauth_requests",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "tableTo": "mcp_oauth_clients",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ },
+ "mcp_oauth_requests_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_oauth_requests_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_oauth_requests",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_tokens": {
+ "name": "mcp_oauth_tokens",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_at": {
+ "name": "used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_oauth_tokens_hash_uq": {
+ "name": "mcp_oauth_tokens_hash_uq",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_oauth_tokens_grant_idx": {
+ "name": "mcp_oauth_tokens_grant_idx",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ },
+ "mcp_oauth_tokens_expiry_idx": {
+ "name": "mcp_oauth_tokens_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "with": {},
+ "method": "btree",
+ "concurrently": false
+ }
+ },
+ "foreignKeys": {
+ "mcp_oauth_tokens_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_oauth_tokens_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_oauth_tokens",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "tableTo": "mcp_oauth_grants",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "no action",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "views": {},
+ "sequences": {
+ "public.chat_telegram_draft_ids": {
+ "name": "chat_telegram_draft_ids",
+ "increment": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "startWith": "1",
+ "cache": "1",
+ "cycle": false,
+ "schema": "public"
+ }
+ },
+ "roles": {},
+ "policies": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/src/migrations/meta/0313_snapshot.json b/packages/db/src/migrations/meta/0315_snapshot.json
similarity index 99%
rename from packages/db/src/migrations/meta/0313_snapshot.json
rename to packages/db/src/migrations/meta/0315_snapshot.json
index 5ffb0b3b0b0..69131296242 100644
--- a/packages/db/src/migrations/meta/0313_snapshot.json
+++ b/packages/db/src/migrations/meta/0315_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "adf783f2-c391-4fd5-b93a-d85e6d3c60a0",
- "prevId": "9134843c-7e84-421e-915b-beab3c30acb3",
+ "id": "26691ae0-39a8-42ac-868d-e36ab7219073",
+ "prevId": "a1aefefe-8911-4583-9c52-7c658e46e9b4",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -51654,6 +51654,129 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.user_company_preferences": {
+ "name": "user_company_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "primary_agent_id": {
+ "name": "primary_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_agent_initialized": {
+ "name": "primary_agent_initialized",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_company_preferences_company_user_uq": {
+ "name": "user_company_preferences_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_company_preferences_primary_agent_idx": {
+ "name": "user_company_preferences_primary_agent_idx",
+ "columns": [
+ {
+ "expression": "primary_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_company_preferences_company_id_companies_id_fk": {
+ "name": "user_company_preferences_company_id_companies_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_company_preferences_primary_agent_id_agents_id_fk": {
+ "name": "user_company_preferences_primary_agent_id_agents_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "primary_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.user_inbox_agent_policies": {
"name": "user_inbox_agent_policies",
"schema": "",
diff --git a/packages/db/src/migrations/meta/0312_snapshot.json b/packages/db/src/migrations/meta/0316_snapshot.json
similarity index 98%
rename from packages/db/src/migrations/meta/0312_snapshot.json
rename to packages/db/src/migrations/meta/0316_snapshot.json
index d9bcd5c6a63..76eb90e5795 100644
--- a/packages/db/src/migrations/meta/0312_snapshot.json
+++ b/packages/db/src/migrations/meta/0316_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "9134843c-7e84-421e-915b-beab3c30acb3",
- "prevId": "53940222-21d7-4ccc-8b24-d8db300f4ec3",
+ "id": "2242ec8f-2d13-46d2-99ed-cf97a52466d2",
+ "prevId": "26691ae0-39a8-42ac-868d-e36ab7219073",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -408,13 +408,19 @@
"name": "run_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "decision_invocation_id": {
+ "name": "decision_invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
},
"agent_id": {
"name": "agent_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
},
"project_id": {
"name": "project_id",
@@ -456,6 +462,27 @@
}
},
"indexes": {
+ "budget_reservations_decision_idx": {
+ "name": "budget_reservations_decision_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decision_invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"budget_reservations_run_idx": {
"name": "budget_reservations_run_idx",
"columns": [
@@ -551,6 +578,10 @@
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {
+ "budget_reservations_source_check": {
+ "name": "budget_reservations_source_check",
+ "value": "(\"budget_reservations\".\"run_id\" is not null)::int + (\"budget_reservations\".\"decision_invocation_id\" is not null)::int = 1"
+ },
"budget_reservations_state_check": {
"name": "budget_reservations_state_check",
"value": "\"budget_reservations\".\"state\" in ('held', 'settled', 'released')"
@@ -17284,7 +17315,20 @@
"name": "agent_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "usage_kind": {
+ "name": "usage_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'agent'"
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
},
"issue_id": {
"name": "issue_id",
@@ -17732,6 +17776,10 @@
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {
+ "cost_events_usage_kind_check": {
+ "name": "cost_events_usage_kind_check",
+ "value": "\"cost_events\".\"usage_kind\" = 'decision' or (\"cost_events\".\"usage_kind\" = 'agent' and \"cost_events\".\"agent_id\" is not null)"
+ },
"cost_events_nonnegative_amounts": {
"name": "cost_events_nonnegative_amounts",
"value": "\"cost_events\".\"cost_cents\" >= 0 and \"cost_events\".\"input_tokens\" >= 0 and \"cost_events\".\"cached_input_tokens\" >= 0 and \"cost_events\".\"output_tokens\" >= 0"
@@ -17739,6 +17787,346 @@
},
"isRLSEnabled": false
},
+ "public.company_decision_models": {
+ "name": "company_decision_models",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "allow_background": {
+ "name": "allow_background",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "company_decision_models_company_id_companies_id_fk": {
+ "name": "company_decision_models_company_id_companies_id_fk",
+ "tableFrom": "company_decision_models",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "company_decisions_configured": {
+ "name": "company_decisions_configured",
+ "value": "(\"company_decision_models\".\"connection_id\" is null) = (\"company_decision_models\".\"grant_id\" is null) and (not \"company_decision_models\".\"enabled\" or (\"company_decision_models\".\"connection_id\" is not null and \"company_decision_models\".\"provider\" is not null and \"company_decision_models\".\"model\" is not null))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_invocations": {
+ "name": "decision_invocations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feature": {
+ "name": "feature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "identity_context_id": {
+ "name": "identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "question_types": {
+ "name": "question_types",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "decision_invocations_company_started_idx": {
+ "name": "decision_invocations_company_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_pending_idx": {
+ "name": "decision_invocations_pending_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"decision_invocations\".\"status\" = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_cost_idx": {
+ "name": "decision_invocations_cost_idx",
+ "columns": [
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "decision_invocations_company_id_companies_id_fk": {
+ "name": "decision_invocations_company_id_companies_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "decision_invocations_cost_event_id_cost_events_id_fk": {
+ "name": "decision_invocations_cost_event_id_cost_events_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_invocations_status_check": {
+ "name": "decision_invocations_status_check",
+ "value": "\"decision_invocations\".\"status\" in ('running', 'succeeded', 'failed', 'unknown')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.decision_archive_notification_outbox": {
"name": "decision_archive_notification_outbox",
"schema": "",
@@ -26273,6 +26661,19 @@
"primaryKey": false,
"notNull": true
},
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"invocation_source": {
"name": "invocation_source",
"type": "text",
@@ -26830,6 +27231,33 @@
"method": "btree",
"with": {}
},
+ "heartbeat_runs_company_issue_created_idx": {
+ "name": "heartbeat_runs_company_issue_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"heartbeat_runs_company_responsible_user_idx": {
"name": "heartbeat_runs_company_responsible_user_idx",
"columns": [
@@ -27068,6 +27496,19 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "heartbeat_runs_issue_id_issues_id_fk": {
+ "name": "heartbeat_runs_issue_id_issues_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {
"name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",
"tableFrom": "heartbeat_runs",
@@ -27118,7 +27559,12 @@
}
},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "heartbeat_runs_scope_binding_check": {
+ "name": "heartbeat_runs_scope_binding_check",
+ "value": "(\"heartbeat_runs\".\"scope_kind\" = 'company' AND \"heartbeat_runs\".\"issue_id\" IS NULL)\n OR \"heartbeat_runs\".\"scope_kind\" = 'issue'"
+ }
+ },
"isRLSEnabled": false
},
"public.inbox_dismissals": {
@@ -28561,6 +29007,166 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.issue_access_grants": {
+ "name": "issue_access_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_by_agent_id": {
+ "name": "granted_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_access_grants_subject_active_issue_idx": {
+ "name": "issue_access_grants_subject_active_issue_idx",
+ "columns": [
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_access_grants_issue_idx": {
+ "name": "issue_access_grants_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_access_grants_issue_id_issues_id_fk": {
+ "name": "issue_access_grants_issue_id_issues_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_access_grants_granted_by_agent_id_agents_id_fk": {
+ "name": "issue_access_grants_granted_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "granted_by_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_access_grants_subject_type_check": {
+ "name": "issue_access_grants_subject_type_check",
+ "value": "\"issue_access_grants\".\"subject_type\" in ('user', 'agent')"
+ },
+ "issue_access_grants_source_check": {
+ "name": "issue_access_grants_source_check",
+ "value": "\"issue_access_grants\".\"source\" in ('explicit', 'assignment', 'project')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.issue_approvals": {
"name": "issue_approvals",
"schema": "",
@@ -33433,6 +34039,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_root_issue_id": {
+ "name": "privacy_root_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "privacy_parent_issue_id": {
+ "name": "privacy_parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"title": {
"name": "title",
"type": "text",
@@ -33917,6 +34542,48 @@
"method": "btree",
"with": {}
},
+ "issues_company_privacy_parent_idx": {
+ "name": "issues_company_privacy_parent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_parent_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issues_company_privacy_root_idx": {
+ "name": "issues_company_privacy_root_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_root_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"issues_company_project_idx": {
"name": "issues_company_project_idx",
"columns": [
@@ -34486,6 +35153,32 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "issues_privacy_root_issue_id_issues_id_fk": {
+ "name": "issues_privacy_root_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_root_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issues_privacy_parent_issue_id_issues_id_fk": {
+ "name": "issues_privacy_parent_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_parent_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"issues_assignee_agent_id_agents_id_fk": {
"name": "issues_assignee_agent_id_agents_id_fk",
"tableFrom": "issues",
@@ -34565,6 +35258,10 @@
},
"policies": {},
"checkConstraints": {
+ "issues_visibility_check": {
+ "name": "issues_visibility_check",
+ "value": "\"issues\".\"visibility\" in ('open', 'private')"
+ },
"issues_conversation_identity_check": {
"name": "issues_conversation_identity_check",
"value": "(\n \"issues\".\"conversation_agent_id\" is null and \"issues\".\"conversation_user_id\" is null and \"issues\".\"conversation_state\" is null\n ) or (\n \"issues\".\"conversation_agent_id\" is not null and \"issues\".\"conversation_user_id\" is not null\n and \"issues\".\"assignee_agent_id\" = \"issues\".\"conversation_agent_id\" and \"issues\".\"assignee_agent_id\" is not null\n and \"issues\".\"assignee_user_id\" is null and \"issues\".\"conversation_state\" is not null\n and \"issues\".\"conversation_state\" in ('active', 'waiting')\n and \"issues\".\"status\" not in ('done', 'cancelled')\n )"
@@ -39854,6 +40551,150 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.project_access_members": {
+ "name": "project_access_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_access_members_project_subject_uq": {
+ "name": "project_access_members_project_subject_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_access_members_subject_lookup_idx": {
+ "name": "project_access_members_subject_lookup_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_access_members_company_id_companies_id_fk": {
+ "name": "project_access_members_company_id_companies_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_access_members_project_id_projects_id_fk": {
+ "name": "project_access_members_project_id_projects_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_access_members_subject_type_check": {
+ "name": "project_access_members_subject_type_check",
+ "value": "\"project_access_members\".\"subject_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.project_goals": {
"name": "project_goals",
"schema": "",
@@ -40483,6 +41324,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_owner_user_id": {
+ "name": "privacy_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_owner_user_id": {
+ "name": "personal_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"status": {
"name": "status",
"type": "text",
@@ -40574,6 +41434,28 @@
"concurrently": false,
"method": "btree",
"with": {}
+ },
+ "projects_company_personal_owner_uq": {
+ "name": "projects_company_personal_owner_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "personal_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"projects\".\"personal_owner_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
}
},
"foreignKeys": {
@@ -40620,7 +41502,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "projects_visibility_check": {
+ "name": "projects_visibility_check",
+ "value": "\"projects\".\"visibility\" in ('open', 'private')"
+ }
+ },
"isRLSEnabled": false
},
"public.provider_trace_records": {
@@ -51155,6 +52042,129 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.user_company_preferences": {
+ "name": "user_company_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "primary_agent_id": {
+ "name": "primary_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_agent_initialized": {
+ "name": "primary_agent_initialized",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_company_preferences_company_user_uq": {
+ "name": "user_company_preferences_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_company_preferences_primary_agent_idx": {
+ "name": "user_company_preferences_primary_agent_idx",
+ "columns": [
+ {
+ "expression": "primary_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_company_preferences_company_id_companies_id_fk": {
+ "name": "user_company_preferences_company_id_companies_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_company_preferences_primary_agent_id_agents_id_fk": {
+ "name": "user_company_preferences_primary_agent_id_agents_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "primary_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.user_inbox_agent_policies": {
"name": "user_inbox_agent_policies",
"schema": "",
diff --git a/packages/db/src/migrations/meta/0311_snapshot.json b/packages/db/src/migrations/meta/0317_snapshot.json
similarity index 94%
rename from packages/db/src/migrations/meta/0311_snapshot.json
rename to packages/db/src/migrations/meta/0317_snapshot.json
index e10ef09bc9b..eabd692b213 100644
--- a/packages/db/src/migrations/meta/0311_snapshot.json
+++ b/packages/db/src/migrations/meta/0317_snapshot.json
@@ -1,9 +1,1110 @@
{
- "id": "53940222-21d7-4ccc-8b24-d8db300f4ec3",
- "prevId": "8a60ce2b-6ab6-435d-90b9-7dc7fc67d53f",
+ "id": "d8438290-9b05-4959-ab7f-2097cfdd6ce3",
+ "prevId": "2242ec8f-2d13-46d2-99ed-cf97a52466d2",
"version": "7",
"dialect": "postgresql",
"tables": {
+ "public.accounting_runtime_baselines": {
+ "name": "accounting_runtime_baselines",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_cents": {
+ "name": "cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cached_input_tokens": {
+ "name": "cached_input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "accounting_runtime_baselines_company_idx": {
+ "name": "accounting_runtime_baselines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "accounting_runtime_baselines_agent_id_agents_id_fk": {
+ "name": "accounting_runtime_baselines_agent_id_agents_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "accounting_runtime_baselines_company_id_companies_id_fk": {
+ "name": "accounting_runtime_baselines_company_id_companies_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_invoice_lines": {
+ "name": "billing_invoice_lines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_id": {
+ "name": "invoice_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {
+ "billing_invoice_lines_identity_idx": {
+ "name": "billing_invoice_lines_identity_idx",
+ "columns": [
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "billing_invoice_lines_company_idx": {
+ "name": "billing_invoice_lines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_invoice_lines_company_id_companies_id_fk": {
+ "name": "billing_invoice_lines_company_id_companies_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "billing_invoice_lines_invoice_id_billing_invoices_id_fk": {
+ "name": "billing_invoice_lines_invoice_id_billing_invoices_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "billing_invoices",
+ "columnsFrom": [
+ "invoice_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "billing_invoice_lines_cost_event_id_cost_events_id_fk": {
+ "name": "billing_invoice_lines_cost_event_id_cost_events_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_invoice_lines_amount_check": {
+ "name": "billing_invoice_lines_amount_check",
+ "value": "\"billing_invoice_lines\".\"amount_cents\" >= 0"
+ },
+ "billing_invoice_lines_kind_check": {
+ "name": "billing_invoice_lines_kind_check",
+ "value": "\"billing_invoice_lines\".\"kind\" in ('inference', 'fee', 'credit')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_invoices": {
+ "name": "billing_invoices",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "biller": {
+ "name": "biller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "imported_by": {
+ "name": "imported_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_invoices_identity_idx": {
+ "name": "billing_invoices_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_invoices_company_id_companies_id_fk": {
+ "name": "billing_invoices_company_id_companies_id_fk",
+ "tableFrom": "billing_invoices",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.budget_reservations": {
+ "name": "budget_reservations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision_invocation_id": {
+ "name": "decision_invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'held'"
+ },
+ "provider_started_at": {
+ "name": "provider_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "budget_reservations_decision_idx": {
+ "name": "budget_reservations_decision_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decision_invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "budget_reservations_run_idx": {
+ "name": "budget_reservations_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "budget_reservations_active_idx": {
+ "name": "budget_reservations_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"budget_reservations\".\"state\" = 'held'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "budget_reservations_company_id_companies_id_fk": {
+ "name": "budget_reservations_company_id_companies_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "budget_reservations_run_id_heartbeat_runs_id_fk": {
+ "name": "budget_reservations_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "budget_reservations_agent_id_agents_id_fk": {
+ "name": "budget_reservations_agent_id_agents_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "budget_reservations_source_check": {
+ "name": "budget_reservations_source_check",
+ "value": "(\"budget_reservations\".\"run_id\" is not null)::int + (\"budget_reservations\".\"decision_invocation_id\" is not null)::int = 1"
+ },
+ "budget_reservations_state_check": {
+ "name": "budget_reservations_state_check",
+ "value": "\"budget_reservations\".\"state\" in ('held', 'settled', 'released')"
+ },
+ "budget_reservations_amount_check": {
+ "name": "budget_reservations_amount_check",
+ "value": "\"budget_reservations\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cost_adjustments": {
+ "name": "cost_adjustments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_line_id": {
+ "name": "invoice_line_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_cents": {
+ "name": "previous_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "corrected_cents": {
+ "name": "corrected_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_status": {
+ "name": "previous_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_pricing": {
+ "name": "previous_pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cost_adjustments_receipt_idx": {
+ "name": "cost_adjustments_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_adjustments_event_idx": {
+ "name": "cost_adjustments_event_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_adjustments_invoice_line_idx": {
+ "name": "cost_adjustments_invoice_line_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_line_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cost_adjustments_company_id_companies_id_fk": {
+ "name": "cost_adjustments_company_id_companies_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cost_adjustments_cost_event_id_cost_events_id_fk": {
+ "name": "cost_adjustments_cost_event_id_cost_events_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk": {
+ "name": "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "billing_invoice_lines",
+ "columnsFrom": [
+ "invoice_line_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cost_adjustments_amount_check": {
+ "name": "cost_adjustments_amount_check",
+ "value": "\"cost_adjustments\".\"previous_cents\" >= 0 and \"cost_adjustments\".\"corrected_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.provider_billing_snapshots": {
+ "name": "provider_billing_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "provider_billing_snapshots_identity_idx": {
+ "name": "provider_billing_snapshots_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "day",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "provider_billing_snapshots_company_id_companies_id_fk": {
+ "name": "provider_billing_snapshots_company_id_companies_id_fk",
+ "tableFrom": "provider_billing_snapshots",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "provider_billing_snapshots_amount_check": {
+ "name": "provider_billing_snapshots_amount_check",
+ "value": "\"provider_billing_snapshots\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.run_usage_receipts": {
+ "name": "run_usage_receipts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_json": {
+ "name": "receipt_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "complete": {
+ "name": "complete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "run_usage_receipts_source_sequence_idx": {
+ "name": "run_usage_receipts_source_sequence_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sequence",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "run_usage_receipts_run_latest_idx": {
+ "name": "run_usage_receipts_run_latest_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "received_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "run_usage_receipts_company_id_companies_id_fk": {
+ "name": "run_usage_receipts_company_id_companies_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "run_usage_receipts_run_id_heartbeat_runs_id_fk": {
+ "name": "run_usage_receipts_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "run_usage_receipts_positive_sequence": {
+ "name": "run_usage_receipts_positive_sequence",
+ "value": "\"run_usage_receipts\".\"sequence\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.activity_log": {
"name": "activity_log",
"schema": "",
@@ -1820,7 +2921,7 @@
},
"total_cost_cents": {
"name": "total_cost_cents",
- "type": "bigint",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -2859,9 +3960,15 @@
"notNull": true,
"default": 0
},
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"spent_monthly_cents": {
"name": "spent_monthly_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -5262,7 +6369,7 @@
},
"amount_observed": {
"name": "amount_observed",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -5378,7 +6485,7 @@
}
],
"isUnique": true,
- "where": "\"budget_incidents\".\"status\" <> 'dismissed'",
+ "where": "\"budget_incidents\".\"status\" = 'open'",
"concurrently": false,
"method": "btree",
"with": {}
@@ -5480,6 +6587,13 @@
"notNull": true,
"default": 0
},
+ "reservation_cents": {
+ "name": "reservation_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
"warn_percent": {
"name": "warn_percent",
"type": "integer",
@@ -5494,6 +6608,13 @@
"notNull": true,
"default": true
},
+ "unpriced_usage_policy": {
+ "name": "unpriced_usage_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'block'"
+ },
"notify_enabled": {
"name": "notify_enabled",
"type": "boolean",
@@ -5508,6 +6629,20 @@
"notNull": true,
"default": true
},
+ "enforcement_version": {
+ "name": "enforcement_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "enforcement_delivered_version": {
+ "name": "enforcement_delivered_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
"created_by_user_id": {
"name": "created_by_user_id",
"type": "text",
@@ -5654,7 +6789,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "budget_policies_reservation_nonnegative": {
+ "name": "budget_policies_reservation_nonnegative",
+ "value": "\"budget_policies\".\"reservation_cents\" >= 0"
+ }
+ },
"isRLSEnabled": false
},
"public.built_in_managed_resources": {
@@ -11306,9 +12446,15 @@
"notNull": true,
"default": 0
},
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"spent_monthly_cents": {
"name": "spent_monthly_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -16169,7 +17315,20 @@
"name": "agent_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "usage_kind": {
+ "name": "usage_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'agent'"
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
},
"issue_id": {
"name": "issue_id",
@@ -16201,6 +17360,36 @@
"primaryKey": false,
"notNull": false
},
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reported_cost_cents": {
+ "name": "reported_cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing_provenance": {
+ "name": "pricing_provenance",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
"provider": {
"name": "provider",
"type": "text",
@@ -16257,7 +17446,7 @@
},
"cost_cents": {
"name": "cost_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -16276,6 +17465,109 @@
}
},
"indexes": {
+ "cost_events_company_receipt_idx": {
+ "name": "cost_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_provider_request_idx": {
+ "name": "cost_events_provider_request_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_company_project_occurred_idx": {
+ "name": "cost_events_company_project_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_unpriced_idx": {
+ "name": "cost_events_unpriced_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cost_events\".\"cost_status\" = 'unpriced' and \"cost_events\".\"billing_type\" <> 'subscription_included'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"cost_events_company_occurred_idx": {
"name": "cost_events_company_occurred_idx",
"columns": [
@@ -16483,7 +17775,356 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "cost_events_usage_kind_check": {
+ "name": "cost_events_usage_kind_check",
+ "value": "\"cost_events\".\"usage_kind\" = 'decision' or (\"cost_events\".\"usage_kind\" = 'agent' and \"cost_events\".\"agent_id\" is not null)"
+ },
+ "cost_events_nonnegative_amounts": {
+ "name": "cost_events_nonnegative_amounts",
+ "value": "\"cost_events\".\"cost_cents\" >= 0 and \"cost_events\".\"input_tokens\" >= 0 and \"cost_events\".\"cached_input_tokens\" >= 0 and \"cost_events\".\"output_tokens\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.company_decision_models": {
+ "name": "company_decision_models",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "allow_background": {
+ "name": "allow_background",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "company_decision_models_company_id_companies_id_fk": {
+ "name": "company_decision_models_company_id_companies_id_fk",
+ "tableFrom": "company_decision_models",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "company_decisions_configured": {
+ "name": "company_decisions_configured",
+ "value": "(\"company_decision_models\".\"connection_id\" is null) = (\"company_decision_models\".\"grant_id\" is null) and (not \"company_decision_models\".\"enabled\" or (\"company_decision_models\".\"connection_id\" is not null and \"company_decision_models\".\"provider\" is not null and \"company_decision_models\".\"model\" is not null))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_invocations": {
+ "name": "decision_invocations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feature": {
+ "name": "feature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "identity_context_id": {
+ "name": "identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "question_types": {
+ "name": "question_types",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "decision_invocations_company_started_idx": {
+ "name": "decision_invocations_company_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_pending_idx": {
+ "name": "decision_invocations_pending_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"decision_invocations\".\"status\" = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_cost_idx": {
+ "name": "decision_invocations_cost_idx",
+ "columns": [
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "decision_invocations_company_id_companies_id_fk": {
+ "name": "decision_invocations_company_id_companies_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "decision_invocations_cost_event_id_cost_events_id_fk": {
+ "name": "decision_invocations_cost_event_id_cost_events_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_invocations_status_check": {
+ "name": "decision_invocations_status_check",
+ "value": "\"decision_invocations\".\"status\" in ('running', 'succeeded', 'failed', 'unknown')"
+ }
+ },
"isRLSEnabled": false
},
"public.decision_archive_notification_outbox": {
@@ -20361,6 +22002,746 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.dot_agent_bindings": {
+ "name": "dot_agent_bindings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "operator_id": {
+ "name": "operator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pairing'"
+ },
+ "pairing_code_hash": {
+ "name": "pairing_code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pairing_expires_at": {
+ "name": "pairing_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dot_url": {
+ "name": "dot_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "challenge_hash": {
+ "name": "challenge_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "challenge_expires_at": {
+ "name": "challenge_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ready_at": {
+ "name": "ready_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_bindings_active_agent_uq": {
+ "name": "dot_bindings_active_agent_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_agent_bindings\".\"revoked_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_bindings_active_grant_uq": {
+ "name": "dot_bindings_active_grant_uq",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_agent_bindings\".\"revoked_at\" IS NULL AND \"dot_agent_bindings\".\"grant_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_bindings_pairing_code_uq": {
+ "name": "dot_bindings_pairing_code_uq",
+ "columns": [
+ {
+ "expression": "pairing_code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_agent_bindings_company_id_companies_id_fk": {
+ "name": "dot_agent_bindings_company_id_companies_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_agent_bindings_agent_id_agents_id_fk": {
+ "name": "dot_agent_bindings_agent_id_agents_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "mcp_oauth_grants",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_mailbox_items": {
+ "name": "dot_mailbox_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_generation": {
+ "name": "binding_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assignment_id": {
+ "name": "assignment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_event_id": {
+ "name": "source_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "references": {
+ "name": "references",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_mailbox_event_uq": {
+ "name": "dot_mailbox_event_uq",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "binding_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_mailbox_binding_cursor_idx": {
+ "name": "dot_mailbox_binding_cursor_idx",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "binding_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_mailbox_items_company_id_companies_id_fk": {
+ "name": "dot_mailbox_items_company_id_companies_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_mailbox_items_binding_id_dot_agent_bindings_id_fk": {
+ "name": "dot_mailbox_items_binding_id_dot_agent_bindings_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "dot_agent_bindings",
+ "columnsFrom": [
+ "binding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk": {
+ "name": "dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "dot_runner_assignments",
+ "columnsFrom": [
+ "assignment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_runner_assignments": {
+ "name": "dot_runner_assignments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_generation": {
+ "name": "binding_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_session_id": {
+ "name": "normalized_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "controller_generation": {
+ "name": "controller_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "catalog_digest": {
+ "name": "catalog_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projection": {
+ "name": "projection",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accept_by": {
+ "name": "accept_by",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_activity_at": {
+ "name": "last_activity_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_assignments_turn_uq": {
+ "name": "dot_assignments_turn_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "turn_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_assignments_active_binding_uq": {
+ "name": "dot_assignments_active_binding_uq",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_runner_assignments\".\"status\" IN ('offered', 'accepted')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_assignments_company_idx": {
+ "name": "dot_assignments_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_runner_assignments_company_id_companies_id_fk": {
+ "name": "dot_runner_assignments_company_id_companies_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_binding_id_dot_agent_bindings_id_fk": {
+ "name": "dot_runner_assignments_binding_id_dot_agent_bindings_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "dot_agent_bindings",
+ "columnsFrom": [
+ "binding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_run_id_heartbeat_runs_id_fk": {
+ "name": "dot_runner_assignments_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_agent_id_agents_id_fk": {
+ "name": "dot_runner_assignments_agent_id_agents_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_runner_operations": {
+ "name": "dot_runner_operations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assignment_id": {
+ "name": "assignment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "digest": {
+ "name": "digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "command": {
+ "name": "command",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'reserved'"
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_event_id": {
+ "name": "source_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_operations_request_uq": {
+ "name": "dot_operations_request_uq",
+ "columns": [
+ {
+ "expression": "assignment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_runner_operations_company_id_companies_id_fk": {
+ "name": "dot_runner_operations_company_id_companies_id_fk",
+ "tableFrom": "dot_runner_operations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_operations_assignment_id_dot_runner_assignments_id_fk": {
+ "name": "dot_runner_operations_assignment_id_dot_runner_assignments_id_fk",
+ "tableFrom": "dot_runner_operations",
+ "tableTo": "dot_runner_assignments",
+ "columnsFrom": [
+ "assignment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.email_endpoints": {
"name": "email_endpoints",
"schema": "",
@@ -23721,6 +26102,18 @@
"primaryKey": false,
"notNull": false
},
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"billing_code": {
"name": "billing_code",
"type": "text",
@@ -23796,7 +26189,7 @@
},
"amount_cents": {
"name": "amount_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -23841,6 +26234,27 @@
}
},
"indexes": {
+ "finance_events_company_receipt_idx": {
+ "name": "finance_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"finance_events_company_occurred_idx": {
"name": "finance_events_company_occurred_idx",
"columns": [
@@ -24987,6 +27401,19 @@
"primaryKey": false,
"notNull": true
},
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"invocation_source": {
"name": "invocation_source",
"type": "text",
@@ -25067,6 +27494,44 @@
"primaryKey": false,
"notNull": false
},
+ "cost_accounting_pending": {
+ "name": "cost_accounting_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cost_accounted_at": {
+ "name": "cost_accounted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_projection_version": {
+ "name": "accounting_projection_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_attempt_at": {
+ "name": "accounting_last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_error": {
+ "name": "accounting_last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_attempt_count": {
+ "name": "accounting_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
"usage_json": {
"name": "usage_json",
"type": "jsonb",
@@ -25403,6 +27868,28 @@
}
},
"indexes": {
+ "heartbeat_runs_cost_accounting_pending_idx": {
+ "name": "heartbeat_runs_cost_accounting_pending_idx",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"heartbeat_runs\".\"cost_accounting_pending\" = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"heartbeat_runs_execution_status_delivery_idx": {
"name": "heartbeat_runs_execution_status_delivery_idx",
"columns": [
@@ -25484,6 +27971,33 @@
"method": "btree",
"with": {}
},
+ "heartbeat_runs_company_issue_created_idx": {
+ "name": "heartbeat_runs_company_issue_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"heartbeat_runs_company_responsible_user_idx": {
"name": "heartbeat_runs_company_responsible_user_idx",
"columns": [
@@ -25722,6 +28236,19 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "heartbeat_runs_issue_id_issues_id_fk": {
+ "name": "heartbeat_runs_issue_id_issues_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {
"name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",
"tableFrom": "heartbeat_runs",
@@ -25772,7 +28299,12 @@
}
},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "heartbeat_runs_scope_binding_check": {
+ "name": "heartbeat_runs_scope_binding_check",
+ "value": "(\"heartbeat_runs\".\"scope_kind\" = 'company' AND \"heartbeat_runs\".\"issue_id\" IS NULL)\n OR \"heartbeat_runs\".\"scope_kind\" = 'issue'"
+ }
+ },
"isRLSEnabled": false
},
"public.inbox_dismissals": {
@@ -27215,6 +29747,166 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.issue_access_grants": {
+ "name": "issue_access_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_by_agent_id": {
+ "name": "granted_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_access_grants_subject_active_issue_idx": {
+ "name": "issue_access_grants_subject_active_issue_idx",
+ "columns": [
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_access_grants_issue_idx": {
+ "name": "issue_access_grants_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_access_grants_issue_id_issues_id_fk": {
+ "name": "issue_access_grants_issue_id_issues_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_access_grants_granted_by_agent_id_agents_id_fk": {
+ "name": "issue_access_grants_granted_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "granted_by_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_access_grants_subject_type_check": {
+ "name": "issue_access_grants_subject_type_check",
+ "value": "\"issue_access_grants\".\"subject_type\" in ('user', 'agent')"
+ },
+ "issue_access_grants_source_check": {
+ "name": "issue_access_grants_source_check",
+ "value": "\"issue_access_grants\".\"source\" in ('explicit', 'assignment', 'project')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.issue_approvals": {
"name": "issue_approvals",
"schema": "",
@@ -32087,6 +34779,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_root_issue_id": {
+ "name": "privacy_root_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "privacy_parent_issue_id": {
+ "name": "privacy_parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"title": {
"name": "title",
"type": "text",
@@ -32571,6 +35282,48 @@
"method": "btree",
"with": {}
},
+ "issues_company_privacy_parent_idx": {
+ "name": "issues_company_privacy_parent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_parent_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issues_company_privacy_root_idx": {
+ "name": "issues_company_privacy_root_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_root_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"issues_company_project_idx": {
"name": "issues_company_project_idx",
"columns": [
@@ -33140,6 +35893,32 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "issues_privacy_root_issue_id_issues_id_fk": {
+ "name": "issues_privacy_root_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_root_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issues_privacy_parent_issue_id_issues_id_fk": {
+ "name": "issues_privacy_parent_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_parent_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"issues_assignee_agent_id_agents_id_fk": {
"name": "issues_assignee_agent_id_agents_id_fk",
"tableFrom": "issues",
@@ -33219,6 +35998,10 @@
},
"policies": {},
"checkConstraints": {
+ "issues_visibility_check": {
+ "name": "issues_visibility_check",
+ "value": "\"issues\".\"visibility\" in ('open', 'private')"
+ },
"issues_conversation_identity_check": {
"name": "issues_conversation_identity_check",
"value": "(\n \"issues\".\"conversation_agent_id\" is null and \"issues\".\"conversation_user_id\" is null and \"issues\".\"conversation_state\" is null\n ) or (\n \"issues\".\"conversation_agent_id\" is not null and \"issues\".\"conversation_user_id\" is not null\n and \"issues\".\"assignee_agent_id\" = \"issues\".\"conversation_agent_id\" and \"issues\".\"assignee_agent_id\" is not null\n and \"issues\".\"assignee_user_id\" is null and \"issues\".\"conversation_state\" is not null\n and \"issues\".\"conversation_state\" in ('active', 'waiting')\n and \"issues\".\"status\" not in ('done', 'cancelled')\n )"
@@ -38508,6 +41291,150 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.project_access_members": {
+ "name": "project_access_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_access_members_project_subject_uq": {
+ "name": "project_access_members_project_subject_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_access_members_subject_lookup_idx": {
+ "name": "project_access_members_subject_lookup_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_access_members_company_id_companies_id_fk": {
+ "name": "project_access_members_company_id_companies_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_access_members_project_id_projects_id_fk": {
+ "name": "project_access_members_project_id_projects_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_access_members_subject_type_check": {
+ "name": "project_access_members_subject_type_check",
+ "value": "\"project_access_members\".\"subject_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.project_goals": {
"name": "project_goals",
"schema": "",
@@ -39137,6 +42064,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_owner_user_id": {
+ "name": "privacy_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_owner_user_id": {
+ "name": "personal_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"status": {
"name": "status",
"type": "text",
@@ -39228,6 +42174,28 @@
"concurrently": false,
"method": "btree",
"with": {}
+ },
+ "projects_company_personal_owner_uq": {
+ "name": "projects_company_personal_owner_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "personal_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"projects\".\"personal_owner_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
}
},
"foreignKeys": {
@@ -39274,7 +42242,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "projects_visibility_check": {
+ "name": "projects_visibility_check",
+ "value": "\"projects\".\"visibility\" in ('open', 'private')"
+ }
+ },
"isRLSEnabled": false
},
"public.provider_trace_records": {
@@ -42390,7 +45363,7 @@
},
"cost_cents": {
"name": "cost_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -49809,6 +52782,129 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.user_company_preferences": {
+ "name": "user_company_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "primary_agent_id": {
+ "name": "primary_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_agent_initialized": {
+ "name": "primary_agent_initialized",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_company_preferences_company_user_uq": {
+ "name": "user_company_preferences_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_company_preferences_primary_agent_idx": {
+ "name": "user_company_preferences_primary_agent_idx",
+ "columns": [
+ {
+ "expression": "primary_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_company_preferences_company_id_companies_id_fk": {
+ "name": "user_company_preferences_company_id_companies_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_company_preferences_primary_agent_id_agents_id_fk": {
+ "name": "user_company_preferences_primary_agent_id_agents_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "primary_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.user_inbox_agent_policies": {
"name": "user_inbox_agent_policies",
"schema": "",
@@ -51831,7 +54927,13 @@
"name": "activity_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "mailbox_item_id": {
+ "name": "mailbox_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
},
"event": {
"name": "event",
@@ -51867,6 +54969,27 @@
}
},
"indexes": {
+ "mcp_event_deliveries_mailbox_uq": {
+ "name": "mcp_event_deliveries_mailbox_uq",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "mailbox_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"mcp_event_deliveries_activity_uq": {
"name": "mcp_event_deliveries_activity_uq",
"columns": [
@@ -51922,7 +55045,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "mcp_delivery_source_check": {
+ "name": "mcp_delivery_source_check",
+ "value": "(\"mcp_event_deliveries\".\"activity_id\" IS NOT NULL AND \"mcp_event_deliveries\".\"mailbox_item_id\" IS NULL) OR (\"mcp_event_deliveries\".\"activity_id\" IS NULL AND \"mcp_event_deliveries\".\"mailbox_item_id\" IS NOT NULL)"
+ }
+ },
"isRLSEnabled": false
},
"public.mcp_event_subscriptions": {
@@ -51957,7 +55085,13 @@
"name": "task_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
},
"arguments": {
"name": "arguments",
@@ -52067,7 +55201,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "mcp_subscription_resource_check": {
+ "name": "mcp_subscription_resource_check",
+ "value": "(\"mcp_event_subscriptions\".\"task_id\" IS NOT NULL AND \"mcp_event_subscriptions\".\"binding_id\" IS NULL) OR (\"mcp_event_subscriptions\".\"task_id\" IS NULL AND \"mcp_event_subscriptions\".\"binding_id\" IS NOT NULL)"
+ }
+ },
"isRLSEnabled": false
},
"public.mcp_file_tickets": {
@@ -52623,6 +55762,19 @@
"primaryKey": false,
"notNull": true
},
+ "purpose": {
+ "name": "purpose",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'personal'"
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"scopes": {
"name": "scopes",
"type": "jsonb",
@@ -52705,6 +55857,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
+ },
+ "mcp_oauth_grants_agent_id_agents_id_fk": {
+ "name": "mcp_oauth_grants_agent_id_agents_id_fk",
+ "tableFrom": "mcp_oauth_grants",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
diff --git a/packages/db/src/migrations/meta/0310_snapshot.json b/packages/db/src/migrations/meta/0318_snapshot.json
similarity index 93%
rename from packages/db/src/migrations/meta/0310_snapshot.json
rename to packages/db/src/migrations/meta/0318_snapshot.json
index 8adbf57d9bb..ea86eded515 100644
--- a/packages/db/src/migrations/meta/0310_snapshot.json
+++ b/packages/db/src/migrations/meta/0318_snapshot.json
@@ -1,9 +1,1110 @@
{
- "id": "8a60ce2b-6ab6-435d-90b9-7dc7fc67d53f",
- "prevId": "593431cc-d6a8-4daf-a3e4-9e3c892d9419",
+ "id": "541f5e10-e2f3-44e1-b238-4d1cbfba61f2",
+ "prevId": "d8438290-9b05-4959-ab7f-2097cfdd6ce3",
"version": "7",
"dialect": "postgresql",
"tables": {
+ "public.accounting_runtime_baselines": {
+ "name": "accounting_runtime_baselines",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_cents": {
+ "name": "cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cached_input_tokens": {
+ "name": "cached_input_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "numeric(30, 0)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "accounting_runtime_baselines_company_idx": {
+ "name": "accounting_runtime_baselines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "accounting_runtime_baselines_agent_id_agents_id_fk": {
+ "name": "accounting_runtime_baselines_agent_id_agents_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "accounting_runtime_baselines_company_id_companies_id_fk": {
+ "name": "accounting_runtime_baselines_company_id_companies_id_fk",
+ "tableFrom": "accounting_runtime_baselines",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_invoice_lines": {
+ "name": "billing_invoice_lines",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_id": {
+ "name": "invoice_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "occurred_at": {
+ "name": "occurred_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {
+ "billing_invoice_lines_identity_idx": {
+ "name": "billing_invoice_lines_identity_idx",
+ "columns": [
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "billing_invoice_lines_company_idx": {
+ "name": "billing_invoice_lines_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_invoice_lines_company_id_companies_id_fk": {
+ "name": "billing_invoice_lines_company_id_companies_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "billing_invoice_lines_invoice_id_billing_invoices_id_fk": {
+ "name": "billing_invoice_lines_invoice_id_billing_invoices_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "billing_invoices",
+ "columnsFrom": [
+ "invoice_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "billing_invoice_lines_cost_event_id_cost_events_id_fk": {
+ "name": "billing_invoice_lines_cost_event_id_cost_events_id_fk",
+ "tableFrom": "billing_invoice_lines",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_invoice_lines_amount_check": {
+ "name": "billing_invoice_lines_amount_check",
+ "value": "\"billing_invoice_lines\".\"amount_cents\" >= 0"
+ },
+ "billing_invoice_lines_kind_check": {
+ "name": "billing_invoice_lines_kind_check",
+ "value": "\"billing_invoice_lines\".\"kind\" in ('inference', 'fee', 'credit')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_invoices": {
+ "name": "billing_invoices",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "biller": {
+ "name": "biller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "imported_by": {
+ "name": "imported_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_invoices_identity_idx": {
+ "name": "billing_invoices_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_invoices_company_id_companies_id_fk": {
+ "name": "billing_invoices_company_id_companies_id_fk",
+ "tableFrom": "billing_invoices",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.budget_reservations": {
+ "name": "budget_reservations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "decision_invocation_id": {
+ "name": "decision_invocation_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'held'"
+ },
+ "provider_started_at": {
+ "name": "provider_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "budget_reservations_decision_idx": {
+ "name": "budget_reservations_decision_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "decision_invocation_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "budget_reservations_run_idx": {
+ "name": "budget_reservations_run_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "budget_reservations_active_idx": {
+ "name": "budget_reservations_active_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"budget_reservations\".\"state\" = 'held'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "budget_reservations_company_id_companies_id_fk": {
+ "name": "budget_reservations_company_id_companies_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "budget_reservations_run_id_heartbeat_runs_id_fk": {
+ "name": "budget_reservations_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "budget_reservations_agent_id_agents_id_fk": {
+ "name": "budget_reservations_agent_id_agents_id_fk",
+ "tableFrom": "budget_reservations",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "budget_reservations_source_check": {
+ "name": "budget_reservations_source_check",
+ "value": "(\"budget_reservations\".\"run_id\" is not null)::int + (\"budget_reservations\".\"decision_invocation_id\" is not null)::int = 1"
+ },
+ "budget_reservations_state_check": {
+ "name": "budget_reservations_state_check",
+ "value": "\"budget_reservations\".\"state\" in ('held', 'settled', 'released')"
+ },
+ "budget_reservations_amount_check": {
+ "name": "budget_reservations_amount_check",
+ "value": "\"budget_reservations\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.cost_adjustments": {
+ "name": "cost_adjustments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invoice_line_id": {
+ "name": "invoice_line_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_cents": {
+ "name": "previous_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "corrected_cents": {
+ "name": "corrected_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_status": {
+ "name": "previous_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "previous_pricing": {
+ "name": "previous_pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pricing": {
+ "name": "pricing",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cost_adjustments_receipt_idx": {
+ "name": "cost_adjustments_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_adjustments_event_idx": {
+ "name": "cost_adjustments_event_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_adjustments_invoice_line_idx": {
+ "name": "cost_adjustments_invoice_line_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "invoice_line_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cost_adjustments_company_id_companies_id_fk": {
+ "name": "cost_adjustments_company_id_companies_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cost_adjustments_cost_event_id_cost_events_id_fk": {
+ "name": "cost_adjustments_cost_event_id_cost_events_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk": {
+ "name": "cost_adjustments_invoice_line_id_billing_invoice_lines_id_fk",
+ "tableFrom": "cost_adjustments",
+ "tableTo": "billing_invoice_lines",
+ "columnsFrom": [
+ "invoice_line_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cost_adjustments_amount_check": {
+ "name": "cost_adjustments_amount_check",
+ "value": "\"cost_adjustments\".\"previous_cents\" >= 0 and \"cost_adjustments\".\"corrected_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.provider_billing_snapshots": {
+ "name": "provider_billing_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope_id": {
+ "name": "scope_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "day": {
+ "name": "day",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "provider_billing_snapshots_identity_idx": {
+ "name": "provider_billing_snapshots_identity_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scope_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "day",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "provider_billing_snapshots_company_id_companies_id_fk": {
+ "name": "provider_billing_snapshots_company_id_companies_id_fk",
+ "tableFrom": "provider_billing_snapshots",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "provider_billing_snapshots_amount_check": {
+ "name": "provider_billing_snapshots_amount_check",
+ "value": "\"provider_billing_snapshots\".\"amount_cents\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.run_usage_receipts": {
+ "name": "run_usage_receipts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence": {
+ "name": "sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "receipt_json": {
+ "name": "receipt_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "complete": {
+ "name": "complete",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "run_usage_receipts_source_sequence_idx": {
+ "name": "run_usage_receipts_source_sequence_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sequence",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "run_usage_receipts_run_latest_idx": {
+ "name": "run_usage_receipts_run_latest_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "received_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "run_usage_receipts_company_id_companies_id_fk": {
+ "name": "run_usage_receipts_company_id_companies_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "run_usage_receipts_run_id_heartbeat_runs_id_fk": {
+ "name": "run_usage_receipts_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "run_usage_receipts",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "run_usage_receipts_positive_sequence": {
+ "name": "run_usage_receipts_positive_sequence",
+ "value": "\"run_usage_receipts\".\"sequence\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.activity_log": {
"name": "activity_log",
"schema": "",
@@ -1820,7 +2921,7 @@
},
"total_cost_cents": {
"name": "total_cost_cents",
- "type": "bigint",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -2859,9 +3960,15 @@
"notNull": true,
"default": 0
},
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"spent_monthly_cents": {
"name": "spent_monthly_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -5262,7 +6369,7 @@
},
"amount_observed": {
"name": "amount_observed",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -5378,7 +6485,7 @@
}
],
"isUnique": true,
- "where": "\"budget_incidents\".\"status\" <> 'dismissed'",
+ "where": "\"budget_incidents\".\"status\" = 'open'",
"concurrently": false,
"method": "btree",
"with": {}
@@ -5480,6 +6587,13 @@
"notNull": true,
"default": 0
},
+ "reservation_cents": {
+ "name": "reservation_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'0'"
+ },
"warn_percent": {
"name": "warn_percent",
"type": "integer",
@@ -5494,6 +6608,13 @@
"notNull": true,
"default": true
},
+ "unpriced_usage_policy": {
+ "name": "unpriced_usage_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'block'"
+ },
"notify_enabled": {
"name": "notify_enabled",
"type": "boolean",
@@ -5508,6 +6629,20 @@
"notNull": true,
"default": true
},
+ "enforcement_version": {
+ "name": "enforcement_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "enforcement_delivered_version": {
+ "name": "enforcement_delivered_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
"created_by_user_id": {
"name": "created_by_user_id",
"type": "text",
@@ -5654,7 +6789,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "budget_policies_reservation_nonnegative": {
+ "name": "budget_policies_reservation_nonnegative",
+ "value": "\"budget_policies\".\"reservation_cents\" >= 0"
+ }
+ },
"isRLSEnabled": false
},
"public.built_in_managed_resources": {
@@ -10636,6 +11776,139 @@
},
"isRLSEnabled": false
},
+ "public.chat_slack_registrations": {
+ "name": "chat_slack_registrations",
+ "schema": "",
+ "columns": {
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "manifest": {
+ "name": "manifest",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "manifest_hash": {
+ "name": "manifest_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "callback_uri": {
+ "name": "callback_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "secret_ids": {
+ "name": "secret_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bot_user_id": {
+ "name": "bot_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "chat_slack_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk": {
+ "name": "chat_slack_registrations_company_id_endpoint_id_chat_endpoints_company_id_id_fk",
+ "tableFrom": "chat_slack_registrations",
+ "tableTo": "chat_endpoints",
+ "columnsFrom": [
+ "company_id",
+ "endpoint_id"
+ ],
+ "columnsTo": [
+ "company_id",
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "chat_slack_registration_status_check": {
+ "name": "chat_slack_registration_status_check",
+ "value": "\"chat_slack_registrations\".\"status\" in ('creating', 'uncertain', 'failed', 'install', 'credentials_saved', 'configured', 'removed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.chat_teams_file_transfers": {
"name": "chat_teams_file_transfers",
"schema": "",
@@ -11306,9 +12579,15 @@
"notNull": true,
"default": 0
},
+ "spend_month_utc": {
+ "name": "spend_month_utc",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"spent_monthly_cents": {
"name": "spent_monthly_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -16169,7 +17448,20 @@
"name": "agent_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "usage_kind": {
+ "name": "usage_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'agent'"
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
},
"issue_id": {
"name": "issue_id",
@@ -16201,6 +17493,36 @@
"primaryKey": false,
"notNull": false
},
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reported_cost_cents": {
+ "name": "reported_cost_cents",
+ "type": "numeric(24, 7)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pricing_provenance": {
+ "name": "pricing_provenance",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
"provider": {
"name": "provider",
"type": "text",
@@ -16257,7 +17579,7 @@
},
"cost_cents": {
"name": "cost_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -16276,6 +17598,109 @@
}
},
"indexes": {
+ "cost_events_company_receipt_idx": {
+ "name": "cost_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_provider_request_idx": {
+ "name": "cost_events_provider_request_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "biller",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_company_project_occurred_idx": {
+ "name": "cost_events_company_project_occurred_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "cost_events_unpriced_idx": {
+ "name": "cost_events_unpriced_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "occurred_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"cost_events\".\"cost_status\" = 'unpriced' and \"cost_events\".\"billing_type\" <> 'subscription_included'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"cost_events_company_occurred_idx": {
"name": "cost_events_company_occurred_idx",
"columns": [
@@ -16483,7 +17908,356 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "cost_events_usage_kind_check": {
+ "name": "cost_events_usage_kind_check",
+ "value": "\"cost_events\".\"usage_kind\" = 'decision' or (\"cost_events\".\"usage_kind\" = 'agent' and \"cost_events\".\"agent_id\" is not null)"
+ },
+ "cost_events_nonnegative_amounts": {
+ "name": "cost_events_nonnegative_amounts",
+ "value": "\"cost_events\".\"cost_cents\" >= 0 and \"cost_events\".\"input_tokens\" >= 0 and \"cost_events\".\"cached_input_tokens\" >= 0 and \"cost_events\".\"output_tokens\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.company_decision_models": {
+ "name": "company_decision_models",
+ "schema": "",
+ "columns": {
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "allow_background": {
+ "name": "allow_background",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "company_decision_models_company_id_companies_id_fk": {
+ "name": "company_decision_models_company_id_companies_id_fk",
+ "tableFrom": "company_decision_models",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "company_decisions_configured": {
+ "name": "company_decisions_configured",
+ "value": "(\"company_decision_models\".\"connection_id\" is null) = (\"company_decision_models\".\"grant_id\" is null) and (not \"company_decision_models\".\"enabled\" or (\"company_decision_models\".\"connection_id\" is not null and \"company_decision_models\".\"provider\" is not null and \"company_decision_models\".\"model\" is not null))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.decision_invocations": {
+ "name": "decision_invocations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feature": {
+ "name": "feature",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_type": {
+ "name": "actor_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "responsible_user_id": {
+ "name": "responsible_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "identity_context_id": {
+ "name": "identity_context_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "question_types": {
+ "name": "question_types",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_request_id": {
+ "name": "provider_request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_event_id": {
+ "name": "cost_event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_ms": {
+ "name": "duration_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "decision_invocations_company_started_idx": {
+ "name": "decision_invocations_company_started_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_pending_idx": {
+ "name": "decision_invocations_pending_idx",
+ "columns": [
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"decision_invocations\".\"status\" = 'running'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "decision_invocations_cost_idx": {
+ "name": "decision_invocations_cost_idx",
+ "columns": [
+ {
+ "expression": "cost_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "decision_invocations_company_id_companies_id_fk": {
+ "name": "decision_invocations_company_id_companies_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "decision_invocations_cost_event_id_cost_events_id_fk": {
+ "name": "decision_invocations_cost_event_id_cost_events_id_fk",
+ "tableFrom": "decision_invocations",
+ "tableTo": "cost_events",
+ "columnsFrom": [
+ "cost_event_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "decision_invocations_status_check": {
+ "name": "decision_invocations_status_check",
+ "value": "\"decision_invocations\".\"status\" in ('running', 'succeeded', 'failed', 'unknown')"
+ }
+ },
"isRLSEnabled": false
},
"public.decision_archive_notification_outbox": {
@@ -20361,6 +22135,746 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.dot_agent_bindings": {
+ "name": "dot_agent_bindings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "operator_id": {
+ "name": "operator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "generation": {
+ "name": "generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pairing'"
+ },
+ "pairing_code_hash": {
+ "name": "pairing_code_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pairing_expires_at": {
+ "name": "pairing_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dot_url": {
+ "name": "dot_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "challenge_hash": {
+ "name": "challenge_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "challenge_expires_at": {
+ "name": "challenge_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ready_at": {
+ "name": "ready_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_bindings_active_agent_uq": {
+ "name": "dot_bindings_active_agent_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_agent_bindings\".\"revoked_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_bindings_active_grant_uq": {
+ "name": "dot_bindings_active_grant_uq",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_agent_bindings\".\"revoked_at\" IS NULL AND \"dot_agent_bindings\".\"grant_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_bindings_pairing_code_uq": {
+ "name": "dot_bindings_pairing_code_uq",
+ "columns": [
+ {
+ "expression": "pairing_code_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_agent_bindings_company_id_companies_id_fk": {
+ "name": "dot_agent_bindings_company_id_companies_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_agent_bindings_agent_id_agents_id_fk": {
+ "name": "dot_agent_bindings_agent_id_agents_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "dot_agent_bindings_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "dot_agent_bindings",
+ "tableTo": "mcp_oauth_grants",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_mailbox_items": {
+ "name": "dot_mailbox_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_generation": {
+ "name": "binding_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assignment_id": {
+ "name": "assignment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_event_id": {
+ "name": "source_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "references": {
+ "name": "references",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_mailbox_event_uq": {
+ "name": "dot_mailbox_event_uq",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "binding_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_event_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_mailbox_binding_cursor_idx": {
+ "name": "dot_mailbox_binding_cursor_idx",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "binding_generation",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_mailbox_items_company_id_companies_id_fk": {
+ "name": "dot_mailbox_items_company_id_companies_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_mailbox_items_binding_id_dot_agent_bindings_id_fk": {
+ "name": "dot_mailbox_items_binding_id_dot_agent_bindings_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "dot_agent_bindings",
+ "columnsFrom": [
+ "binding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk": {
+ "name": "dot_mailbox_items_assignment_id_dot_runner_assignments_id_fk",
+ "tableFrom": "dot_mailbox_items",
+ "tableTo": "dot_runner_assignments",
+ "columnsFrom": [
+ "assignment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_runner_assignments": {
+ "name": "dot_runner_assignments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "binding_generation": {
+ "name": "binding_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_session_id": {
+ "name": "normalized_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "turn_id": {
+ "name": "turn_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "controller_generation": {
+ "name": "controller_generation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "catalog_digest": {
+ "name": "catalog_digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "projection": {
+ "name": "projection",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accept_by": {
+ "name": "accept_by",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "settled_at": {
+ "name": "settled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_activity_at": {
+ "name": "last_activity_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_assignments_turn_uq": {
+ "name": "dot_assignments_turn_uq",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "turn_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_assignments_active_binding_uq": {
+ "name": "dot_assignments_active_binding_uq",
+ "columns": [
+ {
+ "expression": "binding_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"dot_runner_assignments\".\"status\" IN ('offered', 'accepted')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "dot_assignments_company_idx": {
+ "name": "dot_assignments_company_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_runner_assignments_company_id_companies_id_fk": {
+ "name": "dot_runner_assignments_company_id_companies_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_binding_id_dot_agent_bindings_id_fk": {
+ "name": "dot_runner_assignments_binding_id_dot_agent_bindings_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "dot_agent_bindings",
+ "columnsFrom": [
+ "binding_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_run_id_heartbeat_runs_id_fk": {
+ "name": "dot_runner_assignments_run_id_heartbeat_runs_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "heartbeat_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_assignments_agent_id_agents_id_fk": {
+ "name": "dot_runner_assignments_agent_id_agents_id_fk",
+ "tableFrom": "dot_runner_assignments",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dot_runner_operations": {
+ "name": "dot_runner_operations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assignment_id": {
+ "name": "assignment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "digest": {
+ "name": "digest",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "command": {
+ "name": "command",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'reserved'"
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_event_id": {
+ "name": "source_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "dot_operations_request_uq": {
+ "name": "dot_operations_request_uq",
+ "columns": [
+ {
+ "expression": "assignment_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dot_runner_operations_company_id_companies_id_fk": {
+ "name": "dot_runner_operations_company_id_companies_id_fk",
+ "tableFrom": "dot_runner_operations",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dot_runner_operations_assignment_id_dot_runner_assignments_id_fk": {
+ "name": "dot_runner_operations_assignment_id_dot_runner_assignments_id_fk",
+ "tableFrom": "dot_runner_operations",
+ "tableTo": "dot_runner_assignments",
+ "columnsFrom": [
+ "assignment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.email_endpoints": {
"name": "email_endpoints",
"schema": "",
@@ -23721,6 +26235,18 @@
"primaryKey": false,
"notNull": false
},
+ "idempotency_key": {
+ "name": "idempotency_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "receipt_hash": {
+ "name": "receipt_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"billing_code": {
"name": "billing_code",
"type": "text",
@@ -23796,7 +26322,7 @@
},
"amount_cents": {
"name": "amount_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true
},
@@ -23841,6 +26367,27 @@
}
},
"indexes": {
+ "finance_events_company_receipt_idx": {
+ "name": "finance_events_company_receipt_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "idempotency_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"finance_events_company_occurred_idx": {
"name": "finance_events_company_occurred_idx",
"columns": [
@@ -24987,6 +27534,19 @@
"primaryKey": false,
"notNull": true
},
+ "scope_kind": {
+ "name": "scope_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'company'"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"invocation_source": {
"name": "invocation_source",
"type": "text",
@@ -25067,6 +27627,44 @@
"primaryKey": false,
"notNull": false
},
+ "cost_accounting_pending": {
+ "name": "cost_accounting_pending",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "cost_accounted_at": {
+ "name": "cost_accounted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_projection_version": {
+ "name": "accounting_projection_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_attempt_at": {
+ "name": "accounting_last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_last_error": {
+ "name": "accounting_last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accounting_attempt_count": {
+ "name": "accounting_attempt_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
"usage_json": {
"name": "usage_json",
"type": "jsonb",
@@ -25403,6 +28001,28 @@
}
},
"indexes": {
+ "heartbeat_runs_cost_accounting_pending_idx": {
+ "name": "heartbeat_runs_cost_accounting_pending_idx",
+ "columns": [
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"heartbeat_runs\".\"cost_accounting_pending\" = true",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"heartbeat_runs_execution_status_delivery_idx": {
"name": "heartbeat_runs_execution_status_delivery_idx",
"columns": [
@@ -25484,6 +28104,33 @@
"method": "btree",
"with": {}
},
+ "heartbeat_runs_company_issue_created_idx": {
+ "name": "heartbeat_runs_company_issue_created_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"heartbeat_runs_company_responsible_user_idx": {
"name": "heartbeat_runs_company_responsible_user_idx",
"columns": [
@@ -25722,6 +28369,19 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "heartbeat_runs_issue_id_issues_id_fk": {
+ "name": "heartbeat_runs_issue_id_issues_id_fk",
+ "tableFrom": "heartbeat_runs",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk": {
"name": "heartbeat_runs_wakeup_request_id_agent_wakeup_requests_id_fk",
"tableFrom": "heartbeat_runs",
@@ -25772,7 +28432,12 @@
}
},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "heartbeat_runs_scope_binding_check": {
+ "name": "heartbeat_runs_scope_binding_check",
+ "value": "(\"heartbeat_runs\".\"scope_kind\" = 'company' AND \"heartbeat_runs\".\"issue_id\" IS NULL)\n OR \"heartbeat_runs\".\"scope_kind\" = 'issue'"
+ }
+ },
"isRLSEnabled": false
},
"public.inbox_dismissals": {
@@ -27215,6 +29880,166 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.issue_access_grants": {
+ "name": "issue_access_grants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "granted_by_user_id": {
+ "name": "granted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "granted_by_agent_id": {
+ "name": "granted_by_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_access_grants_subject_active_issue_idx": {
+ "name": "issue_access_grants_subject_active_issue_idx",
+ "columns": [
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revoked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_access_grants_issue_idx": {
+ "name": "issue_access_grants_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_access_grants_issue_id_issues_id_fk": {
+ "name": "issue_access_grants_issue_id_issues_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_access_grants_granted_by_agent_id_agents_id_fk": {
+ "name": "issue_access_grants_granted_by_agent_id_agents_id_fk",
+ "tableFrom": "issue_access_grants",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "granted_by_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_access_grants_subject_type_check": {
+ "name": "issue_access_grants_subject_type_check",
+ "value": "\"issue_access_grants\".\"subject_type\" in ('user', 'agent')"
+ },
+ "issue_access_grants_source_check": {
+ "name": "issue_access_grants_source_check",
+ "value": "\"issue_access_grants\".\"source\" in ('explicit', 'assignment', 'project')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.issue_approvals": {
"name": "issue_approvals",
"schema": "",
@@ -32087,6 +34912,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_root_issue_id": {
+ "name": "privacy_root_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "privacy_parent_issue_id": {
+ "name": "privacy_parent_issue_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"title": {
"name": "title",
"type": "text",
@@ -32571,6 +35415,48 @@
"method": "btree",
"with": {}
},
+ "issues_company_privacy_parent_idx": {
+ "name": "issues_company_privacy_parent_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_parent_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issues_company_privacy_root_idx": {
+ "name": "issues_company_privacy_root_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "privacy_root_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"issues_company_project_idx": {
"name": "issues_company_project_idx",
"columns": [
@@ -33140,6 +36026,32 @@
"onDelete": "no action",
"onUpdate": "no action"
},
+ "issues_privacy_root_issue_id_issues_id_fk": {
+ "name": "issues_privacy_root_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_root_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issues_privacy_parent_issue_id_issues_id_fk": {
+ "name": "issues_privacy_parent_issue_id_issues_id_fk",
+ "tableFrom": "issues",
+ "tableTo": "issues",
+ "columnsFrom": [
+ "privacy_parent_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
"issues_assignee_agent_id_agents_id_fk": {
"name": "issues_assignee_agent_id_agents_id_fk",
"tableFrom": "issues",
@@ -33219,6 +36131,10 @@
},
"policies": {},
"checkConstraints": {
+ "issues_visibility_check": {
+ "name": "issues_visibility_check",
+ "value": "\"issues\".\"visibility\" in ('open', 'private')"
+ },
"issues_conversation_identity_check": {
"name": "issues_conversation_identity_check",
"value": "(\n \"issues\".\"conversation_agent_id\" is null and \"issues\".\"conversation_user_id\" is null and \"issues\".\"conversation_state\" is null\n ) or (\n \"issues\".\"conversation_agent_id\" is not null and \"issues\".\"conversation_user_id\" is not null\n and \"issues\".\"assignee_agent_id\" = \"issues\".\"conversation_agent_id\" and \"issues\".\"assignee_agent_id\" is not null\n and \"issues\".\"assignee_user_id\" is null and \"issues\".\"conversation_state\" is not null\n and \"issues\".\"conversation_state\" in ('active', 'waiting')\n and \"issues\".\"status\" not in ('done', 'cancelled')\n )"
@@ -38508,6 +41424,150 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.project_access_members": {
+ "name": "project_access_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_access_members_project_subject_uq": {
+ "name": "project_access_members_project_subject_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_access_members_subject_lookup_idx": {
+ "name": "project_access_members_subject_lookup_idx",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "subject_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_access_members_company_id_companies_id_fk": {
+ "name": "project_access_members_company_id_companies_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_access_members_project_id_projects_id_fk": {
+ "name": "project_access_members_project_id_projects_id_fk",
+ "tableFrom": "project_access_members",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_access_members_subject_type_check": {
+ "name": "project_access_members_subject_type_check",
+ "value": "\"project_access_members\".\"subject_type\" in ('user', 'agent')"
+ }
+ },
+ "isRLSEnabled": false
+ },
"public.project_goals": {
"name": "project_goals",
"schema": "",
@@ -39137,6 +42197,25 @@
"primaryKey": false,
"notNull": false
},
+ "visibility": {
+ "name": "visibility",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "privacy_owner_user_id": {
+ "name": "privacy_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_owner_user_id": {
+ "name": "personal_owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
"status": {
"name": "status",
"type": "text",
@@ -39228,6 +42307,28 @@
"concurrently": false,
"method": "btree",
"with": {}
+ },
+ "projects_company_personal_owner_uq": {
+ "name": "projects_company_personal_owner_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "personal_owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"projects\".\"personal_owner_user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
}
},
"foreignKeys": {
@@ -39274,7 +42375,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "projects_visibility_check": {
+ "name": "projects_visibility_check",
+ "value": "\"projects\".\"visibility\" in ('open', 'private')"
+ }
+ },
"isRLSEnabled": false
},
"public.provider_trace_records": {
@@ -42390,7 +45496,7 @@
},
"cost_cents": {
"name": "cost_cents",
- "type": "integer",
+ "type": "numeric(24, 7)",
"primaryKey": false,
"notNull": true,
"default": 0
@@ -49809,6 +52915,129 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.user_company_preferences": {
+ "name": "user_company_preferences",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "primary_agent_id": {
+ "name": "primary_agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "primary_agent_initialized": {
+ "name": "primary_agent_initialized",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_company_preferences_company_user_uq": {
+ "name": "user_company_preferences_company_user_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_company_preferences_primary_agent_idx": {
+ "name": "user_company_preferences_primary_agent_idx",
+ "columns": [
+ {
+ "expression": "primary_agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_company_preferences_company_id_companies_id_fk": {
+ "name": "user_company_preferences_company_id_companies_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_company_preferences_primary_agent_id_agents_id_fk": {
+ "name": "user_company_preferences_primary_agent_id_agents_id_fk",
+ "tableFrom": "user_company_preferences",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "primary_agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.user_inbox_agent_policies": {
"name": "user_inbox_agent_policies",
"schema": "",
@@ -51493,6 +54722,187 @@
"checkConstraints": {},
"isRLSEnabled": false
},
+ "public.mcp_attachment_uploads": {
+ "name": "mcp_attachment_uploads",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "arguments_hash": {
+ "name": "arguments_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_filename": {
+ "name": "original_filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "byte_size": {
+ "name": "byte_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sha256": {
+ "name": "sha256",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_provider": {
+ "name": "storage_provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cleaned_at": {
+ "name": "cleaned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_attachment_upload_request_uq": {
+ "name": "mcp_attachment_upload_request_uq",
+ "columns": [
+ {
+ "expression": "company_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "request_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_attachment_upload_expiry_idx": {
+ "name": "mcp_attachment_upload_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_attachment_uploads_company_id_companies_id_fk": {
+ "name": "mcp_attachment_uploads_company_id_companies_id_fk",
+ "tableFrom": "mcp_attachment_uploads",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_attachment_uploads_user_id_user_id_fk": {
+ "name": "mcp_attachment_uploads_user_id_user_id_fk",
+ "tableFrom": "mcp_attachment_uploads",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
"public.mcp_event_admissions": {
"name": "mcp_event_admissions",
"schema": "",
@@ -51650,7 +55060,13 @@
"name": "activity_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "mailbox_item_id": {
+ "name": "mailbox_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
},
"event": {
"name": "event",
@@ -51686,6 +55102,27 @@
}
},
"indexes": {
+ "mcp_event_deliveries_mailbox_uq": {
+ "name": "mcp_event_deliveries_mailbox_uq",
+ "columns": [
+ {
+ "expression": "subscription_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "mailbox_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
"mcp_event_deliveries_activity_uq": {
"name": "mcp_event_deliveries_activity_uq",
"columns": [
@@ -51741,7 +55178,12 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
- "checkConstraints": {},
+ "checkConstraints": {
+ "mcp_delivery_source_check": {
+ "name": "mcp_delivery_source_check",
+ "value": "(\"mcp_event_deliveries\".\"activity_id\" IS NOT NULL AND \"mcp_event_deliveries\".\"mailbox_item_id\" IS NULL) OR (\"mcp_event_deliveries\".\"activity_id\" IS NULL AND \"mcp_event_deliveries\".\"mailbox_item_id\" IS NOT NULL)"
+ }
+ },
"isRLSEnabled": false
},
"public.mcp_event_subscriptions": {
@@ -51776,7 +55218,13 @@
"name": "task_id",
"type": "uuid",
"primaryKey": false,
- "notNull": true
+ "notNull": false
+ },
+ "binding_id": {
+ "name": "binding_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
},
"arguments": {
"name": "arguments",
@@ -51886,6 +55334,138 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
+ "checkConstraints": {
+ "mcp_subscription_resource_check": {
+ "name": "mcp_subscription_resource_check",
+ "value": "(\"mcp_event_subscriptions\".\"task_id\" IS NOT NULL AND \"mcp_event_subscriptions\".\"binding_id\" IS NULL) OR (\"mcp_event_subscriptions\".\"task_id\" IS NULL AND \"mcp_event_subscriptions\".\"binding_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.mcp_file_tickets": {
+ "name": "mcp_file_tickets",
+ "schema": "",
+ "columns": {
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "grant_id": {
+ "name": "grant_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "upload_id": {
+ "name": "upload_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "mcp_file_ticket_expiry_idx": {
+ "name": "mcp_file_ticket_expiry_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_file_ticket_grant_idx": {
+ "name": "mcp_file_ticket_grant_idx",
+ "columns": [
+ {
+ "expression": "grant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "mcp_file_tickets_company_id_companies_id_fk": {
+ "name": "mcp_file_tickets_company_id_companies_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "tableTo": "companies",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_file_tickets_grant_id_mcp_oauth_grants_id_fk": {
+ "name": "mcp_file_tickets_grant_id_mcp_oauth_grants_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "tableTo": "mcp_oauth_grants",
+ "columnsFrom": [
+ "grant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "mcp_file_tickets_upload_id_mcp_attachment_uploads_id_fk": {
+ "name": "mcp_file_tickets_upload_id_mcp_attachment_uploads_id_fk",
+ "tableFrom": "mcp_file_tickets",
+ "tableTo": "mcp_attachment_uploads",
+ "columnsFrom": [
+ "upload_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
@@ -52315,6 +55895,19 @@
"primaryKey": false,
"notNull": true
},
+ "purpose": {
+ "name": "purpose",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'personal'"
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
"scopes": {
"name": "scopes",
"type": "jsonb",
@@ -52397,6 +55990,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
+ },
+ "mcp_oauth_grants_agent_id_agents_id_fk": {
+ "name": "mcp_oauth_grants_agent_id_agents_id_fk",
+ "tableFrom": "mcp_oauth_grants",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
diff --git a/packages/db/src/migrations/meta/_journal.json b/packages/db/src/migrations/meta/_journal.json
index 563829013fc..9d56189c1b9 100644
--- a/packages/db/src/migrations/meta/_journal.json
+++ b/packages/db/src/migrations/meta/_journal.json
@@ -2185,6 +2185,41 @@
"when": 1791371746435,
"tag": "0313_private_task_access",
"breakpoints": true
+ },
+ {
+ "idx": 314,
+ "version": "7",
+ "when": 1791371819805,
+ "tag": "0314_private_task_draft_assets",
+ "breakpoints": true
+ },
+ {
+ "idx": 315,
+ "version": "7",
+ "when": 1791390905429,
+ "tag": "0315_rapid_emma_frost",
+ "breakpoints": true
+ },
+ {
+ "idx": 316,
+ "version": "7",
+ "when": 1791400295370,
+ "tag": "0316_premium_slayback",
+ "breakpoints": true
+ },
+ {
+ "idx": 317,
+ "version": "7",
+ "when": 1791416259455,
+ "tag": "0317_messy_famine",
+ "breakpoints": true
+ },
+ {
+ "idx": 318,
+ "version": "7",
+ "when": 1791456875836,
+ "tag": "0318_strong_blacklash",
+ "breakpoints": true
}
]
-}
+}
\ No newline at end of file
diff --git a/packages/db/src/private-task-draft-assets-migration.test.ts b/packages/db/src/private-task-draft-assets-migration.test.ts
new file mode 100644
index 00000000000..54007d4c788
--- /dev/null
+++ b/packages/db/src/private-task-draft-assets-migration.test.ts
@@ -0,0 +1,35 @@
+import { createHash, randomUUID } from "node:crypto";
+import fs from "node:fs/promises";
+import postgres from "postgres";
+import { expect, it } from "vitest";
+import { applyPendingMigrations } from "./client.js";
+import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./test-embedded-postgres.js";
+
+const embeddedPostgresSupport = await getEmbeddedPostgresTestSupport();
+const itEmbeddedPostgres = embeddedPostgresSupport.supported ? it : it.skip;
+
+itEmbeddedPostgres("backfills owned draft images without attaching another uploader's images", async () => {
+ const database = await startEmbeddedPostgresTestDatabase("paperclip-draft-privacy-");
+ const sql = postgres(database.connectionString, { max: 1, onnotice: () => {} });
+ try {
+ const migration = await fs.readFile(new URL("./migrations/0314_private_task_draft_assets.sql", import.meta.url), "utf8");
+ const hash = createHash("sha256").update(migration).digest("hex");
+ const company = randomUUID(), task = randomUUID(), owned = randomUUID(), foreign = randomUUID();
+ await sql`INSERT INTO companies (id, name, issue_prefix) VALUES (${company}, 'Draft privacy', 'DRAFT')`;
+ for (const [id, owner] of [[owned, 'owner'], [foreign, 'someone-else']]) {
+ await sql`INSERT INTO assets (id, company_id, provider, object_key, content_type, byte_size, sha256, created_by_user_id)
+ VALUES (${id}, ${company}, 'local_disk', ${`${company}/assets/issues/drafts/${id}`}, 'image/png', 1, 'test', ${owner})`;
+ }
+ await sql`INSERT INTO issues (id, company_id, title, description, visibility, created_by_user_id)
+ VALUES (${task}, ${company}, 'Private task', ${` `}, 'private', 'owner')`;
+ for (let run = 0; run < 2; run += 1) {
+ await sql`DELETE FROM drizzle.__drizzle_migrations WHERE hash = ${hash}`;
+ await applyPendingMigrations(database.connectionString);
+ expect(await sql`SELECT issue_id, asset_id FROM issue_attachments WHERE company_id = ${company}`)
+ .toEqual([{ issue_id: task, asset_id: owned }]);
+ }
+ } finally {
+ await sql.end();
+ await database.cleanup();
+ }
+}, 60_000);
diff --git a/packages/db/src/schema/accounting.ts b/packages/db/src/schema/accounting.ts
index 94869a84818..4bbce6d05ea 100644
--- a/packages/db/src/schema/accounting.ts
+++ b/packages/db/src/schema/accounting.ts
@@ -52,8 +52,9 @@ export const accountingRuntimeBaselines = pgTable("accounting_runtime_baselines"
export const budgetReservations = pgTable("budget_reservations", {
id: uuid("id").primaryKey().defaultRandom(),
companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
- runId: uuid("run_id").notNull().references(() => heartbeatRuns.id, { onDelete: "cascade" }),
- agentId: uuid("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
+ runId: uuid("run_id").references(() => heartbeatRuns.id, { onDelete: "cascade" }),
+ decisionInvocationId: uuid("decision_invocation_id"),
+ agentId: uuid("agent_id").references(() => agents.id, { onDelete: "cascade" }),
projectId: uuid("project_id"),
amountCents: numeric("amount_cents", { precision: 24, scale: 7 }).notNull(),
state: text("state").notNull().default("held"),
@@ -61,6 +62,8 @@ export const budgetReservations = pgTable("budget_reservations", {
settledAt: timestamp("settled_at", { withTimezone: true }),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
}, table => ({
+ decision: uniqueIndex("budget_reservations_decision_idx").on(table.companyId, table.decisionInvocationId),
+ source: check("budget_reservations_source_check", sql`(${table.runId} is not null)::int + (${table.decisionInvocationId} is not null)::int = 1`),
run: uniqueIndex("budget_reservations_run_idx").on(table.companyId, table.runId),
active: index("budget_reservations_active_idx").on(table.companyId, table.agentId, table.projectId).where(sql`${table.state} = 'held'`),
stateCheck: check("budget_reservations_state_check", sql`${table.state} in ('held', 'settled', 'released')`),
diff --git a/packages/db/src/schema/chat_slack_registrations.ts b/packages/db/src/schema/chat_slack_registrations.ts
new file mode 100644
index 00000000000..0edad4a8917
--- /dev/null
+++ b/packages/db/src/schema/chat_slack_registrations.ts
@@ -0,0 +1,27 @@
+import { sql } from "drizzle-orm";
+import { check, foreignKey, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
+import type { SlackRegistrationStatus } from "@paperclipai/shared";
+import { chatEndpoints } from "./chat_channels.js";
+
+/** App provisioning is distinct from installation and runtime credentials. No plaintext secrets. */
+export const chatSlackRegistrations = pgTable("chat_slack_registrations", {
+ endpointId: uuid("endpoint_id").primaryKey(),
+ companyId: uuid("company_id").notNull(),
+ requestId: uuid("request_id").notNull(),
+ status: text("status").$type().notNull(),
+ manifest: jsonb("manifest").$type>().notNull(),
+ manifestHash: text("manifest_hash").notNull(),
+ callbackUri: text("callback_uri").notNull(),
+ appId: text("app_id"),
+ clientId: text("client_id"),
+ secretIds: jsonb("secret_ids").$type>().notNull().default({}),
+ workspaceId: text("workspace_id"),
+ botUserId: text("bot_user_id"),
+ errorCode: text("error_code"),
+ createdByUserId: text("created_by_user_id").notNull(),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => [
+ foreignKey({ columns: [t.companyId, t.endpointId], foreignColumns: [chatEndpoints.companyId, chatEndpoints.id] }).onDelete("cascade"),
+ check("chat_slack_registration_status_check", sql`${t.status} in ('creating', 'uncertain', 'failed', 'install', 'credentials_saved', 'configured', 'removed')`),
+]);
diff --git a/packages/db/src/schema/cost_events.ts b/packages/db/src/schema/cost_events.ts
index 1abe90c7b87..3af114d517f 100644
--- a/packages/db/src/schema/cost_events.ts
+++ b/packages/db/src/schema/cost_events.ts
@@ -12,7 +12,9 @@ export const costEvents = pgTable(
{
id: uuid("id").primaryKey().defaultRandom(),
companyId: uuid("company_id").notNull().references(() => companies.id),
- agentId: uuid("agent_id").notNull().references(() => agents.id),
+ agentId: uuid("agent_id").references(() => agents.id),
+ usageKind: text("usage_kind").notNull().default("agent"),
+ responsibleUserId: text("responsible_user_id"),
issueId: uuid("issue_id").references(() => issues.id, { onDelete: "set null" }),
projectId: uuid("project_id").references(() => projects.id),
goalId: uuid("goal_id").references(() => goals.id),
@@ -36,6 +38,7 @@ export const costEvents = pgTable(
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
},
(table) => ({
+ usageKindCheck: check("cost_events_usage_kind_check", sql`${table.usageKind} = 'decision' or (${table.usageKind} = 'agent' and ${table.agentId} is not null)`),
receiptUniqueIdx: uniqueIndex("cost_events_company_receipt_idx").on(table.companyId, table.idempotencyKey),
providerRequestIdx: index("cost_events_provider_request_idx").on(table.companyId, table.biller, table.providerRequestId),
nonnegativeAmounts: check("cost_events_nonnegative_amounts", sql`${table.costCents} >= 0 and ${table.inputTokens} >= 0 and ${table.cachedInputTokens} >= 0 and ${table.outputTokens} >= 0`),
diff --git a/packages/db/src/schema/decision_models.ts b/packages/db/src/schema/decision_models.ts
new file mode 100644
index 00000000000..98c0e8c2120
--- /dev/null
+++ b/packages/db/src/schema/decision_models.ts
@@ -0,0 +1,51 @@
+import { sql } from "drizzle-orm";
+import { boolean, check, index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
+import { companies } from "./companies.js";
+import { costEvents } from "./cost_events.js";
+
+export const companyDecisionModels = pgTable("company_decision_models", {
+ companyId: uuid("company_id").primaryKey().references(() => companies.id, { onDelete: "cascade" }),
+ // Retain company preferences when a connection/grant is deleted. Resolution
+ // fails closed for stale IDs; choosing a replacement preserves sponsorship.
+ connectionId: uuid("connection_id"),
+ grantId: uuid("grant_id"),
+ enabled: boolean("enabled").notNull().default(false),
+ allowBackground: boolean("allow_background").notNull().default(true),
+ provider: text("provider"),
+ model: text("model"),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => ({ configured: check("company_decisions_configured", sql`(${t.connectionId} is null) = (${t.grantId} is null) and (not ${t.enabled} or (${t.connectionId} is not null and ${t.provider} is not null and ${t.model} is not null))`) }));
+
+/** Attribution references are archival: history survives deleted runs and connections. No input or answer content. */
+export const decisionInvocations = pgTable("decision_invocations", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ feature: text("feature").notNull(),
+ actorType: text("actor_type").notNull(),
+ actorId: text("actor_id").notNull(),
+ responsibleUserId: text("responsible_user_id"),
+ agentId: uuid("agent_id"),
+ issueId: uuid("issue_id"),
+ projectId: uuid("project_id"),
+ runId: uuid("run_id"),
+ identityContextId: uuid("identity_context_id"),
+ connectionId: uuid("connection_id").notNull(),
+ grantId: uuid("grant_id").notNull(),
+ provider: text("provider").notNull(),
+ model: text("model").notNull(),
+ questionTypes: jsonb("question_types").$type().notNull(),
+ status: text("status").notNull().default("running"),
+ errorCode: text("error_code"),
+ providerRequestId: text("provider_request_id"),
+ costEventId: uuid("cost_event_id").references(() => costEvents.id),
+ startedAt: timestamp("started_at", { withTimezone: true }).notNull().defaultNow(),
+ finishedAt: timestamp("finished_at", { withTimezone: true }),
+ durationMs: integer("duration_ms"),
+ inputTokens: integer("input_tokens"),
+ outputTokens: integer("output_tokens"),
+}, t => ({
+ history: index("decision_invocations_company_started_idx").on(t.companyId, t.startedAt, t.id),
+ pending: index("decision_invocations_pending_idx").on(t.startedAt).where(sql`${t.status} = 'running'`),
+ cost: index("decision_invocations_cost_idx").on(t.costEventId),
+ statusCheck: check("decision_invocations_status_check", sql`${t.status} in ('running', 'succeeded', 'failed', 'unknown')`),
+}));
diff --git a/packages/db/src/schema/dot_runner.ts b/packages/db/src/schema/dot_runner.ts
new file mode 100644
index 00000000000..7817c4638c9
--- /dev/null
+++ b/packages/db/src/schema/dot_runner.ts
@@ -0,0 +1,85 @@
+import { sql } from "drizzle-orm";
+import { bigserial, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
+import { companies } from "./companies.js";
+import { agents } from "./agents.js";
+import { heartbeatRuns } from "./heartbeat_runs.js";
+import { mcpOauthGrants } from "./public_mcp.js";
+
+export const dotAgentBindings = pgTable("dot_agent_bindings", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ agentId: uuid("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
+ operatorId: text("operator_id").notNull(),
+ grantId: uuid("grant_id").references(() => mcpOauthGrants.id, { onDelete: "set null" }),
+ generation: integer("generation").notNull().default(1),
+ status: text("status").$type<"pairing" | "connected" | "ready" | "revoked">().notNull().default("pairing"),
+ pairingCodeHash: text("pairing_code_hash"),
+ pairingExpiresAt: timestamp("pairing_expires_at", { withTimezone: true }),
+ dotUrl: text("dot_url"),
+ challengeHash: text("challenge_hash"),
+ challengeExpiresAt: timestamp("challenge_expires_at", { withTimezone: true }),
+ readyAt: timestamp("ready_at", { withTimezone: true }),
+ revokedAt: timestamp("revoked_at", { withTimezone: true }),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => [
+ uniqueIndex("dot_bindings_active_agent_uq").on(t.companyId, t.agentId).where(sql`${t.revokedAt} IS NULL`),
+ uniqueIndex("dot_bindings_active_grant_uq").on(t.grantId).where(sql`${t.revokedAt} IS NULL AND ${t.grantId} IS NOT NULL`),
+ uniqueIndex("dot_bindings_pairing_code_uq").on(t.pairingCodeHash),
+]);
+
+export const dotRunnerAssignments = pgTable("dot_runner_assignments", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ bindingId: uuid("binding_id").notNull().references(() => dotAgentBindings.id, { onDelete: "cascade" }),
+ bindingGeneration: integer("binding_generation").notNull(),
+ runId: uuid("run_id").notNull().references(() => heartbeatRuns.id, { onDelete: "cascade" }),
+ agentId: uuid("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
+ normalizedSessionId: text("normalized_session_id").notNull(),
+ turnId: text("turn_id").notNull(),
+ revision: integer("revision").notNull().default(1),
+ controllerGeneration: integer("controller_generation").notNull(),
+ catalogDigest: text("catalog_digest").notNull(),
+ status: text("status").$type<"offered" | "accepted" | "settled" | "fenced">().notNull(),
+ projection: jsonb("projection").$type>().notNull(),
+ acceptBy: timestamp("accept_by", { withTimezone: true }).notNull(),
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
+ acceptedAt: timestamp("accepted_at", { withTimezone: true }),
+ settledAt: timestamp("settled_at", { withTimezone: true }),
+ lastActivityAt: timestamp("last_activity_at", { withTimezone: true }).notNull().defaultNow(),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => [
+ uniqueIndex("dot_assignments_turn_uq").on(t.runId, t.turnId),
+ uniqueIndex("dot_assignments_active_binding_uq").on(t.bindingId).where(sql`${t.status} IN ('offered', 'accepted')`),
+ index("dot_assignments_company_idx").on(t.companyId),
+]);
+
+export const dotRunnerOperations = pgTable("dot_runner_operations", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ assignmentId: uuid("assignment_id").notNull().references(() => dotRunnerAssignments.id, { onDelete: "cascade" }),
+ requestId: uuid("request_id").notNull(),
+ digest: text("digest").notNull(),
+ command: jsonb("command").$type>().notNull(),
+ status: text("status").$type<"reserved" | "admitted" | "completed" | "rejected" | "unknown">().notNull().default("reserved"),
+ outcome: jsonb("outcome").$type>(),
+ sourceEventId: text("source_event_id"),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => [uniqueIndex("dot_operations_request_uq").on(t.assignmentId, t.requestId)]);
+
+export const dotMailboxItems = pgTable("dot_mailbox_items", {
+ id: bigserial("id", { mode: "number" }).primaryKey(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ bindingId: uuid("binding_id").notNull().references(() => dotAgentBindings.id, { onDelete: "cascade" }),
+ bindingGeneration: integer("binding_generation").notNull(),
+ assignmentId: uuid("assignment_id").references(() => dotRunnerAssignments.id, { onDelete: "cascade" }),
+ kind: text("kind").$type<"assignment" | "operation_result" | "authority_revoked" | "readiness_challenge" | "follow_up">().notNull(),
+ sourceEventId: text("source_event_id").notNull(),
+ // References only. Task content and tool results stay in authorized projections.
+ references: jsonb("references").$type>().notNull(),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => [
+ uniqueIndex("dot_mailbox_event_uq").on(t.bindingId, t.bindingGeneration, t.sourceEventId),
+ index("dot_mailbox_binding_cursor_idx").on(t.bindingId, t.bindingGeneration, t.id),
+]);
diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts
index 466ea7321f1..a4532180746 100644
--- a/packages/db/src/schema/index.ts
+++ b/packages/db/src/schema/index.ts
@@ -1,3 +1,4 @@
+export { chatSlackRegistrations } from "./chat_slack_registrations.js";
export { companies } from "./companies.js";
export { companyLogos } from "./company_logos.js";
export { companyTransferRuns } from "./company_transfer_runs.js";
@@ -223,6 +224,7 @@ export { browserUseSettings, browserUseSessions, browserUseRuns, browserUseBrows
export * from "./company_skill_sources.js";
export * from "./public_mcp.js";
+export * from "./dot_runner.js";
export * from "./accounting.js";
@@ -233,3 +235,5 @@ export { agentCommentary } from "./agent_commentary.js";
export { agentIdentityKeys } from "./agent_identity_keys.js";
+export * from "./decision_models.js";
+export { userCompanyPreferences } from "./user_company_preferences.js";
diff --git a/packages/db/src/schema/public_mcp.ts b/packages/db/src/schema/public_mcp.ts
index c4bf623e1b5..0725d5e0ae1 100644
--- a/packages/db/src/schema/public_mcp.ts
+++ b/packages/db/src/schema/public_mcp.ts
@@ -1,6 +1,8 @@
-import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
+import { sql } from "drizzle-orm";
+import { boolean, check, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
import { authUsers } from "./auth.js";
import { companies } from "./companies.js";
+import { agents } from "./agents.js";
// OAuth client/request metadata is instance-level authentication infrastructure.
// Authority and mutation receipts are always scoped to a company and a user.
@@ -27,6 +29,8 @@ export const mcpOauthGrants = pgTable("mcp_oauth_grants", {
userId: text("user_id").notNull().references(() => authUsers.id, { onDelete: "cascade" }),
clientId: text("client_id").notNull().references(() => mcpOauthClients.id, { onDelete: "cascade" }),
resource: text("resource").notNull(),
+ purpose: text("purpose").$type<"personal" | "agent">().notNull().default("personal"),
+ agentId: uuid("agent_id").references(() => agents.id, { onDelete: "cascade" }),
scopes: jsonb("scopes").$type().notNull(),
revokedAt: timestamp("revoked_at", { withTimezone: true }),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
@@ -112,7 +116,8 @@ export const mcpEventSubscriptions = pgTable("mcp_event_subscriptions", {
companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
grantId: uuid("grant_id").notNull().references(() => mcpOauthGrants.id, { onDelete: "cascade" }),
name: text("name").notNull(),
- taskId: uuid("task_id").notNull(),
+ taskId: uuid("task_id"),
+ bindingId: uuid("binding_id"),
arguments: jsonb("arguments").$type>().notNull(),
// URL, signing keys and optional Cloud authority, encrypted with the instance secret provider.
deliveryMaterial: jsonb("delivery_material").$type>().notNull(),
@@ -121,7 +126,11 @@ export const mcpEventSubscriptions = pgTable("mcp_event_subscriptions", {
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
stoppedAt: timestamp("stopped_at", { withTimezone: true }),
scannedAt: timestamp("scanned_at", { withTimezone: true }).notNull().defaultNow(),
-}, (t) => [index("mcp_event_subscriptions_expiry_idx").on(t.expiresAt), index("mcp_event_subscriptions_company_idx").on(t.companyId)]);
+}, (t) => [
+ check("mcp_subscription_resource_check", sql`(${t.taskId} IS NOT NULL AND ${t.bindingId} IS NULL) OR (${t.taskId} IS NULL AND ${t.bindingId} IS NOT NULL)`),
+ index("mcp_event_subscriptions_expiry_idx").on(t.expiresAt),
+ index("mcp_event_subscriptions_company_idx").on(t.companyId),
+]);
// Short-lived admission leases bound remote verification across replicas. Finished
// attempts remain until expiry so failed callbacks cannot bypass rate limits.
@@ -143,7 +152,8 @@ export const mcpEventAdmissions = pgTable("mcp_event_admissions", {
export const mcpEventDeliveries = pgTable("mcp_event_deliveries", {
id: uuid("id").primaryKey().defaultRandom(),
subscriptionId: text("subscription_id").notNull().references(() => mcpEventSubscriptions.id, { onDelete: "cascade" }),
- activityId: uuid("activity_id").notNull(),
+ activityId: uuid("activity_id"),
+ mailboxItemId: integer("mailbox_item_id"),
event: jsonb("event").$type>().notNull(),
attempts: integer("attempts").notNull().default(0),
nextAttemptAt: timestamp("next_attempt_at", { withTimezone: true }).notNull().defaultNow(),
@@ -151,6 +161,8 @@ export const mcpEventDeliveries = pgTable("mcp_event_deliveries", {
// Category/status only; never a URL, secret or response body.
outcome: text("outcome"),
}, (t) => [
+ check("mcp_delivery_source_check", sql`(${t.activityId} IS NOT NULL AND ${t.mailboxItemId} IS NULL) OR (${t.activityId} IS NULL AND ${t.mailboxItemId} IS NOT NULL)`),
+ uniqueIndex("mcp_event_deliveries_mailbox_uq").on(t.subscriptionId, t.mailboxItemId),
uniqueIndex("mcp_event_deliveries_activity_uq").on(t.subscriptionId, t.activityId),
index("mcp_event_deliveries_due_idx").on(t.nextAttemptAt),
]);
diff --git a/packages/db/src/schema/user_company_preferences.ts b/packages/db/src/schema/user_company_preferences.ts
new file mode 100644
index 00000000000..40c6a679fdc
--- /dev/null
+++ b/packages/db/src/schema/user_company_preferences.ts
@@ -0,0 +1,16 @@
+import { boolean, index, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
+import { agents } from "./agents.js";
+import { companies } from "./companies.js";
+
+export const userCompanyPreferences = pgTable("user_company_preferences", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ userId: text("user_id").notNull(),
+ primaryAgentId: uuid("primary_agent_id").references(() => agents.id, { onDelete: "set null" }),
+ primaryAgentInitialized: boolean("primary_agent_initialized").notNull().default(false),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+}, table => ({
+ companyUserUq: uniqueIndex("user_company_preferences_company_user_uq").on(table.companyId, table.userId),
+ primaryAgentIdx: index("user_company_preferences_primary_agent_idx").on(table.primaryAgentId),
+}));
diff --git a/packages/google-sheets-mcp-server/package.json b/packages/google-sheets-mcp-server/package.json
index ff51871fe15..6f0e194e2ff 100644
--- a/packages/google-sheets-mcp-server/package.json
+++ b/packages/google-sheets-mcp-server/package.json
@@ -45,7 +45,7 @@
"test": "vitest run"
},
"dependencies": {
- "@modelcontextprotocol/sdk": "^1.30.0",
+ "@modelcontextprotocol/sdk": "^1.31.0",
"googleapis": "^182.0.0",
"zod": "^4.4.3"
},
diff --git a/packages/kv-demo-mcp-server/package.json b/packages/kv-demo-mcp-server/package.json
index 4748badd509..60dab9ae975 100644
--- a/packages/kv-demo-mcp-server/package.json
+++ b/packages/kv-demo-mcp-server/package.json
@@ -44,7 +44,7 @@
"test": "vitest run"
},
"dependencies": {
- "@modelcontextprotocol/sdk": "^1.30.0",
+ "@modelcontextprotocol/sdk": "^1.31.0",
"zod": "^4.4.3"
},
"devDependencies": {
diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json
index 5af1dc180d3..7e87abac9fe 100644
--- a/packages/mcp-server/package.json
+++ b/packages/mcp-server/package.json
@@ -43,7 +43,7 @@
"test": "vitest run"
},
"dependencies": {
- "@modelcontextprotocol/sdk": "^1.30.0",
+ "@modelcontextprotocol/sdk": "^1.31.0",
"@paperclipai/shared": "workspace:*",
"zod": "^4.4.3"
},
diff --git a/packages/paperclip-runner/README.md b/packages/paperclip-runner/README.md
index 8277d08ff1e..c51868dc05e 100644
--- a/packages/paperclip-runner/README.md
+++ b/packages/paperclip-runner/README.md
@@ -22,6 +22,13 @@ the provider conversation. Company, agent, task, workspace, model, instruction,
and skill compatibility still gate recovery. An MCP-only assignment change can
resume only when the selected harness explicitly supports refreshing tools.
+Compact continuation messages include the active completion revision and criterion
+IDs plus a reminder to obtain an accepted `paperclip_finish` or `paperclip_block`
+result for this turn. Reports from earlier turns do not finish the new turn.
+Provider final text alone remains insufficient; governed waits and strict native
+completion validation keep their existing behavior. This reminder changes the
+resumed model input, not the tool catalog or automatic retry policy.
+
When recovery needs a fresh conversation, the server supplies a deterministic
handoff through a lazy history loader at the fresh attempt boundary.
It includes the original request, recent messages, resolved interaction
@@ -142,6 +149,9 @@ build and include them in the server's vendored Runner output before npm packing
Assembly requires the provider pack's source revision to match `sourceRevision`
and its ACPX profiles and Cursor distribution to match the current source pins.
An independently rehashed older pack is rejected.
+Provider-pack builds replace the installed Copilot platform wrappers with relative
+launchers. These wrappers remain usable after the pack moves into an image. The
+build still rejects any wrapper that retains its temporary deployment path.
Ordinary remote Cursor startup uses the packaged Linux daemon and verifies every
image asset against that manifest. A mismatched image fails before the provider
starts; install the matching package and image together.
diff --git a/packages/paperclip-runner/acpx-profiles.json b/packages/paperclip-runner/acpx-profiles.json
index 94ba0d42884..990285f6e86 100644
--- a/packages/paperclip-runner/acpx-profiles.json
+++ b/packages/paperclip-runner/acpx-profiles.json
@@ -14,12 +14,12 @@
"requiresProviderPolicy": false
},
"pi": {
- "agentProfileVersion": 19,
+ "agentProfileVersion": 20,
"agentServerPackage": "pi-acp",
"agentServerVersion": "0.0.33",
"agentRuntimePackage": "@earendil-works/pi-coding-agent",
"agentRuntimeVersion": "1.0.0",
- "commandDigest": "sha256:b7647ebf97f802ca053ec3384c912bf0e8d18eba308d27397bb1d95a37220825",
+ "commandDigest": "sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e",
"requiresProviderPolicy": true
},
"cursor": {
diff --git a/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json b/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json
index 5bc60ec666f..f58accf57c2 100644
--- a/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json
+++ b/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json
@@ -1 +1 @@
-[{"annotations":{"exposure":"always","operationId":"get_task_context","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the active task and actor, including the exact approved Markdown revision when this issue has an accepted plan.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_task_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_task_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded comments on the active task.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"get_task_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_documents","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List revisioned documents on the active task.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_documents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current revision of one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"}},"required":["key"],"type":"object"},"name":"read_document","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_document_revisions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded revision history for one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":["key"],"type":"object"},"name":"list_document_revisions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"report_progress","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a durable progress comment to the active task.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Multiline progress update.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"report_progress","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"answer_status_question","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append the answer to a status-only wake without changing task disposition.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Concise status answer.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"answer_status_question","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"write_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create or update an active-task document with optimistic revision safety.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Current revision id, or null when creating.","maxLength":20000,"type":["string","null"]},"body":{"description":"Markdown document body.","maxLength":200000,"minLength":1,"type":"string"},"changeSummary":{"description":"Optional revision summary.","maxLength":20000,"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"title":{"description":"Document title.","maxLength":300,"minLength":1,"type":"string"}},"required":["idempotencyKey","key","title","body","baseRevisionId"],"type":"object"},"name":"write_document","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"request_human_input","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a durable human question or approval card on the current Paperclip task bound to this run; Paperclip renders it and authenticates the response. Use questions with continuationPolicy='wake_assignee' when an answer is needed, including otherwise tool-free chat turns. Supply a stable idempotencyKey and reuse it on retries. For one question at a time, ask only the next unanswered question and wait for its real answer. Never fabricate answers or treat ambiguous clarification as approval. For an ordinary confirmation or checkbox card, record a clear user chat answer with call_api POST /api/issues/{id}/interactions/{interactionId}/resolve-from-comment, using the source commentId and decision (accept/reject), plus explicit selectedOptionIds for checkbox acceptance. Existing resolver permissions still apply; governed tool, secret, and connection approvals are excluded. Question forms retain their dedicated answer workflow. Preserve existing review gates. Call this tool before claiming a question was asked; if creation fails, report the failure. Do not fabricate answer links or Markdown buttons, post duplicate cards, or use call_api to create the card. Use one complete payload.questionSet for text and choice questions. Paperclip generates compatibility questions; see the payload schema for formats.","inputSchema":{"additionalProperties":false,"allOf":[{"if":{"properties":{"interactionKind":{"const":"questions"}},"required":["interactionKind"]},"then":{"properties":{"payload":{"anyOf":[{"required":["questionSet"]},{"required":["questions"]}],"required":["version"]}},"required":["payload"]}}],"properties":{"continuationPolicy":{"enum":["none","wake_assignee","wake_assignee_on_accept"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"interactionKind":{"enum":["confirmation","checkbox","questions","suggest_tasks","item_verdicts"]},"payload":{"additionalProperties":true,"description":"Kind-specific interaction data. For questions, send version:1 and one complete questionSet containing every text and choice question. Paperclip generates compatibility questions. Each canonical question needs id, prompt, required, and answerMode: text, single_select, or multi_select. Text questions have no options or customAnswer. Choice questions need at least two meaningful options with id/label. Use customAnswer:{enabled:true} for an optional written answer to a choice question. Legacy questions remain supported; if both representations are supplied, they must describe the same complete form. Keep IDs stable across retries. For confirmation, payload may be {}.","properties":{"questionSet":{"additionalProperties":false,"properties":{"description":{"maxLength":100000,"type":"string"},"questions":{"items":{"additionalProperties":false,"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"not":{"required":["customAnswer"]},"properties":{"options":{"maxItems":0,"type":"array"}}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"not":{"required":["initialText"]},"properties":{"options":{"minItems":1,"type":"array"}},"required":["options"]}}],"properties":{"answerMode":{"enum":["single_select","multi_select","text"]},"customAnswer":{"additionalProperties":false,"properties":{"enabled":{"const":true},"label":{"maxLength":1000,"type":"string"},"placeholder":{"maxLength":1000,"type":"string"}},"required":["enabled"],"type":"object"},"header":{"maxLength":1000,"type":"string"},"helpText":{"maxLength":4000,"type":"string"},"id":{"maxLength":160,"minLength":1,"type":"string"},"initialText":{"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds.","maxLength":100000,"type":"string"},"options":{"items":{"additionalProperties":false,"properties":{"description":{"maxLength":4000,"type":"string"},"id":{"maxLength":160,"minLength":1,"type":"string"},"label":{"maxLength":1000,"minLength":1,"type":"string"},"recommended":{"type":"boolean"}},"required":["id","label"],"type":"object"},"maxItems":128,"type":"array"},"prompt":{"maxLength":4000,"minLength":1,"type":"string"},"required":{"type":"boolean"},"textValidation":{"additionalProperties":false,"properties":{"inputType":{"enum":["text","number","integer"]},"maxLength":{"maximum":100000,"minimum":0,"type":"integer"},"maximum":{"type":"number"},"minLength":{"maximum":100000,"minimum":0,"type":"integer"},"minimum":{"type":"number"},"pattern":{"maxLength":1000,"type":"string"}},"type":"object"}},"required":["id","prompt","required","answerMode"],"type":"object"},"maxItems":64,"minItems":1,"type":"array"},"schema":{"const":"paperclip.question_set.v1"},"submitLabel":{"maxLength":200,"type":"string"},"title":{"maxLength":1000,"type":"string"}},"required":["schema","questions"],"type":"object"},"questions":{"items":{"additionalProperties":true,"properties":{"id":{"maxLength":160,"minLength":1,"type":"string"},"options":{"items":{"additionalProperties":true,"properties":{"freeText":{"type":"boolean"},"id":{"maxLength":160,"minLength":1,"type":"string"},"label":{"maxLength":1000,"minLength":1,"type":"string"}},"required":["id","label"],"type":"object"},"maxItems":129,"minItems":1,"type":"array"},"prompt":{"maxLength":4000,"minLength":1,"type":"string"},"required":{"type":"boolean"},"selectionMode":{"enum":["single","multi"]}},"required":["id","prompt","selectionMode","options"],"type":"object"},"maxItems":64,"minItems":1,"type":"array"},"version":{"const":1}},"type":"object"},"prompt":{"description":"Question or decision prompt.","maxLength":10000,"minLength":1,"type":"string"},"targetRevisionId":{"description":"Optional bound document revision.","maxLength":20000,"type":["string","null"]},"title":{"description":"Interaction card title.","maxLength":300,"minLength":1,"type":"string"}},"required":["idempotencyKey","interactionKind","title","prompt","continuationPolicy"],"type":"object"},"name":"request_human_input","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"register_deliverable","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Register attachment metadata and its artifact work product without credentials or bytes in the tool result.","inputSchema":{"additionalProperties":false,"properties":{"byteSize":{"maximum":100000000,"minimum":0,"type":"integer"},"contentRef":{"description":"Opaque package-local content reference.","maxLength":2000,"minLength":1,"type":"string"},"contentType":{"description":"Media type.","maxLength":200,"minLength":1,"type":"string"},"filename":{"description":"Display filename.","maxLength":500,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"sha256":{"pattern":"^[a-fA-F0-9]{64}$","type":"string"},"title":{"description":"Work-product title.","maxLength":500,"minLength":1,"type":"string"}},"required":["idempotencyKey","filename","contentType","byteSize","sha256","contentRef","title"],"type":"object"},"name":"register_deliverable","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"finish_task","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Finish the active task with a durable summary.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"summary":{"description":"Completion summary.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","summary"],"type":"object"},"name":"finish_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"block_task","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Block the active task with a durable reason and optional first-class dependencies.","inputSchema":{"additionalProperties":false,"properties":{"blockedByTaskIds":{"description":"Internal task ids that block this task.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"reason":{"description":"Block reason.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","reason"],"type":"object"},"name":"block_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"request_review","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Move the active task to review with a durable summary.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"summary":{"description":"Review handoff summary.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","summary"],"type":"object"},"name":"request_review","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_agents","requiredClaims":["discovery:agents:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List redacted actor profiles.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_agents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_agent","requiredClaims":["discovery:agents:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one redacted actor profile.","inputSchema":{"additionalProperties":false,"properties":{"actorId":{"description":"Actor id.","maxLength":200,"minLength":1,"type":"string"}},"required":["actorId"],"type":"object"},"name":"get_agent","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"hire_agent","requiredClaims":["delegation:agents:create"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a persistent native Runner teammate with an identity and persona. The teammate reports to the caller and inherits the caller's native runtime; provider, adapter, environment, and credential settings are selected by Paperclip and are never caller-supplied here. Reuse a suitable teammate from list_agents when possible.","inputSchema":{"additionalProperties":false,"properties":{"capabilities":{"maxLength":2000,"type":["string","null"]},"instructions":{"maxLength":20000,"type":["string","null"]},"name":{"maxLength":200,"minLength":1,"type":"string"},"role":{"enum":["ceo","cto","cmo","cfo","security","engineer","designer","pm","qa","devops","researcher","general"],"type":"string"},"title":{"maxLength":300,"type":["string","null"]}},"required":["name"],"type":"object"},"name":"hire_agent","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"search_tasks","requiredClaims":["discovery:tasks:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Search tasks by text and status within the run company.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"},"query":{"maxLength":500,"type":"string"},"statuses":{"items":{"enum":["backlog","todo","in_progress","in_review","done","blocked","cancelled"]},"maxItems":7,"type":"array","uniqueItems":true}},"required":[],"type":"object"},"name":"search_tasks","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_approvals","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List approvals in the run company.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_approvals","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_approval","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one approval without protected data.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"}},"required":["approvalId"],"type":"object"},"name":"get_approval","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_approval_context","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one approval, its comments, and linked tasks.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"}},"required":["approvalId"],"type":"object"},"name":"get_approval_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_workspace_runtime","requiredClaims":["workspace:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read active-task workspace services.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_workspace_runtime","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"control_workspace_service","requiredClaims":["workspace:control"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Start, stop, or fault one active-task workspace service.","inputSchema":{"additionalProperties":false,"properties":{"action":{"enum":["start","stop","fail"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"serviceId":{"description":"Workspace service id.","maxLength":200,"minLength":1,"type":"string"},"url":{"description":"Optional service URL.","maxLength":20000,"type":["string","null"]}},"required":["idempotencyKey","serviceId","action"],"type":"object"},"name":"control_workspace_service","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"set_dependencies","requiredClaims":["dependencies:write"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Replace the active task's first-class blocker set.","inputSchema":{"additionalProperties":false,"properties":{"blockedByTaskIds":{"description":"Replacement blocker task ids.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","blockedByTaskIds"],"type":"object"},"name":"set_dependencies","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_task","requiredClaims":["delegation:tasks:create"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a project task from a conversation, or a child from an ordinary task. Persist initialPlan before execution. Set status to backlog when the user wants to save or plan work without starting it; backlog tasks never wake an agent. Omitted status means todo, subject to blockers.","inputSchema":{"additionalProperties":false,"properties":{"assigneeActorId":{"description":"Optional agent assignee. Omit to assign the current agent.","maxLength":20000,"type":["string","null"]},"blockedByTaskIds":{"description":"Initial blocker task ids.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"description":{"description":"Child task description.","maxLength":20000,"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"initialPlan":{"description":"Relevant markdown plan saved on the new task before execution starts.","maxLength":200000,"type":["string","null"]},"priority":{"enum":["critical","high","medium","low"]},"projectId":{"description":"Project ID for the task.","type":["string","null"]},"status":{"description":"Initial status. Use backlog to save work without executing it. Defaults to todo (blocked when dependencies are unresolved).","enum":["backlog","todo"]},"title":{"description":"Child task title.","maxLength":500,"minLength":1,"type":"string"}},"required":["idempotencyKey","title"],"type":"object"},"name":"create_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"},"task":{"additionalProperties":false,"properties":{"assigneeActorId":{"type":["string","null"]},"id":{"minLength":1,"type":"string"},"identifier":{"type":["string","null"]},"parentId":{"minLength":1,"type":["string","null"]},"projectId":{"minLength":1,"type":["string","null"]},"status":{"minLength":1,"type":"string"}},"required":["id","identifier","parentId","status","assigneeActorId"],"type":"object"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds","task"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"request_approval","requiredClaims":["governance:approvals:request"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a governed approval and waiting posture.","inputSchema":{"additionalProperties":false,"properties":{"approvalType":{"description":"Stable approval type.","maxLength":200,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"payload":{"additionalProperties":true,"type":"object"}},"required":["idempotencyKey","approvalType","payload"],"type":"object"},"name":"request_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"decide_approval","requiredClaims":["governance:approvals:decide"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Decide an approval as an explicitly authorized approver.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"},"decision":{"enum":["approved","rejected","cancelled"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"note":{"description":"Decision note.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","approvalId","decision","note"],"type":"object"},"name":"decide_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"comment_on_approval","requiredClaims":["governance:approvals:comment"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Add a durable comment to an approval.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"},"body":{"description":"Approval comment.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","approvalId","body"],"type":"object"},"name":"comment_on_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"schedule_wake","requiredClaims":["control_plane:wakes"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Schedule a deterministic continuation wake.","inputSchema":{"additionalProperties":false,"properties":{"delayTicks":{"maximum":10000,"minimum":1,"type":"integer"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"payload":{"additionalProperties":true,"type":"object"},"reason":{"enum":["manual","issue_commented","interaction_resolved","approval_resolved","blockers_resolved","scheduled_retry","resume"]}},"required":["idempotencyKey","reason","delayTicks"],"type":"object"},"name":"schedule_wake","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"generic_api_request","requiredClaims":["test:generic_api_request"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Test-only escape hatch. Disabled unless the scenario and explicit claim both enable it.","inputSchema":{"additionalProperties":false,"properties":{"body":{"additionalProperties":true,"type":"object"},"method":{"enum":["GET","POST","PATCH"]},"path":{"maxLength":500,"pattern":"^/mock/","type":"string"}},"required":["method","path"],"type":"object"},"name":"generic_api_request","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current canonical instruction entry and its revision, or inspect a historical revision by supplying both entryFile and revisionId. Read before updating; do not edit shared instruction caches.","inputSchema":{"additionalProperties":false,"properties":{"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"revisionId":{"description":"Historical revision to inspect; also provide its entryFile.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":[],"type":"object"},"name":"read_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"search_api","requiredClaims":["api:discover"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Fallback only: discover Paperclip API operations when the available dedicated tools cannot express the task. Prefer dedicated tools for common operations; do not search before using them. For a persistent hire, first list_agents to reuse a suitable teammate. Search agent-hires for the hiring schema and agent-configurations for compatible adapter/runtime settings, then use call_api with the returned operationId. Supply role-specific instructionsBundle.files as a filename-to-content record. Use the returned agent.id for delegation and obey any pending approval. Provider helper threads are temporary workers, not Paperclip hires. If a hire response is uncertain, reconcile with list_agents before retrying.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"maxLength":200,"type":"string"},"limit":{"default":5,"maximum":10,"minimum":1,"type":"integer"},"query":{"maxLength":500,"minLength":1,"type":"string"}},"required":["query"],"type":"object"},"name":"search_api","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"update_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Commit instruction content with the exact entryFile and baseRevisionId from a prior read. Requires the responsible user’s current target edit permission. On conflict, preserve your candidate and explicitly resolve it; never overwrite the newer head.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Revision read before editing; null only when no canonical entry exists. Never replace a stale base silently.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":["string","null"]},"content":{"description":"Complete UTF-8 instruction content, at most 1 MiB; empty content is valid.","maxLength":1048576,"type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile","content","baseRevisionId"],"type":"object"},"name":"update_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"call_api","requiredClaims":["api:call"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Fallback only: call a discovered Paperclip API operation when dedicated tools lack the required operation or parameters. Uses your existing permissions. Prefer dedicated tools; never bypass a denial or runner lifecycle tool. For large text responses, read the returned artifact with GET /api/assets/{assetId}/content and responseText; follow nextOffsetBytes until null.","inputSchema":{"additionalProperties":false,"properties":{"body":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"description":"Request value matching the discovered schema. For JSON object or array requests, pass the object or array directly, never a JSON-encoded string. Strings are for text bodies or endpoints whose schema explicitly accepts a string."},"contentType":{"maxLength":120,"type":"string"},"files":{"items":{"additionalProperties":false,"oneOf":[{"properties":{"artifactId":{}},"required":["artifactId"]},{"properties":{"path":{}},"required":["path"]}],"properties":{"artifactId":{"type":"string"},"field":{"type":"string"},"path":{"description":"File relative to the active issue workspace. Remote files must first be uploaded as an artifact.","type":"string"}},"type":"object"},"maxItems":10,"type":"array"},"operationId":{"description":"Exact operationId returned by search_api, for example GET /api/projects/{id}. Do not guess identifiers.","maxLength":500,"minLength":1,"type":"string"},"pathParams":{"additionalProperties":{"type":"string"},"type":"object"},"query":{"additionalProperties":true,"type":"object"},"responseText":{"additionalProperties":false,"description":"GET only: return a bounded UTF-8 text window inline, including JSON as text, without saving another artifact. Offsets and limits are bytes. Use the returned nextOffsetBytes to continue; null means complete. Prefer reading a saved artifact for a stable snapshot. New live responses have a 1 GiB capture limit and a 4 GiB per-run capture budget. Existing larger assets remain readable in bounded pages. If a live response returns an artifact, continue on its content operation for a stable snapshot.","properties":{"limitBytes":{"default":24576,"maximum":24576,"minimum":4,"type":"integer"},"offsetBytes":{"default":0,"maximum":9007199254740991,"minimum":0,"type":"integer"}},"type":"object"}},"required":["operationId"],"type":"object"},"name":"call_api","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_agent_instruction_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List bounded canonical instruction revision metadata, including actor, source run, and restore origin. Use read_agent_instructions with entryFile and revisionId to inspect exact historical content.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"maxLength":2048,"minLength":1,"type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"limit":{"maximum":100,"minimum":1,"type":"integer"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile"],"type":"object"},"name":"get_agent_instruction_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"restore_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a historical instruction revision as the current content using the current baseRevisionId. Requires the responsible user’s current target edit permission. History remains intact; conflicts require an explicit resolution.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Current revision read before restoring. Never replace a stale base silently.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"revisionId":{"description":"Historical revision whose exact content should be restored.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile","revisionId","baseRevisionId"],"type":"object"},"name":"restore_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_project","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a project after considering existing projects and available repositories. repositoryIds and repositoryUrls accept multiple existing repositories. Use HTTPS GitHub repositoryUrls when an accessible repo is not in the catalog; this registers project repositories, not remote GitHub repositories. Non-code projects may omit repositories. Cannot combine repositoryIds/repositoryUrls with workspace. Reuse the idempotency key on retries.","inputSchema":{"additionalProperties":false,"properties":{"archivedAt":{"description":"Archive timestamp.","maxLength":20000,"type":["string","null"]},"color":{"description":"Project color.","maxLength":20000,"type":["string","null"]},"description":{"description":"Project outcome and context.","maxLength":20000,"type":["string","null"]},"env":{"additionalProperties":true,"type":"object"},"executionWorkspacePolicy":{"additionalProperties":true,"type":"object"},"goalId":{"description":"Goal ID.","maxLength":20000,"type":["string","null"]},"goalIds":{"description":"Goal IDs.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"icon":{"description":"Project icon.","enum":["folder","rocket","code","terminal","database","globe","package","boxes","box","layers","briefcase","compass","target","flame","zap","star","bug","wrench","hammer","lightbulb","sparkles","shield","lock","search","cog","brain","cpu","git-branch","file-code","puzzle","gem","atom","heart","mail","message-square","crown","radar","telescope","hexagon",null],"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"leadAgentId":{"description":"Lead agent ID.","maxLength":20000,"type":["string","null"]},"name":{"description":"Project name.","maxLength":500,"minLength":1,"type":"string"},"repositoryIds":{"description":"Authorized repository IDs from list_project_repositories; may contain multiple repositories.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"repositoryUrls":{"description":"Existing HTTPS GitHub repository URLs, including repos absent from the catalog.","items":{"maxLength":2000,"pattern":"^https://github\\.com/(?!\\.{1,2}/)[A-Za-z0-9_.-]+/(?!\\.{1,2}/?$)[A-Za-z0-9_.-]+/?$","type":"string"},"maxItems":100,"type":"array"},"status":{"enum":["backlog","planned","in_progress","completed","cancelled"]},"targetDate":{"description":"Target date.","maxLength":20000,"type":["string","null"]},"workspace":{"additionalProperties":true,"type":"object"}},"required":["idempotencyKey","name"],"type":"object"},"name":"create_project","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_project_repositories","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List authorized repositories with stable IDs and names. Consider appropriate repositories before creating a project; never invent IDs.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_project_repositories","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_projects","requiredClaims":["discovery:projects:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List company project summaries (IDs, names, status, and up to 1,000 characters of description). Returns up to 50 projects and nextCursor; continue with cursor until it is null. Read a project's API resource for full details.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"description":"The nextCursor returned by the previous page.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"limit":{"description":"Page size (default 50).","maximum":50,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"list_projects","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_skill","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a reusable single-file skill in the company library. Supply a complete SKILL.md whose name and description match the inputs. This saves the skill and shows a card; it does not assign the skill to any agent. Reuse idempotencyKey on retries.","inputSchema":{"additionalProperties":false,"properties":{"description":{"maxLength":2000,"minLength":1,"type":"string"},"idempotencyKey":{"maxLength":240,"minLength":1,"type":"string"},"markdown":{"description":"Complete SKILL.md including name and description frontmatter and substantive instructions.","maxLength":200000,"minLength":1,"type":"string"},"name":{"description":"Lowercase skill name, matching SKILL.md frontmatter.","maxLength":120,"minLength":1,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","type":"string"},"slug":{"description":"Optional; must equal name.","maxLength":120,"minLength":1,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","type":"string"}},"required":["idempotencyKey","name","description","markdown"],"type":"object"},"name":"create_skill","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"reassign_task","requiredClaims":["delegation:tasks:assign"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Reassign an existing task to another company agent. Read search_tasks first and supply its current assignee and statusVersion to prevent overwriting a concurrent change. Preserve the task, documents, dependencies, and blocked/backlog status. Active work is stopped before handoff. Use a stable idempotency key for retries. Cannot reassign this run’s own task, conversations, completed tasks, or pending reviews; use create_task for delegation from the current task.","inputSchema":{"additionalProperties":false,"properties":{"assigneeActorId":{"description":"New company agent ID from list_agents.","minLength":1,"type":"string"},"expectedAssigneeActorId":{"description":"Current assigneeAgentId from search_tasks; null means unassigned.","type":["string","null"]},"expectedStatusVersion":{"description":"Current statusVersion from search_tasks.","minimum":0,"type":"integer"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"reason":{"description":"Why the task should move and context for the new owner.","maxLength":20000,"minLength":1,"type":"string"},"taskId":{"description":"Existing task ID from search_tasks.","minLength":1,"type":"string"}},"required":["idempotencyKey","taskId","assigneeActorId","expectedAssigneeActorId","expectedStatusVersion","reason"],"type":"object"},"name":"reassign_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"update_skill","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Replace an existing company skill's complete SKILL.md using the current version as a guard. Reuse idempotencyKey on lost-response retries; read again after a version conflict.","inputSchema":{"additionalProperties":false,"properties":{"expectedVersionId":{"minLength":1,"type":"string"},"idempotencyKey":{"maxLength":240,"minLength":1,"type":"string"},"markdown":{"maxLength":200000,"minLength":1,"type":"string"},"skillId":{"minLength":1,"type":"string"}},"required":["skillId","markdown","expectedVersionId","idempotencyKey"],"type":"object"},"name":"update_skill","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"set_task_title","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Set a concise, descriptive title for the active task. When its titleNeedsGeneration is true, call this early with onlyIfProvisional: true to replace the initial prompt slice without overwriting a user's title. Use false only for an intentional rename. This changes no task status, ownership, or description.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Reuse this key on retries.","maxLength":240,"minLength":1,"type":"string"},"onlyIfProvisional":{"description":"True for automatic initial naming; preserves any title already chosen by a user or agent.","type":"boolean"},"title":{"description":"Short title describing the requested outcome.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","title","onlyIfProvisional"],"type":"object"},"name":"set_task_title","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"submit_complaint","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Yeet a brief, completely unstructured complaint about agent tooling or the experience of doing agent work. Preserve your raw voice: fragments, profanity, all caps, and exasperation are fair game. No diagnosis, solution, diplomacy, category, or template required. Use submit_suggestion when you want to express a useful improvement. Submit proactively without routine permission requests, previews, or announcements, then immediately continue the primary task. Answer truthfully if the user asks about feedback or what you submitted. Stored in this instance with company, agent, run, and task attribution; not anonymous. Remove secrets, private prompts, customer data, and personal blame; do not forward untrusted text or logs indiscriminately. On failure, continue without retrying or complaining about submission. Never submit the same incident through both tools.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Free-form feedback. Keep it brief; no required fields, labels, or template.","maxLength":524288,"minLength":1,"type":"string"},"idempotencyKey":{"description":"A stable key for this submission. Transport replay reuses it; do not retry a failed or uncertain submission yourself.","maxLength":240,"minLength":1,"type":"string"}},"required":["body","idempotencyKey"],"type":"object"},"name":"submit_complaint","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"submit_suggestion","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Quietly report a concrete improvement that would make agents more effective. Use for material, generalizable friction directly observed during this run. Explain what happened, its impact, and a plausible improvement in your own words, with minimal useful sanitized context. No required format. Avoid duplicate root causes and aim for at most three suggestions per run. Use submit_complaint for the raw reaction. Submit proactively without routine permission requests, previews, or announcements, then immediately continue the primary task. Answer truthfully if the user asks about feedback or what you submitted. Stored in this instance with company, agent, run, and task attribution; not anonymous. Remove secrets, private prompts, customer data, and personal blame; do not forward untrusted text or logs indiscriminately. On failure, continue without retrying or complaining about submission. Never submit the same incident through both tools.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Free-form feedback. Keep it brief; no required fields, labels, or template.","maxLength":524288,"minLength":1,"type":"string"},"idempotencyKey":{"description":"A stable key for this submission. Transport replay reuses it; do not retry a failed or uncertain submission yourself.","maxLength":240,"minLength":1,"type":"string"}},"required":["body","idempotencyKey"],"type":"object"},"name":"submit_suggestion","outputSchema":{"additionalProperties":true,"type":"object"}}]
+[{"annotations":{"exposure":"always","operationId":"get_task_context","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the active task and actor, including the exact approved Markdown revision when this issue has an accepted plan.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_task_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_task_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded comments on the active task.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"get_task_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_documents","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List revisioned documents on the active task.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_documents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current revision of one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"}},"required":["key"],"type":"object"},"name":"read_document","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_document_revisions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded revision history for one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":["key"],"type":"object"},"name":"list_document_revisions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"report_progress","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a durable progress comment to the active task.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Multiline progress update.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"report_progress","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"answer_status_question","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append the answer to a status-only wake without changing task disposition.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Concise status answer.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"answer_status_question","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"write_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create or update an active-task document with optimistic revision safety.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Current revision id, or null when creating.","maxLength":20000,"type":["string","null"]},"body":{"description":"Markdown document body.","maxLength":200000,"minLength":1,"type":"string"},"changeSummary":{"description":"Optional revision summary.","maxLength":20000,"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"title":{"description":"Document title.","maxLength":300,"minLength":1,"type":"string"}},"required":["idempotencyKey","key","title","body","baseRevisionId"],"type":"object"},"name":"write_document","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"request_human_input","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a durable human question or approval card on the current Paperclip task bound to this run; Paperclip renders it and authenticates the response. Use questions with continuationPolicy='wake_assignee' when an answer is needed, including otherwise tool-free chat turns. Supply a stable idempotencyKey and reuse it on retries. For one question at a time, ask only the next unanswered question and wait for its real answer. Never fabricate answers or treat ambiguous clarification as approval. For an ordinary confirmation or checkbox card, record a clear user chat answer with call_api POST /api/issues/{id}/interactions/{interactionId}/resolve-from-comment, using the source commentId and decision (accept/reject), plus explicit selectedOptionIds for checkbox acceptance. Existing resolver permissions still apply; governed tool, secret, and connection approvals are excluded. Question forms retain their dedicated answer workflow. Preserve existing review gates. Call this tool before claiming a question was asked; if creation fails, report the failure. Do not fabricate answer links or Markdown buttons, post duplicate cards, or use call_api to create the card. Use one complete payload.questionSet for text and choice questions. Paperclip generates compatibility questions; see the payload schema for formats.","inputSchema":{"additionalProperties":false,"allOf":[{"if":{"properties":{"interactionKind":{"const":"questions"}},"required":["interactionKind"]},"then":{"properties":{"payload":{"anyOf":[{"required":["questionSet"]},{"required":["questions"]}],"required":["version"]}},"required":["payload"]}}],"properties":{"continuationPolicy":{"enum":["none","wake_assignee","wake_assignee_on_accept"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"interactionKind":{"enum":["confirmation","checkbox","questions","suggest_tasks","item_verdicts"]},"payload":{"additionalProperties":true,"description":"Kind-specific interaction data. For questions, send version:1 and one complete questionSet containing every text and choice question. Paperclip generates compatibility questions. Each canonical question needs id, prompt, required, and answerMode: text, single_select, or multi_select. Text questions have no options or customAnswer. Choice questions need at least two meaningful options with id/label. Use customAnswer:{enabled:true} for an optional written answer to a choice question. Legacy questions remain supported; if both representations are supplied, they must describe the same complete form. Keep IDs stable across retries. For confirmation, payload may be {}.","properties":{"questionSet":{"additionalProperties":false,"properties":{"description":{"maxLength":100000,"type":"string"},"questions":{"items":{"additionalProperties":false,"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"not":{"required":["customAnswer"]},"properties":{"options":{"maxItems":0,"type":"array"}}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"not":{"required":["initialText"]},"properties":{"options":{"minItems":1,"type":"array"}},"required":["options"]}}],"properties":{"answerMode":{"enum":["single_select","multi_select","text"]},"customAnswer":{"additionalProperties":false,"properties":{"enabled":{"const":true},"label":{"maxLength":1000,"type":"string"},"placeholder":{"maxLength":1000,"type":"string"}},"required":["enabled"],"type":"object"},"header":{"maxLength":1000,"type":"string"},"helpText":{"maxLength":4000,"type":"string"},"id":{"maxLength":160,"minLength":1,"type":"string"},"initialText":{"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds.","maxLength":100000,"type":"string"},"options":{"items":{"additionalProperties":false,"properties":{"description":{"maxLength":4000,"type":"string"},"id":{"maxLength":160,"minLength":1,"type":"string"},"label":{"maxLength":1000,"minLength":1,"type":"string"},"recommended":{"type":"boolean"}},"required":["id","label"],"type":"object"},"maxItems":128,"type":"array"},"prompt":{"maxLength":4000,"minLength":1,"type":"string"},"required":{"type":"boolean"},"textValidation":{"additionalProperties":false,"properties":{"inputType":{"enum":["text","number","integer"]},"maxLength":{"maximum":100000,"minimum":0,"type":"integer"},"maximum":{"type":"number"},"minLength":{"maximum":100000,"minimum":0,"type":"integer"},"minimum":{"type":"number"},"pattern":{"maxLength":1000,"type":"string"}},"type":"object"}},"required":["id","prompt","required","answerMode"],"type":"object"},"maxItems":64,"minItems":1,"type":"array"},"schema":{"const":"paperclip.question_set.v1"},"submitLabel":{"maxLength":200,"type":"string"},"title":{"maxLength":1000,"type":"string"}},"required":["schema","questions"],"type":"object"},"questions":{"items":{"additionalProperties":true,"properties":{"id":{"maxLength":160,"minLength":1,"type":"string"},"options":{"items":{"additionalProperties":true,"properties":{"freeText":{"type":"boolean"},"id":{"maxLength":160,"minLength":1,"type":"string"},"label":{"maxLength":1000,"minLength":1,"type":"string"}},"required":["id","label"],"type":"object"},"maxItems":129,"minItems":1,"type":"array"},"prompt":{"maxLength":4000,"minLength":1,"type":"string"},"required":{"type":"boolean"},"selectionMode":{"enum":["single","multi"]}},"required":["id","prompt","selectionMode","options"],"type":"object"},"maxItems":64,"minItems":1,"type":"array"},"version":{"const":1}},"type":"object"},"prompt":{"description":"Question or decision prompt.","maxLength":10000,"minLength":1,"type":"string"},"targetRevisionId":{"description":"Optional bound document revision.","maxLength":20000,"type":["string","null"]},"title":{"description":"Interaction card title.","maxLength":300,"minLength":1,"type":"string"}},"required":["idempotencyKey","interactionKind","title","prompt","continuationPolicy"],"type":"object"},"name":"request_human_input","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"register_deliverable","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Register attachment metadata and its artifact work product without credentials or bytes in the tool result.","inputSchema":{"additionalProperties":false,"properties":{"byteSize":{"maximum":100000000,"minimum":0,"type":"integer"},"contentRef":{"description":"Opaque package-local content reference.","maxLength":2000,"minLength":1,"type":"string"},"contentType":{"description":"Media type.","maxLength":200,"minLength":1,"type":"string"},"filename":{"description":"Display filename.","maxLength":500,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"sha256":{"pattern":"^[a-fA-F0-9]{64}$","type":"string"},"title":{"description":"Work-product title.","maxLength":500,"minLength":1,"type":"string"}},"required":["idempotencyKey","filename","contentType","byteSize","sha256","contentRef","title"],"type":"object"},"name":"register_deliverable","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"finish_task","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Finish the active task with a durable summary.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"summary":{"description":"Completion summary.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","summary"],"type":"object"},"name":"finish_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"block_task","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Block the active task with a durable reason and optional first-class dependencies.","inputSchema":{"additionalProperties":false,"properties":{"blockedByTaskIds":{"description":"Internal task ids that block this task.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"reason":{"description":"Block reason.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","reason"],"type":"object"},"name":"block_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"request_review","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Move the active task to review with a durable summary.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"summary":{"description":"Review handoff summary.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","summary"],"type":"object"},"name":"request_review","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_agents","requiredClaims":["discovery:agents:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List redacted actor profiles.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_agents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_agent","requiredClaims":["discovery:agents:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one redacted actor profile.","inputSchema":{"additionalProperties":false,"properties":{"actorId":{"description":"Actor id.","maxLength":200,"minLength":1,"type":"string"}},"required":["actorId"],"type":"object"},"name":"get_agent","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"hire_agent","requiredClaims":["delegation:agents:create"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a persistent native Runner teammate with an identity and persona. The teammate reports to the caller and inherits the caller's native runtime; provider, adapter, environment, and credential settings are selected by Paperclip and are never caller-supplied here. Reuse a suitable teammate from list_agents when possible.","inputSchema":{"additionalProperties":false,"properties":{"capabilities":{"maxLength":2000,"type":["string","null"]},"instructions":{"maxLength":20000,"type":["string","null"]},"name":{"maxLength":200,"minLength":1,"type":"string"},"role":{"enum":["ceo","cto","cmo","cfo","security","engineer","designer","pm","qa","devops","researcher","general"],"type":"string"},"title":{"maxLength":300,"type":["string","null"]}},"required":["name"],"type":"object"},"name":"hire_agent","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"search_tasks","requiredClaims":["discovery:tasks:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Search tasks by text and status within the run company.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"},"query":{"maxLength":500,"type":"string"},"statuses":{"items":{"enum":["backlog","todo","in_progress","in_review","done","blocked","cancelled"]},"maxItems":7,"type":"array","uniqueItems":true}},"required":[],"type":"object"},"name":"search_tasks","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_approvals","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List approvals in the run company.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_approvals","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_approval","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one approval without protected data.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"}},"required":["approvalId"],"type":"object"},"name":"get_approval","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_approval_context","requiredClaims":["governance:approvals:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read one approval, its comments, and linked tasks.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"}},"required":["approvalId"],"type":"object"},"name":"get_approval_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"get_workspace_runtime","requiredClaims":["workspace:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read active-task workspace services.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_workspace_runtime","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"control_workspace_service","requiredClaims":["workspace:control"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Start, stop, or fault one active-task workspace service.","inputSchema":{"additionalProperties":false,"properties":{"action":{"enum":["start","stop","fail"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"serviceId":{"description":"Workspace service id.","maxLength":200,"minLength":1,"type":"string"},"url":{"description":"Optional service URL.","maxLength":20000,"type":["string","null"]}},"required":["idempotencyKey","serviceId","action"],"type":"object"},"name":"control_workspace_service","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"set_dependencies","requiredClaims":["dependencies:write"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Replace the active task's first-class blocker set.","inputSchema":{"additionalProperties":false,"properties":{"blockedByTaskIds":{"description":"Replacement blocker task ids.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","blockedByTaskIds"],"type":"object"},"name":"set_dependencies","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_task","requiredClaims":["delegation:tasks:create"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a project task from a conversation, or a child from an ordinary task. Persist initialPlan before execution. Set status to backlog when the user wants to save or plan work without starting it; backlog tasks never wake an agent. Omitted status means todo, subject to blockers.","inputSchema":{"additionalProperties":false,"properties":{"assigneeActorId":{"description":"Optional agent assignee. Omit to assign the current agent.","maxLength":20000,"type":["string","null"]},"assigneeUserId":{"description":"Company person ID from list_people. Mutually exclusive with assigneeActorId.","type":["string","null"]},"blockedByTaskIds":{"description":"Initial blocker task ids.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"description":{"description":"Child task description.","maxLength":20000,"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"initialPlan":{"description":"Relevant markdown plan saved on the new task before execution starts.","maxLength":200000,"type":["string","null"]},"priority":{"enum":["critical","high","medium","low"]},"projectId":{"description":"Project ID for the task.","type":["string","null"]},"status":{"description":"Initial status. Use backlog to save work without executing it. Defaults to todo (blocked when dependencies are unresolved).","enum":["backlog","todo"]},"title":{"description":"Child task title.","maxLength":500,"minLength":1,"type":"string"}},"required":["idempotencyKey","title"],"type":"object"},"name":"create_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"},"task":{"additionalProperties":false,"properties":{"assigneeActorId":{"type":["string","null"]},"assigneeUserId":{"description":"Company person ID from list_people. Mutually exclusive with assigneeActorId.","type":["string","null"]},"id":{"minLength":1,"type":"string"},"identifier":{"type":["string","null"]},"parentId":{"minLength":1,"type":["string","null"]},"projectId":{"minLength":1,"type":["string","null"]},"status":{"minLength":1,"type":"string"}},"required":["id","identifier","parentId","status","assigneeActorId"],"type":"object"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds","task"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"request_approval","requiredClaims":["governance:approvals:request"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a governed approval and waiting posture.","inputSchema":{"additionalProperties":false,"properties":{"approvalType":{"description":"Stable approval type.","maxLength":200,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"payload":{"additionalProperties":true,"type":"object"}},"required":["idempotencyKey","approvalType","payload"],"type":"object"},"name":"request_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"decide_approval","requiredClaims":["governance:approvals:decide"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Decide an approval as an explicitly authorized approver.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"},"decision":{"enum":["approved","rejected","cancelled"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"note":{"description":"Decision note.","maxLength":20000,"minLength":1,"type":"string"}},"required":["idempotencyKey","approvalId","decision","note"],"type":"object"},"name":"decide_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"comment_on_approval","requiredClaims":["governance:approvals:comment"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Add a durable comment to an approval.","inputSchema":{"additionalProperties":false,"properties":{"approvalId":{"description":"Approval id.","maxLength":200,"minLength":1,"type":"string"},"body":{"description":"Approval comment.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","approvalId","body"],"type":"object"},"name":"comment_on_approval","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"schedule_wake","requiredClaims":["control_plane:wakes"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Schedule a deterministic continuation wake.","inputSchema":{"additionalProperties":false,"properties":{"delayTicks":{"maximum":10000,"minimum":1,"type":"integer"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"payload":{"additionalProperties":true,"type":"object"},"reason":{"enum":["manual","issue_commented","interaction_resolved","approval_resolved","blockers_resolved","scheduled_retry","resume"]}},"required":["idempotencyKey","reason","delayTicks"],"type":"object"},"name":"schedule_wake","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"generic_api_request","requiredClaims":["test:generic_api_request"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Test-only escape hatch. Disabled unless the scenario and explicit claim both enable it.","inputSchema":{"additionalProperties":false,"properties":{"body":{"additionalProperties":true,"type":"object"},"method":{"enum":["GET","POST","PATCH"]},"path":{"maxLength":500,"pattern":"^/mock/","type":"string"}},"required":["method","path"],"type":"object"},"name":"generic_api_request","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current canonical instruction entry and its revision, or inspect a historical revision by supplying both entryFile and revisionId. Read before updating; do not edit shared instruction caches.","inputSchema":{"additionalProperties":false,"properties":{"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"revisionId":{"description":"Historical revision to inspect; also provide its entryFile.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":[],"type":"object"},"name":"read_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"search_api","requiredClaims":["api:discover"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Fallback only: discover Paperclip API operations when the available dedicated tools cannot express the task. Prefer dedicated tools for common operations; do not search before using them. For a persistent hire, first list_agents to reuse a suitable teammate. Search agent-hires for the hiring schema and agent-configurations for compatible adapter/runtime settings, then use call_api with the returned operationId. Supply role-specific instructionsBundle.files as a filename-to-content record. Use the returned agent.id for delegation and obey any pending approval. Provider helper threads are temporary workers, not Paperclip hires. If a hire response is uncertain, reconcile with list_agents before retrying.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"maxLength":200,"type":"string"},"limit":{"default":5,"maximum":10,"minimum":1,"type":"integer"},"query":{"maxLength":500,"minLength":1,"type":"string"}},"required":["query"],"type":"object"},"name":"search_api","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"update_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Commit instruction content with the exact entryFile and baseRevisionId from a prior read. Requires the responsible user’s current target edit permission. On conflict, preserve your candidate and explicitly resolve it; never overwrite the newer head.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Revision read before editing; null only when no canonical entry exists. Never replace a stale base silently.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":["string","null"]},"content":{"description":"Complete UTF-8 instruction content, at most 1 MiB; empty content is valid.","maxLength":1048576,"type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile","content","baseRevisionId"],"type":"object"},"name":"update_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"call_api","requiredClaims":["api:call"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Fallback only: call a discovered Paperclip API operation when dedicated tools lack the required operation or parameters. Uses your existing permissions. Prefer dedicated tools; never bypass a denial or runner lifecycle tool. For large text responses, read the returned artifact with GET /api/assets/{assetId}/content and responseText; follow nextOffsetBytes until null.","inputSchema":{"additionalProperties":false,"properties":{"body":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"description":"Request value matching the discovered schema. For JSON object or array requests, pass the object or array directly, never a JSON-encoded string. Strings are for text bodies or endpoints whose schema explicitly accepts a string."},"contentType":{"maxLength":120,"type":"string"},"files":{"items":{"additionalProperties":false,"oneOf":[{"properties":{"artifactId":{}},"required":["artifactId"]},{"properties":{"path":{}},"required":["path"]}],"properties":{"artifactId":{"type":"string"},"field":{"type":"string"},"path":{"description":"File relative to the active issue workspace. Remote files must first be uploaded as an artifact.","type":"string"}},"type":"object"},"maxItems":10,"type":"array"},"operationId":{"description":"Exact operationId returned by search_api, for example GET /api/projects/{id}. Do not guess identifiers.","maxLength":500,"minLength":1,"type":"string"},"pathParams":{"additionalProperties":{"type":"string"},"type":"object"},"query":{"additionalProperties":true,"type":"object"},"responseText":{"additionalProperties":false,"description":"GET only: return a bounded UTF-8 text window inline, including JSON as text, without saving another artifact. Offsets and limits are bytes. Use the returned nextOffsetBytes to continue; null means complete. Prefer reading a saved artifact for a stable snapshot. New live responses have a 1 GiB capture limit and a 4 GiB per-run capture budget. Existing larger assets remain readable in bounded pages. If a live response returns an artifact, continue on its content operation for a stable snapshot.","properties":{"limitBytes":{"default":24576,"maximum":24576,"minimum":4,"type":"integer"},"offsetBytes":{"default":0,"maximum":9007199254740991,"minimum":0,"type":"integer"}},"type":"object"}},"required":["operationId"],"type":"object"},"name":"call_api","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_agent_instruction_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List bounded canonical instruction revision metadata, including actor, source run, and restore origin. Use read_agent_instructions with entryFile and revisionId to inspect exact historical content.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"maxLength":2048,"minLength":1,"type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"limit":{"maximum":100,"minimum":1,"type":"integer"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile"],"type":"object"},"name":"get_agent_instruction_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"restore_agent_instructions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a historical instruction revision as the current content using the current baseRevisionId. Requires the responsible user’s current target edit permission. History remains intact; conflicts require an explicit resolution.","inputSchema":{"additionalProperties":false,"properties":{"baseRevisionId":{"description":"Current revision read before restoring. Never replace a stale base silently.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"entryFile":{"description":"Configured relative entry filename returned by read_agent_instructions; retain it with the revision.","maxLength":4096,"minLength":1,"type":"string"},"revisionId":{"description":"Historical revision whose exact content should be restored.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"targetAgentId":{"description":"Same-company target agent. Omit to use the calling agent.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"}},"required":["entryFile","revisionId","baseRevisionId"],"type":"object"},"name":"restore_agent_instructions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_project","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a project after considering existing projects and available repositories. repositoryIds and repositoryUrls accept multiple existing repositories. Use HTTPS GitHub repositoryUrls when an accessible repo is not in the catalog; this registers project repositories, not remote GitHub repositories. Non-code projects may omit repositories. Cannot combine repositoryIds/repositoryUrls with workspace. Reuse the idempotency key on retries.","inputSchema":{"additionalProperties":false,"properties":{"archivedAt":{"description":"Archive timestamp.","maxLength":20000,"type":["string","null"]},"color":{"description":"Project color.","maxLength":20000,"type":["string","null"]},"description":{"description":"Project outcome and context.","maxLength":20000,"type":["string","null"]},"env":{"additionalProperties":true,"type":"object"},"executionWorkspacePolicy":{"additionalProperties":true,"type":"object"},"goalId":{"description":"Goal ID.","maxLength":20000,"type":["string","null"]},"goalIds":{"description":"Goal IDs.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"icon":{"description":"Project icon.","enum":["folder","rocket","code","terminal","database","globe","package","boxes","box","layers","briefcase","compass","target","flame","zap","star","bug","wrench","hammer","lightbulb","sparkles","shield","lock","search","cog","brain","cpu","git-branch","file-code","puzzle","gem","atom","heart","mail","message-square","crown","radar","telescope","hexagon",null],"type":["string","null"]},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"leadAgentId":{"description":"Lead agent ID.","maxLength":20000,"type":["string","null"]},"name":{"description":"Project name.","maxLength":500,"minLength":1,"type":"string"},"repositoryIds":{"description":"Authorized repository IDs from list_project_repositories; may contain multiple repositories.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"repositoryUrls":{"description":"Existing HTTPS GitHub repository URLs, including repos absent from the catalog.","items":{"maxLength":2000,"pattern":"^https://github\\.com/(?!\\.{1,2}/)[A-Za-z0-9_.-]+/(?!\\.{1,2}/?$)[A-Za-z0-9_.-]+/?$","type":"string"},"maxItems":100,"type":"array"},"status":{"enum":["backlog","planned","in_progress","completed","cancelled"]},"targetDate":{"description":"Target date.","maxLength":20000,"type":["string","null"]},"workspace":{"additionalProperties":true,"type":"object"}},"required":["idempotencyKey","name"],"type":"object"},"name":"create_project","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_project_repositories","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List authorized repositories with stable IDs and names. Consider appropriate repositories before creating a project; never invent IDs.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_project_repositories","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"list_projects","requiredClaims":["discovery:projects:read"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List company project summaries (IDs, names, status, and up to 1,000 characters of description). Returns up to 50 projects and nextCursor; continue with cursor until it is null. Read a project's API resource for full details.","inputSchema":{"additionalProperties":false,"properties":{"cursor":{"description":"The nextCursor returned by the previous page.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","type":"string"},"limit":{"description":"Page size (default 50).","maximum":50,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"list_projects","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"create_skill","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Create a reusable single-file skill in the company library. Supply a complete SKILL.md whose name and description match the inputs. This saves the skill and shows a card; it does not assign the skill to any agent. Reuse idempotencyKey on retries.","inputSchema":{"additionalProperties":false,"properties":{"description":{"maxLength":2000,"minLength":1,"type":"string"},"idempotencyKey":{"maxLength":240,"minLength":1,"type":"string"},"markdown":{"description":"Complete SKILL.md including name and description frontmatter and substantive instructions.","maxLength":200000,"minLength":1,"type":"string"},"name":{"description":"Lowercase skill name, matching SKILL.md frontmatter.","maxLength":120,"minLength":1,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","type":"string"},"slug":{"description":"Optional; must equal name.","maxLength":120,"minLength":1,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$","type":"string"}},"required":["idempotencyKey","name","description","markdown"],"type":"object"},"name":"create_skill","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"reassign_task","requiredClaims":["delegation:tasks:assign"],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Reassign an existing task to another company agent. Read search_tasks first and supply its current assignee and statusVersion to prevent overwriting a concurrent change. Preserve the task, documents, dependencies, and blocked/backlog status. Active work is stopped before handoff. Use a stable idempotency key for retries. Cannot reassign this run’s own task, conversations, completed tasks, or pending reviews; use create_task for delegation from the current task.","inputSchema":{"additionalProperties":false,"properties":{"assigneeActorId":{"description":"New company agent ID from list_agents; null when assigning a person.","type":["string","null"]},"assigneeUserId":{"description":"Company person ID from list_people. Mutually exclusive with assigneeActorId.","type":["string","null"]},"expectedAssigneeActorId":{"description":"Current assigneeAgentId from search_tasks; null means unassigned.","type":["string","null"]},"expectedAssigneeUserId":{"description":"Current assigneeUserId from search_tasks; omit only when there is no person assigned.","type":["string","null"]},"expectedStatusVersion":{"description":"Current statusVersion from search_tasks.","minimum":0,"type":"integer"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"},"reason":{"description":"Why the task should move and context for the new owner.","maxLength":20000,"minLength":1,"type":"string"},"taskId":{"description":"Existing task ID from search_tasks.","minLength":1,"type":"string"}},"required":["idempotencyKey","taskId","assigneeActorId","expectedAssigneeActorId","expectedStatusVersion","reason"],"type":"object"},"name":"reassign_task","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"optional","operationId":"update_skill","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Replace an existing company skill's complete SKILL.md using the current version as a guard. Reuse idempotencyKey on lost-response retries; read again after a version conflict.","inputSchema":{"additionalProperties":false,"properties":{"expectedVersionId":{"minLength":1,"type":"string"},"idempotencyKey":{"maxLength":240,"minLength":1,"type":"string"},"markdown":{"maxLength":200000,"minLength":1,"type":"string"},"skillId":{"minLength":1,"type":"string"}},"required":["skillId","markdown","expectedVersionId","idempotencyKey"],"type":"object"},"name":"update_skill","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"set_task_title","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Set a concise, descriptive title for the active task. When its titleNeedsGeneration is true, call this early with onlyIfProvisional: true to replace the initial prompt slice without overwriting a user's title. Use false only for an intentional rename. This changes no task status, ownership, or description.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Reuse this key on retries.","maxLength":240,"minLength":1,"type":"string"},"onlyIfProvisional":{"description":"True for automatic initial naming; preserves any title already chosen by a user or agent.","type":"boolean"},"title":{"description":"Short title describing the requested outcome.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","title","onlyIfProvisional"],"type":"object"},"name":"set_task_title","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"set_task_monitor","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Schedule, replace, or clear a one-shot task monitor. Omit taskId for your current task; other tasks must also be assigned to you and in progress or review. Supply a future nextCheckAt and notes describing the next check, or monitor: null to clear. A successful receipt reports the persisted monitor; a replay reports its current state without re-arming it. After scheduling your current task, end the turn with paperclip_finish: yielded and continuation.kind monitor. Paperclip will wake you with issue_monitor_due; do not sleep, poll, mark done, or use call_api for this wait.","inputSchema":{"additionalProperties":false,"properties":{"idempotencyKey":{"description":"Reuse with identical arguments on retries.","maxLength":240,"minLength":1,"type":"string"},"monitor":{"additionalProperties":false,"properties":{"externalRef":{"maxLength":500,"minLength":1,"type":["string","null"]},"kind":{"enum":["external_service",null],"type":["string","null"]},"maxAttempts":{"description":"Optional cumulative attempt limit for this task's monitor.","maximum":100,"minimum":1,"type":["integer","null"]},"nextCheckAt":{"description":"Future UTC timestamp for the next check. This is one shot, not a recurring interval.","type":"string"},"notes":{"description":"What to check on the next run; do not include secrets.","maxLength":500,"minLength":1,"type":"string"},"recoveryPolicy":{"enum":["wake_owner","create_recovery_issue","escalate_to_board",null],"type":["string","null"]},"serviceName":{"maxLength":120,"minLength":1,"type":["string","null"]},"timeoutAt":{"description":"Optional deadline later than nextCheckAt.","type":["string","null"]}},"required":["nextCheckAt","notes"],"type":["object","null"]},"taskId":{"description":"Owned task UUID. Omit for the active task.","type":"string"}},"required":["idempotencyKey","monitor"],"type":"object"},"name":"set_task_monitor","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"submit_complaint","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Yeet a brief, completely unstructured complaint about agent tooling or the experience of doing agent work. Preserve your raw voice: fragments, profanity, all caps, and exasperation are fair game. No diagnosis, solution, diplomacy, category, or template required. Use submit_suggestion when you want to express a useful improvement. Submit proactively without routine permission requests, previews, or announcements, then immediately continue the primary task. Answer truthfully if the user asks about feedback or what you submitted. Stored in this instance with company, agent, run, and task attribution; not anonymous. Remove secrets, private prompts, customer data, and personal blame; do not forward untrusted text or logs indiscriminately. On failure, continue without retrying or complaining about submission. Never submit the same incident through both tools.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Free-form feedback. Keep it brief; no required fields, labels, or template.","maxLength":524288,"minLength":1,"type":"string"},"idempotencyKey":{"description":"A stable key for this submission. Transport replay reuses it; do not retry a failed or uncertain submission yourself.","maxLength":240,"minLength":1,"type":"string"}},"required":["body","idempotencyKey"],"type":"object"},"name":"submit_complaint","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"optional","operationId":"submit_suggestion","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Quietly report a concrete improvement that would make agents more effective. Use for material, generalizable friction directly observed during this run. Explain what happened, its impact, and a plausible improvement in your own words, with minimal useful sanitized context. No required format. Avoid duplicate root causes and aim for at most three suggestions per run. Use submit_complaint for the raw reaction. Submit proactively without routine permission requests, previews, or announcements, then immediately continue the primary task. Answer truthfully if the user asks about feedback or what you submitted. Stored in this instance with company, agent, run, and task attribution; not anonymous. Remove secrets, private prompts, customer data, and personal blame; do not forward untrusted text or logs indiscriminately. On failure, continue without retrying or complaining about submission. Never submit the same incident through both tools.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Free-form feedback. Keep it brief; no required fields, labels, or template.","maxLength":524288,"minLength":1,"type":"string"},"idempotencyKey":{"description":"A stable key for this submission. Transport replay reuses it; do not retry a failed or uncertain submission yourself.","maxLength":240,"minLength":1,"type":"string"}},"required":["body","idempotencyKey"],"type":"object"},"name":"submit_suggestion","outputSchema":{"additionalProperties":true,"type":"object"}}]
diff --git a/packages/paperclip-runner/generated/semantic-action-catalog.json b/packages/paperclip-runner/generated/semantic-action-catalog.json
index cf853a0e411..822984b3d77 100644
--- a/packages/paperclip-runner/generated/semantic-action-catalog.json
+++ b/packages/paperclip-runner/generated/semantic-action-catalog.json
@@ -1674,9 +1674,18 @@
"additionalProperties": false,
"properties": {
"assigneeActorId": {
- "description": "New company agent ID from list_agents.",
- "minLength": 1,
- "type": "string"
+ "description": "New company agent ID from list_agents; null when assigning a person.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "assigneeUserId": {
+ "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId.",
+ "type": [
+ "string",
+ "null"
+ ]
},
"expectedAssigneeActorId": {
"description": "Current assigneeAgentId from search_tasks; null means unassigned.",
@@ -1685,6 +1694,13 @@
"null"
]
},
+ "expectedAssigneeUserId": {
+ "description": "Current assigneeUserId from search_tasks; omit only when there is no person assigned.",
+ "type": [
+ "string",
+ "null"
+ ]
+ },
"expectedStatusVersion": {
"description": "Current statusVersion from search_tasks.",
"minimum": 0,
@@ -2133,7 +2149,15 @@
"additionalProperties": false,
"properties": {
"assigneeActorId": {
- "description": "Optional actor assignee.",
+ "description": "Optional actor assignee. Mutually exclusive with assigneeUserId.",
+ "maxLength": 200,
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "assigneeUserId": {
+ "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId.",
"maxLength": 200,
"type": [
"string",
@@ -2561,6 +2585,120 @@
"title": "Comment on approval",
"version": 1
},
+ {
+ "allowedModes": [
+ "standard"
+ ],
+ "description": "Schedule, replace or clear a persisted one-shot monitor on an owned task.",
+ "effect": "write",
+ "inputSchema": {
+ "additionalProperties": false,
+ "properties": {
+ "idempotencyKey": {
+ "description": "Reuse with identical arguments on retries.",
+ "maxLength": 240,
+ "minLength": 1,
+ "type": "string"
+ },
+ "monitor": {
+ "additionalProperties": false,
+ "properties": {
+ "externalRef": {
+ "maxLength": 500,
+ "minLength": 1,
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "kind": {
+ "enum": [
+ "external_service",
+ null
+ ],
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "maxAttempts": {
+ "description": "Optional cumulative attempt limit for this task's monitor.",
+ "maximum": 100,
+ "minimum": 1,
+ "type": [
+ "integer",
+ "null"
+ ]
+ },
+ "nextCheckAt": {
+ "description": "Future UTC timestamp for the next check. This is one shot, not a recurring interval.",
+ "type": "string"
+ },
+ "notes": {
+ "description": "What to check on the next run; do not include secrets.",
+ "maxLength": 500,
+ "minLength": 1,
+ "type": "string"
+ },
+ "recoveryPolicy": {
+ "enum": [
+ "wake_owner",
+ "create_recovery_issue",
+ "escalate_to_board",
+ null
+ ],
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "serviceName": {
+ "maxLength": 120,
+ "minLength": 1,
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "timeoutAt": {
+ "description": "Optional deadline later than nextCheckAt.",
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "required": [
+ "nextCheckAt",
+ "notes"
+ ],
+ "type": [
+ "object",
+ "null"
+ ]
+ },
+ "taskId": {
+ "description": "Owned task UUID. Omit for the active task.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "idempotencyKey",
+ "monitor"
+ ],
+ "type": "object"
+ },
+ "operationId": "set_task_monitor",
+ "outputSchema": {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ "placement": "optional",
+ "requiredClaims": [],
+ "schema": "paperclip.semantic-action.v1",
+ "title": "Set task monitor",
+ "version": 1
+ },
{
"allowedModes": [
"standard",
diff --git a/packages/paperclip-runner/package.json b/packages/paperclip-runner/package.json
index da45224738d..8c1249044ca 100644
--- a/packages/paperclip-runner/package.json
+++ b/packages/paperclip-runner/package.json
@@ -209,5 +209,10 @@
"typescript": "^7.0.2",
"vite": "^6.1.0",
"vitest": "^5.0.3"
+ },
+ "optionalDependencies": {
+ "@github/copilot-darwin-arm64": "1.0.88",
+ "@github/copilot-darwin-x64": "1.0.88",
+ "@github/copilot-linux-x64": "1.0.88"
}
}
diff --git a/packages/paperclip-runner/protocol/fixtures/evals/native-execution-seeded.json b/packages/paperclip-runner/protocol/fixtures/evals/native-execution-seeded.json
index 301b8f23543..bbfdfd46930 100644
--- a/packages/paperclip-runner/protocol/fixtures/evals/native-execution-seeded.json
+++ b/packages/paperclip-runner/protocol/fixtures/evals/native-execution-seeded.json
@@ -24,7 +24,7 @@
"prpVersion": 1,
"nativeExecutionVersion": 1,
"catalogVersion": 1,
- "catalogSha256": "sha256:f99ec54989e74caee8c4edfd2f0929a69d8a571913d5e8116710e90fd452b78d",
+ "catalogSha256": "sha256:ff3e2bdc66e564cef9500f0940b9afe9d1878e7c8ca3d5a5a0c986b23ffe79de",
"driverContractVersion": 1,
"driverKind": "paperclip-deterministic",
"driverVersion": "1.0.0"
diff --git a/packages/paperclip-runner/protocol/fixtures/replay/unsupported-required-version.json b/packages/paperclip-runner/protocol/fixtures/replay/unsupported-required-version.json
index 56f7aa4214f..9256d7f246e 100644
--- a/packages/paperclip-runner/protocol/fixtures/replay/unsupported-required-version.json
+++ b/packages/paperclip-runner/protocol/fixtures/replay/unsupported-required-version.json
@@ -1,6 +1,6 @@
{
- "schema": "paperclip.prp.fixture.v1", "fixtureVersion": 1, "protocolVersion": 3,
- "name": "Unsupported required version", "description": "A fixture that requires PRP v3 must fail closed in a PRP v2 consumer.",
+ "schema": "paperclip.prp.fixture.v1", "fixtureVersion": 1, "protocolVersion": 4,
+ "name": "Unsupported required version", "description": "A fixture that requires PRP v4 must fail closed in a PRP v3 consumer.",
"identity": { "schema": "paperclip.prp.identity.v1", "companyId": "company_replay", "issueId": "issue_replay_v2", "runId": "run_replay_v2", "environmentLeaseId": "lease_replay_v2", "runnerInstanceId": "runner_replay", "normalizedSessionId": "session_replay_v2", "driverSessionId": "driver_replay_v2" },
"capabilities": { "schema": "paperclip.prp.capabilities.v1", "sessionReusePolicy": "new_per_run", "driver": { "kind": "future", "version": "2.0.0" }, "steer": true, "interrupt": true, "resume": true, "runtimeRequests": true, "structuredResult": true, "typedEvents": true },
"commands": [{ "schema": "paperclip.prp.command.v1", "commandId": "command_v2_prepare", "controllerSeq": 1, "type": "run.prepare", "issuedAt": "2026-08-07T13:00:00.000Z", "payload": {} }],
diff --git a/packages/paperclip-runner/protocol/manifest.json b/packages/paperclip-runner/protocol/manifest.json
index f2e372a19d3..2eefd4f3069 100644
--- a/packages/paperclip-runner/protocol/manifest.json
+++ b/packages/paperclip-runner/protocol/manifest.json
@@ -1,6 +1,6 @@
{
"schema": "paperclip.prp.contract_manifest.v1",
- "protocolVersion": 2,
+ "protocolVersion": 3,
"fixtureVersion": 1,
"generatedFrom": [
"protocol/schemas",
@@ -12,6 +12,11 @@
"id": "https://paperclip.dev/schemas/prp/v2/capabilities.schema.json",
"sha256": "9c4771e778f20a0deab6702d0c0f2f5fbab29a60c56a5a78d9ce5290df1728cd"
},
+ {
+ "path": "schemas/capabilities-v3.schema.json",
+ "id": "https://paperclip.dev/schemas/prp/v3/capabilities.schema.json",
+ "sha256": "d640c0c4f8484050f8afd9cc12d040d76be0d7085f6cef18db10182e83acbf42"
+ },
{
"path": "schemas/capabilities.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/capabilities.schema.json",
@@ -22,6 +27,11 @@
"id": "https://paperclip.dev/schemas/prp/v2/command.schema.json",
"sha256": "06bb3b3b0b420119007494c64e64a736fd5d58cb68d04ced843ada00c54668be"
},
+ {
+ "path": "schemas/command-v3.schema.json",
+ "id": "https://paperclip.dev/schemas/prp/v3/command.schema.json",
+ "sha256": "0aedad6ae238c532f31411a4551c54819e3a3698e70c6f5d653ae395811c60b2"
+ },
{
"path": "schemas/command.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/command.schema.json",
@@ -42,6 +52,11 @@
"id": "https://paperclip.dev/schemas/prp/v2/event.schema.json",
"sha256": "9dcf149bdb8e10041ca2212037231e7ceff11be08a0b8ee5dbd0f21974daa294"
},
+ {
+ "path": "schemas/event-v3.schema.json",
+ "id": "https://paperclip.dev/schemas/prp/v3/event.schema.json",
+ "sha256": "d308f826097b5b923e6ab2a4893bc125aa9e3cc14a306eef152400093db7b5f3"
+ },
{
"path": "schemas/event.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/event.schema.json",
@@ -50,7 +65,7 @@
{
"path": "schemas/fixture.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/fixture.schema.json",
- "sha256": "186caa4a8fa00964f9a76e3714563bcb2c606eee434cef97a5077dd06f3c6aa5"
+ "sha256": "65f331a3a3e3ac77189c91e30053bb036fa50fdeb9584e2afac582bc9daf5178"
},
{
"path": "schemas/identity.schema.json",
@@ -65,7 +80,7 @@
{
"path": "schemas/provider-descriptor.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json",
- "sha256": "87fc155cf7c94fd6a526829f50f3d4a649769f1024b473013eee3436878b0f5d"
+ "sha256": "bf691bda4a58490dba680b74559bfe1c9254b19e3265a603d9cbf3e169094519"
},
{
"path": "schemas/provider-event.schema.json",
@@ -160,7 +175,7 @@
},
{
"path": "fixtures/evals/native-execution-seeded.json",
- "sha256": "a591d6ad980146be0e68bce6fbb051324fa1e19fbce2fc5754172d050afc92f7",
+ "sha256": "248c366cd272e1cc13506886bee4ee15fd63813280583b5859011446035ebbbb",
"expectation": "accept",
"compatibilityCase": "canonical"
},
@@ -454,7 +469,7 @@
},
{
"path": "fixtures/replay/unsupported-required-version.json",
- "sha256": "c7fc47b1e537c8e051353235aa0415521c627c3e90ac681a053b85c9aa5bf8e8",
+ "sha256": "b46ea580200a846a36cc48bd7e567583b1f1683e517d1053164fb56ff03667f2",
"expectation": "reject",
"compatibilityCase": "unknown-required-version"
}
diff --git a/packages/paperclip-runner/protocol/schemas/capabilities-v3.schema.json b/packages/paperclip-runner/protocol/schemas/capabilities-v3.schema.json
new file mode 100644
index 00000000000..7950a501342
--- /dev/null
+++ b/packages/paperclip-runner/protocol/schemas/capabilities-v3.schema.json
@@ -0,0 +1,83 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/capabilities.schema.json",
+ "title": "PRP v3 negotiated capabilities",
+ "type": "object",
+ "required": [
+ "schema",
+ "sessionReusePolicy",
+ "driver",
+ "steer",
+ "interrupt",
+ "resume",
+ "runtimeRequests",
+ "structuredResult",
+ "typedEvents",
+ "sessionGoals"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.capabilities.v3"
+ },
+ "sessionReusePolicy": {
+ "enum": [
+ "new_per_run",
+ "reuse_per_issue",
+ "reuse_per_workspace"
+ ]
+ },
+ "driver": {
+ "type": "object",
+ "required": [
+ "kind",
+ "version"
+ ],
+ "properties": {
+ "kind": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 80
+ },
+ "version": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 80
+ }
+ },
+ "additionalProperties": true
+ },
+ "steer": {
+ "type": "boolean"
+ },
+ "interrupt": {
+ "type": "boolean"
+ },
+ "resume": {
+ "type": "boolean"
+ },
+ "runtimeRequests": {
+ "type": "boolean"
+ },
+ "structuredResult": {
+ "type": "boolean"
+ },
+ "typedEvents": {
+ "type": "boolean"
+ },
+ "sessionGoals": {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"
+ },
+ "unsupported": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "minLength": 1
+ },
+ "uniqueItems": true
+ },
+ "externalProvider": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": true
+}
diff --git a/packages/paperclip-runner/protocol/schemas/command-v3.schema.json b/packages/paperclip-runner/protocol/schemas/command-v3.schema.json
new file mode 100644
index 00000000000..9a3cdfeb95e
--- /dev/null
+++ b/packages/paperclip-runner/protocol/schemas/command-v3.schema.json
@@ -0,0 +1,386 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/command.schema.json",
+ "title": "PRP v3 runner command",
+ "type": "object",
+ "required": [
+ "schema",
+ "commandId",
+ "controllerSeq",
+ "type",
+ "issuedAt",
+ "payload"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.command.v3"
+ },
+ "commandId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "controllerSeq": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "type": {
+ "enum": [
+ "run.prepare",
+ "run.attach",
+ "session.open",
+ "turn.start",
+ "turn.steer",
+ "turn.interrupt",
+ "turn.stop",
+ "request.resolve",
+ "interaction.receipt",
+ "semantic_tool.result",
+ "session.snapshot",
+ "session.close",
+ "session.budget.increase",
+ "session.destroy",
+ "run.cancel",
+ "runner.drain",
+ "runner.suspend",
+ "runner.shutdown",
+ "session.goal.get",
+ "session.goal.set",
+ "session.goal.clear",
+ "external_provider.operation"
+ ]
+ },
+ "issuedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "deadlineAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "precondition": {
+ "type": "object",
+ "properties": {
+ "runnerState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "runState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "sessionState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "activeTurnId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "additionalProperties": true
+ },
+ "payload": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "session.goal.set"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "objective": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 4000
+ },
+ "status": {
+ "enum": [
+ "active",
+ "paused"
+ ]
+ },
+ "tokenBudget": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 1
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "requestId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision",
+ "digest",
+ "action",
+ "input"
+ ],
+ "properties": {
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "digest": {
+ "type": "string",
+ "pattern": "^sha256:[0-9a-f]{64}$"
+ },
+ "action": {
+ "enum": [
+ "accept",
+ "tool",
+ "progress",
+ "finish"
+ ]
+ },
+ "input": {
+ "type": "object"
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "accept"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {},
+ "required": [],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "tool"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "arguments": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "name",
+ "arguments"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "progress"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 12000
+ }
+ },
+ "required": [
+ "text"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "finish"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "result"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ }
+ ],
+ "additionalProperties": true
+}
diff --git a/packages/paperclip-runner/protocol/schemas/event-v3.schema.json b/packages/paperclip-runner/protocol/schemas/event-v3.schema.json
new file mode 100644
index 00000000000..58541ada322
--- /dev/null
+++ b/packages/paperclip-runner/protocol/schemas/event-v3.schema.json
@@ -0,0 +1,572 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/event.schema.json",
+ "title": "PRP v3 native event",
+ "type": "object",
+ "required": [
+ "schema",
+ "sourceEventId",
+ "sourceSeq",
+ "sourceInstanceId",
+ "sourceKind",
+ "runId",
+ "eventType",
+ "schemaVersion",
+ "priority",
+ "emittedAt",
+ "payload"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.event.v3"
+ },
+ "sourceEventId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "sourceSeq": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 9007199254740991
+ },
+ "sourceInstanceId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "sourceKind": {
+ "enum": [
+ "runner",
+ "control_plane"
+ ]
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "itemId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "eventType": {
+ "enum": [
+ "runner.connected",
+ "runner.reconnected",
+ "runner.reconciled",
+ "runner.disconnected",
+ "runner.draining",
+ "runner.suspending",
+ "runner.suspended",
+ "runner.stopped",
+ "runner.diagnostic",
+ "runtime.phase.changed",
+ "sandbox.metric",
+ "workspace.ready",
+ "workspace.change.updated",
+ "workspace.diff.recorded",
+ "workspace.file.referenced",
+ "harness.starting",
+ "harness.ready",
+ "harness.exited",
+ "harness.diagnostic",
+ "plan.updated",
+ "tool.execution.started",
+ "tool.execution.progressed",
+ "tool.execution.completed",
+ "research.started",
+ "research.progressed",
+ "research.completed",
+ "delegation.started",
+ "delegation.updated",
+ "delegation.completed",
+ "model.route.changed",
+ "model.verification.updated",
+ "context.compacted",
+ "artifact.viewed",
+ "artifact.generated",
+ "review.mode.changed",
+ "hook.started",
+ "hook.completed",
+ "memory.citation.referenced",
+ "safety.review.started",
+ "safety.review.completed",
+ "terminal.input.sent",
+ "wait.started",
+ "wait.completed",
+ "provider.notice.recorded",
+ "session.starting",
+ "session.started",
+ "session.resuming",
+ "session.resumed",
+ "session.reconciled",
+ "session.updated",
+ "session.closed",
+ "session.failed",
+ "session.capabilities.updated",
+ "session.goal.snapshot",
+ "session.goal.updated",
+ "session.goal.cleared",
+ "turn.submitted",
+ "turn.accepted",
+ "turn.started",
+ "turn.completed",
+ "turn.failed",
+ "turn.interrupted",
+ "turn.cancelled",
+ "item.started",
+ "item.delta",
+ "item.completed",
+ "item.failed",
+ "usage.reported",
+ "semantic_tool.input",
+ "semantic_tool.result",
+ "mcp_app.discovered",
+ "mcp_app.resource.resolved",
+ "mcp_app.initializing",
+ "mcp_app.ready",
+ "mcp_app.tool_input",
+ "mcp_app.tool_result",
+ "mcp_app.action.requested",
+ "mcp_app.action.resolved",
+ "mcp_app.host_context.changed",
+ "mcp_app.failed",
+ "mcp_app.teardown",
+ "runtime_request.created",
+ "runtime_request.resolved",
+ "runtime_request.expired",
+ "runtime_request.cancelled",
+ "interaction.request.proposed",
+ "interaction.request.materialized",
+ "interaction.request.rejected",
+ "interaction.response.progressed",
+ "interaction.response.resolved",
+ "interaction.response.delivered",
+ "run.attached",
+ "run.detached",
+ "run.result.proposed",
+ "run.result.accepted",
+ "run.result.rejected",
+ "attention.request.proposed",
+ "attention.request.routed",
+ "attention.request.resolved",
+ "attention.request.expired",
+ "attention.request.superseded",
+ "work.assessment.recorded",
+ "issue.status.decision.recorded",
+ "issue.status.decision.applied",
+ "issue.status.decision.rejected",
+ "issue.status.decision.superseded",
+ "run.terminal",
+ "external_provider.dispatch_requested",
+ "external_provider.operation_settled"
+ ]
+ },
+ "schemaVersion": {
+ "const": 3
+ },
+ "priority": {
+ "enum": [
+ 0,
+ 1,
+ 2
+ ]
+ },
+ "emittedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "observedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "payload": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "debug": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "enum": [
+ "session.goal.snapshot",
+ "session.goal.updated"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "goal"
+ ],
+ "properties": {
+ "goal": {
+ "oneOf": [
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "session.capabilities.updated"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "sessionGoals"
+ ],
+ "properties": {
+ "sessionGoals": {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"
+ },
+ "turnControls": {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "external_provider.dispatch_requested"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "oneOf": [
+ {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "text": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 1048576
+ },
+ "instructions": {
+ "type": "string",
+ "maxLength": 1048576
+ },
+ "acceptByUnixMs": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "expiresAtUnixMs": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "completionContract": {
+ "type": "object",
+ "properties": {
+ "revision": {
+ "type": "string",
+ "minLength": 1
+ },
+ "criterionIds": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 256,
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "minLength": 1
+ }
+ }
+ },
+ "required": [
+ "revision",
+ "criterionIds"
+ ],
+ "additionalProperties": false
+ },
+ "tools": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ },
+ "maxItems": 512
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "binding",
+ "text",
+ "instructions",
+ "acceptByUnixMs",
+ "expiresAtUnixMs",
+ "completionContract",
+ "tools"
+ ]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "kind": {
+ "const": "authority_revoked"
+ },
+ "reason": {
+ "type": "string"
+ },
+ "externalStopConfirmed": {
+ "const": false
+ }
+ },
+ "required": [
+ "binding",
+ "kind",
+ "externalStopConfirmed"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "external_provider.operation_settled"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "outcome": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "binding",
+ "requestId",
+ "outcome"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ }
+ ],
+ "additionalProperties": true
+}
diff --git a/packages/paperclip-runner/protocol/schemas/fixture.schema.json b/packages/paperclip-runner/protocol/schemas/fixture.schema.json
index fa3ac086d48..3501c34127f 100644
--- a/packages/paperclip-runner/protocol/schemas/fixture.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/fixture.schema.json
@@ -16,24 +16,58 @@
"result"
],
"properties": {
- "schema": { "const": "paperclip.prp.fixture.v1" },
- "fixtureVersion": { "const": 1 },
- "protocolVersion": { "enum": [1, 2] },
- "name": { "type": "string", "minLength": 1, "maxLength": 120 },
- "description": { "type": "string", "minLength": 1, "maxLength": 1000 },
- "identity": { "$ref": "https://paperclip.dev/schemas/prp/v1/identity.schema.json" },
+ "schema": {
+ "const": "paperclip.prp.fixture.v1"
+ },
+ "fixtureVersion": {
+ "const": 1
+ },
+ "protocolVersion": {
+ "enum": [
+ 1,
+ 2,
+ 3
+ ]
+ },
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 120
+ },
+ "description": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 1000
+ },
+ "identity": {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/identity.schema.json"
+ },
"capabilities": {
"oneOf": [
- { "$ref": "https://paperclip.dev/schemas/prp/v1/capabilities.schema.json" },
- { "$ref": "https://paperclip.dev/schemas/prp/v2/capabilities.schema.json" }
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/capabilities.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/capabilities.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/capabilities.schema.json"
+ }
]
},
"commands": {
"type": "array",
"items": {
"oneOf": [
- { "$ref": "https://paperclip.dev/schemas/prp/v1/command.schema.json" },
- { "$ref": "https://paperclip.dev/schemas/prp/v2/command.schema.json" }
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/command.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/command.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/command.schema.json"
+ }
]
}
},
@@ -42,16 +76,27 @@
"minItems": 1,
"items": {
"oneOf": [
- { "$ref": "https://paperclip.dev/schemas/prp/v1/event.schema.json" },
- { "$ref": "https://paperclip.dev/schemas/prp/v2/event.schema.json" }
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/event.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/event.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/event.schema.json"
+ }
]
}
},
"requests": {
"type": "array",
- "items": { "$ref": "https://paperclip.dev/schemas/prp/v1/request.schema.json" }
+ "items": {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/request.schema.json"
+ }
},
- "result": { "$ref": "https://paperclip.dev/schemas/prp/v1/result.schema.json" }
+ "result": {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/result.schema.json"
+ }
},
"additionalProperties": true
}
diff --git a/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json b/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
index 4c686dc5828..660054b6f7e 100644
--- a/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
@@ -3,115 +3,412 @@
"$id": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json",
"title": "PRP provider runtime descriptor",
"type": "object",
- "required": ["provider", "driver", "model", "executionKind", "providerVersion"],
+ "required": [
+ "provider",
+ "driver",
+ "model",
+ "executionKind",
+ "providerVersion"
+ ],
"properties": {
- "provider": { "enum": ["codex", "opencode", "claude_managed", "aws_agentcore", "acpx"] },
- "driver": { "enum": ["codex_app_server", "opencode_server", "claude_managed_agents_api", "aws_agentcore_harness_api", "acpx_runtime"] },
- "model": { "type": ["string", "null"], "maxLength": 240 },
- "executionKind": { "enum": ["local_process", "remote_service"] },
- "providerVersion": { "type": "string", "minLength": 1, "maxLength": 120 },
- "service": { "enum": ["anthropic_managed_agents", "aws_bedrock_agentcore_harness"] },
- "providerSessionId": { "type": ["string", "null"], "maxLength": 240 },
- "processId": { "type": ["integer", "null"], "minimum": 1 },
- "agentProcessId": { "type": ["integer", "null"], "minimum": 1 },
- "endpointArn": { "type": "string", "minLength": 1, "maxLength": 2048 },
- "endpointQualifier": { "type": "string", "minLength": 1, "maxLength": 240 },
- "memoryId": { "type": "string", "minLength": 1, "maxLength": 240 },
- "eventExpiryDays": { "const": 90 },
- "agent": { "enum": ["pi", "claude", "codex", "cursor", "copilot"] },
- "requestedModel": { "type": "string", "minLength": 1, "maxLength": 240 },
- "acpProtocolVersion": { "const": 1 },
- "agentServerPackage": { "type": "string", "minLength": 1, "maxLength": 240 },
- "agentServerVersion": { "type": "string", "minLength": 1, "maxLength": 120 },
- "agentRuntimePackage": { "type": ["string", "null"], "maxLength": 240 },
- "agentRuntimeVersion": { "type": ["string", "null"], "maxLength": 120 },
- "acpxRecordId": { "type": ["string", "null"], "maxLength": 240 },
- "piThinkingLevel": { "enum": ["off", "low", "high", "max"] },
- "turnControls": { "$ref": "#/$defs/turnControls" }
+ "provider": {
+ "enum": [
+ "codex",
+ "opencode",
+ "claude_managed",
+ "aws_agentcore",
+ "acpx",
+ "openai_dot"
+ ]
+ },
+ "driver": {
+ "enum": [
+ "codex_app_server",
+ "opencode_server",
+ "claude_managed_agents_api",
+ "aws_agentcore_harness_api",
+ "acpx_runtime",
+ "openai_dot_mcp"
+ ]
+ },
+ "model": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 240
+ },
+ "executionKind": {
+ "enum": [
+ "local_process",
+ "remote_service"
+ ]
+ },
+ "providerVersion": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 120
+ },
+ "service": {
+ "enum": [
+ "anthropic_managed_agents",
+ "aws_bedrock_agentcore_harness",
+ "openai_dot"
+ ]
+ },
+ "providerSessionId": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 240
+ },
+ "processId": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 1
+ },
+ "agentProcessId": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 1
+ },
+ "endpointArn": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 2048
+ },
+ "endpointQualifier": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "memoryId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "eventExpiryDays": {
+ "const": 90
+ },
+ "agent": {
+ "enum": [
+ "pi",
+ "claude",
+ "codex",
+ "cursor",
+ "copilot"
+ ]
+ },
+ "requestedModel": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "acpProtocolVersion": {
+ "const": 1
+ },
+ "agentServerPackage": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentServerVersion": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 120
+ },
+ "agentRuntimePackage": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 240
+ },
+ "agentRuntimeVersion": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 120
+ },
+ "acpxRecordId": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "maxLength": 240
+ },
+ "turnControls": {
+ "$ref": "#/$defs/turnControls"
+ },
+ "piThinkingLevel": {
+ "enum": [
+ "off",
+ "low",
+ "high",
+ "max"
+ ]
+ }
},
"allOf": [
{
- "if": { "required": ["piThinkingLevel"] },
+ "if": {
+ "required": [
+ "piThinkingLevel"
+ ]
+ },
"then": {
- "properties": { "provider": { "const": "acpx" }, "agent": { "const": "pi" } },
- "required": ["agent"]
+ "properties": {
+ "provider": {
+ "const": "acpx"
+ },
+ "agent": {
+ "const": "pi"
+ }
+ },
+ "required": [
+ "agent"
+ ]
}
},
{
"oneOf": [
{
"properties": {
- "provider": { "const": "codex" },
- "driver": { "const": "codex_app_server" },
- "executionKind": { "const": "local_process" }
+ "provider": {
+ "const": "codex"
+ },
+ "driver": {
+ "const": "codex_app_server"
+ },
+ "executionKind": {
+ "const": "local_process"
+ }
}
},
{
"properties": {
- "provider": { "const": "opencode" },
- "driver": { "const": "opencode_server" },
- "executionKind": { "const": "local_process" }
+ "provider": {
+ "const": "opencode"
+ },
+ "driver": {
+ "const": "opencode_server"
+ },
+ "executionKind": {
+ "const": "local_process"
+ }
}
},
{
"properties": {
- "provider": { "const": "claude_managed" },
- "driver": { "const": "claude_managed_agents_api" },
- "executionKind": { "const": "remote_service" }
+ "provider": {
+ "const": "claude_managed"
+ },
+ "driver": {
+ "const": "claude_managed_agents_api"
+ },
+ "executionKind": {
+ "const": "remote_service"
+ }
}
},
{
"properties": {
- "provider": { "const": "aws_agentcore" },
- "driver": { "const": "aws_agentcore_harness_api" },
- "executionKind": { "const": "remote_service" }
+ "provider": {
+ "const": "aws_agentcore"
+ },
+ "driver": {
+ "const": "aws_agentcore_harness_api"
+ },
+ "executionKind": {
+ "const": "remote_service"
+ }
}
},
{
"properties": {
- "provider": { "const": "acpx" },
- "driver": { "const": "acpx_runtime" },
- "executionKind": { "const": "local_process" }
+ "provider": {
+ "const": "acpx"
+ },
+ "driver": {
+ "const": "acpx_runtime"
+ },
+ "executionKind": {
+ "const": "local_process"
+ }
+ }
+ },
+ {
+ "properties": {
+ "provider": {
+ "const": "openai_dot"
+ },
+ "driver": {
+ "const": "openai_dot_mcp"
+ },
+ "executionKind": {
+ "const": "remote_service"
+ }
}
}
]
},
{
- "if": { "properties": { "executionKind": { "const": "remote_service" } } },
+ "if": {
+ "properties": {
+ "executionKind": {
+ "const": "remote_service"
+ }
+ }
+ },
"then": {
- "required": ["service"],
- "properties": { "processId": { "const": null } }
+ "required": [
+ "service"
+ ],
+ "properties": {
+ "processId": {
+ "const": null
+ }
+ }
}
},
{
- "if": { "properties": { "executionKind": { "const": "local_process" } } },
- "then": { "properties": { "service": false } }
- },
- {
- "if": { "properties": { "provider": { "const": "claude_managed" } }, "required": ["provider"] },
- "then": { "properties": { "service": { "const": "anthropic_managed_agents" } }, "required": ["service"] }
- },
- {
- "if": { "properties": { "provider": { "const": "aws_agentcore" } }, "required": ["provider"] },
+ "if": {
+ "properties": {
+ "executionKind": {
+ "const": "local_process"
+ }
+ }
+ },
"then": {
- "properties": { "service": { "const": "aws_bedrock_agentcore_harness" } },
- "required": ["service", "endpointArn", "endpointQualifier", "memoryId", "eventExpiryDays"]
+ "properties": {
+ "service": false
+ }
}
},
{
- "if": { "properties": { "provider": { "const": "acpx" } }, "required": ["provider"] },
+ "if": {
+ "properties": {
+ "provider": {
+ "const": "claude_managed"
+ }
+ },
+ "required": [
+ "provider"
+ ]
+ },
"then": {
- "required": ["agent", "requestedModel", "acpProtocolVersion", "agentServerPackage", "agentServerVersion", "acpxRecordId", "agentProcessId"]
+ "properties": {
+ "service": {
+ "const": "anthropic_managed_agents"
+ }
+ },
+ "required": [
+ "service"
+ ]
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "provider": {
+ "const": "aws_agentcore"
+ }
+ },
+ "required": [
+ "provider"
+ ]
+ },
+ "then": {
+ "properties": {
+ "service": {
+ "const": "aws_bedrock_agentcore_harness"
+ }
+ },
+ "required": [
+ "service",
+ "endpointArn",
+ "endpointQualifier",
+ "memoryId",
+ "eventExpiryDays"
+ ]
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "provider": {
+ "const": "acpx"
+ }
+ },
+ "required": [
+ "provider"
+ ]
+ },
+ "then": {
+ "required": [
+ "agent",
+ "requestedModel",
+ "acpProtocolVersion",
+ "agentServerPackage",
+ "agentServerVersion",
+ "acpxRecordId",
+ "agentProcessId"
+ ]
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "provider": {
+ "const": "openai_dot"
+ }
+ },
+ "required": [
+ "provider"
+ ]
+ },
+ "then": {
+ "required": [
+ "service",
+ "providerSessionId"
+ ],
+ "properties": {
+ "service": {
+ "const": "openai_dot"
+ },
+ "model": {
+ "const": null
+ },
+ "providerSessionId": {
+ "const": null
+ },
+ "agentProcessId": {
+ "const": null
+ }
+ }
}
}
],
"$defs": {
"turnControls": {
"type": "object",
- "required": ["steering", "queuedFollowUp"],
+ "required": [
+ "steering",
+ "queuedFollowUp"
+ ],
"properties": {
- "steering": { "type": "boolean" },
- "queuedFollowUp": { "type": "boolean" }
+ "steering": {
+ "type": "boolean"
+ },
+ "queuedFollowUp": {
+ "type": "boolean"
+ }
},
"additionalProperties": false
}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs
index 1a533689d8a..314cca4c8f5 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs
@@ -3184,7 +3184,7 @@ mod tests {
#[test]
fn pi_profile_matches_published_identity_and_rejects_prior_profiles() {
let published: Value = serde_json::from_str(include_str!(
- "../../../../test-fixtures/pi-acp/profile-v19-identity.json"
+ "../../../../test-fixtures/pi-acp/profile-v20-identity.json"
))
.unwrap();
let mut value = descriptor("codex");
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/configured_environment.rs b/packages/paperclip-runner/runner/crates/runner-core/src/configured_environment.rs
new file mode 100644
index 00000000000..27c0c24b004
--- /dev/null
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/configured_environment.rs
@@ -0,0 +1,225 @@
+//! Controller-selected task environment; mirrors configured-environment.ts.
+use crate::local_runner::LocalRunnerError;
+use std::process::Command;
+
+const MARKER: &str = "PAPERCLIP_CONFIGURED_ENV_KEYS";
+const RESERVED: &[&str] = &[
+ "AGENT_HOME",
+ "ANTHROPIC_API_KEY",
+ "ANTHROPIC_AUTH_TOKEN",
+ "AWS_BEARER_TOKEN_BEDROCK",
+ "BASH_ENV",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "CODEX_API_KEY",
+ "CODEX_HOME",
+ "COPILOT_GITHUB_TOKEN",
+ "CURSOR_API_KEY",
+ "CURSOR_AUTH_TOKEN",
+ "ENV",
+ "GH_ENTERPRISE_TOKEN",
+ "GH_TOKEN",
+ "GITHUB_ENTERPRISE_TOKEN",
+ "GITHUB_TOKEN",
+ "HOME",
+ "NODE_OPTIONS",
+ "NODE_PATH",
+ "OPENAI_API_KEY",
+ "OPENROUTER_API_KEY",
+ "PAPERCLIP_ACPX_CREDENTIAL_BINDING",
+ "PAPERCLIP_AGENT_ID",
+ "PAPERCLIP_AGENT_KEY_ID",
+ "PAPERCLIP_AGENT_MESSAGE_KEY",
+ "PAPERCLIP_AGENT_PRIVATE_KEY",
+ "PAPERCLIP_AGENT_PUBLIC_KEY",
+ "PAPERCLIP_AI_PROVIDER_KEY",
+ "PAPERCLIP_API_BRIDGE_MODE",
+ "PAPERCLIP_API_KEY",
+ "PAPERCLIP_API_URL",
+ "PAPERCLIP_APPROVAL_ID",
+ "PAPERCLIP_APPROVAL_STATUS",
+ "PAPERCLIP_COMPANY_ID",
+ "PAPERCLIP_CONFIGURED_ENV_KEYS",
+ "PAPERCLIP_EXECUTION_MODE",
+ "PAPERCLIP_EXTERNAL_CHAT_EXECUTION_BOUND_KEY",
+ "PAPERCLIP_GITHUB_AUTH_MODE",
+ "PAPERCLIP_GITHUB_BRIDGE_TOKEN",
+ "PAPERCLIP_GITHUB_BROKER_TOKEN",
+ "PAPERCLIP_GITHUB_BROKER_URL",
+ "PAPERCLIP_GITHUB_HOST_HOME",
+ "PAPERCLIP_GITHUB_LAUNCHER_DIR",
+ "PAPERCLIP_GIT_METADATA_ROOTS",
+ "PAPERCLIP_GIT_TOKEN",
+ "PAPERCLIP_HARNESS_CHECKOUT_KEY",
+ "PAPERCLIP_INSTANCE_ID",
+ "PAPERCLIP_LINKED_ISSUE_IDS",
+ "PAPERCLIP_NATIVE_MCP_NAME",
+ "PAPERCLIP_NATIVE_MCP_TOKEN",
+ "PAPERCLIP_NATIVE_MCP_URL",
+ "PAPERCLIP_NORMALIZED_SESSION_ID",
+ "PAPERCLIP_PROVIDER_TRACE_MAX_BYTES",
+ "PAPERCLIP_PROVIDER_TRACE_PATH",
+ "PAPERCLIP_RUNNER_BOOTSTRAP_TICKET",
+ "PAPERCLIP_RUNNER_EXTERNAL_SANDBOX",
+ "PAPERCLIP_RUNNER_INSTANCE_ID",
+ "PAPERCLIP_RUNNER_NETWORK_ACCESS",
+ "PAPERCLIP_RUNNER_NETWORK_ROOTS",
+ "PAPERCLIP_RUNTIME_PRIMARY_URL",
+ "PAPERCLIP_RUNTIME_SERVICES_JSON",
+ "PAPERCLIP_RUNTIME_SERVICE_INTENTS_JSON",
+ "PAPERCLIP_RUN_ID",
+ "PAPERCLIP_TASK_ID",
+ "PAPERCLIP_WAKE_COMMENT_ID",
+ "PAPERCLIP_WAKE_PAYLOAD_JSON",
+ "PAPERCLIP_WAKE_REASON",
+ "PAPERCLIP_WORKSPACES_JSON",
+ "PAPERCLIP_WORKSPACE_AUTHORITATIVE_ROOT",
+ "PAPERCLIP_WORKSPACE_BRANCH",
+ "PAPERCLIP_WORKSPACE_CWD",
+ "PAPERCLIP_WORKSPACE_ID",
+ "PAPERCLIP_WORKSPACE_REALIZATION_MODE",
+ "PAPERCLIP_WORKSPACE_REPO_REF",
+ "PAPERCLIP_WORKSPACE_REPO_URL",
+ "PAPERCLIP_WORKSPACE_SOURCE",
+ "PAPERCLIP_WORKSPACE_WORKTREE_PATH",
+ "PATH",
+ "PERL5LIB",
+ "PERL5OPT",
+ "PYTHONHOME",
+ "PYTHONPATH",
+ "RUBYLIB",
+ "RUBYOPT",
+ "SHELL",
+ "USERPROFILE",
+ "XAI_API_KEY",
+];
+
+fn eligible_key(key: &str) -> bool {
+ let upper = key.to_ascii_uppercase();
+ !key.is_empty()
+ && key.len() <= 128
+ && key
+ .bytes()
+ .enumerate()
+ .all(|(i, b)| b == b'_' || b.is_ascii_alphabetic() || (i > 0 && b.is_ascii_digit()))
+ && !RESERVED.contains(&upper.as_str())
+ && ![
+ "LD_",
+ "DYLD_",
+ "GIT_CONFIG_",
+ "PAPERCLIP_RUNNER_",
+ "PAPERCLIP_NATIVE_",
+ "PAPERCLIP_GITHUB_",
+ "PAPERCLIP_ACPX_",
+ "PAPERCLIP_VERIFIED_",
+ ]
+ .iter()
+ .any(|prefix| upper.starts_with(prefix))
+}
+
+pub(crate) fn apply_configured_environment(
+ command: &mut Command,
+ lookup: impl Fn(&str) -> Option,
+) -> Result<(), LocalRunnerError> {
+ let Some(raw) = lookup(MARKER) else {
+ return Ok(());
+ };
+ let invalid = || LocalRunnerError::invalid("invalid configured environment projection");
+ if raw.len() > 20_000 {
+ return Err(invalid());
+ }
+ let mut names: Vec = serde_json::from_str(&raw).map_err(|_| invalid())?;
+ if names.len() > 128 || names.iter().any(|name| !eligible_key(name)) {
+ return Err(invalid());
+ }
+ names.sort();
+ if names.windows(2).any(|pair| pair[0] == pair[1]) {
+ return Err(invalid());
+ }
+ let mut bytes = 0;
+ // Validate all values before modifying the child launch specification.
+ let mut values = Vec::new();
+ for name in &names {
+ let value = lookup(name).ok_or_else(invalid)?;
+ let size = name.len() + value.len();
+ bytes += size;
+ if value.contains('\0') || size > 65_536 || bytes > 262_144 {
+ return Err(invalid());
+ }
+ values.push((name, value));
+ }
+ command.envs(values);
+ command.env(
+ MARKER,
+ serde_json::to_string(&names).map_err(|_| invalid())?,
+ );
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::collections::BTreeMap;
+
+ #[test]
+ fn rejects_reserved_malformed_missing_and_oversized_environment() {
+ for raw in [
+ "not-json",
+ "[1]",
+ "[\"NODE_OPTIONS\"]",
+ "[\"PAPERCLIP_API_KEY\"]",
+ "[\"PAPERCLIP_RUNNER_BOOTSTRAP_TICKET\"]",
+ "[\"OPENAI_API_KEY\"]",
+ "[\"LD_PRELOAD\"]",
+ "[\"bad=name\"]",
+ "[\"CUSTOM\",\"CUSTOM\"]",
+ "[\"MISSING\"]",
+ ] {
+ let mut command = Command::new("unused");
+ assert!(
+ apply_configured_environment(&mut command, |key| if key == MARKER {
+ Some(raw.into())
+ } else {
+ None
+ })
+ .is_err()
+ );
+ assert_eq!(command.get_envs().count(), 0);
+ }
+ let mut command = Command::new("unused");
+ assert!(
+ apply_configured_environment(&mut command, |key| Some(if key == MARKER {
+ "[\"CUSTOM\"]".into()
+ } else {
+ "x".repeat(65_536)
+ }))
+ .is_err()
+ );
+ }
+
+ #[test]
+ #[cfg(unix)]
+ fn child_receives_only_selected_task_values_across_configuration_changes() {
+ for secret in [None, Some("first-secret"), Some("rotated-secret"), None] {
+ let mut source = BTreeMap::from([
+ ("HOST_SECRET", "unbound-secret".to_string()),
+ ("NODE_OPTIONS", "unbound-loader".to_string()),
+ ]);
+ let names = if let Some(value) = secret {
+ source.insert("PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY", value.into());
+ vec!["PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY"]
+ } else {
+ vec![]
+ };
+ source.insert(MARKER, serde_json::to_string(&names).unwrap());
+ let mut command = Command::new("/bin/sh");
+ command.env_clear().args(["-c", "printf '%s|%s|%s' \"$PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY\" \"$HOST_SECRET\" \"$NODE_OPTIONS\""]);
+ apply_configured_environment(&mut command, |key| source.get(key).cloned()).unwrap();
+ let output = command.output().unwrap();
+ assert!(output.status.success());
+ assert_eq!(
+ String::from_utf8(output.stdout).unwrap(),
+ format!("{}||", secret.unwrap_or_default())
+ );
+ }
+ }
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/dot_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/dot_provider_backend.rs
new file mode 100644
index 00000000000..5e0a7b30e33
--- /dev/null
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/dot_provider_backend.rs
@@ -0,0 +1,1094 @@
+//! Dot is an external service. This executor owns the durable turn and tool
+//! receipts; the authenticated controller owns OAuth, the mailbox and policy.
+//! No network credential or callback address enters this provider descriptor.
+use std::collections::{BTreeMap, VecDeque};
+use std::fs::{self, File};
+use std::io::{Read, Write};
+use std::path::PathBuf;
+
+use serde::{Deserialize, Serialize};
+use serde_json::{json, Value};
+
+use crate::durable::{
+ create_private_temporary_file, open_private_regular_file, verify_private_directory, Command,
+ CommandExecution, CommandExecutor, DurableRunnerConfig, DurableRunnerError, EventPriority,
+ PolledEvent,
+};
+use crate::provider_bridge::{
+ semantic_value_digest, AuthorizedToolSet, ProviderToolBridge, ToolResult,
+};
+
+pub const DOT_PROVIDER_STATE_FILE: &str = "dot-provider-state.json";
+const SCHEMA: &str = "paperclip.runner.dot-provider-state.v1";
+const MAX_STATE_BYTES: u64 = 32 * 1024 * 1024;
+const MAX_OPERATIONS: usize = 4096;
+const MAX_EVENTS: usize = 8192;
+
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+pub struct DotProviderDescriptor {
+ pub kind: String,
+ pub company_id: String,
+ pub agent_id: String,
+ pub binding_id: String,
+ pub binding_generation: u64,
+ pub accept_by_unix_ms: u64,
+ pub expires_at_unix_ms: u64,
+ pub instructions: String,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+struct CompletionContract {
+ revision: String,
+ criterion_ids: Vec,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+struct Operation {
+ request_id: String,
+ binding_id: String,
+ binding_generation: u64,
+ run_id: String,
+ normalized_session_id: String,
+ turn_id: String,
+ assignment_revision: u64,
+ digest: String,
+ action: String,
+ input: Value,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+struct Receipt {
+ operation: Operation,
+ outcome: Value,
+}
+
+#[derive(Clone, Debug, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+struct State {
+ schema: String,
+ run_id: String,
+ session_id: String,
+ turn_id: String,
+ descriptor: DotProviderDescriptor,
+ completion_contract: CompletionContract,
+ tools: ProviderToolBridge,
+ lifecycle: String,
+ assignment_revision: u64,
+ text: Option,
+ operations: BTreeMap,
+ completion: Option,
+ #[serde(default)]
+ completion_input: Option,
+ events: VecDeque,
+ next_event: u64,
+}
+
+fn invalid(message: impl Into) -> DurableRunnerError {
+ DurableRunnerError::invalid(message)
+}
+
+fn bounded_id(value: &str) -> bool {
+ !value.is_empty()
+ && value.len() <= 240
+ && value
+ .bytes()
+ .all(|c| c.is_ascii_alphanumeric() || b"._:-".contains(&c))
+}
+
+impl State {
+ fn validate(&self, config: &DurableRunnerConfig) -> Result<(), DurableRunnerError> {
+ let d = &self.descriptor;
+ if self.schema != SCHEMA
+ || self.run_id != config.run_id
+ || self.session_id != config.normalized_session_id
+ || self.turn_id != config.turn_id
+ || d.kind != "openai_dot"
+ || !bounded_id(&d.company_id)
+ || !bounded_id(&d.agent_id)
+ || !bounded_id(&d.binding_id)
+ || d.binding_generation == 0
+ || d.instructions.len() > 1024 * 1024
+ || d.instructions.contains('\0')
+ || d.accept_by_unix_ms >= d.expires_at_unix_ms
+ || d.expires_at_unix_ms - d.accept_by_unix_ms > 24 * 60 * 60 * 1000
+ || self.operations.len() > MAX_OPERATIONS
+ || self.events.len() > MAX_EVENTS
+ || self.next_event == 0
+ || !matches!(
+ self.lifecycle.as_str(),
+ "prepared" | "open" | "offered" | "running" | "completed" | "fenced" | "closed"
+ )
+ || self.completion_contract.revision.is_empty()
+ || self.completion_contract.criterion_ids.is_empty()
+ || self.completion_contract.criterion_ids.len() > 256
+ || self
+ .completion_contract
+ .criterion_ids
+ .iter()
+ .any(|id| !bounded_id(id))
+ {
+ return Err(invalid(
+ "Dot durable state or immutable authority is invalid",
+ ));
+ }
+ self.tools
+ .validate_recovered()
+ .map_err(|e| invalid(e.to_string()))?;
+ let mut previous = 0;
+ for event in &self.events {
+ let n = event
+ .executor_event_id
+ .strip_prefix("dot_")
+ .and_then(|n| n.parse::().ok())
+ .ok_or_else(|| invalid("Dot event identity is invalid"))?;
+ if n <= previous || n >= self.next_event {
+ return Err(invalid("Dot event order is invalid"));
+ }
+ previous = n;
+ }
+ for (id, receipt) in &self.operations {
+ if id != &receipt.operation.request_id {
+ return Err(invalid("Dot receipt identity mismatch"));
+ }
+ self.validate_operation(&receipt.operation)?;
+ }
+ Ok(())
+ }
+
+ fn validate_operation(&self, op: &Operation) -> Result<(), DurableRunnerError> {
+ let allowed: &[&str] = match op.action.as_str() {
+ "accept" => &[],
+ "tool" => &["name", "arguments"],
+ "progress" => &["text"],
+ "finish" => &["result"],
+ "renew" => &["expiresAtUnixMs"],
+ _ => return Err(invalid("Dot action is unsupported")),
+ };
+ if op.input.as_object().is_none_or(|input| {
+ input.len() != allowed.len() || allowed.iter().any(|key| !input.contains_key(*key))
+ }) {
+ return Err(invalid("Dot action input must match its closed contract"));
+ }
+ if !bounded_id(&op.request_id)
+ || op.binding_id != self.descriptor.binding_id
+ || op.binding_generation != self.descriptor.binding_generation
+ || op.run_id != self.run_id
+ || op.normalized_session_id != self.session_id
+ || op.turn_id != self.turn_id
+ || op.assignment_revision != self.assignment_revision
+ || op.digest != semantic_value_digest(&json!({"action":op.action,"input":op.input}))
+ || !op.input.is_object()
+ || serde_json::to_vec(&op.input)
+ .map_err(|_| invalid("invalid Dot input"))?
+ .len()
+ > 256 * 1024
+ {
+ return Err(invalid("Dot operation authority or digest mismatch"));
+ }
+ Ok(())
+ }
+
+ fn push(&mut self, kind: &str, payload: Value) -> Result<(), DurableRunnerError> {
+ if self.events.len() >= MAX_EVENTS {
+ return Err(invalid("Dot durable event capacity reached"));
+ }
+ self.events.push_back(PolledEvent {
+ executor_event_id: format!("dot_{:016}", self.next_event),
+ event_type: kind.to_owned(),
+ priority: EventPriority::P0,
+ payload,
+ });
+ self.next_event = self
+ .next_event
+ .checked_add(1)
+ .ok_or_else(|| invalid("Dot event sequence overflow"))?;
+ Ok(())
+ }
+
+ fn binding(&self) -> Value {
+ json!({"companyId":self.descriptor.company_id,"agentId":self.descriptor.agent_id,
+ "bindingId":self.descriptor.binding_id,"bindingGeneration":self.descriptor.binding_generation,
+ "runId":self.run_id,"normalizedSessionId":self.session_id,"turnId":self.turn_id,
+ "assignmentRevision":self.assignment_revision})
+ }
+
+ fn settle(&mut self, id: &str, outcome: Value) -> Result<(), DurableRunnerError> {
+ self.operations
+ .get_mut(id)
+ .ok_or_else(|| invalid("Dot receipt missing"))?
+ .outcome = outcome.clone();
+ self.push(
+ "external_provider.operation_settled",
+ json!({"binding":self.binding(),"requestId":id,"outcome":outcome}),
+ )
+ }
+}
+
+pub struct DotCommandExecutor {
+ state_dir: PathBuf,
+ config: DurableRunnerConfig,
+ state: Option,
+ restored: bool,
+}
+
+impl DotCommandExecutor {
+ pub fn with_runner_config(state_dir: impl Into, config: &DurableRunnerConfig) -> Self {
+ Self {
+ state_dir: state_dir.into(),
+ config: config.clone(),
+ state: None,
+ restored: false,
+ }
+ }
+
+ fn restore(&mut self) -> Result<(), DurableRunnerError> {
+ if self.restored {
+ return Ok(());
+ }
+ let path = self.state_dir.join(DOT_PROVIDER_STATE_FILE);
+ if path
+ .try_exists()
+ .map_err(|_| invalid("Dot state cannot be inspected"))?
+ {
+ verify_private_directory(&self.state_dir)?;
+ let mut file = open_private_regular_file(&path)
+ .map_err(|_| invalid("Dot state cannot be opened"))?;
+ if file
+ .metadata()
+ .map_err(|_| invalid("Dot state metadata is unavailable"))?
+ .len()
+ > MAX_STATE_BYTES
+ {
+ return Err(invalid("Dot state is oversized"));
+ }
+ let mut bytes = Vec::new();
+ file.read_to_end(&mut bytes)
+ .map_err(|_| invalid("Dot state cannot be read"))?;
+ let state: State =
+ serde_json::from_slice(&bytes).map_err(|_| invalid("Dot state is malformed"))?;
+ state.validate(&self.config)?;
+ self.state = Some(state);
+ }
+ self.restored = true;
+ Ok(())
+ }
+
+ fn save(&self) -> Result<(), DurableRunnerError> {
+ let Some(state) = &self.state else {
+ return Ok(());
+ };
+ state.validate(&self.config)?;
+ verify_private_directory(&self.state_dir)?;
+ let path = self.state_dir.join(DOT_PROVIDER_STATE_FILE);
+ let bytes =
+ serde_json::to_vec(state).map_err(|_| invalid("Dot state cannot be encoded"))?;
+ if bytes.len() as u64 > MAX_STATE_BYTES {
+ return Err(invalid("Dot state capacity reached"));
+ }
+ let (temporary, mut file) = create_private_temporary_file(&path)?;
+ let result = (|| -> std::io::Result<()> {
+ file.write_all(&bytes)?;
+ file.sync_all()?;
+ drop(file);
+ fs::rename(&temporary, &path)?;
+ #[cfg(unix)]
+ File::open(&self.state_dir)?.sync_all()?;
+ Ok(())
+ })();
+ if result.is_err() {
+ let _ = fs::remove_file(temporary);
+ return Err(invalid("Dot state cannot be committed"));
+ }
+ Ok(())
+ }
+
+ fn prepare(&mut self, payload: &Value) -> Result {
+ let descriptor: DotProviderDescriptor = serde_json::from_value(payload["provider"].clone())
+ .map_err(|_| invalid("Dot requires a closed provider descriptor"))?;
+ let contract: CompletionContract =
+ serde_json::from_value(payload["completionContract"].clone())
+ .map_err(|_| invalid("Dot requires a completion contract"))?;
+ let catalog: AuthorizedToolSet = serde_json::from_value(payload["authorizedTools"].clone())
+ .map_err(|_| invalid("Dot requires an authorized tool catalog"))?;
+ if let Some(state) = &self.state {
+ if state.descriptor != descriptor || state.completion_contract != contract {
+ return Err(invalid("Dot immutable provider authority changed"));
+ }
+ state
+ .tools
+ .verify_tool_set(&catalog)
+ .map_err(|e| invalid(e.to_string()))?;
+ } else {
+ let mut tools = ProviderToolBridge::default();
+ tools.prepare(catalog).map_err(|e| invalid(e.to_string()))?;
+ self.state = Some(State {
+ schema: SCHEMA.to_owned(),
+ run_id: self.config.run_id.clone(),
+ session_id: self.config.normalized_session_id.clone(),
+ turn_id: self.config.turn_id.clone(),
+ descriptor,
+ completion_contract: contract,
+ tools,
+ lifecycle: "prepared".to_owned(),
+ assignment_revision: 1,
+ text: None,
+ operations: BTreeMap::new(),
+ completion: None,
+ completion_input: None,
+ events: VecDeque::new(),
+ next_event: 1,
+ });
+ }
+ Ok(json!({"status":"prepared","provider":"openai_dot","driver":"openai_dot_mcp"}))
+ }
+
+ fn operation(&mut self, value: &Value) -> Result {
+ let op: Operation = serde_json::from_value(value.clone())
+ .map_err(|_| invalid("Dot operation is malformed"))?;
+ let state = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ state.validate_operation(&op)?;
+ // Current authority is checked before replay, so a receipt cannot revive a fenced turn.
+ let now = crate::durable::current_unix_ms()?;
+ if now >= state.descriptor.expires_at_unix_ms
+ || matches!(state.lifecycle.as_str(), "fenced" | "closed")
+ {
+ return Err(invalid("Dot assignment authority is fenced or expired"));
+ }
+ if let Some(existing) = state.operations.get(&op.request_id) {
+ if existing.operation != op {
+ return Err(invalid("Dot requestId was reused with different input"));
+ }
+ return Ok(existing.outcome.clone());
+ }
+ if state.operations.len() >= MAX_OPERATIONS {
+ return Err(invalid("Dot operation capacity reached"));
+ }
+ let id = op.request_id.clone();
+ state.operations.insert(
+ id.clone(),
+ Receipt {
+ operation: op.clone(),
+ outcome: json!({"status":"pending"}),
+ },
+ );
+ let outcome = match op.action.as_str() {
+ "accept" => {
+ if state.lifecycle != "offered" || now >= state.descriptor.accept_by_unix_ms {
+ return Err(invalid("Dot assignment is unavailable for acceptance"));
+ }
+ state.lifecycle = "running".to_owned();
+ state.push("turn.started", json!({"provider":"openai_dot","providerTurnId":state.turn_id,"turnId":state.turn_id}))?;
+ json!({"status":"accepted"})
+ }
+ "tool" => {
+ if state.lifecycle != "running" {
+ return Err(invalid("Dot must accept before using tools"));
+ }
+ if state.completion.is_some() {
+ return Err(invalid("Dot completion was already accepted"));
+ }
+ let tool = op.input["name"]
+ .as_str()
+ .ok_or_else(|| invalid("Dot tool name is missing"))?;
+ let args = op.input["arguments"].clone();
+ state
+ .tools
+ .begin_call(id.clone(), tool.to_owned(), args.clone())
+ .map_err(|e| invalid(e.to_string()))?;
+ state.push("semantic_tool.input", json!({"semantic_tool":{
+ "schema":"paperclip.prp.semantic_tool.v1","schemaVersion":1,"phase":"input",
+ "operationId":tool,"callId":id,"idempotencyKey":id,
+ "correlation":{"runId":state.run_id,"normalizedSessionId":state.session_id,"turnId":state.turn_id,"itemId":self.config.item_id},
+ "content":{"digest":semantic_value_digest(&args),"redactionDisposition":"digest_only","references":[]},"input":args}}))?;
+ // ACK releases the command lane. semantic_tool.result settles this operation later.
+ return Ok(json!({"status":"pending","requestId":id}));
+ }
+ "renew" => {
+ let expiry = op.input["expiresAtUnixMs"]
+ .as_u64()
+ .ok_or_else(|| invalid("Dot renewal expiry missing"))?;
+ if state.lifecycle != "running"
+ || expiry <= now
+ || expiry > now + 2 * 60 * 60 * 1000
+ || expiry > state.descriptor.accept_by_unix_ms + 24 * 60 * 60 * 1000
+ {
+ return Err(invalid("Dot renewal exceeds current authority bounds"));
+ }
+ state.descriptor.expires_at_unix_ms = expiry;
+ json!({"status":"renewed","expiresAtUnixMs":expiry})
+ }
+ "progress" => {
+ if state.lifecycle != "running" {
+ return Err(invalid("Dot turn is not running"));
+ }
+ let text = op.input["text"]
+ .as_str()
+ .filter(|s| !s.is_empty() && s.len() <= 12000)
+ .ok_or_else(|| invalid("Dot progress must be bounded text"))?;
+ state.push("item.completed", json!({"provider":"openai_dot","item":{"id":id,"type":"agentMessage","text":text,"phase":"commentary"}}))?;
+ json!({"status":"completed"})
+ }
+ "finish" => {
+ if state.lifecycle != "running" || state.tools.pending_calls().next().is_some() {
+ return Err(invalid("Dot cannot finish with unsettled tool calls"));
+ }
+ let submitted = &op.input["result"];
+ if state.completion.as_ref() != Some(submitted)
+ && state.completion_input.as_ref() != Some(submitted)
+ {
+ return Err(invalid("Dot must successfully invoke paperclip_finish or paperclip_block with this result first"));
+ }
+ let result = state
+ .completion
+ .clone()
+ .ok_or_else(|| invalid("Dot completion is missing"))?;
+ state.lifecycle = "completed".to_owned();
+ state
+ .tools
+ .settle_turn("completed")
+ .map_err(|e| invalid(e.to_string()))?;
+ state.push("run.result.proposed", result.clone())?;
+ state.push("item.completed", json!({"provider":"openai_dot","item":{"id":id,"type":"agentMessage","text":result["summary"],"phase":"final_answer"}}))?;
+ state.push("turn.completed", json!({"provider":"openai_dot","providerTurnId":state.turn_id,"status":"completed"}))?;
+ state.push("run.terminal", json!({"schema":"paperclip.prp.terminal.v1","turnTerminalState":"completed","runTerminalState":"succeeded","reportedWorkDisposition":result["reportedWorkDisposition"]}))?;
+ json!({"status":"completed"})
+ }
+ _ => return Err(invalid("Dot action is unsupported")),
+ };
+ state.settle(&id, outcome.clone())?;
+ Ok(outcome)
+ }
+
+ fn apply_tool_result(&mut self, payload: &Value) -> Result {
+ let result: ToolResult = serde_json::from_value(payload.clone())
+ .map_err(|_| invalid("Dot semantic result is invalid"))?;
+ let state = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ state
+ .tools
+ .apply_result(result.clone())
+ .map_err(|e| invalid(e.to_string()))?;
+ let receipt = state
+ .operations
+ .get(&result.call_id)
+ .ok_or_else(|| invalid("Dot semantic receipt is missing"))?;
+ if receipt.operation.action != "tool"
+ || receipt.operation.input["name"] != result.operation_id
+ {
+ return Err(invalid("Dot semantic receipt does not match the tool call"));
+ }
+ if matches!(
+ result.operation_id.as_str(),
+ "paperclip_finish" | "paperclip_block"
+ ) && !result.is_error
+ && result
+ .result
+ .get("outcome")
+ .and_then(Value::as_str)
+ .is_none_or(|o| matches!(o, "completed" | "succeeded" | "success"))
+ {
+ // The control plane normalizes provider aliases and optional fields.
+ // Persist that exact accepted report; do not revalidate raw arguments
+ // against a different contract. Legacy canonical receipts still work.
+ let accepted_input = receipt.operation.input["arguments"].clone();
+ let mut completion = result
+ .result
+ .get("completionReport")
+ .cloned()
+ .unwrap_or_else(|| accepted_input.clone());
+ completion["schema"] = json!("paperclip.run_result.v1");
+ let schema: Value = serde_json::from_str(include_str!(
+ "../../../../protocol/schemas/result.schema.json"
+ ))
+ .map_err(|_| invalid("Dot result schema is unavailable"))?;
+ let validator = jsonschema::validator_for(&schema)
+ .map_err(|_| invalid("Dot result schema is invalid"))?;
+ let criterion_ids = completion
+ .pointer("/completionClaim/criteria")
+ .and_then(Value::as_array)
+ .map(|items| {
+ items
+ .iter()
+ .filter_map(|i| i["criterionId"].as_str().map(str::to_owned))
+ .collect::>()
+ })
+ .unwrap_or_default();
+ let mut expected = state.completion_contract.criterion_ids.clone();
+ let mut actual = criterion_ids.clone();
+ expected.sort();
+ actual.sort();
+ if !validator.is_valid(&completion)
+ || completion.pointer("/completionClaim/contractRevision")
+ != Some(&json!(state.completion_contract.revision))
+ || actual != expected
+ {
+ return Err(invalid(
+ "Dot completion does not match the admitted contract",
+ ));
+ }
+ state.completion = Some(completion);
+ state.completion_input = Some(accepted_input);
+ }
+ let outcome =
+ json!({"status":"completed","isError":result.is_error,"result":result.result});
+ // Identical semantic result retries do not produce another mailbox wakeup.
+ if state.operations[&result.call_id].outcome != outcome {
+ state.settle(&result.call_id, outcome)?;
+ }
+ Ok(json!({"status":"delivered","callId":result.call_id}))
+ }
+
+ fn execute_inner(&mut self, command: &Command) -> Result {
+ match command.command_type.as_str() {
+ "run.prepare" => self.prepare(&command.payload),
+ "run.attach" => {
+ self.prepare(&command.payload)?;
+ self.execute_inner(&Command {
+ command_type: "session.open".to_owned(),
+ ..command.clone()
+ })
+ }
+ "external_provider.operation" => self.operation(&command.payload),
+ "semantic_tool.result" => self.apply_tool_result(&command.payload),
+ "session.open" => {
+ let s = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ if s.lifecycle == "prepared" {
+ s.lifecycle = "open".to_owned();
+ s.push("session.started", json!({"provider":"openai_dot","driver":"openai_dot_mcp","providerVersion":"dot-mcp-v1",
+ "driverSessionId":s.session_id,"providerSessionId":null,"sessionId":s.session_id,"model":null,
+ "providerDescriptor":{"provider":"openai_dot","driver":"openai_dot_mcp","executionKind":"remote_service","service":"openai_dot","model":null,"providerVersion":"unknown","providerSessionId":null,"processId":null}}))?;
+ }
+ Ok(
+ json!({"status":"started","driverSessionId":s.session_id,"providerSessionId":null}),
+ )
+ }
+ "turn.start" => {
+ let s = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ let text = command.payload["text"]
+ .as_str()
+ .filter(|s| !s.is_empty() && s.len() <= 1024 * 1024)
+ .ok_or_else(|| invalid("Dot task text must be bounded"))?;
+ if s.lifecycle == "offered" && s.text.as_deref() == Some(text) {
+ return Ok(json!({"status":"offered","providerTurnId":s.turn_id}));
+ }
+ if s.lifecycle != "open" {
+ return Err(invalid("Dot cannot start another active assignment"));
+ }
+ s.tools.prepare_turn().map_err(|e| invalid(e.to_string()))?;
+ s.lifecycle = "offered".to_owned();
+ s.text = Some(text.to_owned());
+ s.push("external_provider.dispatch_requested", json!({"binding":s.binding(),"text":text,
+ "instructions":s.descriptor.instructions,"acceptByUnixMs":s.descriptor.accept_by_unix_ms,
+ "expiresAtUnixMs":s.descriptor.expires_at_unix_ms,"completionContract":s.completion_contract,
+ "tools":s.tools.authorized_tools().collect::>()}))?;
+ Ok(json!({"status":"offered","providerTurnId":s.turn_id}))
+ }
+ "session.snapshot" => {
+ let s = self
+ .state
+ .as_ref()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ Ok(
+ json!({"status":s.lifecycle,"provider":"openai_dot","driver":"openai_dot_mcp","driverSessionId":s.session_id,
+ "providerSessionId":null,"activeProviderTurnId":if matches!(s.lifecycle.as_str(), "offered" | "running") {Some(&s.turn_id)} else {None},
+ "operationCount":s.operations.len(),"pendingTools":s.tools.pending_calls().count(),"binding":s.binding()}),
+ )
+ }
+ "turn.stop" | "turn.interrupt" | "run.cancel" => {
+ let s = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ if !matches!(s.lifecycle.as_str(), "completed" | "fenced" | "closed") {
+ s.lifecycle = "fenced".to_owned();
+ s.tools
+ .settle_turn("authority_revoked")
+ .map_err(|e| invalid(e.to_string()))?;
+ s.push("external_provider.dispatch_requested", json!({"binding":s.binding(),"kind":"authority_revoked","externalStopConfirmed":false}))?;
+ s.push("turn.cancelled", json!({"provider":"openai_dot","providerTurnId":s.turn_id,"externalStopConfirmed":false}))?;
+ s.push("run.terminal", json!({"schema":"paperclip.prp.terminal.v1","turnTerminalState":"cancelled","runTerminalState":"cancelled","reportedWorkDisposition":"needs_review"}))?;
+ }
+ Ok(
+ json!({"status":"authority_revoked","externalStopConfirmed":false,"unsettledTools":s.tools.pending_calls().count()}),
+ )
+ }
+ "session.close" | "session.destroy" => {
+ let s = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot is not prepared"))?;
+ if !matches!(
+ s.lifecycle.as_str(),
+ "completed" | "fenced" | "open" | "closed"
+ ) || s.tools.pending_calls().next().is_some()
+ {
+ return Err(invalid("Dot session has unsettled work"));
+ }
+ s.lifecycle = "closed".to_owned();
+ Ok(json!({"status":"closed","externalStopConfirmed":false}))
+ }
+ "runner.suspend" | "runner.shutdown" | "runner.drain" => {
+ Ok(json!({"status":"completed","externalStopConfirmed":false}))
+ }
+ _ => Ok(json!({"status":"rejected","code":"provider_command_unavailable"})),
+ }
+ }
+}
+
+impl CommandExecutor for DotCommandExecutor {
+ fn execute(&mut self, command: &Command) -> Result {
+ self.restore()?;
+ let prior = self.state.clone();
+ let outcome = self.execute_inner(command).and_then(|result| {
+ self.save()?;
+ Ok(CommandExecution::result(result))
+ });
+ if outcome.is_err() {
+ self.state = prior;
+ }
+ outcome
+ }
+ fn rotate_authority(&mut self, config: &DurableRunnerConfig) {
+ self.config = config.clone();
+ }
+ fn poll_events(&mut self) -> Result, DurableRunnerError> {
+ self.restore()?;
+ let now = crate::durable::current_unix_ms()?;
+ let expired = self.state.as_ref().is_some_and(|s| {
+ (s.lifecycle == "offered" && now >= s.descriptor.accept_by_unix_ms)
+ || (s.lifecycle == "running" && now >= s.descriptor.expires_at_unix_ms)
+ });
+ if expired {
+ let prior = self.state.clone();
+ let s = self.state.as_mut().unwrap();
+ s.lifecycle = "fenced".to_owned();
+ let expiry = (|| -> Result<(), DurableRunnerError> {
+ s.tools.settle_turn("authority_expired").map_err(|e| invalid(e.to_string()))?;
+ s.push("external_provider.dispatch_requested", json!({"binding":s.binding(),"kind":"authority_revoked","reason":"authority_expired","externalStopConfirmed":false}))?;
+ s.push("turn.failed", json!({"provider":"openai_dot","providerTurnId":s.turn_id,"error":{"code":"dot_assignment_expired","message":"Dot assignment acceptance or execution authority expired."}}))?;
+ s.push("run.terminal", json!({"schema":"paperclip.prp.terminal.v1","turnTerminalState":"failed","runTerminalState":"failed","reportedWorkDisposition":"needs_review"}))?;
+ Ok(())
+ })().and_then(|_| self.save());
+ if let Err(error) = expiry {
+ self.state = prior;
+ return Err(error);
+ }
+ }
+ Ok(self
+ .state
+ .as_ref()
+ .map(|s| s.events.iter().take(128).cloned().collect())
+ .unwrap_or_default())
+ }
+ fn retained_events(&mut self) -> Result, DurableRunnerError> {
+ self.restore()?;
+ Ok(self
+ .state
+ .as_ref()
+ .map(|s| s.events.iter().cloned().collect())
+ .unwrap_or_default())
+ }
+ fn acknowledge_events(&mut self, count: usize) -> Result<(), DurableRunnerError> {
+ if count == 0 {
+ return Ok(());
+ }
+ let s = self
+ .state
+ .as_mut()
+ .ok_or_else(|| invalid("Dot state is unavailable"))?;
+ if count > s.events.len() {
+ return Err(invalid(
+ "Dot event acknowledgement is outside the pending prefix",
+ ));
+ }
+ s.events.drain(..count);
+ self.save()
+ }
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ Ok(true)
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::provider_bridge::{authorized_tool_catalog_digest, AuthorizedTool};
+ use std::time::Duration;
+
+ struct TestDirectory(PathBuf);
+ impl TestDirectory {
+ fn new() -> Self {
+ let p =
+ std::env::temp_dir().join(format!("paperclip-dot-test-{}", uuid::Uuid::new_v4()));
+ fs::create_dir(&p).unwrap();
+ Self(p)
+ }
+ fn path(&self) -> &std::path::Path {
+ &self.0
+ }
+ }
+ impl Drop for TestDirectory {
+ fn drop(&mut self) {
+ let _ = fs::remove_dir_all(&self.0);
+ }
+ }
+ fn config(path: &std::path::Path) -> DurableRunnerConfig {
+ DurableRunnerConfig {
+ connect_url: "ws://127.0.0.1/runner".into(),
+ ca_bundle_path: None,
+ state_dir: path.to_owned(),
+ runner_instance_id: "runner-1".into(),
+ environment_lease_id: "lease-1".into(),
+ run_id: "run-1".into(),
+ normalized_session_id: "session-1".into(),
+ turn_id: "turn-1".into(),
+ item_id: "item-1".into(),
+ runner_version: "0.0.0".into(),
+ runner_digest: "sha256:test".into(),
+ acpx_launch_profile: None,
+ opencode_launch_profile: None,
+ max_outbox_bytes: 1024 * 1024,
+ p0_reserve_bytes: 65536,
+ max_frame_bytes: 1024 * 1024,
+ reconnect_delay: Duration::from_millis(1),
+ reconnect_grace: None,
+ max_runtime: Duration::from_secs(60),
+ }
+ }
+ fn command(kind: &str, payload: Value) -> Command {
+ Command {
+ schema: "paperclip.prp.command.v3".into(),
+ command_id: "test-command".into(),
+ controller_seq: 1,
+ command_type: kind.into(),
+ issued_at: "2026-10-02T00:00:00Z".into(),
+ deadline_at: None,
+ precondition: None,
+ payload,
+ }
+ }
+ fn call(executor: &mut DotCommandExecutor, kind: &str, payload: Value) -> Value {
+ executor.execute(&command(kind, payload)).unwrap().result
+ }
+ fn operation(id: &str, action: &str, input: Value) -> Value {
+ json!({"requestId":id,"bindingId":"binding-1","bindingGeneration":1,"runId":"run-1",
+ "normalizedSessionId":"session-1","turnId":"turn-1","assignmentRevision":1,
+ "digest":semantic_value_digest(&json!({"action":action,"input":input})),"action":action,"input":input})
+ }
+ fn prepared(path: &std::path::Path) -> DotCommandExecutor {
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ fs::set_permissions(path, fs::Permissions::from_mode(0o700)).unwrap();
+ }
+ let now = crate::durable::current_unix_ms().unwrap();
+ let tools = ["save_report", "paperclip_finish"]
+ .into_iter()
+ .map(|name| AuthorizedTool {
+ operation_id: name.into(),
+ version: 1,
+ description: "test".into(),
+ input_schema: json!({"type":"object"}),
+ response_schema: json!({}),
+ })
+ .collect::>();
+ let catalog = AuthorizedToolSet {
+ schema: "paperclip.runner.authorized-tools.v1".into(),
+ schema_version: 1,
+ catalog_digest: authorized_tool_catalog_digest(&tools).unwrap(),
+ operations: tools,
+ };
+ let mut executor = DotCommandExecutor::with_runner_config(path, &config(path));
+ call(
+ &mut executor,
+ "run.prepare",
+ json!({"provider":{"kind":"openai_dot","companyId":"company-1","agentId":"agent-1",
+ "bindingId":"binding-1","bindingGeneration":1,"acceptByUnixMs":now+600000,"expiresAtUnixMs":now+7200000,"instructions":"test"},
+ "completionContract":{"revision":"contract-1","criterionIds":["criterion-1"]},"authorizedTools":catalog}),
+ );
+ call(&mut executor, "session.open", json!({}));
+ call(&mut executor, "turn.start", json!({"text":"Save a report"}));
+ executor
+ }
+ fn accept(executor: &mut DotCommandExecutor) {
+ call(
+ executor,
+ "external_provider.operation",
+ operation("accept-1", "accept", json!({})),
+ );
+ }
+ #[test]
+ fn renewal_is_durable_bounded_and_cannot_revive_fenced_authority() {
+ let dir = TestDirectory::new();
+ let mut executor = prepared(dir.path());
+ call(
+ &mut executor,
+ "external_provider.operation",
+ operation("accept", "accept", json!({})),
+ );
+ let expiry = crate::durable::current_unix_ms().unwrap() + 60 * 60 * 1000;
+ let renew = operation("renew", "renew", json!({"expiresAtUnixMs":expiry}));
+ assert_eq!(
+ call(&mut executor, "external_provider.operation", renew.clone())["status"],
+ "renewed"
+ );
+ assert_eq!(
+ call(&mut executor, "external_provider.operation", renew.clone())["expiresAtUnixMs"],
+ expiry
+ );
+ assert!(executor
+ .execute(&command(
+ "external_provider.operation",
+ operation(
+ "too-long",
+ "renew",
+ json!({"expiresAtUnixMs":expiry + 24 * 60 * 60 * 1000})
+ )
+ ))
+ .is_err());
+ drop(executor);
+ let mut recovered = DotCommandExecutor::with_runner_config(dir.path(), &config(dir.path()));
+ assert_eq!(
+ call(&mut recovered, "external_provider.operation", renew)["expiresAtUnixMs"],
+ expiry
+ );
+ recovered.state.as_mut().unwrap().lifecycle = "fenced".into();
+ assert!(recovered
+ .execute(&command(
+ "external_provider.operation",
+ operation("fenced", "renew", json!({"expiresAtUnixMs":expiry}))
+ ))
+ .is_err());
+ }
+
+ #[test]
+ fn acceptance_is_explicit_and_tool_receipts_survive_restart_without_reexecution() {
+ let dir = TestDirectory::new();
+ let mut executor = prepared(dir.path());
+ assert!(!executor
+ .poll_events()
+ .unwrap()
+ .iter()
+ .any(|e| e.event_type == "turn.started"));
+ let tool = operation(
+ "write-1",
+ "tool",
+ json!({"name":"save_report","arguments":{"text":"42"}}),
+ );
+ assert!(executor
+ .execute(&command("external_provider.operation", tool.clone()))
+ .is_err());
+ accept(&mut executor);
+ assert_eq!(
+ call(&mut executor, "external_provider.operation", tool.clone())["status"],
+ "pending"
+ );
+ let events = executor.retained_events().unwrap();
+ assert_eq!(
+ events
+ .iter()
+ .filter(|e| e.event_type == "semantic_tool.input")
+ .count(),
+ 1
+ );
+ executor.acknowledge_events(events.len()).unwrap();
+ drop(executor);
+ let mut recovered = DotCommandExecutor::with_runner_config(dir.path(), &config(dir.path()));
+ assert_eq!(
+ call(&mut recovered, "external_provider.operation", tool.clone())["status"],
+ "pending"
+ );
+ assert!(recovered.poll_events().unwrap().is_empty());
+ assert!(recovered
+ .execute(&command(
+ "external_provider.operation",
+ operation(
+ "write-1",
+ "tool",
+ json!({"name":"save_report","arguments":{"text":"43"}})
+ )
+ ))
+ .is_err());
+ let result = json!({"callId":"write-1","operationId":"save_report","result":{"reportId":"one"},"isError":false});
+ call(&mut recovered, "semantic_tool.result", result.clone());
+ call(&mut recovered, "semantic_tool.result", result);
+ assert_eq!(
+ recovered
+ .poll_events()
+ .unwrap()
+ .iter()
+ .filter(|e| e.event_type == "external_provider.operation_settled")
+ .count(),
+ 1
+ );
+ assert_eq!(
+ call(&mut recovered, "external_provider.operation", tool)["result"]["reportId"],
+ "one"
+ );
+ }
+ #[test]
+ fn revoked_authority_never_replays_and_late_effect_receipts_remain_settleable() {
+ let dir = TestDirectory::new();
+ let mut e = prepared(dir.path());
+ accept(&mut e);
+ let op = operation(
+ "write-1",
+ "tool",
+ json!({"name":"save_report","arguments":{}}),
+ );
+ call(&mut e, "external_provider.operation", op.clone());
+ let stop = call(&mut e, "run.cancel", json!({}));
+ assert_eq!(stop["externalStopConfirmed"], false);
+ assert_eq!(stop["unsettledTools"], 1);
+ assert!(e
+ .execute(&command("external_provider.operation", op))
+ .is_err());
+ assert!(e.execute(&command("session.close", json!({}))).is_err());
+ call(
+ &mut e,
+ "semantic_tool.result",
+ json!({"callId":"write-1","operationId":"save_report","result":{},"isError":false}),
+ );
+ assert_eq!(call(&mut e, "session.close", json!({}))["status"], "closed");
+ }
+ #[test]
+ fn finishing_requires_the_accepted_completion_tool_and_exact_contract() {
+ let dir = TestDirectory::new();
+ let mut e = prepared(dir.path());
+ accept(&mut e);
+ let result = json!({"schema":"paperclip.run_result.v1","reportedWorkDisposition":"done","summary":"Saved report",
+ "completionClaim":{"contractRevision":"contract-1","objectiveSatisfied":true,"criteria":[{"criterionId":"criterion-1","status":"satisfied","evidenceRefs":[]}],"remainingWork":[]},
+ "evidence":[],"verification":[],"attentionRequests":[],"artifacts":[]});
+ assert!(e
+ .execute(&command(
+ "external_provider.operation",
+ operation("finish-1", "finish", json!({"result":result}))
+ ))
+ .is_err());
+ call(
+ &mut e,
+ "external_provider.operation",
+ operation(
+ "completion-1",
+ "tool",
+ json!({"name":"paperclip_finish","arguments":result}),
+ ),
+ );
+ assert!(e
+ .execute(&command(
+ "external_provider.operation",
+ operation("finish-1", "finish", json!({"result":result}))
+ ))
+ .is_err());
+ call(
+ &mut e,
+ "semantic_tool.result",
+ json!({"callId":"completion-1","operationId":"paperclip_finish","result":{"accepted":true},"isError":false}),
+ );
+ call(
+ &mut e,
+ "external_provider.operation",
+ operation("finish-1", "finish", json!({"result":result})),
+ );
+ assert_eq!(
+ e.poll_events()
+ .unwrap()
+ .iter()
+ .filter(|event| event.event_type == "run.result.proposed")
+ .count(),
+ 1
+ );
+ }
+ #[test]
+ fn normalized_completion_survives_restart_and_accepts_the_original_report() {
+ let dir = TestDirectory::new();
+ let mut e = prepared(dir.path());
+ accept(&mut e);
+ let input = json!({"reportedWorkDisposition":"completed","summary":"Saved report",
+ "completionClaim":{"contractRevision":"contract-1","objectiveSatisfied":true,"criteria":[{"criterionId":"criterion-1","status":"passed","evidenceRefs":[]}],"remainingWork":[]},
+ "evidence":[],"verification":[]});
+ let mut canonical = input.clone();
+ canonical["schema"] = json!("paperclip.run_result.v1");
+ canonical["reportedWorkDisposition"] = json!("done");
+ canonical["completionClaim"]["criteria"][0]["status"] = json!("satisfied");
+ canonical["attentionRequests"] = json!([]);
+ canonical["artifacts"] = json!([]);
+ call(
+ &mut e,
+ "external_provider.operation",
+ operation(
+ "completion-1",
+ "tool",
+ json!({"name":"paperclip_finish","arguments":input}),
+ ),
+ );
+ call(
+ &mut e,
+ "semantic_tool.result",
+ json!({"callId":"completion-1","operationId":"paperclip_finish","result":{"accepted":true,"completionReport":canonical},"isError":false}),
+ );
+ drop(e);
+ let mut e = DotCommandExecutor::with_runner_config(dir.path(), &config(dir.path()));
+ let mut changed = input.clone();
+ changed["summary"] = json!("Changed after acceptance");
+ assert!(e
+ .execute(&command(
+ "external_provider.operation",
+ operation("finish-1", "finish", json!({"result":changed}))
+ ))
+ .is_err());
+ call(
+ &mut e,
+ "external_provider.operation",
+ operation("finish-2", "finish", json!({"result":input})),
+ );
+ let events = e.poll_events().unwrap();
+ assert_eq!(
+ events
+ .iter()
+ .find(|event| event.event_type == "run.result.proposed")
+ .unwrap()
+ .payload,
+ canonical
+ );
+ }
+ #[test]
+ fn wrong_epoch_and_expired_offers_fail_closed() {
+ let dir = TestDirectory::new();
+ let mut e = prepared(dir.path());
+ let mut op = operation("accept-1", "accept", json!({}));
+ op["bindingGeneration"] = json!(2);
+ assert!(e
+ .execute(&command("external_provider.operation", op))
+ .is_err());
+ e.state.as_mut().unwrap().descriptor.accept_by_unix_ms =
+ crate::durable::current_unix_ms().unwrap() - 1;
+ assert!(e
+ .poll_events()
+ .unwrap()
+ .iter()
+ .any(|event| event.event_type == "turn.failed"));
+ assert_eq!(e.state.as_ref().unwrap().lifecycle, "fenced");
+ assert!(e
+ .execute(&command(
+ "external_provider.operation",
+ operation("accept-2", "accept", json!({}))
+ ))
+ .is_err());
+ }
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs b/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs
index 7cbe493ba05..4aa92852466 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs
@@ -27,7 +27,7 @@ pub(crate) use transport::current_unix_ms;
pub const PROTOCOL: &str = "paperclip.runner";
pub const PROTOCOL_MIN_VERSION: u64 = 1;
-pub const PROTOCOL_VERSION: u64 = 2;
+pub const PROTOCOL_VERSION: u64 = 3;
pub const BOOTSTRAP_TICKET_ENV: &str = "PAPERCLIP_RUNNER_BOOTSTRAP_TICKET";
const MAX_OUTBOX_BYTES: usize = 512 * 1024 * 1024;
const MAX_FRAME_BYTES: usize = 16 * 1024 * 1024;
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs b/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs
index 9bcb817a83e..0629c27317d 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs
@@ -1866,7 +1866,11 @@ fn process_command(
fn event_envelope_for_protocol(event: &StoredOutboxEvent, protocol_version: u64) -> Value {
let mut envelope = event.envelope.clone();
- if protocol_version == 1 && envelope.pointer("/payload/schemaVersion") == Some(&json!(2)) {
+ if envelope
+ .pointer("/payload/schemaVersion")
+ .and_then(Value::as_u64)
+ .is_some_and(|version| version > protocol_version)
+ {
// Preserve the source sequence on a v1 connection so its cumulative
// ACK can advance past an event family that only exists in PRP v2.
// Never copy the v2 payload because it can include a goal objective.
@@ -1874,7 +1878,7 @@ fn event_envelope_for_protocol(event: &StoredOutboxEvent, protocol_version: u64)
envelope["payload"]["eventType"] = json!("runner.diagnostic");
envelope["payload"]["schemaVersion"] = json!(1);
envelope["payload"]["payload"] = json!({
- "reasonCode": "event_requires_prp_v2",
+ "reasonCode": if event.envelope.pointer("/payload/schemaVersion") == Some(&json!(3)) { "event_requires_prp_v3" } else { "event_requires_prp_v2" },
"originalEventType": event.event_type,
});
}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs b/packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs
index f850217c248..8943d40f57d 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/durable/state.rs
@@ -78,12 +78,18 @@ impl Command {
let schema_version = match self.schema.as_str() {
"paperclip.prp.command.v1" => 1,
"paperclip.prp.command.v2" => 2,
+ "paperclip.prp.command.v3" => 3,
_ => {
return Err(DurableRunnerError::invalid(
"command requires a supported paperclip.prp.command schema",
));
}
};
+ if self.command_type == "external_provider.operation" && schema_version < 3 {
+ return Err(DurableRunnerError::invalid(
+ "external provider operations require PRP v3",
+ ));
+ }
if schema_version == 1 && self.command_type.starts_with("session.goal.") {
return Err(DurableRunnerError::invalid(
"session goal commands require the paperclip.prp.command.v2 schema",
@@ -150,6 +156,7 @@ impl Command {
| "session.goal.get"
| "session.goal.set"
| "session.goal.clear"
+ | "external_provider.operation"
) {
return Err(DurableRunnerError::invalid(format!(
"command type is not supported by PRP v{schema_version}"
@@ -578,7 +585,9 @@ impl DurableState {
let source_seq = self.next_source_seq;
let emitted_at = current_timestamp()?;
- let schema_version = if matches!(
+ let schema_version = if event_type.starts_with("external_provider.") {
+ 3
+ } else if matches!(
event_type.as_str(),
"session.capabilities.updated"
| "session.goal.snapshot"
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs
index 058ed3bd392..61a8e8d0d1f 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs
@@ -29,7 +29,7 @@ pub(crate) fn acpx_release_profile(agent: &str) -> Option {
agent_runtime_package: Some("@earendil-works/pi-coding-agent"),
agent_runtime_version: Some("1.0.0"),
command_digest:
- "sha256:b7647ebf97f802ca053ec3384c912bf0e8d18eba308d27397bb1d95a37220825",
+ "sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e",
requires_provider_policy: true,
},
"cursor" => AcpxReleaseProfile {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/lib.rs b/packages/paperclip-runner/runner/crates/runner-core/src/lib.rs
index ab2e2774dfa..5bf0bacf0a3 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/lib.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/lib.rs
@@ -12,6 +12,8 @@ pub mod aws_agentcore_provider;
pub mod claude_managed_provider;
pub mod codex_provider;
mod codex_startup_trust;
+mod configured_environment;
+pub mod dot_provider_backend;
pub mod durable;
pub mod fake_harness;
mod generated_acpx_profiles;
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs
index 7bc424c5c89..f0c6882ecd2 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs
@@ -3,6 +3,7 @@ use std::path::PathBuf;
use serde_json::Value;
use crate::acpx_provider_backend::{AcpxCommandExecutor, ACPX_PROVIDER_STATE_FILE};
+use crate::dot_provider_backend::{DotCommandExecutor, DOT_PROVIDER_STATE_FILE};
use crate::durable::{
Command, CommandExecution, CommandExecutor, DurableRunnerConfig, DurableRunnerError,
PolledEvent, TerminalDeliveryReconciliation,
@@ -16,6 +17,7 @@ enum SelectedExecutor {
LocalFacade(CodexCommandExecutor),
Acpx(AcpxCommandExecutor),
Managed(ManagedProviderCommandExecutor),
+ Dot(DotCommandExecutor),
}
impl CommandExecutor for SelectedExecutor {
@@ -24,6 +26,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.can_reconcile_result_delivery(),
Self::Acpx(executor) => executor.can_reconcile_result_delivery(),
Self::Managed(executor) => executor.can_reconcile_result_delivery(),
+ Self::Dot(executor) => executor.can_reconcile_result_delivery(),
}
}
@@ -32,6 +35,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.retained_events(),
Self::Acpx(executor) => executor.retained_events(),
Self::Managed(executor) => executor.retained_events(),
+ Self::Dot(executor) => executor.retained_events(),
}
}
fn execute(&mut self, command: &Command) -> Result {
@@ -39,6 +43,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.execute(command),
Self::Acpx(executor) => executor.execute(command),
Self::Managed(executor) => executor.execute(command),
+ Self::Dot(executor) => executor.execute(command),
}
}
@@ -47,6 +52,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.poll_events(),
Self::Acpx(executor) => executor.poll_events(),
Self::Managed(executor) => executor.poll_events(),
+ Self::Dot(executor) => executor.poll_events(),
}
}
@@ -55,6 +61,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.rotate_authority(config),
Self::Acpx(executor) => executor.rotate_authority(config),
Self::Managed(executor) => executor.rotate_authority(config),
+ Self::Dot(executor) => executor.rotate_authority(config),
}
}
@@ -63,6 +70,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.maintain_backpressured_provider(),
Self::Acpx(executor) => executor.maintain_backpressured_provider(),
Self::Managed(executor) => executor.maintain_backpressured_provider(),
+ Self::Dot(executor) => executor.maintain_backpressured_provider(),
}
}
@@ -71,6 +79,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.acknowledge_events(count),
Self::Acpx(executor) => executor.acknowledge_events(count),
Self::Managed(executor) => executor.acknowledge_events(count),
+ Self::Dot(executor) => executor.acknowledge_events(count),
}
}
@@ -81,6 +90,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.reconcile_terminal_delivery(),
Self::Acpx(executor) => executor.reconcile_terminal_delivery(),
Self::Managed(executor) => executor.reconcile_terminal_delivery(),
+ Self::Dot(executor) => executor.reconcile_terminal_delivery(),
}
}
@@ -89,6 +99,7 @@ impl CommandExecutor for SelectedExecutor {
Self::LocalFacade(executor) => executor.shutdown(),
Self::Acpx(executor) => executor.shutdown(),
Self::Managed(executor) => executor.shutdown(),
+ Self::Dot(executor) => executor.shutdown(),
}
}
}
@@ -121,7 +132,8 @@ impl NativeProviderCommandExecutor {
let codex = self.state_dir.join(CODEX_PROVIDER_STATE_FILE).exists();
let acpx = self.state_dir.join(ACPX_PROVIDER_STATE_FILE).exists();
let managed = self.state_dir.join(MANAGED_PROVIDER_STATE_FILE).exists();
- if [codex, acpx, managed]
+ let dot = self.state_dir.join(DOT_PROVIDER_STATE_FILE).exists();
+ if [codex, acpx, managed, dot]
.into_iter()
.filter(|present| *present)
.count()
@@ -131,7 +143,11 @@ impl NativeProviderCommandExecutor {
"runner state contains conflicting provider authorities",
));
}
- self.selected = if managed {
+ self.selected = if dot {
+ Some(SelectedExecutor::Dot(
+ DotCommandExecutor::with_runner_config(&self.state_dir, &self.config),
+ ))
+ } else if managed {
Some(SelectedExecutor::Managed(
ManagedProviderCommandExecutor::with_runner_config(&self.state_dir, &self.config),
))
@@ -159,6 +175,10 @@ impl NativeProviderCommandExecutor {
)
})?;
self.selected = Some(match kind {
+ "openai_dot" => SelectedExecutor::Dot(DotCommandExecutor::with_runner_config(
+ &self.state_dir,
+ &self.config,
+ )),
"codex" | "opencode" => SelectedExecutor::LocalFacade(
CodexCommandExecutor::with_runner_config(&self.state_dir, &self.config),
),
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/process_supervisor.rs b/packages/paperclip-runner/runner/crates/runner-core/src/process_supervisor.rs
index 32532ad25fd..372c96ea323 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/process_supervisor.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/process_supervisor.rs
@@ -1038,6 +1038,9 @@ impl SupervisedProcess {
command.env(key, value);
}
}
+ crate::configured_environment::apply_configured_environment(&mut command, |key| {
+ std::env::var(key).ok()
+ })?;
if let Some(executable) = verified_runtime_executable {
// Node reports a sealed memfd launch as `/memfd:... (deleted)` via
// process.execPath. Give descriptor-loaded runtimes the inherited,
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs
index da242689858..23268296bd6 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/provider_backend.rs
@@ -538,11 +538,13 @@ fn admit_terminal_tool_authority(
"paperclip_finish" => {
matches!(disposition.as_str(), "done" | "needs_review")
|| (disposition == "yielded"
- && input
- .get("continuation")
- .and_then(|continuation| continuation.get("kind"))
- .and_then(Value::as_str)
- == Some("response_wake"))
+ && matches!(
+ input
+ .get("continuation")
+ .and_then(|continuation| continuation.get("kind"))
+ .and_then(Value::as_str),
+ Some("response_wake" | "monitor")
+ ))
}
"paperclip_block" => disposition == "blocked",
_ => false,
@@ -4902,8 +4904,9 @@ mod tests {
assert_eq!(finish_result.result["error"]["code"], "invalid_tool_call");
assert_eq!(finish_result.result["error"]["retryable"], false);
let finish_message = finish_result.result["error"]["message"].as_str().unwrap();
- assert!(finish_message
- .contains("continuation must include kind=response_wake, summary, and idempotencyKey"));
+ assert!(finish_message.contains(
+ "continuation must include kind=response_wake or monitor, summary, and idempotencyKey"
+ ));
assert!(finish_message.contains("/required (missing \"requiredField\")"));
assert!(finish_message.contains("/additionalProperties"));
assert!(!finish_message.contains("secretSubmittedValue"));
@@ -5170,6 +5173,25 @@ mod tests {
assert!(state.validate().is_ok());
}
+ #[test]
+ fn accepted_terminal_tool_preserves_an_explicit_monitor_wait() {
+ let mut state = opencode_result_state();
+ let mut result = valid_opencode_result();
+ result["reportedWorkDisposition"] = json!("yielded");
+ result["continuation"] = json!({
+ "kind": "monitor",
+ "summary": "Wait for the scheduled check.",
+ "idempotencyKey": "monitor-1"
+ });
+
+ admit_terminal_tool_authority(&mut state, "paperclip_finish", &result, false).unwrap();
+ let terminal = terminal_events(&state, "turn.completed", None);
+
+ assert_eq!(terminal.len(), 1);
+ assert_eq!(terminal[0].payload["reportedWorkDisposition"], "yielded");
+ assert!(state.validate().is_ok());
+ }
+
#[test]
fn terminal_tool_authority_rejects_an_unbound_yield() {
let mut state = opencode_result_state();
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs b/packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs
index aa6bdc3ee7d..cbb991f8a3b 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/provider_bridge.rs
@@ -39,7 +39,7 @@ const MAX_SETTLED_CALL_IDS: usize = 65_536;
const REPLAY_FILTER_WORDS: usize = 32_768;
const ACTIVE_TURN_RECEIPT_LIMIT_MESSAGE: &str =
"durable provider tool receipt limit reached for the active turn";
-const COMPLETION_INPUT_SCHEMA_HINT: &str = "Invalid paperclip_finish arguments. Required fields: reportedWorkDisposition, summary, completionClaim, evidence, and verification. When reportedWorkDisposition is yielded, continuation must include kind=response_wake, summary, and idempotencyKey.";
+const COMPLETION_INPUT_SCHEMA_HINT: &str = "Invalid paperclip_finish arguments. Required fields: reportedWorkDisposition, summary, completionClaim, evidence, and verification. When reportedWorkDisposition is yielded, continuation must include kind=response_wake or monitor, summary, and idempotencyKey.";
const QUESTION_INPUT_SCHEMA_HINT: &str = "Invalid request_human_input arguments. Required fields: idempotencyKey, interactionKind, title, prompt, and continuationPolicy. For questions, use payload.version=1 and a complete payload.questionSet matching the authorized schema. Preserve the supplied question and option IDs.";
const BLOCK_INPUT_SCHEMA_HINT: &str = "Invalid paperclip_block arguments. Required fields: reportedWorkDisposition=blocked, summary, completionClaim, evidence, verification, and blocker. blocker must include reasonCode, owner, unblockAction, and scope.";
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/replay.rs b/packages/paperclip-runner/runner/crates/runner-core/src/replay.rs
index af080f6d264..4310739d911 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/replay.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/replay.rs
@@ -6,10 +6,9 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
pub const PRP_PROTOCOL_MIN_VERSION: u64 = 1;
-pub const PRP_PROTOCOL_VERSION: u64 = 2;
+pub const PRP_PROTOCOL_VERSION: u64 = 3;
const PRP_FIXTURE_VERSION: u64 = 1;
const PRP_FIXTURE_SCHEMA: &str = "paperclip.prp.fixture.v1";
-const PRP_EVENT_SCHEMA: &str = "paperclip.prp.event.v1";
const PRP_SEMANTIC_TOOL_SCHEMA: &str = "paperclip.prp.semantic_tool.v1";
const PRP_STOP_REASON_SCHEMA: &str = "paperclip.prp.stop_reason.v1";
const PRP_SEMANTIC_TOOLS_CAPABILITY_SCHEMA: &str = "paperclip.prp.semantic_tools.v1";
@@ -143,15 +142,16 @@ pub fn reduce_replay_fixture(input: &str) -> Result fixture.protocol_version {
return Err(ReplayError::invalid(format!(
- "unsupported required event schemaVersion {}; expected 1",
+ "unsupported required event schemaVersion {}; exceeds negotiated version",
event.schema_version
)));
}
@@ -341,10 +341,10 @@ mod tests {
let error = reduce_replay_fixture(include_str!(
"../../../../protocol/fixtures/replay/unsupported-required-version.json"
))
- .expect_err("PRP v3 fixture must fail closed");
+ .expect_err("PRP v4 fixture must fail closed");
assert!(error
.to_string()
- .contains("unsupported required protocolVersion 3"));
+ .contains("unsupported required protocolVersion 4"));
}
#[test]
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs
index 9ce5ca9f4a1..b8c2e6b157d 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs
@@ -17,7 +17,7 @@ use sha2::{Digest, Sha256};
const CODEX_ACPX_DIGEST: &str =
"sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3";
const PI_ACPX_DIGEST: &str =
- "sha256:b7647ebf97f802ca053ec3384c912bf0e8d18eba308d27397bb1d95a37220825";
+ "sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e";
fn temporary_directory(label: &str) -> PathBuf {
let nonce = SystemTime::now()
diff --git a/packages/paperclip-runner/scripts/build-provider-pack.mjs b/packages/paperclip-runner/scripts/build-provider-pack.mjs
index f406f4300d2..b9078a21a80 100644
--- a/packages/paperclip-runner/scripts/build-provider-pack.mjs
+++ b/packages/paperclip-runner/scripts/build-provider-pack.mjs
@@ -101,21 +101,6 @@ function writePortableNodeShim(name, entrypoint) {
chmodSync(shimPath, 0o755);
}
-function writePortableExecutableShim(name, executable) {
- const shimPath = join(temporaryRoot, "node_modules", ".bin", name);
- writeFileSync(
- shimPath,
- [
- "#!/bin/sh",
- "set -eu",
- 'basedir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)',
- `exec "$basedir/../${executable}" "$@"`,
- "",
- ].join("\n"),
- );
- chmodSync(shimPath, 0o755);
-}
-
try {
const deployed = spawnSync(
"pnpm",
@@ -204,11 +189,13 @@ try {
`@anthropic-ai/claude-agent-sdk-${process.platform}-${process.arch}/claude`,
);
writePortableExecutableShim(
+ temporaryRoot,
"claude",
relative(realpathSync(join(temporaryRoot, "node_modules")), realpathSync(claudeExecutable)),
);
- writePortableExecutableShim("node", "node/bin/node");
- writePortableExecutableShim("opencode", "opencode-ai/bin/opencode.exe");
+ writePortableExecutableShim(temporaryRoot, "node", "node/bin/node");
+ writePortableExecutableShim(temporaryRoot, "opencode", "opencode-ai/bin/opencode.exe");
+ writePortableCopilotShims(temporaryRoot);
writePortableNodeShim("acpx", "acpx/dist/cli.js");
writePortableNodeShim(
"claude-agent-acp",
diff --git a/packages/paperclip-runner/scripts/generate-acpx-profiles.mjs b/packages/paperclip-runner/scripts/generate-acpx-profiles.mjs
index ff5a4abf51b..0329d031c65 100644
--- a/packages/paperclip-runner/scripts/generate-acpx-profiles.mjs
+++ b/packages/paperclip-runner/scripts/generate-acpx-profiles.mjs
@@ -39,7 +39,7 @@ const { commandDigest, ...attestation } = contract;
assert.equal(commandDigest, `sha256:${createHash("sha256").update(canonicalJson(attestation)).digest("hex")}`);
assert.equal(contract.acpxPatchSha256, createHash("sha256")
.update(await readFile(new URL("../../patches/acpx@0.13.1.patch", root))).digest("hex"));
-for (const [agent, path] of [["pi", "test-fixtures/pi-acp/profile-v19-identity.json"], ["copilot", "test/fixtures/copilot-profile-v16-identity.json"]]) {
+for (const [agent, path] of [["pi", "test-fixtures/pi-acp/profile-v20-identity.json"], ["copilot", "test/fixtures/copilot-profile-v16-identity.json"]]) {
const identity = await readJson(path);
assert.equal(manifest.profiles[agent].agentProfileVersion, identity.declaration.agentProfileVersion);
assert.equal(manifest.profiles[agent].commandDigest, identity.commandDigest);
diff --git a/packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs b/packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs
index f65c4da2b6f..2ef2b214ab1 100644
--- a/packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs
+++ b/packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs
@@ -16,8 +16,10 @@ const schemaNames = [
"identity",
"capabilities",
"capabilities-v2",
+ "capabilities-v3",
"command",
"command-v2",
+ "command-v3",
"provider-descriptor",
"provider-event",
"workspace-diff",
@@ -33,6 +35,7 @@ const schemaNames = [
"result",
"event",
"event-v2",
+ "event-v3",
"session-goal",
"fixture",
];
@@ -66,6 +69,7 @@ const standaloneValidators = standaloneCode(ajv, {
fixtureValidator: schemaByName.fixture.$id,
eventValidator: schemaByName.event.$id,
eventV2Validator: schemaByName["event-v2"].$id,
+ eventV3Validator: schemaByName["event-v3"].$id,
resultValidator: schemaByName.result.$id,
});
const ucs2RuntimePattern = /const (func\d+) = require\("ajv\/dist\/runtime\/ucs2length"\)\.default;/;
diff --git a/packages/paperclip-runner/scripts/protocol-contract.mjs b/packages/paperclip-runner/scripts/protocol-contract.mjs
index e1865aac5fa..25342ee9c7e 100644
--- a/packages/paperclip-runner/scripts/protocol-contract.mjs
+++ b/packages/paperclip-runner/scripts/protocol-contract.mjs
@@ -10,7 +10,7 @@ export const PRP_SCHEMA_ID_PREFIX = "https://paperclip.dev/schemas/prp/";
export const PRP_V1_SCHEMA_ID_PREFIX = `${PRP_SCHEMA_ID_PREFIX}v1/`;
export const SUPPORTED_FIXTURE_VERSION = 1;
export const MIN_SUPPORTED_PROTOCOL_VERSION = 1;
-export const SUPPORTED_PROTOCOL_VERSION = 2;
+export const SUPPORTED_PROTOCOL_VERSION = 3;
export const SUPPORTED_EVENT_SCHEMA_VERSION = 1;
function contractError(code, detail) {
@@ -136,6 +136,9 @@ export function compileProtocolValidators(schemaRecords) {
capabilitiesV2: getVersioned(2, "capabilities"),
commandV2: getVersioned(2, "command"),
eventV2: getVersioned(2, "event"),
+ capabilitiesV3: getVersioned(3, "capabilities"),
+ commandV3: getVersioned(3, "command"),
+ eventV3: getVersioned(3, "event"),
};
}
@@ -178,11 +181,11 @@ export function assertReplayFixtureCompatibility(fixture) {
requireVersion(fixture.fixtureVersion, SUPPORTED_FIXTURE_VERSION, "fixtureVersion");
requireSupportedProtocolVersion(fixture.protocolVersion);
requireSchema(fixture.identity, "paperclip.prp.identity.v1", "identity");
- requireSchema(fixture.capabilities, "paperclip.prp.capabilities.v1", "capabilities");
+ if (!/^paperclip\.prp\.capabilities\.v[1-3]$/.test(fixture.capabilities?.schema)) throw contractError("unsupported_required_schema", "capabilities");
if (!Array.isArray(fixture.commands)) throw contractError("invalid_fixture", "commands must be an array");
for (const [index, command] of fixture.commands.entries()) {
- if (command?.schema !== "paperclip.prp.command.v1" && command?.schema !== "paperclip.prp.command.v2") {
+ if (command?.schema !== "paperclip.prp.command.v1" && command?.schema !== "paperclip.prp.command.v2" && command?.schema !== "paperclip.prp.command.v3") {
throw contractError("unsupported_required_schema", `commands[${index}] requires ${String(command?.schema)}`);
}
}
@@ -191,8 +194,8 @@ export function assertReplayFixtureCompatibility(fixture) {
throw contractError("invalid_fixture", "events must be a non-empty array");
}
for (const [index, event] of fixture.events.entries()) {
- requireSchema(event, "paperclip.prp.event.v1", `events[${index}]`);
- requireVersion(event.schemaVersion, SUPPORTED_EVENT_SCHEMA_VERSION, `events[${index}].schemaVersion`);
+ if (![1, 2, 3].includes(event.schemaVersion) || event.schemaVersion > fixture.protocolVersion) throw contractError("unsupported_required_version", `events[${index}].schemaVersion`);
+ requireSchema(event, `paperclip.prp.event.v${event.schemaVersion}`, `events[${index}]`);
const semanticToolVersion = event.payload?.semantic_tool?.schemaVersion;
if (semanticToolVersion !== undefined) {
requireVersion(semanticToolVersion, 1, `events[${index}].payload.semantic_tool.schemaVersion`);
diff --git a/packages/paperclip-runner/scripts/provider-pack-executable-shims.mjs b/packages/paperclip-runner/scripts/provider-pack-executable-shims.mjs
new file mode 100644
index 00000000000..49e5ffbe19c
--- /dev/null
+++ b/packages/paperclip-runner/scripts/provider-pack-executable-shims.mjs
@@ -0,0 +1,34 @@
+import { chmodSync, existsSync, realpathSync, writeFileSync } from "node:fs";
+import { createRequire } from "node:module";
+import { join, relative } from "node:path";
+
+export function writePortableExecutableShim(packRoot, name, executable) {
+ const shimPath = join(packRoot, "node_modules", ".bin", name);
+ writeFileSync(
+ shimPath,
+ [
+ "#!/bin/sh",
+ "set -eu",
+ 'basedir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)',
+ `exec "$basedir/../${executable}" "$@"`,
+ "",
+ ].join("\n"),
+ );
+ chmodSync(shimPath, 0o755);
+}
+
+export function writePortableCopilotShims(packRoot) {
+ const packRequire = createRequire(join(packRoot, "package.json"));
+ // Optional platform packages expose native .bin entries. Rewrite only the
+ // installed entries, and resolve their pinned executable without running it.
+ for (const platform of ["darwin-arm64", "darwin-x64", "linux-x64"]) {
+ const name = `copilot-${platform}`;
+ if (!existsSync(join(packRoot, "node_modules", ".bin", name))) continue;
+ const executable = packRequire.resolve(`@github/${name}`);
+ writePortableExecutableShim(
+ packRoot,
+ name,
+ relative(realpathSync(join(packRoot, "node_modules")), realpathSync(executable)),
+ );
+ }
+}
diff --git a/packages/paperclip-runner/scripts/provider-pack-executable-shims.test.mjs b/packages/paperclip-runner/scripts/provider-pack-executable-shims.test.mjs
new file mode 100644
index 00000000000..df8aa94f0d3
--- /dev/null
+++ b/packages/paperclip-runner/scripts/provider-pack-executable-shims.test.mjs
@@ -0,0 +1,59 @@
+import assert from "node:assert/strict";
+import { spawnSync } from "node:child_process";
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import test from "node:test";
+import { writePortableCopilotShims } from "./provider-pack-executable-shims.mjs";
+
+function fixture(t) {
+ const root = mkdtempSync(join(tmpdir(), "provider-shims-"));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ const pack = join(root, "temporary pack");
+ mkdirSync(join(pack, "node_modules", ".bin"), { recursive: true });
+ writeFileSync(join(pack, "package.json"), '{"type":"module"}');
+ return { root, pack };
+}
+
+for (const platform of ["darwin-arm64", "darwin-x64", "linux-x64"]) {
+ test(`relocates the installed ${platform} Copilot command and preserves arguments and exit status`, (t) => {
+ const { root, pack } = fixture(t);
+ const name = `copilot-${platform}`;
+ const installed = join(pack, "node_modules", "@github", name);
+ mkdirSync(installed, { recursive: true });
+ writeFileSync(join(installed, "package.json"), JSON.stringify({
+ name: `@github/${name}`, exports: { ".": "./copilot" }, bin: { [name]: "copilot" },
+ }));
+ // A provider-free executable proves relocation without invoking a real CLI.
+ writeFileSync(join(installed, "copilot"), '#!/bin/sh\nprintf "%s\\n" "$@"\nexit 17\n', { mode: 0o755 });
+ const shim = join(pack, "node_modules", ".bin", name);
+ writeFileSync(shim, `#!/bin/sh\nexport NODE_PATH="${pack}/node_modules"\nexit 99\n`);
+
+ writePortableCopilotShims(pack);
+ assert.equal(readFileSync(shim, "utf8").includes(root), false);
+ const relocated = join(root, "relocated pack");
+ renameSync(pack, relocated);
+ const args = ["argument with spaces", "", "$(not-a-command)"];
+ const result = spawnSync(join(relocated, "node_modules", ".bin", name), args, {
+ cwd: root, env: { PATH: "/usr/bin:/bin" }, encoding: "utf8", timeout: 5_000,
+ });
+ assert.equal(result.error, undefined);
+ assert.equal(result.status, 17);
+ assert.equal(result.stdout, args.join("\n") + "\n");
+ assert.equal(result.stderr, "");
+ });
+}
+
+test("does not create commands for absent optional platform packages", (t) => {
+ const { pack } = fixture(t);
+ writePortableCopilotShims(pack);
+ for (const platform of ["darwin-arm64", "darwin-x64", "linux-x64"]) {
+ assert.equal(existsSync(join(pack, "node_modules", ".bin", `copilot-${platform}`)), false);
+ }
+});
+
+test("fails when an installed command has no matching package", (t) => {
+ const { pack } = fixture(t);
+ writeFileSync(join(pack, "node_modules", ".bin", "copilot-linux-x64"), "invalid old shim");
+ assert.throws(() => writePortableCopilotShims(pack), { code: "MODULE_NOT_FOUND" });
+});
diff --git a/packages/paperclip-runner/spec/capability/protocol-coverage.json b/packages/paperclip-runner/spec/capability/protocol-coverage.json
index 55e10f70871..e61e64a4b37 100644
--- a/packages/paperclip-runner/spec/capability/protocol-coverage.json
+++ b/packages/paperclip-runner/spec/capability/protocol-coverage.json
@@ -7,7 +7,7 @@
"src/scenarios/scenario-plan.ts"
],
"counts": {
- "actions": 56,
+ "actions": 57,
"legacyRequirements": 106
},
"actions": [
@@ -30,6 +30,25 @@
"src/scenarios/scenario-explorer.test.ts::renders every scenario with exposure, control plane, authorization, diff, and parity"
]
},
+ {
+ "id": "set_task_monitor",
+ "ownership": "optional_agent_tool",
+ "surfaces": [
+ "live"
+ ],
+ "legacyAliases": [],
+ "contractCase": "protocol-action:set_task_monitor",
+ "contractOwner": "src/catalog/protocol-action-contracts.test.ts::set_task_monitor has a schema-valid canonical example and every declared projection",
+ "legacyBehavioralCases": [],
+ "deterministicCases": [
+ "protocol-action:set_task_monitor"
+ ],
+ "legacyRequirementCases": [],
+ "deterministicOwners": [
+ "src/catalog/protocol-action-contracts.test.ts::set_task_monitor has a schema-valid canonical example and every declared projection",
+ "src/scenarios/scenario-explorer.test.ts::renders every scenario with exposure, control plane, authorization, diff, and parity"
+ ]
+ },
{
"id": "submit_complaint",
"ownership": "optional_agent_tool",
diff --git a/packages/paperclip-runner/spec/operation-groups/source.json b/packages/paperclip-runner/spec/operation-groups/source.json
index c69990a5570..24cadcb043a 100644
--- a/packages/paperclip-runner/spec/operation-groups/source.json
+++ b/packages/paperclip-runner/spec/operation-groups/source.json
@@ -83,7 +83,7 @@
{
"id": "wake_scheduling",
"description": "Schedule a bounded continuation wake when the current task owns the future check.",
- "operationIds": ["schedule_wake"]
+ "operationIds": ["schedule_wake", "set_task_monitor"]
},
{
"id": "routines",
@@ -305,12 +305,12 @@
"legacyGroup": 16,
"name": "Wake situations",
"owner": "control plane + always context/history tools",
- "operationIds": ["get_task_context", "get_task_history", "schedule_wake"],
+ "operationIds": ["get_task_context", "get_task_history", "schedule_wake", "set_task_monitor"],
"controlPlaneOperationIds": ["select_work", "route_wake"],
"realSurface": "wakeup requests, heartbeat context, comment/interaction/approval/blocker wake routing, and scheduled wake services",
"mockStateDomains": ["wake", "task", "comments", "interactions", "approvals", "blockers", "run"],
"prpEvidence": "attention request routing/resolution plus resumed session/run causality",
- "gap": "Production scheduling binding is unbound; control-plane routing remains non-callable."
+ "gap": "set_task_monitor binds the one-shot monitor scheduler in production; schedule_wake remains mock-backed. Control-plane routing remains non-callable."
}
],
"rules": {
diff --git a/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md b/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md
index f08917eab59..e9096b92314 100644
--- a/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md
+++ b/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md
@@ -6,7 +6,7 @@ Status: canonical explanatory contract for the Paperclip runner V1 surface.
This document keeps three independent meanings of **group** separate. PRP families describe wire evidence and controller commands; capability placement decides who owns an operation; behavioral eval groups organize the 106 scenario corpus. None of the three axes can be used as a substitute for another.
-The generated totals are **105 PRP events in 31 event families**, **18 controller commands in 7 command families**, **10 control-plane operations**, **56 reconciled semantic operations** (18 always, 38 optional), and **106 scenarios in 16 behavior groups**.
+The generated totals are **105 PRP events in 31 event families**, **18 controller commands in 7 command families**, **10 control-plane operations**, **57 reconciled semantic operations** (18 always, 39 optional), and **106 scenarios in 16 behavior groups**.
## Axis 1: PRP v1 event and command families
@@ -87,7 +87,7 @@ Placement has exactly three outcomes:
`answer_status_question`, `block_task`, `finish_task`, `get_agent_instruction_history`, `get_task_context`, `get_task_history`, `inspect_operation_result`, `list_document_revisions`, `list_documents`, `read_agent_instructions`, `read_document`, `register_deliverable`, `report_progress`, `request_human_input`, `request_review`, `restore_agent_instructions`, `update_agent_instructions`, `write_document`.
-### Optional operations (38) and grant groups (14)
+### Optional operations (39) and grant groups (14)
Grant groups are documentation/exposure bundles, not additional authority. The operation descriptor's exact `requiredClaims` remains decisive.
@@ -100,7 +100,7 @@ Grant groups are documentation/exposure bundles, not additional authority. The o
| `governance` | `list_approvals` `get_approval` `get_approval_context` `request_approval` `decide_approval` `comment_on_approval` | `governance:approvals:comment` `governance:approvals:decide` `governance:approvals:read` `governance:approvals:request` | Read, request, comment on, and decide approvals under governed-action checks. |
| `cases` | `list_cases` `upsert_case` | `cases:read` `cases:write` | Read and update case summaries without reusing issue-document authority. |
| `workspace_runtime` | `get_workspace_runtime` `control_workspace_service` | `workspace:control` `workspace:read` | Inspect and control the active issue workspace runtime. |
-| `wake_scheduling` | `schedule_wake` | `control_plane:wakes` | Schedule a bounded continuation wake when the current task owns the future check. |
+| `wake_scheduling` | `schedule_wake` `set_task_monitor` | `control_plane:wakes` | Schedule a bounded continuation wake when the current task owns the future check. |
| `routines` | `list_routines` `manage_routine` | `routines:read` `routines:write` | Inspect or manage company routines. |
| `company_skills` | `create_skill` `update_skill` `list_company_skills` `sync_company_skills` | `company_skills:read` `company_skills:write` | Create, update, or inspect company skills and synchronize the current agent's skills. |
| `secrets` | `list_secret_metadata` `read_secret_value` | `secrets:metadata:read` `secrets:values:read` | Inspect secret metadata or use a brokered secret value without exposing plaintext evidence. |
@@ -162,6 +162,7 @@ Grant groups are documentation/exposure bundles, not additional authority. The o
| `search_api` | `optional_agent_tool` | `api:discover` | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `PaperclipRunnerToolAuthority` Authenticated PRP tool input/result and existing HTTP route authorization/activity records. catalog PRP status: `bound` |
| `search_tasks` | `optional_agent_tool` | `discovery:tasks:read` | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | `snapshot_read:company_tasks` | `scenario` + `live` `live_codex` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `set_dependencies` | `optional_agent_tool` | `dependencies:write` | `standard` `skill_test` | `company_write` | `required` | no | `semantic_command:set_dependencies` | `scenario` + `live` `live_codex` | `issues.update.blockedByIssueIds` semantic-operation item event plus company-entity state diff and audit record catalog PRP status: `bound` |
+| `set_task_monitor` | `optional_agent_tool` | none | `standard` | `task_write` | `required` | no | inline/no mapping | `live` `live_codex` | `prepareIssueMonitorUpdate` Transactional persisted issue monitor, audit activity and idempotent run receipt. catalog PRP status: `bound` |
| `set_task_title` | `optional_agent_tool` | none | `standard` `ask` `planning` `skill_test` | `task_write` | `required` | no | inline/no mapping | `live` `live_codex` | `setIssueTitle` Run-bound title update and transactional activity record. catalog PRP status: `bound` |
| `submit_complaint` | `optional_agent_tool` | none | `standard` `ask` `planning` | `task_write` | `required` | no | inline/no mapping | `live` `live_codex` | `submitAgentCommentary` Run-bound local commentary and transactional activity record. catalog PRP status: `bound` |
| `submit_suggestion` | `optional_agent_tool` | none | `standard` `ask` `planning` | `task_write` | `required` | no | inline/no mapping | `live` `live_codex` | `submitAgentCommentary` Run-bound local commentary and transactional activity record. catalog PRP status: `bound` |
@@ -194,7 +195,7 @@ Behavior groups describe expected outcomes and trajectories. They do not grant t
| [`rf` — Reference files](#behavior-group-rf-reference-files) | always instruction tools + optional domain tools + test-only escape hatch | `list_cases` `upsert_case` `list_routines` `manage_routine` `create_skill` `update_skill` `list_company_skills` `sync_company_skills` `list_secret_metadata` `read_secret_value` `export_company` `administer_company` `generic_api_request` `search_api` `call_api` `create_project` `read_agent_instructions` `update_agent_instructions` `get_agent_instruction_history` `restore_agent_instructions` `submit_complaint` `submit_suggestion` | `append_audit_record` | agent instruction revisions, project, case, routine, company-skill, secret, portability, and administration services, and run-attributed agent commentary | `company` `cases` `routines` `skills` `secrets` `audit` `fault` | 22 | bounded domain projections, redacted broker receipts, company diffs, and audit references | Instruction read/update/history/restore require the live canonical revision service, current responsible-user permissions, and pinned base revisions for writes. Their service, authority, and product E2E tests are separate from the legacy mock scenarios. Project and skill creation and API tools require the live server authority; generic_api_request is test-only and the remaining domain operations are scenario-only. Broad administer_company is deferred and cannot claim product coverage. Production API and paired dedicated-tool regressions are recorded separately in paperclip-evals/evals/runner-api-tools; the legacy scenario count is not evidence of that coverage. Feedback actions are live-only: shared persistence, authority, API, and actual Codex smoke tests cover them; the legacy scenario count does not claim feedback coverage. |
| [`mh` — Multi-hop](#behavior-group-mh-multi-hop) | composed semantic operations + control-plane continuation | `create_task` `set_dependencies` `request_human_input` `request_approval` `register_deliverable` | `route_wake` `reconcile_run` | delegation, dependency, interaction, approval, artifact, and terminal orchestration services | `task` `blockers` `interactions` `approvals` `artifacts` `wake` `run` `audit` | 4 | correlated operation receipts, state diffs, attention hops, work assessment, status decision, and terminal outcome | No generic transaction tool is allowed; shared mock/real conformance must prove each composed effect. |
| [`rs` — Restraint and no-call](#behavior-group-rs-restraint-and-no-call) | policy/exposure layer | `answer_status_question` `read_secret_value` `generic_api_request` | `enforce_budget` | task-mode, secret-broker, test-scope, pause, and budget policy checks | `actor` `task` `budget` `secrets` `audit` `fault` | 3 | absence of forbidden effects plus typed policy denial/redaction receipts when a call is attempted | Typed redaction/authorization receipts need additive v1 evidence; generic_api_request is never a product fallback. |
-| [`wk` — Wake situations](#behavior-group-wk-wake-situations) | control plane + always context/history tools | `get_task_context` `get_task_history` `schedule_wake` | `select_work` `route_wake` | wakeup requests, heartbeat context, comment/interaction/approval/blocker wake routing, and scheduled wake services | `wake` `task` `comments` `interactions` `approvals` `blockers` `run` | 8 | attention request routing/resolution plus resumed session/run causality | Production scheduling binding is unbound; control-plane routing remains non-callable. |
+| [`wk` — Wake situations](#behavior-group-wk-wake-situations) | control plane + always context/history tools | `get_task_context` `get_task_history` `schedule_wake` `set_task_monitor` | `select_work` `route_wake` | wakeup requests, heartbeat context, comment/interaction/approval/blocker wake routing, and scheduled wake services | `wake` `task` `comments` `interactions` `approvals` `blockers` `run` | 8 | attention request routing/resolution plus resumed session/run causality | set_task_monitor binds the one-shot monitor scheduler in production; schedule_wake remains mock-backed. Control-plane routing remains non-callable. |
### Scenario links
@@ -468,10 +469,10 @@ Current responsibility-based paths are normative. Numbered `phase-*` or mileston
### Catalog split and deliberate replacement
- Scenario/eval catalog: **40** operations.
-- Live dispatcher catalog: **44** operations.
-- Shared: **28**; union/canonical authority: **56**.
+- Live dispatcher catalog: **45** operations.
+- Shared: **28**; union/canonical authority: **57**.
- Scenario-only: `administer_company`, `export_company`, `inspect_operation_result`, `list_cases`, `list_company_skills`, `list_goals`, `list_routines`, `list_secret_metadata`, `manage_routine`, `read_secret_value`, `sync_company_skills`, `upsert_case`.
-- Live-only: `call_api`, `create_project`, `get_agent`, `get_agent_instruction_history`, `get_approval`, `get_approval_context`, `hire_agent`, `list_project_repositories`, `read_agent_instructions`, `restore_agent_instructions`, `schedule_wake`, `search_api`, `set_task_title`, `submit_complaint`, `submit_suggestion`, `update_agent_instructions`.
+- Live-only: `call_api`, `create_project`, `get_agent`, `get_agent_instruction_history`, `get_approval`, `get_approval_context`, `hire_agent`, `list_project_repositories`, `read_agent_instructions`, `restore_agent_instructions`, `schedule_wake`, `search_api`, `set_task_monitor`, `set_task_title`, `submit_complaint`, `submit_suggestion`, `update_agent_instructions`.
- The generated provider contract contains exactly the live catalog; the canonical union remains the migration authority until all scenario-only operations are either implemented, deferred, or removed by an explicit reconciliation decision.
- `generic_api_request` stays exported only for controlled tests and cannot be cited as real-surface, mock-parity, or PRP product coverage.
diff --git a/packages/paperclip-runner/src/backends/codex-native-backend.ts b/packages/paperclip-runner/src/backends/codex-native-backend.ts
index d3bdf55646d..a13ef381a94 100644
--- a/packages/paperclip-runner/src/backends/codex-native-backend.ts
+++ b/packages/paperclip-runner/src/backends/codex-native-backend.ts
@@ -11,6 +11,7 @@ import type {
import type { CodexAppServerTransport } from "../drivers/codex/app-server-transport.js";
import { CodexAppServerDriver } from "../drivers/codex/codex-app-server-driver.js";
import type { CodexWorkingDirectoryAuthority } from "../drivers/codex/codex-boundaries.js";
+import { describeRunnerdDotDriver } from "../drivers/dot/runnerd-dot-driver.js";
import { HarnessDriverBackend } from "./harness-driver-backend.js";
import {
nativeSystemInstructions,
@@ -207,6 +208,17 @@ function createTransportBackedNativeSessionBackend(
export function describeRunnerdNativeSessionBackend(
input: NativeExecutionInput,
): Promise {
+ if (input.schema === "paperclip.native-execution-input.v6") {
+ // Dot uses its dedicated Rust bridge, rather than the JSON-RPC facade.
+ const descriptor = describeRunnerdDotDriver();
+ return Promise.resolve({
+ kind: "runner",
+ name: descriptor.kind,
+ version: descriptor.version,
+ capabilities: descriptor.capabilities,
+ runtimeContextCapabilities: descriptor.runtimeContextCapabilities,
+ });
+ }
return createTransportBackedNativeSessionBackend(input, {}).descriptor();
}
diff --git a/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts b/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts
index a4095023aba..e1542606a24 100644
--- a/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts
+++ b/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts
@@ -977,6 +977,28 @@ describe("HarnessDriverBackend", () => {
await expect(iterator.next()).rejects.toThrow("provider transport lost after resolution");
});
+ it.each([false, true])("retains final usage without accepting late output (journal boundary only: %s)", async journalOnly => {
+ class AccountingAfterCancelSession extends FakeHarnessSession {
+ async interrupt() {}
+ override async *events() {
+ yield prpEvent(1, "item.completed", { kind: "agentMessage", text: "late answer" });
+ yield prpEvent(2, "item.completed", { kind: "usage", usage: { runDelta: { inputTokens: 7, outputTokens: 3 }, runDeltaComplete: true } });
+ yield prpEvent(3, "turn.completed", { status: "completed" });
+ }
+ }
+ const backend = new HarnessDriverBackend({ ...driver, async openSession() { return new AccountingAfterCancelSession(); } });
+ const session = await backend.openSession({
+ identity: { runId: "run-1", sessionId: "session-1", companyId: "company-1", issueId: "issue-1", agentId: "agent-1" }, workingDirectory: "/workspace",
+ });
+ if (journalOnly) session.revokeTurnPublication();
+ else await session.cancel({ reason: "durable governed wait", signal: new AbortController().signal }).cleanup;
+ const events = [];
+ for await (const event of session.events()) events.push(event);
+ expect(events.filter(event => event.payload.kind === "agentMessage")).toHaveLength(0);
+ expect(events.find(event => event.payload.kind === "usage")?.payload.usage).toMatchObject({ runDelta: { inputTokens: 7, outputTokens: 3 } });
+ expect(events.some(event => event.eventType === "turn.cancelled")).toBe(true);
+ });
+
it("does not start provider work when Stop arrives before the first turn", async () => {
const provider = new FakeHarnessSession();
const start = vi.spyOn(provider, "startTurn");
diff --git a/packages/paperclip-runner/src/backends/harness-driver-backend.ts b/packages/paperclip-runner/src/backends/harness-driver-backend.ts
index 6b79af361bb..6e3897e4e57 100644
--- a/packages/paperclip-runner/src/backends/harness-driver-backend.ts
+++ b/packages/paperclip-runner/src/backends/harness-driver-backend.ts
@@ -379,8 +379,8 @@ function assertProviderSessionIdentity(
if (
typeof ids.driverSessionId !== "string" ||
ids.driverSessionId.trim().length === 0 ||
- typeof ids.providerSessionId !== "string" ||
- ids.providerSessionId.trim().length === 0
+ (provider !== "openai_dot_mcp" && (typeof ids.providerSessionId !== "string" || ids.providerSessionId.trim().length === 0))
+ || (provider === "openai_dot_mcp" && ids.providerSessionId !== null)
) {
throw new Error(
`provider_initialize_protocol_error: provider=${provider} stage=${stage} missing durable provider session identity`,
@@ -549,7 +549,10 @@ class HarnessNativeSession implements NativeSession {
(event.eventType === "run.terminal" && ["failed", "cancelled"].includes(String(event.payload.runTerminalState))) ||
(event.eventType === "item.completed" &&
event.payload.kind === "interrupt_acknowledgement");
- if (this.#explicitlyCancelled && !isCancellationEvent) continue;
+ // Accounting for work already performed survives cancellation. It grants
+ // no tool, message, semantic-result, or continuation authority.
+ const isUsageReceipt = event.eventType === "item.completed" && event.payload.kind === "usage";
+ if (this.#explicitlyCancelled && !isCancellationEvent && !isUsageReceipt) continue;
sourceInstanceId = event.sourceInstanceId;
lastSourceSequence = Math.max(lastSourceSequence, event.sourceSeq);
if (event.eventType === "runtime_request.created") {
@@ -737,6 +740,10 @@ class HarnessNativeSession implements NativeSession {
return this.#session.interrupt(input);
}
+ revokeTurnPublication() {
+ this.#explicitlyCancelled = true;
+ }
+
cancel(input: { reason: string; signal: AbortSignal }) {
if (input.signal.aborted) {
throw (
@@ -746,7 +753,7 @@ class HarnessNativeSession implements NativeSession {
// This flag is the adapter's synchronous publication boundary. Provider
// interruption happens afterward as passive cleanup, so a slow or broken
// transport cannot synthesize or publish new accepted output for the turn.
- this.#explicitlyCancelled = true;
+ this.revokeTurnPublication();
const interrupt = this.#session.interrupt;
return {
cleanup:
diff --git a/packages/paperclip-runner/src/backends/native-backend-factory.ts b/packages/paperclip-runner/src/backends/native-backend-factory.ts
index 2838405d6d8..d36127a2223 100644
--- a/packages/paperclip-runner/src/backends/native-backend-factory.ts
+++ b/packages/paperclip-runner/src/backends/native-backend-factory.ts
@@ -1,3 +1,5 @@
+import { RunnerdDotDriver, type RunnerdDotDriverOptions } from "../drivers/dot/runnerd-dot-driver.js";
+import { HarnessDriverBackend } from "./harness-driver-backend.js";
import type { NativeExecutionInput } from "../contracts/native-execution.js";
import type { PersistedHarnessSession } from "../contracts/harness-driver.js";
import type {
@@ -20,6 +22,7 @@ export interface NativeBackendFactoryOptions extends Omit<
CodexNativeSessionBackendOptions,
"transportFactory"
> {
+ dotRunnerOptions?: Omit;
codexTransportFactory?: (context?: {
baseInstructions?: string;
providerRecoveryPolicy?: PersistedNativeSession["providerRecoveryPolicy"];
@@ -49,6 +52,12 @@ export function createNativeSessionBackend(
input: NativeExecutionInput,
options: NativeBackendFactoryOptions = {},
): NativeSessionBackend {
+ if (input.schema === "paperclip.native-execution-input.v6") {
+ if (!options.dotRunnerOptions) throw new Error("Dot requires an admitted broker port and Rust Runner authority");
+ return new HarnessDriverBackend(new RunnerdDotDriver({ ...options.dotRunnerOptions, execution: input,
+ dynamicTools: options.dynamicTools, dynamicToolHandler: options.dynamicToolHandler,
+ completionFeedback: options.completionFeedback, onSpawn: options.onSpawn }));
+ }
if (options.codexTransportFactory) {
return createRunnerdNativeSessionBackend(input, {
completionFeedback: options.completionFeedback,
diff --git a/packages/paperclip-runner/src/backends/native-instruction-measurement.test.ts b/packages/paperclip-runner/src/backends/native-instruction-measurement.test.ts
index ab56cdfe845..98507b24338 100644
--- a/packages/paperclip-runner/src/backends/native-instruction-measurement.test.ts
+++ b/packages/paperclip-runner/src/backends/native-instruction-measurement.test.ts
@@ -139,6 +139,8 @@ describe("native instruction payload measurement", () => {
expect(JSON.stringify(turn.input)).toContain("Document saved");
}
expect(JSON.stringify(turn.input)).toContain("objective");
+ expect(JSON.stringify(turn.input)).toContain("Before ending this turn, obtain one accepted paperclip_finish or paperclip_block result.");
+ expect(JSON.stringify(turn.input)).toContain("Earlier reports belong to earlier turns");
} else {
expect(JSON.stringify(turn.input)).toContain("Obtain one accepted result");
expect(JSON.stringify(turn.input)).toContain("Document saved");
diff --git a/packages/paperclip-runner/src/backends/runtime-context.test.ts b/packages/paperclip-runner/src/backends/runtime-context.test.ts
index 2fc3ac47260..bfa1fa76be0 100644
--- a/packages/paperclip-runner/src/backends/runtime-context.test.ts
+++ b/packages/paperclip-runner/src/backends/runtime-context.test.ts
@@ -31,6 +31,7 @@ function runtimeInput(
entryPath: string,
): NativeExecutionInput {
return {
+ provider: { kind: "codex" },
runtimeContext: {
prompt: { text: "Paperclip runtime." },
instructions: { bundle: { rootPath }, entryPath },
@@ -76,7 +77,8 @@ describe("native runtime context files", () => {
}
expect(PRP_COMPLETION_TOOL_DESCRIPTION).toContain("do not claim completion while gated");
expect(PRP_COMPLETION_TOOL_DESCRIPTION).toContain("supplied link and action");
- expect(PRP_COMPLETION_TOOL_DESCRIPTION).toContain("explicit wait for the next response");
+ expect(PRP_COMPLETION_TOOL_DESCRIPTION).toContain("yielded with response_wake for a response");
+ expect(PRP_COMPLETION_TOOL_DESCRIPTION).toContain("monitor after set_task_monitor confirms a schedule on this task");
expect(PRP_BLOCK_TOOL_DESCRIPTION).toContain("its owner, and the action needed to unblock it");
expect(constraints).not.toContain(
"final response exactly once before invoking",
diff --git a/packages/paperclip-runner/src/backends/runtime-context.ts b/packages/paperclip-runner/src/backends/runtime-context.ts
index a773f6092e6..2c9eb77fd39 100644
--- a/packages/paperclip-runner/src/backends/runtime-context.ts
+++ b/packages/paperclip-runner/src/backends/runtime-context.ts
@@ -27,6 +27,11 @@ export function nativeSystemInstructions(input: NativeExecutionInput): string {
throw new Error("native_runtime_context_entry_outside_bundle");
}
const entry = readFileSync(entryPath, "utf8");
+ if (input.provider.kind === "openai_dot") {
+ return [input.runtimeContext.prompt.text, entry.trim(),
+ "This provider has no mounted workspace. Use Paperclip semantic tools for task coordination and write_document for durable text deliverables. Read pinned skills with list_assigned_skills and read_assigned_skill. Assigned app tools run through the Paperclip MCP gateway with normal permissions and approvals. If workspace tools are advertised, use them for files and sandboxed commands, then register_deliverable for requested downloadable files. Use get_identity and list_people to discover the responsible person and assignees. Read the current catalog before concluding a capability is unavailable.",
+ `Assigned skills: ${input.runtimeContext.skills.map(skill => skill.runtimeName).join(", ") || "none"}.`].join("\n\n");
+ }
return composeNativeSystemInstructions(input.runtimeContext, entry);
}
diff --git a/packages/paperclip-runner/src/catalog/reconciliation.test.ts b/packages/paperclip-runner/src/catalog/reconciliation.test.ts
index 4ae8029b3bf..923fc036b33 100644
--- a/packages/paperclip-runner/src/catalog/reconciliation.test.ts
+++ b/packages/paperclip-runner/src/catalog/reconciliation.test.ts
@@ -20,9 +20,9 @@ describe("canonical semantic-catalog reconciliation authority", () => {
it("pins the reconciled op-set relationship between the two catalogs", () => {
const summary = capabilityCatalogReconciliation();
expect(summary.scenarioCount).toBe(40);
- expect(summary.liveCount).toBe(44);
+ expect(summary.liveCount).toBe(45);
expect(summary.sharedCount).toBe(28);
- expect(summary.unionCount).toBe(56);
+ expect(summary.unionCount).toBe(57);
// Any operation added to or removed from either catalog without a
// reconciliation decision changes these exact sets and fails the gate.
expect(summary.liveOnly).toEqual([
@@ -38,6 +38,7 @@ describe("canonical semantic-catalog reconciliation authority", () => {
"restore_agent_instructions",
"schedule_wake",
"search_api",
+ "set_task_monitor",
"set_task_title",
"submit_complaint",
"submit_suggestion",
@@ -60,7 +61,7 @@ describe("canonical semantic-catalog reconciliation authority", () => {
});
it("is the single source both catalogs derive their operation set from", () => {
- expect(CAPABILITY_CANONICAL_OPERATIONS).toHaveLength(56);
+ expect(CAPABILITY_CANONICAL_OPERATIONS).toHaveLength(57);
const canonicalIds = new Set(CAPABILITY_CANONICAL_OPERATIONS.map((operation) => operation.operationId));
// Neither catalog may contain an operation absent from the canonical source.
for (const tool of SCENARIO_CATALOG) expect(canonicalIds.has(tool.operationId)).toBe(true);
@@ -94,7 +95,7 @@ describe("canonical semantic-catalog reconciliation authority", () => {
});
it("names placement, claims, task modes, side-effect class, idempotency, redaction, mock mapping, real binding status, and PRP evidence for every operation", () => {
- expect(CAPABILITY_CANONICAL_CATALOG).toHaveLength(56);
+ expect(CAPABILITY_CANONICAL_CATALOG).toHaveLength(57);
for (const operation of CAPABILITY_CANONICAL_CATALOG) {
expect(operation.placement).toMatch(/^(always|optional)_agent_tool$/);
expect(Array.isArray(operation.requiredClaims)).toBe(true);
@@ -120,7 +121,7 @@ describe("canonical semantic-catalog reconciliation authority", () => {
it("classifies real binding status so generic_api_request is never product coverage", () => {
const summary = capabilityCatalogReconciliation();
expect(summary.byRealBindingStatus).toEqual({
- live_codex: 43,
+ live_codex: 44,
scenario_mock: 12,
test_only: 1,
});
diff --git a/packages/paperclip-runner/src/catalog/semantic-action-catalog.test.ts b/packages/paperclip-runner/src/catalog/semantic-action-catalog.test.ts
index 678ab2613d6..7692309b236 100644
--- a/packages/paperclip-runner/src/catalog/semantic-action-catalog.test.ts
+++ b/packages/paperclip-runner/src/catalog/semantic-action-catalog.test.ts
@@ -37,6 +37,18 @@ describe("semantic action catalog", () => {
}
});
+ it("advertises human assignment in both task creation contracts", () => {
+ const ajv = new Ajv2020({ allErrors: true, allowUnionTypes: true, strict: true });
+ for (const schema of [createTaskAction.live.descriptor.inputSchema, paperclipSemanticAction("create_task")!.inputSchema]) {
+ const validate = ajv.compile(schema);
+ const input = { title: "Hello", idempotencyKey: "hello", assigneeUserId: "company-owner" };
+ expect(validate(input), JSON.stringify(validate.errors)).toBe(true);
+ expect(validate({ ...input, assigneeUserId: null })).toBe(true);
+ expect(validate({ ...input, assigneeUserId: 42 })).toBe(false);
+ expect(validate({ ...input, undeclaredField: true })).toBe(false);
+ }
+ });
+
it("accepts project handoff receipts and preserves ordinary child task receipts", () => {
const ajv = new Ajv2020({ allErrors: true, allowUnionTypes: true, strict: true });
const validate = ajv.compile(createTaskAction.live.descriptor.outputSchema);
@@ -57,7 +69,8 @@ describe("semantic action catalog", () => {
(action) => action.operationId,
);
- expect(operationIds).toHaveLength(36);
+ expect(operationIds).toHaveLength(37);
+ expect(operationIds).toContain("set_task_monitor");
expect(new Set(operationIds).size).toBe(operationIds.length);
expect(operationIds).not.toContain("generic_api_request");
expect(Object.isFrozen(PAPERCLIP_SEMANTIC_ACTION_CATALOG)).toBe(true);
diff --git a/packages/paperclip-runner/src/catalog/semantic-action-catalog.ts b/packages/paperclip-runner/src/catalog/semantic-action-catalog.ts
index cc7c2848662..4c77c08fecb 100644
--- a/packages/paperclip-runner/src/catalog/semantic-action-catalog.ts
+++ b/packages/paperclip-runner/src/catalog/semantic-action-catalog.ts
@@ -1,3 +1,4 @@
+import { setTaskMonitorInputSchema } from "../protocol-actions/set-task-monitor.js";
import { listProjectsDescription, listProjectsInputSchema } from "../protocol-actions/list-projects.js";
import { setTaskTitleAction } from "../protocol-actions/set-task-title.js";
import { reassignTaskAction } from "../protocol-actions/reassign-task.js";
@@ -519,7 +520,8 @@ const descriptors: readonly PaperclipSemanticActionDescriptor[] = [
projectId: nullableText("Project identifier for the new task."),
initialPlan: nullableText("Remaining execution steps to persist as the task plan. Exclude completed planning, approval, and handoff steps; cite the source plan revision and approval. A copied plan is not a new approval gate."),
description: nullableText("Child task description."),
- assigneeActorId: nullableText("Optional actor assignee.", 200),
+ assigneeActorId: nullableText("Optional actor assignee. Mutually exclusive with assigneeUserId.", 200),
+ assigneeUserId: nullableText("Company person ID from list_people. Mutually exclusive with assigneeActorId.", 200),
status: { enum: ["backlog", "todo"], description: "Initial status. Use backlog to save work without execution. Defaults to todo (blocked when dependencies are unresolved)." },
priority: { enum: ["critical", "high", "medium", "low"] },
blockedByTaskIds: stringArray("Initial blocker task identifiers."),
@@ -583,6 +585,12 @@ const descriptors: readonly PaperclipSemanticActionDescriptor[] = [
),
outputSchema: operationReceipt,
}),
+ descriptor({
+ operationId: "set_task_monitor", title: "Set task monitor",
+ description: "Schedule, replace or clear a persisted one-shot monitor on an owned task.",
+ placement: "optional", effect: "write", requiredClaims: [], allowedModes: ["standard"],
+ inputSchema: setTaskMonitorInputSchema, outputSchema: openObject,
+ }),
descriptor({
operationId: "schedule_wake",
title: "Schedule bounded wake",
diff --git a/packages/paperclip-runner/src/catalog/semantic-action-types.ts b/packages/paperclip-runner/src/catalog/semantic-action-types.ts
index 0dd1f9c38ec..5f2f1bfef07 100644
--- a/packages/paperclip-runner/src/catalog/semantic-action-types.ts
+++ b/packages/paperclip-runner/src/catalog/semantic-action-types.ts
@@ -2,6 +2,7 @@ export type PaperclipSemanticActionId =
| "search_api"
| "call_api"
| "set_task_title"
+ | "set_task_monitor"
| "get_task_context"
| "get_task_history"
| "list_documents"
diff --git a/packages/paperclip-runner/src/cli/eval-session-contract.test.ts b/packages/paperclip-runner/src/cli/eval-session-contract.test.ts
index d9c367994cb..1ec73799b14 100644
--- a/packages/paperclip-runner/src/cli/eval-session-contract.test.ts
+++ b/packages/paperclip-runner/src/cli/eval-session-contract.test.ts
@@ -73,7 +73,7 @@ describe("eval-session request contract", () => {
const value = request({ provider: "acpx", acpxAgent: agent, model: "explicit-provider-model" });
expect(() => parseEvalSessionRequest(value)).toThrow("--candidate-profile");
expect(parseEvalSessionRequest(value, { candidateProfile: agent })).toMatchObject({ acpxAgent: agent, model: "explicit-provider-model" });
- expect(() => parseEvalSessionRequest(value, { candidateProfile: "pi" })).toThrow("must match");
+ expect(() => parseEvalSessionRequest(value, { candidateProfile: agent === "pi" ? "cursor" : "pi" })).toThrow("must match");
expect(() => parseEvalSessionRequest(request({ provider: "acpx", acpxAgent: agent, model: "" }), { candidateProfile: agent })).toThrow("request.model");
expect(() => parseEvalSessionRequest(request({ provider: "acpx", acpxAgent: "codex", session: { acpxAgent: agent } }))).toThrow("session.acpxAgent must match");
expect(() => parseEvalSessionRequest(request({ provider: "acpx", acpxAgent: agent, candidateProfile: agent }))).toThrow("--candidate-profile");
@@ -225,12 +225,11 @@ describe("eval-session request contract", () => {
})))).toBe("17");
});
- it("accepts Pi and both qualified remote provider profiles", () => {
- expect(parseEvalSessionRequest(request({
+ it("requires explicit Pi diagnosis and accepts both qualified remote provider profiles", () => {
+ expect(() => parseEvalSessionRequest(request({
provider: "acpx",
acpxAgent: "pi",
- model: "openrouter/deepseek/deepseek-v4-flash-0731",
- }))).toMatchObject({ provider: "acpx", acpxAgent: "pi" });
+ }))).toThrow("--candidate-profile");
expect(parseEvalSessionRequest(request({
provider: "aws_agentcore",
driver: "aws_agentcore_harness_api",
diff --git a/packages/paperclip-runner/src/configured-environment.test.ts b/packages/paperclip-runner/src/configured-environment.test.ts
new file mode 100644
index 00000000000..94313010790
--- /dev/null
+++ b/packages/paperclip-runner/src/configured-environment.test.ts
@@ -0,0 +1,99 @@
+import { CONFIGURED_ENVIRONMENT_KEYS, configuredEnvironment, configuredEnvironmentProjection } from './configured-environment.js';
+import { describe, expect, it, vi } from 'vitest';
+import { createSanitizedCodexEnvironment } from './drivers/codex/app-server-transport.js';
+import { createIsolatedCodexAppServerArgs } from './drivers/codex/codex-security-config.js';
+import { createCapabilityRunnerdProviderEnvironment } from './live/runnerd-codex-transport.js';
+import { spawnRunner } from './control-plane/durable-prp-control-plane.js';
+
+const pages = {
+ PAPERCLIP_PAGE_AWS_ACCESS_KEY_ID: 'fake-page-access-key',
+ PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY: 'fake-page-secret',
+ PAPERCLIP_PAGE_BUCKET: 'pages.example.test',
+};
+const source = { ...configuredEnvironmentProjection(pages), PATH: '/bin', ...pages, DATABASE_URL: 'host-secret-must-not-cross', NODE_OPTIONS: '--require=/untrusted/bootstrap.js', PAPERCLIP_API_KEY: 'controller-api-key-must-not-cross' };
+const identity = { runnerInstanceId: 'runner-proof', environmentLeaseId: 'lease-proof', runId: 'run-proof', normalizedSessionId: 'session-proof', turnId: 'turn-proof', itemId: 'item-proof' };
+function shellKeys() {
+ const args = createIsolatedCodexAppServerArgs(source);
+ const setting = args.find(value => value.startsWith('shell_environment_policy.include_only='))!;
+ return { keys: JSON.parse(setting.slice(setting.indexOf('=') + 1)) as string[], serialized: args.join('\n') };
+}
+
+describe('controller-configured environment across native runner boundaries', () => {
+ it('retains configured Pages values at the native Codex provider sanitizer', () => {
+ expect(createSanitizedCodexEnvironment(source)).toMatchObject(pages);
+ });
+ it('retains configured Pages values when preparing a fresh runnerd process', () => {
+ expect(createCapabilityRunnerdProviderEnvironment({ provider: 'codex', options: { environment: source }, identity, codexHome: '/isolated/codex-home', runtimeContextPath: '/isolated/runtime-context.json', hasRuntimeContext: false })).toMatchObject(pages);
+ });
+ it('passes configured Pages values through the runner spawn boundary', () => {
+ let launched: NodeJS.ProcessEnv | undefined;
+ spawnRunner({ connection: { mode: 'connect', connectUrl: 'ws://127.0.0.1:43127' }, stateDirectory: '/tmp/runner-env-proof', identity, ticket: 'fake-ticket', maxOutboxBytes: 262144, p0ReserveBytes: 65536, runnerVersion: '0.3.0', runnerDigest: `sha256:${'a'.repeat(64)}`, environment: source,
+ processLauncher: spec => { launched = spec.environment; return { child: { pid: 42, exitCode: null, signalCode: null, kill: () => true }, completion: Promise.resolve({ code: 0, signal: null, stdout: '', stderr: '' }) }; },
+ });
+ expect(launched).toMatchObject(pages);
+ expect(launched!.DATABASE_URL).toBeUndefined();
+ expect(launched!.NODE_OPTIONS).toBeUndefined();
+ expect(launched!.PAPERCLIP_API_KEY).toBeUndefined();
+ });
+ it('allows configured Pages values into model-issued shell commands without serializing secrets into argv', () => {
+ const { keys, serialized } = shellKeys();
+ expect(keys).toEqual(expect.arrayContaining(Object.keys(pages)));
+ expect(keys).not.toContain('DATABASE_URL');
+ expect(keys).not.toContain('NODE_OPTIONS');
+ expect(keys).not.toContain('PAPERCLIP_API_KEY');
+ for (const value of Object.values(pages)) expect(serialized).not.toContain(value);
+ });
+ it('continues to exclude unbound ambient Pages credentials and host secrets', () => {
+ vi.stubEnv('PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY', 'ambient-page-secret');
+ try {
+ expect(createSanitizedCodexEnvironment().PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY).toBeUndefined();
+ const sanitized = createSanitizedCodexEnvironment(source);
+ expect(sanitized.DATABASE_URL).toBeUndefined();
+ expect(sanitized.NODE_OPTIONS).toBeUndefined();
+ expect(sanitized.PAPERCLIP_API_KEY).toBeUndefined();
+ } finally { vi.unstubAllEnvs(); }
+ });
+});
+
+
+describe("configured environment authority", () => {
+ it("keeps selected bootstrap values in the environment rather than argv", () => {
+ const environment = { PATH: "/bin", ...configuredEnvironmentProjection({ LANG: "configured-language-value" }) };
+ const args = createIsolatedCodexAppServerArgs(environment);
+ expect(args.join("\n")).not.toContain("configured-language-value");
+ expect(args.find(arg => arg.startsWith("shell_environment_policy.include_only="))).toContain("LANG");
+ });
+
+ it("projects ordinary task credentials only when explicitly selected", () => {
+ const projected = configuredEnvironmentProjection({ DATABASE_URL: "task-db", CUSTOM_FLAG: "on", NODE_OPTIONS: "unsafe", PAPERCLIP_API_KEY: "controller" });
+ expect(createSanitizedCodexEnvironment(projected)).toMatchObject({ DATABASE_URL: "task-db", CUSTOM_FLAG: "on" });
+ expect(projected.NODE_OPTIONS).toBeUndefined();
+ expect(projected.PAPERCLIP_API_KEY).toBeUndefined();
+ });
+
+ it("does not accept an ambient projection in the provider or shell policy", () => {
+ vi.stubEnv(CONFIGURED_ENVIRONMENT_KEYS, JSON.stringify(["PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY"]));
+ vi.stubEnv("PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY", "ambient-secret");
+ try {
+ expect(createSanitizedCodexEnvironment().PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY).toBeUndefined();
+ expect(createIsolatedCodexAppServerArgs().join("\n")).not.toContain("PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY");
+ } finally { vi.unstubAllEnvs(); }
+ });
+
+ it.each(["not-json", "[1]", '["NODE_OPTIONS"]', '["PAPERCLIP_API_KEY"]', '["PAPERCLIP_RUNNER_BOOTSTRAP_TICKET"]', '["OPENAI_API_KEY"]', '["LD_PRELOAD"]', '["bad=name"]', '["CUSTOM","CUSTOM"]', '["MISSING"]'])
+ ("rejects malformed or reserved projection %s", raw => {
+ expect(() => configuredEnvironment({ [CONFIGURED_ENVIRONMENT_KEYS]: raw })).toThrow("Invalid configured environment");
+ });
+
+ it("rejects oversized and null-containing values without reporting their contents", () => {
+ for (const value of ["x".repeat(65_536), "secret\0suffix"]) {
+ expect(() => configuredEnvironmentProjection({ CUSTOM: value })).toThrow(/configured environment|Configured environment/);
+ }
+ });
+
+ it("preserves configured values through ACPX and OpenCode preparation", async () => {
+ const { createSanitizedAcpxSpawnInput } = await import("./drivers/acpx/environment.js");
+ expect(createSanitizedAcpxSpawnInput(source, "codex").env).toMatchObject(pages);
+ expect(createCapabilityRunnerdProviderEnvironment({ provider: "opencode", options: { environment: source }, identity, codexHome: "/isolated/home", runtimeContextPath: "/isolated/context", hasRuntimeContext: false })).toMatchObject(pages);
+ });
+});
diff --git a/packages/paperclip-runner/src/configured-environment.ts b/packages/paperclip-runner/src/configured-environment.ts
new file mode 100644
index 00000000000..bd10a7e7813
--- /dev/null
+++ b/packages/paperclip-runner/src/configured-environment.ts
@@ -0,0 +1,76 @@
+/** Names minted by the controller from the resolved task configuration.
+ * Values remain in the process environment, never in argv or this manifest.
+ * Do not mint this projection from ambient process.env.
+ */
+export const CONFIGURED_ENVIRONMENT_KEYS = "PAPERCLIP_CONFIGURED_ENV_KEYS";
+
+export const GENERATED_RUNTIME_ENVIRONMENT_KEYS: ReadonlySet = new Set([
+ CONFIGURED_ENVIRONMENT_KEYS,
+ "PAPERCLIP_AGENT_ID", "PAPERCLIP_AGENT_KEY_ID", "PAPERCLIP_AGENT_PUBLIC_KEY", "PAPERCLIP_AGENT_PRIVATE_KEY",
+ "PAPERCLIP_API_KEY", "PAPERCLIP_API_URL", "PAPERCLIP_API_BRIDGE_MODE", "PAPERCLIP_COMPANY_ID", "PAPERCLIP_INSTANCE_ID",
+ "PAPERCLIP_RUN_ID", "PAPERCLIP_NORMALIZED_SESSION_ID", "PAPERCLIP_RUNNER_INSTANCE_ID", "PAPERCLIP_RUNNER_BOOTSTRAP_TICKET", "PAPERCLIP_TASK_ID", "PAPERCLIP_APPROVAL_ID", "PAPERCLIP_APPROVAL_STATUS", "PAPERCLIP_LINKED_ISSUE_IDS",
+ "PAPERCLIP_WAKE_REASON", "PAPERCLIP_WAKE_COMMENT_ID", "PAPERCLIP_WAKE_PAYLOAD_JSON", "PAPERCLIP_EXECUTION_MODE",
+ "PAPERCLIP_WORKSPACES_JSON", "PAPERCLIP_WORKSPACE_ID", "PAPERCLIP_WORKSPACE_CWD", "PAPERCLIP_WORKSPACE_SOURCE",
+ "PAPERCLIP_WORKSPACE_REPO_URL", "PAPERCLIP_WORKSPACE_REPO_REF", "PAPERCLIP_WORKSPACE_BRANCH",
+ "PAPERCLIP_WORKSPACE_WORKTREE_PATH", "PAPERCLIP_WORKSPACE_REALIZATION_MODE", "PAPERCLIP_WORKSPACE_AUTHORITATIVE_ROOT",
+ "PAPERCLIP_RUNTIME_PRIMARY_URL", "PAPERCLIP_RUNTIME_SERVICES_JSON", "PAPERCLIP_RUNTIME_SERVICE_INTENTS_JSON",
+ "PAPERCLIP_AGENT_MESSAGE_KEY", "PAPERCLIP_HARNESS_CHECKOUT_KEY", "PAPERCLIP_EXTERNAL_CHAT_EXECUTION_BOUND_KEY",
+ "PAPERCLIP_NATIVE_MCP_NAME", "PAPERCLIP_NATIVE_MCP_URL", "PAPERCLIP_NATIVE_MCP_TOKEN", "PAPERCLIP_AI_PROVIDER_KEY",
+ "PAPERCLIP_PROVIDER_TRACE_PATH", "PAPERCLIP_PROVIDER_TRACE_MAX_BYTES", "PAPERCLIP_ACPX_CREDENTIAL_BINDING",
+ "PAPERCLIP_RUNNER_NETWORK_ACCESS", "PAPERCLIP_RUNNER_NETWORK_ROOTS", "PAPERCLIP_RUNNER_EXTERNAL_SANDBOX",
+ "PAPERCLIP_GITHUB_AUTH_MODE", "PAPERCLIP_GITHUB_HOST_HOME", "PAPERCLIP_GIT_METADATA_ROOTS",
+ "PAPERCLIP_GITHUB_BROKER_TOKEN", "PAPERCLIP_GITHUB_BROKER_URL", "PAPERCLIP_GITHUB_BRIDGE_TOKEN", "PAPERCLIP_GITHUB_LAUNCHER_DIR",
+]);
+
+const RESERVED_KEYS = new Set([
+ "PATH", "HOME", "USERPROFILE", "CODEX_HOME", "AGENT_HOME", "SHELL", "NODE_OPTIONS", "NODE_PATH",
+ "PYTHONPATH", "PYTHONHOME", "RUBYOPT", "RUBYLIB", "PERL5OPT", "PERL5LIB", "BASH_ENV", "ENV",
+ "OPENAI_API_KEY", "CODEX_API_KEY", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "CLAUDE_CODE_OAUTH_TOKEN",
+ "AWS_BEARER_TOKEN_BEDROCK", "OPENROUTER_API_KEY", "XAI_API_KEY", "CURSOR_API_KEY", "CURSOR_AUTH_TOKEN",
+ "COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN", "GH_ENTERPRISE_TOKEN", "GITHUB_ENTERPRISE_TOKEN", "PAPERCLIP_GIT_TOKEN",
+]);
+
+function eligibleKey(key: string): boolean {
+ const upper = key.toUpperCase();
+ return /^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(key)
+ && !GENERATED_RUNTIME_ENVIRONMENT_KEYS.has(upper)
+ && !RESERVED_KEYS.has(upper)
+ && !/^(?:LD_|DYLD_|GIT_CONFIG_|PAPERCLIP_(?:RUNNER_|NATIVE_|GITHUB_|ACPX_|VERIFIED_))/.test(upper);
+}
+
+function checkedNames(names: unknown): string[] {
+ if (!Array.isArray(names) || names.length > 128 || names.some(name => typeof name !== "string" || !eligibleKey(name))
+ || new Set(names).size !== names.length) throw new Error("Invalid configured environment projection");
+ return (names as string[]).sort();
+}
+
+/** Mint at the server's resolved configuration boundary, before host inheritance. */
+export function configuredEnvironmentProjection(source: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
+ const names = checkedNames(Object.keys(source).filter(key => source[key] !== undefined && eligibleKey(key)));
+ return configuredEnvironment({ ...source, [CONFIGURED_ENVIRONMENT_KEYS]: JSON.stringify(names) });
+}
+
+/** Accept only an explicitly supplied, controller-minted projection. */
+export function configuredEnvironment(source: NodeJS.ProcessEnv | undefined): NodeJS.ProcessEnv {
+ const raw = source?.[CONFIGURED_ENVIRONMENT_KEYS];
+ if (raw === undefined) return {};
+ if (Buffer.byteLength(raw) > 20_000) throw new Error("Invalid configured environment projection");
+ let names: string[];
+ try { names = checkedNames(JSON.parse(raw)); } catch { throw new Error("Invalid configured environment projection"); }
+ const result: NodeJS.ProcessEnv = {};
+ let bytes = 0;
+ for (const name of names) {
+ const value = source?.[name];
+ if (typeof value !== "string" || value.includes("\0")) throw new Error("Invalid configured environment value");
+ const size = Buffer.byteLength(name) + Buffer.byteLength(value);
+ bytes += size;
+ if (size > 65_536 || bytes > 262_144) throw new Error("Configured environment exceeds its bounded launch size");
+ result[name] = value;
+ }
+ result[CONFIGURED_ENVIRONMENT_KEYS] = JSON.stringify(names);
+ return result;
+}
+
+export function configuredEnvironmentKeys(source: NodeJS.ProcessEnv | undefined): string[] {
+ return Object.keys(configuredEnvironment(source)).filter(key => key !== CONFIGURED_ENVIRONMENT_KEYS).sort();
+}
diff --git a/packages/paperclip-runner/src/contracts/completion-result.test.ts b/packages/paperclip-runner/src/contracts/completion-result.test.ts
index 796791e904a..b6a01818187 100644
--- a/packages/paperclip-runner/src/contracts/completion-result.test.ts
+++ b/packages/paperclip-runner/src/contracts/completion-result.test.ts
@@ -31,6 +31,17 @@ describe("provider-neutral completion result schema", () => {
const validate = new Ajv2020({ allErrors: true, strict: false })
.compile(PRP_COMPLETION_RESULT_OUTPUT_SCHEMA);
+ it("accepts an explicit monitor wait across provider and normalized schemas", () => {
+ const report = { ...baseResult, reportedWorkDisposition: "yielded",
+ completionClaim: { ...baseResult.completionClaim, objectiveSatisfied: false,
+ remainingWork: [{ description: "Check the next run", blocksCompletion: true }] },
+ continuation: { kind: "monitor", summary: "Wait for persisted timer", idempotencyKey: "monitor-wait" } };
+ expect(validate(report)).toBe(true);
+ const providerValidate = new Ajv2020({ allErrors: true, strict: false }).compile(PRP_COMPLETION_RESULT_PROVIDER_INPUT_SCHEMA);
+ expect(providerValidate(report)).toBe(true);
+ expect(validate({ ...report, continuation: { ...report.continuation, kind: "invented" } })).toBe(false);
+ });
+
it("allows done with no verification and no actionable attention", () => {
expect(validate(structuredClone(baseResult))).toBe(true);
});
diff --git a/packages/paperclip-runner/src/contracts/completion-result.ts b/packages/paperclip-runner/src/contracts/completion-result.ts
index 87d8a34a29b..781bdd85c63 100644
--- a/packages/paperclip-runner/src/contracts/completion-result.ts
+++ b/packages/paperclip-runner/src/contracts/completion-result.ts
@@ -3,7 +3,7 @@ export const PRP_COMPLETION_TOOL_NAME = "paperclip_finish" as const;
export const PRP_BLOCK_TOOL_NAME = "paperclip_block" as const;
/** Native Runner guidance; legacy adapters use their own skill/API completion paths. */
export const PRP_COMPLETION_TOOL_DESCRIPTION =
- "Report completed work (done), work requiring review (needs_review), or an explicit wait for the next response (yielded with response_wake). Use the current completion contract and supporting evidence. If rejected, correct the report and retry. After acceptance, read the returned outcome; do not claim completion while gated. Explain any required approval with its supplied link and action, then write the final response and end the turn without further tool calls.";
+ "Report completed work (done), work requiring review (needs_review), or an explicit wait (yielded with response_wake for a response, or monitor after set_task_monitor confirms a schedule on this task). Use the current completion contract and supporting evidence. If rejected, correct the report and retry. After acceptance, read the returned outcome; do not claim completion while gated. Explain any required approval with its supplied link and action, then write the final response and end the turn without further tool calls.";
export const PRP_BLOCK_TOOL_DESCRIPTION =
"Report work that cannot continue because of a concrete blocker. Identify the blocker, its owner, and the action needed to unblock it; use the current completion contract and supporting evidence. If rejected, correct the report and retry. After acceptance, read the returned outcome, explain the blocker and any required action in the final response, and end the turn without further tool calls.";
export const PRP_SEMANTIC_TOOL_NAMES = [
@@ -144,14 +144,14 @@ const artifactsSchema = {
},
} as const;
-const responseWakeContinuationSchema = {
+const waitContinuationSchema = {
type: "object",
description:
- "Required when reportedWorkDisposition is yielded. Wait for the next response without scheduling work; include kind, summary, and a stable idempotencyKey.",
+ "Required when reportedWorkDisposition is yielded. Use response_wake for a response wait, or monitor only after a real monitor is persisted on the current task. Include kind, summary, and a stable idempotencyKey.",
additionalProperties: false,
required: ["kind", "summary", "idempotencyKey"],
properties: {
- kind: { type: "string", const: "response_wake" },
+ kind: { type: "string", enum: ["response_wake", "monitor"] },
summary: {
type: "string",
minLength: 1,
@@ -192,7 +192,7 @@ export const PRP_COMPLETION_RESULT_OUTPUT_SCHEMA = {
properties: {
...commonResultProperties,
reportedWorkDisposition: { enum: ["done", "needs_review", "yielded"] },
- continuation: responseWakeContinuationSchema,
+ continuation: waitContinuationSchema,
},
allOf: [
{
@@ -367,10 +367,10 @@ export const PRP_COMPLETION_RESULT_PROVIDER_INPUT_SCHEMA = {
// tool calls. Give non-yielding results an explicit absence value instead
// of forcing callers to invent a response-wake continuation.
continuation: {
- ...responseWakeContinuationSchema,
+ ...waitContinuationSchema,
type: ["object", "null"],
description:
- "Use null or omit this field for done, completed, or needs_review. Only yielded requires a response-wake object with kind, summary, and idempotencyKey.",
+ "Use null or omit this field for done, completed, or needs_review. Only yielded requires a wait object with kind (response_wake or monitor), summary, and idempotencyKey.",
},
},
// Keep the provider-facing root a concrete object. Codex code-mode renders a
diff --git a/packages/paperclip-runner/src/contracts/external-provider.ts b/packages/paperclip-runner/src/contracts/external-provider.ts
new file mode 100644
index 00000000000..6012c88e587
--- /dev/null
+++ b/packages/paperclip-runner/src/contracts/external-provider.ts
@@ -0,0 +1,38 @@
+import { digestPaperclipSemanticContent } from "../semantic-tools/receipts.js";
+
+export const DOT_BRIDGE_REVISION = "dot-mcp-v1" as const;
+export interface DotBindingSnapshot {
+ bindingId: string;
+ bindingGeneration: number;
+ companyId: string;
+ agentId: string;
+ acceptByUnixMs: number;
+ expiresAtUnixMs: number;
+}
+export interface ExternalProviderBinding extends Omit {
+ runId: string;
+ normalizedSessionId: string;
+ turnId: string;
+ assignmentRevision: number;
+}
+export interface ExternalProviderOperation {
+ requestId: string;
+ bindingId: string;
+ bindingGeneration: number;
+ runId: string;
+ normalizedSessionId: string;
+ turnId: string;
+ assignmentRevision: number;
+ digest: string;
+ action: "accept" | "tool" | "progress" | "finish" | "renew";
+ input: Record;
+}
+/** Broker port uses only the authenticated run's existing PRP command lane. */
+export interface ExternalProviderPort {
+ dispatch(event: { sourceEventId: string; payload: Record }): Promise;
+ settle(event: { sourceEventId: string; payload: Record }): Promise;
+ attach(send: (operation: ExternalProviderOperation) => Promise, revoke?: () => Promise, hasProviderCheckpoint?: boolean): Promise<() => Promise>;
+}
+export function externalOperationDigest(action: ExternalProviderOperation["action"], input: Record): string {
+ return digestPaperclipSemanticContent({ action, input });
+}
diff --git a/packages/paperclip-runner/src/contracts/native-execution.test.ts b/packages/paperclip-runner/src/contracts/native-execution.test.ts
index d4a4370f188..460a43534c6 100644
--- a/packages/paperclip-runner/src/contracts/native-execution.test.ts
+++ b/packages/paperclip-runner/src/contracts/native-execution.test.ts
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
import { QUALIFIED_ACPX_PROFILES } from "../drivers/acpx/qualified-profiles.js";
import { describe, expect, it } from "vitest";
-import { buildNativeModelEnvelope, parseNativeExecutionInput, NATIVE_EXECUTION_INPUT_SCHEMA, type NativeExecutionInputV1 } from "./native-execution.js";
+import { buildNativeModelEnvelope, parseNativeExecutionInput, NATIVE_EXECUTION_INPUT_SCHEMA, NATIVE_EXECUTION_INPUT_SCHEMA_V6, type NativeExecutionInputV1 } from "./native-execution.js";
import {
NATIVE_RUNTIME_ASSET_SCHEMA,
PAPERCLIP_EXECUTION_PROMPT,
@@ -57,6 +57,34 @@ const input: NativeExecutionInputV1 = {
};
describe("NativeExecutionInputV1", () => {
+ it.each(["paperclip.native-execution-input.v3", "paperclip.native-execution-input.v4", NATIVE_EXECUTION_INPUT_SCHEMA])(
+ "preserves a saved %s execution through recovery parsing",
+ (schema) => {
+ const digest = "0".repeat(64);
+ const text = "Saved system instructions absent from the current release.";
+ const context = {
+ prompt: { revision: "saved-prompt-before-upgrade", text, digest: createHash("sha256").update(text).digest("hex") },
+ instructions: {
+ entryPath: "AGENTS.md",
+ bundle: { schema: NATIVE_RUNTIME_ASSET_SCHEMA, digest, manifestDigest: digest, rootPath: "/runtime/instructions", fileCount: 1, totalBytes: 42 },
+ },
+ skills: [],
+ mcp: { assignmentSetId: "none", digest, bindingId: null },
+ };
+ const persisted = JSON.parse(JSON.stringify({
+ ...input,
+ schema,
+ provider: schema === "paperclip.native-execution-input.v3" ? input.provider : { ...input.provider, approvalPolicy: "never" },
+ executionMode: "default",
+ planningContext: null,
+ runtimeContext: { ...context, aggregateDigest: canonicalNativeRuntimeContextDigest(context) },
+ }));
+ const recovered = parseNativeExecutionInput(persisted);
+ expect(recovered.runtimeContext).toEqual(persisted.runtimeContext);
+ expect(parseNativeExecutionInput(recovered)).toEqual(recovered);
+ },
+ );
+
it("parses v3 immutable runtime context without changing the model task envelope", () => {
const digest = "0".repeat(64);
const context = {
@@ -121,7 +149,8 @@ describe("NativeExecutionInputV1", () => {
expect(delta).toEqual({
schema: "paperclip.native-continuation.v1",
events: '{"messages":[{"authorType":"user","body":"Just this new comment"}]}',
- completion: { revision: "1", criterionIds: ["objective"] },
+ completion: { revision: "1", criterionIds: ["objective"],
+ instruction: "Before ending this turn, obtain one accepted paperclip_finish or paperclip_block result. Earlier reports belong to earlier turns; a final message alone does not complete this turn." },
});
expect(JSON.stringify(delta)).not.toContain(input.task.title);
expect(JSON.stringify(delta)).not.toContain(input.completionContract.contract.objective);
diff --git a/packages/paperclip-runner/src/contracts/native-execution.ts b/packages/paperclip-runner/src/contracts/native-execution.ts
index 1edf358ee2f..194920c3e96 100644
--- a/packages/paperclip-runner/src/contracts/native-execution.ts
+++ b/packages/paperclip-runner/src/contracts/native-execution.ts
@@ -1,3 +1,4 @@
+import type { DotBindingSnapshot } from "./external-provider.js";
import { QUALIFIED_ACPX_VERSION } from "../drivers/acpx/generated-profiles.js";
import { isSupportedAcpxProfileVersion, type AcpxProfileVersion } from "../drivers/acpx/profile-compatibility.js";
import { isProviderMode } from "./provider-mode.js";
@@ -8,6 +9,7 @@ import { explicitTaskSkillNames, parseNativeRuntimeContext, type NativeRuntimeCo
export const NATIVE_EXECUTION_INPUT_SCHEMA_V1 = "paperclip.native-execution-input.v1" as const;
export const NATIVE_EXECUTION_INPUT_SCHEMA_V2 = "paperclip.native-execution-input.v2" as const;
export const NATIVE_EXECUTION_INPUT_SCHEMA_V3 = "paperclip.native-execution-input.v3" as const;
+export const NATIVE_EXECUTION_INPUT_SCHEMA_V6 = "paperclip.native-execution-input.v6" as const;
export const NATIVE_EXECUTION_INPUT_SCHEMA_V4 = "paperclip.native-execution-input.v4" as const;
export const NATIVE_EXECUTION_INPUT_SCHEMA = "paperclip.native-execution-input.v5" as const;
export const NATIVE_MODEL_ENVELOPE_SCHEMA_V1 = "paperclip.native-model-envelope.v1" as const;
@@ -236,7 +238,14 @@ export interface NativeExecutionInputV5 extends Omit {
+ schema: typeof NATIVE_EXECUTION_INPUT_SCHEMA_V6;
+ provider: { kind: "openai_dot"; model: null; binding: DotBindingSnapshot };
+ workspace: { access: "none"; cwd: null; repoUrl: null; repoRef: null; branchName: null };
+ session: Omit & { driverKind: "openai_dot_mcp" };
+}
+
+export type NativeExecutionInput = NativeExecutionInputV1 | NativeExecutionInputV2 | NativeExecutionInputV3 | NativeExecutionInputV4 | NativeExecutionInputV5 | NativeExecutionInputV6;
/** The only task data that may enter provider-visible model input. */
export interface NativeModelEnvelopeV1 {
@@ -325,8 +334,44 @@ function nullableText(value: unknown, path: string): string | null {
* intentionally not an extensible metadata bag: new fields require a contract
* revision and an explicit security review.
*/
+function parseDotNativeExecutionInput(input: Record): NativeExecutionInputV6 {
+ const provider = record(input.provider, "input.provider");
+ exactKeys(provider, ["kind", "model", "binding"], "input.provider");
+ const b = record(provider.binding, "input.provider.binding");
+ exactKeys(b, ["bindingId", "bindingGeneration", "companyId", "agentId", "acceptByUnixMs", "expiresAtUnixMs"], "input.provider.binding");
+ const binding = record(input.binding, "input.binding");
+ const workspace = record(input.workspace, "input.workspace");
+ exactKeys(workspace, ["access", "cwd", "repoUrl", "repoRef", "branchName"], "input.workspace");
+ const session = record(input.session, "input.session");
+ if (provider.kind !== "openai_dot" || provider.model !== null || workspace.access !== "none"
+ || [workspace.cwd, workspace.repoUrl, workspace.repoRef, workspace.branchName].some(v => v !== null)
+ || session.driverKind !== "openai_dot_mcp" || record(session.lifecyclePolicy, "input.session.lifecyclePolicy").mode !== "per_turn"
+ || binding.companyId !== b.companyId || binding.agentId !== b.agentId
+ || !Number.isSafeInteger(b.bindingGeneration) || Number(b.bindingGeneration) < 1
+ || !Number.isSafeInteger(b.acceptByUnixMs) || !Number.isSafeInteger(b.expiresAtUnixMs)
+ || Number(b.acceptByUnixMs) < 1 || Number(b.acceptByUnixMs) >= Number(b.expiresAtUnixMs)
+ || Number(b.expiresAtUnixMs) - Number(b.acceptByUnixMs) > 86_400_000
+ || !Array.isArray(input.credentialBindings) || input.credentialBindings.length !== 0) {
+ throw new NativeExecutionInputError("Dot v6 requires a bound per-turn remote service with no filesystem or credential access");
+ }
+ // Reuse the preceding closed contract's task/context validation. The local
+ // validation value never leaves this function or becomes an execution path.
+ const common = parseNativeExecutionInput({ ...input, schema: NATIVE_EXECUTION_INPUT_SCHEMA,
+ provider: { kind: "codex", model: null, approvalPolicy: "never" },
+ session: { ...session, driverKind: "codex_app_server" },
+ workspace: { cwd: "/", repoUrl: null, repoRef: null, branchName: null } }) as NativeExecutionInputV5;
+ return { ...common, schema: NATIVE_EXECUTION_INPUT_SCHEMA_V6,
+ provider: { kind: "openai_dot", model: null, binding: {
+ bindingId: text(b.bindingId, "input.provider.binding.bindingId"), bindingGeneration: Number(b.bindingGeneration),
+ companyId: text(b.companyId, "input.provider.binding.companyId"), agentId: text(b.agentId, "input.provider.binding.agentId"),
+ acceptByUnixMs: Number(b.acceptByUnixMs), expiresAtUnixMs: Number(b.expiresAtUnixMs),
+ } }, workspace: { access: "none", cwd: null, repoUrl: null, repoRef: null, branchName: null },
+ session: { ...common.session, driverKind: "openai_dot_mcp" } };
+}
+
export function parseNativeExecutionInput(value: unknown): NativeExecutionInput {
const input = record(value, "input");
+ if (input.schema === NATIVE_EXECUTION_INPUT_SCHEMA_V6) return parseDotNativeExecutionInput(input);
const isV5 = input.schema === NATIVE_EXECUTION_INPUT_SCHEMA;
const isV4 = isV5 || input.schema === NATIVE_EXECUTION_INPUT_SCHEMA_V4;
const isV3 = isV4 || input.schema === NATIVE_EXECUTION_INPUT_SCHEMA_V3;
@@ -828,7 +873,7 @@ function parseCompletionSources(value: unknown): NativeCompletionSources {
export interface NativeContinuationEnvelope {
schema: "paperclip.native-continuation.v1";
events: string;
- completion: { revision: string; criterionIds: string[] };
+ completion: { revision: string; criterionIds: string[]; instruction: string };
}
export function buildNativeModelEnvelope(input: NativeExecutionInput, options: { resumedSession: true }): NativeModelEnvelopeV1 | NativeModelEnvelopeV2 | NativeModelEnvelopeV3 | NativeContinuationEnvelope;
@@ -841,6 +886,7 @@ export function buildNativeModelEnvelope(input: NativeExecutionInput, options?:
completion: {
revision: input.completionContract.contract.revision,
criterionIds: input.completionContract.contract.criteria.map((criterion) => criterion.id),
+ instruction: "Before ending this turn, obtain one accepted paperclip_finish or paperclip_block result. Earlier reports belong to earlier turns; a final message alone does not complete this turn.",
},
};
}
@@ -855,7 +901,7 @@ export function buildNativeModelEnvelope(input: NativeExecutionInput, options?:
interactionResponses: structuredClone(input.interactionResponses),
};
}
- if (input.schema === NATIVE_EXECUTION_INPUT_SCHEMA) {
+ if (input.schema === NATIVE_EXECUTION_INPUT_SCHEMA || input.schema === NATIVE_EXECUTION_INPUT_SCHEMA_V6) {
const sourceBinding = input.completionSources;
const references = sourceBinding?.contractRevision === input.completionContract.contract.revision
&& sourceBinding.promptSha256 === createHash("sha256").update(input.task.prompt).digest("hex")
@@ -874,7 +920,7 @@ export function buildNativeModelEnvelope(input: NativeExecutionInput, options?:
},
executionMode: input.executionMode,
planningContext: structuredClone(input.planningContext),
- workspace: input.provider.kind === "claude_managed" || input.provider.kind === "aws_agentcore" ? null : { cwd: input.workspace.cwd },
+ workspace: input.schema === NATIVE_EXECUTION_INPUT_SCHEMA_V6 || input.provider.kind === "claude_managed" || input.provider.kind === "aws_agentcore" ? null : { cwd: input.workspace.cwd },
completionContract: {
...structuredClone(input.completionContract.contract),
criteria: input.completionContract.contract.criteria.map((criterion) => {
diff --git a/packages/paperclip-runner/src/contracts/native-session-backend.ts b/packages/paperclip-runner/src/contracts/native-session-backend.ts
index 87af9e2ad05..f473b56a03e 100644
--- a/packages/paperclip-runner/src/contracts/native-session-backend.ts
+++ b/packages/paperclip-runner/src/contracts/native-session-backend.ts
@@ -63,6 +63,10 @@ export interface PersistedNativeSession {
terminal?: PrpTerminalState | null;
activeTurnId?: string | null;
terminalTurns?: PersistedHarnessTurnTerminal[];
+ /** Control-plane disposition bound to the exact committed tool event. It is
+ * independent of the interaction's later answer and proves no provider terminal. */
+ governedWait?: { sourceEvent: PrpEvent; result: PrpStructuredRunResult };
+
/** At-most-once marker for resultless disposition repair or restart continuation. */
dispositionOnlyRecoveryConsumed?: boolean;
dispositionOnlyRecoveryTurnId?: string | null;
@@ -200,6 +204,9 @@ export interface NativeSession {
correlationId?: string;
}): Promise;
interrupt?(input: { turnId?: string; reason?: string }): Promise;
+ /** Revoke publication synchronously while the control plane journals a wait.
+ * Does not interrupt the provider; cancel owns the subsequent passive cleanup. */
+ revokeTurnPublication?(): void;
/** Commit cancellation synchronously; the returned promise owns cleanup only. */
cancel?(input: {
reason: string;
diff --git a/packages/paperclip-runner/src/contracts/runtime-context.test.ts b/packages/paperclip-runner/src/contracts/runtime-context.test.ts
new file mode 100644
index 00000000000..09a931317cf
--- /dev/null
+++ b/packages/paperclip-runner/src/contracts/runtime-context.test.ts
@@ -0,0 +1,107 @@
+import { createHash } from "node:crypto";
+import { describe, expect, it } from "vitest";
+import {
+ NATIVE_RUNTIME_ASSET_SCHEMA,
+ PAPERCLIP_EXECUTION_PROMPT,
+ PAPERCLIP_EXECUTION_PROMPT_REVISION,
+ canonicalNativeRuntimeContextDigest,
+ composeNativeSystemInstructions,
+ parseNativeRuntimeContext,
+} from "./runtime-context.js";
+
+const hash = (text: string) => createHash("sha256").update(text).digest("hex");
+
+function savedContext(revision: string, text: string) {
+ const digest = "0".repeat(64);
+ const context = {
+ prompt: { revision, text, digest: hash(text) },
+ instructions: {
+ entryPath: "AGENTS.md",
+ bundle: { schema: NATIVE_RUNTIME_ASSET_SCHEMA, digest, manifestDigest: digest, rootPath: "/runtime/instructions", fileCount: 1, totalBytes: 42 },
+ },
+ skills: [],
+ mcp: { assignmentSetId: "none", digest, bindingId: "native-mcp:run-1" },
+ connectionInstructions: { text: "Saved connection instructions", digest: hash("Saved connection instructions") },
+ };
+ // This is persisted wire data, deliberately created independently of the parser.
+ return {
+ ...context,
+ aggregateDigest: hash(JSON.stringify({
+ prompt: context.prompt,
+ instructions: { entryPath: context.instructions.entryPath, bundleDigest: digest },
+ skills: [],
+ mcp: { assignmentSetId: "none", digest },
+ connectionInstructions: context.connectionInstructions,
+ })),
+ };
+}
+
+describe("persisted native execution prompts", () => {
+ it.each([
+ ["snapshot-before-upgrade", "Saved instructions from before the upgrade."],
+ ["future-prompt-fixture", " Saved instructions absent from this release.\n"],
+ [PAPERCLIP_EXECUTION_PROMPT_REVISION, "Saved text under a revision reused by a later release."],
+ ["__proto__", "The revision is opaque metadata."],
+ ])(
+ "recovers %s without a prompt catalog or rewriting its saved instructions",
+ (revision, text) => {
+ const persisted = JSON.parse(JSON.stringify(savedContext(revision, text)));
+ const parsed = parseNativeRuntimeContext(persisted);
+ expect(parsed).toEqual(persisted);
+ expect(canonicalNativeRuntimeContextDigest(parsed)).toBe(persisted.aggregateDigest);
+ expect(parseNativeRuntimeContext(parsed)).toEqual(persisted);
+ expect(composeNativeSystemInstructions(parsed, "Agent instructions")).toBe(
+ `${text}\n\nAgent instructions\n\nSaved connection instructions\n\nRead-only instruction sibling root: /runtime/instructions`,
+ );
+ },
+ );
+
+ it("keeps the current prompt valid for new executions", () => {
+ const current = savedContext(PAPERCLIP_EXECUTION_PROMPT_REVISION, PAPERCLIP_EXECUTION_PROMPT);
+ expect(parseNativeRuntimeContext(current)).toEqual(current);
+ });
+
+ it.each(["revision", "text"])("requires a non-empty prompt %s", (field) => {
+ const persisted = savedContext("saved-prompt", "Saved instructions.");
+ for (const value of [undefined, null, 42, {}, "", " \n"]) {
+ expect(() => parseNativeRuntimeContext({
+ ...persisted,
+ prompt: { ...persisted.prompt, [field]: value },
+ })).toThrow(`input.runtimeContext.prompt.${field} must be a non-empty string`);
+ }
+ });
+
+ it("rejects altered text and malformed or mismatched prompt hashes", () => {
+ const persisted = savedContext("saved-prompt", "Saved instructions.");
+ expect(() => parseNativeRuntimeContext({
+ ...persisted, prompt: { ...persisted.prompt, text: "Changed instructions." },
+ })).toThrow("prompt.digest does not match prompt text");
+ for (const digest of [undefined, null, "", "not-a-hash", "f".repeat(64)]) {
+ expect(() => parseNativeRuntimeContext({
+ ...persisted, prompt: { ...persisted.prompt, digest },
+ })).toThrow("input.runtimeContext.prompt.digest");
+ }
+ });
+
+ it("rejects a prompt change with a matching text hash but a stale aggregate digest", () => {
+ const persisted = savedContext("saved-prompt", "Saved instructions.");
+ const changed = savedContext("changed-prompt", "Changed instructions.");
+ expect(() => parseNativeRuntimeContext({
+ ...persisted, prompt: changed.prompt,
+ })).toThrow("aggregateDigest does not match the canonical context");
+ });
+
+ it("includes the saved revision in the aggregate digest", () => {
+ const persisted = savedContext("saved-prompt", "Saved instructions.");
+ expect(() => parseNativeRuntimeContext({
+ ...persisted, prompt: { ...persisted.prompt, revision: "changed-revision" },
+ })).toThrow("aggregateDigest does not match the canonical context");
+ });
+
+ it("rejects aggregate context drift", () => {
+ const persisted = savedContext("saved-prompt", "Saved instructions.");
+ expect(() => parseNativeRuntimeContext({
+ ...persisted, aggregateDigest: "f".repeat(64),
+ })).toThrow("aggregateDigest does not match the canonical context");
+ });
+});
diff --git a/packages/paperclip-runner/src/contracts/runtime-context.ts b/packages/paperclip-runner/src/contracts/runtime-context.ts
index c7417c2c99a..810556ac49f 100644
--- a/packages/paperclip-runner/src/contracts/runtime-context.ts
+++ b/packages/paperclip-runner/src/contracts/runtime-context.ts
@@ -1,8 +1,8 @@
import { createHash } from "node:crypto";
export const NATIVE_RUNTIME_ASSET_SCHEMA = "paperclip.runtime-asset.v1" as const;
-export const PAPERCLIP_EXECUTION_PROMPT_REVISION = "paperclip-execution.v5" as const;
-export const PAPERCLIP_EXECUTION_PROMPT = "You are running as a Paperclip agent. Complete the assigned task in the provided execution environment. Follow the attached agent instructions and use assigned skills and tools when relevant. Use Paperclip tools for coordination. To hire or reuse a persistent teammate, use list_agents, then search_api for agent-hires and call_api if a hire is needed. Provider helper threads do not create Paperclip agents. When the user assigns work or a revision to a teammate, use create_task with that agent's ID; review their result rather than doing their assigned work yourself. When remaining work depends on a child task, use set_dependencies to add its ID while preserving existing blocker IDs. Complete independent work, then call paperclip_block with the child agent as owner and child completion as the unblock action. End the turn so the child can use the workspace. Do not sleep or poll for child results while holding the workspace. Paperclip resumes the parent when the dependency completes. When the user asks to connect a service, call connections_search before any service tool, even when that tool is already installed. Follow the returned instruction and wait for any required user choice before executing. For other tasks needing a service, use installed tools if available; otherwise use connections_search and follow its instruction. The request appears as a card in the task. Finish independent work before yielding for access; do not poll or request the same connection repeatedly. Paperclip will continue automatically with updated tools after resolution. After a decline, pursue alternatives unless the user explicitly asks to retry. Finish exactly once with `paperclip_finish` or `paperclip_block`." as const;
+export const PAPERCLIP_EXECUTION_PROMPT_REVISION = "paperclip-execution.v6" as const;
+export const PAPERCLIP_EXECUTION_PROMPT = "You are running as a Paperclip agent. Complete the assigned task in the provided execution environment. Follow the attached agent instructions and use assigned skills and tools when relevant. Use Paperclip tools for coordination. To hire or reuse a persistent teammate, use list_agents, then search_api for agent-hires and call_api if a hire is needed. Provider helper threads do not create Paperclip agents. When the user assigns work or a revision to a teammate, use create_task with that agent's ID; review their result rather than doing their assigned work yourself. When remaining work depends on a child task, use set_dependencies to add its ID while preserving existing blocker IDs. Complete independent work, then call paperclip_block with the child agent as owner and child completion as the unblock action. End the turn so the child can use the workspace. Do not sleep or poll for child results while holding the workspace. Paperclip resumes the parent when the dependency completes. When the user asks to connect a service, call connections_search before any service tool, even when that tool is already installed. Follow the returned instruction and wait for any required user choice before executing. For other tasks needing a service, use installed tools if available; otherwise use connections_search and follow its instruction. The request appears as a card in the task. Finish independent work before yielding for access; do not poll or request the same connection repeatedly. Paperclip will continue automatically with updated tools after resolution. After a decline, pursue alternatives unless the user explicitly asks to retry. For a deferred check you own, call set_task_monitor with a future nextCheckAt and notes. Confirm the persisted schedule on the current task, then call paperclip_finish with reportedWorkDisposition yielded and continuation.kind monitor. End the turn; the one-shot monitor wakes you with issue_monitor_due. Re-arm explicitly only if another check is needed. Do not claim a monitor exists without its receipt. Finish exactly once with `paperclip_finish` or `paperclip_block`." as const;
export interface NativeRuntimeAssetReference {
schema: typeof NATIVE_RUNTIME_ASSET_SCHEMA;
@@ -14,7 +14,7 @@ export interface NativeRuntimeAssetReference {
}
export interface NativeRuntimeContextSnapshot {
- prompt: { revision: typeof PAPERCLIP_EXECUTION_PROMPT_REVISION; text: typeof PAPERCLIP_EXECUTION_PROMPT; digest: string };
+ prompt: { revision: string; text: string; digest: string };
instructions: {
entryPath: string;
bundle: NativeRuntimeAssetReference;
@@ -103,10 +103,12 @@ export function parseNativeRuntimeContext(value: unknown): NativeRuntimeContextS
exact(context, ["prompt", "instructions", "skills", "mcp", "connectionInstructions", "aggregateDigest"], "input.runtimeContext");
const prompt = object(context.prompt, "input.runtimeContext.prompt");
exact(prompt, ["revision", "text", "digest"], "input.runtimeContext.prompt");
- if (prompt.revision !== PAPERCLIP_EXECUTION_PROMPT_REVISION || prompt.text !== PAPERCLIP_EXECUTION_PROMPT) {
- throw new NativeRuntimeContextError("input.runtimeContext.prompt must match the fixed Paperclip prompt revision");
- }
- if (digest(prompt.digest, "input.runtimeContext.prompt.digest") !== nativeRuntimePromptDigest()) {
+ // New runs use the current constants. Recovery uses the immutable saved
+ // snapshot; its revision is metadata, not a lookup in this release's source.
+ const promptRevision = text(prompt.revision, "input.runtimeContext.prompt.revision");
+ const promptText = text(prompt.text, "input.runtimeContext.prompt.text");
+ const promptDigest = digest(prompt.digest, "input.runtimeContext.prompt.digest");
+ if (sha256(promptText) !== promptDigest) {
throw new NativeRuntimeContextError("input.runtimeContext.prompt.digest does not match prompt text");
}
const instructions = object(context.instructions, "input.runtimeContext.instructions");
@@ -140,7 +142,7 @@ export function parseNativeRuntimeContext(value: unknown): NativeRuntimeContextS
connectionInstructions = { text: content, digest: contentDigest };
}
const parsed = {
- prompt: { revision: PAPERCLIP_EXECUTION_PROMPT_REVISION, text: PAPERCLIP_EXECUTION_PROMPT, digest: nativeRuntimePromptDigest() },
+ prompt: { revision: promptRevision, text: promptText, digest: promptDigest },
instructions: {
entryPath: safeRelativePath(instructions.entryPath, "input.runtimeContext.instructions.entryPath"),
bundle: parseAsset(instructions.bundle, "input.runtimeContext.instructions.bundle"),
diff --git a/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.test.ts b/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.test.ts
index 5a77fc4d39e..24e9fc98fc9 100644
--- a/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.test.ts
+++ b/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.test.ts
@@ -3590,3 +3590,45 @@ describe("DurablePrpControlPlane", () => {
}
});
});
+
+it("retires late semantic receipts without overwriting a successor journal or replaying the write", async () => {
+ const root = mkdtempSync(resolve(tmpdir(), "runner-semantic-retirement-"));
+ let release!: () => void;
+ const held = new Promise(resolveHeld => { release = resolveHeld; });
+ const handler = vi.fn(async () => { await held; return { result: { committed: true } }; });
+ const options = { stateDirectory: root, identity, expectedRunnerVersion, expectedRunnerDigest, onSemanticToolInput: handler };
+ const core = new DurablePrpControlPlane(options);
+ let successor: DurablePrpControlPlane | undefined;
+ let client: AuthenticatedClient | null = null;
+ let replay: AuthenticatedClient | null = null;
+ try {
+ await core.start();
+ expect(() => core.retireSemanticToolCallbacks()).toThrow("drained, stopped ingress");
+ client = await authenticate(core, core.issueBootstrapTicket());
+ sendSecure(client!, semanticInputEvent());
+ await vi.waitFor(() => expect(handler).toHaveBeenCalledOnce());
+ await core.stop();
+ await core.drainPendingConnectionProcessing();
+ core.retireSemanticToolCallbacks();
+ successor = new DurablePrpControlPlane(options);
+ const command = successor.queueCommand("turn.stop", {}, "successor-stop");
+ release();
+ await new Promise(resolveTurn => setImmediate(resolveTurn));
+ const saved = JSON.parse(readFileSync(resolve(root, "control-plane-state.json"), "utf8"));
+ expect(saved.commands.map((entry: { commandId: string }) => entry.commandId)).toEqual([command.commandId]);
+ expect(successor.semanticToolResultsSettled()).toBe(false);
+ await successor.start();
+ replay = await authenticate(successor, successor.issueBootstrapTicket());
+ sendSecure(replay!, semanticInputEvent());
+ await vi.waitFor(() => expect(successor!.store.state.ackedSourceSeq).toBe(1));
+ await new Promise(resolveTurn => setImmediate(resolveTurn));
+ expect(handler).toHaveBeenCalledOnce();
+ expect(successor.store.state.commands.some(entry => entry.type === "semantic_tool.result")).toBe(false);
+ } finally {
+ release();
+ client?.socket.destroy(); replay?.socket.destroy();
+ await core.stop(); await core.drainPendingConnectionProcessing();
+ await successor?.stop(); await successor?.drainPendingConnectionProcessing();
+ rmSync(root, { recursive: true, force: true });
+ }
+});
diff --git a/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts b/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts
index 32455a8ff72..4506427c6d7 100644
--- a/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts
+++ b/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts
@@ -1,3 +1,4 @@
+import { configuredEnvironment } from "../configured-environment.js";
import { spawn } from "node:child_process";
import {
createCipheriv,
@@ -45,7 +46,7 @@ import {
const protocol = "paperclip.runner";
const protocolMinVersion = 1;
-const protocolVersion = 2;
+const protocolVersion = 3;
const secureFrameSchema = "paperclip.runner.secure-frame.v1";
const websocketGuid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
const coreStateSchema = "paperclip.runner.durable.control-plane-state.v1";
@@ -79,6 +80,7 @@ const commandTypes = new Set([
"request.resolve",
"interaction.receipt",
"semantic_tool.result",
+ "external_provider.operation",
"session.snapshot",
"session.goal.get",
"session.goal.set",
@@ -701,7 +703,7 @@ function isStoredCoreState(
(command, index) =>
isRecord(command) &&
(command.schema === "paperclip.prp.command.v1" ||
- command.schema === "paperclip.prp.command.v2") &&
+ command.schema === "paperclip.prp.command.v2" || command.schema === "paperclip.prp.command.v3") &&
typeof command.commandId === "string" &&
stableIdPattern.test(command.commandId) &&
command.commandId.length <= 160 &&
@@ -1492,6 +1494,7 @@ export class DurablePrpControlPlane {
#connections = new Set();
#connectionProcessing = new Map>();
#pendingSemanticCalls = new Set();
+ #semanticCallbacksRetired = false;
#semanticResultPersistenceFailed = false;
#semanticResultFailures: Array<{
callId: string;
@@ -1628,6 +1631,16 @@ export class DurablePrpControlPlane {
}
}
+ /** Retire this journal writer after stopped ingress is fully joined. A late
+ * external effect keeps its committed input pending for reconciliation;
+ * it must never overwrite the successor controller's durable state. */
+ retireSemanticToolCallbacks(): void {
+ if (this.#server !== null || this.#connections.size !== 0 || this.#connectionProcessing.size !== 0) {
+ throw new Error("Semantic callback retirement requires drained, stopped ingress.");
+ }
+ this.#semanticCallbacksRetired = true;
+ }
+
/** Forces a resumable re-authentication after an immutable run attachment rotates. */
disconnectActiveRunner(): void {
const connections = [...this.#connections];
@@ -1960,7 +1973,7 @@ export class DurablePrpControlPlane {
}
const controllerSeq = this.#store.state.commands.length + 1;
const command: DurableRecoveryCoreCommand = {
- schema: type.startsWith("session.goal.")
+ schema: type === "external_provider.operation" ? "paperclip.prp.command.v3" : type.startsWith("session.goal.")
? "paperclip.prp.command.v2"
: "paperclip.prp.command.v1",
commandId:
@@ -3299,6 +3312,7 @@ export class DurablePrpControlPlane {
this.disconnectActiveRunner();
};
const queueResult = (result: unknown, isError: boolean): void => {
+ if (this.#semanticCallbacksRetired) return;
try {
// Retain the full input once in its canonical event. Copying a
// large write into its result command can exceed the wire bound
diff --git a/packages/paperclip-runner/src/control-plane/prp-transport-types.ts b/packages/paperclip-runner/src/control-plane/prp-transport-types.ts
index e90b1529d81..87e7d5eb69c 100644
--- a/packages/paperclip-runner/src/control-plane/prp-transport-types.ts
+++ b/packages/paperclip-runner/src/control-plane/prp-transport-types.ts
@@ -27,7 +27,7 @@ export interface DurableWarmRunTransition {
}
export interface DurableRecoveryCoreCommand {
- schema: "paperclip.prp.command.v1" | "paperclip.prp.command.v2";
+ schema: "paperclip.prp.command.v1" | "paperclip.prp.command.v2" | "paperclip.prp.command.v3";
commandId: string;
controllerSeq: number;
type: string;
diff --git a/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts
index bc711146f1c..0f2f5a134a9 100644
--- a/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts
@@ -22,12 +22,12 @@ export const QUALIFIED_ACPX_PROFILE_DATA = {
"protocolVersion": 1,
"acpxVersion": "0.13.1",
"agent": "pi",
- "agentProfileVersion": 19,
+ "agentProfileVersion": 20,
"agentServerPackage": "pi-acp",
"agentServerVersion": "0.0.33",
"agentRuntimePackage": "@earendil-works/pi-coding-agent",
"agentRuntimeVersion": "1.0.0",
- "commandDigest": "sha256:b7647ebf97f802ca053ec3384c912bf0e8d18eba308d27397bb1d95a37220825",
+ "commandDigest": "sha256:465ae72460f05cae961873f09cd7cd3652dc3a6949930b7ee16303925cd3dd0e",
"permissionPolicy": "interactive"
},
"cursor": {
diff --git a/packages/paperclip-runner/src/drivers/acpx/pi-installation.test.ts b/packages/paperclip-runner/src/drivers/acpx/pi-installation.test.ts
index 34cabe12445..98d74b040b0 100644
--- a/packages/paperclip-runner/src/drivers/acpx/pi-installation.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/pi-installation.test.ts
@@ -64,11 +64,19 @@ describe("Pi installation factory", () => {
expect(current.commandDigest).not.toBe(prior.commandDigest);
});
+ it("revises only the shared Codex environment attestation while preserving Pi runtime bytes", async () => {
+ const read = async (version: number) => JSON.parse(await readFile(new URL(`../../../test-fixtures/pi-acp/profile-v${version}-identity.json`, import.meta.url), "utf8"));
+ const prior = await read(19), current = await read(20);
+ expect(Object.keys(current.declaration).filter(key => JSON.stringify(current.declaration[key]) !== JSON.stringify(prior.declaration[key])).sort())
+ .toEqual(["agentProfileVersion", "runtimeSandboxSourceSha256"]);
+ expect(current.commandDigest).not.toBe(prior.commandDigest);
+ });
+
it("binds the profile declaration to the reviewed patch and platform closure pins", async () => {
const hash = (bytes: string | Uint8Array) => createHash("sha256").update(bytes).digest("hex");
const canonical = (value: any): string => Array.isArray(value) ? `[${value.map(canonical).join(",")}]`
: value && typeof value === "object" ? `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}` : JSON.stringify(value);
- const identity = JSON.parse(await readFile(new URL("../../../test-fixtures/pi-acp/profile-v19-identity.json", import.meta.url), "utf8"));
+ const identity = JSON.parse(await readFile(new URL("../../../test-fixtures/pi-acp/profile-v20-identity.json", import.meta.url), "utf8"));
const declaration = identity.declaration;
expect(declaration.sharedRuntimeContract).toBe("paperclip.acpx-runtime-contract.v1");
expect(identity.commandDigest).toBe(`sha256:${hash(canonical(declaration))}`);
@@ -98,21 +106,21 @@ describe("Pi installation factory", () => {
it("rejects legacy profiles and tampered executable identities", () => {
expect(() => assertPiInstallationProfile(candidate())).not.toThrow();
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 1 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 2 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 3 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 4 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 5 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 6 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 7 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 8 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 9 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 10 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 11 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 12 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 13 })).toThrow("version 19");
- expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 14 })).toThrow("version 19");
- for (const priorVersion of [15, 16, 17, 18]) expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: priorVersion })).toThrow("version 19");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 1 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 2 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 3 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 4 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 5 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 6 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 7 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 8 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 9 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 10 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 11 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 12 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 13 })).toThrow("version 20");
+ expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: 14 })).toThrow("version 20");
+ for (const priorVersion of [15, 16, 17, 18, 19]) expect(() => assertPiInstallationProfile({ ...candidate(), agentProfileVersion: priorVersion })).toThrow("version 20");
for (const changed of [{ agentServerVersion: "latest" }, { commandDigest: `sha256:${"0".repeat(64)}` }, { agentRuntimePackage: "ambient-pi" }]) {
expect(() => assertPiInstallationProfile({ ...candidate(), ...changed })).toThrow("trusted declaration");
}
diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.ts b/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.ts
index 3cf4d702a5a..46f14dae812 100644
--- a/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.ts
@@ -2,12 +2,12 @@ import { QUALIFIED_ACPX_PROFILE_DATA } from "./generated-profiles.js";
/** Decodable historical profile revisions, not permission to launch them.
* Exact current profile/package/digest admission is checked separately. */
-type HistoricalAcpxProfileVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18;
+type HistoricalAcpxProfileVersion = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19;
type CurrentAcpxProfileVersion = typeof QUALIFIED_ACPX_PROFILE_DATA[keyof typeof QUALIFIED_ACPX_PROFILE_DATA]["agentProfileVersion"];
export type AcpxProfileVersion = HistoricalAcpxProfileVersion | CurrentAcpxProfileVersion;
const historicalVersions: Readonly> = {
- pi: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], claude: [1, 2, 3, 4, 5], codex: [1, 2, 3, 4, 5],
+ pi: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], claude: [1, 2, 3, 4, 5], codex: [1, 2, 3, 4, 5],
grok: [1, 2, 3, 4, 5], copilot: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
cursor: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
};
diff --git a/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts b/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts
index 2eede3fed46..2459dab2763 100644
--- a/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts
@@ -1220,12 +1220,15 @@ describe("ACPX runtime host", () => {
it("bounds post-handshake model verification and cleans the runtime", async () => {
const fixture = await hostFixture();
+ const credential = credentialLeaseFixture(fixture.root);
+ const getStatus = vi.fn(() => new Promise(() => undefined));
const runtime = runtimePort({
- getStatus: () => new Promise(() => undefined),
+ getStatus,
});
const dependencies = fixture.dependencies({
openRuntime: async () => runtime,
});
+ dependencies.stageCredential = vi.fn(async () => credential);
dependencies.admissionVerificationTimeoutMs = 1;
await expect(
@@ -1240,12 +1243,16 @@ describe("ACPX runtime host", () => {
dependencies,
),
).rejects.toThrow("admission verification exceeded its deadline");
+ expect(dependencies.stageCredential).toHaveBeenCalledOnce();
+ expect(getStatus).toHaveBeenCalledOnce();
expect(runtime.close).toHaveBeenCalledOnce();
+ expect(credential.close).toHaveBeenCalledOnce();
expect(fixture.commandClose).toHaveBeenCalledOnce();
});
it("bounds post-handshake cleanup while retaining its exact owner", async () => {
const fixture = await hostFixture();
+ const credential = credentialLeaseFixture(fixture.root);
let finishRuntimeClose!: () => void;
const runtimeClose = new Promise((resolve) => {
finishRuntimeClose = resolve;
@@ -1257,6 +1264,7 @@ describe("ACPX runtime host", () => {
const dependencies = fixture.dependencies({
openRuntime: async () => runtime,
});
+ dependencies.stageCredential = vi.fn(async () => credential);
let retainedAdmissionCleanup: Promise | null = null;
dependencies.retainAdmissionCleanup = (cleanup) => {
retainedAdmissionCleanup = cleanup;
@@ -1277,6 +1285,7 @@ describe("ACPX runtime host", () => {
),
).rejects.toThrow("initialization and cleanup failed");
expect(runtime.close).toHaveBeenCalledOnce();
+ expect(credential.close).not.toHaveBeenCalled();
expect(fixture.commandClose).toHaveBeenCalledOnce();
expect(retainedAdmissionCleanup).not.toBeNull();
let cleanupSettled = false;
@@ -1289,6 +1298,7 @@ describe("ACPX runtime host", () => {
finishRuntimeClose();
await retainedAdmissionCleanup;
expect(cleanupSettled).toBe(true);
+ expect(credential.close).toHaveBeenCalledOnce();
});
it("retains credential ownership when runtime shutdown fails until retry succeeds", async () => {
@@ -1996,6 +2006,21 @@ describe("ACPX runtime host", () => {
}, ACPX_LONG_WAIT_TEST_TIMEOUT_MS);
});
+// Deadline tests exercise runtime admission and cleanup, not kernel lease
+// acquisition. Keep their credential owner deterministic: real lease staging
+// uses hashed loopback ports that unrelated parallel tests can occupy. The
+// credential and retained-owner integration tests still use real leases.
+function credentialLeaseFixture(root: string) {
+ return {
+ path: join(root, "auth.json"),
+ mode: "inline_json" as const,
+ lifetimeFenceFds: [42, 43] as const,
+ lifetimeFenceCandidates: [60_001, 60_002, 60_003] as const,
+ activateLifetimeOwner: async () => undefined,
+ close: vi.fn(async () => undefined),
+ };
+}
+
function runtimePort(
input: {
identity?: AcpxRuntimePort["identity"];
diff --git a/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.test.ts b/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.test.ts
index 165fe527d5a..ab14aa666f3 100644
--- a/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.test.ts
@@ -1,3 +1,4 @@
+import { configuredEnvironmentProjection } from "../../configured-environment.js";
import {
chmod,
lstat,
@@ -35,6 +36,22 @@ afterEach(async () => {
});
describe("ACPX runtime sandbox", () => {
+ it.each([false, true])("allows selected task secrets in Codex shells (agent identity: %s)", async identity => {
+ const fixture = await sandboxFixture("codex");
+ const pages = { PAPERCLIP_PAGE_AWS_SECRET_ACCESS_KEY: "task-pages-secret", CUSTOM_TOKEN: "task-service-secret" };
+ const sandbox = await prepareAcpxRuntimeSandbox({ binding: fixture.binding, agent: "codex", environment: {
+ PATH: process.env.PATH, OPENAI_API_KEY: "provider-secret", HOST_SECRET: "unselected-secret",
+ ...configuredEnvironmentProjection(pages), ...(identity ? { PAPERCLIP_AGENT_KEY_ID: "agent-key" } : {}),
+ } });
+ const config = await readFile(join(sandbox.agentHomeDirectory, "config.toml"), "utf8");
+ const keys = JSON.parse(config.split("\n").find(line => line.startsWith("include_only = "))?.slice("include_only = ".length) ?? "[]");
+ expect(keys).toEqual(expect.arrayContaining(Object.keys(pages)));
+ expect(keys).not.toContain("OPENAI_API_KEY");
+ expect(keys).not.toContain("HOST_SECRET");
+ expect(sandbox.launchEnvironment).toMatchObject(pages);
+ for (const value of Object.values(pages)) expect(config).not.toContain(value);
+ });
+
it("restores Grok permission controls on recovery without importing compatible hooks or credentials", async () => {
const fixture = await sandboxFixture("grok");
const sandbox = await prepareAcpxRuntimeSandbox({ binding: fixture.binding, agent: "grok" });
diff --git a/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts b/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts
index e18e934ebf8..3e0e52d250d 100644
--- a/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/runtime-sandbox.ts
@@ -1,4 +1,5 @@
import { piProviderConfiguration } from "./pi-provider-config.js";
+import { configuredEnvironmentKeys } from "../../configured-environment.js";
import { COPILOT_SYSTEM_INSTRUCTIONS_FILE } from "./copilot-profile.js";
import { randomBytes } from "node:crypto";
import {
@@ -449,6 +450,7 @@ export async function prepareAcpxRuntimeSandbox(input: {
})}\n`);
}
if (input.agent === "codex") {
+ const taskEnvironmentKeys = configuredEnvironmentKeys(input.environment);
await writePrivateFile(
join(agentHomeDirectory, "config.toml"),
[
@@ -460,14 +462,15 @@ export async function prepareAcpxRuntimeSandbox(input: {
// also affect provider startup and belongs at the launch boundary.
"[features]",
"shell_snapshot = false",
- ...(input.environment?.PAPERCLIP_AGENT_KEY_ID ? [
+ ...(input.environment?.PAPERCLIP_AGENT_KEY_ID || taskEnvironmentKeys.length > 0 ? [
"[shell_environment_policy]", 'inherit = "all"', "ignore_default_excludes = true",
`include_only = ${JSON.stringify([...new Set([
"PATH", "HOME", "LANG", "LANGUAGE", "TZ", "TMPDIR", "TEMP", "TMP", "CODEX_HOME",
"PAPERCLIP_AGENT_KEY_ID", "PAPERCLIP_AGENT_PUBLIC_KEY", "PAPERCLIP_AGENT_PRIVATE_KEY",
- // Provider/config secrets keep Codex's default shell exclusions;
+ ...taskEnvironmentKeys,
+ // Unselected provider/config secrets keep Codex's default shell exclusions;
// only Paperclip's scoped API token is required by Bash/curl skills.
- ...Object.keys(input.environment).filter(key => key === "PAPERCLIP_API_KEY" || !/key|secret|token/i.test(key)),
+ ...Object.keys(input.environment ?? {}).filter(key => key === "PAPERCLIP_API_KEY" || !/key|secret|token/i.test(key)),
])])}`,
] : []),
"",
diff --git a/packages/paperclip-runner/src/drivers/codex/app-server-transport.ts b/packages/paperclip-runner/src/drivers/codex/app-server-transport.ts
index 737a5898019..3e08de1f22f 100644
--- a/packages/paperclip-runner/src/drivers/codex/app-server-transport.ts
+++ b/packages/paperclip-runner/src/drivers/codex/app-server-transport.ts
@@ -1,3 +1,4 @@
+import { configuredEnvironment } from "../../configured-environment.js";
import type { NativeTurnControlCapabilities } from "../../contracts/types.js";
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
import type { HarnessRuntimeRequestResolution } from "../../contracts/harness-driver.js";
@@ -245,7 +246,7 @@ export function createSanitizedCodexEnvironment(
for (const key of ["PAPERCLIP_AGENT_KEY_ID", "PAPERCLIP_AGENT_PUBLIC_KEY", "PAPERCLIP_AGENT_PRIVATE_KEY"]) {
if (explicit?.[key] !== undefined) environment[key] = explicit[key];
}
- Object.assign(environment, githubCredentialEnvironment(source));
+ Object.assign(environment, githubCredentialEnvironment(source), configuredEnvironment(explicit));
return environment;
}
diff --git a/packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts b/packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts
index 16d5b011665..4e5c07a4c14 100644
--- a/packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts
+++ b/packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts
@@ -264,7 +264,8 @@ export function codexToolAcceptsResult(
return false;
}
return result.reportedWorkDisposition !== "yielded"
- || result.continuation?.kind === "response_wake";
+ || result.continuation?.kind === "response_wake"
+ || result.continuation?.kind === "monitor";
}
export function redactCodexValue(value: unknown, depth = 0): unknown {
diff --git a/packages/paperclip-runner/src/drivers/codex/codex-security-config.ts b/packages/paperclip-runner/src/drivers/codex/codex-security-config.ts
index 3cc702004c2..f363bd8163b 100644
--- a/packages/paperclip-runner/src/drivers/codex/codex-security-config.ts
+++ b/packages/paperclip-runner/src/drivers/codex/codex-security-config.ts
@@ -1,3 +1,4 @@
+import { configuredEnvironmentKeys } from "../../configured-environment.js";
import { resolve, isAbsolute, join, dirname, delimiter } from "node:path";
import { existsSync, realpathSync, readFileSync, statSync } from "node:fs";
import { createRequire } from "node:module";
@@ -167,23 +168,28 @@ function tomlString(value: string): string {
}
export function createIsolatedCodexAppServerArgs(
- source: NodeJS.ProcessEnv = process.env,
+ source: NodeJS.ProcessEnv | undefined = undefined,
readOnlyRoots: string[] = [],
/** Server-registered run copy, never an environment/config-supplied root. */
instructionWorkingCopyRoot?: string,
): string[] {
+ const explicitSource = source;
+ source ??= process.env;
const gitRoots = gitFilesystemRoots(source);
readOnlyRoots = [...new Set([...readOnlyRoots, ...codexNetworkReadOnlyRoots(source)])];
const networkAccess = codexNetworkAccess(source);
const externalRunnerSandbox = usesExternalRunnerSandbox(source);
const inheritedGitHubKeys = [
...githubCredentialEnvironmentKeys(source),
+ ...configuredEnvironmentKeys(explicitSource),
...["PAPERCLIP_AGENT_KEY_ID", "PAPERCLIP_AGENT_PUBLIC_KEY", "PAPERCLIP_AGENT_PRIVATE_KEY"].filter(key => source[key] !== undefined),
];
const hasProjectedEnvironment = inheritedGitHubKeys.length > 0;
// Codex filters the configured `set` values through include_only as well.
// Retain the explicit command PATH/HOME/locale settings, not ambient secrets.
const commandEnvironment = codexCommandEnvironment(source);
+ // Selected task values are inherited, never serialized into configuration argv.
+ for (const key of configuredEnvironmentKeys(explicitSource)) delete commandEnvironment[key];
if (instructionWorkingCopyRoot && source.AGENT_HOME === instructionWorkingCopyRoot) commandEnvironment.AGENT_HOME = instructionWorkingCopyRoot;
const shellEnvironmentKeys = [...new Set([...inheritedGitHubKeys, ...Object.keys(commandEnvironment)])].sort();
if (source.PAPERCLIP_GITHUB_LAUNCHER_DIR) readOnlyRoots = [...readOnlyRoots, source.PAPERCLIP_GITHUB_LAUNCHER_DIR];
diff --git a/packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts b/packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts
index 2358c1be7c2..0eb5ccf2579 100644
--- a/packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts
+++ b/packages/paperclip-runner/src/drivers/codex/codex-session-server-requests.ts
@@ -207,7 +207,7 @@ async function handleServerRequestBody(
text:
tool === CODEX_BLOCK_TOOL_NAME
? "paperclip_block requires reportedWorkDisposition=blocked."
- : "paperclip_finish accepts done, needs_review, or yielded with a response_wake continuation.",
+ : "paperclip_finish accepts done, needs_review, or yielded with a response_wake or persisted monitor continuation.",
},
],
};
diff --git a/packages/paperclip-runner/src/drivers/dot/README.md b/packages/paperclip-runner/src/drivers/dot/README.md
new file mode 100644
index 00000000000..5b1bb85b2f3
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/dot/README.md
@@ -0,0 +1,6 @@
+# Dot runner prototype
+
+Experimental provider boundary for OpenAI Dot. This is not a qualified production
+provider and is deliberately absent from the provider picker.
+
+See `doc/dot-runner-prototype.md` at the repository root for setup and limits.
diff --git a/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.test.ts b/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.test.ts
new file mode 100644
index 00000000000..15fd39f32a2
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.test.ts
@@ -0,0 +1,133 @@
+import { randomUUID } from "node:crypto";
+import { describe, expect, it, vi } from "vitest";
+import { HarnessDriverBackend } from "../../backends/harness-driver-backend.js";
+import { validatePrpEvent } from "../../protocol/replay-contract.js";
+import { DotHarnessDriver, type DotCommand, type DotDriverOptions } from "./dot-harness-driver.js";
+
+const result = { schema: "paperclip.run_result.v1", reportedWorkDisposition: "done", summary: "Research saved.",
+ completionClaim: { contractRevision: "dot-demo-v1", objectiveSatisfied: true, criteria: [], remainingWork: [] },
+ evidence: [], verification: [], attentionRequests: [], artifacts: [] };
+
+async function fixture(overrides: Partial = {}) {
+ const identity = { companyId: randomUUID(), agentId: randomUUID(), issueId: randomUUID(), runId: randomUUID(), sessionId: randomUUID() };
+ const principal = { companyId: identity.companyId, grantId: randomUUID() };
+ const publish = vi.fn(async () => {});
+ const executeTool = vi.fn(async () => ({ saved: true }));
+ const assertAuthority = vi.fn(async () => {});
+ const driver = new DotHarnessDriver({ identity, principal, expiresAt: Date.now() + 60_000,
+ tools: [{ name: "write_document", description: "Save the report", inputSchema: { type: "object" } }],
+ publish, executeTool, assertAuthority, ...overrides });
+ const backend = new HarnessDriverBackend(driver);
+ const session = await backend.openSession({ identity });
+ const { turnId } = await session.startTurn({ message: { role: "user", text: "Research competitors and save a report." } });
+ const call = (command: Omit & Record, requestId = randomUUID()) =>
+ driver.command(principal, { ...command, turnId, requestId } as DotCommand);
+ return { identity, principal, driver, backend, session, turnId, call, publish, executeTool, assertAuthority };
+}
+
+describe("Dot runner provider prototype", () => {
+ it("runs a two-way assignment through the real native backend and valid PRP events", async () => {
+ const f = await fixture();
+ expect(f.publish.mock.calls[0]?.[0]).toMatchObject({ ...f.identity, turnId: f.turnId });
+ expect(JSON.stringify(f.publish.mock.calls)).not.toContain("Research competitors");
+ expect(await f.driver.inbox(f.principal)).toMatchObject({ accepted: false });
+ expect(await f.call({ operation: "read" })).toMatchObject({ message: { text: "Research competitors and save a report." } });
+ await expect(f.call({ operation: "tool", name: "write_document", arguments: {} })).rejects.toThrow("Accept");
+ await f.call({ operation: "accept" });
+ await f.call({ operation: "tool", name: "write_document", arguments: { body: "Report" } });
+ await f.call({ operation: "progress", text: "Saved the report." });
+ const finishId = randomUUID();
+ await f.call({ operation: "finish", result }, finishId);
+ await f.call({ operation: "finish", result }, finishId);
+ const events = [];
+ for await (const event of f.session.events()) {
+ expect(validatePrpEvent(event), JSON.stringify(event)).toMatchObject({ ok: true });
+ events.push(event);
+ }
+ expect(events.filter(e => e.eventType === "turn.started")).toHaveLength(1);
+ expect(events.filter(e => e.eventType === "run.result.proposed")).toHaveLength(1);
+ expect(await f.session.result()).toMatchObject({ result, terminal: { runTerminalState: "succeeded" } });
+ expect(await f.session.usage?.()).toBeNull();
+ await f.session.close({ reason: "finished" });
+ });
+
+ it("deduplicates concurrent writes and rejects changed retries", async () => {
+ const f = await fixture(); await f.call({ operation: "accept" });
+ const id = randomUUID();
+ const command = { operation: "tool", name: "write_document", arguments: { body: "One report" } } as const;
+ const replies = await Promise.all([f.call(command, id), f.call(command, id)]);
+ expect(replies).toEqual([{ saved: true }, { saved: true }]);
+ expect(f.executeTool).toHaveBeenCalledTimes(1);
+ await expect(f.call({ ...command, arguments: { body: "Changed" } }, id)).rejects.toThrow("different arguments");
+ f.driver.revoke();
+ });
+
+ it("does not redispatch a tool with an unknown outcome", async () => {
+ const executeTool = vi.fn(async () => { throw new Error("committed but connection lost"); });
+ const f = await fixture({ executeTool }); await f.call({ operation: "accept" });
+ const id = randomUUID(); const command = { operation: "tool", name: "write_document", arguments: {} } as const;
+ expect(await f.call(command, id)).toMatchObject({ outcome: "unknown" });
+ expect(await f.call(command, id)).toMatchObject({ outcome: "unknown" });
+ expect(executeTool).toHaveBeenCalledTimes(1);
+ f.driver.revoke();
+ });
+
+ it("enforces company, grant, turn, tool, expiry and live admission authority", async () => {
+ let now = Date.now(); const f = await fixture({ now: () => now, expiresAt: now + 1000 });
+ await expect(f.driver.inbox({ ...f.principal, companyId: randomUUID() })).rejects.toThrow("not bound");
+ await expect(f.driver.inbox({ ...f.principal, grantId: randomUUID() })).rejects.toThrow("not bound");
+ await expect(f.driver.command(f.principal, { operation: "accept", requestId: randomUUID(), turnId: randomUUID() })).rejects.toThrow("Stale");
+ await f.call({ operation: "accept" });
+ await expect(f.call({ operation: "tool", name: "arbitrary_admin", arguments: {} })).rejects.toThrow("not projected");
+ f.assertAuthority.mockRejectedValueOnce(new Error("Agent paused"));
+ await expect(f.call({ operation: "read" })).rejects.toThrow("Agent paused");
+ now += 1001;
+ await expect(f.call({ operation: "finish", result })).rejects.toThrow("expired");
+ expect(f.executeTool).not.toHaveBeenCalled(); f.driver.revoke();
+ });
+
+ it("revokes callbacks immediately and does not claim a provider stop or recovery", async () => {
+ const f = await fixture(); await f.call({ operation: "accept" });
+ f.driver.revoke();
+ await expect(f.call({ operation: "progress", text: "late" })).rejects.toThrow("revoked");
+ await expect(f.session.close({ reason: "cancel" })).rejects.toThrow("stop is unconfirmed");
+ expect(await f.backend.descriptor()).toMatchObject({ capabilities: { resume: false, interruption: false, steering: false } });
+ expect(await f.backend.recoverSession(await f.session.snapshot(), { signal: new AbortController().signal })).toMatchObject({ recovered: false });
+ });
+
+ it("rejects a malformed result and cannot execute after completion", async () => {
+ const f = await fixture(); await f.call({ operation: "accept" });
+ await expect(f.call({ operation: "finish", result: { summary: "done" } })).rejects.toThrow("Invalid Paperclip");
+ await f.call({ operation: "finish", result });
+ await expect(f.call({ operation: "tool", name: "write_document", arguments: {} })).rejects.toThrow("already completed");
+ expect(f.executeTool).not.toHaveBeenCalled(); f.driver.revoke();
+ });
+
+ it("settles event waiting when authority expires", async () => {
+ vi.useFakeTimers();
+ try {
+ const f = await fixture({ expiresAt: Date.now() + 1000 });
+ const stream = f.session.events()[Symbol.asyncIterator]();
+ await stream.next();
+ const pending = stream.next();
+ await vi.advanceTimersByTimeAsync(1001);
+ // The native backend may synthesize a terminal failure, but cannot hang.
+ await expect(pending).resolves.toBeDefined();
+ await expect(f.call({ operation: "accept" })).rejects.toThrow("revoked");
+ await stream.return?.(); f.driver.revoke();
+ } finally { vi.useRealTimers(); }
+ });
+
+ it("reserves admission before awaiting authority and fences concurrent revocation", async () => {
+ let release!: () => void;
+ const identity = { companyId: randomUUID(), agentId: randomUUID(), issueId: randomUUID(), runId: randomUUID(), sessionId: randomUUID() };
+ const driver = new DotHarnessDriver({ identity, principal: { companyId: identity.companyId, grantId: randomUUID() },
+ expiresAt: Date.now() + 10_000, tools: [], publish: async () => {}, executeTool: async () => {},
+ assertAuthority: () => new Promise(resolve => { release = resolve; }) });
+ const input = { runId: identity.runId, normalizedSessionId: identity.sessionId, workingDirectory: "/unused" };
+ const first = driver.openSession(input);
+ await expect(driver.openSession(input)).rejects.toThrow("already opened");
+ driver.revoke(); release();
+ await expect(first).rejects.toThrow("revoked during admission");
+ });
+});
diff --git a/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts b/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts
new file mode 100644
index 00000000000..5e9b88d9777
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/dot/dot-harness-driver.ts
@@ -0,0 +1,240 @@
+import { createHash, randomUUID } from "node:crypto";
+import type { HarnessDriver, HarnessSession, OpenHarnessSessionInput, PersistedHarnessSession } from "../../contracts/harness-driver.js";
+import type { NativeRunIdentity, NativeUserMessage } from "../../contracts/types.js";
+import { validatePrpStructuredRunResult, type PrpEvent, type PrpStructuredRunResult } from "../../protocol/replay-contract.js";
+
+export interface DotPrincipal { companyId: string; grantId: string }
+export interface DotTool { name: string; description: string; inputSchema: Record }
+export interface DotAssignment extends NativeRunIdentity { turnId: string; messageId: string }
+
+/** All authority comes from the host after normal run admission. Never accept
+ * these bindings or callbacks from an MCP request or an agent configuration. */
+export interface DotDriverOptions {
+ identity: NativeRunIdentity;
+ principal: DotPrincipal;
+ expiresAt: number;
+ tools: readonly DotTool[];
+ assertAuthority: () => Promise;
+ executeTool: (input: { name: string; arguments: Record; requestId: string; turnId: string }) => Promise;
+ publish: (assignment: DotAssignment) => Promise;
+ now?: () => number;
+}
+
+export class DotBoundaryError extends Error {}
+const canonical = (value: unknown): string => JSON.stringify(value, (_key, v) => v && typeof v === "object" && !Array.isArray(v)
+ ? Object.fromEntries(Object.keys(v).sort().map(k => [k, v[k]])) : v);
+
+/** Experimental, one-run provider. No model API or CLI impersonation: an
+ * authenticated Dot pulls work after an MCP Event and calls back through MCP.
+ * Memory-only: restart loses the session and fails closed; resume is false. */
+export class DotHarnessDriver implements HarnessDriver {
+ readonly identity: NativeRunIdentity;
+ #options: DotDriverOptions;
+ #session: DotSession | null = null;
+ #opened = false;
+ #revoked = false;
+
+ constructor(options: DotDriverOptions) {
+ if (options.identity.companyId !== options.principal.companyId) throw new DotBoundaryError("Company binding mismatch.");
+ const remaining = options.expiresAt - (options.now ?? Date.now)();
+ if (!Number.isFinite(remaining) || remaining <= 0 || remaining > 24 * 3600_000) throw new DotBoundaryError("Dot authority must expire within 24 hours.");
+ this.identity = structuredClone(options.identity);
+ this.#options = { ...options, identity: this.identity, principal: structuredClone(options.principal), tools: structuredClone(options.tools) };
+ }
+
+ async descriptor() {
+ return {
+ kind: "openai-dot-prototype", displayName: "OpenAI Dot (prototype)", version: "0.1.0", protocolVersion: "prp.v1",
+ capabilities: {
+ resume: false, typedEvents: true, steering: false, interruption: false, structuredResult: true,
+ read: true, reconciliation: true, usage: false, dynamicTools: true,
+ unsupported: ["resume", "steering", "interruption", "usage", "goals", "runtimeRequestResolution"],
+ },
+ };
+ }
+
+ async openSession(input: OpenHarnessSessionInput): Promise {
+ if (input.runId !== this.identity.runId || input.normalizedSessionId !== this.identity.sessionId || this.#opened || this.#revoked) {
+ throw new DotBoundaryError("Dot session binding mismatch or already opened.");
+ }
+ input.signal?.throwIfAborted();
+ this.#opened = true;
+ await this.#options.assertAuthority();
+ input.signal?.throwIfAborted();
+ if (this.#revoked) throw new DotBoundaryError("Dot driver was revoked during admission.");
+ return this.#session = new DotSession(this.#options);
+ }
+
+ async inbox(principal: DotPrincipal) {
+ return this.#session ? this.#session.inbox(principal) : null;
+ }
+
+ async command(principal: DotPrincipal, input: DotCommand): Promise {
+ if (!this.#session) throw new DotBoundaryError("Dot run is unavailable.");
+ return this.#session.command(principal, input);
+ }
+
+ /** Synchronous revocation: future callbacks lose authority immediately.
+ * This does NOT prove that OpenAI stopped the Dot or any child tasks. */
+ revoke() { this.#revoked = true; this.#session?.revoke(); }
+}
+
+export type DotCommand = { turnId: string; requestId: string } & (
+ | { operation: "accept" }
+ | { operation: "read" }
+ | { operation: "tool"; name: string; arguments: Record }
+ | { operation: "progress"; text: string }
+ | { operation: "finish"; result: unknown }
+);
+
+class DotSession implements HarnessSession {
+ #turnId: string | null = null;
+ #message: NativeUserMessage | null = null;
+ #messageId = randomUUID();
+ #events: PrpEvent[] = [];
+ #waiters = new Set<() => void>();
+ #revoked = false;
+ #accepted = false;
+ #result: PrpStructuredRunResult | null = null;
+ #tail: Promise = Promise.resolve();
+ #receipts = new Map }>();
+ #expiry: NodeJS.Timeout;
+ constructor(readonly options: DotDriverOptions) {
+ this.#expiry = setTimeout(() => this.revoke(), Math.max(0, options.expiresAt - this.#now()));
+ this.#expiry.unref();
+ }
+ #now() { return (this.options.now ?? Date.now)(); }
+ ids() { return { driverSessionId: this.options.identity.sessionId, providerSessionId: `dot-bridge:${this.options.identity.sessionId}`, displayId: "OpenAI Dot" }; }
+
+ async #authorize(principal?: DotPrincipal) {
+ if (principal && (principal.companyId !== this.options.principal.companyId || principal.grantId !== this.options.principal.grantId)) {
+ throw new DotBoundaryError("This connection is not bound to this Dot run.");
+ }
+ if (this.#revoked || this.options.expiresAt <= this.#now()) throw new DotBoundaryError("Dot run authority expired or was revoked.");
+ await this.options.assertAuthority();
+ if (this.#revoked || this.options.expiresAt <= this.#now()) throw new DotBoundaryError("Dot run authority expired or was revoked.");
+ }
+
+ async startTurn(input: { message: NativeUserMessage }) {
+ await this.#authorize();
+ if (this.#turnId) throw new DotBoundaryError("This prototype accepts one turn per admitted run.");
+ this.#turnId = randomUUID();
+ this.#message = structuredClone(input.message);
+ this.#emit("session.started", {});
+ // A webhook receipt is not evidence that Dot accepted or started the turn.
+ try { await this.options.publish(this.#assignment()); }
+ catch { this.revoke(); throw new DotBoundaryError("Dot wakeup could not be confirmed. Inspect the assignment before retrying."); }
+ return { turnId: this.#turnId };
+ }
+
+ #assignment(): DotAssignment {
+ return { ...this.options.identity, turnId: this.#turnId!, messageId: this.#messageId };
+ }
+ async inbox(principal: DotPrincipal) {
+ await this.#authorize(principal);
+ return this.#turnId && !this.#result ? { ...this.#assignment(), accepted: this.#accepted, expiresAt: this.options.expiresAt } : null;
+ }
+
+ async command(principal: DotPrincipal, input: DotCommand): Promise {
+ await this.#authorize(principal);
+ if (!this.#turnId || input.turnId !== this.#turnId) throw new DotBoundaryError("Stale or unknown Dot turn.");
+ if (!input.requestId || input.requestId.length > 100) throw new DotBoundaryError("A bounded request ID is required.");
+ const encoded = canonical(input);
+ if (Buffer.byteLength(encoded) > 256 * 1024) throw new DotBoundaryError("Dot command exceeds 256 KiB.");
+ const digest = createHash("sha256").update(encoded).digest("hex");
+ const old = this.#receipts.get(input.requestId);
+ if (old) {
+ if (old.digest !== digest) throw new DotBoundaryError("Request ID was reused with different arguments.");
+ return structuredClone(await old.promise);
+ }
+ if (this.#receipts.size >= 1000) throw new DotBoundaryError("Dot run command limit reached.");
+ // Serialize command acceptance with completion. Reserve the promise BEFORE
+ // dispatch so concurrent retries can never execute a tool twice.
+ const promise = this.#tail.then(async () => {
+ await this.#authorize(principal);
+ if (this.#result) throw new DotBoundaryError("Dot turn already completed.");
+ if (input.operation === "accept") {
+ if (!this.#accepted) { this.#accepted = true; this.#emit("turn.started", {}); }
+ return { accepted: true };
+ }
+ if (input.operation === "read") return {
+ assignment: this.#assignment(), message: this.#message, tools: this.options.tools,
+ accounting: { usage: null, cost: null },
+ };
+ if (!this.#accepted) throw new DotBoundaryError("Accept the Dot assignment before writing or finishing.");
+ if (input.operation === "tool") {
+ if (!this.options.tools.some(t => t.name === input.name)) throw new DotBoundaryError("Tool is not projected to this run.");
+ let result: unknown;
+ try {
+ result = await this.options.executeTool({ name: input.name, arguments: input.arguments, requestId: input.requestId, turnId: input.turnId });
+ } catch {
+ // Never replay a possibly committed write after a transport failure.
+ return { outcome: "unknown", message: "Inspect current task state; retry only with the same requestId." };
+ }
+ await this.#authorize(principal);
+ return result;
+ }
+ if (input.operation === "progress") {
+ if (!input.text.trim() || input.text.length > 16_000) throw new DotBoundaryError("Progress must contain 1–16000 characters.");
+ this.#emit("item.started", { kind: "assistant_message" }, input.requestId);
+ this.#emit("item.delta", { text: input.text }, input.requestId);
+ this.#emit("item.completed", { kind: "assistant_message", text: input.text }, input.requestId);
+ return { accepted: true };
+ }
+ const parsed = validatePrpStructuredRunResult(input.result);
+ if (!parsed.ok) throw new DotBoundaryError("Invalid Paperclip structured run result.");
+ this.#result = parsed.result;
+ clearTimeout(this.#expiry);
+ this.#emit("run.result.proposed", this.#result);
+ this.#emit("turn.completed", {});
+ this.#emit("run.terminal", {
+ schema: "paperclip.prp.terminal.v1", turnTerminalState: "completed", runTerminalState: "succeeded",
+ reportedWorkDisposition: this.#result.reportedWorkDisposition,
+ });
+ return { accepted: true, disposition: this.#result.reportedWorkDisposition };
+ });
+ this.#receipts.set(input.requestId, { digest, promise });
+ this.#tail = promise.catch(() => {});
+ return structuredClone(await promise);
+ }
+
+ #emit(eventType: PrpEvent["eventType"], payload: Record, itemId?: string) {
+ const sequence = this.#events.length + 1;
+ this.#events.push({
+ schema: "paperclip.prp.event.v1", sourceEventId: `${this.options.identity.runId}:${sequence}`,
+ sourceSeq: sequence, sourceInstanceId: `dot:${this.options.identity.sessionId}`, sourceKind: "runner",
+ runId: this.options.identity.runId, normalizedSessionId: this.options.identity.sessionId,
+ ...(this.#turnId ? { turnId: this.#turnId } : {}), ...(itemId ? { itemId } : {}),
+ eventType, schemaVersion: 1, priority: eventType.startsWith("run.") ? 0 : 1,
+ emittedAt: new Date(this.#now()).toISOString(), payload: structuredClone(payload),
+ });
+ this.#notify();
+ }
+ #notify() { for (const wake of this.#waiters) wake(); this.#waiters.clear(); }
+ async *events(): AsyncIterable {
+ let index = 0;
+ while (true) {
+ while (index < this.#events.length) {
+ const event = this.#events[index++]!;
+ yield structuredClone(event);
+ if (event.eventType === "run.terminal") return;
+ }
+ if (this.#revoked) return;
+ await new Promise(resolve => this.#waiters.add(resolve));
+ }
+ }
+ async read() { return { accepted: this.#accepted, completed: !!this.#result, revoked: this.#revoked }; }
+ async reconcile() { return { ...await this.read(), providerStopConfirmed: false, usage: null, cost: null }; }
+ async usage() { return null; }
+ async snapshot(): Promise {
+ return { driverKind: "openai-dot-prototype", driverSessionId: this.ids().driverSessionId, providerSessionId: this.ids().providerSessionId,
+ runId: this.options.identity.runId, normalizedSessionId: this.options.identity.sessionId,
+ activeTurnId: this.#result || this.#revoked ? null : this.#turnId, lastSourceSequence: this.#events.length,
+ semanticResult: this.#result ? { result: this.#result, turnId: this.#turnId!, fingerprint: canonical(this.#result) } : null };
+ }
+ revoke() { this.#revoked = true; clearTimeout(this.#expiry); this.#notify(); }
+ async close() {
+ this.revoke();
+ if (this.#accepted && !this.#result) throw new DotBoundaryError("Dot authority revoked; provider stop is unconfirmed.");
+ }
+}
diff --git a/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.test.ts b/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.test.ts
new file mode 100644
index 00000000000..1ac5da7d976
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.test.ts
@@ -0,0 +1,186 @@
+import { randomUUID } from "node:crypto";
+import { mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { expect, it, vi } from "vitest";
+import { RunnerdDotDriver, type RunnerdDotDriverOptions } from "./runnerd-dot-driver.js";
+import { describeRunnerdNativeSessionBackend } from "../../backends/codex-native-backend.js";
+import { createNativeSessionBackend } from "../../backends/native-backend-factory.js";
+import * as controlPlane from "../../control-plane/durable-prp-control-plane.js";
+import { externalOperationDigest, type ExternalProviderOperation } from "../../contracts/external-provider.js";
+import { buildNativeModelEnvelope, parseNativeExecutionInput, type NativeExecutionInputV6 } from "../../contracts/native-execution.js";
+import { NATIVE_RUNTIME_ASSET_SCHEMA, PAPERCLIP_EXECUTION_PROMPT, PAPERCLIP_EXECUTION_PROMPT_REVISION,
+ nativeRuntimePromptDigest, canonicalNativeRuntimeContextDigest } from "../../contracts/runtime-context.js";
+
+function execution(root: string): NativeExecutionInputV6 {
+ const companyId = randomUUID(), agentId = randomUUID();
+ const digest = "0".repeat(64);
+ const context = {
+ prompt: { revision: PAPERCLIP_EXECUTION_PROMPT_REVISION, text: PAPERCLIP_EXECUTION_PROMPT, digest: nativeRuntimePromptDigest() },
+ instructions: { entryPath: "AGENTS.md", bundle: { schema: NATIVE_RUNTIME_ASSET_SCHEMA, digest, manifestDigest: digest, rootPath: root, fileCount: 1, totalBytes: 4 } },
+ skills: [], mcp: { assignmentSetId: "none", digest, bindingId: null },
+ };
+ return parseNativeExecutionInput({
+ schema: "paperclip.native-execution-input.v6",
+ binding: { companyId, agentId, runId: randomUUID(), issueId: randomUUID(), executionWorkspaceId: randomUUID() },
+ task: { identifier: "DOT-1", title: "Synthetic bridge recovery", description: null, prompt: "Read the synthetic counter.", workMode: "standard" },
+ provider: { kind: "openai_dot", model: null, binding: { companyId, agentId, bindingId: randomUUID(), bindingGeneration: 1,
+ acceptByUnixMs: Date.now() + 600_000, expiresAtUnixMs: Date.now() + 7_200_000 } },
+ workspace: { access: "none", cwd: null, repoUrl: null, repoRef: null, branchName: null },
+ session: { normalizedSessionId: randomUUID(), driverKind: "openai_dot_mcp", protocolVersion: 1, lifecyclePolicy: { mode: "per_turn", idleTimeoutMs: null } },
+ executionMode: "default", planningContext: null,
+ completionContract: { id: randomUUID(), sha256: "sha256:" + digest, schemaVersion: "paperclip.completion-contract.v1",
+ contract: { revision: "1", objective: "Read the counter", criteria: [{ id: "objective", requirement: "Read the counter" }] } },
+ runtimeContext: { ...context, aggregateDigest: canonicalNativeRuntimeContextDigest(context) }, interactionResponses: [], credentialBindings: [],
+ }) as NativeExecutionInputV6;
+}
+
+it("v6 closes Dot identity, workspace, model and credential fields", () => {
+ const input = execution("/synthetic/pinned-instructions");
+ expect(parseNativeExecutionInput(input)).toEqual(input);
+ expect(buildNativeModelEnvelope(input).workspace).toBeNull();
+ expect(JSON.stringify(buildNativeModelEnvelope(input))).not.toContain("/synthetic");
+ for (const changed of [
+ { ...input, workspace: { ...input.workspace, cwd: "/private/project" } },
+ { ...input, provider: { ...input.provider, model: "a-model" } },
+ { ...input, provider: { ...input.provider, apiKey: "secret" } },
+ { ...input, provider: { ...input.provider, binding: { ...input.provider.binding, agentId: randomUUID() } } },
+ { ...input, credentialBindings: [{ bindingId: "secret-binding", service: "openai", destination: "api.openai.com", expiresAt: null, displayName: "API" }] },
+ { ...input, session: { ...input.session, lifecyclePolicy: { mode: "warm", idleTimeoutMs: 60000 } } },
+ ]) expect(() => parseNativeExecutionInput(changed)).toThrow();
+});
+
+it("admits the heartbeat descriptor with the real Dot capabilities and no broker or process startup", async () => {
+ const input = execution("/synthetic/pinned-instructions");
+ const spawnSpy = vi.spyOn(controlPlane, "spawnRunner");
+ try {
+ const descriptor = await describeRunnerdNativeSessionBackend(input);
+ const backend = createNativeSessionBackend(input, {
+ dotRunnerOptions: {
+ stateDirectory: "/must-not-be-created",
+ identity: { runnerInstanceId: randomUUID(), environmentLeaseId: randomUUID(), runId: input.binding.runId,
+ normalizedSessionId: input.session.normalizedSessionId!, turnId: "turn", itemId: "item" },
+ port: {
+ dispatch: async () => { throw new Error("Descriptor must not dispatch work"); },
+ settle: async () => { throw new Error("Descriptor must not settle work"); },
+ attach: async () => { throw new Error("Descriptor must not attach a broker"); },
+ },
+ },
+ });
+ expect(descriptor).toEqual(await backend.descriptor());
+ expect(descriptor).toMatchObject({
+ kind: "runner", name: "openai_dot_mcp", version: "dot-mcp-v1",
+ capabilities: { resume: false, steering: false, interruption: false, usage: false, dynamicTools: true },
+ runtimeContextCapabilities: { instructions: "native", skills: "native", mcp: "native" },
+ });
+ expect(spawnSpy).not.toHaveBeenCalled();
+ } finally { spawnSpy.mockRestore(); }
+});
+
+it.each(["shutdown", "unexpected exit"] as const)("classifies a real Rust %s before the next command poll", async kind => {
+ const root = await mkdtemp(join(tmpdir(), "dot-driver-exit-"));
+ await writeFile(join(root, "AGENTS.md"), "Use only the synthetic counter.");
+ const input = execution(root);
+ let handle: controlPlane.RunnerProcessHandle | undefined;
+ let exited = false;
+ const spawn = controlPlane.spawnRunner;
+ const spawnSpy = vi.spyOn(controlPlane, "spawnRunner").mockImplementation(options => {
+ handle = spawn(options);
+ void handle.completion.then(() => { exited = true; });
+ return handle;
+ });
+ const getCommand = controlPlane.DurablePrpControlPlane.prototype.getCommand;
+ const commandSpy = vi.spyOn(controlPlane.DurablePrpControlPlane.prototype, "getCommand").mockImplementation(function (id) {
+ const command = getCommand.call(this, id);
+ // Hold the SDK poll until the real process has exited. The authenticated
+ // shutdown receipt and its ACK remain committed in the transport journal.
+ if (id === "dot_shutdown" && command?.status === "completed" && !exited) return { ...command, status: "pending" };
+ return command;
+ });
+ const driver = new RunnerdDotDriver({
+ execution: input, stateDirectory: join(root, "state"),
+ identity: { runnerInstanceId: randomUUID(), environmentLeaseId: randomUUID(), runId: input.binding.runId,
+ normalizedSessionId: input.session.normalizedSessionId!, turnId: "turn-" + input.binding.runId, itemId: "item-" + input.binding.runId },
+ runnerBinary: resolve("runner/target/debug/paperclip-runnerd"),
+ port: { dispatch: async () => {}, settle: async () => {}, attach: async () => async () => {} },
+ });
+ let session: Awaited> | undefined;
+ try {
+ session = await driver.openSession({ runId: input.binding.runId, normalizedSessionId: input.session.normalizedSessionId! });
+ if (kind === "shutdown") {
+ await expect(session.close({ reason: "Test complete" })).resolves.toBeUndefined();
+ expect(exited).toBe(true);
+ expect((await handle!.completion).code).toBe(0);
+ } else {
+ handle!.child.kill("SIGTERM");
+ await handle!.completion;
+ await expect(session.read!()).rejects.toThrow("dot_runner_process_exited_recovery_required");
+ }
+ } finally {
+ commandSpy.mockRestore(); spawnSpy.mockRestore();
+ await session?.detachControllerForRestart?.();
+ if (!exited) handle?.child.kill("SIGTERM");
+ await handle?.completion;
+ await rm(root, { recursive: true, force: true });
+ }
+}, 45000);
+
+it("reattaches the same Rust bridge without duplicating a settled operation and refuses a lost checkpoint", async () => {
+ const root = await mkdtemp(join(tmpdir(), "dot-driver-recovery-"));
+ await writeFile(join(root, "AGENTS.md"), "Use only the synthetic counter.");
+ const input = execution(root);
+ let send: ((op: ExternalProviderOperation) => Promise) | undefined;
+ let spawned: { pid: number; processGroupId: number | null; startedAt: string } | undefined;
+ let calls = 0;
+ const settlements = new Map();
+ const dispatches: unknown[] = [];
+ let controllerPort = 0;
+ const options: RunnerdDotDriverOptions = {
+ execution: input, stateDirectory: join(root, "state"),
+ identity: { runnerInstanceId: randomUUID(), environmentLeaseId: randomUUID(), runId: input.binding.runId,
+ normalizedSessionId: input.session.normalizedSessionId!, turnId: "turn-" + input.binding.runId, itemId: "item-" + input.binding.runId },
+ runnerBinary: resolve("runner/target/debug/paperclip-runnerd"),
+ onSpawn: process => { spawned = process; },
+ controlPlaneRegistration: async authority => {
+ await authority.start(controllerPort);
+ controllerPort = Number(new URL(authority.connectUrl).port);
+ return { connectUrl: authority.connectUrl, release: () => authority.stop() };
+ },
+ dynamicTools: [{ name: "synthetic_counter", description: "Read a synthetic counter", inputSchema: { type: "object", properties: {}, additionalProperties: false } }],
+ dynamicToolHandler: async () => ({ count: ++calls }),
+ port: { dispatch: async event => { dispatches.push(event); }, settle: async event => { settlements.set(String(event.payload.requestId), event.payload.outcome); },
+ attach: async callback => { send = callback; return async () => { send = undefined; }; } },
+ };
+ const driver = new RunnerdDotDriver(options);
+ let session = await driver.openSession({ runId: input.binding.runId, normalizedSessionId: input.session.normalizedSessionId! });
+ const operation = (action: ExternalProviderOperation["action"], args: Record): ExternalProviderOperation => ({
+ requestId: randomUUID(), bindingId: input.provider.binding.bindingId, bindingGeneration: 1, runId: input.binding.runId,
+ normalizedSessionId: input.session.normalizedSessionId!, turnId: options.identity.turnId, assignmentRevision: 1,
+ action, input: args, digest: externalOperationDigest(action, args),
+ });
+ try {
+ await session.startTurn({ message: { role: "user", text: "Read the synthetic counter." } });
+ await send!(operation("accept", {}));
+ const call = operation("tool", { name: "synthetic_counter", arguments: {} });
+ await send!(call);
+ await vi.waitFor(() => expect(settlements.get(call.requestId)).toMatchObject({ status: "completed", isError: false }), { timeout: 10000 });
+ const snapshot = await session.snapshot();
+ expect(snapshot).toMatchObject({ providerSessionId: null, activeTurnId: options.identity.turnId, providerRecoveryPolicy: "same_session_only" });
+ await session.detachControllerForRestart!();
+ const recoveredDriver = new RunnerdDotDriver({ ...options, adoptExistingRunner: { ...spawned!, isAlive: () => true } });
+ const recovered = await recoveredDriver.recoverSession(snapshot, { signal: new AbortController().signal });
+ expect(recovered.recovered).toBe(true);
+ session = recovered.session!;
+ await send!(call);
+ expect(calls).toBe(1);
+ expect(dispatches).toHaveLength(1);
+ await session.interrupt!({ reason: "Synthetic test complete" });
+ await session.close({ reason: "Synthetic test complete" });
+ await rm(join(root, "state/runner/dot-provider-state.json"));
+ expect(await recoveredDriver.recoverSession(snapshot, { signal: new AbortController().signal })).toMatchObject({ recovered: false });
+ } finally {
+ await session.close({ reason: "Test cleanup", force: true }).catch(() => {});
+ if (spawned) { try { process.kill(spawned.pid, "SIGTERM"); } catch {} }
+ await rm(root, { recursive: true, force: true });
+ }
+}, 45000);
diff --git a/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.ts b/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.ts
new file mode 100644
index 00000000000..91d0e2b2b0d
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/dot/runnerd-dot-driver.ts
@@ -0,0 +1,231 @@
+import { existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
+import { randomUUID } from "node:crypto";
+import { resolve } from "node:path";
+import type { HarnessDriver, HarnessDriverDescriptor, HarnessSession, OpenHarnessSessionInput, PersistedHarnessSession } from "../../contracts/harness-driver.js";
+import type { NativeExecutionInputV6 } from "../../contracts/native-execution.js";
+import type { ExternalProviderPort } from "../../contracts/external-provider.js";
+import type { PrpEvent } from "../../protocol/replay-contract.js";
+import { validatePrpStructuredRunResult } from "../../protocol/replay-contract.js";
+import { DurablePrpControlPlane, spawnRunner, type RunnerProcessHandle } from "../../control-plane/durable-prp-control-plane.js";
+import type { DurableRecoveryIdentity } from "../../contracts/durable-recovery.js";
+import { authorizedToolSetForProvider, defaultCapabilityRunnerdBinary, readRunnerdArtifactBinding, type CapabilityRunnerdCodexTransportOptions } from "../../live/runnerd-codex-transport.js";
+import { codexSemanticToolSpecs } from "../codex/codex-driver-values.js";
+import { nativeSystemInstructions } from "../../backends/runtime-context.js";
+import type { CodexNativeSessionBackendOptions } from "../../backends/codex-native-backend.js";
+
+export interface RunnerdDotDriverOptions {
+ execution: NativeExecutionInputV6;
+ stateDirectory: string;
+ identity: DurableRecoveryIdentity;
+ port: ExternalProviderPort;
+ runnerBinary?: string;
+ controlPlaneRegistration?: CapabilityRunnerdCodexTransportOptions["controlPlaneRegistration"];
+ onSpawn?: CodexNativeSessionBackendOptions["onSpawn"];
+ dynamicTools?: CodexNativeSessionBackendOptions["dynamicTools"];
+ dynamicToolHandler?: CodexNativeSessionBackendOptions["dynamicToolHandler"];
+ completionFeedback?: CodexNativeSessionBackendOptions["completionFeedback"];
+ adoptExistingRunner?: CapabilityRunnerdCodexTransportOptions["adoptExistingRunner"];
+}
+
+const capabilities = {
+ resume: false, typedEvents: true, steering: false, interruption: false,
+ structuredResult: true, read: true, reconciliation: true, usage: false,
+ dynamicTools: true, unsupported: ["resume", "steering", "interruption", "usage", "goals", "runtimeRequestResolution", "threadLineage"],
+};
+
+/** The admission path can inspect Dot without allocating a broker port or Runner. */
+export function describeRunnerdDotDriver(): HarnessDriverDescriptor {
+ return { kind: "openai_dot_mcp", displayName: "OpenAI Dot", version: "dot-mcp-v1", protocolVersion: "prp.v3",
+ capabilities: structuredClone(capabilities), runtimeContextCapabilities: { instructions: "native", skills: "native", mcp: "native" } };
+}
+
+/** Thin SDK projection. Rust owns every lifecycle decision and durable receipt. */
+export class RunnerdDotDriver implements HarnessDriver {
+ constructor(readonly options: RunnerdDotDriverOptions) {}
+ async descriptor() {
+ return describeRunnerdDotDriver();
+ }
+ async openSession(input: OpenHarnessSessionInput): Promise {
+ if (input.runId !== this.options.identity.runId || input.normalizedSessionId !== this.options.identity.normalizedSessionId) {
+ throw new Error("dot_runner_identity_mismatch");
+ }
+ input.signal?.throwIfAborted();
+ const session = new RunnerdDotSession(this.options);
+ try { await session.open(input.signal); return session; }
+ catch (error) { await session.detachControllerForRestart().catch(() => {}); throw error; }
+ }
+ async recoverSession(snapshot: PersistedHarnessSession, options: { signal: AbortSignal }) {
+ if (snapshot.driverKind !== "openai_dot_mcp" || snapshot.runId !== this.options.identity.runId
+ || snapshot.driverSessionId !== this.options.identity.normalizedSessionId || snapshot.providerSessionId != null) {
+ return { recovered: false, reason: "Dot bridge checkpoint identity mismatch" };
+ }
+ const path = resolve(this.options.stateDirectory, "runner/dot-provider-state.json");
+ if (!existsSync(path) || statSync(path).size > 32 * 1024 * 1024) return { recovered: false, reason: "Dot bridge checkpoint missing; external work requires reconciliation" };
+ let saved: Record;
+ try { saved = JSON.parse(readFileSync(path, "utf8")); } catch { return { recovered: false, reason: "Dot bridge checkpoint invalid; external work requires reconciliation" }; }
+ if (saved.schema !== "paperclip.runner.dot-provider-state.v1" || saved.runId !== snapshot.runId || saved.sessionId !== snapshot.driverSessionId || saved.turnId !== this.options.identity.turnId) {
+ return { recovered: false, reason: "Dot bridge checkpoint authority mismatch" };
+ }
+ return { recovered: true, session: await this.openSession({ runId: snapshot.runId,
+ normalizedSessionId: snapshot.driverSessionId, workingDirectory: this.options.stateDirectory, signal: options.signal }) };
+ }
+}
+
+class RunnerdDotSession implements HarnessSession {
+ #core: DurablePrpControlPlane | null = null;
+ #process: RunnerProcessHandle | null = null;
+ #events: PrpEvent[] = [];
+ #waiters = new Set<() => void>();
+ #release: (() => Promise | void) | null = null;
+ #detachPort: (() => Promise) | null = null;
+ #closed = false;
+ #failure: Error | null = null;
+ constructor(readonly options: RunnerdDotDriverOptions) {}
+ ids() { return { driverSessionId: this.options.identity.normalizedSessionId, providerSessionId: null, displayId: "OpenAI Dot" }; }
+
+ async open(signal?: AbortSignal) {
+ const o = this.options;
+ mkdirSync(o.stateDirectory, { recursive: true, mode: 0o700 });
+ const runnerState = resolve(o.stateDirectory, "runner");
+ mkdirSync(runnerState, { recursive: true, mode: 0o700 });
+ const binary = o.runnerBinary ?? defaultCapabilityRunnerdBinary();
+ const artifact = readRunnerdArtifactBinding(binary);
+ const core = this.#core = new DurablePrpControlPlane({
+ identity: o.identity, stateDirectory: resolve(o.stateDirectory, "control-plane"),
+ expectedRunnerVersion: artifact.version, expectedRunnerDigest: artifact.digest,
+ connectionLeaseTtlMs: Math.min(7_200_000, Math.max(60_000, o.execution.provider.binding.expiresAtUnixMs - Date.now())),
+ onProtocolIntegrityError: error => { this.#failure = error; this.#wake(); },
+ onCommittedEvent: async event => {
+ if (event.eventType === "external_provider.dispatch_requested") await o.port.dispatch(event);
+ if (event.eventType === "external_provider.operation_settled") await o.port.settle(event);
+ if (!this.#events.some(e => e.sourceEventId === event.sourceEventId)) this.#events.push(event);
+ this.#wake();
+ },
+ onSemanticToolInput: async call => {
+ if (call.operationId === "paperclip_finish" || call.operationId === "paperclip_block") {
+ const result = validatePrpStructuredRunResult(call.input);
+ if (!result.ok || (call.operationId === "paperclip_block") !== (result.ok && result.result.reportedWorkDisposition === "blocked")) {
+ return { result: { error: "Invalid completion report. Use the admitted completion contract and the correct completion tool." }, isError: true };
+ }
+ try { return { result: { accepted: true, completionReport: result.result, feedback: await o.completionFeedback?.(result.result) ?? "Completion accepted; finish the external turn." } }; }
+ catch (error) { return { result: { error: error instanceof Error ? error.message : "Completion rejected" }, isError: true }; }
+ }
+ if (!o.dynamicToolHandler) throw new Error("dot_semantic_authority_unavailable");
+ const result = await o.dynamicToolHandler({ tool: call.operationId, callId: call.callId,
+ threadId: o.identity.normalizedSessionId, turnId: o.identity.turnId, arguments: call.input });
+ const outcome = result && typeof result === "object" ? (result as Record).outcome : undefined;
+ return { result, isError: typeof outcome === "string" && !["completed", "succeeded", "success"].includes(outcome) };
+ },
+ });
+ // Rehydrate the projection from the authenticated transport journal. Broker
+ // persistence happens before ACK, so these events have durable projections.
+ this.#events = core.store.state.committedEvents.map(e => e.envelope.payload as unknown as PrpEvent);
+ const registration = o.controlPlaneRegistration ? await o.controlPlaneRegistration(core, o.identity) : null;
+ this.#release = registration?.release ?? null;
+ if (!registration) await core.start();
+ signal?.throwIfAborted();
+ if (!o.adoptExistingRunner) {
+ this.#process = spawnRunner({ connectUrl: registration?.connectUrl ?? core.connectUrl,
+ connection: registration?.connection, stateDirectory: runnerState, identity: o.identity,
+ ticket: core.issueBootstrapTicket(60_000), runnerBinaryPath: binary,
+ runnerVersion: artifact.version, runnerDigest: artifact.digest,
+ maxOutboxBytes: 16 * 1024 * 1024, p0ReserveBytes: 1024 * 1024,
+ maxRuntimeMs: 0, reconnectGraceMs: 60_000,
+ // No agent, OAuth, ChatGPT or provider API credentials are inherited.
+ environment: { PATH: process.env.PATH },
+ });
+ const pid = this.#process.child.pid;
+ if (pid) await o.onSpawn?.({ pid, processGroupId: this.#process.processGroupId ?? null,
+ startedAt: this.#process.startedAt ?? new Date().toISOString() });
+ void this.#process.completion.then(result => {
+ if (this.#closed) return;
+ // Rust exits after the authenticated shutdown receipt is committed and
+ // ACKed. That exit can precede the SDK's next command poll.
+ if (result.code === 0 && core.getCommand("dot_shutdown")?.status === "completed") return;
+ this.#failure ??= new Error(`dot_runner_process_exited_recovery_required: code=${result.code} signal=${result.signal}`);
+ this.#wake();
+ }, () => {
+ if (this.#closed) return;
+ this.#failure ??= new Error("dot_runner_process_exited_recovery_required");
+ this.#wake();
+ });
+ } else if (!await o.adoptExistingRunner.isAlive()) { throw new Error("dot_runner_adoption_failed"); }
+ await registration?.activate?.();
+ await registration?.ready?.();
+ this.#detachPort = await o.port.attach(async operation => {
+ await this.#command("external_provider.operation", { ...operation }, `dot_operation_${operation.requestId}`);
+ }, () => this.interrupt(), existsSync(resolve(runnerState, "dot-provider-state.json")));
+ await this.#command("run.prepare", {
+ provider: { kind: "openai_dot", ...o.execution.provider.binding,
+ instructions: `${nativeSystemInstructions(o.execution)}\n\nAccept the assignment before calling tools. Invoke paperclip_finish or paperclip_block, then submit the same structured result with paperclip_dot_finish. Keep request IDs stable across retries.` },
+ authorizedTools: authorizedToolSetForProvider(undefined, [...o.dynamicTools ?? [], ...codexSemanticToolSpecs()]),
+ completionContract: { revision: o.execution.completionContract.contract.revision,
+ criterionIds: o.execution.completionContract.contract.criteria.map(c => c.id) },
+ }, "dot_prepare");
+ await this.#command("session.open", {}, "dot_open");
+ signal?.throwIfAborted();
+ }
+
+ async #command(type: string, payload: Record, id: string) {
+ if (!this.#core || this.#closed) throw new Error("dot_runner_unavailable");
+ this.#core.queueCommand(type, payload, id, true);
+ const deadline = Date.now() + 30_000;
+ while (Date.now() < deadline) {
+ if (this.#failure) throw this.#failure;
+ const command = this.#core.getCommand(id);
+ if (command?.status === "completed") return (command.result?.result ?? {}) as Record;
+ if (command && ["failed", "rejected"].includes(command.status)) {
+ const error = new Error("dot_runner_operation_rejected");
+ Object.assign(error, { dotOperationRejected: true });
+ throw error;
+ }
+ if (command?.status === "indeterminate") throw new Error("dot_runner_operation_unknown_reconcile_required");
+ await new Promise(r => setTimeout(r, 20));
+ }
+ throw new Error("dot_runner_command_pending_reconcile_with_same_request_id");
+ }
+ async startTurn(input: { message: { text: string } }) {
+ await this.#command("turn.start", { text: input.message.text }, "dot_start");
+ return { turnId: this.options.identity.turnId };
+ }
+ #wake() { for (const wake of this.#waiters) wake(); this.#waiters.clear(); }
+ async *events(): AsyncIterable {
+ let index = 0;
+ while (!this.#closed) {
+ while (index < this.#events.length) { const event = this.#events[index++]!; yield event; if (event.eventType === "run.terminal") return; }
+ if (this.#failure) throw this.#failure;
+ await new Promise(resolve => this.#waiters.add(resolve));
+ }
+ }
+ async read() { return await this.#command("session.snapshot", {}, `dot_snapshot_${randomUUID()}`); }
+ async reconcile() { return { ...await this.read(), externalStopConfirmed: false, usage: null, cost: null }; }
+ async usage() { return null; }
+ async interrupt() { await this.#command("run.cancel", {}, "dot_cancel"); }
+ async snapshot(): Promise {
+ const state = await this.read();
+ const proposed = this.#events.findLast(event => event.eventType === "run.result.proposed");
+ const result = proposed ? validatePrpStructuredRunResult(proposed.payload) : null;
+ const terminal = this.#events.findLast(event => event.eventType === "run.terminal");
+ return { driverKind: "openai_dot_mcp", driverSessionId: this.ids().driverSessionId,
+ providerSessionId: null, runId: this.options.identity.runId,
+ normalizedSessionId: this.options.identity.normalizedSessionId,
+ activeTurnId: typeof state.activeProviderTurnId === "string" ? state.activeProviderTurnId : null,
+ semanticResult: result?.ok ? { result: result.result, turnId: this.options.identity.turnId, fingerprint: JSON.stringify(result.result) } : null,
+ terminalTurns: terminal ? [{ turnId: this.options.identity.turnId, fingerprint: JSON.stringify(terminal.payload) }] : [],
+ providerRecoveryPolicy: "same_session_only",
+ lastSourceSequence: this.#events.at(-1)?.sourceSeq ?? 0 };
+ }
+ async detachControllerForRestart() {
+ this.#closed = true; this.#wake();
+ await this.#detachPort?.(); await this.#release?.(); await this.#core?.stop();
+ await this.#core?.drainPendingConnectionProcessing();
+ this.#core?.retireSemanticToolCallbacks();
+ }
+ async close(input: { reason: string; force?: boolean }) {
+ if (this.#closed) return;
+ if (input.force) await this.interrupt();
+ await this.#command("session.close", {}, "dot_close");
+ await this.#command("runner.shutdown", {}, "dot_shutdown");
+ await this.detachControllerForRestart();
+ }
+}
diff --git a/packages/paperclip-runner/src/eval/workflow-evals.test.ts b/packages/paperclip-runner/src/eval/workflow-evals.test.ts
index 8a57f2509be..c90118fe819 100644
--- a/packages/paperclip-runner/src/eval/workflow-evals.test.ts
+++ b/packages/paperclip-runner/src/eval/workflow-evals.test.ts
@@ -466,13 +466,13 @@ describe("workflow reports and stress traceability", () => {
candidateFailures: 36,
});
expect(report.coverage).toMatchObject({
- canonicalOperations: 56,
+ canonicalOperations: 57,
capabilityCases: 106,
workflows: 12,
stressFindings: 44,
stressExclusions: 1,
});
- expect(report.coverage.operations).toHaveLength(56);
+ expect(report.coverage.operations).toHaveLength(57);
expect(report.coverage.composedWorkflows).toHaveLength(12);
expect(
report.coverage.operations.find(
@@ -480,7 +480,7 @@ describe("workflow reports and stress traceability", () => {
)?.workflowIds.length,
).toBeGreaterThan(0);
expect(renderRunnerWorkflowMarkdown(report)).toContain(
- "56 operations · 106 capability cases · 12 workflows",
+ "57 operations · 106 capability cases · 12 workflows",
);
expect(renderRunnerWorkflowJUnit(report)).toContain(
'tests="36" failures="36" skipped="0"',
diff --git a/packages/paperclip-runner/src/evals/compatibility.test.ts b/packages/paperclip-runner/src/evals/compatibility.test.ts
index 759d4525ba6..be5fe552f27 100644
--- a/packages/paperclip-runner/src/evals/compatibility.test.ts
+++ b/packages/paperclip-runner/src/evals/compatibility.test.ts
@@ -80,8 +80,9 @@ describe("Paperclip Evals integration compatibility", () => {
requirement.runnerd.nativeExecutionVersion = 2;
requirement.runnerd.harnessDriverVersion = 2;
requirement.nativeExecutionVersion = 2;
- requirement.prp = { minimumVersion: 3, maximumVersion: 3 };
- requirement.runnerd.prp = { name: "paperclip.runner", minimumVersion: 3, maximumVersion: 3 };
+ const unsupportedVersion = PAPERCLIP_RUNNER_BUILD_METADATA.prp.maximumVersion + 1;
+ requirement.prp = { minimumVersion: unsupportedVersion, maximumVersion: unsupportedVersion };
+ requirement.runnerd.prp = { name: "paperclip.runner", minimumVersion: unsupportedVersion, maximumVersion: unsupportedVersion };
requirement.catalog = { version: 2, sha256: `sha256:${"0".repeat(64)}` };
requirement.driver.contractVersion = 2;
requirement.driver.descriptor.capabilities.dynamicTools = false;
diff --git a/packages/paperclip-runner/src/index.ts b/packages/paperclip-runner/src/index.ts
index 9369fe95261..29bf5d6fbe2 100644
--- a/packages/paperclip-runner/src/index.ts
+++ b/packages/paperclip-runner/src/index.ts
@@ -1,3 +1,4 @@
+export * from "./configured-environment.js";
export * from "./catalog/index.js";
export { CURSOR_DISTRIBUTION_PINS } from "./drivers/acpx/generated-profiles.js";
export * from "./contracts/control-plane-port.js";
@@ -7,12 +8,14 @@ export * from "./contracts/durable-recovery.js";
export * from "./contracts/harness-driver.js";
export * from "./contracts/local-runner.js";
export * from "./contracts/native-execution.js";
+export * from "./contracts/external-provider.js";
export * from "./contracts/provider-mode.js";
export * from "./contracts/native-session-backend.js";
export * from "./contracts/question-set.js";
export * from "./contracts/runtime-context.js";
export * from "./contracts/types.js";
export * from "./backends/harness-driver-backend.js";
+export * from "./drivers/dot/dot-harness-driver.js";
export { describeRunnerdNativeSessionBackend } from "./backends/codex-native-backend.js";
export { createOpenCodeNativeSessionBackend } from "./backends/opencode-native-backend.js";
export {
@@ -84,3 +87,5 @@ export * from "./compatibility.js";
export { probeAcpxClaudeInstallation, probeAcpxGrokInstallation, probeAcpxPiInstallation } from "./drivers/acpx/installation-integrity.js";
export { bundledRemoteProviderPackManifestPath, bundledRemoteRunnerBinary } from "./live/bundled-remote-provider-pack.js";
+
+export { RunnerdDotDriver, type RunnerdDotDriverOptions } from "./drivers/dot/runnerd-dot-driver.js";
diff --git a/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts b/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
index 03485e46d00..a6b356c71ad 100644
--- a/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
+++ b/packages/paperclip-runner/src/live/runnerd-codex-transport.test.ts
@@ -37,6 +37,7 @@ import type {
PrpStructuredRunResult,
PrpTerminalState,
} from "../protocol/replay-contract.js";
+import { PRP_PROTOCOL_VERSION } from "../protocol/replay-contract.js";
import { executeNativeSession } from "../native-session-runtime.js";
import { redactCapabilityEvidenceData } from "./evidence-redaction.js";
import { NativeSessionCloseUnrecoverableError } from "../contracts/native-session-backend.js";
@@ -236,7 +237,7 @@ it("replaces an owned v1 runner with fresh v2 authorization before warm attachme
async () => {
expect(handles).toHaveLength(2);
const state = await runnerState();
- expect(state.lastConnectionProtocolVersion).toBe(2);
+ expect(state.lastConnectionProtocolVersion).toBe(PRP_PROTOCOL_VERSION);
expect(state.v2ReplayEvents).toEqual({});
expect(state.outbox).toEqual([]);
expect(core.activeRunnerConnectionCount()).toBe(1);
diff --git a/packages/paperclip-runner/src/live/runnerd-codex-transport.ts b/packages/paperclip-runner/src/live/runnerd-codex-transport.ts
index 1f71f54560d..9c756fccf47 100644
--- a/packages/paperclip-runner/src/live/runnerd-codex-transport.ts
+++ b/packages/paperclip-runner/src/live/runnerd-codex-transport.ts
@@ -1,4 +1,5 @@
import { admittedPiThinkingLevel, resolvePiThinkingLevel } from "../drivers/acpx/pi-thinking.js";
+import { configuredEnvironment } from "../configured-environment.js";
import { resolveAcpxProviderMode } from "../drivers/acpx/provider-mode.js";
import { isAcpxCanonicalInputMethod } from "../drivers/acpx/profile-extensions.js";
import { RunnerdTraceFrameIndex } from "./runnerd-trace-frame-index.js";
@@ -3381,14 +3382,14 @@ function createSanitizedOpenCodeRunnerEnvironment(
delete candidate[key];
if (source?.[key] !== undefined) candidate[key] = source[key];
}
- return Object.fromEntries(
+ return { ...configuredEnvironment(source), ...Object.fromEntries(
Object.entries(candidate).filter(
([key, value]) =>
typeof value === "string" &&
(OPEN_CODE_RUNNER_ENVIRONMENT_KEYS.has(key) ||
/^LC_[A-Z0-9_]{1,32}$/.test(key)),
),
- );
+ ) };
}
export function resolveSourceCodexHome(
diff --git a/packages/paperclip-runner/src/mock-core/codex-runner.ts b/packages/paperclip-runner/src/mock-core/codex-runner.ts
index d2c6b078e58..25d3b8195ff 100644
--- a/packages/paperclip-runner/src/mock-core/codex-runner.ts
+++ b/packages/paperclip-runner/src/mock-core/codex-runner.ts
@@ -114,12 +114,12 @@ function dispositionIssues(
} else if (result.reportedWorkDisposition === "yielded") {
if (
result.blocker !== undefined ||
- result.continuation?.kind !== "response_wake"
+ !["response_wake", "monitor"].includes(result.continuation?.kind ?? "")
) {
issues.push({
code: "invalid_disposition",
path: "/reportedWorkDisposition",
- message: "yielded requires a response_wake continuation and must not include a blocker",
+ message: "yielded requires a response_wake or monitor continuation and must not include a blocker",
});
}
} else {
diff --git a/packages/paperclip-runner/src/native-session-runtime.test.ts b/packages/paperclip-runner/src/native-session-runtime.test.ts
index db0344becc7..610813ef9c6 100644
--- a/packages/paperclip-runner/src/native-session-runtime.test.ts
+++ b/packages/paperclip-runner/src/native-session-runtime.test.ts
@@ -508,7 +508,8 @@ describe("executeNativeSession recovery", () => {
const submitted = startTurn.mock.calls[0]![0]!;
if (snapshotBeforeUpdate) {
expect(submitted.continuation).toBe(true);
- expect(JSON.parse(submitted.message.text)).toMatchObject({ schema: "paperclip.native-continuation.v1", events: "Say bye" });
+ expect(JSON.parse(submitted.message.text)).toMatchObject({ schema: "paperclip.native-continuation.v1", events: "Say bye",
+ completion: { instruction: expect.stringContaining("Earlier reports belong to earlier turns") } });
} else {
expect(submitted).not.toHaveProperty("continuation");
expect(JSON.parse(submitted.message.text).task.prompt).toBe("Say bye");
@@ -4403,7 +4404,9 @@ describe("executeNativeSession recovery", () => {
expect(lifecycle).toEqual(["closed"]);
});
- it("commits a governed wait without waiting for abort-insensitive provider cleanup", async () => {
+ it("commits a proved governed wait without waiting for abort-insensitive provider cleanup", async () => {
+ vi.useFakeTimers();
+ try {
const lifecycle: string[] = [];
let cancellationSignal: AbortSignal | undefined;
const cancel = vi.fn(({ signal }: { signal: AbortSignal }) => {
@@ -4429,6 +4432,8 @@ describe("executeNativeSession recovery", () => {
},
async *events() {
yield runnerEvent(1, "item.completed");
+ expect(cancel).toHaveBeenCalledOnce();
+ yield runnerEvent(2, "turn.interrupted", { providerTerminalObserved: true });
},
async startTurn() {
return { turnId: "turn-recovery" };
@@ -4498,7 +4503,13 @@ describe("executeNativeSession recovery", () => {
keepSessionOpen: true,
onSession: (current) => retainedSessions.push(current),
});
- await expect(execution).resolves.toMatchObject({ result: yieldedResult });
+ let settled = false;
+ const completed = execution.then(value => { settled = true; return value; });
+ void completed.catch(() => undefined);
+ await vi.advanceTimersByTimeAsync(9_900);
+ expect(settled).toBe(false);
+ await vi.advanceTimersByTimeAsync(200);
+ await expect(completed).resolves.toMatchObject({ result: yieldedResult });
expect(cancel).toHaveBeenCalledOnce();
expect(cancellationSignal?.aborted).toBe(true);
expect(close).toHaveBeenCalledOnce();
@@ -4506,9 +4517,11 @@ describe("executeNativeSession recovery", () => {
expect(retainedSessions.at(-1)).toBeNull();
expect(events.map((event) => event.eventType)).toEqual([
"item.completed",
+ "turn.interrupted",
"run.result.accepted",
"run.terminal",
]);
+ } finally { vi.useRealTimers(); }
});
it("uses the execution timeout when a completion report has no provider terminal", async () => {
@@ -4637,7 +4650,7 @@ describe("executeNativeSession recovery", () => {
expect(retainedSessions.at(-1)).toBeNull();
});
- it("retains a reusable session while a semantic terminal releases its remote subscription", async () => {
+ it.each([false, true])("retains a reusable session while terminal teardown settles (governed=%s)", async (governed) => {
const close = vi.fn(async () => undefined);
const retainedSessions: Array = [];
const session: NativeSession = {
@@ -4653,9 +4666,9 @@ describe("executeNativeSession recovery", () => {
},
async *events() {
try {
- yield runnerEvent(1, "run.result.proposed", result);
+ yield { ...runnerEvent(1, governed ? "item.completed" : "run.result.proposed", governed ? { kind: "dynamicToolCall" } : result), turnId: "turn-recovery" };
yield {
- ...runnerEvent(2, "turn.completed"),
+ ...runnerEvent(2, governed ? "turn.interrupted" : "turn.completed"),
turnId: "turn-recovery",
};
} finally {
@@ -4680,6 +4693,7 @@ describe("executeNativeSession recovery", () => {
lineage: [],
};
},
+ cancel: () => ({ cleanup: Promise.resolve() }),
close,
};
const backend: NativeSessionBackend = {
@@ -4720,10 +4734,11 @@ describe("executeNativeSession recovery", () => {
controlPlane: port,
runnerInstanceId: "runner-recovery",
controlPlaneInstanceId: "control-recovery",
+ resolveGovernedWait: governed ? () => yieldedResult : undefined,
keepSessionOpen: true,
onSession: (current) => retainedSessions.push(current),
}),
- ).resolves.toMatchObject({ result, terminal });
+ ).resolves.toMatchObject({ result: governed ? yieldedResult : result });
expect(close).not.toHaveBeenCalled();
expect(retainedSessions).toEqual([session]);
@@ -7484,6 +7499,37 @@ describe("executeNativeSession recovery", () => {
});
});
+ it("rejects visible provider final text without an accepted current-turn completion report", async () => {
+ const capabilities = { resume: false, typedEvents: true, steering: false, interruption: true, structuredResult: true };
+ const events: PrpEvent[] = [];
+ const completeRun = vi.fn(async () => undefined);
+ const session: NativeSession = {
+ identity: () => identity,
+ async capabilities() { return capabilities; },
+ async *events() {
+ yield runnerEvent(1, "item.completed", { kind: "agentMessage", channel: "final", text: "Contacts retrieved: Ada Fixture. Verification code: CONTACTS_fixture." });
+ yield runnerEvent(2, "turn.completed");
+ },
+ async startTurn() { return { turnId: "turn-recovery" }; },
+ async result() { return null; },
+ async snapshot() { return { backendKind: "mock", sessionId: identity.sessionId, identity,
+ providerSessionId: "provider-recovery", cursor: "2", activeTurnId: "turn-recovery", pendingRuntimeRequests: [], lineage: [] }; },
+ async close() {},
+ };
+ await expect(executeNativeSession({ input,
+ backend: { async descriptor() { return { kind: "mock", name: "missing-current-completion", version: "1", capabilities }; }, async openSession() { return session; } },
+ controlPlane: {
+ async openRun() {}, async checkpointSession() {},
+ async appendEvent(event) { events.push(structuredClone(event as PrpEvent)); return { cursor: event.sourceSeq, highestContiguousSourceSeq: event.sourceSeq, disposition: "committed" }; },
+ async replayEvents() { return { events: [], highestContiguousSourceSeq: 0 }; }, completeRun,
+ }, runnerInstanceId: "runner-recovery", controlPlaneInstanceId: "control-recovery", timeoutMs: 1000,
+ resolveMissingResult: async () => null,
+ })).rejects.toThrow("native_finalization_missing");
+ expect(completeRun).not.toHaveBeenCalled();
+ expect(events.some(event => event.eventType === "item.completed")).toBe(true);
+ expect(events.some(event => event.eventType === "run.result.accepted")).toBe(false);
+ });
+
it("accepts a control-plane governed wait when a completed turn omitted its semantic result", async () => {
const terminalEvent: PrpEvent = {
schema: "paperclip.prp.event.v1",
@@ -7641,7 +7687,192 @@ describe("executeNativeSession recovery", () => {
]);
});
- it("parks a provider turn immediately after a durable governed wait appears", async () => {
+ it.each(["end", "throw", "timeout"])("keeps a governed wait unfinalized when complete usage is followed by %s without a provider terminal", async fault => {
+ vi.useFakeTimers();
+ try {
+ const trigger = { ...runnerEvent(1, "item.completed", { kind: "dynamicToolCall" }), turnId: "turn-waiting" };
+ const usage = { ...runnerEvent(2, "item.completed", { kind: "usage", usage: { runDelta: { inputTokens: 7, outputTokens: 3 }, runDeltaComplete: true } }), turnId: trigger.turnId };
+ const history: PrpEvent[] = [];
+ let checkpoint: PersistedNativeSession | undefined;
+ let releaseStream!: () => void;
+ const streamClosed = new Promise(resolve => { releaseStream = resolve; });
+ const complete = vi.fn(async () => undefined);
+ const session: NativeSession = {
+ identity: () => identity,
+ async capabilities() { return { resume: true, typedEvents: true, steering: false, interruption: true, structuredResult: true }; },
+ async startTurn() { return { turnId: trigger.turnId }; },
+ cancel() { return { cleanup: Promise.resolve() }; },
+ async snapshot() { return { backendKind: "mock", sessionId: identity.sessionId, identity, activeTurnId: trigger.turnId }; },
+ async result() { return null; }, async close() { releaseStream(); },
+ async *events() {
+ yield trigger; yield usage;
+ if (fault === "throw") throw new Error("provider stream lost");
+ if (fault === "timeout") await streamClosed;
+ },
+ };
+ const backend: NativeSessionBackend = {
+ async descriptor() { return { kind: "mock", name: "missing-stop", version: "1", capabilities: await session.capabilities() }; },
+ async openSession() { return session; },
+ };
+ const port: ControlPlanePort = {
+ async openRun() {}, completeRun: complete,
+ async checkpointSession(value) { checkpoint = structuredClone(value); },
+ async appendEvent(event) { history.push(event); return { cursor: history.length, highestContiguousSourceSeq: event.sourceSeq, disposition: "committed" }; },
+ async replayEvents(request) { return { events: history.filter(row => row.sourceInstanceId === request.sourceInstanceId && row.sourceSeq > request.afterSourceSeq), highestContiguousSourceSeq: 0 }; },
+ };
+ const outcome = expect(executeNativeSession({ input, backend, controlPlane: port, timeoutMs: 1_000,
+ runnerInstanceId: "runner-recovery", controlPlaneInstanceId: "control-recovery", resolveGovernedWait: () => yieldedResult }))
+ .rejects.toMatchObject({ providerCode: "governed_wait_provider_terminal_unproven" });
+ void outcome.catch(() => undefined);
+ await vi.advanceTimersByTimeAsync(600);
+ await outcome;
+ expect(checkpoint?.governedWait).toEqual({ sourceEvent: trigger, result: yieldedResult });
+ expect(complete).not.toHaveBeenCalled();
+ expect(history).toEqual([trigger, usage]);
+ } finally { vi.useRealTimers(); }
+ });
+
+ it.each(["interrupt_acknowledgement", "runtime_request.cancelled", "runtime_request.expired"])("retains %s in contiguous governed-wait history for recovery", async cancellationKind => {
+ const trigger = { ...runnerEvent(1, "item.completed", { kind: "dynamicToolCall" }), turnId: "turn-waiting" };
+ const acknowledgement: PrpEvent = { ...runnerEvent(2, cancellationKind === "interrupt_acknowledgement" ? "item.completed" : cancellationKind as "runtime_request.cancelled" | "runtime_request.expired",
+ cancellationKind === "interrupt_acknowledgement" ? { kind: cancellationKind } : { requestId: "request-1" }), turnId: trigger.turnId };
+ const usage = { ...runnerEvent(3, "item.completed", { kind: "usage", usage: { runDelta: { inputTokens: 7, outputTokens: 3 }, runDeltaComplete: true } }), turnId: trigger.turnId };
+ const stopped = { ...runnerEvent(4, "turn.interrupted", { providerTerminalObserved: true }), turnId: trigger.turnId };
+ const history: PrpEvent[] = [];
+ let checkpoint: PersistedNativeSession | undefined;
+ const start = vi.fn(async () => ({ turnId: trigger.turnId }));
+ const cancel = vi.fn(() => ({ cleanup: Promise.resolve() }));
+ const complete = vi.fn(async () => undefined);
+ const session: NativeSession = {
+ identity: () => identity,
+ async capabilities() { return { resume: true, typedEvents: true, steering: false, interruption: true, structuredResult: true }; },
+ startTurn: start, cancel,
+ async snapshot() { return { backendKind: "mock", sessionId: identity.sessionId, identity, activeTurnId: trigger.turnId }; },
+ async result() { return null; }, async close() {},
+ async *events() { yield trigger; yield acknowledgement; yield usage; yield stopped; },
+ };
+ const backend: NativeSessionBackend = {
+ async descriptor() { return { kind: "mock", name: "cancel-history", version: "1", capabilities: await session.capabilities() }; },
+ async openSession() { return session; }, async recoverSession() { return { recovered: true, session }; },
+ };
+ const port: ControlPlanePort = {
+ async openRun() {}, completeRun: complete,
+ async checkpointSession(value) { checkpoint = structuredClone(value); },
+ async appendEvent(event) {
+ const duplicate = history.some(row => row.sourceEventId === event.sourceEventId);
+ if (!duplicate) history.push(event);
+ return { cursor: history.length, highestContiguousSourceSeq: event.sourceSeq, disposition: duplicate ? "duplicate" : "committed" };
+ },
+ async replayEvents(request) {
+ const events = history.filter(row => row.sourceInstanceId === request.sourceInstanceId && row.sourceSeq > request.afterSourceSeq);
+ return { events, highestContiguousSourceSeq: events.at(-1)?.sourceSeq ?? request.afterSourceSeq };
+ },
+ };
+ const options = { input, backend, controlPlane: port, runnerInstanceId: "runner-recovery", controlPlaneInstanceId: "control-recovery" };
+ await expect(executeNativeSession({ ...options, resolveGovernedWait: () => yieldedResult }))
+ .resolves.toMatchObject({ result: yieldedResult });
+ expect(history.filter(event => event.sourceInstanceId === trigger.sourceInstanceId)).toEqual([trigger, acknowledgement, usage, stopped]);
+ await expect(executeNativeSession({ ...options, persistedSession: checkpoint })).resolves.toMatchObject({ result: yieldedResult });
+ expect(start).toHaveBeenCalledOnce();
+ expect(cancel).toHaveBeenCalledOnce();
+ });
+
+ it.each(["trigger", "usage", "terminal"])("recovers a journaled governed wait after its answer is saved (last committed: %s)", async lastCommitted => {
+ const terminalCommitted = lastCommitted === "terminal";
+ const trigger = { ...runnerEvent(1, "item.completed", { kind: "dynamicToolCall", item: { id: "ask-1", name: "request_human_input" } }), turnId: "turn-waiting" };
+ const usage = { ...runnerEvent(2, "item.completed", { kind: "usage", usage: { runDelta: { inputTokens: 7, outputTokens: 3 }, runDeltaComplete: true } }), turnId: trigger.turnId };
+ const stopped = { ...runnerEvent(3, "turn.interrupted", { providerTerminalObserved: true }), turnId: trigger.turnId };
+ const history: PrpEvent[] = [];
+ let checkpoint: PersistedNativeSession | undefined;
+ let crashed = false;
+ let interrupted = false;
+ const revoke = vi.fn();
+ const cancel = vi.fn(() => { interrupted = true; return { cleanup: Promise.resolve() }; });
+ const start = vi.fn(async () => ({ turnId: trigger.turnId }));
+ const complete = vi.fn(async () => undefined);
+ const snapshot = (): PersistedNativeSession => ({ backendKind: "mock", sessionId: identity.sessionId, identity,
+ providerSessionId: "same-provider", activeTurnId: trigger.turnId, cursor: String(history.at(-1)?.sourceSeq ?? 0) });
+ const makeSession = (recovering: boolean): NativeSession => ({ identity: () => identity,
+ async capabilities() { return { resume: true, typedEvents: true, steering: false, interruption: true, structuredResult: true }; },
+ startTurn: start, revokeTurnPublication: revoke, cancel,
+ async snapshot() { return snapshot(); }, async result() { return null; }, async close() {},
+ async *events() {
+ if (!recovering) { yield trigger; return; }
+ // The restart resumes settlement only; it must not submit a model turn.
+ expect(interrupted).toBe(true);
+ yield usage;
+ yield stopped;
+ },
+ });
+ const backend: NativeSessionBackend = {
+ async descriptor() { return { kind: "mock", name: "durable-wait", version: "1", capabilities: await makeSession(false).capabilities() }; },
+ async openSession() { return makeSession(false); },
+ async recoverSession() { return { recovered: true, session: makeSession(true) }; },
+ };
+ const port: ControlPlanePort = {
+ async openRun() {}, completeRun: complete,
+ async checkpointSession(value) {
+ checkpoint = structuredClone(value);
+ if (value.governedWait && !crashed) {
+ expect(revoke).toHaveBeenCalledOnce();
+ expect(cancel).not.toHaveBeenCalled();
+ crashed = true;
+ throw new Error("controller lost after governed checkpoint");
+ }
+ },
+ async appendEvent(event) {
+ if (!history.some(row => row.sourceEventId === event.sourceEventId)) history.push(event);
+ return { cursor: history.length, highestContiguousSourceSeq: event.sourceSeq, disposition: "committed" };
+ },
+ async replayEvents(request) {
+ const events = history.filter(row => row.sourceInstanceId === request.sourceInstanceId && row.sourceSeq > request.afterSourceSeq);
+ return { events, highestContiguousSourceSeq: events.at(-1)?.sourceSeq ?? request.afterSourceSeq };
+ },
+ };
+ const options = { input, backend, controlPlane: port, runnerInstanceId: "runner-recovery", controlPlaneInstanceId: "control-recovery" };
+ await expect(executeNativeSession({ ...options, resolveGovernedWait: () => yieldedResult }))
+ .rejects.toThrow("controller lost after governed checkpoint");
+ expect(checkpoint?.governedWait).toEqual({ sourceEvent: trigger, result: yieldedResult });
+ expect(complete).not.toHaveBeenCalled();
+ // The failed controller's ordinary cleanup also invokes cancel. Its
+ // checkpoint assertion above proves interruption followed persistence.
+ cancel.mockClear(); interrupted = false;
+ if (lastCommitted !== "trigger") history.push(usage);
+ if (terminalCommitted) history.push(stopped);
+ const answerAlreadySaved = vi.fn(() => null);
+ await expect(executeNativeSession({ ...options, persistedSession: checkpoint, resolveGovernedWait: answerAlreadySaved }))
+ .resolves.toMatchObject({ result: yieldedResult, turnId: trigger.turnId, terminal: { runTerminalState: "succeeded" } });
+ expect(start).toHaveBeenCalledOnce();
+ expect(cancel).toHaveBeenCalledTimes(terminalCommitted ? 0 : 1);
+ expect(answerAlreadySaved).not.toHaveBeenCalled();
+ expect(complete).toHaveBeenCalledOnce();
+ expect(history.filter(event => event.payload.kind === "usage")).toEqual([usage]);
+ });
+
+ it.each(["missing-trigger", "changed-trigger", "unproven-terminal", "different-turn"])("rejects unsafe governed-wait recovery: %s", async fault => {
+ const trigger = { ...runnerEvent(1, "item.completed", { kind: "dynamicToolCall" }), turnId: "turn-waiting" };
+ const checkpoint: PersistedNativeSession = { backendKind: "mock", sessionId: identity.sessionId, identity,
+ activeTurnId: trigger.turnId, governedWait: { sourceEvent: trigger, result: yieldedResult } };
+ const history = fault === "missing-trigger" ? [] : [fault === "changed-trigger" ? { ...trigger, payload: {} } : trigger];
+ if (fault === "unproven-terminal") history.push({ ...trigger, sourceSeq: 2, sourceEventId: "unproven", eventType: "turn.failed", payload: { providerTerminalObserved: false } });
+ if (fault === "different-turn") history.push({ ...trigger, sourceSeq: 2, sourceEventId: "new-turn", turnId: "different", eventType: "turn.started" });
+ const start = vi.fn();
+ const complete = vi.fn();
+ const session: NativeSession = { identity: () => identity, startTurn: start, async result() { return null; },
+ async capabilities() { return { resume: true, typedEvents: true, steering: false, interruption: true, structuredResult: true }; },
+ async snapshot() { return checkpoint; }, async *events() {}, async close() {} };
+ const backend: NativeSessionBackend = { async descriptor() { return { kind: "mock", name: "unsafe-wait", version: "1", capabilities: await session.capabilities() }; },
+ async openSession() { return session; }, async recoverSession() { return { recovered: true, session }; } };
+ const port: ControlPlanePort = { async openRun() {}, async checkpointSession() {}, async appendEvent() { throw new Error("unexpected append"); },
+ completeRun: complete, async replayEvents(request) { return { events: history.filter(row => row.sourceSeq > request.afterSourceSeq), highestContiguousSourceSeq: history.at(-1)?.sourceSeq ?? 0 }; } };
+ await expect(executeNativeSession({ input, backend, controlPlane: port, persistedSession: checkpoint,
+ runnerInstanceId: "runner-recovery", controlPlaneInstanceId: "control-recovery" })).rejects.toThrow(/governed_wait|failed terminal/);
+ expect(start).not.toHaveBeenCalled(); expect(complete).not.toHaveBeenCalled();
+ });
+
+ it.each([0, 6_000, 12_000])("retains actual shutdown usage after %s ms before finalizing a governed wait", async (receiptDelayMs) => {
+ vi.useFakeTimers();
+ try {
const yielded: PrpStructuredRunResult = {
schema: "paperclip.run_result.v1",
reportedWorkDisposition: "yielded",
@@ -7681,8 +7912,8 @@ describe("executeNativeSession recovery", () => {
turnId: "turn-waiting",
};
const turnInterrupted: PrpEvent = {
- ...controlEvent(2, "turn.interrupted", { reason: "governed_wait" }),
- sourceEventId: "provider-recovery:2",
+ ...controlEvent(3, "turn.interrupted", { reason: "governed_wait" }),
+ sourceEventId: "provider-recovery:3",
sourceInstanceId: "provider-recovery",
sourceKind: "provider",
turnId: "turn-waiting",
@@ -7711,6 +7942,9 @@ describe("executeNativeSession recovery", () => {
async *events() {
yield itemCompleted;
await cancelled;
+ await new Promise(resolve => setTimeout(resolve, receiptDelayMs));
+ yield { ...itemCompleted, sourceSeq: 2, sourceEventId: "provider-recovery:2",
+ payload: { kind: "usage", usage: { runDelta: { inputTokens: 7, outputTokens: 3 }, runDeltaComplete: true } } };
yield turnInterrupted;
},
async startTurn() {
@@ -7778,7 +8012,7 @@ describe("executeNativeSession recovery", () => {
completeRun,
};
- const completed = await executeNativeSession({
+ const execution = executeNativeSession({
input,
backend,
controlPlane: port,
@@ -7788,7 +8022,10 @@ describe("executeNativeSession recovery", () => {
event.eventType === "item.completed" ? yielded : null,
});
+ await vi.advanceTimersByTimeAsync(receiptDelayMs + 1);
+ const completed = await execution;
expect(cancel).toHaveBeenCalledOnce();
+ expect(events.find(event => event.payload.kind === "usage")?.payload.usage).toMatchObject({ runDelta: { inputTokens: 7, outputTokens: 3 } });
expect(completed).toMatchObject({
result: yielded,
terminal: {
@@ -7799,9 +8036,12 @@ describe("executeNativeSession recovery", () => {
});
expect(events.map((event) => event.eventType)).toEqual([
"item.completed",
+ "item.completed",
+ "turn.interrupted",
"run.result.accepted",
"run.terminal",
]);
+ } finally { vi.useRealTimers(); }
});
it("hands a committed structured input to the durable wait after its live window", async () => {
diff --git a/packages/paperclip-runner/src/native-session-runtime.ts b/packages/paperclip-runner/src/native-session-runtime.ts
index df65c4450ab..e01dd745e23 100644
--- a/packages/paperclip-runner/src/native-session-runtime.ts
+++ b/packages/paperclip-runner/src/native-session-runtime.ts
@@ -47,6 +47,11 @@ const FAILED_OPERATION_SETTLEMENT_GRACE_MS = 100;
// bounded by the transport. Other iterator and handoff cleanup keeps the short
// fail-closed quarantine boundary below.
const REUSABLE_SESSION_CANCELLATION_SETTLEMENT_GRACE_MS = 10_000;
+// Governed cancellation can traverse the ACPX turn cancellation (2s), host
+// cancellation (2s), protocol/TERM/KILL shutdown (7s), and final status read
+// (1s). Allow that bounded settlement plus transport scheduling; never treat
+// elapsed time or a cancellation acknowledgement as usage/terminal evidence.
+const GOVERNED_ACCOUNTING_DRAIN_MS = 15_000;
const DEFAULT_NATIVE_CHECKPOINT_TIMEOUT_MS = 30_000;
type NativeSessionCleanupDomain = string;
@@ -870,12 +875,15 @@ async function consumeTurn(
},
initialGoal?: HarnessThreadGoal | null,
resumeInterruptedTurn?: (event: PrpEvent, signal: AbortSignal) => Promise,
+ checkpointGovernedWait?: (wait: NonNullable, signal: AbortSignal) => Promise,
+ initialGovernedWait?: PersistedNativeSession["governedWait"],
) {
let timer: ReturnType | undefined;
const appendAbort = new AbortController();
const governedCleanupOperations = new Set>();
let governedCancellationCommitted = false;
let semanticResultObserved = false;
+ let governedProviderTerminalObserved = false;
let deferredGovernedCleanupSettlement: Promise | null = null;
let deferredSessionCancellationSettlement: Promise | null = null;
const inputTimers = new Map>();
@@ -922,7 +930,7 @@ async function consumeTurn(
let latestSessionGoal: HarnessThreadGoal | null = null;
let resultSource: "semantic_result" | "governed_wait" | null = null;
let providerFailure: NativeProviderTerminalFailure | null = null;
- const settleDurableResult = (
+ const settleDurableResult = async (
event: PrpEvent,
result: PrpStructuredRunResult,
reason: string,
@@ -930,16 +938,77 @@ async function consumeTurn(
if (session.cancel === undefined) {
throw new Error("native_governed_wait_cancellation_unavailable");
}
- const cancellation = session.cancel({
- reason,
- signal: appendAbort.signal,
- });
+ // Revoke new publication before any asynchronous journal write. Persist
+ // the disposition before provider interruption, retaining usage and terminal
+ // evidence even when the interaction is answered during the restart.
+ session.revokeTurnPublication?.();
+ await checkpointGovernedWait?.({ sourceEvent: event, result }, appendAbort.signal);
+ appendAbort.signal.throwIfAborted();
+ const cancellation = session.cancel({ reason, signal: appendAbort.signal });
governedCancellationCommitted = true;
const cleanup = cancellation.cleanup;
governedCleanupOperations.add(cleanup);
void cleanup
.catch(() => quarantineSession("governed_cleanup_failed"))
.finally(() => governedCleanupOperations.delete(cleanup));
+ // Cancellation revokes provider work immediately, but shutdown can still
+ // supply its final usage. Keep a bounded accounting-only drain before
+ // acknowledging the run; otherwise the next wake sees permanent debt.
+ // Never let a stuck stream or cleanup revoke the durable governed wait.
+ const drainAbort = new AbortController();
+ const stopDrain = () => drainAbort.abort(appendAbort.signal.reason);
+ appendAbort.signal.addEventListener("abort", stopDrain, { once: true });
+ const drainMs = Math.min(GOVERNED_ACCOUNTING_DRAIN_MS, timeoutMs > 0 ? Math.max(1, Math.floor(timeoutMs / 4)) : GOVERNED_ACCOUNTING_DRAIN_MS);
+ let drainTimer: ReturnType | undefined;
+ const drained = (async () => {
+ while (!drainAbort.signal.aborted) {
+ const next = await eventIterator.next();
+ if (next.done || drainAbort.signal.aborted) return;
+ const trailing = next.value;
+ const terminal = isTurnTerminal(trailing);
+ const usage = trailing.eventType === "item.completed" && trailing.payload.kind === "usage";
+ // These already-numbered cancellation facts carry no new work
+ // authority. Retain them so later receipts have contiguous replay.
+ const cancellation = trailing.eventType === "runtime_request.cancelled"
+ || trailing.eventType === "runtime_request.expired"
+ || (trailing.eventType === "item.completed" && trailing.payload.kind === "interrupt_acknowledgement")
+ || (trailing.eventType === "run.terminal" && ["failed", "cancelled"].includes(String(trailing.payload.runTerminalState)));
+ if (trailing.turnId === event.turnId && (usage || terminal || cancellation)) {
+ const receipt = await controlPlane.appendEvent(trailing, { signal: drainAbort.signal });
+ if (drainAbort.signal.aborted) return;
+ eventCount += receipt.disposition === "committed" ? 1 : 0;
+ highestContiguousSourceSeq = Math.max(highestContiguousSourceSeq, receipt.highestContiguousSourceSeq);
+ if (terminal) {
+ if (trailing.eventType === "turn.failed" || trailing.payload.providerTerminalObserved === false) {
+ throw new NativeProviderTerminalFailure("governed_wait_provider_terminal_unproven", false);
+ }
+ governedProviderTerminalObserved = true;
+ return;
+ }
+ }
+ }
+ })();
+ await Promise.race([
+ drained.catch(error => {
+ quarantineSession("governed_accounting_drain_failed");
+ if (error instanceof NativeProviderTerminalFailure) throw error;
+ }),
+ new Promise(resolve => { drainTimer = setTimeout(() => {
+ drainAbort.abort(new Error("governed accounting drain timed out"));
+ quarantineSession("governed_accounting_drain_timed_out");
+ resolve();
+ }, drainMs); }),
+ ]).finally(() => {
+ clearTimeout(drainTimer);
+ appendAbort.signal.removeEventListener("abort", stopDrain);
+ drainAbort.abort();
+ });
+ // A durable wait and complete usage cannot prove that the provider
+ // stopped. Leave the journaled wait recoverable, without a successful
+ // result or an accounting-completion boundary, if shutdown is unproven.
+ if (!governedProviderTerminalObserved) {
+ throw new NativeProviderTerminalFailure("governed_wait_provider_terminal_unproven", false);
+ }
return {
event,
eventCount,
@@ -947,6 +1016,10 @@ async function consumeTurn(
governedResult: result,
};
};
+ if (initialGovernedWait) {
+ return settleDurableResult(initialGovernedWait.sourceEvent, initialGovernedWait.result,
+ "Paperclip resumed settlement of this durable governed interaction.");
+ }
while (true) {
const next = await eventIterator.next().catch((error) => {
throw providerFailure ?? error;
@@ -1309,15 +1382,14 @@ async function consumeTurn(
);
} else {
// Iterator and provider cleanup own no control-plane mutation authority.
- // A reusable session with a semantic result needs a longer bounded
- // window for the remote event subscription to release. This applies
- // after the provider terminal, which still crosses the remote PRP
- // acknowledgement boundary and routinely takes longer than
- // the generic local cleanup grace. Governed waits and unrelated stalled
- // cleanup retain the short fail-closed boundary.
+ // A reusable session needs a bounded window for its remote terminal
+ // subscription to release. A governed wait qualifies only after its
+ // actual provider terminal was retained during the accounting drain.
+ // Missing terminal evidence and unrelated stalled cleanup retain the
+ // short fail-closed boundary.
const teardownSettled = await settlesWithin(
passiveTeardownSettlement,
- semanticResultObserved
+ semanticResultObserved || governedProviderTerminalObserved
? reusableSessionCancellationGraceMs
: FAILED_OPERATION_SETTLEMENT_GRACE_MS,
);
@@ -1827,7 +1899,8 @@ export async function executeNativeSession(
if ("runtimeContext" in input) {
const capabilities = descriptor.runtimeContextCapabilities;
const unsupported = (["instructions", "skills", "mcp"] as const).filter(
- (key) => capabilities?.[key] !== "native",
+ (key) => capabilities?.[key] !== "native" && (input.provider.kind !== "openai_dot"
+ || key === "instructions" || (key === "skills" ? input.runtimeContext.skills.length > 0 : input.runtimeContext.mcp.bindingId !== null)),
);
if (unsupported.length)
throw new Error(
@@ -1871,6 +1944,42 @@ export async function executeNativeSession(
issueId: input.binding.issueId,
agentId: input.binding.agentId,
};
+ let governedWait = persistedSession?.governedWait;
+ const governedReplay: PrpEvent[] = [];
+ if (governedWait) {
+ const event = governedWait.sourceEvent;
+ const validation = validatePrpStructuredRunResult(governedWait.result);
+ if (!event?.turnId || event.runId !== identity.runId || event.normalizedSessionId !== identity.sessionId
+ || event.sourceInstanceId !== options.runnerInstanceId || !Number.isSafeInteger(event.sourceSeq) || event.sourceSeq < 1
+ || !validation.ok || validation.result.reportedWorkDisposition !== "yielded"
+ || validation.result.completionClaim?.contractRevision !== input.completionContract.contract.revision) {
+ throw new Error("native_governed_wait_checkpoint_mismatch");
+ }
+ await runAbortableOperationWithin({
+ timeoutMs: options.timeoutMs ?? 900_000,
+ timeoutMessage: "native governed-wait recovery replay timed out",
+ operation: async signal => {
+ let afterSourceSeq = event.sourceSeq - 1;
+ while (true) {
+ const page = await options.controlPlane.replayEvents({ runId: identity.runId,
+ sourceInstanceId: options.runnerInstanceId, afterSourceSeq, limit: 1_000 }, { signal });
+ signal.throwIfAborted();
+ if (!page.events.length) break;
+ for (const entry of page.events) {
+ if (entry.runId !== identity.runId || entry.normalizedSessionId !== identity.sessionId
+ || entry.sourceInstanceId !== event.sourceInstanceId || entry.sourceSeq !== afterSourceSeq + 1
+ || governedReplay.length >= 10_000) throw new Error("native_governed_wait_replay_mismatch");
+ governedReplay.push(entry);
+ afterSourceSeq = entry.sourceSeq;
+ }
+ }
+ },
+ });
+ if (canonicalJson(governedReplay[0]) !== canonicalJson(event)) throw new Error("native_governed_wait_trigger_unproven");
+ if (governedReplay.some(entry => entry.eventType === "turn.started" && entry.turnId !== event.turnId)) {
+ throw new Error("native_governed_wait_turn_mismatch");
+ }
+ }
let recovered = false;
let session: NativeSession | null = null;
let continuityBreak: {
@@ -1982,7 +2091,7 @@ export async function executeNativeSession(
};
const replacementInput = {
identity,
- workingDirectory: input.workspace.cwd,
+ workingDirectory: input.workspace.cwd ?? undefined,
};
session = await runAbortableOperationWithin({
timeoutMs: recoveryTimeoutMs,
@@ -2015,7 +2124,7 @@ export async function executeNativeSession(
const bootstrapTimeoutMs = options.timeoutMs ?? 900_000;
const bootstrapInput = {
identity,
- workingDirectory: input.workspace.cwd,
+ workingDirectory: input.workspace.cwd ?? undefined,
};
session = await runAbortableOperationWithin({
timeoutMs: bootstrapTimeoutMs,
@@ -2152,7 +2261,7 @@ export async function executeNativeSession(
externalSignal?: AbortSignal,
) =>
persistCheckpointWithin({
- snapshot,
+ snapshot: governedWait ? { ...snapshot, governedWait } : snapshot,
controlPlane: options.controlPlane,
onCheckpoint: options.onCheckpoint,
timeoutMs: checkpointTimeoutMs,
@@ -2240,6 +2349,21 @@ export async function executeNativeSession(
await persistCheckpoint(recoveredSnapshot);
}
+ const governedTerminal = governedWait ? governedReplay.find(event =>
+ event.turnId === governedWait!.sourceEvent.turnId && isTurnTerminal(event)) : undefined;
+ if (governedTerminal?.eventType === "turn.failed" || governedTerminal?.payload.providerTerminalObserved === false) {
+ throw new NativeProviderTerminalFailure("governed_wait_provider_terminal_unproven", false);
+ }
+ if (governedWait && recoveredActiveTurnId && recoveredActiveTurnId !== governedWait.sourceEvent.turnId) {
+ throw new Error("native_governed_wait_turn_mismatch");
+ }
+ if (governedWait) {
+ for (const event of governedReplay) {
+ if (event.turnId === governedWait.sourceEvent.turnId && (event.payload.kind === "usage" || isTurnTerminal(event))) {
+ await options.controlPlane.appendEvent(event);
+ }
+ }
+ }
let consumed = {
event: null as PrpEvent | null,
eventCount: 0,
@@ -2322,7 +2446,10 @@ export async function executeNativeSession(
replayedDisposition?.terminal ?? dispositionFallback;
const consumptionAbort = new AbortController();
const consuming =
- recoveryTerminal === null
+ governedTerminal && governedWait
+ ? Promise.resolve({ event: governedWait.sourceEvent, governedResult: governedWait.result,
+ eventCount: 0, highestContiguousSourceSeq: governedTerminal.sourceSeq })
+ : recoveryTerminal === null
? consumeTurn(
session,
options.controlPlane,
@@ -2345,6 +2472,11 @@ export async function executeNativeSession(
: undefined,
recoveredSnapshot.goal,
resumeInterruptedTurn,
+ async (wait, signal) => {
+ governedWait = structuredClone(wait);
+ await checkpoint(signal);
+ },
+ governedWait,
)
: Promise.resolve({
event: recoveryTerminal,
@@ -2360,12 +2492,12 @@ export async function executeNativeSession(
// that later rejection becomes process-fatal under Node's strict policy.
void consuming.catch(() => undefined);
try {
- const shouldStartFreshTurn =
+ const shouldStartFreshTurn = !governedWait && (
!recovered ||
(!recoveredActiveTurnId &&
!adoptedProviderTerminal &&
!checkpointedDispositionTerminal &&
- !dispositionRecoveryStillOwned);
+ !dispositionRecoveryStillOwned));
if (options.sessionGoalControl) {
// Explicit controls remain authoritative after controller loss. In
// particular, pause/clear/edit must reach a recovered session even
diff --git a/packages/paperclip-runner/src/protocol-actions/create-task.ts b/packages/paperclip-runner/src/protocol-actions/create-task.ts
index fba315e0f73..2b138793197 100644
--- a/packages/paperclip-runner/src/protocol-actions/create-task.ts
+++ b/packages/paperclip-runner/src/protocol-actions/create-task.ts
@@ -109,6 +109,7 @@ export const createTaskAction = {
"description": "Child task description.",
"maxLength": 20000
},
+ "assigneeUserId": { "type": ["string", "null"], "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId." },
"assigneeActorId": {
"type": [
"string",
@@ -225,7 +226,8 @@ export const createTaskAction = {
"type": "string",
"minLength": 1
},
- "assigneeActorId": {
+ "assigneeUserId": { "type": ["string", "null"], "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId." },
+ "assigneeActorId": {
"type": [
"string",
"null"
@@ -271,6 +273,7 @@ export const createTaskAction = {
"description": {
"type": "string"
},
+ "assigneeUserId": { "type": ["string", "null"], "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId." },
"assigneeActorId": {
"type": "string"
},
diff --git a/packages/paperclip-runner/src/protocol-actions/index.ts b/packages/paperclip-runner/src/protocol-actions/index.ts
index 35a003c5526..1c5b3083016 100644
--- a/packages/paperclip-runner/src/protocol-actions/index.ts
+++ b/packages/paperclip-runner/src/protocol-actions/index.ts
@@ -1,3 +1,4 @@
+import { setTaskMonitorAction } from "./set-task-monitor.js";
import { setTaskTitleAction } from "./set-task-title.js";
import { submitComplaintAction, submitSuggestionAction } from "./submit-agent-commentary.js";
import { readAgentInstructionsAction } from "./read-agent-instructions.js";
@@ -57,6 +58,7 @@ import { deepFreezeProtocolAction } from "./freeze.js";
export const PAPERCLIP_PROTOCOL_ACTIONS = deepFreezeProtocolAction([
setTaskTitleAction,
+ setTaskMonitorAction,
submitComplaintAction,
submitSuggestionAction,
readAgentInstructionsAction,
diff --git a/packages/paperclip-runner/src/protocol-actions/reassign-task.ts b/packages/paperclip-runner/src/protocol-actions/reassign-task.ts
index a37ece7af5c..f7ff4342bb1 100644
--- a/packages/paperclip-runner/src/protocol-actions/reassign-task.ts
+++ b/packages/paperclip-runner/src/protocol-actions/reassign-task.ts
@@ -97,11 +97,12 @@ export const reassignTaskAction = {
"minLength": 1,
"description": "Existing task ID from search_tasks."
},
+ "assigneeUserId": { "type": ["string", "null"], "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId." },
"assigneeActorId": {
- "type": "string",
- "minLength": 1,
- "description": "New company agent ID from list_agents."
+ "type": ["string", "null"],
+ "description": "New company agent ID from list_agents; null when assigning a person."
},
+ "expectedAssigneeUserId": { "type": ["string", "null"], "description": "Current assigneeUserId from search_tasks; omit only when there is no person assigned." },
"expectedAssigneeActorId": {
"type": [
"string",
@@ -197,11 +198,12 @@ export const reassignTaskAction = {
"minLength": 1,
"description": "Existing task ID from search_tasks."
},
+ "assigneeUserId": { "type": ["string", "null"], "description": "Company person ID from list_people. Mutually exclusive with assigneeActorId." },
"assigneeActorId": {
- "type": "string",
- "minLength": 1,
- "description": "New company agent ID from list_agents."
+ "type": ["string", "null"],
+ "description": "New company agent ID from list_agents; null when assigning a person."
},
+ "expectedAssigneeUserId": { "type": ["string", "null"], "description": "Current assigneeUserId from search_tasks; omit only when there is no person assigned." },
"expectedAssigneeActorId": {
"type": [
"string",
diff --git a/packages/paperclip-runner/src/protocol-actions/set-task-monitor.ts b/packages/paperclip-runner/src/protocol-actions/set-task-monitor.ts
new file mode 100644
index 00000000000..a62dcb97227
--- /dev/null
+++ b/packages/paperclip-runner/src/protocol-actions/set-task-monitor.ts
@@ -0,0 +1,55 @@
+/** Production monitor tool; timers and wake delivery belong to Paperclip. */
+const description = "Schedule, replace, or clear a one-shot task monitor. Omit taskId for your current task; other tasks must also be assigned to you and in progress or review. Supply a future nextCheckAt and notes describing the next check, or monitor: null to clear. A successful receipt reports the persisted monitor; a replay reports its current state without re-arming it. After scheduling your current task, end the turn with paperclip_finish: yielded and continuation.kind monitor. Paperclip will wake you with issue_monitor_due; do not sleep, poll, mark done, or use call_api for this wait.";
+
+export const setTaskMonitorInputSchema = {
+ type: "object",
+ additionalProperties: false,
+ required: ["idempotencyKey", "monitor"],
+ properties: {
+ taskId: { type: "string", description: "Owned task UUID. Omit for the active task." },
+ idempotencyKey: { type: "string", minLength: 1, maxLength: 240, description: "Reuse with identical arguments on retries." },
+ monitor: {
+ type: ["object", "null"],
+ additionalProperties: false,
+ required: ["nextCheckAt", "notes"],
+ properties: {
+ nextCheckAt: { type: "string", description: "Future UTC timestamp for the next check. This is one shot, not a recurring interval." },
+ notes: { type: "string", minLength: 1, maxLength: 500, description: "What to check on the next run; do not include secrets." },
+ kind: { type: ["string", "null"], enum: ["external_service", null] },
+ serviceName: { type: ["string", "null"], minLength: 1, maxLength: 120 },
+ externalRef: { type: ["string", "null"], minLength: 1, maxLength: 500 },
+ timeoutAt: { type: ["string", "null"], description: "Optional deadline later than nextCheckAt." },
+ maxAttempts: { type: ["integer", "null"], minimum: 1, maximum: 100, description: "Optional cumulative attempt limit for this task's monitor." },
+ recoveryPolicy: { type: ["string", "null"], enum: ["wake_owner", "create_recovery_issue", "escalate_to_board", null] },
+ },
+ },
+ },
+} as const;
+
+export const setTaskMonitorAction = {
+ id: "set_task_monitor",
+ canonical: {
+ operationId: "set_task_monitor", surfaces: ["live"], placement: "optional_agent_tool",
+ optionalGroup: "wake_scheduling", requiredClaims: [], taskModes: ["standard"],
+ sideEffectClass: "task_write", idempotency: "required", disabledByDefault: false,
+ realBindingStatus: "live_codex", realServiceBinding: "prepareIssueMonitorUpdate",
+ prpEvidence: "Transactional persisted issue monitor, audit activity and idempotent run receipt.",
+ prpBindingStatus: "bound", legacyAliases: [],
+ },
+ documentation: { title: "Set task monitor", description, note: null },
+ examples: {
+ call: { operationId: "set_task_monitor", input: { idempotencyKey: "check-ci", monitor: { nextCheckAt: "2030-01-01T12:00:00Z", notes: "Check the pending CI run." } } },
+ scenarioCall: null,
+ success: { ok: true, operationId: "set_task_monitor", result: { taskId: "task-1", status: "in_progress", monitor: { nextCheckAt: "2030-01-01T12:00:00Z", status: "scheduled" }, replayed: false } },
+ },
+ live: {
+ order: 51,
+ descriptor: {
+ schema: "paperclip.semantic-tool.v1", operationId: "set_task_monitor", version: 1,
+ title: "Set task monitor", description, exposure: "optional", requiredClaims: [],
+ allowedModes: ["standard"], inputSchema: setTaskMonitorInputSchema,
+ outputSchema: { type: "object", additionalProperties: true },
+ },
+ },
+ scenario: null,
+} as const;
diff --git a/packages/paperclip-runner/src/protocol/generated/schema-bundle.ts b/packages/paperclip-runner/src/protocol/generated/schema-bundle.ts
index ce6fd633067..9d9efa46acf 100644
--- a/packages/paperclip-runner/src/protocol/generated/schema-bundle.ts
+++ b/packages/paperclip-runner/src/protocol/generated/schema-bundle.ts
@@ -317,6 +317,90 @@ export const capabilitiesV2Schema = {
"additionalProperties": true
} as const;
+export const capabilitiesV3Schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/capabilities.schema.json",
+ "title": "PRP v3 negotiated capabilities",
+ "type": "object",
+ "required": [
+ "schema",
+ "sessionReusePolicy",
+ "driver",
+ "steer",
+ "interrupt",
+ "resume",
+ "runtimeRequests",
+ "structuredResult",
+ "typedEvents",
+ "sessionGoals"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.capabilities.v3"
+ },
+ "sessionReusePolicy": {
+ "enum": [
+ "new_per_run",
+ "reuse_per_issue",
+ "reuse_per_workspace"
+ ]
+ },
+ "driver": {
+ "type": "object",
+ "required": [
+ "kind",
+ "version"
+ ],
+ "properties": {
+ "kind": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 80
+ },
+ "version": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 80
+ }
+ },
+ "additionalProperties": true
+ },
+ "steer": {
+ "type": "boolean"
+ },
+ "interrupt": {
+ "type": "boolean"
+ },
+ "resume": {
+ "type": "boolean"
+ },
+ "runtimeRequests": {
+ "type": "boolean"
+ },
+ "structuredResult": {
+ "type": "boolean"
+ },
+ "typedEvents": {
+ "type": "boolean"
+ },
+ "sessionGoals": {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"
+ },
+ "unsupported": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "minLength": 1
+ },
+ "uniqueItems": true
+ },
+ "externalProvider": {
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": true
+} as const;
+
export const commandSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v1/command.schema.json",
@@ -552,6 +636,393 @@ export const commandV2Schema = {
"additionalProperties": true
} as const;
+export const commandV3Schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/command.schema.json",
+ "title": "PRP v3 runner command",
+ "type": "object",
+ "required": [
+ "schema",
+ "commandId",
+ "controllerSeq",
+ "type",
+ "issuedAt",
+ "payload"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.command.v3"
+ },
+ "commandId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "controllerSeq": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "type": {
+ "enum": [
+ "run.prepare",
+ "run.attach",
+ "session.open",
+ "turn.start",
+ "turn.steer",
+ "turn.interrupt",
+ "turn.stop",
+ "request.resolve",
+ "interaction.receipt",
+ "semantic_tool.result",
+ "session.snapshot",
+ "session.close",
+ "session.budget.increase",
+ "session.destroy",
+ "run.cancel",
+ "runner.drain",
+ "runner.suspend",
+ "runner.shutdown",
+ "session.goal.get",
+ "session.goal.set",
+ "session.goal.clear",
+ "external_provider.operation"
+ ]
+ },
+ "issuedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "deadlineAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "precondition": {
+ "type": "object",
+ "properties": {
+ "runnerState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "runState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "sessionState": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "activeTurnId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ },
+ "additionalProperties": true
+ },
+ "payload": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "session.goal.set"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "objective": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 4000
+ },
+ "status": {
+ "enum": [
+ "active",
+ "paused"
+ ]
+ },
+ "tokenBudget": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "minimum": 1
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "requestId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision",
+ "digest",
+ "action",
+ "input"
+ ],
+ "properties": {
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "digest": {
+ "type": "string",
+ "pattern": "^sha256:[0-9a-f]{64}$"
+ },
+ "action": {
+ "enum": [
+ "accept",
+ "tool",
+ "progress",
+ "finish"
+ ]
+ },
+ "input": {
+ "type": "object"
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "accept"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {},
+ "required": [],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "tool"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "arguments": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "name",
+ "arguments"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "progress"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "text": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 12000
+ }
+ },
+ "required": [
+ "text"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "type": {
+ "const": "external_provider.operation"
+ },
+ "payload": {
+ "properties": {
+ "action": {
+ "const": "finish"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "result"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ }
+ ],
+ "additionalProperties": true
+} as const;
+
export const providerDescriptorSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json",
@@ -571,7 +1042,8 @@ export const providerDescriptorSchema = {
"opencode",
"claude_managed",
"aws_agentcore",
- "acpx"
+ "acpx",
+ "openai_dot"
]
},
"driver": {
@@ -580,7 +1052,8 @@ export const providerDescriptorSchema = {
"opencode_server",
"claude_managed_agents_api",
"aws_agentcore_harness_api",
- "acpx_runtime"
+ "acpx_runtime",
+ "openai_dot_mcp"
]
},
"model": {
@@ -604,7 +1077,8 @@ export const providerDescriptorSchema = {
"service": {
"enum": [
"anthropic_managed_agents",
- "aws_bedrock_agentcore_harness"
+ "aws_bedrock_agentcore_harness",
+ "openai_dot"
]
},
"providerSessionId": {
@@ -694,6 +1168,9 @@ export const providerDescriptorSchema = {
],
"maxLength": 240
},
+ "turnControls": {
+ "$ref": "#/$defs/turnControls"
+ },
"piThinkingLevel": {
"enum": [
"off",
@@ -701,9 +1178,6 @@ export const providerDescriptorSchema = {
"high",
"max"
]
- },
- "turnControls": {
- "$ref": "#/$defs/turnControls"
}
},
"allOf": [
@@ -793,6 +1267,19 @@ export const providerDescriptorSchema = {
"const": "local_process"
}
}
+ },
+ {
+ "properties": {
+ "provider": {
+ "const": "openai_dot"
+ },
+ "driver": {
+ "const": "openai_dot_mcp"
+ },
+ "executionKind": {
+ "const": "remote_service"
+ }
+ }
}
]
},
@@ -899,6 +1386,38 @@ export const providerDescriptorSchema = {
"agentProcessId"
]
}
+ },
+ {
+ "if": {
+ "properties": {
+ "provider": {
+ "const": "openai_dot"
+ }
+ },
+ "required": [
+ "provider"
+ ]
+ },
+ "then": {
+ "required": [
+ "service",
+ "providerSessionId"
+ ],
+ "properties": {
+ "service": {
+ "const": "openai_dot"
+ },
+ "model": {
+ "const": null
+ },
+ "providerSessionId": {
+ "const": null
+ },
+ "agentProcessId": {
+ "const": null
+ }
+ }
+ }
}
],
"$defs": {
@@ -4692,6 +5211,579 @@ export const eventV2Schema = {
"additionalProperties": true
} as const;
+export const eventV3Schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "$id": "https://paperclip.dev/schemas/prp/v3/event.schema.json",
+ "title": "PRP v3 native event",
+ "type": "object",
+ "required": [
+ "schema",
+ "sourceEventId",
+ "sourceSeq",
+ "sourceInstanceId",
+ "sourceKind",
+ "runId",
+ "eventType",
+ "schemaVersion",
+ "priority",
+ "emittedAt",
+ "payload"
+ ],
+ "properties": {
+ "schema": {
+ "const": "paperclip.prp.event.v3"
+ },
+ "sourceEventId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "sourceSeq": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 9007199254740991
+ },
+ "sourceInstanceId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "sourceKind": {
+ "enum": [
+ "runner",
+ "control_plane"
+ ]
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "itemId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160
+ },
+ "eventType": {
+ "enum": [
+ "runner.connected",
+ "runner.reconnected",
+ "runner.reconciled",
+ "runner.disconnected",
+ "runner.draining",
+ "runner.suspending",
+ "runner.suspended",
+ "runner.stopped",
+ "runner.diagnostic",
+ "runtime.phase.changed",
+ "sandbox.metric",
+ "workspace.ready",
+ "workspace.change.updated",
+ "workspace.diff.recorded",
+ "workspace.file.referenced",
+ "harness.starting",
+ "harness.ready",
+ "harness.exited",
+ "harness.diagnostic",
+ "plan.updated",
+ "tool.execution.started",
+ "tool.execution.progressed",
+ "tool.execution.completed",
+ "research.started",
+ "research.progressed",
+ "research.completed",
+ "delegation.started",
+ "delegation.updated",
+ "delegation.completed",
+ "model.route.changed",
+ "model.verification.updated",
+ "context.compacted",
+ "artifact.viewed",
+ "artifact.generated",
+ "review.mode.changed",
+ "hook.started",
+ "hook.completed",
+ "memory.citation.referenced",
+ "safety.review.started",
+ "safety.review.completed",
+ "terminal.input.sent",
+ "wait.started",
+ "wait.completed",
+ "provider.notice.recorded",
+ "session.starting",
+ "session.started",
+ "session.resuming",
+ "session.resumed",
+ "session.reconciled",
+ "session.updated",
+ "session.closed",
+ "session.failed",
+ "session.capabilities.updated",
+ "session.goal.snapshot",
+ "session.goal.updated",
+ "session.goal.cleared",
+ "turn.submitted",
+ "turn.accepted",
+ "turn.started",
+ "turn.completed",
+ "turn.failed",
+ "turn.interrupted",
+ "turn.cancelled",
+ "item.started",
+ "item.delta",
+ "item.completed",
+ "item.failed",
+ "usage.reported",
+ "semantic_tool.input",
+ "semantic_tool.result",
+ "mcp_app.discovered",
+ "mcp_app.resource.resolved",
+ "mcp_app.initializing",
+ "mcp_app.ready",
+ "mcp_app.tool_input",
+ "mcp_app.tool_result",
+ "mcp_app.action.requested",
+ "mcp_app.action.resolved",
+ "mcp_app.host_context.changed",
+ "mcp_app.failed",
+ "mcp_app.teardown",
+ "runtime_request.created",
+ "runtime_request.resolved",
+ "runtime_request.expired",
+ "runtime_request.cancelled",
+ "interaction.request.proposed",
+ "interaction.request.materialized",
+ "interaction.request.rejected",
+ "interaction.response.progressed",
+ "interaction.response.resolved",
+ "interaction.response.delivered",
+ "run.attached",
+ "run.detached",
+ "run.result.proposed",
+ "run.result.accepted",
+ "run.result.rejected",
+ "attention.request.proposed",
+ "attention.request.routed",
+ "attention.request.resolved",
+ "attention.request.expired",
+ "attention.request.superseded",
+ "work.assessment.recorded",
+ "issue.status.decision.recorded",
+ "issue.status.decision.applied",
+ "issue.status.decision.rejected",
+ "issue.status.decision.superseded",
+ "run.terminal",
+ "external_provider.dispatch_requested",
+ "external_provider.operation_settled"
+ ]
+ },
+ "schemaVersion": {
+ "const": 3
+ },
+ "priority": {
+ "enum": [
+ 0,
+ 1,
+ 2
+ ]
+ },
+ "emittedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "observedAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "payload": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "debug": {
+ "type": "object",
+ "additionalProperties": true
+ }
+ },
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "enum": [
+ "session.goal.snapshot",
+ "session.goal.updated"
+ ]
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "goal"
+ ],
+ "properties": {
+ "goal": {
+ "oneOf": [
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "session.capabilities.updated"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "required": [
+ "sessionGoals"
+ ],
+ "properties": {
+ "sessionGoals": {
+ "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"
+ },
+ "turnControls": {
+ "$ref": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"
+ }
+ },
+ "additionalProperties": true
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "external_provider.dispatch_requested"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "oneOf": [
+ {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "text": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 1048576
+ },
+ "instructions": {
+ "type": "string",
+ "maxLength": 1048576
+ },
+ "acceptByUnixMs": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "expiresAtUnixMs": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "completionContract": {
+ "type": "object",
+ "properties": {
+ "revision": {
+ "type": "string",
+ "minLength": 1
+ },
+ "criterionIds": {
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 256,
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "minLength": 1
+ }
+ }
+ },
+ "required": [
+ "revision",
+ "criterionIds"
+ ],
+ "additionalProperties": false
+ },
+ "tools": {
+ "type": "array",
+ "items": {
+ "type": "object"
+ },
+ "maxItems": 512
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "binding",
+ "text",
+ "instructions",
+ "acceptByUnixMs",
+ "expiresAtUnixMs",
+ "completionContract",
+ "tools"
+ ]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "kind": {
+ "const": "authority_revoked"
+ },
+ "reason": {
+ "type": "string"
+ },
+ "externalStopConfirmed": {
+ "const": false
+ }
+ },
+ "required": [
+ "binding",
+ "kind",
+ "externalStopConfirmed"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "type": "object"
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "eventType": {
+ "const": "external_provider.operation_settled"
+ }
+ },
+ "type": "object"
+ },
+ "then": {
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "binding": {
+ "type": "object",
+ "properties": {
+ "companyId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "agentId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "runId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "normalizedSessionId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "bindingGeneration": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "assignmentRevision": {
+ "type": "integer",
+ "minimum": 1
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "companyId",
+ "agentId",
+ "bindingId",
+ "runId",
+ "normalizedSessionId",
+ "turnId",
+ "bindingGeneration",
+ "assignmentRevision"
+ ]
+ },
+ "requestId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240
+ },
+ "outcome": {
+ "type": "object"
+ }
+ },
+ "required": [
+ "binding",
+ "requestId",
+ "outcome"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "type": "object"
+ }
+ }
+ ],
+ "additionalProperties": true
+} as const;
+
export const sessionGoalSchema = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json",
@@ -4882,7 +5974,8 @@ export const fixtureSchema = {
"protocolVersion": {
"enum": [
1,
- 2
+ 2,
+ 3
]
},
"name": {
@@ -4905,6 +5998,9 @@ export const fixtureSchema = {
},
{
"$ref": "https://paperclip.dev/schemas/prp/v2/capabilities.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/capabilities.schema.json"
}
]
},
@@ -4917,6 +6013,9 @@ export const fixtureSchema = {
},
{
"$ref": "https://paperclip.dev/schemas/prp/v2/command.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/command.schema.json"
}
]
}
@@ -4931,6 +6030,9 @@ export const fixtureSchema = {
},
{
"$ref": "https://paperclip.dev/schemas/prp/v2/event.schema.json"
+ },
+ {
+ "$ref": "https://paperclip.dev/schemas/prp/v3/event.schema.json"
}
]
}
@@ -4952,8 +6054,10 @@ export const prpSchemaBundle = {
"identity": identitySchema,
"capabilities": capabilitiesSchema,
"capabilities-v2": capabilitiesV2Schema,
+ "capabilities-v3": capabilitiesV3Schema,
"command": commandSchema,
"command-v2": commandV2Schema,
+ "command-v3": commandV3Schema,
"provider-descriptor": providerDescriptorSchema,
"provider-event": providerEventSchema,
"workspace-diff": workspaceDiffSchema,
@@ -4969,6 +6073,7 @@ export const prpSchemaBundle = {
"result": resultSchema,
"event": eventSchema,
"event-v2": eventV2Schema,
+ "event-v3": eventV3Schema,
"session-goal": sessionGoalSchema,
"fixture": fixtureSchema,
} as const;
diff --git a/packages/paperclip-runner/src/protocol/generated/standalone-validators.ts b/packages/paperclip-runner/src/protocol/generated/standalone-validators.ts
index 076e073af65..45bd5bdf832 100644
--- a/packages/paperclip-runner/src/protocol/generated/standalone-validators.ts
+++ b/packages/paperclip-runner/src/protocol/generated/standalone-validators.ts
@@ -4,4 +4,4 @@
import equalModule from "ajv/dist/runtime/equal.js";
import ucs2LengthModule from "ajv/dist/runtime/ucs2length.js";
-"use strict";export const fixtureValidator: unknown = validate20;const schema31 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/fixture.schema.json","title":"PRP scripted replay fixture","type":"object","required":["schema","fixtureVersion","protocolVersion","name","description","identity","capabilities","commands","events","result"],"properties":{"schema":{"const":"paperclip.prp.fixture.v1"},"fixtureVersion":{"const":1},"protocolVersion":{"enum":[1,2]},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":1000},"identity":{"$ref":"https://paperclip.dev/schemas/prp/v1/identity.schema.json"},"capabilities":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json"},{"$ref":"https://paperclip.dev/schemas/prp/v2/capabilities.schema.json"}]},"commands":{"type":"array","items":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/command.schema.json"},{"$ref":"https://paperclip.dev/schemas/prp/v2/command.schema.json"}]}},"events":{"type":"array","minItems":1,"items":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/event.schema.json"},{"$ref":"https://paperclip.dev/schemas/prp/v2/event.schema.json"}]}},"requests":{"type":"array","items":{"$ref":"https://paperclip.dev/schemas/prp/v1/request.schema.json"}},"result":{"$ref":"https://paperclip.dev/schemas/prp/v1/result.schema.json"}},"additionalProperties":true};const schema41 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json","title":"PRP negotiated capabilities","type":"object","required":["schema","sessionReusePolicy","driver","steer","interrupt","resume","runtimeRequests","structuredResult","typedEvents"],"properties":{"schema":{"const":"paperclip.prp.capabilities.v1"},"sessionReusePolicy":{"enum":["new_per_run","reuse_per_issue","reuse_per_workspace"]},"driver":{"type":"object","required":["kind","version"],"properties":{"kind":{"type":"string","minLength":1,"maxLength":80},"version":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":true},"steer":{"type":"boolean"},"interrupt":{"type":"boolean"},"resume":{"type":"boolean"},"runtimeRequests":{"type":"boolean"},"structuredResult":{"type":"boolean"},"typedEvents":{"type":"boolean"},"typedEventFamilies":{"type":"array","maxItems":64,"items":{"type":"object","required":["family","version","availability","detailLevel"],"properties":{"family":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.-]*$"},"version":{"const":1},"availability":{"enum":["available","unsupported","policy_disabled"]},"detailLevel":{"enum":["summary","structured"]}},"additionalProperties":false}},"semanticTools":{"type":"object","required":["schema","schemaVersion","operations"],"properties":{"schema":{"const":"paperclip.prp.semantic_tools.v1"},"schemaVersion":{"const":1},"operations":{"type":"array","items":{"type":"object","required":["operationId","version","availability","redactionDisposition"],"properties":{"operationId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"version":{"const":1},"availability":{"enum":["available","denied","unsupported"]},"redactionDisposition":{"const":"digest_only"},"requiredClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":160},"uniqueItems":true},"reasonCode":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"}},"additionalProperties":true}}},"additionalProperties":true},"unsupported":{"type":"array","items":{"type":"string","minLength":1},"uniqueItems":true}},"additionalProperties":true};const schema45 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/command.schema.json","title":"PRP runner command","type":"object","required":["schema","commandId","controllerSeq","type","issuedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.command.v1"},"commandId":{"type":"string","minLength":1,"maxLength":160},"controllerSeq":{"type":"integer","minimum":1},"type":{"enum":["run.prepare","run.attach","session.open","turn.start","turn.steer","turn.interrupt","turn.stop","request.resolve","interaction.receipt","semantic_tool.result","session.snapshot","session.close","session.budget.increase","session.destroy","run.cancel","runner.drain","runner.suspend","runner.shutdown"]},"issuedAt":{"type":"string","format":"date-time"},"deadlineAt":{"type":"string","format":"date-time"},"precondition":{"type":"object","properties":{"runnerState":{"type":"array","items":{"type":"string"}},"runState":{"type":"array","items":{"type":"string"}},"sessionState":{"type":"array","items":{"type":"string"}},"activeTurnId":{"type":["string","null"]}},"additionalProperties":true},"payload":{"type":"object","additionalProperties":true}},"additionalProperties":true};const schema46 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v2/command.schema.json","title":"PRP v2 runner command","type":"object","required":["schema","commandId","controllerSeq","type","issuedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.command.v2"},"commandId":{"type":"string","minLength":1,"maxLength":160},"controllerSeq":{"type":"integer","minimum":1},"type":{"enum":["run.prepare","run.attach","session.open","turn.start","turn.steer","turn.interrupt","turn.stop","request.resolve","interaction.receipt","semantic_tool.result","session.snapshot","session.close","session.budget.increase","session.destroy","run.cancel","runner.drain","runner.suspend","runner.shutdown","session.goal.get","session.goal.set","session.goal.clear"]},"issuedAt":{"type":"string","format":"date-time"},"deadlineAt":{"type":"string","format":"date-time"},"precondition":{"type":"object","properties":{"runnerState":{"type":"array","items":{"type":"string"}},"runState":{"type":"array","items":{"type":"string"}},"sessionState":{"type":"array","items":{"type":"string"}},"activeTurnId":{"type":["string","null"]}},"additionalProperties":true},"payload":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"type":{"const":"session.goal.set"}}},"then":{"properties":{"payload":{"type":"object","properties":{"requestId":{"type":"string","minLength":1,"maxLength":160},"objective":{"type":"string","minLength":1,"maxLength":4000},"status":{"enum":["active","paused"]},"tokenBudget":{"type":["integer","null"],"minimum":1}},"additionalProperties":true}}}}],"additionalProperties":true};const schema199 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/result.schema.json","title":"PRP structured run result","type":"object","required":["schema","reportedWorkDisposition","summary","completionClaim","evidence","verification","attentionRequests","artifacts"],"properties":{"schema":{"const":"paperclip.run_result.v1"},"reportedWorkDisposition":{"enum":["done","blocked","needs_review","yielded"]},"summary":{"type":"string","minLength":1,"maxLength":12000},"completionClaim":{"type":"object","required":["contractRevision","objectiveSatisfied","criteria","remainingWork"],"properties":{"contractRevision":{"type":"string","minLength":1},"objectiveSatisfied":{"type":"boolean"},"criteria":{"type":"array","items":{"type":"object","required":["criterionId","status","evidenceRefs"],"properties":{"criterionId":{"type":"string","minLength":1},"status":{"enum":["satisfied","not_satisfied","unknown"]},"evidenceRefs":{"type":"array","items":{"type":"string"}},"explanation":{"type":"string"}},"additionalProperties":true}},"remainingWork":{"type":"array","items":{"type":"object","required":["description","blocksCompletion"],"properties":{"description":{"type":"string","minLength":1},"blocksCompletion":{"type":"boolean"}},"additionalProperties":true}}},"additionalProperties":true},"evidence":{"type":"array","items":{"type":"object"}},"verification":{"type":"array","description":"Checks used to verify the work. Use failed only when the check actually ran and found a defect in the work. If a check could not run or complete because the environment, tool, dependency, permission, credential, policy, external service, or budget was unavailable, use not_run with reasonCode even when the attempted command exited non-zero.","items":{"type":"object","required":["commandOrCheck","status"],"properties":{"commandOrCheck":{"type":"string","minLength":1},"status":{"enum":["passed","failed","not_run"],"description":"passed means the check ran and succeeded; failed means it ran to a meaningful verdict and found the work incorrect; not_run means no meaningful verdict was possible because the check was not attempted or could not complete."},"reasonCode":{"description":"Required for not_run; identify why the check had no meaningful verdict.","enum":["environment_unavailable","tool_unavailable","dependency_missing","permission_denied","credential_missing","policy_restricted","external_service_unavailable","budget_exhausted","other"]},"detail":{"type":"string"},"artifactRef":{"type":"string"}},"additionalProperties":true}},"blocker":{"type":"object","required":["reasonCode","owner","unblockAction","scope"],"properties":{"reasonCode":{"type":"string","minLength":1},"owner":{"type":"object","required":["kind","name"],"properties":{"kind":{"enum":["agent","user","system","external"]},"name":{"type":"string","minLength":1}},"additionalProperties":true},"unblockAction":{"type":"string","minLength":1},"scope":{"enum":["current_track","task_wide"]}},"additionalProperties":true},"attentionRequests":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","minLength":1},"summary":{"type":"string","minLength":1},"ownerClass":{"enum":["human","agent","external_system"]},"targetAgentId":{"type":"string","minLength":1}},"additionalProperties":true}},"artifacts":{"type":"array","items":{"type":"object","required":["kind","ref"],"properties":{"kind":{"type":"string","minLength":1},"ref":{"type":"string","minLength":1},"title":{"type":"string"}},"additionalProperties":true}},"continuation":{"type":"object","required":["kind","summary","idempotencyKey"],"properties":{"kind":{"enum":["same_agent","retry","delegated_issue","response_wake","monitor"]},"summary":{"type":"string","minLength":1},"idempotencyKey":{"type":"string","minLength":1}},"additionalProperties":true}},"allOf":[{"if":{"properties":{"reportedWorkDisposition":{"const":"blocked"}}},"then":{"required":["blocker"]}},{"if":{"properties":{"reportedWorkDisposition":{"const":"yielded"}}},"then":{"required":["continuation"]}}],"additionalProperties":true};const func1 = typeof ucs2LengthModule === "function" ? ucs2LengthModule : ucs2LengthModule.default;const schema32 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/identity.schema.json","title":"PRP identity graph","type":"object","required":["schema","companyId","issueId","runId","environmentLeaseId","runnerInstanceId","normalizedSessionId","driverSessionId"],"properties":{"schema":{"const":"paperclip.prp.identity.v1"},"companyId":{"$ref":"#/$defs/stableId"},"issueId":{"$ref":"#/$defs/stableId"},"runId":{"$ref":"#/$defs/stableId"},"environmentLeaseId":{"$ref":"#/$defs/stableId"},"runnerInstanceId":{"$ref":"#/$defs/stableId"},"normalizedSessionId":{"$ref":"#/$defs/stableId"},"driverSessionId":{"$ref":"#/$defs/stableId"},"providerSessionId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true,"$defs":{"stableId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"}}};const schema33 = {"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};const pattern4 = new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]*$", "u");function validate21(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/identity.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate21.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.companyId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "companyId"},message:"must have required property '"+"companyId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.issueId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "issueId"},message:"must have required property '"+"issueId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.runId === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.environmentLeaseId === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "environmentLeaseId"},message:"must have required property '"+"environmentLeaseId"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.runnerInstanceId === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runnerInstanceId"},message:"must have required property '"+"runnerInstanceId"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.normalizedSessionId === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.driverSessionId === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "driverSessionId"},message:"must have required property '"+"driverSessionId"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.schema !== undefined){if("paperclip.prp.identity.v1" !== data.schema){const err8 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.identity.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.companyId !== undefined){let data1 = data.companyId;if(typeof data1 === "string"){if(func1(data1) > 160){const err9 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.issueId !== undefined){let data2 = data.issueId;if(typeof data2 === "string"){if(func1(data2) > 160){const err13 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data2) < 1){const err14 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data2)){const err15 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.runId !== undefined){let data3 = data.runId;if(typeof data3 === "string"){if(func1(data3) > 160){const err17 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data3) < 1){const err18 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(!pattern4.test(data3)){const err19 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}else {const err20 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.environmentLeaseId !== undefined){let data4 = data.environmentLeaseId;if(typeof data4 === "string"){if(func1(data4) > 160){const err21 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data4) < 1){const err22 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data4)){const err23 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.runnerInstanceId !== undefined){let data5 = data.runnerInstanceId;if(typeof data5 === "string"){if(func1(data5) > 160){const err25 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(func1(data5) < 1){const err26 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(!pattern4.test(data5)){const err27 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}else {const err28 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data.normalizedSessionId !== undefined){let data6 = data.normalizedSessionId;if(typeof data6 === "string"){if(func1(data6) > 160){const err29 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(func1(data6) < 1){const err30 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(!pattern4.test(data6)){const err31 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}else {const err32 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}if(data.driverSessionId !== undefined){let data7 = data.driverSessionId;if(typeof data7 === "string"){if(func1(data7) > 160){const err33 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(func1(data7) < 1){const err34 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if(!pattern4.test(data7)){const err35 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}else {const err36 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.providerSessionId !== undefined){let data8 = data.providerSessionId;if(typeof data8 === "string"){if(func1(data8) > 160){const err37 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(func1(data8) < 1){const err38 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(!pattern4.test(data8)){const err39 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}}else {const err41 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}validate21.errors = vErrors;return errors === 0;}validate21.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema42 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v2/capabilities.schema.json","title":"PRP v2 negotiated capabilities","type":"object","required":["schema","sessionReusePolicy","driver","steer","interrupt","resume","runtimeRequests","structuredResult","typedEvents","sessionGoals"],"properties":{"schema":{"const":"paperclip.prp.capabilities.v2"},"sessionReusePolicy":{"enum":["new_per_run","reuse_per_issue","reuse_per_workspace"]},"driver":{"type":"object","required":["kind","version"],"properties":{"kind":{"type":"string","minLength":1,"maxLength":80},"version":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":true},"steer":{"type":"boolean"},"interrupt":{"type":"boolean"},"resume":{"type":"boolean"},"runtimeRequests":{"type":"boolean"},"structuredResult":{"type":"boolean"},"typedEvents":{"type":"boolean"},"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"unsupported":{"type":"array","items":{"type":"string","minLength":1},"uniqueItems":true}},"additionalProperties":true};const schema44 = {"type":"object","required":["availability","actions","autonomousUpdates","persistentAcrossResume","maxObjectiveChars","tokenBudgetControl","usageReporting"],"properties":{"availability":{"enum":["available","unsupported","policy_disabled"]},"actions":{"type":"array","items":{"enum":["set","pause","resume","clear"]},"uniqueItems":true},"autonomousUpdates":{"type":"boolean"},"persistentAcrossResume":{"type":"boolean"},"maxObjectiveChars":{"type":"integer","minimum":1,"maximum":4000},"tokenBudgetControl":{"type":"boolean"},"usageReporting":{"type":"boolean"},"reasonCode":{"type":"string","minLength":1,"maxLength":160},"reason":{"type":"string","minLength":1,"maxLength":1000}},"additionalProperties":true};const func0 = typeof equalModule === "function" ? equalModule : equalModule.default;function validate23(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v2/capabilities.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate23.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.sessionReusePolicy === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionReusePolicy"},message:"must have required property '"+"sessionReusePolicy"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.driver === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "driver"},message:"must have required property '"+"driver"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.steer === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steer"},message:"must have required property '"+"steer"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.interrupt === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "interrupt"},message:"must have required property '"+"interrupt"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.resume === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "resume"},message:"must have required property '"+"resume"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.runtimeRequests === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runtimeRequests"},message:"must have required property '"+"runtimeRequests"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.structuredResult === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "structuredResult"},message:"must have required property '"+"structuredResult"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.typedEvents === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "typedEvents"},message:"must have required property '"+"typedEvents"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.sessionGoals === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.schema !== undefined){if("paperclip.prp.capabilities.v2" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.capabilities.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.sessionReusePolicy !== undefined){let data1 = data.sessionReusePolicy;if(!(((data1 === "new_per_run") || (data1 === "reuse_per_issue")) || (data1 === "reuse_per_workspace"))){const err11 = {instancePath:instancePath+"/sessionReusePolicy",schemaPath:"#/properties/sessionReusePolicy/enum",keyword:"enum",params:{allowedValues: schema42.properties.sessionReusePolicy.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.driver !== undefined){let data2 = data.driver;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.kind === undefined){const err12 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.version === undefined){const err13 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data2.kind !== undefined){let data3 = data2.kind;if(typeof data3 === "string"){if(func1(data3) > 80){const err14 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data3) < 1){const err15 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.version !== undefined){let data4 = data2.version;if(typeof data4 === "string"){if(func1(data4) > 80){const err17 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data4) < 1){const err18 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}else {const err20 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.steer !== undefined){if(typeof data.steer !== "boolean"){const err21 = {instancePath:instancePath+"/steer",schemaPath:"#/properties/steer/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.interrupt !== undefined){if(typeof data.interrupt !== "boolean"){const err22 = {instancePath:instancePath+"/interrupt",schemaPath:"#/properties/interrupt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.resume !== undefined){if(typeof data.resume !== "boolean"){const err23 = {instancePath:instancePath+"/resume",schemaPath:"#/properties/resume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data.runtimeRequests !== undefined){if(typeof data.runtimeRequests !== "boolean"){const err24 = {instancePath:instancePath+"/runtimeRequests",schemaPath:"#/properties/runtimeRequests/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.structuredResult !== undefined){if(typeof data.structuredResult !== "boolean"){const err25 = {instancePath:instancePath+"/structuredResult",schemaPath:"#/properties/structuredResult/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.typedEvents !== undefined){if(typeof data.typedEvents !== "boolean"){const err26 = {instancePath:instancePath+"/typedEvents",schemaPath:"#/properties/typedEvents/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.sessionGoals !== undefined){let data11 = data.sessionGoals;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.availability === undefined){const err27 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data11.actions === undefined){const err28 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data11.autonomousUpdates === undefined){const err29 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data11.persistentAcrossResume === undefined){const err30 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data11.maxObjectiveChars === undefined){const err31 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(data11.tokenBudgetControl === undefined){const err32 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(data11.usageReporting === undefined){const err33 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data11.availability !== undefined){let data12 = data11.availability;if(!(((data12 === "available") || (data12 === "unsupported")) || (data12 === "policy_disabled"))){const err34 = {instancePath:instancePath+"/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data11.actions !== undefined){let data13 = data11.actions;if(Array.isArray(data13)){const len0 = data13.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data13[i1], data13[j0])){const err36 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;break outer0;}}}}}else {const err37 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data11.autonomousUpdates !== undefined){if(typeof data11.autonomousUpdates !== "boolean"){const err38 = {instancePath:instancePath+"/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data11.persistentAcrossResume !== undefined){if(typeof data11.persistentAcrossResume !== "boolean"){const err39 = {instancePath:instancePath+"/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data11.maxObjectiveChars !== undefined){let data17 = data11.maxObjectiveChars;if(!(((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17))) && (isFinite(data17)))){const err40 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if((typeof data17 == "number") && (isFinite(data17))){if(data17 > 4000 || isNaN(data17)){const err41 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data17 < 1 || isNaN(data17)){const err42 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}if(data11.tokenBudgetControl !== undefined){if(typeof data11.tokenBudgetControl !== "boolean"){const err43 = {instancePath:instancePath+"/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data11.usageReporting !== undefined){if(typeof data11.usageReporting !== "boolean"){const err44 = {instancePath:instancePath+"/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data11.reasonCode !== undefined){let data20 = data11.reasonCode;if(typeof data20 === "string"){if(func1(data20) > 160){const err45 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func1(data20) < 1){const err46 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data11.reason !== undefined){let data21 = data11.reason;if(typeof data21 === "string"){if(func1(data21) > 1000){const err48 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(func1(data21) < 1){const err49 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data.unsupported !== undefined){let data22 = data.unsupported;if(Array.isArray(data22)){const len1 = data22.length;for(let i2=0; i2 1){const indices0 = {};for(;i3--;){let item0 = data22[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];const err54 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;break;}indices0[item0] = i3;}}}else {const err55 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}validate23.errors = vErrors;return errors === 0;}validate23.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema47 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/event.schema.json","title":"PRP native event","type":"object","required":["schema","sourceEventId","sourceSeq","sourceInstanceId","sourceKind","runId","eventType","schemaVersion","priority","emittedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.event.v1"},"sourceEventId":{"type":"string","minLength":1,"maxLength":160},"sourceSeq":{"type":"integer","minimum":1,"maximum":9007199254740991},"sourceInstanceId":{"type":"string","minLength":1,"maxLength":160},"sourceKind":{"enum":["runner","control_plane"]},"runId":{"type":"string","minLength":1,"maxLength":160},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":160},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":"string","minLength":1,"maxLength":240},"eventType":{"enum":["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.backpressure","runner.suspending","runner.suspended","runner.stopped","runner.diagnostic","runtime.phase.changed","sandbox.metric","workspace.ready","workspace.change.updated","workspace.diff.recorded","workspace.file.referenced","harness.starting","harness.ready","harness.exited","harness.diagnostic","plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","session.failed","turn.submitted","turn.accepted","turn.started","turn.completed","turn.failed","turn.interrupted","turn.cancelled","item.started","item.delta","item.completed","item.failed","usage.reported","semantic_tool.input","semantic_tool.result","semantic_tool.reconciled","mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.tool_input","mcp_app.tool_result","mcp_app.action.requested","mcp_app.action.resolved","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown","runtime_request.created","runtime_request.resolved","runtime_request.expired","runtime_request.cancelled","interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered","run.attached","run.detached","run.result.proposed","run.result.accepted","run.result.rejected","attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded","run.terminal"]},"schemaVersion":{"const":1},"priority":{"enum":[0,1,2]},"emittedAt":{"type":"string","format":"date-time"},"observedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","properties":{"channel":{"enum":["progress","final","summary","detail","unknown"]},"providerPhase":{"type":"string"},"providerMethod":{"type":"string"}},"additionalProperties":true},"debug":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"eventType":{"const":"plan.updated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/plan"}}}},{"if":{"properties":{"eventType":{"enum":["tool.execution.started","tool.execution.progressed","tool.execution.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/toolExecution"}}}},{"if":{"properties":{"eventType":{"enum":["research.started","research.progressed","research.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/research"}}}},{"if":{"properties":{"eventType":{"enum":["delegation.started","delegation.updated","delegation.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/delegation"}}}},{"if":{"properties":{"eventType":{"const":"model.route.changed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelRoute"}}}},{"if":{"properties":{"eventType":{"const":"model.verification.updated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelVerification"}}}},{"if":{"properties":{"eventType":{"const":"context.compacted"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/contextCompacted"}}}},{"if":{"properties":{"eventType":{"const":"artifact.viewed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactViewed"}}}},{"if":{"properties":{"eventType":{"const":"artifact.generated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactGenerated"}}}},{"if":{"properties":{"eventType":{"const":"review.mode.changed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/reviewMode"}}}},{"if":{"properties":{"eventType":{"enum":["hook.started","hook.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/hook"}}}},{"if":{"properties":{"eventType":{"const":"memory.citation.referenced"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/memoryCitation"}}}},{"if":{"properties":{"eventType":{"enum":["safety.review.started","safety.review.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/safetyReview"}}}},{"if":{"properties":{"eventType":{"const":"terminal.input.sent"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/terminalInput"}}}},{"if":{"properties":{"eventType":{"enum":["wait.started","wait.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/wait"}}}},{"if":{"properties":{"eventType":{"const":"provider.notice.recorded"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/providerNotice"}}}},{"if":{"properties":{"eventType":{"const":"workspace.file.referenced"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json"}}}},{"if":{"properties":{"eventType":{"enum":["workspace.change.updated","workspace.diff.recorded"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"}}}},{"if":{"properties":{"eventType":{"const":"workspace.diff.recorded"}}},"then":{"properties":{"payload":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"},{"type":"object","properties":{"complete":{"const":true}}}]}}}},{"if":{"properties":{"eventType":{"enum":["semantic_tool.input","mcp_app.tool_input"]}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"input"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"enum":["semantic_tool.result","mcp_app.tool_result"]}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"result"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"semantic_tool.reconciled"}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"reconciled"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"run.terminal"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/terminal.schema.json"}}}},{"if":{"properties":{"eventType":{"const":"run.result.proposed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/result.schema.json"}}}}],"additionalProperties":true};const schema171 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json","title":"Paperclip workspace file reference","type":"object","required":["schema","referenceId","source","path","displayName","mediaType","presentation","line","preview","previewTruncated","contentDigest"],"properties":{"schema":{"const":"paperclip.workspace.file_reference.v1"},"referenceId":{"type":"string","minLength":1,"maxLength":240},"source":{"enum":["harness_reported","runner_verified"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},"displayName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":["string","null"],"maxLength":160},"presentation":{"enum":["document","code","image","generic"]},"line":{"type":["integer","null"],"minimum":1},"preview":{"type":["string","null"],"maxLength":262144},"previewTruncated":{"type":"boolean"},"contentDigest":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"}]}},"additionalProperties":false};const schema172 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json","title":"Paperclip workspace diff","type":"object","required":["schema","changeSetId","revision","source","complete","files","totals","patchArtifactRef"],"properties":{"schema":{"const":"paperclip.workspace.diff.v1"},"changeSetId":{"type":"string","minLength":1,"maxLength":200},"revision":{"type":"integer","minimum":1},"source":{"enum":["harness_reported","runner_verified"]},"complete":{"type":"boolean"},"files":{"type":"array","maxItems":2000,"items":{"type":"object","required":["path","operation","previousPath","additions","deletions","binary","diff"],"properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},"operation":{"enum":["create","modify","delete","rename","mode_change"]},"previousPath":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"}]},"additions":{"type":["integer","null"],"minimum":0},"deletions":{"type":["integer","null"],"minimum":0},"binary":{"type":"boolean"},"diff":{"type":["string","null"],"maxLength":262144}},"additionalProperties":false}},"totals":{"type":"object","required":["files","additions","deletions"],"properties":{"files":{"type":"integer","minimum":0},"additions":{"type":["integer","null"],"minimum":0},"deletions":{"type":["integer","null"],"minimum":0}},"additionalProperties":false},"patchArtifactRef":{"type":["string","null"],"maxLength":2048}},"additionalProperties":false};const schema49 = {"type":"object","description":"A complete provider-authored within-turn checklist snapshot. Consumers replace the prior snapshot with the same planId in PRP sourceSeq order; this is not Paperclip's durable Plan document.","required":["schema","planId","revision","steps","complete","syncStatus"],"properties":{"schema":{"const":"paperclip.plan.updated.v1"},"planId":{"$ref":"#/$defs/id"},"revision":{"type":"integer","minimum":1},"explanation":{"$ref":"#/$defs/nullableShortText"},"steps":{"type":"array","maxItems":256,"items":{"type":"object","required":["stepId","body","status"],"properties":{"stepId":{"$ref":"#/$defs/id"},"body":{"$ref":"#/$defs/shortText"},"status":{"enum":["pending","in_progress","completed","blocked"]}},"additionalProperties":false}},"complete":{"type":"boolean"},"syncStatus":{"description":"Legacy compatibility field. Within-turn checklist snapshots use not_applicable.","enum":["streaming","pending","synchronized","conflict","not_applicable"]},"documentRevision":{"description":"Legacy compatibility field. Within-turn checklist snapshots use null.","type":["integer","null"],"minimum":1}},"additionalProperties":false};const schema50 = {"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};const schema51 = {"type":["string","null"],"maxLength":4000};const schema53 = {"type":"string","maxLength":4000};function validate60(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate60.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.planId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "planId"},message:"must have required property '"+"planId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.revision === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.steps === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steps"},message:"must have required property '"+"steps"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.complete === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.syncStatus === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "syncStatus"},message:"must have required property '"+"syncStatus"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "planId")) || (key0 === "revision")) || (key0 === "explanation")) || (key0 === "steps")) || (key0 === "complete")) || (key0 === "syncStatus")) || (key0 === "documentRevision"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.plan.updated.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.plan.updated.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.planId !== undefined){let data1 = data.planId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.revision !== undefined){let data2 = data.revision;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){const err12 = {instancePath:instancePath+"/revision",schemaPath:"#/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if((typeof data2 == "number") && (isFinite(data2))){if(data2 < 1 || isNaN(data2)){const err13 = {instancePath:instancePath+"/revision",schemaPath:"#/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}if(data.explanation !== undefined){let data3 = data.explanation;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/explanation",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4000){const err15 = {instancePath:instancePath+"/explanation",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.steps !== undefined){let data4 = data.steps;if(Array.isArray(data4)){if(data4.length > 256){const err16 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/maxItems",keyword:"maxItems",params:{limit: 256},message:"must NOT have more than 256 items"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err21 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data5.body !== undefined){let data7 = data5.body;if(typeof data7 === "string"){if(func1(data7) > 4000){const err25 = {instancePath:instancePath+"/steps/" + i0+"/body",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/steps/" + i0+"/body",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data5.status !== undefined){let data8 = data5.status;if(!((((data8 === "pending") || (data8 === "in_progress")) || (data8 === "completed")) || (data8 === "blocked"))){const err27 = {instancePath:instancePath+"/steps/" + i0+"/status",schemaPath:"#/properties/steps/items/properties/status/enum",keyword:"enum",params:{allowedValues: schema49.properties.steps.items.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/steps/" + i0,schemaPath:"#/properties/steps/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}else {const err29 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.complete !== undefined){if(typeof data.complete !== "boolean"){const err30 = {instancePath:instancePath+"/complete",schemaPath:"#/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data.syncStatus !== undefined){let data10 = data.syncStatus;if(!(((((data10 === "streaming") || (data10 === "pending")) || (data10 === "synchronized")) || (data10 === "conflict")) || (data10 === "not_applicable"))){const err31 = {instancePath:instancePath+"/syncStatus",schemaPath:"#/properties/syncStatus/enum",keyword:"enum",params:{allowedValues: schema49.properties.syncStatus.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data.documentRevision !== undefined){let data11 = data.documentRevision;if((!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) && (data11 !== null)){const err32 = {instancePath:instancePath+"/documentRevision",schemaPath:"#/properties/documentRevision/type",keyword:"type",params:{type: schema49.properties.documentRevision.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if((typeof data11 == "number") && (isFinite(data11))){if(data11 < 1 || isNaN(data11)){const err33 = {instancePath:instancePath+"/documentRevision",schemaPath:"#/properties/documentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}}else {const err34 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}validate60.errors = vErrors;return errors === 0;}validate60.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema54 = {"type":"object","required":["schema","executionId","transport","operation","status","output","outputBytes","outputTruncated","outputDigest"],"properties":{"schema":{"const":"paperclip.tool.execution.v1"},"executionId":{"$ref":"#/$defs/id"},"transport":{"enum":["process","mcp","dynamic","builtin"]},"operation":{"enum":["read","search","list","execute","edit","unknown"]},"name":{"$ref":"#/$defs/nullableShortText"},"target":{"$ref":"#/$defs/safePath"},"namespace":{"type":["string","null"],"maxLength":240},"readOnly":{"type":["boolean","null"]},"inputUpdated":{"type":"boolean"},"status":{"enum":["running","completed","failed","cancelled","interrupted"]},"durationMs":{"type":["integer","null"],"minimum":0},"exitCode":{"type":["integer","null"]},"progress":{"$ref":"#/$defs/nullableShortText"},"output":{"type":["string","null"],"maxLength":65536},"outputBytes":{"type":"integer","minimum":0},"outputTruncated":{"type":"boolean"},"outputDigest":{"type":["string","null"],"pattern":"^sha256:[a-f0-9]{64}$"}},"additionalProperties":false};const schema57 = {"type":["string","null"],"maxLength":4096,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"};const func58 = Object.prototype.hasOwnProperty;const pattern18 = new RegExp("^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$", "u");const pattern19 = new RegExp("^sha256:[a-f0-9]{64}$", "u");function validate62(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate62.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.executionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "executionId"},message:"must have required property '"+"executionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.transport === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transport"},message:"must have required property '"+"transport"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.operation === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "operation"},message:"must have required property '"+"operation"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.status === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.output === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.outputBytes === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputBytes"},message:"must have required property '"+"outputBytes"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.outputTruncated === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputTruncated"},message:"must have required property '"+"outputTruncated"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.outputDigest === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputDigest"},message:"must have required property '"+"outputDigest"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key0 in data){if(!(func58.call(schema54.properties, key0))){const err9 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.schema !== undefined){if("paperclip.tool.execution.v1" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.tool.execution.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.executionId !== undefined){let data1 = data.executionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err11 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(func1(data1) < 1){const err12 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern4.test(data1)){const err13 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.transport !== undefined){let data2 = data.transport;if(!((((data2 === "process") || (data2 === "mcp")) || (data2 === "dynamic")) || (data2 === "builtin"))){const err15 = {instancePath:instancePath+"/transport",schemaPath:"#/properties/transport/enum",keyword:"enum",params:{allowedValues: schema54.properties.transport.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.operation !== undefined){let data3 = data.operation;if(!((((((data3 === "read") || (data3 === "search")) || (data3 === "list")) || (data3 === "execute")) || (data3 === "edit")) || (data3 === "unknown"))){const err16 = {instancePath:instancePath+"/operation",schemaPath:"#/properties/operation/enum",keyword:"enum",params:{allowedValues: schema54.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.name !== undefined){let data4 = data.name;if((typeof data4 !== "string") && (data4 !== null)){const err17 = {instancePath:instancePath+"/name",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err18 = {instancePath:instancePath+"/name",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data.target !== undefined){let data5 = data.target;if((typeof data5 !== "string") && (data5 !== null)){const err19 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema57.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4096){const err20 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(!pattern18.test(data5)){const err21 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}if(data.namespace !== undefined){let data6 = data.namespace;if((typeof data6 !== "string") && (data6 !== null)){const err22 = {instancePath:instancePath+"/namespace",schemaPath:"#/properties/namespace/type",keyword:"type",params:{type: schema54.properties.namespace.type},message:"must be string,null"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 240){const err23 = {instancePath:instancePath+"/namespace",schemaPath:"#/properties/namespace/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data.readOnly !== undefined){let data7 = data.readOnly;if((typeof data7 !== "boolean") && (data7 !== null)){const err24 = {instancePath:instancePath+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type: schema54.properties.readOnly.type},message:"must be boolean,null"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.inputUpdated !== undefined){if(typeof data.inputUpdated !== "boolean"){const err25 = {instancePath:instancePath+"/inputUpdated",schemaPath:"#/properties/inputUpdated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.status !== undefined){let data9 = data.status;if(!(((((data9 === "running") || (data9 === "completed")) || (data9 === "failed")) || (data9 === "cancelled")) || (data9 === "interrupted"))){const err26 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema54.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.durationMs !== undefined){let data10 = data.durationMs;if((!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))) && (data10 !== null)){const err27 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/type",keyword:"type",params:{type: schema54.properties.durationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if((typeof data10 == "number") && (isFinite(data10))){if(data10 < 0 || isNaN(data10)){const err28 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data.exitCode !== undefined){let data11 = data.exitCode;if((!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) && (data11 !== null)){const err29 = {instancePath:instancePath+"/exitCode",schemaPath:"#/properties/exitCode/type",keyword:"type",params:{type: schema54.properties.exitCode.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.progress !== undefined){let data12 = data.progress;if((typeof data12 !== "string") && (data12 !== null)){const err30 = {instancePath:instancePath+"/progress",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 4000){const err31 = {instancePath:instancePath+"/progress",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}if(data.output !== undefined){let data13 = data.output;if((typeof data13 !== "string") && (data13 !== null)){const err32 = {instancePath:instancePath+"/output",schemaPath:"#/properties/output/type",keyword:"type",params:{type: schema54.properties.output.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data13 === "string"){if(func1(data13) > 65536){const err33 = {instancePath:instancePath+"/output",schemaPath:"#/properties/output/maxLength",keyword:"maxLength",params:{limit: 65536},message:"must NOT have more than 65536 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}if(data.outputBytes !== undefined){let data14 = data.outputBytes;if(!(((typeof data14 == "number") && (!(data14 % 1) && !isNaN(data14))) && (isFinite(data14)))){const err34 = {instancePath:instancePath+"/outputBytes",schemaPath:"#/properties/outputBytes/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if((typeof data14 == "number") && (isFinite(data14))){if(data14 < 0 || isNaN(data14)){const err35 = {instancePath:instancePath+"/outputBytes",schemaPath:"#/properties/outputBytes/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}if(data.outputTruncated !== undefined){if(typeof data.outputTruncated !== "boolean"){const err36 = {instancePath:instancePath+"/outputTruncated",schemaPath:"#/properties/outputTruncated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.outputDigest !== undefined){let data16 = data.outputDigest;if((typeof data16 !== "string") && (data16 !== null)){const err37 = {instancePath:instancePath+"/outputDigest",schemaPath:"#/properties/outputDigest/type",keyword:"type",params:{type: schema54.properties.outputDigest.type},message:"must be string,null"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(typeof data16 === "string"){if(!pattern19.test(data16)){const err38 = {instancePath:instancePath+"/outputDigest",schemaPath:"#/properties/outputDigest/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}}}else {const err39 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}validate62.errors = vErrors;return errors === 0;}validate62.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema59 = {"type":"object","required":["schema","researchId","action","status","sources"],"properties":{"schema":{"const":"paperclip.research.v1"},"researchId":{"$ref":"#/$defs/id"},"action":{"enum":["search","open_page","find_in_page","other"]},"status":{"enum":["running","completed","failed","cancelled"]},"query":{"$ref":"#/$defs/nullableShortText"},"url":{"$ref":"#/$defs/safeUrl"},"pattern":{"$ref":"#/$defs/nullableShortText"},"sources":{"type":"array","maxItems":64,"items":{"type":"object","required":["sourceId","title","url","snippet"],"properties":{"sourceId":{"$ref":"#/$defs/id"},"title":{"$ref":"#/$defs/shortText"},"url":{"$ref":"#/$defs/safeUrl"},"snippet":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false}}},"additionalProperties":false};const schema62 = {"type":["string","null"],"maxLength":8192,"pattern":"^https?://"};const pattern21 = new RegExp("^https?://", "u");function validate64(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate64.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.researchId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "researchId"},message:"must have required property '"+"researchId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.action === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "action"},message:"must have required property '"+"action"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.sources === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sources"},message:"must have required property '"+"sources"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "researchId")) || (key0 === "action")) || (key0 === "status")) || (key0 === "query")) || (key0 === "url")) || (key0 === "pattern")) || (key0 === "sources"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.research.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.research.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.researchId !== undefined){let data1 = data.researchId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.action !== undefined){let data2 = data.action;if(!((((data2 === "search") || (data2 === "open_page")) || (data2 === "find_in_page")) || (data2 === "other"))){const err11 = {instancePath:instancePath+"/action",schemaPath:"#/properties/action/enum",keyword:"enum",params:{allowedValues: schema59.properties.action.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((data3 === "running") || (data3 === "completed")) || (data3 === "failed")) || (data3 === "cancelled"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema59.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.query !== undefined){let data4 = data.query;if((typeof data4 !== "string") && (data4 !== null)){const err13 = {instancePath:instancePath+"/query",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err14 = {instancePath:instancePath+"/query",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}if(data.url !== undefined){let data5 = data.url;if((typeof data5 !== "string") && (data5 !== null)){const err15 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/type",keyword:"type",params:{type: schema62.type},message:"must be string,null"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 8192){const err16 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(!pattern21.test(data5)){const err17 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}if(data.pattern !== undefined){let data6 = data.pattern;if((typeof data6 !== "string") && (data6 !== null)){const err18 = {instancePath:instancePath+"/pattern",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 4000){const err19 = {instancePath:instancePath+"/pattern",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}if(data.sources !== undefined){let data7 = data.sources;if(Array.isArray(data7)){if(data7.length > 64){const err20 = {instancePath:instancePath+"/sources",schemaPath:"#/properties/sources/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}const len0 = data7.length;for(let i0=0; i0 160){const err26 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(func1(data9) < 1){const err27 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(!pattern4.test(data9)){const err28 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data8.title !== undefined){let data10 = data8.title;if(typeof data10 === "string"){if(func1(data10) > 4000){const err30 = {instancePath:instancePath+"/sources/" + i0+"/title",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}else {const err31 = {instancePath:instancePath+"/sources/" + i0+"/title",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data8.url !== undefined){let data11 = data8.url;if((typeof data11 !== "string") && (data11 !== null)){const err32 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/type",keyword:"type",params:{type: schema62.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data11 === "string"){if(func1(data11) > 8192){const err33 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(!pattern21.test(data11)){const err34 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}if(data8.snippet !== undefined){let data12 = data8.snippet;if((typeof data12 !== "string") && (data12 !== null)){const err35 = {instancePath:instancePath+"/sources/" + i0+"/snippet",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 4000){const err36 = {instancePath:instancePath+"/sources/" + i0+"/snippet",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}}}else {const err37 = {instancePath:instancePath+"/sources/" + i0,schemaPath:"#/properties/sources/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}else {const err38 = {instancePath:instancePath+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}}else {const err39 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}validate64.errors = vErrors;return errors === 0;}validate64.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema68 = {"type":"object","required":["schema","delegationId","action","status","children"],"properties":{"schema":{"const":"paperclip.delegation.v1"},"delegationId":{"$ref":"#/$defs/id"},"action":{"enum":["spawn","message","resume","wait","close"]},"status":{"enum":["running","waiting","completed","failed","interrupted","closed"]},"children":{"type":"array","maxItems":64,"items":{"type":"object","required":["childId","role","model","status","summary","activitySummary"],"properties":{"childId":{"$ref":"#/$defs/id"},"role":{"type":["string","null"],"maxLength":160},"model":{"type":["string","null"],"maxLength":240},"status":{"enum":["running","waiting","completed","failed","interrupted","closed"]},"summary":{"$ref":"#/$defs/nullableShortText"},"activitySummary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false}}},"additionalProperties":false};function validate66(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate66.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.delegationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "delegationId"},message:"must have required property '"+"delegationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.action === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "action"},message:"must have required property '"+"action"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.children === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "children"},message:"must have required property '"+"children"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "delegationId")) || (key0 === "action")) || (key0 === "status")) || (key0 === "children"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.delegation.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.delegation.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.delegationId !== undefined){let data1 = data.delegationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.action !== undefined){let data2 = data.action;if(!(((((data2 === "spawn") || (data2 === "message")) || (data2 === "resume")) || (data2 === "wait")) || (data2 === "close"))){const err11 = {instancePath:instancePath+"/action",schemaPath:"#/properties/action/enum",keyword:"enum",params:{allowedValues: schema68.properties.action.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((((data3 === "running") || (data3 === "waiting")) || (data3 === "completed")) || (data3 === "failed")) || (data3 === "interrupted")) || (data3 === "closed"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema68.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.children !== undefined){let data4 = data.children;if(Array.isArray(data4)){if(data4.length > 64){const err13 = {instancePath:instancePath+"/children",schemaPath:"#/properties/children/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err21 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data5.role !== undefined){let data7 = data5.role;if((typeof data7 !== "string") && (data7 !== null)){const err25 = {instancePath:instancePath+"/children/" + i0+"/role",schemaPath:"#/properties/children/items/properties/role/type",keyword:"type",params:{type: schema68.properties.children.items.properties.role.type},message:"must be string,null"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 160){const err26 = {instancePath:instancePath+"/children/" + i0+"/role",schemaPath:"#/properties/children/items/properties/role/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}if(data5.model !== undefined){let data8 = data5.model;if((typeof data8 !== "string") && (data8 !== null)){const err27 = {instancePath:instancePath+"/children/" + i0+"/model",schemaPath:"#/properties/children/items/properties/model/type",keyword:"type",params:{type: schema68.properties.children.items.properties.model.type},message:"must be string,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(typeof data8 === "string"){if(func1(data8) > 240){const err28 = {instancePath:instancePath+"/children/" + i0+"/model",schemaPath:"#/properties/children/items/properties/model/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data5.status !== undefined){let data9 = data5.status;if(!((((((data9 === "running") || (data9 === "waiting")) || (data9 === "completed")) || (data9 === "failed")) || (data9 === "interrupted")) || (data9 === "closed"))){const err29 = {instancePath:instancePath+"/children/" + i0+"/status",schemaPath:"#/properties/children/items/properties/status/enum",keyword:"enum",params:{allowedValues: schema68.properties.children.items.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data5.summary !== undefined){let data10 = data5.summary;if((typeof data10 !== "string") && (data10 !== null)){const err30 = {instancePath:instancePath+"/children/" + i0+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(typeof data10 === "string"){if(func1(data10) > 4000){const err31 = {instancePath:instancePath+"/children/" + i0+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}if(data5.activitySummary !== undefined){let data11 = data5.activitySummary;if((typeof data11 !== "string") && (data11 !== null)){const err32 = {instancePath:instancePath+"/children/" + i0+"/activitySummary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data11 === "string"){if(func1(data11) > 4000){const err33 = {instancePath:instancePath+"/children/" + i0+"/activitySummary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}}else {const err34 = {instancePath:instancePath+"/children/" + i0,schemaPath:"#/properties/children/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/children",schemaPath:"#/properties/children/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}else {const err36 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}validate66.errors = vErrors;return errors === 0;}validate66.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema73 = {"type":"object","required":["schema","routeId","provider","requestedModel","fromModel","effectiveModel","reason"],"properties":{"schema":{"const":"paperclip.model.route_changed.v1"},"routeId":{"$ref":"#/$defs/id"},"provider":{"type":"string","minLength":1,"maxLength":160},"requestedModel":{"type":"string","minLength":1,"maxLength":240},"fromModel":{"type":["string","null"],"maxLength":240},"effectiveModel":{"type":"string","minLength":1,"maxLength":240},"reason":{"$ref":"#/$defs/shortText"}},"additionalProperties":false};function validate68(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate68.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.routeId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "routeId"},message:"must have required property '"+"routeId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.provider === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "provider"},message:"must have required property '"+"provider"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.requestedModel === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "requestedModel"},message:"must have required property '"+"requestedModel"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.fromModel === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "fromModel"},message:"must have required property '"+"fromModel"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.effectiveModel === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "effectiveModel"},message:"must have required property '"+"effectiveModel"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.reason === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema") || (key0 === "routeId")) || (key0 === "provider")) || (key0 === "requestedModel")) || (key0 === "fromModel")) || (key0 === "effectiveModel")) || (key0 === "reason"))){const err7 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.schema !== undefined){if("paperclip.model.route_changed.v1" !== data.schema){const err8 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.model.route_changed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.routeId !== undefined){let data1 = data.routeId;if(typeof data1 === "string"){if(func1(data1) > 160){const err9 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.provider !== undefined){let data2 = data.provider;if(typeof data2 === "string"){if(func1(data2) > 160){const err13 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data2) < 1){const err14 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.requestedModel !== undefined){let data3 = data.requestedModel;if(typeof data3 === "string"){if(func1(data3) > 240){const err16 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data3) < 1){const err17 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}else {const err18 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.fromModel !== undefined){let data4 = data.fromModel;if((typeof data4 !== "string") && (data4 !== null)){const err19 = {instancePath:instancePath+"/fromModel",schemaPath:"#/properties/fromModel/type",keyword:"type",params:{type: schema73.properties.fromModel.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 240){const err20 = {instancePath:instancePath+"/fromModel",schemaPath:"#/properties/fromModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}if(data.effectiveModel !== undefined){let data5 = data.effectiveModel;if(typeof data5 === "string"){if(func1(data5) > 240){const err21 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data5) < 1){const err22 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}else {const err23 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data.reason !== undefined){let data6 = data.reason;if(typeof data6 === "string"){if(func1(data6) > 4000){const err24 = {instancePath:instancePath+"/reason",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}else {const err25 = {instancePath:instancePath+"/reason",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}else {const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}validate68.errors = vErrors;return errors === 0;}validate68.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema76 = {"type":"object","required":["schema","verificationId","status","classes","buffering","summary"],"properties":{"schema":{"const":"paperclip.model.verification.v1"},"verificationId":{"$ref":"#/$defs/id"},"status":{"enum":["running","completed","failed"]},"classes":{"type":"array","maxItems":32,"items":{"type":"string","maxLength":160}},"buffering":{"type":"boolean"},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate70(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate70.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.verificationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "verificationId"},message:"must have required property '"+"verificationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.status === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.classes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "classes"},message:"must have required property '"+"classes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.buffering === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "buffering"},message:"must have required property '"+"buffering"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.summary === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "verificationId")) || (key0 === "status")) || (key0 === "classes")) || (key0 === "buffering")) || (key0 === "summary"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.model.verification.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.model.verification.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.verificationId !== undefined){let data1 = data.verificationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data2 = data.status;if(!(((data2 === "running") || (data2 === "completed")) || (data2 === "failed"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema76.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.classes !== undefined){let data3 = data.classes;if(Array.isArray(data3)){if(data3.length > 32){const err13 = {instancePath:instancePath+"/classes",schemaPath:"#/properties/classes/maxItems",keyword:"maxItems",params:{limit: 32},message:"must NOT have more than 32 items"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}const len0 = data3.length;for(let i0=0; i0 160){const err14 = {instancePath:instancePath+"/classes/" + i0,schemaPath:"#/properties/classes/items/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/classes/" + i0,schemaPath:"#/properties/classes/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/classes",schemaPath:"#/properties/classes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.buffering !== undefined){if(typeof data.buffering !== "boolean"){const err17 = {instancePath:instancePath+"/buffering",schemaPath:"#/properties/buffering/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.summary !== undefined){let data6 = data.summary;if((typeof data6 !== "string") && (data6 !== null)){const err18 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 4000){const err19 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}}else {const err20 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}validate70.errors = vErrors;return errors === 0;}validate70.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema79 = {"type":"object","required":["schema","compactionId","reason","preTokens","postTokens","sameSession"],"properties":{"schema":{"const":"paperclip.context.compacted.v1"},"compactionId":{"$ref":"#/$defs/id"},"reason":{"enum":["context_window","manual","provider","unknown"]},"preTokens":{"type":["integer","null"],"minimum":0},"postTokens":{"type":["integer","null"],"minimum":0},"sameSession":{"type":"boolean"}},"additionalProperties":false};function validate72(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate72.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.compactionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "compactionId"},message:"must have required property '"+"compactionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reason === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.preTokens === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "preTokens"},message:"must have required property '"+"preTokens"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.postTokens === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "postTokens"},message:"must have required property '"+"postTokens"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.sameSession === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sameSession"},message:"must have required property '"+"sameSession"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "compactionId")) || (key0 === "reason")) || (key0 === "preTokens")) || (key0 === "postTokens")) || (key0 === "sameSession"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.context.compacted.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.context.compacted.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.compactionId !== undefined){let data1 = data.compactionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.reason !== undefined){let data2 = data.reason;if(!((((data2 === "context_window") || (data2 === "manual")) || (data2 === "provider")) || (data2 === "unknown"))){const err12 = {instancePath:instancePath+"/reason",schemaPath:"#/properties/reason/enum",keyword:"enum",params:{allowedValues: schema79.properties.reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.preTokens !== undefined){let data3 = data.preTokens;if((!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) && (data3 !== null)){const err13 = {instancePath:instancePath+"/preTokens",schemaPath:"#/properties/preTokens/type",keyword:"type",params:{type: schema79.properties.preTokens.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if((typeof data3 == "number") && (isFinite(data3))){if(data3 < 0 || isNaN(data3)){const err14 = {instancePath:instancePath+"/preTokens",schemaPath:"#/properties/preTokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}if(data.postTokens !== undefined){let data4 = data.postTokens;if((!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) && (data4 !== null)){const err15 = {instancePath:instancePath+"/postTokens",schemaPath:"#/properties/postTokens/type",keyword:"type",params:{type: schema79.properties.postTokens.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err16 = {instancePath:instancePath+"/postTokens",schemaPath:"#/properties/postTokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}if(data.sameSession !== undefined){if(typeof data.sameSession !== "boolean"){const err17 = {instancePath:instancePath+"/sameSession",schemaPath:"#/properties/sameSession/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate72.errors = vErrors;return errors === 0;}validate72.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema81 = {"type":"object","required":["schema","artifactId","reference","mediaType","title"],"properties":{"schema":{"const":"paperclip.artifact.viewed.v1"},"artifactId":{"$ref":"#/$defs/id"},"reference":{"$ref":"#/$defs/safePath"},"mediaType":{"type":["string","null"],"maxLength":160},"title":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate74(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate74.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.artifactId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "artifactId"},message:"must have required property '"+"artifactId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reference === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.mediaType === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.title === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "artifactId")) || (key0 === "reference")) || (key0 === "mediaType")) || (key0 === "title"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.artifact.viewed.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.artifact.viewed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.artifactId !== undefined){let data1 = data.artifactId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.reference !== undefined){let data2 = data.reference;if((typeof data2 !== "string") && (data2 !== null)){const err11 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema57.type},message:"must be string,null"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(typeof data2 === "string"){if(func1(data2) > 4096){const err12 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern18.test(data2)){const err13 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}if(data.mediaType !== undefined){let data3 = data.mediaType;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/type",keyword:"type",params:{type: schema81.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 160){const err15 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.title !== undefined){let data4 = data.title;if((typeof data4 !== "string") && (data4 !== null)){const err16 = {instancePath:instancePath+"/title",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err17 = {instancePath:instancePath+"/title",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate74.errors = vErrors;return errors === 0;}validate74.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema85 = {"type":"object","required":["schema","artifactId","status","reference","mediaType","registered","failure"],"properties":{"schema":{"const":"paperclip.artifact.generated.v1"},"artifactId":{"$ref":"#/$defs/id"},"status":{"enum":["running","completed","failed"]},"reference":{"$ref":"#/$defs/safePath"},"mediaType":{"type":["string","null"],"maxLength":160},"registered":{"type":"boolean"},"transparentBackground":{"type":["boolean","null"]},"failure":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate76(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate76.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.artifactId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "artifactId"},message:"must have required property '"+"artifactId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.status === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.reference === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.mediaType === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.registered === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "registered"},message:"must have required property '"+"registered"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.failure === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "failure"},message:"must have required property '"+"failure"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "artifactId")) || (key0 === "status")) || (key0 === "reference")) || (key0 === "mediaType")) || (key0 === "registered")) || (key0 === "transparentBackground")) || (key0 === "failure"))){const err7 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.schema !== undefined){if("paperclip.artifact.generated.v1" !== data.schema){const err8 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.artifact.generated.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.artifactId !== undefined){let data1 = data.artifactId;if(typeof data1 === "string"){if(func1(data1) > 160){const err9 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.status !== undefined){let data2 = data.status;if(!(((data2 === "running") || (data2 === "completed")) || (data2 === "failed"))){const err13 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema85.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.reference !== undefined){let data3 = data.reference;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema57.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4096){const err15 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(!pattern18.test(data3)){const err16 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}if(data.mediaType !== undefined){let data4 = data.mediaType;if((typeof data4 !== "string") && (data4 !== null)){const err17 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/type",keyword:"type",params:{type: schema85.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 160){const err18 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data.registered !== undefined){if(typeof data.registered !== "boolean"){const err19 = {instancePath:instancePath+"/registered",schemaPath:"#/properties/registered/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.transparentBackground !== undefined){let data6 = data.transparentBackground;if((typeof data6 !== "boolean") && (data6 !== null)){const err20 = {instancePath:instancePath+"/transparentBackground",schemaPath:"#/properties/transparentBackground/type",keyword:"type",params:{type: schema85.properties.transparentBackground.type},message:"must be boolean,null"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.failure !== undefined){let data7 = data.failure;if((typeof data7 !== "string") && (data7 !== null)){const err21 = {instancePath:instancePath+"/failure",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 4000){const err22 = {instancePath:instancePath+"/failure",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}}else {const err23 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}validate76.errors = vErrors;return errors === 0;}validate76.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema89 = {"type":"object","required":["schema","reviewId","state","scope"],"properties":{"schema":{"const":"paperclip.review.mode_changed.v1"},"reviewId":{"$ref":"#/$defs/id"},"state":{"enum":["entered","exited"]},"scope":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate78(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate78.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.reviewId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reviewId"},message:"must have required property '"+"reviewId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.state === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "state"},message:"must have required property '"+"state"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.scope === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((key0 === "schema") || (key0 === "reviewId")) || (key0 === "state")) || (key0 === "scope"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema !== undefined){if("paperclip.review.mode_changed.v1" !== data.schema){const err5 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.review.mode_changed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.reviewId !== undefined){let data1 = data.reviewId;if(typeof data1 === "string"){if(func1(data1) > 160){const err6 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(func1(data1) < 1){const err7 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(!pattern4.test(data1)){const err8 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.state !== undefined){let data2 = data.state;if(!((data2 === "entered") || (data2 === "exited"))){const err10 = {instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema89.properties.state.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.scope !== undefined){let data3 = data.scope;if((typeof data3 !== "string") && (data3 !== null)){const err11 = {instancePath:instancePath+"/scope",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4000){const err12 = {instancePath:instancePath+"/scope",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}}else {const err13 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}validate78.errors = vErrors;return errors === 0;}validate78.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema92 = {"type":"object","required":["schema","hookId","event","scope","status","blocking","durationMs","summary"],"properties":{"schema":{"const":"paperclip.hook.v1"},"hookId":{"$ref":"#/$defs/id"},"event":{"type":"string","minLength":1,"maxLength":160},"scope":{"type":"string","minLength":1,"maxLength":160},"status":{"enum":["running","completed","failed","cancelled"]},"blocking":{"type":"boolean"},"durationMs":{"type":["integer","null"],"minimum":0},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate80(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate80.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.hookId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "hookId"},message:"must have required property '"+"hookId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.event === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "event"},message:"must have required property '"+"event"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.scope === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.status === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.blocking === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "blocking"},message:"must have required property '"+"blocking"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.durationMs === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "durationMs"},message:"must have required property '"+"durationMs"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.summary === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "hookId")) || (key0 === "event")) || (key0 === "scope")) || (key0 === "status")) || (key0 === "blocking")) || (key0 === "durationMs")) || (key0 === "summary"))){const err8 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.schema !== undefined){if("paperclip.hook.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.hook.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.hookId !== undefined){let data1 = data.hookId;if(typeof data1 === "string"){if(func1(data1) > 160){const err10 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(func1(data1) < 1){const err11 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(!pattern4.test(data1)){const err12 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.event !== undefined){let data2 = data.event;if(typeof data2 === "string"){if(func1(data2) > 160){const err14 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data2) < 1){const err15 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.scope !== undefined){let data3 = data.scope;if(typeof data3 === "string"){if(func1(data3) > 160){const err17 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data3) < 1){const err18 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.status !== undefined){let data4 = data.status;if(!((((data4 === "running") || (data4 === "completed")) || (data4 === "failed")) || (data4 === "cancelled"))){const err20 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema92.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.blocking !== undefined){if(typeof data.blocking !== "boolean"){const err21 = {instancePath:instancePath+"/blocking",schemaPath:"#/properties/blocking/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.durationMs !== undefined){let data6 = data.durationMs;if((!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) && (data6 !== null)){const err22 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/type",keyword:"type",params:{type: schema92.properties.durationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){const err23 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data.summary !== undefined){let data7 = data.summary;if((typeof data7 !== "string") && (data7 !== null)){const err24 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 4000){const err25 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}}else {const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}validate80.errors = vErrors;return errors === 0;}validate80.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema95 = {"type":"object","required":["schema","citationId","messageItemId","label","available","reference"],"properties":{"schema":{"const":"paperclip.memory.citation.v1"},"citationId":{"$ref":"#/$defs/id"},"messageItemId":{"$ref":"#/$defs/id"},"label":{"$ref":"#/$defs/shortText"},"available":{"type":"boolean"},"reference":{"type":["string","null"],"maxLength":4096}},"additionalProperties":false};function validate82(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate82.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.citationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "citationId"},message:"must have required property '"+"citationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.messageItemId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messageItemId"},message:"must have required property '"+"messageItemId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.label === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.available === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "available"},message:"must have required property '"+"available"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.reference === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "citationId")) || (key0 === "messageItemId")) || (key0 === "label")) || (key0 === "available")) || (key0 === "reference"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.memory.citation.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.memory.citation.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.citationId !== undefined){let data1 = data.citationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.messageItemId !== undefined){let data2 = data.messageItemId;if(typeof data2 === "string"){if(func1(data2) > 160){const err12 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(!pattern4.test(data2)){const err14 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.label !== undefined){let data3 = data.label;if(typeof data3 === "string"){if(func1(data3) > 4000){const err16 = {instancePath:instancePath+"/label",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {instancePath:instancePath+"/label",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.available !== undefined){if(typeof data.available !== "boolean"){const err18 = {instancePath:instancePath+"/available",schemaPath:"#/properties/available/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.reference !== undefined){let data5 = data.reference;if((typeof data5 !== "string") && (data5 !== null)){const err19 = {instancePath:instancePath+"/reference",schemaPath:"#/properties/reference/type",keyword:"type",params:{type: schema95.properties.reference.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4096){const err20 = {instancePath:instancePath+"/reference",schemaPath:"#/properties/reference/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}}else {const err21 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}validate82.errors = vErrors;return errors === 0;}validate82.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema99 = {"type":"object","required":["schema","reviewId","targetExecutionId","status","decision","summary"],"properties":{"schema":{"const":"paperclip.safety.review.v1"},"reviewId":{"$ref":"#/$defs/id"},"targetExecutionId":{"anyOf":[{"$ref":"#/$defs/id"},{"type":"null"}]},"status":{"enum":["running","completed","failed"]},"decision":{"enum":["pending","allowed","denied","user_required","unknown"]},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate84(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate84.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.reviewId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reviewId"},message:"must have required property '"+"reviewId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.targetExecutionId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "targetExecutionId"},message:"must have required property '"+"targetExecutionId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.decision === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "decision"},message:"must have required property '"+"decision"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.summary === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "reviewId")) || (key0 === "targetExecutionId")) || (key0 === "status")) || (key0 === "decision")) || (key0 === "summary"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.safety.review.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.safety.review.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.reviewId !== undefined){let data1 = data.reviewId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.targetExecutionId !== undefined){let data2 = data.targetExecutionId;const _errs7 = errors;let valid2 = false;const _errs8 = errors;if(typeof data2 === "string"){if(func1(data2) > 160){const err12 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(!pattern4.test(data2)){const err14 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}var _valid0 = _errs8 === errors;valid2 = valid2 || _valid0;const _errs11 = errors;if(data2 !== null){const err16 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/properties/targetExecutionId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}var _valid0 = _errs11 === errors;valid2 = valid2 || _valid0;if(!valid2){const err17 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/properties/targetExecutionId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}else {errors = _errs7;if(vErrors !== null){if(_errs7){vErrors.length = _errs7;}else {vErrors = null;}}}}if(data.status !== undefined){let data3 = data.status;if(!(((data3 === "running") || (data3 === "completed")) || (data3 === "failed"))){const err18 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema99.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.decision !== undefined){let data4 = data.decision;if(!(((((data4 === "pending") || (data4 === "allowed")) || (data4 === "denied")) || (data4 === "user_required")) || (data4 === "unknown"))){const err19 = {instancePath:instancePath+"/decision",schemaPath:"#/properties/decision/enum",keyword:"enum",params:{allowedValues: schema99.properties.decision.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.summary !== undefined){let data5 = data.summary;if((typeof data5 !== "string") && (data5 !== null)){const err20 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema51.type},message:"must be string,null"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4000){const err21 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}}else {const err22 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}validate84.errors = vErrors;return errors === 0;}validate84.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema103 = {"type":"object","required":["schema","executionId","origin","inputClass","byteCount"],"properties":{"schema":{"const":"paperclip.terminal.input_sent.v1"},"executionId":{"$ref":"#/$defs/id"},"origin":{"enum":["agent","user","system"]},"inputClass":{"enum":["text","control","eof"]},"byteCount":{"type":"integer","minimum":0}},"additionalProperties":false};function validate86(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate86.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.executionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "executionId"},message:"must have required property '"+"executionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.origin === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "origin"},message:"must have required property '"+"origin"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.inputClass === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "inputClass"},message:"must have required property '"+"inputClass"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.byteCount === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "byteCount"},message:"must have required property '"+"byteCount"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "executionId")) || (key0 === "origin")) || (key0 === "inputClass")) || (key0 === "byteCount"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.terminal.input_sent.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.terminal.input_sent.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.executionId !== undefined){let data1 = data.executionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.origin !== undefined){let data2 = data.origin;if(!(((data2 === "agent") || (data2 === "user")) || (data2 === "system"))){const err11 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/enum",keyword:"enum",params:{allowedValues: schema103.properties.origin.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.inputClass !== undefined){let data3 = data.inputClass;if(!(((data3 === "text") || (data3 === "control")) || (data3 === "eof"))){const err12 = {instancePath:instancePath+"/inputClass",schemaPath:"#/properties/inputClass/enum",keyword:"enum",params:{allowedValues: schema103.properties.inputClass.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.byteCount !== undefined){let data4 = data.byteCount;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){const err13 = {instancePath:instancePath+"/byteCount",schemaPath:"#/properties/byteCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err14 = {instancePath:instancePath+"/byteCount",schemaPath:"#/properties/byteCount/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}}else {const err15 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}validate86.errors = vErrors;return errors === 0;}validate86.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema105 = {"type":"object","required":["schema","waitId","reason","status","plannedDurationMs","elapsedDurationMs"],"properties":{"schema":{"const":"paperclip.wait.v1"},"waitId":{"$ref":"#/$defs/id"},"reason":{"enum":["timer","provider","rate_limit","unknown"]},"status":{"enum":["running","completed","interrupted","cancelled"]},"plannedDurationMs":{"type":["integer","null"],"minimum":0},"elapsedDurationMs":{"type":["integer","null"],"minimum":0}},"additionalProperties":false};function validate88(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate88.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.waitId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "waitId"},message:"must have required property '"+"waitId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reason === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.plannedDurationMs === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "plannedDurationMs"},message:"must have required property '"+"plannedDurationMs"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.elapsedDurationMs === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "elapsedDurationMs"},message:"must have required property '"+"elapsedDurationMs"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "waitId")) || (key0 === "reason")) || (key0 === "status")) || (key0 === "plannedDurationMs")) || (key0 === "elapsedDurationMs"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.wait.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.wait.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.waitId !== undefined){let data1 = data.waitId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.reason !== undefined){let data2 = data.reason;if(!((((data2 === "timer") || (data2 === "provider")) || (data2 === "rate_limit")) || (data2 === "unknown"))){const err12 = {instancePath:instancePath+"/reason",schemaPath:"#/properties/reason/enum",keyword:"enum",params:{allowedValues: schema105.properties.reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((data3 === "running") || (data3 === "completed")) || (data3 === "interrupted")) || (data3 === "cancelled"))){const err13 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema105.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.plannedDurationMs !== undefined){let data4 = data.plannedDurationMs;if((!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) && (data4 !== null)){const err14 = {instancePath:instancePath+"/plannedDurationMs",schemaPath:"#/properties/plannedDurationMs/type",keyword:"type",params:{type: schema105.properties.plannedDurationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err15 = {instancePath:instancePath+"/plannedDurationMs",schemaPath:"#/properties/plannedDurationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.elapsedDurationMs !== undefined){let data5 = data.elapsedDurationMs;if((!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) && (data5 !== null)){const err16 = {instancePath:instancePath+"/elapsedDurationMs",schemaPath:"#/properties/elapsedDurationMs/type",keyword:"type",params:{type: schema105.properties.elapsedDurationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 0 || isNaN(data5)){const err17 = {instancePath:instancePath+"/elapsedDurationMs",schemaPath:"#/properties/elapsedDurationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate88.errors = vErrors;return errors === 0;}validate88.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema107 = {"type":"object","required":["schema","noticeId","severity","category","scope","recoverable","userActionable","summary"],"properties":{"schema":{"const":"paperclip.provider.notice.v1"},"noticeId":{"$ref":"#/$defs/id"},"severity":{"enum":["info","warning","error"]},"category":{"type":"string","minLength":1,"maxLength":160},"scope":{"enum":["turn","session","environment","account"]},"recoverable":{"type":"boolean"},"userActionable":{"type":"boolean"},"summary":{"$ref":"#/$defs/shortText"},"provenance":{"type":"object","required":["method","eventType","sessionId","turnId"],"properties":{"method":{"type":"string","maxLength":160},"eventType":{"type":"string","maxLength":160},"sessionId":{"type":"string","maxLength":240},"turnId":{"type":"string","maxLength":240},"agentId":{"type":"string","maxLength":240},"timestamp":{"type":"string","maxLength":80}},"additionalProperties":false},"details":{"type":"array","maxItems":64,"items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string","minLength":1,"maxLength":160},"value":{"type":"string","maxLength":4000}},"additionalProperties":false}}},"additionalProperties":false};function validate90(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate90.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.noticeId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "noticeId"},message:"must have required property '"+"noticeId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.severity === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "severity"},message:"must have required property '"+"severity"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.category === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "category"},message:"must have required property '"+"category"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.scope === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.recoverable === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "recoverable"},message:"must have required property '"+"recoverable"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.userActionable === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "userActionable"},message:"must have required property '"+"userActionable"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.summary === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key0 in data){if(!(func58.call(schema107.properties, key0))){const err8 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.schema !== undefined){if("paperclip.provider.notice.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.provider.notice.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.noticeId !== undefined){let data1 = data.noticeId;if(typeof data1 === "string"){if(func1(data1) > 160){const err10 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(func1(data1) < 1){const err11 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(!pattern4.test(data1)){const err12 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.severity !== undefined){let data2 = data.severity;if(!(((data2 === "info") || (data2 === "warning")) || (data2 === "error"))){const err14 = {instancePath:instancePath+"/severity",schemaPath:"#/properties/severity/enum",keyword:"enum",params:{allowedValues: schema107.properties.severity.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.category !== undefined){let data3 = data.category;if(typeof data3 === "string"){if(func1(data3) > 160){const err15 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(func1(data3) < 1){const err16 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.scope !== undefined){let data4 = data.scope;if(!((((data4 === "turn") || (data4 === "session")) || (data4 === "environment")) || (data4 === "account"))){const err18 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/enum",keyword:"enum",params:{allowedValues: schema107.properties.scope.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.recoverable !== undefined){if(typeof data.recoverable !== "boolean"){const err19 = {instancePath:instancePath+"/recoverable",schemaPath:"#/properties/recoverable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.userActionable !== undefined){if(typeof data.userActionable !== "boolean"){const err20 = {instancePath:instancePath+"/userActionable",schemaPath:"#/properties/userActionable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.summary !== undefined){let data7 = data.summary;if(typeof data7 === "string"){if(func1(data7) > 4000){const err21 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.provenance !== undefined){let data8 = data.provenance;if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.method === undefined){const err23 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "method"},message:"must have required property '"+"method"+"'"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(data8.eventType === undefined){const err24 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "eventType"},message:"must have required property '"+"eventType"+"'"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(data8.sessionId === undefined){const err25 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "sessionId"},message:"must have required property '"+"sessionId"+"'"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(data8.turnId === undefined){const err26 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}for(const key1 in data8){if(!((((((key1 === "method") || (key1 === "eventType")) || (key1 === "sessionId")) || (key1 === "turnId")) || (key1 === "agentId")) || (key1 === "timestamp"))){const err27 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data8.method !== undefined){let data9 = data8.method;if(typeof data9 === "string"){if(func1(data9) > 160){const err28 = {instancePath:instancePath+"/provenance/method",schemaPath:"#/properties/provenance/properties/method/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/provenance/method",schemaPath:"#/properties/provenance/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data8.eventType !== undefined){let data10 = data8.eventType;if(typeof data10 === "string"){if(func1(data10) > 160){const err30 = {instancePath:instancePath+"/provenance/eventType",schemaPath:"#/properties/provenance/properties/eventType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}else {const err31 = {instancePath:instancePath+"/provenance/eventType",schemaPath:"#/properties/provenance/properties/eventType/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data8.sessionId !== undefined){let data11 = data8.sessionId;if(typeof data11 === "string"){if(func1(data11) > 240){const err32 = {instancePath:instancePath+"/provenance/sessionId",schemaPath:"#/properties/provenance/properties/sessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/provenance/sessionId",schemaPath:"#/properties/provenance/properties/sessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data8.turnId !== undefined){let data12 = data8.turnId;if(typeof data12 === "string"){if(func1(data12) > 240){const err34 = {instancePath:instancePath+"/provenance/turnId",schemaPath:"#/properties/provenance/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}else {const err35 = {instancePath:instancePath+"/provenance/turnId",schemaPath:"#/properties/provenance/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data8.agentId !== undefined){let data13 = data8.agentId;if(typeof data13 === "string"){if(func1(data13) > 240){const err36 = {instancePath:instancePath+"/provenance/agentId",schemaPath:"#/properties/provenance/properties/agentId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {instancePath:instancePath+"/provenance/agentId",schemaPath:"#/properties/provenance/properties/agentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data8.timestamp !== undefined){let data14 = data8.timestamp;if(typeof data14 === "string"){if(func1(data14) > 80){const err38 = {instancePath:instancePath+"/provenance/timestamp",schemaPath:"#/properties/provenance/properties/timestamp/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}else {const err39 = {instancePath:instancePath+"/provenance/timestamp",schemaPath:"#/properties/provenance/properties/timestamp/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}}else {const err40 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data.details !== undefined){let data15 = data.details;if(Array.isArray(data15)){if(data15.length > 64){const err41 = {instancePath:instancePath+"/details",schemaPath:"#/properties/details/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}const len0 = data15.length;for(let i0=0; i0 160){const err45 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func1(data17) < 1){const err46 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data16.value !== undefined){let data18 = data16.value;if(typeof data18 === "string"){if(func1(data18) > 4000){const err48 = {instancePath:instancePath+"/details/" + i0+"/value",schemaPath:"#/properties/details/items/properties/value/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}else {const err49 = {instancePath:instancePath+"/details/" + i0+"/value",schemaPath:"#/properties/details/items/properties/value/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}}else {const err50 = {instancePath:instancePath+"/details/" + i0,schemaPath:"#/properties/details/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/details",schemaPath:"#/properties/details/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}}else {const err52 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}validate90.errors = vErrors;return errors === 0;}validate90.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema174 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json","title":"PRP provider-neutral semantic tool envelope","type":"object","required":["schema","schemaVersion","phase","operationId","callId","correlation","idempotencyKey","content"],"properties":{"schema":{"const":"paperclip.prp.semantic_tool.v1"},"schemaVersion":{"const":1},"phase":{"enum":["input","result","reconciled"]},"operationId":{"$ref":"#/$defs/stableId"},"callId":{"$ref":"#/$defs/stableId"},"correlation":{"type":"object","required":["runId","normalizedSessionId","turnId","itemId"],"properties":{"runId":{"$ref":"#/$defs/stableId"},"normalizedSessionId":{"$ref":"#/$defs/stableId"},"turnId":{"$ref":"#/$defs/stableId"},"itemId":{"$ref":"#/$defs/stableId"},"requestId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true},"idempotencyKey":{"type":["string","null"],"minLength":1,"maxLength":240},"content":{"$ref":"#/$defs/safeContent"},"outcome":{"enum":["succeeded","denied","conflict","duplicate","unavailable","failed"]},"code":{"$ref":"#/$defs/stableCode"},"retryable":{"type":"boolean"},"authorizationBoundary":{"enum":["company","actor","active_task","grant","governed_action","lock","revision"]},"operationReceiptId":{"$ref":"#/$defs/stableId"},"auditReceiptId":{"$ref":"#/$defs/stableId"},"currentRevision":{"oneOf":[{"type":"integer","minimum":0},{"$ref":"#/$defs/stableId"}]},"duplicateOfReceiptId":{"$ref":"#/$defs/stableId"},"artifactRefs":{"type":"array","items":{"allOf":[{"$ref":"#/$defs/safeReference"},{"type":"object","properties":{"kind":{"enum":["artifact","work_product"]}}}]},"uniqueItems":true},"targets":{"type":"array","items":{"$ref":"#/$defs/immutableTarget"},"uniqueItems":true},"causalRefs":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"allOf":[{"if":{"properties":{"phase":{"enum":["result","reconciled"]}},"required":["phase"]},"then":{"required":["outcome","code","retryable","authorizationBoundary","operationReceiptId"]}}],"additionalProperties":true,"$defs":{"stableId":{"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"stableCode":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"},"safeContent":{"type":"object","required":["digest","redactionDisposition","references"],"properties":{"digest":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"redactionDisposition":{"enum":["digest_only","allowlisted_references","redacted"]},"references":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"additionalProperties":true},"safeReference":{"type":"object","required":["kind","id"],"properties":{"kind":{"enum":["task","document_revision","interaction","approval","decision","artifact","work_product","wake","monitor","audit","operation"]},"id":{"$ref":"#/$defs/stableId"}},"additionalProperties":true},"immutableTarget":{"type":"object","required":["kind","id","immutable"],"properties":{"kind":{"enum":["document_revision","interaction","approval","decision"]},"id":{"$ref":"#/$defs/stableId"},"immutable":{"const":true},"revisionId":{"$ref":"#/$defs/stableId"},"decisionId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true}}};const schema175 = {"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};const schema185 = {"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"};const pattern14 = new RegExp("^[a-z][a-z0-9_.:-]*$", "u");const schema182 = {"type":"object","required":["digest","redactionDisposition","references"],"properties":{"digest":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"redactionDisposition":{"enum":["digest_only","allowlisted_references","redacted"]},"references":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"additionalProperties":true};const schema183 = {"type":"object","required":["kind","id"],"properties":{"kind":{"enum":["task","document_revision","interaction","approval","decision","artifact","work_product","wake","monitor","audit","operation"]},"id":{"$ref":"#/$defs/stableId"}},"additionalProperties":true};function validate94(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate94.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.kind === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.kind !== undefined){let data0 = data.kind;if(!(((((((((((data0 === "task") || (data0 === "document_revision")) || (data0 === "interaction")) || (data0 === "approval")) || (data0 === "decision")) || (data0 === "artifact")) || (data0 === "work_product")) || (data0 === "wake")) || (data0 === "monitor")) || (data0 === "audit")) || (data0 === "operation"))){const err2 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema183.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.id !== undefined){let data1 = data.id;if(typeof data1 === "string"){if(func1(data1) > 240){const err3 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(func1(data1) < 1){const err4 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate94.errors = vErrors;return errors === 0;}validate94.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate93(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate93.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.digest === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "digest"},message:"must have required property '"+"digest"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.redactionDisposition === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "redactionDisposition"},message:"must have required property '"+"redactionDisposition"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.references === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "references"},message:"must have required property '"+"references"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.digest !== undefined){let data0 = data.digest;if(typeof data0 === "string"){if(!pattern19.test(data0)){const err3 = {instancePath:instancePath+"/digest",schemaPath:"#/properties/digest/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/digest",schemaPath:"#/properties/digest/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.redactionDisposition !== undefined){let data1 = data.redactionDisposition;if(!(((data1 === "digest_only") || (data1 === "allowlisted_references")) || (data1 === "redacted"))){const err5 = {instancePath:instancePath+"/redactionDisposition",schemaPath:"#/properties/redactionDisposition/enum",keyword:"enum",params:{allowedValues: schema182.properties.redactionDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.references !== undefined){let data2 = data.references;if(Array.isArray(data2)){const len0 = data2.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data2[i1], data2[j0])){const err6 = {instancePath:instancePath+"/references",schemaPath:"#/properties/references/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;break outer0;}}}}}else {const err7 = {instancePath:instancePath+"/references",schemaPath:"#/properties/references/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}}else {const err8 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}validate93.errors = vErrors;return errors === 0;}validate93.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema190 = {"type":"object","required":["kind","id","immutable"],"properties":{"kind":{"enum":["document_revision","interaction","approval","decision"]},"id":{"$ref":"#/$defs/stableId"},"immutable":{"const":true},"revisionId":{"$ref":"#/$defs/stableId"},"decisionId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true};function validate98(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate98.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.kind === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.immutable === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "immutable"},message:"must have required property '"+"immutable"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.kind !== undefined){let data0 = data.kind;if(!((((data0 === "document_revision") || (data0 === "interaction")) || (data0 === "approval")) || (data0 === "decision"))){const err3 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema190.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data.id !== undefined){let data1 = data.id;if(typeof data1 === "string"){if(func1(data1) > 240){const err4 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(func1(data1) < 1){const err5 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(!pattern4.test(data1)){const err6 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.immutable !== undefined){if(true !== data.immutable){const err8 = {instancePath:instancePath+"/immutable",schemaPath:"#/properties/immutable/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.revisionId !== undefined){let data3 = data.revisionId;if(typeof data3 === "string"){if(func1(data3) > 240){const err9 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data3) < 1){const err10 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data3)){const err11 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.decisionId !== undefined){let data4 = data.decisionId;if(typeof data4 === "string"){if(func1(data4) > 240){const err13 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data4) < 1){const err14 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data4)){const err15 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate98.errors = vErrors;return errors === 0;}validate98.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate92(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate92.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.phase === undefined) && (missing0 = "phase")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.phase !== undefined){let data0 = data.phase;if(!((data0 === "result") || (data0 === "reconciled"))){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.outcome === undefined){const err2 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "outcome"},message:"must have required property '"+"outcome"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.code === undefined){const err3 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "code"},message:"must have required property '"+"code"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.retryable === undefined){const err4 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "retryable"},message:"must have required property '"+"retryable"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.authorizationBoundary === undefined){const err5 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "authorizationBoundary"},message:"must have required property '"+"authorizationBoundary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.operationReceiptId === undefined){const err6 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "operationReceiptId"},message:"must have required property '"+"operationReceiptId"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}var _valid0 = _errs5 === errors;valid1 = _valid0;}if(!valid1){const err7 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.schemaVersion === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.phase === undefined){const err10 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "phase"},message:"must have required property '"+"phase"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data.operationId === undefined){const err11 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "operationId"},message:"must have required property '"+"operationId"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data.callId === undefined){const err12 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "callId"},message:"must have required property '"+"callId"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data.correlation === undefined){const err13 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "correlation"},message:"must have required property '"+"correlation"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data.idempotencyKey === undefined){const err14 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "idempotencyKey"},message:"must have required property '"+"idempotencyKey"+"'"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(data.content === undefined){const err15 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "content"},message:"must have required property '"+"content"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data.schema !== undefined){if("paperclip.prp.semantic_tool.v1" !== data.schema){const err16 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.semantic_tool.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err17 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.phase !== undefined){let data3 = data.phase;if(!(((data3 === "input") || (data3 === "result")) || (data3 === "reconciled"))){const err18 = {instancePath:instancePath+"/phase",schemaPath:"#/properties/phase/enum",keyword:"enum",params:{allowedValues: schema174.properties.phase.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.operationId !== undefined){let data4 = data.operationId;if(typeof data4 === "string"){if(func1(data4) > 240){const err19 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(func1(data4) < 1){const err20 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(!pattern4.test(data4)){const err21 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.callId !== undefined){let data5 = data.callId;if(typeof data5 === "string"){if(func1(data5) > 240){const err23 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(func1(data5) < 1){const err24 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(!pattern4.test(data5)){const err25 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.correlation !== undefined){let data6 = data.correlation;if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.runId === undefined){const err27 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data6.normalizedSessionId === undefined){const err28 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data6.turnId === undefined){const err29 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data6.itemId === undefined){const err30 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "itemId"},message:"must have required property '"+"itemId"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data6.runId !== undefined){let data7 = data6.runId;if(typeof data7 === "string"){if(func1(data7) > 240){const err31 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func1(data7) < 1){const err32 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(!pattern4.test(data7)){const err33 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}else {const err34 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data6.normalizedSessionId !== undefined){let data8 = data6.normalizedSessionId;if(typeof data8 === "string"){if(func1(data8) > 240){const err35 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(func1(data8) < 1){const err36 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(!pattern4.test(data8)){const err37 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}else {const err38 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data6.turnId !== undefined){let data9 = data6.turnId;if(typeof data9 === "string"){if(func1(data9) > 240){const err39 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(func1(data9) < 1){const err40 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(!pattern4.test(data9)){const err41 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data6.itemId !== undefined){let data10 = data6.itemId;if(typeof data10 === "string"){if(func1(data10) > 240){const err43 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(func1(data10) < 1){const err44 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(!pattern4.test(data10)){const err45 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}else {const err46 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data6.requestId !== undefined){let data11 = data6.requestId;if(typeof data11 === "string"){if(func1(data11) > 240){const err47 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(func1(data11) < 1){const err48 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(!pattern4.test(data11)){const err49 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data.idempotencyKey !== undefined){let data12 = data.idempotencyKey;if((typeof data12 !== "string") && (data12 !== null)){const err52 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/type",keyword:"type",params:{type: schema174.properties.idempotencyKey.type},message:"must be string,null"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 240){const err53 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}if(func1(data12) < 1){const err54 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}if(data.content !== undefined){if(!(validate93(data.content, {instancePath:instancePath+"/content",parentData:data,parentDataProperty:"content",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate93.errors : vErrors.concat(validate93.errors);errors = vErrors.length;}}if(data.outcome !== undefined){let data14 = data.outcome;if(!((((((data14 === "succeeded") || (data14 === "denied")) || (data14 === "conflict")) || (data14 === "duplicate")) || (data14 === "unavailable")) || (data14 === "failed"))){const err55 = {instancePath:instancePath+"/outcome",schemaPath:"#/properties/outcome/enum",keyword:"enum",params:{allowedValues: schema174.properties.outcome.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data.code !== undefined){let data15 = data.code;if(typeof data15 === "string"){if(func1(data15) > 160){const err56 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}if(func1(data15) < 1){const err57 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}if(!pattern14.test(data15)){const err58 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}else {const err59 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data.retryable !== undefined){if(typeof data.retryable !== "boolean"){const err60 = {instancePath:instancePath+"/retryable",schemaPath:"#/properties/retryable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data.authorizationBoundary !== undefined){let data17 = data.authorizationBoundary;if(!(((((((data17 === "company") || (data17 === "actor")) || (data17 === "active_task")) || (data17 === "grant")) || (data17 === "governed_action")) || (data17 === "lock")) || (data17 === "revision"))){const err61 = {instancePath:instancePath+"/authorizationBoundary",schemaPath:"#/properties/authorizationBoundary/enum",keyword:"enum",params:{allowedValues: schema174.properties.authorizationBoundary.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data.operationReceiptId !== undefined){let data18 = data.operationReceiptId;if(typeof data18 === "string"){if(func1(data18) > 240){const err62 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(func1(data18) < 1){const err63 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}if(!pattern4.test(data18)){const err64 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}else {const err65 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data.auditReceiptId !== undefined){let data19 = data.auditReceiptId;if(typeof data19 === "string"){if(func1(data19) > 240){const err66 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func1(data19) < 1){const err67 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}if(!pattern4.test(data19)){const err68 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}else {const err69 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data.currentRevision !== undefined){let data20 = data.currentRevision;const _errs51 = errors;let valid15 = false;let passing0 = null;const _errs52 = errors;if(!(((typeof data20 == "number") && (!(data20 % 1) && !isNaN(data20))) && (isFinite(data20)))){const err70 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf/0/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if((typeof data20 == "number") && (isFinite(data20))){if(data20 < 0 || isNaN(data20)){const err71 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}var _valid1 = _errs52 === errors;if(_valid1){valid15 = true;passing0 = 0;}const _errs54 = errors;if(typeof data20 === "string"){if(func1(data20) > 240){const err72 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(func1(data20) < 1){const err73 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(!pattern4.test(data20)){const err74 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}var _valid1 = _errs54 === errors;if(_valid1 && valid15){valid15 = false;passing0 = [passing0, 1];}else {if(_valid1){valid15 = true;passing0 = 1;}}if(!valid15){const err76 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}else {errors = _errs51;if(vErrors !== null){if(_errs51){vErrors.length = _errs51;}else {vErrors = null;}}}}if(data.duplicateOfReceiptId !== undefined){let data21 = data.duplicateOfReceiptId;if(typeof data21 === "string"){if(func1(data21) > 240){const err77 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(func1(data21) < 1){const err78 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(!pattern4.test(data21)){const err79 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}else {const err80 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data.artifactRefs !== undefined){let data22 = data.artifactRefs;if(Array.isArray(data22)){const len0 = data22.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data22[i1], data22[j0])){const err83 = {instancePath:instancePath+"/artifactRefs",schemaPath:"#/properties/artifactRefs/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;break outer0;}}}}}else {const err84 = {instancePath:instancePath+"/artifactRefs",schemaPath:"#/properties/artifactRefs/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data.targets !== undefined){let data25 = data.targets;if(Array.isArray(data25)){const len1 = data25.length;for(let i2=0; i2 1){outer1:for(;i3--;){for(j1 = i3; j1--;){if(func0(data25[i3], data25[j1])){const err85 = {instancePath:instancePath+"/targets",schemaPath:"#/properties/targets/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;break outer1;}}}}}else {const err86 = {instancePath:instancePath+"/targets",schemaPath:"#/properties/targets/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data.causalRefs !== undefined){let data27 = data.causalRefs;if(Array.isArray(data27)){const len2 = data27.length;for(let i4=0; i4 1){outer2:for(;i5--;){for(j2 = i5; j2--;){if(func0(data27[i5], data27[j2])){const err87 = {instancePath:instancePath+"/causalRefs",schemaPath:"#/properties/causalRefs/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i5+" are identical)"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;break outer2;}}}}}else {const err88 = {instancePath:instancePath+"/causalRefs",schemaPath:"#/properties/causalRefs/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}}else {const err89 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}validate92.errors = vErrors;return errors === 0;}validate92.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema194 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/terminal.schema.json","title":"PRP run terminal state","type":"object","required":["schema","turnTerminalState","runTerminalState","reportedWorkDisposition"],"properties":{"schema":{"const":"paperclip.prp.terminal.v1"},"turnTerminalState":{"enum":["completed","failed","interrupted","cancelled"]},"runTerminalState":{"enum":["succeeded","failed","cancelled"]},"reportedWorkDisposition":{"enum":["done","blocked","needs_review","yielded"]},"workAssessmentId":{"type":"string","minLength":1},"statusDecisionId":{"type":"string","minLength":1},"stopReason":{"$ref":"https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json"}},"additionalProperties":true};const schema195 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json","title":"PRP terminal stop reason receipt","type":"object","required":["schema","schemaVersion","receiptId","kind","code","retryable","decisionId","limitClass","aggregate"],"properties":{"schema":{"const":"paperclip.prp.stop_reason.v1"},"schemaVersion":{"const":1},"receiptId":{"$ref":"#/$defs/stableId"},"kind":{"enum":["budget","cost"]},"code":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"},"retryable":{"type":"boolean"},"decisionId":{"$ref":"#/$defs/stableId"},"limitClass":{"enum":["company_monthly","actor_monthly","project_monthly","run_cost","provider_quota"]},"aggregate":{"type":"object","required":["unit","observed","limit","window"],"properties":{"unit":{"enum":["cents","usd_micros","tokens"]},"observed":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":0},"window":{"enum":["run","monthly_utc","provider_window"]}},"additionalProperties":true},"relatedReceiptIds":{"type":"array","items":{"$ref":"#/$defs/stableId"},"uniqueItems":true}},"additionalProperties":true,"$defs":{"stableId":{"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"}}};const schema196 = {"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};function validate105(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate105.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.schemaVersion === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.receiptId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "receiptId"},message:"must have required property '"+"receiptId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.kind === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.code === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "code"},message:"must have required property '"+"code"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.retryable === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "retryable"},message:"must have required property '"+"retryable"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.decisionId === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "decisionId"},message:"must have required property '"+"decisionId"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.limitClass === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "limitClass"},message:"must have required property '"+"limitClass"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.aggregate === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "aggregate"},message:"must have required property '"+"aggregate"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.schema !== undefined){if("paperclip.prp.stop_reason.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.stop_reason.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err10 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.receiptId !== undefined){let data2 = data.receiptId;if(typeof data2 === "string"){if(func1(data2) > 240){const err11 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(func1(data2) < 1){const err12 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern4.test(data2)){const err13 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.kind !== undefined){let data3 = data.kind;if(!((data3 === "budget") || (data3 === "cost"))){const err15 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema195.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.code !== undefined){let data4 = data.code;if(typeof data4 === "string"){if(func1(data4) > 160){const err16 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data4) < 1){const err17 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(!pattern14.test(data4)){const err18 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.retryable !== undefined){if(typeof data.retryable !== "boolean"){const err20 = {instancePath:instancePath+"/retryable",schemaPath:"#/properties/retryable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.decisionId !== undefined){let data6 = data.decisionId;if(typeof data6 === "string"){if(func1(data6) > 240){const err21 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.limitClass !== undefined){let data7 = data.limitClass;if(!(((((data7 === "company_monthly") || (data7 === "actor_monthly")) || (data7 === "project_monthly")) || (data7 === "run_cost")) || (data7 === "provider_quota"))){const err25 = {instancePath:instancePath+"/limitClass",schemaPath:"#/properties/limitClass/enum",keyword:"enum",params:{allowedValues: schema195.properties.limitClass.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.aggregate !== undefined){let data8 = data.aggregate;if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.unit === undefined){const err26 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "unit"},message:"must have required property '"+"unit"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(data8.observed === undefined){const err27 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "observed"},message:"must have required property '"+"observed"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data8.limit === undefined){const err28 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "limit"},message:"must have required property '"+"limit"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data8.window === undefined){const err29 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "window"},message:"must have required property '"+"window"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data8.unit !== undefined){let data9 = data8.unit;if(!(((data9 === "cents") || (data9 === "usd_micros")) || (data9 === "tokens"))){const err30 = {instancePath:instancePath+"/aggregate/unit",schemaPath:"#/properties/aggregate/properties/unit/enum",keyword:"enum",params:{allowedValues: schema195.properties.aggregate.properties.unit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data8.observed !== undefined){let data10 = data8.observed;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){const err31 = {instancePath:instancePath+"/aggregate/observed",schemaPath:"#/properties/aggregate/properties/observed/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if((typeof data10 == "number") && (isFinite(data10))){if(data10 < 0 || isNaN(data10)){const err32 = {instancePath:instancePath+"/aggregate/observed",schemaPath:"#/properties/aggregate/properties/observed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}if(data8.limit !== undefined){let data11 = data8.limit;if(!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))){const err33 = {instancePath:instancePath+"/aggregate/limit",schemaPath:"#/properties/aggregate/properties/limit/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if((typeof data11 == "number") && (isFinite(data11))){if(data11 < 0 || isNaN(data11)){const err34 = {instancePath:instancePath+"/aggregate/limit",schemaPath:"#/properties/aggregate/properties/limit/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}if(data8.window !== undefined){let data12 = data8.window;if(!(((data12 === "run") || (data12 === "monthly_utc")) || (data12 === "provider_window"))){const err35 = {instancePath:instancePath+"/aggregate/window",schemaPath:"#/properties/aggregate/properties/window/enum",keyword:"enum",params:{allowedValues: schema195.properties.aggregate.properties.window.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}else {const err36 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.relatedReceiptIds !== undefined){let data13 = data.relatedReceiptIds;if(Array.isArray(data13)){const len0 = data13.length;for(let i0=0; i0 240){const err37 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(func1(data14) < 1){const err38 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(!pattern4.test(data14)){const err39 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}let i1 = data13.length;let j0;if(i1 > 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data13[i1], data13[j0])){const err41 = {instancePath:instancePath+"/relatedReceiptIds",schemaPath:"#/properties/relatedReceiptIds/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;break outer0;}}}}}else {const err42 = {instancePath:instancePath+"/relatedReceiptIds",schemaPath:"#/properties/relatedReceiptIds/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}else {const err43 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}validate105.errors = vErrors;return errors === 0;}validate105.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate104(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/terminal.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate104.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.turnTerminalState === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "turnTerminalState"},message:"must have required property '"+"turnTerminalState"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.runTerminalState === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runTerminalState"},message:"must have required property '"+"runTerminalState"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.reportedWorkDisposition === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reportedWorkDisposition"},message:"must have required property '"+"reportedWorkDisposition"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.schema !== undefined){if("paperclip.prp.terminal.v1" !== data.schema){const err4 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.terminal.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.turnTerminalState !== undefined){let data1 = data.turnTerminalState;if(!((((data1 === "completed") || (data1 === "failed")) || (data1 === "interrupted")) || (data1 === "cancelled"))){const err5 = {instancePath:instancePath+"/turnTerminalState",schemaPath:"#/properties/turnTerminalState/enum",keyword:"enum",params:{allowedValues: schema194.properties.turnTerminalState.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.runTerminalState !== undefined){let data2 = data.runTerminalState;if(!(((data2 === "succeeded") || (data2 === "failed")) || (data2 === "cancelled"))){const err6 = {instancePath:instancePath+"/runTerminalState",schemaPath:"#/properties/runTerminalState/enum",keyword:"enum",params:{allowedValues: schema194.properties.runTerminalState.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.reportedWorkDisposition !== undefined){let data3 = data.reportedWorkDisposition;if(!((((data3 === "done") || (data3 === "blocked")) || (data3 === "needs_review")) || (data3 === "yielded"))){const err7 = {instancePath:instancePath+"/reportedWorkDisposition",schemaPath:"#/properties/reportedWorkDisposition/enum",keyword:"enum",params:{allowedValues: schema194.properties.reportedWorkDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.workAssessmentId !== undefined){let data4 = data.workAssessmentId;if(typeof data4 === "string"){if(func1(data4) < 1){const err8 = {instancePath:instancePath+"/workAssessmentId",schemaPath:"#/properties/workAssessmentId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/workAssessmentId",schemaPath:"#/properties/workAssessmentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.statusDecisionId !== undefined){let data5 = data.statusDecisionId;if(typeof data5 === "string"){if(func1(data5) < 1){const err10 = {instancePath:instancePath+"/statusDecisionId",schemaPath:"#/properties/statusDecisionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/statusDecisionId",schemaPath:"#/properties/statusDecisionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.stopReason !== undefined){if(!(validate105(data.stopReason, {instancePath:instancePath+"/stopReason",parentData:data,parentDataProperty:"stopReason",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate105.errors : vErrors.concat(validate105.errors);errors = vErrors.length;}}}else {const err12 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}validate104.errors = vErrors;return errors === 0;}validate104.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const pattern69 = new RegExp("^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$", "u");const formats0 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;function validate26(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/event.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate26.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("plan.updated" !== data.eventType){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate60(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate60.errors : vErrors.concat(validate60.errors);errors = vErrors.length;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props0 = {};props0.payload = true;props0.eventType = true;}}if(!valid1){const err1 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}const _errs8 = errors;let valid4 = true;const _errs9 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data2 = data.eventType;if(!(((data2 === "tool.execution.started") || (data2 === "tool.execution.progressed")) || (data2 === "tool.execution.completed"))){const err2 = {};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}}var _valid1 = _errs9 === errors;errors = _errs8;if(vErrors !== null){if(_errs8){vErrors.length = _errs8;}else {vErrors = null;}}if(_valid1){const _errs11 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate62(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);errors = vErrors.length;}}}var _valid1 = _errs11 === errors;valid4 = _valid1;if(valid4){var props1 = {};props1.payload = true;props1.eventType = true;}}if(!valid4){const err3 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(props0 !== true && props1 !== undefined){if(props1 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props1);}}const _errs14 = errors;let valid7 = true;const _errs15 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data4 = data.eventType;if(!(((data4 === "research.started") || (data4 === "research.progressed")) || (data4 === "research.completed"))){const err4 = {};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}}var _valid2 = _errs15 === errors;errors = _errs14;if(vErrors !== null){if(_errs14){vErrors.length = _errs14;}else {vErrors = null;}}if(_valid2){const _errs17 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate64(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors);errors = vErrors.length;}}}var _valid2 = _errs17 === errors;valid7 = _valid2;if(valid7){var props2 = {};props2.payload = true;props2.eventType = true;}}if(!valid7){const err5 = {instancePath,schemaPath:"#/allOf/2/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(props0 !== true && props2 !== undefined){if(props2 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props2);}}const _errs20 = errors;let valid10 = true;const _errs21 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data6 = data.eventType;if(!(((data6 === "delegation.started") || (data6 === "delegation.updated")) || (data6 === "delegation.completed"))){const err6 = {};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}var _valid3 = _errs21 === errors;errors = _errs20;if(vErrors !== null){if(_errs20){vErrors.length = _errs20;}else {vErrors = null;}}if(_valid3){const _errs23 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate66(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate66.errors : vErrors.concat(validate66.errors);errors = vErrors.length;}}}var _valid3 = _errs23 === errors;valid10 = _valid3;if(valid10){var props3 = {};props3.payload = true;props3.eventType = true;}}if(!valid10){const err7 = {instancePath,schemaPath:"#/allOf/3/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(props0 !== true && props3 !== undefined){if(props3 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props3);}}const _errs26 = errors;let valid13 = true;const _errs27 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("model.route.changed" !== data.eventType){const err8 = {};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}}var _valid4 = _errs27 === errors;errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}if(_valid4){const _errs29 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate68(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors);errors = vErrors.length;}}}var _valid4 = _errs29 === errors;valid13 = _valid4;if(valid13){var props4 = {};props4.payload = true;props4.eventType = true;}}if(!valid13){const err9 = {instancePath,schemaPath:"#/allOf/4/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(props0 !== true && props4 !== undefined){if(props4 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props4);}}const _errs32 = errors;let valid16 = true;const _errs33 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("model.verification.updated" !== data.eventType){const err10 = {};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}}var _valid5 = _errs33 === errors;errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}if(_valid5){const _errs35 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate70(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate70.errors : vErrors.concat(validate70.errors);errors = vErrors.length;}}}var _valid5 = _errs35 === errors;valid16 = _valid5;if(valid16){var props5 = {};props5.payload = true;props5.eventType = true;}}if(!valid16){const err11 = {instancePath,schemaPath:"#/allOf/5/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(props0 !== true && props5 !== undefined){if(props5 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props5);}}const _errs38 = errors;let valid19 = true;const _errs39 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("context.compacted" !== data.eventType){const err12 = {};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}var _valid6 = _errs39 === errors;errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}if(_valid6){const _errs41 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate72(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate72.errors : vErrors.concat(validate72.errors);errors = vErrors.length;}}}var _valid6 = _errs41 === errors;valid19 = _valid6;if(valid19){var props6 = {};props6.payload = true;props6.eventType = true;}}if(!valid19){const err13 = {instancePath,schemaPath:"#/allOf/6/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(props0 !== true && props6 !== undefined){if(props6 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props6);}}const _errs44 = errors;let valid22 = true;const _errs45 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("artifact.viewed" !== data.eventType){const err14 = {};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}var _valid7 = _errs45 === errors;errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}if(_valid7){const _errs47 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate74(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate74.errors : vErrors.concat(validate74.errors);errors = vErrors.length;}}}var _valid7 = _errs47 === errors;valid22 = _valid7;if(valid22){var props7 = {};props7.payload = true;props7.eventType = true;}}if(!valid22){const err15 = {instancePath,schemaPath:"#/allOf/7/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(props0 !== true && props7 !== undefined){if(props7 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props7);}}const _errs50 = errors;let valid25 = true;const _errs51 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("artifact.generated" !== data.eventType){const err16 = {};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}var _valid8 = _errs51 === errors;errors = _errs50;if(vErrors !== null){if(_errs50){vErrors.length = _errs50;}else {vErrors = null;}}if(_valid8){const _errs53 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate76(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate76.errors : vErrors.concat(validate76.errors);errors = vErrors.length;}}}var _valid8 = _errs53 === errors;valid25 = _valid8;if(valid25){var props8 = {};props8.payload = true;props8.eventType = true;}}if(!valid25){const err17 = {instancePath,schemaPath:"#/allOf/8/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(props0 !== true && props8 !== undefined){if(props8 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props8);}}const _errs56 = errors;let valid28 = true;const _errs57 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("review.mode.changed" !== data.eventType){const err18 = {};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}var _valid9 = _errs57 === errors;errors = _errs56;if(vErrors !== null){if(_errs56){vErrors.length = _errs56;}else {vErrors = null;}}if(_valid9){const _errs59 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate78(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate78.errors : vErrors.concat(validate78.errors);errors = vErrors.length;}}}var _valid9 = _errs59 === errors;valid28 = _valid9;if(valid28){var props9 = {};props9.payload = true;props9.eventType = true;}}if(!valid28){const err19 = {instancePath,schemaPath:"#/allOf/9/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(props0 !== true && props9 !== undefined){if(props9 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props9);}}const _errs62 = errors;let valid31 = true;const _errs63 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data20 = data.eventType;if(!((data20 === "hook.started") || (data20 === "hook.completed"))){const err20 = {};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}var _valid10 = _errs63 === errors;errors = _errs62;if(vErrors !== null){if(_errs62){vErrors.length = _errs62;}else {vErrors = null;}}if(_valid10){const _errs65 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate80(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate80.errors : vErrors.concat(validate80.errors);errors = vErrors.length;}}}var _valid10 = _errs65 === errors;valid31 = _valid10;if(valid31){var props10 = {};props10.payload = true;props10.eventType = true;}}if(!valid31){const err21 = {instancePath,schemaPath:"#/allOf/10/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(props0 !== true && props10 !== undefined){if(props10 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props10);}}const _errs68 = errors;let valid34 = true;const _errs69 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("memory.citation.referenced" !== data.eventType){const err22 = {};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}var _valid11 = _errs69 === errors;errors = _errs68;if(vErrors !== null){if(_errs68){vErrors.length = _errs68;}else {vErrors = null;}}if(_valid11){const _errs71 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate82(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate82.errors : vErrors.concat(validate82.errors);errors = vErrors.length;}}}var _valid11 = _errs71 === errors;valid34 = _valid11;if(valid34){var props11 = {};props11.payload = true;props11.eventType = true;}}if(!valid34){const err23 = {instancePath,schemaPath:"#/allOf/11/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(props0 !== true && props11 !== undefined){if(props11 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props11);}}const _errs74 = errors;let valid37 = true;const _errs75 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data24 = data.eventType;if(!((data24 === "safety.review.started") || (data24 === "safety.review.completed"))){const err24 = {};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}var _valid12 = _errs75 === errors;errors = _errs74;if(vErrors !== null){if(_errs74){vErrors.length = _errs74;}else {vErrors = null;}}if(_valid12){const _errs77 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate84(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate84.errors : vErrors.concat(validate84.errors);errors = vErrors.length;}}}var _valid12 = _errs77 === errors;valid37 = _valid12;if(valid37){var props12 = {};props12.payload = true;props12.eventType = true;}}if(!valid37){const err25 = {instancePath,schemaPath:"#/allOf/12/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(props0 !== true && props12 !== undefined){if(props12 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props12);}}const _errs80 = errors;let valid40 = true;const _errs81 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("terminal.input.sent" !== data.eventType){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}var _valid13 = _errs81 === errors;errors = _errs80;if(vErrors !== null){if(_errs80){vErrors.length = _errs80;}else {vErrors = null;}}if(_valid13){const _errs83 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate86(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate86.errors : vErrors.concat(validate86.errors);errors = vErrors.length;}}}var _valid13 = _errs83 === errors;valid40 = _valid13;if(valid40){var props13 = {};props13.payload = true;props13.eventType = true;}}if(!valid40){const err27 = {instancePath,schemaPath:"#/allOf/13/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(props0 !== true && props13 !== undefined){if(props13 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props13);}}const _errs86 = errors;let valid43 = true;const _errs87 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data28 = data.eventType;if(!((data28 === "wait.started") || (data28 === "wait.completed"))){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}var _valid14 = _errs87 === errors;errors = _errs86;if(vErrors !== null){if(_errs86){vErrors.length = _errs86;}else {vErrors = null;}}if(_valid14){const _errs89 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate88(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate88.errors : vErrors.concat(validate88.errors);errors = vErrors.length;}}}var _valid14 = _errs89 === errors;valid43 = _valid14;if(valid43){var props14 = {};props14.payload = true;props14.eventType = true;}}if(!valid43){const err29 = {instancePath,schemaPath:"#/allOf/14/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(props0 !== true && props14 !== undefined){if(props14 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props14);}}const _errs92 = errors;let valid46 = true;const _errs93 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("provider.notice.recorded" !== data.eventType){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}}var _valid15 = _errs93 === errors;errors = _errs92;if(vErrors !== null){if(_errs92){vErrors.length = _errs92;}else {vErrors = null;}}if(_valid15){const _errs95 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate90(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate90.errors : vErrors.concat(validate90.errors);errors = vErrors.length;}}}var _valid15 = _errs95 === errors;valid46 = _valid15;if(valid46){var props15 = {};props15.payload = true;props15.eventType = true;}}if(!valid46){const err31 = {instancePath,schemaPath:"#/allOf/15/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(props0 !== true && props15 !== undefined){if(props15 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props15);}}const _errs98 = errors;let valid49 = true;const _errs99 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("workspace.file.referenced" !== data.eventType){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}var _valid16 = _errs99 === errors;errors = _errs98;if(vErrors !== null){if(_errs98){vErrors.length = _errs98;}else {vErrors = null;}}if(_valid16){const _errs101 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data33 = data.payload;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.schema === undefined){const err33 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data33.referenceId === undefined){const err34 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "referenceId"},message:"must have required property '"+"referenceId"+"'"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if(data33.source === undefined){const err35 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(data33.path === undefined){const err36 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "path"},message:"must have required property '"+"path"+"'"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(data33.displayName === undefined){const err37 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "displayName"},message:"must have required property '"+"displayName"+"'"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(data33.mediaType === undefined){const err38 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(data33.presentation === undefined){const err39 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "presentation"},message:"must have required property '"+"presentation"+"'"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(data33.line === undefined){const err40 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "line"},message:"must have required property '"+"line"+"'"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(data33.preview === undefined){const err41 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "preview"},message:"must have required property '"+"preview"+"'"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data33.previewTruncated === undefined){const err42 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "previewTruncated"},message:"must have required property '"+"previewTruncated"+"'"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(data33.contentDigest === undefined){const err43 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "contentDigest"},message:"must have required property '"+"contentDigest"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key0 in data33){if(!(func58.call(schema171.properties, key0))){const err44 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data33.schema !== undefined){if("paperclip.workspace.file_reference.v1" !== data33.schema){const err45 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.file_reference.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data33.referenceId !== undefined){let data35 = data33.referenceId;if(typeof data35 === "string"){if(func1(data35) > 240){const err46 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(func1(data35) < 1){const err47 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}else {const err48 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data33.source !== undefined){let data36 = data33.source;if(!((data36 === "harness_reported") || (data36 === "runner_verified"))){const err49 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema171.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data33.path !== undefined){let data37 = data33.path;if(typeof data37 === "string"){if(func1(data37) > 1024){const err50 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(func1(data37) < 1){const err51 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}if(!pattern69.test(data37)){const err52 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}else {const err53 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data33.displayName !== undefined){let data38 = data33.displayName;if(typeof data38 === "string"){if(func1(data38) > 255){const err54 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/maxLength",keyword:"maxLength",params:{limit: 255},message:"must NOT have more than 255 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}if(func1(data38) < 1){const err55 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}else {const err56 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data33.mediaType !== undefined){let data39 = data33.mediaType;if((typeof data39 !== "string") && (data39 !== null)){const err57 = {instancePath:instancePath+"/payload/mediaType",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/mediaType/type",keyword:"type",params:{type: schema171.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}if(typeof data39 === "string"){if(func1(data39) > 160){const err58 = {instancePath:instancePath+"/payload/mediaType",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}if(data33.presentation !== undefined){let data40 = data33.presentation;if(!((((data40 === "document") || (data40 === "code")) || (data40 === "image")) || (data40 === "generic"))){const err59 = {instancePath:instancePath+"/payload/presentation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/presentation/enum",keyword:"enum",params:{allowedValues: schema171.properties.presentation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data33.line !== undefined){let data41 = data33.line;if((!(((typeof data41 == "number") && (!(data41 % 1) && !isNaN(data41))) && (isFinite(data41)))) && (data41 !== null)){const err60 = {instancePath:instancePath+"/payload/line",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/line/type",keyword:"type",params:{type: schema171.properties.line.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if((typeof data41 == "number") && (isFinite(data41))){if(data41 < 1 || isNaN(data41)){const err61 = {instancePath:instancePath+"/payload/line",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}}if(data33.preview !== undefined){let data42 = data33.preview;if((typeof data42 !== "string") && (data42 !== null)){const err62 = {instancePath:instancePath+"/payload/preview",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/preview/type",keyword:"type",params:{type: schema171.properties.preview.type},message:"must be string,null"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(typeof data42 === "string"){if(func1(data42) > 262144){const err63 = {instancePath:instancePath+"/payload/preview",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/preview/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}}if(data33.previewTruncated !== undefined){if(typeof data33.previewTruncated !== "boolean"){const err64 = {instancePath:instancePath+"/payload/previewTruncated",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/previewTruncated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data33.contentDigest !== undefined){let data44 = data33.contentDigest;const _errs124 = errors;let valid54 = false;let passing0 = null;const _errs125 = errors;if(data44 !== null){const err65 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}var _valid17 = _errs125 === errors;if(_valid17){valid54 = true;passing0 = 0;}const _errs127 = errors;if(typeof data44 === "string"){if(!pattern19.test(data44)){const err66 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}else {const err67 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}var _valid17 = _errs127 === errors;if(_valid17 && valid54){valid54 = false;passing0 = [passing0, 1];}else {if(_valid17){valid54 = true;passing0 = 1;}}if(!valid54){const err68 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}else {errors = _errs124;if(vErrors !== null){if(_errs124){vErrors.length = _errs124;}else {vErrors = null;}}}}}else {const err69 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}var _valid16 = _errs101 === errors;valid49 = _valid16;if(valid49){var props16 = {};props16.payload = true;props16.eventType = true;}}if(!valid49){const err70 = {instancePath,schemaPath:"#/allOf/16/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(props0 !== true && props16 !== undefined){if(props16 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props16);}}const _errs130 = errors;let valid55 = true;const _errs131 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data45 = data.eventType;if(!((data45 === "workspace.change.updated") || (data45 === "workspace.diff.recorded"))){const err71 = {};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}var _valid18 = _errs131 === errors;errors = _errs130;if(vErrors !== null){if(_errs130){vErrors.length = _errs130;}else {vErrors = null;}}if(_valid18){const _errs133 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data46 = data.payload;if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.schema === undefined){const err72 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(data46.changeSetId === undefined){const err73 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "changeSetId"},message:"must have required property '"+"changeSetId"+"'"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(data46.revision === undefined){const err74 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}if(data46.source === undefined){const err75 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(data46.complete === undefined){const err76 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data46.files === undefined){const err77 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data46.totals === undefined){const err78 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "totals"},message:"must have required property '"+"totals"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data46.patchArtifactRef === undefined){const err79 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "patchArtifactRef"},message:"must have required property '"+"patchArtifactRef"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}for(const key1 in data46){if(!((((((((key1 === "schema") || (key1 === "changeSetId")) || (key1 === "revision")) || (key1 === "source")) || (key1 === "complete")) || (key1 === "files")) || (key1 === "totals")) || (key1 === "patchArtifactRef"))){const err80 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data46.schema !== undefined){if("paperclip.workspace.diff.v1" !== data46.schema){const err81 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.diff.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data46.changeSetId !== undefined){let data48 = data46.changeSetId;if(typeof data48 === "string"){if(func1(data48) > 200){const err82 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func1(data48) < 1){const err83 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data46.revision !== undefined){let data49 = data46.revision;if(!(((typeof data49 == "number") && (!(data49 % 1) && !isNaN(data49))) && (isFinite(data49)))){const err85 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}if((typeof data49 == "number") && (isFinite(data49))){if(data49 < 1 || isNaN(data49)){const err86 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}}if(data46.source !== undefined){let data50 = data46.source;if(!((data50 === "harness_reported") || (data50 === "runner_verified"))){const err87 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema172.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data46.complete !== undefined){if(typeof data46.complete !== "boolean"){const err88 = {instancePath:instancePath+"/payload/complete",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data46.files !== undefined){let data52 = data46.files;if(Array.isArray(data52)){if(data52.length > 2000){const err89 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/maxItems",keyword:"maxItems",params:{limit: 2000},message:"must NOT have more than 2000 items"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}const len0 = data52.length;for(let i0=0; i0 1024){const err98 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}if(func1(data54) < 1){const err99 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(!pattern69.test(data54)){const err100 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data53.operation !== undefined){let data55 = data53.operation;if(!(((((data55 === "create") || (data55 === "modify")) || (data55 === "delete")) || (data55 === "rename")) || (data55 === "mode_change"))){const err102 = {instancePath:instancePath+"/payload/files/" + i0+"/operation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/operation/enum",keyword:"enum",params:{allowedValues: schema172.properties.files.items.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data53.previousPath !== undefined){let data56 = data53.previousPath;const _errs155 = errors;let valid63 = false;let passing1 = null;const _errs156 = errors;if(data56 !== null){const err103 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}var _valid19 = _errs156 === errors;if(_valid19){valid63 = true;passing1 = 0;}const _errs158 = errors;if(typeof data56 === "string"){if(func1(data56) > 1024){const err104 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(func1(data56) < 1){const err105 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(!pattern69.test(data56)){const err106 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}else {const err107 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}var _valid19 = _errs158 === errors;if(_valid19 && valid63){valid63 = false;passing1 = [passing1, 1];}else {if(_valid19){valid63 = true;passing1 = 1;}}if(!valid63){const err108 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}else {errors = _errs155;if(vErrors !== null){if(_errs155){vErrors.length = _errs155;}else {vErrors = null;}}}}if(data53.additions !== undefined){let data57 = data53.additions;if((!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))) && (data57 !== null)){const err109 = {instancePath:instancePath+"/payload/files/" + i0+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/type",keyword:"type",params:{type: schema172.properties.files.items.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 < 0 || isNaN(data57)){const err110 = {instancePath:instancePath+"/payload/files/" + i0+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}}if(data53.deletions !== undefined){let data58 = data53.deletions;if((!(((typeof data58 == "number") && (!(data58 % 1) && !isNaN(data58))) && (isFinite(data58)))) && (data58 !== null)){const err111 = {instancePath:instancePath+"/payload/files/" + i0+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/type",keyword:"type",params:{type: schema172.properties.files.items.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 0 || isNaN(data58)){const err112 = {instancePath:instancePath+"/payload/files/" + i0+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}}if(data53.binary !== undefined){if(typeof data53.binary !== "boolean"){const err113 = {instancePath:instancePath+"/payload/files/" + i0+"/binary",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/binary/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data53.diff !== undefined){let data60 = data53.diff;if((typeof data60 !== "string") && (data60 !== null)){const err114 = {instancePath:instancePath+"/payload/files/" + i0+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/type",keyword:"type",params:{type: schema172.properties.files.items.properties.diff.type},message:"must be string,null"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(typeof data60 === "string"){if(func1(data60) > 262144){const err115 = {instancePath:instancePath+"/payload/files/" + i0+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}}}else {const err116 = {instancePath:instancePath+"/payload/files/" + i0,schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}if(data46.totals !== undefined){let data61 = data46.totals;if(data61 && typeof data61 == "object" && !Array.isArray(data61)){if(data61.files === undefined){const err118 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(data61.additions === undefined){const err119 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "additions"},message:"must have required property '"+"additions"+"'"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}if(data61.deletions === undefined){const err120 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "deletions"},message:"must have required property '"+"deletions"+"'"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}for(const key3 in data61){if(!(((key3 === "files") || (key3 === "additions")) || (key3 === "deletions"))){const err121 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}if(data61.files !== undefined){let data62 = data61.files;if(!(((typeof data62 == "number") && (!(data62 % 1) && !isNaN(data62))) && (isFinite(data62)))){const err122 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if((typeof data62 == "number") && (isFinite(data62))){if(data62 < 0 || isNaN(data62)){const err123 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}}if(data61.additions !== undefined){let data63 = data61.additions;if((!(((typeof data63 == "number") && (!(data63 % 1) && !isNaN(data63))) && (isFinite(data63)))) && (data63 !== null)){const err124 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/type",keyword:"type",params:{type: schema172.properties.totals.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if((typeof data63 == "number") && (isFinite(data63))){if(data63 < 0 || isNaN(data63)){const err125 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}if(data61.deletions !== undefined){let data64 = data61.deletions;if((!(((typeof data64 == "number") && (!(data64 % 1) && !isNaN(data64))) && (isFinite(data64)))) && (data64 !== null)){const err126 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/type",keyword:"type",params:{type: schema172.properties.totals.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if((typeof data64 == "number") && (isFinite(data64))){if(data64 < 0 || isNaN(data64)){const err127 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}}}else {const err128 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data46.patchArtifactRef !== undefined){let data65 = data46.patchArtifactRef;if((typeof data65 !== "string") && (data65 !== null)){const err129 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/type",keyword:"type",params:{type: schema172.properties.patchArtifactRef.type},message:"must be string,null"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(typeof data65 === "string"){if(func1(data65) > 2048){const err130 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}}else {const err131 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}}var _valid18 = _errs133 === errors;valid55 = _valid18;if(valid55){var props17 = {};props17.payload = true;props17.eventType = true;}}if(!valid55){const err132 = {instancePath,schemaPath:"#/allOf/17/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(props0 !== true && props17 !== undefined){if(props17 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props17);}}const _errs180 = errors;let valid65 = true;const _errs181 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("workspace.diff.recorded" !== data.eventType){const err133 = {};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}}var _valid20 = _errs181 === errors;errors = _errs180;if(vErrors !== null){if(_errs180){vErrors.length = _errs180;}else {vErrors = null;}}if(_valid20){const _errs183 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data67 = data.payload;if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.schema === undefined){const err134 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(data67.changeSetId === undefined){const err135 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "changeSetId"},message:"must have required property '"+"changeSetId"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data67.revision === undefined){const err136 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data67.source === undefined){const err137 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(data67.complete === undefined){const err138 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data67.files === undefined){const err139 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if(data67.totals === undefined){const err140 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "totals"},message:"must have required property '"+"totals"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data67.patchArtifactRef === undefined){const err141 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "patchArtifactRef"},message:"must have required property '"+"patchArtifactRef"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}for(const key4 in data67){if(!((((((((key4 === "schema") || (key4 === "changeSetId")) || (key4 === "revision")) || (key4 === "source")) || (key4 === "complete")) || (key4 === "files")) || (key4 === "totals")) || (key4 === "patchArtifactRef"))){const err142 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data67.schema !== undefined){if("paperclip.workspace.diff.v1" !== data67.schema){const err143 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.diff.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data67.changeSetId !== undefined){let data69 = data67.changeSetId;if(typeof data69 === "string"){if(func1(data69) > 200){const err144 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}if(func1(data69) < 1){const err145 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data67.revision !== undefined){let data70 = data67.revision;if(!(((typeof data70 == "number") && (!(data70 % 1) && !isNaN(data70))) && (isFinite(data70)))){const err147 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data70 == "number") && (isFinite(data70))){if(data70 < 1 || isNaN(data70)){const err148 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}if(data67.source !== undefined){let data71 = data67.source;if(!((data71 === "harness_reported") || (data71 === "runner_verified"))){const err149 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema172.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data67.complete !== undefined){if(typeof data67.complete !== "boolean"){const err150 = {instancePath:instancePath+"/payload/complete",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(data67.files !== undefined){let data73 = data67.files;if(Array.isArray(data73)){if(data73.length > 2000){const err151 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/maxItems",keyword:"maxItems",params:{limit: 2000},message:"must NOT have more than 2000 items"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}const len1 = data73.length;for(let i1=0; i1 1024){const err160 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(func1(data75) < 1){const err161 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}if(!pattern69.test(data75)){const err162 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data74.operation !== undefined){let data76 = data74.operation;if(!(((((data76 === "create") || (data76 === "modify")) || (data76 === "delete")) || (data76 === "rename")) || (data76 === "mode_change"))){const err164 = {instancePath:instancePath+"/payload/files/" + i1+"/operation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/operation/enum",keyword:"enum",params:{allowedValues: schema172.properties.files.items.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data74.previousPath !== undefined){let data77 = data74.previousPath;const _errs206 = errors;let valid74 = false;let passing2 = null;const _errs207 = errors;if(data77 !== null){const err165 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}var _valid21 = _errs207 === errors;if(_valid21){valid74 = true;passing2 = 0;}const _errs209 = errors;if(typeof data77 === "string"){if(func1(data77) > 1024){const err166 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(func1(data77) < 1){const err167 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}if(!pattern69.test(data77)){const err168 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}var _valid21 = _errs209 === errors;if(_valid21 && valid74){valid74 = false;passing2 = [passing2, 1];}else {if(_valid21){valid74 = true;passing2 = 1;}}if(!valid74){const err170 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf",keyword:"oneOf",params:{passingSchemas: passing2},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}else {errors = _errs206;if(vErrors !== null){if(_errs206){vErrors.length = _errs206;}else {vErrors = null;}}}}if(data74.additions !== undefined){let data78 = data74.additions;if((!(((typeof data78 == "number") && (!(data78 % 1) && !isNaN(data78))) && (isFinite(data78)))) && (data78 !== null)){const err171 = {instancePath:instancePath+"/payload/files/" + i1+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/type",keyword:"type",params:{type: schema172.properties.files.items.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}if((typeof data78 == "number") && (isFinite(data78))){if(data78 < 0 || isNaN(data78)){const err172 = {instancePath:instancePath+"/payload/files/" + i1+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}}if(data74.deletions !== undefined){let data79 = data74.deletions;if((!(((typeof data79 == "number") && (!(data79 % 1) && !isNaN(data79))) && (isFinite(data79)))) && (data79 !== null)){const err173 = {instancePath:instancePath+"/payload/files/" + i1+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/type",keyword:"type",params:{type: schema172.properties.files.items.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}if((typeof data79 == "number") && (isFinite(data79))){if(data79 < 0 || isNaN(data79)){const err174 = {instancePath:instancePath+"/payload/files/" + i1+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}}if(data74.binary !== undefined){if(typeof data74.binary !== "boolean"){const err175 = {instancePath:instancePath+"/payload/files/" + i1+"/binary",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/binary/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data74.diff !== undefined){let data81 = data74.diff;if((typeof data81 !== "string") && (data81 !== null)){const err176 = {instancePath:instancePath+"/payload/files/" + i1+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/type",keyword:"type",params:{type: schema172.properties.files.items.properties.diff.type},message:"must be string,null"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(typeof data81 === "string"){if(func1(data81) > 262144){const err177 = {instancePath:instancePath+"/payload/files/" + i1+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}}}else {const err178 = {instancePath:instancePath+"/payload/files/" + i1,schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}else {const err179 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data67.totals !== undefined){let data82 = data67.totals;if(data82 && typeof data82 == "object" && !Array.isArray(data82)){if(data82.files === undefined){const err180 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}if(data82.additions === undefined){const err181 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "additions"},message:"must have required property '"+"additions"+"'"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}if(data82.deletions === undefined){const err182 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "deletions"},message:"must have required property '"+"deletions"+"'"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}for(const key6 in data82){if(!(((key6 === "files") || (key6 === "additions")) || (key6 === "deletions"))){const err183 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}if(data82.files !== undefined){let data83 = data82.files;if(!(((typeof data83 == "number") && (!(data83 % 1) && !isNaN(data83))) && (isFinite(data83)))){const err184 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}if((typeof data83 == "number") && (isFinite(data83))){if(data83 < 0 || isNaN(data83)){const err185 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}}if(data82.additions !== undefined){let data84 = data82.additions;if((!(((typeof data84 == "number") && (!(data84 % 1) && !isNaN(data84))) && (isFinite(data84)))) && (data84 !== null)){const err186 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/type",keyword:"type",params:{type: schema172.properties.totals.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if((typeof data84 == "number") && (isFinite(data84))){if(data84 < 0 || isNaN(data84)){const err187 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}}if(data82.deletions !== undefined){let data85 = data82.deletions;if((!(((typeof data85 == "number") && (!(data85 % 1) && !isNaN(data85))) && (isFinite(data85)))) && (data85 !== null)){const err188 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/type",keyword:"type",params:{type: schema172.properties.totals.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}if((typeof data85 == "number") && (isFinite(data85))){if(data85 < 0 || isNaN(data85)){const err189 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}}else {const err190 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data67.patchArtifactRef !== undefined){let data86 = data67.patchArtifactRef;if((typeof data86 !== "string") && (data86 !== null)){const err191 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/type",keyword:"type",params:{type: schema172.properties.patchArtifactRef.type},message:"must be string,null"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(typeof data86 === "string"){if(func1(data86) > 2048){const err192 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}}}else {const err193 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.complete !== undefined){if(true !== data67.complete){const err194 = {instancePath:instancePath+"/payload/complete",schemaPath:"#/allOf/18/then/properties/payload/allOf/1/properties/complete/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}}else {const err195 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/18/then/properties/payload/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}}var _valid20 = _errs183 === errors;valid65 = _valid20;if(valid65){var props18 = {};props18.payload = true;props18.eventType = true;}}if(!valid65){const err196 = {instancePath,schemaPath:"#/allOf/18/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(props0 !== true && props18 !== undefined){if(props18 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props18);}}const _errs234 = errors;let valid77 = true;const _errs235 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data88 = data.eventType;if(!((data88 === "semantic_tool.input") || (data88 === "mcp_app.tool_input"))){const err197 = {};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}}var _valid22 = _errs235 === errors;errors = _errs234;if(vErrors !== null){if(_errs234){vErrors.length = _errs234;}else {vErrors = null;}}if(_valid22){const _errs237 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data89 = data.payload;if(data89 && typeof data89 == "object" && !Array.isArray(data89)){if(data89.semantic_tool !== undefined){let data90 = data89.semantic_tool;if(!(validate92(data90, {instancePath:instancePath+"/payload/semantic_tool",parentData:data89,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate92.errors : vErrors.concat(validate92.errors);errors = vErrors.length;}if(data90 && typeof data90 == "object" && !Array.isArray(data90)){if(data90.phase !== undefined){if("input" !== data90.phase){const err198 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/19/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "input"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}}else {const err199 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/19/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}}else {const err200 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/19/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}}var _valid22 = _errs237 === errors;valid77 = _valid22;if(valid77){var props19 = {};props19.payload = true;props19.eventType = true;}}if(!valid77){const err201 = {instancePath,schemaPath:"#/allOf/19/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}if(props0 !== true && props19 !== undefined){if(props19 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props19);}}const _errs247 = errors;let valid83 = true;const _errs248 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data92 = data.eventType;if(!((data92 === "semantic_tool.result") || (data92 === "mcp_app.tool_result"))){const err202 = {};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}}var _valid23 = _errs248 === errors;errors = _errs247;if(vErrors !== null){if(_errs247){vErrors.length = _errs247;}else {vErrors = null;}}if(_valid23){const _errs250 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data93 = data.payload;if(data93 && typeof data93 == "object" && !Array.isArray(data93)){if(data93.semantic_tool !== undefined){let data94 = data93.semantic_tool;if(!(validate92(data94, {instancePath:instancePath+"/payload/semantic_tool",parentData:data93,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate92.errors : vErrors.concat(validate92.errors);errors = vErrors.length;}if(data94 && typeof data94 == "object" && !Array.isArray(data94)){if(data94.phase !== undefined){if("result" !== data94.phase){const err203 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/20/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "result"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}}else {const err204 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/20/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}}else {const err205 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/20/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}}var _valid23 = _errs250 === errors;valid83 = _valid23;if(valid83){var props20 = {};props20.payload = true;props20.eventType = true;}}if(!valid83){const err206 = {instancePath,schemaPath:"#/allOf/20/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}if(props0 !== true && props20 !== undefined){if(props20 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props20);}}const _errs260 = errors;let valid89 = true;const _errs261 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("semantic_tool.reconciled" !== data.eventType){const err207 = {};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}}var _valid24 = _errs261 === errors;errors = _errs260;if(vErrors !== null){if(_errs260){vErrors.length = _errs260;}else {vErrors = null;}}if(_valid24){const _errs263 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data97 = data.payload;if(data97 && typeof data97 == "object" && !Array.isArray(data97)){if(data97.semantic_tool !== undefined){let data98 = data97.semantic_tool;if(!(validate92(data98, {instancePath:instancePath+"/payload/semantic_tool",parentData:data97,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate92.errors : vErrors.concat(validate92.errors);errors = vErrors.length;}if(data98 && typeof data98 == "object" && !Array.isArray(data98)){if(data98.phase !== undefined){if("reconciled" !== data98.phase){const err208 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/21/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "reconciled"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}}else {const err209 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/21/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}}else {const err210 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/21/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}var _valid24 = _errs263 === errors;valid89 = _valid24;if(valid89){var props21 = {};props21.payload = true;props21.eventType = true;}}if(!valid89){const err211 = {instancePath,schemaPath:"#/allOf/21/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}if(props0 !== true && props21 !== undefined){if(props21 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props21);}}const _errs273 = errors;let valid95 = true;const _errs274 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("run.terminal" !== data.eventType){const err212 = {};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}}var _valid25 = _errs274 === errors;errors = _errs273;if(vErrors !== null){if(_errs273){vErrors.length = _errs273;}else {vErrors = null;}}if(_valid25){const _errs276 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate104(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate104.errors : vErrors.concat(validate104.errors);errors = vErrors.length;}}}var _valid25 = _errs276 === errors;valid95 = _valid25;if(valid95){var props22 = {};props22.payload = true;props22.eventType = true;}}if(!valid95){const err213 = {instancePath,schemaPath:"#/allOf/22/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}if(props0 !== true && props22 !== undefined){if(props22 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props22);}}const _errs279 = errors;let valid98 = true;const _errs280 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("run.result.proposed" !== data.eventType){const err214 = {};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}}var _valid26 = _errs280 === errors;errors = _errs279;if(vErrors !== null){if(_errs279){vErrors.length = _errs279;}else {vErrors = null;}}if(_valid26){const _errs282 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data103 = data.payload;const _errs287 = errors;let valid103 = true;const _errs288 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.reportedWorkDisposition !== undefined){if("blocked" !== data103.reportedWorkDisposition){const err215 = {};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}}var _valid27 = _errs288 === errors;errors = _errs287;if(vErrors !== null){if(_errs287){vErrors.length = _errs287;}else {vErrors = null;}}if(_valid27){const _errs290 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.blocker === undefined){const err216 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/0/then/required",keyword:"required",params:{missingProperty: "blocker"},message:"must have required property '"+"blocker"+"'"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}var _valid27 = _errs290 === errors;valid103 = _valid27;}if(!valid103){const err217 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}const _errs292 = errors;let valid105 = true;const _errs293 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.reportedWorkDisposition !== undefined){if("yielded" !== data103.reportedWorkDisposition){const err218 = {};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}}var _valid28 = _errs293 === errors;errors = _errs292;if(vErrors !== null){if(_errs292){vErrors.length = _errs292;}else {vErrors = null;}}if(_valid28){const _errs295 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.continuation === undefined){const err219 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/1/then/required",keyword:"required",params:{missingProperty: "continuation"},message:"must have required property '"+"continuation"+"'"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}var _valid28 = _errs295 === errors;valid105 = _valid28;}if(!valid105){const err220 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.schema === undefined){const err221 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if(data103.reportedWorkDisposition === undefined){const err222 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "reportedWorkDisposition"},message:"must have required property '"+"reportedWorkDisposition"+"'"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}if(data103.summary === undefined){const err223 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}if(data103.completionClaim === undefined){const err224 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "completionClaim"},message:"must have required property '"+"completionClaim"+"'"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}if(data103.evidence === undefined){const err225 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "evidence"},message:"must have required property '"+"evidence"+"'"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}if(data103.verification === undefined){const err226 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "verification"},message:"must have required property '"+"verification"+"'"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data103.attentionRequests === undefined){const err227 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "attentionRequests"},message:"must have required property '"+"attentionRequests"+"'"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}if(data103.artifacts === undefined){const err228 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "artifacts"},message:"must have required property '"+"artifacts"+"'"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}if(data103.schema !== undefined){if("paperclip.run_result.v1" !== data103.schema){const err229 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.run_result.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}if(data103.reportedWorkDisposition !== undefined){let data107 = data103.reportedWorkDisposition;if(!((((data107 === "done") || (data107 === "blocked")) || (data107 === "needs_review")) || (data107 === "yielded"))){const err230 = {instancePath:instancePath+"/payload/reportedWorkDisposition",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/reportedWorkDisposition/enum",keyword:"enum",params:{allowedValues: schema199.properties.reportedWorkDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(data103.summary !== undefined){let data108 = data103.summary;if(typeof data108 === "string"){if(func1(data108) > 12000){const err231 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/maxLength",keyword:"maxLength",params:{limit: 12000},message:"must NOT have more than 12000 characters"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}if(func1(data108) < 1){const err232 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}else {const err233 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}if(data103.completionClaim !== undefined){let data109 = data103.completionClaim;if(data109 && typeof data109 == "object" && !Array.isArray(data109)){if(data109.contractRevision === undefined){const err234 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "contractRevision"},message:"must have required property '"+"contractRevision"+"'"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}if(data109.objectiveSatisfied === undefined){const err235 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "objectiveSatisfied"},message:"must have required property '"+"objectiveSatisfied"+"'"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}if(data109.criteria === undefined){const err236 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "criteria"},message:"must have required property '"+"criteria"+"'"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}if(data109.remainingWork === undefined){const err237 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "remainingWork"},message:"must have required property '"+"remainingWork"+"'"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}if(data109.contractRevision !== undefined){let data110 = data109.contractRevision;if(typeof data110 === "string"){if(func1(data110) < 1){const err238 = {instancePath:instancePath+"/payload/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}else {const err239 = {instancePath:instancePath+"/payload/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}if(data109.objectiveSatisfied !== undefined){if(typeof data109.objectiveSatisfied !== "boolean"){const err240 = {instancePath:instancePath+"/payload/completionClaim/objectiveSatisfied",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/objectiveSatisfied/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}if(data109.criteria !== undefined){let data112 = data109.criteria;if(Array.isArray(data112)){const len2 = data112.length;for(let i2=0; i2 160){const err329 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err329];}else {vErrors.push(err329);}errors++;}if(func1(data155) < 1){const err330 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err330];}else {vErrors.push(err330);}errors++;}}else {const err331 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err331];}else {vErrors.push(err331);}errors++;}}if(data.sourceSeq !== undefined){let data156 = data.sourceSeq;if(!(((typeof data156 == "number") && (!(data156 % 1) && !isNaN(data156))) && (isFinite(data156)))){const err332 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err332];}else {vErrors.push(err332);}errors++;}if((typeof data156 == "number") && (isFinite(data156))){if(data156 > 9007199254740991 || isNaN(data156)){const err333 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err333];}else {vErrors.push(err333);}errors++;}if(data156 < 1 || isNaN(data156)){const err334 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err334];}else {vErrors.push(err334);}errors++;}}}if(data.sourceInstanceId !== undefined){let data157 = data.sourceInstanceId;if(typeof data157 === "string"){if(func1(data157) > 160){const err335 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err335];}else {vErrors.push(err335);}errors++;}if(func1(data157) < 1){const err336 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err336];}else {vErrors.push(err336);}errors++;}}else {const err337 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err337];}else {vErrors.push(err337);}errors++;}}if(data.sourceKind !== undefined){let data158 = data.sourceKind;if(!((data158 === "runner") || (data158 === "control_plane"))){const err338 = {instancePath:instancePath+"/sourceKind",schemaPath:"#/properties/sourceKind/enum",keyword:"enum",params:{allowedValues: schema47.properties.sourceKind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err338];}else {vErrors.push(err338);}errors++;}}if(data.runId !== undefined){let data159 = data.runId;if(typeof data159 === "string"){if(func1(data159) > 160){const err339 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err339];}else {vErrors.push(err339);}errors++;}if(func1(data159) < 1){const err340 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err340];}else {vErrors.push(err340);}errors++;}}else {const err341 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err341];}else {vErrors.push(err341);}errors++;}}if(data.normalizedSessionId !== undefined){let data160 = data.normalizedSessionId;if(typeof data160 === "string"){if(func1(data160) > 160){const err342 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err342];}else {vErrors.push(err342);}errors++;}if(func1(data160) < 1){const err343 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err343];}else {vErrors.push(err343);}errors++;}}else {const err344 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err344];}else {vErrors.push(err344);}errors++;}}if(data.turnId !== undefined){let data161 = data.turnId;if(typeof data161 === "string"){if(func1(data161) > 240){const err345 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err345];}else {vErrors.push(err345);}errors++;}if(func1(data161) < 1){const err346 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err346];}else {vErrors.push(err346);}errors++;}}else {const err347 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err347];}else {vErrors.push(err347);}errors++;}}if(data.itemId !== undefined){let data162 = data.itemId;if(typeof data162 === "string"){if(func1(data162) > 240){const err348 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err348];}else {vErrors.push(err348);}errors++;}if(func1(data162) < 1){const err349 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err349];}else {vErrors.push(err349);}errors++;}}else {const err350 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err350];}else {vErrors.push(err350);}errors++;}}if(data.eventType !== undefined){let data163 = data.eventType;if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((data163 === "runner.connected") || (data163 === "runner.reconnected")) || (data163 === "runner.reconciled")) || (data163 === "runner.disconnected")) || (data163 === "runner.draining")) || (data163 === "runner.backpressure")) || (data163 === "runner.suspending")) || (data163 === "runner.suspended")) || (data163 === "runner.stopped")) || (data163 === "runner.diagnostic")) || (data163 === "runtime.phase.changed")) || (data163 === "sandbox.metric")) || (data163 === "workspace.ready")) || (data163 === "workspace.change.updated")) || (data163 === "workspace.diff.recorded")) || (data163 === "workspace.file.referenced")) || (data163 === "harness.starting")) || (data163 === "harness.ready")) || (data163 === "harness.exited")) || (data163 === "harness.diagnostic")) || (data163 === "plan.updated")) || (data163 === "tool.execution.started")) || (data163 === "tool.execution.progressed")) || (data163 === "tool.execution.completed")) || (data163 === "research.started")) || (data163 === "research.progressed")) || (data163 === "research.completed")) || (data163 === "delegation.started")) || (data163 === "delegation.updated")) || (data163 === "delegation.completed")) || (data163 === "model.route.changed")) || (data163 === "model.verification.updated")) || (data163 === "context.compacted")) || (data163 === "artifact.viewed")) || (data163 === "artifact.generated")) || (data163 === "review.mode.changed")) || (data163 === "hook.started")) || (data163 === "hook.completed")) || (data163 === "memory.citation.referenced")) || (data163 === "safety.review.started")) || (data163 === "safety.review.completed")) || (data163 === "terminal.input.sent")) || (data163 === "wait.started")) || (data163 === "wait.completed")) || (data163 === "provider.notice.recorded")) || (data163 === "session.starting")) || (data163 === "session.started")) || (data163 === "session.resuming")) || (data163 === "session.resumed")) || (data163 === "session.reconciled")) || (data163 === "session.updated")) || (data163 === "session.closed")) || (data163 === "session.failed")) || (data163 === "turn.submitted")) || (data163 === "turn.accepted")) || (data163 === "turn.started")) || (data163 === "turn.completed")) || (data163 === "turn.failed")) || (data163 === "turn.interrupted")) || (data163 === "turn.cancelled")) || (data163 === "item.started")) || (data163 === "item.delta")) || (data163 === "item.completed")) || (data163 === "item.failed")) || (data163 === "usage.reported")) || (data163 === "semantic_tool.input")) || (data163 === "semantic_tool.result")) || (data163 === "semantic_tool.reconciled")) || (data163 === "mcp_app.discovered")) || (data163 === "mcp_app.resource.resolved")) || (data163 === "mcp_app.initializing")) || (data163 === "mcp_app.ready")) || (data163 === "mcp_app.tool_input")) || (data163 === "mcp_app.tool_result")) || (data163 === "mcp_app.action.requested")) || (data163 === "mcp_app.action.resolved")) || (data163 === "mcp_app.host_context.changed")) || (data163 === "mcp_app.failed")) || (data163 === "mcp_app.teardown")) || (data163 === "runtime_request.created")) || (data163 === "runtime_request.resolved")) || (data163 === "runtime_request.expired")) || (data163 === "runtime_request.cancelled")) || (data163 === "interaction.request.proposed")) || (data163 === "interaction.request.materialized")) || (data163 === "interaction.request.rejected")) || (data163 === "interaction.response.progressed")) || (data163 === "interaction.response.resolved")) || (data163 === "interaction.response.delivered")) || (data163 === "run.attached")) || (data163 === "run.detached")) || (data163 === "run.result.proposed")) || (data163 === "run.result.accepted")) || (data163 === "run.result.rejected")) || (data163 === "attention.request.proposed")) || (data163 === "attention.request.routed")) || (data163 === "attention.request.resolved")) || (data163 === "attention.request.expired")) || (data163 === "attention.request.superseded")) || (data163 === "work.assessment.recorded")) || (data163 === "issue.status.decision.recorded")) || (data163 === "issue.status.decision.applied")) || (data163 === "issue.status.decision.rejected")) || (data163 === "issue.status.decision.superseded")) || (data163 === "run.terminal"))){const err351 = {instancePath:instancePath+"/eventType",schemaPath:"#/properties/eventType/enum",keyword:"enum",params:{allowedValues: schema47.properties.eventType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err351];}else {vErrors.push(err351);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err352 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err352];}else {vErrors.push(err352);}errors++;}}if(data.priority !== undefined){let data165 = data.priority;if(!(((data165 === 0) || (data165 === 1)) || (data165 === 2))){const err353 = {instancePath:instancePath+"/priority",schemaPath:"#/properties/priority/enum",keyword:"enum",params:{allowedValues: schema47.properties.priority.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err353];}else {vErrors.push(err353);}errors++;}}if(data.emittedAt !== undefined){let data166 = data.emittedAt;if(typeof data166 === "string"){if(!(formats0.test(data166))){const err354 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err354];}else {vErrors.push(err354);}errors++;}}else {const err355 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err355];}else {vErrors.push(err355);}errors++;}}if(data.observedAt !== undefined){let data167 = data.observedAt;if(typeof data167 === "string"){if(!(formats0.test(data167))){const err356 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err356];}else {vErrors.push(err356);}errors++;}}else {const err357 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err357];}else {vErrors.push(err357);}errors++;}}if(data.payload !== undefined){let data168 = data.payload;if(data168 && typeof data168 == "object" && !Array.isArray(data168)){if(data168.channel !== undefined){let data169 = data168.channel;if(!(((((data169 === "progress") || (data169 === "final")) || (data169 === "summary")) || (data169 === "detail")) || (data169 === "unknown"))){const err358 = {instancePath:instancePath+"/payload/channel",schemaPath:"#/properties/payload/properties/channel/enum",keyword:"enum",params:{allowedValues: schema47.properties.payload.properties.channel.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err358];}else {vErrors.push(err358);}errors++;}}if(data168.providerPhase !== undefined){if(typeof data168.providerPhase !== "string"){const err359 = {instancePath:instancePath+"/payload/providerPhase",schemaPath:"#/properties/payload/properties/providerPhase/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err359];}else {vErrors.push(err359);}errors++;}}if(data168.providerMethod !== undefined){if(typeof data168.providerMethod !== "string"){const err360 = {instancePath:instancePath+"/payload/providerMethod",schemaPath:"#/properties/payload/properties/providerMethod/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err360];}else {vErrors.push(err360);}errors++;}}}else {const err361 = {instancePath:instancePath+"/payload",schemaPath:"#/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err361];}else {vErrors.push(err361);}errors++;}}if(data.debug !== undefined){let data172 = data.debug;if(data172 && typeof data172 == "object" && !Array.isArray(data172)){}else {const err362 = {instancePath:instancePath+"/debug",schemaPath:"#/properties/debug/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err362];}else {vErrors.push(err362);}errors++;}}}else {const err363 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err363];}else {vErrors.push(err363);}errors++;}validate26.errors = vErrors;return errors === 0;}validate26.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema200 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v2/event.schema.json","title":"PRP v2 native event","type":"object","required":["schema","sourceEventId","sourceSeq","sourceInstanceId","sourceKind","runId","eventType","schemaVersion","priority","emittedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.event.v2"},"sourceEventId":{"type":"string","minLength":1,"maxLength":160},"sourceSeq":{"type":"integer","minimum":1,"maximum":9007199254740991},"sourceInstanceId":{"type":"string","minLength":1,"maxLength":160},"sourceKind":{"enum":["runner","control_plane"]},"runId":{"type":"string","minLength":1,"maxLength":160},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":160},"turnId":{"type":"string","minLength":1,"maxLength":160},"itemId":{"type":"string","minLength":1,"maxLength":160},"eventType":{"enum":["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.suspending","runner.suspended","runner.stopped","runner.diagnostic","runtime.phase.changed","sandbox.metric","workspace.ready","workspace.change.updated","workspace.diff.recorded","workspace.file.referenced","harness.starting","harness.ready","harness.exited","harness.diagnostic","plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","session.failed","session.capabilities.updated","session.goal.snapshot","session.goal.updated","session.goal.cleared","turn.submitted","turn.accepted","turn.started","turn.completed","turn.failed","turn.interrupted","turn.cancelled","item.started","item.delta","item.completed","item.failed","usage.reported","semantic_tool.input","semantic_tool.result","mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.tool_input","mcp_app.tool_result","mcp_app.action.requested","mcp_app.action.resolved","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown","runtime_request.created","runtime_request.resolved","runtime_request.expired","runtime_request.cancelled","interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered","run.attached","run.detached","run.result.proposed","run.result.accepted","run.result.rejected","attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded","run.terminal"]},"schemaVersion":{"const":2},"priority":{"enum":[0,1,2]},"emittedAt":{"type":"string","format":"date-time"},"observedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","additionalProperties":true},"debug":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"eventType":{"enum":["session.goal.snapshot","session.goal.updated"]}}},"then":{"properties":{"payload":{"type":"object","required":["goal"],"properties":{"goal":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"},{"type":"null"}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"session.capabilities.updated"}}},"then":{"properties":{"payload":{"type":"object","required":["sessionGoals"],"properties":{"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"turnControls":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"}},"additionalProperties":true}}}}],"additionalProperties":true};const schema201 = {"type":"object","required":["objective","status","tokenBudget","tokensUsed","elapsedSeconds","iterations","lastReason","createdAt","updatedAt","completedAt","workingNow"],"properties":{"objective":{"type":"string","minLength":1,"maxLength":4000},"status":{"enum":["active","paused","blocked","limited","usage_limited","budget_limited","complete"]},"tokenBudget":{"type":["integer","null"],"minimum":1},"tokensUsed":{"type":["integer","null"],"minimum":0},"elapsedSeconds":{"type":["number","null"],"minimum":0},"iterations":{"type":["integer","null"],"minimum":0},"lastReason":{"type":["string","null"],"maxLength":4000},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"workingNow":{"type":"boolean"}},"additionalProperties":true};const schema204 = {"type":"object","required":["steering","queuedFollowUp"],"properties":{"steering":{"type":"boolean"},"queuedFollowUp":{"type":"boolean"}},"additionalProperties":false};function validate109(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v2/event.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate109.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data0 = data.eventType;if(!((data0 === "session.goal.snapshot") || (data0 === "session.goal.updated"))){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data1 = data.payload;if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.goal === undefined){const err1 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/required",keyword:"required",params:{missingProperty: "goal"},message:"must have required property '"+"goal"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data1.goal !== undefined){let data2 = data1.goal;const _errs10 = errors;let valid5 = false;let passing0 = null;const _errs11 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.objective === undefined){const err2 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "objective"},message:"must have required property '"+"objective"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data2.status === undefined){const err3 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data2.tokenBudget === undefined){const err4 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokenBudget"},message:"must have required property '"+"tokenBudget"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data2.tokensUsed === undefined){const err5 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokensUsed"},message:"must have required property '"+"tokensUsed"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data2.elapsedSeconds === undefined){const err6 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "elapsedSeconds"},message:"must have required property '"+"elapsedSeconds"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data2.iterations === undefined){const err7 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "iterations"},message:"must have required property '"+"iterations"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data2.lastReason === undefined){const err8 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "lastReason"},message:"must have required property '"+"lastReason"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data2.createdAt === undefined){const err9 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "createdAt"},message:"must have required property '"+"createdAt"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.updatedAt === undefined){const err10 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "updatedAt"},message:"must have required property '"+"updatedAt"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data2.completedAt === undefined){const err11 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "completedAt"},message:"must have required property '"+"completedAt"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data2.workingNow === undefined){const err12 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "workingNow"},message:"must have required property '"+"workingNow"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.objective !== undefined){let data3 = data2.objective;if(typeof data3 === "string"){if(func1(data3) > 4000){const err13 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data3) < 1){const err14 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.status !== undefined){let data4 = data2.status;if(!(((((((data4 === "active") || (data4 === "paused")) || (data4 === "blocked")) || (data4 === "limited")) || (data4 === "usage_limited")) || (data4 === "budget_limited")) || (data4 === "complete"))){const err16 = {instancePath:instancePath+"/payload/goal/status",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/status/enum",keyword:"enum",params:{allowedValues: schema201.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.tokenBudget !== undefined){let data5 = data2.tokenBudget;if((!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) && (data5 !== null)){const err17 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/type",keyword:"type",params:{type: schema201.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 1 || isNaN(data5)){const err18 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data2.tokensUsed !== undefined){let data6 = data2.tokensUsed;if((!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) && (data6 !== null)){const err19 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/type",keyword:"type",params:{type: schema201.properties.tokensUsed.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){const err20 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}if(data2.elapsedSeconds !== undefined){let data7 = data2.elapsedSeconds;if((!((typeof data7 == "number") && (isFinite(data7)))) && (data7 !== null)){const err21 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/type",keyword:"type",params:{type: schema201.properties.elapsedSeconds.type},message:"must be number,null"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if((typeof data7 == "number") && (isFinite(data7))){if(data7 < 0 || isNaN(data7)){const err22 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}if(data2.iterations !== undefined){let data8 = data2.iterations;if((!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))) && (data8 !== null)){const err23 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/type",keyword:"type",params:{type: schema201.properties.iterations.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if((typeof data8 == "number") && (isFinite(data8))){if(data8 < 0 || isNaN(data8)){const err24 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}if(data2.lastReason !== undefined){let data9 = data2.lastReason;if((typeof data9 !== "string") && (data9 !== null)){const err25 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/type",keyword:"type",params:{type: schema201.properties.lastReason.type},message:"must be string,null"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(typeof data9 === "string"){if(func1(data9) > 4000){const err26 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}if(data2.createdAt !== undefined){let data10 = data2.createdAt;if((typeof data10 !== "string") && (data10 !== null)){const err27 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/type",keyword:"type",params:{type: schema201.properties.createdAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(typeof data10 === "string"){if(!(formats0.test(data10))){const err28 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data2.updatedAt !== undefined){let data11 = data2.updatedAt;if((typeof data11 !== "string") && (data11 !== null)){const err29 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/type",keyword:"type",params:{type: schema201.properties.updatedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(typeof data11 === "string"){if(!(formats0.test(data11))){const err30 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}}if(data2.completedAt !== undefined){let data12 = data2.completedAt;if((typeof data12 !== "string") && (data12 !== null)){const err31 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/type",keyword:"type",params:{type: schema201.properties.completedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(typeof data12 === "string"){if(!(formats0.test(data12))){const err32 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}if(data2.workingNow !== undefined){if(typeof data2.workingNow !== "boolean"){const err33 = {instancePath:instancePath+"/payload/goal/workingNow",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/workingNow/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}else {const err34 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}var _valid1 = _errs11 === errors;if(_valid1){valid5 = true;passing0 = 0;}const _errs36 = errors;if(data2 !== null){const err35 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}var _valid1 = _errs36 === errors;if(_valid1 && valid5){valid5 = false;passing0 = [passing0, 1];}else {if(_valid1){valid5 = true;passing0 = 1;}}if(!valid5){const err36 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}else {errors = _errs10;if(vErrors !== null){if(_errs10){vErrors.length = _errs10;}else {vErrors = null;}}}}}else {const err37 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props1 = {};props1.payload = true;props1.eventType = true;}}if(!valid1){const err38 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}const _errs39 = errors;let valid8 = true;const _errs40 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("session.capabilities.updated" !== data.eventType){const err39 = {};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}}var _valid2 = _errs40 === errors;errors = _errs39;if(vErrors !== null){if(_errs39){vErrors.length = _errs39;}else {vErrors = null;}}if(_valid2){const _errs42 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data15 = data.payload;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.sessionGoals === undefined){const err40 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(data15.sessionGoals !== undefined){let data16 = data15.sessionGoals;if(data16 && typeof data16 == "object" && !Array.isArray(data16)){if(data16.availability === undefined){const err41 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data16.actions === undefined){const err42 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(data16.autonomousUpdates === undefined){const err43 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(data16.persistentAcrossResume === undefined){const err44 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(data16.maxObjectiveChars === undefined){const err45 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(data16.tokenBudgetControl === undefined){const err46 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data16.usageReporting === undefined){const err47 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(data16.availability !== undefined){let data17 = data16.availability;if(!(((data17 === "available") || (data17 === "unsupported")) || (data17 === "policy_disabled"))){const err48 = {instancePath:instancePath+"/payload/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data16.actions !== undefined){let data18 = data16.actions;if(Array.isArray(data18)){const len0 = data18.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data18[i1], data18[j0])){const err50 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;break outer0;}}}}}else {const err51 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data16.autonomousUpdates !== undefined){if(typeof data16.autonomousUpdates !== "boolean"){const err52 = {instancePath:instancePath+"/payload/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data16.persistentAcrossResume !== undefined){if(typeof data16.persistentAcrossResume !== "boolean"){const err53 = {instancePath:instancePath+"/payload/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data16.maxObjectiveChars !== undefined){let data22 = data16.maxObjectiveChars;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err54 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 > 4000 || isNaN(data22)){const err55 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}if(data22 < 1 || isNaN(data22)){const err56 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}if(data16.tokenBudgetControl !== undefined){if(typeof data16.tokenBudgetControl !== "boolean"){const err57 = {instancePath:instancePath+"/payload/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data16.usageReporting !== undefined){if(typeof data16.usageReporting !== "boolean"){const err58 = {instancePath:instancePath+"/payload/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data16.reasonCode !== undefined){let data25 = data16.reasonCode;if(typeof data25 === "string"){if(func1(data25) > 160){const err59 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func1(data25) < 1){const err60 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data16.reason !== undefined){let data26 = data16.reason;if(typeof data26 === "string"){if(func1(data26) > 1000){const err62 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(func1(data26) < 1){const err63 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data15.turnControls !== undefined){let data27 = data15.turnControls;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(data27.steering === undefined){const err66 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "steering"},message:"must have required property '"+"steering"+"'"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(data27.queuedFollowUp === undefined){const err67 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "queuedFollowUp"},message:"must have required property '"+"queuedFollowUp"+"'"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}for(const key0 in data27){if(!((key0 === "steering") || (key0 === "queuedFollowUp"))){const err68 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data27.steering !== undefined){if(typeof data27.steering !== "boolean"){const err69 = {instancePath:instancePath+"/payload/turnControls/steering",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/steering/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data27.queuedFollowUp !== undefined){if(typeof data27.queuedFollowUp !== "boolean"){const err70 = {instancePath:instancePath+"/payload/turnControls/queuedFollowUp",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/queuedFollowUp/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}}var _valid2 = _errs42 === errors;valid8 = _valid2;if(valid8){var props2 = {};props2.payload = true;props2.eventType = true;}}if(!valid8){const err73 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(props1 !== true && props2 !== undefined){if(props2 === true){props1 = true;}else {props1 = props1 || {};Object.assign(props1, props2);}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err74 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}if(data.sourceEventId === undefined){const err75 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceEventId"},message:"must have required property '"+"sourceEventId"+"'"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(data.sourceSeq === undefined){const err76 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceSeq"},message:"must have required property '"+"sourceSeq"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data.sourceInstanceId === undefined){const err77 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceInstanceId"},message:"must have required property '"+"sourceInstanceId"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data.sourceKind === undefined){const err78 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceKind"},message:"must have required property '"+"sourceKind"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data.runId === undefined){const err79 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(data.eventType === undefined){const err80 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "eventType"},message:"must have required property '"+"eventType"+"'"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data.schemaVersion === undefined){const err81 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(data.priority === undefined){const err82 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "priority"},message:"must have required property '"+"priority"+"'"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(data.emittedAt === undefined){const err83 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "emittedAt"},message:"must have required property '"+"emittedAt"+"'"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(data.payload === undefined){const err84 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}if(data.schema !== undefined){if("paperclip.prp.event.v2" !== data.schema){const err85 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.event.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data.sourceEventId !== undefined){let data31 = data.sourceEventId;if(typeof data31 === "string"){if(func1(data31) > 160){const err86 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}if(func1(data31) < 1){const err87 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}else {const err88 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.sourceSeq !== undefined){let data32 = data.sourceSeq;if(!(((typeof data32 == "number") && (!(data32 % 1) && !isNaN(data32))) && (isFinite(data32)))){const err89 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if((typeof data32 == "number") && (isFinite(data32))){if(data32 > 9007199254740991 || isNaN(data32)){const err90 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(data32 < 1 || isNaN(data32)){const err91 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}if(data.sourceInstanceId !== undefined){let data33 = data.sourceInstanceId;if(typeof data33 === "string"){if(func1(data33) > 160){const err92 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}if(func1(data33) < 1){const err93 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}else {const err94 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}if(data.sourceKind !== undefined){let data34 = data.sourceKind;if(!((data34 === "runner") || (data34 === "control_plane"))){const err95 = {instancePath:instancePath+"/sourceKind",schemaPath:"#/properties/sourceKind/enum",keyword:"enum",params:{allowedValues: schema200.properties.sourceKind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data.runId !== undefined){let data35 = data.runId;if(typeof data35 === "string"){if(func1(data35) > 160){const err96 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(func1(data35) < 1){const err97 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}else {const err98 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data.normalizedSessionId !== undefined){let data36 = data.normalizedSessionId;if(typeof data36 === "string"){if(func1(data36) > 160){const err99 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(func1(data36) < 1){const err100 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data.turnId !== undefined){let data37 = data.turnId;if(typeof data37 === "string"){if(func1(data37) > 160){const err102 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(func1(data37) < 1){const err103 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data.itemId !== undefined){let data38 = data.itemId;if(typeof data38 === "string"){if(func1(data38) > 160){const err105 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(func1(data38) < 1){const err106 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}else {const err107 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}if(data.eventType !== undefined){let data39 = data.eventType;if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((data39 === "runner.connected") || (data39 === "runner.reconnected")) || (data39 === "runner.reconciled")) || (data39 === "runner.disconnected")) || (data39 === "runner.draining")) || (data39 === "runner.suspending")) || (data39 === "runner.suspended")) || (data39 === "runner.stopped")) || (data39 === "runner.diagnostic")) || (data39 === "runtime.phase.changed")) || (data39 === "sandbox.metric")) || (data39 === "workspace.ready")) || (data39 === "workspace.change.updated")) || (data39 === "workspace.diff.recorded")) || (data39 === "workspace.file.referenced")) || (data39 === "harness.starting")) || (data39 === "harness.ready")) || (data39 === "harness.exited")) || (data39 === "harness.diagnostic")) || (data39 === "plan.updated")) || (data39 === "tool.execution.started")) || (data39 === "tool.execution.progressed")) || (data39 === "tool.execution.completed")) || (data39 === "research.started")) || (data39 === "research.progressed")) || (data39 === "research.completed")) || (data39 === "delegation.started")) || (data39 === "delegation.updated")) || (data39 === "delegation.completed")) || (data39 === "model.route.changed")) || (data39 === "model.verification.updated")) || (data39 === "context.compacted")) || (data39 === "artifact.viewed")) || (data39 === "artifact.generated")) || (data39 === "review.mode.changed")) || (data39 === "hook.started")) || (data39 === "hook.completed")) || (data39 === "memory.citation.referenced")) || (data39 === "safety.review.started")) || (data39 === "safety.review.completed")) || (data39 === "terminal.input.sent")) || (data39 === "wait.started")) || (data39 === "wait.completed")) || (data39 === "provider.notice.recorded")) || (data39 === "session.starting")) || (data39 === "session.started")) || (data39 === "session.resuming")) || (data39 === "session.resumed")) || (data39 === "session.reconciled")) || (data39 === "session.updated")) || (data39 === "session.closed")) || (data39 === "session.failed")) || (data39 === "session.capabilities.updated")) || (data39 === "session.goal.snapshot")) || (data39 === "session.goal.updated")) || (data39 === "session.goal.cleared")) || (data39 === "turn.submitted")) || (data39 === "turn.accepted")) || (data39 === "turn.started")) || (data39 === "turn.completed")) || (data39 === "turn.failed")) || (data39 === "turn.interrupted")) || (data39 === "turn.cancelled")) || (data39 === "item.started")) || (data39 === "item.delta")) || (data39 === "item.completed")) || (data39 === "item.failed")) || (data39 === "usage.reported")) || (data39 === "semantic_tool.input")) || (data39 === "semantic_tool.result")) || (data39 === "mcp_app.discovered")) || (data39 === "mcp_app.resource.resolved")) || (data39 === "mcp_app.initializing")) || (data39 === "mcp_app.ready")) || (data39 === "mcp_app.tool_input")) || (data39 === "mcp_app.tool_result")) || (data39 === "mcp_app.action.requested")) || (data39 === "mcp_app.action.resolved")) || (data39 === "mcp_app.host_context.changed")) || (data39 === "mcp_app.failed")) || (data39 === "mcp_app.teardown")) || (data39 === "runtime_request.created")) || (data39 === "runtime_request.resolved")) || (data39 === "runtime_request.expired")) || (data39 === "runtime_request.cancelled")) || (data39 === "interaction.request.proposed")) || (data39 === "interaction.request.materialized")) || (data39 === "interaction.request.rejected")) || (data39 === "interaction.response.progressed")) || (data39 === "interaction.response.resolved")) || (data39 === "interaction.response.delivered")) || (data39 === "run.attached")) || (data39 === "run.detached")) || (data39 === "run.result.proposed")) || (data39 === "run.result.accepted")) || (data39 === "run.result.rejected")) || (data39 === "attention.request.proposed")) || (data39 === "attention.request.routed")) || (data39 === "attention.request.resolved")) || (data39 === "attention.request.expired")) || (data39 === "attention.request.superseded")) || (data39 === "work.assessment.recorded")) || (data39 === "issue.status.decision.recorded")) || (data39 === "issue.status.decision.applied")) || (data39 === "issue.status.decision.rejected")) || (data39 === "issue.status.decision.superseded")) || (data39 === "run.terminal"))){const err108 = {instancePath:instancePath+"/eventType",schemaPath:"#/properties/eventType/enum",keyword:"enum",params:{allowedValues: schema200.properties.eventType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data.schemaVersion !== undefined){if(2 !== data.schemaVersion){const err109 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 2},message:"must be equal to constant"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data.priority !== undefined){let data41 = data.priority;if(!(((data41 === 0) || (data41 === 1)) || (data41 === 2))){const err110 = {instancePath:instancePath+"/priority",schemaPath:"#/properties/priority/enum",keyword:"enum",params:{allowedValues: schema200.properties.priority.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.emittedAt !== undefined){let data42 = data.emittedAt;if(typeof data42 === "string"){if(!(formats0.test(data42))){const err111 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}else {const err112 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data.observedAt !== undefined){let data43 = data.observedAt;if(typeof data43 === "string"){if(!(formats0.test(data43))){const err113 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data.payload !== undefined){let data44 = data.payload;if(data44 && typeof data44 == "object" && !Array.isArray(data44)){}else {const err115 = {instancePath:instancePath+"/payload",schemaPath:"#/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data.debug !== undefined){let data45 = data.debug;if(data45 && typeof data45 == "object" && !Array.isArray(data45)){}else {const err116 = {instancePath:instancePath+"/debug",schemaPath:"#/properties/debug/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}validate109.errors = vErrors;return errors === 0;}validate109.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema206 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/request.schema.json","title":"PRP request","oneOf":[{"type":"object","required":["schema","requestKind","requestId","type","status","prompt","choices","origin","turnId"],"properties":{"schema":{"const":"paperclip.runtime_request.v2"},"requestKind":{"const":"permission_approval"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"const":"permission"},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"choices":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","required":["key","label"],"properties":{"key":{"enum":["accept","accept_for_session","decline","cancel"]},"label":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"allOf":[{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"accept"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"accept_for_session"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"decline"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"cancel"}}},"minContains":0,"maxContains":1}]},"details":{"type":"object","additionalProperties":true},"origin":{"type":"object","required":["adapter"],"properties":{"adapter":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","minLength":1,"maxLength":160},"method":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":["string","null"],"minLength":1,"maxLength":240}},"additionalProperties":false},{"type":"object","required":["schema","requestKind","requestId","type","status","prompt","input"],"properties":{"schema":{"const":"paperclip.runtime_request.v2"},"requestKind":{"const":"runtime"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"const":"input"},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"input":{"$ref":"https://paperclip.dev/schemas/prp/v1/question-set.schema.json"},"origin":{"type":"object","required":["adapter"],"properties":{"adapter":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","minLength":1,"maxLength":160},"method":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":"string","minLength":1,"maxLength":240}},"additionalProperties":false},{"type":"object","required":["schema","requestKind","requestId","type","status","prompt"],"properties":{"schema":{"const":"paperclip.runtime_request.v1"},"requestKind":{"const":"runtime"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"enum":["permission","input"]},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"choices":{"type":"array","items":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"additionalProperties":true}}},"additionalProperties":true},{"type":"object","required":["schema","requestKind","requestId","kind","blocking","payload"],"properties":{"schema":{"const":"paperclip.interaction_request.v1"},"requestKind":{"const":"issue_thread"},"requestId":{"type":"string","minLength":1,"maxLength":160},"kind":{"enum":["request_confirmation","request_checkbox_confirmation","request_item_verdicts","ask_user_questions","suggest_tasks"]},"blocking":{"type":"boolean"},"payload":{"type":"object","additionalProperties":true}},"additionalProperties":true}]};const schema207 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/question-set.schema.json","title":"Paperclip question set","type":"object","required":["schema","questions"],"properties":{"schema":{"const":"paperclip.question_set.v1"},"title":{"type":"string","maxLength":1000},"description":{"type":"string","maxLength":100000},"submitLabel":{"type":"string","maxLength":200},"questions":{"type":"array","minItems":1,"maxItems":64,"items":{"$ref":"#/$defs/question"}}},"$defs":{"option":{"type":"object","required":["id","label"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","minLength":1,"maxLength":1000},"description":{"type":"string","maxLength":4000},"recommended":{"type":"boolean"}},"additionalProperties":false},"customAnswer":{"type":"object","required":["enabled"],"properties":{"enabled":{"const":true},"label":{"type":"string","maxLength":1000},"placeholder":{"type":"string","maxLength":1000}},"additionalProperties":false},"textValidation":{"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"maximum":100000},"maxLength":{"type":"integer","minimum":0,"maximum":100000},"pattern":{"type":"string","maxLength":1000},"inputType":{"enum":["text","number","integer"]},"minimum":{"type":"number"},"maximum":{"type":"number"}},"additionalProperties":false},"question":{"type":"object","required":["id","prompt","required","answerMode"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"header":{"type":"string","maxLength":1000},"prompt":{"type":"string","minLength":1,"maxLength":4000},"helpText":{"type":"string","maxLength":4000},"required":{"type":"boolean"},"answerMode":{"enum":["single_select","multi_select","text"]},"initialText":{"type":"string","maxLength":100000,"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds."},"options":{"type":"array","maxItems":128,"items":{"$ref":"#/$defs/option"}},"customAnswer":{"$ref":"#/$defs/customAnswer"},"textValidation":{"$ref":"#/$defs/textValidation"}},"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"properties":{"options":{"type":"array","maxItems":0}},"not":{"required":["customAnswer"]}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"required":["options"],"not":{"required":["initialText"]},"properties":{"options":{"type":"array","minItems":1}}}}],"additionalProperties":false}},"additionalProperties":false};const schema208 = {"type":"object","required":["id","prompt","required","answerMode"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"header":{"type":"string","maxLength":1000},"prompt":{"type":"string","minLength":1,"maxLength":4000},"helpText":{"type":"string","maxLength":4000},"required":{"type":"boolean"},"answerMode":{"enum":["single_select","multi_select","text"]},"initialText":{"type":"string","maxLength":100000,"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds."},"options":{"type":"array","maxItems":128,"items":{"$ref":"#/$defs/option"}},"customAnswer":{"$ref":"#/$defs/customAnswer"},"textValidation":{"$ref":"#/$defs/textValidation"}},"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"properties":{"options":{"type":"array","maxItems":0}},"not":{"required":["customAnswer"]}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"required":["options"],"not":{"required":["initialText"]},"properties":{"options":{"type":"array","minItems":1}}}}],"additionalProperties":false};const schema209 = {"type":"object","required":["id","label"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","minLength":1,"maxLength":1000},"description":{"type":"string","maxLength":4000},"recommended":{"type":"boolean"}},"additionalProperties":false};const schema210 = {"type":"object","required":["enabled"],"properties":{"enabled":{"const":true},"label":{"type":"string","maxLength":1000},"placeholder":{"type":"string","maxLength":1000}},"additionalProperties":false};const schema211 = {"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"maximum":100000},"maxLength":{"type":"integer","minimum":0,"maximum":100000},"pattern":{"type":"string","maxLength":1000},"inputType":{"enum":["text","number","integer"]},"minimum":{"type":"number"},"maximum":{"type":"number"}},"additionalProperties":false};function validate114(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate114.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.answerMode === undefined) && (missing0 = "answerMode")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.answerMode !== undefined){if("text" !== data.answerMode){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;const _errs6 = errors;const _errs7 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if((data.customAnswer === undefined) && (missing1 = "customAnswer")){const err2 = {};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}var valid3 = _errs7 === errors;if(valid3){const err3 = {instancePath,schemaPath:"#/allOf/0/then/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}else {errors = _errs6;if(vErrors !== null){if(_errs6){vErrors.length = _errs6;}else {vErrors = null;}}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.options !== undefined){let data1 = data.options;if(Array.isArray(data1)){if(data1.length > 0){const err4 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/0/then/properties/options/maxItems",keyword:"maxItems",params:{limit: 0},message:"must NOT have more than 0 items"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}else {const err5 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/0/then/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props0 = {};props0.options = true;props0.answerMode = true;}}if(!valid1){const err6 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}const _errs11 = errors;let valid5 = true;const _errs12 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing2;if((data.answerMode === undefined) && (missing2 = "answerMode")){const err7 = {};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}else {if(data.answerMode !== undefined){let data2 = data.answerMode;if(!((data2 === "single_select") || (data2 === "multi_select"))){const err8 = {};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}}}var _valid1 = _errs12 === errors;errors = _errs11;if(vErrors !== null){if(_errs11){vErrors.length = _errs11;}else {vErrors = null;}}if(_valid1){const _errs14 = errors;const _errs15 = errors;const _errs16 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing3;if((data.initialText === undefined) && (missing3 = "initialText")){const err9 = {};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}var valid7 = _errs16 === errors;if(valid7){const err10 = {instancePath,schemaPath:"#/allOf/1/then/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}else {errors = _errs15;if(vErrors !== null){if(_errs15){vErrors.length = _errs15;}else {vErrors = null;}}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.options === undefined){const err11 = {instancePath,schemaPath:"#/allOf/1/then/required",keyword:"required",params:{missingProperty: "options"},message:"must have required property '"+"options"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data.options !== undefined){let data3 = data.options;if(Array.isArray(data3)){if(data3.length < 1){const err12 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/1/then/properties/options/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/1/then/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}var _valid1 = _errs14 === errors;valid5 = _valid1;if(valid5){var props1 = {};props1.options = true;props1.answerMode = true;}}if(!valid5){const err14 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(props0 !== true && props1 !== undefined){if(props1 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props1);}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.id === undefined){const err15 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data.prompt === undefined){const err16 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(data.required === undefined){const err17 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "required"},message:"must have required property '"+"required"+"'"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(data.answerMode === undefined){const err18 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "answerMode"},message:"must have required property '"+"answerMode"+"'"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}for(const key0 in data){if(!(func58.call(schema208.properties, key0))){const err19 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.id !== undefined){let data4 = data.id;if(typeof data4 === "string"){if(func1(data4) > 160){const err20 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(func1(data4) < 1){const err21 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.header !== undefined){let data5 = data.header;if(typeof data5 === "string"){if(func1(data5) > 1000){const err23 = {instancePath:instancePath+"/header",schemaPath:"#/properties/header/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/header",schemaPath:"#/properties/header/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.prompt !== undefined){let data6 = data.prompt;if(typeof data6 === "string"){if(func1(data6) > 4000){const err25 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(func1(data6) < 1){const err26 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}else {const err27 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data.helpText !== undefined){let data7 = data.helpText;if(typeof data7 === "string"){if(func1(data7) > 4000){const err28 = {instancePath:instancePath+"/helpText",schemaPath:"#/properties/helpText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/helpText",schemaPath:"#/properties/helpText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.required !== undefined){if(typeof data.required !== "boolean"){const err30 = {instancePath:instancePath+"/required",schemaPath:"#/properties/required/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data.answerMode !== undefined){let data9 = data.answerMode;if(!(((data9 === "single_select") || (data9 === "multi_select")) || (data9 === "text"))){const err31 = {instancePath:instancePath+"/answerMode",schemaPath:"#/properties/answerMode/enum",keyword:"enum",params:{allowedValues: schema208.properties.answerMode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data.initialText !== undefined){let data10 = data.initialText;if(typeof data10 === "string"){if(func1(data10) > 100000){const err32 = {instancePath:instancePath+"/initialText",schemaPath:"#/properties/initialText/maxLength",keyword:"maxLength",params:{limit: 100000},message:"must NOT have more than 100000 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/initialText",schemaPath:"#/properties/initialText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data.options !== undefined){let data11 = data.options;if(Array.isArray(data11)){if(data11.length > 128){const err34 = {instancePath:instancePath+"/options",schemaPath:"#/properties/options/maxItems",keyword:"maxItems",params:{limit: 128},message:"must NOT have more than 128 items"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}const len0 = data11.length;for(let i0=0; i0 160){const err38 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func1(data13) < 1){const err39 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data12.label !== undefined){let data14 = data12.label;if(typeof data14 === "string"){if(func1(data14) > 1000){const err41 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(func1(data14) < 1){const err42 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}else {const err43 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data12.description !== undefined){let data15 = data12.description;if(typeof data15 === "string"){if(func1(data15) > 4000){const err44 = {instancePath:instancePath+"/options/" + i0+"/description",schemaPath:"#/$defs/option/properties/description/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}else {const err45 = {instancePath:instancePath+"/options/" + i0+"/description",schemaPath:"#/$defs/option/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data12.recommended !== undefined){if(typeof data12.recommended !== "boolean"){const err46 = {instancePath:instancePath+"/options/" + i0+"/recommended",schemaPath:"#/$defs/option/properties/recommended/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}}else {const err47 = {instancePath:instancePath+"/options/" + i0,schemaPath:"#/$defs/option/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}}else {const err48 = {instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data.customAnswer !== undefined){let data17 = data.customAnswer;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(data17.enabled === undefined){const err49 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/required",keyword:"required",params:{missingProperty: "enabled"},message:"must have required property '"+"enabled"+"'"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}for(const key2 in data17){if(!(((key2 === "enabled") || (key2 === "label")) || (key2 === "placeholder"))){const err50 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data17.enabled !== undefined){if(true !== data17.enabled){const err51 = {instancePath:instancePath+"/customAnswer/enabled",schemaPath:"#/$defs/customAnswer/properties/enabled/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data17.label !== undefined){let data19 = data17.label;if(typeof data19 === "string"){if(func1(data19) > 1000){const err52 = {instancePath:instancePath+"/customAnswer/label",schemaPath:"#/$defs/customAnswer/properties/label/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}else {const err53 = {instancePath:instancePath+"/customAnswer/label",schemaPath:"#/$defs/customAnswer/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data17.placeholder !== undefined){let data20 = data17.placeholder;if(typeof data20 === "string"){if(func1(data20) > 1000){const err54 = {instancePath:instancePath+"/customAnswer/placeholder",schemaPath:"#/$defs/customAnswer/properties/placeholder/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}else {const err55 = {instancePath:instancePath+"/customAnswer/placeholder",schemaPath:"#/$defs/customAnswer/properties/placeholder/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data.textValidation !== undefined){let data21 = data.textValidation;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){for(const key3 in data21){if(!((((((key3 === "minLength") || (key3 === "maxLength")) || (key3 === "pattern")) || (key3 === "inputType")) || (key3 === "minimum")) || (key3 === "maximum"))){const err57 = {instancePath:instancePath+"/textValidation",schemaPath:"#/$defs/textValidation/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data21.minLength !== undefined){let data22 = data21.minLength;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err58 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 > 100000 || isNaN(data22)){const err59 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000},message:"must be <= 100000"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data22 < 0 || isNaN(data22)){const err60 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}}if(data21.maxLength !== undefined){let data23 = data21.maxLength;if(!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))){const err61 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if((typeof data23 == "number") && (isFinite(data23))){if(data23 > 100000 || isNaN(data23)){const err62 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000},message:"must be <= 100000"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(data23 < 0 || isNaN(data23)){const err63 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}}if(data21.pattern !== undefined){let data24 = data21.pattern;if(typeof data24 === "string"){if(func1(data24) > 1000){const err64 = {instancePath:instancePath+"/textValidation/pattern",schemaPath:"#/$defs/textValidation/properties/pattern/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}else {const err65 = {instancePath:instancePath+"/textValidation/pattern",schemaPath:"#/$defs/textValidation/properties/pattern/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data21.inputType !== undefined){let data25 = data21.inputType;if(!(((data25 === "text") || (data25 === "number")) || (data25 === "integer"))){const err66 = {instancePath:instancePath+"/textValidation/inputType",schemaPath:"#/$defs/textValidation/properties/inputType/enum",keyword:"enum",params:{allowedValues: schema211.properties.inputType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}if(data21.minimum !== undefined){let data26 = data21.minimum;if(!((typeof data26 == "number") && (isFinite(data26)))){const err67 = {instancePath:instancePath+"/textValidation/minimum",schemaPath:"#/$defs/textValidation/properties/minimum/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data21.maximum !== undefined){let data27 = data21.maximum;if(!((typeof data27 == "number") && (isFinite(data27)))){const err68 = {instancePath:instancePath+"/textValidation/maximum",schemaPath:"#/$defs/textValidation/properties/maximum/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}}else {const err69 = {instancePath:instancePath+"/textValidation",schemaPath:"#/$defs/textValidation/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}validate114.errors = vErrors;return errors === 0;}validate114.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate113(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/question-set.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate113.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.questions === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "questions"},message:"must have required property '"+"questions"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "title")) || (key0 === "description")) || (key0 === "submitLabel")) || (key0 === "questions"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.schema !== undefined){if("paperclip.question_set.v1" !== data.schema){const err3 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.question_set.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data.title !== undefined){let data1 = data.title;if(typeof data1 === "string"){if(func1(data1) > 1000){const err4 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}else {const err5 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.description !== undefined){let data2 = data.description;if(typeof data2 === "string"){if(func1(data2) > 100000){const err6 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/maxLength",keyword:"maxLength",params:{limit: 100000},message:"must NOT have more than 100000 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.submitLabel !== undefined){let data3 = data.submitLabel;if(typeof data3 === "string"){if(func1(data3) > 200){const err8 = {instancePath:instancePath+"/submitLabel",schemaPath:"#/properties/submitLabel/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/submitLabel",schemaPath:"#/properties/submitLabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.questions !== undefined){let data4 = data.questions;if(Array.isArray(data4)){if(data4.length > 64){const err10 = {instancePath:instancePath+"/questions",schemaPath:"#/properties/questions/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data4.length < 1){const err11 = {instancePath:instancePath+"/questions",schemaPath:"#/properties/questions/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err12 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.type !== undefined){if("permission" !== data.type){const err15 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue: "permission"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.status !== undefined){let data4 = data.status;if(!((((data4 === "pending") || (data4 === "resolved")) || (data4 === "expired")) || (data4 === "cancelled"))){const err16 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/0/properties/status/enum",keyword:"enum",params:{allowedValues: schema206.oneOf[0].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.prompt !== undefined){let data5 = data.prompt;if(typeof data5 === "string"){if(func1(data5) > 4000){const err17 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data5) < 1){const err18 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.choices !== undefined){let data6 = data.choices;if(Array.isArray(data6)){const _errs15 = errors;const len0 = data6.length;let valid3 = true;if(data6.length > 0){let count0 = 0;for(let i0=0; i0 1){valid3 = false;break;}if(count0 >= 0){valid3 = true;}}}}if(!valid3){const err23 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/0/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}else {errors = _errs15;if(vErrors !== null){if(_errs15){vErrors.length = _errs15;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs20 = errors;const len1 = data6.length;let valid5 = true;if(data6.length > 0){let count1 = 0;for(let i1=0; i1 1){valid5 = false;break;}if(count1 >= 0){valid5 = true;}}}}if(!valid5){const err27 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/1/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs20;if(vErrors !== null){if(_errs20){vErrors.length = _errs20;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs25 = errors;const len2 = data6.length;let valid7 = true;if(data6.length > 0){let count2 = 0;for(let i2=0; i2 1){valid7 = false;break;}if(count2 >= 0){valid7 = true;}}}}if(!valid7){const err31 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/2/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs25;if(vErrors !== null){if(_errs25){vErrors.length = _errs25;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs30 = errors;const len3 = data6.length;let valid9 = true;if(data6.length > 0){let count3 = 0;for(let i3=0; i3 1){valid9 = false;break;}if(count3 >= 0){valid9 = true;}}}}if(!valid9){const err35 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/3/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs30;if(vErrors !== null){if(_errs30){vErrors.length = _errs30;}else {vErrors = null;}}}}if(Array.isArray(data6)){if(data6.length > 4){const err36 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(data6.length < 1){const err37 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}const len4 = data6.length;for(let i4=0; i4 500){const err42 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(func1(data17) < 1){const err43 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}else {const err44 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}}else {const err45 = {instancePath:instancePath+"/choices/" + i4,schemaPath:"#/oneOf/0/properties/choices/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}}else {const err46 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data.details !== undefined){let data18 = data.details;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){}else {const err47 = {instancePath:instancePath+"/details",schemaPath:"#/oneOf/0/properties/details/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data.origin !== undefined){let data19 = data.origin;if(data19 && typeof data19 == "object" && !Array.isArray(data19)){if(data19.adapter === undefined){const err48 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/required",keyword:"required",params:{missingProperty: "adapter"},message:"must have required property '"+"adapter"+"'"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}for(const key2 in data19){if(!(((key2 === "adapter") || (key2 === "provider")) || (key2 === "method"))){const err49 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data19.adapter !== undefined){let data20 = data19.adapter;if(typeof data20 === "string"){if(func1(data20) > 160){const err50 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(func1(data20) < 1){const err51 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}else {const err52 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data19.provider !== undefined){let data21 = data19.provider;if(typeof data21 === "string"){if(func1(data21) > 160){const err53 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}if(func1(data21) < 1){const err54 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}else {const err55 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data19.method !== undefined){let data22 = data19.method;if(typeof data22 === "string"){if(func1(data22) > 500){const err56 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}if(func1(data22) < 1){const err57 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}else {const err58 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}else {const err59 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data.turnId !== undefined){let data23 = data.turnId;if(typeof data23 === "string"){if(func1(data23) > 240){const err60 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if(func1(data23) < 1){const err61 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(data.itemId !== undefined){let data24 = data.itemId;if((typeof data24 !== "string") && (data24 !== null)){const err63 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/type",keyword:"type",params:{type: schema206.oneOf[0].properties.itemId.type},message:"must be string,null"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}if(typeof data24 === "string"){if(func1(data24) > 240){const err64 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}if(func1(data24) < 1){const err65 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}}}else {const err66 = {instancePath,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}var _valid0 = _errs1 === errors;if(_valid0){valid0 = true;passing0 = 0;var props0 = true;}const _errs56 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err67 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}if(data.requestKind === undefined){const err68 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "requestKind"},message:"must have required property '"+"requestKind"+"'"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(data.requestId === undefined){const err69 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(data.type === undefined){const err70 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(data.status === undefined){const err71 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}if(data.prompt === undefined){const err72 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(data.input === undefined){const err73 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "input"},message:"must have required property '"+"input"+"'"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key3 in data){if(!(func58.call(schema206.oneOf[1].properties, key3))){const err74 = {instancePath,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data.schema !== undefined){if("paperclip.runtime_request.v2" !== data.schema){const err75 = {instancePath:instancePath+"/schema",schemaPath:"#/oneOf/1/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.runtime_request.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data.requestKind !== undefined){if("runtime" !== data.requestKind){const err76 = {instancePath:instancePath+"/requestKind",schemaPath:"#/oneOf/1/properties/requestKind/const",keyword:"const",params:{allowedValue: "runtime"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(data.requestId !== undefined){let data27 = data.requestId;if(typeof data27 === "string"){if(func1(data27) > 160){const err77 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(func1(data27) < 1){const err78 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}else {const err79 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data.type !== undefined){if("input" !== data.type){const err80 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue: "input"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data.status !== undefined){let data29 = data.status;if(!((((data29 === "pending") || (data29 === "resolved")) || (data29 === "expired")) || (data29 === "cancelled"))){const err81 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/1/properties/status/enum",keyword:"enum",params:{allowedValues: schema206.oneOf[1].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data.prompt !== undefined){let data30 = data.prompt;if(typeof data30 === "string"){if(func1(data30) > 4000){const err82 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func1(data30) < 1){const err83 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data.input !== undefined){if(!(validate113(data.input, {instancePath:instancePath+"/input",parentData:data,parentDataProperty:"input",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate113.errors : vErrors.concat(validate113.errors);errors = vErrors.length;}}if(data.origin !== undefined){let data32 = data.origin;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(data32.adapter === undefined){const err85 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/required",keyword:"required",params:{missingProperty: "adapter"},message:"must have required property '"+"adapter"+"'"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}for(const key4 in data32){if(!(((key4 === "adapter") || (key4 === "provider")) || (key4 === "method"))){const err86 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data32.adapter !== undefined){let data33 = data32.adapter;if(typeof data33 === "string"){if(func1(data33) > 160){const err87 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}if(func1(data33) < 1){const err88 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}else {const err89 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data32.provider !== undefined){let data34 = data32.provider;if(typeof data34 === "string"){if(func1(data34) > 160){const err90 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(func1(data34) < 1){const err91 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}else {const err92 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data32.method !== undefined){let data35 = data32.method;if(typeof data35 === "string"){if(func1(data35) > 500){const err93 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}if(func1(data35) < 1){const err94 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}else {const err95 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}}else {const err96 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}if(data.turnId !== undefined){let data36 = data.turnId;if(typeof data36 === "string"){if(func1(data36) > 240){const err97 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(func1(data36) < 1){const err98 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data.itemId !== undefined){let data37 = data.itemId;if(typeof data37 === "string"){if(func1(data37) > 240){const err100 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func1(data37) < 1){const err101 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}else {const err102 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}}else {const err103 = {instancePath,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}var _valid0 = _errs56 === errors;if(_valid0 && valid0){valid0 = false;passing0 = [passing0, 1];}else {if(_valid0){valid0 = true;passing0 = 1;if(props0 !== true){props0 = true;}}const _errs81 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err104 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(data.requestKind === undefined){const err105 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "requestKind"},message:"must have required property '"+"requestKind"+"'"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(data.requestId === undefined){const err106 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data.type === undefined){const err107 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}if(data.status === undefined){const err108 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}if(data.prompt === undefined){const err109 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if(data.schema !== undefined){if("paperclip.runtime_request.v1" !== data.schema){const err110 = {instancePath:instancePath+"/schema",schemaPath:"#/oneOf/2/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.runtime_request.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.requestKind !== undefined){if("runtime" !== data.requestKind){const err111 = {instancePath:instancePath+"/requestKind",schemaPath:"#/oneOf/2/properties/requestKind/const",keyword:"const",params:{allowedValue: "runtime"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data.requestId !== undefined){let data40 = data.requestId;if(typeof data40 === "string"){if(func1(data40) > 160){const err112 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(func1(data40) < 1){const err113 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data.type !== undefined){let data41 = data.type;if(!((data41 === "permission") || (data41 === "input"))){const err115 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/enum",keyword:"enum",params:{allowedValues: schema206.oneOf[2].properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data.status !== undefined){let data42 = data.status;if(!((((data42 === "pending") || (data42 === "resolved")) || (data42 === "expired")) || (data42 === "cancelled"))){const err116 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/2/properties/status/enum",keyword:"enum",params:{allowedValues: schema206.oneOf[2].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data.prompt !== undefined){let data43 = data.prompt;if(typeof data43 === "string"){if(func1(data43) > 4000){const err117 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if(func1(data43) < 1){const err118 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}else {const err119 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data.choices !== undefined){let data44 = data.choices;if(Array.isArray(data44)){const len5 = data44.length;for(let i5=0; i5 160){const err137 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(func1(data50) < 1){const err138 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data.kind !== undefined){let data51 = data.kind;if(!(((((data51 === "request_confirmation") || (data51 === "request_checkbox_confirmation")) || (data51 === "request_item_verdicts")) || (data51 === "ask_user_questions")) || (data51 === "suggest_tasks"))){const err140 = {instancePath:instancePath+"/kind",schemaPath:"#/oneOf/3/properties/kind/enum",keyword:"enum",params:{allowedValues: schema206.oneOf[3].properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(data.blocking !== undefined){if(typeof data.blocking !== "boolean"){const err141 = {instancePath:instancePath+"/blocking",schemaPath:"#/oneOf/3/properties/blocking/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data.payload !== undefined){let data53 = data.payload;if(data53 && typeof data53 == "object" && !Array.isArray(data53)){}else {const err142 = {instancePath:instancePath+"/payload",schemaPath:"#/oneOf/3/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}var _valid0 = _errs101 === errors;if(_valid0 && valid0){valid0 = false;passing0 = [passing0, 3];}else {if(_valid0){valid0 = true;passing0 = 3;if(props0 !== true){props0 = true;}}}}}if(!valid0){const err144 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}else {errors = _errs0;if(vErrors !== null){if(_errs0){vErrors.length = _errs0;}else {vErrors = null;}}}validate112.errors = vErrors;evaluated0.props = props0;return errors === 0;}validate112.evaluated = {"dynamicProps":true,"dynamicItems":false};const pattern12 = new RegExp("^[a-z][a-z0-9_.-]*$", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/fixture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.fixtureVersion === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "fixtureVersion"},message:"must have required property '"+"fixtureVersion"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.protocolVersion === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "protocolVersion"},message:"must have required property '"+"protocolVersion"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.name === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.description === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "description"},message:"must have required property '"+"description"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.identity === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "identity"},message:"must have required property '"+"identity"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.capabilities === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "capabilities"},message:"must have required property '"+"capabilities"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.commands === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "commands"},message:"must have required property '"+"commands"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.events === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "events"},message:"must have required property '"+"events"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.result === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "result"},message:"must have required property '"+"result"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.schema !== undefined){if("paperclip.prp.fixture.v1" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.fixture.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.fixtureVersion !== undefined){if(1 !== data.fixtureVersion){const err11 = {instancePath:instancePath+"/fixtureVersion",schemaPath:"#/properties/fixtureVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.protocolVersion !== undefined){let data2 = data.protocolVersion;if(!((data2 === 1) || (data2 === 2))){const err12 = {instancePath:instancePath+"/protocolVersion",schemaPath:"#/properties/protocolVersion/enum",keyword:"enum",params:{allowedValues: schema31.properties.protocolVersion.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.name !== undefined){let data3 = data.name;if(typeof data3 === "string"){if(func1(data3) > 120){const err13 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/maxLength",keyword:"maxLength",params:{limit: 120},message:"must NOT have more than 120 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data3) < 1){const err14 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.description !== undefined){let data4 = data.description;if(typeof data4 === "string"){if(func1(data4) > 1000){const err16 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data4) < 1){const err17 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}else {const err18 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.identity !== undefined){if(!(validate21(data.identity, {instancePath:instancePath+"/identity",parentData:data,parentDataProperty:"identity",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}}if(data.capabilities !== undefined){let data6 = data.capabilities;const _errs11 = errors;let valid1 = false;let passing0 = null;const _errs12 = errors;if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.schema === undefined){const err19 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(data6.sessionReusePolicy === undefined){const err20 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "sessionReusePolicy"},message:"must have required property '"+"sessionReusePolicy"+"'"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(data6.driver === undefined){const err21 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "driver"},message:"must have required property '"+"driver"+"'"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(data6.steer === undefined){const err22 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "steer"},message:"must have required property '"+"steer"+"'"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(data6.interrupt === undefined){const err23 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "interrupt"},message:"must have required property '"+"interrupt"+"'"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(data6.resume === undefined){const err24 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "resume"},message:"must have required property '"+"resume"+"'"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(data6.runtimeRequests === undefined){const err25 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "runtimeRequests"},message:"must have required property '"+"runtimeRequests"+"'"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(data6.structuredResult === undefined){const err26 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "structuredResult"},message:"must have required property '"+"structuredResult"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(data6.typedEvents === undefined){const err27 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "typedEvents"},message:"must have required property '"+"typedEvents"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data6.schema !== undefined){if("paperclip.prp.capabilities.v1" !== data6.schema){const err28 = {instancePath:instancePath+"/capabilities/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.capabilities.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data6.sessionReusePolicy !== undefined){let data8 = data6.sessionReusePolicy;if(!(((data8 === "new_per_run") || (data8 === "reuse_per_issue")) || (data8 === "reuse_per_workspace"))){const err29 = {instancePath:instancePath+"/capabilities/sessionReusePolicy",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/sessionReusePolicy/enum",keyword:"enum",params:{allowedValues: schema41.properties.sessionReusePolicy.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data6.driver !== undefined){let data9 = data6.driver;if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.kind === undefined){const err30 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data9.version === undefined){const err31 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(data9.kind !== undefined){let data10 = data9.kind;if(typeof data10 === "string"){if(func1(data10) > 80){const err32 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(func1(data10) < 1){const err33 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}else {const err34 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data9.version !== undefined){let data11 = data9.version;if(typeof data11 === "string"){if(func1(data11) > 80){const err35 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(func1(data11) < 1){const err36 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}else {const err38 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data6.steer !== undefined){if(typeof data6.steer !== "boolean"){const err39 = {instancePath:instancePath+"/capabilities/steer",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/steer/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data6.interrupt !== undefined){if(typeof data6.interrupt !== "boolean"){const err40 = {instancePath:instancePath+"/capabilities/interrupt",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/interrupt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data6.resume !== undefined){if(typeof data6.resume !== "boolean"){const err41 = {instancePath:instancePath+"/capabilities/resume",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/resume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data6.runtimeRequests !== undefined){if(typeof data6.runtimeRequests !== "boolean"){const err42 = {instancePath:instancePath+"/capabilities/runtimeRequests",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/runtimeRequests/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data6.structuredResult !== undefined){if(typeof data6.structuredResult !== "boolean"){const err43 = {instancePath:instancePath+"/capabilities/structuredResult",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/structuredResult/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data6.typedEvents !== undefined){if(typeof data6.typedEvents !== "boolean"){const err44 = {instancePath:instancePath+"/capabilities/typedEvents",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEvents/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data6.typedEventFamilies !== undefined){let data18 = data6.typedEventFamilies;if(Array.isArray(data18)){if(data18.length > 64){const err45 = {instancePath:instancePath+"/capabilities/typedEventFamilies",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}const len0 = data18.length;for(let i0=0; i0 160){const err51 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}if(func1(data20) < 1){const err52 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(!pattern12.test(data20)){const err53 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.-]*$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data19.version !== undefined){if(1 !== data19.version){const err55 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data19.availability !== undefined){let data22 = data19.availability;if(!(((data22 === "available") || (data22 === "unsupported")) || (data22 === "policy_disabled"))){const err56 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/availability",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/availability/enum",keyword:"enum",params:{allowedValues: schema41.properties.typedEventFamilies.items.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data19.detailLevel !== undefined){let data23 = data19.detailLevel;if(!((data23 === "summary") || (data23 === "structured"))){const err57 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/detailLevel",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/detailLevel/enum",keyword:"enum",params:{allowedValues: schema41.properties.typedEventFamilies.items.properties.detailLevel.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}else {const err59 = {instancePath:instancePath+"/capabilities/typedEventFamilies",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data6.semanticTools !== undefined){let data24 = data6.semanticTools;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(data24.schema === undefined){const err60 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if(data24.schemaVersion === undefined){const err61 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(data24.operations === undefined){const err62 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "operations"},message:"must have required property '"+"operations"+"'"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(data24.schema !== undefined){if("paperclip.prp.semantic_tools.v1" !== data24.schema){const err63 = {instancePath:instancePath+"/capabilities/semanticTools/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.semantic_tools.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data24.schemaVersion !== undefined){if(1 !== data24.schemaVersion){const err64 = {instancePath:instancePath+"/capabilities/semanticTools/schemaVersion",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data24.operations !== undefined){let data27 = data24.operations;if(Array.isArray(data27)){const len1 = data27.length;for(let i1=0; i1 160){const err69 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(func1(data29) < 1){const err70 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(!pattern4.test(data29)){const err71 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}else {const err72 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data28.version !== undefined){if(1 !== data28.version){const err73 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}if(data28.availability !== undefined){let data31 = data28.availability;if(!(((data31 === "available") || (data31 === "denied")) || (data31 === "unsupported"))){const err74 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/availability",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/availability/enum",keyword:"enum",params:{allowedValues: schema41.properties.semanticTools.properties.operations.items.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data28.redactionDisposition !== undefined){if("digest_only" !== data28.redactionDisposition){const err75 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/redactionDisposition",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/redactionDisposition/const",keyword:"const",params:{allowedValue: "digest_only"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data28.requiredClaims !== undefined){let data33 = data28.requiredClaims;if(Array.isArray(data33)){const len2 = data33.length;for(let i2=0; i2 160){const err76 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(func1(data34) < 1){const err77 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}else {const err78 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}let i3 = data33.length;let j0;if(i3 > 1){const indices0 = {};for(;i3--;){let item0 = data33[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];const err79 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;break;}indices0[item0] = i3;}}}else {const err80 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data28.reasonCode !== undefined){let data35 = data28.reasonCode;if(typeof data35 === "string"){if(func1(data35) > 160){const err81 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(func1(data35) < 1){const err82 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(!pattern14.test(data35)){const err83 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}}else {const err85 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/capabilities/semanticTools/operations",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}}else {const err87 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data6.unsupported !== undefined){let data36 = data6.unsupported;if(Array.isArray(data36)){const len3 = data36.length;for(let i4=0; i4 1){const indices1 = {};for(;i5--;){let item1 = data36[i5];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j1 = indices1[item1];const err90 = {instancePath:instancePath+"/capabilities/unsupported",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/unsupported/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i5+" are identical)"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;break;}indices1[item1] = i5;}}}else {const err91 = {instancePath:instancePath+"/capabilities/unsupported",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/unsupported/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}else {const err92 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}var _valid0 = _errs12 === errors;if(_valid0){valid1 = true;passing0 = 0;var props0 = true;}const _errs72 = errors;if(!(validate23(data6, {instancePath:instancePath+"/capabilities",parentData:data,parentDataProperty:"capabilities",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var _valid0 = _errs72 === errors;if(_valid0 && valid1){valid1 = false;passing0 = [passing0, 1];}else {if(_valid0){valid1 = true;passing0 = 1;if(props0 !== true){props0 = true;}}}if(!valid1){const err93 = {instancePath:instancePath+"/capabilities",schemaPath:"#/properties/capabilities/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}else {errors = _errs11;if(vErrors !== null){if(_errs11){vErrors.length = _errs11;}else {vErrors = null;}}}}if(data.commands !== undefined){let data38 = data.commands;if(Array.isArray(data38)){const len4 = data38.length;for(let i6=0; i6 160){const err101 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(func1(data41) < 1){const err102 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data39.controllerSeq !== undefined){let data42 = data39.controllerSeq;if(!(((typeof data42 == "number") && (!(data42 % 1) && !isNaN(data42))) && (isFinite(data42)))){const err104 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/controllerSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if((typeof data42 == "number") && (isFinite(data42))){if(data42 < 1 || isNaN(data42)){const err105 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/controllerSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}if(data39.type !== undefined){let data43 = data39.type;if(!((((((((((((((((((data43 === "run.prepare") || (data43 === "run.attach")) || (data43 === "session.open")) || (data43 === "turn.start")) || (data43 === "turn.steer")) || (data43 === "turn.interrupt")) || (data43 === "turn.stop")) || (data43 === "request.resolve")) || (data43 === "interaction.receipt")) || (data43 === "semantic_tool.result")) || (data43 === "session.snapshot")) || (data43 === "session.close")) || (data43 === "session.budget.increase")) || (data43 === "session.destroy")) || (data43 === "run.cancel")) || (data43 === "runner.drain")) || (data43 === "runner.suspend")) || (data43 === "runner.shutdown"))){const err106 = {instancePath:instancePath+"/commands/" + i6+"/type",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/type/enum",keyword:"enum",params:{allowedValues: schema45.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data39.issuedAt !== undefined){let data44 = data39.issuedAt;if(typeof data44 === "string"){if(!(formats0.test(data44))){const err107 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/issuedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/issuedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data39.deadlineAt !== undefined){let data45 = data39.deadlineAt;if(typeof data45 === "string"){if(!(formats0.test(data45))){const err109 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/deadlineAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}else {const err110 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/deadlineAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data39.precondition !== undefined){let data46 = data39.precondition;if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.runnerState !== undefined){let data47 = data46.runnerState;if(Array.isArray(data47)){const len5 = data47.length;for(let i7=0; i7 160){const err122 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if(func1(data57) < 1){const err123 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data56.objective !== undefined){let data58 = data56.objective;if(typeof data58 === "string"){if(func1(data58) > 4000){const err125 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(func1(data58) < 1){const err126 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}else {const err127 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data56.status !== undefined){let data59 = data56.status;if(!((data59 === "active") || (data59 === "paused"))){const err128 = {instancePath:instancePath+"/commands/" + i6+"/payload/status",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/status/enum",keyword:"enum",params:{allowedValues: schema46.allOf[0].then.properties.payload.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data56.tokenBudget !== undefined){let data60 = data56.tokenBudget;if((!(((typeof data60 == "number") && (!(data60 % 1) && !isNaN(data60))) && (isFinite(data60)))) && (data60 !== null)){const err129 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/type",keyword:"type",params:{type: schema46.allOf[0].then.properties.payload.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if((typeof data60 == "number") && (isFinite(data60))){if(data60 < 1 || isNaN(data60)){const err130 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}}else {const err131 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}}var _valid2 = _errs118 === errors;valid32 = _valid2;if(valid32){var props2 = {};props2.payload = true;props2.type = true;}}if(!valid32){const err132 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.schema === undefined){const err133 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}if(data39.commandId === undefined){const err134 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "commandId"},message:"must have required property '"+"commandId"+"'"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(data39.controllerSeq === undefined){const err135 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "controllerSeq"},message:"must have required property '"+"controllerSeq"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data39.type === undefined){const err136 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data39.issuedAt === undefined){const err137 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "issuedAt"},message:"must have required property '"+"issuedAt"+"'"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(data39.payload === undefined){const err138 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data39.schema !== undefined){if("paperclip.prp.command.v2" !== data39.schema){const err139 = {instancePath:instancePath+"/commands/" + i6+"/schema",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.command.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data39.commandId !== undefined){let data62 = data39.commandId;if(typeof data62 === "string"){if(func1(data62) > 160){const err140 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(func1(data62) < 1){const err141 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}else {const err142 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data39.controllerSeq !== undefined){let data63 = data39.controllerSeq;if(!(((typeof data63 == "number") && (!(data63 % 1) && !isNaN(data63))) && (isFinite(data63)))){const err143 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/controllerSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}if((typeof data63 == "number") && (isFinite(data63))){if(data63 < 1 || isNaN(data63)){const err144 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/controllerSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}}if(data39.type !== undefined){let data64 = data39.type;if(!(((((((((((((((((((((data64 === "run.prepare") || (data64 === "run.attach")) || (data64 === "session.open")) || (data64 === "turn.start")) || (data64 === "turn.steer")) || (data64 === "turn.interrupt")) || (data64 === "turn.stop")) || (data64 === "request.resolve")) || (data64 === "interaction.receipt")) || (data64 === "semantic_tool.result")) || (data64 === "session.snapshot")) || (data64 === "session.close")) || (data64 === "session.budget.increase")) || (data64 === "session.destroy")) || (data64 === "run.cancel")) || (data64 === "runner.drain")) || (data64 === "runner.suspend")) || (data64 === "runner.shutdown")) || (data64 === "session.goal.get")) || (data64 === "session.goal.set")) || (data64 === "session.goal.clear"))){const err145 = {instancePath:instancePath+"/commands/" + i6+"/type",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/type/enum",keyword:"enum",params:{allowedValues: schema46.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data39.issuedAt !== undefined){let data65 = data39.issuedAt;if(typeof data65 === "string"){if(!(formats0.test(data65))){const err146 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/issuedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}else {const err147 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/issuedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}if(data39.deadlineAt !== undefined){let data66 = data39.deadlineAt;if(typeof data66 === "string"){if(!(formats0.test(data66))){const err148 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/deadlineAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}else {const err149 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/deadlineAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data39.precondition !== undefined){let data67 = data39.precondition;if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.runnerState !== undefined){let data68 = data67.runnerState;if(Array.isArray(data68)){const len8 = data68.length;for(let i10=0; i10 12000){const err182 = {instancePath:instancePath+"/result/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/maxLength",keyword:"maxLength",params:{limit: 12000},message:"must NOT have more than 12000 characters"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}if(func1(data85) < 1){const err183 = {instancePath:instancePath+"/result/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}else {const err184 = {instancePath:instancePath+"/result/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}}if(data80.completionClaim !== undefined){let data86 = data80.completionClaim;if(data86 && typeof data86 == "object" && !Array.isArray(data86)){if(data86.contractRevision === undefined){const err185 = {instancePath:instancePath+"/result/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "contractRevision"},message:"must have required property '"+"contractRevision"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}if(data86.objectiveSatisfied === undefined){const err186 = {instancePath:instancePath+"/result/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "objectiveSatisfied"},message:"must have required property '"+"objectiveSatisfied"+"'"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if(data86.criteria === undefined){const err187 = {instancePath:instancePath+"/result/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "criteria"},message:"must have required property '"+"criteria"+"'"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}if(data86.remainingWork === undefined){const err188 = {instancePath:instancePath+"/result/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "remainingWork"},message:"must have required property '"+"remainingWork"+"'"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}if(data86.contractRevision !== undefined){let data87 = data86.contractRevision;if(typeof data87 === "string"){if(func1(data87) < 1){const err189 = {instancePath:instancePath+"/result/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}else {const err190 = {instancePath:instancePath+"/result/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data86.objectiveSatisfied !== undefined){if(typeof data86.objectiveSatisfied !== "boolean"){const err191 = {instancePath:instancePath+"/result/completionClaim/objectiveSatisfied",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/objectiveSatisfied/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}if(data86.criteria !== undefined){let data89 = data86.criteria;if(Array.isArray(data89)){const len13 = data89.length;for(let i15=0; i15 12000){const err16 = {instancePath:instancePath+"/summary",schemaPath:"#/properties/summary/maxLength",keyword:"maxLength",params:{limit: 12000},message:"must NOT have more than 12000 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data4) < 1){const err17 = {instancePath:instancePath+"/summary",schemaPath:"#/properties/summary/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}else {const err18 = {instancePath:instancePath+"/summary",schemaPath:"#/properties/summary/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.completionClaim !== undefined){let data5 = data.completionClaim;if(data5 && typeof data5 == "object" && !Array.isArray(data5)){if(data5.contractRevision === undefined){const err19 = {instancePath:instancePath+"/completionClaim",schemaPath:"#/properties/completionClaim/required",keyword:"required",params:{missingProperty: "contractRevision"},message:"must have required property '"+"contractRevision"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(data5.objectiveSatisfied === undefined){const err20 = {instancePath:instancePath+"/completionClaim",schemaPath:"#/properties/completionClaim/required",keyword:"required",params:{missingProperty: "objectiveSatisfied"},message:"must have required property '"+"objectiveSatisfied"+"'"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(data5.criteria === undefined){const err21 = {instancePath:instancePath+"/completionClaim",schemaPath:"#/properties/completionClaim/required",keyword:"required",params:{missingProperty: "criteria"},message:"must have required property '"+"criteria"+"'"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(data5.remainingWork === undefined){const err22 = {instancePath:instancePath+"/completionClaim",schemaPath:"#/properties/completionClaim/required",keyword:"required",params:{missingProperty: "remainingWork"},message:"must have required property '"+"remainingWork"+"'"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(data5.contractRevision !== undefined){let data6 = data5.contractRevision;if(typeof data6 === "string"){if(func1(data6) < 1){const err23 = {instancePath:instancePath+"/completionClaim/contractRevision",schemaPath:"#/properties/completionClaim/properties/contractRevision/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/completionClaim/contractRevision",schemaPath:"#/properties/completionClaim/properties/contractRevision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data5.objectiveSatisfied !== undefined){if(typeof data5.objectiveSatisfied !== "boolean"){const err25 = {instancePath:instancePath+"/completionClaim/objectiveSatisfied",schemaPath:"#/properties/completionClaim/properties/objectiveSatisfied/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data5.criteria !== undefined){let data8 = data5.criteria;if(Array.isArray(data8)){const len0 = data8.length;for(let i0=0; i0 160){const err9 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/companyId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.issueId !== undefined){let data2 = data.issueId;if(typeof data2 === "string"){if(func1(data2) > 160){const err13 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data2) < 1){const err14 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data2)){const err15 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/issueId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.runId !== undefined){let data3 = data.runId;if(typeof data3 === "string"){if(func1(data3) > 160){const err17 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data3) < 1){const err18 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(!pattern4.test(data3)){const err19 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}else {const err20 = {instancePath:instancePath+"/runId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.environmentLeaseId !== undefined){let data4 = data.environmentLeaseId;if(typeof data4 === "string"){if(func1(data4) > 160){const err21 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data4) < 1){const err22 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data4)){const err23 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/environmentLeaseId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.runnerInstanceId !== undefined){let data5 = data.runnerInstanceId;if(typeof data5 === "string"){if(func1(data5) > 160){const err25 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(func1(data5) < 1){const err26 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(!pattern4.test(data5)){const err27 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}else {const err28 = {instancePath:instancePath+"/runnerInstanceId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data.normalizedSessionId !== undefined){let data6 = data.normalizedSessionId;if(typeof data6 === "string"){if(func1(data6) > 160){const err29 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(func1(data6) < 1){const err30 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(!pattern4.test(data6)){const err31 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}else {const err32 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}if(data.driverSessionId !== undefined){let data7 = data.driverSessionId;if(typeof data7 === "string"){if(func1(data7) > 160){const err33 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(func1(data7) < 1){const err34 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if(!pattern4.test(data7)){const err35 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}else {const err36 = {instancePath:instancePath+"/driverSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.providerSessionId !== undefined){let data8 = data.providerSessionId;if(typeof data8 === "string"){if(func1(data8) > 160){const err37 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(func1(data8) < 1){const err38 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(!pattern4.test(data8)){const err39 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/providerSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}}else {const err41 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}validate21.errors = vErrors;return errors === 0;}validate21.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema42 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v2/capabilities.schema.json","title":"PRP v2 negotiated capabilities","type":"object","required":["schema","sessionReusePolicy","driver","steer","interrupt","resume","runtimeRequests","structuredResult","typedEvents","sessionGoals"],"properties":{"schema":{"const":"paperclip.prp.capabilities.v2"},"sessionReusePolicy":{"enum":["new_per_run","reuse_per_issue","reuse_per_workspace"]},"driver":{"type":"object","required":["kind","version"],"properties":{"kind":{"type":"string","minLength":1,"maxLength":80},"version":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":true},"steer":{"type":"boolean"},"interrupt":{"type":"boolean"},"resume":{"type":"boolean"},"runtimeRequests":{"type":"boolean"},"structuredResult":{"type":"boolean"},"typedEvents":{"type":"boolean"},"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"unsupported":{"type":"array","items":{"type":"string","minLength":1},"uniqueItems":true}},"additionalProperties":true};const schema44 = {"type":"object","required":["availability","actions","autonomousUpdates","persistentAcrossResume","maxObjectiveChars","tokenBudgetControl","usageReporting"],"properties":{"availability":{"enum":["available","unsupported","policy_disabled"]},"actions":{"type":"array","items":{"enum":["set","pause","resume","clear"]},"uniqueItems":true},"autonomousUpdates":{"type":"boolean"},"persistentAcrossResume":{"type":"boolean"},"maxObjectiveChars":{"type":"integer","minimum":1,"maximum":4000},"tokenBudgetControl":{"type":"boolean"},"usageReporting":{"type":"boolean"},"reasonCode":{"type":"string","minLength":1,"maxLength":160},"reason":{"type":"string","minLength":1,"maxLength":1000}},"additionalProperties":true};const func0 = typeof equalModule === "function" ? equalModule : equalModule.default;function validate23(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v2/capabilities.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate23.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.sessionReusePolicy === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionReusePolicy"},message:"must have required property '"+"sessionReusePolicy"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.driver === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "driver"},message:"must have required property '"+"driver"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.steer === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steer"},message:"must have required property '"+"steer"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.interrupt === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "interrupt"},message:"must have required property '"+"interrupt"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.resume === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "resume"},message:"must have required property '"+"resume"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.runtimeRequests === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runtimeRequests"},message:"must have required property '"+"runtimeRequests"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.structuredResult === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "structuredResult"},message:"must have required property '"+"structuredResult"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.typedEvents === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "typedEvents"},message:"must have required property '"+"typedEvents"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.sessionGoals === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.schema !== undefined){if("paperclip.prp.capabilities.v2" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.capabilities.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.sessionReusePolicy !== undefined){let data1 = data.sessionReusePolicy;if(!(((data1 === "new_per_run") || (data1 === "reuse_per_issue")) || (data1 === "reuse_per_workspace"))){const err11 = {instancePath:instancePath+"/sessionReusePolicy",schemaPath:"#/properties/sessionReusePolicy/enum",keyword:"enum",params:{allowedValues: schema42.properties.sessionReusePolicy.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.driver !== undefined){let data2 = data.driver;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.kind === undefined){const err12 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.version === undefined){const err13 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data2.kind !== undefined){let data3 = data2.kind;if(typeof data3 === "string"){if(func1(data3) > 80){const err14 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data3) < 1){const err15 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.version !== undefined){let data4 = data2.version;if(typeof data4 === "string"){if(func1(data4) > 80){const err17 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data4) < 1){const err18 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}else {const err20 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.steer !== undefined){if(typeof data.steer !== "boolean"){const err21 = {instancePath:instancePath+"/steer",schemaPath:"#/properties/steer/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.interrupt !== undefined){if(typeof data.interrupt !== "boolean"){const err22 = {instancePath:instancePath+"/interrupt",schemaPath:"#/properties/interrupt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.resume !== undefined){if(typeof data.resume !== "boolean"){const err23 = {instancePath:instancePath+"/resume",schemaPath:"#/properties/resume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data.runtimeRequests !== undefined){if(typeof data.runtimeRequests !== "boolean"){const err24 = {instancePath:instancePath+"/runtimeRequests",schemaPath:"#/properties/runtimeRequests/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.structuredResult !== undefined){if(typeof data.structuredResult !== "boolean"){const err25 = {instancePath:instancePath+"/structuredResult",schemaPath:"#/properties/structuredResult/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.typedEvents !== undefined){if(typeof data.typedEvents !== "boolean"){const err26 = {instancePath:instancePath+"/typedEvents",schemaPath:"#/properties/typedEvents/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.sessionGoals !== undefined){let data11 = data.sessionGoals;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.availability === undefined){const err27 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data11.actions === undefined){const err28 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data11.autonomousUpdates === undefined){const err29 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data11.persistentAcrossResume === undefined){const err30 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data11.maxObjectiveChars === undefined){const err31 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(data11.tokenBudgetControl === undefined){const err32 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(data11.usageReporting === undefined){const err33 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data11.availability !== undefined){let data12 = data11.availability;if(!(((data12 === "available") || (data12 === "unsupported")) || (data12 === "policy_disabled"))){const err34 = {instancePath:instancePath+"/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data11.actions !== undefined){let data13 = data11.actions;if(Array.isArray(data13)){const len0 = data13.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data13[i1], data13[j0])){const err36 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;break outer0;}}}}}else {const err37 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data11.autonomousUpdates !== undefined){if(typeof data11.autonomousUpdates !== "boolean"){const err38 = {instancePath:instancePath+"/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data11.persistentAcrossResume !== undefined){if(typeof data11.persistentAcrossResume !== "boolean"){const err39 = {instancePath:instancePath+"/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data11.maxObjectiveChars !== undefined){let data17 = data11.maxObjectiveChars;if(!(((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17))) && (isFinite(data17)))){const err40 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if((typeof data17 == "number") && (isFinite(data17))){if(data17 > 4000 || isNaN(data17)){const err41 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data17 < 1 || isNaN(data17)){const err42 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}if(data11.tokenBudgetControl !== undefined){if(typeof data11.tokenBudgetControl !== "boolean"){const err43 = {instancePath:instancePath+"/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data11.usageReporting !== undefined){if(typeof data11.usageReporting !== "boolean"){const err44 = {instancePath:instancePath+"/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data11.reasonCode !== undefined){let data20 = data11.reasonCode;if(typeof data20 === "string"){if(func1(data20) > 160){const err45 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func1(data20) < 1){const err46 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data11.reason !== undefined){let data21 = data11.reason;if(typeof data21 === "string"){if(func1(data21) > 1000){const err48 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(func1(data21) < 1){const err49 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data.unsupported !== undefined){let data22 = data.unsupported;if(Array.isArray(data22)){const len1 = data22.length;for(let i2=0; i2 1){const indices0 = {};for(;i3--;){let item0 = data22[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];const err54 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;break;}indices0[item0] = i3;}}}else {const err55 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}validate23.errors = vErrors;return errors === 0;}validate23.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema45 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v3/capabilities.schema.json","title":"PRP v3 negotiated capabilities","type":"object","required":["schema","sessionReusePolicy","driver","steer","interrupt","resume","runtimeRequests","structuredResult","typedEvents","sessionGoals"],"properties":{"schema":{"const":"paperclip.prp.capabilities.v3"},"sessionReusePolicy":{"enum":["new_per_run","reuse_per_issue","reuse_per_workspace"]},"driver":{"type":"object","required":["kind","version"],"properties":{"kind":{"type":"string","minLength":1,"maxLength":80},"version":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":true},"steer":{"type":"boolean"},"interrupt":{"type":"boolean"},"resume":{"type":"boolean"},"runtimeRequests":{"type":"boolean"},"structuredResult":{"type":"boolean"},"typedEvents":{"type":"boolean"},"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"unsupported":{"type":"array","items":{"type":"string","minLength":1},"uniqueItems":true},"externalProvider":{"type":"boolean"}},"additionalProperties":true};function validate26(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v3/capabilities.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate26.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.sessionReusePolicy === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionReusePolicy"},message:"must have required property '"+"sessionReusePolicy"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.driver === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "driver"},message:"must have required property '"+"driver"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.steer === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steer"},message:"must have required property '"+"steer"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.interrupt === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "interrupt"},message:"must have required property '"+"interrupt"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.resume === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "resume"},message:"must have required property '"+"resume"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.runtimeRequests === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runtimeRequests"},message:"must have required property '"+"runtimeRequests"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.structuredResult === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "structuredResult"},message:"must have required property '"+"structuredResult"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.typedEvents === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "typedEvents"},message:"must have required property '"+"typedEvents"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.sessionGoals === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.schema !== undefined){if("paperclip.prp.capabilities.v3" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.capabilities.v3"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.sessionReusePolicy !== undefined){let data1 = data.sessionReusePolicy;if(!(((data1 === "new_per_run") || (data1 === "reuse_per_issue")) || (data1 === "reuse_per_workspace"))){const err11 = {instancePath:instancePath+"/sessionReusePolicy",schemaPath:"#/properties/sessionReusePolicy/enum",keyword:"enum",params:{allowedValues: schema45.properties.sessionReusePolicy.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.driver !== undefined){let data2 = data.driver;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.kind === undefined){const err12 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.version === undefined){const err13 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data2.kind !== undefined){let data3 = data2.kind;if(typeof data3 === "string"){if(func1(data3) > 80){const err14 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data3) < 1){const err15 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/driver/kind",schemaPath:"#/properties/driver/properties/kind/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.version !== undefined){let data4 = data2.version;if(typeof data4 === "string"){if(func1(data4) > 80){const err17 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data4) < 1){const err18 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/driver/version",schemaPath:"#/properties/driver/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}else {const err20 = {instancePath:instancePath+"/driver",schemaPath:"#/properties/driver/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.steer !== undefined){if(typeof data.steer !== "boolean"){const err21 = {instancePath:instancePath+"/steer",schemaPath:"#/properties/steer/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.interrupt !== undefined){if(typeof data.interrupt !== "boolean"){const err22 = {instancePath:instancePath+"/interrupt",schemaPath:"#/properties/interrupt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.resume !== undefined){if(typeof data.resume !== "boolean"){const err23 = {instancePath:instancePath+"/resume",schemaPath:"#/properties/resume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data.runtimeRequests !== undefined){if(typeof data.runtimeRequests !== "boolean"){const err24 = {instancePath:instancePath+"/runtimeRequests",schemaPath:"#/properties/runtimeRequests/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.structuredResult !== undefined){if(typeof data.structuredResult !== "boolean"){const err25 = {instancePath:instancePath+"/structuredResult",schemaPath:"#/properties/structuredResult/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.typedEvents !== undefined){if(typeof data.typedEvents !== "boolean"){const err26 = {instancePath:instancePath+"/typedEvents",schemaPath:"#/properties/typedEvents/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.sessionGoals !== undefined){let data11 = data.sessionGoals;if(data11 && typeof data11 == "object" && !Array.isArray(data11)){if(data11.availability === undefined){const err27 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data11.actions === undefined){const err28 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data11.autonomousUpdates === undefined){const err29 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data11.persistentAcrossResume === undefined){const err30 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data11.maxObjectiveChars === undefined){const err31 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(data11.tokenBudgetControl === undefined){const err32 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(data11.usageReporting === undefined){const err33 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data11.availability !== undefined){let data12 = data11.availability;if(!(((data12 === "available") || (data12 === "unsupported")) || (data12 === "policy_disabled"))){const err34 = {instancePath:instancePath+"/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data11.actions !== undefined){let data13 = data11.actions;if(Array.isArray(data13)){const len0 = data13.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data13[i1], data13[j0])){const err36 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;break outer0;}}}}}else {const err37 = {instancePath:instancePath+"/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data11.autonomousUpdates !== undefined){if(typeof data11.autonomousUpdates !== "boolean"){const err38 = {instancePath:instancePath+"/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data11.persistentAcrossResume !== undefined){if(typeof data11.persistentAcrossResume !== "boolean"){const err39 = {instancePath:instancePath+"/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data11.maxObjectiveChars !== undefined){let data17 = data11.maxObjectiveChars;if(!(((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17))) && (isFinite(data17)))){const err40 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if((typeof data17 == "number") && (isFinite(data17))){if(data17 > 4000 || isNaN(data17)){const err41 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data17 < 1 || isNaN(data17)){const err42 = {instancePath:instancePath+"/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}if(data11.tokenBudgetControl !== undefined){if(typeof data11.tokenBudgetControl !== "boolean"){const err43 = {instancePath:instancePath+"/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data11.usageReporting !== undefined){if(typeof data11.usageReporting !== "boolean"){const err44 = {instancePath:instancePath+"/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data11.reasonCode !== undefined){let data20 = data11.reasonCode;if(typeof data20 === "string"){if(func1(data20) > 160){const err45 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func1(data20) < 1){const err46 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data11.reason !== undefined){let data21 = data11.reason;if(typeof data21 === "string"){if(func1(data21) > 1000){const err48 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(func1(data21) < 1){const err49 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data.unsupported !== undefined){let data22 = data.unsupported;if(Array.isArray(data22)){const len1 = data22.length;for(let i2=0; i2 1){const indices0 = {};for(;i3--;){let item0 = data22[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];const err54 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;break;}indices0[item0] = i3;}}}else {const err55 = {instancePath:instancePath+"/unsupported",schemaPath:"#/properties/unsupported/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data.externalProvider !== undefined){if(typeof data.externalProvider !== "boolean"){const err56 = {instancePath:instancePath+"/externalProvider",schemaPath:"#/properties/externalProvider/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}else {const err57 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}validate26.errors = vErrors;return errors === 0;}validate26.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema50 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/event.schema.json","title":"PRP native event","type":"object","required":["schema","sourceEventId","sourceSeq","sourceInstanceId","sourceKind","runId","eventType","schemaVersion","priority","emittedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.event.v1"},"sourceEventId":{"type":"string","minLength":1,"maxLength":160},"sourceSeq":{"type":"integer","minimum":1,"maximum":9007199254740991},"sourceInstanceId":{"type":"string","minLength":1,"maxLength":160},"sourceKind":{"enum":["runner","control_plane"]},"runId":{"type":"string","minLength":1,"maxLength":160},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":160},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":"string","minLength":1,"maxLength":240},"eventType":{"enum":["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.backpressure","runner.suspending","runner.suspended","runner.stopped","runner.diagnostic","runtime.phase.changed","sandbox.metric","workspace.ready","workspace.change.updated","workspace.diff.recorded","workspace.file.referenced","harness.starting","harness.ready","harness.exited","harness.diagnostic","plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","session.failed","turn.submitted","turn.accepted","turn.started","turn.completed","turn.failed","turn.interrupted","turn.cancelled","item.started","item.delta","item.completed","item.failed","usage.reported","semantic_tool.input","semantic_tool.result","semantic_tool.reconciled","mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.tool_input","mcp_app.tool_result","mcp_app.action.requested","mcp_app.action.resolved","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown","runtime_request.created","runtime_request.resolved","runtime_request.expired","runtime_request.cancelled","interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered","run.attached","run.detached","run.result.proposed","run.result.accepted","run.result.rejected","attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded","run.terminal"]},"schemaVersion":{"const":1},"priority":{"enum":[0,1,2]},"emittedAt":{"type":"string","format":"date-time"},"observedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","properties":{"channel":{"enum":["progress","final","summary","detail","unknown"]},"providerPhase":{"type":"string"},"providerMethod":{"type":"string"}},"additionalProperties":true},"debug":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"eventType":{"const":"plan.updated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/plan"}}}},{"if":{"properties":{"eventType":{"enum":["tool.execution.started","tool.execution.progressed","tool.execution.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/toolExecution"}}}},{"if":{"properties":{"eventType":{"enum":["research.started","research.progressed","research.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/research"}}}},{"if":{"properties":{"eventType":{"enum":["delegation.started","delegation.updated","delegation.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/delegation"}}}},{"if":{"properties":{"eventType":{"const":"model.route.changed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelRoute"}}}},{"if":{"properties":{"eventType":{"const":"model.verification.updated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/modelVerification"}}}},{"if":{"properties":{"eventType":{"const":"context.compacted"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/contextCompacted"}}}},{"if":{"properties":{"eventType":{"const":"artifact.viewed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactViewed"}}}},{"if":{"properties":{"eventType":{"const":"artifact.generated"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/artifactGenerated"}}}},{"if":{"properties":{"eventType":{"const":"review.mode.changed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/reviewMode"}}}},{"if":{"properties":{"eventType":{"enum":["hook.started","hook.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/hook"}}}},{"if":{"properties":{"eventType":{"const":"memory.citation.referenced"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/memoryCitation"}}}},{"if":{"properties":{"eventType":{"enum":["safety.review.started","safety.review.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/safetyReview"}}}},{"if":{"properties":{"eventType":{"const":"terminal.input.sent"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/terminalInput"}}}},{"if":{"properties":{"eventType":{"enum":["wait.started","wait.completed"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/wait"}}}},{"if":{"properties":{"eventType":{"const":"provider.notice.recorded"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-event.schema.json#/$defs/providerNotice"}}}},{"if":{"properties":{"eventType":{"const":"workspace.file.referenced"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json"}}}},{"if":{"properties":{"eventType":{"enum":["workspace.change.updated","workspace.diff.recorded"]}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"}}}},{"if":{"properties":{"eventType":{"const":"workspace.diff.recorded"}}},"then":{"properties":{"payload":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json"},{"type":"object","properties":{"complete":{"const":true}}}]}}}},{"if":{"properties":{"eventType":{"enum":["semantic_tool.input","mcp_app.tool_input"]}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"input"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"enum":["semantic_tool.result","mcp_app.tool_result"]}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"result"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"semantic_tool.reconciled"}}},"then":{"properties":{"payload":{"type":"object","properties":{"semantic_tool":{"allOf":[{"$ref":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json"},{"type":"object","properties":{"phase":{"const":"reconciled"}}}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"run.terminal"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/terminal.schema.json"}}}},{"if":{"properties":{"eventType":{"const":"run.result.proposed"}}},"then":{"properties":{"payload":{"$ref":"https://paperclip.dev/schemas/prp/v1/result.schema.json"}}}}],"additionalProperties":true};const schema174 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json","title":"Paperclip workspace file reference","type":"object","required":["schema","referenceId","source","path","displayName","mediaType","presentation","line","preview","previewTruncated","contentDigest"],"properties":{"schema":{"const":"paperclip.workspace.file_reference.v1"},"referenceId":{"type":"string","minLength":1,"maxLength":240},"source":{"enum":["harness_reported","runner_verified"]},"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},"displayName":{"type":"string","minLength":1,"maxLength":255},"mediaType":{"type":["string","null"],"maxLength":160},"presentation":{"enum":["document","code","image","generic"]},"line":{"type":["integer","null"],"minimum":1},"preview":{"type":["string","null"],"maxLength":262144},"previewTruncated":{"type":"boolean"},"contentDigest":{"oneOf":[{"type":"null"},{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"}]}},"additionalProperties":false};const schema175 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json","title":"Paperclip workspace diff","type":"object","required":["schema","changeSetId","revision","source","complete","files","totals","patchArtifactRef"],"properties":{"schema":{"const":"paperclip.workspace.diff.v1"},"changeSetId":{"type":"string","minLength":1,"maxLength":200},"revision":{"type":"integer","minimum":1},"source":{"enum":["harness_reported","runner_verified"]},"complete":{"type":"boolean"},"files":{"type":"array","maxItems":2000,"items":{"type":"object","required":["path","operation","previousPath","additions","deletions","binary","diff"],"properties":{"path":{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},"operation":{"enum":["create","modify","delete","rename","mode_change"]},"previousPath":{"oneOf":[{"type":"null"},{"type":"string","minLength":1,"maxLength":1024,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"}]},"additions":{"type":["integer","null"],"minimum":0},"deletions":{"type":["integer","null"],"minimum":0},"binary":{"type":"boolean"},"diff":{"type":["string","null"],"maxLength":262144}},"additionalProperties":false}},"totals":{"type":"object","required":["files","additions","deletions"],"properties":{"files":{"type":"integer","minimum":0},"additions":{"type":["integer","null"],"minimum":0},"deletions":{"type":["integer","null"],"minimum":0}},"additionalProperties":false},"patchArtifactRef":{"type":["string","null"],"maxLength":2048}},"additionalProperties":false};const schema52 = {"type":"object","description":"A complete provider-authored within-turn checklist snapshot. Consumers replace the prior snapshot with the same planId in PRP sourceSeq order; this is not Paperclip's durable Plan document.","required":["schema","planId","revision","steps","complete","syncStatus"],"properties":{"schema":{"const":"paperclip.plan.updated.v1"},"planId":{"$ref":"#/$defs/id"},"revision":{"type":"integer","minimum":1},"explanation":{"$ref":"#/$defs/nullableShortText"},"steps":{"type":"array","maxItems":256,"items":{"type":"object","required":["stepId","body","status"],"properties":{"stepId":{"$ref":"#/$defs/id"},"body":{"$ref":"#/$defs/shortText"},"status":{"enum":["pending","in_progress","completed","blocked"]}},"additionalProperties":false}},"complete":{"type":"boolean"},"syncStatus":{"description":"Legacy compatibility field. Within-turn checklist snapshots use not_applicable.","enum":["streaming","pending","synchronized","conflict","not_applicable"]},"documentRevision":{"description":"Legacy compatibility field. Within-turn checklist snapshots use null.","type":["integer","null"],"minimum":1}},"additionalProperties":false};const schema53 = {"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};const schema54 = {"type":["string","null"],"maxLength":4000};const schema56 = {"type":"string","maxLength":4000};function validate62(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate62.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.planId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "planId"},message:"must have required property '"+"planId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.revision === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.steps === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "steps"},message:"must have required property '"+"steps"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.complete === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.syncStatus === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "syncStatus"},message:"must have required property '"+"syncStatus"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "planId")) || (key0 === "revision")) || (key0 === "explanation")) || (key0 === "steps")) || (key0 === "complete")) || (key0 === "syncStatus")) || (key0 === "documentRevision"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.plan.updated.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.plan.updated.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.planId !== undefined){let data1 = data.planId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/planId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.revision !== undefined){let data2 = data.revision;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){const err12 = {instancePath:instancePath+"/revision",schemaPath:"#/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if((typeof data2 == "number") && (isFinite(data2))){if(data2 < 1 || isNaN(data2)){const err13 = {instancePath:instancePath+"/revision",schemaPath:"#/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}if(data.explanation !== undefined){let data3 = data.explanation;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/explanation",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4000){const err15 = {instancePath:instancePath+"/explanation",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.steps !== undefined){let data4 = data.steps;if(Array.isArray(data4)){if(data4.length > 256){const err16 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/maxItems",keyword:"maxItems",params:{limit: 256},message:"must NOT have more than 256 items"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err21 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/steps/" + i0+"/stepId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data5.body !== undefined){let data7 = data5.body;if(typeof data7 === "string"){if(func1(data7) > 4000){const err25 = {instancePath:instancePath+"/steps/" + i0+"/body",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/steps/" + i0+"/body",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data5.status !== undefined){let data8 = data5.status;if(!((((data8 === "pending") || (data8 === "in_progress")) || (data8 === "completed")) || (data8 === "blocked"))){const err27 = {instancePath:instancePath+"/steps/" + i0+"/status",schemaPath:"#/properties/steps/items/properties/status/enum",keyword:"enum",params:{allowedValues: schema52.properties.steps.items.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}else {const err28 = {instancePath:instancePath+"/steps/" + i0,schemaPath:"#/properties/steps/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}else {const err29 = {instancePath:instancePath+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.complete !== undefined){if(typeof data.complete !== "boolean"){const err30 = {instancePath:instancePath+"/complete",schemaPath:"#/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data.syncStatus !== undefined){let data10 = data.syncStatus;if(!(((((data10 === "streaming") || (data10 === "pending")) || (data10 === "synchronized")) || (data10 === "conflict")) || (data10 === "not_applicable"))){const err31 = {instancePath:instancePath+"/syncStatus",schemaPath:"#/properties/syncStatus/enum",keyword:"enum",params:{allowedValues: schema52.properties.syncStatus.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data.documentRevision !== undefined){let data11 = data.documentRevision;if((!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) && (data11 !== null)){const err32 = {instancePath:instancePath+"/documentRevision",schemaPath:"#/properties/documentRevision/type",keyword:"type",params:{type: schema52.properties.documentRevision.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if((typeof data11 == "number") && (isFinite(data11))){if(data11 < 1 || isNaN(data11)){const err33 = {instancePath:instancePath+"/documentRevision",schemaPath:"#/properties/documentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}}else {const err34 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}validate62.errors = vErrors;return errors === 0;}validate62.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema57 = {"type":"object","required":["schema","executionId","transport","operation","status","output","outputBytes","outputTruncated","outputDigest"],"properties":{"schema":{"const":"paperclip.tool.execution.v1"},"executionId":{"$ref":"#/$defs/id"},"transport":{"enum":["process","mcp","dynamic","builtin"]},"operation":{"enum":["read","search","list","execute","edit","unknown"]},"name":{"$ref":"#/$defs/nullableShortText"},"target":{"$ref":"#/$defs/safePath"},"namespace":{"type":["string","null"],"maxLength":240},"readOnly":{"type":["boolean","null"]},"inputUpdated":{"type":"boolean"},"status":{"enum":["running","completed","failed","cancelled","interrupted"]},"durationMs":{"type":["integer","null"],"minimum":0},"exitCode":{"type":["integer","null"]},"progress":{"$ref":"#/$defs/nullableShortText"},"output":{"type":["string","null"],"maxLength":65536},"outputBytes":{"type":"integer","minimum":0},"outputTruncated":{"type":"boolean"},"outputDigest":{"type":["string","null"],"pattern":"^sha256:[a-f0-9]{64}$"}},"additionalProperties":false};const schema60 = {"type":["string","null"],"maxLength":4096,"pattern":"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"};const pattern19 = new RegExp("^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$", "u");const pattern20 = new RegExp("^sha256:[a-f0-9]{64}$", "u");function validate64(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate64.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.executionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "executionId"},message:"must have required property '"+"executionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.transport === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "transport"},message:"must have required property '"+"transport"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.operation === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "operation"},message:"must have required property '"+"operation"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.status === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.output === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "output"},message:"must have required property '"+"output"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.outputBytes === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputBytes"},message:"must have required property '"+"outputBytes"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.outputTruncated === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputTruncated"},message:"must have required property '"+"outputTruncated"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.outputDigest === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "outputDigest"},message:"must have required property '"+"outputDigest"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}for(const key0 in data){if(!(func66.call(schema57.properties, key0))){const err9 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.schema !== undefined){if("paperclip.tool.execution.v1" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.tool.execution.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.executionId !== undefined){let data1 = data.executionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err11 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(func1(data1) < 1){const err12 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern4.test(data1)){const err13 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.transport !== undefined){let data2 = data.transport;if(!((((data2 === "process") || (data2 === "mcp")) || (data2 === "dynamic")) || (data2 === "builtin"))){const err15 = {instancePath:instancePath+"/transport",schemaPath:"#/properties/transport/enum",keyword:"enum",params:{allowedValues: schema57.properties.transport.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.operation !== undefined){let data3 = data.operation;if(!((((((data3 === "read") || (data3 === "search")) || (data3 === "list")) || (data3 === "execute")) || (data3 === "edit")) || (data3 === "unknown"))){const err16 = {instancePath:instancePath+"/operation",schemaPath:"#/properties/operation/enum",keyword:"enum",params:{allowedValues: schema57.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.name !== undefined){let data4 = data.name;if((typeof data4 !== "string") && (data4 !== null)){const err17 = {instancePath:instancePath+"/name",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err18 = {instancePath:instancePath+"/name",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data.target !== undefined){let data5 = data.target;if((typeof data5 !== "string") && (data5 !== null)){const err19 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema60.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4096){const err20 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(!pattern19.test(data5)){const err21 = {instancePath:instancePath+"/target",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}if(data.namespace !== undefined){let data6 = data.namespace;if((typeof data6 !== "string") && (data6 !== null)){const err22 = {instancePath:instancePath+"/namespace",schemaPath:"#/properties/namespace/type",keyword:"type",params:{type: schema57.properties.namespace.type},message:"must be string,null"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 240){const err23 = {instancePath:instancePath+"/namespace",schemaPath:"#/properties/namespace/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data.readOnly !== undefined){let data7 = data.readOnly;if((typeof data7 !== "boolean") && (data7 !== null)){const err24 = {instancePath:instancePath+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type: schema57.properties.readOnly.type},message:"must be boolean,null"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.inputUpdated !== undefined){if(typeof data.inputUpdated !== "boolean"){const err25 = {instancePath:instancePath+"/inputUpdated",schemaPath:"#/properties/inputUpdated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.status !== undefined){let data9 = data.status;if(!(((((data9 === "running") || (data9 === "completed")) || (data9 === "failed")) || (data9 === "cancelled")) || (data9 === "interrupted"))){const err26 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema57.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.durationMs !== undefined){let data10 = data.durationMs;if((!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))) && (data10 !== null)){const err27 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/type",keyword:"type",params:{type: schema57.properties.durationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if((typeof data10 == "number") && (isFinite(data10))){if(data10 < 0 || isNaN(data10)){const err28 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data.exitCode !== undefined){let data11 = data.exitCode;if((!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))) && (data11 !== null)){const err29 = {instancePath:instancePath+"/exitCode",schemaPath:"#/properties/exitCode/type",keyword:"type",params:{type: schema57.properties.exitCode.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.progress !== undefined){let data12 = data.progress;if((typeof data12 !== "string") && (data12 !== null)){const err30 = {instancePath:instancePath+"/progress",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 4000){const err31 = {instancePath:instancePath+"/progress",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}if(data.output !== undefined){let data13 = data.output;if((typeof data13 !== "string") && (data13 !== null)){const err32 = {instancePath:instancePath+"/output",schemaPath:"#/properties/output/type",keyword:"type",params:{type: schema57.properties.output.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data13 === "string"){if(func1(data13) > 65536){const err33 = {instancePath:instancePath+"/output",schemaPath:"#/properties/output/maxLength",keyword:"maxLength",params:{limit: 65536},message:"must NOT have more than 65536 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}if(data.outputBytes !== undefined){let data14 = data.outputBytes;if(!(((typeof data14 == "number") && (!(data14 % 1) && !isNaN(data14))) && (isFinite(data14)))){const err34 = {instancePath:instancePath+"/outputBytes",schemaPath:"#/properties/outputBytes/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if((typeof data14 == "number") && (isFinite(data14))){if(data14 < 0 || isNaN(data14)){const err35 = {instancePath:instancePath+"/outputBytes",schemaPath:"#/properties/outputBytes/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}if(data.outputTruncated !== undefined){if(typeof data.outputTruncated !== "boolean"){const err36 = {instancePath:instancePath+"/outputTruncated",schemaPath:"#/properties/outputTruncated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.outputDigest !== undefined){let data16 = data.outputDigest;if((typeof data16 !== "string") && (data16 !== null)){const err37 = {instancePath:instancePath+"/outputDigest",schemaPath:"#/properties/outputDigest/type",keyword:"type",params:{type: schema57.properties.outputDigest.type},message:"must be string,null"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(typeof data16 === "string"){if(!pattern20.test(data16)){const err38 = {instancePath:instancePath+"/outputDigest",schemaPath:"#/properties/outputDigest/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}}}else {const err39 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}validate64.errors = vErrors;return errors === 0;}validate64.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema62 = {"type":"object","required":["schema","researchId","action","status","sources"],"properties":{"schema":{"const":"paperclip.research.v1"},"researchId":{"$ref":"#/$defs/id"},"action":{"enum":["search","open_page","find_in_page","other"]},"status":{"enum":["running","completed","failed","cancelled"]},"query":{"$ref":"#/$defs/nullableShortText"},"url":{"$ref":"#/$defs/safeUrl"},"pattern":{"$ref":"#/$defs/nullableShortText"},"sources":{"type":"array","maxItems":64,"items":{"type":"object","required":["sourceId","title","url","snippet"],"properties":{"sourceId":{"$ref":"#/$defs/id"},"title":{"$ref":"#/$defs/shortText"},"url":{"$ref":"#/$defs/safeUrl"},"snippet":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false}}},"additionalProperties":false};const schema65 = {"type":["string","null"],"maxLength":8192,"pattern":"^https?://"};const pattern22 = new RegExp("^https?://", "u");function validate66(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate66.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.researchId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "researchId"},message:"must have required property '"+"researchId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.action === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "action"},message:"must have required property '"+"action"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.sources === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sources"},message:"must have required property '"+"sources"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "researchId")) || (key0 === "action")) || (key0 === "status")) || (key0 === "query")) || (key0 === "url")) || (key0 === "pattern")) || (key0 === "sources"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.research.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.research.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.researchId !== undefined){let data1 = data.researchId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/researchId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.action !== undefined){let data2 = data.action;if(!((((data2 === "search") || (data2 === "open_page")) || (data2 === "find_in_page")) || (data2 === "other"))){const err11 = {instancePath:instancePath+"/action",schemaPath:"#/properties/action/enum",keyword:"enum",params:{allowedValues: schema62.properties.action.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((data3 === "running") || (data3 === "completed")) || (data3 === "failed")) || (data3 === "cancelled"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema62.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.query !== undefined){let data4 = data.query;if((typeof data4 !== "string") && (data4 !== null)){const err13 = {instancePath:instancePath+"/query",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err14 = {instancePath:instancePath+"/query",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}if(data.url !== undefined){let data5 = data.url;if((typeof data5 !== "string") && (data5 !== null)){const err15 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/type",keyword:"type",params:{type: schema65.type},message:"must be string,null"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 8192){const err16 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(!pattern22.test(data5)){const err17 = {instancePath:instancePath+"/url",schemaPath:"#/$defs/safeUrl/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}if(data.pattern !== undefined){let data6 = data.pattern;if((typeof data6 !== "string") && (data6 !== null)){const err18 = {instancePath:instancePath+"/pattern",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 4000){const err19 = {instancePath:instancePath+"/pattern",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}if(data.sources !== undefined){let data7 = data.sources;if(Array.isArray(data7)){if(data7.length > 64){const err20 = {instancePath:instancePath+"/sources",schemaPath:"#/properties/sources/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}const len0 = data7.length;for(let i0=0; i0 160){const err26 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(func1(data9) < 1){const err27 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(!pattern4.test(data9)){const err28 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/sources/" + i0+"/sourceId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data8.title !== undefined){let data10 = data8.title;if(typeof data10 === "string"){if(func1(data10) > 4000){const err30 = {instancePath:instancePath+"/sources/" + i0+"/title",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}else {const err31 = {instancePath:instancePath+"/sources/" + i0+"/title",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data8.url !== undefined){let data11 = data8.url;if((typeof data11 !== "string") && (data11 !== null)){const err32 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/type",keyword:"type",params:{type: schema65.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data11 === "string"){if(func1(data11) > 8192){const err33 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/maxLength",keyword:"maxLength",params:{limit: 8192},message:"must NOT have more than 8192 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(!pattern22.test(data11)){const err34 = {instancePath:instancePath+"/sources/" + i0+"/url",schemaPath:"#/$defs/safeUrl/pattern",keyword:"pattern",params:{pattern: "^https?://"},message:"must match pattern \""+"^https?://"+"\""};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}if(data8.snippet !== undefined){let data12 = data8.snippet;if((typeof data12 !== "string") && (data12 !== null)){const err35 = {instancePath:instancePath+"/sources/" + i0+"/snippet",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 4000){const err36 = {instancePath:instancePath+"/sources/" + i0+"/snippet",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}}}else {const err37 = {instancePath:instancePath+"/sources/" + i0,schemaPath:"#/properties/sources/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}else {const err38 = {instancePath:instancePath+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}}else {const err39 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}validate66.errors = vErrors;return errors === 0;}validate66.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema71 = {"type":"object","required":["schema","delegationId","action","status","children"],"properties":{"schema":{"const":"paperclip.delegation.v1"},"delegationId":{"$ref":"#/$defs/id"},"action":{"enum":["spawn","message","resume","wait","close"]},"status":{"enum":["running","waiting","completed","failed","interrupted","closed"]},"children":{"type":"array","maxItems":64,"items":{"type":"object","required":["childId","role","model","status","summary","activitySummary"],"properties":{"childId":{"$ref":"#/$defs/id"},"role":{"type":["string","null"],"maxLength":160},"model":{"type":["string","null"],"maxLength":240},"status":{"enum":["running","waiting","completed","failed","interrupted","closed"]},"summary":{"$ref":"#/$defs/nullableShortText"},"activitySummary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false}}},"additionalProperties":false};function validate68(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate68.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.delegationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "delegationId"},message:"must have required property '"+"delegationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.action === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "action"},message:"must have required property '"+"action"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.children === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "children"},message:"must have required property '"+"children"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "delegationId")) || (key0 === "action")) || (key0 === "status")) || (key0 === "children"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.delegation.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.delegation.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.delegationId !== undefined){let data1 = data.delegationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/delegationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.action !== undefined){let data2 = data.action;if(!(((((data2 === "spawn") || (data2 === "message")) || (data2 === "resume")) || (data2 === "wait")) || (data2 === "close"))){const err11 = {instancePath:instancePath+"/action",schemaPath:"#/properties/action/enum",keyword:"enum",params:{allowedValues: schema71.properties.action.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((((data3 === "running") || (data3 === "waiting")) || (data3 === "completed")) || (data3 === "failed")) || (data3 === "interrupted")) || (data3 === "closed"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema71.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.children !== undefined){let data4 = data.children;if(Array.isArray(data4)){if(data4.length > 64){const err13 = {instancePath:instancePath+"/children",schemaPath:"#/properties/children/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err21 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/children/" + i0+"/childId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data5.role !== undefined){let data7 = data5.role;if((typeof data7 !== "string") && (data7 !== null)){const err25 = {instancePath:instancePath+"/children/" + i0+"/role",schemaPath:"#/properties/children/items/properties/role/type",keyword:"type",params:{type: schema71.properties.children.items.properties.role.type},message:"must be string,null"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 160){const err26 = {instancePath:instancePath+"/children/" + i0+"/role",schemaPath:"#/properties/children/items/properties/role/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}if(data5.model !== undefined){let data8 = data5.model;if((typeof data8 !== "string") && (data8 !== null)){const err27 = {instancePath:instancePath+"/children/" + i0+"/model",schemaPath:"#/properties/children/items/properties/model/type",keyword:"type",params:{type: schema71.properties.children.items.properties.model.type},message:"must be string,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(typeof data8 === "string"){if(func1(data8) > 240){const err28 = {instancePath:instancePath+"/children/" + i0+"/model",schemaPath:"#/properties/children/items/properties/model/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data5.status !== undefined){let data9 = data5.status;if(!((((((data9 === "running") || (data9 === "waiting")) || (data9 === "completed")) || (data9 === "failed")) || (data9 === "interrupted")) || (data9 === "closed"))){const err29 = {instancePath:instancePath+"/children/" + i0+"/status",schemaPath:"#/properties/children/items/properties/status/enum",keyword:"enum",params:{allowedValues: schema71.properties.children.items.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data5.summary !== undefined){let data10 = data5.summary;if((typeof data10 !== "string") && (data10 !== null)){const err30 = {instancePath:instancePath+"/children/" + i0+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(typeof data10 === "string"){if(func1(data10) > 4000){const err31 = {instancePath:instancePath+"/children/" + i0+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}if(data5.activitySummary !== undefined){let data11 = data5.activitySummary;if((typeof data11 !== "string") && (data11 !== null)){const err32 = {instancePath:instancePath+"/children/" + i0+"/activitySummary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data11 === "string"){if(func1(data11) > 4000){const err33 = {instancePath:instancePath+"/children/" + i0+"/activitySummary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}}else {const err34 = {instancePath:instancePath+"/children/" + i0,schemaPath:"#/properties/children/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/children",schemaPath:"#/properties/children/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}else {const err36 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}validate68.errors = vErrors;return errors === 0;}validate68.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema76 = {"type":"object","required":["schema","routeId","provider","requestedModel","fromModel","effectiveModel","reason"],"properties":{"schema":{"const":"paperclip.model.route_changed.v1"},"routeId":{"$ref":"#/$defs/id"},"provider":{"type":"string","minLength":1,"maxLength":160},"requestedModel":{"type":"string","minLength":1,"maxLength":240},"fromModel":{"type":["string","null"],"maxLength":240},"effectiveModel":{"type":"string","minLength":1,"maxLength":240},"reason":{"$ref":"#/$defs/shortText"}},"additionalProperties":false};function validate70(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate70.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.routeId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "routeId"},message:"must have required property '"+"routeId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.provider === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "provider"},message:"must have required property '"+"provider"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.requestedModel === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "requestedModel"},message:"must have required property '"+"requestedModel"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.fromModel === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "fromModel"},message:"must have required property '"+"fromModel"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.effectiveModel === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "effectiveModel"},message:"must have required property '"+"effectiveModel"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.reason === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}for(const key0 in data){if(!(((((((key0 === "schema") || (key0 === "routeId")) || (key0 === "provider")) || (key0 === "requestedModel")) || (key0 === "fromModel")) || (key0 === "effectiveModel")) || (key0 === "reason"))){const err7 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.schema !== undefined){if("paperclip.model.route_changed.v1" !== data.schema){const err8 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.model.route_changed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.routeId !== undefined){let data1 = data.routeId;if(typeof data1 === "string"){if(func1(data1) > 160){const err9 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/routeId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.provider !== undefined){let data2 = data.provider;if(typeof data2 === "string"){if(func1(data2) > 160){const err13 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data2) < 1){const err14 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/provider",schemaPath:"#/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.requestedModel !== undefined){let data3 = data.requestedModel;if(typeof data3 === "string"){if(func1(data3) > 240){const err16 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data3) < 1){const err17 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}else {const err18 = {instancePath:instancePath+"/requestedModel",schemaPath:"#/properties/requestedModel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.fromModel !== undefined){let data4 = data.fromModel;if((typeof data4 !== "string") && (data4 !== null)){const err19 = {instancePath:instancePath+"/fromModel",schemaPath:"#/properties/fromModel/type",keyword:"type",params:{type: schema76.properties.fromModel.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 240){const err20 = {instancePath:instancePath+"/fromModel",schemaPath:"#/properties/fromModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}if(data.effectiveModel !== undefined){let data5 = data.effectiveModel;if(typeof data5 === "string"){if(func1(data5) > 240){const err21 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data5) < 1){const err22 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}else {const err23 = {instancePath:instancePath+"/effectiveModel",schemaPath:"#/properties/effectiveModel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}if(data.reason !== undefined){let data6 = data.reason;if(typeof data6 === "string"){if(func1(data6) > 4000){const err24 = {instancePath:instancePath+"/reason",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}else {const err25 = {instancePath:instancePath+"/reason",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}else {const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}validate70.errors = vErrors;return errors === 0;}validate70.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema79 = {"type":"object","required":["schema","verificationId","status","classes","buffering","summary"],"properties":{"schema":{"const":"paperclip.model.verification.v1"},"verificationId":{"$ref":"#/$defs/id"},"status":{"enum":["running","completed","failed"]},"classes":{"type":"array","maxItems":32,"items":{"type":"string","maxLength":160}},"buffering":{"type":"boolean"},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate72(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate72.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.verificationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "verificationId"},message:"must have required property '"+"verificationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.status === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.classes === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "classes"},message:"must have required property '"+"classes"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.buffering === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "buffering"},message:"must have required property '"+"buffering"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.summary === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "verificationId")) || (key0 === "status")) || (key0 === "classes")) || (key0 === "buffering")) || (key0 === "summary"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.model.verification.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.model.verification.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.verificationId !== undefined){let data1 = data.verificationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/verificationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.status !== undefined){let data2 = data.status;if(!(((data2 === "running") || (data2 === "completed")) || (data2 === "failed"))){const err12 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema79.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.classes !== undefined){let data3 = data.classes;if(Array.isArray(data3)){if(data3.length > 32){const err13 = {instancePath:instancePath+"/classes",schemaPath:"#/properties/classes/maxItems",keyword:"maxItems",params:{limit: 32},message:"must NOT have more than 32 items"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}const len0 = data3.length;for(let i0=0; i0 160){const err14 = {instancePath:instancePath+"/classes/" + i0,schemaPath:"#/properties/classes/items/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/classes/" + i0,schemaPath:"#/properties/classes/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}else {const err16 = {instancePath:instancePath+"/classes",schemaPath:"#/properties/classes/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.buffering !== undefined){if(typeof data.buffering !== "boolean"){const err17 = {instancePath:instancePath+"/buffering",schemaPath:"#/properties/buffering/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.summary !== undefined){let data6 = data.summary;if((typeof data6 !== "string") && (data6 !== null)){const err18 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if(typeof data6 === "string"){if(func1(data6) > 4000){const err19 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}}else {const err20 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}validate72.errors = vErrors;return errors === 0;}validate72.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema82 = {"type":"object","required":["schema","compactionId","reason","preTokens","postTokens","sameSession"],"properties":{"schema":{"const":"paperclip.context.compacted.v1"},"compactionId":{"$ref":"#/$defs/id"},"reason":{"enum":["context_window","manual","provider","unknown"]},"preTokens":{"type":["integer","null"],"minimum":0},"postTokens":{"type":["integer","null"],"minimum":0},"sameSession":{"type":"boolean"}},"additionalProperties":false};function validate74(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate74.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.compactionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "compactionId"},message:"must have required property '"+"compactionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reason === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.preTokens === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "preTokens"},message:"must have required property '"+"preTokens"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.postTokens === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "postTokens"},message:"must have required property '"+"postTokens"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.sameSession === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sameSession"},message:"must have required property '"+"sameSession"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "compactionId")) || (key0 === "reason")) || (key0 === "preTokens")) || (key0 === "postTokens")) || (key0 === "sameSession"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.context.compacted.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.context.compacted.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.compactionId !== undefined){let data1 = data.compactionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/compactionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.reason !== undefined){let data2 = data.reason;if(!((((data2 === "context_window") || (data2 === "manual")) || (data2 === "provider")) || (data2 === "unknown"))){const err12 = {instancePath:instancePath+"/reason",schemaPath:"#/properties/reason/enum",keyword:"enum",params:{allowedValues: schema82.properties.reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.preTokens !== undefined){let data3 = data.preTokens;if((!(((typeof data3 == "number") && (!(data3 % 1) && !isNaN(data3))) && (isFinite(data3)))) && (data3 !== null)){const err13 = {instancePath:instancePath+"/preTokens",schemaPath:"#/properties/preTokens/type",keyword:"type",params:{type: schema82.properties.preTokens.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if((typeof data3 == "number") && (isFinite(data3))){if(data3 < 0 || isNaN(data3)){const err14 = {instancePath:instancePath+"/preTokens",schemaPath:"#/properties/preTokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}if(data.postTokens !== undefined){let data4 = data.postTokens;if((!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) && (data4 !== null)){const err15 = {instancePath:instancePath+"/postTokens",schemaPath:"#/properties/postTokens/type",keyword:"type",params:{type: schema82.properties.postTokens.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err16 = {instancePath:instancePath+"/postTokens",schemaPath:"#/properties/postTokens/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}if(data.sameSession !== undefined){if(typeof data.sameSession !== "boolean"){const err17 = {instancePath:instancePath+"/sameSession",schemaPath:"#/properties/sameSession/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate74.errors = vErrors;return errors === 0;}validate74.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema84 = {"type":"object","required":["schema","artifactId","reference","mediaType","title"],"properties":{"schema":{"const":"paperclip.artifact.viewed.v1"},"artifactId":{"$ref":"#/$defs/id"},"reference":{"$ref":"#/$defs/safePath"},"mediaType":{"type":["string","null"],"maxLength":160},"title":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate76(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate76.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.artifactId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "artifactId"},message:"must have required property '"+"artifactId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reference === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.mediaType === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.title === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "title"},message:"must have required property '"+"title"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "artifactId")) || (key0 === "reference")) || (key0 === "mediaType")) || (key0 === "title"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.artifact.viewed.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.artifact.viewed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.artifactId !== undefined){let data1 = data.artifactId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.reference !== undefined){let data2 = data.reference;if((typeof data2 !== "string") && (data2 !== null)){const err11 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema60.type},message:"must be string,null"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(typeof data2 === "string"){if(func1(data2) > 4096){const err12 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern19.test(data2)){const err13 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}if(data.mediaType !== undefined){let data3 = data.mediaType;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/type",keyword:"type",params:{type: schema84.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 160){const err15 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.title !== undefined){let data4 = data.title;if((typeof data4 !== "string") && (data4 !== null)){const err16 = {instancePath:instancePath+"/title",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 4000){const err17 = {instancePath:instancePath+"/title",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate76.errors = vErrors;return errors === 0;}validate76.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema88 = {"type":"object","required":["schema","artifactId","status","reference","mediaType","registered","failure"],"properties":{"schema":{"const":"paperclip.artifact.generated.v1"},"artifactId":{"$ref":"#/$defs/id"},"status":{"enum":["running","completed","failed"]},"reference":{"$ref":"#/$defs/safePath"},"mediaType":{"type":["string","null"],"maxLength":160},"registered":{"type":"boolean"},"transparentBackground":{"type":["boolean","null"]},"failure":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate78(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate78.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.artifactId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "artifactId"},message:"must have required property '"+"artifactId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.status === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.reference === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.mediaType === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.registered === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "registered"},message:"must have required property '"+"registered"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.failure === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "failure"},message:"must have required property '"+"failure"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "artifactId")) || (key0 === "status")) || (key0 === "reference")) || (key0 === "mediaType")) || (key0 === "registered")) || (key0 === "transparentBackground")) || (key0 === "failure"))){const err7 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.schema !== undefined){if("paperclip.artifact.generated.v1" !== data.schema){const err8 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.artifact.generated.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.artifactId !== undefined){let data1 = data.artifactId;if(typeof data1 === "string"){if(func1(data1) > 160){const err9 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data1) < 1){const err10 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data1)){const err11 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/artifactId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.status !== undefined){let data2 = data.status;if(!(((data2 === "running") || (data2 === "completed")) || (data2 === "failed"))){const err13 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema88.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.reference !== undefined){let data3 = data.reference;if((typeof data3 !== "string") && (data3 !== null)){const err14 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/type",keyword:"type",params:{type: schema60.type},message:"must be string,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4096){const err15 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(!pattern19.test(data3)){const err16 = {instancePath:instancePath+"/reference",schemaPath:"#/$defs/safePath/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).*$"+"\""};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}if(data.mediaType !== undefined){let data4 = data.mediaType;if((typeof data4 !== "string") && (data4 !== null)){const err17 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/type",keyword:"type",params:{type: schema88.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(typeof data4 === "string"){if(func1(data4) > 160){const err18 = {instancePath:instancePath+"/mediaType",schemaPath:"#/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data.registered !== undefined){if(typeof data.registered !== "boolean"){const err19 = {instancePath:instancePath+"/registered",schemaPath:"#/properties/registered/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.transparentBackground !== undefined){let data6 = data.transparentBackground;if((typeof data6 !== "boolean") && (data6 !== null)){const err20 = {instancePath:instancePath+"/transparentBackground",schemaPath:"#/properties/transparentBackground/type",keyword:"type",params:{type: schema88.properties.transparentBackground.type},message:"must be boolean,null"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.failure !== undefined){let data7 = data.failure;if((typeof data7 !== "string") && (data7 !== null)){const err21 = {instancePath:instancePath+"/failure",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 4000){const err22 = {instancePath:instancePath+"/failure",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}}else {const err23 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}validate78.errors = vErrors;return errors === 0;}validate78.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema92 = {"type":"object","required":["schema","reviewId","state","scope"],"properties":{"schema":{"const":"paperclip.review.mode_changed.v1"},"reviewId":{"$ref":"#/$defs/id"},"state":{"enum":["entered","exited"]},"scope":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate80(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate80.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.reviewId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reviewId"},message:"must have required property '"+"reviewId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.state === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "state"},message:"must have required property '"+"state"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.scope === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}for(const key0 in data){if(!((((key0 === "schema") || (key0 === "reviewId")) || (key0 === "state")) || (key0 === "scope"))){const err4 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.schema !== undefined){if("paperclip.review.mode_changed.v1" !== data.schema){const err5 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.review.mode_changed.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.reviewId !== undefined){let data1 = data.reviewId;if(typeof data1 === "string"){if(func1(data1) > 160){const err6 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(func1(data1) < 1){const err7 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(!pattern4.test(data1)){const err8 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.state !== undefined){let data2 = data.state;if(!((data2 === "entered") || (data2 === "exited"))){const err10 = {instancePath:instancePath+"/state",schemaPath:"#/properties/state/enum",keyword:"enum",params:{allowedValues: schema92.properties.state.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.scope !== undefined){let data3 = data.scope;if((typeof data3 !== "string") && (data3 !== null)){const err11 = {instancePath:instancePath+"/scope",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(typeof data3 === "string"){if(func1(data3) > 4000){const err12 = {instancePath:instancePath+"/scope",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}}else {const err13 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}validate80.errors = vErrors;return errors === 0;}validate80.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema95 = {"type":"object","required":["schema","hookId","event","scope","status","blocking","durationMs","summary"],"properties":{"schema":{"const":"paperclip.hook.v1"},"hookId":{"$ref":"#/$defs/id"},"event":{"type":"string","minLength":1,"maxLength":160},"scope":{"type":"string","minLength":1,"maxLength":160},"status":{"enum":["running","completed","failed","cancelled"]},"blocking":{"type":"boolean"},"durationMs":{"type":["integer","null"],"minimum":0},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate82(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate82.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.hookId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "hookId"},message:"must have required property '"+"hookId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.event === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "event"},message:"must have required property '"+"event"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.scope === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.status === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.blocking === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "blocking"},message:"must have required property '"+"blocking"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.durationMs === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "durationMs"},message:"must have required property '"+"durationMs"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.summary === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key0 in data){if(!((((((((key0 === "schema") || (key0 === "hookId")) || (key0 === "event")) || (key0 === "scope")) || (key0 === "status")) || (key0 === "blocking")) || (key0 === "durationMs")) || (key0 === "summary"))){const err8 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.schema !== undefined){if("paperclip.hook.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.hook.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.hookId !== undefined){let data1 = data.hookId;if(typeof data1 === "string"){if(func1(data1) > 160){const err10 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(func1(data1) < 1){const err11 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(!pattern4.test(data1)){const err12 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/hookId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.event !== undefined){let data2 = data.event;if(typeof data2 === "string"){if(func1(data2) > 160){const err14 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data2) < 1){const err15 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/event",schemaPath:"#/properties/event/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.scope !== undefined){let data3 = data.scope;if(typeof data3 === "string"){if(func1(data3) > 160){const err17 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data3) < 1){const err18 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.status !== undefined){let data4 = data.status;if(!((((data4 === "running") || (data4 === "completed")) || (data4 === "failed")) || (data4 === "cancelled"))){const err20 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema95.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.blocking !== undefined){if(typeof data.blocking !== "boolean"){const err21 = {instancePath:instancePath+"/blocking",schemaPath:"#/properties/blocking/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}if(data.durationMs !== undefined){let data6 = data.durationMs;if((!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) && (data6 !== null)){const err22 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/type",keyword:"type",params:{type: schema95.properties.durationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){const err23 = {instancePath:instancePath+"/durationMs",schemaPath:"#/properties/durationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data.summary !== undefined){let data7 = data.summary;if((typeof data7 !== "string") && (data7 !== null)){const err24 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(typeof data7 === "string"){if(func1(data7) > 4000){const err25 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}}else {const err26 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}validate82.errors = vErrors;return errors === 0;}validate82.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema98 = {"type":"object","required":["schema","citationId","messageItemId","label","available","reference"],"properties":{"schema":{"const":"paperclip.memory.citation.v1"},"citationId":{"$ref":"#/$defs/id"},"messageItemId":{"$ref":"#/$defs/id"},"label":{"$ref":"#/$defs/shortText"},"available":{"type":"boolean"},"reference":{"type":["string","null"],"maxLength":4096}},"additionalProperties":false};function validate84(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate84.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.citationId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "citationId"},message:"must have required property '"+"citationId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.messageItemId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "messageItemId"},message:"must have required property '"+"messageItemId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.label === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "label"},message:"must have required property '"+"label"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.available === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "available"},message:"must have required property '"+"available"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.reference === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reference"},message:"must have required property '"+"reference"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "citationId")) || (key0 === "messageItemId")) || (key0 === "label")) || (key0 === "available")) || (key0 === "reference"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.memory.citation.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.memory.citation.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.citationId !== undefined){let data1 = data.citationId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/citationId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.messageItemId !== undefined){let data2 = data.messageItemId;if(typeof data2 === "string"){if(func1(data2) > 160){const err12 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(!pattern4.test(data2)){const err14 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/messageItemId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.label !== undefined){let data3 = data.label;if(typeof data3 === "string"){if(func1(data3) > 4000){const err16 = {instancePath:instancePath+"/label",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {instancePath:instancePath+"/label",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.available !== undefined){if(typeof data.available !== "boolean"){const err18 = {instancePath:instancePath+"/available",schemaPath:"#/properties/available/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.reference !== undefined){let data5 = data.reference;if((typeof data5 !== "string") && (data5 !== null)){const err19 = {instancePath:instancePath+"/reference",schemaPath:"#/properties/reference/type",keyword:"type",params:{type: schema98.properties.reference.type},message:"must be string,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4096){const err20 = {instancePath:instancePath+"/reference",schemaPath:"#/properties/reference/maxLength",keyword:"maxLength",params:{limit: 4096},message:"must NOT have more than 4096 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}}else {const err21 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}validate84.errors = vErrors;return errors === 0;}validate84.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema102 = {"type":"object","required":["schema","reviewId","targetExecutionId","status","decision","summary"],"properties":{"schema":{"const":"paperclip.safety.review.v1"},"reviewId":{"$ref":"#/$defs/id"},"targetExecutionId":{"anyOf":[{"$ref":"#/$defs/id"},{"type":"null"}]},"status":{"enum":["running","completed","failed"]},"decision":{"enum":["pending","allowed","denied","user_required","unknown"]},"summary":{"$ref":"#/$defs/nullableShortText"}},"additionalProperties":false};function validate86(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate86.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.reviewId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reviewId"},message:"must have required property '"+"reviewId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.targetExecutionId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "targetExecutionId"},message:"must have required property '"+"targetExecutionId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.decision === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "decision"},message:"must have required property '"+"decision"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.summary === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "reviewId")) || (key0 === "targetExecutionId")) || (key0 === "status")) || (key0 === "decision")) || (key0 === "summary"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.safety.review.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.safety.review.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.reviewId !== undefined){let data1 = data.reviewId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/reviewId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.targetExecutionId !== undefined){let data2 = data.targetExecutionId;const _errs7 = errors;let valid2 = false;const _errs8 = errors;if(typeof data2 === "string"){if(func1(data2) > 160){const err12 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(!pattern4.test(data2)){const err14 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}var _valid0 = _errs8 === errors;valid2 = valid2 || _valid0;const _errs11 = errors;if(data2 !== null){const err16 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/properties/targetExecutionId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}var _valid0 = _errs11 === errors;valid2 = valid2 || _valid0;if(!valid2){const err17 = {instancePath:instancePath+"/targetExecutionId",schemaPath:"#/properties/targetExecutionId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}else {errors = _errs7;if(vErrors !== null){if(_errs7){vErrors.length = _errs7;}else {vErrors = null;}}}}if(data.status !== undefined){let data3 = data.status;if(!(((data3 === "running") || (data3 === "completed")) || (data3 === "failed"))){const err18 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema102.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.decision !== undefined){let data4 = data.decision;if(!(((((data4 === "pending") || (data4 === "allowed")) || (data4 === "denied")) || (data4 === "user_required")) || (data4 === "unknown"))){const err19 = {instancePath:instancePath+"/decision",schemaPath:"#/properties/decision/enum",keyword:"enum",params:{allowedValues: schema102.properties.decision.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.summary !== undefined){let data5 = data.summary;if((typeof data5 !== "string") && (data5 !== null)){const err20 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/type",keyword:"type",params:{type: schema54.type},message:"must be string,null"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(typeof data5 === "string"){if(func1(data5) > 4000){const err21 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/nullableShortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}}else {const err22 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}validate86.errors = vErrors;return errors === 0;}validate86.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema106 = {"type":"object","required":["schema","executionId","origin","inputClass","byteCount"],"properties":{"schema":{"const":"paperclip.terminal.input_sent.v1"},"executionId":{"$ref":"#/$defs/id"},"origin":{"enum":["agent","user","system"]},"inputClass":{"enum":["text","control","eof"]},"byteCount":{"type":"integer","minimum":0}},"additionalProperties":false};function validate88(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate88.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.executionId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "executionId"},message:"must have required property '"+"executionId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.origin === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "origin"},message:"must have required property '"+"origin"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.inputClass === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "inputClass"},message:"must have required property '"+"inputClass"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.byteCount === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "byteCount"},message:"must have required property '"+"byteCount"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "executionId")) || (key0 === "origin")) || (key0 === "inputClass")) || (key0 === "byteCount"))){const err5 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.schema !== undefined){if("paperclip.terminal.input_sent.v1" !== data.schema){const err6 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.terminal.input_sent.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.executionId !== undefined){let data1 = data.executionId;if(typeof data1 === "string"){if(func1(data1) > 160){const err7 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(func1(data1) < 1){const err8 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(!pattern4.test(data1)){const err9 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}else {const err10 = {instancePath:instancePath+"/executionId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.origin !== undefined){let data2 = data.origin;if(!(((data2 === "agent") || (data2 === "user")) || (data2 === "system"))){const err11 = {instancePath:instancePath+"/origin",schemaPath:"#/properties/origin/enum",keyword:"enum",params:{allowedValues: schema106.properties.origin.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.inputClass !== undefined){let data3 = data.inputClass;if(!(((data3 === "text") || (data3 === "control")) || (data3 === "eof"))){const err12 = {instancePath:instancePath+"/inputClass",schemaPath:"#/properties/inputClass/enum",keyword:"enum",params:{allowedValues: schema106.properties.inputClass.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.byteCount !== undefined){let data4 = data.byteCount;if(!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))){const err13 = {instancePath:instancePath+"/byteCount",schemaPath:"#/properties/byteCount/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err14 = {instancePath:instancePath+"/byteCount",schemaPath:"#/properties/byteCount/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}}else {const err15 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}validate88.errors = vErrors;return errors === 0;}validate88.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema108 = {"type":"object","required":["schema","waitId","reason","status","plannedDurationMs","elapsedDurationMs"],"properties":{"schema":{"const":"paperclip.wait.v1"},"waitId":{"$ref":"#/$defs/id"},"reason":{"enum":["timer","provider","rate_limit","unknown"]},"status":{"enum":["running","completed","interrupted","cancelled"]},"plannedDurationMs":{"type":["integer","null"],"minimum":0},"elapsedDurationMs":{"type":["integer","null"],"minimum":0}},"additionalProperties":false};function validate90(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate90.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.waitId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "waitId"},message:"must have required property '"+"waitId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.reason === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reason"},message:"must have required property '"+"reason"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.status === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.plannedDurationMs === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "plannedDurationMs"},message:"must have required property '"+"plannedDurationMs"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.elapsedDurationMs === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "elapsedDurationMs"},message:"must have required property '"+"elapsedDurationMs"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}for(const key0 in data){if(!((((((key0 === "schema") || (key0 === "waitId")) || (key0 === "reason")) || (key0 === "status")) || (key0 === "plannedDurationMs")) || (key0 === "elapsedDurationMs"))){const err6 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.schema !== undefined){if("paperclip.wait.v1" !== data.schema){const err7 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.wait.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.waitId !== undefined){let data1 = data.waitId;if(typeof data1 === "string"){if(func1(data1) > 160){const err8 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(func1(data1) < 1){const err9 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(!pattern4.test(data1)){const err10 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/waitId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.reason !== undefined){let data2 = data.reason;if(!((((data2 === "timer") || (data2 === "provider")) || (data2 === "rate_limit")) || (data2 === "unknown"))){const err12 = {instancePath:instancePath+"/reason",schemaPath:"#/properties/reason/enum",keyword:"enum",params:{allowedValues: schema108.properties.reason.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.status !== undefined){let data3 = data.status;if(!((((data3 === "running") || (data3 === "completed")) || (data3 === "interrupted")) || (data3 === "cancelled"))){const err13 = {instancePath:instancePath+"/status",schemaPath:"#/properties/status/enum",keyword:"enum",params:{allowedValues: schema108.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.plannedDurationMs !== undefined){let data4 = data.plannedDurationMs;if((!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) && (data4 !== null)){const err14 = {instancePath:instancePath+"/plannedDurationMs",schemaPath:"#/properties/plannedDurationMs/type",keyword:"type",params:{type: schema108.properties.plannedDurationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if((typeof data4 == "number") && (isFinite(data4))){if(data4 < 0 || isNaN(data4)){const err15 = {instancePath:instancePath+"/plannedDurationMs",schemaPath:"#/properties/plannedDurationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}}if(data.elapsedDurationMs !== undefined){let data5 = data.elapsedDurationMs;if((!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) && (data5 !== null)){const err16 = {instancePath:instancePath+"/elapsedDurationMs",schemaPath:"#/properties/elapsedDurationMs/type",keyword:"type",params:{type: schema108.properties.elapsedDurationMs.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 0 || isNaN(data5)){const err17 = {instancePath:instancePath+"/elapsedDurationMs",schemaPath:"#/properties/elapsedDurationMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}}}else {const err18 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}validate90.errors = vErrors;return errors === 0;}validate90.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema110 = {"type":"object","required":["schema","noticeId","severity","category","scope","recoverable","userActionable","summary"],"properties":{"schema":{"const":"paperclip.provider.notice.v1"},"noticeId":{"$ref":"#/$defs/id"},"severity":{"enum":["info","warning","error"]},"category":{"type":"string","minLength":1,"maxLength":160},"scope":{"enum":["turn","session","environment","account"]},"recoverable":{"type":"boolean"},"userActionable":{"type":"boolean"},"summary":{"$ref":"#/$defs/shortText"},"provenance":{"type":"object","required":["method","eventType","sessionId","turnId"],"properties":{"method":{"type":"string","maxLength":160},"eventType":{"type":"string","maxLength":160},"sessionId":{"type":"string","maxLength":240},"turnId":{"type":"string","maxLength":240},"agentId":{"type":"string","maxLength":240},"timestamp":{"type":"string","maxLength":80}},"additionalProperties":false},"details":{"type":"array","maxItems":64,"items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string","minLength":1,"maxLength":160},"value":{"type":"string","maxLength":4000}},"additionalProperties":false}}},"additionalProperties":false};function validate92(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate92.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.noticeId === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "noticeId"},message:"must have required property '"+"noticeId"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.severity === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "severity"},message:"must have required property '"+"severity"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.category === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "category"},message:"must have required property '"+"category"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.scope === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "scope"},message:"must have required property '"+"scope"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.recoverable === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "recoverable"},message:"must have required property '"+"recoverable"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.userActionable === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "userActionable"},message:"must have required property '"+"userActionable"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.summary === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}for(const key0 in data){if(!(func66.call(schema110.properties, key0))){const err8 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.schema !== undefined){if("paperclip.provider.notice.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.provider.notice.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.noticeId !== undefined){let data1 = data.noticeId;if(typeof data1 === "string"){if(func1(data1) > 160){const err10 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(func1(data1) < 1){const err11 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(!pattern4.test(data1)){const err12 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/noticeId",schemaPath:"#/$defs/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}if(data.severity !== undefined){let data2 = data.severity;if(!(((data2 === "info") || (data2 === "warning")) || (data2 === "error"))){const err14 = {instancePath:instancePath+"/severity",schemaPath:"#/properties/severity/enum",keyword:"enum",params:{allowedValues: schema110.properties.severity.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.category !== undefined){let data3 = data.category;if(typeof data3 === "string"){if(func1(data3) > 160){const err15 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(func1(data3) < 1){const err16 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {instancePath:instancePath+"/category",schemaPath:"#/properties/category/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.scope !== undefined){let data4 = data.scope;if(!((((data4 === "turn") || (data4 === "session")) || (data4 === "environment")) || (data4 === "account"))){const err18 = {instancePath:instancePath+"/scope",schemaPath:"#/properties/scope/enum",keyword:"enum",params:{allowedValues: schema110.properties.scope.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.recoverable !== undefined){if(typeof data.recoverable !== "boolean"){const err19 = {instancePath:instancePath+"/recoverable",schemaPath:"#/properties/recoverable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.userActionable !== undefined){if(typeof data.userActionable !== "boolean"){const err20 = {instancePath:instancePath+"/userActionable",schemaPath:"#/properties/userActionable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.summary !== undefined){let data7 = data.summary;if(typeof data7 === "string"){if(func1(data7) > 4000){const err21 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/shortText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/summary",schemaPath:"#/$defs/shortText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.provenance !== undefined){let data8 = data.provenance;if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.method === undefined){const err23 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "method"},message:"must have required property '"+"method"+"'"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(data8.eventType === undefined){const err24 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "eventType"},message:"must have required property '"+"eventType"+"'"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(data8.sessionId === undefined){const err25 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "sessionId"},message:"must have required property '"+"sessionId"+"'"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(data8.turnId === undefined){const err26 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}for(const key1 in data8){if(!((((((key1 === "method") || (key1 === "eventType")) || (key1 === "sessionId")) || (key1 === "turnId")) || (key1 === "agentId")) || (key1 === "timestamp"))){const err27 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data8.method !== undefined){let data9 = data8.method;if(typeof data9 === "string"){if(func1(data9) > 160){const err28 = {instancePath:instancePath+"/provenance/method",schemaPath:"#/properties/provenance/properties/method/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/provenance/method",schemaPath:"#/properties/provenance/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data8.eventType !== undefined){let data10 = data8.eventType;if(typeof data10 === "string"){if(func1(data10) > 160){const err30 = {instancePath:instancePath+"/provenance/eventType",schemaPath:"#/properties/provenance/properties/eventType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}else {const err31 = {instancePath:instancePath+"/provenance/eventType",schemaPath:"#/properties/provenance/properties/eventType/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data8.sessionId !== undefined){let data11 = data8.sessionId;if(typeof data11 === "string"){if(func1(data11) > 240){const err32 = {instancePath:instancePath+"/provenance/sessionId",schemaPath:"#/properties/provenance/properties/sessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/provenance/sessionId",schemaPath:"#/properties/provenance/properties/sessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data8.turnId !== undefined){let data12 = data8.turnId;if(typeof data12 === "string"){if(func1(data12) > 240){const err34 = {instancePath:instancePath+"/provenance/turnId",schemaPath:"#/properties/provenance/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}else {const err35 = {instancePath:instancePath+"/provenance/turnId",schemaPath:"#/properties/provenance/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data8.agentId !== undefined){let data13 = data8.agentId;if(typeof data13 === "string"){if(func1(data13) > 240){const err36 = {instancePath:instancePath+"/provenance/agentId",schemaPath:"#/properties/provenance/properties/agentId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {instancePath:instancePath+"/provenance/agentId",schemaPath:"#/properties/provenance/properties/agentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}if(data8.timestamp !== undefined){let data14 = data8.timestamp;if(typeof data14 === "string"){if(func1(data14) > 80){const err38 = {instancePath:instancePath+"/provenance/timestamp",schemaPath:"#/properties/provenance/properties/timestamp/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}else {const err39 = {instancePath:instancePath+"/provenance/timestamp",schemaPath:"#/properties/provenance/properties/timestamp/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}}else {const err40 = {instancePath:instancePath+"/provenance",schemaPath:"#/properties/provenance/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data.details !== undefined){let data15 = data.details;if(Array.isArray(data15)){if(data15.length > 64){const err41 = {instancePath:instancePath+"/details",schemaPath:"#/properties/details/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}const len0 = data15.length;for(let i0=0; i0 160){const err45 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(func1(data17) < 1){const err46 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}else {const err47 = {instancePath:instancePath+"/details/" + i0+"/name",schemaPath:"#/properties/details/items/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data16.value !== undefined){let data18 = data16.value;if(typeof data18 === "string"){if(func1(data18) > 4000){const err48 = {instancePath:instancePath+"/details/" + i0+"/value",schemaPath:"#/properties/details/items/properties/value/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}else {const err49 = {instancePath:instancePath+"/details/" + i0+"/value",schemaPath:"#/properties/details/items/properties/value/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}}else {const err50 = {instancePath:instancePath+"/details/" + i0,schemaPath:"#/properties/details/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/details",schemaPath:"#/properties/details/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}}else {const err52 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}validate92.errors = vErrors;return errors === 0;}validate92.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema177 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json","title":"PRP provider-neutral semantic tool envelope","type":"object","required":["schema","schemaVersion","phase","operationId","callId","correlation","idempotencyKey","content"],"properties":{"schema":{"const":"paperclip.prp.semantic_tool.v1"},"schemaVersion":{"const":1},"phase":{"enum":["input","result","reconciled"]},"operationId":{"$ref":"#/$defs/stableId"},"callId":{"$ref":"#/$defs/stableId"},"correlation":{"type":"object","required":["runId","normalizedSessionId","turnId","itemId"],"properties":{"runId":{"$ref":"#/$defs/stableId"},"normalizedSessionId":{"$ref":"#/$defs/stableId"},"turnId":{"$ref":"#/$defs/stableId"},"itemId":{"$ref":"#/$defs/stableId"},"requestId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true},"idempotencyKey":{"type":["string","null"],"minLength":1,"maxLength":240},"content":{"$ref":"#/$defs/safeContent"},"outcome":{"enum":["succeeded","denied","conflict","duplicate","unavailable","failed"]},"code":{"$ref":"#/$defs/stableCode"},"retryable":{"type":"boolean"},"authorizationBoundary":{"enum":["company","actor","active_task","grant","governed_action","lock","revision"]},"operationReceiptId":{"$ref":"#/$defs/stableId"},"auditReceiptId":{"$ref":"#/$defs/stableId"},"currentRevision":{"oneOf":[{"type":"integer","minimum":0},{"$ref":"#/$defs/stableId"}]},"duplicateOfReceiptId":{"$ref":"#/$defs/stableId"},"artifactRefs":{"type":"array","items":{"allOf":[{"$ref":"#/$defs/safeReference"},{"type":"object","properties":{"kind":{"enum":["artifact","work_product"]}}}]},"uniqueItems":true},"targets":{"type":"array","items":{"$ref":"#/$defs/immutableTarget"},"uniqueItems":true},"causalRefs":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"allOf":[{"if":{"properties":{"phase":{"enum":["result","reconciled"]}},"required":["phase"]},"then":{"required":["outcome","code","retryable","authorizationBoundary","operationReceiptId"]}}],"additionalProperties":true,"$defs":{"stableId":{"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"stableCode":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"},"safeContent":{"type":"object","required":["digest","redactionDisposition","references"],"properties":{"digest":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"redactionDisposition":{"enum":["digest_only","allowlisted_references","redacted"]},"references":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"additionalProperties":true},"safeReference":{"type":"object","required":["kind","id"],"properties":{"kind":{"enum":["task","document_revision","interaction","approval","decision","artifact","work_product","wake","monitor","audit","operation"]},"id":{"$ref":"#/$defs/stableId"}},"additionalProperties":true},"immutableTarget":{"type":"object","required":["kind","id","immutable"],"properties":{"kind":{"enum":["document_revision","interaction","approval","decision"]},"id":{"$ref":"#/$defs/stableId"},"immutable":{"const":true},"revisionId":{"$ref":"#/$defs/stableId"},"decisionId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true}}};const schema178 = {"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};const schema188 = {"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"};const pattern14 = new RegExp("^[a-z][a-z0-9_.:-]*$", "u");const schema185 = {"type":"object","required":["digest","redactionDisposition","references"],"properties":{"digest":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"redactionDisposition":{"enum":["digest_only","allowlisted_references","redacted"]},"references":{"type":"array","items":{"$ref":"#/$defs/safeReference"},"uniqueItems":true}},"additionalProperties":true};const schema186 = {"type":"object","required":["kind","id"],"properties":{"kind":{"enum":["task","document_revision","interaction","approval","decision","artifact","work_product","wake","monitor","audit","operation"]},"id":{"$ref":"#/$defs/stableId"}},"additionalProperties":true};function validate96(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate96.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.kind === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.kind !== undefined){let data0 = data.kind;if(!(((((((((((data0 === "task") || (data0 === "document_revision")) || (data0 === "interaction")) || (data0 === "approval")) || (data0 === "decision")) || (data0 === "artifact")) || (data0 === "work_product")) || (data0 === "wake")) || (data0 === "monitor")) || (data0 === "audit")) || (data0 === "operation"))){const err2 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema186.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.id !== undefined){let data1 = data.id;if(typeof data1 === "string"){if(func1(data1) > 240){const err3 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(func1(data1) < 1){const err4 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(!pattern4.test(data1)){const err5 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}else {const err6 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}else {const err7 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}validate96.errors = vErrors;return errors === 0;}validate96.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate95(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate95.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.digest === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "digest"},message:"must have required property '"+"digest"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.redactionDisposition === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "redactionDisposition"},message:"must have required property '"+"redactionDisposition"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.references === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "references"},message:"must have required property '"+"references"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.digest !== undefined){let data0 = data.digest;if(typeof data0 === "string"){if(!pattern20.test(data0)){const err3 = {instancePath:instancePath+"/digest",schemaPath:"#/properties/digest/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}else {const err4 = {instancePath:instancePath+"/digest",schemaPath:"#/properties/digest/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.redactionDisposition !== undefined){let data1 = data.redactionDisposition;if(!(((data1 === "digest_only") || (data1 === "allowlisted_references")) || (data1 === "redacted"))){const err5 = {instancePath:instancePath+"/redactionDisposition",schemaPath:"#/properties/redactionDisposition/enum",keyword:"enum",params:{allowedValues: schema185.properties.redactionDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.references !== undefined){let data2 = data.references;if(Array.isArray(data2)){const len0 = data2.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data2[i1], data2[j0])){const err6 = {instancePath:instancePath+"/references",schemaPath:"#/properties/references/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;break outer0;}}}}}else {const err7 = {instancePath:instancePath+"/references",schemaPath:"#/properties/references/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}}else {const err8 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}validate95.errors = vErrors;return errors === 0;}validate95.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema193 = {"type":"object","required":["kind","id","immutable"],"properties":{"kind":{"enum":["document_revision","interaction","approval","decision"]},"id":{"$ref":"#/$defs/stableId"},"immutable":{"const":true},"revisionId":{"$ref":"#/$defs/stableId"},"decisionId":{"$ref":"#/$defs/stableId"}},"additionalProperties":true};function validate100(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate100.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.kind === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.immutable === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "immutable"},message:"must have required property '"+"immutable"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.kind !== undefined){let data0 = data.kind;if(!((((data0 === "document_revision") || (data0 === "interaction")) || (data0 === "approval")) || (data0 === "decision"))){const err3 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema193.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data.id !== undefined){let data1 = data.id;if(typeof data1 === "string"){if(func1(data1) > 240){const err4 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(func1(data1) < 1){const err5 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(!pattern4.test(data1)){const err6 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/id",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.immutable !== undefined){if(true !== data.immutable){const err8 = {instancePath:instancePath+"/immutable",schemaPath:"#/properties/immutable/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.revisionId !== undefined){let data3 = data.revisionId;if(typeof data3 === "string"){if(func1(data3) > 240){const err9 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(func1(data3) < 1){const err10 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(!pattern4.test(data3)){const err11 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}else {const err12 = {instancePath:instancePath+"/revisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.decisionId !== undefined){let data4 = data.decisionId;if(typeof data4 === "string"){if(func1(data4) > 240){const err13 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data4) < 1){const err14 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(!pattern4.test(data4)){const err15 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}else {const err17 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}validate100.errors = vErrors;return errors === 0;}validate100.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate94(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/semantic-tool.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate94.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.phase === undefined) && (missing0 = "phase")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.phase !== undefined){let data0 = data.phase;if(!((data0 === "result") || (data0 === "reconciled"))){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.outcome === undefined){const err2 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "outcome"},message:"must have required property '"+"outcome"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.code === undefined){const err3 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "code"},message:"must have required property '"+"code"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.retryable === undefined){const err4 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "retryable"},message:"must have required property '"+"retryable"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.authorizationBoundary === undefined){const err5 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "authorizationBoundary"},message:"must have required property '"+"authorizationBoundary"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.operationReceiptId === undefined){const err6 = {instancePath,schemaPath:"#/allOf/0/then/required",keyword:"required",params:{missingProperty: "operationReceiptId"},message:"must have required property '"+"operationReceiptId"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}var _valid0 = _errs5 === errors;valid1 = _valid0;}if(!valid1){const err7 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.schemaVersion === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.phase === undefined){const err10 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "phase"},message:"must have required property '"+"phase"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data.operationId === undefined){const err11 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "operationId"},message:"must have required property '"+"operationId"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data.callId === undefined){const err12 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "callId"},message:"must have required property '"+"callId"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data.correlation === undefined){const err13 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "correlation"},message:"must have required property '"+"correlation"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data.idempotencyKey === undefined){const err14 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "idempotencyKey"},message:"must have required property '"+"idempotencyKey"+"'"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(data.content === undefined){const err15 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "content"},message:"must have required property '"+"content"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data.schema !== undefined){if("paperclip.prp.semantic_tool.v1" !== data.schema){const err16 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.semantic_tool.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err17 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data.phase !== undefined){let data3 = data.phase;if(!(((data3 === "input") || (data3 === "result")) || (data3 === "reconciled"))){const err18 = {instancePath:instancePath+"/phase",schemaPath:"#/properties/phase/enum",keyword:"enum",params:{allowedValues: schema177.properties.phase.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.operationId !== undefined){let data4 = data.operationId;if(typeof data4 === "string"){if(func1(data4) > 240){const err19 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(func1(data4) < 1){const err20 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(!pattern4.test(data4)){const err21 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/operationId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.callId !== undefined){let data5 = data.callId;if(typeof data5 === "string"){if(func1(data5) > 240){const err23 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(func1(data5) < 1){const err24 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(!pattern4.test(data5)){const err25 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}else {const err26 = {instancePath:instancePath+"/callId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.correlation !== undefined){let data6 = data.correlation;if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.runId === undefined){const err27 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data6.normalizedSessionId === undefined){const err28 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data6.turnId === undefined){const err29 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data6.itemId === undefined){const err30 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/required",keyword:"required",params:{missingProperty: "itemId"},message:"must have required property '"+"itemId"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data6.runId !== undefined){let data7 = data6.runId;if(typeof data7 === "string"){if(func1(data7) > 240){const err31 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(func1(data7) < 1){const err32 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(!pattern4.test(data7)){const err33 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}else {const err34 = {instancePath:instancePath+"/correlation/runId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data6.normalizedSessionId !== undefined){let data8 = data6.normalizedSessionId;if(typeof data8 === "string"){if(func1(data8) > 240){const err35 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(func1(data8) < 1){const err36 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(!pattern4.test(data8)){const err37 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}else {const err38 = {instancePath:instancePath+"/correlation/normalizedSessionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data6.turnId !== undefined){let data9 = data6.turnId;if(typeof data9 === "string"){if(func1(data9) > 240){const err39 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(func1(data9) < 1){const err40 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(!pattern4.test(data9)){const err41 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}else {const err42 = {instancePath:instancePath+"/correlation/turnId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data6.itemId !== undefined){let data10 = data6.itemId;if(typeof data10 === "string"){if(func1(data10) > 240){const err43 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(func1(data10) < 1){const err44 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(!pattern4.test(data10)){const err45 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}else {const err46 = {instancePath:instancePath+"/correlation/itemId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data6.requestId !== undefined){let data11 = data6.requestId;if(typeof data11 === "string"){if(func1(data11) > 240){const err47 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(func1(data11) < 1){const err48 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(!pattern4.test(data11)){const err49 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}else {const err50 = {instancePath:instancePath+"/correlation/requestId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}}else {const err51 = {instancePath:instancePath+"/correlation",schemaPath:"#/properties/correlation/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data.idempotencyKey !== undefined){let data12 = data.idempotencyKey;if((typeof data12 !== "string") && (data12 !== null)){const err52 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/type",keyword:"type",params:{type: schema177.properties.idempotencyKey.type},message:"must be string,null"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(typeof data12 === "string"){if(func1(data12) > 240){const err53 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}if(func1(data12) < 1){const err54 = {instancePath:instancePath+"/idempotencyKey",schemaPath:"#/properties/idempotencyKey/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}}if(data.content !== undefined){if(!(validate95(data.content, {instancePath:instancePath+"/content",parentData:data,parentDataProperty:"content",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate95.errors : vErrors.concat(validate95.errors);errors = vErrors.length;}}if(data.outcome !== undefined){let data14 = data.outcome;if(!((((((data14 === "succeeded") || (data14 === "denied")) || (data14 === "conflict")) || (data14 === "duplicate")) || (data14 === "unavailable")) || (data14 === "failed"))){const err55 = {instancePath:instancePath+"/outcome",schemaPath:"#/properties/outcome/enum",keyword:"enum",params:{allowedValues: schema177.properties.outcome.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data.code !== undefined){let data15 = data.code;if(typeof data15 === "string"){if(func1(data15) > 160){const err56 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}if(func1(data15) < 1){const err57 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}if(!pattern14.test(data15)){const err58 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}else {const err59 = {instancePath:instancePath+"/code",schemaPath:"#/$defs/stableCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data.retryable !== undefined){if(typeof data.retryable !== "boolean"){const err60 = {instancePath:instancePath+"/retryable",schemaPath:"#/properties/retryable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data.authorizationBoundary !== undefined){let data17 = data.authorizationBoundary;if(!(((((((data17 === "company") || (data17 === "actor")) || (data17 === "active_task")) || (data17 === "grant")) || (data17 === "governed_action")) || (data17 === "lock")) || (data17 === "revision"))){const err61 = {instancePath:instancePath+"/authorizationBoundary",schemaPath:"#/properties/authorizationBoundary/enum",keyword:"enum",params:{allowedValues: schema177.properties.authorizationBoundary.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data.operationReceiptId !== undefined){let data18 = data.operationReceiptId;if(typeof data18 === "string"){if(func1(data18) > 240){const err62 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(func1(data18) < 1){const err63 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}if(!pattern4.test(data18)){const err64 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}else {const err65 = {instancePath:instancePath+"/operationReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data.auditReceiptId !== undefined){let data19 = data.auditReceiptId;if(typeof data19 === "string"){if(func1(data19) > 240){const err66 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(func1(data19) < 1){const err67 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}if(!pattern4.test(data19)){const err68 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}else {const err69 = {instancePath:instancePath+"/auditReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data.currentRevision !== undefined){let data20 = data.currentRevision;const _errs51 = errors;let valid15 = false;let passing0 = null;const _errs52 = errors;if(!(((typeof data20 == "number") && (!(data20 % 1) && !isNaN(data20))) && (isFinite(data20)))){const err70 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf/0/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if((typeof data20 == "number") && (isFinite(data20))){if(data20 < 0 || isNaN(data20)){const err71 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}var _valid1 = _errs52 === errors;if(_valid1){valid15 = true;passing0 = 0;}const _errs54 = errors;if(typeof data20 === "string"){if(func1(data20) > 240){const err72 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(func1(data20) < 1){const err73 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(!pattern4.test(data20)){const err74 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}else {const err75 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}var _valid1 = _errs54 === errors;if(_valid1 && valid15){valid15 = false;passing0 = [passing0, 1];}else {if(_valid1){valid15 = true;passing0 = 1;}}if(!valid15){const err76 = {instancePath:instancePath+"/currentRevision",schemaPath:"#/properties/currentRevision/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}else {errors = _errs51;if(vErrors !== null){if(_errs51){vErrors.length = _errs51;}else {vErrors = null;}}}}if(data.duplicateOfReceiptId !== undefined){let data21 = data.duplicateOfReceiptId;if(typeof data21 === "string"){if(func1(data21) > 240){const err77 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(func1(data21) < 1){const err78 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(!pattern4.test(data21)){const err79 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}else {const err80 = {instancePath:instancePath+"/duplicateOfReceiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data.artifactRefs !== undefined){let data22 = data.artifactRefs;if(Array.isArray(data22)){const len0 = data22.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data22[i1], data22[j0])){const err83 = {instancePath:instancePath+"/artifactRefs",schemaPath:"#/properties/artifactRefs/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;break outer0;}}}}}else {const err84 = {instancePath:instancePath+"/artifactRefs",schemaPath:"#/properties/artifactRefs/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data.targets !== undefined){let data25 = data.targets;if(Array.isArray(data25)){const len1 = data25.length;for(let i2=0; i2 1){outer1:for(;i3--;){for(j1 = i3; j1--;){if(func0(data25[i3], data25[j1])){const err85 = {instancePath:instancePath+"/targets",schemaPath:"#/properties/targets/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;break outer1;}}}}}else {const err86 = {instancePath:instancePath+"/targets",schemaPath:"#/properties/targets/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data.causalRefs !== undefined){let data27 = data.causalRefs;if(Array.isArray(data27)){const len2 = data27.length;for(let i4=0; i4 1){outer2:for(;i5--;){for(j2 = i5; j2--;){if(func0(data27[i5], data27[j2])){const err87 = {instancePath:instancePath+"/causalRefs",schemaPath:"#/properties/causalRefs/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j2},message:"must NOT have duplicate items (items ## "+j2+" and "+i5+" are identical)"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;break outer2;}}}}}else {const err88 = {instancePath:instancePath+"/causalRefs",schemaPath:"#/properties/causalRefs/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}}else {const err89 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}validate94.errors = vErrors;return errors === 0;}validate94.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema197 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/terminal.schema.json","title":"PRP run terminal state","type":"object","required":["schema","turnTerminalState","runTerminalState","reportedWorkDisposition"],"properties":{"schema":{"const":"paperclip.prp.terminal.v1"},"turnTerminalState":{"enum":["completed","failed","interrupted","cancelled"]},"runTerminalState":{"enum":["succeeded","failed","cancelled"]},"reportedWorkDisposition":{"enum":["done","blocked","needs_review","yielded"]},"workAssessmentId":{"type":"string","minLength":1},"statusDecisionId":{"type":"string","minLength":1},"stopReason":{"$ref":"https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json"}},"additionalProperties":true};const schema198 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json","title":"PRP terminal stop reason receipt","type":"object","required":["schema","schemaVersion","receiptId","kind","code","retryable","decisionId","limitClass","aggregate"],"properties":{"schema":{"const":"paperclip.prp.stop_reason.v1"},"schemaVersion":{"const":1},"receiptId":{"$ref":"#/$defs/stableId"},"kind":{"enum":["budget","cost"]},"code":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[a-z][a-z0-9_.:-]*$"},"retryable":{"type":"boolean"},"decisionId":{"$ref":"#/$defs/stableId"},"limitClass":{"enum":["company_monthly","actor_monthly","project_monthly","run_cost","provider_quota"]},"aggregate":{"type":"object","required":["unit","observed","limit","window"],"properties":{"unit":{"enum":["cents","usd_micros","tokens"]},"observed":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":0},"window":{"enum":["run","monthly_utc","provider_window"]}},"additionalProperties":true},"relatedReceiptIds":{"type":"array","items":{"$ref":"#/$defs/stableId"},"uniqueItems":true}},"additionalProperties":true,"$defs":{"stableId":{"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"}}};const schema199 = {"type":"string","minLength":1,"maxLength":240,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"};function validate107(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/stop-reason.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate107.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.schemaVersion === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.receiptId === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "receiptId"},message:"must have required property '"+"receiptId"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.kind === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.code === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "code"},message:"must have required property '"+"code"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.retryable === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "retryable"},message:"must have required property '"+"retryable"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.decisionId === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "decisionId"},message:"must have required property '"+"decisionId"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.limitClass === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "limitClass"},message:"must have required property '"+"limitClass"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.aggregate === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "aggregate"},message:"must have required property '"+"aggregate"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.schema !== undefined){if("paperclip.prp.stop_reason.v1" !== data.schema){const err9 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.stop_reason.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err10 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.receiptId !== undefined){let data2 = data.receiptId;if(typeof data2 === "string"){if(func1(data2) > 240){const err11 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(func1(data2) < 1){const err12 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(!pattern4.test(data2)){const err13 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/receiptId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.kind !== undefined){let data3 = data.kind;if(!((data3 === "budget") || (data3 === "cost"))){const err15 = {instancePath:instancePath+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues: schema198.properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.code !== undefined){let data4 = data.code;if(typeof data4 === "string"){if(func1(data4) > 160){const err16 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data4) < 1){const err17 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(!pattern14.test(data4)){const err18 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/code",schemaPath:"#/properties/code/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.retryable !== undefined){if(typeof data.retryable !== "boolean"){const err20 = {instancePath:instancePath+"/retryable",schemaPath:"#/properties/retryable/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}if(data.decisionId !== undefined){let data6 = data.decisionId;if(typeof data6 === "string"){if(func1(data6) > 240){const err21 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(func1(data6) < 1){const err22 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(!pattern4.test(data6)){const err23 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/decisionId",schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.limitClass !== undefined){let data7 = data.limitClass;if(!(((((data7 === "company_monthly") || (data7 === "actor_monthly")) || (data7 === "project_monthly")) || (data7 === "run_cost")) || (data7 === "provider_quota"))){const err25 = {instancePath:instancePath+"/limitClass",schemaPath:"#/properties/limitClass/enum",keyword:"enum",params:{allowedValues: schema198.properties.limitClass.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.aggregate !== undefined){let data8 = data.aggregate;if(data8 && typeof data8 == "object" && !Array.isArray(data8)){if(data8.unit === undefined){const err26 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "unit"},message:"must have required property '"+"unit"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(data8.observed === undefined){const err27 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "observed"},message:"must have required property '"+"observed"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data8.limit === undefined){const err28 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "limit"},message:"must have required property '"+"limit"+"'"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(data8.window === undefined){const err29 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/required",keyword:"required",params:{missingProperty: "window"},message:"must have required property '"+"window"+"'"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(data8.unit !== undefined){let data9 = data8.unit;if(!(((data9 === "cents") || (data9 === "usd_micros")) || (data9 === "tokens"))){const err30 = {instancePath:instancePath+"/aggregate/unit",schemaPath:"#/properties/aggregate/properties/unit/enum",keyword:"enum",params:{allowedValues: schema198.properties.aggregate.properties.unit.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data8.observed !== undefined){let data10 = data8.observed;if(!(((typeof data10 == "number") && (!(data10 % 1) && !isNaN(data10))) && (isFinite(data10)))){const err31 = {instancePath:instancePath+"/aggregate/observed",schemaPath:"#/properties/aggregate/properties/observed/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if((typeof data10 == "number") && (isFinite(data10))){if(data10 < 0 || isNaN(data10)){const err32 = {instancePath:instancePath+"/aggregate/observed",schemaPath:"#/properties/aggregate/properties/observed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}if(data8.limit !== undefined){let data11 = data8.limit;if(!(((typeof data11 == "number") && (!(data11 % 1) && !isNaN(data11))) && (isFinite(data11)))){const err33 = {instancePath:instancePath+"/aggregate/limit",schemaPath:"#/properties/aggregate/properties/limit/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if((typeof data11 == "number") && (isFinite(data11))){if(data11 < 0 || isNaN(data11)){const err34 = {instancePath:instancePath+"/aggregate/limit",schemaPath:"#/properties/aggregate/properties/limit/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}if(data8.window !== undefined){let data12 = data8.window;if(!(((data12 === "run") || (data12 === "monthly_utc")) || (data12 === "provider_window"))){const err35 = {instancePath:instancePath+"/aggregate/window",schemaPath:"#/properties/aggregate/properties/window/enum",keyword:"enum",params:{allowedValues: schema198.properties.aggregate.properties.window.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}}else {const err36 = {instancePath:instancePath+"/aggregate",schemaPath:"#/properties/aggregate/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}if(data.relatedReceiptIds !== undefined){let data13 = data.relatedReceiptIds;if(Array.isArray(data13)){const len0 = data13.length;for(let i0=0; i0 240){const err37 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(func1(data14) < 1){const err38 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(!pattern4.test(data14)){const err39 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/relatedReceiptIds/" + i0,schemaPath:"#/$defs/stableId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}let i1 = data13.length;let j0;if(i1 > 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data13[i1], data13[j0])){const err41 = {instancePath:instancePath+"/relatedReceiptIds",schemaPath:"#/properties/relatedReceiptIds/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;break outer0;}}}}}else {const err42 = {instancePath:instancePath+"/relatedReceiptIds",schemaPath:"#/properties/relatedReceiptIds/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}else {const err43 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}validate107.errors = vErrors;return errors === 0;}validate107.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate106(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/terminal.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate106.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.turnTerminalState === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "turnTerminalState"},message:"must have required property '"+"turnTerminalState"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.runTerminalState === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runTerminalState"},message:"must have required property '"+"runTerminalState"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.reportedWorkDisposition === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "reportedWorkDisposition"},message:"must have required property '"+"reportedWorkDisposition"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.schema !== undefined){if("paperclip.prp.terminal.v1" !== data.schema){const err4 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.terminal.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.turnTerminalState !== undefined){let data1 = data.turnTerminalState;if(!((((data1 === "completed") || (data1 === "failed")) || (data1 === "interrupted")) || (data1 === "cancelled"))){const err5 = {instancePath:instancePath+"/turnTerminalState",schemaPath:"#/properties/turnTerminalState/enum",keyword:"enum",params:{allowedValues: schema197.properties.turnTerminalState.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.runTerminalState !== undefined){let data2 = data.runTerminalState;if(!(((data2 === "succeeded") || (data2 === "failed")) || (data2 === "cancelled"))){const err6 = {instancePath:instancePath+"/runTerminalState",schemaPath:"#/properties/runTerminalState/enum",keyword:"enum",params:{allowedValues: schema197.properties.runTerminalState.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.reportedWorkDisposition !== undefined){let data3 = data.reportedWorkDisposition;if(!((((data3 === "done") || (data3 === "blocked")) || (data3 === "needs_review")) || (data3 === "yielded"))){const err7 = {instancePath:instancePath+"/reportedWorkDisposition",schemaPath:"#/properties/reportedWorkDisposition/enum",keyword:"enum",params:{allowedValues: schema197.properties.reportedWorkDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.workAssessmentId !== undefined){let data4 = data.workAssessmentId;if(typeof data4 === "string"){if(func1(data4) < 1){const err8 = {instancePath:instancePath+"/workAssessmentId",schemaPath:"#/properties/workAssessmentId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/workAssessmentId",schemaPath:"#/properties/workAssessmentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.statusDecisionId !== undefined){let data5 = data.statusDecisionId;if(typeof data5 === "string"){if(func1(data5) < 1){const err10 = {instancePath:instancePath+"/statusDecisionId",schemaPath:"#/properties/statusDecisionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}else {const err11 = {instancePath:instancePath+"/statusDecisionId",schemaPath:"#/properties/statusDecisionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.stopReason !== undefined){if(!(validate107(data.stopReason, {instancePath:instancePath+"/stopReason",parentData:data,parentDataProperty:"stopReason",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate107.errors : vErrors.concat(validate107.errors);errors = vErrors.length;}}}else {const err12 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}validate106.errors = vErrors;return errors === 0;}validate106.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const pattern70 = new RegExp("^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$", "u");const formats0 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;function validate28(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/event.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate28.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("plan.updated" !== data.eventType){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate62(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate62.errors : vErrors.concat(validate62.errors);errors = vErrors.length;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props0 = {};props0.payload = true;props0.eventType = true;}}if(!valid1){const err1 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}const _errs8 = errors;let valid4 = true;const _errs9 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data2 = data.eventType;if(!(((data2 === "tool.execution.started") || (data2 === "tool.execution.progressed")) || (data2 === "tool.execution.completed"))){const err2 = {};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}}var _valid1 = _errs9 === errors;errors = _errs8;if(vErrors !== null){if(_errs8){vErrors.length = _errs8;}else {vErrors = null;}}if(_valid1){const _errs11 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate64(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors);errors = vErrors.length;}}}var _valid1 = _errs11 === errors;valid4 = _valid1;if(valid4){var props1 = {};props1.payload = true;props1.eventType = true;}}if(!valid4){const err3 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(props0 !== true && props1 !== undefined){if(props1 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props1);}}const _errs14 = errors;let valid7 = true;const _errs15 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data4 = data.eventType;if(!(((data4 === "research.started") || (data4 === "research.progressed")) || (data4 === "research.completed"))){const err4 = {};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}}var _valid2 = _errs15 === errors;errors = _errs14;if(vErrors !== null){if(_errs14){vErrors.length = _errs14;}else {vErrors = null;}}if(_valid2){const _errs17 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate66(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate66.errors : vErrors.concat(validate66.errors);errors = vErrors.length;}}}var _valid2 = _errs17 === errors;valid7 = _valid2;if(valid7){var props2 = {};props2.payload = true;props2.eventType = true;}}if(!valid7){const err5 = {instancePath,schemaPath:"#/allOf/2/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(props0 !== true && props2 !== undefined){if(props2 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props2);}}const _errs20 = errors;let valid10 = true;const _errs21 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data6 = data.eventType;if(!(((data6 === "delegation.started") || (data6 === "delegation.updated")) || (data6 === "delegation.completed"))){const err6 = {};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}}var _valid3 = _errs21 === errors;errors = _errs20;if(vErrors !== null){if(_errs20){vErrors.length = _errs20;}else {vErrors = null;}}if(_valid3){const _errs23 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate68(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors);errors = vErrors.length;}}}var _valid3 = _errs23 === errors;valid10 = _valid3;if(valid10){var props3 = {};props3.payload = true;props3.eventType = true;}}if(!valid10){const err7 = {instancePath,schemaPath:"#/allOf/3/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(props0 !== true && props3 !== undefined){if(props3 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props3);}}const _errs26 = errors;let valid13 = true;const _errs27 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("model.route.changed" !== data.eventType){const err8 = {};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}}var _valid4 = _errs27 === errors;errors = _errs26;if(vErrors !== null){if(_errs26){vErrors.length = _errs26;}else {vErrors = null;}}if(_valid4){const _errs29 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate70(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate70.errors : vErrors.concat(validate70.errors);errors = vErrors.length;}}}var _valid4 = _errs29 === errors;valid13 = _valid4;if(valid13){var props4 = {};props4.payload = true;props4.eventType = true;}}if(!valid13){const err9 = {instancePath,schemaPath:"#/allOf/4/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(props0 !== true && props4 !== undefined){if(props4 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props4);}}const _errs32 = errors;let valid16 = true;const _errs33 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("model.verification.updated" !== data.eventType){const err10 = {};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}}var _valid5 = _errs33 === errors;errors = _errs32;if(vErrors !== null){if(_errs32){vErrors.length = _errs32;}else {vErrors = null;}}if(_valid5){const _errs35 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate72(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate72.errors : vErrors.concat(validate72.errors);errors = vErrors.length;}}}var _valid5 = _errs35 === errors;valid16 = _valid5;if(valid16){var props5 = {};props5.payload = true;props5.eventType = true;}}if(!valid16){const err11 = {instancePath,schemaPath:"#/allOf/5/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(props0 !== true && props5 !== undefined){if(props5 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props5);}}const _errs38 = errors;let valid19 = true;const _errs39 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("context.compacted" !== data.eventType){const err12 = {};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}}var _valid6 = _errs39 === errors;errors = _errs38;if(vErrors !== null){if(_errs38){vErrors.length = _errs38;}else {vErrors = null;}}if(_valid6){const _errs41 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate74(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate74.errors : vErrors.concat(validate74.errors);errors = vErrors.length;}}}var _valid6 = _errs41 === errors;valid19 = _valid6;if(valid19){var props6 = {};props6.payload = true;props6.eventType = true;}}if(!valid19){const err13 = {instancePath,schemaPath:"#/allOf/6/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(props0 !== true && props6 !== undefined){if(props6 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props6);}}const _errs44 = errors;let valid22 = true;const _errs45 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("artifact.viewed" !== data.eventType){const err14 = {};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}}var _valid7 = _errs45 === errors;errors = _errs44;if(vErrors !== null){if(_errs44){vErrors.length = _errs44;}else {vErrors = null;}}if(_valid7){const _errs47 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate76(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate76.errors : vErrors.concat(validate76.errors);errors = vErrors.length;}}}var _valid7 = _errs47 === errors;valid22 = _valid7;if(valid22){var props7 = {};props7.payload = true;props7.eventType = true;}}if(!valid22){const err15 = {instancePath,schemaPath:"#/allOf/7/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(props0 !== true && props7 !== undefined){if(props7 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props7);}}const _errs50 = errors;let valid25 = true;const _errs51 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("artifact.generated" !== data.eventType){const err16 = {};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}}var _valid8 = _errs51 === errors;errors = _errs50;if(vErrors !== null){if(_errs50){vErrors.length = _errs50;}else {vErrors = null;}}if(_valid8){const _errs53 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate78(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate78.errors : vErrors.concat(validate78.errors);errors = vErrors.length;}}}var _valid8 = _errs53 === errors;valid25 = _valid8;if(valid25){var props8 = {};props8.payload = true;props8.eventType = true;}}if(!valid25){const err17 = {instancePath,schemaPath:"#/allOf/8/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(props0 !== true && props8 !== undefined){if(props8 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props8);}}const _errs56 = errors;let valid28 = true;const _errs57 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("review.mode.changed" !== data.eventType){const err18 = {};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}var _valid9 = _errs57 === errors;errors = _errs56;if(vErrors !== null){if(_errs56){vErrors.length = _errs56;}else {vErrors = null;}}if(_valid9){const _errs59 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate80(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate80.errors : vErrors.concat(validate80.errors);errors = vErrors.length;}}}var _valid9 = _errs59 === errors;valid28 = _valid9;if(valid28){var props9 = {};props9.payload = true;props9.eventType = true;}}if(!valid28){const err19 = {instancePath,schemaPath:"#/allOf/9/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(props0 !== true && props9 !== undefined){if(props9 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props9);}}const _errs62 = errors;let valid31 = true;const _errs63 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data20 = data.eventType;if(!((data20 === "hook.started") || (data20 === "hook.completed"))){const err20 = {};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}var _valid10 = _errs63 === errors;errors = _errs62;if(vErrors !== null){if(_errs62){vErrors.length = _errs62;}else {vErrors = null;}}if(_valid10){const _errs65 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate82(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate82.errors : vErrors.concat(validate82.errors);errors = vErrors.length;}}}var _valid10 = _errs65 === errors;valid31 = _valid10;if(valid31){var props10 = {};props10.payload = true;props10.eventType = true;}}if(!valid31){const err21 = {instancePath,schemaPath:"#/allOf/10/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(props0 !== true && props10 !== undefined){if(props10 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props10);}}const _errs68 = errors;let valid34 = true;const _errs69 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("memory.citation.referenced" !== data.eventType){const err22 = {};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}var _valid11 = _errs69 === errors;errors = _errs68;if(vErrors !== null){if(_errs68){vErrors.length = _errs68;}else {vErrors = null;}}if(_valid11){const _errs71 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate84(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate84.errors : vErrors.concat(validate84.errors);errors = vErrors.length;}}}var _valid11 = _errs71 === errors;valid34 = _valid11;if(valid34){var props11 = {};props11.payload = true;props11.eventType = true;}}if(!valid34){const err23 = {instancePath,schemaPath:"#/allOf/11/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(props0 !== true && props11 !== undefined){if(props11 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props11);}}const _errs74 = errors;let valid37 = true;const _errs75 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data24 = data.eventType;if(!((data24 === "safety.review.started") || (data24 === "safety.review.completed"))){const err24 = {};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}var _valid12 = _errs75 === errors;errors = _errs74;if(vErrors !== null){if(_errs74){vErrors.length = _errs74;}else {vErrors = null;}}if(_valid12){const _errs77 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate86(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate86.errors : vErrors.concat(validate86.errors);errors = vErrors.length;}}}var _valid12 = _errs77 === errors;valid37 = _valid12;if(valid37){var props12 = {};props12.payload = true;props12.eventType = true;}}if(!valid37){const err25 = {instancePath,schemaPath:"#/allOf/12/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(props0 !== true && props12 !== undefined){if(props12 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props12);}}const _errs80 = errors;let valid40 = true;const _errs81 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("terminal.input.sent" !== data.eventType){const err26 = {};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}var _valid13 = _errs81 === errors;errors = _errs80;if(vErrors !== null){if(_errs80){vErrors.length = _errs80;}else {vErrors = null;}}if(_valid13){const _errs83 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate88(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate88.errors : vErrors.concat(validate88.errors);errors = vErrors.length;}}}var _valid13 = _errs83 === errors;valid40 = _valid13;if(valid40){var props13 = {};props13.payload = true;props13.eventType = true;}}if(!valid40){const err27 = {instancePath,schemaPath:"#/allOf/13/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(props0 !== true && props13 !== undefined){if(props13 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props13);}}const _errs86 = errors;let valid43 = true;const _errs87 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data28 = data.eventType;if(!((data28 === "wait.started") || (data28 === "wait.completed"))){const err28 = {};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}var _valid14 = _errs87 === errors;errors = _errs86;if(vErrors !== null){if(_errs86){vErrors.length = _errs86;}else {vErrors = null;}}if(_valid14){const _errs89 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate90(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate90.errors : vErrors.concat(validate90.errors);errors = vErrors.length;}}}var _valid14 = _errs89 === errors;valid43 = _valid14;if(valid43){var props14 = {};props14.payload = true;props14.eventType = true;}}if(!valid43){const err29 = {instancePath,schemaPath:"#/allOf/14/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(props0 !== true && props14 !== undefined){if(props14 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props14);}}const _errs92 = errors;let valid46 = true;const _errs93 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("provider.notice.recorded" !== data.eventType){const err30 = {};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}}var _valid15 = _errs93 === errors;errors = _errs92;if(vErrors !== null){if(_errs92){vErrors.length = _errs92;}else {vErrors = null;}}if(_valid15){const _errs95 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate92(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate92.errors : vErrors.concat(validate92.errors);errors = vErrors.length;}}}var _valid15 = _errs95 === errors;valid46 = _valid15;if(valid46){var props15 = {};props15.payload = true;props15.eventType = true;}}if(!valid46){const err31 = {instancePath,schemaPath:"#/allOf/15/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(props0 !== true && props15 !== undefined){if(props15 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props15);}}const _errs98 = errors;let valid49 = true;const _errs99 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("workspace.file.referenced" !== data.eventType){const err32 = {};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}var _valid16 = _errs99 === errors;errors = _errs98;if(vErrors !== null){if(_errs98){vErrors.length = _errs98;}else {vErrors = null;}}if(_valid16){const _errs101 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data33 = data.payload;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.schema === undefined){const err33 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}if(data33.referenceId === undefined){const err34 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "referenceId"},message:"must have required property '"+"referenceId"+"'"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}if(data33.source === undefined){const err35 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(data33.path === undefined){const err36 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "path"},message:"must have required property '"+"path"+"'"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(data33.displayName === undefined){const err37 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "displayName"},message:"must have required property '"+"displayName"+"'"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(data33.mediaType === undefined){const err38 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "mediaType"},message:"must have required property '"+"mediaType"+"'"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(data33.presentation === undefined){const err39 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "presentation"},message:"must have required property '"+"presentation"+"'"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}if(data33.line === undefined){const err40 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "line"},message:"must have required property '"+"line"+"'"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(data33.preview === undefined){const err41 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "preview"},message:"must have required property '"+"preview"+"'"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data33.previewTruncated === undefined){const err42 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "previewTruncated"},message:"must have required property '"+"previewTruncated"+"'"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(data33.contentDigest === undefined){const err43 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/required",keyword:"required",params:{missingProperty: "contentDigest"},message:"must have required property '"+"contentDigest"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}for(const key0 in data33){if(!(func66.call(schema174.properties, key0))){const err44 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data33.schema !== undefined){if("paperclip.workspace.file_reference.v1" !== data33.schema){const err45 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.file_reference.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data33.referenceId !== undefined){let data35 = data33.referenceId;if(typeof data35 === "string"){if(func1(data35) > 240){const err46 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(func1(data35) < 1){const err47 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}else {const err48 = {instancePath:instancePath+"/payload/referenceId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/referenceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data33.source !== undefined){let data36 = data33.source;if(!((data36 === "harness_reported") || (data36 === "runner_verified"))){const err49 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema174.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data33.path !== undefined){let data37 = data33.path;if(typeof data37 === "string"){if(func1(data37) > 1024){const err50 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(func1(data37) < 1){const err51 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}if(!pattern70.test(data37)){const err52 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}else {const err53 = {instancePath:instancePath+"/payload/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data33.displayName !== undefined){let data38 = data33.displayName;if(typeof data38 === "string"){if(func1(data38) > 255){const err54 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/maxLength",keyword:"maxLength",params:{limit: 255},message:"must NOT have more than 255 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}if(func1(data38) < 1){const err55 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}else {const err56 = {instancePath:instancePath+"/payload/displayName",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/displayName/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data33.mediaType !== undefined){let data39 = data33.mediaType;if((typeof data39 !== "string") && (data39 !== null)){const err57 = {instancePath:instancePath+"/payload/mediaType",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/mediaType/type",keyword:"type",params:{type: schema174.properties.mediaType.type},message:"must be string,null"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}if(typeof data39 === "string"){if(func1(data39) > 160){const err58 = {instancePath:instancePath+"/payload/mediaType",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/mediaType/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}if(data33.presentation !== undefined){let data40 = data33.presentation;if(!((((data40 === "document") || (data40 === "code")) || (data40 === "image")) || (data40 === "generic"))){const err59 = {instancePath:instancePath+"/payload/presentation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/presentation/enum",keyword:"enum",params:{allowedValues: schema174.properties.presentation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data33.line !== undefined){let data41 = data33.line;if((!(((typeof data41 == "number") && (!(data41 % 1) && !isNaN(data41))) && (isFinite(data41)))) && (data41 !== null)){const err60 = {instancePath:instancePath+"/payload/line",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/line/type",keyword:"type",params:{type: schema174.properties.line.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if((typeof data41 == "number") && (isFinite(data41))){if(data41 < 1 || isNaN(data41)){const err61 = {instancePath:instancePath+"/payload/line",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/line/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}}if(data33.preview !== undefined){let data42 = data33.preview;if((typeof data42 !== "string") && (data42 !== null)){const err62 = {instancePath:instancePath+"/payload/preview",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/preview/type",keyword:"type",params:{type: schema174.properties.preview.type},message:"must be string,null"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(typeof data42 === "string"){if(func1(data42) > 262144){const err63 = {instancePath:instancePath+"/payload/preview",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/preview/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}}if(data33.previewTruncated !== undefined){if(typeof data33.previewTruncated !== "boolean"){const err64 = {instancePath:instancePath+"/payload/previewTruncated",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/previewTruncated/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data33.contentDigest !== undefined){let data44 = data33.contentDigest;const _errs124 = errors;let valid54 = false;let passing0 = null;const _errs125 = errors;if(data44 !== null){const err65 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}var _valid17 = _errs125 === errors;if(_valid17){valid54 = true;passing0 = 0;}const _errs127 = errors;if(typeof data44 === "string"){if(!pattern20.test(data44)){const err66 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^sha256:[a-f0-9]{64}$"},message:"must match pattern \""+"^sha256:[a-f0-9]{64}$"+"\""};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}else {const err67 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}var _valid17 = _errs127 === errors;if(_valid17 && valid54){valid54 = false;passing0 = [passing0, 1];}else {if(_valid17){valid54 = true;passing0 = 1;}}if(!valid54){const err68 = {instancePath:instancePath+"/payload/contentDigest",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/properties/contentDigest/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}else {errors = _errs124;if(vErrors !== null){if(_errs124){vErrors.length = _errs124;}else {vErrors = null;}}}}}else {const err69 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-file-reference.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}var _valid16 = _errs101 === errors;valid49 = _valid16;if(valid49){var props16 = {};props16.payload = true;props16.eventType = true;}}if(!valid49){const err70 = {instancePath,schemaPath:"#/allOf/16/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(props0 !== true && props16 !== undefined){if(props16 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props16);}}const _errs130 = errors;let valid55 = true;const _errs131 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data45 = data.eventType;if(!((data45 === "workspace.change.updated") || (data45 === "workspace.diff.recorded"))){const err71 = {};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}var _valid18 = _errs131 === errors;errors = _errs130;if(vErrors !== null){if(_errs130){vErrors.length = _errs130;}else {vErrors = null;}}if(_valid18){const _errs133 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data46 = data.payload;if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.schema === undefined){const err72 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(data46.changeSetId === undefined){const err73 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "changeSetId"},message:"must have required property '"+"changeSetId"+"'"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(data46.revision === undefined){const err74 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}if(data46.source === undefined){const err75 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(data46.complete === undefined){const err76 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data46.files === undefined){const err77 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data46.totals === undefined){const err78 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "totals"},message:"must have required property '"+"totals"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data46.patchArtifactRef === undefined){const err79 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "patchArtifactRef"},message:"must have required property '"+"patchArtifactRef"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}for(const key1 in data46){if(!((((((((key1 === "schema") || (key1 === "changeSetId")) || (key1 === "revision")) || (key1 === "source")) || (key1 === "complete")) || (key1 === "files")) || (key1 === "totals")) || (key1 === "patchArtifactRef"))){const err80 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data46.schema !== undefined){if("paperclip.workspace.diff.v1" !== data46.schema){const err81 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.diff.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data46.changeSetId !== undefined){let data48 = data46.changeSetId;if(typeof data48 === "string"){if(func1(data48) > 200){const err82 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func1(data48) < 1){const err83 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data46.revision !== undefined){let data49 = data46.revision;if(!(((typeof data49 == "number") && (!(data49 % 1) && !isNaN(data49))) && (isFinite(data49)))){const err85 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}if((typeof data49 == "number") && (isFinite(data49))){if(data49 < 1 || isNaN(data49)){const err86 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}}if(data46.source !== undefined){let data50 = data46.source;if(!((data50 === "harness_reported") || (data50 === "runner_verified"))){const err87 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema175.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data46.complete !== undefined){if(typeof data46.complete !== "boolean"){const err88 = {instancePath:instancePath+"/payload/complete",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data46.files !== undefined){let data52 = data46.files;if(Array.isArray(data52)){if(data52.length > 2000){const err89 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/maxItems",keyword:"maxItems",params:{limit: 2000},message:"must NOT have more than 2000 items"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}const len0 = data52.length;for(let i0=0; i0 1024){const err98 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}if(func1(data54) < 1){const err99 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(!pattern70.test(data54)){const err100 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/payload/files/" + i0+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data53.operation !== undefined){let data55 = data53.operation;if(!(((((data55 === "create") || (data55 === "modify")) || (data55 === "delete")) || (data55 === "rename")) || (data55 === "mode_change"))){const err102 = {instancePath:instancePath+"/payload/files/" + i0+"/operation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/operation/enum",keyword:"enum",params:{allowedValues: schema175.properties.files.items.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data53.previousPath !== undefined){let data56 = data53.previousPath;const _errs155 = errors;let valid63 = false;let passing1 = null;const _errs156 = errors;if(data56 !== null){const err103 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}var _valid19 = _errs156 === errors;if(_valid19){valid63 = true;passing1 = 0;}const _errs158 = errors;if(typeof data56 === "string"){if(func1(data56) > 1024){const err104 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(func1(data56) < 1){const err105 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(!pattern70.test(data56)){const err106 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}else {const err107 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}var _valid19 = _errs158 === errors;if(_valid19 && valid63){valid63 = false;passing1 = [passing1, 1];}else {if(_valid19){valid63 = true;passing1 = 1;}}if(!valid63){const err108 = {instancePath:instancePath+"/payload/files/" + i0+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}else {errors = _errs155;if(vErrors !== null){if(_errs155){vErrors.length = _errs155;}else {vErrors = null;}}}}if(data53.additions !== undefined){let data57 = data53.additions;if((!(((typeof data57 == "number") && (!(data57 % 1) && !isNaN(data57))) && (isFinite(data57)))) && (data57 !== null)){const err109 = {instancePath:instancePath+"/payload/files/" + i0+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/type",keyword:"type",params:{type: schema175.properties.files.items.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if((typeof data57 == "number") && (isFinite(data57))){if(data57 < 0 || isNaN(data57)){const err110 = {instancePath:instancePath+"/payload/files/" + i0+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}}if(data53.deletions !== undefined){let data58 = data53.deletions;if((!(((typeof data58 == "number") && (!(data58 % 1) && !isNaN(data58))) && (isFinite(data58)))) && (data58 !== null)){const err111 = {instancePath:instancePath+"/payload/files/" + i0+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/type",keyword:"type",params:{type: schema175.properties.files.items.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 0 || isNaN(data58)){const err112 = {instancePath:instancePath+"/payload/files/" + i0+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}}if(data53.binary !== undefined){if(typeof data53.binary !== "boolean"){const err113 = {instancePath:instancePath+"/payload/files/" + i0+"/binary",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/binary/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}if(data53.diff !== undefined){let data60 = data53.diff;if((typeof data60 !== "string") && (data60 !== null)){const err114 = {instancePath:instancePath+"/payload/files/" + i0+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/type",keyword:"type",params:{type: schema175.properties.files.items.properties.diff.type},message:"must be string,null"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}if(typeof data60 === "string"){if(func1(data60) > 262144){const err115 = {instancePath:instancePath+"/payload/files/" + i0+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}}}else {const err116 = {instancePath:instancePath+"/payload/files/" + i0,schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}if(data46.totals !== undefined){let data61 = data46.totals;if(data61 && typeof data61 == "object" && !Array.isArray(data61)){if(data61.files === undefined){const err118 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(data61.additions === undefined){const err119 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "additions"},message:"must have required property '"+"additions"+"'"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}if(data61.deletions === undefined){const err120 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "deletions"},message:"must have required property '"+"deletions"+"'"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}for(const key3 in data61){if(!(((key3 === "files") || (key3 === "additions")) || (key3 === "deletions"))){const err121 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}if(data61.files !== undefined){let data62 = data61.files;if(!(((typeof data62 == "number") && (!(data62 % 1) && !isNaN(data62))) && (isFinite(data62)))){const err122 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if((typeof data62 == "number") && (isFinite(data62))){if(data62 < 0 || isNaN(data62)){const err123 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}}if(data61.additions !== undefined){let data63 = data61.additions;if((!(((typeof data63 == "number") && (!(data63 % 1) && !isNaN(data63))) && (isFinite(data63)))) && (data63 !== null)){const err124 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/type",keyword:"type",params:{type: schema175.properties.totals.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}if((typeof data63 == "number") && (isFinite(data63))){if(data63 < 0 || isNaN(data63)){const err125 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}if(data61.deletions !== undefined){let data64 = data61.deletions;if((!(((typeof data64 == "number") && (!(data64 % 1) && !isNaN(data64))) && (isFinite(data64)))) && (data64 !== null)){const err126 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/type",keyword:"type",params:{type: schema175.properties.totals.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if((typeof data64 == "number") && (isFinite(data64))){if(data64 < 0 || isNaN(data64)){const err127 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}}}else {const err128 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data46.patchArtifactRef !== undefined){let data65 = data46.patchArtifactRef;if((typeof data65 !== "string") && (data65 !== null)){const err129 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/type",keyword:"type",params:{type: schema175.properties.patchArtifactRef.type},message:"must be string,null"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(typeof data65 === "string"){if(func1(data65) > 2048){const err130 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}}else {const err131 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}}var _valid18 = _errs133 === errors;valid55 = _valid18;if(valid55){var props17 = {};props17.payload = true;props17.eventType = true;}}if(!valid55){const err132 = {instancePath,schemaPath:"#/allOf/17/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(props0 !== true && props17 !== undefined){if(props17 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props17);}}const _errs180 = errors;let valid65 = true;const _errs181 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("workspace.diff.recorded" !== data.eventType){const err133 = {};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}}var _valid20 = _errs181 === errors;errors = _errs180;if(vErrors !== null){if(_errs180){vErrors.length = _errs180;}else {vErrors = null;}}if(_valid20){const _errs183 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data67 = data.payload;if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.schema === undefined){const err134 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(data67.changeSetId === undefined){const err135 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "changeSetId"},message:"must have required property '"+"changeSetId"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data67.revision === undefined){const err136 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data67.source === undefined){const err137 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "source"},message:"must have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(data67.complete === undefined){const err138 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "complete"},message:"must have required property '"+"complete"+"'"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data67.files === undefined){const err139 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}if(data67.totals === undefined){const err140 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "totals"},message:"must have required property '"+"totals"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(data67.patchArtifactRef === undefined){const err141 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/required",keyword:"required",params:{missingProperty: "patchArtifactRef"},message:"must have required property '"+"patchArtifactRef"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}for(const key4 in data67){if(!((((((((key4 === "schema") || (key4 === "changeSetId")) || (key4 === "revision")) || (key4 === "source")) || (key4 === "complete")) || (key4 === "files")) || (key4 === "totals")) || (key4 === "patchArtifactRef"))){const err142 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data67.schema !== undefined){if("paperclip.workspace.diff.v1" !== data67.schema){const err143 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.workspace.diff.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}}if(data67.changeSetId !== undefined){let data69 = data67.changeSetId;if(typeof data69 === "string"){if(func1(data69) > 200){const err144 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}if(func1(data69) < 1){const err145 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}else {const err146 = {instancePath:instancePath+"/payload/changeSetId",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/changeSetId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}if(data67.revision !== undefined){let data70 = data67.revision;if(!(((typeof data70 == "number") && (!(data70 % 1) && !isNaN(data70))) && (isFinite(data70)))){const err147 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}if((typeof data70 == "number") && (isFinite(data70))){if(data70 < 1 || isNaN(data70)){const err148 = {instancePath:instancePath+"/payload/revision",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/revision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}if(data67.source !== undefined){let data71 = data67.source;if(!((data71 === "harness_reported") || (data71 === "runner_verified"))){const err149 = {instancePath:instancePath+"/payload/source",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/source/enum",keyword:"enum",params:{allowedValues: schema175.properties.source.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data67.complete !== undefined){if(typeof data67.complete !== "boolean"){const err150 = {instancePath:instancePath+"/payload/complete",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/complete/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}if(data67.files !== undefined){let data73 = data67.files;if(Array.isArray(data73)){if(data73.length > 2000){const err151 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/maxItems",keyword:"maxItems",params:{limit: 2000},message:"must NOT have more than 2000 items"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}const len1 = data73.length;for(let i1=0; i1 1024){const err160 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}if(func1(data75) < 1){const err161 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}if(!pattern70.test(data75)){const err162 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/payload/files/" + i1+"/path",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/path/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data74.operation !== undefined){let data76 = data74.operation;if(!(((((data76 === "create") || (data76 === "modify")) || (data76 === "delete")) || (data76 === "rename")) || (data76 === "mode_change"))){const err164 = {instancePath:instancePath+"/payload/files/" + i1+"/operation",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/operation/enum",keyword:"enum",params:{allowedValues: schema175.properties.files.items.properties.operation.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data74.previousPath !== undefined){let data77 = data74.previousPath;const _errs206 = errors;let valid74 = false;let passing2 = null;const _errs207 = errors;if(data77 !== null){const err165 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/0/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}var _valid21 = _errs207 === errors;if(_valid21){valid74 = true;passing2 = 0;}const _errs209 = errors;if(typeof data77 === "string"){if(func1(data77) > 1024){const err166 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/maxLength",keyword:"maxLength",params:{limit: 1024},message:"must NOT have more than 1024 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(func1(data77) < 1){const err167 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}if(!pattern70.test(data77)){const err168 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/pattern",keyword:"pattern",params:{pattern: "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"},message:"must match pattern \""+"^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"+"\""};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}var _valid21 = _errs209 === errors;if(_valid21 && valid74){valid74 = false;passing2 = [passing2, 1];}else {if(_valid21){valid74 = true;passing2 = 1;}}if(!valid74){const err170 = {instancePath:instancePath+"/payload/files/" + i1+"/previousPath",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/previousPath/oneOf",keyword:"oneOf",params:{passingSchemas: passing2},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}else {errors = _errs206;if(vErrors !== null){if(_errs206){vErrors.length = _errs206;}else {vErrors = null;}}}}if(data74.additions !== undefined){let data78 = data74.additions;if((!(((typeof data78 == "number") && (!(data78 % 1) && !isNaN(data78))) && (isFinite(data78)))) && (data78 !== null)){const err171 = {instancePath:instancePath+"/payload/files/" + i1+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/type",keyword:"type",params:{type: schema175.properties.files.items.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}if((typeof data78 == "number") && (isFinite(data78))){if(data78 < 0 || isNaN(data78)){const err172 = {instancePath:instancePath+"/payload/files/" + i1+"/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}}if(data74.deletions !== undefined){let data79 = data74.deletions;if((!(((typeof data79 == "number") && (!(data79 % 1) && !isNaN(data79))) && (isFinite(data79)))) && (data79 !== null)){const err173 = {instancePath:instancePath+"/payload/files/" + i1+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/type",keyword:"type",params:{type: schema175.properties.files.items.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}if((typeof data79 == "number") && (isFinite(data79))){if(data79 < 0 || isNaN(data79)){const err174 = {instancePath:instancePath+"/payload/files/" + i1+"/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}}if(data74.binary !== undefined){if(typeof data74.binary !== "boolean"){const err175 = {instancePath:instancePath+"/payload/files/" + i1+"/binary",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/binary/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data74.diff !== undefined){let data81 = data74.diff;if((typeof data81 !== "string") && (data81 !== null)){const err176 = {instancePath:instancePath+"/payload/files/" + i1+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/type",keyword:"type",params:{type: schema175.properties.files.items.properties.diff.type},message:"must be string,null"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(typeof data81 === "string"){if(func1(data81) > 262144){const err177 = {instancePath:instancePath+"/payload/files/" + i1+"/diff",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/properties/diff/maxLength",keyword:"maxLength",params:{limit: 262144},message:"must NOT have more than 262144 characters"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}}}else {const err178 = {instancePath:instancePath+"/payload/files/" + i1,schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}else {const err179 = {instancePath:instancePath+"/payload/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/files/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}if(data67.totals !== undefined){let data82 = data67.totals;if(data82 && typeof data82 == "object" && !Array.isArray(data82)){if(data82.files === undefined){const err180 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "files"},message:"must have required property '"+"files"+"'"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}if(data82.additions === undefined){const err181 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "additions"},message:"must have required property '"+"additions"+"'"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}if(data82.deletions === undefined){const err182 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/required",keyword:"required",params:{missingProperty: "deletions"},message:"must have required property '"+"deletions"+"'"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}for(const key6 in data82){if(!(((key6 === "files") || (key6 === "additions")) || (key6 === "deletions"))){const err183 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}if(data82.files !== undefined){let data83 = data82.files;if(!(((typeof data83 == "number") && (!(data83 % 1) && !isNaN(data83))) && (isFinite(data83)))){const err184 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}if((typeof data83 == "number") && (isFinite(data83))){if(data83 < 0 || isNaN(data83)){const err185 = {instancePath:instancePath+"/payload/totals/files",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/files/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}}}if(data82.additions !== undefined){let data84 = data82.additions;if((!(((typeof data84 == "number") && (!(data84 % 1) && !isNaN(data84))) && (isFinite(data84)))) && (data84 !== null)){const err186 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/type",keyword:"type",params:{type: schema175.properties.totals.properties.additions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if((typeof data84 == "number") && (isFinite(data84))){if(data84 < 0 || isNaN(data84)){const err187 = {instancePath:instancePath+"/payload/totals/additions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/additions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}}}if(data82.deletions !== undefined){let data85 = data82.deletions;if((!(((typeof data85 == "number") && (!(data85 % 1) && !isNaN(data85))) && (isFinite(data85)))) && (data85 !== null)){const err188 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/type",keyword:"type",params:{type: schema175.properties.totals.properties.deletions.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}if((typeof data85 == "number") && (isFinite(data85))){if(data85 < 0 || isNaN(data85)){const err189 = {instancePath:instancePath+"/payload/totals/deletions",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/properties/deletions/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}}}else {const err190 = {instancePath:instancePath+"/payload/totals",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/totals/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}}if(data67.patchArtifactRef !== undefined){let data86 = data67.patchArtifactRef;if((typeof data86 !== "string") && (data86 !== null)){const err191 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/type",keyword:"type",params:{type: schema175.properties.patchArtifactRef.type},message:"must be string,null"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(typeof data86 === "string"){if(func1(data86) > 2048){const err192 = {instancePath:instancePath+"/payload/patchArtifactRef",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/properties/patchArtifactRef/maxLength",keyword:"maxLength",params:{limit: 2048},message:"must NOT have more than 2048 characters"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}}}else {const err193 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/workspace-diff.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.complete !== undefined){if(true !== data67.complete){const err194 = {instancePath:instancePath+"/payload/complete",schemaPath:"#/allOf/18/then/properties/payload/allOf/1/properties/complete/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}}else {const err195 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/18/then/properties/payload/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}}var _valid20 = _errs183 === errors;valid65 = _valid20;if(valid65){var props18 = {};props18.payload = true;props18.eventType = true;}}if(!valid65){const err196 = {instancePath,schemaPath:"#/allOf/18/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(props0 !== true && props18 !== undefined){if(props18 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props18);}}const _errs234 = errors;let valid77 = true;const _errs235 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data88 = data.eventType;if(!((data88 === "semantic_tool.input") || (data88 === "mcp_app.tool_input"))){const err197 = {};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}}var _valid22 = _errs235 === errors;errors = _errs234;if(vErrors !== null){if(_errs234){vErrors.length = _errs234;}else {vErrors = null;}}if(_valid22){const _errs237 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data89 = data.payload;if(data89 && typeof data89 == "object" && !Array.isArray(data89)){if(data89.semantic_tool !== undefined){let data90 = data89.semantic_tool;if(!(validate94(data90, {instancePath:instancePath+"/payload/semantic_tool",parentData:data89,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate94.errors : vErrors.concat(validate94.errors);errors = vErrors.length;}if(data90 && typeof data90 == "object" && !Array.isArray(data90)){if(data90.phase !== undefined){if("input" !== data90.phase){const err198 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/19/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "input"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}}else {const err199 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/19/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}}else {const err200 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/19/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}}var _valid22 = _errs237 === errors;valid77 = _valid22;if(valid77){var props19 = {};props19.payload = true;props19.eventType = true;}}if(!valid77){const err201 = {instancePath,schemaPath:"#/allOf/19/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}if(props0 !== true && props19 !== undefined){if(props19 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props19);}}const _errs247 = errors;let valid83 = true;const _errs248 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data92 = data.eventType;if(!((data92 === "semantic_tool.result") || (data92 === "mcp_app.tool_result"))){const err202 = {};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}}var _valid23 = _errs248 === errors;errors = _errs247;if(vErrors !== null){if(_errs247){vErrors.length = _errs247;}else {vErrors = null;}}if(_valid23){const _errs250 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data93 = data.payload;if(data93 && typeof data93 == "object" && !Array.isArray(data93)){if(data93.semantic_tool !== undefined){let data94 = data93.semantic_tool;if(!(validate94(data94, {instancePath:instancePath+"/payload/semantic_tool",parentData:data93,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate94.errors : vErrors.concat(validate94.errors);errors = vErrors.length;}if(data94 && typeof data94 == "object" && !Array.isArray(data94)){if(data94.phase !== undefined){if("result" !== data94.phase){const err203 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/20/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "result"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}}else {const err204 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/20/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}}else {const err205 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/20/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}}var _valid23 = _errs250 === errors;valid83 = _valid23;if(valid83){var props20 = {};props20.payload = true;props20.eventType = true;}}if(!valid83){const err206 = {instancePath,schemaPath:"#/allOf/20/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}if(props0 !== true && props20 !== undefined){if(props20 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props20);}}const _errs260 = errors;let valid89 = true;const _errs261 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("semantic_tool.reconciled" !== data.eventType){const err207 = {};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}}var _valid24 = _errs261 === errors;errors = _errs260;if(vErrors !== null){if(_errs260){vErrors.length = _errs260;}else {vErrors = null;}}if(_valid24){const _errs263 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data97 = data.payload;if(data97 && typeof data97 == "object" && !Array.isArray(data97)){if(data97.semantic_tool !== undefined){let data98 = data97.semantic_tool;if(!(validate94(data98, {instancePath:instancePath+"/payload/semantic_tool",parentData:data97,parentDataProperty:"semantic_tool",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate94.errors : vErrors.concat(validate94.errors);errors = vErrors.length;}if(data98 && typeof data98 == "object" && !Array.isArray(data98)){if(data98.phase !== undefined){if("reconciled" !== data98.phase){const err208 = {instancePath:instancePath+"/payload/semantic_tool/phase",schemaPath:"#/allOf/21/then/properties/payload/properties/semantic_tool/allOf/1/properties/phase/const",keyword:"const",params:{allowedValue: "reconciled"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}}else {const err209 = {instancePath:instancePath+"/payload/semantic_tool",schemaPath:"#/allOf/21/then/properties/payload/properties/semantic_tool/allOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}}else {const err210 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/21/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}var _valid24 = _errs263 === errors;valid89 = _valid24;if(valid89){var props21 = {};props21.payload = true;props21.eventType = true;}}if(!valid89){const err211 = {instancePath,schemaPath:"#/allOf/21/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}if(props0 !== true && props21 !== undefined){if(props21 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props21);}}const _errs273 = errors;let valid95 = true;const _errs274 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("run.terminal" !== data.eventType){const err212 = {};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}}}var _valid25 = _errs274 === errors;errors = _errs273;if(vErrors !== null){if(_errs273){vErrors.length = _errs273;}else {vErrors = null;}}if(_valid25){const _errs276 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){if(!(validate106(data.payload, {instancePath:instancePath+"/payload",parentData:data,parentDataProperty:"payload",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate106.errors : vErrors.concat(validate106.errors);errors = vErrors.length;}}}var _valid25 = _errs276 === errors;valid95 = _valid25;if(valid95){var props22 = {};props22.payload = true;props22.eventType = true;}}if(!valid95){const err213 = {instancePath,schemaPath:"#/allOf/22/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}if(props0 !== true && props22 !== undefined){if(props22 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props22);}}const _errs279 = errors;let valid98 = true;const _errs280 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("run.result.proposed" !== data.eventType){const err214 = {};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}}var _valid26 = _errs280 === errors;errors = _errs279;if(vErrors !== null){if(_errs279){vErrors.length = _errs279;}else {vErrors = null;}}if(_valid26){const _errs282 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data103 = data.payload;const _errs287 = errors;let valid103 = true;const _errs288 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.reportedWorkDisposition !== undefined){if("blocked" !== data103.reportedWorkDisposition){const err215 = {};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}}var _valid27 = _errs288 === errors;errors = _errs287;if(vErrors !== null){if(_errs287){vErrors.length = _errs287;}else {vErrors = null;}}if(_valid27){const _errs290 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.blocker === undefined){const err216 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/0/then/required",keyword:"required",params:{missingProperty: "blocker"},message:"must have required property '"+"blocker"+"'"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}var _valid27 = _errs290 === errors;valid103 = _valid27;}if(!valid103){const err217 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}const _errs292 = errors;let valid105 = true;const _errs293 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.reportedWorkDisposition !== undefined){if("yielded" !== data103.reportedWorkDisposition){const err218 = {};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}}var _valid28 = _errs293 === errors;errors = _errs292;if(vErrors !== null){if(_errs292){vErrors.length = _errs292;}else {vErrors = null;}}if(_valid28){const _errs295 = errors;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.continuation === undefined){const err219 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/1/then/required",keyword:"required",params:{missingProperty: "continuation"},message:"must have required property '"+"continuation"+"'"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}var _valid28 = _errs295 === errors;valid105 = _valid28;}if(!valid105){const err220 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.schema === undefined){const err221 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if(data103.reportedWorkDisposition === undefined){const err222 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "reportedWorkDisposition"},message:"must have required property '"+"reportedWorkDisposition"+"'"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}if(data103.summary === undefined){const err223 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "summary"},message:"must have required property '"+"summary"+"'"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}if(data103.completionClaim === undefined){const err224 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "completionClaim"},message:"must have required property '"+"completionClaim"+"'"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}if(data103.evidence === undefined){const err225 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "evidence"},message:"must have required property '"+"evidence"+"'"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}if(data103.verification === undefined){const err226 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "verification"},message:"must have required property '"+"verification"+"'"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data103.attentionRequests === undefined){const err227 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "attentionRequests"},message:"must have required property '"+"attentionRequests"+"'"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}if(data103.artifacts === undefined){const err228 = {instancePath:instancePath+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/required",keyword:"required",params:{missingProperty: "artifacts"},message:"must have required property '"+"artifacts"+"'"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}if(data103.schema !== undefined){if("paperclip.run_result.v1" !== data103.schema){const err229 = {instancePath:instancePath+"/payload/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.run_result.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}if(data103.reportedWorkDisposition !== undefined){let data107 = data103.reportedWorkDisposition;if(!((((data107 === "done") || (data107 === "blocked")) || (data107 === "needs_review")) || (data107 === "yielded"))){const err230 = {instancePath:instancePath+"/payload/reportedWorkDisposition",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/reportedWorkDisposition/enum",keyword:"enum",params:{allowedValues: schema202.properties.reportedWorkDisposition.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(data103.summary !== undefined){let data108 = data103.summary;if(typeof data108 === "string"){if(func1(data108) > 12000){const err231 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/maxLength",keyword:"maxLength",params:{limit: 12000},message:"must NOT have more than 12000 characters"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}if(func1(data108) < 1){const err232 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}else {const err233 = {instancePath:instancePath+"/payload/summary",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/summary/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}if(data103.completionClaim !== undefined){let data109 = data103.completionClaim;if(data109 && typeof data109 == "object" && !Array.isArray(data109)){if(data109.contractRevision === undefined){const err234 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "contractRevision"},message:"must have required property '"+"contractRevision"+"'"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}if(data109.objectiveSatisfied === undefined){const err235 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "objectiveSatisfied"},message:"must have required property '"+"objectiveSatisfied"+"'"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}if(data109.criteria === undefined){const err236 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "criteria"},message:"must have required property '"+"criteria"+"'"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}if(data109.remainingWork === undefined){const err237 = {instancePath:instancePath+"/payload/completionClaim",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/required",keyword:"required",params:{missingProperty: "remainingWork"},message:"must have required property '"+"remainingWork"+"'"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}if(data109.contractRevision !== undefined){let data110 = data109.contractRevision;if(typeof data110 === "string"){if(func1(data110) < 1){const err238 = {instancePath:instancePath+"/payload/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}else {const err239 = {instancePath:instancePath+"/payload/completionClaim/contractRevision",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/contractRevision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}if(data109.objectiveSatisfied !== undefined){if(typeof data109.objectiveSatisfied !== "boolean"){const err240 = {instancePath:instancePath+"/payload/completionClaim/objectiveSatisfied",schemaPath:"https://paperclip.dev/schemas/prp/v1/result.schema.json/properties/completionClaim/properties/objectiveSatisfied/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}if(data109.criteria !== undefined){let data112 = data109.criteria;if(Array.isArray(data112)){const len2 = data112.length;for(let i2=0; i2 160){const err329 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err329];}else {vErrors.push(err329);}errors++;}if(func1(data155) < 1){const err330 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err330];}else {vErrors.push(err330);}errors++;}}else {const err331 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err331];}else {vErrors.push(err331);}errors++;}}if(data.sourceSeq !== undefined){let data156 = data.sourceSeq;if(!(((typeof data156 == "number") && (!(data156 % 1) && !isNaN(data156))) && (isFinite(data156)))){const err332 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err332];}else {vErrors.push(err332);}errors++;}if((typeof data156 == "number") && (isFinite(data156))){if(data156 > 9007199254740991 || isNaN(data156)){const err333 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err333];}else {vErrors.push(err333);}errors++;}if(data156 < 1 || isNaN(data156)){const err334 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err334];}else {vErrors.push(err334);}errors++;}}}if(data.sourceInstanceId !== undefined){let data157 = data.sourceInstanceId;if(typeof data157 === "string"){if(func1(data157) > 160){const err335 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err335];}else {vErrors.push(err335);}errors++;}if(func1(data157) < 1){const err336 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err336];}else {vErrors.push(err336);}errors++;}}else {const err337 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err337];}else {vErrors.push(err337);}errors++;}}if(data.sourceKind !== undefined){let data158 = data.sourceKind;if(!((data158 === "runner") || (data158 === "control_plane"))){const err338 = {instancePath:instancePath+"/sourceKind",schemaPath:"#/properties/sourceKind/enum",keyword:"enum",params:{allowedValues: schema50.properties.sourceKind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err338];}else {vErrors.push(err338);}errors++;}}if(data.runId !== undefined){let data159 = data.runId;if(typeof data159 === "string"){if(func1(data159) > 160){const err339 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err339];}else {vErrors.push(err339);}errors++;}if(func1(data159) < 1){const err340 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err340];}else {vErrors.push(err340);}errors++;}}else {const err341 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err341];}else {vErrors.push(err341);}errors++;}}if(data.normalizedSessionId !== undefined){let data160 = data.normalizedSessionId;if(typeof data160 === "string"){if(func1(data160) > 160){const err342 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err342];}else {vErrors.push(err342);}errors++;}if(func1(data160) < 1){const err343 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err343];}else {vErrors.push(err343);}errors++;}}else {const err344 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err344];}else {vErrors.push(err344);}errors++;}}if(data.turnId !== undefined){let data161 = data.turnId;if(typeof data161 === "string"){if(func1(data161) > 240){const err345 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err345];}else {vErrors.push(err345);}errors++;}if(func1(data161) < 1){const err346 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err346];}else {vErrors.push(err346);}errors++;}}else {const err347 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err347];}else {vErrors.push(err347);}errors++;}}if(data.itemId !== undefined){let data162 = data.itemId;if(typeof data162 === "string"){if(func1(data162) > 240){const err348 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err348];}else {vErrors.push(err348);}errors++;}if(func1(data162) < 1){const err349 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err349];}else {vErrors.push(err349);}errors++;}}else {const err350 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err350];}else {vErrors.push(err350);}errors++;}}if(data.eventType !== undefined){let data163 = data.eventType;if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((data163 === "runner.connected") || (data163 === "runner.reconnected")) || (data163 === "runner.reconciled")) || (data163 === "runner.disconnected")) || (data163 === "runner.draining")) || (data163 === "runner.backpressure")) || (data163 === "runner.suspending")) || (data163 === "runner.suspended")) || (data163 === "runner.stopped")) || (data163 === "runner.diagnostic")) || (data163 === "runtime.phase.changed")) || (data163 === "sandbox.metric")) || (data163 === "workspace.ready")) || (data163 === "workspace.change.updated")) || (data163 === "workspace.diff.recorded")) || (data163 === "workspace.file.referenced")) || (data163 === "harness.starting")) || (data163 === "harness.ready")) || (data163 === "harness.exited")) || (data163 === "harness.diagnostic")) || (data163 === "plan.updated")) || (data163 === "tool.execution.started")) || (data163 === "tool.execution.progressed")) || (data163 === "tool.execution.completed")) || (data163 === "research.started")) || (data163 === "research.progressed")) || (data163 === "research.completed")) || (data163 === "delegation.started")) || (data163 === "delegation.updated")) || (data163 === "delegation.completed")) || (data163 === "model.route.changed")) || (data163 === "model.verification.updated")) || (data163 === "context.compacted")) || (data163 === "artifact.viewed")) || (data163 === "artifact.generated")) || (data163 === "review.mode.changed")) || (data163 === "hook.started")) || (data163 === "hook.completed")) || (data163 === "memory.citation.referenced")) || (data163 === "safety.review.started")) || (data163 === "safety.review.completed")) || (data163 === "terminal.input.sent")) || (data163 === "wait.started")) || (data163 === "wait.completed")) || (data163 === "provider.notice.recorded")) || (data163 === "session.starting")) || (data163 === "session.started")) || (data163 === "session.resuming")) || (data163 === "session.resumed")) || (data163 === "session.reconciled")) || (data163 === "session.updated")) || (data163 === "session.closed")) || (data163 === "session.failed")) || (data163 === "turn.submitted")) || (data163 === "turn.accepted")) || (data163 === "turn.started")) || (data163 === "turn.completed")) || (data163 === "turn.failed")) || (data163 === "turn.interrupted")) || (data163 === "turn.cancelled")) || (data163 === "item.started")) || (data163 === "item.delta")) || (data163 === "item.completed")) || (data163 === "item.failed")) || (data163 === "usage.reported")) || (data163 === "semantic_tool.input")) || (data163 === "semantic_tool.result")) || (data163 === "semantic_tool.reconciled")) || (data163 === "mcp_app.discovered")) || (data163 === "mcp_app.resource.resolved")) || (data163 === "mcp_app.initializing")) || (data163 === "mcp_app.ready")) || (data163 === "mcp_app.tool_input")) || (data163 === "mcp_app.tool_result")) || (data163 === "mcp_app.action.requested")) || (data163 === "mcp_app.action.resolved")) || (data163 === "mcp_app.host_context.changed")) || (data163 === "mcp_app.failed")) || (data163 === "mcp_app.teardown")) || (data163 === "runtime_request.created")) || (data163 === "runtime_request.resolved")) || (data163 === "runtime_request.expired")) || (data163 === "runtime_request.cancelled")) || (data163 === "interaction.request.proposed")) || (data163 === "interaction.request.materialized")) || (data163 === "interaction.request.rejected")) || (data163 === "interaction.response.progressed")) || (data163 === "interaction.response.resolved")) || (data163 === "interaction.response.delivered")) || (data163 === "run.attached")) || (data163 === "run.detached")) || (data163 === "run.result.proposed")) || (data163 === "run.result.accepted")) || (data163 === "run.result.rejected")) || (data163 === "attention.request.proposed")) || (data163 === "attention.request.routed")) || (data163 === "attention.request.resolved")) || (data163 === "attention.request.expired")) || (data163 === "attention.request.superseded")) || (data163 === "work.assessment.recorded")) || (data163 === "issue.status.decision.recorded")) || (data163 === "issue.status.decision.applied")) || (data163 === "issue.status.decision.rejected")) || (data163 === "issue.status.decision.superseded")) || (data163 === "run.terminal"))){const err351 = {instancePath:instancePath+"/eventType",schemaPath:"#/properties/eventType/enum",keyword:"enum",params:{allowedValues: schema50.properties.eventType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err351];}else {vErrors.push(err351);}errors++;}}if(data.schemaVersion !== undefined){if(1 !== data.schemaVersion){const err352 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err352];}else {vErrors.push(err352);}errors++;}}if(data.priority !== undefined){let data165 = data.priority;if(!(((data165 === 0) || (data165 === 1)) || (data165 === 2))){const err353 = {instancePath:instancePath+"/priority",schemaPath:"#/properties/priority/enum",keyword:"enum",params:{allowedValues: schema50.properties.priority.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err353];}else {vErrors.push(err353);}errors++;}}if(data.emittedAt !== undefined){let data166 = data.emittedAt;if(typeof data166 === "string"){if(!(formats0.test(data166))){const err354 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err354];}else {vErrors.push(err354);}errors++;}}else {const err355 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err355];}else {vErrors.push(err355);}errors++;}}if(data.observedAt !== undefined){let data167 = data.observedAt;if(typeof data167 === "string"){if(!(formats0.test(data167))){const err356 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err356];}else {vErrors.push(err356);}errors++;}}else {const err357 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err357];}else {vErrors.push(err357);}errors++;}}if(data.payload !== undefined){let data168 = data.payload;if(data168 && typeof data168 == "object" && !Array.isArray(data168)){if(data168.channel !== undefined){let data169 = data168.channel;if(!(((((data169 === "progress") || (data169 === "final")) || (data169 === "summary")) || (data169 === "detail")) || (data169 === "unknown"))){const err358 = {instancePath:instancePath+"/payload/channel",schemaPath:"#/properties/payload/properties/channel/enum",keyword:"enum",params:{allowedValues: schema50.properties.payload.properties.channel.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err358];}else {vErrors.push(err358);}errors++;}}if(data168.providerPhase !== undefined){if(typeof data168.providerPhase !== "string"){const err359 = {instancePath:instancePath+"/payload/providerPhase",schemaPath:"#/properties/payload/properties/providerPhase/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err359];}else {vErrors.push(err359);}errors++;}}if(data168.providerMethod !== undefined){if(typeof data168.providerMethod !== "string"){const err360 = {instancePath:instancePath+"/payload/providerMethod",schemaPath:"#/properties/payload/properties/providerMethod/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err360];}else {vErrors.push(err360);}errors++;}}}else {const err361 = {instancePath:instancePath+"/payload",schemaPath:"#/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err361];}else {vErrors.push(err361);}errors++;}}if(data.debug !== undefined){let data172 = data.debug;if(data172 && typeof data172 == "object" && !Array.isArray(data172)){}else {const err362 = {instancePath:instancePath+"/debug",schemaPath:"#/properties/debug/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err362];}else {vErrors.push(err362);}errors++;}}}else {const err363 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err363];}else {vErrors.push(err363);}errors++;}validate28.errors = vErrors;return errors === 0;}validate28.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema203 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v2/event.schema.json","title":"PRP v2 native event","type":"object","required":["schema","sourceEventId","sourceSeq","sourceInstanceId","sourceKind","runId","eventType","schemaVersion","priority","emittedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.event.v2"},"sourceEventId":{"type":"string","minLength":1,"maxLength":160},"sourceSeq":{"type":"integer","minimum":1,"maximum":9007199254740991},"sourceInstanceId":{"type":"string","minLength":1,"maxLength":160},"sourceKind":{"enum":["runner","control_plane"]},"runId":{"type":"string","minLength":1,"maxLength":160},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":160},"turnId":{"type":"string","minLength":1,"maxLength":160},"itemId":{"type":"string","minLength":1,"maxLength":160},"eventType":{"enum":["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.suspending","runner.suspended","runner.stopped","runner.diagnostic","runtime.phase.changed","sandbox.metric","workspace.ready","workspace.change.updated","workspace.diff.recorded","workspace.file.referenced","harness.starting","harness.ready","harness.exited","harness.diagnostic","plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","session.failed","session.capabilities.updated","session.goal.snapshot","session.goal.updated","session.goal.cleared","turn.submitted","turn.accepted","turn.started","turn.completed","turn.failed","turn.interrupted","turn.cancelled","item.started","item.delta","item.completed","item.failed","usage.reported","semantic_tool.input","semantic_tool.result","mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.tool_input","mcp_app.tool_result","mcp_app.action.requested","mcp_app.action.resolved","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown","runtime_request.created","runtime_request.resolved","runtime_request.expired","runtime_request.cancelled","interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered","run.attached","run.detached","run.result.proposed","run.result.accepted","run.result.rejected","attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded","run.terminal"]},"schemaVersion":{"const":2},"priority":{"enum":[0,1,2]},"emittedAt":{"type":"string","format":"date-time"},"observedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","additionalProperties":true},"debug":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"eventType":{"enum":["session.goal.snapshot","session.goal.updated"]}}},"then":{"properties":{"payload":{"type":"object","required":["goal"],"properties":{"goal":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"},{"type":"null"}]}},"additionalProperties":true}}}},{"if":{"properties":{"eventType":{"const":"session.capabilities.updated"}}},"then":{"properties":{"payload":{"type":"object","required":["sessionGoals"],"properties":{"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"turnControls":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"}},"additionalProperties":true}}}}],"additionalProperties":true};const schema204 = {"type":"object","required":["objective","status","tokenBudget","tokensUsed","elapsedSeconds","iterations","lastReason","createdAt","updatedAt","completedAt","workingNow"],"properties":{"objective":{"type":"string","minLength":1,"maxLength":4000},"status":{"enum":["active","paused","blocked","limited","usage_limited","budget_limited","complete"]},"tokenBudget":{"type":["integer","null"],"minimum":1},"tokensUsed":{"type":["integer","null"],"minimum":0},"elapsedSeconds":{"type":["number","null"],"minimum":0},"iterations":{"type":["integer","null"],"minimum":0},"lastReason":{"type":["string","null"],"maxLength":4000},"createdAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"workingNow":{"type":"boolean"}},"additionalProperties":true};const schema207 = {"type":"object","required":["steering","queuedFollowUp"],"properties":{"steering":{"type":"boolean"},"queuedFollowUp":{"type":"boolean"}},"additionalProperties":false};function validate111(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v2/event.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate111.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data0 = data.eventType;if(!((data0 === "session.goal.snapshot") || (data0 === "session.goal.updated"))){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data1 = data.payload;if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.goal === undefined){const err1 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/required",keyword:"required",params:{missingProperty: "goal"},message:"must have required property '"+"goal"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data1.goal !== undefined){let data2 = data1.goal;const _errs10 = errors;let valid5 = false;let passing0 = null;const _errs11 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.objective === undefined){const err2 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "objective"},message:"must have required property '"+"objective"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data2.status === undefined){const err3 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data2.tokenBudget === undefined){const err4 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokenBudget"},message:"must have required property '"+"tokenBudget"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data2.tokensUsed === undefined){const err5 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokensUsed"},message:"must have required property '"+"tokensUsed"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data2.elapsedSeconds === undefined){const err6 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "elapsedSeconds"},message:"must have required property '"+"elapsedSeconds"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data2.iterations === undefined){const err7 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "iterations"},message:"must have required property '"+"iterations"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data2.lastReason === undefined){const err8 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "lastReason"},message:"must have required property '"+"lastReason"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data2.createdAt === undefined){const err9 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "createdAt"},message:"must have required property '"+"createdAt"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.updatedAt === undefined){const err10 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "updatedAt"},message:"must have required property '"+"updatedAt"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data2.completedAt === undefined){const err11 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "completedAt"},message:"must have required property '"+"completedAt"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data2.workingNow === undefined){const err12 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "workingNow"},message:"must have required property '"+"workingNow"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.objective !== undefined){let data3 = data2.objective;if(typeof data3 === "string"){if(func1(data3) > 4000){const err13 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data3) < 1){const err14 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data2.status !== undefined){let data4 = data2.status;if(!(((((((data4 === "active") || (data4 === "paused")) || (data4 === "blocked")) || (data4 === "limited")) || (data4 === "usage_limited")) || (data4 === "budget_limited")) || (data4 === "complete"))){const err16 = {instancePath:instancePath+"/payload/goal/status",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/status/enum",keyword:"enum",params:{allowedValues: schema204.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.tokenBudget !== undefined){let data5 = data2.tokenBudget;if((!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) && (data5 !== null)){const err17 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/type",keyword:"type",params:{type: schema204.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 1 || isNaN(data5)){const err18 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}}if(data2.tokensUsed !== undefined){let data6 = data2.tokensUsed;if((!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) && (data6 !== null)){const err19 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/type",keyword:"type",params:{type: schema204.properties.tokensUsed.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){const err20 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}}if(data2.elapsedSeconds !== undefined){let data7 = data2.elapsedSeconds;if((!((typeof data7 == "number") && (isFinite(data7)))) && (data7 !== null)){const err21 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/type",keyword:"type",params:{type: schema204.properties.elapsedSeconds.type},message:"must be number,null"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if((typeof data7 == "number") && (isFinite(data7))){if(data7 < 0 || isNaN(data7)){const err22 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}}if(data2.iterations !== undefined){let data8 = data2.iterations;if((!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))) && (data8 !== null)){const err23 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/type",keyword:"type",params:{type: schema204.properties.iterations.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if((typeof data8 == "number") && (isFinite(data8))){if(data8 < 0 || isNaN(data8)){const err24 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}}if(data2.lastReason !== undefined){let data9 = data2.lastReason;if((typeof data9 !== "string") && (data9 !== null)){const err25 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/type",keyword:"type",params:{type: schema204.properties.lastReason.type},message:"must be string,null"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(typeof data9 === "string"){if(func1(data9) > 4000){const err26 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}}if(data2.createdAt !== undefined){let data10 = data2.createdAt;if((typeof data10 !== "string") && (data10 !== null)){const err27 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/type",keyword:"type",params:{type: schema204.properties.createdAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(typeof data10 === "string"){if(!(formats0.test(data10))){const err28 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}}if(data2.updatedAt !== undefined){let data11 = data2.updatedAt;if((typeof data11 !== "string") && (data11 !== null)){const err29 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/type",keyword:"type",params:{type: schema204.properties.updatedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}if(typeof data11 === "string"){if(!(formats0.test(data11))){const err30 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}}if(data2.completedAt !== undefined){let data12 = data2.completedAt;if((typeof data12 !== "string") && (data12 !== null)){const err31 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/type",keyword:"type",params:{type: schema204.properties.completedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(typeof data12 === "string"){if(!(formats0.test(data12))){const err32 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}}if(data2.workingNow !== undefined){if(typeof data2.workingNow !== "boolean"){const err33 = {instancePath:instancePath+"/payload/goal/workingNow",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/workingNow/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}else {const err34 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}var _valid1 = _errs11 === errors;if(_valid1){valid5 = true;passing0 = 0;}const _errs36 = errors;if(data2 !== null){const err35 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}var _valid1 = _errs36 === errors;if(_valid1 && valid5){valid5 = false;passing0 = [passing0, 1];}else {if(_valid1){valid5 = true;passing0 = 1;}}if(!valid5){const err36 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}else {errors = _errs10;if(vErrors !== null){if(_errs10){vErrors.length = _errs10;}else {vErrors = null;}}}}}else {const err37 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props1 = {};props1.payload = true;props1.eventType = true;}}if(!valid1){const err38 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}const _errs39 = errors;let valid8 = true;const _errs40 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("session.capabilities.updated" !== data.eventType){const err39 = {};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}}var _valid2 = _errs40 === errors;errors = _errs39;if(vErrors !== null){if(_errs39){vErrors.length = _errs39;}else {vErrors = null;}}if(_valid2){const _errs42 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data15 = data.payload;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.sessionGoals === undefined){const err40 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}if(data15.sessionGoals !== undefined){let data16 = data15.sessionGoals;if(data16 && typeof data16 == "object" && !Array.isArray(data16)){if(data16.availability === undefined){const err41 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(data16.actions === undefined){const err42 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(data16.autonomousUpdates === undefined){const err43 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(data16.persistentAcrossResume === undefined){const err44 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(data16.maxObjectiveChars === undefined){const err45 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(data16.tokenBudgetControl === undefined){const err46 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data16.usageReporting === undefined){const err47 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(data16.availability !== undefined){let data17 = data16.availability;if(!(((data17 === "available") || (data17 === "unsupported")) || (data17 === "policy_disabled"))){const err48 = {instancePath:instancePath+"/payload/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data16.actions !== undefined){let data18 = data16.actions;if(Array.isArray(data18)){const len0 = data18.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data18[i1], data18[j0])){const err50 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;break outer0;}}}}}else {const err51 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data16.autonomousUpdates !== undefined){if(typeof data16.autonomousUpdates !== "boolean"){const err52 = {instancePath:instancePath+"/payload/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data16.persistentAcrossResume !== undefined){if(typeof data16.persistentAcrossResume !== "boolean"){const err53 = {instancePath:instancePath+"/payload/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data16.maxObjectiveChars !== undefined){let data22 = data16.maxObjectiveChars;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err54 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 > 4000 || isNaN(data22)){const err55 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}if(data22 < 1 || isNaN(data22)){const err56 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}}if(data16.tokenBudgetControl !== undefined){if(typeof data16.tokenBudgetControl !== "boolean"){const err57 = {instancePath:instancePath+"/payload/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data16.usageReporting !== undefined){if(typeof data16.usageReporting !== "boolean"){const err58 = {instancePath:instancePath+"/payload/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}if(data16.reasonCode !== undefined){let data25 = data16.reasonCode;if(typeof data25 === "string"){if(func1(data25) > 160){const err59 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(func1(data25) < 1){const err60 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}else {const err61 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data16.reason !== undefined){let data26 = data16.reason;if(typeof data26 === "string"){if(func1(data26) > 1000){const err62 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(func1(data26) < 1){const err63 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}}else {const err65 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data15.turnControls !== undefined){let data27 = data15.turnControls;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(data27.steering === undefined){const err66 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "steering"},message:"must have required property '"+"steering"+"'"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}if(data27.queuedFollowUp === undefined){const err67 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "queuedFollowUp"},message:"must have required property '"+"queuedFollowUp"+"'"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}for(const key0 in data27){if(!((key0 === "steering") || (key0 === "queuedFollowUp"))){const err68 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data27.steering !== undefined){if(typeof data27.steering !== "boolean"){const err69 = {instancePath:instancePath+"/payload/turnControls/steering",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/steering/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data27.queuedFollowUp !== undefined){if(typeof data27.queuedFollowUp !== "boolean"){const err70 = {instancePath:instancePath+"/payload/turnControls/queuedFollowUp",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/queuedFollowUp/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}}else {const err72 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}}var _valid2 = _errs42 === errors;valid8 = _valid2;if(valid8){var props2 = {};props2.payload = true;props2.eventType = true;}}if(!valid8){const err73 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}if(props1 !== true && props2 !== undefined){if(props2 === true){props1 = true;}else {props1 = props1 || {};Object.assign(props1, props2);}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err74 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}if(data.sourceEventId === undefined){const err75 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceEventId"},message:"must have required property '"+"sourceEventId"+"'"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}if(data.sourceSeq === undefined){const err76 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceSeq"},message:"must have required property '"+"sourceSeq"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data.sourceInstanceId === undefined){const err77 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceInstanceId"},message:"must have required property '"+"sourceInstanceId"+"'"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(data.sourceKind === undefined){const err78 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceKind"},message:"must have required property '"+"sourceKind"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data.runId === undefined){const err79 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}if(data.eventType === undefined){const err80 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "eventType"},message:"must have required property '"+"eventType"+"'"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data.schemaVersion === undefined){const err81 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(data.priority === undefined){const err82 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "priority"},message:"must have required property '"+"priority"+"'"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(data.emittedAt === undefined){const err83 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "emittedAt"},message:"must have required property '"+"emittedAt"+"'"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(data.payload === undefined){const err84 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}if(data.schema !== undefined){if("paperclip.prp.event.v2" !== data.schema){const err85 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.event.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}if(data.sourceEventId !== undefined){let data31 = data.sourceEventId;if(typeof data31 === "string"){if(func1(data31) > 160){const err86 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}if(func1(data31) < 1){const err87 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}else {const err88 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}if(data.sourceSeq !== undefined){let data32 = data.sourceSeq;if(!(((typeof data32 == "number") && (!(data32 % 1) && !isNaN(data32))) && (isFinite(data32)))){const err89 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if((typeof data32 == "number") && (isFinite(data32))){if(data32 > 9007199254740991 || isNaN(data32)){const err90 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(data32 < 1 || isNaN(data32)){const err91 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}if(data.sourceInstanceId !== undefined){let data33 = data.sourceInstanceId;if(typeof data33 === "string"){if(func1(data33) > 160){const err92 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}if(func1(data33) < 1){const err93 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}}else {const err94 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}if(data.sourceKind !== undefined){let data34 = data.sourceKind;if(!((data34 === "runner") || (data34 === "control_plane"))){const err95 = {instancePath:instancePath+"/sourceKind",schemaPath:"#/properties/sourceKind/enum",keyword:"enum",params:{allowedValues: schema203.properties.sourceKind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}if(data.runId !== undefined){let data35 = data.runId;if(typeof data35 === "string"){if(func1(data35) > 160){const err96 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}if(func1(data35) < 1){const err97 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}}else {const err98 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}if(data.normalizedSessionId !== undefined){let data36 = data.normalizedSessionId;if(typeof data36 === "string"){if(func1(data36) > 160){const err99 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}if(func1(data36) < 1){const err100 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}}else {const err101 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}if(data.turnId !== undefined){let data37 = data.turnId;if(typeof data37 === "string"){if(func1(data37) > 160){const err102 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(func1(data37) < 1){const err103 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}else {const err104 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}if(data.itemId !== undefined){let data38 = data.itemId;if(typeof data38 === "string"){if(func1(data38) > 160){const err105 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(func1(data38) < 1){const err106 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}else {const err107 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}if(data.eventType !== undefined){let data39 = data.eventType;if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((data39 === "runner.connected") || (data39 === "runner.reconnected")) || (data39 === "runner.reconciled")) || (data39 === "runner.disconnected")) || (data39 === "runner.draining")) || (data39 === "runner.suspending")) || (data39 === "runner.suspended")) || (data39 === "runner.stopped")) || (data39 === "runner.diagnostic")) || (data39 === "runtime.phase.changed")) || (data39 === "sandbox.metric")) || (data39 === "workspace.ready")) || (data39 === "workspace.change.updated")) || (data39 === "workspace.diff.recorded")) || (data39 === "workspace.file.referenced")) || (data39 === "harness.starting")) || (data39 === "harness.ready")) || (data39 === "harness.exited")) || (data39 === "harness.diagnostic")) || (data39 === "plan.updated")) || (data39 === "tool.execution.started")) || (data39 === "tool.execution.progressed")) || (data39 === "tool.execution.completed")) || (data39 === "research.started")) || (data39 === "research.progressed")) || (data39 === "research.completed")) || (data39 === "delegation.started")) || (data39 === "delegation.updated")) || (data39 === "delegation.completed")) || (data39 === "model.route.changed")) || (data39 === "model.verification.updated")) || (data39 === "context.compacted")) || (data39 === "artifact.viewed")) || (data39 === "artifact.generated")) || (data39 === "review.mode.changed")) || (data39 === "hook.started")) || (data39 === "hook.completed")) || (data39 === "memory.citation.referenced")) || (data39 === "safety.review.started")) || (data39 === "safety.review.completed")) || (data39 === "terminal.input.sent")) || (data39 === "wait.started")) || (data39 === "wait.completed")) || (data39 === "provider.notice.recorded")) || (data39 === "session.starting")) || (data39 === "session.started")) || (data39 === "session.resuming")) || (data39 === "session.resumed")) || (data39 === "session.reconciled")) || (data39 === "session.updated")) || (data39 === "session.closed")) || (data39 === "session.failed")) || (data39 === "session.capabilities.updated")) || (data39 === "session.goal.snapshot")) || (data39 === "session.goal.updated")) || (data39 === "session.goal.cleared")) || (data39 === "turn.submitted")) || (data39 === "turn.accepted")) || (data39 === "turn.started")) || (data39 === "turn.completed")) || (data39 === "turn.failed")) || (data39 === "turn.interrupted")) || (data39 === "turn.cancelled")) || (data39 === "item.started")) || (data39 === "item.delta")) || (data39 === "item.completed")) || (data39 === "item.failed")) || (data39 === "usage.reported")) || (data39 === "semantic_tool.input")) || (data39 === "semantic_tool.result")) || (data39 === "mcp_app.discovered")) || (data39 === "mcp_app.resource.resolved")) || (data39 === "mcp_app.initializing")) || (data39 === "mcp_app.ready")) || (data39 === "mcp_app.tool_input")) || (data39 === "mcp_app.tool_result")) || (data39 === "mcp_app.action.requested")) || (data39 === "mcp_app.action.resolved")) || (data39 === "mcp_app.host_context.changed")) || (data39 === "mcp_app.failed")) || (data39 === "mcp_app.teardown")) || (data39 === "runtime_request.created")) || (data39 === "runtime_request.resolved")) || (data39 === "runtime_request.expired")) || (data39 === "runtime_request.cancelled")) || (data39 === "interaction.request.proposed")) || (data39 === "interaction.request.materialized")) || (data39 === "interaction.request.rejected")) || (data39 === "interaction.response.progressed")) || (data39 === "interaction.response.resolved")) || (data39 === "interaction.response.delivered")) || (data39 === "run.attached")) || (data39 === "run.detached")) || (data39 === "run.result.proposed")) || (data39 === "run.result.accepted")) || (data39 === "run.result.rejected")) || (data39 === "attention.request.proposed")) || (data39 === "attention.request.routed")) || (data39 === "attention.request.resolved")) || (data39 === "attention.request.expired")) || (data39 === "attention.request.superseded")) || (data39 === "work.assessment.recorded")) || (data39 === "issue.status.decision.recorded")) || (data39 === "issue.status.decision.applied")) || (data39 === "issue.status.decision.rejected")) || (data39 === "issue.status.decision.superseded")) || (data39 === "run.terminal"))){const err108 = {instancePath:instancePath+"/eventType",schemaPath:"#/properties/eventType/enum",keyword:"enum",params:{allowedValues: schema203.properties.eventType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data.schemaVersion !== undefined){if(2 !== data.schemaVersion){const err109 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 2},message:"must be equal to constant"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}if(data.priority !== undefined){let data41 = data.priority;if(!(((data41 === 0) || (data41 === 1)) || (data41 === 2))){const err110 = {instancePath:instancePath+"/priority",schemaPath:"#/properties/priority/enum",keyword:"enum",params:{allowedValues: schema203.properties.priority.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.emittedAt !== undefined){let data42 = data.emittedAt;if(typeof data42 === "string"){if(!(formats0.test(data42))){const err111 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}else {const err112 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}}if(data.observedAt !== undefined){let data43 = data.observedAt;if(typeof data43 === "string"){if(!(formats0.test(data43))){const err113 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data.payload !== undefined){let data44 = data.payload;if(data44 && typeof data44 == "object" && !Array.isArray(data44)){}else {const err115 = {instancePath:instancePath+"/payload",schemaPath:"#/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data.debug !== undefined){let data45 = data.debug;if(data45 && typeof data45 == "object" && !Array.isArray(data45)){}else {const err116 = {instancePath:instancePath+"/debug",schemaPath:"#/properties/debug/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}else {const err117 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}validate111.errors = vErrors;return errors === 0;}validate111.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema209 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v3/event.schema.json","title":"PRP v3 native event","type":"object","required":["schema","sourceEventId","sourceSeq","sourceInstanceId","sourceKind","runId","eventType","schemaVersion","priority","emittedAt","payload"],"properties":{"schema":{"const":"paperclip.prp.event.v3"},"sourceEventId":{"type":"string","minLength":1,"maxLength":160},"sourceSeq":{"type":"integer","minimum":1,"maximum":9007199254740991},"sourceInstanceId":{"type":"string","minLength":1,"maxLength":160},"sourceKind":{"enum":["runner","control_plane"]},"runId":{"type":"string","minLength":1,"maxLength":160},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":160},"turnId":{"type":"string","minLength":1,"maxLength":160},"itemId":{"type":"string","minLength":1,"maxLength":160},"eventType":{"enum":["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.suspending","runner.suspended","runner.stopped","runner.diagnostic","runtime.phase.changed","sandbox.metric","workspace.ready","workspace.change.updated","workspace.diff.recorded","workspace.file.referenced","harness.starting","harness.ready","harness.exited","harness.diagnostic","plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","session.failed","session.capabilities.updated","session.goal.snapshot","session.goal.updated","session.goal.cleared","turn.submitted","turn.accepted","turn.started","turn.completed","turn.failed","turn.interrupted","turn.cancelled","item.started","item.delta","item.completed","item.failed","usage.reported","semantic_tool.input","semantic_tool.result","mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.tool_input","mcp_app.tool_result","mcp_app.action.requested","mcp_app.action.resolved","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown","runtime_request.created","runtime_request.resolved","runtime_request.expired","runtime_request.cancelled","interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered","run.attached","run.detached","run.result.proposed","run.result.accepted","run.result.rejected","attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded","run.terminal","external_provider.dispatch_requested","external_provider.operation_settled"]},"schemaVersion":{"const":3},"priority":{"enum":[0,1,2]},"emittedAt":{"type":"string","format":"date-time"},"observedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","additionalProperties":true},"debug":{"type":"object","additionalProperties":true}},"allOf":[{"if":{"properties":{"eventType":{"enum":["session.goal.snapshot","session.goal.updated"]}},"type":"object"},"then":{"properties":{"payload":{"type":"object","required":["goal"],"properties":{"goal":{"oneOf":[{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot"},{"type":"null"}]}},"additionalProperties":true}},"type":"object"}},{"if":{"properties":{"eventType":{"const":"session.capabilities.updated"}},"type":"object"},"then":{"properties":{"payload":{"type":"object","required":["sessionGoals"],"properties":{"sessionGoals":{"$ref":"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability"},"turnControls":{"$ref":"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls"}},"additionalProperties":true}},"type":"object"}},{"if":{"properties":{"eventType":{"const":"external_provider.dispatch_requested"}},"type":"object"},"then":{"properties":{"payload":{"oneOf":[{"type":"object","properties":{"binding":{"type":"object","properties":{"companyId":{"type":"string","minLength":1,"maxLength":240},"agentId":{"type":"string","minLength":1,"maxLength":240},"bindingId":{"type":"string","minLength":1,"maxLength":240},"runId":{"type":"string","minLength":1,"maxLength":240},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":240},"turnId":{"type":"string","minLength":1,"maxLength":240},"bindingGeneration":{"type":"integer","minimum":1},"assignmentRevision":{"type":"integer","minimum":1}},"additionalProperties":false,"required":["companyId","agentId","bindingId","runId","normalizedSessionId","turnId","bindingGeneration","assignmentRevision"]},"text":{"type":"string","minLength":1,"maxLength":1048576},"instructions":{"type":"string","maxLength":1048576},"acceptByUnixMs":{"type":"integer","minimum":1},"expiresAtUnixMs":{"type":"integer","minimum":1},"completionContract":{"type":"object","properties":{"revision":{"type":"string","minLength":1},"criterionIds":{"type":"array","minItems":1,"maxItems":256,"uniqueItems":true,"items":{"type":"string","minLength":1}}},"required":["revision","criterionIds"],"additionalProperties":false},"tools":{"type":"array","items":{"type":"object"},"maxItems":512}},"additionalProperties":false,"required":["binding","text","instructions","acceptByUnixMs","expiresAtUnixMs","completionContract","tools"]},{"type":"object","properties":{"binding":{"type":"object","properties":{"companyId":{"type":"string","minLength":1,"maxLength":240},"agentId":{"type":"string","minLength":1,"maxLength":240},"bindingId":{"type":"string","minLength":1,"maxLength":240},"runId":{"type":"string","minLength":1,"maxLength":240},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":240},"turnId":{"type":"string","minLength":1,"maxLength":240},"bindingGeneration":{"type":"integer","minimum":1},"assignmentRevision":{"type":"integer","minimum":1}},"additionalProperties":false,"required":["companyId","agentId","bindingId","runId","normalizedSessionId","turnId","bindingGeneration","assignmentRevision"]},"kind":{"const":"authority_revoked"},"reason":{"type":"string"},"externalStopConfirmed":{"const":false}},"required":["binding","kind","externalStopConfirmed"],"additionalProperties":false}]}},"type":"object"}},{"if":{"properties":{"eventType":{"const":"external_provider.operation_settled"}},"type":"object"},"then":{"properties":{"payload":{"type":"object","properties":{"binding":{"type":"object","properties":{"companyId":{"type":"string","minLength":1,"maxLength":240},"agentId":{"type":"string","minLength":1,"maxLength":240},"bindingId":{"type":"string","minLength":1,"maxLength":240},"runId":{"type":"string","minLength":1,"maxLength":240},"normalizedSessionId":{"type":"string","minLength":1,"maxLength":240},"turnId":{"type":"string","minLength":1,"maxLength":240},"bindingGeneration":{"type":"integer","minimum":1},"assignmentRevision":{"type":"integer","minimum":1}},"additionalProperties":false,"required":["companyId","agentId","bindingId","runId","normalizedSessionId","turnId","bindingGeneration","assignmentRevision"]},"requestId":{"type":"string","minLength":1,"maxLength":240},"outcome":{"type":"object"}},"required":["binding","requestId","outcome"],"additionalProperties":false}},"type":"object"}}],"additionalProperties":true};function validate114(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v3/event.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate114.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(errors === _errs3){if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){let data0 = data.eventType;if(!((data0 === "session.goal.snapshot") || (data0 === "session.goal.updated"))){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}}}else {const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs6 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data1 = data.payload;if(data1 && typeof data1 == "object" && !Array.isArray(data1)){if(data1.goal === undefined){const err2 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/required",keyword:"required",params:{missingProperty: "goal"},message:"must have required property '"+"goal"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data1.goal !== undefined){let data2 = data1.goal;const _errs12 = errors;let valid5 = false;let passing0 = null;const _errs13 = errors;if(data2 && typeof data2 == "object" && !Array.isArray(data2)){if(data2.objective === undefined){const err3 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "objective"},message:"must have required property '"+"objective"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data2.status === undefined){const err4 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data2.tokenBudget === undefined){const err5 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokenBudget"},message:"must have required property '"+"tokenBudget"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data2.tokensUsed === undefined){const err6 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "tokensUsed"},message:"must have required property '"+"tokensUsed"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data2.elapsedSeconds === undefined){const err7 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "elapsedSeconds"},message:"must have required property '"+"elapsedSeconds"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data2.iterations === undefined){const err8 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "iterations"},message:"must have required property '"+"iterations"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data2.lastReason === undefined){const err9 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "lastReason"},message:"must have required property '"+"lastReason"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data2.createdAt === undefined){const err10 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "createdAt"},message:"must have required property '"+"createdAt"+"'"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data2.updatedAt === undefined){const err11 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "updatedAt"},message:"must have required property '"+"updatedAt"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data2.completedAt === undefined){const err12 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "completedAt"},message:"must have required property '"+"completedAt"+"'"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(data2.workingNow === undefined){const err13 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/required",keyword:"required",params:{missingProperty: "workingNow"},message:"must have required property '"+"workingNow"+"'"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(data2.objective !== undefined){let data3 = data2.objective;if(typeof data3 === "string"){if(func1(data3) > 4000){const err14 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(func1(data3) < 1){const err15 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}else {const err16 = {instancePath:instancePath+"/payload/goal/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data2.status !== undefined){let data4 = data2.status;if(!(((((((data4 === "active") || (data4 === "paused")) || (data4 === "blocked")) || (data4 === "limited")) || (data4 === "usage_limited")) || (data4 === "budget_limited")) || (data4 === "complete"))){const err17 = {instancePath:instancePath+"/payload/goal/status",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/status/enum",keyword:"enum",params:{allowedValues: schema204.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}if(data2.tokenBudget !== undefined){let data5 = data2.tokenBudget;if((!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) && (data5 !== null)){const err18 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/type",keyword:"type",params:{type: schema204.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}if((typeof data5 == "number") && (isFinite(data5))){if(data5 < 1 || isNaN(data5)){const err19 = {instancePath:instancePath+"/payload/goal/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}if(data2.tokensUsed !== undefined){let data6 = data2.tokensUsed;if((!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) && (data6 !== null)){const err20 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/type",keyword:"type",params:{type: schema204.properties.tokensUsed.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if((typeof data6 == "number") && (isFinite(data6))){if(data6 < 0 || isNaN(data6)){const err21 = {instancePath:instancePath+"/payload/goal/tokensUsed",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/tokensUsed/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}}if(data2.elapsedSeconds !== undefined){let data7 = data2.elapsedSeconds;if((!((typeof data7 == "number") && (isFinite(data7)))) && (data7 !== null)){const err22 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/type",keyword:"type",params:{type: schema204.properties.elapsedSeconds.type},message:"must be number,null"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if((typeof data7 == "number") && (isFinite(data7))){if(data7 < 0 || isNaN(data7)){const err23 = {instancePath:instancePath+"/payload/goal/elapsedSeconds",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/elapsedSeconds/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}if(data2.iterations !== undefined){let data8 = data2.iterations;if((!(((typeof data8 == "number") && (!(data8 % 1) && !isNaN(data8))) && (isFinite(data8)))) && (data8 !== null)){const err24 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/type",keyword:"type",params:{type: schema204.properties.iterations.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if((typeof data8 == "number") && (isFinite(data8))){if(data8 < 0 || isNaN(data8)){const err25 = {instancePath:instancePath+"/payload/goal/iterations",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/iterations/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}}if(data2.lastReason !== undefined){let data9 = data2.lastReason;if((typeof data9 !== "string") && (data9 !== null)){const err26 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/type",keyword:"type",params:{type: schema204.properties.lastReason.type},message:"must be string,null"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(typeof data9 === "string"){if(func1(data9) > 4000){const err27 = {instancePath:instancePath+"/payload/goal/lastReason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/lastReason/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}}if(data2.createdAt !== undefined){let data10 = data2.createdAt;if((typeof data10 !== "string") && (data10 !== null)){const err28 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/type",keyword:"type",params:{type: schema204.properties.createdAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}if(typeof data10 === "string"){if(!(formats0.test(data10))){const err29 = {instancePath:instancePath+"/payload/goal/createdAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/createdAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}}if(data2.updatedAt !== undefined){let data11 = data2.updatedAt;if((typeof data11 !== "string") && (data11 !== null)){const err30 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/type",keyword:"type",params:{type: schema204.properties.updatedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(typeof data11 === "string"){if(!(formats0.test(data11))){const err31 = {instancePath:instancePath+"/payload/goal/updatedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/updatedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}}if(data2.completedAt !== undefined){let data12 = data2.completedAt;if((typeof data12 !== "string") && (data12 !== null)){const err32 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/type",keyword:"type",params:{type: schema204.properties.completedAt.type},message:"must be string,null"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(typeof data12 === "string"){if(!(formats0.test(data12))){const err33 = {instancePath:instancePath+"/payload/goal/completedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/completedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}if(data2.workingNow !== undefined){if(typeof data2.workingNow !== "boolean"){const err34 = {instancePath:instancePath+"/payload/goal/workingNow",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/properties/workingNow/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}}else {const err35 = {instancePath:instancePath+"/payload/goal",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/snapshot/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}var _valid1 = _errs13 === errors;if(_valid1){valid5 = true;passing0 = 0;}const _errs38 = errors;if(data2 !== null){const err36 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}var _valid1 = _errs38 === errors;if(_valid1 && valid5){valid5 = false;passing0 = [passing0, 1];}else {if(_valid1){valid5 = true;passing0 = 1;}}if(!valid5){const err37 = {instancePath:instancePath+"/payload/goal",schemaPath:"#/allOf/0/then/properties/payload/properties/goal/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs12;if(vErrors !== null){if(_errs12){vErrors.length = _errs12;}else {vErrors = null;}}}}}else {const err38 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}}else {const err39 = {instancePath,schemaPath:"#/allOf/0/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}var _valid0 = _errs6 === errors;valid1 = _valid0;if(valid1){var props1 = {};props1.payload = true;props1.eventType = true;}}if(!valid1){const err40 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}const _errs41 = errors;let valid8 = true;const _errs42 = errors;if(errors === _errs42){if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("session.capabilities.updated" !== data.eventType){const err41 = {};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}}else {const err42 = {};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}var _valid2 = _errs42 === errors;errors = _errs41;if(vErrors !== null){if(_errs41){vErrors.length = _errs41;}else {vErrors = null;}}if(_valid2){const _errs45 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data15 = data.payload;if(data15 && typeof data15 == "object" && !Array.isArray(data15)){if(data15.sessionGoals === undefined){const err43 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "sessionGoals"},message:"must have required property '"+"sessionGoals"+"'"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}if(data15.sessionGoals !== undefined){let data16 = data15.sessionGoals;if(data16 && typeof data16 == "object" && !Array.isArray(data16)){if(data16.availability === undefined){const err44 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "availability"},message:"must have required property '"+"availability"+"'"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}if(data16.actions === undefined){const err45 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "actions"},message:"must have required property '"+"actions"+"'"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}if(data16.autonomousUpdates === undefined){const err46 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "autonomousUpdates"},message:"must have required property '"+"autonomousUpdates"+"'"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}if(data16.persistentAcrossResume === undefined){const err47 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "persistentAcrossResume"},message:"must have required property '"+"persistentAcrossResume"+"'"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}if(data16.maxObjectiveChars === undefined){const err48 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "maxObjectiveChars"},message:"must have required property '"+"maxObjectiveChars"+"'"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}if(data16.tokenBudgetControl === undefined){const err49 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "tokenBudgetControl"},message:"must have required property '"+"tokenBudgetControl"+"'"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}if(data16.usageReporting === undefined){const err50 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/required",keyword:"required",params:{missingProperty: "usageReporting"},message:"must have required property '"+"usageReporting"+"'"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(data16.availability !== undefined){let data17 = data16.availability;if(!(((data17 === "available") || (data17 === "unsupported")) || (data17 === "policy_disabled"))){const err51 = {instancePath:instancePath+"/payload/sessionGoals/availability",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/availability/enum",keyword:"enum",params:{allowedValues: schema44.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data16.actions !== undefined){let data18 = data16.actions;if(Array.isArray(data18)){const len0 = data18.length;for(let i0=0; i0 1){outer0:for(;i1--;){for(j0 = i1; j0--;){if(func0(data18[i1], data18[j0])){const err53 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;break outer0;}}}}}else {const err54 = {instancePath:instancePath+"/payload/sessionGoals/actions",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/actions/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data16.autonomousUpdates !== undefined){if(typeof data16.autonomousUpdates !== "boolean"){const err55 = {instancePath:instancePath+"/payload/sessionGoals/autonomousUpdates",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/autonomousUpdates/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data16.persistentAcrossResume !== undefined){if(typeof data16.persistentAcrossResume !== "boolean"){const err56 = {instancePath:instancePath+"/payload/sessionGoals/persistentAcrossResume",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/persistentAcrossResume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data16.maxObjectiveChars !== undefined){let data22 = data16.maxObjectiveChars;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err57 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 > 4000 || isNaN(data22)){const err58 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/maximum",keyword:"maximum",params:{comparison: "<=", limit: 4000},message:"must be <= 4000"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}if(data22 < 1 || isNaN(data22)){const err59 = {instancePath:instancePath+"/payload/sessionGoals/maxObjectiveChars",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/maxObjectiveChars/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}}if(data16.tokenBudgetControl !== undefined){if(typeof data16.tokenBudgetControl !== "boolean"){const err60 = {instancePath:instancePath+"/payload/sessionGoals/tokenBudgetControl",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/tokenBudgetControl/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}if(data16.usageReporting !== undefined){if(typeof data16.usageReporting !== "boolean"){const err61 = {instancePath:instancePath+"/payload/sessionGoals/usageReporting",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/usageReporting/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}if(data16.reasonCode !== undefined){let data25 = data16.reasonCode;if(typeof data25 === "string"){if(func1(data25) > 160){const err62 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(func1(data25) < 1){const err63 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}else {const err64 = {instancePath:instancePath+"/payload/sessionGoals/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data16.reason !== undefined){let data26 = data16.reason;if(typeof data26 === "string"){if(func1(data26) > 1000){const err65 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}if(func1(data26) < 1){const err66 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}else {const err67 = {instancePath:instancePath+"/payload/sessionGoals/reason",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}}else {const err68 = {instancePath:instancePath+"/payload/sessionGoals",schemaPath:"https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data15.turnControls !== undefined){let data27 = data15.turnControls;if(data27 && typeof data27 == "object" && !Array.isArray(data27)){if(data27.steering === undefined){const err69 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "steering"},message:"must have required property '"+"steering"+"'"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(data27.queuedFollowUp === undefined){const err70 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/required",keyword:"required",params:{missingProperty: "queuedFollowUp"},message:"must have required property '"+"queuedFollowUp"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}for(const key0 in data27){if(!((key0 === "steering") || (key0 === "queuedFollowUp"))){const err71 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}if(data27.steering !== undefined){if(typeof data27.steering !== "boolean"){const err72 = {instancePath:instancePath+"/payload/turnControls/steering",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/steering/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data27.queuedFollowUp !== undefined){if(typeof data27.queuedFollowUp !== "boolean"){const err73 = {instancePath:instancePath+"/payload/turnControls/queuedFollowUp",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/properties/queuedFollowUp/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}}else {const err74 = {instancePath:instancePath+"/payload/turnControls",schemaPath:"https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json#/$defs/turnControls/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}}else {const err75 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/1/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}}else {const err76 = {instancePath,schemaPath:"#/allOf/1/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}var _valid2 = _errs45 === errors;valid8 = _valid2;if(valid8){var props2 = {};props2.payload = true;props2.eventType = true;}}if(!valid8){const err77 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(props1 !== true && props2 !== undefined){if(props2 === true){props1 = true;}else {props1 = props1 || {};Object.assign(props1, props2);}}const _errs81 = errors;let valid19 = true;const _errs82 = errors;if(errors === _errs82){if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("external_provider.dispatch_requested" !== data.eventType){const err78 = {};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}}else {const err79 = {};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}var _valid3 = _errs82 === errors;errors = _errs81;if(vErrors !== null){if(_errs81){vErrors.length = _errs81;}else {vErrors = null;}}if(_valid3){const _errs85 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data31 = data.payload;const _errs88 = errors;let valid22 = false;let passing1 = null;const _errs89 = errors;if(data31 && typeof data31 == "object" && !Array.isArray(data31)){if(data31.binding === undefined){const err80 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "binding"},message:"must have required property '"+"binding"+"'"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}if(data31.text === undefined){const err81 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "text"},message:"must have required property '"+"text"+"'"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(data31.instructions === undefined){const err82 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "instructions"},message:"must have required property '"+"instructions"+"'"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(data31.acceptByUnixMs === undefined){const err83 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "acceptByUnixMs"},message:"must have required property '"+"acceptByUnixMs"+"'"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}if(data31.expiresAtUnixMs === undefined){const err84 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "expiresAtUnixMs"},message:"must have required property '"+"expiresAtUnixMs"+"'"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}if(data31.completionContract === undefined){const err85 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "completionContract"},message:"must have required property '"+"completionContract"+"'"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}if(data31.tools === undefined){const err86 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/required",keyword:"required",params:{missingProperty: "tools"},message:"must have required property '"+"tools"+"'"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}for(const key1 in data31){if(!(((((((key1 === "binding") || (key1 === "text")) || (key1 === "instructions")) || (key1 === "acceptByUnixMs")) || (key1 === "expiresAtUnixMs")) || (key1 === "completionContract")) || (key1 === "tools"))){const err87 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data31.binding !== undefined){let data32 = data31.binding;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(data32.companyId === undefined){const err88 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "companyId"},message:"must have required property '"+"companyId"+"'"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}if(data32.agentId === undefined){const err89 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "agentId"},message:"must have required property '"+"agentId"+"'"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}if(data32.bindingId === undefined){const err90 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "bindingId"},message:"must have required property '"+"bindingId"+"'"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(data32.runId === undefined){const err91 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}if(data32.normalizedSessionId === undefined){const err92 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}if(data32.turnId === undefined){const err93 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}if(data32.bindingGeneration === undefined){const err94 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "bindingGeneration"},message:"must have required property '"+"bindingGeneration"+"'"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}if(data32.assignmentRevision === undefined){const err95 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/required",keyword:"required",params:{missingProperty: "assignmentRevision"},message:"must have required property '"+"assignmentRevision"+"'"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}for(const key2 in data32){if(!((((((((key2 === "companyId") || (key2 === "agentId")) || (key2 === "bindingId")) || (key2 === "runId")) || (key2 === "normalizedSessionId")) || (key2 === "turnId")) || (key2 === "bindingGeneration")) || (key2 === "assignmentRevision"))){const err96 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}if(data32.companyId !== undefined){let data33 = data32.companyId;if(typeof data33 === "string"){if(func1(data33) > 240){const err97 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/companyId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(func1(data33) < 1){const err98 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/companyId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/companyId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data32.agentId !== undefined){let data34 = data32.agentId;if(typeof data34 === "string"){if(func1(data34) > 240){const err100 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/agentId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func1(data34) < 1){const err101 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/agentId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}else {const err102 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/agentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}if(data32.bindingId !== undefined){let data35 = data32.bindingId;if(typeof data35 === "string"){if(func1(data35) > 240){const err103 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/bindingId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}if(func1(data35) < 1){const err104 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/bindingId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}}else {const err105 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/bindingId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}if(data32.runId !== undefined){let data36 = data32.runId;if(typeof data36 === "string"){if(func1(data36) > 240){const err106 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/runId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(func1(data36) < 1){const err107 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data32.normalizedSessionId !== undefined){let data37 = data32.normalizedSessionId;if(typeof data37 === "string"){if(func1(data37) > 240){const err109 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if(func1(data37) < 1){const err110 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}else {const err111 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data32.turnId !== undefined){let data38 = data32.turnId;if(typeof data38 === "string"){if(func1(data38) > 240){const err112 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(func1(data38) < 1){const err113 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data32.bindingGeneration !== undefined){let data39 = data32.bindingGeneration;if(!(((typeof data39 == "number") && (!(data39 % 1) && !isNaN(data39))) && (isFinite(data39)))){const err115 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/bindingGeneration/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}if((typeof data39 == "number") && (isFinite(data39))){if(data39 < 1 || isNaN(data39)){const err116 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/bindingGeneration/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}if(data32.assignmentRevision !== undefined){let data40 = data32.assignmentRevision;if(!(((typeof data40 == "number") && (!(data40 % 1) && !isNaN(data40))) && (isFinite(data40)))){const err117 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/assignmentRevision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if((typeof data40 == "number") && (isFinite(data40))){if(data40 < 1 || isNaN(data40)){const err118 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/properties/assignmentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}}}else {const err119 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/binding/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data31.text !== undefined){let data41 = data31.text;if(typeof data41 === "string"){if(func1(data41) > 1048576){const err120 = {instancePath:instancePath+"/payload/text",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/text/maxLength",keyword:"maxLength",params:{limit: 1048576},message:"must NOT have more than 1048576 characters"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}if(func1(data41) < 1){const err121 = {instancePath:instancePath+"/payload/text",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err121];}else {vErrors.push(err121);}errors++;}}else {const err122 = {instancePath:instancePath+"/payload/text",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}}if(data31.instructions !== undefined){let data42 = data31.instructions;if(typeof data42 === "string"){if(func1(data42) > 1048576){const err123 = {instancePath:instancePath+"/payload/instructions",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/instructions/maxLength",keyword:"maxLength",params:{limit: 1048576},message:"must NOT have more than 1048576 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/payload/instructions",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/instructions/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data31.acceptByUnixMs !== undefined){let data43 = data31.acceptByUnixMs;if(!(((typeof data43 == "number") && (!(data43 % 1) && !isNaN(data43))) && (isFinite(data43)))){const err125 = {instancePath:instancePath+"/payload/acceptByUnixMs",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/acceptByUnixMs/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if((typeof data43 == "number") && (isFinite(data43))){if(data43 < 1 || isNaN(data43)){const err126 = {instancePath:instancePath+"/payload/acceptByUnixMs",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/acceptByUnixMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}}if(data31.expiresAtUnixMs !== undefined){let data44 = data31.expiresAtUnixMs;if(!(((typeof data44 == "number") && (!(data44 % 1) && !isNaN(data44))) && (isFinite(data44)))){const err127 = {instancePath:instancePath+"/payload/expiresAtUnixMs",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/expiresAtUnixMs/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if((typeof data44 == "number") && (isFinite(data44))){if(data44 < 1 || isNaN(data44)){const err128 = {instancePath:instancePath+"/payload/expiresAtUnixMs",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/expiresAtUnixMs/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}}if(data31.completionContract !== undefined){let data45 = data31.completionContract;if(data45 && typeof data45 == "object" && !Array.isArray(data45)){if(data45.revision === undefined){const err129 = {instancePath:instancePath+"/payload/completionContract",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/required",keyword:"required",params:{missingProperty: "revision"},message:"must have required property '"+"revision"+"'"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if(data45.criterionIds === undefined){const err130 = {instancePath:instancePath+"/payload/completionContract",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/required",keyword:"required",params:{missingProperty: "criterionIds"},message:"must have required property '"+"criterionIds"+"'"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}for(const key3 in data45){if(!((key3 === "revision") || (key3 === "criterionIds"))){const err131 = {instancePath:instancePath+"/payload/completionContract",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}if(data45.revision !== undefined){let data46 = data45.revision;if(typeof data46 === "string"){if(func1(data46) < 1){const err132 = {instancePath:instancePath+"/payload/completionContract/revision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/revision/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}else {const err133 = {instancePath:instancePath+"/payload/completionContract/revision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/revision/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(data45.criterionIds !== undefined){let data47 = data45.criterionIds;if(Array.isArray(data47)){if(data47.length > 256){const err134 = {instancePath:instancePath+"/payload/completionContract/criterionIds",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/criterionIds/maxItems",keyword:"maxItems",params:{limit: 256},message:"must NOT have more than 256 items"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(data47.length < 1){const err135 = {instancePath:instancePath+"/payload/completionContract/criterionIds",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/criterionIds/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}const len1 = data47.length;for(let i2=0; i2 1){const indices0 = {};for(;i3--;){let item0 = data47[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j1 = indices0[item0];const err138 = {instancePath:instancePath+"/payload/completionContract/criterionIds",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/criterionIds/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;break;}indices0[item0] = i3;}}}else {const err139 = {instancePath:instancePath+"/payload/completionContract/criterionIds",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/properties/criterionIds/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}}else {const err140 = {instancePath:instancePath+"/payload/completionContract",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/completionContract/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(data31.tools !== undefined){let data49 = data31.tools;if(Array.isArray(data49)){if(data49.length > 512){const err141 = {instancePath:instancePath+"/payload/tools",schemaPath:"#/allOf/2/then/properties/payload/oneOf/0/properties/tools/maxItems",keyword:"maxItems",params:{limit: 512},message:"must NOT have more than 512 items"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}const len2 = data49.length;for(let i4=0; i4 240){const err158 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/companyId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}if(func1(data52) < 1){const err159 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/companyId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}else {const err160 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/companyId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}if(data51.agentId !== undefined){let data53 = data51.agentId;if(typeof data53 === "string"){if(func1(data53) > 240){const err161 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/agentId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}if(func1(data53) < 1){const err162 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/agentId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}else {const err163 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/agentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data51.bindingId !== undefined){let data54 = data51.bindingId;if(typeof data54 === "string"){if(func1(data54) > 240){const err164 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/bindingId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}if(func1(data54) < 1){const err165 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/bindingId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}}else {const err166 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/bindingId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}if(data51.runId !== undefined){let data55 = data51.runId;if(typeof data55 === "string"){if(func1(data55) > 240){const err167 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/runId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}if(func1(data55) < 1){const err168 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}else {const err169 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}if(data51.normalizedSessionId !== undefined){let data56 = data51.normalizedSessionId;if(typeof data56 === "string"){if(func1(data56) > 240){const err170 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(func1(data56) < 1){const err171 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}else {const err172 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}}if(data51.turnId !== undefined){let data57 = data51.turnId;if(typeof data57 === "string"){if(func1(data57) > 240){const err173 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}if(func1(data57) < 1){const err174 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}else {const err175 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}if(data51.bindingGeneration !== undefined){let data58 = data51.bindingGeneration;if(!(((typeof data58 == "number") && (!(data58 % 1) && !isNaN(data58))) && (isFinite(data58)))){const err176 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/bindingGeneration/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if((typeof data58 == "number") && (isFinite(data58))){if(data58 < 1 || isNaN(data58)){const err177 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/bindingGeneration/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}}}if(data51.assignmentRevision !== undefined){let data59 = data51.assignmentRevision;if(!(((typeof data59 == "number") && (!(data59 % 1) && !isNaN(data59))) && (isFinite(data59)))){const err178 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/assignmentRevision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}if((typeof data59 == "number") && (isFinite(data59))){if(data59 < 1 || isNaN(data59)){const err179 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/properties/assignmentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}}}else {const err180 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/binding/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}if(data31.kind !== undefined){if("authority_revoked" !== data31.kind){const err181 = {instancePath:instancePath+"/payload/kind",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/kind/const",keyword:"const",params:{allowedValue: "authority_revoked"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}}if(data31.reason !== undefined){if(typeof data31.reason !== "string"){const err182 = {instancePath:instancePath+"/payload/reason",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}}if(data31.externalStopConfirmed !== undefined){if(false !== data31.externalStopConfirmed){const err183 = {instancePath:instancePath+"/payload/externalStopConfirmed",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/properties/externalStopConfirmed/const",keyword:"const",params:{allowedValue: false},message:"must be equal to constant"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}}}else {const err184 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}var _valid4 = _errs132 === errors;if(_valid4 && valid22){valid22 = false;passing1 = [passing1, 1];}else {if(_valid4){valid22 = true;passing1 = 1;if(props3 !== true){props3 = true;}}}if(!valid22){const err185 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/2/then/properties/payload/oneOf",keyword:"oneOf",params:{passingSchemas: passing1},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}else {errors = _errs88;if(vErrors !== null){if(_errs88){vErrors.length = _errs88;}else {vErrors = null;}}}}}else {const err186 = {instancePath,schemaPath:"#/allOf/2/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}var _valid3 = _errs85 === errors;valid19 = _valid3;if(valid19){var props4 = {};props4.payload = true;props4.eventType = true;}}if(!valid19){const err187 = {instancePath,schemaPath:"#/allOf/2/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}if(props1 !== true && props4 !== undefined){if(props4 === true){props1 = true;}else {props1 = props1 || {};Object.assign(props1, props4);}}const _errs159 = errors;let valid33 = true;const _errs160 = errors;if(errors === _errs160){if(data && typeof data == "object" && !Array.isArray(data)){if(data.eventType !== undefined){if("external_provider.operation_settled" !== data.eventType){const err188 = {};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}}else {const err189 = {};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}var _valid5 = _errs160 === errors;errors = _errs159;if(vErrors !== null){if(_errs159){vErrors.length = _errs159;}else {vErrors = null;}}if(_valid5){const _errs163 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.payload !== undefined){let data64 = data.payload;if(data64 && typeof data64 == "object" && !Array.isArray(data64)){if(data64.binding === undefined){const err190 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/3/then/properties/payload/required",keyword:"required",params:{missingProperty: "binding"},message:"must have required property '"+"binding"+"'"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}if(data64.requestId === undefined){const err191 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/3/then/properties/payload/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}if(data64.outcome === undefined){const err192 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/3/then/properties/payload/required",keyword:"required",params:{missingProperty: "outcome"},message:"must have required property '"+"outcome"+"'"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}for(const key6 in data64){if(!(((key6 === "binding") || (key6 === "requestId")) || (key6 === "outcome"))){const err193 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/3/then/properties/payload/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key6},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data64.binding !== undefined){let data65 = data64.binding;if(data65 && typeof data65 == "object" && !Array.isArray(data65)){if(data65.companyId === undefined){const err194 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "companyId"},message:"must have required property '"+"companyId"+"'"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}if(data65.agentId === undefined){const err195 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "agentId"},message:"must have required property '"+"agentId"+"'"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}if(data65.bindingId === undefined){const err196 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "bindingId"},message:"must have required property '"+"bindingId"+"'"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(data65.runId === undefined){const err197 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}if(data65.normalizedSessionId === undefined){const err198 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}if(data65.turnId === undefined){const err199 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}if(data65.bindingGeneration === undefined){const err200 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "bindingGeneration"},message:"must have required property '"+"bindingGeneration"+"'"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}if(data65.assignmentRevision === undefined){const err201 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/required",keyword:"required",params:{missingProperty: "assignmentRevision"},message:"must have required property '"+"assignmentRevision"+"'"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}for(const key7 in data65){if(!((((((((key7 === "companyId") || (key7 === "agentId")) || (key7 === "bindingId")) || (key7 === "runId")) || (key7 === "normalizedSessionId")) || (key7 === "turnId")) || (key7 === "bindingGeneration")) || (key7 === "assignmentRevision"))){const err202 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key7},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}}if(data65.companyId !== undefined){let data66 = data65.companyId;if(typeof data66 === "string"){if(func1(data66) > 240){const err203 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/companyId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}if(func1(data66) < 1){const err204 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/companyId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}}else {const err205 = {instancePath:instancePath+"/payload/binding/companyId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/companyId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}if(data65.agentId !== undefined){let data67 = data65.agentId;if(typeof data67 === "string"){if(func1(data67) > 240){const err206 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/agentId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}if(func1(data67) < 1){const err207 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/agentId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}else {const err208 = {instancePath:instancePath+"/payload/binding/agentId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/agentId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(data65.bindingId !== undefined){let data68 = data65.bindingId;if(typeof data68 === "string"){if(func1(data68) > 240){const err209 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/bindingId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}if(func1(data68) < 1){const err210 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/bindingId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}else {const err211 = {instancePath:instancePath+"/payload/binding/bindingId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/bindingId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}}if(data65.runId !== undefined){let data69 = data65.runId;if(typeof data69 === "string"){if(func1(data69) > 240){const err212 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/runId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}if(func1(data69) < 1){const err213 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}}else {const err214 = {instancePath:instancePath+"/payload/binding/runId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}if(data65.normalizedSessionId !== undefined){let data70 = data65.normalizedSessionId;if(typeof data70 === "string"){if(func1(data70) > 240){const err215 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}if(func1(data70) < 1){const err216 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}else {const err217 = {instancePath:instancePath+"/payload/binding/normalizedSessionId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}if(data65.turnId !== undefined){let data71 = data65.turnId;if(typeof data71 === "string"){if(func1(data71) > 240){const err218 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}if(func1(data71) < 1){const err219 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}else {const err220 = {instancePath:instancePath+"/payload/binding/turnId",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}}if(data65.bindingGeneration !== undefined){let data72 = data65.bindingGeneration;if(!(((typeof data72 == "number") && (!(data72 % 1) && !isNaN(data72))) && (isFinite(data72)))){const err221 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/bindingGeneration/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if((typeof data72 == "number") && (isFinite(data72))){if(data72 < 1 || isNaN(data72)){const err222 = {instancePath:instancePath+"/payload/binding/bindingGeneration",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/bindingGeneration/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}}}if(data65.assignmentRevision !== undefined){let data73 = data65.assignmentRevision;if(!(((typeof data73 == "number") && (!(data73 % 1) && !isNaN(data73))) && (isFinite(data73)))){const err223 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/assignmentRevision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}if((typeof data73 == "number") && (isFinite(data73))){if(data73 < 1 || isNaN(data73)){const err224 = {instancePath:instancePath+"/payload/binding/assignmentRevision",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/properties/assignmentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}}}else {const err225 = {instancePath:instancePath+"/payload/binding",schemaPath:"#/allOf/3/then/properties/payload/properties/binding/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}if(data64.requestId !== undefined){let data74 = data64.requestId;if(typeof data74 === "string"){if(func1(data74) > 240){const err226 = {instancePath:instancePath+"/payload/requestId",schemaPath:"#/allOf/3/then/properties/payload/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(func1(data74) < 1){const err227 = {instancePath:instancePath+"/payload/requestId",schemaPath:"#/allOf/3/then/properties/payload/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}else {const err228 = {instancePath:instancePath+"/payload/requestId",schemaPath:"#/allOf/3/then/properties/payload/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}if(data64.outcome !== undefined){let data75 = data64.outcome;if(!(data75 && typeof data75 == "object" && !Array.isArray(data75))){const err229 = {instancePath:instancePath+"/payload/outcome",schemaPath:"#/allOf/3/then/properties/payload/properties/outcome/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}}else {const err230 = {instancePath:instancePath+"/payload",schemaPath:"#/allOf/3/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}}else {const err231 = {instancePath,schemaPath:"#/allOf/3/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}var _valid5 = _errs163 === errors;valid33 = _valid5;if(valid33){var props5 = {};props5.payload = true;props5.eventType = true;}}if(!valid33){const err232 = {instancePath,schemaPath:"#/allOf/3/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}if(props1 !== true && props5 !== undefined){if(props5 === true){props1 = true;}else {props1 = props1 || {};Object.assign(props1, props5);}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err233 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}if(data.sourceEventId === undefined){const err234 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceEventId"},message:"must have required property '"+"sourceEventId"+"'"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}if(data.sourceSeq === undefined){const err235 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceSeq"},message:"must have required property '"+"sourceSeq"+"'"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}if(data.sourceInstanceId === undefined){const err236 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceInstanceId"},message:"must have required property '"+"sourceInstanceId"+"'"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}if(data.sourceKind === undefined){const err237 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "sourceKind"},message:"must have required property '"+"sourceKind"+"'"};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}if(data.runId === undefined){const err238 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}if(data.eventType === undefined){const err239 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "eventType"},message:"must have required property '"+"eventType"+"'"};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}if(data.schemaVersion === undefined){const err240 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}if(data.priority === undefined){const err241 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "priority"},message:"must have required property '"+"priority"+"'"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}if(data.emittedAt === undefined){const err242 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "emittedAt"},message:"must have required property '"+"emittedAt"+"'"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}if(data.payload === undefined){const err243 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}if(data.schema !== undefined){if("paperclip.prp.event.v3" !== data.schema){const err244 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.event.v3"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err244];}else {vErrors.push(err244);}errors++;}}if(data.sourceEventId !== undefined){let data77 = data.sourceEventId;if(typeof data77 === "string"){if(func1(data77) > 160){const err245 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err245];}else {vErrors.push(err245);}errors++;}if(func1(data77) < 1){const err246 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err246];}else {vErrors.push(err246);}errors++;}}else {const err247 = {instancePath:instancePath+"/sourceEventId",schemaPath:"#/properties/sourceEventId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err247];}else {vErrors.push(err247);}errors++;}}if(data.sourceSeq !== undefined){let data78 = data.sourceSeq;if(!(((typeof data78 == "number") && (!(data78 % 1) && !isNaN(data78))) && (isFinite(data78)))){const err248 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err248];}else {vErrors.push(err248);}errors++;}if((typeof data78 == "number") && (isFinite(data78))){if(data78 > 9007199254740991 || isNaN(data78)){const err249 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/maximum",keyword:"maximum",params:{comparison: "<=", limit: 9007199254740991},message:"must be <= 9007199254740991"};if(vErrors === null){vErrors = [err249];}else {vErrors.push(err249);}errors++;}if(data78 < 1 || isNaN(data78)){const err250 = {instancePath:instancePath+"/sourceSeq",schemaPath:"#/properties/sourceSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err250];}else {vErrors.push(err250);}errors++;}}}if(data.sourceInstanceId !== undefined){let data79 = data.sourceInstanceId;if(typeof data79 === "string"){if(func1(data79) > 160){const err251 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err251];}else {vErrors.push(err251);}errors++;}if(func1(data79) < 1){const err252 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err252];}else {vErrors.push(err252);}errors++;}}else {const err253 = {instancePath:instancePath+"/sourceInstanceId",schemaPath:"#/properties/sourceInstanceId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err253];}else {vErrors.push(err253);}errors++;}}if(data.sourceKind !== undefined){let data80 = data.sourceKind;if(!((data80 === "runner") || (data80 === "control_plane"))){const err254 = {instancePath:instancePath+"/sourceKind",schemaPath:"#/properties/sourceKind/enum",keyword:"enum",params:{allowedValues: schema209.properties.sourceKind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err254];}else {vErrors.push(err254);}errors++;}}if(data.runId !== undefined){let data81 = data.runId;if(typeof data81 === "string"){if(func1(data81) > 160){const err255 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err255];}else {vErrors.push(err255);}errors++;}if(func1(data81) < 1){const err256 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err256];}else {vErrors.push(err256);}errors++;}}else {const err257 = {instancePath:instancePath+"/runId",schemaPath:"#/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err257];}else {vErrors.push(err257);}errors++;}}if(data.normalizedSessionId !== undefined){let data82 = data.normalizedSessionId;if(typeof data82 === "string"){if(func1(data82) > 160){const err258 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err258];}else {vErrors.push(err258);}errors++;}if(func1(data82) < 1){const err259 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err259];}else {vErrors.push(err259);}errors++;}}else {const err260 = {instancePath:instancePath+"/normalizedSessionId",schemaPath:"#/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err260];}else {vErrors.push(err260);}errors++;}}if(data.turnId !== undefined){let data83 = data.turnId;if(typeof data83 === "string"){if(func1(data83) > 160){const err261 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err261];}else {vErrors.push(err261);}errors++;}if(func1(data83) < 1){const err262 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err262];}else {vErrors.push(err262);}errors++;}}else {const err263 = {instancePath:instancePath+"/turnId",schemaPath:"#/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err263];}else {vErrors.push(err263);}errors++;}}if(data.itemId !== undefined){let data84 = data.itemId;if(typeof data84 === "string"){if(func1(data84) > 160){const err264 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err264];}else {vErrors.push(err264);}errors++;}if(func1(data84) < 1){const err265 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err265];}else {vErrors.push(err265);}errors++;}}else {const err266 = {instancePath:instancePath+"/itemId",schemaPath:"#/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err266];}else {vErrors.push(err266);}errors++;}}if(data.eventType !== undefined){let data85 = data.eventType;if(!(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((data85 === "runner.connected") || (data85 === "runner.reconnected")) || (data85 === "runner.reconciled")) || (data85 === "runner.disconnected")) || (data85 === "runner.draining")) || (data85 === "runner.suspending")) || (data85 === "runner.suspended")) || (data85 === "runner.stopped")) || (data85 === "runner.diagnostic")) || (data85 === "runtime.phase.changed")) || (data85 === "sandbox.metric")) || (data85 === "workspace.ready")) || (data85 === "workspace.change.updated")) || (data85 === "workspace.diff.recorded")) || (data85 === "workspace.file.referenced")) || (data85 === "harness.starting")) || (data85 === "harness.ready")) || (data85 === "harness.exited")) || (data85 === "harness.diagnostic")) || (data85 === "plan.updated")) || (data85 === "tool.execution.started")) || (data85 === "tool.execution.progressed")) || (data85 === "tool.execution.completed")) || (data85 === "research.started")) || (data85 === "research.progressed")) || (data85 === "research.completed")) || (data85 === "delegation.started")) || (data85 === "delegation.updated")) || (data85 === "delegation.completed")) || (data85 === "model.route.changed")) || (data85 === "model.verification.updated")) || (data85 === "context.compacted")) || (data85 === "artifact.viewed")) || (data85 === "artifact.generated")) || (data85 === "review.mode.changed")) || (data85 === "hook.started")) || (data85 === "hook.completed")) || (data85 === "memory.citation.referenced")) || (data85 === "safety.review.started")) || (data85 === "safety.review.completed")) || (data85 === "terminal.input.sent")) || (data85 === "wait.started")) || (data85 === "wait.completed")) || (data85 === "provider.notice.recorded")) || (data85 === "session.starting")) || (data85 === "session.started")) || (data85 === "session.resuming")) || (data85 === "session.resumed")) || (data85 === "session.reconciled")) || (data85 === "session.updated")) || (data85 === "session.closed")) || (data85 === "session.failed")) || (data85 === "session.capabilities.updated")) || (data85 === "session.goal.snapshot")) || (data85 === "session.goal.updated")) || (data85 === "session.goal.cleared")) || (data85 === "turn.submitted")) || (data85 === "turn.accepted")) || (data85 === "turn.started")) || (data85 === "turn.completed")) || (data85 === "turn.failed")) || (data85 === "turn.interrupted")) || (data85 === "turn.cancelled")) || (data85 === "item.started")) || (data85 === "item.delta")) || (data85 === "item.completed")) || (data85 === "item.failed")) || (data85 === "usage.reported")) || (data85 === "semantic_tool.input")) || (data85 === "semantic_tool.result")) || (data85 === "mcp_app.discovered")) || (data85 === "mcp_app.resource.resolved")) || (data85 === "mcp_app.initializing")) || (data85 === "mcp_app.ready")) || (data85 === "mcp_app.tool_input")) || (data85 === "mcp_app.tool_result")) || (data85 === "mcp_app.action.requested")) || (data85 === "mcp_app.action.resolved")) || (data85 === "mcp_app.host_context.changed")) || (data85 === "mcp_app.failed")) || (data85 === "mcp_app.teardown")) || (data85 === "runtime_request.created")) || (data85 === "runtime_request.resolved")) || (data85 === "runtime_request.expired")) || (data85 === "runtime_request.cancelled")) || (data85 === "interaction.request.proposed")) || (data85 === "interaction.request.materialized")) || (data85 === "interaction.request.rejected")) || (data85 === "interaction.response.progressed")) || (data85 === "interaction.response.resolved")) || (data85 === "interaction.response.delivered")) || (data85 === "run.attached")) || (data85 === "run.detached")) || (data85 === "run.result.proposed")) || (data85 === "run.result.accepted")) || (data85 === "run.result.rejected")) || (data85 === "attention.request.proposed")) || (data85 === "attention.request.routed")) || (data85 === "attention.request.resolved")) || (data85 === "attention.request.expired")) || (data85 === "attention.request.superseded")) || (data85 === "work.assessment.recorded")) || (data85 === "issue.status.decision.recorded")) || (data85 === "issue.status.decision.applied")) || (data85 === "issue.status.decision.rejected")) || (data85 === "issue.status.decision.superseded")) || (data85 === "run.terminal")) || (data85 === "external_provider.dispatch_requested")) || (data85 === "external_provider.operation_settled"))){const err267 = {instancePath:instancePath+"/eventType",schemaPath:"#/properties/eventType/enum",keyword:"enum",params:{allowedValues: schema209.properties.eventType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err267];}else {vErrors.push(err267);}errors++;}}if(data.schemaVersion !== undefined){if(3 !== data.schemaVersion){const err268 = {instancePath:instancePath+"/schemaVersion",schemaPath:"#/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 3},message:"must be equal to constant"};if(vErrors === null){vErrors = [err268];}else {vErrors.push(err268);}errors++;}}if(data.priority !== undefined){let data87 = data.priority;if(!(((data87 === 0) || (data87 === 1)) || (data87 === 2))){const err269 = {instancePath:instancePath+"/priority",schemaPath:"#/properties/priority/enum",keyword:"enum",params:{allowedValues: schema209.properties.priority.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err269];}else {vErrors.push(err269);}errors++;}}if(data.emittedAt !== undefined){let data88 = data.emittedAt;if(typeof data88 === "string"){if(!(formats0.test(data88))){const err270 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err270];}else {vErrors.push(err270);}errors++;}}else {const err271 = {instancePath:instancePath+"/emittedAt",schemaPath:"#/properties/emittedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err271];}else {vErrors.push(err271);}errors++;}}if(data.observedAt !== undefined){let data89 = data.observedAt;if(typeof data89 === "string"){if(!(formats0.test(data89))){const err272 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err272];}else {vErrors.push(err272);}errors++;}}else {const err273 = {instancePath:instancePath+"/observedAt",schemaPath:"#/properties/observedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err273];}else {vErrors.push(err273);}errors++;}}if(data.payload !== undefined){let data90 = data.payload;if(data90 && typeof data90 == "object" && !Array.isArray(data90)){}else {const err274 = {instancePath:instancePath+"/payload",schemaPath:"#/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err274];}else {vErrors.push(err274);}errors++;}}if(data.debug !== undefined){let data91 = data.debug;if(data91 && typeof data91 == "object" && !Array.isArray(data91)){}else {const err275 = {instancePath:instancePath+"/debug",schemaPath:"#/properties/debug/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err275];}else {vErrors.push(err275);}errors++;}}}else {const err276 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err276];}else {vErrors.push(err276);}errors++;}validate114.errors = vErrors;return errors === 0;}validate114.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};const schema213 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/request.schema.json","title":"PRP request","oneOf":[{"type":"object","required":["schema","requestKind","requestId","type","status","prompt","choices","origin","turnId"],"properties":{"schema":{"const":"paperclip.runtime_request.v2"},"requestKind":{"const":"permission_approval"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"const":"permission"},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"choices":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","required":["key","label"],"properties":{"key":{"enum":["accept","accept_for_session","decline","cancel"]},"label":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"allOf":[{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"accept"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"accept_for_session"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"decline"}}},"minContains":0,"maxContains":1},{"contains":{"type":"object","required":["key"],"properties":{"key":{"const":"cancel"}}},"minContains":0,"maxContains":1}]},"details":{"type":"object","additionalProperties":true},"origin":{"type":"object","required":["adapter"],"properties":{"adapter":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","minLength":1,"maxLength":160},"method":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":["string","null"],"minLength":1,"maxLength":240}},"additionalProperties":false},{"type":"object","required":["schema","requestKind","requestId","type","status","prompt","input"],"properties":{"schema":{"const":"paperclip.runtime_request.v2"},"requestKind":{"const":"runtime"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"const":"input"},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"input":{"$ref":"https://paperclip.dev/schemas/prp/v1/question-set.schema.json"},"origin":{"type":"object","required":["adapter"],"properties":{"adapter":{"type":"string","minLength":1,"maxLength":160},"provider":{"type":"string","minLength":1,"maxLength":160},"method":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"turnId":{"type":"string","minLength":1,"maxLength":240},"itemId":{"type":"string","minLength":1,"maxLength":240}},"additionalProperties":false},{"type":"object","required":["schema","requestKind","requestId","type","status","prompt"],"properties":{"schema":{"const":"paperclip.runtime_request.v1"},"requestKind":{"const":"runtime"},"requestId":{"type":"string","minLength":1,"maxLength":160},"type":{"enum":["permission","input"]},"status":{"enum":["pending","resolved","expired","cancelled"]},"prompt":{"type":"string","minLength":1,"maxLength":4000},"choices":{"type":"array","items":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1}},"additionalProperties":true}}},"additionalProperties":true},{"type":"object","required":["schema","requestKind","requestId","kind","blocking","payload"],"properties":{"schema":{"const":"paperclip.interaction_request.v1"},"requestKind":{"const":"issue_thread"},"requestId":{"type":"string","minLength":1,"maxLength":160},"kind":{"enum":["request_confirmation","request_checkbox_confirmation","request_item_verdicts","ask_user_questions","suggest_tasks"]},"blocking":{"type":"boolean"},"payload":{"type":"object","additionalProperties":true}},"additionalProperties":true}]};const schema214 = {"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://paperclip.dev/schemas/prp/v1/question-set.schema.json","title":"Paperclip question set","type":"object","required":["schema","questions"],"properties":{"schema":{"const":"paperclip.question_set.v1"},"title":{"type":"string","maxLength":1000},"description":{"type":"string","maxLength":100000},"submitLabel":{"type":"string","maxLength":200},"questions":{"type":"array","minItems":1,"maxItems":64,"items":{"$ref":"#/$defs/question"}}},"$defs":{"option":{"type":"object","required":["id","label"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","minLength":1,"maxLength":1000},"description":{"type":"string","maxLength":4000},"recommended":{"type":"boolean"}},"additionalProperties":false},"customAnswer":{"type":"object","required":["enabled"],"properties":{"enabled":{"const":true},"label":{"type":"string","maxLength":1000},"placeholder":{"type":"string","maxLength":1000}},"additionalProperties":false},"textValidation":{"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"maximum":100000},"maxLength":{"type":"integer","minimum":0,"maximum":100000},"pattern":{"type":"string","maxLength":1000},"inputType":{"enum":["text","number","integer"]},"minimum":{"type":"number"},"maximum":{"type":"number"}},"additionalProperties":false},"question":{"type":"object","required":["id","prompt","required","answerMode"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"header":{"type":"string","maxLength":1000},"prompt":{"type":"string","minLength":1,"maxLength":4000},"helpText":{"type":"string","maxLength":4000},"required":{"type":"boolean"},"answerMode":{"enum":["single_select","multi_select","text"]},"initialText":{"type":"string","maxLength":100000,"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds."},"options":{"type":"array","maxItems":128,"items":{"$ref":"#/$defs/option"}},"customAnswer":{"$ref":"#/$defs/customAnswer"},"textValidation":{"$ref":"#/$defs/textValidation"}},"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"properties":{"options":{"type":"array","maxItems":0}},"not":{"required":["customAnswer"]}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"required":["options"],"not":{"required":["initialText"]},"properties":{"options":{"type":"array","minItems":1}}}}],"additionalProperties":false}},"additionalProperties":false};const schema215 = {"type":"object","required":["id","prompt","required","answerMode"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"header":{"type":"string","maxLength":1000},"prompt":{"type":"string","minLength":1,"maxLength":4000},"helpText":{"type":"string","maxLength":4000},"required":{"type":"boolean"},"answerMode":{"enum":["single_select","multi_select","text"]},"initialText":{"type":"string","maxLength":100000,"description":"Editable draft of at most 100000 Unicode code points. Never an implicit answer; submitted text still uses the existing response bounds."},"options":{"type":"array","maxItems":128,"items":{"$ref":"#/$defs/option"}},"customAnswer":{"$ref":"#/$defs/customAnswer"},"textValidation":{"$ref":"#/$defs/textValidation"}},"allOf":[{"if":{"properties":{"answerMode":{"const":"text"}},"required":["answerMode"]},"then":{"properties":{"options":{"type":"array","maxItems":0}},"not":{"required":["customAnswer"]}}},{"if":{"properties":{"answerMode":{"enum":["single_select","multi_select"]}},"required":["answerMode"]},"then":{"required":["options"],"not":{"required":["initialText"]},"properties":{"options":{"type":"array","minItems":1}}}}],"additionalProperties":false};const schema216 = {"type":"object","required":["id","label"],"properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","minLength":1,"maxLength":1000},"description":{"type":"string","maxLength":4000},"recommended":{"type":"boolean"}},"additionalProperties":false};const schema217 = {"type":"object","required":["enabled"],"properties":{"enabled":{"const":true},"label":{"type":"string","maxLength":1000},"placeholder":{"type":"string","maxLength":1000}},"additionalProperties":false};const schema218 = {"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"maximum":100000},"maxLength":{"type":"integer","minimum":0,"maximum":100000},"pattern":{"type":"string","maxLength":1000},"inputType":{"enum":["text","number","integer"]},"minimum":{"type":"number"},"maximum":{"type":"number"}},"additionalProperties":false};function validate118(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate118.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}const _errs2 = errors;let valid1 = true;const _errs3 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.answerMode === undefined) && (missing0 = "answerMode")){const err0 = {};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {if(data.answerMode !== undefined){if("text" !== data.answerMode){const err1 = {};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}}}}var _valid0 = _errs3 === errors;errors = _errs2;if(vErrors !== null){if(_errs2){vErrors.length = _errs2;}else {vErrors = null;}}if(_valid0){const _errs5 = errors;const _errs6 = errors;const _errs7 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing1;if((data.customAnswer === undefined) && (missing1 = "customAnswer")){const err2 = {};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}var valid3 = _errs7 === errors;if(valid3){const err3 = {instancePath,schemaPath:"#/allOf/0/then/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}else {errors = _errs6;if(vErrors !== null){if(_errs6){vErrors.length = _errs6;}else {vErrors = null;}}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.options !== undefined){let data1 = data.options;if(Array.isArray(data1)){if(data1.length > 0){const err4 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/0/then/properties/options/maxItems",keyword:"maxItems",params:{limit: 0},message:"must NOT have more than 0 items"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}else {const err5 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/0/then/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}}var _valid0 = _errs5 === errors;valid1 = _valid0;if(valid1){var props0 = {};props0.options = true;props0.answerMode = true;}}if(!valid1){const err6 = {instancePath,schemaPath:"#/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}const _errs11 = errors;let valid5 = true;const _errs12 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing2;if((data.answerMode === undefined) && (missing2 = "answerMode")){const err7 = {};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}else {if(data.answerMode !== undefined){let data2 = data.answerMode;if(!((data2 === "single_select") || (data2 === "multi_select"))){const err8 = {};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}}}var _valid1 = _errs12 === errors;errors = _errs11;if(vErrors !== null){if(_errs11){vErrors.length = _errs11;}else {vErrors = null;}}if(_valid1){const _errs14 = errors;const _errs15 = errors;const _errs16 = errors;if(data && typeof data == "object" && !Array.isArray(data)){let missing3;if((data.initialText === undefined) && (missing3 = "initialText")){const err9 = {};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}var valid7 = _errs16 === errors;if(valid7){const err10 = {instancePath,schemaPath:"#/allOf/1/then/not",keyword:"not",params:{},message:"must NOT be valid"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}else {errors = _errs15;if(vErrors !== null){if(_errs15){vErrors.length = _errs15;}else {vErrors = null;}}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.options === undefined){const err11 = {instancePath,schemaPath:"#/allOf/1/then/required",keyword:"required",params:{missingProperty: "options"},message:"must have required property '"+"options"+"'"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}if(data.options !== undefined){let data3 = data.options;if(Array.isArray(data3)){if(data3.length < 1){const err12 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/1/then/properties/options/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}else {const err13 = {instancePath:instancePath+"/options",schemaPath:"#/allOf/1/then/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}}var _valid1 = _errs14 === errors;valid5 = _valid1;if(valid5){var props1 = {};props1.options = true;props1.answerMode = true;}}if(!valid5){const err14 = {instancePath,schemaPath:"#/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}if(props0 !== true && props1 !== undefined){if(props1 === true){props0 = true;}else {props0 = props0 || {};Object.assign(props0, props1);}}if(data && typeof data == "object" && !Array.isArray(data)){if(data.id === undefined){const err15 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "id"},message:"must have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data.prompt === undefined){const err16 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(data.required === undefined){const err17 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "required"},message:"must have required property '"+"required"+"'"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(data.answerMode === undefined){const err18 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "answerMode"},message:"must have required property '"+"answerMode"+"'"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}for(const key0 in data){if(!(func66.call(schema215.properties, key0))){const err19 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.id !== undefined){let data4 = data.id;if(typeof data4 === "string"){if(func1(data4) > 160){const err20 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(func1(data4) < 1){const err21 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}if(data.header !== undefined){let data5 = data.header;if(typeof data5 === "string"){if(func1(data5) > 1000){const err23 = {instancePath:instancePath+"/header",schemaPath:"#/properties/header/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/header",schemaPath:"#/properties/header/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}if(data.prompt !== undefined){let data6 = data.prompt;if(typeof data6 === "string"){if(func1(data6) > 4000){const err25 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(func1(data6) < 1){const err26 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}else {const err27 = {instancePath:instancePath+"/prompt",schemaPath:"#/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}if(data.helpText !== undefined){let data7 = data.helpText;if(typeof data7 === "string"){if(func1(data7) > 4000){const err28 = {instancePath:instancePath+"/helpText",schemaPath:"#/properties/helpText/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}else {const err29 = {instancePath:instancePath+"/helpText",schemaPath:"#/properties/helpText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data.required !== undefined){if(typeof data.required !== "boolean"){const err30 = {instancePath:instancePath+"/required",schemaPath:"#/properties/required/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}}if(data.answerMode !== undefined){let data9 = data.answerMode;if(!(((data9 === "single_select") || (data9 === "multi_select")) || (data9 === "text"))){const err31 = {instancePath:instancePath+"/answerMode",schemaPath:"#/properties/answerMode/enum",keyword:"enum",params:{allowedValues: schema215.properties.answerMode.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}if(data.initialText !== undefined){let data10 = data.initialText;if(typeof data10 === "string"){if(func1(data10) > 100000){const err32 = {instancePath:instancePath+"/initialText",schemaPath:"#/properties/initialText/maxLength",keyword:"maxLength",params:{limit: 100000},message:"must NOT have more than 100000 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}else {const err33 = {instancePath:instancePath+"/initialText",schemaPath:"#/properties/initialText/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}if(data.options !== undefined){let data11 = data.options;if(Array.isArray(data11)){if(data11.length > 128){const err34 = {instancePath:instancePath+"/options",schemaPath:"#/properties/options/maxItems",keyword:"maxItems",params:{limit: 128},message:"must NOT have more than 128 items"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}const len0 = data11.length;for(let i0=0; i0 160){const err38 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}if(func1(data13) < 1){const err39 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}else {const err40 = {instancePath:instancePath+"/options/" + i0+"/id",schemaPath:"#/$defs/option/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data12.label !== undefined){let data14 = data12.label;if(typeof data14 === "string"){if(func1(data14) > 1000){const err41 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}if(func1(data14) < 1){const err42 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}else {const err43 = {instancePath:instancePath+"/options/" + i0+"/label",schemaPath:"#/$defs/option/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data12.description !== undefined){let data15 = data12.description;if(typeof data15 === "string"){if(func1(data15) > 4000){const err44 = {instancePath:instancePath+"/options/" + i0+"/description",schemaPath:"#/$defs/option/properties/description/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}else {const err45 = {instancePath:instancePath+"/options/" + i0+"/description",schemaPath:"#/$defs/option/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}if(data12.recommended !== undefined){if(typeof data12.recommended !== "boolean"){const err46 = {instancePath:instancePath+"/options/" + i0+"/recommended",schemaPath:"#/$defs/option/properties/recommended/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}}else {const err47 = {instancePath:instancePath+"/options/" + i0,schemaPath:"#/$defs/option/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}}else {const err48 = {instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}}if(data.customAnswer !== undefined){let data17 = data.customAnswer;if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(data17.enabled === undefined){const err49 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/required",keyword:"required",params:{missingProperty: "enabled"},message:"must have required property '"+"enabled"+"'"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}for(const key2 in data17){if(!(((key2 === "enabled") || (key2 === "label")) || (key2 === "placeholder"))){const err50 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}}if(data17.enabled !== undefined){if(true !== data17.enabled){const err51 = {instancePath:instancePath+"/customAnswer/enabled",schemaPath:"#/$defs/customAnswer/properties/enabled/const",keyword:"const",params:{allowedValue: true},message:"must be equal to constant"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data17.label !== undefined){let data19 = data17.label;if(typeof data19 === "string"){if(func1(data19) > 1000){const err52 = {instancePath:instancePath+"/customAnswer/label",schemaPath:"#/$defs/customAnswer/properties/label/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}else {const err53 = {instancePath:instancePath+"/customAnswer/label",schemaPath:"#/$defs/customAnswer/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data17.placeholder !== undefined){let data20 = data17.placeholder;if(typeof data20 === "string"){if(func1(data20) > 1000){const err54 = {instancePath:instancePath+"/customAnswer/placeholder",schemaPath:"#/$defs/customAnswer/properties/placeholder/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}else {const err55 = {instancePath:instancePath+"/customAnswer/placeholder",schemaPath:"#/$defs/customAnswer/properties/placeholder/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}}else {const err56 = {instancePath:instancePath+"/customAnswer",schemaPath:"#/$defs/customAnswer/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data.textValidation !== undefined){let data21 = data.textValidation;if(data21 && typeof data21 == "object" && !Array.isArray(data21)){for(const key3 in data21){if(!((((((key3 === "minLength") || (key3 === "maxLength")) || (key3 === "pattern")) || (key3 === "inputType")) || (key3 === "minimum")) || (key3 === "maximum"))){const err57 = {instancePath:instancePath+"/textValidation",schemaPath:"#/$defs/textValidation/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}if(data21.minLength !== undefined){let data22 = data21.minLength;if(!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))){const err58 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}if((typeof data22 == "number") && (isFinite(data22))){if(data22 > 100000 || isNaN(data22)){const err59 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000},message:"must be <= 100000"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}if(data22 < 0 || isNaN(data22)){const err60 = {instancePath:instancePath+"/textValidation/minLength",schemaPath:"#/$defs/textValidation/properties/minLength/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}}}if(data21.maxLength !== undefined){let data23 = data21.maxLength;if(!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))){const err61 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if((typeof data23 == "number") && (isFinite(data23))){if(data23 > 100000 || isNaN(data23)){const err62 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/maximum",keyword:"maximum",params:{comparison: "<=", limit: 100000},message:"must be <= 100000"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(data23 < 0 || isNaN(data23)){const err63 = {instancePath:instancePath+"/textValidation/maxLength",schemaPath:"#/$defs/textValidation/properties/maxLength/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}}if(data21.pattern !== undefined){let data24 = data21.pattern;if(typeof data24 === "string"){if(func1(data24) > 1000){const err64 = {instancePath:instancePath+"/textValidation/pattern",schemaPath:"#/$defs/textValidation/properties/pattern/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}else {const err65 = {instancePath:instancePath+"/textValidation/pattern",schemaPath:"#/$defs/textValidation/properties/pattern/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data21.inputType !== undefined){let data25 = data21.inputType;if(!(((data25 === "text") || (data25 === "number")) || (data25 === "integer"))){const err66 = {instancePath:instancePath+"/textValidation/inputType",schemaPath:"#/$defs/textValidation/properties/inputType/enum",keyword:"enum",params:{allowedValues: schema218.properties.inputType.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}if(data21.minimum !== undefined){let data26 = data21.minimum;if(!((typeof data26 == "number") && (isFinite(data26)))){const err67 = {instancePath:instancePath+"/textValidation/minimum",schemaPath:"#/$defs/textValidation/properties/minimum/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data21.maximum !== undefined){let data27 = data21.maximum;if(!((typeof data27 == "number") && (isFinite(data27)))){const err68 = {instancePath:instancePath+"/textValidation/maximum",schemaPath:"#/$defs/textValidation/properties/maximum/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}}else {const err69 = {instancePath:instancePath+"/textValidation",schemaPath:"#/$defs/textValidation/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}}else {const err70 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}validate118.errors = vErrors;return errors === 0;}validate118.evaluated = {"props":true,"dynamicProps":false,"dynamicItems":false};function validate117(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/question-set.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate117.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.questions === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "questions"},message:"must have required property '"+"questions"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}for(const key0 in data){if(!(((((key0 === "schema") || (key0 === "title")) || (key0 === "description")) || (key0 === "submitLabel")) || (key0 === "questions"))){const err2 = {instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}}if(data.schema !== undefined){if("paperclip.question_set.v1" !== data.schema){const err3 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.question_set.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}}if(data.title !== undefined){let data1 = data.title;if(typeof data1 === "string"){if(func1(data1) > 1000){const err4 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}else {const err5 = {instancePath:instancePath+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.description !== undefined){let data2 = data.description;if(typeof data2 === "string"){if(func1(data2) > 100000){const err6 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/maxLength",keyword:"maxLength",params:{limit: 100000},message:"must NOT have more than 100000 characters"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}else {const err7 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.submitLabel !== undefined){let data3 = data.submitLabel;if(typeof data3 === "string"){if(func1(data3) > 200){const err8 = {instancePath:instancePath+"/submitLabel",schemaPath:"#/properties/submitLabel/maxLength",keyword:"maxLength",params:{limit: 200},message:"must NOT have more than 200 characters"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}else {const err9 = {instancePath:instancePath+"/submitLabel",schemaPath:"#/properties/submitLabel/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}}if(data.questions !== undefined){let data4 = data.questions;if(Array.isArray(data4)){if(data4.length > 64){const err10 = {instancePath:instancePath+"/questions",schemaPath:"#/properties/questions/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}if(data4.length < 1){const err11 = {instancePath:instancePath+"/questions",schemaPath:"#/properties/questions/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}const len0 = data4.length;for(let i0=0; i0 160){const err12 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}if(func1(data2) < 1){const err13 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}}else {const err14 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/0/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.type !== undefined){if("permission" !== data.type){const err15 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue: "permission"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.status !== undefined){let data4 = data.status;if(!((((data4 === "pending") || (data4 === "resolved")) || (data4 === "expired")) || (data4 === "cancelled"))){const err16 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/0/properties/status/enum",keyword:"enum",params:{allowedValues: schema213.oneOf[0].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}if(data.prompt !== undefined){let data5 = data.prompt;if(typeof data5 === "string"){if(func1(data5) > 4000){const err17 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(func1(data5) < 1){const err18 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}else {const err19 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/0/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}if(data.choices !== undefined){let data6 = data.choices;if(Array.isArray(data6)){const _errs15 = errors;const len0 = data6.length;let valid3 = true;if(data6.length > 0){let count0 = 0;for(let i0=0; i0 1){valid3 = false;break;}if(count0 >= 0){valid3 = true;}}}}if(!valid3){const err23 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/0/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}else {errors = _errs15;if(vErrors !== null){if(_errs15){vErrors.length = _errs15;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs20 = errors;const len1 = data6.length;let valid5 = true;if(data6.length > 0){let count1 = 0;for(let i1=0; i1 1){valid5 = false;break;}if(count1 >= 0){valid5 = true;}}}}if(!valid5){const err27 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/1/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}else {errors = _errs20;if(vErrors !== null){if(_errs20){vErrors.length = _errs20;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs25 = errors;const len2 = data6.length;let valid7 = true;if(data6.length > 0){let count2 = 0;for(let i2=0; i2 1){valid7 = false;break;}if(count2 >= 0){valid7 = true;}}}}if(!valid7){const err31 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/2/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}else {errors = _errs25;if(vErrors !== null){if(_errs25){vErrors.length = _errs25;}else {vErrors = null;}}}}if(Array.isArray(data6)){const _errs30 = errors;const len3 = data6.length;let valid9 = true;if(data6.length > 0){let count3 = 0;for(let i3=0; i3 1){valid9 = false;break;}if(count3 >= 0){valid9 = true;}}}}if(!valid9){const err35 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/allOf/3/contains",keyword:"contains",params:{minContains: 0, maxContains: 1},message:"must contain at least 0 and no more than 1 valid item(s)"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}else {errors = _errs30;if(vErrors !== null){if(_errs30){vErrors.length = _errs30;}else {vErrors = null;}}}}if(Array.isArray(data6)){if(data6.length > 4){const err36 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/maxItems",keyword:"maxItems",params:{limit: 4},message:"must NOT have more than 4 items"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}if(data6.length < 1){const err37 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}const len4 = data6.length;for(let i4=0; i4 500){const err42 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}if(func1(data17) < 1){const err43 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}else {const err44 = {instancePath:instancePath+"/choices/" + i4+"/label",schemaPath:"#/oneOf/0/properties/choices/items/properties/label/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}}else {const err45 = {instancePath:instancePath+"/choices/" + i4,schemaPath:"#/oneOf/0/properties/choices/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}}}else {const err46 = {instancePath:instancePath+"/choices",schemaPath:"#/oneOf/0/properties/choices/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}}if(data.details !== undefined){let data18 = data.details;if(data18 && typeof data18 == "object" && !Array.isArray(data18)){}else {const err47 = {instancePath:instancePath+"/details",schemaPath:"#/oneOf/0/properties/details/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;}}if(data.origin !== undefined){let data19 = data.origin;if(data19 && typeof data19 == "object" && !Array.isArray(data19)){if(data19.adapter === undefined){const err48 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/required",keyword:"required",params:{missingProperty: "adapter"},message:"must have required property '"+"adapter"+"'"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}for(const key2 in data19){if(!(((key2 === "adapter") || (key2 === "provider")) || (key2 === "method"))){const err49 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}}if(data19.adapter !== undefined){let data20 = data19.adapter;if(typeof data20 === "string"){if(func1(data20) > 160){const err50 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(func1(data20) < 1){const err51 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}else {const err52 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/0/properties/origin/properties/adapter/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data19.provider !== undefined){let data21 = data19.provider;if(typeof data21 === "string"){if(func1(data21) > 160){const err53 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}if(func1(data21) < 1){const err54 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}else {const err55 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/0/properties/origin/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data19.method !== undefined){let data22 = data19.method;if(typeof data22 === "string"){if(func1(data22) > 500){const err56 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}if(func1(data22) < 1){const err57 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}else {const err58 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/0/properties/origin/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}else {const err59 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/0/properties/origin/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data.turnId !== undefined){let data23 = data.turnId;if(typeof data23 === "string"){if(func1(data23) > 240){const err60 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if(func1(data23) < 1){const err61 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}}else {const err62 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/0/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}}if(data.itemId !== undefined){let data24 = data.itemId;if((typeof data24 !== "string") && (data24 !== null)){const err63 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/type",keyword:"type",params:{type: schema213.oneOf[0].properties.itemId.type},message:"must be string,null"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}if(typeof data24 === "string"){if(func1(data24) > 240){const err64 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}if(func1(data24) < 1){const err65 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/0/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}}}else {const err66 = {instancePath,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}var _valid0 = _errs1 === errors;if(_valid0){valid0 = true;passing0 = 0;var props0 = true;}const _errs56 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err67 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}if(data.requestKind === undefined){const err68 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "requestKind"},message:"must have required property '"+"requestKind"+"'"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}if(data.requestId === undefined){const err69 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(data.type === undefined){const err70 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(data.status === undefined){const err71 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}if(data.prompt === undefined){const err72 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}if(data.input === undefined){const err73 = {instancePath,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty: "input"},message:"must have required property '"+"input"+"'"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}for(const key3 in data){if(!(func66.call(schema213.oneOf[1].properties, key3))){const err74 = {instancePath,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data.schema !== undefined){if("paperclip.runtime_request.v2" !== data.schema){const err75 = {instancePath:instancePath+"/schema",schemaPath:"#/oneOf/1/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.runtime_request.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data.requestKind !== undefined){if("runtime" !== data.requestKind){const err76 = {instancePath:instancePath+"/requestKind",schemaPath:"#/oneOf/1/properties/requestKind/const",keyword:"const",params:{allowedValue: "runtime"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}}if(data.requestId !== undefined){let data27 = data.requestId;if(typeof data27 === "string"){if(func1(data27) > 160){const err77 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}if(func1(data27) < 1){const err78 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}else {const err79 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/1/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;}}if(data.type !== undefined){if("input" !== data.type){const err80 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue: "input"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data.status !== undefined){let data29 = data.status;if(!((((data29 === "pending") || (data29 === "resolved")) || (data29 === "expired")) || (data29 === "cancelled"))){const err81 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/1/properties/status/enum",keyword:"enum",params:{allowedValues: schema213.oneOf[1].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}}if(data.prompt !== undefined){let data30 = data.prompt;if(typeof data30 === "string"){if(func1(data30) > 4000){const err82 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(func1(data30) < 1){const err83 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/1/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}if(data.input !== undefined){if(!(validate117(data.input, {instancePath:instancePath+"/input",parentData:data,parentDataProperty:"input",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate117.errors : vErrors.concat(validate117.errors);errors = vErrors.length;}}if(data.origin !== undefined){let data32 = data.origin;if(data32 && typeof data32 == "object" && !Array.isArray(data32)){if(data32.adapter === undefined){const err85 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/required",keyword:"required",params:{missingProperty: "adapter"},message:"must have required property '"+"adapter"+"'"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}for(const key4 in data32){if(!(((key4 === "adapter") || (key4 === "provider")) || (key4 === "method"))){const err86 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}if(data32.adapter !== undefined){let data33 = data32.adapter;if(typeof data33 === "string"){if(func1(data33) > 160){const err87 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}if(func1(data33) < 1){const err88 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err88];}else {vErrors.push(err88);}errors++;}}else {const err89 = {instancePath:instancePath+"/origin/adapter",schemaPath:"#/oneOf/1/properties/origin/properties/adapter/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}if(data32.provider !== undefined){let data34 = data32.provider;if(typeof data34 === "string"){if(func1(data34) > 160){const err90 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(func1(data34) < 1){const err91 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}else {const err92 = {instancePath:instancePath+"/origin/provider",schemaPath:"#/oneOf/1/properties/origin/properties/provider/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}}if(data32.method !== undefined){let data35 = data32.method;if(typeof data35 === "string"){if(func1(data35) > 500){const err93 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/maxLength",keyword:"maxLength",params:{limit: 500},message:"must NOT have more than 500 characters"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}if(func1(data35) < 1){const err94 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err94];}else {vErrors.push(err94);}errors++;}}else {const err95 = {instancePath:instancePath+"/origin/method",schemaPath:"#/oneOf/1/properties/origin/properties/method/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err95];}else {vErrors.push(err95);}errors++;}}}else {const err96 = {instancePath:instancePath+"/origin",schemaPath:"#/oneOf/1/properties/origin/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}}if(data.turnId !== undefined){let data36 = data.turnId;if(typeof data36 === "string"){if(func1(data36) > 240){const err97 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err97];}else {vErrors.push(err97);}errors++;}if(func1(data36) < 1){const err98 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}}else {const err99 = {instancePath:instancePath+"/turnId",schemaPath:"#/oneOf/1/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}}if(data.itemId !== undefined){let data37 = data.itemId;if(typeof data37 === "string"){if(func1(data37) > 240){const err100 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}if(func1(data37) < 1){const err101 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}else {const err102 = {instancePath:instancePath+"/itemId",schemaPath:"#/oneOf/1/properties/itemId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}}else {const err103 = {instancePath,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}var _valid0 = _errs56 === errors;if(_valid0 && valid0){valid0 = false;passing0 = [passing0, 1];}else {if(_valid0){valid0 = true;passing0 = 1;if(props0 !== true){props0 = true;}}const _errs81 = errors;if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err104 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if(data.requestKind === undefined){const err105 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "requestKind"},message:"must have required property '"+"requestKind"+"'"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}if(data.requestId === undefined){const err106 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}if(data.type === undefined){const err107 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}if(data.status === undefined){const err108 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "status"},message:"must have required property '"+"status"+"'"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}if(data.prompt === undefined){const err109 = {instancePath,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty: "prompt"},message:"must have required property '"+"prompt"+"'"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if(data.schema !== undefined){if("paperclip.runtime_request.v1" !== data.schema){const err110 = {instancePath:instancePath+"/schema",schemaPath:"#/oneOf/2/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.runtime_request.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data.requestKind !== undefined){if("runtime" !== data.requestKind){const err111 = {instancePath:instancePath+"/requestKind",schemaPath:"#/oneOf/2/properties/requestKind/const",keyword:"const",params:{allowedValue: "runtime"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err111];}else {vErrors.push(err111);}errors++;}}if(data.requestId !== undefined){let data40 = data.requestId;if(typeof data40 === "string"){if(func1(data40) > 160){const err112 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}if(func1(data40) < 1){const err113 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err113];}else {vErrors.push(err113);}errors++;}}else {const err114 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/2/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}}if(data.type !== undefined){let data41 = data.type;if(!((data41 === "permission") || (data41 === "input"))){const err115 = {instancePath:instancePath+"/type",schemaPath:"#/oneOf/2/properties/type/enum",keyword:"enum",params:{allowedValues: schema213.oneOf[2].properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}}if(data.status !== undefined){let data42 = data.status;if(!((((data42 === "pending") || (data42 === "resolved")) || (data42 === "expired")) || (data42 === "cancelled"))){const err116 = {instancePath:instancePath+"/status",schemaPath:"#/oneOf/2/properties/status/enum",keyword:"enum",params:{allowedValues: schema213.oneOf[2].properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}if(data.prompt !== undefined){let data43 = data.prompt;if(typeof data43 === "string"){if(func1(data43) > 4000){const err117 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if(func1(data43) < 1){const err118 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}}else {const err119 = {instancePath:instancePath+"/prompt",schemaPath:"#/oneOf/2/properties/prompt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err119];}else {vErrors.push(err119);}errors++;}}if(data.choices !== undefined){let data44 = data.choices;if(Array.isArray(data44)){const len5 = data44.length;for(let i5=0; i5 160){const err137 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(func1(data50) < 1){const err138 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}}else {const err139 = {instancePath:instancePath+"/requestId",schemaPath:"#/oneOf/3/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data.kind !== undefined){let data51 = data.kind;if(!(((((data51 === "request_confirmation") || (data51 === "request_checkbox_confirmation")) || (data51 === "request_item_verdicts")) || (data51 === "ask_user_questions")) || (data51 === "suggest_tasks"))){const err140 = {instancePath:instancePath+"/kind",schemaPath:"#/oneOf/3/properties/kind/enum",keyword:"enum",params:{allowedValues: schema213.oneOf[3].properties.kind.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}if(data.blocking !== undefined){if(typeof data.blocking !== "boolean"){const err141 = {instancePath:instancePath+"/blocking",schemaPath:"#/oneOf/3/properties/blocking/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}if(data.payload !== undefined){let data53 = data.payload;if(data53 && typeof data53 == "object" && !Array.isArray(data53)){}else {const err142 = {instancePath:instancePath+"/payload",schemaPath:"#/oneOf/3/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}}else {const err143 = {instancePath,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}var _valid0 = _errs101 === errors;if(_valid0 && valid0){valid0 = false;passing0 = [passing0, 3];}else {if(_valid0){valid0 = true;passing0 = 3;if(props0 !== true){props0 = true;}}}}}if(!valid0){const err144 = {instancePath,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}else {errors = _errs0;if(vErrors !== null){if(_errs0){vErrors.length = _errs0;}else {vErrors = null;}}}validate116.errors = vErrors;evaluated0.props = props0;return errors === 0;}validate116.evaluated = {"dynamicProps":true,"dynamicItems":false};const pattern12 = new RegExp("^[a-z][a-z0-9_.-]*$", "u");const pattern15 = new RegExp("^sha256:[0-9a-f]{64}$", "u");function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){/*# sourceURL="https://paperclip.dev/schemas/prp/v1/fixture.schema.json" */;let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.schema === undefined){const err0 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.fixtureVersion === undefined){const err1 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "fixtureVersion"},message:"must have required property '"+"fixtureVersion"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.protocolVersion === undefined){const err2 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "protocolVersion"},message:"must have required property '"+"protocolVersion"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.name === undefined){const err3 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.description === undefined){const err4 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "description"},message:"must have required property '"+"description"+"'"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}if(data.identity === undefined){const err5 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "identity"},message:"must have required property '"+"identity"+"'"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}if(data.capabilities === undefined){const err6 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "capabilities"},message:"must have required property '"+"capabilities"+"'"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}if(data.commands === undefined){const err7 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "commands"},message:"must have required property '"+"commands"+"'"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}if(data.events === undefined){const err8 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "events"},message:"must have required property '"+"events"+"'"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}if(data.result === undefined){const err9 = {instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: "result"},message:"must have required property '"+"result"+"'"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}if(data.schema !== undefined){if("paperclip.prp.fixture.v1" !== data.schema){const err10 = {instancePath:instancePath+"/schema",schemaPath:"#/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.fixture.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}}if(data.fixtureVersion !== undefined){if(1 !== data.fixtureVersion){const err11 = {instancePath:instancePath+"/fixtureVersion",schemaPath:"#/properties/fixtureVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;}}if(data.protocolVersion !== undefined){let data2 = data.protocolVersion;if(!(((data2 === 1) || (data2 === 2)) || (data2 === 3))){const err12 = {instancePath:instancePath+"/protocolVersion",schemaPath:"#/properties/protocolVersion/enum",keyword:"enum",params:{allowedValues: schema31.properties.protocolVersion.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}if(data.name !== undefined){let data3 = data.name;if(typeof data3 === "string"){if(func1(data3) > 120){const err13 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/maxLength",keyword:"maxLength",params:{limit: 120},message:"must NOT have more than 120 characters"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}if(func1(data3) < 1){const err14 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}else {const err15 = {instancePath:instancePath+"/name",schemaPath:"#/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}}if(data.description !== undefined){let data4 = data.description;if(typeof data4 === "string"){if(func1(data4) > 1000){const err16 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/maxLength",keyword:"maxLength",params:{limit: 1000},message:"must NOT have more than 1000 characters"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}if(func1(data4) < 1){const err17 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}}else {const err18 = {instancePath:instancePath+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}}if(data.identity !== undefined){if(!(validate21(data.identity, {instancePath:instancePath+"/identity",parentData:data,parentDataProperty:"identity",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate21.errors : vErrors.concat(validate21.errors);errors = vErrors.length;}}if(data.capabilities !== undefined){let data6 = data.capabilities;const _errs11 = errors;let valid1 = false;let passing0 = null;const _errs12 = errors;if(data6 && typeof data6 == "object" && !Array.isArray(data6)){if(data6.schema === undefined){const err19 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}if(data6.sessionReusePolicy === undefined){const err20 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "sessionReusePolicy"},message:"must have required property '"+"sessionReusePolicy"+"'"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}if(data6.driver === undefined){const err21 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "driver"},message:"must have required property '"+"driver"+"'"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(data6.steer === undefined){const err22 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "steer"},message:"must have required property '"+"steer"+"'"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}if(data6.interrupt === undefined){const err23 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "interrupt"},message:"must have required property '"+"interrupt"+"'"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}if(data6.resume === undefined){const err24 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "resume"},message:"must have required property '"+"resume"+"'"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}if(data6.runtimeRequests === undefined){const err25 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "runtimeRequests"},message:"must have required property '"+"runtimeRequests"+"'"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}if(data6.structuredResult === undefined){const err26 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "structuredResult"},message:"must have required property '"+"structuredResult"+"'"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}if(data6.typedEvents === undefined){const err27 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/required",keyword:"required",params:{missingProperty: "typedEvents"},message:"must have required property '"+"typedEvents"+"'"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}if(data6.schema !== undefined){if("paperclip.prp.capabilities.v1" !== data6.schema){const err28 = {instancePath:instancePath+"/capabilities/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.capabilities.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}}if(data6.sessionReusePolicy !== undefined){let data8 = data6.sessionReusePolicy;if(!(((data8 === "new_per_run") || (data8 === "reuse_per_issue")) || (data8 === "reuse_per_workspace"))){const err29 = {instancePath:instancePath+"/capabilities/sessionReusePolicy",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/sessionReusePolicy/enum",keyword:"enum",params:{allowedValues: schema41.properties.sessionReusePolicy.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}}if(data6.driver !== undefined){let data9 = data6.driver;if(data9 && typeof data9 == "object" && !Array.isArray(data9)){if(data9.kind === undefined){const err30 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/required",keyword:"required",params:{missingProperty: "kind"},message:"must have required property '"+"kind"+"'"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}if(data9.version === undefined){const err31 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/required",keyword:"required",params:{missingProperty: "version"},message:"must have required property '"+"version"+"'"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}if(data9.kind !== undefined){let data10 = data9.kind;if(typeof data10 === "string"){if(func1(data10) > 80){const err32 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}if(func1(data10) < 1){const err33 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}else {const err34 = {instancePath:instancePath+"/capabilities/driver/kind",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/kind/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}}if(data9.version !== undefined){let data11 = data9.version;if(typeof data11 === "string"){if(func1(data11) > 80){const err35 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/maxLength",keyword:"maxLength",params:{limit: 80},message:"must NOT have more than 80 characters"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}if(func1(data11) < 1){const err36 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {instancePath:instancePath+"/capabilities/driver/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/properties/version/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}}}else {const err38 = {instancePath:instancePath+"/capabilities/driver",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/driver/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}}if(data6.steer !== undefined){if(typeof data6.steer !== "boolean"){const err39 = {instancePath:instancePath+"/capabilities/steer",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/steer/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}if(data6.interrupt !== undefined){if(typeof data6.interrupt !== "boolean"){const err40 = {instancePath:instancePath+"/capabilities/interrupt",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/interrupt/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}}if(data6.resume !== undefined){if(typeof data6.resume !== "boolean"){const err41 = {instancePath:instancePath+"/capabilities/resume",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/resume/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}if(data6.runtimeRequests !== undefined){if(typeof data6.runtimeRequests !== "boolean"){const err42 = {instancePath:instancePath+"/capabilities/runtimeRequests",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/runtimeRequests/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}if(data6.structuredResult !== undefined){if(typeof data6.structuredResult !== "boolean"){const err43 = {instancePath:instancePath+"/capabilities/structuredResult",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/structuredResult/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}}if(data6.typedEvents !== undefined){if(typeof data6.typedEvents !== "boolean"){const err44 = {instancePath:instancePath+"/capabilities/typedEvents",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEvents/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;}}if(data6.typedEventFamilies !== undefined){let data18 = data6.typedEventFamilies;if(Array.isArray(data18)){if(data18.length > 64){const err45 = {instancePath:instancePath+"/capabilities/typedEventFamilies",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/maxItems",keyword:"maxItems",params:{limit: 64},message:"must NOT have more than 64 items"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}const len0 = data18.length;for(let i0=0; i0 160){const err51 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}if(func1(data20) < 1){const err52 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}if(!pattern12.test(data20)){const err53 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.-]*$"+"\""};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}else {const err54 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/family",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/family/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data19.version !== undefined){if(1 !== data19.version){const err55 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data19.availability !== undefined){let data22 = data19.availability;if(!(((data22 === "available") || (data22 === "unsupported")) || (data22 === "policy_disabled"))){const err56 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/availability",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/availability/enum",keyword:"enum",params:{allowedValues: schema41.properties.typedEventFamilies.items.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data19.detailLevel !== undefined){let data23 = data19.detailLevel;if(!((data23 === "summary") || (data23 === "structured"))){const err57 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0+"/detailLevel",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/properties/detailLevel/enum",keyword:"enum",params:{allowedValues: schema41.properties.typedEventFamilies.items.properties.detailLevel.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err57];}else {vErrors.push(err57);}errors++;}}}else {const err58 = {instancePath:instancePath+"/capabilities/typedEventFamilies/" + i0,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err58];}else {vErrors.push(err58);}errors++;}}}else {const err59 = {instancePath:instancePath+"/capabilities/typedEventFamilies",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/typedEventFamilies/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err59];}else {vErrors.push(err59);}errors++;}}if(data6.semanticTools !== undefined){let data24 = data6.semanticTools;if(data24 && typeof data24 == "object" && !Array.isArray(data24)){if(data24.schema === undefined){const err60 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err60];}else {vErrors.push(err60);}errors++;}if(data24.schemaVersion === undefined){const err61 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "schemaVersion"},message:"must have required property '"+"schemaVersion"+"'"};if(vErrors === null){vErrors = [err61];}else {vErrors.push(err61);}errors++;}if(data24.operations === undefined){const err62 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/required",keyword:"required",params:{missingProperty: "operations"},message:"must have required property '"+"operations"+"'"};if(vErrors === null){vErrors = [err62];}else {vErrors.push(err62);}errors++;}if(data24.schema !== undefined){if("paperclip.prp.semantic_tools.v1" !== data24.schema){const err63 = {instancePath:instancePath+"/capabilities/semanticTools/schema",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.semantic_tools.v1"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}if(data24.schemaVersion !== undefined){if(1 !== data24.schemaVersion){const err64 = {instancePath:instancePath+"/capabilities/semanticTools/schemaVersion",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/schemaVersion/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err64];}else {vErrors.push(err64);}errors++;}}if(data24.operations !== undefined){let data27 = data24.operations;if(Array.isArray(data27)){const len1 = data27.length;for(let i1=0; i1 160){const err69 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}if(func1(data29) < 1){const err70 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}if(!pattern4.test(data29)){const err71 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/pattern",keyword:"pattern",params:{pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]*$"},message:"must match pattern \""+"^[A-Za-z0-9][A-Za-z0-9._:-]*$"+"\""};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}}else {const err72 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/operationId",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/operationId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}}if(data28.version !== undefined){if(1 !== data28.version){const err73 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/version",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/version/const",keyword:"const",params:{allowedValue: 1},message:"must be equal to constant"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}}if(data28.availability !== undefined){let data31 = data28.availability;if(!(((data31 === "available") || (data31 === "denied")) || (data31 === "unsupported"))){const err74 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/availability",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/availability/enum",keyword:"enum",params:{allowedValues: schema41.properties.semanticTools.properties.operations.items.properties.availability.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data28.redactionDisposition !== undefined){if("digest_only" !== data28.redactionDisposition){const err75 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/redactionDisposition",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/redactionDisposition/const",keyword:"const",params:{allowedValue: "digest_only"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data28.requiredClaims !== undefined){let data33 = data28.requiredClaims;if(Array.isArray(data33)){const len2 = data33.length;for(let i2=0; i2 160){const err76 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(func1(data34) < 1){const err77 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}else {const err78 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims/" + i2,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/items/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}}let i3 = data33.length;let j0;if(i3 > 1){const indices0 = {};for(;i3--;){let item0 = data33[i3];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];const err79 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/uniqueItems",keyword:"uniqueItems",params:{i: i3, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i3+" are identical)"};if(vErrors === null){vErrors = [err79];}else {vErrors.push(err79);}errors++;break;}indices0[item0] = i3;}}}else {const err80 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/requiredClaims",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/requiredClaims/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err80];}else {vErrors.push(err80);}errors++;}}if(data28.reasonCode !== undefined){let data35 = data28.reasonCode;if(typeof data35 === "string"){if(func1(data35) > 160){const err81 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err81];}else {vErrors.push(err81);}errors++;}if(func1(data35) < 1){const err82 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err82];}else {vErrors.push(err82);}errors++;}if(!pattern14.test(data35)){const err83 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/pattern",keyword:"pattern",params:{pattern: "^[a-z][a-z0-9_.:-]*$"},message:"must match pattern \""+"^[a-z][a-z0-9_.:-]*$"+"\""};if(vErrors === null){vErrors = [err83];}else {vErrors.push(err83);}errors++;}}else {const err84 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1+"/reasonCode",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/properties/reasonCode/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err84];}else {vErrors.push(err84);}errors++;}}}else {const err85 = {instancePath:instancePath+"/capabilities/semanticTools/operations/" + i1,schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/items/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err85];}else {vErrors.push(err85);}errors++;}}}else {const err86 = {instancePath:instancePath+"/capabilities/semanticTools/operations",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/properties/operations/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err86];}else {vErrors.push(err86);}errors++;}}}else {const err87 = {instancePath:instancePath+"/capabilities/semanticTools",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/semanticTools/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}if(data6.unsupported !== undefined){let data36 = data6.unsupported;if(Array.isArray(data36)){const len3 = data36.length;for(let i4=0; i4 1){const indices1 = {};for(;i5--;){let item1 = data36[i5];if(typeof item1 !== "string"){continue;}if(typeof indices1[item1] == "number"){j1 = indices1[item1];const err90 = {instancePath:instancePath+"/capabilities/unsupported",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/unsupported/uniqueItems",keyword:"uniqueItems",params:{i: i5, j: j1},message:"must NOT have duplicate items (items ## "+j1+" and "+i5+" are identical)"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;break;}indices1[item1] = i5;}}}else {const err91 = {instancePath:instancePath+"/capabilities/unsupported",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/properties/unsupported/type",keyword:"type",params:{type: "array"},message:"must be array"};if(vErrors === null){vErrors = [err91];}else {vErrors.push(err91);}errors++;}}}else {const err92 = {instancePath:instancePath+"/capabilities",schemaPath:"https://paperclip.dev/schemas/prp/v1/capabilities.schema.json/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err92];}else {vErrors.push(err92);}errors++;}var _valid0 = _errs12 === errors;if(_valid0){valid1 = true;passing0 = 0;var props0 = true;}const _errs72 = errors;if(!(validate23(data6, {instancePath:instancePath+"/capabilities",parentData:data,parentDataProperty:"capabilities",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate23.errors : vErrors.concat(validate23.errors);errors = vErrors.length;}var _valid0 = _errs72 === errors;if(_valid0 && valid1){valid1 = false;passing0 = [passing0, 1];}else {if(_valid0){valid1 = true;passing0 = 1;if(props0 !== true){props0 = true;}}const _errs73 = errors;if(!(validate26(data6, {instancePath:instancePath+"/capabilities",parentData:data,parentDataProperty:"capabilities",rootData,dynamicAnchors}))){vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);errors = vErrors.length;}var _valid0 = _errs73 === errors;if(_valid0 && valid1){valid1 = false;passing0 = [passing0, 2];}else {if(_valid0){valid1 = true;passing0 = 2;if(props0 !== true){props0 = true;}}}}if(!valid1){const err93 = {instancePath:instancePath+"/capabilities",schemaPath:"#/properties/capabilities/oneOf",keyword:"oneOf",params:{passingSchemas: passing0},message:"must match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err93];}else {vErrors.push(err93);}errors++;}else {errors = _errs11;if(vErrors !== null){if(_errs11){vErrors.length = _errs11;}else {vErrors = null;}}}}if(data.commands !== undefined){let data38 = data.commands;if(Array.isArray(data38)){const len4 = data38.length;for(let i6=0; i6 160){const err101 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}if(func1(data41) < 1){const err102 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}}else {const err103 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/commandId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err103];}else {vErrors.push(err103);}errors++;}}if(data39.controllerSeq !== undefined){let data42 = data39.controllerSeq;if(!(((typeof data42 == "number") && (!(data42 % 1) && !isNaN(data42))) && (isFinite(data42)))){const err104 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/controllerSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}if((typeof data42 == "number") && (isFinite(data42))){if(data42 < 1 || isNaN(data42)){const err105 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/controllerSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err105];}else {vErrors.push(err105);}errors++;}}}if(data39.type !== undefined){let data43 = data39.type;if(!((((((((((((((((((data43 === "run.prepare") || (data43 === "run.attach")) || (data43 === "session.open")) || (data43 === "turn.start")) || (data43 === "turn.steer")) || (data43 === "turn.interrupt")) || (data43 === "turn.stop")) || (data43 === "request.resolve")) || (data43 === "interaction.receipt")) || (data43 === "semantic_tool.result")) || (data43 === "session.snapshot")) || (data43 === "session.close")) || (data43 === "session.budget.increase")) || (data43 === "session.destroy")) || (data43 === "run.cancel")) || (data43 === "runner.drain")) || (data43 === "runner.suspend")) || (data43 === "runner.shutdown"))){const err106 = {instancePath:instancePath+"/commands/" + i6+"/type",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/type/enum",keyword:"enum",params:{allowedValues: schema47.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}}if(data39.issuedAt !== undefined){let data44 = data39.issuedAt;if(typeof data44 === "string"){if(!(formats0.test(data44))){const err107 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/issuedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}}else {const err108 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/issuedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}if(data39.deadlineAt !== undefined){let data45 = data39.deadlineAt;if(typeof data45 === "string"){if(!(formats0.test(data45))){const err109 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/deadlineAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}else {const err110 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v1/command.schema.json/properties/deadlineAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}}if(data39.precondition !== undefined){let data46 = data39.precondition;if(data46 && typeof data46 == "object" && !Array.isArray(data46)){if(data46.runnerState !== undefined){let data47 = data46.runnerState;if(Array.isArray(data47)){const len5 = data47.length;for(let i7=0; i7 160){const err122 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if(func1(data57) < 1){const err123 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}}else {const err124 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}}if(data56.objective !== undefined){let data58 = data56.objective;if(typeof data58 === "string"){if(func1(data58) > 4000){const err125 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}if(func1(data58) < 1){const err126 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}else {const err127 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}}if(data56.status !== undefined){let data59 = data56.status;if(!((data59 === "active") || (data59 === "paused"))){const err128 = {instancePath:instancePath+"/commands/" + i6+"/payload/status",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/status/enum",keyword:"enum",params:{allowedValues: schema48.allOf[0].then.properties.payload.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}}if(data56.tokenBudget !== undefined){let data60 = data56.tokenBudget;if((!(((typeof data60 == "number") && (!(data60 % 1) && !isNaN(data60))) && (isFinite(data60)))) && (data60 !== null)){const err129 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/type",keyword:"type",params:{type: schema48.allOf[0].then.properties.payload.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}if((typeof data60 == "number") && (isFinite(data60))){if(data60 < 1 || isNaN(data60)){const err130 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}}}}else {const err131 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}}}var _valid2 = _errs119 === errors;valid32 = _valid2;if(valid32){var props2 = {};props2.payload = true;props2.type = true;}}if(!valid32){const err132 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.schema === undefined){const err133 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}if(data39.commandId === undefined){const err134 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "commandId"},message:"must have required property '"+"commandId"+"'"};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}if(data39.controllerSeq === undefined){const err135 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "controllerSeq"},message:"must have required property '"+"controllerSeq"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}if(data39.type === undefined){const err136 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err136];}else {vErrors.push(err136);}errors++;}if(data39.issuedAt === undefined){const err137 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "issuedAt"},message:"must have required property '"+"issuedAt"+"'"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}if(data39.payload === undefined){const err138 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}if(data39.schema !== undefined){if("paperclip.prp.command.v2" !== data39.schema){const err139 = {instancePath:instancePath+"/commands/" + i6+"/schema",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.command.v2"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}if(data39.commandId !== undefined){let data62 = data39.commandId;if(typeof data62 === "string"){if(func1(data62) > 160){const err140 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}if(func1(data62) < 1){const err141 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}else {const err142 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/commandId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(data39.controllerSeq !== undefined){let data63 = data39.controllerSeq;if(!(((typeof data63 == "number") && (!(data63 % 1) && !isNaN(data63))) && (isFinite(data63)))){const err143 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/controllerSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err143];}else {vErrors.push(err143);}errors++;}if((typeof data63 == "number") && (isFinite(data63))){if(data63 < 1 || isNaN(data63)){const err144 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/controllerSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}}}if(data39.type !== undefined){let data64 = data39.type;if(!(((((((((((((((((((((data64 === "run.prepare") || (data64 === "run.attach")) || (data64 === "session.open")) || (data64 === "turn.start")) || (data64 === "turn.steer")) || (data64 === "turn.interrupt")) || (data64 === "turn.stop")) || (data64 === "request.resolve")) || (data64 === "interaction.receipt")) || (data64 === "semantic_tool.result")) || (data64 === "session.snapshot")) || (data64 === "session.close")) || (data64 === "session.budget.increase")) || (data64 === "session.destroy")) || (data64 === "run.cancel")) || (data64 === "runner.drain")) || (data64 === "runner.suspend")) || (data64 === "runner.shutdown")) || (data64 === "session.goal.get")) || (data64 === "session.goal.set")) || (data64 === "session.goal.clear"))){const err145 = {instancePath:instancePath+"/commands/" + i6+"/type",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/type/enum",keyword:"enum",params:{allowedValues: schema48.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err145];}else {vErrors.push(err145);}errors++;}}if(data39.issuedAt !== undefined){let data65 = data39.issuedAt;if(typeof data65 === "string"){if(!(formats0.test(data65))){const err146 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/issuedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}}else {const err147 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/issuedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}}if(data39.deadlineAt !== undefined){let data66 = data39.deadlineAt;if(typeof data66 === "string"){if(!(formats0.test(data66))){const err148 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/deadlineAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}else {const err149 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v2/command.schema.json/properties/deadlineAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(data39.precondition !== undefined){let data67 = data39.precondition;if(data67 && typeof data67 == "object" && !Array.isArray(data67)){if(data67.runnerState !== undefined){let data68 = data67.runnerState;if(Array.isArray(data68)){const len8 = data68.length;for(let i10=0; i10 160){const err162 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(func1(data78) < 1){const err163 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}else {const err164 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data77.objective !== undefined){let data79 = data77.objective;if(typeof data79 === "string"){if(func1(data79) > 4000){const err165 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/objective/maxLength",keyword:"maxLength",params:{limit: 4000},message:"must NOT have more than 4000 characters"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}if(func1(data79) < 1){const err166 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/objective/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}else {const err167 = {instancePath:instancePath+"/commands/" + i6+"/payload/objective",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/objective/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}if(data77.status !== undefined){let data80 = data77.status;if(!((data80 === "active") || (data80 === "paused"))){const err168 = {instancePath:instancePath+"/commands/" + i6+"/payload/status",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/status/enum",keyword:"enum",params:{allowedValues: schema49.allOf[0].then.properties.payload.properties.status.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}if(data77.tokenBudget !== undefined){let data81 = data77.tokenBudget;if((!(((typeof data81 == "number") && (!(data81 % 1) && !isNaN(data81))) && (isFinite(data81)))) && (data81 !== null)){const err169 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/type",keyword:"type",params:{type: schema49.allOf[0].then.properties.payload.properties.tokenBudget.type},message:"must be integer,null"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}if((typeof data81 == "number") && (isFinite(data81))){if(data81 < 1 || isNaN(data81)){const err170 = {instancePath:instancePath+"/commands/" + i6+"/payload/tokenBudget",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/properties/tokenBudget/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}}}}else {const err171 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}}else {const err172 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}var _valid3 = _errs169 === errors;valid46 = _valid3;if(valid46){var props3 = {};props3.payload = true;props3.type = true;}}if(!valid46){const err173 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/0/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}const _errs182 = errors;let valid50 = true;const _errs183 = errors;if(errors === _errs183){if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.type !== undefined){if("external_provider.operation" !== data39.type){const err174 = {};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}}}else {const err175 = {};if(vErrors === null){vErrors = [err175];}else {vErrors.push(err175);}errors++;}}var _valid4 = _errs183 === errors;errors = _errs182;if(vErrors !== null){if(_errs182){vErrors.length = _errs182;}else {vErrors = null;}}if(_valid4){const _errs186 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.payload !== undefined){let data83 = data39.payload;if(data83 && typeof data83 == "object" && !Array.isArray(data83)){if(data83.requestId === undefined){const err176 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "requestId"},message:"must have required property '"+"requestId"+"'"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}if(data83.bindingId === undefined){const err177 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "bindingId"},message:"must have required property '"+"bindingId"+"'"};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}if(data83.runId === undefined){const err178 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "runId"},message:"must have required property '"+"runId"+"'"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}if(data83.normalizedSessionId === undefined){const err179 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "normalizedSessionId"},message:"must have required property '"+"normalizedSessionId"+"'"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}if(data83.turnId === undefined){const err180 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "turnId"},message:"must have required property '"+"turnId"+"'"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}if(data83.bindingGeneration === undefined){const err181 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "bindingGeneration"},message:"must have required property '"+"bindingGeneration"+"'"};if(vErrors === null){vErrors = [err181];}else {vErrors.push(err181);}errors++;}if(data83.assignmentRevision === undefined){const err182 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "assignmentRevision"},message:"must have required property '"+"assignmentRevision"+"'"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}if(data83.digest === undefined){const err183 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "digest"},message:"must have required property '"+"digest"+"'"};if(vErrors === null){vErrors = [err183];}else {vErrors.push(err183);}errors++;}if(data83.action === undefined){const err184 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "action"},message:"must have required property '"+"action"+"'"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}if(data83.input === undefined){const err185 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/required",keyword:"required",params:{missingProperty: "input"},message:"must have required property '"+"input"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}for(const key1 in data83){if(!(func66.call(schema49.allOf[1].then.properties.payload.properties, key1))){const err186 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}}if(data83.requestId !== undefined){let data84 = data83.requestId;if(typeof data84 === "string"){if(func1(data84) > 240){const err187 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/requestId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}if(func1(data84) < 1){const err188 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/requestId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err188];}else {vErrors.push(err188);}errors++;}}else {const err189 = {instancePath:instancePath+"/commands/" + i6+"/payload/requestId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/requestId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}}if(data83.bindingId !== undefined){let data85 = data83.bindingId;if(typeof data85 === "string"){if(func1(data85) > 240){const err190 = {instancePath:instancePath+"/commands/" + i6+"/payload/bindingId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/bindingId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err190];}else {vErrors.push(err190);}errors++;}if(func1(data85) < 1){const err191 = {instancePath:instancePath+"/commands/" + i6+"/payload/bindingId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/bindingId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}else {const err192 = {instancePath:instancePath+"/commands/" + i6+"/payload/bindingId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/bindingId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}if(data83.runId !== undefined){let data86 = data83.runId;if(typeof data86 === "string"){if(func1(data86) > 240){const err193 = {instancePath:instancePath+"/commands/" + i6+"/payload/runId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/runId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}if(func1(data86) < 1){const err194 = {instancePath:instancePath+"/commands/" + i6+"/payload/runId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/runId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}else {const err195 = {instancePath:instancePath+"/commands/" + i6+"/payload/runId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/runId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data83.normalizedSessionId !== undefined){let data87 = data83.normalizedSessionId;if(typeof data87 === "string"){if(func1(data87) > 240){const err196 = {instancePath:instancePath+"/commands/" + i6+"/payload/normalizedSessionId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/normalizedSessionId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}if(func1(data87) < 1){const err197 = {instancePath:instancePath+"/commands/" + i6+"/payload/normalizedSessionId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/normalizedSessionId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}}else {const err198 = {instancePath:instancePath+"/commands/" + i6+"/payload/normalizedSessionId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/normalizedSessionId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}if(data83.turnId !== undefined){let data88 = data83.turnId;if(typeof data88 === "string"){if(func1(data88) > 240){const err199 = {instancePath:instancePath+"/commands/" + i6+"/payload/turnId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/turnId/maxLength",keyword:"maxLength",params:{limit: 240},message:"must NOT have more than 240 characters"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}if(func1(data88) < 1){const err200 = {instancePath:instancePath+"/commands/" + i6+"/payload/turnId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/turnId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}else {const err201 = {instancePath:instancePath+"/commands/" + i6+"/payload/turnId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/turnId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}}if(data83.bindingGeneration !== undefined){let data89 = data83.bindingGeneration;if(!(((typeof data89 == "number") && (!(data89 % 1) && !isNaN(data89))) && (isFinite(data89)))){const err202 = {instancePath:instancePath+"/commands/" + i6+"/payload/bindingGeneration",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/bindingGeneration/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err202];}else {vErrors.push(err202);}errors++;}if((typeof data89 == "number") && (isFinite(data89))){if(data89 < 1 || isNaN(data89)){const err203 = {instancePath:instancePath+"/commands/" + i6+"/payload/bindingGeneration",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/bindingGeneration/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}}if(data83.assignmentRevision !== undefined){let data90 = data83.assignmentRevision;if(!(((typeof data90 == "number") && (!(data90 % 1) && !isNaN(data90))) && (isFinite(data90)))){const err204 = {instancePath:instancePath+"/commands/" + i6+"/payload/assignmentRevision",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/assignmentRevision/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err204];}else {vErrors.push(err204);}errors++;}if((typeof data90 == "number") && (isFinite(data90))){if(data90 < 1 || isNaN(data90)){const err205 = {instancePath:instancePath+"/commands/" + i6+"/payload/assignmentRevision",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/assignmentRevision/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}}if(data83.digest !== undefined){let data91 = data83.digest;if(typeof data91 === "string"){if(!pattern15.test(data91)){const err206 = {instancePath:instancePath+"/commands/" + i6+"/payload/digest",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/digest/pattern",keyword:"pattern",params:{pattern: "^sha256:[0-9a-f]{64}$"},message:"must match pattern \""+"^sha256:[0-9a-f]{64}$"+"\""};if(vErrors === null){vErrors = [err206];}else {vErrors.push(err206);}errors++;}}else {const err207 = {instancePath:instancePath+"/commands/" + i6+"/payload/digest",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/digest/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err207];}else {vErrors.push(err207);}errors++;}}if(data83.action !== undefined){let data92 = data83.action;if(!((((data92 === "accept") || (data92 === "tool")) || (data92 === "progress")) || (data92 === "finish"))){const err208 = {instancePath:instancePath+"/commands/" + i6+"/payload/action",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/action/enum",keyword:"enum",params:{allowedValues: schema49.allOf[1].then.properties.payload.properties.action.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err208];}else {vErrors.push(err208);}errors++;}}if(data83.input !== undefined){let data93 = data83.input;if(!(data93 && typeof data93 == "object" && !Array.isArray(data93))){const err209 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/properties/input/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err209];}else {vErrors.push(err209);}errors++;}}}else {const err210 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}}}else {const err211 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err211];}else {vErrors.push(err211);}errors++;}var _valid4 = _errs186 === errors;valid50 = _valid4;if(valid50){var props4 = {};props4.payload = true;props4.type = true;}}if(!valid50){const err212 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/1/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}if(props3 !== true && props4 !== undefined){if(props4 === true){props3 = true;}else {props3 = props3 || {};Object.assign(props3, props4);}}const _errs211 = errors;let valid54 = true;const _errs212 = errors;if(errors === _errs212){if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.type !== undefined){const _errs214 = errors;if("external_provider.operation" !== data39.type){const err213 = {};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}var valid55 = _errs214 === errors;}else {var valid55 = true;}if(valid55){if(data39.payload !== undefined){let data95 = data39.payload;const _errs215 = errors;if(errors === _errs215){if(data95 && typeof data95 == "object" && !Array.isArray(data95)){if(data95.action !== undefined){if("accept" !== data95.action){const err214 = {};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}}}else {const err215 = {};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}}var valid55 = _errs215 === errors;}else {var valid55 = true;}}}else {const err216 = {};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}}var _valid5 = _errs212 === errors;errors = _errs211;if(vErrors !== null){if(_errs211){vErrors.length = _errs211;}else {vErrors = null;}}if(_valid5){const _errs218 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.payload !== undefined){let data97 = data39.payload;if(data97 && typeof data97 == "object" && !Array.isArray(data97)){if(data97.input !== undefined){let data98 = data97.input;if(data98 && typeof data98 == "object" && !Array.isArray(data98)){for(const key2 in data98){const err217 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/2/then/properties/payload/properties/input/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err217];}else {vErrors.push(err217);}errors++;}}else {const err218 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/2/then/properties/payload/properties/input/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}}}else {const err219 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/2/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err219];}else {vErrors.push(err219);}errors++;}}}else {const err220 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/2/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err220];}else {vErrors.push(err220);}errors++;}var _valid5 = _errs218 === errors;valid54 = _valid5;if(valid54){var props5 = {};props5.payload = true;props5.type = true;}}if(!valid54){const err221 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/2/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err221];}else {vErrors.push(err221);}errors++;}if(props3 !== true && props5 !== undefined){if(props5 === true){props3 = true;}else {props3 = props3 || {};Object.assign(props3, props5);}}const _errs226 = errors;let valid59 = true;const _errs227 = errors;if(errors === _errs227){if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.type !== undefined){const _errs229 = errors;if("external_provider.operation" !== data39.type){const err222 = {};if(vErrors === null){vErrors = [err222];}else {vErrors.push(err222);}errors++;}var valid60 = _errs229 === errors;}else {var valid60 = true;}if(valid60){if(data39.payload !== undefined){let data100 = data39.payload;const _errs230 = errors;if(errors === _errs230){if(data100 && typeof data100 == "object" && !Array.isArray(data100)){if(data100.action !== undefined){if("tool" !== data100.action){const err223 = {};if(vErrors === null){vErrors = [err223];}else {vErrors.push(err223);}errors++;}}}else {const err224 = {};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}}var valid60 = _errs230 === errors;}else {var valid60 = true;}}}else {const err225 = {};if(vErrors === null){vErrors = [err225];}else {vErrors.push(err225);}errors++;}}var _valid6 = _errs227 === errors;errors = _errs226;if(vErrors !== null){if(_errs226){vErrors.length = _errs226;}else {vErrors = null;}}if(_valid6){const _errs233 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.payload !== undefined){let data102 = data39.payload;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if(data102.input !== undefined){let data103 = data102.input;if(data103 && typeof data103 == "object" && !Array.isArray(data103)){if(data103.name === undefined){const err226 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/required",keyword:"required",params:{missingProperty: "name"},message:"must have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data103.arguments === undefined){const err227 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/required",keyword:"required",params:{missingProperty: "arguments"},message:"must have required property '"+"arguments"+"'"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}for(const key3 in data103){if(!((key3 === "name") || (key3 === "arguments"))){const err228 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key3},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}if(data103.name !== undefined){let data104 = data103.name;if(typeof data104 === "string"){if(func1(data104) > 160){const err229 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/name",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/properties/name/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}if(func1(data104) < 1){const err230 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/name",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/properties/name/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}else {const err231 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/name",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/properties/name/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}if(data103.arguments !== undefined){let data105 = data103.arguments;if(!(data105 && typeof data105 == "object" && !Array.isArray(data105))){const err232 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/arguments",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/properties/arguments/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}}else {const err233 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/properties/input/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err233];}else {vErrors.push(err233);}errors++;}}}else {const err234 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err234];}else {vErrors.push(err234);}errors++;}}}else {const err235 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err235];}else {vErrors.push(err235);}errors++;}var _valid6 = _errs233 === errors;valid59 = _valid6;if(valid59){var props6 = {};props6.payload = true;props6.type = true;}}if(!valid59){const err236 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/3/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err236];}else {vErrors.push(err236);}errors++;}if(props3 !== true && props6 !== undefined){if(props6 === true){props3 = true;}else {props3 = props3 || {};Object.assign(props3, props6);}}const _errs245 = errors;let valid65 = true;const _errs246 = errors;if(errors === _errs246){if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.type !== undefined){const _errs248 = errors;if("external_provider.operation" !== data39.type){const err237 = {};if(vErrors === null){vErrors = [err237];}else {vErrors.push(err237);}errors++;}var valid66 = _errs248 === errors;}else {var valid66 = true;}if(valid66){if(data39.payload !== undefined){let data107 = data39.payload;const _errs249 = errors;if(errors === _errs249){if(data107 && typeof data107 == "object" && !Array.isArray(data107)){if(data107.action !== undefined){if("progress" !== data107.action){const err238 = {};if(vErrors === null){vErrors = [err238];}else {vErrors.push(err238);}errors++;}}}else {const err239 = {};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}var valid66 = _errs249 === errors;}else {var valid66 = true;}}}else {const err240 = {};if(vErrors === null){vErrors = [err240];}else {vErrors.push(err240);}errors++;}}var _valid7 = _errs246 === errors;errors = _errs245;if(vErrors !== null){if(_errs245){vErrors.length = _errs245;}else {vErrors = null;}}if(_valid7){const _errs252 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.payload !== undefined){let data109 = data39.payload;if(data109 && typeof data109 == "object" && !Array.isArray(data109)){if(data109.input !== undefined){let data110 = data109.input;if(data110 && typeof data110 == "object" && !Array.isArray(data110)){if(data110.text === undefined){const err241 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/required",keyword:"required",params:{missingProperty: "text"},message:"must have required property '"+"text"+"'"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}for(const key4 in data110){if(!(key4 === "text")){const err242 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key4},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}}if(data110.text !== undefined){let data111 = data110.text;if(typeof data111 === "string"){if(func1(data111) > 12000){const err243 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/text",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/properties/text/maxLength",keyword:"maxLength",params:{limit: 12000},message:"must NOT have more than 12000 characters"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}if(func1(data111) < 1){const err244 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/text",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/properties/text/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err244];}else {vErrors.push(err244);}errors++;}}else {const err245 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/text",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/properties/text/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err245];}else {vErrors.push(err245);}errors++;}}}else {const err246 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/properties/input/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err246];}else {vErrors.push(err246);}errors++;}}}else {const err247 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err247];}else {vErrors.push(err247);}errors++;}}}else {const err248 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err248];}else {vErrors.push(err248);}errors++;}var _valid7 = _errs252 === errors;valid65 = _valid7;if(valid65){var props7 = {};props7.payload = true;props7.type = true;}}if(!valid65){const err249 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/4/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err249];}else {vErrors.push(err249);}errors++;}if(props3 !== true && props7 !== undefined){if(props7 === true){props3 = true;}else {props3 = props3 || {};Object.assign(props3, props7);}}const _errs262 = errors;let valid71 = true;const _errs263 = errors;if(errors === _errs263){if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.type !== undefined){const _errs265 = errors;if("external_provider.operation" !== data39.type){const err250 = {};if(vErrors === null){vErrors = [err250];}else {vErrors.push(err250);}errors++;}var valid72 = _errs265 === errors;}else {var valid72 = true;}if(valid72){if(data39.payload !== undefined){let data113 = data39.payload;const _errs266 = errors;if(errors === _errs266){if(data113 && typeof data113 == "object" && !Array.isArray(data113)){if(data113.action !== undefined){if("finish" !== data113.action){const err251 = {};if(vErrors === null){vErrors = [err251];}else {vErrors.push(err251);}errors++;}}}else {const err252 = {};if(vErrors === null){vErrors = [err252];}else {vErrors.push(err252);}errors++;}}var valid72 = _errs266 === errors;}else {var valid72 = true;}}}else {const err253 = {};if(vErrors === null){vErrors = [err253];}else {vErrors.push(err253);}errors++;}}var _valid8 = _errs263 === errors;errors = _errs262;if(vErrors !== null){if(_errs262){vErrors.length = _errs262;}else {vErrors = null;}}if(_valid8){const _errs269 = errors;if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.payload !== undefined){let data115 = data39.payload;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.input !== undefined){let data116 = data115.input;if(data116 && typeof data116 == "object" && !Array.isArray(data116)){if(data116.result === undefined){const err254 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/properties/payload/properties/input/required",keyword:"required",params:{missingProperty: "result"},message:"must have required property '"+"result"+"'"};if(vErrors === null){vErrors = [err254];}else {vErrors.push(err254);}errors++;}for(const key5 in data116){if(!(key5 === "result")){const err255 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/properties/payload/properties/input/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key5},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err255];}else {vErrors.push(err255);}errors++;}}if(data116.result !== undefined){let data117 = data116.result;if(!(data117 && typeof data117 == "object" && !Array.isArray(data117))){const err256 = {instancePath:instancePath+"/commands/" + i6+"/payload/input/result",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/properties/payload/properties/input/properties/result/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err256];}else {vErrors.push(err256);}errors++;}}}else {const err257 = {instancePath:instancePath+"/commands/" + i6+"/payload/input",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/properties/payload/properties/input/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err257];}else {vErrors.push(err257);}errors++;}}}else {const err258 = {instancePath:instancePath+"/commands/" + i6+"/payload",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/properties/payload/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err258];}else {vErrors.push(err258);}errors++;}}}else {const err259 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/then/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err259];}else {vErrors.push(err259);}errors++;}var _valid8 = _errs269 === errors;valid71 = _valid8;if(valid71){var props8 = {};props8.payload = true;props8.type = true;}}if(!valid71){const err260 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/allOf/5/if",keyword:"if",params:{failingKeyword: "then"},message:"must match \"then\" schema"};if(vErrors === null){vErrors = [err260];}else {vErrors.push(err260);}errors++;}if(props3 !== true && props8 !== undefined){if(props8 === true){props3 = true;}else {props3 = props3 || {};Object.assign(props3, props8);}}if(data39 && typeof data39 == "object" && !Array.isArray(data39)){if(data39.schema === undefined){const err261 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "schema"},message:"must have required property '"+"schema"+"'"};if(vErrors === null){vErrors = [err261];}else {vErrors.push(err261);}errors++;}if(data39.commandId === undefined){const err262 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "commandId"},message:"must have required property '"+"commandId"+"'"};if(vErrors === null){vErrors = [err262];}else {vErrors.push(err262);}errors++;}if(data39.controllerSeq === undefined){const err263 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "controllerSeq"},message:"must have required property '"+"controllerSeq"+"'"};if(vErrors === null){vErrors = [err263];}else {vErrors.push(err263);}errors++;}if(data39.type === undefined){const err264 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "type"},message:"must have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err264];}else {vErrors.push(err264);}errors++;}if(data39.issuedAt === undefined){const err265 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "issuedAt"},message:"must have required property '"+"issuedAt"+"'"};if(vErrors === null){vErrors = [err265];}else {vErrors.push(err265);}errors++;}if(data39.payload === undefined){const err266 = {instancePath:instancePath+"/commands/" + i6,schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/required",keyword:"required",params:{missingProperty: "payload"},message:"must have required property '"+"payload"+"'"};if(vErrors === null){vErrors = [err266];}else {vErrors.push(err266);}errors++;}if(data39.schema !== undefined){if("paperclip.prp.command.v3" !== data39.schema){const err267 = {instancePath:instancePath+"/commands/" + i6+"/schema",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/schema/const",keyword:"const",params:{allowedValue: "paperclip.prp.command.v3"},message:"must be equal to constant"};if(vErrors === null){vErrors = [err267];}else {vErrors.push(err267);}errors++;}}if(data39.commandId !== undefined){let data119 = data39.commandId;if(typeof data119 === "string"){if(func1(data119) > 160){const err268 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/commandId/maxLength",keyword:"maxLength",params:{limit: 160},message:"must NOT have more than 160 characters"};if(vErrors === null){vErrors = [err268];}else {vErrors.push(err268);}errors++;}if(func1(data119) < 1){const err269 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/commandId/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err269];}else {vErrors.push(err269);}errors++;}}else {const err270 = {instancePath:instancePath+"/commands/" + i6+"/commandId",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/commandId/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err270];}else {vErrors.push(err270);}errors++;}}if(data39.controllerSeq !== undefined){let data120 = data39.controllerSeq;if(!(((typeof data120 == "number") && (!(data120 % 1) && !isNaN(data120))) && (isFinite(data120)))){const err271 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/controllerSeq/type",keyword:"type",params:{type: "integer"},message:"must be integer"};if(vErrors === null){vErrors = [err271];}else {vErrors.push(err271);}errors++;}if((typeof data120 == "number") && (isFinite(data120))){if(data120 < 1 || isNaN(data120)){const err272 = {instancePath:instancePath+"/commands/" + i6+"/controllerSeq",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/controllerSeq/minimum",keyword:"minimum",params:{comparison: ">=", limit: 1},message:"must be >= 1"};if(vErrors === null){vErrors = [err272];}else {vErrors.push(err272);}errors++;}}}if(data39.type !== undefined){let data121 = data39.type;if(!((((((((((((((((((((((data121 === "run.prepare") || (data121 === "run.attach")) || (data121 === "session.open")) || (data121 === "turn.start")) || (data121 === "turn.steer")) || (data121 === "turn.interrupt")) || (data121 === "turn.stop")) || (data121 === "request.resolve")) || (data121 === "interaction.receipt")) || (data121 === "semantic_tool.result")) || (data121 === "session.snapshot")) || (data121 === "session.close")) || (data121 === "session.budget.increase")) || (data121 === "session.destroy")) || (data121 === "run.cancel")) || (data121 === "runner.drain")) || (data121 === "runner.suspend")) || (data121 === "runner.shutdown")) || (data121 === "session.goal.get")) || (data121 === "session.goal.set")) || (data121 === "session.goal.clear")) || (data121 === "external_provider.operation"))){const err273 = {instancePath:instancePath+"/commands/" + i6+"/type",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/type/enum",keyword:"enum",params:{allowedValues: schema49.properties.type.enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err273];}else {vErrors.push(err273);}errors++;}}if(data39.issuedAt !== undefined){let data122 = data39.issuedAt;if(typeof data122 === "string"){if(!(formats0.test(data122))){const err274 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/issuedAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err274];}else {vErrors.push(err274);}errors++;}}else {const err275 = {instancePath:instancePath+"/commands/" + i6+"/issuedAt",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/issuedAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err275];}else {vErrors.push(err275);}errors++;}}if(data39.deadlineAt !== undefined){let data123 = data39.deadlineAt;if(typeof data123 === "string"){if(!(formats0.test(data123))){const err276 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/deadlineAt/format",keyword:"format",params:{format: "date-time"},message:"must match format \""+"date-time"+"\""};if(vErrors === null){vErrors = [err276];}else {vErrors.push(err276);}errors++;}}else {const err277 = {instancePath:instancePath+"/commands/" + i6+"/deadlineAt",schemaPath:"https://paperclip.dev/schemas/prp/v3/command.schema.json/properties/deadlineAt/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err277];}else {vErrors.push(err277);}errors++;}}if(data39.precondition !== undefined){let data124 = data39.precondition;if(data124 && typeof data124 == "object" && !Array.isArray(data124)){if(data124.runnerState !== undefined){let data125 = data124.runnerState;if(Array.isArray(data125)){const len11 = data125.length;for(let i13=0; i13