diff --git a/.env.runner-e2e.example b/.env.runner-e2e.example
index 1e208f879fb..c1e2377a391 100644
--- a/.env.runner-e2e.example
+++ b/.env.runner-e2e.example
@@ -6,6 +6,10 @@ XAI_API_KEY=
OPENROUTER_API_KEY=
DAYTONA_API_KEY=
+# Explicit-only extended-harnesses candidates.
+CURSOR_AUTH_TOKEN=
+COPILOT_GITHUB_TOKEN=
+
# Required only for Daytona cells. Use an immutable, anonymously pullable
# digest from the Runner Full-Stack E2E image job or a locally published image.
PAPERCLIP_E2E_DAYTONA_IMAGE=ghcr.io/paperclipai/paperclip-daytona-runner@sha256:REPLACE_ME
diff --git a/.github/workflows/sentry-contract.yml b/.github/workflows/sentry-contract.yml
index f4bb2bcebbb..87515150a0e 100644
--- a/.github/workflows/sentry-contract.yml
+++ b/.github/workflows/sentry-contract.yml
@@ -47,7 +47,14 @@ jobs:
version: 9.15.4
- name: Install workspace dependencies
- run: pnpm install --frozen-lockfile
+ # Master owns the lockfile; PR verification can start before its refresh.
+ # Resolve like the normal PR jobs, but this narrow contract needs no
+ # dependency or workspace lifecycle scripts, including on the fast path.
+ run: |
+ if ! pnpm install --frozen-lockfile --ignore-scripts; then
+ pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile
+ pnpm install --frozen-lockfile --ignore-scripts
+ fi
- name: Install the audited optional SDK outside the workspace
shell: bash
diff --git a/AGENTS.md b/AGENTS.md
index 3c1c4188486..c957ca41ead 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -74,10 +74,7 @@ pnpm dev
1. Keep changes company-scoped.
Every domain entity should be scoped to a company and company boundaries must be enforced in routes/services.
-Explicit exceptions: personal keyboard shortcut enablement is stored on the
-authenticated user and applies across companies, like the user profile. Only
-that user can read or change it; writes validate company membership for their
-audit context. Announcement dismissals are instance-wide user preferences,
+Explicit exception: announcement dismissals are instance-wide user preferences,
keyed by user and announcement so they persist across companies. Their audit
context must still validate company membership. The announcement publication-ID
registry is instance-level feed metadata; it contains no company or user data.
diff --git a/DESIGN.md b/DESIGN.md
index 75a2972dbce..c3e53e4db36 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -108,3 +108,5 @@ tokenize motion. Principles — reasoning only; values live in `ui/src/index.css
- **Reduced motion is honored at the token layer.** A `prefers-reduced-motion: reduce`
block collapses the duration/stagger tokens to zero, cascading to every scoped token,
in addition to each animation's own component-level guard.
+
+Agent Chat keeps pending questions as compact “Unanswered question” entries at their original position in history. A newer user message dismisses the old question form without resolving it. Opening the history entry restores the original form and its draft; submitting later uses the same durable question response path. Actual permission reviews retain their permission checks.
diff --git a/README.md b/README.md
index 8096cf9bbcf..b3f130123d8 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,10 @@
+
+ Sign up for the Paperclip Cloud waitlist →
+
+
# Paperclip is the app people use to manage AI agents for work.
@@ -32,7 +36,7 @@ Open-source orchestration for teams of AI agents.
**If OpenClaw is an _employee_, Paperclip is the _company_.**
-Paperclip is a Node.js server and React UI that orchestrates a team of AI agents to run a business. Bring your own agents, assign goals, and track work and costs from one dashboard.
+Paperclip is a Node.js server and React UI that orchestrates a team of AI agents to run a business. Bring your own agents, assign goals, and track work and costs from one dashboard. Choose models and harnesses per agent while keeping your team's tasks, skills, permissions, and history in one place.
It looks like a task manager. Under the hood: org charts, budgets, governance, goal alignment, and agent coordination.
@@ -49,13 +53,19 @@ It looks like a task manager. Under the hood: org charts, budgets, governance, g
+Custom processes, HTTP endpoints, and external adapter packages extend the roster. See the [adapter overview](https://docs.paperclip.ing/reference/adapters/overview/) for setup and capabilities.
+
## Paperclip is right for you if
@@ -90,9 +102,9 @@ Four things have to work for an organization of AI agents to actually produce: t
| Pillar | Built for | What it covers |
| --- | --- | --- |
| **Agentic Task Manager** — Declare intent. Agents work. You verify the output. | Everyone, daily | Tasks, approvals & review gates · proactive agent coworkers · auditable routines & workflows · verify from diffs, screenshots & tests |
-| **Org Chart for Agents** — Roles, permissions & boundaries for humans and agents. | Managers | Mixed human + agent org chart · responsibilities, delegation, specialization · governance: who can do what · scoped secrets & company boundaries |
-| **Agent Employee Training** — Design, train & evaluate your AI employees. | Enablers | Skill Studio & shared org-wide skills · evals & saved test runs · active learning loops & quality metrics · performance reviews for agents |
-| **Agentic OS** — The infrastructure that makes the work run. | IT & platform | Cross-provider runtime: any model, any agent · sandboxing, integrations & MCP servers · SSO, GRC, RBAC & cost controls · data privacy, internal trace collection, compounding data value |
+| **Org Chart for Agents** — Roles, permissions & boundaries for humans and agents. | Managers | Mixed human + agent org chart · responsibilities, delegation, specialization · governance: who can do what · scoped secrets & company boundaries · connection permissions & responsible-user identities |
+| **Agent Employee Training** — Design, train & evaluate your AI employees. | Enablers | Skill Studio & shared org-wide skills · evals & saved test runs · active learning loops & quality metrics · performance reviews for agents · saved test inputs · skill version history & restore · reusable team templates |
+| **Agentic OS** — The infrastructure that makes the work run. | IT & platform | Cross-provider runtime: any model, any agent · sandboxing, integrations & MCP servers · SSO, GRC, RBAC & cost controls · data privacy, internal trace collection, compounding data value · personal & shared app connections · run history & opt-in tracing |
@@ -106,31 +118,31 @@ Any agent, any runtime, one org chart. If it can receive a heartbeat, it's hired
🎯 Goal Alignment
-Every task traces back to the organization mission. Agents know what to do and why .
+Link tasks and projects to your organization goals. Agents receive the goal context behind their work.
💓 Heartbeats
-Agents wake on a schedule, check work, and act. Delegation flows up and down the org chart.
+Agents wake for assigned work, follow-up messages, or configured schedules. Delegation flows up and down the org chart.
💰 Cost Control
-Monthly budgets per agent. When they hit the limit, they stop. No runaway costs.
+Company, agent, and project budgets . Track reported spend, get threshold alerts, and pause work at configured limits.
🏢 Multi-Organization
-One deployment, many organizations. Complete data isolation. One control plane for your portfolio.
+One deployment, many organizations. Separate tasks, agents, permissions, and activity histories for each.
-🎫 Ticket System
-Every conversation traced. Every decision explained. Full tool-call tracing and immutable audit log.
+🎫 Task Threads
+Keep conversations, plans, blockers, files, and run history attached to the work. Assign tasks to agents or people.
🛡️ Governance
-Approve hires, override strategy, pause or terminate any agent — at any time.
+Configure review and approval stages , approve hires, and pause, reassign, or stop work when needed.
📊 Org Chart
@@ -141,8 +153,38 @@ Hierarchies, roles, reporting lines. Your agents have a boss, a title, and a job
Monitor and manage your autonomous businesses from anywhere.
+
+
+🔗 Apps & Connections
+Connect services such as GitHub, Notion, and Railway, or your own MCP server. Set gateway actions to Allowed, Ask first, or Off.
+
+
+👥 Shared Agents, Personal Accounts
+Choose who can use a connection and which agents can access it . Managed GitHub operations can use the account of the person directing the work.
+
+
+🧠 Skills & Skill Studio
+Install or write shared skills , test them with saved inputs, inspect results, and restore earlier versions.
+
+
+
+
+📅 Scheduled Routines
+Run recurring work on a schedule or trigger it through an API or webhook. Each run has a task, an owner, and a history.
+
+
+📎 Artifacts & Feedback
+Find the files and documents agents produce . Preview supported formats and leave comments on specific passages in documents.
+
+
+📦 Ready-Made Teams
+Preview and install teams with roles, skills, projects, and routines. Choose their runtimes and make the setup your own.
+
+
+Experimental **Agent Chat** and **chat/email connectors** add conversations with agents in Paperclip and through configured services such as Slack, Discord, Telegram, and AgentMail. Enable the relevant instance settings to try them.
+
## Problems Paperclip solves
@@ -152,8 +194,8 @@ Monitor and manage your autonomous businesses from anywhere.
| ❌ You have 20 Claude Code tabs open and can't track which one does what. On reboot you lose everything. | ✅ Tasks are ticket-based, conversations are threaded, sessions persist across reboots. |
| ❌ You manually gather context from several places to remind your bot what you're actually doing. | ✅ Context flows from the task up through the project and company goals — your agent always knows what to do and why. |
| ❌ Folders of agent configs are disorganized and you're re-inventing task management, communication, and coordination between agents. | ✅ Paperclip gives you org charts, ticketing, delegation, and governance out of the box — so you run a company, not a pile of scripts. |
-| ❌ Runaway loops waste hundreds of dollars of tokens and max your quota before you even know what happened. | ✅ Cost tracking surfaces token budgets and throttles agents when they're out. Management prioritizes with budgets. |
-| ❌ You have recurring jobs (customer support, social, reports) and have to remember to manually kick them off. | ✅ Heartbeats handle regular work on a schedule. Management supervises. |
+| ❌ Runaway loops waste hundreds of dollars of tokens and max your quota before you even know what happened. | ✅ Spend tracking, budget alerts, and automatic pauses help you control the cost of ongoing work. |
+| ❌ You have recurring jobs (customer support, social, reports) and have to remember to manually kick them off. | ✅ Routines create assigned tasks on a schedule, with outputs and run history you can inspect. |
| ❌ You have an idea, you have to find your repo, fire up Claude Code, keep a tab open, and babysit it. | ✅ Add a task in Paperclip. Your coding agent works on it until it's done. Management reviews their work. |
@@ -164,13 +206,14 @@ Paperclip handles the hard orchestration details correctly.
| | |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------- |
-| **Atomic execution.** | Task checkout and budget enforcement are atomic, so no double-work and no runaway spend. |
-| **Persistent agent state.** | Agents resume the same task context across heartbeats instead of restarting from scratch. |
+| **Atomic task checkout.** | A single assignee and execution locks prevent competing runs from claiming the same task. |
+| **Persistent work context.** | Tasks, comments, and documents stay in Paperclip. Supporting adapters resume saved sessions across runs. |
| **Runtime skill injection.** | Agents can learn Paperclip workflows and project context at runtime, without retraining. |
| **Governance with rollback.** | Approval gates are enforced, config changes are revisioned, and bad changes can be rolled back safely. |
-| **Goal-aware execution.** | Tasks carry full goal ancestry so agents consistently see the "why," not just a title. |
+| **Accountable connections.** | Human access, agent eligibility, and gateway action permissions are separate controls. Approve a call once or save a revocable rule. |
+| **Goal-aware execution.** | Linked tasks and projects carry goal ancestry so agents see the "why," not just a title. |
| **Portable company templates.** | Export/import orgs, agents, and skills with secret scrubbing and collision handling. |
-| **True multi-organization isolation.** | Every entity is company-scoped, so one deployment can run many companies with separate data and audit trails. |
+| **Organization boundaries.** | Company-scoped access checks keep each organization's work, agents, and activity separate within one deployment. |
@@ -210,7 +253,7 @@ Paperclip is a full control plane, not a wrapper. Before you build any of this y
-**Identity & Access** — Two deployment modes (trusted local or authenticated), board users, agent API keys, short-lived run JWTs, company memberships, invite flows, and OpenClaw onboarding. Every mutating request is traced to an actor.
+**Identity & Access** — Two deployment modes (trusted local or authenticated), human roles and permissions, agent API keys, short-lived run JWTs, company memberships, and invite flows. Responsible-user attribution follows work through delegation and supported managed connections.
@@ -222,31 +265,31 @@ Paperclip is a full control plane, not a wrapper. Before you build any of this y
-**Work & Task System** — Issues carry company/project/goal/parent links, atomic checkout with execution locks, first-class blocker dependencies, comments, documents, attachments, work products, labels, and inbox state. No double-work, no lost context.
+**Work & Task System** — Issues carry company/project/goal/parent links, atomic checkout with execution locks, first-class blocker dependencies, comments, documents, attachments, work products, labels, and inbox state. Search across work, review document revisions, and leave anchored feedback.
-**Heartbeat Execution** — DB-backed wakeup queue with coalescing, budget checks, workspace resolution, secret injection, skill loading, and adapter invocation. Runs produce structured logs, cost events, session state, and audit trails. Recovery handles orphaned runs automatically.
+**Heartbeat Execution** — DB-backed wakeup queue with coalescing, budget checks, workspace resolution, secret injection, skill loading, and adapter invocation. Runs produce logs, usage records, and adapter-specific session state. Bounded recovery handles supported failures and surfaces cases that need human action.
-**Workspaces & Runtime** — Project workspaces, isolated execution workspaces (git worktrees, operator branches), and runtime services (dev servers, preview URLs). Agents work in the right directory with the right context every time.
+**Workspaces & Runtime** — Project repositories and workspaces, optional isolated execution workspaces (git worktrees, operator branches), and runtime services (dev servers, preview URLs). Sandbox providers extend execution beyond the local host; availability depends on the configured environment and adapter.
-**Governance & Approvals** — Board approval workflows, execution policies with review/approval stages, decision tracking, budget hard-stops, agent pause/resume/terminate, and full audit logging. Nothing ships without your sign-off.
+**Governance & Approvals** — Board approval workflows, execution policies with review/approval stages, decision tracking, budget hard-stops, and agent pause/resume/terminate. Configured task reviews govern completion; connection action approvals govern calls through the tool gateway.
-**Budget & Cost Control** — Token and cost tracking by company, agent, project, goal, issue, provider, and model. Scoped budget policies with warning thresholds and hard stops. Overspend pauses agents and cancels queued work automatically.
+**Budget & Cost Control** — Token and cost tracking by company, agent, project, goal, issue, provider, and model. Scoped budget policies with warning thresholds and hard stops. Enforcement uses recorded spend; usage reporting and in-flight work can delay a stop.
@@ -258,12 +301,12 @@ Paperclip is a full control plane, not a wrapper. Before you build any of this y
-**Plugins** — Instance-wide plugin system with out-of-process workers, capability-gated host services, job scheduling, tool exposure, and UI contributions. Extend Paperclip without forking it.
+**[Plugins](https://docs.paperclip.ing/administration/plugins/)** — Instance-wide plugin system with out-of-process workers, capability-gated host services, job scheduling, tool exposure, and UI contributions. Extend Paperclip without forking it.
-**Secrets & Storage** — Instance and company secrets, encrypted local storage, provider-backed object storage, attachments, and work products. Sensitive values stay out of prompts unless a scoped run explicitly needs them.
+**Secrets & Storage** — Company secrets and per-person secret values, encrypted credential storage, local or S3-compatible file storage, attachments, and work products. Secret references supply credentials to authorized runs without copying values into ordinary agent configuration.
@@ -275,7 +318,7 @@ Paperclip is a full control plane, not a wrapper. Before you build any of this y
-**Company Portability** — Export and import entire organizations — agents, skills, projects, routines, and issues — with secret scrubbing and collision handling. One deployment, many companies, complete data isolation.
+**[Company Portability](https://docs.paperclip.ing/guides/power/export-import/)** — Preview, export, and import organization packages with agents, skills, and optional projects, routines, tasks, and attachments. Referenced secret values are omitted; review packages before sharing because plain environment values and local paths can remain. Packages share an operating setup; full-instance recovery uses backups.
@@ -287,54 +330,34 @@ Paperclip is a full control plane, not a wrapper. Before you build any of this y
| | |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------- |
-| **Not a chatbot.** | Agents have jobs, not chat windows. |
+| **Not just a chatbot.** | Conversations stay attached to tasks, plans, decisions, and outputs. Experimental Agent Chat can hand work off to assigned tasks. |
| **Not an agent framework.** | We don't tell you how to build agents. We tell you how to run a company made of them. |
-| **Not a workflow builder.** | No drag-and-drop pipelines. Paperclip models companies — with org charts, goals, budgets, and governance. |
+| **Not just a workflow builder.** | Routines and experimental pipelines operate within an organization, with roles, goals, budgets, and governance. |
| **Not a prompt manager.** | Agents bring their own prompts, models, and runtimes. Paperclip manages the organization they work in. |
-| **Not a single-agent tool.** | This is for teams. If you have one agent, you probably don't need Paperclip. If you have twenty — you definitely do. |
-| **Not a code review tool.** | Paperclip orchestrates work, not pull requests. Bring your own review process. |
+| **Not limited to one agent.** | Start with one agent and grow into a team with shared skills, delegation, and review. |
+| **Not only for code review.** | Coding and PR review fit alongside research, operations, content, and other work. |
## Quickstart
-Open source. Self-hosted. No Paperclip account required.
+Open source. Self-hosted. No Paperclip account required. Follow the [guided quickstart](https://docs.paperclip.ing/guides/getting-started/five-minute-path/) to set up your first agent.
+
+### Just ask your agent to install Paperclip
+
+Share the [installation guide](https://docs.paperclip.ing/reference/cli/installation/) with your agent.
+
+### Or install it yourself
+
+With **Node.js 24.11 or newer** installed:
```bash
-curl -fsSLO https://paperclip.ing/install.sh
-curl -fsSLO https://paperclip.ing/install.sh.sha256
-if command -v sha256sum >/dev/null 2>&1; then
- sha256sum -c install.sh.sha256
-else
- shasum -a 256 -c install.sh.sha256
-fi
-bash install.sh
+npx paperclipai@latest onboard --yes
```
-The installer ensures Node.js 24.11 or newer is available, installs a managed
-Paperclip CLI under `~/.paperclip/cli`, and starts interactive onboarding. It
-can also install Paperclip as a background service on supported Linux and
-macOS systems. The checksum detects transfer or publishing mistakes, but it is
-served from the same origin as the script; use a release-tag or commit-pinned
-GitHub copy when you need an independently hosted source.
+The CLI runs from npm's cache; your instance configuration and data persist locally.
-For a non-interactive managed install:
-
-```bash
-curl -fsSL https://paperclip.ing/install.sh | bash -s -- --no-prompt --no-onboard
-paperclipai onboard --yes
-```
-
-The piped form requires supported Node.js, npm, and npx to already be present.
-If Node.js bootstrap is required, download and review `install.sh` before
-running it so no privileged dependency-install command is accepted through a
-pipe.
-
-To try Paperclip without installing anything permanently:
-
-```bash
-npx --registry https://registry.npmjs.org paperclipai onboard --yes
-```
+See the [installation guide](https://docs.paperclip.ing/reference/cli/installation/) for managed installs, pinned versions, canary and git-ref installs, updates, rollback, service management, and uninstalling.
For an isolated manual test instance that is already initialized with a CEO
agent, use `test-drive`. It stays in the foreground, never installs a service
@@ -352,7 +375,7 @@ Each run without `--data-dir` gets a unique, retained temporary directory; its
absolute path is printed at startup. Pass `--data-dir` to reuse one, or
`--no-browser` to leave the initialized instance unopened. When invoked from a
linked Git worktree, `test-drive` also enables task execution in that worktree.
-See [`doc/CLI.md`](doc/CLI.md#isolated-manual-test-drives) for credential and
+See the [test-drive guide](https://docs.paperclip.ing/reference/cli/test-drive/) for credential and
reuse behavior.
> **Troubleshooting: private npm registry `.npmrc`**
@@ -368,21 +391,18 @@ reuse behavior.
> Workaround (cross-platform; force the public npm registry for this command):
>
> ```bash
-> npx --registry https://registry.npmjs.org paperclipai onboard --yes
+> npx --registry https://registry.npmjs.org paperclipai@latest onboard --yes
> ```
That quickstart path now defaults to trusted local loopback mode for the fastest first run. To start in authenticated/private mode instead, choose a bind preset explicitly:
```bash
-paperclipai onboard --yes --bind lan
+npx paperclipai@latest onboard --yes --bind lan
# or:
-paperclipai onboard --yes --bind tailnet
+npx paperclipai@latest onboard --yes --bind tailnet
```
-If you already have Paperclip configured, rerunning `onboard` keeps the existing config in place. Use `paperclipai configure` to edit settings.
-
-See [`doc/INSTALLING.md`](doc/INSTALLING.md) for pinned versions, canary and
-git-ref installs, updates, rollback, service management, and uninstalling.
+If you already have Paperclip configured, rerunning `onboard` keeps the existing config in place. Use `npx paperclipai configure` to edit settings.
Or manually:
@@ -393,32 +413,53 @@ pnpm install
pnpm dev
```
-This starts the API server at `http://localhost:3100`. An embedded PostgreSQL database is created automatically — no setup required.
+This starts the UI and API at `http://localhost:3100`. An embedded PostgreSQL database is created automatically — no setup required.
> **Requirements:** Node.js 24.11+, pnpm 9.15+
+Source development also builds the native Paperclip Runner when enabled (the self-hosted default). Install a Rust toolchain, or set `PAPERCLIP_RUNNER_BINARY` to a compatible prebuilt runner.
+
## FAQ
-**What does a typical setup look like?**
-Locally, a single Node.js process manages an embedded Postgres and local file storage. For production, point it at your own Postgres and deploy however you like. Configure projects, agents, and goals — the agents take care of the rest.
+**Q: Is this project maintained or just slop?**
-If you're a solo entrepreneur you can use Tailscale to access Paperclip on the go. Then later you can deploy to e.g. Vercel when you need it.
+**A:** Paperclip is maintained by the [Paperclip team](https://paperclip.ing). We've merged [over 2,700 pull requests](https://github.com/paperclipai/paperclip/pulls?q=is%3Apr+is%3Amerged).
-**Can I run multiple companies?**
-Yes. A single deployment can run an unlimited number of companies with complete data isolation.
+
-**How is Paperclip different from agents like OpenClaw or Claude Code?**
-Paperclip _uses_ those agents. It orchestrates them into a company — with org charts, budgets, goals, governance, and accountability.
+**Q: What does a typical setup look like?**
-**Why should I use Paperclip instead of just pointing my OpenClaw to Asana or Trello?**
-Agent orchestration has subtleties in how you coordinate who has work checked out, how to maintain sessions, monitoring costs, establishing governance - Paperclip does this for you.
+**A:** Locally, a single Node.js process manages an embedded Postgres and local file storage. For production, point it at your own Postgres and deploy however you like. Configure projects, agents, and goals — the agents take care of the rest.
+
+For remote access, use authenticated mode with a private-network bind such as Tailscale, or deploy the persistent server with Docker. See [deployment modes](https://docs.paperclip.ing/reference/deploy/deployment-modes/) and the [Docker guide](https://docs.paperclip.ing/reference/deploy/docker/).
+
+
+
+**Q: Can I run multiple companies?**
+
+**A:** Yes. A single deployment can host multiple organizations with company-scoped data and access checks.
+
+
+
+**Q: How is Paperclip different from agents like OpenClaw or Claude Code?**
+
+**A:** Paperclip _uses_ those agents. It orchestrates them into a company — with org charts, budgets, goals, governance, and accountability.
+
+
+
+**Q: Why should I use Paperclip instead of just pointing my OpenClaw to Asana or Trello?**
+
+**A:** Agent orchestration has subtleties in how you coordinate who has work checked out, how to maintain sessions, monitoring costs, establishing governance - Paperclip does this for you.
(Bring-your-own-ticket-system is on the Roadmap)
-**Do agents run continuously?**
-By default, agents run on scheduled heartbeats and event-based triggers (task assignment, @-mentions). You can also hook in continuous agents like OpenClaw. You bring your agent and Paperclip coordinates.
+
+
+**Q: Do agents run continuously?**
+
+**A:** Agents wake for assigned work and follow-up messages. Optional timer heartbeats let them check for work periodically; routines create recurring tasks on their own schedules. You can also connect externally running agents such as OpenClaw. A mention alone does not assign work or wake another agent.
@@ -465,16 +506,22 @@ See [doc/DEVELOPING.md](doc/DEVELOPING.md) for the full development guide.
- ✅ Activity log & action attribution
- ✅ Self-healing runs & automatic recovery
- ✅ Agent evals & feedback
-- ⚪ Memory / Knowledge
+- ✅ Connected Apps
+- ✅ Personal & Shared AI Accounts
+- ✅ Shared Agents Use Personal GitHub Identities
+- ✅ Skill Version History & Restore
+- ✅ Document Comments & Revision History
+- ✅ Company-Wide Search
+- ✅ Multi-Model & Multi-Harness Teams
+- 🟡 Memory / Knowledge
- ⚪ MAXIMIZER MODE
- ⚪ Work Queues
- ⚪ Self-Organization
- ⚪ Automatic Organizational Learning
-- ⚪ CEO Chat
-- 🟡 Cloud deployments (multi-tenant isolation & company Import/Export shipped)
+- 🟡 Agent Chat
+- 🟡 Cloud deployments
- ⚪ Desktop App
- ⚪ Bring-your-own-ticket-system (Asana / Linear / Jira as on-ramps)
-- ⚪ Connected Apps (one-click integrations, e.g. Vercel)
This is the short roadmap preview. See the full roadmap in [ROADMAP.md](ROADMAP.md).
@@ -510,6 +557,8 @@ Telemetry is **enabled by default** and can be disabled with any of the followin
We welcome contributions. See the [contributing guide](CONTRIBUTING.md) for details.
+**[We're hiring](https://paperclip.ing/about/#careers)**
+
## Community
diff --git a/ROADMAP.md b/ROADMAP.md
index fd245a3e88f..8a6003e2758 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -4,6 +4,8 @@ This document expands the roadmap preview in `README.md`.
Paperclip is still moving quickly. The list below is directional, not promised, and priorities may shift as we learn from users and from operating real AI companies with the product.
+Status tracks the default branch: ✅ available, 🟡 partial or experimental, ⚪ planned. Check [release notes](https://github.com/paperclipai/paperclip/releases) for packaged versions. Some capabilities require instance settings, plugins, or provider setup.
+
We value community involvement and want to make sure contributor energy goes toward areas where it can land.
We may accept contributions in the areas below, but if you want to work on roadmap-level core features, please coordinate with us first in Discord (`#dev`) before writing code. Bugs, docs, polish, and tightly scoped improvements are still the easiest contributions to merge.
@@ -48,9 +50,9 @@ Paperclip should support explicit review and approval stages as first-class work
Paperclip needs a clearer path from solo operator to real human teams. That means shared board access, safer collaboration, and a better model for several humans supervising the same autonomous company.
-### ✅ Cloud / Sandbox agents (e2b, Cloudflare, Daytona, Modal, Novita, self-hosted Kubernetes)
+### ✅ Cloud / Sandbox agent support
-We want agents to run in more remote and sandboxed environments while preserving the same Paperclip control-plane model. This makes the system safer, more flexible, and more useful outside a single trusted local machine.
+Sandbox provider plugins support remote execution while preserving the Paperclip control-plane model. Providers include E2B, Cloudflare, Daytona, Modal, Novita, and Kubernetes. Execution requires a configured provider and a compatible adapter; environment and isolated-workspace surfaces depend on instance settings.
### ✅ Artifacts & Work Products
@@ -76,17 +78,45 @@ Secrets need to be centrally managed without giving every agent every credential
Operators need a durable record of what changed and who initiated it. Activity history and clear action attribution make human, agent, and system actions inspectable across the control plane.
-### ✅ Self-healing runs & automatic recovery
+### ✅ Bounded run recovery
-Agent work should recover from routine failures without waiting for a human to notice every stalled run. Recovery policies can retry safe work, route failures, and keep the issue lifecycle aligned with what actually happened.
+Recovery policies handle supported transient failures and interrupted runs, retain task ownership, and surface recovery actions when work needs human intervention. Retries are bounded and remain subject to budgets, approvals, and pause gates.
### ✅ Agent evals & feedback
-Agent performance should be measurable over time, not judged only from anecdotes. Evals, saved results, and structured feedback create a loop for improving skills, prompts, models, and employee quality.
+Skill Studio provides saved test inputs, test runs, results, and version history. Task and document feedback helps people improve procedures. Automatic organizational learning remains a separate roadmap item below.
-### ⚪ Memory / Knowledge
+### ✅ Connected Apps
-We want a stronger memory and knowledge surface for companies, agents, and projects. That includes durable memory, better recall of prior decisions and context, and a clearer path for knowledge-style capabilities without turning Paperclip into a generic chat app.
+Apps and Connections provide a service catalog, custom MCP connections, personal and shared accounts, agent access controls, and per-action Allowed / Ask first / Off policies. Supported AI accounts also use Connections. Setup varies by provider and deployment; not every integration is one-click. Broader provider coverage and simpler setup remain ongoing work.
+
+### ✅ Personal & Shared AI Accounts
+
+Connect supported subscription accounts or API keys and choose personal defaults or shared accounts for compatible agents. Human access and agent eligibility are separate controls; account selection stays independent of the model and harness. See [AI Connections](doc/connections/AI-CONNECTIONS.md).
+
+### ✅ Shared Agents Use Personal GitHub Identities
+
+Shared agents can use the GitHub identity of the person whose instructions they are executing. Managed Git and GitHub operations resolve that identity through delegation and follow-up work, subject to connection permissions. See [GitHub identity during agent execution](doc/execution-github-identity.md).
+
+### ✅ Skill Version History & Restore
+
+Save skill versions, inspect earlier contents, and restore a previous version as a new revision. Saved test inputs and results support comparison as procedures evolve.
+
+### ✅ Document Comments & Revision History
+
+Leave comments on specific passages in task documents, follow revision history, and restore previous document revisions. Annotations carry into agent review context so feedback stays attached to the work.
+
+### ✅ Company-Wide Search
+
+Search tasks, comments, documents, agents, projects, and artifacts within company access boundaries. Filters and matching excerpts help people find relevant work and its outputs.
+
+### ✅ Multi-Model & Multi-Harness Teams
+
+Choose models and supported harnesses per agent while keeping tasks, skills, and history in one organization. Built-in adapters cover Claude Code, Codex, Cursor, Gemini CLI, OpenCode, Pi, Hermes, Grok, Kimi Code, OpenClaw, and process or HTTP integrations.
+
+### 🟡 Memory / Knowledge
+
+Experimental memory connections support Mem0, Zep, Supermemory, Cognee, and Honcho. The optional LLM Wiki plugin provides another knowledge workflow. A broader memory and knowledge surface for companies, agents, and projects remains a direction for future work. See [memory connections](doc/connections/MEMORY.md) for setup and availability.
### ⚪ MAXIMIZER MODE
@@ -94,7 +124,7 @@ This is the direction for higher-autonomy execution: more aggressive delegation,
### ⚪ Work Queues
-Paperclip should support queue-style work streams for repeatable inputs like support, triage, review, and backlog intake. That would make it easier to route work continuously without turning every system into a one-off workflow.
+Paperclip should support queue-style work streams for repeatable inputs like support, triage, review, and backlog intake. That would make it easier to route work continuously without turning every system into a one-off workflow. Existing decision queues group items awaiting input; this milestone concerns continuous work intake and routing.
### ⚪ Self-Organization
@@ -104,11 +134,11 @@ As companies grow, agents should be able to propose useful structural changes su
Paperclip should get better at turning completed work into reusable organizational knowledge. That includes capturing playbooks, recurring fixes, and decision patterns so future work starts from what the company has already learned.
-### ⚪ CEO Chat
+### 🟡 Agent Chat (including CEO Chat)
-We want a lighter-weight way to talk to leadership agents, but those conversations should still resolve to real work objects like plans, issues, approvals, or decisions. This should improve interaction without changing the core task-and-comments model.
+Experimental Agent Chat provides persistent conversations with any agent, including leadership. Conversations keep their history and plans, then hand execution off to linked tasks. Agent Chat is off by default. Experimental chat and email connectors provide additional entry points through configured external services; they have separate setup and access controls.
-### 🟡 Cloud deployments (multi-tenant isolation & company Import/Export shipped)
+### 🟡 Cloud deployments
Local-first remains important, but Paperclip also needs a cleaner shared deployment story. Teams should be able to run the same product in hosted or semi-hosted environments without changing the mental model.
@@ -121,7 +151,3 @@ A desktop app can make Paperclip feel more accessible and persistent for day-to-
### ⚪ Bring-your-own-ticket-system (Asana / Linear / Jira as on-ramps)
Existing ticket systems should be able to feed work into Paperclip without becoming the agent control plane themselves. Asana, Linear, and Jira can act as familiar on-ramps while Paperclip owns execution, governance, and outcomes.
-
-### ⚪ Connected Apps (one-click integrations, e.g. Vercel)
-
-Common services should connect without bespoke setup for every company. One-click integrations can package credentials, permissions, and useful workflows for apps such as Vercel while keeping access governed and auditable.
diff --git a/cli/src/commands/client/issue.ts b/cli/src/commands/client/issue.ts
index d7a5fb7b866..2e4cdf6ddc0 100644
--- a/cli/src/commands/client/issue.ts
+++ b/cli/src/commands/client/issue.ts
@@ -1314,7 +1314,7 @@ export function registerIssueCommands(program: Command): void {
addCommonClientOptions(
issue
.command("release")
- .description("Release issue back to todo and clear assignee")
+ .description("Release issue execution locks; clear the assignee only for unfinished issues")
.argument("", "Issue ID")
.action(async (issueId: string, opts: BaseClientOptions) => {
try {
diff --git a/doc/AGENT-ARTIFACTS.md b/doc/AGENT-ARTIFACTS.md
index bc2bcd6fc41..6a451b5f3f7 100644
--- a/doc/AGENT-ARTIFACTS.md
+++ b/doc/AGENT-ARTIFACTS.md
@@ -201,3 +201,27 @@ PAPERCLIP_FILE_DELIVERY_DAYTONA=1 pnpm exec vitest run server/src/__tests__/file
The live fixture deletes each sandbox before checking that its attachments
remain downloadable from Paperclip. It does not run unless explicitly enabled.
+
+## Text attachment previews
+
+In the task chat layout, select a text attachment in Artifacts, a work-product
+card, or a chat attachment chip to open a named right-side tab. Reopening the
+same attachment focuses its existing tab. Tabs can be switched and closed.
+On mobile, the same viewer opens in the task details drawer.
+
+Markdown work products keep their expandable review document, annotations,
+revision indicator, and document links. **Open in tab** is a separate action.
+Work-product cards keep **Download** as a direct original-file download.
+Text file cards provide **Open in tab** beside their existing actions. CSV cards
+keep this action before and after loading their data preview.
+
+Markdown attachments offer **Rendered** and **Raw** views. Other supported text
+files display literal text. Image references and diagram source remain inert;
+opening a preview does not load attachment-selected media URLs. The viewer
+provides a download action. Preview reads
+are limited to 512 KiB; oversized, unsupported, or unavailable files show an
+explicit fallback instead of attempting an unbounded render. A failed read can
+be retried. Workspace files continue to use the existing workspace file viewer.
+
+Storybook: **Tasks / Text file tabs** covers opening from Artifacts, Markdown,
+plain text, empty files, oversized files, missing attachments, and a narrow panel.
diff --git a/doc/DATABASE.md b/doc/DATABASE.md
index 151581873d3..3a348cbe52a 100644
--- a/doc/DATABASE.md
+++ b/doc/DATABASE.md
@@ -442,6 +442,17 @@ revokes the previous boot identity with a conditional update. Its own claim also
expires so another sweep can finish cleanup after a restart. Historical rows keep
null ownership fields and follow the previous recovery path.
+## Agent file persistence and legacy revisions
+
+Managed agent files are current filesystem contents, using the same persistent
+instance storage as other workspaces. `agent_instruction_revisions` and
+`agent_instruction_heads` are retained as read-only upgrade input. Their heads
+are adopted once into the managed directory; new saves never append revisions.
+`agent_instruction_working_copies` holds per-run baseline hashes, state, and
+capture receipts. New receipts identify `paperclip.agent-files.v1`; historical
+rows retain the instruction-only format. Completed directory runs discard their
+baseline and private copies. See [Persistent agent files](agent-files.md).
+
## Large API response snapshots
`assets.byte_size` uses PostgreSQL `bigint` so saved responses and byte ranges can
diff --git a/doc/DEVELOPING.md b/doc/DEVELOPING.md
index c830de4bcbd..679cbce721a 100644
--- a/doc/DEVELOPING.md
+++ b/doc/DEVELOPING.md
@@ -100,6 +100,17 @@ pnpm build-storybook
These run the `@paperclipai/ui` Storybook on port `6006` and build the static output to `ui/storybook-static/`.
+Use **Design explorations → Agent chat sidebar** to review the production secondary
+agent navigation. **Components** covers selection, search, loading, empty results,
+and larger teams. **Pages** puts it beside the production agent chat inside the
+real app shell, including landing, conversation, plan panel, light, and mobile
+views. The plus button opens the existing agent picker; adding an agent creates
+one sidebar entry, and choosing them again reopens the same conversation. The
+**Add and reopen** component story exercises that constraint. Agent selection
+and sending use local fixtures. The live `/chats` and `/chats/:agentRef` routes
+use the same sidebar, picker, landing page, and existing chat surface when the
+Agent Chat experimental setting is enabled.
+
Use **Chat & Comments → Issue Thread Interactions → Composer Questions Auto Advance**
to try the paged composer form. A single selection shows a brief checked-state animation before advancing to the
next question. Reduced-motion mode advances without animation.
@@ -115,6 +126,19 @@ pending card.
Use **Composer → Model and effort picker** to review harness-specific model
choices. Codex uses the curated adapter catalog unless the instance declares
`PAPERCLIP_ADAPTER_MODELS`; general OpenAI API models are not Codex choices.
+The Paperclip Runner Codex profile shows the same known model effort levels.
+Its selected effort is saved with the run and sent to Codex for each turn.
+Claude Code uses model-specific effort levels; Haiku has no effort slider.
+Grok uses its adapter's reasoning levels, including for its default model.
+Kimi shows effort only when its agent uses the CLI engine, including with its
+default model, because the default ACP engine ignores effort.
+
+Mobile entity picker sheets use a modal popover so touch scrolling stays inside
+the sheet even when it is portalled outside the new-task dialog. Run
+`pnpm exec playwright test --config tests/e2e/playwright.config.ts tests/e2e/new-task-picker-touch.spec.ts`
+to verify native touch scrolling and selection in both assignee and model lists.
+The test uses a fixed model catalog and a reduced viewport to cover limited
+space while the phone keyboard is open; it does not require a provider login.
The Storybook visual regression suite uses external PNG baselines instead of
committed screenshots:
@@ -238,6 +262,17 @@ owns committed updates.
## Hot-Restart Deploys
+During a restart, the board's health, session, and access checks retry temporary
+network/gateway failures and non-JSON API responses every five seconds. A new
+page shows **Reconnecting to Paperclip** with a **Try again** action and waits
+for startup health to become ready. Valid startup metadata remains available to
+sign-in and invitation pages. An already
+open page stays mounted during temporary background failures so unsaved edits
+survive. Successful checks resume the same route and refresh other failed reads;
+this recovery does not reload the browser or replay mutations. Authorization
+failures still require sign-in or an explicit retry. Storybook **App / Connection
+recovery** shows the startup recovery states.
+
Primary-instance rebuilds that restart `paperclip.service` can request one-shot live-run adoption instead of using the normal graceful shutdown drain. Before restarting the service, write the marker from the newly staged app with the current service PID:
```sh
diff --git a/doc/PRODUCT.md b/doc/PRODUCT.md
index 7c739557ec9..15ab6854106 100644
--- a/doc/PRODUCT.md
+++ b/doc/PRODUCT.md
@@ -66,6 +66,13 @@ The governing rule is: **skill permissions are opt-in restrictions, not opt-in c
Core Paperclip owns the skill runtime, company-boundary enforcement, policy evaluation contract, API denials, validation, path containment, secret redaction, and activity logging. Those safety invariants cannot be disabled by policy. Open-by-default skill work never authorizes arbitrary host-path reads, unsafe executable content, or policy edits: local imports and scans must stay within Paperclip-known workspace or managed-skill roots, remote sources must resolve to validated immutable content, and platform safety denials must stay distinct from optional administrative restrictions. Paperclip EE may provide detailed administration for per-agent, per-role, per-action, per-source, and protected-skill rules, but EE is not required to use skills and is not an enforcement boundary. Without EE, companies remain open by default and any already-configured restrictions continue to be enforced by core.
+GitHub repositories are first-class sources within Skills. People import selected
+skills through their existing GitHub connection and manually refresh installed
+snapshots. The source records repository, branch, path, and installed commit;
+the connection supplies caller-authorized access. Originals remain viewable and
+testable, with independent editable copies. New upstream skills require selection,
+and deselection, source disconnection, or upstream removal retains installed content.
+
An explicit restricted policy may deny selected operations or switch to a default-deny preset with explicit allow rules. Core exposes a stable versioned policy API so EE and other administrative clients configure and simulate the same evaluator used by skill mutation routes. Core Skill Studio only needs to perform normal skill work, explain an explicit denial, and point administrators to EE when its richer policy UI is available; it must not recreate a partial enterprise permission editor.
## Principles
diff --git a/doc/SPEC-implementation.md b/doc/SPEC-implementation.md
index 927e7f1a7e5..583608f242b 100644
--- a/doc/SPEC-implementation.md
+++ b/doc/SPEC-implementation.md
@@ -542,6 +542,12 @@ V1 non-terminal liveness rule:
Detailed ownership, execution, blocker, active-run watchdog, crash-recovery, and non-terminal liveness semantics are documented in `doc/execution-semantics.md`.
+For native ordinary tasks, answering a Board comment does not authorize an
+indefinite response wait when the structured result reports blocking remaining
+work. Without a recorded wait condition, reject the finish report or use the
+bounded incomplete-work recovery path. Preserve real governance and pause gates,
+conversation lifecycles, and protection against replaying superseded requests.
+
## 8.3 Approval Status
- `pending -> approved | rejected | cancelled`
@@ -622,6 +628,11 @@ rollout mode, and fails closed with the cap in the error once enforcement is
active. Writes to the run's own source issue are not counted. Assignee self-comments do not
wake the assignee, and a non-assignee comment cannot mint a mention grant.
+Agent @-mentions are context links only: they do not wake the mentioned agent,
+assign work, or forward comments to another task. Normal comment feedback still
+routes to the current assignee. Work for another agent requires explicit
+assignment, delegation, or a review request.
+
Agent-authored issue comments persist the responsible user derived from the
authenticated actor; clients cannot choose that attribution. Each comment also
records the write-policy reason, and spoof attempts fail with an audited 422.
@@ -728,8 +739,12 @@ outcomes and resolver attribution are immutable.
An explicit named agent or user addressee and a company-configured cap may narrow
the effective audience. Only the exact named addressee may resolve an addressed
-interaction; a human does not override a user addressee. A cap never widens the
-requested audience. Tool-action confirmations and
+interaction; a human does not override a user addressee. Explicit user recipients
+must exist and be authorized to respond in the issue's company before creation.
+Ordinary Agent Chat questions derive their user recipient from the persisted
+conversation owner. A conflicting explicit user recipient is rejected; IDs are
+never guessed or repaired. Ordinary task questions keep optional addressing.
+A cap never widens the requested audience. Tool-action confirmations and
other hard-governed action cards remain `human_only` (or move to the formal approval
system) regardless of a requested open audience.
@@ -978,6 +993,14 @@ Core authorization follows these rules:
- New qualifying issue activity may invalidate an archive so the item resurfaces; archival is not a substitute for resolving or closing work.
- Viewing an issue may update its per-user read receipt, but read receipts alone do not enroll the issue in Mine. Mine participation begins with a user-authored comment, issue creation/assignment, or another audited user mutation; explicit product actions such as manually running a routine may record an audited inbox touch.
+Failed-run rows in Mine and the inbox badge use the run's `responsibleUserId`.
+Another user's run does not appear there, even for a shared agent. Select the
+latest run per agent before checking ownership so older failures do not resurface.
+Unattributed runs appear only for `local-board` in Mine; an unresolved viewer
+identity shows no failed runs. All retains company-wide failed-run visibility.
+Company health alerts do not contribute to the personal inbox badge.
+Run list responses, including summaries, retain `responsibleUserId`.
+
Ownership split:
- **Core / Free:** permission key and scoped-grant enforcement; responsible-user resolution; default-open, disabled, and allowlist policy modes; archive/unarchive APIs; per-user archive persistence; resurfacing behavior; activity audit records; and stable denial codes.
@@ -1097,6 +1120,12 @@ Server behavior:
2. if updated row count is 0, return `409` with current owner/status
3. successful checkout sets `assignee_agent_id`, `status = in_progress`, and `started_at`
+`POST /issues/:issueId/release` clears checkout and execution locks. For terminal
+issues (`done` or `cancelled`), it preserves the assignee, status, and disposition
+timestamps, including on repeated release. For unfinished issues it clears the
+agent assignee; only `in_progress` changes to `todo`. Existing company access,
+assignee/run ownership checks, and the `issue.released` activity event still apply.
+
`POST /issues/:issueId/admin/force-release` is an operator recovery endpoint for stale harness locks. It requires board access to the issue company, clears checkout and execution run lock fields, and may clear the agent assignee when `clearAssignee=true` is passed. The route must write an `issue.admin_force_release` activity log entry containing the previous checkout and execution run IDs.
## 10.5 Projects
@@ -1610,7 +1639,7 @@ for persistence, migration, rendering, and integration contracts.
`enableAgentChat` is an instance experimental flag, default false. Conversation containers remain issues, unique by `(company_id, conversation_agent_id, conversation_user_id)`. The authenticated board actor supplies ownership; local trusted mode uses `local-board`. Ordinary company task access applies. A conversation's agent assignment and identity are immutable through ordinary updates; terminal status mutations are rejected.
-`GET /api/companies/:companyId/chats/:agentRef` reads an existing conversation or null. `POST` atomically resolves its issue on first send/upload. Existing issue comment, attachment, document, interaction, and run APIs apply thereafter. User chat comments require an idempotent UUID `clientRequestId`. Conversation delivery preserves comment order through the existing issue execution queue; the durable comment outbox repairs the commit-to-enqueue crash window.
+`GET /api/companies/:companyId/chats/:agentRef` reads an existing conversation or null. `POST` atomically resolves its issue when adding a chat or on first send/upload. `GET /api/companies/:companyId/chats` lists only the current board user’s conversations in that company, subject to ordinary issue read access. The Chat navigation opens a searchable secondary sidebar with agent avatars and a picker for starting or reopening the same per-agent conversation. Existing issue comment, attachment, document, interaction, and run APIs apply thereafter. User chat comments require an idempotent UUID `clientRequestId`. Conversation delivery preserves comment order through the existing issue execution queue; the durable comment outbox repairs the commit-to-enqueue crash window.
The server owns conversation state: `waiting` plus `in_review` denotes a healthy idle conversation, and `active` denotes an unanswered or executing turn. Successful replies settle a turn; they do not finish the issue. Idle containers are excluded from execution-work counts, ordinary task lists, timer work, and recovery invocations. Failed/unanswered turns retain normal handling. Child completion never wakes or completes the conversation. Search and direct task access preserve history.
@@ -1647,6 +1676,12 @@ harness/model routing and fails closed without ambient credential fallback.
Legacy agents retain their authentication until validated adoption. See
[AI Connections](connections/AI-CONNECTIONS.md) for company isolation, compatible
methods, lifecycle, runtime enforcement, and migration details.
+
+Provider login failures create a provider-specific Connections card on the task
+when the run fails, before generic recovery retries. Reconnect preserves account
+identity and permissions. Compatible legacy agents may explicitly adopt a
+validated connection inline; late failures must not invalidate newer credentials.
+
### Experimental task-bound email
AgentMail channel connections extend the experimental conversation/task pipeline
@@ -1709,21 +1744,27 @@ dismissal retries after withdrawal while rejecting caller-invented IDs. It
stores no announcement content, account data or interaction events.
See [Announcements](ANNOUNCEMENTS.md) for API and publishing details.
-### Personal keyboard shortcut preference
+### Keyboard shortcuts
-Keyboard shortcuts are off by default and are enabled in Settings → Profile.
-The preference is stored on the signed-in user, applies across companies and
-devices, and does not require instance administrator access. The local trusted
-board user has the same preference. `GET /api/auth/preferences` returns only the
-current board user's preference. `PATCH /api/auth/preferences` updates only that
-user and requires an accessible `companyId` for the activity log, including viewer
-memberships. The preference and audit record commit in one transaction. Both
-requests require `expectedUserId` (GET query parameter or PATCH body) matching
-the authenticated actor, so a cookie change cannot mix accounts in the cache.
-Agents cannot
-read or change these preferences. The legacy instance general setting is retained
-for API compatibility but no longer controls shortcut behavior in the app;
-users opt in individually after the upgrade.
+Keyboard shortcuts are always enabled for every signed-in user. There is no
+instance setting and no personal preference that turns them off.
+
+### Persistent managed agent files (2026-09-28)
+
+The Instructions Editor and agent execution share one current agent-owned
+directory, scoped by company and agent. The configured instruction entry is one
+file in this directory. Registered private copies synchronize supported files
+across tasks and sessions, separately from task workspace persistence. Saves
+require verified provider stop and current authorization, then synchronize changed
+files using per-file last-sync-wins;
+new content is not stored as revision history. Existing deployed revisions and
+saved execution formats remain compatible during adoption. See
+[Persistent agent files](agent-files.md).
+
+Persistent-file storage limits are advisory for execution: a full folder cannot
+pause the agent, fail its run, or prevent later runs. Show a warning on each run
+while storage remains full, restore existing files so the agent can remove them,
+and enforce the limits on saves. Cleanup clears the warning for future runs.
### Unsafe native workspace exports
@@ -1736,3 +1777,67 @@ omit the already-rejected export, clear stale repair notices, and finalize the
accepted result without another provider turn, even when its old sandbox is
unavailable. Preserve current ownership and newer-work fences. See
`native-workspace-finalization-recovery.md`.
+
+## GitHub-synced skill sources
+
+- Discovery supports opt-in `Accept: application/x-ndjson` on the existing discovery
+ endpoint. Progress events report connection/download/tree/package stages, checked skill
+ counts, and the current package's file counts; candidate events contain metadata,
+ never file contents. Only the final `complete` event makes the scan selectable.
+ Interrupted streams discard partial results, and cancellation stops further
+ provider reads. The default JSON API remains compatible. The import dialog uses
+ reduced-motion-aware animations and shows indeterminate progress while saving
+ complete packages, without inventing completion percentages.
+
+- Sources and entries are company-scoped. Reuse GitHub connection grants and credential
+ refresh; every provider read authorizes the current caller. Saved connection IDs do
+ not confer access to another user's token. Agent reads use managed run identities.
+- The import picker searches the deduplicated union of repositories from all connections
+ the caller can access, automatically choosing an authorized connection. Adding accounts
+ uses the standard GitHub setup in Apps and retains the import draft. Repository URLs
+ use the default branch; `/tree/` URLs select a branch, including slash-containing
+ names, without a separate branch or credential selector. Pasted URLs also prefer
+ the caller's eligible GitHub connections, including for public repositories;
+ anonymous access is used when no authorized connection succeeds. An explicitly
+ saved connection must remain authorized. Repository identity still comes from
+ the GitHub API; quota errors are distinct from access denials.
+- Discover every `SKILL.md`, including hidden/deep directories. Resolve the tracking
+ ref to an immutable commit once per operation through a shallow Git fetch. Read
+ the complete local Git tree and blobs without checkout, archive transformations,
+ or per-file API calls. Git's receiving/preparing percentages feed download progress.
+ Git must be installed on the server. Downloads are bounded to 128 MiB and three
+ minutes, with two simultaneous downloads and at most four cached/downloading
+ snapshots. A ten-minute in-memory index of temporary repositories, scoped by
+ company, caller, run, and grant, reuses a pinned snapshot for preview/import;
+ authorization is checked before every reuse. No credentials are written to disk
+ or inherited from host Git configuration. Cancellation terminates the Git process
+ group and removes incomplete downloads. Symlinks and submodules are reported,
+ never traversed; nested skill roots are independent package boundaries.
+- Select packages as units, with included-file trees and bounded read-only previews.
+ Nested packages have independent checkboxes; supporting files have no individual
+ selection. Persist file manifests, explicit missing/out-of-package reference findings,
+ and declared `compatibility` requirements with source entries. Preview reads reauthorize
+ the current caller and audit the requested package at the scanned immutable commit;
+ discovery and source metadata contain no file contents. Reference checks are advisory,
+ do not establish complete runtime dependencies, and never expand package boundaries.
+- Stage and audit complete packages before publishing. Scripts are allowed through
+ the existing content audit and never run on import. Persist binary bytes and executable
+ flags in immutable version inventories (legacy entries default to UTF-8/non-executable).
+- Refresh is serialized per source, checks saved selection revisions, and publishes
+ valid skills plus per-entry outcomes with required activity records in one transaction.
+ Failed packages retain prior versions; access/scan/download failures retain all content.
+ Record attempted and successful refresh times separately.
+- Match by repository identity and exact path. Preserve IDs, keys, assignments, folders,
+ and history. New key collisions cannot overwrite unrelated skills. Only changed package
+ bytes or executable modes create versions. Library reads, tests, and subsequent unpinned
+ runs use local installed snapshots; pinned/active runs retain their versions.
+- Additions require reviewed selection, with new candidates checked by default and
+ explicit folder exclusions retained. Upstream deletion keeps installed content with
+ removed status; moves are removal plus discovery. Deselect/disconnect retains content
+ and assignments. Originals are read-only, with the existing independent fork workflow.
+- Adopt recognizable existing GitHub imports without provider calls or content changes;
+ resolve missing repository IDs and full snapshots on successful refresh. Exclude bundled,
+ catalog, local/project, skills.sh, and unsupported hosts. Existing GitHub import and update
+ endpoints delegate to sources while retaining response shapes.
+- GitHub.com, manual refresh only. No upstream editing, polling, webhook sync, commits,
+ or pull-request creation in this milestone.
diff --git a/doc/SPEC.md b/doc/SPEC.md
index 3e5fa410fe6..5104a39ab60 100644
--- a/doc/SPEC.md
+++ b/doc/SPEC.md
@@ -34,6 +34,11 @@ human approval, decline, or scoped remembered permission. Connections and task
views resolve the same review, and the agent continues with the server-recorded
outcome. See [the implementation contract](SPEC-implementation.md#124-connection-tool-reviews).
+Model authentication failures also surface a provider-specific Connections card
+on the task immediately after failure. Users can reconnect inline and resume;
+legacy agents keep their authentication until an explicit, validated adoption.
+See [AI Connections](connections/AI-CONNECTIONS.md).
+
#### Board Powers (Always Available)
The Board has **unrestricted access** to the entire system at all times:
@@ -47,6 +52,11 @@ The Board has **unrestricted access** to the entire system at all times:
The Board is not just an approval gate — it's a live control surface. The human can intervene at any level at any time.
+A Board status inquiry does not itself pause unfinished task execution. Native
+ordinary tasks that report blocking remaining work must continue, register a
+real wait, or surface a bounded recovery failure. Recorded approvals, questions,
+dependencies, and pauses remain authoritative; obsolete requests must not replay.
+
#### Budget Delegation
The Board sets Company-level budgets. The CEO can set budgets for Agents below them, and every manager Agent can do the same for their reports. How this cascading budget delegation works in practice is TBD, but the permission structure supports it. The Board can manually override any budget at any level.
@@ -277,11 +287,20 @@ All agent communication flows through the **task system**.
There is no separate messaging or chat system. Tasks are the communication channel. This keeps all context attached to the work it relates to and creates a natural audit trail.
-Experimental Agent Chat presents one persistent task per person and agent as a simplified conversation. It retains the task composer, transcript, tools, attachments, documents, and existing Subtasks panel, with ordinary company visibility. New execution tasks are ordinary project tasks, not children of the conversation. 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`.
+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 ordinary company visibility. New execution tasks are ordinary project tasks, not children of the conversation. 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`.
+
+### Question recipients
+
+Ordinary Agent Chat questions use the server-owned conversation recipient.
+Task questions may optionally name a particular user or agent. Explicit user
+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.
+
### Implications
- An agent's "inbox" is: tasks assigned to them + comments on tasks they're involved in
+- A human's Mine inbox and its badge include failed runs attributed to that human, not another user's runs. All retains company-wide failure visibility. Historical unattributed runs remain in the local single-user board's Mine view; see `SPEC-implementation.md` for the routing contract.
- The CEO delegates by creating tasks assigned to the CTO
- The CTO breaks those down into sub-tasks assigned to engineers
- Discussion happens in task comments, not a side channel
@@ -414,6 +433,13 @@ Tasks use **single assignment** (one agent per task) with **atomic checkout**:
No optimistic locking or CRDTs needed. The single-assignment model + atomic checkout prevents conflicts at the design level.
+Agent @-mentions provide context without waking agents or changing task ownership. New work requires explicit assignment, delegation, or a review request; ordinary issue comments can still wake the current assignee.
+
+Releasing a terminal task clears execution locks while preserving its assigned
+owner and final status. Assignment remains part of the work history after Done
+or Cancelled. Releasing unfinished work still relinquishes the agent assignment;
+only an active `in_progress` task returns to `todo`.
+
### Human in the Loop
Agents can create tasks assigned to humans. The board member (or any human with access) can complete these tasks through the UI.
@@ -604,21 +630,22 @@ title matches lead; current conversation and document content supplies supportin
evidence. See [Task search relevance](SEARCH.md) for the evaluation rubric,
matching contract and reproducible quality tests.
-### Personal keyboard shortcut preference
+### Keyboard shortcuts
-Keyboard shortcuts are off by default and are enabled in Settings → Profile.
-The preference is stored on the signed-in user, applies across companies and
-devices, and does not require instance administrator access. The local trusted
-board user has the same preference. `GET /api/auth/preferences` returns only the
-current board user's preference. `PATCH /api/auth/preferences` updates only that
-user and requires an accessible `companyId` for the activity log, including viewer
-memberships. The preference and audit record commit in one transaction. Both
-requests require `expectedUserId` (GET query parameter or PATCH body) matching
-the authenticated actor, so a cookie change cannot mix accounts in the cache.
-Agents cannot
-read or change these preferences. The legacy instance general setting is retained
-for API compatibility but no longer controls shortcut behavior in the app;
-users opt in individually after the upgrade.
+Keyboard shortcuts are always enabled for every signed-in user. There is no
+instance setting and no personal preference that turns them off.
+
+Managed agents own a persistent file directory across tasks and sessions. The
+Instructions Editor and stopped agent execution synchronize the same current
+files, including AGENTS.md and its supporting files. Task working directories and
+provider home directories remain separate concepts. Concurrent runs synchronize only
+the files they change, with the last sync winning for the same file. Temporary
+copies are cleaned up; this storage does not add a revision-history system. See
+[agent-files.md](agent-files.md) for lifecycle and upgrade compatibility.
+
+Full agent storage produces a run warning without stopping current or future
+work. Storage limits constrain saved file changes, not the agent's ability to run
+and remove files to recover space.
### Unsafe native workspace exports
@@ -631,3 +658,15 @@ omit the already-rejected export, clear stale repair notices, and finalize the
accepted result without another provider turn, even when its old sandbox is
unavailable. Preserve current ownership and newer-work fences. See
`native-workspace-finalization-recovery.md`.
+
+### Git-backed skill library sources
+
+Repositories can supply read-only company skills independently of project repositories.
+A source tracks repository identity, branch, selected paths, and installed commits;
+an existing GitHub connection supplies caller-authorized reads. Manual refresh publishes
+complete local immutable versions, preserving skill identity and assignments. Selection
+operates on whole skill packages, with inspectable included files, declared runtime
+requirements, and advisory warnings for missing or external references. New
+upstream skills require reviewed selection; removed or deselected skills remain
+installed. Editing starts with an independent copy. Write-back and PR publication
+are a later milestone; exact path and commit provenance provide their base.
diff --git a/doc/agent-files.md b/doc/agent-files.md
new file mode 100644
index 00000000000..187323d2d73
--- /dev/null
+++ b/doc/agent-files.md
@@ -0,0 +1,199 @@
+# Persistent agent files
+
+Each managed agent has one current directory, scoped by company and agent. The
+Instructions Editor reads and writes this directory. `AGENTS.md` (or the
+configured entry) is one file in it. Agents may create ordinary files and nested
+folders for notes, memory, and other personal working material. Files in the
+task working directory remain task files.
+
+Agents can edit their own managed files under the responsible user’s current
+target permissions. Access to another agent’s files additionally requires the
+caller’s own target-scoped configuration permission; shared company membership
+or a responsible user alone does not grant peer access.
+
+## Layout
+
+The canonical host directory keeps its existing physical location:
+
+```
+/companies//agents//
+ instructions/ current agent files (editor)
+ AGENTS.md
+ notes/
+ any-supported-file
+ file-sync/ controller-only operational state
+ adopted.json
+ canonical-manifest.json metadata/hash cache, no file contents
+ runs//
+ owner.json current run owning the writable copy
+ live/ writable copy for the provider lifetime
+```
+
+The process starts in its existing task workspace. `AGENT_HOME` points to the
+registered writable agent copy. Adapter `HOME` and `CODEX_HOME` keep their
+existing meanings and are not personal-file storage. Local copies are outside
+the task workspace. Remote providers currently confine file sync to their
+workspace: their independent agent copy therefore lives under the excluded
+`.paperclip-runtime/agent-files///` area. It is not included in task
+workspace sync, Git staging, or task deliverables.
+
+Regular files (including binary bytes) and directories are supported, up to
+100,000 entries (files and folders), 256 MiB per file and 2 GiB total. Symlinks,
+hardlinks, and special
+files are rejected, rather than followed or silently skipped. The instruction
+entry remains valid UTF-8, at most 1 MiB, and cannot be deleted. The editor edits
+text up to 1 MiB and offers downloads for binary or larger files. The reserved
+`.paperclip-runtime` directory and the compatibility-only virtual file
+`promptTemplate.legacy.md` are not user storage. Task cache and Git ignore
+exclusions do not apply to this directory.
+
+These storage limits are separate from the 1 MiB instruction/editor limit. Large
+files are hashed and downloaded as streams; listings bound concurrent reads,
+and only editor-sized text is buffered. Storage counts uncompressed file bytes,
+not allocated disk
+blocks. These are sync validation limits, not live filesystem quotas: an agent
+can write beyond them while running. Storage limits never pause an agent, fail
+a provider run, or block future task admission. A folder at or above a limit
+produces a warning on each run until enough files have been removed or shrunk.
+Existing saved files are restored even when already over quota, so the agent
+can continue working and clean them up with ordinary filesystem tools. Unsafe
+paths and links still fail validation; bypassing a storage quota does not
+bypass those checks.
+
+An API save above a storage limit returns 422 without changing the saved files.
+If a stopped run exceeds a storage limit, none of its agent-folder changes are
+saved. The run shows a nonblocking storage warning and its save receipt reports
+`AGENT_FILES_LIMIT_EXCEEDED` with the specific limit
+and, for an oversized file, its path. The previous saved folder is used on the
+next run. The temporary run copy is discarded, including on a limit failure;
+there is no retained recovery archive or partial-save option. Transient sync
+failures get up to three attempts at the stop boundary before cleanup and an
+explicit failure receipt. Individual file writes are atomic, but an I/O failure
+partway through a sync can leave some files updated; a failed receipt does not
+claim whole-folder success.
+
+Sync failures are diagnostics for the affected run, not errors on the current
+files in the Instructions Editor. Historical failures remain in the run log;
+the run detail also shows warnings from its save receipt. The editor only shows
+preserved instruction-only candidates that may need review, alongside errors
+from the current browser edit. Later successful saves do not erase run history.
+
+Initial restoration copies the canonical folder once. Warm native Codex turns
+reuse that working directory. Checkpoints enumerate file metadata, hash files
+whose identity/size/mode/mtime/ctime changed, and temporarily copy and transfer
+only changed file contents. Deletions and empty directories travel as manifest
+entries. An unchanged image is neither rehashed nor recopied after its first
+checkpoint. A modified file is transferred in full; this is a file-level delta,
+not block-level deduplication. Canonical hash caches and manifests contain no
+file contents. Temporary checkpoint payloads are removed after application.
+The operator still provisions storage for the canonical folders, active working
+copies and changed-file payloads; these are not aggregate disk quotas.
+
+## Run lifecycle
+
+1. Under the agent lock, restore current files into a private run copy and save
+ a baseline of paths, kinds, modes, and hashes. This is sync metadata, not a
+ revision history.
+2. Stage the copy through the existing workspace transport. Point `AGENT_HOME`
+ and instruction guidance at that registered root.
+3. For warm native Codex, capture a manifest and changed-file payload at each
+ terminal turn boundary before admitting another turn. Check file metadata
+ before and after streaming and hash the captured payload independently on
+ the host. Retry an unstable checkpoint up to three times; if it cannot be
+ validated, close the owned provider and perform the stopped collector. Other
+ execution paths retain their stopped-provider collection boundary.
+4. Recheck the responsible user's current authorization. Under the same agent
+ lock used by editor writes, apply only files changed or deleted relative to
+ the last acknowledged baseline. For a competing edit or deletion of the same
+ file, the last synchronization to acquire the lock wins. Unchanged files do
+ not overwrite another run's changes; newly added unrelated files survive.
+5. Record the save receipt and advance the baseline only after application. A
+ warm session keeps its directory and hands ownership to the next run using
+ a controller-owned marker. Old callbacks cannot collect or remove the next
+ owner's files. On session retirement, collect any later writes and remove
+ the private directory. No per-run file versions or conflict copies accumulate.
+
+These are validated **per-file checkpoints**, not an atomic snapshot of arbitrary
+background writers across an entire directory. Writes after a checkpoint remain
+pending until the next checkpoint or verified session retirement. A save receipt
+acknowledges only the captured bytes. Lost remote bytes or missing stop proof
+cannot become a successful save.
+
+Warm reuse requires the actual live session, the same remote environment and
+provider lease, and unchanged canonical files since its last checkpoint. An
+editor or another task changing canonical files retires that session before a
+fresh copy is restored. A directory-path mismatch also forces retirement. Only
+the loaded instruction entry participates in the runtime instruction digest;
+ordinary memory/image edits do not change it. Changes to loaded instructions,
+policy, credentials or provider configuration may still replace the process.
+Relative supporting files are read from `AGENT_HOME`, not the read-only prompt
+snapshot. External instruction bundles remain read-only and use their existing
+lifecycle.
+
+The editor supplies the hash of the file it read. A stale browser save returns
+409 and retains the user's unsaved draft. Run synchronization itself uses
+per-file last-sync-wins: a later run can overwrite a saved browser edit to the
+same file. There is no text merge or historical copy to recover the overwritten
+version. Ordinary task files continue using their existing workspace contract.
+
+## Upgrade and recovery
+
+Migration 0287 creates the preview tables idempotently after master’s 0285/0286.
+Existing preview receipts, rows, constraints, and pending captures are retained.
+On first use, while holding
+the agent row lock, import any deployed revision heads into the existing managed
+directory once. A controller-owned marker outside agent files prevents any
+later replay of those heads. Existing revision rows remain readable for recovery;
+new saves never append to them. Old UUID-based clients receive content tokens
+and can still submit their previously recorded revision IDs, which are checked
+against the corresponding bytes before a write.
+
+Working-copy receipts and native runtime inputs record the new file contract.
+A restored native session with no contract field keeps the old instruction-only
+copy shape, prompt digest, paths, and collector. Its writes use the compatibility
+bridge into current files, with the original baseline fence. Existing pending
+legacy candidates remain resolvable. Neither old task workspaces nor arbitrary
+external instruction roots are imported as agent directories.
+
+Stock-agent and plugin resets update their declared files while retaining unrelated
+personal files and formerly configured entries. Automatic stock upgrades first
+record baseline hashes in the existing resource binding, then apply and finalize
+under the agent lock. A failed file write or database commit retries against
+those hashes and already-applied bytes. Removed, unchanged stock files are
+removed; intervening personal edits stop the retry. This pending operation
+metadata is cleared on success and does not retain file revisions.
+
+External bundles retain their existing behavior. Their migration to managed
+storage is an explicit configuration action. Historical task cwd, provider-home,
+checkpoint, and workspace restoration formats are not rewritten.
+
+Backups must include the persistent instance filesystem as well as the database.
+New current-file bytes are not database revision rows. Old instruction-only
+candidates are retained solely for upgrade compatibility.
+
+Crash recovery can collect a stopped working copy without starting a model.
+Missing stop proof or lost remote bytes produce a visible diagnostic, never a
+save receipt. An interrupted apply can replay its changed files with the same
+last-sync-wins rule. Cleanup resumes for terminal runs; no copy is retained as
+an archive after cleanup succeeds.
+
+## Verification
+
+`agent-directory-working-copies.test.ts` exercises nested/binary files, directory
+isolation, last-sync-wins edits and deletions, terminal cleanup, link rejection, old-head
+adoption, and stable prompt digests. The legacy working-copy and native-tool
+suites exercise compatibility. Workspace merge tests exercise preflight and
+interrupted replay.
+
+The explicit Product E2E `instruction-persistence` suite creates a file through
+the browser editor, runs an agent that changes instructions and supporting files,
+checks exact binary bytes via the public download route, restarts the server,
+and asks a fresh task to prove restored contents using an independent nonce. A
+third task edits its entry while the browser saves that same file; the later
+run sync wins while a separate browser-created file survives, with no conflict
+candidate or manual resolution. Three more tasks save a sparse file at its
+256 MiB boundary, exceed that boundary with a nonfatal save rejection, then
+remove it and save a new small file. All tasks must succeed, with warnings
+visible in run details while full and cleared after cleanup.
+Run results, including unavailable credentials, must be reported separately from
+unit or matcher results; a passing matcher does not prove a live run.
diff --git a/doc/agent-instruction-revisions.md b/doc/agent-instruction-revisions.md
new file mode 100644
index 00000000000..d4512d68678
--- /dev/null
+++ b/doc/agent-instruction-revisions.md
@@ -0,0 +1,15 @@
+# Legacy instruction revision compatibility
+
+The revision-based design in the first version of PR #14325 has been superseded
+by [persistent agent files](agent-files.md). Current managed files are authoritative;
+new edits do not create revision or head rows.
+
+Published migrations 0285 and 0286 and existing revision records are retained so
+preview installations and saved sessions can upgrade safely. Old heads are
+adopted once. Legacy collectors and UUID-based APIs compare their baseline bytes
+against current files before writing. Read-only history and restore endpoints
+remain for pre-upgrade records; they are not advertised as new agent capabilities
+or shown as a history feature in the current file editor.
+
+See the current document for directory layout, synchronization, conflicts,
+authorization, recovery, and verification.
diff --git a/doc/architecture/native-status-arbitration.md b/doc/architecture/native-status-arbitration.md
index cd8732da701..f56014fa5b0 100644
--- a/doc/architecture/native-status-arbitration.md
+++ b/doc/architecture/native-status-arbitration.md
@@ -142,6 +142,7 @@ conditions before model disposition:
| Runner reports a task-wide blocker | `blocked` | Persist blocker owner and unblock action |
| Runner reports a current-track blocker | `in_progress` | Enqueue another productive track |
| Runner reports `yielded` with a valid continuation | `in_progress` | Enqueue the declared continuation |
+| Ordinary task reports `response_wake` and blocking remaining work, without a real wait | `in_progress` | Use the bounded incomplete-work continuation, then a visible recovery error if repair was already used |
| Completion evidence is incomplete and continuation is forbidden | Preserve | Record a finalization error and named next action |
| Completion evidence is otherwise incomplete | `in_progress` | Enqueue a bounded, idempotent continuation |
@@ -155,6 +156,21 @@ The output is a `NativeStatusDecision` containing:
The pure arbiter performs no database or network writes.
+A response to a Board comment does not by itself justify parking unfinished
+work. When a `yielded` / `response_wake` result contains
+`remainingWork[].blocksCompletion: true`, `paperclip_finish` rejects the report
+unless a real wait owns the next action. The agent can correct it in the same
+turn. Finalization also checks accepted reports and uses the existing
+`native-completion-incomplete` one-follow-up budget. Model-selected retry keys
+cannot reset that budget. Pending interactions, approvals, dependencies, pause
+holds, and conversation lifecycles retain their authority.
+
+The current Board source is rechecked in the status transaction before a repair
+is queued. Edited, deleted, or superseded comments do not authorize replay of an
+old response. Recovery no longer treats an old committed passive wait as healthy
+when its report admits blocking work and its Board source is still current.
+Existing recovery gates continue to protect pauses, budgets, and ownership.
+
## Transactional decision commit
`commitNativeStatusDecision()` applies the decision against authoritative issue
diff --git a/doc/architecture/runner-rich-acp-capabilities.md b/doc/architecture/runner-rich-acp-capabilities.md
new file mode 100644
index 00000000000..54467eaa033
--- /dev/null
+++ b/doc/architecture/runner-rich-acp-capabilities.md
@@ -0,0 +1,592 @@
+# Rich ACP integration and qualification report
+
+Updated: 2026-09-29. Base: `c65fc9e3c81c41aafe421aa90a00514b84343285`.
+Mainline integration: `3ca196b0a642aa21b8feba1fcd89edb53d1c622e`.
+Status: implementation is split into a shared foundation and three provider PRs.
+Provider review and qualification remain separate from foundation acceptance.
+All three new profiles remain **pending qualification**. Cursor passed all five
+local semantic Product E2E cases. Copilot passed completion, file validation,
+plan approval and controller restart; its question case failed the required final
+marker. Pi passed completion, file validation and semantic question continuation,
+plus real native denial, active steering and queued follow-up probes on v2/v3/v4.
+Pi completion/file/question passes retain their v2/v3 identities. The latest
+Pi candidate is profile v5 with a patched dependency closure; its paid native
+control probe passed, but its Product qualification remains blocked. Copilot
+passed real native denial and detached-command settlement probes. Failed attempts remain in the evidence;
+no Daytona resources have been started. This report does not certify a provider
+from its ACP listing or a partial run.
+
+The [harness priorities report](https://pages.paperclip.ing/2026-09-25-harness-priorities/)
+recommends Cursor and Copilot, followed by Pi, using the existing qualified ACPX
+path. Codex app-server is the richness benchmark. The legacy Cursor and Pi
+adapters are outside this change.
+
+## Branches and evidence ownership
+
+| Branch | Deliverable |
+| --- | --- |
+| [`codex/runner-rich-acp` / #14430](https://github.com/paperclipai/paperclip/pull/14430) | Shared ACPX extension boundary, durable permissions, canonical display events, provider pack infrastructure, configuration and UI |
+| [`codex/runner-cursor-acp` / #14435](https://github.com/paperclipai/paperclip/pull/14435) | Cursor native distribution, questions/plans, child activity, policy admission, wire fixtures |
+| [`codex/runner-copilot-acp` / #14434](https://github.com/paperclipai/paperclip/pull/14434) | Copilot native distribution, event inventory/projections, permission and settlement probes |
+| [`codex/runner-pi-acp` / #14436](https://github.com/paperclipai/paperclip/pull/14436) | Patched wrapper, owned extension, MCP/tools, permissions/input, portable dependency closure |
+| [`codex/rich-acp-extended-harness-evals` / evals #29](https://github.com/paperclipai/paperclip-evals/pull/29) | Explicit 21-cell Runner Eval campaign, semantic assertions, provenance and fail-closed budget accounting |
+
+The provider branches were implemented in parallel from the foundation. Final
+shared registration and packaging conflicts are resolved in dependency order:
+foundation → Cursor → Copilot → Pi. They remain four separate worktrees and PR
+review units; the later PR bases include their prerequisite providers. Foundation
+acceptance requires Apex review and CI to pass. Provider PRs remain unmerged
+pending qualification. Source reports on the provider branches are
+`doc/architecture/runner-cursor-capabilities.md`,
+`doc/architecture/runner-copilot-capabilities.md`, and
+`doc/architecture/runner-pi-capabilities.md`. Those reports retain versioned
+source references, per-field dispositions, fixture paths, and narrower claims.
+The Copilot inventory enumerates all 150 pinned native event types. Read the
+[Cursor inventory](https://github.com/paperclipai/paperclip/blob/codex/runner-cursor-acp/doc/architecture/runner-cursor-capabilities.md),
+[Copilot inventory](https://github.com/paperclipai/paperclip/blob/codex/runner-copilot-acp/doc/architecture/runner-copilot-capabilities.md),
+and [Pi inventory](https://github.com/paperclipai/paperclip/blob/codex/runner-pi-acp/doc/architecture/runner-pi-capabilities.md)
+for the complete per-provider source audit.
+
+[Retained browser evidence](../../ui/storybook/fixtures/evidence/rich-acp-browser-proof.darwin-arm64.json)
+records the production renderer's full native plan, accept/reject/cancel,
+single/multiple selection, typed input and activity-details checks. Its Cursor
+transport is a canonical fixture, not a paid provider session. The browser
+renders a 99,724-character plan and verifies its final paragraph before approval.
+The JSON records screenshot hashes; screenshots remain outside the source tree.
+
+## Capability matrix
+
+“Candidate” means implemented or observed in deterministic tests. It does not
+mean the required paid local and Daytona product cases have passed. “Not exposed”
+means the pinned interface was inspected; “unverified” is a separate finding.
+Codex's row is the existing app-server integration, not the Codex ACP bridge.
+
+The provider reports above are the method/event and field inventories. In the
+table below, a method that is absent from a pinned implementation is distinct
+from an exposed method with no Paperclip control. Shared surfaces and their
+deterministic evidence are mapped separately after the comparison.
+
+| Capability | Codex app-server benchmark | Cursor ACP candidate | Copilot ACP candidate | Pi ACP candidate |
+| --- | --- | --- | --- | --- |
+| Exact model | Selected and reported model | Explicit ID required; exact echo, paid semantic protocol and five local semantic product cases passed | Explicit ID required; exact `gpt-5.6-luna` echo, paid semantic protocol and local completion/file/plan/restart passed | Exact `openrouter/deepseek/deepseek-v4-flash-0731`; model echo and v2/v3 paid Product completion/file/question cases passed; v5 native controls passed |
+| Text and tools | Typed thread/turn/item events | Standard ACP updates; child activity kept separate | Standard ACP plus opt-in native session events | Wrapper text/tool updates and owned tool gates |
+| Active steering | Dedicated `turn/steer` | Concurrent prompt replaces/cancels, so it is not steering | Concurrent prompt replaces/cancels, so it is not steering | Owned `pi/steer` requires handshake, exact active turn and acknowledgment; real active-turn probe passed |
+| Queued follow-up | Product continuation controls | Controller can schedule a later prompt; native queue not established | Native pending-message activity exists; no qualified ACP queue responder | Owned `pi/follow_up`, separately named and ordered; real queued marker followed the steered current response |
+| Cancellation | Typed interrupt and process lifecycle | ACP cancel; paid command cleanup pending | ACP cancel; bounded live detached-command settlement and cleanup passed | Native abort; wrapper waits for `agent_settled` and treats provider errors as failure |
+| Session continuity | Read/load/history/fork and durable identity | Session load/list observed; paid semantic warm continuation passed; native history replay unverified and fork absent in tested methods | Session load plus native history events; semantic pending-question controller recovery passed | Private Pi JSONL mapping/load; native RPC `fork`, `clone`, `get_fork_messages` are not mapped through this ACP wrapper; unresolved UI promises cannot survive provider death |
+| Questions | Typed input requests and response correlation | `cursor/ask_question`, option identity and multiple selection preserved | Native ask-user capability exists, but pinned ACP does not wire its responder; do not display a false answerable form | `select`, `confirm`, `input`, `editor` through typed form elicitation |
+| Permissions | Durable typed approvals | Standard ACP permission options; denied shell write had no observed side effects; separately labeled exact-correlation assessment | Standard ACP; real native reject_once prevented marker creation; session decision scope inspected | Native pre-tool gate; allow once, exact-operation session grant, deny; paths rechecked after wait |
+| Plans | Typed plan and collaboration mode | `cursor/create_plan` includes full plan and revision-bound accept/reject/cancel; todo activity separate | Native plan events displayed; native plan-decision callback not exposed in ACP | No native structured plan event; authenticated Paperclip planning tools available |
+| Authenticated tools | Runner bridge and governed operations | ACP HTTP MCP binding; paid context/history reads passed | ACP HTTP MCP binding; paid context read passed | Owned extension registers exact bound MCP tools; four authenticated semantic reads succeeded in a paid partial run; no ambient servers |
+| Delegation | Typed agent roles and lifecycle | Opt-in subagent lifecycle, nested ownership and bounded child activity; never parent transcript flattening | Native delegation/session events projected with role/model/agent provenance | No built-in ACP delegation protocol; arbitrary extensions are excluded |
+| Files/diffs | Typed file changes and artifact references | Standard tool changes plus validated image references | File/workspace events retained; provider session files are not silently treated as task files | Wrapper-retained read/write/edit diffs; common typed/UI projection remains partial; semantic artifact tools |
+| Images/artifacts | Typed references and registered work products | Existing contained files only, provenance, `registered:false` | Contained task references only; external/session-store paths become descriptive notices | Image/resource tool blocks preserved by wrapper; dedicated artifact channel absent |
+| Image/attachment input | Typed input conversion | ACP advertises images, but the runner turn converter currently forwards text only | ACP advertises images/embedded context, but the runner turn converter currently forwards text only | Native Pi/ACP image input exists, but the runner turn converter currently forwards text only |
+| Usage | Per-request receipt and model context | Pinned ACP omitted receipts on denied and successful turns; account UI confirms included usage separately | ACP/native tokens retained; account UI confirms included credits separately, without a per-run USD receipt | Assistant-message and compaction token receipts; dollar cost is a catalog pricing estimate, never authoritative billing |
+| Config/model changes | Typed configurable controls | Known modes/model interfaces researched; runtime policy cannot be changed by a display event | Model/reasoning/mode options exist; runtime policy remains authoritative | Exact pinned candidate model; arbitrary slash commands/config/extensions disabled |
+| Reconnect/restart | Durable controller replay and qualified provider restoration | Semantic pending question survived a real controller restart; exact native callback restoration remains unverified | Semantic pending question survived controller restart with the same interaction and provider session; native callback restoration remains unverified | Wrapper explicitly advertises live-process-only pending-input recovery |
+
+| Shared capability | User-visible surface | Inspectable implementation / deterministic evidence |
+| --- | --- | --- |
+| Text, tools and child activity | Task transcript; bounded activity details preserve provider/session/tool attribution | `src/drivers/acpx/codex-runtime-adapter.test.ts`, `runner/crates/runner-core/tests/acpx_rich_events.rs`, `ui/src/components/task-chat/TaskChatProtocolActivityRow.test.tsx` |
+| Native questions and permissions | Existing question/confirmation cards; only offered decisions can be submitted | `src/protocol/permission-request.test.ts`, `src/drivers/acpx/acp-permission-adapter.test.ts`, `server/src/services/native-runtime/native-question-bridge.test.ts`, `ui/src/components/task-chat/TaskChatProtocolCard.test.tsx` |
+| Native plan decisions | Full plan description followed by a revision-bound decision; no implicit plan acceptance | Cursor provider fixtures; `ui/storybook/fixtures/evidence/rich-acp-browser-proof.darwin-arm64.json` records the real renderer with a canonical fixture |
+| Active steering and queued follow-up | Existing active-turn control where a bound method is negotiated; no native Pi queue selector yet | `src/drivers/acpx/turn-controls.test.ts`; provider reports state which wire method is absent or not surfaced |
+| Files, diffs and images | Workspace file/artifact cards plus contained provider reference notices; raw provider diffs are still partial | `src/drivers/acpx/profile-extensions.test.ts`; provider field audits; Product `file-edit-validate` uses an independent exact-byte oracle |
+| Usage and model identity | Exact configured model, per-provider token/accounting fields, explicit incomplete cost coverage | `src/drivers/acpx/usage-accounting.test.ts`, `src/cli/eval-session-contract.test.ts`, `server/src/services/native-runtime/native-session-executor.test.ts` |
+| Durable input, reconnect and provider death | Pending interaction cards survive controller recovery; unsafe replacement expires unresolved requests; delivered settlement survives a crash before journaling | `src/control-plane/durable-prp-control-plane.test.ts`, `runner/crates/runner-core/tests/acpx_provider_resolutions.rs`, `runner/crates/runner-core/tests/native_provider_backend.rs`, `src/live/runnerd-codex-transport.test.ts` |
+| Session list/fork, generic configuration and commands | No added operator surface; exact owned session recovery and configured model remain available | Provider inventories identify native-only, ACP-exposed, confirmed-absent and unverified methods with follow-ups |
+
+Paths starting with `src/` or `runner/` in this evidence table are relative to
+`packages/paperclip-runner/`; other paths are repository-relative. Deterministic
+fixtures establish contract behavior, not successful paid provider execution.
+
+## Shared event and interaction contract
+
+The active connection, wire session, normalized turn and original request identity
+bind every extension callback. The allowlist is per provider. An omitted wire
+session can only acquire the verified active connection's session; an explicit
+mismatch is rejected. Retired streams and inactive turns cannot emit new activity.
+
+Requests enter durable runtime state before the UI presents them. The response
+must match an outstanding request and an offered action or valid typed answer.
+The direct driver and sidecar await a receipt for the exact JSON-RPC pipe write before the runtime settles its durable record.
+The successful resolution enters the retained event outbox in the same atomic
+state save that removes the pending request. A restart before journal delivery
+retains that resolution for normal event replay and acknowledgment. A restart
+before this state save instead expires the unresolved request; neither path sends
+the provider response again.
+If persistence fails, the current executor stops accepting commands and exposing
+or acknowledging retained events. Cleanup still terminates its owned provider,
+but leaves the uncertain snapshot untouched. A fresh executor reads the complete
+atomic snapshot that survived; it cannot publish an in-memory resolution that
+conflicts with a later recovery expiry.
+Standard ACP does not acknowledge application of a permission reply; a lost
+transport acknowledgment is not proof of exactly-once external effects. A
+replacement provider process cannot inherit an old approval promise. A bounded durable ledger expires pending requests after provider loss or unsafe restart, including requests whose creation events were already acknowledged. No tool
+mutation or approval is automatically replayed into a replacement.
+
+Full plan documents have a bounded 100,000-character description and a 196 KiB
+question-set envelope. Oversized plans fail rather than approve an unseen suffix.
+Display redaction remains visible. Decision descriptions render image references as
+inert text and Mermaid diagrams as source, so reviewing a plan does not fetch
+provider-selected media. Automatic issue-reference linking is disabled for these
+descriptions, so a long provider plan cannot start an issue-detail query for every
+identifier. The rich event channel has exact canonical
+schemas and a bounded envelope. It cannot create terminal outcomes, dispatch a
+semantic tool, register an artifact, synchronize a durable plan, or supply source
+authority. Notices retain useful bounded fields and provenance in expandable UI
+details. Provider references remain unregistered until a control-plane operation
+registers them.
+
+Permission labels are derived from offered option kinds. An unknown or duplicate
+option is rejected. A provider's “always” decision is not relabeled “this session”
+unless the pinned implementation proves that scope. Restrictive execution policy
+is separate from automatic approval and company governance. Fresh permission
+configuration defaults to full auto; it never overrides read-only task policy.
+
+## Distribution and isolation
+
+Cursor pins `2026.09.26-dd393fe`; Copilot pins `1.0.88`; Pi pins wrapper `0.0.33`,
+runtime `0.84.2`, portable Node and its full npm lock. Native distribution hashes
+cover macOS ARM64, macOS x64 and Linux x64. Source-owned closure pins remain
+separate from profile declaration digests. Native admission reads held files,
+verifies every admitted byte, creates a private immutable snapshot and retains
+the existing process guardian. A manifest cannot supply its own trusted pin.
+
+Candidate credentials are only read from explicitly bound run environments:
+Cursor `CURSOR_API_KEY`/`CURSOR_AUTH_TOKEN`, Copilot `COPILOT_GITHUB_TOKEN`, Pi
+`OPENROUTER_API_KEY`. Ambient GitHub login variables, provider configuration,
+extensions and MCP discovery do not establish authority. Homes/config/cache are
+private. Updates are disabled. Pi launches only its owned extension and assigned
+skills, with a startup sentinel before a prompt can run.
+
+Build candidate packs explicitly with `--candidate-providers=` on that
+provider's branch. Local and remote pack verification includes the complete
+candidate asset tree. The corresponding Daytona build argument is documented in
+`docker/daytona-runner/README.md`. Candidate packaging never promotes a profile.
+
+ACP is not an OS sandbox. Cursor still reads project MCP/hooks beyond its
+`--disable-project-configs` flag; the adapter rejects known ambient execution
+configuration. Mutations during a run and remote team hooks still require
+qualification. Pi's tool policy supplements the execution boundary; arbitrary
+shell commands and filesystem races require the host boundary. These are
+qualification gates, not claims that a JavaScript path check confines a shell.
+
+## Explicit gaps and follow-ups
+
+| Priority | Exposed but unused, partial, or unverified | Reason and next proof |
+| --- | --- | --- |
+| P0 | Remaining paid product cases on local and Daytona | Credentials are explicitly bound. Cursor's five local semantic cases passed. Copilot completion/file/plan/restart cases and Pi completion/file/question passed. Copilot question continuation reached the correct UI and warm session but failed its final marker. Copilot question qualification, remaining Pi cases and all remote cases remain open. The 30-cell Product E2E and private 21-cell Runner Eval extended suites are explicit-only. Daytona billing access still requires user email verification. |
+| P0 | Pi fresh-profile Product verification blocked by host resources | The next paid plan case failed during embedded PostgreSQL initialization before any provider prompt. A disposable reproduction found 16 free SysV semaphores when Postgres required a set of 17. Resume the unchanged canonical case only after task-owned cleanup or a supported isolated test host restores capacity; do not remove unrelated IPC objects or substitute an unqualified database fixture. |
+| P0 | Copilot native ask-user and plan-decision callbacks | Pinned ACP does not install native responders. Prove no blocking request is exposed, or add a qualified responder/wrapper; never swallow the request. |
+| P0 | Broader Copilot denial and background settlement qualification | Two bounded real-service probes passed on pinned 1.0.88: native reject_once prevented a requested file write, and an observed detach:true command completed before end_turn. These establish the selected cases only; retain broader local/Daytona qualification before promotion. |
+| P0 | Cursor native question availability | A real default-mode prompt with no semantic MCP tools reported that native AskQuestion was unavailable. No native request arrived. The pinned client implements the RPC and mode controls, but inspected local guards do not explain the negotiated tool availability. Inspect the actual catalog/flags before another live probe; do not infer permanent harness absence or native success from semantic question tests. |
+| P0 | Typed Cursor entitlement failure | Exact models and successful inference are observed on the selected paid accounts. Cursor's first-account entitlement denial became ordinary text and normal completion. Preserve this failure and qualify typed failure handling; never infer a successful task from terminal status alone. |
+| P0 | Cursor project and remote hooks; native shell boundaries | Configuration flags do not cover every native source. Demonstrate policy cannot be bypassed before production qualification. |
+| P1 | Native Pi queue selection in the product UI | The runner API exposes negotiated `follow_up` separately from active steering. The current composer has no native queue selector; add one without confusing it with controller-scheduled later turns. |
+| P1 | Pi `queue_update` contents and delivery state | RPC acknowledgment proves acceptance, not model consumption. Add bounded queued/delivered events and durable message correlation with explicit retention rules for user content; preserve this distinction on reconnect. The selected live marker-order probe proves its own consumed messages only. |
+| P1 | Pi structured retry and compaction progress | Current text projection drops some `attempt`, `maxAttempts`, `delayMs`, `errorMessage`, `success`, `finalError`, `reason` and `willRetry` fields. Add bounded redacted provider notices with source-event provenance and outcome regressions; keep terminal failure authority separate. |
+| P1 | Native Cursor/Copilot active steering and queues | ACP prompt replacement is not steering; native SDK capabilities may be richer. Require a dedicated bound method plus acknowledgment before advertising. |
+| P1 | Child tool media/diff/raw payloads | Bounded delegation summaries preserve lifecycle and identity. Large nested payloads need a child-owned canonical item model; current omission is a visible notice and provider report entry. |
+| P1 | Standard ACP parent tool `content` diffs/images, secondary locations and raw input bodies | The existing common normalizer projects bounded output text, input-presence, and the first safe relative location. Raw argument bodies can contain secrets; richer content needs bounded typed blocks and a separately validated workspace binding for each file. Provider-specific image/file notices do not close this standard-tool gap. |
+| P1 | User attachments and image prompting | `AcpxRuntimeTurnInput` and the common runtime adapter currently forward text only, despite underlying image-input support. Implement validated attachment-to-ACP content conversion and model-specific capability admission, then qualify real local/Daytona image prompts. This is an implementation gap as well as a live-verification gap. |
+| P1 | Copilot session-store files and export/artifact URIs | Provider paths are not task-workspace paths. Add a separately authorized export flow with validated bytes and provenance; do not resolve arbitrary URLs or auto-register. |
+| P1 | Pi native fork/history/export interfaces | Pinned Pi 0.84.2 native RPC exposes `fork(entryId)`, `clone`, `get_fork_messages` and `export_html`. The wrapper does not map them to runner controls. Add durable branch lineage for fork/clone and an authorized, contained artifact flow for HTML export before exposing them; do not label these native capabilities absent. |
+| P1 | Complete usage/billing provenance | Missing cache fields remain unknown. Pi price estimates are displayed separately. Budget qualification requires actual spend coverage, not an estimate presented as a bill. |
+| P1 | Fork/history/model/mode controls not exposed by Paperclip | Research documents the native and ACP methods separately. Add governance-aware controls and durable lineage before enabling them. |
+| P1 | Exact pending-request restoration after process death | Session transcript restoration does not restore callbacks. Expire unresolved requests unless a provider proves exact restoration. |
+| P1 | Persistent agent-directory access through ACPX | Mainline `3ca196b0a` supplies `AGENT_HOME`, but its existing ACPX environment allowlist does not forward it. Pi also confines native writes to the task workspace, while the local persistent agent directory lives outside it. The disabled candidates do not claim this new capability. Bind and validate the company/agent/run-owned directory explicitly through launch and native-tool policy, including warm-run rebinding and cleanup-before-collection tests; do not widen ambient environment or filesystem access. |
+| P2 | Remaining Copilot native diagnostic/config/account events | The provider inventory records every event and field, its projection or reason for omission. Preserve bounded useful context; avoid credentials, raw environment or unbounded blobs. |
+| P2 | Pi native extension surfaces and unsupported slash commands | Arbitrary extensions/templates/themes may execute ambient code. Only reviewed runner-owned capabilities are admitted; structured native plan/goals are not fabricated. Native fork/clone/export are separate unmapped capabilities above. |
+| P2 | Pi status/widget/title/editor and session/configuration notifications | `setStatus`, `setWidget`, `setTitle` and `set_editor_text` have no UI projection and are unused by the owned extension. Native session-name and thinking-level events also lack a dedicated projection. Add reviewed bounded notice schemas and governed configuration controls before exposing these fields; `notify` and interactive input already have separate bridges. |
+| P2 | Pi invocation and history provenance metadata | The v4 wrapper retains `nativeToolCallId`, `modelIteration`, `historyMessageIndex` and `identityScope` in private ACP-wire metadata. Closed common tool and permission projections omit them from the UI. Normalized IDs still correlate live tool, MCP and permission events. Add bounded, redacted display-only provenance fields and parity tests before surfacing the native metadata. |
+| P2 | Conditional native-plan follow-up fields | Cursor's optional rejection-reason field also appears for accept/cancel. The current question renderer has no conditional fields; add conditional presentation without changing the revision-bound decision receipt. |
+| P2 | Cursor command exit code projection | The paid file case preserved native `exitCode: 0` inside output text, while the canonical command field remained null. Normalize a typed, correlated exit code without parsing arbitrary prose; current independent file assertions do not prove this field. |
+
+## Qualification ledger
+
+Combined ceiling: **$100**, including retries and infrastructure. Cursor allocation:
+$25; Copilot: $25; Pi: $25; coordinated diagnosis reserve: $25.
+Initial reservations are $2 per provider. Measured cumulative OpenRouter key-usage
+delta through Pi's native denial, both file attempts, question, three plan attempts and native controls: **$0.028858372**, including failures.
+The first model-backed Pi attempt cost **$0.005748807**. Cursor's first account was
+not entitled; its dashboard was unchanged at the displayed precision, with no
+per-request receipt. Copilot's first session-start failure left its dashboard at
+0/1,500 included AI credits and $0 incremental charges. After its protocol and
+Product question cases, GitHub displayed 3/1,500 included credits with additional
+usage disabled and a $0 budget. It still displayed 3 immediately after the native
+denial and detached-command probes, then 5 after the two-turn plan batch. These
+are delayed aggregate snapshots; exact allocation among calls is unverified.
+After its denial probe, the selected Cursor account displayed 482.5K included
+tokens across twelve qualification requests and zero on-demand tokens. The restart
+rows showed 23.8K and 41.7K included tokens; denial used 24.4K. Displayed credit precision
+and delayed accounting do not establish
+a per-run zero receipt. These measurements are
+partial, not a final all-provider total. No Daytona leases have been started.
+Registry downloads, fake-model fixtures and metadata-only authenticated discovery
+are separate from model inference.
+
+The first Pi canonical `get-task-context` attempt used source `788105248a3ba594b30b5bcec3fa266d8a51d8d4`
+and provider-pack digest `sha256:4de47c31a8131424495366741bd491ff5fa10723ab9a3918c07a3e42982dbe3c`.
+It observed successful `get_task_context`, `get_task_history`, `list_documents`
+and `read_document` calls, then hit its 120-second turn deadline without a
+terminal receipt. This is a retained failed attempt, not semantic qualification.
+Earlier launch/interpreter failures are retained separately. The initial Cursor
+failure exposed a native wrapper gap: a typed entitlement error becomes an
+ordinary message and normal completion. The runner does not infer authorization
+from that message or fabricate a zero-cost usage receipt.
+
+The selected paid Cursor account passed canonical `get-task-context` at source
+`01959b8a602683f13706807983f02c3cba9d36a0`, pack
+`sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb`,
+using exact `gpt-5.6-luna[context=272k,reasoning=medium,fast=false]`.
+Its context/history reads and all four semantic checks passed in 29.291 seconds.
+The account usage row attributes 56K tokens to this run, included in its existing
+Pro+ subscription; incremental cash is zero. ACP supplied no token or USD receipt.
+A conservative list-price bound of $0.07 is an estimate, not an invoice.
+
+Copilot's first real completed attempt used source `92fcaf0c`, the same immutable
+runnerd SHA-256 `986060810ba7377c6ddd64a5d89e322d0a434e1a9c80400e6d4acf5934bfc421`,
+and exact `gpt-5.6-luna`. One context read and all four canonical semantic checks
+passed. The original post-run package/provenance failure is retained; offline
+scoring recovered the same artifact with zero additional provider calls. Its
+24,258 input, 11,781 cached-input and 441 output tokens yield a $0.00326022 catalog
+estimate. GitHub still displayed 0/1,500 included credits and additional billing
+disabled with a $0 budget after the run. UI delay/rounding leaves the exact credit
+delta unverified; this is not a provider USD receipt. Neither protocol case proves
+Product E2E, restrictive permissions, restart recovery, or Daytona qualification.
+
+Separate paid Product E2E evidence now records:
+
+| Provider / local case | Exact source revision | Observed result |
+| --- | --- | --- |
+| Cursor / completion | `edf538e61e712dddb6b4d59045c3dcfd445686c7` | 6/6 assertions; committed finalization, one completion marker, cleanup passed |
+| Cursor / file edit and validation | `fe132224c2b30a8d9ce7b46cea38b8760af233fc` | 7/7 assertions; independent final file bytes, visible downloadable workspace artifact, cleanup passed |
+| Copilot / completion | `bcc9c638a25b91b84065f12633f083bd4f7a689f` | 6/6 assertions and cleanup passed; original accounting projection failed independently |
+| Cursor / question continuation | `a7e01a0cec397dd5048f5d5b5825658dc6e91450` | UI answer Cobalt, continuation and 6/6 terminal assertions passed; two expected provider runs, no retry |
+| Cursor / semantic plan approval | `a7e01a0cec397dd5048f5d5b5825658dc6e91450` | Displayed plan revision matched the confirmation target; accept/continue and 6/6 terminal assertions passed |
+| Copilot / file edit and validation | `ee9536001fbe733b2386dd3379730a4e0be59488` | 7/7 assertions and cleanup passed; independent bytes validated; GitHub biller and unpriced receipt verified |
+| Copilot / question continuation | `ee9536001fbe733b2386dd3379730a4e0be59488` | Question/answer and warm session reuse worked; 4/6 terminal assertions passed because the provider returned a literal placeholder instead of the required marker; failed attempt retained |
+| Cursor / controller restart | `d35b83074a018537f5475568d7410e3b1d676789` | 6/6 assertions in 57.865 seconds; pending semantic question survived server restart, Cobalt answer continued to Done, cleanup passed; earlier failed attempts retained |
+| Pi / completion | `dd78df1ef8b279c30c710c9b7a7f9fda22e321d6` | 6/6 assertions and cleanup passed in 32.668 seconds; one authenticated `paperclip_finish`, `turn.completed` and `run.terminal`; exclusive-key delta $0.000654767 |
+| Copilot / semantic plan approval | `c06fc5fccc88f5816450434493451b9d2d339125` | 6/6 assertions in 45.625 seconds; accepted decision bound to displayed revision 1, exact marker and Done; both paused/completed receipts are GitHub/unpriced; cleanup passed |
+| Copilot / controller restart | `19ca0f558` (final runtime remains `8aa867b64d5fc2fd62cff110bd000addf5dc54de`) | 6/6 assertions in 50.875 seconds; same pending interaction survived restart and same persisted provider session continued; exact marker once, Done and cleanup passed |
+| Pi / file edit and validation | Runtime `dd78df1ef8b279c30c710c9b7a7f9fda22e321d6` | Failed at the 120-second active deadline after five rejected `paperclip_finish` calls; cleanup passed. The extension discarded validation details. Final bytes and completion arguments cannot be reconstructed from the retained projection. |
+| Pi / file edit and validation, v3 | Pack source `7710736ca3924c655c5b0efd172cfd3c0173766a`; execution fix `06cf356a8bc94f709fcd15606fe05e17933fe3b2` | 7/7 assertions in 49.427 seconds, exact file bytes and cleanup passed. One rejected completion exposed the missing registered deliverable; Pi corrected it, registered the artifact and finished. Exclusive-key delta $0.003324737. |
+| Pi / semantic question, v3 | Pack source `7710736ca3924c655c5b0efd172cfd3c0173766a` | 6/6 assertions in 158.388 seconds across two bounded turns; exact question/option IDs, Cobalt answer, warm continuation, final marker and cleanup passed. First waiting run has no usage receipt; exclusive-key delta covers both runs ($0.001413697). |
+| Pi / semantic plan, v3 first attempt | Pack source `7710736ca3924c655c5b0efd172cfd3c0173766a` | Failed the native write-boundary UI assertion in 119.553 seconds. The saved two-step plan, matching revision and confirmation controls were visible, but all retained DOM snapshots showed the fallback Plan card. Rust lost the MCP display name/namespace used for placement. Cleanup passed; exclusive-key delta $0.003090504. Matcher remains unchanged. |
+| Pi / semantic plan, v3 second attempt | Combined pack source `7ab463697037c9456a4ad2b83ea0e9c28b353f8a`; daemon source `e35b11db21b8da8527fa0b6c6f5fe186bdced111` | Displayed Plan placement and revision-bound acceptance passed. The resumed turn exceeded the unchanged 120-second active deadline; total case duration 260.246 seconds, cleanup passed. Pi reused native `call_0` for different tool executions, so the bridge correctly rejected conflicting identities. No terminal usage receipt; exclusive-key delta $0.002440082. |
+| Pi / semantic plan, v4 first attempt | Frozen combined runtime `f556110d588a9de9fefe676a9a62bf09e98afb85`; fresh pack `sha256:4df7e9fa164929c7ae7d8e8711f0bf7d587d9fa6a246d0a8340f318f57168855` | Infrastructure failure during embedded PostgreSQL initialization in 6.679 seconds; no provider process or prompt. Disposable reproduction confirms host SysV semaphore exhaustion (16 free, 17 required). Cleanup passed, exclusive-key delta $0, and all original graders/deadlines remain unchanged. |
+
+Pi's immediately preceding `hello05` consumed $0.000351509 and failed evidence
+packaging after a confirmed 888-second host Maintenance Sleep. It reached
+authenticated prompt acceptance but retained no semantic-tool or terminal event.
+An incomplete Playwright archive could not be inspected (`unzip` exit 9), so the
+existing scanner failed closed with its `secret_leak` classification; no credential
+match was observed. That canonical failure remains unchanged. The deliberate
+`hello06` repeat used the same runtime source, a task-owned idle-sleep hold, and
+both wall-clock and monotonic outer deadlines. Canonical Pi cost remains unpriced;
+the exclusive-key billing delta is separate evidence, not a fabricated receipt.
+
+Separate real native probes used final immutable packs without a Product database:
+
+| Provider / probe | Runtime source | Observed result |
+| --- | --- | --- |
+| Cursor / native AskQuestion | `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` | Failed: zero native input events, normal terminal and cleanup; the provider reported that the tool was unavailable. This does not qualify the native question bridge. |
+| Copilot / denied write | `8aa867b64d5fc2fd62cff110bd000addf5dc54de` | Passed: actual native permission request ID 0, original `reject_once`, forbidden marker absent in all 79 observations through process cleanup. |
+| Copilot / detached command | `8aa867b64d5fc2fd62cff110bd000addf5dc54de` | Passed: actual `mode:async` and `detach:true`, original `allow_once`; command completion at 10.083 seconds and marker at 10.098 preceded `end_turn` at 10.675; five-second late-effect check and process cleanup passed. |
+| Pi / denied write | `dd78df1ef8b279c30c710c9b7a7f9fda22e321d6` | Passed in 20.438 seconds: actual native permission ID 0 persisted before original reject_once reply, pipe delivery acknowledged, correlated tool failed, prompt settled end_turn, forbidden file absent and cleanup passed. |
+| Cursor / denied shell write | `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` | Original grader failed because permission omitted rawInput. Separate offline assessment passed from the preceding exact-command tool_call bound to the same toolCallId, original reject-once reply and 98 independent absent-file observations through terminal and cleanup; no repeat prompt. |
+| Pi / active steering and queued follow-up, v3 | Pack source `7710736ca3924c655c5b0efd172cfd3c0173766a` | Passed in 21.342 seconds. Both active-session operations acknowledged while a persisted native write permission waited; original reject_once denied the tool, visible STEERED_CURRENT preceded QUEUED_NEXT, forbidden file stayed absent, end_turn settled, stale steer was rejected and cleanup passed. |
+| Pi / active steering and queued follow-up, v4 | Frozen combined runtime `f556110d588a9de9fefe676a9a62bf09e98afb85`; verified pack `sha256:4df7e9fa164929c7ae7d8e8711f0bf7d587d9fa6a246d0a8340f318f57168855` | Passed in 20.255 seconds: normalized invocation identity matched the denied tool update; both controls acknowledged before the original denial; exact STEERED_CURRENT then QUEUED_NEXT, stale steering rejected, end_turn and cleanup passed, forbidden file absent. Settled exclusive-key delta $0.000546502; separate Pi estimate $0.000803936. |
+| Pi / active steering and queued follow-up, v5 | Runtime `aec26ad83f1d082f0d0a5eaffbd615a9e2e26155`; pack `sha256:cf7d0998bbc2bed7b893c726c2b6455ba8a683d9cff7d92afedbff2d5900d500` | Passed in 19.199 seconds: one real normalized write invocation, original reject_once persisted before reply, both controls acknowledged before denial, exact STEERED_CURRENT then QUEUED_NEXT, stale steering rejected, end_turn, forbidden file absent and cleanup passed. Settled exclusive-key delta $0.000151739; its separate Pi estimate is $0.000611156. |
+
+These narrow native probes do not replace durable Product interaction, restart,
+or Daytona coverage. Their private wire evidence remains separate from sanitized
+public summaries. A private durable retention manifest also records hashes for the
+logs, screenshots, wire evidence and failed attempts; no credentials are published. The semantic Cursor question and plan cases above exercise
+Paperclip tools, not the native `cursor/ask_question` or `cursor/create_plan` RPCs.
+The failed Pi file case exposed two wrapper losses. Profile version 3 at
+`06cf356a8bc94f709fcd15606fe05e17933fe3b2` preserves bounded, redacted MCP validation
+errors and bounded Bash arguments/output; oversized values have an explicit
+omission marker. Version 1 and 2 warm snapshots are rejected. Installed-wrapper
+regressions pass. A fresh v3 pack then passed the paid file case: the model received
+the actual missing-deliverable receipt error, registered its deliverable and
+completed. The original v2 failure remains retained.
+Canonical command exit codes and typed generic diff/media projection remain partial.
+
+The Pi denial/file batch cost $0.010995043 by exclusive-key delta. Delayed billing
+prevents exact per-call attribution, so the aggregate remains separate from Pi's
+catalog estimates and its missing terminal receipt on the file case.
+
+The Cursor file case proves the workspace artifact surface, not complete native
+file/diff projection. The Copilot result incorrectly projected missing native cost
+as USD zero and attributed its biller to OpenAI. The original result is retained;
+the shared fix identifies GitHub, Cursor and OpenRouter correctly and keeps absent
+candidate USD receipts unpriced. The separate Copilot file case verifies that fix.
+The question case exposed a second ledger edge: zero normalized token counters
+were treated as a reported cost despite no cost field. Ledger classification now
+requires an explicit finite nonnegative cost; an explicit zero remains reported.
+Protocol evals now fail their cost gate when spend is unknown, preserving completed
+behavior and semantic evidence in a separate accounting-failure result. The
+maintained campaign stops subsequent cells on unknown accounting and never turns
+an unavailable receipt into a zero-dollar measurement.
+
+Initial Product attempts exposed local PostgreSQL postinstall hydration and a
+server candidate-admission gap before any model prompt. Both failed attempts are
+retained. The package's own hydration repairs local installation; exact host
+qualification now applies consistently at agent creation, runtime selection,
+native input and process construction. Agent configuration cannot grant itself
+qualification authority. The obsolete unconditional Pi executor rejection is
+replaced by the same closed host authorization. Candidate active turns are bounded
+to 120 seconds and automatic infrastructure retries remain disabled.
+
+Pi's next local startup attempt timed out before any prompt, with zero exclusive
+key usage delta. A credential-free reproduction isolated a 37.423-second immutable
+copy of its 13,827-file, 234,019,683-byte distribution, after 5.168 seconds of
+verification, against the 30-second session-open deadline. Bounded parallel copying
+reduced that same copy to 5.851 seconds without changing a timeout. Ten tests cover
+the eight-file / 32 MiB batch bounds, unchanged per-file integrity checks, stable
+digest order, mutation rejection, and draining pending copies before cleanup.
+The later `hello06` paid Product case above proves successful inference and
+settlement after this startup fix. Its final screenshot shows one readable answer,
+a visible Done status and a usable composer, with no duplicate response or error.
+
+The maintained Product E2E `extended-harnesses` suite covers local and Daytona
+completion, question/answer, semantic plan approval, pending-input restart and
+file edit/validation. It has no automatic retries and does not enable candidates
+outside exact operator-authorized provider/model pairs. The private Runner Eval
+campaign is complementary: seven semantic protocol cases per provider. Neither
+suite's membership is a qualification claim.
+
+Before each paid batch, record source SHA, executable and closure/profile digests,
+exact model, OS/architecture or Daytona image, selected cases, prior spend,
+maximum batch spend and authoritative billing coverage. Stop before the shared
+ceiling. Missing spend coverage blocks a run rather than treating unknown cost as
+zero. Retain screenshots and wire evidence without credentials. Never convert a
+provider to supported solely because a test suite or packaging check passed.
+
+Verification commands and final results are recorded with the prerequisite and
+provider PRs. The full handoff requires runner checks, token gates, recursive
+typecheck, `pnpm test:run`, and `pnpm build`. Until that evidence is recorded, this
+report is an implementation report rather than a PR-ready certification.
+
+At foundation `5aeebb20c`, recursive typecheck, build, token gates, full Rust runner
+checks, conformance/replay parity and API-authority checks passed. Approval
+verification includes 18 real database integration tests, 15 projector cases,
+87 transcript/UI cases, 82 route/websocket cases and eight provider receipt cases.
+The local full root test attempt initially failed because embedded Postgres's
+install-time library links were missing. Its official package postinstall restored
+them; all 38 affected suites (743 tests) then passed. The workspace streaming stress test initially exceeded macOS path limits
+(`ENAMETOOLONG`); the later portable fixture correction is recorded below. The full runner TypeScript repeat passed 2,164 tests in 156 files, with ten
+skipped tests. The full UI and CLI suites passed 6,772 and 502 tests. Remaining
+source workspace checks passed 2,882 tests; two macOS path-alias fixture failures
+were corrected with an explicit injection assertion (all 89 sandbox tests pass),
+and a database timeout passed in an isolated repeat. Failed attempts and the
+latest CI state remain recorded in the PR. The decision-media review fix passes
+87 focused tests, UI typecheck, token gates and the UI build.
+
+At execution source `f063fbf2b`, recursive typecheck, full build, token gates,
+13 accounting tests, 10 immutable-distribution tests and seven image-contract tests
+pass. Both full UI/CLI shard partitions pass (6,848 UI and 502 CLI tests).
+The remaining local test partitions run sequentially after paid Product cells to
+avoid the machine's observed PostgreSQL semaphore exhaustion. Earlier failures,
+including the unchanged macOS path-length stress case, remain retained. Foundation
+CI at this source passed typecheck, build, Rust, both runner test lanes, all twelve
+general server shards and all eight browser shards. Six other jobs received a
+coordinated runner-shutdown signal; their cancellation is not a passing result.
+Greptile reviewed this source at 5/5. Later documentation/build-pin updates still
+require their own final check status.
+
+Initial macOS ARM64 candidate packs were independently built and launched through
+the generic installation registry: Cursor source `1055c13f8`, Copilot `5d8829add`,
+Pi `f58cfa1cb`. Review fixes that change execution bytes require fresh packs and
+launch proofs; the latest source SHA, manifest/profile/closure digests and
+sanitized wire evidence are retained in each provider PR. Earlier proofs retain
+their original source identity. These probes send no model prompt.
+
+Final native Linux packaging probes also run with no network, no credentials and
+no model prompt. Cursor source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` initialized
+from image `sha256:5fa7951d1d6dd99305555fe00a5baf2bf5b834d16f021053737301975b93986f`;
+its native EOF does not settle within five seconds, so explicit process-group
+cleanup is required and verified. Copilot source
+`8aa867b64d5fc2fd62cff110bd000addf5dc54de` initialized as version 1.0.88 from image
+`sha256:5457769683fd310223d3b0d4f1ed9a6cf341bdb16514746b3aaeabca2e888fee` and exited
+zero on EOF. Its metadata-only fixture received zero requests. The provider PRs
+retain complete pack/executable digests and sanitized initialization responses.
+Pi v3 source `06cf356a8bc94f709fcd15606fe05e17933fe3b2` also initializes and
+exits zero from image `sha256:c5fa7976bba92a186a2f70dc8b8ddc58ab86606b80a819c89bf550d2d057c832`,
+with profile digest `sha256:72cb225288376f733b9ed3afa5e13565eb4152f0de509bc1181382fa44bee472`.
+The earlier Pi v2 proof remains historical.
+These are packaging proofs, not paid Daytona or model-availability evidence.
+
+At `e8dee462e2fd09cf858be0a02368805346ec4f3b`, versioned profile contract tests
+pass 36 cases and full runner TypeScript checking passes. Nine additional source
+workspace suites pass 2,757 tests with 19 skips. An isolated repeat of the unchanged
+HTTP redaction suite passes all 59 tests after its earlier concurrent-run timeout.
+The feedback-route mock fix retains both company-boundary assertions and passes
+two independent fresh-environment repeats (4/4 each). Current source and any
+remaining partition failures are recorded in the final prerequisite PR evidence.
+
+The portable real-Git stress fixture passes on macOS in 234.43 seconds, retaining
+40,000 files, four independently checked 34,988,890-byte filename lanes, real
+staging/deletion and cleanup. Its timeout is 300 seconds on macOS and remains
+180 seconds elsewhere. Both earlier failures are retained. All seven remaining
+serialized root partitions pass; database-project and previously skipped-file
+remediation later passed all ten partitions, including 1,042 chat integration tests.
+
+The combined provider stack passes 616 ACP/profile/backend tests with eight
+skips, 34 packaging and actual-wrapper tests, and a TypeScript build. The
+Copilot registry regression now verifies dispatch to separate native factories;
+the pack test no longer assumes another implemented provider is absent.
+The complete database project passes 161 tests in 44 files after serialization;
+all ten remediation partitions completed without failure, including the full
+1,042-test chat integration lane.
+
+The first Pi plan attempt exposed a shared Rust display-mapping gap: prefixed MCP
+tool names were retained as builtin names, preventing the saved Plan from anchoring
+to its write event. All four retained browser snapshots showed the fallback Plan
+card inside a settled turn, so the existing Product matcher remains unchanged.
+Foundation `5aa02662b34fc70f5fe9ffd5ac8f7ae81b5fe3bd` parses both ACP MCP name forms,
+preserves bounded/redacted namespace and name, and leaves semantic authorization,
+operation and read-only classification unchanged. The original Rust regression
+fails before the fix; 55 Rust, 28 TypeScript provider and 158 UI tests pass afterward.
+The UI regression distinguishes the proper write-boundary card from the original
+fallback. A rebuilt daemon is required for the retained paid retry.
+
+The rebuilt daemon passed the Plan placement and revision-acceptance boundary in
+the second paid attempt. Its continuation exposed a separate Pi identity defect:
+the owned extension reused native `call_0` as the MCP request ID for different
+executions. A rejected finish was followed by a corrected finish and context read,
+both correctly rejected by shared duplicate-call protection. Further paid cases
+stopped. Pi v4 at `f556110d588a9de9fefe676a9a62bf09e98afb85` binds live identities
+to a private launch namespace and a lifetime model-iteration ordinal. Exact
+request retries retain their identity; conflicting or duplicate native invocations
+within one iteration fail closed. History uses a separate display-only identity.
+Bridge idempotence and durable call tombstones stay intact. Raw native IDs remain
+private-wire provenance, with the UI omission recorded above.
+
+The corrective-call regression failed before the fix and passes against the real
+authenticated loopback tool bridge afterward. The pinned native SDK test covers
+six iterations across two warm prompts and four executions that reuse `call_0`;
+its native turn index resets, while the owned ordinal remains monotonic. This
+check uses an in-memory model stream and no inference. Independent review and
+profile-digest verification pass. At that v4 checkpoint, the profile digest was:
+`sha256:2324d9b47650c12b16f8e2c44dc33637d52f1b22ba8e914623eac4049e7e1991`.
+Earlier v1-v3 snapshots could not establish that runtime identity. The extended
+Runner Eval configuration then pinned v4 and rejected those historical identities;
+all 132 eval tests and seven-cell Pi campaign validation passed without provider
+calls at that checkpoint. The later v5 identity is recorded below.
+
+Recursive typecheck and the full build both pass at shared repair source
+`5aa02662b34fc70f5fe9ffd5ac8f7ae81b5fe3bd` and again at version-admission source
+`1545c7692`. The latter adds closed profile-version-4 admission, with 22 contract
+tests and full runner TypeScript checks passing. Exact profile digest matching
+remains mandatory. Recursive typecheck and the full repository build also pass
+on the frozen combined provider source `f556110d588a9de9fefe676a9a62bf09e98afb85`,
+including Pi v4. The combined macOS ARM64 provider pack
+at `7ab463697037c9456a4ad2b83ea0e9c28b353f8a` independently verifies all three
+complete candidate trees (446 Cursor files, one Copilot executable and 13,827 Pi
+files), manifest digest
+`sha256:0800f10114e3d8e2e981ea27f0ab47f1da9349dbcc22bf55a76ebbc4af00601d`.
+All three initialize through the verified registry without credentials or model
+prompts. The combined Linux image at source
+`e35b11db21b8da8527fa0b6c6f5fe186bdced111` also passes all three initialization
+probes under network-none and a read-only root. Image digest:
+`sha256:17c228d3b9744d6bf375ead57918c755d0cc44fc3db44d238cc898317cea25ce`;
+pack digest: `sha256:4e0ddb39a34e7f55d7520a8a2d9074009589f3f95f4c10bb837e54ec58d70ba1`.
+These combined proofs contain Pi v3 and retain that historical identity when the
+invocation-identity repair produces a new profile. They are not paid Daytona proof.
+All candidates remain pending; verification and packaging do not grant support.
+
+The fresh v4 macOS ARM64 pack at the frozen combined source has digest
+`sha256:4df7e9fa164929c7ae7d8e8711f0bf7d587d9fa6a246d0a8340f318f57168855`.
+All 13,827 Pi runtime files independently match the pinned closure. Native
+initialization under denied networking exits cleanly; the complete Runner path
+returns the expected typed missing-key rejection without inference. The rebuilt
+daemon has SHA-256 `373848d2d7287b2c47b2cee422cb7bd25073a594a620a9ad574f2d3d51cd1670`.
+The next canonical paid plan attempt stopped in PostgreSQL initialization before
+provider startup. Its unchanged billing and exact disposable initdb failure are
+retained. The diagnostic created no server, removed its temporary directory, and
+left IPC totals unchanged. Unrelated database processes and IPC objects were not
+modified. Canonical Product E2E does not currently admit an external database
+substitute; introducing one requires its own ownership, isolation and cleanup
+proof rather than bypassing the existing guard.
+
+The v4 native probe above does not need a database and passed independently of
+the host PostgreSQL blocker. A read-only IPC attribution audit found no semaphore
+set with sufficient task provenance for safe cleanup; no unrelated set was
+removed. The paid Product and Daytona qualification gaps remain open.
+
+Dependency review subsequently identified Pi's pinned `undici@8.9.0` in
+[GHSA-3wwx-pv8p-q78v](https://github.com/advisories/GHSA-3wwx-pv8p-q78v),
+indexed in GitHub's advisory database on September 28. Pi's owned Node 24.19.0
+also embeds affected Undici 7.29.0. The repair requires both the exact npm override
+and the provider-local patched Node distribution; it cannot be represented by a
+waived check or a claim that updating npm replaces Node's builtin implementation.
+Shared contract source `e6163e16a` admits closed profile version 5, with 23 contract
+cases and full runner TypeScript checking passing; unknown versions remain
+rejected and exact command digests remain mandatory.
+
+The combined v4 Linux image at frozen source `f556110d588a9de9fefe676a9a62bf09e98afb85`
+was built and all three providers passed credential-free initialization under
+network-none with a read-only root. Image digest:
+`sha256:4c4e2fb7eb8ef3681b14c3e21dd28eace5ef920d6d08d572fb9c9c7e9a5f290a`;
+pack digest: `sha256:8f263ed5c309b47cdc74a37d8217bb49e57129fca393498f54f6dd461657a9b9`.
+The daemon SHA-256 is `5914ed1ad0235aaee9af8731af2cbf28d7b16b0fda231a13963f1d86c3220daa`.
+Cursor still needs explicit cleanup after EOF; Copilot and Pi exit zero. No model
+prompt or credential was supplied. This remains a historical packaging proof
+when the dependency repair changes Pi's profile and executable closure.
+
+Recursive `pnpm -r typecheck` and `pnpm build` also pass at shared version-5
+admission source `e6163e16a`; no database or model request is used by those checks.
+
+Pi v5 repair source `aec26ad83f1d082f0d0a5eaffbd615a9e2e26155` pins private
+Node 24.21.0 (bundled Undici 7.29.1) and nested npm Undici 8.10.2. Because npm
+retains the vulnerable shrinkwrapped package despite overrides, materialization
+verifies the exact published old tuple, replaces only that package from a bounded,
+integrity-checked fixed archive, and then verifies the complete trusted closure.
+The upstream Pi package and shrinkwrap bytes remain unchanged; the exception is
+explicit and closed. Profile digest:
+`sha256:020d96ccbd3c45c3f62680814776394ed5a56d9572a1a4dccda56a74d16c7803`.
+Old versions 1–4 are rejected. Forty-three focused TypeScript tests, 19 package
+checks, eight materializer checks and 13 Rust tests pass. Independent review verified all 13,827 installed
+files, both patched dependency copies, eight materializer and twelve profile/
+recovery cases. Recursive typecheck and the full build pass at the same source.
+
+Shared Docker pin source `3a5637732` uses the official Linux x64
+`node:24.21.0-bookworm@sha256:5a750d3be5e5c80275f8c9a5367c3aed99c2875656590c8d0701c7ee687f5f0a`
+for the outer provider pack. A network-disabled launch independently reports
+Node 24.21.0 and Undici 7.29.1, matching the
+[official Node release](https://nodejs.org/en/blog/release/v24.21.0). All seven
+image-contract tests pass. The first local test invocation failed because the
+root has no `tsx` executable; the retained retry used the maintained Vitest
+configuration. No provider call was made by either command. Pack authority
+includes the outer Node bytes and is bound into the persisted launch profile;
+changes invalidate incompatible warm recovery independently of Pi's profile bump.
+
+The fresh v5 macOS ARM64 combined pack has manifest digest
+`sha256:cf7d0998bbc2bed7b893c726c2b6455ba8a683d9cff7d92afedbff2d5900d500`
+and source `aec26ad83f1d082f0d0a5eaffbd615a9e2e26155`. Independent initialization
+through the verified registry passes for Cursor, Copilot and Pi with no provider
+credentials or prompts. The outer interpreter reports Node 24.21.0 and Undici
+7.29.1. Cursor still requires explicit process-group cleanup after EOF; Copilot
+and Pi exit zero. All owned processes and private supervisor directories are
+cleaned. Cursor/Copilot profile and closure identities match their prior pack.
+The proof index has SHA-256
+`a07394e3215eb0a153c4a9443762a5d84ddfe0e70b92e1d47ae8d574239e104c`.
+
+The private Runner Eval campaign now pins v5 at eval source
+`18f06b9391838d637c1588f372c7f1397ec6f9a7`. All 133 Python tests and the seven-cell
+Pi validation pass without provider calls. Explicit tests reject each historical
+v1–v4 version, digest and paired identity. Cases, model, scoring, budgets and
+deadlines remain unchanged.
+
+Current Linux image identities and exact-head CI/review status are recorded in
+the [Pi PR verification](https://github.com/paperclipai/paperclip/pull/14436) and
+[foundation PR verification](https://github.com/paperclipai/paperclip/pull/14430).
+Their immutable source and dependency identities remain distinct from the
+historical packaging proofs above. Image initialization does not certify paid
+Daytona execution. The unresolved local database and remote account-verification
+blockers prevent support promotion.
diff --git a/doc/connections/AI-CONNECTIONS.md b/doc/connections/AI-CONNECTIONS.md
index 6c55738c5e8..e74390255fa 100644
--- a/doc/connections/AI-CONNECTIONS.md
+++ b/doc/connections/AI-CONNECTIONS.md
@@ -99,6 +99,34 @@ Sending `environmentId: null` tests a change back to the instance default.
## Runtime isolation
+Provider authentication failures, including `acpx_auth_required`, adapter login
+requirements, and expired/invalidated refresh tokens, create an AI connection
+card as the failed run is finalized. The card names the provider and uses the
+same inline connection/reconnect controls as missing-account setup. Pending
+cards are deduplicated. Creating a repair card persists a blocked run classification
+that suppresses immediate and periodic generic retries until the responsible user
+repairs the connection. Unsupported providers and failures that could not create
+a card retain their existing recovery path. Tool permission errors and provider quota failures do not
+request model authentication.
+
+An attributed managed credential is marked as needing reauthorization only if
+its stored generation still matches the failed run. Late failures cannot
+invalidate a refreshed or reconnected credential. Repair preserves the selected
+account and its permissions when the same sign-in method is selected. The card
+also lets the user switch between API key and subscription authentication for
+providers that support both. Switching creates a separate account, then selects
+it as the user's provider default or validates and updates the agent's explicit
+account binding. The original account is retained. Accepting the card resumes with a fresh session
+through the existing durable continuation delivery.
+
+For compatible legacy agents, the card offers the responsible person's provider
+connection without changing authentication automatically. After connecting,
+**Use connection and continue** checks agent-update permissions and validates in
+the agent's execution environment before committing the agent binding, connection
+install, audit, and card completion in one transaction. A failed validation or
+completion leaves the request pending and the old agent configuration and access
+intact. Unsupported harness/provider routes are not guessed.
+
Codex ACP terminal failures with category `limit` and explicit usage-exhaustion
wording enter provider-quota recovery. A supported reset clock uses the existing
Codex parser; when none is available, recovery uses its existing quota backoff.
@@ -324,7 +352,10 @@ Native Codex and ACPX/Claude provider selections follow the same compatibility r
Hiring may succeed before that personal account exists or while it needs repair,
including hires awaiting board approval. The first assigned task then shows an AI
connection card. First-time setup presents the provider's subscription/API controls
-inside the task. Connecting installs access for that agent and resumes the pending
+inside the task. The inline form omits the connection name field and names new
+accounts from the user's display name, provider, and selected authentication
+method (for example, `dotta's Claude API account`). Reconnecting preserves the
+existing account name. Connecting installs access for that agent and resumes the pending
work automatically. Explicit incompatible bindings and shared-account permission
denials still fail; hiring never expands a restricted shared account's audience.
diff --git a/doc/connections/BROWSER-USE.md b/doc/connections/BROWSER-USE.md
new file mode 100644
index 00000000000..72104d93981
--- /dev/null
+++ b/doc/connections/BROWSER-USE.md
@@ -0,0 +1,387 @@
+# Browser Use Cloud
+
+This connection delegates website work to Browser Use's hosted agent through its
+v4 REST API. The task's Browser tab embeds the provider's interactive live viewer.
+The connection's API key stays in Paperclip's vault and is never exported to the
+agent, local browser tools, or the board UI.
+
+## Connect and configure
+
+Choose **Browser Use Cloud** (`browser-use-cloud`) in Apps, select agent access, enter a project API key from
+[Browser Use settings](https://cloud.browser-use.com/settings), and review
+Permissions. No OAuth registration, callback, Paperclip ID, or external connection
+broker is required. Cloud and self-hosted instances use the same server-side path.
+The instance needs outbound HTTPS to `api.browser-use.com`; browsers need access
+to `live.browser-use.com`. An operator-supplied CSP must permit that viewer origin
+in `frame-src`.
+
+The setup probe reads profiles without creating paid work. Existing personal and
+organization grants, audience restrictions, installations, policies, approvals,
+and invocation audit remain authoritative. Browser settings on Permissions are
+per credential: the owner (or a shared connection manager) can set a maximum cost per run and explicitly allow
+existing saved profiles. No selected profiles means fresh browsers. Profiles can
+contain authenticated website sessions, so selecting one grants meaningful access.
+Paperclip does not create or import profiles.
+
+## Reviewed actions
+
+| Action | Risk | Scope and behavior |
+| --- | --- | --- |
+| `browser_start` | Destructive-capable | Delegate a task; optional allowed profile and lower cost cap. |
+| `browser_status` | Read | Current run status, sanitized result, progress and recorded run cost. |
+| `browser_continue` | Destructive-capable | Start a new turn in an idle owned conversation. Busy sessions reject it. |
+| `browser_cancel` | Destructive-capable | Cancel hosted agent work; keep the browser for the idle window. |
+| `browser_end` | Destructive-capable | Cancel work and stop every browser registered to the conversation. |
+| `browser_sessions` | Read | List conversations for the current task, agent and selected grant only. |
+| `browser_profiles` | Read | List existing profiles explicitly allowed for the selected grant. |
+
+Start, continue and control are conservative because a natural-language browser
+task can change external systems. They use the normal Allowed / Ask first / Off
+policy, rate limits and signed approval path. A new action or schema change goes
+through the existing catalog review/quarantine configuration. Arbitrary HTTP
+endpoints, CDP, provider run IDs and browser IDs are not agent inputs.
+
+Hosted execution requires a bound task and agent run. The Apps Test surface can
+use `browser_profiles`; paid starts there are rejected with task guidance. For a
+hosted test, use a real task so ownership, budgets and cleanup are exercised.
+
+## Runtime and lifecycle
+
+The gateway exposes reviewed REST tools to existing native and CLI tool bridges.
+Authorized task/run access contributes the `browser-use-cloud` skill, bundled
+with the connector in `server/src/services/connectors/browser-use-cloud/skill.ts`.
+It is not in the universal `skills/` directory and is not offered to every agent.
+The existing connector assignment resolver requires accessible connection tools
+and a current credential grant. No assignment, disabled tools/connections, or
+revoked access means no skill. The run-scoped bundle exposes its short description
+for discovery and contains the detailed `SKILL.md` for using this connection.
+Adapters that cannot isolate skill files receive the same authorized instructions
+in their run context. Nothing is added to an agent's saved skill preferences.
+Retired `paperclipai/paperclip/browser-use` selections are stripped from runtime
+overlays; unrelated browser skills keep their own names and behavior.
+The idempotent migration updates pre-release app/connection and financial keys
+to `browser-use-cloud` without replacing credentials, grants, or browser records.
+
+The parent agent starts
+a hosted run, polls its status and stays alive until it finishes. Approved starts
+can execute after the requesting turn ends: a ten-minute handoff window lets the
+resumed agent attach by reading status. An expired handoff stops unfinished work.
+
+Four company-scoped tables separate grant settings, conversation ownership, hosted
+runs and browser instances. Each hosted run records its invocation, parent run,
+event cursor and cost checkpoint. A leased reconciler polls minimal status,
+drains bounded event pages, discovers browser instances by conversation, and
+checks each instance's authoritative conversation association. Restarting the
+server resumes reconciliation. A lost paid-create response becomes an explicit
+unknown outcome and is never submitted again automatically; the operator must
+inspect Browser Use before starting replacement work.
+
+Each new ready browser session opens once per task/account in the right panel. A task
+card and the panel launcher reopen it. Switching tabs preserves the iframe.
+Closing the tab hides it; **Close browser** in the footer menu stops the provider browser. **Stop browsing**
+requests hosted-run cancellation. Visible viewers keep completed browsers open;
+leaving the viewer starts a ten-minute idle window.
+**Keep browser open** in the footer menu renews that window, bounded by provider expiry.
+Only the final five minutes show a seconds countdown and a direct **Keep browsing**
+action. **Reconnect view** reloads the live display without restarting browser work.
+The footer has no cost display. **Browser size** defaults to **Fit to pane**.
+A ResizeObserver measures the iframe's actual CSS size and, after 250 ms without
+another meaningful change, applies the remote viewport through CDP. Only the
+newest pending dimensions are retained; requests are serialized. The iframe is
+not reloaded. Fixed presets disable automatic fitting until Fit to pane is chosen.
+Only the visible panel in a visible document resizes. One viewer holds a 20-second
+in-memory lease, renewed every eight seconds and released when hidden/unmounted.
+Other viewers show **Size follows another viewer** and can explicitly choose
+**Fit to this pane instead**. Automatic updates never take over a live lease or
+override a newer fixed selection. A resize failure pauses fitting until a size
+is explicitly selected again. Socket/server restart resets the mode to fitting.
+
+Browser Use's current viewer has a 30-pixel tab strip and 40-pixel navigation bar.
+The Paperclip token `--browser-use-viewer-chrome-height` records that measured
+70-pixel allowance; Paperclip's footer is excluded by observing the iframe itself.
+The provider's published viewer bundle exposes no sizing postMessage contract.
+This keeps navigation available but requires rechecking the allowance if the
+provider changes its chrome; it is not a guaranteed cross-origin measurement.
+Remote dimensions are bounded to 6144 × 3456, scaling proportionally at the limits.
+One-pixel jitter is ignored. These dimensions are browser settings, not UI tokens.
+
+The same menu also offers Phone (390 × 844), Tablet (768 × 1024), Laptop (1280 × 800), Desktop (1440 × 900),
+and **Browser default**. Presets fix the remote page viewport; changing panel size
+scales that viewport. Failed resizes retain the previous selection and show an
+inline error. Follow-up work uses a
+normal task message and `browser_continue`, with the same conversation ID.
+
+Cancellation/failure of the owning run, task cancellation/reassignment,
+agent pause/termination, task pause, budget blocks, grant/access removal and idle
+expiry request cleanup. Completing a task stops unfinished hosted work; a completed
+hosted run retains its idle grace period. Stop is not considered complete until the provider confirms
+it. Terminal event pages and accounting finish before the session closes. Removing
+the app disables its access first, then confirms shutdown before deleting secrets.
+If shutdown is pending, removal returns a retryable conflict; only cleanup retains
+credential access, and retrying removal finishes secret deletion.
+
+## Credential and budget boundaries
+
+The board list and stored tab state contain internal IDs and safe metadata only.
+An authenticated, active, non-viewer company member with access to the exact grant
+can request a viewer URL through a `no-store` endpoint. Agent keys cannot use that
+endpoint. Only the exact HTTPS `live.browser-use.com` origin is accepted. The URL
+lives in component memory, uses `no-referrer`, and is revalidated while hidden.
+Provider events/results are sanitized before persistence or gateway output; live,
+CDP, recording and other URL fields are excluded. Do not put a viewer link in a
+comment, log, tool response or artifact.
+
+Each dispatch uses the minimum of the requested cap, configured grant cap and
+applicable remaining hard company/agent/project budgets. Unconfigured limits do
+not invent a cap. Provider run `totalCostUsd` is recorded through a locked,
+idempotent cumulative checkpoint and feeds normal Paperclip budget enforcement.
+Each positive accounting delta also creates a linked, task-scoped `finance_events`
+row in the same transaction as its `cost_events` row. Reconciliation retries do
+not duplicate either entry. Costs remain available for reporting without appearing
+in the browser footer. These are recorded run charges, not a live invoice. Browser hosting and
+proxy fields are not added separately because their relationship to run totals
+has not been verified; avoid double counting. Concurrent runs are not a shared
+provider-side reservation. Recording is explicitly off. Artifact/file import,
+recordings and arbitrary provider queue interruption are not part of this connection.
+CDP is limited to board-authorized viewport presets and bounded pane dimensions; arbitrary commands and
+credential-bearing CDP addresses are never exposed to the UI or agent tools.
+
+## Validation and live proof
+
+Deterministic tests use the real vault, connection setup, policy/approval gateway,
+Postgres tables, reconciler and routes with a controlled v4 provider fixture.
+They cover paid-create idempotency/uncertainty, ownership, delayed browser readiness,
+viewer authorization and no-store headers, durable event pagination, cost dedup,
+approval handoff, revoked access and shutdown before secret removal. Panel tests
+check iframe preservation and tab closure. Storybook provides the production panel
+with explicitly simulated interactive, idle, closed, failed and revoked states.
+
+For live acceptance, connect a dedicated test credential in the isolated instance:
+
+1. Confirm setup/discovery performs no paid start and the agent receives the tools.
+2. Delegate a harmless public-page task with a small cap; inspect the actual viewer
+ while the run is active and type/click in it.
+3. Switch tabs, close/reopen, stop the hosted agent, keep an idle browser open, and
+ continue through a task message. Verify a second agent or different grant cannot
+ use the conversation or fetch its viewer.
+4. Exercise Ask first, denied access, restart during work, provider rate limiting,
+ idle expiry and connection removal. Confirm provider shutdown and one cost entry
+ per cumulative billed increment without any viewer credential in audit.
+
+The live test-drive used a fresh
+database with one company, one agent and one task; it contains no cloned inbox or
+task history. The connection was configured through the normal setup wizard and
+given a $1 per-run limit with fresh browsers. Browser Use completed a real v4 run
+that explored `paperclip.ing`, visited About and returned to the homepage. The
+recorded run cost was $0.01. The completed browser was visible in Paperclip's
+Browser tab, and manual address-bar navigation and Back worked inside the iframe.
+Keep open renewed the idle countdown. The initial blank viewer recovered after a
+page reload; provider results alone were not treated as proof of the viewer.
+
+An earlier run exposed a runtime transport filter that excluded
+Browser Use REST tools even though the skill was installed. Both runtime tool
+delivery and the native assignment snapshot now include this reviewed REST
+connection, with a regression test covering all seven tools. Live acceptance of
+revocation, approvals, rate limiting and restart recovery remains outstanding;
+those cases currently have deterministic fixture coverage.
+
+## Verification record — 2026-09-29
+
+- Footer redesign: 59 Storybook states across panel, footer, task activity and
+ credential settings. UI typecheck/build, Storybook build, token gates and 34
+ existing panel/state tests pass. Browser walkthrough verified the 5:01/5:00
+ countdown boundary, narrow layout, timer extension, preserved page state after
+ stopping work, reconnect/close controls and saving settings with offline fixtures.
+- Fresh live test: setup/discovery, actual hosted task, completed result, $0.01
+ accounting, interactive iframe navigation, and Keep open verified. The runtime
+ delivery regression suite passes 14 tests; server TypeScript check passes.
+- `pnpm -r typecheck` and `pnpm build`: passed. The final lifecycle changes also
+ passed server typecheck/build and UI typecheck.
+- Browser Use backend: 18 passing tests; task-panel/state/brand tests: 43 passing;
+ shared app-definition tests: 24 passing; gallery route assertion: passing.
+ Existing gateway/connection/removal regression suites: 429 passing tests.
+- `pnpm check:token-gates`, brand asset validation, module boundary validation
+ and `git diff --check`: passed.
+- Browser inspection of the production panel with a simulated provider: typed
+ input survived Properties/Browser tab switches; Stop agent, Keep open and End
+ session behaved correctly; controls remained usable at a 390-pixel viewport.
+- The full `pnpm test:run` attempt was stopped after known failures. Its gallery
+ count assertion was updated for the added app and passed on retry. Its unrelated
+ Slack callback-ordering test passed in isolation. There is no clean full-suite
+ result from this worktree.
+- The optional `pnpm check:tokens` content check finds existing names in unrelated
+ Storybook fixtures. None of the new Browser Use files introduced those matches.
+
+## Provider research
+
+Reviewed on 2026-09-29:
+
+- [v4 overview](https://docs.browser-use.com/cloud/api-v4-overview): current REST
+ base URL and API key header; minimal status polling and terminal summary.
+- [v4 OpenAPI](https://docs.browser-use.com/cloud/openapi/v4.json): run/session/browser
+ identities, continuation by session, events, cancellation, profiles and cost cap.
+- [Live preview and recording](https://docs.browser-use.com/cloud/browser/live-preview):
+ browser-ready event, interactive iframe, credential treatment and recording flags.
+- Official artwork: [Browser Use logo](https://browser-use.com/logo-primary.svg),
+ copied as a sanitized local SVG; provenance is in the app brand manifest.
+
+The connector uses v4 directly. It does not mix v3 MCP task/session methods with
+v4 runs, and it does not substitute Paperclip's existing execution agent adapter.
+
+## Viewer size and Storybook coverage
+
+The iframe fills the available panel height and width without a Paperclip-imposed
+aspect ratio. The provider streams an existing remote viewport, so scaling its
+viewer does not make the website switch responsive breakpoints.
+
+The published v4 `RunBrowserSettings` schema exposes `screenWidth` (320–6144) and
+`screenHeight` (320–3456) at browser creation. Explicit settings on a follow-up
+apply only when provisioning a new browser. The schema does not list
+`allowResizing`, although a live test on 2026-09-29 established that sending
+`browserSettings: { allowResizing: true }` when creating an agent run enables
+runtime viewport resizing. Treat this as verified provider behavior with an
+OpenAPI documentation gap, not a documented contract. The standalone browser
+creation API documents the same opt-in and notes its stealth tradeoff.
+
+Live test results, using the same browser and page throughout each test:
+
+| Browser configuration | Requested viewport | Measured page viewport | Result |
+| --- | --- | --- | --- |
+| Agent run, default resizing policy | 480 × 800, then 900 × 700 | Stayed 1280 × 588 | CDP commands succeeded but had no effect; native window resizing also had no effect |
+| Standalone browser, `allowResizing: true` | 480 × 800, then 900 × 700 | 480 × 800, then 900 × 700 | Responsive layout and screenshot dimensions changed |
+| Agent run, `browserSettings.allowResizing: true` | 480 × 800, then 900 × 700 | 480 × 800, then 900 × 700 | Both changes occurred while run status was `running`; live viewer followed the change |
+
+The successful command was server-side CDP `Emulation.setDeviceMetricsOverride`
+with `width`, `height`, `screenWidth`, `screenHeight`, `deviceScaleFactor: 1`, and
+`mobile: false`. Verification checked `window.innerWidth/innerHeight`, layout
+metrics, PNG screenshot dimensions, and a 600-pixel CSS media query. The media
+query changed with the page width, proving reflow rather than viewer scaling.
+The opted-in agent's 900 × 700 viewport persisted on a check 41 seconds later,
+still during the run; the run subsequently completed. All three disposable cloud
+browsers were confirmed stopped after testing.
+The initial configured screen dimensions were not the actual page viewport;
+browser chrome and device scaling affected the latter.
+
+REST `PATCH /api/v4/browsers/{id}` still rejected both a dimensions-only body and
+`action: "resize"` with HTTP 422. That endpoint documents only `action: "stop"`.
+The live-preview docs do not specify a parent-frame resize message. Browser Use
+does document [CDP attachment to a live v4 agent browser](https://docs.browser-use.com/cloud/agent/network-capture).
+
+Automatic panel-size synchronization is implemented through
+`POST /api/issues/:issueId/browsers/:browserId/viewport`. Fit requests carry bounded
+width/height and a viewer UUID; fixed choices carry a validated preset. All use
+the same company, task, grant and board checks as the viewer. New runs request
+the resizing opt-in. A bounded CDP session verifies actual viewport dimensions,
+reapplies the selection to new page targets, and serializes updates. Browser
+default clears the override while retaining the selected mode. Mode and ownership
+are shared by viewers on the same server process and reset on server/CDP restart.
+Unsupported older browsers retain their existing size and show an actionable error.
+
+The iframe stays mounted across resizing. Only the visible pane observes and
+renews ownership; it debounces changes for 250 ms and coalesces pending updates.
+A 20-second lease prevents concurrent viewers from fighting over dimensions;
+the menu allows explicit takeover. See the interaction details above for viewer
+chrome calibration and the fixed-size escape hatch. Resizing during an agent
+action can invalidate screenshot coordinates; the live test covered a running
+agent observing the page, not concurrent click safety.
+
+Automatic fitting verification on 2026-09-29:
+
+- 60 focused tests passed across viewport scheduling, CDP ownership and validation,
+ connection routes, Browser Use service behavior and task-panel state. UI/server
+ typechecks, UI/Storybook builds and token gates passed.
+- In the embedded Storybook, the page reflowed at 358 × 527 and 798 × 327 while
+ retaining typed input. Phone stayed 390 × 844 when the pane changed. Two viewers
+ correctly handed ownership over through the menu.
+- The fresh test-drive browser received a 478 × 754 Fit request and the backend verified
+ those actual page dimensions. A subsequent real pane maximize/restore changed
+ the remote viewport from 624 × 520 to 1040 × 520 and back through the automatic
+ observer path. Its hosted viewer stayed at `about:blank` in the
+ embedded browser, including after clearing the viewport override and reconnecting.
+ Thus live remote sizing is verified, but a successful visual end-to-end fit in
+ that test-drive remains unverified. The Storybook uses an offline fixture.
+
+Storybook now groups the production panel and its lifecycle states, isolated footer
+and expiry boundaries, task activity/reopening, and credential settings with
+loading/error/access states. Offline interactions exercise keep-open, stop/close,
+reconnect, profile selection, saving and changing/resetting viewport presets.
+The offline viewer simulates reflow at the chosen preset and scales it to fit its
+panel. It is not evidence of provider viewport resizing; that was tested separately.
+
+## Follow-up opening and viewer presence
+
+Browser sessions appear as compact entries in the chronological task feed at
+their creation time, between the request and reply. Status updates stay on the
+same session entry; **Open browser** opens its side-panel tab and **View session**
+shows a closed session. There is no browser list in the task header. Older
+sessions outside the loaded comment window appear when that history is loaded.
+Storybook's **Task activity / Inline History** demonstrates successive sessions.
+
+Each new live session opens its Browser tab once per task and browser tab, including
+follow-up requests after older browsers have closed. Repeated polling does not
+steal focus back after the user switches away. Open requests are acknowledged only
+after the new tab selection has been committed and persisted.
+
+A visible, selected Browser tab sends an authorized presence POST every 30 seconds.
+The server renews the existing idle window (at most once a minute), respecting
+provider expiry and the reconciler's shutdown lease. Hidden tabs and collapsed
+panes stop renewing; closing a viewer does not immediately destroy its browser.
+The ten-minute idle window applies after the last visible presence. Explicit
+Close browser, revoked access, pause/budget gates and provider expiry still win.
+No paid run is started by presence. Each renewal is activity-logged.
+
+The iframe shows a loading state and reconnects once after 15 seconds if its
+document never loads, then shows a recoverable error if the retry also times out.
+Inactive browser tabs do not consume that load window. A viewer that did not
+load cannot own automatic sizing. When a task has several sessions, the tabs use
+the same browser numbers as task activity. A closed tab offers **Open active
+browser** if another live session exists, without starting another paid run.
+On 2026-09-29 the same provider iframe rendered successfully in Chrome, while
+Codex's embedded browser left both the provider and a plain example.com iframe
+at about:blank. After reconnecting to the updated test-drive, the embedded viewer
+also loaded and displayed paperclip.ing. The new-session selection and automatic
+presence renewal were verified there with the same hosted session; no replacement
+paid run was needed.
+
+Follow-up verification: 54 focused tests passed (15 service/route lifecycle tests
+and 39 UI tests), plus UI/server typechecks, UI build and token gates. The original
+hosted session stayed idle and available after its original deadline; viewing
+renewed the deadline automatically. Closing/reopening the tab selected and rendered
+that same session. Proof was captured in the isolated test-drive.
+
+Second hands-on pass reproduced a stale closed tab and a viewer that required
+manual reconnect. A fresh composer request then opened paperclip.ing automatically
+and stayed visible after completion, switching tabs and reloading the task. The
+original stalled-navigation cause remains unproven; the bounded automatic retry
+and closed-tab recovery cover those observed failure paths. Recovery was exercised
+in the actual test-drive; 41 focused UI tests, UI typecheck/build and token gates
+passed. The automatic timeout retry is regression-tested with a non-loading iframe.
+
+## Passkey limitation
+
+The provider's current v4 authentication and live-viewer documentation does not
+document WebAuthn/passkey forwarding from the viewer's device to the cloud
+browser. Do not promise that a local Touch ID or iCloud passkey will work in the
+embedded viewer. The documented alternatives are saved login profiles, passwords
+and TOTP codes, and human entry of verification codes. Profile sync transfers
+login cookies and browser state, not a password manager; sites can reject a
+transferred login or require another verification step. See [profile sync](https://docs.browser-use.com/cloud/guides/profile-sync)
+and [1Password integration](https://docs.browser-use.com/cloud/guides/1password).
+
+## Uncertain starts and rejected continuations
+
+Each paid task includes an opaque invocation marker. The v4 API has no documented
+create idempotency key. If a response is lost or the process stops before saving
+provider identifiers, Paperclip never repeats the paid POST. The reconciler scans
+the documented run list for that exact marker, with a durable pagination cursor.
+Once found, it cancels the run, discovers and stops its browsers, and records cost.
+A missing list entry is not proof that no work exists: cleanup remains pending
+and retains the credential while recovery continues. Each sweep reads at most
+five pages. Continuations restrict recovery to their known provider session.
+
+Definite request rejections (such as HTTP 409 or 429) atomically record a failed
+local run and return its existing browser to idle. That browser remains visible,
+gets a fresh idle grace period, and can still be closed. A crash before commit
+leaves the run eligible for recovery. Provider backoff also applies to cleanup.
+New-browser arrivals are queued in order and are acknowledged only after the
+panel has selected and persisted the tab. Polling cannot claim an unseen arrival.
diff --git a/doc/connections/CONNECTION-SEARCH.md b/doc/connections/CONNECTION-SEARCH.md
new file mode 100644
index 00000000000..dbcb31c816f
--- /dev/null
+++ b/doc/connections/CONNECTION-SEARCH.md
@@ -0,0 +1,64 @@
+# Connection search
+
+`connections_search` accepts a service name or a natural-language query up to
+4,000 characters. It ranks names before capabilities, tolerates extra words,
+split names such as “Agent Mail,” and single-character spelling errors or
+transpositions. Short partial names work too. Capability searches return
+overlapping matches without requiring every query word to occur in the catalog.
+Results are bounded to 40 entries. Exact app names outrank typo matches for
+different apps (for example, Motion is not replaced by Notion). Query preparation
+is shared across the catalog scan.
+
+Discovery includes tool, channel/email, and AI methods. Channel methods follow
+the instance's Chat connectors experimental setting. Each catalog method names
+its `purpose`. Channel and AI methods include a company-scoped `setupPath` to
+their existing setup flow. `connection_request` still creates tool setup cards;
+channel discovery does not turn an email inbox into an executable MCP tool or
+add channel setup to that card.
+
+The agent chooses the relevant match using descriptions and method purposes.
+It should clarify only when the task remains ambiguous. A search match does not
+prove that an account is authorized, that a tool is installed, or that a provider
+can perform every requested action.
+
+## Aggregator discovery
+
+The local support index combines reviewed Arcade/Zapier claims with the public
+[Composio toolkit catalog](https://docs.composio.dev/toolkits). The Composio
+snapshot includes names and toolkit identifiers, a source URL, and a verification
+date. Each result links to its official toolkit page. This covers, for example,
+[Circleback MCP](https://docs.composio.dev/toolkits/circleback_mcp), including
+queries such as “help me find tools for circle back.”
+
+Refresh the snapshot from the official public page with:
+
+```sh
+node scripts/update-composio-search-catalog.mjs
+```
+
+The script also accepts a saved HTML file as its first argument for reproducible
+extraction. Review the resulting diff before committing it. Searches use this
+local snapshot and authorized indexed tool namespaces; they do not send user
+queries to a provider. Broad provider descriptions are not evidence of support.
+Configured connection metadata remains scoped to the current company and
+identity. Archived and unauthorized catalogs cannot establish an aggregator route.
+
+Built-in connections remain preferred for the same app. Existing AI access is
+checked through the agent's AI binding and credential selection. An aggregator route still requires a
+saved provider choice or a verified explicit user request. Fuzzy retrieval never
+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.
+
+## Regression coverage
+
+```sh
+pnpm exec vitest run packages/shared/src/connection-search.test.ts packages/shared/src/connection-routing.test.ts packages/shared/src/validators/connection-intent.test.ts server/src/__tests__/connection-aggregator-fallback.test.ts server/src/__tests__/connection-intents-service.test.ts
+```
+
+The database suite covers the original AgentMail sentence, split names, typos,
+capability overlap, multiple services, AI discovery, experimental gating,
+Circleback/Attio/ClickUp, indexed Executor tools, and provider consent. The native
+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.
diff --git a/doc/connections/CONNECTOR-PERMISSION-AUDIT.md b/doc/connections/CONNECTOR-PERMISSION-AUDIT.md
new file mode 100644
index 00000000000..07942d7504f
--- /dev/null
+++ b/doc/connections/CONNECTOR-PERMISSION-AUDIT.md
@@ -0,0 +1,160 @@
+# Tool connection permission audit — 2026-09-30
+
+This review covers 117 tool methods (84 OAuth methods). The machine-readable
+[source of reviewed defaults](./tool-method-permission-reviews.json) lists each
+method's exact requested scopes, supported actions, restrictions, sources and
+verification limits. AI runtime authentication and chat/channel setup are
+separate contracts and were not changed.
+
+## Shared credential failure
+
+Zapier's secret URL exposed a shared ownership/resolution problem. The same
+invariants apply to personal pasted-key and custom-header methods, including
+Bitly, Cloudflare, Coda, Fireflies, GitHub PATs, Kernel, O'Reilly, PagerDuty,
+PostHog, Postman, Razorpay, Sanity, Similarweb, Stripe, Supabase and You.com.
+Generic MCP setup uses this path too, so “Connect your own” was not a reliable
+workaround. This is a code-path finding, not a claim that every provider was
+tested with a live account.
+
+Personal invocation secrets now belong to the grant's user. Setup, health,
+discovery and the run gateway share ownership checks and canonical credential
+paths. Public unauthenticated URLs need no credential repair. OAuth client
+registration secrets remain company-owned and separate from invocation tokens.
+Existing connections with incorrectly owned credentials require the owner to
+reconnect with a fresh key or secret URL. There is no automatic ownership backfill.
+
+## Changes
+
+- Airtable now requests its seven documented record, schema, comment and
+ workspace/base scopes, including writes.
+- Explicit scope sets were added for providers that advertise a scoped MCP
+ resource, including Beehiiv, Netlify, Miro, Sentry, Supabase, Todoist and
+ TickTick. Read and write remain subject to provider roles and resource selection.
+- Hugging Face adds repository read/contribution and jobs to `read-mcp`.
+ Optional tools still need enabling in HF's MCP settings.
+- Slack's reviewed set now covers the documented message, channel, reaction,
+ canvas, file and list actions. It replaces the obsolete generic search scope
+ with the documented search scopes. The fixed app/approval gate remains.
+- Google write/draft methods take priority over managed read-only methods when
+ available. Existing Google profiles, preview verification and availability
+ gates remain. People and Workspace Search stay read-only.
+- The hosted Fireflies server also exposes meeting sharing, renaming, moving and
+ soundbite creation. Its identity scopes are retained; meeting ownership and
+ team roles decide which mutations succeed.
+- Provider read-only choices stay available under Advanced. Existing OAuth
+ tokens and action restrictions are untouched. Permissions offers reconnect
+ when provider consent needs changing.
+
+## Provider-default exceptions
+
+These are deliberate exceptions to supplying `scopesHint`, not claims that an
+old grant can write. Several servers put resource/permission selection in their
+own consent screen; Box uses registered app scopes, and managed GitHub uses
+installation permissions. An authorization server's general scope catalog is
+not a safe substitute for the MCP permission contract.
+
+| Provider / method | Reason and limits |
+| --- | --- |
+| bitly / `mcp-oauth` | The official MCP quickstart uses browser authorization without client-selected scopes; neither protected-resource nor authorization-server metadata advertises a scope list. Bitly account permissions govern link actions. [Evidence](https://dev.bitly.com/bitly-mcp/overview/quickstart/) |
+| box / `mcp-own-oauth` | Box requires scopes (including Manage AI) on the registered Box app in the Admin Console. Its MCP authorization metadata has no request-scope list; consent and the app registration control file operations. [Evidence](https://support.box.com/hc/en-us/articles/43847256139923-Managing-Box-MCP-Servers) |
+| egnyte / `mcp-oauth` | The hosted authorization server selects the Egnyte tenant/account permissions. Neither MCP nor authorization-server metadata advertises request scopes. Documentation rendered no readable body during this review; tenant-bound write proof remains required. [Evidence](https://developers.egnyte.com/docs/Remote_MCP_Server) |
+| github / `managed` | Managed github.code uses a GitHub App installation and selected repositories. Installation permissions, not OAuth scope strings, grant code and pull-request writes; retain the managed profile. [Evidence](https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/) |
+| make / `mcp-oauth` | Make documents selecting scopes and scenarios during its hosted connection flow. Management tools require a paid plan. Do not replace that resource selection with invented MCP client scopes. [Evidence](https://developers.make.com/mcp-server) |
+| oauth-generic / `oauth` | Operator-defined OAuth endpoints have no provider-specific reviewed scope list. Request only the scopes supplied by the operator; this template is not a curated provider allowlist. [Evidence](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) |
+| planetscale / `mcp-oauth` | PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint. [Evidence](https://planetscale.com/docs/connect/mcp) |
+| planetscale / `mcp-insights-only` | PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint. [Evidence](https://planetscale.com/docs/connect/mcp) |
+| posthog / `mcp-oauth` | PostHog documents the no-scope MCP setup as read/write, with optional readonly and feature filters. The authorization server advertises account administration unrelated to many tools; retain its MCP consent defaults and the existing explicit filters. [Evidence](https://posthog.com/docs/model-context-protocol) |
+| postman / `mcp-oauth-minimal` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
+| postman / `mcp-oauth-code` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
+| postman / `mcp-oauth-full` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
+| razorpay / `mcp-oauth` | Neither protected-resource nor authorization-server metadata advertises scopes. Keep hosted provider consent; the previous official OAuth documentation URL returned 404 during review. Account-bound writes need live confirmation. [Evidence](https://razorpay.com/docs/mcp-server/oauth/) |
+| ticket-tailor / `mcp-oauth` | Hosted authorization controls box-office API-key permissions; do not treat OAuth sign-in as increasing the underlying key permissions. This method requires account-bound proof. [Evidence](https://developers.tickettailor.com/docs/mcp/authentication/) |
+| webflow / `mcp-oauth` | The official MCP setup installs the Bridge App and asks users to authorize sites. Neither protected-resource nor authorization-server metadata publishes a request-scope list; the installed app and site selection govern writes. [Evidence](https://developers.webflow.com/mcp/reference/getting-started) |
+
+## Read-only and provider-controlled methods
+
+Candid, Context7, O'Reilly, Similarweb and You.com expose retrieval/research
+capabilities rather than document/account mutation. PlanetScale's insights-only
+endpoint deliberately excludes query execution. Xero's current published MCP
+scope set includes invoice/report reads and settings access, without invoice
+write permission. Do not widen these using unrelated general API scopes.
+
+Scopes such as `openid`, `global`, `mcp:all` or `workspace:member` do not have to
+contain the word “write” to authorize work. The provider's MCP tool contract,
+role and consent selection determine their meaning. In particular, Cloudflare,
+Vercel, Wix, Kernel and Supermemory retain their provider-side permission gates.
+
+## Evidence and verification boundaries
+
+Official docs and unauthenticated protected-resource/authorization metadata were
+retrieved on 2026-09-30. The review records source URLs per method. Some pages
+(especially Egnyte and Razorpay's old OAuth URL) were unavailable or unreadable;
+those entries explicitly retain that limitation. Embat publishes identity
+metadata but no verified write contract. No account-bound write guarantee is
+made for these entries.
+
+No provider account was used for live read/write verification in this task.
+In particular, public scope metadata is **not** proof that an existing token has
+those permissions or that an account has the required paid plan, resource ACLs,
+admin approval, or Google preview enrollment. Use test accounts/resources for
+that proof before claiming provider-level acceptance.
+
+Backend regressions execute catalog Zapier, generic secret URLs, personal
+bearer/custom headers, organization credentials and public URLs through the
+run-scoped gateway using a fixture transport. They assert canonical persisted
+ownership/declarations and run read and write calls. Reconnect regressions cover
+replacing legacy company credentials with user-owned values and declarations.
+OAuth fixtures assert exact authorization scopes and rejection of an unrelated
+advertised admin scope; they do not contact provider accounts.
+
+The managed worktree has a separate instance configuration and database path.
+Local CLI provisioning was attempted with both minimal and full seed modes;
+both failed while applying the copied database's migrations because
+`tool_connections_transport_check` was missing. The development instance was
+not started from that clone. Clean fixture databases were used for the backend and Apps browser
+checks; their success does not establish successful seeding of that local copy.
+
+### Embedded-browser acceptance
+
+On 2026-09-30, a hands-on walkthrough used the PR checkout's built UI and actual
+server, a fresh isolated database created through CLI onboarding, and a local
+HTTP MCP fixture. Starting from the sidebar's Connectors page, the operator
+selected “Just me,” entered a bearer key, and created and read back a disposable
+widget through the Permissions screen's agent test controls.
+
+After seeding the legacy ownership mismatch in that disposable connection,
+invocation and catalog refresh rejected it with `grant_credential_invalid`.
+The catalog showed “Needs attention” and offered Reconnect. Replacing the key
+through that UI preserved the connection and personal grant, created a fresh
+user-owned secret and canonical declaration, and restored writes. The legacy
+company secret retained its ownership. Separate HTTP calls through a session
+bound to a fixture agent run also completed a write and read-back.
+
+The walkthrough exposed and verified fixes for a false “Still not working”
+message after successful reconnect, incorrect action-input advice for ownership
+errors, and Cancel attempting to save an invalid Zapier URL. The browser
+reconnect regression now performs the replacement through the form and checks
+that the stale warning disappears.
+
+A second personal connection used a secret URL. After reproducing its legacy
+ownership failure, the browser could replace the URL and create/read back a
+widget. Generic reconnect now derives URL/header fields from the stored
+credential placement instead of assuming a bearer key, and rejects replacement
+URLs for a different public endpoint. A new public, organization-wide connection
+also appeared immediately when returning to Browse, without a page reload.
+The walkthrough fixed setup cache invalidation and a cramped reconnect banner.
+
+Zapier's URL validation and cancellation were exercised, but a live Zapier
+connection was not completed. Gmail stopped at instance enrollment. Neither
+journey establishes provider-account consent or live provider read/write proof.
+
+### Automated verification
+
+- Run `pnpm -r typecheck`, `pnpm build`, and `pnpm check:token-gates`.
+- The affected Apps browser suites passed 10 tests, with one existing restart
+ case skipped. These used clean, isolated fixture databases.
+- Run `pnpm test:run` for the full suite. Current-head CI and local results are
+ recorded in the pull request; fixture coverage is distinct from provider proof.
+- New gateway fixtures execute both read and write calls through real run-scoped
+ gateway sessions. They also verify that invalid ownership requires reconnect
+ and that the owner's fresh credentials restore access without changing identity.
diff --git a/doc/connections/CONNECTOR-PLAYBOOK.md b/doc/connections/CONNECTOR-PLAYBOOK.md
index 3b75e99e061..950656cbf21 100644
--- a/doc/connections/CONNECTOR-PLAYBOOK.md
+++ b/doc/connections/CONNECTOR-PLAYBOOK.md
@@ -61,6 +61,59 @@ execution. Extend the provider's existing catalog entry with typed AI methods;
reuse the existing login controllers. See [AI Connections](./AI-CONNECTIONS.md)
for compatibility, personal defaults, resolver isolation, and legacy adoption.
+## Read/write defaults and credential ownership
+
+New tool connections request the provider-documented permissions needed for their
+supported read **and write** actions. Prefer an available write/draft capability
+before a managed read-only method. Read-only capability choices and provider
+read-only switches belong under **Advanced**. Preserve an explicit method on
+resume/reconnect. Keep the Access → Connect flow and manage action restrictions
+on Permissions; changing OAuth configuration never changes existing consent or
+turns an Off/Ask-first action into Allowed.
+
+Every tool method must have a review in
+[`tool-method-permission-reviews.json`](./tool-method-permission-reviews.json).
+It records requested scopes, supported actions, provider restrictions, official
+evidence, and live-proof status. The ingestion script uses its explicit scope
+lists as `scopesHint`; the catalog regression rejects missing reviews, drift,
+and undocumented omitted OAuth scopes. An omission requires a provider-default
+exception explaining how consent/registration grants access. Never automatically
+request all scopes advertised by an authorization server. See the
+[permission audit](./CONNECTOR-PERMISSION-AUDIT.md) for review findings and limits.
+API-key fields must explain required provider permissions; Paperclip cannot
+increase an already-issued key's permissions. Reconnect with fresh consent/key
+when access is insufficient. A provider's explicit `insufficient_scope` response
+becomes an actionable `oauth_insufficient_scope` error; provider response text
+and credentials are not echoed.
+
+All invocation credential writes use `writeConnectionCredential` (setup,
+replacement, reconnect, OAuth completion and rotation). A personal grant requires
+a **user-scoped** secret owned by its subject and a user-secret definition and
+declaration for the connection. Organization/dedicated-agent credentials use
+company secrets and bindings. OAuth **client-registration** secrets remain
+company-owned and are resolved separately from action credentials. Declaration
+paths are canonical (`credentials.authorization`, `headers.X-Api-Key`,
+`remote.url`, `oauth.access_token`), never double-prefixed. Health, discovery,
+board tests, invocation, and version tracking must use the selected grant's
+refs and the same ownership checks. A personal resolver must not fall back to a
+company credential. Ownership mismatch is `grant_credential_invalid` and tells
+the owner to reconnect.
+
+Existing personal connections with company-scoped invocation credentials require
+their owner to reconnect and enter a fresh key or secret URL. Reconnect creates
+a user-owned credential and updates the grant and declarations while preserving
+the connection identity and action policies. Credential ownership is never
+automatically reassigned at startup. Health, discovery and invocation reject an
+invalid ownership layout with an actionable reconnect error.
+
+Verification must assert stored ownership and declarations, then execute a read
+and a write through a real run-scoped gateway. Cover generic and curated URL
+credentials, bearer/custom headers, shared identities, public endpoints, rotation,
+removal, failed-setup cleanup, owner reconnect of legacy credentials, another user,
+and another company. Fixture-backed MCP calls prove Paperclip behavior; they do
+not prove provider consent or account entitlements. Record account-bound live
+read/write proof separately and never describe metadata discovery as live proof.
+
## Contents
- [Mental model and support matrix](#mental-model-five-independent-axes)
@@ -497,6 +550,13 @@ registry in `server/src/services/connector-runtime.ts`; AgentMail is the first
consumer. This registry describes bundled server implementations, not executable
code or skill URLs supplied by a credential or external message.
+Optional connector instructions must not be placed in the universal `skills/`
+directory, which adapters can enumerate for every agent. A trusted contribution
+can provide `skillMarkdown` from its connector module; the server then materializes
+`SKILL.md` only for authorized assignments. Browser Use Cloud uses this path with
+the app key and skill name `browser-use-cloud`, leaving generic browser skill
+names available to other integrations.
+
For each contribution, declare its connector key, bundled skill, namespaced tool
definitions, resource-assignment resolver, and execution handler. Use names such
as `agentmail_send` rather than extending core tools with provider-specific
@@ -2191,6 +2251,16 @@ Collect end-to-end evidence using the production validation matrix above:
- Audit rows prove actor, run/issue context, connection, tool, decision,
reason code, and outcome.
+## Reviewed REST browser connection
+
+[Browser Use Cloud](./BROWSER-USE.md) uses the v4 REST API through the same
+connection grants, catalog, policies, approvals and audit gateway. Its
+`provider_rest` execution path is limited to the reviewed Browser Use adapter;
+adding `rest_api` to a catalog entry does not enable arbitrary HTTP execution.
+The task Browser panel is a human-only credential viewer, separate from agent
+tool results. Follow that guide for lifecycle, profile scope, cost accounting,
+cleanup and the required live acceptance pass.
+
## Slack task tools
For Slack bot tool contributions, use [Slack task tools](SLACK-TASK-TOOLS.md). It
diff --git a/doc/connections/GENERIC-REMOTE-MCP.md b/doc/connections/GENERIC-REMOTE-MCP.md
index c09e8707dba..543c910c63b 100644
--- a/doc/connections/GENERIC-REMOTE-MCP.md
+++ b/doc/connections/GENERIC-REMOTE-MCP.md
@@ -62,6 +62,23 @@ back that step while retaining the established draft identity.
Later health checks still require the user's authorization and return an
actionable `422` error when it is missing.
+### Personal apps on shared agents
+
+Installing a personal app on an agent does not require every user who runs that
+agent to connect the app. Runs start without probing optional apps or warning
+about another user's missing credentials. The installed app's cached tools stay
+available even when its shared health check needs attention.
+
+Authorization happens when the agent calls an app tool. Paperclip uses the run's
+responsible user, never another user's personal grant. If that user has not
+connected the app, the tool returns `user_authorization_required` and adds an
+inline connection request. Unrelated work can continue without using the app.
+Disabled or uninstalled apps remain unavailable.
+
+Optional assigned apps do not emit run-start connection warnings, including
+unavailable shared apps. Their health state and reconnect controls remain in
+Apps. An unrelated run does not need to act on that state.
+
### Slack app access
If Slack reports that MCP access is disabled for the app, ask the Slack app
diff --git a/doc/connections/GOOGLE-WORKSPACE.md b/doc/connections/GOOGLE-WORKSPACE.md
index 74187eee435..98b256a4d8b 100644
--- a/doc/connections/GOOGLE-WORKSPACE.md
+++ b/doc/connections/GOOGLE-WORKSPACE.md
@@ -159,6 +159,40 @@ operations. Write profiles add only the reviewed write operations for their app;
destructive or unreviewed tools do not become available merely because Google
adds them upstream.
+### Service-specific minimum scopes (2026-09-30)
+
+Docs, Sheets, and Slides request only their service's read-only scope in the
+read profile and its read/write scope in the write profile. They do not also
+request `drive.readonly` or `drive.file`: those are authorization alternatives,
+not additional requirements. Drive and Workspace Search retain their separate
+Drive permissions. Calendar write requests `calendar.calendarlist.readonly`
+and `calendar.events`; the latter also authorizes `suggest_time`. Calendar read
+retains `calendar.events.freebusy` alongside list/event read-only access.
+
+References: Google's [Docs read](https://developers.google.com/workspace/docs/api/reference/mcp/tools_list/read_doc)
+and [update](https://developers.google.com/workspace/docs/api/reference/mcp/tools_list/update_doc),
+[Sheets read](https://developers.google.com/workspace/sheets/api/reference/mcp/tools_list/get_spreadsheet)
+and [update](https://developers.google.com/workspace/sheets/api/reference/mcp/tools_list/update_values),
+[Slides read](https://developers.google.com/workspace/slides/api/reference/mcp/tools_list/read_presentation)
+and [update](https://developers.google.com/workspace/slides/api/reference/mcp/tools_list/update_presentation),
+and [Calendar suggest_time](https://developers.google.com/workspace/calendar/api/v3/reference/mcp/tools_list/suggest_time).
+
+The write scopes support editing existing accessible files by ID. `drive.file`
+is a valid narrower alternative for app-authorized files, but would require a
+different per-file authorization workflow. Read-only profiles remain separate;
+the project-wide union is not the scope set requested by every connection.
+
+Deploy with the matching Cloud broker registry and test fresh grants in staging
+before production. Signed authorization and refresh requests use exact scope
+sets, so mixed versions fail closed. The broker rejects old broader grants and
+refresh responses without explicit scope evidence for these reduced profiles.
+Reconnect affected connections; do not relabel or globally revoke existing
+tokens. Customer-owned methods request the same reduced sets on new consent;
+previously issued grants are not retroactively narrowed. The 21-scope integration
+union is unchanged by these profile-level reductions. Console must still keep
+Drive/free-busy entries required by other profiles and separately used identity
+scopes. Fresh provider proof is a release requirement, not implied by unit tests.
+
### Google Chat scope reduction (2026-09-22)
`chat.read` requests only `chat.spaces.readonly` and `chat.messages.readonly`.
diff --git a/doc/connections/tool-method-permission-reviews.json b/doc/connections/tool-method-permission-reviews.json
new file mode 100644
index 00000000000..162bc2b09cc
--- /dev/null
+++ b/doc/connections/tool-method-permission-reviews.json
@@ -0,0 +1,2149 @@
+{
+ "reviewedAt": "2026-09-30",
+ "evidenceLevel": "Official documentation and public MCP metadata; no account-bound read/write proof. Runtime discovery never expands this allowlist.",
+ "methods": [
+ {
+ "app": "airtable",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "data.records:read",
+ "data.records:write",
+ "schema.bases:read",
+ "schema.bases:write",
+ "data.recordComments:read",
+ "data.recordComments:write",
+ "workspacesAndBases:read"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update records, schema and record comments in selected bases.",
+ "evidence": [
+ "https://airtable.com/developers/agents/mcp/getting-started",
+ "https://support.airtable.com/articles/9897799762-using-the-airtable-mcp-server",
+ "https://mcp.airtable.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "api-key-generic",
+ "method": "api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Actions depend on the operator-supplied API and key; grant read/write on the required resources at the provider.",
+ "evidence": [
+ "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Actions depend on the operator-supplied API and key; grant read/write on the required resources at the provider. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "arcade",
+ "method": "mcp",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Actions depend on the user-configured endpoint and its upstream authorizations.",
+ "evidence": [
+ "https://docs.arcade.dev/en/operate/governance/mcp-gateways"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "asana",
+ "method": "mcp-own-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "default"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update tasks and projects authorized by the account.",
+ "evidence": [
+ "https://developers.asana.com/docs/integrating-with-asanas-mcp-server",
+ "https://mcp.asana.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "beehiiv",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "read",
+ "write"
+ ],
+ "capability": "write",
+ "supportedActions": "Publication/subscriber actions exposed by the MCP catalog.",
+ "evidence": [
+ "https://www.beehiiv.com/features/mcp/getting-started",
+ "https://mcp.beehiiv.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "bitly",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Create/manage links in authorized groups.",
+ "evidence": [
+ "https://dev.bitly.com/bitly-mcp/overview/quickstart/",
+ "https://api-ssl.bitly.com/.well-known/oauth-protected-resource",
+ "https://api-ssl.bitly.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The official MCP quickstart uses browser authorization without client-selected scopes; neither protected-resource nor authorization-server metadata advertises a scope list. Bitly account permissions govern link actions."
+ },
+ {
+ "app": "bitly",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Create/manage links in authorized groups.",
+ "evidence": [
+ "https://dev.bitly.com/bitly-mcp/overview/quickstart/",
+ "https://api-ssl.bitly.com/.well-known/oauth-protected-resource",
+ "https://api-ssl.bitly.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Create/manage links in authorized groups. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "box",
+ "method": "mcp-own-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "File/folder actions exposed by the configured Box MCP app; app registration and content ACLs apply.",
+ "evidence": [
+ "https://support.box.com/hc/en-us/articles/43847256139923-Managing-Box-MCP-Servers",
+ "https://mcp.box.com/.well-known/oauth-protected-resource",
+ "https://api.box.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Box requires scopes (including Manage AI) on the registered Box app in the Admin Console. Its MCP authorization metadata has no request-scope list; consent and the app registration control file operations."
+ },
+ {
+ "app": "brex",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "offline_access",
+ "email",
+ "users.readonly",
+ "departments.readonly",
+ "locations.readonly",
+ "titles.readonly",
+ "legal_entities.readonly",
+ "cards.readonly",
+ "cards",
+ "companies.readonly",
+ "budgets.readonly",
+ "travel.trips.readonly",
+ "expenses.card.readonly",
+ "expenses.card",
+ "expenses.bill",
+ "accounts.cash.readonly",
+ "vendors.readonly",
+ "accounting.integration.read",
+ "accounting.record.read"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Own card/expense memos, receipts, attendees and spend limits. No reimbursement creation or expense approval through MCP.",
+ "evidence": [
+ "https://www.brex.com/support/using-brex-in-ai-apps",
+ "https://api.brex.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "browser-use-cloud",
+ "method": "cloud-v4",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Create/stop browser sessions and run browser tasks under the API key.",
+ "evidence": [
+ "https://docs.browser-use.com/cloud/api-v4-overview"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Create/stop browser sessions and run browser tasks under the API key. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "candid",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "profile",
+ "email"
+ ],
+ "capability": "read",
+ "supportedActions": "None: nonprofit/funder discovery and research.",
+ "evidence": [
+ "https://learning.candid.org/getting-started-with-the-candid-mcp-connector/375441",
+ "https://mcp.candid.org/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "clickhouse",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "mcp:access",
+ "clickstack:access",
+ "openid",
+ "profile",
+ "email"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "ClickStack dashboards, saved searches and alerts; selected service access applies.",
+ "evidence": [
+ "https://clickhouse.com/blog/announcing-managed-clickstack-mcp-server",
+ "https://mcp.clickhouse.cloud/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "cloudflare",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "user:read",
+ "account:read"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Cloudflare API actions selected at provider consent or on the API token. Identity scopes alone do not grant account writes.",
+ "evidence": [
+ "https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/",
+ "https://mcp.cloudflare.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "cloudflare",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Cloudflare API actions selected at provider consent or on the API token. Identity scopes alone do not grant account writes.",
+ "evidence": [
+ "https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/",
+ "https://mcp.cloudflare.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Cloudflare API actions selected at provider consent or on the API token. Identity scopes alone do not grant account writes. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "cloudinary",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "profile",
+ "email",
+ "offline_access",
+ "asset_management",
+ "upload",
+ "media_generation"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Upload, manage and generate media in the authorized product environment.",
+ "evidence": [
+ "https://cloudinary.com/documentation/cloudinary_llm_mcp",
+ "https://asset-management.mcp.cloudinary.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "coda",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "mcp:all"
+ ],
+ "capability": "write",
+ "supportedActions": "Modify documents/tables permitted by the account.",
+ "evidence": [
+ "https://help.coda.io/hc/en-us/articles/44722769665549-Security-recommendations-for-the-Coda-MCP",
+ "https://coda.io/.well-known/oauth-protected-resource/apis/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "coda",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Modify documents/tables permitted by the account.",
+ "evidence": [
+ "https://help.coda.io/hc/en-us/articles/44722769665549-Security-recommendations-for-the-Coda-MCP",
+ "https://coda.io/.well-known/oauth-protected-resource/apis/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Modify documents/tables permitted by the account. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "cognee",
+ "method": "cloud-local",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Add/process knowledge and manage authorized datasets.",
+ "evidence": [
+ "https://docs.cognee.ai/cognee-cloud/connections/cloud-mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Add/process knowledge and manage authorized datasets. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "composio",
+ "method": "mcp",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Actions depend on the configured toolkits and upstream connected accounts.",
+ "evidence": [
+ "https://docs.composio.dev/docs/composio-connect"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "context7",
+ "method": "mcp",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "None: library documentation retrieval.",
+ "evidence": [
+ "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "egnyte",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Account-dependent file operations; live write verification outstanding.",
+ "evidence": [
+ "https://developers.egnyte.com/docs/Remote_MCP_Server",
+ "https://mcp-server.egnyte.com/.well-known/oauth-protected-resource",
+ "https://mcp-oauth.egnyte.com/.well-known/oauth-authorization-server/egnyte-connect"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The hosted authorization server selects the Egnyte tenant/account permissions. Neither MCP nor authorization-server metadata advertises request scopes. Documentation rendered no readable body during this review; tenant-bound write proof remains required."
+ },
+ {
+ "app": "embat",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "email",
+ "offline_access",
+ "openid",
+ "profile"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Provider/account dependent; published metadata is identity-only, so no write guarantee.",
+ "evidence": [
+ "https://tellme.embat.io/.well-known/oauth-protected-resource/mcp",
+ "https://complete-book-76.authkit.app/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "executor",
+ "method": "mcp",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Actions depend on the custom MCP endpoint and configured services.",
+ "evidence": [
+ "https://executor.sh/docs/mcp-proxy"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "fireflies",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "email",
+ "profile"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Share/revoke meeting access, rename/move meetings and create soundbites where the authenticated owner or team-admin role permits. The MCP resource requests profile/email, not separate mutation scopes.",
+ "evidence": [
+ "https://docs.fireflies.ai/getting-started/mcp-configuration",
+ "https://api.fireflies.ai/.well-known/oauth-protected-resource",
+ "https://docs.fireflies.ai/mcp-tools/overview"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "fireflies",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Share/revoke meeting access, rename/move meetings and create soundbites where the authenticated owner or team-admin role permits. The MCP resource requests profile/email, not separate mutation scopes.",
+ "evidence": [
+ "https://docs.fireflies.ai/getting-started/mcp-configuration",
+ "https://api.fireflies.ai/.well-known/oauth-protected-resource",
+ "https://docs.fireflies.ai/mcp-tools/overview"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Use an API key for an account with write access to the meetings your agents need to share, rename, move or turn into soundbites. Paperclip cannot increase the key\u2019s permissions."
+ },
+ {
+ "app": "github",
+ "method": "managed",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Repository contents, issues, pull requests and other granted toolsets; selected repos and installation/PAT permissions apply.",
+ "evidence": [
+ "https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Managed github.code uses a GitHub App installation and selected repositories. Installation permissions, not OAuth scope strings, grant code and pull-request writes; retain the managed profile.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "github",
+ "method": "mcp-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Repository contents, issues, pull requests and other granted toolsets; selected repos and installation/PAT permissions apply.",
+ "evidence": [
+ "https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Repository contents, issues, pull requests and other granted toolsets; selected repos and installation/PAT permissions apply. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "gmail",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search and read messages, threads, drafts, and labels.",
+ "evidence": [
+ "https://developers.google.com/workspace/gmail/api/reference/mcp",
+ "https://gmailmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "gmail",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search and read messages, threads, drafts, and labels.",
+ "evidence": [
+ "https://developers.google.com/workspace/gmail/api/reference/mcp",
+ "https://gmailmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "gmail",
+ "method": "paperclip-draft",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly",
+ "https://www.googleapis.com/auth/gmail.compose"
+ ],
+ "capability": "write",
+ "supportedActions": "Read Gmail and create drafts for review in Gmail.",
+ "evidence": [
+ "https://developers.google.com/workspace/gmail/api/reference/mcp",
+ "https://gmailmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "gmail",
+ "method": "customer-draft-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly",
+ "https://www.googleapis.com/auth/gmail.compose"
+ ],
+ "capability": "write",
+ "supportedActions": "Read Gmail and create drafts for review in Gmail.",
+ "evidence": [
+ "https://developers.google.com/workspace/gmail/api/reference/mcp",
+ "https://gmailmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-calendar",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
+ "https://www.googleapis.com/auth/calendar.events.freebusy",
+ "https://www.googleapis.com/auth/calendar.events.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read calendars, events, and availability.",
+ "evidence": [
+ "https://developers.google.com/workspace/calendar/api/reference/mcp",
+ "https://calendarmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "google-calendar",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
+ "https://www.googleapis.com/auth/calendar.events.freebusy",
+ "https://www.googleapis.com/auth/calendar.events.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read calendars, events, and availability.",
+ "evidence": [
+ "https://developers.google.com/workspace/calendar/api/reference/mcp",
+ "https://calendarmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "google-calendar",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
+ "https://www.googleapis.com/auth/calendar.events"
+ ],
+ "capability": "write",
+ "supportedActions": "Create, update, respond to, and delete events.",
+ "evidence": [
+ "https://developers.google.com/workspace/calendar/api/reference/mcp",
+ "https://calendarmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "google-calendar",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
+ "https://www.googleapis.com/auth/calendar.events"
+ ],
+ "capability": "write",
+ "supportedActions": "Create, update, respond to, and delete events.",
+ "evidence": [
+ "https://developers.google.com/workspace/calendar/api/reference/mcp",
+ "https://calendarmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "google-chat",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/chat.spaces.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search conversations and read messages.",
+ "evidence": [
+ "https://developers.google.com/workspace/chat/api/reference/mcp",
+ "https://chatmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-chat",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/chat.spaces.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search conversations and read messages.",
+ "evidence": [
+ "https://developers.google.com/workspace/chat/api/reference/mcp",
+ "https://chatmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-chat",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/chat.spaces.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly",
+ "https://www.googleapis.com/auth/chat.messages.create"
+ ],
+ "capability": "write",
+ "supportedActions": "Read Chat and send messages.",
+ "evidence": [
+ "https://developers.google.com/workspace/chat/api/reference/mcp",
+ "https://chatmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-chat",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/chat.spaces.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly",
+ "https://www.googleapis.com/auth/chat.messages.create"
+ ],
+ "capability": "write",
+ "supportedActions": "Read Chat and send messages.",
+ "evidence": [
+ "https://developers.google.com/workspace/chat/api/reference/mcp",
+ "https://chatmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-docs",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/documents.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read document text and structure.",
+ "evidence": [
+ "https://developers.google.com/workspace/docs/api/reference/mcp",
+ "https://docsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-docs",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/documents.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read document text and structure.",
+ "evidence": [
+ "https://developers.google.com/workspace/docs/api/reference/mcp",
+ "https://docsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-docs",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/documents"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update documents.",
+ "evidence": [
+ "https://developers.google.com/workspace/docs/api/reference/mcp",
+ "https://docsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-docs",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/documents"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update documents.",
+ "evidence": [
+ "https://developers.google.com/workspace/docs/api/reference/mcp",
+ "https://docsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-drive",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search and read files and metadata.",
+ "evidence": [
+ "https://developers.google.com/workspace/drive/api/reference/mcp",
+ "https://drivemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-drive",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/drive.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search and read files and metadata.",
+ "evidence": [
+ "https://developers.google.com/workspace/drive/api/reference/mcp",
+ "https://drivemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-drive",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/drive.file"
+ ],
+ "capability": "write",
+ "supportedActions": "Read files and create or copy files.",
+ "evidence": [
+ "https://developers.google.com/workspace/drive/api/reference/mcp",
+ "https://drivemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-drive",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/drive.file"
+ ],
+ "capability": "write",
+ "supportedActions": "Read files and create or copy files.",
+ "evidence": [
+ "https://developers.google.com/workspace/drive/api/reference/mcp",
+ "https://drivemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-people",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/directory.readonly",
+ "https://www.googleapis.com/auth/userinfo.profile",
+ "https://www.googleapis.com/auth/contacts.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search contacts, directory people, and your profile.",
+ "evidence": [
+ "https://developers.google.com/people/api/mcp",
+ "https://people.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-people",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/directory.readonly",
+ "https://www.googleapis.com/auth/userinfo.profile",
+ "https://www.googleapis.com/auth/contacts.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search contacts, directory people, and your profile.",
+ "evidence": [
+ "https://developers.google.com/people/api/mcp",
+ "https://people.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-sheets",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/spreadsheets.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read spreadsheet values and structure.",
+ "evidence": [
+ "https://developers.google.com/workspace/sheets/api/reference/mcp",
+ "https://sheetsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-sheets",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/spreadsheets.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read spreadsheet values and structure.",
+ "evidence": [
+ "https://developers.google.com/workspace/sheets/api/reference/mcp",
+ "https://sheetsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-sheets",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/spreadsheets"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update spreadsheet values, formulas, and dimensions.",
+ "evidence": [
+ "https://developers.google.com/workspace/sheets/api/reference/mcp",
+ "https://sheetsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-sheets",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/spreadsheets"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update spreadsheet values, formulas, and dimensions.",
+ "evidence": [
+ "https://developers.google.com/workspace/sheets/api/reference/mcp",
+ "https://sheetsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-sheets",
+ "method": "local",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Share only named spreadsheets with the Paperclip robot account.",
+ "evidence": [
+ "https://developers.google.com/workspace/sheets/api/reference/mcp",
+ "https://sheetsmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-slides",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/presentations.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read presentation slides and content.",
+ "evidence": [
+ "https://developers.google.com/workspace/slides/api/reference/mcp",
+ "https://slidesmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-slides",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/presentations.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Read presentation slides and content.",
+ "evidence": [
+ "https://developers.google.com/workspace/slides/api/reference/mcp",
+ "https://slidesmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-slides",
+ "method": "paperclip-write",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/presentations"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update presentations.",
+ "evidence": [
+ "https://developers.google.com/workspace/slides/api/reference/mcp",
+ "https://slidesmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-slides",
+ "method": "customer-write-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/presentations"
+ ],
+ "capability": "write",
+ "supportedActions": "Read and update presentations.",
+ "evidence": [
+ "https://developers.google.com/workspace/slides/api/reference/mcp",
+ "https://slidesmcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-workspace-search",
+ "method": "paperclip-read",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/calendar.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search Gmail, Drive, Calendar, and Chat without write access.",
+ "evidence": [
+ "https://developers.google.com/workspace/guides/universal-search-mcp",
+ "https://workspacemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "google-workspace-search",
+ "method": "customer-read-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "https://www.googleapis.com/auth/gmail.readonly",
+ "https://www.googleapis.com/auth/drive.readonly",
+ "https://www.googleapis.com/auth/calendar.readonly",
+ "https://www.googleapis.com/auth/chat.messages.readonly"
+ ],
+ "capability": "read",
+ "supportedActions": "Search Gmail, Drive, Calendar, and Chat without write access.",
+ "evidence": [
+ "https://developers.google.com/workspace/guides/universal-search-mcp",
+ "https://workspacemcp.googleapis.com/.well-known/oauth-protected-resource/mcp/v1"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "honcho",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Create peers/sessions and save memory under the API key project.",
+ "evidence": [
+ "https://honcho.dev/docs/v3/guides/integrations/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Create peers/sessions and save memory under the API key project. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "hugging-face",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "read-mcp",
+ "read-repos",
+ "contribute-repos",
+ "jobs"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/contribute repositories and schedule/run jobs; users must enable those tools in HF MCP settings. Paid compute still requires an eligible account.",
+ "evidence": [
+ "https://huggingface.co/docs/hub/en/agents-mcp",
+ "https://huggingface.co/docs/hub/agents-mcp",
+ "https://huggingface.co/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "jira",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "read:me",
+ "read:account",
+ "offline_access",
+ "email",
+ "read:jira-work",
+ "write:jira-work",
+ "search:confluence",
+ "read:confluence-user",
+ "read:page:confluence",
+ "write:page:confluence",
+ "read:comment:confluence",
+ "write:comment:confluence",
+ "read:space:confluence",
+ "read:hierarchical-content:confluence",
+ "write:component:compass",
+ "read:component:compass",
+ "read:scorecard:compass",
+ "write:scorecard:compass",
+ "read:event:compass",
+ "read:metric:compass",
+ "read:all:twg",
+ "write:all:twg"
+ ],
+ "capability": "write",
+ "supportedActions": "Jira issues, Confluence pages/comments and Compass components/scorecards. Admin policy and consent toolset choices apply.",
+ "evidence": [
+ "https://support.atlassian.com/atlassian-rovo-mcp-server/docs/getting-started-with-the-atlassian-remote-mcp-server/",
+ "https://mcp.atlassian.com/.well-known/oauth-protected-resource/v1/mcp/authv2"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "kernel",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Launch/manage browsers, profiles, apps and browser automation.",
+ "evidence": [
+ "https://www.kernel.sh/docs/reference/mcp-server/",
+ "https://mcp.onkernel.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "kernel",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Launch/manage browsers, profiles, apps and browser automation.",
+ "evidence": [
+ "https://www.kernel.sh/docs/reference/mcp-server/",
+ "https://mcp.onkernel.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Launch/manage browsers, profiles, apps and browser automation. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "linear",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "read",
+ "write"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update issues and other authorized workspace resources.",
+ "evidence": [
+ "https://mcp.linear.app/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "local-falcon",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "api",
+ "offline_access"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Account-authorized scans/campaigns; subscription credits apply.",
+ "evidence": [
+ "https://docs.localfalcon.com/",
+ "https://mcp.localfalcon.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "make",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Run selected scenarios; paid plans additionally manage scenarios, data stores and teams.",
+ "evidence": [
+ "https://developers.make.com/mcp-server",
+ "https://mcp.make.com/.well-known/oauth-protected-resource",
+ "https://www.make.com/.well-known/oauth-authorization-server/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Make documents selecting scopes and scenarios during its hosted connection flow. Management tools require a paid plan. Do not replace that resource selection with invented MCP client scopes."
+ },
+ {
+ "app": "manufact",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "profile",
+ "email",
+ "offline_access"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Deploy/redeploy/stop servers and edit server configuration under the signed-in role.",
+ "evidence": [
+ "https://docs.manufact.com/mcp",
+ "https://mcp.manufact.com/.well-known/oauth-protected-resource/mcp",
+ "https://cloud.manufact.com/.well-known/oauth-authorization-server/api/auth"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "mem0",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Add/update/delete memories under the API key account.",
+ "evidence": [
+ "https://docs.mem0.ai/platform/mem0-mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Add/update/delete memories under the API key account. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "miro",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "boards:read",
+ "boards:write",
+ "openid",
+ "email"
+ ],
+ "capability": "write",
+ "supportedActions": "Create board content/diagrams and act on comments; board/team ACLs apply.",
+ "evidence": [
+ "https://help.miro.com/hc/en-us/articles/31625301583890-How-to-enable-Miro-s-MCP-Server-user-guide",
+ "https://mcp.miro.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "mixpanel",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "projects",
+ "analysis",
+ "events",
+ "insights",
+ "segmentation",
+ "retention",
+ "data:read",
+ "funnels",
+ "flows",
+ "data_definitions",
+ "alerts",
+ "annotations",
+ "bookmarks",
+ "business_context",
+ "cohorts",
+ "context",
+ "custom_alerts",
+ "custom_events",
+ "custom_properties",
+ "dashboard_reports",
+ "experiments",
+ "feature_flags",
+ "metrics",
+ "user_details"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Metadata, annotations, cohorts and enabled management tools; project role still governs each action.",
+ "evidence": [
+ "https://mixpanel.com/blog/mixpanel-mcp-server/",
+ "https://mcp.mixpanel.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "netlify",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "offline_access",
+ "read",
+ "write"
+ ],
+ "capability": "write",
+ "supportedActions": "Deploy/manage sites via the account; no Claude-specific scope is required for Paperclip.",
+ "evidence": [
+ "https://docs.netlify.com/build/build-with-ai/agent-setup-guides/agent-setup-overview/",
+ "https://netlify-mcp.netlify.app/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "notion",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "default"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update pages and databases shared with the authenticated account.",
+ "evidence": [
+ "https://developers.notion.com/guides/mcp/build-mcp-client",
+ "https://mcp.notion.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "oauth-generic",
+ "method": "oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Actions and scope requirements depend on the operator-supplied provider.",
+ "evidence": [
+ "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Operator-defined OAuth endpoints have no provider-specific reviewed scope list. Request only the scopes supplied by the operator; this template is not a curated provider allowlist.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "oreilly",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "offline_access"
+ ],
+ "capability": "read",
+ "supportedActions": "None: content discovery and retrieval.",
+ "evidence": [
+ "https://learning.oreilly.com/apidocs/mcp/content/",
+ "https://api.oreilly.com/.well-known/oauth-protected-resource/api/content-discovery/v1/mcp/"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "oreilly",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "None: content discovery and retrieval.",
+ "evidence": [
+ "https://learning.oreilly.com/apidocs/mcp/content/",
+ "https://api.oreilly.com/.well-known/oauth-protected-resource/api/content-discovery/v1/mcp/"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "None: content discovery and retrieval. A read-only key is sufficient."
+ },
+ {
+ "app": "pagerduty",
+ "method": "mcp-api-key-us",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Incident and on-call changes require a full-access API key and role access.",
+ "evidence": [
+ "https://support.pagerduty.com/main/docs/pagerduty-mcp-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Incident and on-call changes require a full-access API key and role access. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "pagerduty",
+ "method": "mcp-api-key-eu",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Incident and on-call changes require a full-access API key and role access.",
+ "evidence": [
+ "https://support.pagerduty.com/main/docs/pagerduty-mcp-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Incident and on-call changes require a full-access API key and role access. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "planetscale",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "SQL writes and database actions only when selected at provider consent; insights-only remains read only.",
+ "evidence": [
+ "https://planetscale.com/docs/connect/mcp",
+ "https://mcp.pscale.dev/.well-known/oauth-protected-resource/mcp/planetscale",
+ "https://mcp.pscale.dev/.well-known/oauth-protected-resource/mcp/planetscale-insights-only",
+ "https://mcp.pscale.dev/.well-known/oauth-authorization-server/mcp/planetscale-insights-only",
+ "https://api.planetscale.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint."
+ },
+ {
+ "app": "planetscale",
+ "method": "mcp-insights-only",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "SQL writes and database actions only when selected at provider consent; insights-only remains read only.",
+ "evidence": [
+ "https://planetscale.com/docs/connect/mcp",
+ "https://mcp.pscale.dev/.well-known/oauth-protected-resource/mcp/planetscale",
+ "https://mcp.pscale.dev/.well-known/oauth-protected-resource/mcp/planetscale-insights-only",
+ "https://mcp.pscale.dev/.well-known/oauth-authorization-server/mcp/planetscale-insights-only",
+ "https://api.planetscale.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint."
+ },
+ {
+ "app": "posthog",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Analytics objects, feature flags, experiments, error triage and other enabled product actions. readonly/feature/tool filters remain enforced.",
+ "evidence": [
+ "https://posthog.com/docs/model-context-protocol",
+ "https://mcp.posthog.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "PostHog documents the no-scope MCP setup as read/write, with optional readonly and feature filters. The authorization server advertises account administration unrelated to many tools; retain its MCP consent defaults and the existing explicit filters."
+ },
+ {
+ "app": "posthog",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Analytics objects, feature flags, experiments, error triage and other enabled product actions. readonly/feature/tool filters remain enforced.",
+ "evidence": [
+ "https://posthog.com/docs/model-context-protocol",
+ "https://mcp.posthog.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Analytics objects, feature flags, experiments, error triage and other enabled product actions. readonly/feature/tool filters remain enforced. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-oauth-minimal",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-oauth-code",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-oauth-full",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "write",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-eu-key-minimal",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-eu-key-code",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "postman",
+ "method": "mcp-eu-key-full",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "write",
+ "supportedActions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role.",
+ "evidence": [
+ "https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server",
+ "https://mcp.postman.com/.well-known/oauth-protected-resource",
+ "https://mcp.postman.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Collection/workspace/API actions supported by the selected minimal/code/full endpoint and account role. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "railway",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "offline_access",
+ "workspace:member"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Project/service/deployment operations in authorized workspaces; workspace:member and account role bound access.",
+ "evidence": [
+ "https://docs.railway.com/ai/mcp-server",
+ "https://mcp.railway.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "razorpay",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Provider-authorized payment/account tools; financial policy gates remain. Live verification outstanding.",
+ "evidence": [
+ "https://razorpay.com/docs/mcp-server/oauth/",
+ "https://mcp.razorpay.com/.well-known/oauth-protected-resource",
+ "https://mcp.razorpay.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Neither protected-resource nor authorization-server metadata advertises scopes. Keep hosted provider consent; the previous official OAuth documentation URL returned 404 during review. Account-bound writes need live confirmation.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "razorpay",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Provider-authorized payment/account tools; financial policy gates remain. Live verification outstanding.",
+ "evidence": [
+ "https://razorpay.com/docs/mcp-server/oauth/",
+ "https://mcp.razorpay.com/.well-known/oauth-protected-resource",
+ "https://mcp.razorpay.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Provider-authorized payment/account tools; financial policy gates remain. Live verification outstanding. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions.",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "resend",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "full_access"
+ ],
+ "capability": "write",
+ "supportedActions": "Send email and manage domains/templates/account resources. full_access covers the MCP management tools as well as sending.",
+ "evidence": [
+ "https://resend.com/changelog/remote-mcp-server",
+ "https://mcp.resend.com/.well-known/oauth-protected-resource",
+ "https://api.resend.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "sanity",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "global"
+ ],
+ "capability": "write",
+ "supportedActions": "Edit content permitted by project role; global is MCP authorization, not a bypass of project ACLs.",
+ "evidence": [
+ "https://www.sanity.io/docs/ai/mcp-server",
+ "https://mcp.sanity.io/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "sanity",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Edit content permitted by project role; global is MCP authorization, not a bypass of project ACLs.",
+ "evidence": [
+ "https://www.sanity.io/docs/ai/mcp-server",
+ "https://mcp.sanity.io/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Edit content permitted by project role; global is MCP authorization, not a bypass of project ACLs. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "sentry",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "org:read",
+ "project:write",
+ "team:write",
+ "event:write",
+ "alerts:write"
+ ],
+ "capability": "write",
+ "supportedActions": "Manage projects/teams, triage issues and edit alerts under the authorized organization role.",
+ "evidence": [
+ "https://mcp.sentry.dev/.well-known/oauth-authorization-server",
+ "https://mcp.sentry.dev/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "shopify",
+ "method": "ucp-commerce",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Storefront cart operations; checkout/purchase and account privileges remain provider-controlled.",
+ "evidence": [
+ "https://shopify.dev/docs/apps/build/storefront-mcp/servers/storefront"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "shopify",
+ "method": "storefront-mcp",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Storefront cart operations; checkout/purchase and account privileges remain provider-controlled.",
+ "evidence": [
+ "https://shopify.dev/docs/apps/build/storefront-mcp/servers/storefront"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "similarweb",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "None: analytics retrieval; subscription entitlements apply.",
+ "evidence": [
+ "https://developers.similarweb.com/docs/similarweb-mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "None: analytics retrieval; subscription entitlements apply. A read-only key is sufficient."
+ },
+ {
+ "app": "slack",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "canvases:read",
+ "canvases:write",
+ "channels:history",
+ "channels:read",
+ "channels:write",
+ "chat:write",
+ "emoji:read",
+ "files:read",
+ "files:write",
+ "groups:history",
+ "groups:read",
+ "groups:write",
+ "im:history",
+ "im:read",
+ "im:write",
+ "lists:read",
+ "lists:write",
+ "mpim:history",
+ "mpim:read",
+ "mpim:write",
+ "reactions:read",
+ "reactions:write",
+ "search:read.files",
+ "search:read.im",
+ "search:read.mpim",
+ "search:read.private",
+ "search:read.public",
+ "search:read.users",
+ "users:read",
+ "users:read.email"
+ ],
+ "capability": "write",
+ "supportedActions": "Send/schedule messages, create conversations, react, edit canvases/lists and upload files. Published internal app/Marketplace and admin approval requirements apply.",
+ "evidence": [
+ "https://docs.slack.dev/ai/slack-mcp-server/",
+ "https://mcp.slack.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "stripe",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "mcp"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Account- and sandbox-specific writes selected during Stripe consent; financial approvals and restricted-key permissions remain.",
+ "evidence": [
+ "https://docs.stripe.com/mcp",
+ "https://mcp.stripe.com/.well-known/oauth-protected-resource",
+ "https://access.stripe.com/.well-known/oauth-authorization-server/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "stripe",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Account- and sandbox-specific writes selected during Stripe consent; financial approvals and restricted-key permissions remain.",
+ "evidence": [
+ "https://docs.stripe.com/mcp",
+ "https://mcp.stripe.com/.well-known/oauth-protected-resource",
+ "https://access.stripe.com/.well-known/oauth-authorization-server/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Account- and sandbox-specific writes selected during Stripe consent; financial approvals and restricted-key permissions remain. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "supabase",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "organizations:read",
+ "projects:read",
+ "projects:write",
+ "database:write",
+ "database:read",
+ "analytics:read",
+ "secrets:read",
+ "edge_functions:read",
+ "edge_functions:write",
+ "environment:read",
+ "environment:write",
+ "storage:read",
+ "storage:write"
+ ],
+ "capability": "write",
+ "supportedActions": "Project/database/environment/storage changes and Edge Function deployment. Project selection and optional read-only configuration remain authoritative.",
+ "evidence": [
+ "https://supabase.com/docs/guides/ai-tools/mcp",
+ "https://mcp.supabase.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "supabase",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Project/database/environment/storage changes and Edge Function deployment. Project selection and optional read-only configuration remain authoritative.",
+ "evidence": [
+ "https://supabase.com/docs/guides/ai-tools/mcp",
+ "https://mcp.supabase.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "Project/database/environment/storage changes and Edge Function deployment. Project selection and optional read-only configuration remain authoritative. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key\u2019s permissions."
+ },
+ {
+ "app": "supermemory",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "profile",
+ "email",
+ "offline_access"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Save memories/documents in the workspace selected at provider consent; read/write choice is provider-controlled.",
+ "evidence": [
+ "https://supermemory.ai/docs/supermemory-mcp/mcp",
+ "https://mcp.supermemory.ai/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "ticket-tailor",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Box-office operations allowed by the API key chosen at provider consent.",
+ "evidence": [
+ "https://developers.tickettailor.com/docs/mcp/authentication/"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "Hosted authorization controls box-office API-key permissions; do not treat OAuth sign-in as increasing the underlying key permissions. This method requires account-bound proof."
+ },
+ {
+ "app": "ticktick",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "tasks:write",
+ "tasks:read"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update tasks in the authenticated account.",
+ "evidence": [
+ "https://help.ticktick.com/articles/7438129581631995904",
+ "https://mcp.ticktick.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "todoist",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "data:read_write"
+ ],
+ "capability": "write",
+ "supportedActions": "Create/update tasks and projects in the authenticated account.",
+ "evidence": [
+ "https://developer.todoist.com/",
+ "https://ai.todoist.net/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "vercel",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Account/team-authorized project and deployment actions; identity scope is not an admin permission.",
+ "evidence": [
+ "https://mcp.vercel.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "evidenceLimit": "Provider documentation was unavailable or not readable during this review; metadata/registered source only. Account-bound proof remains outstanding."
+ },
+ {
+ "app": "webflow",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "provider-default",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Build/edit sites and CMS content for explicitly authorized sites.",
+ "evidence": [
+ "https://developers.webflow.com/mcp/reference/getting-started",
+ "https://mcp.webflow.com/.well-known/oauth-protected-resource",
+ "https://mcp.webflow.com/.well-known/oauth-authorization-server"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "providerDefaultReason": "The official MCP setup installs the Bridge App and asks users to authorize sites. Neither protected-resource nor authorization-server metadata publishes a request-scope list; the installed app and site selection govern writes."
+ },
+ {
+ "app": "wix",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "offline_access"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Site editing and business operations under the signed-in Wix role.",
+ "evidence": [
+ "https://www.wix.com/studio/developers/mcp-server",
+ "https://mcp.wix.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "xero",
+ "method": "mcp-own-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "openid",
+ "profile",
+ "email",
+ "offline_access",
+ "accounting.settings",
+ "accounting.invoices.read",
+ "accounting.reports.aged.read",
+ "accounting.reports.balancesheet.read",
+ "accounting.reports.profitandloss.read"
+ ],
+ "capability": "provider-controlled",
+ "supportedActions": "Invoice/report reads and settings access only in the current MCP resource profile; no invoice writes are advertised.",
+ "evidence": [
+ "https://developer.xero.com/ai",
+ "https://mcp.xero.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "youcom",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "Tools",
+ "offline_access"
+ ],
+ "capability": "read",
+ "supportedActions": "None: search, contents and research tools (usage may be billed).",
+ "evidence": [
+ "https://you.com/docs/build-with-agents/mcp-server",
+ "https://api.you.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "youcom",
+ "method": "mcp-api-key",
+ "auth": "api_key",
+ "policy": "provider-key",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "None: search, contents and research tools (usage may be billed).",
+ "evidence": [
+ "https://you.com/docs/build-with-agents/mcp-server",
+ "https://api.you.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run",
+ "keyPermissions": "None: search, contents and research tools (usage may be billed). A read-only key is sufficient."
+ },
+ {
+ "app": "youcom",
+ "method": "mcp-free",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "read",
+ "supportedActions": "None: search, contents and research tools (usage may be billed).",
+ "evidence": [
+ "https://you.com/docs/build-with-agents/mcp-server",
+ "https://api.you.com/.well-known/oauth-protected-resource"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "zapier",
+ "method": "generated-url",
+ "auth": "none",
+ "policy": "endpoint",
+ "requestedScopes": [],
+ "capability": "provider-controlled",
+ "supportedActions": "Run only the actions configured by the user in the generated Zapier MCP endpoint; a URL cannot add actions or permissions.",
+ "evidence": [
+ "https://docs.zapier.com/mcp/quickstart"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ },
+ {
+ "app": "zep",
+ "method": "mcp-oauth",
+ "auth": "oauth",
+ "policy": "explicit",
+ "requestedScopes": [
+ "graph:read",
+ "graph:write"
+ ],
+ "capability": "write",
+ "supportedActions": "Write memory graphs authorized for the signed-in identity.",
+ "evidence": [
+ "https://help.getzep.com/memory-mcp-server",
+ "https://api.getzep.com/.well-known/oauth-protected-resource/mcp"
+ ],
+ "reviewedAt": "2026-09-30",
+ "liveProof": "not-run"
+ }
+ ]
+}
diff --git a/doc/design/COMPONENT-INVENTORY.md b/doc/design/COMPONENT-INVENTORY.md
index 91bf50d1923..a92490a6ed9 100644
--- a/doc/design/COMPONENT-INVENTORY.md
+++ b/doc/design/COMPONENT-INVENTORY.md
@@ -6,6 +6,13 @@ Run scope: `ui/src/components/` and `ui/src/pages/` on branch `design/token-extr
## Counts
+### Connection recovery — 2026-09-29
+
+`CloudAccessGate.tsx` contains the startup `CloudAccessError` composition, using
+the existing Button and typography tokens. It covers automatic reconnection,
+an in-flight check, and manual retry after access-check failures. See
+`/design-guide` and Storybook **App / Connection recovery**.
+
### Independent MCP connection setup — 2026-09-21
`ui/src/features/connections/remote-mcp/RemoteMcpConnectionSetup.tsx` is the controlled
@@ -444,3 +451,16 @@ Independently addressable examples live under `Connections/In-task connections`
`ui/src/components/SetupWizard.tsx` extracts the Slack setup navigation into reusable numbered steps, a portal sidebar, an optional section-menu takeover outlet, and a single-row footer. `SetupWizardSidebarProvider` owns the portal target and takeover lifecycle. Chat exports retain their existing names and defaults for compatibility. The Design Guide demonstrates the components. The production routine trigger wizard and its Storybook previews share the sidebar takeover, navigation, and footer. `routine-triggers/TriggerWizard.tsx`, `TriggerCard.tsx`, and `WebhookFields.tsx` provide the shared trigger setup, compact editable cards, copyable credentials, and agent instructions.
`routine-triggers/WebhookUrlWarning.tsx` uses `InlineBanner` for non-blocking localhost, private-network, Tailscale, and HTTP guidance. Setup and saved webhook editors share it; the Design Guide shows each warning. URL classification is heuristic, not a public reachability test.
+
+## Browser Use surfaces — 2026-09-29
+
+| Component | Responsibility | Storybook |
+| --- | --- | --- |
+| `TaskBrowserPanel` | Live iframe, debounced fitting with viewer ownership, connecting/closed/error/access states | Tasks / Browser Use / Panel |
+| `TaskBrowserFooter` | Fit to pane and fixed viewport presets, ownership feedback, last-five-minute countdown, contextual stop/extend, explained session menu | Tasks / Browser Use / Footer |
+| `TaskBrowserActivity` | Compact single-session row, interleaved at browser creation time in the task feed; opens the matching panel tab | Tasks / Browser Use / Task activity, including Inline History |
+| `BrowserUseSettingsPanel` | Per-credential cost caps and saved-profile access | Connections / Browser Use / Settings |
+
+The footer also appears on `/design-guide`. All stories use offline fixtures;
+they do not create provider sessions. The viewer fixture intentionally scales a
+fixed desktop viewport, preserving the current provider embed's sizing limitation.
diff --git a/doc/evals.md b/doc/evals.md
index cbfd78e78b5..4c1f1a2f3b6 100644
--- a/doc/evals.md
+++ b/doc/evals.md
@@ -19,7 +19,7 @@ The names describe the system under test; “headless” is an execution option,
not an eval category.
The explicit Product E2E `completion-updates` suite compares onboarding and
-idle Agent Chat handoffs on native Claude/Codex. It separates mechanical
+idle, busy, multiple-task, and restart Agent Chat handoffs on native Claude/Codex. It separates mechanical
completion delivery/result access from semantic review of the retained answer;
see the [probe contract](../tests/runner-e2e/README.md#completion-update-probes-explicit-only).
@@ -90,6 +90,10 @@ authentication respectively. Keep their results separate; the subscription
fixture seeds an explicitly supplied login and does not qualify interactive
login. See the [Grok fixture contract](../tests/runner-e2e/README.md#grok-build-qualification).
+The explicit [Direct blocker guidance suite](../tests/runner-e2e/README.md#direct-blocker-guidance)
+checks the legacy coordination skill against human authority, missing hiring
+permission, and requester scope decisions through saved browser interactions.
+
## Validation ladder
Start with credential-free checks and a catalog listing. For Product E2E:
@@ -192,6 +196,78 @@ For a repeatable workflow, use the matching skill: [paperclip-evals](../.agents/
[add-runner-eval](../.agents/skills/add-runner-eval/SKILL.md), or
[add-product-e2e-eval](../.agents/skills/add-product-e2e-eval/SKILL.md).
+## Diagnose failures before buying another campaign
+
+Use this loop to turn eval failures into product improvements. The unit of work
+is a broken user outcome or invariant, not an individual red cell.
+
+1. **Freeze the evidence.** Record the inspected application revision and each
+ campaign's evaluated revision, definition/grader fingerprint, model/profile,
+ environment, exact selected IDs, attempts, and usage coverage. Read the
+ history feed and retained attempt records before launching models. A report
+ refresh, skipped workflow, passing unit suite, or old-definition green cell
+ is not a new live measurement. Inventory explicit-only suites separately
+ from `--all`.
+2. **Reconstruct the failed boundary.** Read durable task state, interactions,
+ event chronology, source/worker identity, delivered output, and the failing
+ assertion. State whether the test reached the boundary it claims to test.
+ Separate observed failure, machine class, analytical cause, and confidence.
+ A cancelled queued wake does not by itself prove lost work; a failed decline
+ assertion does not prove unauthorized execution. A saved artifact does not
+ prove the user received a correct completion update.
+3. **Group by cause and product contract.** Join cells only when their evidence
+ supports the same mechanism. Check for already-merged fixes and definition
+ corrections before proposing new work. Keep product defects, provider/model
+ behavior, grading defects, infrastructure, and unexercised boundaries
+ distinct. Preserve the original grades when attribution changes.
+4. **Design the smallest general correction.** Name the desired user behavior,
+ the authoritative state/transaction or provider boundary that owns it, the
+ affected callers, and the existing guarantees that must survive. Check it
+ against `PRODUCT.md` and `SPEC-implementation.md`. A change to an intentional
+ product rule is a contract change, not an excuse to delete its guard. Avoid
+ case-name branches, phrase-specific prompts, unconditional retries, or
+ weakening approval, ownership, cancellation, and budget gates to get green.
+5. **Prove the mechanism cheaply.** Calibrate a grader against correct and
+ plausible wrong retained evidence. Reproduce a product race with scripted
+ providers or service tests. Pair every proposed fix with a regression that
+ exercises the opposite boundary (for example, eligible delivery versus
+ revoked access, benign obsolete wake versus interrupted active work).
+ Presentation-only changes use the existing report refresh path and make no
+ provider calls; do not claim replay can prove changed runtime behavior.
+6. **Select a bounded live confirmation.** Write the exact failed representative
+ IDs and only the passing controls affected by the change. Pin the source,
+ definitions, models, and remote image. Record an attempt cap, provider and
+ compute budget, wall-clock deadline, and concurrency before dispatch under
+ the existing live-run authorization. Missing pricing means unknown, not free.
+ Do not rerun unaffected green cells during diagnosis or retry usable behavior
+ failures until they happen to pass. Preserve every attempt. Expand to a
+ compatible qualification campaign only after the causal fix passes.
+7. **Close with evidence and remaining scope.** Report original versus new
+ measurements, exact selected coverage, regression results, cost coverage,
+ and unresolved boundaries. A partial verification may close one defect; it
+ cannot turn the full catalog green or establish reliability from one attempt.
+
+Keep one triage record per cause with: affected cell IDs; evidence links;
+observed failure; supported cause and confidence; existing fix/revision; proposed
+product contract; invariant regressions; next exact live selection; budget and
+stop condition; owner; and disposition. Useful dispositions include confirmed
+product defect, model behavior, grader correction, infrastructure repair,
+fixed-but-not-remeasured, historical pass, and unqualified coverage.
+
+Parallelize independent artifact inventory, deterministic checks, and isolated
+cells. Keep a cell's dependent turns ordered. When delegating, use inexpensive
+agents for bounded extraction, catalog reconciliation, and test execution; keep
+causal attribution, product design, and final review with the lead. Begin local
+browser campaigns at the documented conservative concurrency and increase only
+with measured host headroom. Hosted fanout must respect the workflow's provider
+and fleet caps; more simultaneous timeouts do not improve wall-clock efficiency.
+
+Current tools support exact-ID selection and retained-evidence report refresh,
+but not an automatic cause-aware "rerun unresolved failures" planner. Build an
+explicit selection manifest rather than treating `--all` as that planner. Review
+the launcher's automatic retry policy when budgeting; Product E2E may create one
+fresh attempt for a retryable failure.
+
## Install the authoring skills
The reviewable sources live in this repository's `.agents/skills`. For a
@@ -276,6 +352,22 @@ results and follow-up coverage are recorded in that suite's guide.
Continuation accounting has an explicit-only eight-cell Product E2E [baseline suite](../tests/runner-e2e/CONTINUATION-ACCOUNTING.md), complementing the deterministic lifecycle inventory.
+The explicit Product E2E `instruction-persistence` suite verifies private file
+edits, nested and binary agent files, stopped-provider directory saves, server restart, and a fresh task's
+downloaded proof on local native/legacy Codex and native Daytona. See the
+[Product E2E runbook](../tests/runner-e2e/README.md).
+
The explicit-only Product E2E `api-response-reading` suite verifies retrieval of
large saved API responses on local and Daytona native Codex runs. See the
[Runner E2E guide](../tests/runner-e2e/README.md#bounded-api-response-reading).
+
+The explicit-only Product E2E `extended-harnesses` suite covers pending Cursor,
+Copilot and Pi ACP profiles on local and Daytona. See the
+[fixture admission, credentials and budget contract](../tests/runner-e2e/README.md#extended-acp-harnesses-explicit-only).
+The private Runner Evals campaign of the same name provides complementary
+semantic protocol cases; catalog membership is not live qualification.
+
+The explicit-only Product E2E `confirmation-replies` suite tests conversational
+approval and rejection, persisted message provenance, approval before execution,
+ambiguous proposals, and the existing card-click path with native Claude/Codex.
+See the [suite contract](../tests/runner-e2e/README.md#conversational-confirmation-replies-explicit-only).
diff --git a/doc/execution-semantics.md b/doc/execution-semantics.md
index 1e4da6e8509..fb1c1cae671 100644
--- a/doc/execution-semantics.md
+++ b/doc/execution-semantics.md
@@ -394,7 +394,6 @@ Issue document comments, document annotation comments, and document review comme
Document-scoped activity may still route work when it is converted into an explicit action-path primitive. Valid routing exceptions include:
-- an issue mention or structured agent mention that intentionally wakes or assigns a named participant
- a document-review assignment that names a reviewer or assignee for the review state
- a response to an issue-thread interaction, such as `request_confirmation`, `ask_user_questions`, or `suggest_tasks`
- intentional board routing that assigns or reassigns the issue, opens a first-class blocker, creates delegated follow-up work, or queues a typed wake
@@ -423,16 +422,9 @@ A wake is the delivery path for a selected agent owner. If an interrupting updat
If the committed update assigns the issue to a user, clears the agent assignee, or leaves the issue without an agent owner, Paperclip must not imply that an agent handoff happened. The issue is then waiting on the human owner or on a future explicit assignment, blocker, approval, interaction, monitor, or recovery action.
-Plain text is not assignment. Writing an agent's name, role, or team label in a comment does not change ownership and does not create an agent wake. Agent routing from comment text requires a structured agent mention that resolves inside the company, an explicit `assigneeAgentId` mutation, or an existing current agent assignee receiving normal issue-thread feedback.
+Agent names and structured @-mentions are context, not assignment or wake requests. Mentions remain on the original comment and do not start an agent, authorize checkout, or copy feedback onto a referenced child task. This applies equally to board and agent comments, standalone comments and issue updates, and open and terminal tasks. New work for another agent requires explicit assignment, a bounded delegated task, or an explicit review request.
-A delegation comment from the current assignee's run on this parent must not start competing parent work when the named worker already owns the referenced child. This applies to issue updates with a comment and standalone comments. Verify the source run's company, agent, and parent-task context. Then verify that the comment references the child's identifier, the child's `parentId` names this parent, and the child belongs to the same company and is assigned to the mentioned worker. Apply child-aware routing only in either of these states:
-
-- The parent is `blocked` and the child is `in_progress`. The child must have a blocker edge to the parent. The child's execution or checkout run must still be `running`, belong to that worker and company, and name that child in its run context. Verify comment and mutation access to the child, then retain the parent comment and append a linked copy on the child. Preserve the full comment, author, source run, responsible-user attribution, and source trust. Target the normal mention wake at the child and its new comment ID, with explicit resume and follow-up intent. This keeps new feedback available to the worker and lets the existing queue serialize a child continuation behind its current execution.
-- The parent and child are both `done`. The assignee's closing comment must not start another worker run for the completed delegation. A blocker edge is not required after completion: a fast child can finish before the lead needs to record a wait. New agent work must use explicit `resume: true`, a status change, or a new assigned task. Explicit resume moves the parent out of `done` before this rule runs; the comment's prose alone does not restart completed work.
-
-The completed-delegation comment remains on the parent without a worker wake. Neither path changes ownership. Board-user comments and unrelated mentions retain their normal wake behavior. If multiple referenced children qualify for the same worker, the child or run no longer meets these conditions, child comment or mutation access is denied, or a lookup or copy fails, use the normal parent mention path. Do not parse mentions again while copying a comment, which would create another routing loop. Completion of the child still uses the existing blocker-resolution wake for the parent's assignee.
-
-The parent may receive a closing comment before its assignee changes the status to `done`. Recheck the completed-delegation rule when releasing that parent execution, before promoting a deferred mention. On the same transaction, verify the final parent state, finishing run, and every original queued or deferred comment ID. Each comment must belong to this parent and company, come from its assignee's finishing run, and reference exactly one completed direct child assigned to the mentioned worker. A link to the parent itself is allowed; any other extra issue reference keeps the normal mention path, including an unknown or foreign reference. Mixed human, other-run, unrelated, or ambiguous input retains its normal wake path. Explicit continuation and interaction requests also retain their normal path.
+Normal issue-thread feedback can still wake the current assignee according to the comment policy; self-comments and closed-task comments retain their existing suppression rules. Explicit assignment, review, interaction, and blocker-resolution wakes retain their own routing. New mention wake requests are ignored at admission, including calls from legacy producers. Already accepted queue entries retain their existing execution rules: an old entry can combine an assignment or other feedback with a later mention, so its last wake reason does not prove that the entry is mention-only.
Accepted agent feedback must survive a child changing to `done` before its active run exits. Deferred wake promotion may reopen that completed child only for its current assignee, with explicit agent resume intent and live tracked comments from another author. Claim promotion before reopening. Cancelled tasks, deleted comments, self-authored comments, empty continuations, and agent continuations without explicit intent keep their existing suppression rules. Normal pause, ownership, authorization, and budget gates still apply.
@@ -936,6 +928,12 @@ Questions must be created as durable interactions before the agent claims to be
waiting. A direct Board comment reopening completed work has the same passive
response-wait semantics as a comment on an open task, subject to the same source,
identity, and governance checks. An automatic continuation is not a user reply.
+For ordinary tasks, a response wait cannot park reported blocking remaining
+work without a recorded wait condition. The finish tool rejects this combination;
+finalization routes already-accepted reports through one bounded corrective
+continuation and then a visible recovery error. Real questions, approvals,
+dependencies, pauses, and conversation lifecycles keep their existing behavior.
+A superseded Board comment never grants permission to replay the old response.
A run must receive queued human direction before it creates a new task question.
When the saved run context contains an explicit delivered-comment list, the
@@ -1258,6 +1256,11 @@ turn finishes during shutdown, its release checkpoints the session before
returning instead of leaving a new idle owner behind. If checkpointing fails,
the retained state continues to block unverified reuse.
+Local durable control-plane state is bounded at 256 MiB in the server,
+runnerd recovery, and durable control-plane readers. These paths synchronously
+read and parse the full JSON file, so memory use and parse time grow with file
+size. Remote checkpoint archive and expanded-size limits remain 64 MiB.
+
### Warm sandbox continuity
For the native runner, warm mode requests a reusable sandbox lease **before**
diff --git a/doc/observability.md b/doc/observability.md
index 491e8e35c85..6af36505f4f 100644
--- a/doc/observability.md
+++ b/doc/observability.md
@@ -22,7 +22,8 @@ alternative peer dependencies — install exactly **one**, matching
`OTEL_EXPORTER_OTLP_PROTOCOL`.
When `OTEL_EXPORTER_OTLP_ENDPOINT` is unset, none of the `@opentelemetry/*` SDK
-packages are imported and there is zero runtime overhead.
+packages are imported and there is no SDK or exporter overhead. Local request
+timings still use the performance clock.
`server/package.json` declares each optional package at the exact version the
server tests against; install that exact version. Our Dependabot cannot bump
@@ -34,6 +35,33 @@ maintains as a dependency; once you install the packages below, they become
normal dependencies of **your own** project, and your own Dependabot updates
them.
+## Task detail loading
+
+`GET /api/issues/:id` returns `Server-Timing` with `paperclip_issue` for the
+whole handler and `issue_` for its reads. The total includes the final
+execution-blocker read after recovery revalidation. Concurrent phases overlap;
+do not sum them to obtain request duration.
+
+With the existing operator-configured OTLP endpoint, the same reads produce
+`issue.read.` child spans through the `paperclip.issue-read` tracer.
+There are no custom attributes, identifiers, content, or exception messages.
+The closed phase names in `server/src/services/issue-read-timing.ts` are:
+`lookup`, `authorization`, `project_goal`, `ancestors`, `mentions`, `documents`,
+`relations`, `blockers`, `review`, `references`, `handoff`, `retry`, `recovery`,
+`cases`, `inbox`, `channel`, `workspace`, `work_products`, `execution_blocker`,
+`relation_recovery`, `revalidate_recovery`, and `mentioned_projects`.
+Without an OTLP endpoint, spans remain no-ops. This adds no first-party
+Telemetry events or run-log events.
+
+The browser's `issue-detail:navigate→content-paint` User Timing measure ends
+after the redesigned conversation is revealed and painted, rather than when
+the comments request completes while the conversation is still hidden. Durable
+messages can paint before run history and plan enrichment. Runtime-only threads
+wait for initial output; late history retains the existing scroll-anchor behavior.
+Use Chrome's request waterfall and this mark together to distinguish API wait,
+request dependencies, and rendering time. A hard-load trace also includes auth,
+company selection, and JavaScript startup before the task navigation mark.
+
## Enabling tracing
### 1. Install the OTel peer dependencies
@@ -406,6 +434,56 @@ 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.
+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;
+missing or malformed values become `null`. Signals must match the reporting
+host's Node signal constants; missing values become `null` and unrecognized
+values become `unknown`. A signal such as `SIGKILL` does not establish who sent
+it or prove an out-of-memory kill. These fields do not change error grouping
+or run outcomes, and do not include process output or adapter result payloads.
+
+An unconfirmed adapter Stop timeout has an event-local `adapter_stop` context:
+the run UUID, built-in adapter type, native/legacy runtime mode, configured
+wait duration, and whether abort was requested. Invalid identities become
+`null`, and unknown adapter/runtime values become `unknown`. The report does
+not include stop reasons, prompts, process output, provider responses, or
+credentials. It preserves default error grouping and does not acknowledge
+termination, remove the live execution control, or change the timeout. The
+context is sent only through the existing opt-in Sentry gate and never leaks
+into unrelated captures.
+
+The shared reporter also attaches bounded diagnostic contexts for both legacy
+and native runs:
+
+- `run_execution`: runtime mode, execution stage/native phase, driver and version,
+ duration, failure phase, stop reason, error family, and timeout settings when available.
+- `adapter_failure`: selected adapter error fields such as phase, category,
+ protocol code, retryability, cause message, stack preview, HTTP status, and request ID.
+- `provider_failure`: the saved provider failure category, title, and details.
+- `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 execution and setup catch paths pass the original exception to the reporter.
+It snapshots and rebuilds only these selected fields and the original message and
+stack. Sentry receives the sanitized cause chain rather than a stack created at
+the reporting call. Saved adapter results use an available adapter stack preview;
+without one, the report has no synthetic reporting stack.
+
+Credential patterns, the current user's home path, registered run-secret values,
+and known host/runtime environment credentials are removed before truncation.
+Declared environment secret bindings are included even when their key has no
+credential-like name. Runtime values are used only for redaction and are never
+copied into an event. Stack fields are limited to 8,192 characters,
+exception messages to 2,048, provider titles to 4,096, and provider details to
+12,288. Other diagnostic strings are limited to 200 characters (adapter cause
+messages: 2,048). Truncation is marked in the text and in
+`run_execution.truncatedFields`; cyclic and deeper cause chains are marked too.
+Request/response objects, headers, environment/configuration, prompts, stdout,
+stderr, and arbitrary adapter result fields are not copied. The existing DSN
+opt-in gate and error-code/adapter fingerprint remain unchanged. These reports
+cannot recover diagnostic data that a provider or adapter discarded upstream.
+
### Browser data
The browser sends no page URL, no referrer, no user agent, and no
diff --git a/doc/plans/2026-09-28-chat-completion-updates.md b/doc/plans/2026-09-28-chat-completion-updates.md
new file mode 100644
index 00000000000..12553a388ca
--- /dev/null
+++ b/doc/plans/2026-09-28-chat-completion-updates.md
@@ -0,0 +1,93 @@
+# Return completed work to its originating chat
+
+## Summary
+
+When an agent hands off work from Agent Chat, Paperclip will bring the finished result back to that conversation automatically. The original agent will write the update using the task’s recorded status and saved output.
+
+Report tasks as they finish. Combine completions already waiting for the same reply. A `/new` reset suppresses updates from the previous conversation session.
+
+The merged completion-update evals are the baseline. This change should turn the missing-update cases green and address the stale onboarding replies.
+
+This behavior applies to Agent Chat handoffs and the onboarding completion-update fix below, not all agent handoffs in general. It uses the existing Agent Chat availability setting and adds no separate experimental flag.
+
+## Implementation
+
+**Record the handoff automatically.**
+
+- Add a durable, company-scoped handoff record linking the created task to the source conversation, its session generation, and its agent.
+- Capture it inside task creation using the authenticated creating run. Both native `create_task` and HTTP task creation already supply that context. Do not rely on the model to provide a source ID.
+- Keep execution tasks as ordinary project tasks. Do not turn the conversation into their parent or block it on their completion.
+- Preserve existing creation idempotency: replaying task creation must not create another handoff.
+
+**Queue completion durably.**
+
+- Create a completion-delivery record in the same transaction that moves a linked task into Done. Cover both ordinary issue updates and native status-decision commits.
+- Identify each event by the handoff and committed completion transition. Repeating the same transition must not create duplicate deliveries.
+- Use a small database-backed outbox, following the existing delivery-service pattern. Process it immediately after commit and through startup and periodic recovery.
+- Reopening a task before delivery supersedes its pending completion. Completing it again creates a new event.
+- Start with newly created handoffs. Do not backfill historical tasks or emit old completion notices.
+
+**Run an agent-authored follow-up.**
+
+- Add a dedicated completion wake reason in `server/src/services/agent-conversations.ts` and `server/src/services/heartbeat.ts`.
+- Wake an idle conversation. If a reply is underway, queue a subsequent turn; never treat an update to the running turn’s stored context as delivery.
+- At turn start, collect pending completions for that conversation session. Completions arriving after that point wait for another turn.
+- Supply current task status, task links, saved deliverable references, and bounded result content. Keep task output separate from trusted instructions.
+- Tell the agent to explain what finished and provide access to the result. Do not prescribe canned wording or authorize additional execution.
+- Use the existing conversation response path. Record delivery against the persisted agent reply, not merely an enqueued or successful run.
+
+**Handle recovery and onboarding.**
+
+- Carry delivery IDs through wakeups, retries, and response persistence. Before retrying, check for an already-published reply; make publication and delivery acknowledgement atomic.
+- Use leased claims and bounded retries following existing delivery conventions. Retain exhausted failures for diagnosis.
+- Check the conversation’s session generation before scheduling and publishing. Suppress old-session deliveries after `/new`.
+- Add `issue_children_completed` to the existing follow-up scheduling rule so onboarding completion cannot disappear into an active parent run. Refresh completion facts when that follow-up starts. Apply this scheduling change to onboarding flows; preserve existing scheduling for other handoffs.
+- Preserve company access, agent permissions, budgets, and pause controls. Result delivery must not broaden general access to other tasks.
+
+No new user-facing tool, notification settings, onboarding option, or UI component is required. Add the database migration and synchronized internal types; preserve existing public task-creation inputs.
+
+## Tests and evals
+
+**Deterministic service and integration tests**
+
+Cover both task-creation paths and both completion paths, including:
+
+- Idle versus actively replying conversations.
+- Multiple pending completions combined without losing task identities.
+- Duplicate events, concurrent dispatchers, and restart recovery.
+- Crashes before dispatch and after reply persistence.
+- `/new`, task reopening, cross-company inputs, and paused agents.
+- Onboarding child completion during an active parent turn.
+- Existing Agent Chat availability controls and unaffected behavior for other agent handoffs.
+
+**Product E2E evals**
+
+Extend the explicit `completion-updates` suite for native Claude and Codex:
+
+- Retain the existing onboarding and idle-handoff stories.
+- Add completion during an active chat reply, multiple-task completion, and interrupted completion-reply recovery.
+- Establish each timing boundary with observable run state and bounded fixture gates. Use real browser/API actions; do not inject completion messages or edit database state.
+- Require durable Done status, saved output, an unsolicited source reply, working result access, and no duplicate completion update.
+
+Add a separate completion-accuracy grader using the existing pinned judge infrastructure. It must cite recorded evidence and reject stale promises such as “the work will run next” after completion. Calibrate it against accurate replies, stale replies, unsupported claims, and later corrections. Missing judge evidence leaves accuracy unqualified; it cannot override a mechanical failure.
+
+Run the selected cells in GitHub Actions. Preserve source revisions, grader versions, attempts, timing, cleanup, and cost coverage. Require two consecutive complete campaigns to pass delivery, access, and accuracy before calling this scope qualified.
+
+## Rollout and defaults
+
+- Enable completion follow-ups wherever Agent Chat is already enabled; leave native-runner onboarding selection unchanged.
+- Report Done transitions only. Progress, blocked, failed, and cancelled notifications remain outside this change.
+- Report each task as it finishes, combining already-pending completions without an artificial batching delay.
+- Suppress old-session updates after `/new`; keep tasks and results intact.
+- Record pending, delivered, superseded, and exhausted events in instance-local diagnostics.
+- Submit a separate product PR with unit/integration coverage, live eval reports, and passing merge checks. The previously merged eval baseline remains the red reference.
+
+## Implementation security refinement
+
+Completion input carries server-recorded task identifiers, Done status, timestamps,
+and result links. Worker-authored titles, document bodies, and comments are not
+copied into the source agent's prompt; the result remains on the linked task.
+Tool authority and provider permissions retain their normal configured defaults.
+The original agent writes the completion reply from these facts and its existing
+conversation context. Evals independently read the saved output and grade the
+reply's truthfulness and result access.
diff --git a/doc/plans/2026-09-28-runner-rich-acp.md b/doc/plans/2026-09-28-runner-rich-acp.md
new file mode 100644
index 00000000000..994afef0d3e
--- /dev/null
+++ b/doc/plans/2026-09-28-runner-rich-acp.md
@@ -0,0 +1,30 @@
+# Cursor, Copilot and Pi through rich ACP
+
+Approved implementation plan, 2026-09-28. Shared base:
+`c65fc9e3c81c41aafe421aa90a00514b84343285`.
+
+Keep the existing ACPX runner transport and Codex app-server richness benchmark.
+Implement a foundation prerequisite, then three separate provider branches and
+PRs. Do not merge automatically. Preserve legacy Cursor/Pi adapters.
+
+1. Investigate each pinned harness, its native API, ACP adapter, observed wire,
+ runner normalization and UI surface. Inventory every meaningful event field.
+2. Extend shared profile declarations, durable permissions/input, extension
+ dispatch, steering/queue distinctions, artifact provenance and bounded display
+ activity. Preserve existing replay and exact warm-session identities.
+3. Pin complete provider distributions for macOS ARM64/x64 and Linux x64. Use
+ verified launches, isolated credentials/configuration and build-time assets.
+4. Implement Cursor native ACP and its question/plan/subagent extensions;
+ Copilot ACP authentication/events/permission and settlement handling; Pi
+ wrapper patch and owned extension with authenticated tools and input policy.
+5. Run deterministic, recovery, isolation and richness conformance. Qualify each
+ provider locally and in Daytona with product E2E evidence before advertising
+ support. Use a combined $100 ceiling: $25 each plus $25 diagnosis reserve.
+6. Run required full checks, prepare one foundation and three dependent PRs,
+ retain evidence and deliver the comparative capability report. List every
+ unused/partial capability with reason and prioritized follow-up.
+
+Implementation and qualification status is maintained in
+[the capability report](../architecture/runner-rich-acp-capabilities.md).
+Missing credentials or spend verification leave qualification pending; they do
+not authorize a weaker supported profile or an implicit model fallback.
diff --git a/doc/plans/2026-09-29-browser-use-cloud-connector.md b/doc/plans/2026-09-29-browser-use-cloud-connector.md
new file mode 100644
index 00000000000..2d312abd66e
--- /dev/null
+++ b/doc/plans/2026-09-29-browser-use-cloud-connector.md
@@ -0,0 +1,39 @@
+# Browser Use Cloud connector — 2026-09-29
+
+Approved implementation: connect Browser Use Cloud using its v4 REST API and the
+normal Access → Connect → Permissions flow. API keys remain in the vault; actions
+use the existing governed gateway. Hosted browser tasks are destructive-capable.
+
+2026-09-30 clarification: the app key and runtime skill name are
+`browser-use-cloud`. Bundle instructions with the connector implementation,
+outside universal `skills/`, and contribute them only with authorized connection
+tools in the agent's task run. Remove them when access is revoked. Preserve
+pre-release connection and cost records when migrating the old provider key.
+
+Persist company/task/agent/credential-grant ownership, conversation sessions,
+individual runs with durable event cursors and accounting checkpoints, and browser
+instances separately. Observe browser.ready while work proceeds. Reconcile after
+restart; never replay an uncertain paid create. Continue idle conversations with
+POST /runs and sessionId. Cancel run and stop browser are separate operations.
+
+Show an interactive Browser tab beside Properties and Artifacts. Auto-open the
+arrival of each new session once, respect subsequent navigation and closes, preserve the iframe
+across tab switches, and allow reopening through the launcher. Closing a tab only
+hides it. Viewer credentials are fetched on demand by authorized humans, never
+returned to agents, persisted in tab state, or included in logs or live events.
+
+Completed browsers stay open while viewed, then have a ten-minute idle grace period with Keep open. Task/run
+cancellation, reassignment, budget stops, and credential revocation trigger durable
+cleanup. Provider expiry wins. Followups use normal task conversations and tools.
+Existing profiles are optional, explicitly allowed per credential. Fresh browsers
+are the default. Recording and automatic artifact import are deferred.
+
+Enforce v4 maxCostUsd from applicable remaining budgets and configured limits;
+account cumulative provider usage idempotently. Verify deterministic transport,
+ownership, policy, lifecycle, event recovery, viewer authorization, and UI states;
+then verify with a live credential if available. Never claim fixture evidence as
+live provider proof.
+
+Sources: https://docs.browser-use.com/cloud/api-v4-overview,
+https://docs.browser-use.com/cloud/openapi/v4.json,
+https://docs.browser-use.com/cloud/browser/live-preview.
diff --git a/doc/run-log-events.md b/doc/run-log-events.md
index d9cf3faf66b..6fd6bd36a25 100644
--- a/doc/run-log-events.md
+++ b/doc/run-log-events.md
@@ -34,6 +34,47 @@ credential material are never written to the run log.
These records remain run-log events. They do not create an OpenTelemetry or
Paperclip Telemetry export, and legacy adapters do not use this writer.
+## Semantic Settlement Diagnostics and Retry Logs
+
+Before interrupting a Codex turn, the runner durably records a
+`harness.diagnostic` event with code `provider_interrupt_requested`, the stop
+reason, provider turn ID, and pending tool call IDs. A harmless identical result
+replay records `semantic_tool_result_duplicate` with warning severity, call ID,
+operation ID, and result digest. It does not fail the task or create a user
+attention request. A true conflict includes the call and operation IDs and both
+result digests in its error; full arguments belong to the canonical semantic
+input record, not the error message.
+
+Incomplete close emits the bounded `native_session_settlement_incomplete`
+runner diagnostic. Its evidence includes runner suspension, provider drain,
+final provider state, pending call/operation/source-event IDs and input digests,
+and incomplete result-delivery command IDs and statuses. If execution and
+cleanup both fail, execution retains its original error identity and cleanup is
+attached as `cleanupError`.
+
+Instruction writes also commit an `agent.instruction_write_attempted` activity
+row and a run-scoped `instructionToolAttempts` entry before permitting the
+filesystem effect. They retain the call ID, operation ID, and input digest, not
+instruction text. A later transaction rollback cannot erase this attempt proof.
+A missing success or definite pre-write failure receipt means the outcome is
+unknown, even if the current file contains the requested text. Known validation
+and stale-base failures are saved under the attempt's `failure` entry and replay
+their original status, message, and details without a new write. Unknown
+outcomes remain blocked until reconciled; a
+committed receipt with a lost acknowledgement can replay its exact result.
+
+The NDJSON output log appends across repeated `begin` calls for one run. Each
+new handle adds an `attemptId` to its lines. If the local file is absent and a
+durable S3 mirror exists, `begin` restores that prefix before appending. A
+failed restore must not replace the mirror with an empty or partial attempt.
+Publishing a restored prefix uses an atomic create-if-absent operation, so a
+concurrent restore cannot overwrite lines another attempt has already appended.
+Earlier attempts therefore remain available for incident diagnosis. Existing
+records without `attemptId` remain readable.
+
+These records use the instance run log and its configured storage. They add no
+Paperclip Telemetry or OpenTelemetry export.
+
## Omitted Unsafe Workspace Export
`workspace_export_omitted` is an informational system event in the local run log.
@@ -155,6 +196,40 @@ The payload never carries a command, an argument, a path, an environment value,
or a raw identifier. The event rides the `ctx.onEvent` run-event bridge and is
run-log-only. It needs no OTLP endpoint.
+## ACP terminal failure diagnostics
+
+The shared ACP adapter engine preserves typed terminal session failures in the
+run error, the `acpx.error` transcript record, and
+`heartbeat_runs.result_json.terminalSessionFailure`. The structured diagnostic
+contains the provider category, title, and details. It works when raw provider
+tracing is disabled. The existing UI and CLI render the diagnostic as an error,
+not as assistant output or an automatic task response.
+Issue continuation summaries and session-compaction handoffs retain only the
+generic failure category; provider diagnostic prose is not copied into prompts.
+
+Both pinned ACPX patches pass complete title and detail strings to the in-memory
+callback. The engine redacts configured environment values (including resolved
+secrets with arbitrary variable names), launch environment values outside a
+closed allowlist of public process settings, known boolean flags, and run identifiers,
+connection URL passwords, the run API key, and common credential forms before
+truncation. It removes control characters,
+retains line breaks for JSON and stack traces, and preserves up to 4,096 title
+characters and 24,576 detail characters. These bounds also keep the escaped
+transcript JSON below the server's 64 KiB chunk limit. Longer fields end with an explicit
+omission count and appear in `truncatedFields`. The error message includes the
+same sanitized text. Ordinary run retrieval preserves the bounded structured
+diagnostic even when multibyte text or other result fields exceed the result
+byte budget. In that reduced response, title and details have 1 KiB and 8 KiB
+byte budgets, including truncation markers. `retrievalTruncated` directs callers
+to the full adapter-bounded text in the run error or transcript. Other provider
+metadata and action payloads are not copied.
+
+Recovery still uses the typed failure category and the adapter's existing
+classifier. Provider warnings do not become failures, and timeouts or lost
+control channels keep their authoritative failure messages. These diagnostics
+stay in the instance's run records and configured run-log storage. They add no
+Paperclip Telemetry or OpenTelemetry export.
+
## Related instrumentation
The sandbox duplex transport also writes one run-log event as one of its three
@@ -243,3 +318,20 @@ The message distinguishes an automatic retry from work that is no longer eligibl
This pre-provider wait records `ai_connection_busy` on the cancelled run and does
not consume the provider-failure retry allowance. The event contains no credentials
and creates no Telemetry or OpenTelemetry export.
+
+## Managed Agent File Save Receipts
+
+The server writes `instruction_save` after managed file collection or a warm
+turn checkpoint. The payload includes the save state, instruction entry path,
+storage warning, and error code/message. Agent-directory receipts identify
+`contract: "agent_files"` and the applied candidate hash. Legacy instruction
+receipts instead identify the saved revision.
+
+A validated warm checkpoint reports `saved` or `unchanged`, even though its
+working directory remains owned by the live session. An unstable checkpoint
+reports `pending_collection` until stopped collection produces a final receipt.
+Successful checkpoints can include `checkpointStats`: `scannedEntries`,
+`hashedBytes`, `copiedFiles`, and `copiedBytes`. These counts describe that
+capture, not cumulative traffic or an atomic snapshot of background writers.
+They contain no file contents. The receipt remains in the instance run log;
+it adds no Paperclip Telemetry or OpenTelemetry export.
diff --git a/docker/daytona-runner/Dockerfile b/docker/daytona-runner/Dockerfile
index 75e33e9033f..5a1da31b1f8 100644
--- a/docker/daytona-runner/Dockerfile
+++ b/docker/daytona-runner/Dockerfile
@@ -9,10 +9,10 @@ WORKDIR /workspace/packages/paperclip-runner/runner
COPY packages/paperclip-runner/runner/Cargo.toml packages/paperclip-runner/runner/Cargo.lock ./
COPY packages/paperclip-runner/runner/crates ./crates
COPY packages/paperclip-runner/protocol ../protocol
-RUN cargo build --locked --release -p paperclip-runner-core --bin paperclip-runnerd \
+RUN cargo build --locked --release -j 2 -p paperclip-runner-core --bin paperclip-runnerd \
&& strip /workspace/packages/paperclip-runner/runner/target/release/paperclip-runnerd
-FROM node:24-bookworm@sha256:9137a20e25879e0b557227b57e3ee4e9af4bde29eb3db66134cd1723e84f830b AS provider-pack-build
+FROM node:24.21.0-bookworm@sha256:5a750d3be5e5c80275f8c9a5367c3aed99c2875656590c8d0701c7ee687f5f0a AS provider-pack-build
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
WORKDIR /workspace
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc tsconfig.base.json ./
@@ -28,15 +28,18 @@ COPY cli/package.json ./cli/package.json
# The complete resolved lock (including transitive integrity hashes) is reviewed.
# Reject registry-time drift BEFORE installing packages or running lifecycle code.
# Refresh this digest together with source/provider dependency changes.
-ARG PAPERCLIP_RUNNER_LOCK_SHA256=0c06ab38c1d4b6b58e1c9f5ee85eb79f97cecd83e751b5d27c3b262faf5ab265
+ARG PAPERCLIP_RUNNER_LOCK_SHA256=2c46a68811ba1d504a41b6f4d3f642bc93f4a1c615097754c9c6486881dba8e6
RUN printf '%s pnpm-lock.yaml\n' "${PAPERCLIP_RUNNER_LOCK_SHA256}" > /tmp/provider-lock.sha256 \
&& sha256sum -c /tmp/provider-lock.sha256 \
&& pnpm install --frozen-lockfile --filter '@paperclipai/paperclip-runner...'
ARG PAPERCLIP_RUNNER_SOURCE_REVISION
+# Optional qualification assets; this never promotes candidate profiles.
+ARG PAPERCLIP_RUNNER_CANDIDATE_PROVIDERS=
RUN test -n "${PAPERCLIP_RUNNER_SOURCE_REVISION}"
RUN pnpm --filter @paperclipai/paperclip-runner build:typescript \
&& PAPERCLIP_RUNNER_SOURCE_REVISION="${PAPERCLIP_RUNNER_SOURCE_REVISION}" \
node packages/paperclip-runner/scripts/build-provider-pack.mjs /provider-pack \
+ "--candidate-providers=${PAPERCLIP_RUNNER_CANDIDATE_PROVIDERS}" \
&& chmod -R a+rX /provider-pack
# Fleet sandbox base image. Keep this section aligned with
diff --git a/docker/daytona-runner/README.md b/docker/daytona-runner/README.md
index 54b8911a67b..cd54962638f 100644
--- a/docker/daytona-runner/README.md
+++ b/docker/daytona-runner/README.md
@@ -94,6 +94,12 @@ full Git SHA as `PAPERCLIP_RUNNER_SOURCE_REVISION`.
Do not bake provider credentials, Paperclip bootstrap tickets, or Daytona
preview tokens into this image. They remain per-run secret material.
+The provider-pack build pins the official Linux x64 Node 24.21.0 image by
+manifest digest. Its bundled Undici is 7.29.1, which fixes
+[GHSA-3wwx-pv8p-q78v](https://github.com/advisories/GHSA-3wwx-pv8p-q78v).
+Pi separately verifies its private Node executable and nested npm dependency;
+changing the outer interpreter does not replace either provider-owned pin.
+
Provider CLI updates are manifest-only changes: repository CI owns the root
lockfile. Resolve the complete workspace manifest graph in the build context
before invoking Docker, matching CI when a source commit precedes the lockfile
@@ -106,6 +112,37 @@ verifies the downloaded artifact, then passes that artifact's SHA-256 as the
`PAPERCLIP_RUNNER_LOCK_SHA256` build argument. The Dockerfile checks the resolved
lock against this value before installation. The fixed Dockerfile default is
for standalone builds; it must not replace a campaign's verified lock digest.
+Refresh the default from the clean tracked lockfile using the exact
+`pnpm install --resolution-only --ignore-scripts --no-frozen-lockfile` command,
+and verify a second resolution preserves the digest. A lockfile left by a
+filtered or incremental install can retain stale importer patch identities.
+Refresh exact runtime versions and qualification digests together; do not
+download dependencies when a task starts.
+
+## Candidate ACP qualification assets
+
+Provider branches can build their pinned assets with
+`node packages/paperclip-runner/scripts/build-provider-pack.mjs /absolute/pack --candidate-providers=cursor`
+(or `copilot` or `pi`). The source revision must include the named provider's
+builder. Assets are installed at build time under `provider-assets//-`.
+The pack manifest binds each complete asset tree. Runtime admission separately
+checks the provider's source-owned closure pins and copies a verified launch snapshot.
+A pack with candidate assets does not qualify or enable that provider.
+
+For an isolated Linux x64 Daytona qualification image, pass
+`--build-arg PAPERCLIP_RUNNER_CANDIDATE_PROVIDERS=cursor` with the normal build arguments.
+Compute its content ID with the same selection:
+`pnpm --silent test:e2e:runner:image-id --candidate-providers=cursor`.
+Candidate assets and the default pack have distinct image identities. Never reuse
+the default image's content ID for a candidate build.
+Use each provider branch's recorded version and explicit model. Keep credentials
+out of images. Paid qualification requires bound provider and Daytona credentials,
+inspectable spend, and the shared $100 ceiling recorded in the capability report.
+
+The pack builder tests its copied Node interpreter after relocation. Use a
+standalone Node distribution if the host interpreter depends on a package manager's
+private shared libraries. Pi additionally pins its complete portable interpreter
+and npm dependency graph.
Refresh exact runtime versions and qualification digests together; never download
dependencies when a task starts. Grok's additive native ACP profile keeps its
qualified 1.0.13 executable at the verified sandbox prerequisite path. It does not replace the
diff --git a/docs/adapters/overview.md b/docs/adapters/overview.md
index 1f5717cffbf..7a38872d2d1 100644
--- a/docs/adapters/overview.md
+++ b/docs/adapters/overview.md
@@ -137,3 +137,12 @@ Rough tiers, richest first:
## UI Parser Contract
External adapters can ship a self-contained UI parser that tells the Paperclip web UI how to render their stdout. Without it, the UI uses a generic shell parser. See the [UI Parser Contract](/adapters/adapter-ui-parser) for details.
+
+### Cursor failure details
+
+The Cursor CLI adapter uses structured error output first, then the first
+nonempty diagnostic line. It skips the informational `cursor-retrieval: tracing
+to ...` file-location notice. If the CLI exits unsuccessfully with only that
+notice, the run shows the exit code. The original stdout and stderr remain in
+the local run result and log for troubleshooting. Environment probes use the
+same diagnostic selection. This does not change retry or success decisions.
diff --git a/docs/api/issues.md b/docs/api/issues.md
index b6ad1245745..7478e5480bc 100644
--- a/docs/api/issues.md
+++ b/docs/api/issues.md
@@ -175,7 +175,7 @@ POST /api/issues/{issueId}/comments
{ "body": "Progress update in markdown..." }
```
-@-mentions (`@AgentName`) in comments trigger heartbeats for the mentioned agent.
+Agent @-mentions are context only and do not trigger heartbeats. Normal comment feedback can still wake the current assignee. Use explicit assignment or a review request to ask another agent to act.
## Issue-Thread Interactions
diff --git a/docs/deploy/environment-variables.md b/docs/deploy/environment-variables.md
index c21d4f34b35..78ca705b7e6 100644
--- a/docs/deploy/environment-variables.md
+++ b/docs/deploy/environment-variables.md
@@ -93,7 +93,7 @@ Daytona snapshot for future leases.
their management endpoints with `403 settings_operator_managed`; hiding
`instance.experimental` floors every experimental toggle write.
- Any Instance → General section: `instance.general.censorUsernameInLogs`,
- `instance.general.keyboardShortcuts`, `instance.general.backupRetention`,
+ `instance.general.backupRetention`,
`instance.general.feedbackDataSharingPreference` (each also rejects
value-changing writes via `PATCH /api/instance/settings/general`), plus the
UI-only `instance.general.deploymentStatus` and `instance.general.signOut`.
diff --git a/docs/guides/agent-developer/comments-and-communication.md b/docs/guides/agent-developer/comments-and-communication.md
index fe44cb78d89..66f44a7c262 100644
--- a/docs/guides/agent-developer/comments-and-communication.md
+++ b/docs/guides/agent-developer/comments-and-communication.md
@@ -41,22 +41,16 @@ Submitted CTO hire request and linked it for board review.
## @-Mentions
-Mention another agent by name using `@AgentName` in a comment to wake them:
+Use a structured agent link to identify someone relevant to the task:
```
POST /api/issues/{issueId}/comments
-{ "body": "@EngineeringLead I need a review on this implementation." }
+{ "body": "[@Engineering Lead](agent://agent-id) has relevant context on this implementation." }
```
-The name must match the agent's `name` field exactly (case-insensitive). This triggers a heartbeat for the mentioned agent.
+Resolve the agent ID from the company’s agent list. Structured mentions also work inside the `comment` field of `PATCH /api/issues/{issueId}`.
-@-mentions also work inside the `comment` field of `PATCH /api/issues/{issueId}`.
-
-## @-Mention Rules
-
-- **Don't overuse mentions** — each mention triggers a budget-consuming heartbeat
-- **Don't use mentions for assignment** — create/assign a task instead
-- **Mention handoff exception** — if an agent is explicitly @-mentioned with a clear directive to take a task, they may self-assign via checkout
+Mentions are context only. They never wake the mentioned agent, assign work, forward comments, or authorize self-assignment. Normal feedback can still wake the current assignee. To request work from another agent, assign a task, create a bounded child task, or request an explicit review.
## Structured Decisions
diff --git a/docs/guides/agent-developer/skills-store.md b/docs/guides/agent-developer/skills-store.md
index 0ff736d2d9c..3d281358c32 100644
--- a/docs/guides/agent-developer/skills-store.md
+++ b/docs/guides/agent-developer/skills-store.md
@@ -63,10 +63,10 @@ its contents require. The level is **derived from the files**, not self-declared
| `assets` | Markdown plus images/PDFs/other static files | No executable code |
| `scripts_executables` | Any script (`.sh`, `.js`, `.py`, `.ts`, …) | Highest scrutiny |
-Trust level gates what can be imported. A skill that carries executable scripts **cannot
-be imported from an external source** (GitHub, `skills.sh`, or a raw URL) — only
-first-party bundled catalog skills are allowed to ship scripts. This keeps untrusted
-remote code out of your agents' hands.
+GitHub sources support scripts after the existing content audit passes. Importing
+never executes scripts, hooks, dependency installers, or builds. Raw URL and
+`skills.sh` imports retain their existing script restrictions. Unsafe content,
+secrets, invalid paths, and oversized files are still rejected.
## Where skills come from (source types)
@@ -81,10 +81,9 @@ A skill in your company library records where it originated. The Store shows thi
| `url` | URL | Imported from a raw markdown URL |
| `local_path` | Local | Created in-app or scanned from a project workspace on disk |
-External imports (`github`, `skills_sh`, `url`) are held to two rules: they must be
-`markdown_only` or `assets` (no scripts), and Git-backed sources **must resolve to a
-pinned 40-character commit SHA** before import, so a moving branch can never silently
-change what your agents run.
+Git-backed sources **must resolve to a pinned 40-character commit SHA** before
+import. A moving branch cannot change what agents run until you refresh its source.
+GitHub originals are read-only; use **Make a copy** to edit an independent local skill.
### Thin wrappers for external live playbooks
@@ -119,6 +118,128 @@ upstream catalog skill has changed.
- Re-installing an already-installed catalog skill updates it in place rather than
creating a duplicate.
+### Sync skills from GitHub
+
+Open **Skills → Sources → Import from GitHub** (also in the **New** menu), choose a connected repository or
+click **… or add public repo by URL** to paste a GitHub.com repository URL, then choose **Find skills**. The searchable list
+combines repositories from all GitHub connections you can access, with duplicates
+removed. Paperclip automatically uses an authorized connection for the chosen
+repository. Pasted URLs also use your authorized connections when available,
+including public repositories outside the list. Public repositories can use
+anonymous access when no connection succeeds; private repositories require access.
+
+A repository URL uses the default branch. Paste a branch URL such as
+`https://github.com/owner/repo/tree/feature/new-skills` to track another branch,
+including branches whose names contain slashes. **Add repos**
+opens the standard setup in Apps. Completing or cancelling setup returns you to
+the importer with your draft retained; the repository list refreshes automatically.
+Use the refresh button beside the repository count to reload accessible repositories.
+
+The searchable tree starts with every discovered skill package checked, including
+hidden and deeply nested directories. Each package shows its name and file count;
+expand it to see the files included with it. Folder checkboxes select descendant
+packages. A package checkbox selects that whole directory, stopping at nested
+`SKILL.md` boundaries; nested skills remain independently selectable. Supporting
+files cannot be deselected individually.
+
+Use the inspection button or click an included file to open a read-only preview.
+The inspector shows the repository path, scanned commit, byte sizes, executable
+flags, and any `compatibility` requirements declared by the author. Text previews
+show up to 64 KiB; binary assets show metadata and a link to GitHub for viewing or
+download. Preview reads use the current caller's GitHub access and re-audit the
+package at that exact commit. Preview failures do not alter selection or installed
+content. Existing sources gain inspection metadata on their next successful refresh.
+
+**Check references** flags detectable Markdown links and inline-code relative
+resource paths that are missing or outside the package, including files belonging to
+nested skills. This is a best-effort check, not a complete dependency analysis;
+references do not cause external files to be imported automatically. Fix the source
+or leave the package unchecked if it needs those files. Declared requirements are
+shown separately from these warnings and from content-audit notices.
+
+Validation errors appear beside affected skills; eligible selections import and
+skipped skills are reported. These skills become available in the current company's
+library and agent skill picker. Files are limited to 1 MiB each and a scan to 100 MiB
+of expanded skill content, counting repeated file copies. A scan supports up to
+1,000 skill packages and 10,000 package files. The repository path index includes
+directories and is limited to 100,000 paths, with paths up to 4,096 characters and
+64 levels deep. Discovery retains audited manifests without retaining every
+package's contents. Importing never runs scripts, hooks, dependency installation,
+or builds.
+
+Repeated scans resolve the branch's current commit and reuse the caller's cached
+snapshot when it is unchanged. Each server process allows one active scan per
+caller and two per company. Per minute, callers can open 30 snapshots and download
+6 repositories; companies can open 60 snapshots and download 12 repositories.
+Cached scans do not consume the download quota. A limit returns a retry message;
+installed skills remain available.
+
+**Skills → Sources** shows repositories, installed skill links, and connection errors.
+Click a repository title to open it on GitHub. Its three-dot menu contains
+**Refresh**, **Select skills**, and **Disconnect source**. **Refresh** applies valid
+updates immediately. New skills wait for
+**Select skills → Save selection** before import. Previously declined skills stay
+unchecked, including additions beneath excluded folders.
+
+Unchecking an installed skill stops future syncing and keeps its content and agent
+assignments. **Disconnect source** does the same for the whole repository. Remove
+an installed skill separately if you want it gone from the library. Upstream deletion
+shows **Removed from source** and retains the installed version; a moved path is a
+new skill, not an inferred rename.
+
+Installed content is stored locally, so viewing, testing, and agent execution work
+without GitHub access. Updates preserve skill identity, organization, assignments,
+and history. New versions are created only when package bytes or executable modes
+change; active runs and pinned versions keep their existing content. Skill Studio
+can view and test originals. **Make a copy** creates an independent editable skill.
+
+Older imports with no saved tracking branch resolve the repository’s default branch
+on their first successful refresh. If an explicit source already tracks that branch,
+the adopted source keeps a **Default branch** alias so both sets of installed skill
+identities and selections remain intact. Explicit branch and commit pins are preserved.
+
+Recognizable older GitHub imports are adopted into Sources without refetching or
+changing content; the first successful refresh completes their local snapshots.
+Bundled/catalog, project/local, unsupported-host, and `skills.sh` imports keep their
+existing behavior. Sync is manual and GitHub.com-only; upstream editing and pull
+requests are not part of this milestone.
+
+While finding skills, the dialog shows the scan stages, the current file, and
+recently checked skills as their local packages are validated. Large repositories show real
+package and file counts; you can cancel and retry without importing partial
+results. Selection opens only after the full scan completes. Importing displays
+an animated saving state while complete local packages are prepared. Animations
+respect reduced-motion preferences.
+
+Paperclip fetches one shallow Git snapshot, preserving committed bytes and executable
+permissions without checking out or running repository code. Download progress shows
+Git's measured receiving and preparing percentages before discovery begins. The server
+requires Git. Downloads are limited to 128 MiB and three minutes; at most two downloads
+run concurrently. Up to four temporary snapshots (including active downloads) are kept
+for ten minutes, scoped to the company and caller's authorization. Preview and import
+can reuse the exact scanned commit after checking access again. Installed skills remain
+local and independent of this temporary cache. GitHub's API is still used for repository
+identity and the connection picker, so metadata requests can still encounter rate limits.
+
+The discovery API keeps its normal JSON response. Clients requesting
+`Accept: application/x-ndjson` receive `progress` and `candidate` events followed
+by `complete` (containing the discovery response), or a terminal `error`. A stream
+ending without `complete` is unsuccessful; partial candidates are not importable.
+Progress contains metadata only, never package file contents.
+
+Source APIs live beneath `/api/companies/:companyId/skill-sources`:
+
+| Method/path | Purpose |
+|---|---|
+| `GET /` and `GET /:sourceId` | List sources and entries |
+| `GET /repositories` | Browse repositories through existing GitHub grants |
+| `POST /discover` | Discover and validate packages at one commit |
+| `POST /preview` | Preview an audited package file at an immutable commit using current caller access |
+| `POST /` | Import selected packages at the discovered commit |
+| `PATCH /:sourceId` | Save selection/exclusions and optional connection, with revision check |
+| `POST /:sourceId/refresh` | Refresh selected skills; discover new ones for review |
+| `DELETE /:sourceId` | Disconnect while retaining installed skills |
+
### Import from an external source
Paste a source and Paperclip fetches and imports it. Accepted forms include:
diff --git a/docs/start/architecture.md b/docs/start/architecture.md
index 11bd009ddc7..66df63ef337 100644
--- a/docs/start/architecture.md
+++ b/docs/start/architecture.md
@@ -72,7 +72,7 @@ paperclip/
When a heartbeat fires:
-1. **Trigger** — Scheduler, manual invoke, or event (assignment, mention) triggers a heartbeat
+1. **Trigger** — Scheduler, manual invoke, or event (assignment, assignee feedback) triggers a heartbeat
2. **Adapter invocation** — Server calls the configured adapter's `execute()` function
3. **Agent process** — Adapter spawns the agent (e.g. Claude Code CLI) with Paperclip env vars and a prompt
4. **Agent work** — The agent calls Paperclip's REST API to check assignments, checkout tasks, do work, and update status
diff --git a/packages/adapter-utils/src/acpx-engine/execute.ts b/packages/adapter-utils/src/acpx-engine/execute.ts
index 2c4b029e126..b1dc5699857 100644
--- a/packages/adapter-utils/src/acpx-engine/execute.ts
+++ b/packages/adapter-utils/src/acpx-engine/execute.ts
@@ -39,6 +39,13 @@ import {
import { captureLocalProcess, capturedProcessExited, killCapturedLocalProcess } from "./local-process-control.js";
import type { DuplexLossReason } from "../duplex-observability.js";
import { DUPLEX_CHANNEL_LOST_ERROR_CODE } from "../bridge-transport-contract.js";
+import {
+ formatTerminalSessionFailure,
+ sanitizeTerminalSessionFailure,
+ type AcpxTerminalSessionFailure,
+ type AcpxTerminalSessionFailureDiagnostic,
+} from "./terminal-session-failure.js";
+export type { AcpxTerminalSessionFailure } from "./terminal-session-failure.js";
import type { WorkspaceRestoreFailureCode, WorkspaceRestoreOutcome } from "../workspace-restore-merge.js";
import {
classifyWorkspaceRestoreFailure,
@@ -353,12 +360,6 @@ export interface AcpxRemoteManagedHomeResult {
disposeStaged?: () => Promise;
}
-export interface AcpxTerminalSessionFailure {
- category: string;
- title?: string;
- details?: string;
-}
-
export type AcpxTerminalFailureClassification = Pick<
AdapterExecutionResult,
"errorCode" | "errorFamily" | "retryNotBefore"
@@ -2058,7 +2059,11 @@ async function buildRuntime(input: {
paperclipClaudeSettings = await writePaperclipClaudeSettings({
cwd,
stateDir,
- agentHome,
+ // A run's writable AGENT_HOME moves, but the existing permission root
+ // must not invalidate its resumable conversation. Run copies are covered
+ // by the company root already granted in these settings; the process env
+ // still receives this run's actual AGENT_HOME.
+ agentHome: asString(workspaceContext.agentHomeForPermissions, agentHome),
companyId: agent.companyId,
});
skillCommandNotes.push(
@@ -4094,6 +4099,7 @@ export function createAcpxEngineExecutor(deps: AcpxEngineExecutorOptions = {}) {
// (the cancel-before-close order). The turn wrapper assigns it in `turnStart`.
let activeTurn: AcpRuntimeTurn | null = null;
let terminalFailureClassification: AcpxTerminalFailureClassification | null = null;
+ let terminalSessionFailure: AcpxTerminalSessionFailureDiagnostic | null = null;
// How the settlement `endSession` step must release the runtime for the path
// this run took. Each exit path that acquired the runtime records it before it
// returns; a build or create-runtime failure never registers the runtime, so
@@ -4775,14 +4781,14 @@ export function createAcpxEngineExecutor(deps: AcpxEngineExecutorOptions = {}) {
timeoutMs: startTimeoutMs,
signal,
// The callback belongs to this turn, including when a runtime is reused.
- // Raw provider text must never enter the result or the run log.
- ...(deps.classifyTerminalSessionFailure
- ? {
- onTerminalSessionFailure: (failure: AcpxTerminalSessionFailure) => {
- terminalFailureClassification = deps.classifyTerminalSessionFailure!(failure, new Date(now()));
- },
- }
- : {}),
+ // Diagnostics are retained even when an adapter has no recovery
+ // classifier. Redact before bounding so partial secrets cannot leak.
+ onTerminalSessionFailure: (failure: AcpxTerminalSessionFailure) => {
+ terminalSessionFailure = sanitizeTerminalSessionFailure(
+ failure, prepared.env, ctx.authToken, parseObject(ctx.config.env),
+ );
+ terminalFailureClassification = deps.classifyTerminalSessionFailure?.(failure, new Date(now())) ?? null;
+ },
});
activeTurn = turn;
// A latched sandbox duplex-channel loss otherwise has no way to reach
@@ -4995,11 +5001,14 @@ export function createAcpxEngineExecutor(deps: AcpxEngineExecutorOptions = {}) {
skipRemoteClose: channelLost,
};
+ const failureDiagnostic = !timedOut && !channelLost && terminal.status === "failed"
+ ? terminalSessionFailure
+ : null;
const errorMessage = timedOut
? formatAdapterExecutionTimeoutErrorMessage(prepared.timeoutResolution)
: channelLost
? channelLostMessage
- : resultErrorMessage(terminal);
+ : formatTerminalSessionFailure(resultErrorMessage(terminal), failureDiagnostic);
const terminalStopReason = terminal.status === "failed" ? terminal.error.message : terminal.stopReason;
const classifiedFailure = !timedOut && !channelLost && terminal.status === "failed"
? terminalFailureClassification
@@ -5038,6 +5047,7 @@ export function createAcpxEngineExecutor(deps: AcpxEngineExecutorOptions = {}) {
costUsd: turnUsage.costUsd,
resultJson: {
status: channelLost ? "failed" : terminal.status,
+ ...(failureDiagnostic ? { terminalSessionFailure: failureDiagnostic } : {}),
...(classifiedFailure?.errorFamily ? { errorFamily: classifiedFailure.errorFamily } : {}),
...(classifiedFailure?.retryNotBefore
? {
diff --git a/packages/adapter-utils/src/acpx-engine/spawn-smoke.test.ts b/packages/adapter-utils/src/acpx-engine/spawn-smoke.test.ts
index 0a20dd29b38..837ba47d251 100644
--- a/packages/adapter-utils/src/acpx-engine/spawn-smoke.test.ts
+++ b/packages/adapter-utils/src/acpx-engine/spawn-smoke.test.ts
@@ -16,6 +16,12 @@ const fixturePath = path.join(
);
const tempRoots: string[] = [];
+async function writeFailureFile(root: string, title: string): Promise {
+ const file = path.join(root, "failure.json");
+ await fs.writeFile(file, JSON.stringify({ title, category: "request" }));
+ return file;
+}
+
afterEach(async () => {
await Promise.all(
tempRoots
@@ -61,7 +67,7 @@ it("spawns a real Node ACP agent with per-session env on this platform", async (
expect(stderr).toContain("paperclip-acp-echo-agent started");
});
-it("fails closed on a typed ACP session failure without exposing its provider text", async () => {
+it("retains a typed ACP failure as diagnostics without making it assistant output", async () => {
const root = await fs.mkdtemp(
path.join(os.tmpdir(), "paperclip-acpx-typed-failure-"),
);
@@ -80,7 +86,7 @@ it("fails closed on a typed ACP session failure without exposing its provider te
mode: "oneshot",
stateDir: path.join(root, "state"),
cwd: repoRoot,
- env: { PAPERCLIP_ACPX_TYPED_FAILURE_CANARY: providerText },
+ env: { PAPERCLIP_ACPX_TYPED_FAILURE_FILE: await writeFailureFile(root, providerText) },
},
context: {},
onLog: async (_stream: string, text: string) => logs.push(text),
@@ -89,8 +95,10 @@ it("fails closed on a typed ACP session failure without exposing its provider te
expect(result.exitCode).toBe(1);
expect(result.errorCode).toBe("acpx_turn_failed");
- expect(JSON.stringify(result)).not.toContain(providerText);
- expect(logs.join("\n")).not.toContain(providerText);
+ expect(result.errorMessage).toContain(providerText);
+ expect(result.resultJson?.terminalSessionFailure).toMatchObject({ title: providerText });
+ expect(result.summary).not.toContain(providerText);
+ expect(logs.join("\n")).toContain(providerText);
expect(result.summary).toContain("terminal request failure");
});
@@ -114,7 +122,7 @@ it("fails closed on a typed ACP session failure in persistent mode", async () =>
warmHandleIdleMs: 0,
stateDir: path.join(root, "state"),
cwd: repoRoot,
- env: { PAPERCLIP_ACPX_TYPED_FAILURE_CANARY: providerText },
+ env: { PAPERCLIP_ACPX_TYPED_FAILURE_FILE: await writeFailureFile(root, providerText) },
},
context: {},
onLog: async (_stream: string, text: string) => logs.push(text),
@@ -123,8 +131,10 @@ it("fails closed on a typed ACP session failure in persistent mode", async () =>
expect(result.exitCode).toBe(1);
expect(result.errorCode).toBe("acpx_turn_failed");
- expect(JSON.stringify(result)).not.toContain(providerText);
- expect(logs.join("\n")).not.toContain(providerText);
+ expect(result.errorMessage).toContain(providerText);
+ expect(result.resultJson?.terminalSessionFailure).toMatchObject({ title: providerText });
+ expect(result.summary).not.toContain(providerText);
+ expect(logs.join("\n")).toContain(providerText);
expect(result.summary).toContain("terminal request failure");
});
diff --git a/packages/adapter-utils/src/acpx-engine/terminal-session-failure.test.ts b/packages/adapter-utils/src/acpx-engine/terminal-session-failure.test.ts
new file mode 100644
index 00000000000..dbe8cea1ed3
--- /dev/null
+++ b/packages/adapter-utils/src/acpx-engine/terminal-session-failure.test.ts
@@ -0,0 +1,134 @@
+import { describe, expect, it } from "vitest";
+import { formatTerminalSessionFailure, sanitizeTerminalSessionFailure } from "./terminal-session-failure.js";
+
+describe("terminal session failure diagnostics", () => {
+ it("keeps the provider category, message, request id and stack", () => {
+ const failure = {
+ category: "service",
+ title: "HTTP 529: overloaded_error",
+ details: 'request_id=req_diagnostic_123\n{"error":{"message":"Service unavailable"}}\n at prompt (agent.js:42:7)',
+ };
+ const diagnostic = sanitizeTerminalSessionFailure(failure, {});
+ expect(diagnostic).toEqual(failure);
+ expect(formatTerminalSessionFailure("ACP turn failed.", diagnostic)).toBe(
+ `ACP turn failed.\n${failure.title}\n${failure.details}`,
+ );
+ });
+
+ it("redacts known credentials and common secret forms without dropping useful context", () => {
+ const secret = 'opaque / credential "value"';
+ const runKey = "run-credential-canary";
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "access",
+ title: `Request rejected: ${secret}`,
+ details: [
+ `request_id=req_123 ${runKey}`,
+ JSON.stringify({ message: secret }),
+ `https://example.test/?value=${encodeURIComponent(secret)}`,
+ 'Authorization: Bearer bearer-canary',
+ '{"api_key":"json-canary"}',
+ 'sk-ant-example-provider-key-canary',
+ 'TOKEN=assignment-canary',
+ ].join("\n"),
+ }, { PROVIDER_SECRET: secret }, runKey);
+ const serialized = JSON.stringify(diagnostic);
+ for (const value of ["opaque", runKey, "bearer-canary", "json-canary", "sk-ant-example", "assignment-canary"]) {
+ expect(serialized).not.toContain(value);
+ }
+ expect(diagnostic.details).toContain("request_id=req_123");
+ expect(diagnostic.title).toBe("Request rejected: ***REDACTED***");
+ });
+
+ it("redacts before truncation and reports every omitted field", () => {
+ const credential = "opaque-credential-crossing-the-limit";
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "service",
+ title: "t".repeat(5000),
+ details: `${"d".repeat(24568)}${credential}${"x".repeat(1000)}`,
+ }, { API_KEY: credential });
+ expect(diagnostic.truncatedFields).toEqual(["title", "details"]);
+ expect(diagnostic.title).toContain("[truncated: 904 characters omitted]");
+ expect(diagnostic.details).not.toContain("opaque");
+ expect(diagnostic.details).toContain("[truncated:");
+ expect(diagnostic.details!.length).toBeLessThan(24700);
+ });
+
+ it("redacts configured values with arbitrary names and connection URL passwords", () => {
+ const databaseUrl = "postgres://user:database%20canary@db.test/database";
+ const opaque = "arbitrarily-named-secret";
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "service",
+ details: `request_id=req_123 ${databaseUrl}\npassword echoed: database canary\n${opaque}`,
+ }, { DATABASE_URL: databaseUrl, PROVIDER_SETTING: opaque }, undefined, {
+ DATABASE_URL: databaseUrl, PROVIDER_SETTING: opaque,
+ });
+ expect(diagnostic.details).toBe(
+ "request_id=req_123 ***REDACTED***\npassword echoed: ***REDACTED***\n***REDACTED***",
+ );
+ });
+
+ it("redacts unknown inherited launch values while preserving public process context", () => {
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "service",
+ details: "request_id=req_123 inherited-canary A /workspace",
+ }, { UNEXPECTED_VARIABLE: "inherited-canary", ANOTHER_VARIABLE: "A", HOME: "/workspace" });
+ expect(diagnostic.details).toBe("request_id=req_123 ***REDACTED*** ***REDACTED*** /workspace");
+ });
+
+ it("preserves known boolean settings, HTTP codes and request IDs", () => {
+ const details = "HTTP 401 request_id=req_123 req-1 /1/path retries=1";
+ const diagnostic = sanitizeTerminalSessionFailure({ category: "access", details }, {
+ OPENCODE_ALLOW_ALL_MODELS: "1",
+ }, undefined, { OPENCODE_ALLOW_ALL_MODELS: "1" });
+ expect(diagnostic.details).toBe(details);
+ });
+
+ it("redacts short credentials even inside words, paths and punctuated strings", () => {
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "access", details: "upstream abc-def /abc/path xabcx abc.value abc_other",
+ }, { CUSTOM_SETTING: "abc" }, undefined, { CUSTOM_SETTING: "abc" });
+ expect(diagnostic.details).not.toContain("abc");
+ expect(diagnostic.details).toBe(
+ "upstream ***REDACTED***-def /***REDACTED***/path x***REDACTED***x ***REDACTED***.value ***REDACTED***_other",
+ );
+ });
+
+ it("fits the persisted transcript chunk limit even with escaped provider text", () => {
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "service",
+ title: '"'.repeat(5000),
+ details: "\\".repeat(40000),
+ }, {});
+ const log = JSON.stringify({
+ type: "acpx.error", summary: "failed", stopReason: "adapter_failed",
+ message: formatTerminalSessionFailure("ACP agent reported a terminal service failure.", diagnostic),
+ });
+ expect(log.length).toBeLessThan(64 * 1024);
+ expect(JSON.parse(log).message).toContain("[truncated:");
+ });
+
+ it("handles empty, malformed and control-character fields", () => {
+ expect(sanitizeTerminalSessionFailure({
+ category: "untrusted-category",
+ title: " \n",
+ details: 42 as unknown as string,
+ }, {})).toEqual({ category: "unknown" });
+ expect(sanitizeTerminalSessionFailure({
+ category: "service",
+ title: "\x1b[31mFailure\x1b[0m\0",
+ details: "line 1\n\tline 2",
+ }, {})).toEqual({ category: "service", title: "Failure", details: "line 1\n\tline 2" });
+ expect(formatTerminalSessionFailure("original error", null)).toBe("original error");
+ });
+
+ it("keeps truncated Unicode valid for JSONB storage", () => {
+ const diagnostic = sanitizeTerminalSessionFailure({
+ category: "service",
+ title: `${"x".repeat(4095)}🚨failure`,
+ details: "malformed \ud800 detail",
+ }, {});
+ expect(diagnostic.title).not.toMatch(/[\ud800-\udfff]/u);
+ expect(diagnostic.details).not.toMatch(/[\ud800-\udfff]/u);
+ expect(diagnostic.truncatedFields).toEqual(["title"]);
+ });
+});
diff --git a/packages/adapter-utils/src/acpx-engine/terminal-session-failure.ts b/packages/adapter-utils/src/acpx-engine/terminal-session-failure.ts
new file mode 100644
index 00000000000..8491aa56f8b
--- /dev/null
+++ b/packages/adapter-utils/src/acpx-engine/terminal-session-failure.ts
@@ -0,0 +1,104 @@
+import { redactDiagnosticText, REDACTED_COMMAND_TEXT_VALUE } from "../command-redaction.js";
+
+export interface AcpxTerminalSessionFailure {
+ category: string;
+ title?: string;
+ details?: string;
+}
+
+export interface AcpxTerminalSessionFailureDiagnostic extends AcpxTerminalSessionFailure {
+ truncatedFields?: Array<"title" | "details">;
+}
+
+const CATEGORIES = new Set(["connection", "access", "limit", "service", "request", "unknown"]);
+// Leave room under the server's 64 KiB run-log chunk limit even when every
+// retained character needs JSON escaping. The transcript stores the text once.
+const FIELD_LIMITS = { title: 4096, details: 24576 } as const;
+// Only conventional public process settings may survive by default. Provider,
+// proxy, bridge, and future launch contributions may carry secrets under any
+// name. Explicitly configured values are still redacted even for these keys.
+const PUBLIC_ENV_KEYS = new Set([
+ "PATH", "PATHEXT", "SYSTEMROOT", "WINDIR", "COMSPEC", "HOME", "USERPROFILE",
+ "HOMEDRIVE", "HOMEPATH", "USER", "USERNAME", "LOGNAME", "SHELL", "LANG",
+ "LANGUAGE", "LC_ALL", "LC_CTYPE", "TZ", "TMPDIR", "TEMP", "TMP", "NODE_ENV",
+ "XDG_CONFIG_HOME", "XDG_CACHE_HOME", "XDG_DATA_HOME",
+ "PAPERCLIP_AGENT_ID", "PAPERCLIP_COMPANY_ID", "PAPERCLIP_RUN_ID", "PAPERCLIP_TASK_ID",
+]);
+const PUBLIC_BOOLEAN_ENV_KEYS = new Set([
+ "OPENCODE_ALLOW_ALL_MODELS", "CLAUDE_CODE_USE_BEDROCK", "GOOGLE_GENAI_USE_GCA",
+ "CI", "NO_COLOR", "FORCE_COLOR",
+]);
+
+function isPublicBooleanSetting(key: string, value: string): boolean {
+ return PUBLIC_BOOLEAN_ENV_KEYS.has(key.toUpperCase()) && /^(?:0|1|true|false)$/i.test(value);
+}
+
+/** Keep provider diagnostics in the run, after redaction and before truncation. */
+export function sanitizeTerminalSessionFailure(
+ failure: AcpxTerminalSessionFailure,
+ env: Record,
+ authToken?: string,
+ configuredEnv: Record = {},
+): AcpxTerminalSessionFailureDiagnostic {
+ const secrets = Object.entries(env)
+ .filter(([key, value]) => value && !PUBLIC_ENV_KEYS.has(key.toUpperCase()) && !isPublicBooleanSetting(key, value))
+ .map(([, value]) => value);
+ // Configured values can be resolved secret_refs under arbitrary names (for
+ // example DATABASE_URL). Key-name heuristics cannot establish they are public.
+ for (const [key, value] of Object.entries(configuredEnv)) {
+ if (typeof value === "string" && value && !isPublicBooleanSetting(key, value)) secrets.push(value);
+ }
+ // A provider may echo just the password from a configured connection URL.
+ for (const value of Object.values(env)) {
+ try {
+ const url = new URL(value);
+ if (url.password) {
+ secrets.push(value, url.password, decodeURIComponent(url.password));
+ }
+ } catch { /* ordinary environment values are not URLs */ }
+ }
+ if (authToken) secrets.push(authToken);
+ const secretForms = [...new Set(secrets.flatMap((value) => {
+ const forms = [value, JSON.stringify(value).slice(1, -1)];
+ // A malformed Unicode credential must not discard the entire diagnostic.
+ try { forms.push(encodeURIComponent(value)); } catch { /* retain literal forms */ }
+ return forms;
+ }))].sort((a, b) => b.length - a.length);
+ // Replace in one pass so a short value cannot modify a redaction marker
+ // inserted for a longer value or cause repeated marker expansion.
+ const secretPattern = secretForms.length > 0
+ ? new RegExp(secretForms.map((value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "gu")
+ : null;
+ const diagnostic: AcpxTerminalSessionFailureDiagnostic = {
+ category: CATEGORIES.has(failure.category) ? failure.category : "unknown",
+ };
+ for (const field of ["title", "details"] as const) {
+ const raw = failure[field];
+ if (typeof raw !== "string" || !raw.trim()) continue;
+ let text = secretPattern ? raw.replace(secretPattern, () => REDACTED_COMMAND_TEXT_VALUE) : raw;
+ text = redactDiagnosticText(text)
+ // Keep line breaks and tabs for provider JSON and stack traces, but strip
+ // terminal control sequences and characters PostgreSQL cannot store.
+ .replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "")
+ .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "")
+ .replace(/[\ud800-\udfff]/gu, "\ufffd")
+ .trim();
+ const limit = FIELD_LIMITS[field];
+ if (text.length > limit) {
+ (diagnostic.truncatedFields ??= []).push(field);
+ // Do not split a UTF-16 surrogate pair into invalid JSONB text.
+ const end = (text.codePointAt(limit - 1) ?? 0) > 0xffff ? limit - 1 : limit;
+ text = `${text.slice(0, end)}\n[truncated: ${text.length - end} characters omitted]`;
+ }
+ if (text) diagnostic[field] = text;
+ }
+ return diagnostic;
+}
+
+export function formatTerminalSessionFailure(
+ message: string | null,
+ diagnostic: AcpxTerminalSessionFailureDiagnostic | null,
+): string | null {
+ if (!diagnostic) return message;
+ return [...new Set([message, diagnostic.title, diagnostic.details].filter(Boolean))].join("\n");
+}
diff --git a/packages/adapter-utils/src/acpx-engine/turn-characterization.test.ts b/packages/adapter-utils/src/acpx-engine/turn-characterization.test.ts
index 01eea583224..f58e214182c 100644
--- a/packages/adapter-utils/src/acpx-engine/turn-characterization.test.ts
+++ b/packages/adapter-utils/src/acpx-engine/turn-characterization.test.ts
@@ -227,7 +227,7 @@ describe("ACPX engine turn characterization", () => {
runtimeSessionName: "runtime-session",
};
- it("passes exactly the six turn inputs to startTurn", async () => {
+ it("passes the turn inputs and terminal failure callback to startTurn", async () => {
const root = await makeTempRoot();
const stateDir = path.join(root, "state");
let captured: Record | null = null;
@@ -276,9 +276,10 @@ describe("ACPX engine turn characterization", () => {
const signal = input.signal as AbortSignal;
expect(signal).toBeInstanceOf(AbortSignal);
expect(signal.aborted).toBe(false);
- // Exactly the six documented keys are threaded.
+ // Every adapter receives diagnostics, even without a failure classifier.
+ expect(input.onTerminalSessionFailure).toBeTypeOf("function");
expect(Object.keys(input).sort()).toEqual(
- ["handle", "mode", "requestId", "signal", "text", "timeoutMs"].sort(),
+ ["handle", "mode", "onTerminalSessionFailure", "requestId", "signal", "text", "timeoutMs"].sort(),
);
});
diff --git a/packages/adapter-utils/src/command-managed-runtime.ts b/packages/adapter-utils/src/command-managed-runtime.ts
index befdccf674d..9abfd933c9f 100644
--- a/packages/adapter-utils/src/command-managed-runtime.ts
+++ b/packages/adapter-utils/src/command-managed-runtime.ts
@@ -544,6 +544,8 @@ export async function prepareCommandManagedRuntime(input: {
workspaceBaseline?: DirectorySnapshot;
workspaceGitSnapshot?: GitWorkspaceSnapshot | null;
workspaceExclude?: string[];
+ /** Plain persistent directories include all files, independent of Git and task cache exclusions. */
+ workspaceFileMode?: "all";
preserveAbsentOnRestore?: string[];
assets?: CommandManagedRuntimeAsset[];
/** Referenced (additional) projects to stage into the sandbox as plain, read-only trees. */
@@ -609,6 +611,7 @@ export async function prepareCommandManagedRuntime(input: {
workspaceBaseline: input.workspaceBaseline,
workspaceGitSnapshot: input.workspaceGitSnapshot,
workspaceExclude: mergeRuntimeExcludes(input.workspaceExclude),
+ workspaceFileMode: input.workspaceFileMode,
preserveAbsentOnRestore: input.preserveAbsentOnRestore,
assets: input.assets,
additionalSources: input.additionalSources,
@@ -652,6 +655,7 @@ export async function prepareCommandManagedRuntime(input: {
workspaceBaseline: input.workspaceBaseline,
workspaceGitSnapshot: input.workspaceGitSnapshot,
workspaceExclude: mergeRuntimeExcludes(input.workspaceExclude),
+ workspaceFileMode: input.workspaceFileMode,
preserveAbsentOnRestore: input.preserveAbsentOnRestore,
assets: input.assets,
additionalSources: input.additionalSources,
diff --git a/packages/adapter-utils/src/execution-target.ts b/packages/adapter-utils/src/execution-target.ts
index ca816ca25c3..6b118011d43 100644
--- a/packages/adapter-utils/src/execution-target.ts
+++ b/packages/adapter-utils/src/execution-target.ts
@@ -1437,6 +1437,8 @@ export async function prepareAdapterExecutionTargetRuntime(input: {
workspaceBaseline?: DirectorySnapshot;
workspaceGitSnapshot?: GitWorkspaceSnapshot | null;
workspaceExclude?: string[];
+ /** Plain persistent directories include all files, independent of Git and task cache exclusions. */
+ workspaceFileMode?: "all";
preserveAbsentOnRestore?: string[];
assets?: AdapterManagedRuntimeAsset[];
/** Referenced (additional) projects to stage into the sandbox as plain, read-only trees. */
@@ -1478,6 +1480,8 @@ export async function prepareAdapterExecutionTargetRuntime(input: {
workspaceLocalDir: input.workspaceLocalDir,
workspaceRemoteDir: input.workspaceRemoteDir,
syncWorkspace: input.syncWorkspace,
+ workspaceFileMode: input.workspaceFileMode,
+ workspaceExclude: input.workspaceExclude,
assets: input.assets,
additionalSources: input.additionalSources,
onProgress: input.onProgress,
@@ -1517,6 +1521,7 @@ export async function prepareAdapterExecutionTargetRuntime(input: {
workspaceBaseline: input.workspaceBaseline,
workspaceGitSnapshot: input.workspaceGitSnapshot,
workspaceExclude: input.workspaceExclude,
+ workspaceFileMode: input.workspaceFileMode,
preserveAbsentOnRestore: input.preserveAbsentOnRestore,
assets: input.assets,
additionalSources: input.additionalSources,
diff --git a/packages/adapter-utils/src/index.ts b/packages/adapter-utils/src/index.ts
index 653c07e936f..eb02fb4efc4 100644
--- a/packages/adapter-utils/src/index.ts
+++ b/packages/adapter-utils/src/index.ts
@@ -117,6 +117,7 @@ export {
PAPERCLIP_RUNNER_IDLE_TIMEOUT_MAX_MS,
PAPERCLIP_RUNNER_DEFAULT_MODELS,
PAPERCLIP_RUNNER_PERMISSION_CAPABILITIES,
+ PAPERCLIP_RUNNER_ACPX_PROFILES,
isPaperclipRunnerProvider,
resolvePaperclipRunnerIdleTimeoutMs,
resolvePaperclipRunnerModel,
diff --git a/packages/adapter-utils/src/paperclip-runner-permissions.ts b/packages/adapter-utils/src/paperclip-runner-permissions.ts
index ed9b2dee71e..cb32c0fd78c 100644
--- a/packages/adapter-utils/src/paperclip-runner-permissions.ts
+++ b/packages/adapter-utils/src/paperclip-runner-permissions.ts
@@ -125,7 +125,7 @@ export const PAPERCLIP_RUNNER_PERMISSION_CAPABILITIES = {
value: "approve-reads",
label: "Allow Paperclip reads",
description:
- "Automatically allow assigned Paperclip read tools. Other operations stop with an approval-required message because this runner has no interactive approval handler.",
+ "Automatically allow assigned Paperclip read tools. Other operations request a supported permission decision. Company permissions and execution boundaries still apply.",
},
{
value: "deny-all",
@@ -223,3 +223,12 @@ export function normalizeLegacyRunnerProvider(
} = config;
return { ...rest, provider: "codex", codexPermissionMode: "never" };
}
+
+/** Qualification is a release property, never an operator-configurable bypass. */
+export const PAPERCLIP_RUNNER_ACPX_PROFILES = Object.freeze([
+ { value: "grok", label: "Grok Build", qualified: true, credentialEnvironment: ["XAI_API_KEY"] },
+ { value: "claude", label: "Claude", qualified: true, credentialEnvironment: ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"] },
+ { value: "cursor", label: "Cursor", qualified: false, credentialEnvironment: ["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"] },
+ { value: "copilot", label: "GitHub Copilot", qualified: false, credentialEnvironment: ["COPILOT_GITHUB_TOKEN"] },
+ { value: "pi", label: "Pi", qualified: false, credentialEnvironment: ["OPENROUTER_API_KEY"] },
+] as const);
diff --git a/packages/adapter-utils/src/remote-managed-runtime.test.ts b/packages/adapter-utils/src/remote-managed-runtime.test.ts
index 89659bb643e..f5cb64b9d06 100644
--- a/packages/adapter-utils/src/remote-managed-runtime.test.ts
+++ b/packages/adapter-utils/src/remote-managed-runtime.test.ts
@@ -32,6 +32,33 @@ import { setExpensiveWorkspaceGitExecutor } from "./git-workspace-sync.js";
describe("remote managed runtime", () => {
const cleanupDirs: string[] = [];
+ it("stages all files over SSH without Git or cache exclusions and restores the same baseline", async () => {
+ const root = await mkdtemp(path.join(os.tmpdir(), "paperclip-ssh-plain-"));
+ cleanupDirs.push(root);
+ await mkdir(path.join(root, "node_modules"));
+ await writeFile(path.join(root, ".gitignore"), "node_modules/\n");
+ await writeFile(path.join(root, "node_modules", "personal.bin"), Buffer.from([0, 255, 1]));
+ const prepared = await prepareRemoteManagedRuntime({
+ spec: { host: "127.0.0.1", port: 2222, username: "fixture", remoteWorkspacePath: "/app", remoteCwd: "/app",
+ privateKey: "PRIVATE KEY", knownHosts: "KNOWN HOSTS", strictHostKeyChecking: true },
+ runId: "plain", adapterKey: "test", workspaceLocalDir: root,
+ workspaceFileMode: "all", workspaceExclude: ["explicitly-excluded"],
+ });
+ expect(prepareWorkspaceForSshExecution).toHaveBeenCalledWith(expect.objectContaining({
+ localDir: root, remoteDir: prepared.workspaceRemoteDir, workspaceFileMode: "all", workspaceExclude: ["explicitly-excluded"],
+ }));
+ await prepared.restoreWorkspace();
+ expect(restoreWorkspaceFromSshExecution).toHaveBeenCalledWith(expect.objectContaining({
+ restoreGitHistory: false, baselineSnapshot: expect.objectContaining({
+ exclude: [".paperclip-runtime", "explicitly-excluded"],
+ entries: expect.any(Map),
+ }),
+ }));
+ const args = vi.mocked(restoreWorkspaceFromSshExecution).mock.calls[0] as unknown as [{ baselineSnapshot: { entries: Map } }];
+ expect(args[0].baselineSnapshot.entries.has("node_modules/personal.bin")).toBe(true);
+ });
+
+
afterEach(async () => {
vi.clearAllMocks();
while (cleanupDirs.length > 0) {
diff --git a/packages/adapter-utils/src/remote-managed-runtime.ts b/packages/adapter-utils/src/remote-managed-runtime.ts
index ff394dc7fb3..cb47f3caede 100644
--- a/packages/adapter-utils/src/remote-managed-runtime.ts
+++ b/packages/adapter-utils/src/remote-managed-runtime.ts
@@ -113,6 +113,8 @@ export async function prepareRemoteManagedRuntime(input: {
workspaceLocalDir: string;
workspaceRemoteDir?: string;
syncWorkspace?: boolean;
+ workspaceFileMode?: "all";
+ workspaceExclude?: string[];
assets?: RemoteManagedRuntimeAsset[];
/** Referenced (additional) projects to stage as plain, read-only trees. */
additionalSources?: SandboxAdditionalSource[];
@@ -139,13 +141,15 @@ export async function prepareRemoteManagedRuntime(input: {
localDir: input.workspaceLocalDir,
remoteDir: workspaceRemoteDir,
onProgress: input.onProgress,
+ workspaceFileMode: input.workspaceFileMode,
+ workspaceExclude: input.workspaceExclude,
})
: null;
const baselineSnapshot = preparedWorkspace
? await captureDirectorySnapshot(input.workspaceLocalDir, {
exclude: preparedWorkspace.gitBacked
? [...GIT_ARCHIVE_EXCLUDES, ".paperclip-runtime"]
- : [".paperclip-runtime"],
+ : [".paperclip-runtime", ...(input.workspaceFileMode === "all" ? input.workspaceExclude ?? [] : [])],
})
: null;
diff --git a/packages/adapter-utils/src/sandbox-managed-runtime.test.ts b/packages/adapter-utils/src/sandbox-managed-runtime.test.ts
index 58dfd1c960e..88144df3dfa 100644
--- a/packages/adapter-utils/src/sandbox-managed-runtime.test.ts
+++ b/packages/adapter-utils/src/sandbox-managed-runtime.test.ts
@@ -1212,7 +1212,9 @@ describe("sandbox managed runtime", () => {
});
it.each(["symlink", "root_symlink", "root_alias", "root_alias_retarget", "case_alias", "EACCES", "EIO", "ENOENT"])("handles an overlay source changed after the snapshot: %s", async (change) => {
- const rootDir = await mkdtemp(path.join(os.tmpdir(), "paperclip-sandbox-overlay-source-"));
+ // The runtime pins a realpath root before staging. Match that spelling so
+ // injected I/O errors also reach the selected file on macOS's /var alias.
+ const rootDir = await fsPromises.realpath(await mkdtemp(path.join(os.tmpdir(), "paperclip-sandbox-overlay-source-")));
cleanupDirs.push(rootDir);
const workspaceLocalDir = path.join(rootDir, "workspace");
await initGitRepo(workspaceLocalDir);
@@ -1301,6 +1303,7 @@ describe("sandbox managed runtime", () => {
expect(syncIn).toHaveBeenCalledOnce();
} else {
await expect(preparing).rejects.toThrow(change.endsWith("symlink") ? /overlay.*directory/i : failure.message);
+ if (statSpy) expect(statSpy).toHaveBeenCalledWith(selectedPath);
expect(syncIn).not.toHaveBeenCalled();
}
} finally {
diff --git a/packages/adapter-utils/src/sandbox-managed-runtime.ts b/packages/adapter-utils/src/sandbox-managed-runtime.ts
index 3f83e61639a..10eeab606e4 100644
--- a/packages/adapter-utils/src/sandbox-managed-runtime.ts
+++ b/packages/adapter-utils/src/sandbox-managed-runtime.ts
@@ -1102,6 +1102,8 @@ export async function prepareSandboxManagedRuntime(input: {
workspaceBaseline?: DirectorySnapshot;
workspaceGitSnapshot?: GitWorkspaceSnapshot | null;
workspaceExclude?: string[];
+ /** Plain persistent directories include all files, independent of Git and task cache exclusions. */
+ workspaceFileMode?: "all";
preserveAbsentOnRestore?: string[];
assets?: SandboxManagedRuntimeAsset[];
/**
@@ -1179,7 +1181,7 @@ export async function prepareSandboxManagedRuntime(input: {
// The git enumeration (`git status --ignored`, the HEAD diffs, `ls-files`).
// It reads git's own bookkeeping to decide what to include/exclude, so it is
// usually fast, but on a large working tree the `--ignored` walk is not free.
- const gitSnapshot = syncWorkspace
+ const gitSnapshot = syncWorkspace && input.workspaceFileMode !== "all"
? input.workspaceGitSnapshot !== undefined
? input.workspaceGitSnapshot
: await runStepSpan("snapshot.git", () =>
@@ -1195,7 +1197,7 @@ export async function prepareSandboxManagedRuntime(input: {
// A selected subfolder has no cloneable Git snapshot, but its parent
// repository's ignore rules still govern which files may leave the host.
// Use the same bounded, path-relative resolver as referenced project trees.
- const directoryIgnore = syncWorkspace && !gitSnapshot
+ const directoryIgnore = syncWorkspace && !gitSnapshot && input.workspaceFileMode !== "all"
? await resolveReferencedSourceIgnore(input.workspaceLocalDir)
: null;
if (directoryIgnore?.kind === "failed") {
@@ -1203,14 +1205,14 @@ export async function prepareSandboxManagedRuntime(input: {
}
const gitIgnoredExcludes = directoryIgnore?.kind === "git" ? directoryIgnore.ignoredPaths : undefined;
const workspaceArchiveExclude = mergeExcludes(
- SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,
- [...GIT_ARCHIVE_EXCLUDES],
+ input.workspaceFileMode === "all" ? [] : SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,
+ input.workspaceFileMode === "all" ? [] : [...GIT_ARCHIVE_EXCLUDES],
input.workspaceExclude,
gitIgnoredExcludes,
);
const restoreExclude = mergeExcludes(
- SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,
- [...GIT_ARCHIVE_EXCLUDES],
+ input.workspaceFileMode === "all" ? [] : SANDBOX_WORKSPACE_HEAVY_DIR_EXCLUDES,
+ input.workspaceFileMode === "all" ? [] : [...GIT_ARCHIVE_EXCLUDES],
[".paperclip-runtime"],
input.preserveAbsentOnRestore,
input.workspaceExclude,
diff --git a/packages/adapter-utils/src/ssh-fixture.test.ts b/packages/adapter-utils/src/ssh-fixture.test.ts
index c9c7657f564..83c4ad7e6d5 100644
--- a/packages/adapter-utils/src/ssh-fixture.test.ts
+++ b/packages/adapter-utils/src/ssh-fixture.test.ts
@@ -712,6 +712,28 @@ describe("ssh env-lab fixture", () => {
expect(result.stdout).toContain("{\"token\":\"secret\"}");
}, SSH_FIXTURE_TEST_TIMEOUT_MS);
+ it("clears stale files when plain SSH preparation is retried", async () => {
+ const rootDir = await createFixtureRootDir();
+ const localDir = path.join(rootDir, "plain-local");
+ await mkdir(path.join(localDir, "node_modules"), { recursive: true });
+ await git(localDir, ["init"]);
+ await writeFile(path.join(localDir, ".gitignore"), "node_modules/\n");
+ await writeFile(path.join(localDir, "removed.txt"), "remove on retry");
+ const binary = Buffer.from([0, 255, 1]);
+ await writeFile(path.join(localDir, "node_modules", "personal.bin"), binary);
+ const started = await startSshEnvLabFixtureOrSkip(path.join(rootDir, "state.json"), "SSH plain retry");
+ if (!started) return;
+ const config = await buildSshEnvLabFixtureConfig(started);
+ const input = { spec: { ...config, remoteCwd: started.workspaceDir }, localDir,
+ remoteDir: started.workspaceDir, workspaceFileMode: "all" as const };
+ expect(await prepareWorkspaceForSshExecution(input)).toEqual({ gitBacked: false });
+ expect(await readFile(path.join(started.workspaceDir, "node_modules", "personal.bin"))).toEqual(binary);
+ await rm(path.join(localDir, "removed.txt"));
+ await prepareWorkspaceForSshExecution(input);
+ await expect(stat(path.join(started.workspaceDir, "removed.txt"))).rejects.toMatchObject({ code: "ENOENT" });
+ expect(await readFile(path.join(started.workspaceDir, "node_modules", "personal.bin"))).toEqual(binary);
+ }, SSH_FIXTURE_TEST_TIMEOUT_MS);
+
it("round-trips a git workspace through the SSH fixture", async () => {
const rootDir = await createFixtureRootDir();
const statePath = path.join(rootDir, "state.json");
diff --git a/packages/adapter-utils/src/ssh.ts b/packages/adapter-utils/src/ssh.ts
index 084bb0803d1..89fd456c5d4 100644
--- a/packages/adapter-utils/src/ssh.ts
+++ b/packages/adapter-utils/src/ssh.ts
@@ -1558,9 +1558,11 @@ export async function prepareWorkspaceForSshExecution(input: {
localDir: string;
remoteDir?: string;
onProgress?: RuntimeProgressSink;
+ workspaceFileMode?: "all";
+ workspaceExclude?: string[];
}): Promise<{ gitBacked: boolean }> {
const remoteDir = input.remoteDir ?? input.spec.remoteCwd;
- const gitSnapshot = await readLocalGitWorkspaceSnapshot(input.localDir);
+ const gitSnapshot = input.workspaceFileMode === "all" ? null : await readLocalGitWorkspaceSnapshot(input.localDir);
if (gitSnapshot) {
await importGitWorkspaceToSsh({
@@ -1595,7 +1597,7 @@ export async function prepareWorkspaceForSshExecution(input: {
spec: input.spec,
localDir: input.localDir,
remoteDir,
- exclude: [".paperclip-runtime"],
+ exclude: [".paperclip-runtime", ...(input.workspaceFileMode === "all" ? input.workspaceExclude ?? [] : [])],
onProgress: input.onProgress,
progressLabel: "workspace",
});
diff --git a/packages/adapter-utils/src/workspace-restore-merge.test.ts b/packages/adapter-utils/src/workspace-restore-merge.test.ts
index 7833997dd44..914d99ac751 100644
--- a/packages/adapter-utils/src/workspace-restore-merge.test.ts
+++ b/packages/adapter-utils/src/workspace-restore-merge.test.ts
@@ -605,3 +605,56 @@ describe("workspace restore merge", () => {
});
});
});
+
+describe("conflict-preserving directory restore", () => {
+ it("preflights competing edits before applying any other change and deduplicates replay", async () => {
+ const root = await fsPromises.realpath(await mkdtemp(path.join(os.tmpdir(), "directory-cas-")));
+ const source = path.join(root, "source"), target = path.join(root, "target");
+ try {
+ await mkdir(target);
+ await writeFile(path.join(target, "conflict"), "baseline");
+ const baseline = await captureDirectorySnapshot(target);
+ await fsPromises.cp(target, source, { recursive: true });
+ await writeFile(path.join(source, "conflict"), "incoming");
+ await writeFile(path.join(source, "independent"), "also incoming");
+ await writeFile(path.join(target, "conflict"), "board");
+ await expect(mergeDirectoryWithBaseline({ baseline, sourceDir: source, targetDir: target, conflictPolicy: "reject" })).rejects.toMatchObject({ code: "DIRECTORY_MERGE_CONFLICT", paths: ["conflict"] });
+ await expect(stat(path.join(target, "independent"))).rejects.toMatchObject({ code: "ENOENT" });
+ await writeFile(path.join(target, "conflict"), "baseline");
+ await expect(mergeDirectoryWithBaseline({ baseline, sourceDir: source, targetDir: target, conflictPolicy: "reject", afterApply: async () => { throw new Error("receipt interrupted"); } })).rejects.toThrow("receipt interrupted");
+ await mergeDirectoryWithBaseline({ baseline, sourceDir: source, targetDir: target, conflictPolicy: "reject" });
+ expect(await readFile(path.join(target, "independent"), "utf8")).toBe("also incoming");
+ } finally { await rm(root, { recursive: true, force: true }); }
+ });
+
+ it("preserves a newly added child when another run removes or replaces its parent", async () => {
+ const root = await fsPromises.realpath(await mkdtemp(path.join(os.tmpdir(), "directory-delete-cas-")));
+ const source = path.join(root, "source"), target = path.join(root, "target");
+ try {
+ await mkdir(path.join(target, "folder"), { recursive: true });
+ const baseline = await captureDirectorySnapshot(target);
+ await mkdir(source);
+ await writeFile(path.join(target, "folder", "new"), "concurrent");
+ await expect(mergeDirectoryWithBaseline({ baseline, sourceDir: source, targetDir: target, conflictPolicy: "reject" })).rejects.toMatchObject({ paths: ["folder/new"] });
+ expect(await readFile(path.join(target, "folder", "new"), "utf8")).toBe("concurrent");
+ } finally { await rm(root, { recursive: true, force: true }); }
+ });
+});
+
+
+it("strict preflight preserves excluded descendants when a directory becomes a file", async () => {
+ const root = await fsPromises.realpath(await mkdtemp(path.join(os.tmpdir(), "directory-excluded-cas-")));
+ const target = path.join(root, "target"), source = path.join(root, "source");
+ await mkdir(path.join(target, "folder", "node_modules"), { recursive: true });
+ await writeFile(path.join(target, "folder", "node_modules", "keep"), "excluded contents");
+ const baseline = await captureDirectorySnapshot(target, { exclude: ["*/node_modules"], diskBacked: true });
+ try {
+ await mkdir(source);
+ await writeFile(path.join(source, "folder"), "replacement");
+ await writeFile(path.join(source, "independent"), "must not partially apply");
+ await expect(mergeDirectoryWithBaseline({ baseline, sourceDir: source, targetDir: target, conflictPolicy: "reject" }))
+ .rejects.toMatchObject({ code: "DIRECTORY_MERGE_CONFLICT", paths: expect.arrayContaining(["folder/node_modules/keep"]) });
+ expect(await readFile(path.join(target, "folder", "node_modules", "keep"), "utf8")).toBe("excluded contents");
+ await expect(stat(path.join(target, "independent"))).rejects.toMatchObject({ code: "ENOENT" });
+ } finally { await disposeDirectorySnapshot(baseline); await rm(root, { recursive: true, force: true }); }
+});
diff --git a/packages/adapter-utils/src/workspace-restore-merge.ts b/packages/adapter-utils/src/workspace-restore-merge.ts
index 88e89e8f920..fafba8dabd4 100644
--- a/packages/adapter-utils/src/workspace-restore-merge.ts
+++ b/packages/adapter-utils/src/workspace-restore-merge.ts
@@ -1,4 +1,4 @@
-import { createHash } from "node:crypto";
+import { createHash, randomUUID } from "node:crypto";
import { createReadStream } from "node:fs";
import { constants as fsConstants, promises as fs } from "node:fs";
import path from "node:path";
@@ -442,16 +442,26 @@ async function copySnapshotEntry(sourceDir: string, targetDir: string, relative:
}
await fs.mkdir(path.dirname(targetPath), { recursive: true });
- await fs.rm(targetPath, { recursive: true, force: true }).catch(() => undefined);
if (entry.kind === "symlink") {
+ await fs.rm(targetPath, { recursive: true, force: true });
await fs.symlink(entry.target, targetPath);
return;
}
+ // An interrupted restore must not leave a truncated current file. Keep the
+ // incoming tree until its owner records success; exact retries deduplicate.
+ const temporary = path.join(path.dirname(targetPath), `.paperclip-merge-${randomUUID()}`);
+ try {
+ await fs.copyFile(sourcePath, temporary, fsConstants.COPYFILE_FICLONE).catch(async () => {
+ await fs.copyFile(sourcePath, temporary);
+ });
+ await fs.chmod(temporary, entry.mode);
+ const file = await fs.open(temporary, "r");
+ try { await file.sync(); } finally { await file.close(); }
+ const existing = await fs.lstat(targetPath).catch(() => null);
+ if (existing?.isDirectory()) await fs.rm(targetPath, { recursive: true, force: true });
+ await fs.rename(temporary, targetPath);
+ } finally { await fs.rm(temporary, { force: true }); }
- await fs.copyFile(sourcePath, targetPath, fsConstants.COPYFILE_FICLONE).catch(async () => {
- await fs.copyFile(sourcePath, targetPath);
- });
- await fs.chmod(targetPath, entry.mode);
}
export async function captureDirectorySnapshot(
@@ -511,20 +521,74 @@ function orderedEntries(snapshot: DirectorySnapshot, reverse = false): Iterable<
return [...snapshot.entries].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0) * (reverse ? -1 : 1));
}
+export class DirectoryMergeConflict extends Error {
+ readonly code = "DIRECTORY_MERGE_CONFLICT";
+ constructor(readonly paths: string[]) {
+ super("Directory contents changed concurrently");
+ }
+}
+
+/** Preflight the entire delta before writing. Identical replays are safe after
+ * an interrupted apply; unrelated edits are left alone. No history is retained. */
+export function directoryMergeConflicts(baseline: DirectorySnapshot, source: DirectorySnapshot, current: DirectorySnapshot): string[] {
+ const same = (a: SnapshotEntry | undefined, b: SnapshotEntry | undefined) =>
+ (!a && !b) || entriesMatch(a, b);
+ const conflicts = new Set();
+ function* changedPaths() {
+ for (const [name] of baseline.entries) yield name;
+ for (const [name] of source.entries) if (!baseline.entries.has(name)) yield name;
+ }
+ for (const relative of changedPaths()) {
+ const before = baseline.entries.get(relative);
+ const incoming = source.entries.get(relative);
+ const present = current.entries.get(relative);
+ if (same(before, incoming) || same(incoming, present)) continue;
+ if (!same(before, present)) conflicts.add(relative);
+ // A parent removed/replaced by another writer must never be traversed.
+ for (let parent = path.posix.dirname(relative); parent !== "."; parent = path.posix.dirname(parent)) {
+ if (current.entries.get(parent)?.kind !== "dir" &&
+ !same(current.entries.get(parent), baseline.entries.get(parent))) conflicts.add(parent);
+ }
+ }
+ // Stream each current entry once. A replacement must not remove children
+ // omitted from the baseline, including excluded or newly created files.
+ for (const [child, entry] of current.entries) {
+ if (same(entry, baseline.entries.get(child)) || same(entry, source.entries.get(child))) continue;
+ for (let parent = path.posix.dirname(child); parent !== "."; parent = path.posix.dirname(parent)) {
+ if (baseline.entries.get(parent)?.kind === "dir" && source.entries.get(parent)?.kind !== "dir") {
+ conflicts.add(child);
+ break;
+ }
+ }
+ }
+ return [...conflicts].sort();
+}
+
export async function mergeDirectoryWithBaseline(input: {
baseline: DirectorySnapshot;
sourceDir: string;
targetDir: string;
+ conflictPolicy?: "reject";
beforeApply?: () => Promise;
afterApply?: () => Promise;
+ /** Caller holds the target's writer lock and validated an immutable sparse
+ * source. Unchanged entries need no payload and are never copied. */
+ snapshots?: { source: DirectorySnapshot; current: DirectorySnapshot };
}): Promise {
const options = { exclude: input.baseline.exclude, ignoredPaths: input.baseline.ignoredPaths, diskBacked: true };
- const source = await captureDirectorySnapshot(input.sourceDir, options);
+ const source = input.snapshots?.source ?? await captureDirectorySnapshot(input.sourceDir, options);
try {
await withDirectoryMergeLock(input.targetDir, async (canonicalTargetDir) => {
await input.beforeApply?.();
- const current = await captureDirectorySnapshot(canonicalTargetDir, options);
+ // Strict preflight must see excluded children before a directory is
+ // replaced. The merge still applies only the filtered source/baseline.
+ const current = input.snapshots?.current ?? await captureDirectorySnapshot(canonicalTargetDir,
+ input.conflictPolicy === "reject" ? { exclude: [], diskBacked: true } : options);
try {
+ if (input.conflictPolicy === "reject") {
+ const conflicts = directoryMergeConflicts(input.baseline, source, current);
+ if (conflicts.length) throw new DirectoryMergeConflict(conflicts);
+ }
for (const [relative, baselineEntry] of orderedEntries(input.baseline)) {
if (baselineEntry.kind === "dir" || source.entries.has(relative)) continue;
if (!entriesMatch(current.entries.get(relative), baselineEntry)) continue;
@@ -537,7 +601,8 @@ export async function mergeDirectoryWithBaseline(input: {
});
}
for (const [relative, entry] of orderedEntries(source)) {
- if (!entriesMatch(input.baseline.entries.get(relative), entry)) await copySnapshotEntry(input.sourceDir, canonicalTargetDir, relative, entry);
+ if (!entriesMatch(input.baseline.entries.get(relative), entry) &&
+ !(input.conflictPolicy === "reject" && entriesMatch(current.entries.get(relative), entry))) await copySnapshotEntry(input.sourceDir, canonicalTargetDir, relative, entry);
}
await input.afterApply?.();
} finally { await disposeDirectorySnapshot(current); }
diff --git a/packages/adapters/claude-local/src/server/acp.quota.test.ts b/packages/adapters/claude-local/src/server/acp.quota.test.ts
index 051a41a287c..42fb254407a 100644
--- a/packages/adapters/claude-local/src/server/acp.quota.test.ts
+++ b/packages/adapters/claude-local/src/server/acp.quota.test.ts
@@ -3,9 +3,10 @@ import os from "node:os";
import path from "node:path";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
-import { afterEach, expect, it } from "vitest";
+import { afterEach, expect, it, vi } from "vitest";
import { classifyClaudeTerminalSessionFailure, createClaudeAcpExecutor } from "./acp.js";
import type { AcpxEngineExecutorOptions } from "@paperclipai/adapter-utils/acpx-engine/execute";
+import { parseAcpxStdoutLine } from "@paperclipai/adapter-utils/acpx-engine/ui";
const repoRoot = fileURLToPath(new URL("../../../../..", import.meta.url));
const fixture = path.join(repoRoot, "scripts/mcp-fixtures/servers/acp-echo-agent.mjs");
@@ -16,6 +17,7 @@ const runnerRequire = createRequire(path.join(repoRoot, "packages/paperclip-runn
const runnerAcpx = await import(runnerRequire.resolve("acpx/runtime"));
afterEach(async () => {
+ vi.unstubAllEnvs();
await Promise.all(roots.splice(0).map((root) => fs.rm(root, { recursive: true, force: true })));
});
@@ -24,9 +26,13 @@ async function executeFailure(
category = "limit",
mode = "oneshot",
createRuntime?: AcpxEngineExecutorOptions["createRuntime"],
+ extraEnv: Record = {},
+ details?: string,
) {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-claude-acp-quota-"));
roots.push(root);
+ const failureFile = path.join(root, "failure.json");
+ await fs.writeFile(failureFile, JSON.stringify({ title, category, details }));
const logs: string[] = [];
const execute = createClaudeAcpExecutor({ now: () => now.getTime(), createRuntime });
const result = await execute({
@@ -40,8 +46,8 @@ async function executeFailure(
cwd: repoRoot,
stateDir: path.join(root, "state"),
env: {
- PAPERCLIP_ACPX_TYPED_FAILURE_CANARY: title,
- PAPERCLIP_ACPX_TYPED_FAILURE_CATEGORY: category,
+ ...extraEnv,
+ PAPERCLIP_ACPX_TYPED_FAILURE_FILE: failureFile,
},
},
context: {},
@@ -56,7 +62,7 @@ it.each([
["0.12.0", "persistent"],
["0.13.1", "oneshot"],
["0.13.1", "persistent"],
-])("waits for a typed Claude quota reset with ACPX %s in %s mode without exposing provider text", async (version, mode) => {
+])("waits for a typed Claude quota reset with ACPX %s in %s mode with provider diagnostics", async (version, mode) => {
const title = "You've hit your session limit · resets 4:30pm (America/Chicago)";
const { result, logs } = await executeFailure(
title, "limit", mode, version === "0.13.1" ? runnerAcpx.createAcpRuntime : undefined,
@@ -72,8 +78,49 @@ it.each([
providerQuotaRetryNotBefore: "2026-07-15T21:30:00.000Z",
},
});
- expect(JSON.stringify(result)).not.toContain(title);
- expect(logs).not.toContain(title);
+ expect(result.errorMessage).toContain(title);
+ expect(result.resultJson?.terminalSessionFailure).toMatchObject({ title });
+ expect(result.summary).not.toContain(title);
+ expect(logs).toContain(title);
+});
+
+it.each([
+ ["0.12.0", "oneshot"],
+ ["0.12.0", "persistent"],
+ ["0.13.1", "oneshot"],
+ ["0.13.1", "persistent"],
+])("retains redacted service diagnostics beyond 4 KiB with ACPX %s in %s mode", async (version, mode) => {
+ const secret = "opaque-provider-credential-canary";
+ const inheritedSecret = "opaque-inherited-proxy-canary";
+ // HTTP_PROXY is inherited by the real ACP launch but has no secret-name hint.
+ vi.stubEnv("HTTP_PROXY", inheritedSecret);
+ const title = "HTTP 529: overloaded_error";
+ const details = `${"provider context\n".repeat(300)}request_id=req_service_123\nCredential echoed: ${secret}\nInherited credential: ${inheritedSecret}\n at prompt (agent.js:42:7)`;
+ const { result, logs } = await executeFailure(
+ title, "service", mode, version === "0.13.1" ? runnerAcpx.createAcpRuntime : undefined,
+ { PROVIDER_SETTING: secret }, details,
+ );
+ expect(result).toMatchObject({
+ exitCode: 1,
+ errorCode: "acpx_turn_failed",
+ resultJson: {
+ terminalSessionFailure: {
+ category: "service",
+ title,
+ details: details.replace(secret, "***REDACTED***").replace(inheritedSecret, "***REDACTED***"),
+ },
+ },
+ });
+ expect(result.errorMessage).toContain("request_id=req_service_123");
+ expect(result.errorMessage).toContain("at prompt (agent.js:42:7)");
+ expect(result.summary).not.toContain(title);
+ expect(JSON.stringify(result)).not.toContain(secret);
+ expect(logs).not.toContain(secret);
+ expect(JSON.stringify(result)).not.toContain(inheritedSecret);
+ expect(logs).not.toContain(inheritedSecret);
+ const transcript = logs.split("\n").flatMap((line) => parseAcpxStdoutLine(line, "2026-07-15T20:00:00Z"));
+ expect(transcript).toContainEqual(expect.objectContaining({ kind: "stderr", text: result.errorMessage }));
+ expect(transcript.some((entry) => entry.kind === "assistant")).toBe(false);
});
it("classifies quota without a reset time for the existing recovery backoff", async () => {
@@ -95,14 +142,16 @@ it.each([
);
expect(result).toMatchObject({
exitCode: 1,
- errorMessage: "ACP agent reported a terminal limit failure.",
+ errorMessage: `ACP agent reported a terminal limit failure.\n${title}`,
errorCode: "provider_quota",
errorFamily: "provider_quota",
resultJson: { errorFamily: "provider_quota" },
});
expect(result.retryNotBefore).toBeUndefined();
- expect(JSON.stringify(result)).not.toContain(title);
- expect(logs).not.toContain(title);
+ expect(result.errorMessage).toContain(title);
+ expect(result.resultJson?.terminalSessionFailure).toMatchObject({ category: "limit", title });
+ expect(result.summary).not.toContain(title);
+ expect(logs).toContain(title);
});
it.each([
@@ -119,8 +168,10 @@ it.each([
expect(result).toMatchObject({ exitCode: 1, errorCode: "acpx_turn_failed" });
expect(result.errorFamily).not.toBe("provider_quota");
expect(result.retryNotBefore).toBeUndefined();
- expect(JSON.stringify(result)).not.toContain(title);
- expect(logs).not.toContain(title);
+ expect(result.errorMessage).toContain(title);
+ expect(result.resultJson?.terminalSessionFailure).toMatchObject({ category, title });
+ expect(result.summary).not.toContain(title);
+ expect(logs).toContain(title);
});
it("does not infer quota from the historical generic terminal-limit error", () => {
diff --git a/packages/adapters/codex-local/src/server/codex-home.test.ts b/packages/adapters/codex-local/src/server/codex-home.test.ts
index 13cb166c18e..1e181363eda 100644
--- a/packages/adapters/codex-local/src/server/codex-home.test.ts
+++ b/packages/adapters/codex-local/src/server/codex-home.test.ts
@@ -1290,23 +1290,22 @@ describe("stageCodexHomeForSync", () => {
}
});
- // Mode normalization: nested skill files must be staged 0600 regardless of
- // their source mode (0644 documents, 0755 scripts, etc.).
- it("writes nested skill files with mode 0600 regardless of source mode", async () => {
+ // Skill staging retains executable permission with owner-only access.
+ it("retains skill executable bits without group or world permissions", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-codex-stage-skill-mode-"));
let staged: string | null = null;
try {
const home = path.join(root, "codex-home");
await fs.mkdir(path.join(home, "skills", "my-skill"), { recursive: true });
// Typical source modes: readable doc (0644) and executable script (0755);
- // both must land 0600 in the staged dir.
+ // documents land 0600, scripts 0700 in the staged dir.
await fs.writeFile(path.join(home, "skills", "my-skill", "SKILL.md"), "# skill\n", { mode: 0o644 });
await fs.writeFile(path.join(home, "skills", "my-skill", "run.sh"), "#!/bin/sh\n", { mode: 0o755 });
staged = await stageCodexHomeForSync(home, { runId: "run-skill-mode" });
for (const rel of ["my-skill/SKILL.md", "my-skill/run.sh"]) {
const mode = (await fs.stat(path.join(staged, "skills", rel))).mode & 0o777;
- expect(mode, `skills/${rel} should be staged 0600`).toBe(0o600);
+ expect(mode, `skills/${rel} mode`).toBe(rel.endsWith(".sh") ? 0o700 : 0o600);
}
} finally {
if (staged) await fs.rm(staged, { recursive: true, force: true });
diff --git a/packages/adapters/codex-local/src/server/codex-home.ts b/packages/adapters/codex-local/src/server/codex-home.ts
index f6b5f968da0..73ca446738b 100644
--- a/packages/adapters/codex-local/src/server/codex-home.ts
+++ b/packages/adapters/codex-local/src/server/codex-home.ts
@@ -383,7 +383,8 @@ function isResolvedPathInside(candidate: string, root: string): boolean {
* Recursively copies one skill subtree — rooted at its real directory
* `containmentRoot` — into `targetDir`, dereferencing symlinks to bytes (so the
* sandbox receives real file content, not host-relative links) and normalizing
- * every copied regular file to mode `0600`. Created directories get mode `0700`.
+ * regular files to owner-only access (`0700` for executables, `0600` otherwise).
+ * Created directories get mode `0700`.
*
* Two containment guards protect the staged upload:
*
@@ -438,8 +439,9 @@ async function stageContainedSubtree(
activePath.delete(resolved);
} else if (entryStat.isFile()) {
const bytes = await fs.readFile(resolved);
- await fs.writeFile(entryTarget, bytes, { mode: 0o600 });
- await fs.chmod(entryTarget, 0o600);
+ const mode = entryStat.mode & 0o111 ? 0o700 : 0o600;
+ await fs.writeFile(entryTarget, bytes, { mode });
+ await fs.chmod(entryTarget, mode);
}
// Other types (sockets, devices) are silently skipped.
}
@@ -448,11 +450,12 @@ async function stageContainedSubtree(
/**
* Recursively copies `sourceDir` (a directory allowlist entry — currently only
* `skills/`) into `targetDir`, dereferencing symlinks to bytes and normalizing
- * every copied regular file to mode `0600`. Created directories get mode `0700`.
+ * regular files to owner-only access (`0700` for executables, `0600` otherwise).
+ * Created directories get mode `0700`.
*
* This replaces `fs.cp({ dereference: true })` which preserves source file modes,
* leaving `0644` documents and `0755` scripts group/other-readable in the staged
- * asset; here all regular files are normalized to `0600` regardless of source mode.
+ * asset; here skill files retain only their executable flag, with owner-only access.
*
* `sourceDir`'s *direct* children are the Paperclip-injected skill symlinks that
* intentionally point into a shared skill store *outside* `CODEX_HOME/skills/`,
@@ -463,7 +466,7 @@ async function stageContainedSubtree(
* cycles (finding 1). A direct child that resolves to `sourceDir` itself or to
* an ancestor of it (a degenerate `-> .` / `-> ..` link at the top level) is
* skipped rather than used as a root, so it can never drag the wider home into
- * the staged skills asset. The `0700` staged directory and per-file `0600` mode
+ * the staged skills asset. The `0700` staged directory and per-file owner-only mode
* together ensure even externally-sourced skill content is not group/world-readable.
*/
async function stageDirectorySecure(
@@ -498,8 +501,9 @@ async function stageDirectorySecure(
await stageContainedSubtree(resolved, entryTarget, resolved, new Set([resolved]));
} else if (entryStat.isFile()) {
const bytes = await fs.readFile(resolved);
- await fs.writeFile(entryTarget, bytes, { mode: 0o600 });
- await fs.chmod(entryTarget, 0o600);
+ const mode = entryStat.mode & 0o111 ? 0o700 : 0o600;
+ await fs.writeFile(entryTarget, bytes, { mode });
+ await fs.chmod(entryTarget, mode);
}
// Other types (sockets, devices) are silently skipped.
}
diff --git a/packages/adapters/cursor-local/src/server/execute.test.ts b/packages/adapters/cursor-local/src/server/execute.test.ts
index f8d555169aa..913d34cdc40 100644
--- a/packages/adapters/cursor-local/src/server/execute.test.ts
+++ b/packages/adapters/cursor-local/src/server/execute.test.ts
@@ -138,6 +138,43 @@ function createFreshLeaseSandboxRunner(options: {
}
describe("cursor execute", () => {
+ it.each([
+ { detail: "Authentication failed", structured: "", expected: "Authentication failed" },
+ { detail: "", structured: "", expected: "Cursor exited with code 7" },
+ { detail: "stderr fallback", structured: '{"type":"error","message":"Structured failure"}', expected: "Structured failure" },
+ ])("keeps the actual failure after a retrieval trace announcement: $expected", async ({ detail, structured, expected }) => {
+ setPrepareCursorSandboxCommand.mockReset();
+ setPrepareCursorSandboxCommand.mockImplementation(async (input) => ({
+ command: input.command, env: input.env, remoteSystemHomeDir: null,
+ addedPathEntry: null, preferredCommandPath: null,
+ }));
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-cursor-diagnostic-"));
+ const command = path.join(root, "agent.sh");
+ const trace = "cursor-retrieval: tracing to '/tmp/fixture-cursor-retrieval.log'";
+ // Values are fixed test fixtures, passed through env rather than shell code.
+ await fs.writeFile(command, `#!/bin/sh
+cat >/dev/null
+printf '%s\\n' "$FIXTURE_TRACE" "$FIXTURE_DETAIL" >&2
+printf '%s\\n' "$FIXTURE_STRUCTURED"
+exit 7
+`, { mode: 0o755 });
+ try {
+ const result = await execute({
+ runId: "run-diagnostic-1",
+ agent: { id: "agent-1", companyId: "company-1", name: "Cursor", adapterType: "cursor", adapterConfig: {} },
+ runtime: { sessionId: null, sessionParams: null, sessionDisplayId: null, taskKey: null },
+ config: { command, cwd: root, env: { FIXTURE_TRACE: trace, FIXTURE_DETAIL: detail, FIXTURE_STRUCTURED: structured } },
+ context: createPromptContextFixture(), authToken: "fixture-run-token", onLog: async () => {},
+ });
+ expect(result.exitCode).toBe(7);
+ expect(result.errorMessage).toBe(expected);
+ expect(result.resultJson?.stderr).toContain(trace);
+ expect(result.resultJson?.stderr).toContain(detail);
+ } finally {
+ await fs.rm(root, { recursive: true, force: true });
+ }
+ });
+
it("installs the default agent command on a fresh sandbox lease before execution", async () => {
setPrepareCursorSandboxCommand.mockReset();
setPrepareCursorSandboxCommand.mockImplementation(async (input) => {
diff --git a/packages/adapters/cursor-local/src/server/execute.ts b/packages/adapters/cursor-local/src/server/execute.ts
index f11ca77a3a5..60831453723 100644
--- a/packages/adapters/cursor-local/src/server/execute.ts
+++ b/packages/adapters/cursor-local/src/server/execute.ts
@@ -52,7 +52,7 @@ import {
joinPromptSections,
} from "@paperclipai/adapter-utils/server-utils";
import { DEFAULT_CURSOR_LOCAL_MODEL, SANDBOX_INSTALL_COMMAND } from "../index.js";
-import { parseCursorJsonl, isCursorUnknownSessionError } from "./parse.js";
+import { firstCursorDiagnosticLine, parseCursorJsonl, isCursorUnknownSessionError } from "./parse.js";
import { prepareCursorSandboxCommand } from "./remote-command.js";
import { normalizeCursorStreamLine } from "../shared/stream.js";
import { hasCursorTrustBypassArg } from "../shared/trust.js";
@@ -60,15 +60,6 @@ import { resolveCursorSkillsHome } from "./skills.js";
const __moduleDir = path.dirname(fileURLToPath(import.meta.url));
-function firstNonEmptyLine(text: string): string {
- return (
- text
- .split(/\r?\n/)
- .map((line) => line.trim())
- .find(Boolean) ?? ""
- );
-}
-
function hasNonEmptyEnvValue(env: Record, key: string): boolean {
const raw = env[key];
return typeof raw === "string" && raw.trim().length > 0;
@@ -726,7 +717,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise)
: null;
const parsedError = typeof attempt.parsed.errorMessage === "string" ? attempt.parsed.errorMessage.trim() : "";
- const stderrLine = firstNonEmptyLine(attempt.proc.stderr);
+ const stderrLine = firstCursorDiagnosticLine(attempt.proc.stderr);
const fallbackErrorMessage =
parsedError ||
stderrLine ||
diff --git a/packages/adapters/cursor-local/src/server/parse.test.ts b/packages/adapters/cursor-local/src/server/parse.test.ts
new file mode 100644
index 00000000000..07906260792
--- /dev/null
+++ b/packages/adapters/cursor-local/src/server/parse.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import { firstCursorDiagnosticLine } from "./parse.js";
+
+describe("Cursor diagnostic selection", () => {
+ it("skips trace announcements with CRLF, whitespace and ANSI color", () => {
+ expect(firstCursorDiagnosticLine("\r\n\x1b[90m cursor-retrieval: tracing to '/tmp/fixture.log' \x1b[0m\r\ncursor-retrieval: tracing to \"/tmp/second.log\"\r\nAuthentication failed\r\nmore detail"))
+ .toBe("Authentication failed");
+ });
+
+ it("keeps retrieval failures and unknown diagnostic formats", () => {
+ for (const line of [
+ "cursor-retrieval: failed to open trace file",
+ "cursor-retrieval: tracing to '/tmp/fixture.log' failed: permission denied",
+ "unknown warning: preserve this diagnostic",
+ ]) expect(firstCursorDiagnosticLine(line)).toBe(line);
+ });
+
+ it("leaves no diagnostic when only a trace location was printed", () => {
+ expect(firstCursorDiagnosticLine("cursor-retrieval: tracing to '/tmp/fixture.log'\n")).toBe("");
+ expect(firstCursorDiagnosticLine("\n\r\n")).toBe("");
+ });
+});
diff --git a/packages/adapters/cursor-local/src/server/parse.ts b/packages/adapters/cursor-local/src/server/parse.ts
index 8644e106a4e..053e5f2a800 100644
--- a/packages/adapters/cursor-local/src/server/parse.ts
+++ b/packages/adapters/cursor-local/src/server/parse.ts
@@ -1,6 +1,17 @@
+import { stripVTControlCharacters } from "node:util";
import { asString, asNumber, parseObject, parseJson } from "@paperclipai/adapter-utils/server-utils";
import { normalizeCursorStreamLine } from "../shared/stream.js";
+/** Select diagnostics without mistaking Cursor's trace-file notice for an error. */
+export function firstCursorDiagnosticLine(text: string): string {
+ for (const raw of text.split(/\r?\n/)) {
+ const line = stripVTControlCharacters(raw).trim();
+ if (!line || /^cursor-retrieval: tracing to (?:'[^']*'|"[^"]*")$/.test(line)) continue;
+ return line;
+ }
+ return "";
+}
+
function asErrorText(value: unknown): string {
if (typeof value === "string") return value;
const rec = parseObject(value);
diff --git a/packages/adapters/cursor-local/src/server/test.test.ts b/packages/adapters/cursor-local/src/server/test.test.ts
index 72b3f9ede0d..46d241e5a1d 100644
--- a/packages/adapters/cursor-local/src/server/test.test.ts
+++ b/packages/adapters/cursor-local/src/server/test.test.ts
@@ -70,6 +70,30 @@ function createSandboxRunner(options: { homeDir: string; installCommandPath: str
}
describe("cursor testEnvironment", () => {
+ it("shows the probe failure after an informational retrieval trace notice", async () => {
+ const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-cursor-probe-diagnostic-"));
+ const command = path.join(root, "agent");
+ await fs.writeFile(command, `#!/bin/sh
+if [ "$1" = "--version" ]; then
+ printf '%s\\n' 'Cursor Agent 1.2.3'
+ exit 0
+fi
+printf '%s\\n' "cursor-retrieval: tracing to '/tmp/fixture.log'" 'Provider connection failed' >&2
+exit 7
+`, { mode: 0o755 });
+ try {
+ const result = await testEnvironment({
+ companyId: "company-1", adapterType: "cursor",
+ config: { command: "agent", cwd: root, env: { PATH: `${root}${path.delimiter}${process.env.PATH ?? ""}`, CURSOR_API_KEY: "fixture-cursor-key" } },
+ });
+ expect(result.checks).toEqual(expect.arrayContaining([
+ expect.objectContaining({ code: "cursor_hello_probe_failed", detail: "Provider connection failed" }),
+ ]));
+ } finally {
+ await fs.rm(root, { recursive: true, force: true });
+ }
+ });
+
it("re-resolves the installed agent under ~/.cursor/bin and verifies --version before the hello probe", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-cursor-envtest-"));
const homeDir = path.join(root, "home");
diff --git a/packages/adapters/cursor-local/src/server/test.ts b/packages/adapters/cursor-local/src/server/test.ts
index 8059d897683..762177e7d1e 100644
--- a/packages/adapters/cursor-local/src/server/test.ts
+++ b/packages/adapters/cursor-local/src/server/test.ts
@@ -22,7 +22,7 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { DEFAULT_CURSOR_LOCAL_MODEL, SANDBOX_INSTALL_COMMAND } from "../index.js";
-import { parseCursorJsonl } from "./parse.js";
+import { firstCursorDiagnosticLine, parseCursorJsonl } from "./parse.js";
import { isDefaultCursorCommand, prepareCursorSandboxCommand } from "./remote-command.js";
import { hasCursorTrustBypassArg } from "../shared/trust.js";
@@ -36,17 +36,8 @@ function isNonEmpty(value: unknown): value is string {
return typeof value === "string" && value.trim().length > 0;
}
-function firstNonEmptyLine(text: string): string {
- return (
- text
- .split(/\r?\n/)
- .map((line) => line.trim())
- .find(Boolean) ?? ""
- );
-}
-
function summarizeProbeDetail(stdout: string, stderr: string, parsedError: string | null): string | null {
- const raw = parsedError?.trim() || firstNonEmptyLine(stderr) || firstNonEmptyLine(stdout);
+ const raw = parsedError?.trim() || firstCursorDiagnosticLine(stderr) || firstCursorDiagnosticLine(stdout);
if (!raw) return null;
const clean = raw.replace(/\s+/g, " ").trim();
const max = 240;
diff --git a/packages/db/src/agent-instruction-migration.test.ts b/packages/db/src/agent-instruction-migration.test.ts
new file mode 100644
index 00000000000..6def7b7e884
--- /dev/null
+++ b/packages/db/src/agent-instruction-migration.test.ts
@@ -0,0 +1,141 @@
+import { createHash, randomUUID } from "node:crypto";
+import { readFile } from "node:fs/promises";
+import postgres from "postgres";
+import { describe, expect, it } from "vitest";
+import { applyPendingMigrations, inspectMigrations } from "./client.js";
+import { EMBEDDED_POSTGRES_TEST_TIMEOUT_MS, getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./test-embedded-postgres.js";
+
+// Exact SQL from PR #14325 before master assigned 0285/0286 to API response storage.
+// Exercise real preview tables/receipts, not a second application of the new schema.
+const previewMigrations = [
+ { when: 1790474441205, sql: `CREATE TABLE "agent_instruction_heads" (
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "entry_file" text NOT NULL,
+ "revision_id" uuid NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "agent_instruction_heads_identity_uq" UNIQUE("company_id","agent_id","entry_file")
+);
+--> statement-breakpoint
+CREATE TABLE "agent_instruction_revisions" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "entry_file" text NOT NULL,
+ "content_base64" text NOT NULL,
+ "content_hash" text NOT NULL,
+ "byte_length" integer NOT NULL,
+ "parent_revision_id" uuid,
+ "base_revision_id" uuid,
+ "restored_from_revision_id" uuid,
+ "actor_agent_id" uuid,
+ "actor_user_id" text,
+ "responsible_user_id" text,
+ "source_run_id" uuid,
+ "source" text NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "agent_instruction_revisions_identity_uq" UNIQUE("company_id","agent_id","entry_file","id")
+);
+--> statement-breakpoint
+ALTER TABLE "agent_instruction_heads" ADD CONSTRAINT "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk" FOREIGN KEY ("company_id","agent_id","entry_file","revision_id") REFERENCES "public"."agent_instruction_revisions"("company_id","agent_id","entry_file","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "agent_instruction_revisions" ADD CONSTRAINT "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk" FOREIGN KEY ("company_id","agent_id") REFERENCES "public"."agents"("company_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE INDEX "agent_instruction_revisions_history_idx" ON "agent_instruction_revisions" USING btree ("company_id","agent_id","entry_file","created_at","id");` },
+ { when: 1790543348340, sql: `CREATE TABLE "agent_instruction_working_copies" (
+ "run_id" uuid PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "responsible_user_id" text NOT NULL,
+ "entry_file" text NOT NULL,
+ "base_revision_id" uuid,
+ "base_hash" text NOT NULL,
+ "local_root" text NOT NULL,
+ "execution_root" text NOT NULL,
+ "location" text NOT NULL,
+ "state" text DEFAULT 'prepared' NOT NULL,
+ "candidate_base64" text,
+ "candidate_hash" text,
+ "error_code" text,
+ "error_message" text,
+ "receipt" jsonb,
+ "process_stopped_at" timestamp with time zone,
+ "attempts" integer DEFAULT 0 NOT NULL,
+ "next_attempt_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
+ALTER TABLE "agent_instruction_working_copies" ADD CONSTRAINT "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "agent_instruction_working_copies" ADD CONSTRAINT "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk" FOREIGN KEY ("company_id","agent_id") REFERENCES "public"."agents"("company_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE INDEX "agent_instruction_copies_pending_idx" ON "agent_instruction_working_copies" USING btree ("state","next_attempt_at");--> statement-breakpoint
+CREATE INDEX "agent_instruction_copies_agent_idx" ON "agent_instruction_working_copies" USING btree ("company_id","agent_id","created_at");` },
+];
+const migration = await readFile(new URL("./migrations/0287_serious_tinkerer.sql", import.meta.url), "utf8");
+const migrationHash = createHash("sha256").update(migration).digest("hex");
+
+const support = await getEmbeddedPostgresTestSupport();
+const describePostgres = support.supported ? describe : describe.skip;
+
+describePostgres("instruction revision migrations", () => {
+ it("keeps applied migration receipts, revisions, and pending copies intact on repeated upgrades", async () => {
+ const database = await startEmbeddedPostgresTestDatabase("instruction-migration-upgrade-");
+ const sql = postgres(database.connectionString, { max: 1, onnotice: () => {} });
+ try {
+ await sql`DROP TABLE agent_instruction_heads, agent_instruction_working_copies, agent_instruction_revisions`;
+ await sql`DELETE FROM drizzle.__drizzle_migrations WHERE hash = ${migrationHash}`;
+ for (const preview of previewMigrations) {
+ for (const statement of preview.sql.split("--> statement-breakpoint")) await sql.unsafe(statement);
+ await sql`INSERT INTO drizzle.__drizzle_migrations (hash, created_at)
+ VALUES (${createHash("sha256").update(preview.sql).digest("hex")}, ${preview.when})`;
+ }
+ const companyId = randomUUID(), otherCompanyId = randomUUID(), agentId = randomUUID();
+ const runId = randomUUID(), revisionId = randomUUID();
+ const bytes = Buffer.from("\uFEFF# Saved\r\nExact bytes ☃\n");
+ const contentBase64 = bytes.toString("base64");
+ const contentHash = createHash("sha256").update(bytes).digest("hex");
+ await sql`INSERT INTO companies (id, name, issue_prefix) VALUES
+ (${companyId}, 'Instructions', 'INS'), (${otherCompanyId}, 'Other', 'OTH')`;
+ await sql`INSERT INTO agents (id, company_id, name) VALUES (${agentId}, ${companyId}, 'Writer')`;
+ await sql`INSERT INTO heartbeat_runs (id, company_id, agent_id) VALUES (${runId}, ${companyId}, ${agentId})`;
+ await sql`INSERT INTO agent_instruction_revisions
+ (id, company_id, agent_id, entry_file, content_base64, content_hash, byte_length, source, source_run_id)
+ VALUES (${revisionId}, ${companyId}, ${agentId}, 'AGENTS.md', ${contentBase64}, ${contentHash}, ${bytes.length}, 'cleanup', ${runId})`;
+ await sql`INSERT INTO agent_instruction_heads (company_id, agent_id, entry_file, revision_id)
+ VALUES (${companyId}, ${agentId}, 'AGENTS.md', ${revisionId})`;
+ await sql`INSERT INTO agent_instruction_working_copies
+ (run_id, company_id, agent_id, responsible_user_id, entry_file, base_revision_id, base_hash, local_root, execution_root, location, state, candidate_base64, candidate_hash)
+ VALUES (${runId}, ${companyId}, ${agentId}, 'editor', 'AGENTS.md', ${revisionId}, ${contentHash}, '/private/copy', '/private/copy', 'local', 'pending_commit', ${contentBase64}, ${contentHash})`;
+ const snapshot = async () => ({
+ journal: await sql`SELECT * FROM drizzle.__drizzle_migrations ORDER BY id`,
+ relations: await sql`SELECT oid::text, relname FROM pg_class WHERE relname IN
+ ('agent_instruction_revisions', 'agent_instruction_heads', 'agent_instruction_working_copies') ORDER BY relname`,
+ constraints: await sql`SELECT oid::text, conname, pg_get_constraintdef(oid) AS definition FROM pg_constraint
+ WHERE conrelid IN ('agent_instruction_revisions'::regclass, 'agent_instruction_heads'::regclass,
+ 'agent_instruction_working_copies'::regclass) ORDER BY conname`,
+ revisions: await sql`SELECT * FROM agent_instruction_revisions`,
+ heads: await sql`SELECT * FROM agent_instruction_heads`,
+ copies: await sql`SELECT * FROM agent_instruction_working_copies`,
+ });
+ const before = await snapshot();
+ expect(before.relations).toHaveLength(3);
+ expect(await inspectMigrations(database.connectionString)).toMatchObject({
+ status: "needsMigrations", pendingMigrations: ["0287_serious_tinkerer.sql"],
+ });
+ await applyPendingMigrations(database.connectionString);
+ const upgraded = await snapshot();
+ expect(upgraded).toEqual({ ...before, journal: expect.arrayContaining(before.journal) });
+ expect(upgraded.journal).toHaveLength(before.journal.length + 1);
+ for (let attempt = 0; attempt < 2; attempt += 1) {
+ expect(await inspectMigrations(database.connectionString)).toMatchObject({ status: "upToDate" });
+ await applyPendingMigrations(database.connectionString);
+ expect(await snapshot()).toEqual(upgraded);
+ }
+ await expect(sql`UPDATE agent_instruction_heads SET company_id = ${otherCompanyId} WHERE revision_id = ${revisionId}`)
+ .rejects.toMatchObject({ code: "23503" });
+ await expect(sql`UPDATE agent_instruction_working_copies SET company_id = ${otherCompanyId} WHERE run_id = ${runId}`)
+ .rejects.toMatchObject({ code: "23503" });
+ } finally {
+ await sql.end();
+ await database.cleanup();
+ }
+ }, EMBEDDED_POSTGRES_TEST_TIMEOUT_MS);
+});
diff --git a/packages/db/src/connections-v3-schema-core-migration.test.ts b/packages/db/src/connections-v3-schema-core-migration.test.ts
index cea6751a579..a1ee50090cf 100644
--- a/packages/db/src/connections-v3-schema-core-migration.test.ts
+++ b/packages/db/src/connections-v3-schema-core-migration.test.ts
@@ -42,6 +42,11 @@ describeEmbeddedPostgres("connections v3 schema core migration", () => {
await sql`DROP TABLE IF EXISTS "ai_connection_defaults"`;
await sql`DROP TABLE IF EXISTS "connection_grant_delegations"`;
await sql`DROP TABLE IF EXISTS "connection_grant_members"`;
+ // Browser Use is a later grant consumer; rewind its empty fixture tables too.
+ await sql`DROP TABLE IF EXISTS "browser_use_browsers"`;
+ await sql`DROP TABLE IF EXISTS "browser_use_runs"`;
+ await sql`DROP TABLE IF EXISTS "browser_use_sessions"`;
+ await sql`DROP TABLE IF EXISTS "browser_use_settings"`;
await sql`DROP TABLE IF EXISTS "connection_grants"`;
await sql`DROP INDEX IF EXISTS "tool_connections_company_uid_uq"`;
await sql`ALTER TABLE "tool_connections" DROP CONSTRAINT IF EXISTS "tool_connections_company_id_uq"`;
diff --git a/packages/db/src/migrations/0287_serious_tinkerer.sql b/packages/db/src/migrations/0287_serious_tinkerer.sql
new file mode 100644
index 00000000000..2810534d4c1
--- /dev/null
+++ b/packages/db/src/migrations/0287_serious_tinkerer.sql
@@ -0,0 +1,61 @@
+-- Retain preview instruction rows and pending captures when upgrading PR #14325.
+CREATE TABLE IF NOT EXISTS "agent_instruction_heads" (
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "entry_file" text NOT NULL,
+ "revision_id" uuid NOT NULL,
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "agent_instruction_heads_identity_uq" UNIQUE("company_id","agent_id","entry_file")
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "agent_instruction_revisions" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "entry_file" text NOT NULL,
+ "content_base64" text NOT NULL,
+ "content_hash" text NOT NULL,
+ "byte_length" integer NOT NULL,
+ "parent_revision_id" uuid,
+ "base_revision_id" uuid,
+ "restored_from_revision_id" uuid,
+ "actor_agent_id" uuid,
+ "actor_user_id" text,
+ "responsible_user_id" text,
+ "source_run_id" uuid,
+ "source" text NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "agent_instruction_revisions_identity_uq" UNIQUE("company_id","agent_id","entry_file","id")
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "agent_instruction_working_copies" (
+ "run_id" uuid PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "responsible_user_id" text NOT NULL,
+ "entry_file" text NOT NULL,
+ "base_revision_id" uuid,
+ "base_hash" text NOT NULL,
+ "local_root" text NOT NULL,
+ "execution_root" text NOT NULL,
+ "location" text NOT NULL,
+ "state" text DEFAULT 'prepared' NOT NULL,
+ "candidate_base64" text,
+ "candidate_hash" text,
+ "error_code" text,
+ "error_message" text,
+ "receipt" jsonb,
+ "process_stopped_at" timestamp with time zone,
+ "attempts" integer DEFAULT 0 NOT NULL,
+ "next_attempt_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
+DO $$ BEGIN ALTER TABLE "agent_instruction_heads" ADD CONSTRAINT "agent_instruction_heads_company_id_agent_id_entry_file_revision_id_agent_instruction_revisions_company_id_agent_id_entry_file_id_fk" FOREIGN KEY ("company_id","agent_id","entry_file","revision_id") REFERENCES "public"."agent_instruction_revisions"("company_id","agent_id","entry_file","id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "agent_instruction_revisions" ADD CONSTRAINT "agent_instruction_revisions_company_id_agent_id_agents_company_id_id_fk" FOREIGN KEY ("company_id","agent_id") REFERENCES "public"."agents"("company_id","id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "agent_instruction_working_copies" ADD CONSTRAINT "agent_instruction_working_copies_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "agent_instruction_working_copies" ADD CONSTRAINT "agent_instruction_working_copies_company_id_agent_id_agents_company_id_id_fk" FOREIGN KEY ("company_id","agent_id") REFERENCES "public"."agents"("company_id","id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "agent_instruction_revisions_history_idx" ON "agent_instruction_revisions" USING btree ("company_id","agent_id","entry_file","created_at","id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "agent_instruction_copies_pending_idx" ON "agent_instruction_working_copies" USING btree ("state","next_attempt_at");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "agent_instruction_copies_agent_idx" ON "agent_instruction_working_copies" USING btree ("company_id","agent_id","created_at");
diff --git a/packages/db/src/migrations/0288_glorious_jamie_braddock.sql b/packages/db/src/migrations/0288_glorious_jamie_braddock.sql
new file mode 100644
index 00000000000..300112a9485
--- /dev/null
+++ b/packages/db/src/migrations/0288_glorious_jamie_braddock.sql
@@ -0,0 +1,36 @@
+CREATE TABLE IF NOT EXISTS "chat_completion_deliveries" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "task_id" uuid NOT NULL,
+ "status_version" integer NOT NULL,
+ "status" text DEFAULT 'pending' NOT NULL,
+ "attempts" integer DEFAULT 0 NOT NULL,
+ "next_attempt_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "target_run_id" uuid,
+ "response_comment_id" uuid,
+ "error" text,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "chat_task_handoffs" (
+ "task_id" uuid PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "conversation_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "session_generation" integer NOT NULL,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_completion_deliveries" ADD CONSTRAINT "chat_completion_deliveries_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 "chat_completion_deliveries" ADD CONSTRAINT "chat_completion_deliveries_task_id_chat_task_handoffs_task_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."chat_task_handoffs"("task_id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_completion_deliveries" ADD CONSTRAINT "chat_completion_deliveries_target_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("target_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE set null ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_completion_deliveries" ADD CONSTRAINT "chat_completion_deliveries_response_comment_id_issue_comments_id_fk" FOREIGN KEY ("response_comment_id") REFERENCES "public"."issue_comments"("id") ON DELETE set null ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_task_handoffs" ADD CONSTRAINT "chat_task_handoffs_task_id_issues_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_task_handoffs" ADD CONSTRAINT "chat_task_handoffs_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 "chat_task_handoffs" ADD CONSTRAINT "chat_task_handoffs_conversation_id_issues_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."issues"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+DO $$ BEGIN ALTER TABLE "chat_task_handoffs" ADD CONSTRAINT "chat_task_handoffs_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN NULL; END $$;--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "chat_completion_deliveries_transition_uq" ON "chat_completion_deliveries" USING btree ("task_id","status_version");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "chat_completion_deliveries_pending_idx" ON "chat_completion_deliveries" USING btree ("status","next_attempt_at");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "chat_task_handoffs_source_idx" ON "chat_task_handoffs" USING btree ("company_id","conversation_id");--> statement-breakpoint
+-- paperclip:migration-safety-ignore large-create-index-not-concurrently: Drizzle migrations are transactional, so CONCURRENTLY is unavailable. This new key namespace has no existing matches; the partial unique index is required for atomic completion wake deduplication. The one-time table scan takes a write lock.
+CREATE UNIQUE INDEX IF NOT EXISTS "agent_wakeup_requests_chat_completion_uq" ON "agent_wakeup_requests" USING btree ("company_id","idempotency_key") WHERE "agent_wakeup_requests"."idempotency_key" LIKE 'chat-completion:%';
\ No newline at end of file
diff --git a/packages/db/src/migrations/0289_drop_user_keyboard_shortcuts.sql b/packages/db/src/migrations/0289_drop_user_keyboard_shortcuts.sql
new file mode 100644
index 00000000000..4d2b6e2ab16
--- /dev/null
+++ b/packages/db/src/migrations/0289_drop_user_keyboard_shortcuts.sql
@@ -0,0 +1,5 @@
+-- Drop the per-user keyboard shortcut preference. Keyboard shortcuts are now
+-- always enabled for every signed-in user, so the column lost its last reader
+-- when the Profile settings toggle and the /api/auth/preferences routes were
+-- removed.
+ALTER TABLE "user" DROP COLUMN IF EXISTS "keyboard_shortcuts";
diff --git a/packages/db/src/migrations/0290_browser_use_cloud.sql b/packages/db/src/migrations/0290_browser_use_cloud.sql
new file mode 100644
index 00000000000..86aa8c02601
--- /dev/null
+++ b/packages/db/src/migrations/0290_browser_use_cloud.sql
@@ -0,0 +1,155 @@
+CREATE TABLE IF NOT EXISTS "browser_use_browsers" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "session_id" uuid NOT NULL,
+ "provider_browser_id" uuid NOT NULL,
+ "status" text DEFAULT 'active' NOT NULL,
+ "expires_at" timestamp with time zone,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "browser_use_runs" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "session_id" uuid NOT NULL,
+ "heartbeat_run_id" uuid NOT NULL,
+ "invocation_id" uuid NOT NULL,
+ "provider_run_id" uuid,
+ "status" text DEFAULT 'creating' NOT NULL,
+ "detached_until" timestamp with time zone,
+ "recovery_cursor" text,
+ "event_cursor" integer DEFAULT 0 NOT NULL,
+ "events_drained" integer DEFAULT 0 NOT NULL,
+ "accounted_cents" integer DEFAULT 0 NOT NULL,
+ "progress" text,
+ "result" jsonb,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "browser_use_sessions" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "issue_id" uuid NOT NULL,
+ "agent_id" uuid NOT NULL,
+ "connection_id" uuid NOT NULL,
+ "grant_id" uuid NOT NULL,
+ "provider_session_id" uuid,
+ "status" text DEFAULT 'starting' NOT NULL,
+ "idle_deadline" timestamp with time zone,
+ "stop_requested" text,
+ "error" text,
+ "lease_token" uuid,
+ "lease_until" timestamp with time zone,
+ "next_poll_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "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 "browser_use_settings" (
+ "grant_id" uuid PRIMARY KEY NOT NULL,
+ "company_id" uuid NOT NULL,
+ "allowed_profile_ids" jsonb DEFAULT '[]'::jsonb NOT NULL,
+ "max_cost_usd" text
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_browsers_company_id_companies_id_fk' AND conrelid = 'public.browser_use_browsers'::regclass) THEN
+ ALTER TABLE "browser_use_browsers" ADD CONSTRAINT "browser_use_browsers_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_browsers_session_id_browser_use_sessions_id_fk' AND conrelid = 'public.browser_use_browsers'::regclass) THEN
+ ALTER TABLE "browser_use_browsers" ADD CONSTRAINT "browser_use_browsers_session_id_browser_use_sessions_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."browser_use_sessions"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_runs_company_id_companies_id_fk' AND conrelid = 'public.browser_use_runs'::regclass) THEN
+ ALTER TABLE "browser_use_runs" ADD CONSTRAINT "browser_use_runs_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_runs_session_id_browser_use_sessions_id_fk' AND conrelid = 'public.browser_use_runs'::regclass) THEN
+ ALTER TABLE "browser_use_runs" ADD CONSTRAINT "browser_use_runs_session_id_browser_use_sessions_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."browser_use_sessions"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk' AND conrelid = 'public.browser_use_runs'::regclass) THEN
+ ALTER TABLE "browser_use_runs" ADD CONSTRAINT "browser_use_runs_heartbeat_run_id_heartbeat_runs_id_fk" FOREIGN KEY ("heartbeat_run_id") REFERENCES "public"."heartbeat_runs"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_sessions_company_id_companies_id_fk' AND conrelid = 'public.browser_use_sessions'::regclass) THEN
+ ALTER TABLE "browser_use_sessions" ADD CONSTRAINT "browser_use_sessions_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_sessions_issue_id_issues_id_fk' AND conrelid = 'public.browser_use_sessions'::regclass) THEN
+ ALTER TABLE "browser_use_sessions" ADD CONSTRAINT "browser_use_sessions_issue_id_issues_id_fk" FOREIGN KEY ("issue_id") REFERENCES "public"."issues"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_sessions_agent_id_agents_id_fk' AND conrelid = 'public.browser_use_sessions'::regclass) THEN
+ ALTER TABLE "browser_use_sessions" ADD CONSTRAINT "browser_use_sessions_agent_id_agents_id_fk" FOREIGN KEY ("agent_id") REFERENCES "public"."agents"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_sessions_connection_id_tool_connections_id_fk' AND conrelid = 'public.browser_use_sessions'::regclass) THEN
+ ALTER TABLE "browser_use_sessions" ADD CONSTRAINT "browser_use_sessions_connection_id_tool_connections_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."tool_connections"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_sessions_grant_id_connection_grants_id_fk' AND conrelid = 'public.browser_use_sessions'::regclass) THEN
+ ALTER TABLE "browser_use_sessions" ADD CONSTRAINT "browser_use_sessions_grant_id_connection_grants_id_fk" FOREIGN KEY ("grant_id") REFERENCES "public"."connection_grants"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_settings_grant_id_connection_grants_id_fk' AND conrelid = 'public.browser_use_settings'::regclass) THEN
+ ALTER TABLE "browser_use_settings" ADD CONSTRAINT "browser_use_settings_grant_id_connection_grants_id_fk" FOREIGN KEY ("grant_id") REFERENCES "public"."connection_grants"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'browser_use_settings_company_id_companies_id_fk' AND conrelid = 'public.browser_use_settings'::regclass) THEN
+ ALTER TABLE "browser_use_settings" ADD CONSTRAINT "browser_use_settings_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "browser_use_browsers_provider_uq" ON "browser_use_browsers" USING btree ("provider_browser_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "browser_use_browsers_session_idx" ON "browser_use_browsers" USING btree ("session_id");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "browser_use_runs_invocation_uq" ON "browser_use_runs" USING btree ("invocation_id");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "browser_use_runs_provider_uq" ON "browser_use_runs" USING btree ("provider_run_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "browser_use_runs_session_idx" ON "browser_use_runs" USING btree ("session_id");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "browser_use_sessions_task_idx" ON "browser_use_sessions" USING btree ("company_id","issue_id");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "browser_use_sessions_provider_uq" ON "browser_use_sessions" USING btree ("provider_session_id");
+--> statement-breakpoint
+-- Support development databases that applied the initial browser schema.
+ALTER TABLE "browser_use_runs" ADD COLUMN IF NOT EXISTS "detached_until" timestamp with time zone;
+
+--> statement-breakpoint
+ALTER TABLE "browser_use_runs" ADD COLUMN IF NOT EXISTS "recovery_cursor" text;
+--> statement-breakpoint
+-- Preserve pre-release connections, grants and browser history under the Cloud identity.
+UPDATE "tool_connections"
+SET "config" = jsonb_set("config", '{sourceTemplateKey}', '"browser-use-cloud"'),
+ "transport_config" = CASE WHEN "transport_config"->>'sourceTemplateKey' = 'browser-use'
+ THEN jsonb_set("transport_config", '{sourceTemplateKey}', '"browser-use-cloud"') ELSE "transport_config" END
+WHERE "transport" = 'rest_api' AND "config"->>'sourceTemplateKey' = 'browser-use';
+--> statement-breakpoint
+UPDATE "tool_applications"
+SET "metadata" = "metadata" || '{"sourceTemplateKey":"browser-use-cloud","galleryKey":"browser-use-cloud"}'::jsonb,
+ "application_key" = regexp_replace("application_key", '^app-gallery:browser-use:', 'app-gallery:browser-use-cloud:')
+WHERE "type" = 'rest_api' AND "metadata"->>'sourceTemplateKey' = 'browser-use';
+--> statement-breakpoint
+UPDATE "cost_events"
+SET "provider" = 'browser-use-cloud',
+ "biller" = CASE WHEN "biller" = 'browser-use' THEN 'browser-use-cloud' ELSE "biller" END,
+ "billing_code" = regexp_replace("billing_code", '^browser-use:', 'browser-use-cloud:')
+WHERE "provider" = 'browser-use' AND "billing_code" IN (
+ SELECT 'browser-use:' || "id"::text FROM "browser_use_runs" WHERE "company_id" = "cost_events"."company_id"
+);
+--> statement-breakpoint
+UPDATE "finance_events"
+SET "provider" = 'browser-use-cloud',
+ "biller" = CASE WHEN "biller" = 'browser-use' THEN 'browser-use-cloud' ELSE "biller" END,
+ "billing_code" = regexp_replace("billing_code", '^browser-use:', 'browser-use-cloud:')
+WHERE "provider" = 'browser-use' AND "billing_code" IN (
+ SELECT 'browser-use:' || "id"::text FROM "browser_use_runs" WHERE "company_id" = "finance_events"."company_id"
+);
diff --git a/packages/db/src/migrations/0291_conscious_secret_warriors.sql b/packages/db/src/migrations/0291_conscious_secret_warriors.sql
new file mode 100644
index 00000000000..23a2c911303
--- /dev/null
+++ b/packages/db/src/migrations/0291_conscious_secret_warriors.sql
@@ -0,0 +1,119 @@
+CREATE TABLE IF NOT EXISTS "company_skill_source_entries" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "source_id" uuid NOT NULL,
+ "path" text NOT NULL,
+ "name" text NOT NULL,
+ "description" text,
+ "skill_id" uuid,
+ "selection" text DEFAULT 'new' NOT NULL,
+ "present" boolean DEFAULT true NOT NULL,
+ "error" text
+);
+--> statement-breakpoint
+CREATE TABLE IF NOT EXISTS "company_skill_sources" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "company_id" uuid NOT NULL,
+ "repository_id" text,
+ "repository_url" text NOT NULL,
+ "full_name" text NOT NULL,
+ "tracking_ref" text NOT NULL,
+ "connection_id" uuid,
+ "excluded_folders" jsonb DEFAULT '[]'::jsonb NOT NULL,
+ "enabled" boolean DEFAULT true NOT NULL,
+ "revision" integer DEFAULT 0 NOT NULL,
+ "last_attempt_at" timestamp with time zone,
+ "last_success_at" timestamp with time zone,
+ "last_scan_commit" text,
+ "last_error" text,
+ "lease_token" uuid,
+ "lease_expires_at" timestamp with time zone,
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+DO $$ BEGIN
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'company_skill_source_entries_company_id_companies_id_fk' AND conrelid = 'company_skill_source_entries'::regclass) THEN
+ ALTER TABLE "company_skill_source_entries" ADD CONSTRAINT "company_skill_source_entries_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 = 'company_skill_source_entries_source_id_company_skill_sources_id_fk' AND conrelid = 'company_skill_source_entries'::regclass) THEN
+ ALTER TABLE "company_skill_source_entries" ADD CONSTRAINT "company_skill_source_entries_source_id_company_skill_sources_id_fk" FOREIGN KEY ("source_id") REFERENCES "public"."company_skill_sources"("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 = 'company_skill_source_entries_skill_id_company_skills_id_fk' AND conrelid = 'company_skill_source_entries'::regclass) THEN
+ ALTER TABLE "company_skill_source_entries" ADD CONSTRAINT "company_skill_source_entries_skill_id_company_skills_id_fk" FOREIGN KEY ("skill_id") REFERENCES "public"."company_skills"("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 = 'company_skill_sources_company_id_companies_id_fk' AND conrelid = 'company_skill_sources'::regclass) THEN
+ ALTER TABLE "company_skill_sources" ADD CONSTRAINT "company_skill_sources_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 = 'company_skill_sources_connection_id_tool_connections_id_fk' AND conrelid = 'company_skill_sources'::regclass) THEN
+ ALTER TABLE "company_skill_sources" ADD CONSTRAINT "company_skill_sources_connection_id_tool_connections_id_fk" FOREIGN KEY ("connection_id") REFERENCES "public"."tool_connections"("id") ON DELETE set null ON UPDATE no action;
+ END IF;
+END $$;--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "company_skill_source_entries_source_path_idx" ON "company_skill_source_entries" USING btree ("source_id","path");--> statement-breakpoint
+CREATE INDEX IF NOT EXISTS "company_skill_source_entries_company_skill_idx" ON "company_skill_source_entries" USING btree ("company_id","skill_id");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "company_skill_sources_repository_ref_idx" ON "company_skill_sources" USING btree ("company_id","repository_url","tracking_ref");--> statement-breakpoint
+CREATE UNIQUE INDEX IF NOT EXISTS "company_skill_sources_identity_ref_idx" ON "company_skill_sources" USING btree ("company_id","repository_id","tracking_ref");
+--> statement-breakpoint
+-- Adopt only actual GitHub imports. Keyset batches use company_skills' primary
+-- key; only source provenance is added, with no provider requests, content rewrites, or credential assumptions.
+DO $$
+DECLARE
+ skill record;
+ last_id uuid := '00000000-0000-0000-0000-000000000000';
+ adopted_source_id uuid;
+ repo_url text;
+ repo_name text;
+ adopted_tracking_ref text;
+ skill_path text;
+ batch_count integer;
+BEGIN
+ LOOP
+ batch_count := 0;
+ FOR skill IN
+ SELECT id, company_id, name, description, slug, metadata, source_ref
+ FROM company_skills
+ WHERE id > last_id AND source_type = 'github'
+ AND coalesce(metadata->>'hostname', 'github.com') = 'github.com'
+ AND coalesce(metadata->>'sourceKind', '') NOT IN ('paperclip_bundled', 'catalog')
+ AND metadata->>'catalogId' IS NULL
+ AND metadata->>'owner' ~ '^[A-Za-z0-9_.-]+$'
+ AND metadata->>'repo' ~ '^[A-Za-z0-9_.-]+$'
+ ORDER BY id LIMIT 500
+ LOOP
+ last_id := skill.id;
+ batch_count := batch_count + 1;
+ repo_name := (skill.metadata->>'owner') || '/' || (skill.metadata->>'repo');
+ repo_url := 'https://github.com/' || lower(repo_name);
+ -- Older imports recorded only the installed commit. Keep explicit tracking
+ -- refs (including intentional commit pins); resolve unknown refs on first refresh.
+ adopted_tracking_ref := coalesce(
+ nullif(skill.metadata->>'trackingRef', ''),
+ CASE WHEN skill.metadata->>'ref' !~* '^[0-9a-f]{40}$' THEN nullif(skill.metadata->>'ref', '') END,
+ CASE WHEN skill.source_ref !~* '^[0-9a-f]{40}$' THEN nullif(skill.source_ref, '') END,
+ 'HEAD'
+ );
+ skill_path := trim(both '/' from coalesce(skill.metadata->>'repoSkillDir', skill.slug));
+ IF skill_path = '.' THEN skill_path := ''; END IF;
+ skill_path := CASE WHEN skill_path = '' THEN 'SKILL.md' ELSE skill_path || '/SKILL.md' END;
+ INSERT INTO company_skill_sources (company_id, repository_url, full_name, tracking_ref)
+ VALUES (skill.company_id, repo_url, repo_name, adopted_tracking_ref)
+ ON CONFLICT (company_id, repository_url, tracking_ref) DO NOTHING;
+ SELECT id INTO adopted_source_id FROM company_skill_sources
+ WHERE company_id = skill.company_id AND repository_url = repo_url AND company_skill_sources.tracking_ref = adopted_tracking_ref;
+ INSERT INTO company_skill_source_entries (company_id, source_id, path, name, description, skill_id, selection)
+ VALUES (skill.company_id, adopted_source_id, skill_path, skill.name, skill.description, skill.id, 'selected')
+ ON CONFLICT (source_id, path) DO NOTHING;
+ UPDATE company_skills SET metadata = coalesce(metadata, '{}'::jsonb)
+ || jsonb_build_object('legacySkillSourceId', adopted_source_id, 'skillSourcePath', skill_path)
+ WHERE id = skill.id AND company_id = skill.company_id;
+ END LOOP;
+ EXIT WHEN batch_count < 500;
+ END LOOP;
+END $$;
diff --git a/packages/db/src/migrations/0292_powerful_devos.sql b/packages/db/src/migrations/0292_powerful_devos.sql
new file mode 100644
index 00000000000..2df4ed006f7
--- /dev/null
+++ b/packages/db/src/migrations/0292_powerful_devos.sql
@@ -0,0 +1 @@
+ALTER TABLE "company_skill_source_entries" ADD COLUMN IF NOT EXISTS "inspection" jsonb;
\ No newline at end of file
diff --git a/packages/db/src/migrations/meta/0282_snapshot.json b/packages/db/src/migrations/meta/0282_snapshot.json
deleted file mode 100644
index 5c16a75ee35..00000000000
--- a/packages/db/src/migrations/meta/0282_snapshot.json
+++ /dev/null
@@ -1,47935 +0,0 @@
-{
- "id": "23f8fed6-33cf-43ff-b711-8adb151a4bfc",
- "prevId": "8d202a5a-5d6b-44d9-9336-3bb39a8b99bc",
- "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_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_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')"
- },
- "ai_connection_defaults_method_check": {
- "name": "ai_connection_defaults_method_check",
- "value": "\"ai_connection_defaults\".\"method\" in ('subscription','api_key')"
- }
- },
- "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')"
- }
- },
- "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": "integer",
- "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.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_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_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
- },
- "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_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
- },
- "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_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.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.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_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
- },
- "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_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
- }
- },
- "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/0284_snapshot.json b/packages/db/src/migrations/meta/0288_snapshot.json
similarity index 98%
rename from packages/db/src/migrations/meta/0284_snapshot.json
rename to packages/db/src/migrations/meta/0288_snapshot.json
index e2d4cb653a2..c6dde90ac28 100644
--- a/packages/db/src/migrations/meta/0284_snapshot.json
+++ b/packages/db/src/migrations/meta/0288_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "7db2ceec-ed62-4968-90c9-4c79206cfe34",
- "prevId": "786cd4a9-366b-4934-be90-014e1ee15b51",
+ "id": "770b6d59-6346-4c92-8e49-0b71cf4819ab",
+ "prevId": "26beb23c-50c3-42f9-8a1c-814d0c8acfbe",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -829,6 +829,479 @@
"checkConstraints": {},
"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": "",
@@ -1942,6 +2415,28 @@
"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": [
@@ -2917,7 +3412,7 @@
},
"byte_size": {
"name": "byte_size",
- "type": "integer",
+ "type": "bigint",
"primaryKey": false,
"notNull": true
},
@@ -8067,6 +8562,311 @@
"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": "",
@@ -38939,6 +39739,113 @@
"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": "",
diff --git a/packages/db/src/migrations/meta/0286_snapshot.json b/packages/db/src/migrations/meta/0289_snapshot.json
similarity index 98%
rename from packages/db/src/migrations/meta/0286_snapshot.json
rename to packages/db/src/migrations/meta/0289_snapshot.json
index 0f02bbe75dc..1b3fb2249ad 100644
--- a/packages/db/src/migrations/meta/0286_snapshot.json
+++ b/packages/db/src/migrations/meta/0289_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "33120bf3-9cac-4909-ae94-d514ddc1e9e2",
- "prevId": "c27cbbec-6948-4b2b-8db8-36d0bf3830fd",
+ "id": "3960ae6b-5bf1-4fd7-91db-6a18fc7eaa19",
+ "prevId": "770b6d59-6346-4c92-8e49-0b71cf4819ab",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -829,6 +829,479 @@
"checkConstraints": {},
"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": "",
@@ -1942,6 +2415,28 @@
"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": [
@@ -3302,13 +3797,6 @@
"primaryKey": false,
"notNull": false
},
- "keyboard_shortcuts": {
- "name": "keyboard_shortcuts",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
@@ -8067,6 +8555,311 @@
"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": "",
diff --git a/packages/db/src/migrations/meta/0285_snapshot.json b/packages/db/src/migrations/meta/0290_snapshot.json
similarity index 97%
rename from packages/db/src/migrations/meta/0285_snapshot.json
rename to packages/db/src/migrations/meta/0290_snapshot.json
index 74f739c25ff..63ef4c6fddf 100644
--- a/packages/db/src/migrations/meta/0285_snapshot.json
+++ b/packages/db/src/migrations/meta/0290_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "c27cbbec-6948-4b2b-8db8-36d0bf3830fd",
- "prevId": "7db2ceec-ed62-4968-90c9-4c79206cfe34",
+ "id": "26315a87-4675-4dea-9634-efe5e878cc7d",
+ "prevId": "3960ae6b-5bf1-4fd7-91db-6a18fc7eaa19",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -829,6 +829,479 @@
"checkConstraints": {},
"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": "",
@@ -1942,6 +2415,28 @@
"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": [
@@ -3302,13 +3797,6 @@
"primaryKey": false,
"notNull": false
},
- "keyboard_shortcuts": {
- "name": "keyboard_shortcuts",
- "type": "boolean",
- "primaryKey": false,
- "notNull": true,
- "default": false
- },
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
@@ -3487,6 +3975,599 @@
"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": "",
@@ -8067,6 +9148,311 @@
"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": "",
@@ -38939,6 +40325,113 @@
"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": "",
diff --git a/packages/db/src/migrations/meta/0283_snapshot.json b/packages/db/src/migrations/meta/0291_snapshot.json
similarity index 96%
rename from packages/db/src/migrations/meta/0283_snapshot.json
rename to packages/db/src/migrations/meta/0291_snapshot.json
index 45a457f47b7..22572d546d5 100644
--- a/packages/db/src/migrations/meta/0283_snapshot.json
+++ b/packages/db/src/migrations/meta/0291_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "786cd4a9-366b-4934-be90-014e1ee15b51",
- "prevId": "23f8fed6-33cf-43ff-b711-8adb151a4bfc",
+ "id": "a02dd1cf-75c9-4c4d-b13d-cf5dcd729ad3",
+ "prevId": "26315a87-4675-4dea-9634-efe5e878cc7d",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -829,6 +829,479 @@
"checkConstraints": {},
"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": "",
@@ -1942,6 +2415,28 @@
"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": [
@@ -2917,7 +3412,7 @@
},
"byte_size": {
"name": "byte_size",
- "type": "integer",
+ "type": "bigint",
"primaryKey": false,
"notNull": true
},
@@ -3480,6 +3975,599 @@
"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": "",
@@ -8060,6 +9148,311 @@
"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": "",
@@ -11344,6 +12737,367 @@
"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
+ },
+ "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": "",
@@ -38932,6 +40686,113 @@
"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": "",
diff --git a/packages/db/src/migrations/meta/0292_snapshot.json b/packages/db/src/migrations/meta/0292_snapshot.json
new file mode 100644
index 00000000000..a10ea2e0104
--- /dev/null
+++ b/packages/db/src/migrations/meta/0292_snapshot.json
@@ -0,0 +1,50315 @@
+{
+ "id": "239dfc30-3531-48b5-a06f-72608de479da",
+ "prevId": "a02dd1cf-75c9-4c4d-b13d-cf5dcd729ad3",
+ "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_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')"
+ },
+ "ai_connection_defaults_method_check": {
+ "name": "ai_connection_defaults_method_check",
+ "value": "\"ai_connection_defaults\".\"method\" in ('subscription','api_key')"
+ }
+ },
+ "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')"
+ }
+ },
+ "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
+ },
+ "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
+ },
+ "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_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.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_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
+ },
+ "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_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
+ }
+ },
+ "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/_journal.json b/packages/db/src/migrations/meta/_journal.json
index 264cefe4465..0efa97f7705 100644
--- a/packages/db/src/migrations/meta/_journal.json
+++ b/packages/db/src/migrations/meta/_journal.json
@@ -1996,6 +1996,48 @@
"when": 1790607525758,
"tag": "0286_complete_alice",
"breakpoints": true
+ },
+ {
+ "idx": 287,
+ "version": "7",
+ "when": 1790611116286,
+ "tag": "0287_serious_tinkerer",
+ "breakpoints": true
+ },
+ {
+ "idx": 288,
+ "version": "7",
+ "when": 1790690265758,
+ "tag": "0288_glorious_jamie_braddock",
+ "breakpoints": true
+ },
+ {
+ "idx": 289,
+ "version": "7",
+ "when": 1790727655506,
+ "tag": "0289_drop_user_keyboard_shortcuts",
+ "breakpoints": true
+ },
+ {
+ "idx": 290,
+ "version": "7",
+ "when": 1790768845200,
+ "tag": "0290_browser_use_cloud",
+ "breakpoints": true
+ },
+ {
+ "idx": 291,
+ "version": "7",
+ "when": 1790771783697,
+ "tag": "0291_conscious_secret_warriors",
+ "breakpoints": true
+ },
+ {
+ "idx": 292,
+ "version": "7",
+ "when": 1790776905226,
+ "tag": "0292_powerful_devos",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/agent_instruction_revisions.ts b/packages/db/src/schema/agent_instruction_revisions.ts
new file mode 100644
index 00000000000..39db9af7237
--- /dev/null
+++ b/packages/db/src/schema/agent_instruction_revisions.ts
@@ -0,0 +1,119 @@
+import {
+ pgTable,
+ uuid,
+ text,
+ integer,
+ timestamp,
+ index,
+ unique,
+ foreignKey,
+ jsonb,
+} from "drizzle-orm/pg-core";
+import { agents } from "./agents.js";
+import { heartbeatRuns } from "./heartbeat_runs.js";
+
+/** Append-only content. Base64 preserves every UTF-8 byte, including NUL and BOM. */
+export const agentInstructionRevisions = pgTable(
+ "agent_instruction_revisions",
+ {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull(),
+ agentId: uuid("agent_id").notNull(),
+ entryFile: text("entry_file").notNull(),
+ contentBase64: text("content_base64").notNull(),
+ contentHash: text("content_hash").notNull(),
+ byteLength: integer("byte_length").notNull(),
+ parentRevisionId: uuid("parent_revision_id"),
+ baseRevisionId: uuid("base_revision_id"),
+ restoredFromRevisionId: uuid("restored_from_revision_id"),
+ actorAgentId: uuid("actor_agent_id"),
+ actorUserId: text("actor_user_id"),
+ responsibleUserId: text("responsible_user_id"),
+ sourceRunId: uuid("source_run_id"),
+ source: text("source").notNull(),
+ createdAt: timestamp("created_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ },
+ (t) => ({
+ owner: foreignKey({
+ columns: [t.companyId, t.agentId],
+ foreignColumns: [agents.companyId, agents.id],
+ }).onDelete("cascade"),
+ identity: unique("agent_instruction_revisions_identity_uq").on(
+ t.companyId,
+ t.agentId,
+ t.entryFile,
+ t.id,
+ ),
+ history: index("agent_instruction_revisions_history_idx").on(
+ t.companyId,
+ t.agentId,
+ t.entryFile,
+ t.createdAt,
+ t.id,
+ ),
+ }),
+);
+
+export const agentInstructionHeads = pgTable(
+ "agent_instruction_heads",
+ {
+ companyId: uuid("company_id").notNull(),
+ agentId: uuid("agent_id").notNull(),
+ entryFile: text("entry_file").notNull(),
+ revisionId: uuid("revision_id").notNull(),
+ updatedAt: timestamp("updated_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ },
+ (t) => ({
+ identity: unique("agent_instruction_heads_identity_uq").on(
+ t.companyId,
+ t.agentId,
+ t.entryFile,
+ ),
+ revision: foreignKey({
+ columns: [t.companyId, t.agentId, t.entryFile, t.revisionId],
+ foreignColumns: [
+ agentInstructionRevisions.companyId,
+ agentInstructionRevisions.agentId,
+ agentInstructionRevisions.entryFile,
+ agentInstructionRevisions.id,
+ ],
+ }).onDelete("cascade"),
+ }),
+);
+
+/** A server-owned collection receipt, retained even when canonical CAS rejects an edit. */
+export const agentInstructionWorkingCopies = pgTable(
+ "agent_instruction_working_copies",
+ {
+ runId: uuid("run_id").primaryKey().references(() => heartbeatRuns.id, { onDelete: "cascade" }),
+ companyId: uuid("company_id").notNull(),
+ agentId: uuid("agent_id").notNull(),
+ responsibleUserId: text("responsible_user_id").notNull(),
+ entryFile: text("entry_file").notNull(),
+ baseRevisionId: uuid("base_revision_id"),
+ baseHash: text("base_hash").notNull(),
+ localRoot: text("local_root").notNull(),
+ executionRoot: text("execution_root").notNull(),
+ location: text("location").notNull(),
+ state: text("state").notNull().default("prepared"),
+ candidateBase64: text("candidate_base64"),
+ candidateHash: text("candidate_hash"),
+ errorCode: text("error_code"),
+ errorMessage: text("error_message"),
+ receipt: jsonb("receipt").$type>(),
+ processStoppedAt: timestamp("process_stopped_at", { withTimezone: true }),
+ attempts: integer("attempts").notNull().default(0),
+ nextAttemptAt: timestamp("next_attempt_at", { withTimezone: true }),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
+ },
+ (t) => ({
+ owner: foreignKey({ columns: [t.companyId, t.agentId], foreignColumns: [agents.companyId, agents.id] }).onDelete("cascade"),
+ pending: index("agent_instruction_copies_pending_idx").on(t.state, t.nextAttemptAt),
+ history: index("agent_instruction_copies_agent_idx").on(t.companyId, t.agentId, t.createdAt),
+ }),
+);
diff --git a/packages/db/src/schema/agent_wakeup_requests.ts b/packages/db/src/schema/agent_wakeup_requests.ts
index 80ead37029d..0537bf6ee24 100644
--- a/packages/db/src/schema/agent_wakeup_requests.ts
+++ b/packages/db/src/schema/agent_wakeup_requests.ts
@@ -81,6 +81,9 @@ export const agentWakeupRequests = pgTable(
toolActionDeliveryIdempotencyUq: uniqueIndex("agent_wakeup_requests_tool_action_delivery_uq")
.on(table.companyId, table.idempotencyKey)
.where(sql`${table.idempotencyKey} LIKE 'tool-action-response:%' AND ${table.status} NOT IN ('skipped', 'failed', 'cancelled')`),
+ chatCompletionIdempotencyUq: uniqueIndex("agent_wakeup_requests_chat_completion_uq")
+ .on(table.companyId, table.idempotencyKey)
+ .where(sql`${table.idempotencyKey} LIKE 'chat-completion:%'`),
companyPayloadIssueIdx: index("agent_wakeup_requests_company_payload_issue_idx").on(
table.companyId,
sql`(${table.payload} ->> 'issueId')`,
diff --git a/packages/db/src/schema/auth.ts b/packages/db/src/schema/auth.ts
index faae5df7076..1e82b8a1256 100644
--- a/packages/db/src/schema/auth.ts
+++ b/packages/db/src/schema/auth.ts
@@ -6,7 +6,6 @@ export const authUsers = pgTable("user", {
email: text("email").notNull(),
emailVerified: boolean("email_verified").notNull().default(false),
image: text("image"),
- keyboardShortcuts: boolean("keyboard_shortcuts").notNull().default(false),
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
});
diff --git a/packages/db/src/schema/browser_use.ts b/packages/db/src/schema/browser_use.ts
new file mode 100644
index 00000000000..75dce9d0d03
--- /dev/null
+++ b/packages/db/src/schema/browser_use.ts
@@ -0,0 +1,125 @@
+import {
+ pgTable,
+ uuid,
+ text,
+ timestamp,
+ integer,
+ jsonb,
+ index,
+ uniqueIndex,
+} from "drizzle-orm/pg-core";
+import { companies } from "./companies.js";
+import { issues } from "./issues.js";
+import { agents } from "./agents.js";
+import { heartbeatRuns } from "./heartbeat_runs.js";
+import { toolConnections, connectionGrants } from "./tool_access.js";
+
+export const browserUseSettings = pgTable("browser_use_settings", {
+ grantId: uuid("grant_id")
+ .primaryKey()
+ .references(() => connectionGrants.id),
+ companyId: uuid("company_id")
+ .notNull()
+ .references(() => companies.id),
+ allowedProfileIds: jsonb("allowed_profile_ids")
+ .$type()
+ .notNull()
+ .default([]),
+ maxCostUsd: text("max_cost_usd"),
+});
+export const browserUseSessions = pgTable(
+ "browser_use_sessions",
+ {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id")
+ .notNull()
+ .references(() => companies.id),
+ issueId: uuid("issue_id")
+ .notNull()
+ .references(() => issues.id),
+ agentId: uuid("agent_id")
+ .notNull()
+ .references(() => agents.id),
+ connectionId: uuid("connection_id")
+ .notNull()
+ .references(() => toolConnections.id),
+ grantId: uuid("grant_id")
+ .notNull()
+ .references(() => connectionGrants.id),
+ providerSessionId: uuid("provider_session_id"),
+ status: text("status").notNull().default("starting"),
+ idleDeadline: timestamp("idle_deadline", { withTimezone: true }),
+ stopRequested: text("stop_requested"),
+ error: text("error"),
+ leaseToken: uuid("lease_token"),
+ leaseUntil: timestamp("lease_until", { withTimezone: true }),
+ nextPollAt: timestamp("next_poll_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ createdAt: timestamp("created_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ updatedAt: timestamp("updated_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ },
+ (t) => [
+ index("browser_use_sessions_task_idx").on(t.companyId, t.issueId),
+ uniqueIndex("browser_use_sessions_provider_uq").on(t.providerSessionId),
+ ],
+);
+export const browserUseRuns = pgTable(
+ "browser_use_runs",
+ {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id")
+ .notNull()
+ .references(() => companies.id),
+ sessionId: uuid("session_id")
+ .notNull()
+ .references(() => browserUseSessions.id),
+ heartbeatRunId: uuid("heartbeat_run_id")
+ .notNull()
+ .references(() => heartbeatRuns.id),
+ invocationId: uuid("invocation_id").notNull(),
+ providerRunId: uuid("provider_run_id"),
+ recoveryCursor: text("recovery_cursor"),
+ status: text("status").notNull().default("creating"),
+ detachedUntil: timestamp("detached_until", { withTimezone: true }),
+ eventCursor: integer("event_cursor").notNull().default(0),
+ eventsDrained: integer("events_drained").notNull().default(0),
+ accountedCents: integer("accounted_cents").notNull().default(0),
+ progress: text("progress"),
+ result: jsonb("result"),
+ createdAt: timestamp("created_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ },
+ (t) => [
+ uniqueIndex("browser_use_runs_invocation_uq").on(t.invocationId),
+ uniqueIndex("browser_use_runs_provider_uq").on(t.providerRunId),
+ index("browser_use_runs_session_idx").on(t.sessionId),
+ ],
+);
+export const browserUseBrowsers = pgTable(
+ "browser_use_browsers",
+ {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id")
+ .notNull()
+ .references(() => companies.id),
+ sessionId: uuid("session_id")
+ .notNull()
+ .references(() => browserUseSessions.id),
+ providerBrowserId: uuid("provider_browser_id").notNull(),
+ status: text("status").notNull().default("active"),
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
+ createdAt: timestamp("created_at", { withTimezone: true })
+ .notNull()
+ .defaultNow(),
+ },
+ (t) => [
+ uniqueIndex("browser_use_browsers_provider_uq").on(t.providerBrowserId),
+ index("browser_use_browsers_session_idx").on(t.sessionId),
+ ],
+);
diff --git a/packages/db/src/schema/chat_completion_deliveries.ts b/packages/db/src/schema/chat_completion_deliveries.ts
new file mode 100644
index 00000000000..4b89630fa29
--- /dev/null
+++ b/packages/db/src/schema/chat_completion_deliveries.ts
@@ -0,0 +1,34 @@
+import { index, integer, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
+import { companies } from "./companies.js";
+import { issues } from "./issues.js";
+import { agents } from "./agents.js";
+import { heartbeatRuns } from "./heartbeat_runs.js";
+import { issueComments } from "./issue_comments.js";
+
+/** Server-derived audience captured when a conversation creates an execution task. */
+export const chatTaskHandoffs = pgTable("chat_task_handoffs", {
+ taskId: uuid("task_id").primaryKey().references(() => issues.id, { onDelete: "cascade" }),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ conversationId: uuid("conversation_id").notNull().references(() => issues.id, { onDelete: "cascade" }),
+ agentId: uuid("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
+ sessionGeneration: integer("session_generation").notNull(),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => ({ sourceIdx: index("chat_task_handoffs_source_idx").on(t.companyId, t.conversationId) }));
+
+/** Content-free outbox; results remain on the source task and its documents. */
+export const chatCompletionDeliveries = pgTable("chat_completion_deliveries", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
+ taskId: uuid("task_id").notNull().references(() => chatTaskHandoffs.taskId, { onDelete: "cascade" }),
+ statusVersion: integer("status_version").notNull(),
+ status: text("status").$type<"pending" | "queued" | "delivered" | "superseded" | "exhausted">().notNull().default("pending"),
+ attempts: integer("attempts").notNull().default(0),
+ nextAttemptAt: timestamp("next_attempt_at", { withTimezone: true }).notNull().defaultNow(),
+ targetRunId: uuid("target_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
+ responseCommentId: uuid("response_comment_id").references(() => issueComments.id, { onDelete: "set null" }),
+ error: text("error"),
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
+}, t => ({
+ transitionUq: uniqueIndex("chat_completion_deliveries_transition_uq").on(t.taskId, t.statusVersion),
+ pendingIdx: index("chat_completion_deliveries_pending_idx").on(t.status, t.nextAttemptAt),
+}));
diff --git a/packages/db/src/schema/company_skill_sources.ts b/packages/db/src/schema/company_skill_sources.ts
new file mode 100644
index 00000000000..40a538b18fb
--- /dev/null
+++ b/packages/db/src/schema/company_skill_sources.ts
@@ -0,0 +1,44 @@
+import { pgTable, uuid, text, timestamp, jsonb, integer, boolean, uniqueIndex, index } from 'drizzle-orm/pg-core';
+import type { SkillPackageInspection } from '@paperclipai/shared';
+import { companies } from './companies.js';
+import { companySkills } from './company_skills.js';
+import { toolConnections } from './tool_access.js';
+
+export const companySkillSources = pgTable('company_skill_sources', {
+ id: uuid('id').primaryKey().defaultRandom(),
+ companyId: uuid('company_id').notNull().references(() => companies.id, { onDelete: 'cascade' }),
+ repositoryId: text('repository_id'),
+ repositoryUrl: text('repository_url').notNull(),
+ fullName: text('full_name').notNull(),
+ trackingRef: text('tracking_ref').notNull(),
+ connectionId: uuid('connection_id').references(() => toolConnections.id, { onDelete: 'set null' }),
+ excludedFolders: jsonb('excluded_folders').$type().notNull().default([]),
+ enabled: boolean('enabled').notNull().default(true),
+ revision: integer('revision').notNull().default(0),
+ lastAttemptAt: timestamp('last_attempt_at', { withTimezone: true }),
+ lastSuccessAt: timestamp('last_success_at', { withTimezone: true }),
+ lastScanCommit: text('last_scan_commit'),
+ lastError: text('last_error'),
+ leaseToken: uuid('lease_token'),
+ leaseExpiresAt: timestamp('lease_expires_at', { withTimezone: true }),
+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
+}, table => ({
+ repositoryRef: uniqueIndex('company_skill_sources_repository_ref_idx').on(table.companyId, table.repositoryUrl, table.trackingRef),
+ repositoryIdentity: uniqueIndex('company_skill_sources_identity_ref_idx').on(table.companyId, table.repositoryId, table.trackingRef),
+}));
+export const companySkillSourceEntries = pgTable('company_skill_source_entries', {
+ id: uuid('id').primaryKey().defaultRandom(),
+ companyId: uuid('company_id').notNull().references(() => companies.id, { onDelete: 'cascade' }),
+ sourceId: uuid('source_id').notNull().references(() => companySkillSources.id, { onDelete: 'cascade' }),
+ path: text('path').notNull(),
+ name: text('name').notNull(),
+ description: text('description'),
+ inspection: jsonb('inspection').$type(),
+ skillId: uuid('skill_id').references(() => companySkills.id, { onDelete: 'set null' }),
+ selection: text('selection').$type<'selected' | 'excluded' | 'new'>().notNull().default('new'),
+ present: boolean('present').notNull().default(true),
+ error: text('error'),
+}, table => ({
+ sourcePath: uniqueIndex('company_skill_source_entries_source_path_idx').on(table.sourceId, table.path),
+ companySkill: index('company_skill_source_entries_company_skill_idx').on(table.companyId, table.skillId),
+}));
diff --git a/packages/db/src/schema/company_skills.ts b/packages/db/src/schema/company_skills.ts
index c40fc52e14c..7a1648de90c 100644
--- a/packages/db/src/schema/company_skills.ts
+++ b/packages/db/src/schema/company_skills.ts
@@ -64,6 +64,8 @@ export const companySkills = pgTable(
export type CompanySkillVersionFileInventoryEntry = CompanySkillFileInventoryEntry & {
content: string;
+ encoding?: "utf8" | "base64";
+ executable?: boolean;
};
export const companySkillVersions = pgTable(
diff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.ts
index db17f2aa695..19df9235905 100644
--- a/packages/db/src/schema/index.ts
+++ b/packages/db/src/schema/index.ts
@@ -211,3 +211,10 @@ export { aiConnectionDefaults } from "./ai_connection_defaults.js";
export { aiProviderDefaults } from "./ai_provider_defaults.js";
export * from "./email.js";
export { announcementDismissals, announcementPublications } from "./announcement_dismissals.js";
+export { chatTaskHandoffs, chatCompletionDeliveries } from "./chat_completion_deliveries.js";
+
+export { agentInstructionRevisions, agentInstructionHeads, agentInstructionWorkingCopies } from "./agent_instruction_revisions.js";
+export { browserUseSettings, browserUseSessions, browserUseRuns, browserUseBrowsers } from "./browser_use.js";
+
+
+export * from "./company_skill_sources.js";
diff --git a/packages/paperclip-runner/README.md b/packages/paperclip-runner/README.md
index a98643fad49..27913b20dd4 100644
--- a/packages/paperclip-runner/README.md
+++ b/packages/paperclip-runner/README.md
@@ -54,7 +54,11 @@ leave the board showing an active run after the provider turn has already ended.
The package also builds `paperclip-runner-acpx-sidecar`. This bounded v2
stdin/stdout bridge admits the pinned Claude and Codex ACPX profiles. It
validates the exact model, session identity, tool catalog, structured input,
-and terminal settlement at the process boundary. Pi remains unavailable.
+and terminal settlement at the process boundary. Cursor, Copilot and Pi have
+separate candidate branches and remain unavailable in production until local
+and Daytona qualification passes. Their verified distributions are build-owned;
+no candidate accepts an arbitrary executable. See
+[the rich ACP capability report](../../doc/architecture/runner-rich-acp-capabilities.md).
Remote Codex sessions relay assigned app tools through the server's configured
gateway. Small catalogs are sent directly. When a catalog would exceed the
@@ -96,19 +100,22 @@ do not change workspace isolation or grant credentials or connection access.
task tools; `approve-reads` allows assigned reads; `deny-all` rejects requests.
None of these restrictive modes is the default.
+Restrictive profiles route supported permission decisions through durable runtime
+requests and the existing task interaction controls. Requests are persisted
+before presentation; answers are checked against the offered decisions and
+acknowledged by the sidecar before settlement. Unknown, stale and duplicate
+responses fail. Missing provider decision support remains a blocked disposition,
+not implicit approval. Company access checks still run for each Paperclip tool.
+Provider death expires pending promises; approvals are never replayed into a
+replacement process.
+
Automatic Paperclip/read allowances currently require the Claude SDK dispatch
boundary. Grok preserves these restricted settings, but its ACP requests lack
-independently bound tool authority. They therefore stop with
-`approval_required`, including Paperclip tool requests. Use an explicitly
-selected `approve-all` policy for unattended Grok work in an assigned sandbox;
-Paperclip authorization and governed approvals still apply.
-
-This runtime has no interactive permission handler. An operation that still
-requires approval stops the turn with `approval_required`. The server marks the
-task blocked, exposes the permission action to the operator, and disables
-automatic retry. The operator must review the operation and the agent's
-permission setting before retrying. Company access checks still run when each
-Paperclip tool executes.
+independently bound tool authority. Those operations require a supported operator
+permission decision; a missing interactive responder stops with
+`approval_required`. An explicitly selected `approve-all` policy permits unattended
+Grok work in an assigned sandbox. Paperclip authorization and governed approvals
+still apply.
Runnerd selects only qualified provider profiles. Claude Managed and AWS
AgentCore receive immutable company-profile snapshots with explicit retention,
@@ -285,7 +292,11 @@ pnpm --filter @paperclipai/paperclip-runner report:runner-chaos-evals
`report:runner-live-evals` is a paid, provider-backed command. Native Codex
requires `OPENAI_API_KEY`; ACPX Claude requires
`ANTHROPIC_API_KEY`; OpenCode candidates require `OPENROUTER_API_KEY`. The live
-matrix admits no Pi profile and does not persist credential values. Set
+matrix remains qualified-only and does not persist credential values. Candidate
+qualification uses `eval-session --candidate-profile ` with an
+explicit model and a separately materialized pinned candidate pack. This option
+is a constructor-bound diagnostic opt-in; session JSON cannot enable a candidate.
+Missing credentials or unverifiable spend block paid qualification. Set
`PAPERCLIP_EVAL_MAX_CAMPAIGN_COST_USD` to a positive finite number to bound
additional scheduling after the observed campaign total reaches that value:
diff --git a/packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx b/packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx
index 717f6936dd7..8a8079413e3 100644
--- a/packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx
+++ b/packages/paperclip-runner/devtools/issue-thread/src/ThreadItems.tsx
@@ -172,6 +172,7 @@ function ProviderActivity({ item, callbacks }: {
{children.length > 0 ? {children.map((child, index) => {String(child.role ?? "Child agent")} {String(child.status ?? "unknown")} {String(child.summary ?? "")} )} : null}
{sources.length > 0 ? {sources.map((source, index) => { const url = typeof source.url === "string" && /^https?:\/\//.test(source.url) ? source.url : null; return {url === null ? {String(source.title ?? "Unavailable source")} : {String(source.title ?? url)} }Provider-reported ; })} : null}
{output.length > 0 ? {output} : null}
+ {item.family === "provider_notice" && Array.isArray(payload.details) ? {payload.details.slice(0, 64).map((value, index) => { const detail = valueRecord(value); return
{String(detail.name ?? "Detail")} {String(detail.value ?? "")} ; })} : null}
{item.family === "model_identity" ? Requested {String(payload.requestedModel ?? "—")} Effective {String(payload.effectiveModel ?? "—")} : null}
{item.family === "artifact" && typeof payload.reference === "string" ? Open {payload.reference} : null}
callbacks.onOpenEvidence(item.evidenceRef.section, item.evidenceRef.recordId)}>View in Evidence
diff --git a/packages/paperclip-runner/docs/capability-contract.md b/packages/paperclip-runner/docs/capability-contract.md
index e6da9a2c217..3bdc087203a 100644
--- a/packages/paperclip-runner/docs/capability-contract.md
+++ b/packages/paperclip-runner/docs/capability-contract.md
@@ -8,9 +8,9 @@ The skill/reference inventory and eval cases are the only normative behavior sou
## Baseline Counts
-- Skill/reference headings: 155
+- Skill/reference headings: 157
- Eval cases: 106 across 16 groups
-- Total normative rows: 261
+- Total normative rows: 263
- Legacy MCP aliases folded into normative rows: 42
| Eval group | Cases |
@@ -47,30 +47,31 @@ The skill/reference inventory and eval cases are the only normative behavior sou
| skill:skills/paperclip/SKILL.md:conversation-tasks:30 | optional_agent_tool | skills/paperclip/SKILL.md:30 |
| skill:skills/paperclip/SKILL.md:server-verified-external-chat-turns:47 | control_plane_owned | skills/paperclip/SKILL.md:47 |
| skill:skills/paperclip/SKILL.md:the-heartbeat-procedure:87 | optional_agent_tool | skills/paperclip/SKILL.md:87 |
-| skill:skills/paperclip/SKILL.md:generated-artifacts-and-work-products:159 | always_agent_tool | skills/paperclip/SKILL.md:159 |
-| skill:skills/paperclip/SKILL.md:status-quick-guide:207 | control_plane_owned | skills/paperclip/SKILL.md:207 |
-| skill:skills/paperclip/SKILL.md:monitors-and-watchers-say-only-what-you-actually-scheduled:217 | optional_agent_tool | skills/paperclip/SKILL.md:217 |
-| skill:skills/paperclip/SKILL.md:delegating-review-tasks:230 | always_agent_tool | skills/paperclip/SKILL.md:230 |
-| skill:skills/paperclip/SKILL.md:managing-a-user-s-inbox:241 | control_plane_owned | skills/paperclip/SKILL.md:241 |
-| skill:skills/paperclip/SKILL.md:issue-dependencies-blockers:249 | control_plane_owned | skills/paperclip/SKILL.md:249 |
-| skill:skills/paperclip/SKILL.md:requesting-board-approval:274 | optional_agent_tool | skills/paperclip/SKILL.md:274 |
-| skill:skills/paperclip/SKILL.md:issue-thread-interactions:295 | optional_agent_tool | skills/paperclip/SKILL.md:295 |
-| skill:skills/paperclip/SKILL.md:standalone-decisions:324 | optional_agent_tool | skills/paperclip/SKILL.md:324 |
-| skill:skills/paperclip/SKILL.md:mcp-tool-approval-gates:428 | optional_agent_tool | skills/paperclip/SKILL.md:428 |
-| skill:skills/paperclip/SKILL.md:niche-workflow-pointers:470 | optional_agent_tool | skills/paperclip/SKILL.md:470 |
-| skill:skills/paperclip/SKILL.md:cases:480 | optional_agent_tool | skills/paperclip/SKILL.md:480 |
-| skill:skills/paperclip/SKILL.md:company-skills-workflow:485 | optional_agent_tool | skills/paperclip/SKILL.md:485 |
-| skill:skills/paperclip/SKILL.md:routines:496 | optional_agent_tool | skills/paperclip/SKILL.md:496 |
-| skill:skills/paperclip/SKILL.md:issue-workspace-runtime-controls:507 | optional_agent_tool | skills/paperclip/SKILL.md:507 |
-| skill:skills/paperclip/SKILL.md:proposing-credentials-safely:514 | optional_agent_tool | skills/paperclip/SKILL.md:514 |
-| skill:skills/paperclip/SKILL.md:reading-granted-secrets:521 | optional_agent_tool | skills/paperclip/SKILL.md:521 |
-| skill:skills/paperclip/SKILL.md:critical-rules:547 | optional_agent_tool | skills/paperclip/SKILL.md:547 |
-| skill:skills/paperclip/SKILL.md:comment-style-required:567 | always_agent_tool | skills/paperclip/SKILL.md:567 |
-| skill:skills/paperclip/SKILL.md:update:599 | optional_agent_tool | skills/paperclip/SKILL.md:599 |
-| skill:skills/paperclip/SKILL.md:planning-required-when-planning-requested:609 | optional_agent_tool | skills/paperclip/SKILL.md:609 |
-| skill:skills/paperclip/SKILL.md:key-endpoints-hot-routes:642 | optional_agent_tool | skills/paperclip/SKILL.md:642 |
-| skill:skills/paperclip/SKILL.md:searching-issues:671 | optional_agent_tool | skills/paperclip/SKILL.md:671 |
-| skill:skills/paperclip/SKILL.md:full-reference:681 | optional_agent_tool | skills/paperclip/SKILL.md:681 |
+| skill:skills/paperclip/SKILL.md:generated-artifacts-and-work-products:195 | always_agent_tool | skills/paperclip/SKILL.md:195 |
+| skill:skills/paperclip/SKILL.md:status-quick-guide:243 | control_plane_owned | skills/paperclip/SKILL.md:243 |
+| skill:skills/paperclip/SKILL.md:monitors-and-watchers-say-only-what-you-actually-scheduled:253 | optional_agent_tool | skills/paperclip/SKILL.md:253 |
+| skill:skills/paperclip/SKILL.md:delegating-review-tasks:266 | always_agent_tool | skills/paperclip/SKILL.md:266 |
+| skill:skills/paperclip/SKILL.md:managing-a-user-s-inbox:277 | control_plane_owned | skills/paperclip/SKILL.md:277 |
+| skill:skills/paperclip/SKILL.md:issue-dependencies-blockers:285 | control_plane_owned | skills/paperclip/SKILL.md:285 |
+| skill:skills/paperclip/SKILL.md:requesting-board-approval:310 | optional_agent_tool | skills/paperclip/SKILL.md:310 |
+| skill:skills/paperclip/SKILL.md:issue-thread-interactions:331 | optional_agent_tool | skills/paperclip/SKILL.md:331 |
+| skill:skills/paperclip/SKILL.md:standalone-decisions:360 | optional_agent_tool | skills/paperclip/SKILL.md:360 |
+| skill:skills/paperclip/SKILL.md:mcp-tool-approval-gates:464 | optional_agent_tool | skills/paperclip/SKILL.md:464 |
+| skill:skills/paperclip/SKILL.md:niche-workflow-pointers:506 | optional_agent_tool | skills/paperclip/SKILL.md:506 |
+| skill:skills/paperclip/SKILL.md:cases:516 | optional_agent_tool | skills/paperclip/SKILL.md:516 |
+| skill:skills/paperclip/SKILL.md:company-skills-workflow:521 | optional_agent_tool | skills/paperclip/SKILL.md:521 |
+| skill:skills/paperclip/SKILL.md:routines:532 | optional_agent_tool | skills/paperclip/SKILL.md:532 |
+| skill:skills/paperclip/SKILL.md:issue-workspace-runtime-controls:543 | optional_agent_tool | skills/paperclip/SKILL.md:543 |
+| skill:skills/paperclip/SKILL.md:proposing-credentials-safely:550 | optional_agent_tool | skills/paperclip/SKILL.md:550 |
+| skill:skills/paperclip/SKILL.md:reading-granted-secrets:557 | optional_agent_tool | skills/paperclip/SKILL.md:557 |
+| skill:skills/paperclip/SKILL.md:critical-rules:583 | optional_agent_tool | skills/paperclip/SKILL.md:583 |
+| skill:skills/paperclip/SKILL.md:comment-style-required:604 | always_agent_tool | skills/paperclip/SKILL.md:604 |
+| skill:skills/paperclip/SKILL.md:update:636 | optional_agent_tool | skills/paperclip/SKILL.md:636 |
+| skill:skills/paperclip/SKILL.md:planning-required-when-planning-requested:646 | optional_agent_tool | skills/paperclip/SKILL.md:646 |
+| skill:skills/paperclip/SKILL.md:key-endpoints-hot-routes:679 | optional_agent_tool | skills/paperclip/SKILL.md:679 |
+| skill:skills/paperclip/SKILL.md:searching-issues:708 | optional_agent_tool | skills/paperclip/SKILL.md:708 |
+| skill:skills/paperclip/SKILL.md:full-reference:718 | optional_agent_tool | skills/paperclip/SKILL.md:718 |
+| skill:skills/paperclip/SKILL.md:conversational-confirmation-answers:722 | always_agent_tool | skills/paperclip/SKILL.md:722 |
| skill:skills/paperclip/references/artifacts.md:generated-artifacts-and-work-products:1 | always_agent_tool | skills/paperclip/references/artifacts.md:1 |
| skill:skills/paperclip/references/artifacts.md:workspace-only-file-references:15 | optional_agent_tool | skills/paperclip/references/artifacts.md:15 |
| skill:skills/paperclip/references/cases.md:cases:1 | optional_agent_tool | skills/paperclip/references/cases.md:1 |
@@ -165,21 +166,22 @@ The skill/reference inventory and eval cases are the only normative behavior sou
| skill:skills/paperclip/references/api-reference.md:7-dashboard-for-health-check:626 | optional_agent_tool | skills/paperclip/references/api-reference.md:626 |
| skill:skills/paperclip/references/api-reference.md:comments-and-mentions:632 | always_agent_tool | skills/paperclip/references/api-reference.md:632 |
| skill:skills/paperclip/references/api-reference.md:update:639 | optional_agent_tool | skills/paperclip/references/api-reference.md:639 |
-| skill:skills/paperclip/references/api-reference.md:cross-team-work-and-delegation:677 | optional_agent_tool | skills/paperclip/references/api-reference.md:677 |
-| skill:skills/paperclip/references/api-reference.md:receiving-cross-team-work:681 | optional_agent_tool | skills/paperclip/references/api-reference.md:681 |
-| skill:skills/paperclip/references/api-reference.md:questions-and-dependencies:691 | always_agent_tool | skills/paperclip/references/api-reference.md:691 |
-| skill:skills/paperclip/references/api-reference.md:company-context:703 | optional_agent_tool | skills/paperclip/references/api-reference.md:703 |
-| skill:skills/paperclip/references/api-reference.md:company-branding-ceo-board:715 | optional_agent_tool | skills/paperclip/references/api-reference.md:715 |
-| skill:skills/paperclip/references/api-reference.md:openclaw-invite-prompt-ceo:735 | optional_agent_tool | skills/paperclip/references/api-reference.md:735 |
-| skill:skills/paperclip/references/api-reference.md:setting-agent-instructions-path:754 | optional_agent_tool | skills/paperclip/references/api-reference.md:754 |
-| skill:skills/paperclip/references/api-reference.md:project-setup-create-workspace:787 | optional_agent_tool | skills/paperclip/references/api-reference.md:787 |
-| skill:skills/paperclip/references/api-reference.md:option-a-one-call-create-with-workspace:811 | optional_agent_tool | skills/paperclip/references/api-reference.md:811 |
-| skill:skills/paperclip/references/api-reference.md:option-b-two-calls-project-first-then-workspace:830 | optional_agent_tool | skills/paperclip/references/api-reference.md:830 |
-| skill:skills/paperclip/references/api-reference.md:governance-and-approvals:859 | optional_agent_tool | skills/paperclip/references/api-reference.md:859 |
-| skill:skills/paperclip/references/api-reference.md:requesting-a-hire-management-only:863 | optional_agent_tool | skills/paperclip/references/api-reference.md:863 |
-| skill:skills/paperclip/references/api-reference.md:ceo-strategy-approval:928 | optional_agent_tool | skills/paperclip/references/api-reference.md:928 |
-| skill:skills/paperclip/references/api-reference.md:questions-and-waiting-for-human-input:937 | always_agent_tool | skills/paperclip/references/api-reference.md:937 |
-| skill:skills/paperclip/references/api-reference.md:issue-thread-confirmations:1034 | always_agent_tool | skills/paperclip/references/api-reference.md:1034 |
+| skill:skills/paperclip/references/api-reference.md:cross-team-work-and-delegation:661 | optional_agent_tool | skills/paperclip/references/api-reference.md:661 |
+| skill:skills/paperclip/references/api-reference.md:receiving-cross-team-work:665 | optional_agent_tool | skills/paperclip/references/api-reference.md:665 |
+| skill:skills/paperclip/references/api-reference.md:questions-and-dependencies:675 | always_agent_tool | skills/paperclip/references/api-reference.md:675 |
+| skill:skills/paperclip/references/api-reference.md:company-context:687 | optional_agent_tool | skills/paperclip/references/api-reference.md:687 |
+| skill:skills/paperclip/references/api-reference.md:company-branding-ceo-board:699 | optional_agent_tool | skills/paperclip/references/api-reference.md:699 |
+| skill:skills/paperclip/references/api-reference.md:openclaw-invite-prompt-ceo:719 | optional_agent_tool | skills/paperclip/references/api-reference.md:719 |
+| skill:skills/paperclip/references/api-reference.md:setting-agent-instructions-path:738 | optional_agent_tool | skills/paperclip/references/api-reference.md:738 |
+| skill:skills/paperclip/references/api-reference.md:project-setup-create-workspace:771 | optional_agent_tool | skills/paperclip/references/api-reference.md:771 |
+| skill:skills/paperclip/references/api-reference.md:option-a-one-call-create-with-workspace:795 | optional_agent_tool | skills/paperclip/references/api-reference.md:795 |
+| skill:skills/paperclip/references/api-reference.md:option-b-two-calls-project-first-then-workspace:814 | optional_agent_tool | skills/paperclip/references/api-reference.md:814 |
+| skill:skills/paperclip/references/api-reference.md:governance-and-approvals:843 | optional_agent_tool | skills/paperclip/references/api-reference.md:843 |
+| skill:skills/paperclip/references/api-reference.md:requesting-a-hire-management-only:847 | optional_agent_tool | skills/paperclip/references/api-reference.md:847 |
+| skill:skills/paperclip/references/api-reference.md:ceo-strategy-approval:912 | optional_agent_tool | skills/paperclip/references/api-reference.md:912 |
+| skill:skills/paperclip/references/api-reference.md:questions-and-waiting-for-human-input:921 | always_agent_tool | skills/paperclip/references/api-reference.md:921 |
+| skill:skills/paperclip/references/api-reference.md:issue-thread-confirmations:1028 | always_agent_tool | skills/paperclip/references/api-reference.md:1028 |
+| skill:skills/paperclip/references/api-reference.md:conversational-confirmation-answers:1086 | always_agent_tool | skills/paperclip/references/api-reference.md:1086 |
| skill:skills/paperclip/references/api-reference.md:checkbox-confirmations:1092 | always_agent_tool | skills/paperclip/references/api-reference.md:1092 |
| skill:skills/paperclip/references/api-reference.md:item-verdict-requests:1207 | optional_agent_tool | skills/paperclip/references/api-reference.md:1207 |
| skill:skills/paperclip/references/api-reference.md:checking-approval-status:1317 | optional_agent_tool | skills/paperclip/references/api-reference.md:1317 |
@@ -189,13 +191,13 @@ The skill/reference inventory and eval cases are the only normative behavior sou
| skill:skills/paperclip/references/api-reference.md:full-api-reference:1385 | optional_agent_tool | skills/paperclip/references/api-reference.md:1385 |
| skill:skills/paperclip/references/api-reference.md:agents:1387 | optional_agent_tool | skills/paperclip/references/api-reference.md:1387 |
| skill:skills/paperclip/references/api-reference.md:issues-tasks:1408 | optional_agent_tool | skills/paperclip/references/api-reference.md:1408 |
-| skill:skills/paperclip/references/api-reference.md:companies-projects-goals:1448 | optional_agent_tool | skills/paperclip/references/api-reference.md:1448 |
-| skill:skills/paperclip/references/api-reference.md:routines:1472 | optional_agent_tool | skills/paperclip/references/api-reference.md:1472 |
-| skill:skills/paperclip/references/api-reference.md:approvals-costs-activity-dashboard:1488 | optional_agent_tool | skills/paperclip/references/api-reference.md:1488 |
-| skill:skills/paperclip/references/api-reference.md:secrets:1510 | optional_agent_tool | skills/paperclip/references/api-reference.md:1510 |
-| skill:skills/paperclip/references/api-reference.md:agent-secret-proposals:1523 | optional_agent_tool | skills/paperclip/references/api-reference.md:1523 |
-| skill:skills/paperclip/references/api-reference.md:agent-secret-access:1623 | optional_agent_tool | skills/paperclip/references/api-reference.md:1623 |
-| skill:skills/paperclip/references/api-reference.md:common-mistakes:1663 | optional_agent_tool | skills/paperclip/references/api-reference.md:1663 |
+| skill:skills/paperclip/references/api-reference.md:companies-projects-goals:1449 | optional_agent_tool | skills/paperclip/references/api-reference.md:1449 |
+| skill:skills/paperclip/references/api-reference.md:routines:1473 | optional_agent_tool | skills/paperclip/references/api-reference.md:1473 |
+| skill:skills/paperclip/references/api-reference.md:approvals-costs-activity-dashboard:1489 | optional_agent_tool | skills/paperclip/references/api-reference.md:1489 |
+| skill:skills/paperclip/references/api-reference.md:secrets:1511 | optional_agent_tool | skills/paperclip/references/api-reference.md:1511 |
+| skill:skills/paperclip/references/api-reference.md:agent-secret-proposals:1524 | optional_agent_tool | skills/paperclip/references/api-reference.md:1524 |
+| skill:skills/paperclip/references/api-reference.md:agent-secret-access:1624 | optional_agent_tool | skills/paperclip/references/api-reference.md:1624 |
+| skill:skills/paperclip/references/api-reference.md:common-mistakes:1664 | optional_agent_tool | skills/paperclip/references/api-reference.md:1664 |
## Legacy MCP Alias Index
diff --git a/packages/paperclip-runner/docs/durable-recovery.md b/packages/paperclip-runner/docs/durable-recovery.md
index 857de7b7121..8ee0b22c975 100644
--- a/packages/paperclip-runner/docs/durable-recovery.md
+++ b/packages/paperclip-runner/docs/durable-recovery.md
@@ -185,6 +185,105 @@ The trace records `logicalEffectCount`. Every completed command has exactly one
logical effect. A policy rejection, such as a new turn during drain or storage
pressure, has zero effects.
+## Semantic operations that outlive a turn
+
+An execution session includes the provider process, the runner's durable call
+receipts and event outbox, and the controller's durable command queue. Ending a
+provider turn closes admission of new work. It does not establish whether a
+semantic operation already dispatched to the server succeeded or failed.
+
+The tool bridge retains pending call IDs, operation IDs, and exact arguments
+across that boundary. It accepts the authority's late result without delivering
+it to an obsolete provider turn. An identical result is an idempotent replay;
+a different result for that call remains a conflict. Codex records harmless
+result replay as `semantic_tool_result_duplicate` in a diagnostic event, with
+no task failure. Conflict errors identify the call, operation, and both result
+digests without including the result bodies.
+
+The controller checkpoints a reusable session only after every admitted tool
+has a matching completed result-delivery command and the provider has drained.
+A callback rejected before business dispatch can report
+`semantic_tool_not_dispatched`. A callback rejected after dispatch has an
+unknown outcome; the controller must not invent a failure or execute it again.
+After controller restart, an already committed input without a result remains
+unsettled. It requires authoritative reconciliation, not an automatic retry.
+A different case is a runner crash after the controller saved the result but
+before its delivery command completed. Codex/OpenCode explicitly opt in to
+reconciling that exact `semantic_tool.result` command through their durable tool
+receipt. The full command fingerprint must match. This delivers the saved
+answer without executing the business operation. Unsupported providers and all
+other indeterminate commands remain non-reexecutable. This change does not
+repair legacy journals already containing contradictory or failed receipts.
+
+`update_agent_instructions` and `restore_agent_instructions` use a durable,
+company/run-scoped mutation receipt keyed by call ID. Before attempting a file
+write, the authority commits an `instructionToolAttempts` record and an
+`agent.instruction_write_attempted` activity row with the call ID, operation ID,
+and input digest. This evidence survives a later filesystem or database failure.
+Completed calls and retries after authority restart return the exact original receipt.
+Changing the arguments under that ID is an idempotency conflict. Receipt replay
+still checks current instruction-write authorization. Concurrent callers in the
+same process wait for the first handler before checking the receipt again.
+
+The filesystem and PostgreSQL are not one atomic store. If a write is visible
+but its receipt transaction rolls back, the attempt record remains durable and
+the result is unknown. An identical call with an attempt but no committed result
+raises `paperclip_runner_instruction_outcome_unknown`; it does not write again
+or pretend to have succeeded. This also applies to another process reaching a
+reserved call before its effect transaction starts. The controller retains an
+unsettled operation for authoritative reconciliation. If only the commit
+acknowledgement was lost, the committed receipt is replayed normally.
+The native tool wrapper propagates `SemanticToolOutcomeUnknownError` instead
+of turning it into a completed failed tool response. Ordinary validation,
+authorization, and stale-base errors still return normal tool errors. Before
+returning a definite pre-write failure, the authority saves its status, message,
+and details under the attempt's `failure` receipt. Replays return that original
+error without executing again, even if the old CAS base becomes current again.
+Failure-receipt storage errors retain an unsettled operation instead of exposing
+an unrecorded final answer.
+
+### Lossless arguments and bounded transport
+
+Execution arguments do not use the diagnostic preview formatter. Accepted
+input remains exact, including Unicode, line endings, and long document tails.
+The credential policy rejects input it would have to alter before dispatch.
+Diagnostic copies remain redacted and bounded. The semantic input limit is
+480 KiB of encoded JSON, leaving room for the encrypted frame's hex expansion
+and envelope inside the 1 MiB wire limit. Oversized input fails before a write;
+it is never truncated into an apparently successful write.
+
+A result command retains a SHA-256 `inputDigest` instead of duplicating the
+full input alongside the full result. The canonical input event retains the
+arguments. Settlement validates the digest and all run, event, call, operation,
+and correlation identities. Legacy result commands carrying the full input
+remain supported. Large results still have to fit the command transport limit;
+exceeding it leaves the outcome unsettled rather than retrying an effect.
+
+### Deterministic fault coverage
+
+These tests use explicit barriers, durable reloads, real runner processes with
+scripted providers, and a real PostgreSQL database. They do not require a paid
+model or rely on an LLM choosing the desired timing.
+
+| Fault | Required assertion | Regression suite |
+| --- | --- | --- |
+| Stop before/after server result; restart before late delivery | No invented failure; pending identity survives; late result accepted | Rust `provider_bridge`, `codex_provider` |
+| Provider terminal before tool completion | New turn blocked until actual result; safe replay and later reuse | Rust `acpx_provider_turns`, `acpx_provider_state` |
+| Crash before/after applying a saved delivery receipt, before command completion | Exact result delivery recovers only for opted-in providers; changed commands and ordinary operations never replay | Rust durable runner tests |
+| Lost result acknowledgement; conflicting redelivery | Identical result accepted; changed result rejected with IDs and digests | Rust `codex_provider`, `provider_bridge` |
+| Concurrent writes held at filesystem commit; authority restart | One write, one audit record, same receipt; revoked authorization rejected | Server `agent-instruction-tools.integration.test.ts` |
+| Failure after file rename or rollback while saving the receipt | Durable attempt and audit evidence survive; no success claim and no second write | Server `agent-instruction-tools.integration.test.ts` |
+| Receipt commits but its database acknowledgement is lost | Exact original result replays; one file-update audit and one attempt record | Server `agent-instruction-tools.integration.test.ts` |
+| Tool handler throws an unknown-outcome error versus a validation error | Unknown propagates without a completed tool event; validation returns an ordinary failed response | `codex-app-server-driver.test.ts` |
+| Invalid arguments, oversized input, or stale base; restart and replay | Original failure replays with zero writes, even after the base becomes valid | Server `agent-instruction-tools.integration.test.ts` |
+| Failure receipt cannot be stored | No unrecorded final failure; attempt remains unsettled and never reexecutes | Server `agent-instruction-tools.integration.test.ts` |
+| Long Unicode input and result; corrupted input digest | Exact bytes across persistence/wire; no copied input in result; bad proof blocks settlement | Rust durable-state tests; `durable-prp-control-plane.test.ts` |
+| Handler finishes during close, after close budget, or persistence fails | Checkpoint marked settled only with completed delivery and drained provider | `runnerd-codex-transport.test.ts` |
+| Controller restarts with committed input but no result | No second dispatch and no fabricated outcome | `durable-prp-control-plane.test.ts` |
+| Execution and cleanup both fail | Original execution error retained; cleanup error attached | `native-session-runtime.test.ts` |
+| Retry in same process or after local log loss | Earlier attempts survive locally and in the durable mirror | Server `run-log-store.test.ts` |
+| Two restores overlap and one appends before the other publishes | Complete prefix is published without replacement; both attempts survive | Server `run-log-store.test.ts` |
+
## Residual local trust and revocation window
The authenticated session removes trust in whichever process wins the configured
diff --git a/packages/paperclip-runner/generated/capability/capabilities.yaml b/packages/paperclip-runner/generated/capability/capabilities.yaml
index 698ff493003..56d11b3f3d5 100644
--- a/packages/paperclip-runner/generated/capability/capabilities.yaml
+++ b/packages/paperclip-runner/generated/capability/capabilities.yaml
@@ -56,221 +56,230 @@
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:159",
+ "id": "skill:skills/paperclip/SKILL.md:195",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L159:generated-artifacts-and-work-products",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L195:generated-artifacts-and-work-products",
"heading": "Generated Artifacts and Work Products",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "register_deliverable",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:207",
+ "id": "skill:skills/paperclip/SKILL.md:243",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L207:status-quick-guide",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L243:status-quick-guide",
"heading": "Status Quick Guide",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:217",
+ "id": "skill:skills/paperclip/SKILL.md:253",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L217:monitors-and-watchers-say-only-what-you-actually-scheduled",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L253:monitors-and-watchers-say-only-what-you-actually-scheduled",
"heading": "Monitors and Watchers (say only what you actually scheduled)",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:230",
+ "id": "skill:skills/paperclip/SKILL.md:266",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L230:delegating-review-tasks",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L266:delegating-review-tasks",
"heading": "Delegating review tasks",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:241",
+ "id": "skill:skills/paperclip/SKILL.md:277",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L241:managing-a-user-s-inbox",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L277:managing-a-user-s-inbox",
"heading": "Managing A User's Inbox",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:249",
+ "id": "skill:skills/paperclip/SKILL.md:285",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L249:issue-dependencies-blockers",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L285:issue-dependencies-blockers",
"heading": "Issue Dependencies (Blockers)",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:274",
+ "id": "skill:skills/paperclip/SKILL.md:310",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L274:requesting-board-approval",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L310:requesting-board-approval",
"heading": "Requesting Board Approval",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:295",
+ "id": "skill:skills/paperclip/SKILL.md:331",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L295:issue-thread-interactions",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L331:issue-thread-interactions",
"heading": "Issue-Thread Interactions",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "request_human_input",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:324",
+ "id": "skill:skills/paperclip/SKILL.md:360",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L324:standalone-decisions",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L360:standalone-decisions",
"heading": "Standalone Decisions",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:428",
+ "id": "skill:skills/paperclip/SKILL.md:464",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L428:mcp-tool-approval-gates",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L464:mcp-tool-approval-gates",
"heading": "MCP Tool Approval Gates",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:470",
+ "id": "skill:skills/paperclip/SKILL.md:506",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L470:niche-workflow-pointers",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L506:niche-workflow-pointers",
"heading": "Niche Workflow Pointers",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:480",
+ "id": "skill:skills/paperclip/SKILL.md:516",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L480:cases",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L516:cases",
"heading": "Cases",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:485",
+ "id": "skill:skills/paperclip/SKILL.md:521",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L485:company-skills-workflow",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L521:company-skills-workflow",
"heading": "Company Skills Workflow",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:496",
+ "id": "skill:skills/paperclip/SKILL.md:532",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L496:routines",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L532:routines",
"heading": "Routines",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:507",
+ "id": "skill:skills/paperclip/SKILL.md:543",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L507:issue-workspace-runtime-controls",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L543:issue-workspace-runtime-controls",
"heading": "Issue Workspace Runtime Controls",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:514",
+ "id": "skill:skills/paperclip/SKILL.md:550",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L514:proposing-credentials-safely",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L550:proposing-credentials-safely",
"heading": "Proposing Credentials Safely",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:521",
+ "id": "skill:skills/paperclip/SKILL.md:557",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L521:reading-granted-secrets",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L557:reading-granted-secrets",
"heading": "Reading Granted Secrets",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:547",
+ "id": "skill:skills/paperclip/SKILL.md:583",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L547:critical-rules",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L583:critical-rules",
"heading": "Critical Rules",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:567",
+ "id": "skill:skills/paperclip/SKILL.md:604",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L567:comment-style-required",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L604:comment-style-required",
"heading": "Comment Style (Required)",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "report_progress",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:599",
+ "id": "skill:skills/paperclip/SKILL.md:636",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L599:update",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L636:update",
"heading": "Update",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:609",
+ "id": "skill:skills/paperclip/SKILL.md:646",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L609:planning-required-when-planning-requested",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L646:planning-required-when-planning-requested",
"heading": "Planning (Required when planning requested)",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "write_document",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/SKILL.md:642",
+ "id": "skill:skills/paperclip/SKILL.md:679",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L642:key-endpoints-hot-routes",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L679:key-endpoints-hot-routes",
"heading": "Key Endpoints (Hot Routes)",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:671",
+ "id": "skill:skills/paperclip/SKILL.md:708",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L671:searching-issues",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L708:searching-issues",
"heading": "Searching Issues",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/SKILL.md:681",
+ "id": "skill:skills/paperclip/SKILL.md:718",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md#L681:full-reference",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L718:full-reference",
"heading": "Full Reference",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
+ {
+ "id": "skill:skills/paperclip/SKILL.md:722",
+ "kind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md#L722:conversational-confirmation-answers",
+ "heading": "Conversational confirmation answers",
+ "primaryDisposition": "always_agent_tool",
+ "semanticOperation": "call_api",
+ "expectedMockState": "operation_result"
+ },
{
"id": "skill:skills/paperclip/references/api-reference.md:1",
"kind": "skill_heading",
@@ -614,140 +623,149 @@
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:677",
+ "id": "skill:skills/paperclip/references/api-reference.md:661",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L677:cross-team-work-and-delegation",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L661:cross-team-work-and-delegation",
"heading": "Cross-Team Work and Delegation",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:681",
+ "id": "skill:skills/paperclip/references/api-reference.md:665",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L681:receiving-cross-team-work",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L665:receiving-cross-team-work",
"heading": "Receiving cross-team work",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:691",
+ "id": "skill:skills/paperclip/references/api-reference.md:675",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L691:questions-and-dependencies",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L675:questions-and-dependencies",
"heading": "Questions and dependencies",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "request_human_input",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:703",
+ "id": "skill:skills/paperclip/references/api-reference.md:687",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L703:company-context",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L687:company-context",
"heading": "Company Context",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:715",
+ "id": "skill:skills/paperclip/references/api-reference.md:699",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L715:company-branding-ceo-board",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L699:company-branding-ceo-board",
"heading": "Company Branding (CEO / Board)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:735",
+ "id": "skill:skills/paperclip/references/api-reference.md:719",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L735:openclaw-invite-prompt-ceo",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L719:openclaw-invite-prompt-ceo",
"heading": "OpenClaw Invite Prompt (CEO)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:754",
+ "id": "skill:skills/paperclip/references/api-reference.md:738",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L754:setting-agent-instructions-path",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L738:setting-agent-instructions-path",
"heading": "Setting Agent Instructions Path",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:787",
+ "id": "skill:skills/paperclip/references/api-reference.md:771",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L787:project-setup-create-workspace",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L771:project-setup-create-workspace",
"heading": "Project Setup (Create + Workspace)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:811",
+ "id": "skill:skills/paperclip/references/api-reference.md:795",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L811:option-a-one-call-create-with-workspace",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L795:option-a-one-call-create-with-workspace",
"heading": "Option A: One-call create with workspace",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:830",
+ "id": "skill:skills/paperclip/references/api-reference.md:814",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L830:option-b-two-calls-project-first-then-workspace",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L814:option-b-two-calls-project-first-then-workspace",
"heading": "Option B: Two calls (project first, then workspace)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:859",
+ "id": "skill:skills/paperclip/references/api-reference.md:843",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L859:governance-and-approvals",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L843:governance-and-approvals",
"heading": "Governance and Approvals",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:863",
+ "id": "skill:skills/paperclip/references/api-reference.md:847",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L863:requesting-a-hire-management-only",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L847:requesting-a-hire-management-only",
"heading": "Requesting a hire (management only)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:928",
+ "id": "skill:skills/paperclip/references/api-reference.md:912",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L928:ceo-strategy-approval",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L912:ceo-strategy-approval",
"heading": "CEO strategy approval",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:937",
+ "id": "skill:skills/paperclip/references/api-reference.md:921",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L937:questions-and-waiting-for-human-input",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L921:questions-and-waiting-for-human-input",
"heading": "Questions and waiting for human input",
"primaryDisposition": "always_agent_tool",
"semanticOperation": "request_human_input",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1034",
+ "id": "skill:skills/paperclip/references/api-reference.md:1028",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1034:issue-thread-confirmations",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1028:issue-thread-confirmations",
"heading": "Issue-thread confirmations",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
+ {
+ "id": "skill:skills/paperclip/references/api-reference.md:1086",
+ "kind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1086:conversational-confirmation-answers",
+ "heading": "Conversational confirmation answers",
+ "primaryDisposition": "always_agent_tool",
+ "semanticOperation": "call_api",
+ "expectedMockState": "operation_result"
+ },
{
"id": "skill:skills/paperclip/references/api-reference.md:1092",
"kind": "skill_heading",
@@ -830,72 +848,72 @@
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1448",
+ "id": "skill:skills/paperclip/references/api-reference.md:1449",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1448:companies-projects-goals",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1449:companies-projects-goals",
"heading": "Companies, Projects, Goals",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1472",
+ "id": "skill:skills/paperclip/references/api-reference.md:1473",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1472:routines",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1473:routines",
"heading": "Routines",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1488",
+ "id": "skill:skills/paperclip/references/api-reference.md:1489",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1488:approvals-costs-activity-dashboard",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1489:approvals-costs-activity-dashboard",
"heading": "Approvals, Costs, Activity, Dashboard",
"primaryDisposition": "control_plane_owned",
"semanticOperation": "runtime_reconciliation",
"expectedMockState": "runtime_decision_record"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1510",
+ "id": "skill:skills/paperclip/references/api-reference.md:1511",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1510:secrets",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1511:secrets",
"heading": "Secrets",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1523",
+ "id": "skill:skills/paperclip/references/api-reference.md:1524",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1523:agent-secret-proposals",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1524:agent-secret-proposals",
"heading": "Agent secret proposals",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1576",
+ "id": "skill:skills/paperclip/references/api-reference.md:1577",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1576:re-bind-an-existing-secret-under-a-new-path-no-secret-id",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1577:re-bind-an-existing-secret-under-a-new-path-no-secret-id",
"heading": "Re-bind an existing secret under a new path (no secret ID)",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1623",
+ "id": "skill:skills/paperclip/references/api-reference.md:1624",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1623:agent-secret-access",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1624:agent-secret-access",
"heading": "Agent secret access",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
"expectedMockState": "operation_result"
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:1663",
+ "id": "skill:skills/paperclip/references/api-reference.md:1664",
"kind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md#L1663:common-mistakes",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md#L1664:common-mistakes",
"heading": "Common Mistakes",
"primaryDisposition": "optional_agent_tool",
"semanticOperation": "scoped_discovery",
diff --git a/packages/paperclip-runner/generated/capability/capability-contract.md b/packages/paperclip-runner/generated/capability/capability-contract.md
index a4d6c2d6d5f..254f1c40869 100644
--- a/packages/paperclip-runner/generated/capability/capability-contract.md
+++ b/packages/paperclip-runner/generated/capability/capability-contract.md
@@ -2,9 +2,9 @@
Generated by `scripts/generate-capability-contract.mjs`; do not edit generated files.
-- Skill/reference headings: 156
+- Skill/reference headings: 158
- Legacy MCP tools: 42
- Eval cases: 106 across 16 groups
-- Deterministic content SHA-256: `3a651e198c543b747fb4abb78e6a2b4ece3082bfc9941de5095cccd707d04b13`
+- Deterministic content SHA-256: `60255e688c2b172a02979b4bd305ec089c9ad93b6d4eb4ffae59051a60170d7e`
Every row has exactly one primary disposition, a source anchor, a semantic operation, and a mock-state expectation.
diff --git a/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json b/packages/paperclip-runner/generated/capability/semantic-tool-contracts.json
index 9ca2c4ba8d1..388e842c3fb 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 infer answers, answer your own card, or treat clarification as approval. 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 substitute call_api. Use payload.questions for choices and payload.questionSet for text fields; see the payload schema for formats.","inputSchema":{"additionalProperties":false,"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 interactionKind='questions', use version:1 and questions:[{id,prompt,selectionMode:'single'|'multi',required?,options:[{id,label,description?,freeText?}]}]. Choice questions need at least two distinct meaningful options. For an open-ended text answer, ALSO include questionSet:{schema:'paperclip.question_set.v1',questions:[{id,prompt,answerMode:'text',required?}]} with no options or customAnswer in its text questions. Keep matching IDs/prompts in both arrays; the required compatibility questions entry uses selectionMode:'single' and options:[{id:'describe',label:'Your answer',freeText:true}]. Without questionSet this incorrectly renders as a one-option choice. Never use a lone Other or describe option as the presentation. Option keys are id/label, not value. For confirmation, payload may be {}. Keep IDs stable across retries.","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":"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":"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":"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":"Inspect available company projects before selecting a project for new work.","inputSchema":{"additionalProperties":false,"properties":{},"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":"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 payload.questions for choices and payload.questionSet for text fields; see the payload schema for formats.","inputSchema":{"additionalProperties":false,"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 interactionKind='questions', use version:1 and questions:[{id,prompt,selectionMode:'single'|'multi',required?,options:[{id,label,description?,freeText?}]}]. Choice questions need at least two distinct meaningful options. For an open-ended text answer, ALSO include questionSet:{schema:'paperclip.question_set.v1',questions:[{id,prompt,answerMode:'text',required?}]} with no options or customAnswer in its text questions. Keep matching IDs/prompts in both arrays; the required compatibility questions entry uses selectionMode:'single' and options:[{id:'describe',label:'Your answer',freeText:true}]. Without questionSet this incorrectly renders as a one-option choice. Never use a lone Other or describe option as the presentation. Option keys are id/label, not value. For confirmation, payload may be {}. Keep IDs stable across retries.","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":"Inspect available company projects before selecting a project for new work.","inputSchema":{"additionalProperties":false,"properties":{},"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"}}]
diff --git a/packages/paperclip-runner/package.json b/packages/paperclip-runner/package.json
index ebc0614e39e..596b74ad881 100644
--- a/packages/paperclip-runner/package.json
+++ b/packages/paperclip-runner/package.json
@@ -74,7 +74,7 @@
"typecheck:browser": "tsc -p tsconfig.browser.json --noEmit",
"test": "pnpm run test:typescript && pnpm run test:rust",
"test:typescript": "pnpm run test:typescript:prep && vitest run",
- "test:typescript:prep": "pnpm run ensure:eval-build-deps && pnpm run build:rust && node --test test/protocol-contract.test.mjs test/acpx-sidecar-contract.test.mjs test/acpx-codex-package-contract.test.mjs scripts/aws-agentcore-provisioning.test.mjs scripts/build-verified-provider-entrypoints.test.mjs scripts/local-provider-smoke-environment.test.mjs scripts/materialize-opencode-binary.test.mjs",
+ "test:typescript:prep": "pnpm run ensure:eval-build-deps && pnpm run build:rust && node --test test/protocol-contract.test.mjs test/acpx-sidecar-contract.test.mjs test/acpx-codex-package-contract.test.mjs test/acpx-rich-extensions-package-contract.test.mjs test/acpx-pi-receipt-package-contract.test.mjs test/acpx-response-delivery-package-contract.test.mjs scripts/candidate-provider-pack.test.mjs scripts/aws-agentcore-provisioning.test.mjs scripts/build-verified-provider-entrypoints.test.mjs scripts/local-provider-smoke-environment.test.mjs scripts/materialize-opencode-binary.test.mjs",
"test:typescript:vitest": "node ./scripts/run-pr-vitest-lane.mjs",
"test:rust": "cargo test --release --manifest-path runner/Cargo.toml --locked --workspace",
"test:codex": "cargo test --manifest-path runner/Cargo.toml --locked -p paperclip-runner-core --test codex_provider",
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 74e4b4be817..98f7e9ea5c3 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:a19534304480dfd3d357cc902e785af05158ce1496f4d324184112732ff94c9c",
+ "catalogSha256": "sha256:994cf391ef851c37a4815db38368aa97bd3830def50218b2ffe9428966fc994f",
"driverContractVersion": 1,
"driverKind": "paperclip-deterministic",
"driverVersion": "1.0.0"
diff --git a/packages/paperclip-runner/protocol/manifest.json b/packages/paperclip-runner/protocol/manifest.json
index bd8c300f1d9..41febfb9b1b 100644
--- a/packages/paperclip-runner/protocol/manifest.json
+++ b/packages/paperclip-runner/protocol/manifest.json
@@ -40,7 +40,7 @@
{
"path": "schemas/event-v2.schema.json",
"id": "https://paperclip.dev/schemas/prp/v2/event.schema.json",
- "sha256": "d7528ee2a46ad20de831fd4ee4a0a51e8325a9855fed5a9b8c428dcebc39cc11"
+ "sha256": "9dcf149bdb8e10041ca2212037231e7ceff11be08a0b8ee5dbd0f21974daa294"
},
{
"path": "schemas/event.schema.json",
@@ -65,12 +65,12 @@
{
"path": "schemas/provider-descriptor.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/provider-descriptor.schema.json",
- "sha256": "a56c0c8501171c34bb72f6fba08d3872839a8b45bbc10daa93620afc9dc2b669"
+ "sha256": "f5badf70748d6a761a3487f001ce8282582b161cb5b80fabb6bb5f683d28c512"
},
{
"path": "schemas/provider-event.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/provider-event.schema.json",
- "sha256": "0b138a41bd3bd0b1a115f5536a2d7349537e79e36ede3b51d003f9f21ce73b50"
+ "sha256": "14143d53f28969fa3f940def7331a45ee0eed560dd343506ac41b6a3dfe59985"
},
{
"path": "schemas/question-adapter-fixture.schema.json",
@@ -85,12 +85,12 @@
{
"path": "schemas/question-set.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/question-set.schema.json",
- "sha256": "42b5441a3d388851dacb6e4500dfd4a17d878eded2e724228078b647e7440d3f"
+ "sha256": "6aeb2b880a60356cb48acfe26605acd9412a1df65f5308397d3ec521db5ea70f"
},
{
"path": "schemas/request.schema.json",
"id": "https://paperclip.dev/schemas/prp/v1/request.schema.json",
- "sha256": "c8d00e10150c90963f19641c075f50da7f67617dd817f41b356287ad85c53f2b"
+ "sha256": "985a3b0a6ae36ae5ad4cf7d708dc401db7c108f683a81cd44a03093fc4ca7862"
},
{
"path": "schemas/result.schema.json",
@@ -160,7 +160,7 @@
},
{
"path": "fixtures/evals/native-execution-seeded.json",
- "sha256": "c6367c7c7e3dd01fed341b7a83b0008c9d5d1efdfa85bc70e1013bc304a008c7",
+ "sha256": "076427778f1ecced927c0680ab3d59e52e06d3e680a610bee3af6fd0795b6a8c",
"expectation": "accept",
"compatibilityCase": "canonical"
},
diff --git a/packages/paperclip-runner/protocol/provider-schemas/acpx-sidecar.schema.json b/packages/paperclip-runner/protocol/provider-schemas/acpx-sidecar.schema.json
index b4b286f4f0d..1d285c52add 100644
--- a/packages/paperclip-runner/protocol/provider-schemas/acpx-sidecar.schema.json
+++ b/packages/paperclip-runner/protocol/provider-schemas/acpx-sidecar.schema.json
@@ -16,6 +16,7 @@
"run.attach",
"turn.start",
"turn.cancel",
+ "turn.steer",
"permission.resolve",
"input.resolve",
"tool.resolve",
@@ -31,6 +32,7 @@
"eventType": {
"enum": [
"runtime.event",
+ "runtime.rich_event",
"runtime.permission_requested",
"runtime.input_requested",
"runtime.tool_called",
@@ -49,7 +51,11 @@
"command": { "$ref": "#/$defs/command" },
"params": { "type": "object" }
},
- "additionalProperties": false
+ "additionalProperties": false,
+ "allOf": [{
+ "if": { "properties": { "command": { "const": "turn.steer" } } },
+ "then": { "properties": { "params": { "$ref": "#/$defs/turnControl" } } }
+ }]
},
"response": {
"type": "object",
@@ -108,6 +114,102 @@
"turnId": { "type": ["string", "null"], "maxLength": 240, "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$" },
"payload": { "type": "object" }
},
+ "additionalProperties": false,
+ "allOf": [
+ {
+ "if": { "properties": { "eventType": { "const": "runtime.rich_event" } } },
+ "then": {
+ "properties": {
+ "runId": { "type": "string" },
+ "turnId": { "type": "string" },
+ "payload": { "$ref": "#/$defs/richEvent" }
+ }
+ }
+ }
+ ]
+ },
+ "richEvent": {
+ "type": "object",
+ "required": [
+ "eventType",
+ "itemId",
+ "payload"
+ ],
+ "properties": {
+ "eventType": {
+ "enum": [
+ "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"
+ ]
+ },
+ "itemId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160,
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
+ },
+ "payload": {
+ "type": "object"
+ }
+ },
+ "additionalProperties": false
+ },
+ "turnControl": {
+ "type": "object",
+ "required": [
+ "turnId",
+ "controlId",
+ "mode",
+ "message"
+ ],
+ "properties": {
+ "turnId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240,
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
+ },
+ "controlId": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 160,
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
+ },
+ "mode": {
+ "enum": [
+ "steer",
+ "follow_up"
+ ]
+ },
+ "message": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 65536
+ }
+ },
"additionalProperties": false
}
}
diff --git a/packages/paperclip-runner/protocol/schemas/event-v2.schema.json b/packages/paperclip-runner/protocol/schemas/event-v2.schema.json
index 8cfc4558de7..0b1ba05ce1b 100644
--- a/packages/paperclip-runner/protocol/schemas/event-v2.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/event-v2.schema.json
@@ -74,7 +74,8 @@
"type": "object",
"required": ["sessionGoals"],
"properties": {
- "sessionGoals": { "$ref": "https://paperclip.dev/schemas/prp/v2/session-goal.schema.json#/$defs/capability" }
+ "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
}
diff --git a/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json b/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
index 53c174d9832..9cd3470da08 100644
--- a/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/provider-descriptor.schema.json
@@ -18,14 +18,15 @@
"endpointQualifier": { "type": "string", "minLength": 1, "maxLength": 240 },
"memoryId": { "type": "string", "minLength": 1, "maxLength": 240 },
"eventExpiryDays": { "const": 90 },
- "agent": { "enum": ["pi", "claude", "codex"] },
+ "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 }
+ "acpxRecordId": { "type": ["string", "null"], "maxLength": 240 },
+ "turnControls": { "$ref": "#/$defs/turnControls" }
},
"allOf": [
{
@@ -96,5 +97,16 @@
}
}
],
+ "$defs": {
+ "turnControls": {
+ "type": "object",
+ "required": ["steering", "queuedFollowUp"],
+ "properties": {
+ "steering": { "type": "boolean" },
+ "queuedFollowUp": { "type": "boolean" }
+ },
+ "additionalProperties": false
+ }
+ },
"additionalProperties": false
}
diff --git a/packages/paperclip-runner/protocol/schemas/provider-event.schema.json b/packages/paperclip-runner/protocol/schemas/provider-event.schema.json
index 110f0ede5c4..07c5de62701 100644
--- a/packages/paperclip-runner/protocol/schemas/provider-event.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/provider-event.schema.json
@@ -162,7 +162,7 @@
"providerNotice": {
"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" } },
+ "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
}
}
diff --git a/packages/paperclip-runner/protocol/schemas/question-set.schema.json b/packages/paperclip-runner/protocol/schemas/question-set.schema.json
index a1bec0e67fd..5921ad34467 100644
--- a/packages/paperclip-runner/protocol/schemas/question-set.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/question-set.schema.json
@@ -7,7 +7,7 @@
"properties": {
"schema": { "const": "paperclip.question_set.v1" },
"title": { "type": "string", "maxLength": 1000 },
- "description": { "type": "string", "maxLength": 4000 },
+ "description": { "type": "string", "maxLength": 100000 },
"submitLabel": { "type": "string", "maxLength": 200 },
"questions": {
"type": "array",
diff --git a/packages/paperclip-runner/protocol/schemas/request.schema.json b/packages/paperclip-runner/protocol/schemas/request.schema.json
index 83a741ef446..ec475dbac1a 100644
--- a/packages/paperclip-runner/protocol/schemas/request.schema.json
+++ b/packages/paperclip-runner/protocol/schemas/request.schema.json
@@ -3,6 +3,181 @@
"$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"],
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs
index 7ab36472b12..677f3d836e4 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_event_payload.rs
@@ -1,15 +1,19 @@
-use std::collections::BTreeSet;
+use std::collections::{BTreeMap, BTreeSet};
+use std::sync::OnceLock;
use serde_json::Value;
use crate::acpx_event_scope::AcpxEventScope;
use crate::acpx_sidecar_transport::AcpxSidecarEvent;
-use crate::durable::{redact_text, sanitize_semantic_tool_input, sanitize_value};
+use crate::durable::{
+ redact_sensitive_text_values, redact_text, sanitize_semantic_tool_input, sanitize_value,
+};
use crate::generated_acpx_sidecar_contract::{
classify_generated_acpx_tool_operation, GeneratedAcpxSidecarEventType,
};
use crate::local_runner::LocalRunnerError;
use crate::provider_bridge::semantic_value_digest;
+use crate::stable_identity::{is_stable_id, SHORT_STABLE_ID_CHARS};
const MAX_EVENT_PAYLOAD_BYTES: usize = 256 * 1024;
const MAX_ID_CHARS: usize = 160;
@@ -40,6 +44,10 @@ pub enum AcpxTurnStatus {
#[derive(Clone, Debug, PartialEq)]
pub enum AcpxEventPayload {
+ RichActivity {
+ event_type: String,
+ payload: Value,
+ },
Runtime {
kind: AcpxRuntimeEventKind,
tool_operation: Option<&'static str>,
@@ -95,6 +103,7 @@ pub fn decode_acpx_event(
}
match event.event_type {
+ GeneratedAcpxSidecarEventType::RuntimeRichEvent => decode_rich_event(&event.payload),
GeneratedAcpxSidecarEventType::RuntimeEvent => decode_runtime_event(&event.payload),
GeneratedAcpxSidecarEventType::RuntimePermissionRequested => {
Ok(AcpxEventPayload::PermissionRequested {
@@ -113,7 +122,7 @@ pub fn decode_acpx_event(
LocalRunnerError::invalid("ACPX input request omitted its question set")
})?;
validate_question_set(&question_set)?;
- let question_set = sanitize_question_set(question_set);
+ let question_set = sanitize_question_set(question_set)?;
let origin = optional_object(&event.payload, "origin", "input request origin")?;
Ok(AcpxEventPayload::InputRequested {
request_id: required_id_with_limit(
@@ -192,9 +201,173 @@ pub fn decode_acpx_event(
}
}
-fn sanitize_question_set(mut value: Value) -> Value {
+// This boundary accepts display activity only. Terminal outcomes, tool dispatch,
+// runtime requests and source references retain their separate authority paths.
+fn rich_event_schema(event_type: &str) -> Option<&'static str> {
+ Some(match event_type {
+ "plan.updated" => "plan",
+ "tool.execution.started" | "tool.execution.progressed" | "tool.execution.completed" => {
+ "toolExecution"
+ }
+ "research.started" | "research.progressed" | "research.completed" => "research",
+ "delegation.started" | "delegation.updated" | "delegation.completed" => "delegation",
+ "model.route.changed" => "modelRoute",
+ "model.verification.updated" => "modelVerification",
+ "context.compacted" => "contextCompacted",
+ "artifact.viewed" => "artifactViewed",
+ "artifact.generated" => "artifactGenerated",
+ "review.mode.changed" => "reviewMode",
+ "hook.started" | "hook.completed" => "hook",
+ "memory.citation.referenced" => "memoryCitation",
+ "safety.review.started" | "safety.review.completed" => "safetyReview",
+ "terminal.input.sent" => "terminalInput",
+ "wait.started" | "wait.completed" => "wait",
+ "provider.notice.recorded" => "providerNotice",
+ _ => return None,
+ })
+}
+
+fn rich_event_validators(
+) -> Result<&'static BTreeMap, LocalRunnerError> {
+ static VALIDATORS: OnceLock, String>> =
+ OnceLock::new();
+ VALIDATORS.get_or_init(|| {
+ let schema: Value = serde_json::from_str(include_str!("../../../../protocol/schemas/provider-event.schema.json"))
+ .map_err(|_| "embedded provider-event schema is invalid".to_owned())?;
+ fn internal_refs(value: &Value) -> bool {
+ match value {
+ Value::Object(object) => object.iter().all(|(key, value)| {
+ (key != "$ref" || value.as_str().is_some_and(|reference| reference.starts_with("#/"))) && internal_refs(value)
+ }),
+ Value::Array(values) => values.iter().all(internal_refs),
+ _ => true,
+ }
+ }
+ if !internal_refs(&schema) { return Err("provider-event schema may use only internal references".to_owned()); }
+ let definitions = schema.get("$defs").and_then(Value::as_object).ok_or_else(|| "provider-event schema has no definitions".to_owned())?;
+ let mut validators = BTreeMap::new();
+ for name in ["plan", "toolExecution", "research", "delegation", "modelRoute", "modelVerification", "contextCompacted", "artifactViewed", "artifactGenerated", "reviewMode", "hook", "memoryCitation", "safetyReview", "terminalInput", "wait", "providerNotice"] {
+ if !definitions.contains_key(name) { return Err("provider-event schema is missing an admitted definition".to_owned()); }
+ let selected = serde_json::json!({"$schema":"https://json-schema.org/draft/2020-12/schema", "$ref":format!("#/$defs/{name}"), "$defs":definitions});
+ let validator = jsonschema::validator_for(&selected).map_err(|_| "embedded provider-event schema cannot compile".to_owned())?;
+ validators.insert(name.to_owned(), validator);
+ }
+ Ok(validators)
+ }).as_ref().map_err(|message| LocalRunnerError::invalid(message.clone()))
+}
+
+fn decode_rich_event(value: &Value) -> Result {
+ let wrapper = value
+ .as_object()
+ .ok_or_else(|| LocalRunnerError::invalid("ACPX rich event must be an object"))?;
+ if wrapper
+ .keys()
+ .any(|key| !matches!(key.as_str(), "eventType" | "itemId" | "payload"))
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX rich event cannot supply source references or authority fields",
+ ));
+ }
+ let item_id = wrapper
+ .get("itemId")
+ .and_then(Value::as_str)
+ .ok_or_else(|| LocalRunnerError::invalid("ACPX rich event omitted its display identity"))?;
+ if !is_stable_id(item_id, SHORT_STABLE_ID_CHARS) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX rich event display identity is invalid",
+ ));
+ }
+ let event_type = wrapper
+ .get("eventType")
+ .and_then(Value::as_str)
+ .ok_or_else(|| LocalRunnerError::invalid("ACPX rich event omitted its type"))?;
+ let schema = rich_event_schema(event_type).ok_or_else(|| {
+ LocalRunnerError::invalid("ACPX rich event type is not admitted display activity")
+ })?;
+ let payload = wrapper
+ .get("payload")
+ .ok_or_else(|| LocalRunnerError::invalid("ACPX rich event omitted its payload"))?;
+ let validators = rich_event_validators()?;
+ let validator = validators
+ .get(schema)
+ .ok_or_else(|| LocalRunnerError::invalid("ACPX rich event schema is unavailable"))?;
+ if !validator.is_valid(payload) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX rich event failed its exact provider-event schema",
+ ));
+ }
+ if event_type == "artifact.generated" && payload.get("registered") != Some(&Value::Bool(false))
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX display activity cannot register an artifact",
+ ));
+ }
+ if event_type == "plan.updated"
+ && (payload.get("syncStatus").and_then(Value::as_str) != Some("not_applicable")
+ || payload
+ .get("documentRevision")
+ .is_some_and(|revision| !revision.is_null()))
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX display activity cannot synchronize a durable plan",
+ ));
+ }
+ for field in ["reference", "target"] {
+ if payload
+ .get(field)
+ .and_then(Value::as_str)
+ .is_some_and(|path| {
+ path.contains('\\') || path.contains(':') || path.chars().any(char::is_control)
+ })
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX activity reference must be a workspace-relative path",
+ ));
+ }
+ }
+ fn sanitize_display(value: &Value) -> Value {
+ match value {
+ Value::String(text) => Value::String(redact_sensitive_text_values(text)),
+ Value::Array(values) => Value::Array(values.iter().map(sanitize_display).collect()),
+ Value::Object(object) => Value::Object(
+ object
+ .iter()
+ .map(|(key, value)| (key.clone(), sanitize_display(value)))
+ .collect(),
+ ),
+ value => value.clone(),
+ }
+ }
+ let payload = sanitize_display(payload);
+ if !validator.is_valid(&payload) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX rich event redaction exceeded its schema bounds",
+ ));
+ }
+ Ok(AcpxEventPayload::RichActivity {
+ event_type: event_type.to_owned(),
+ payload,
+ })
+}
+
+// Durable storage uses this same exact schema gate before lifting diagnostic
+// preview limits. This does not admit an event or grant mutation authority.
+pub(crate) fn has_bounded_rich_display_shape(event_type: &str, payload: &Value) -> bool {
+ let Some(schema) = rich_event_schema(event_type) else {
+ return false;
+ };
+ serde_json::to_vec(payload).is_ok_and(|bytes| bytes.len() <= MAX_EVENT_PAYLOAD_BYTES)
+ && rich_event_validators().is_ok_and(|validators| {
+ validators
+ .get(schema)
+ .is_some_and(|validator| validator.is_valid(payload))
+ })
+}
+
+fn sanitize_question_set(mut value: Value) -> Result {
+ let original = value.clone();
let Some(question_set) = value.as_object_mut() else {
- return value;
+ return Ok(value);
};
redact_object_text(question_set, &["title", "description", "submitLabel"]);
if let Some(questions) = question_set
@@ -223,7 +396,17 @@ fn sanitize_question_set(mut value: Value) -> Value {
}
}
}
- value
+ if value != original {
+ let description = value
+ .get("description")
+ .and_then(Value::as_str)
+ .unwrap_or("");
+ value["description"] = Value::String(format!(
+ "Sensitive values were redacted from this request.\n\n{description}"
+ ));
+ }
+ validate_question_set(&value)?;
+ Ok(value)
}
fn redact_object_text(object: &mut serde_json::Map, keys: &[&str]) {
@@ -231,7 +414,7 @@ fn redact_object_text(object: &mut serde_json::Map, keys: &[&str]
let Some(text) = object.get(*key).and_then(Value::as_str) else {
continue;
};
- let redacted = redact_text(text);
+ let redacted = redact_sensitive_text_values(text);
object.insert((*key).to_owned(), Value::String(redacted));
}
}
@@ -397,7 +580,16 @@ fn validate_plan(payload: &Value) -> Result<(), LocalRunnerError> {
Ok(())
}
-fn validate_question_set(value: &Value) -> Result<(), LocalRunnerError> {
+pub(crate) fn validate_question_set(value: &Value) -> Result<(), LocalRunnerError> {
+ if serde_json::to_vec(value)
+ .map_err(|_| LocalRunnerError::invalid("ACPX question set is invalid"))?
+ .len()
+ > 196 * 1024
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX question set exceeds its 196 KiB durable byte bound",
+ ));
+ }
let schema: Value = serde_json::from_str(include_str!(
"../../../../protocol/schemas/question-set.schema.json"
))
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 626deef153c..c2408ec731a 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
@@ -1,4 +1,4 @@
-use std::collections::{HashMap, HashSet, VecDeque};
+use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
use std::fs::{self, DirBuilder, File};
use std::io::{Read, Write};
use std::net::TcpListener;
@@ -10,11 +10,11 @@ use std::os::unix::fs::{DirBuilderExt, PermissionsExt};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
-#[cfg(test)]
use sha2::{Digest, Sha256};
use crate::acpx_provider_session::{
- AcpxPermissionMode, AcpxProviderSession, AcpxProviderSessionConfig, AcpxProviderSessionIdentity,
+ AcpxPermissionMode, AcpxProviderRuntimePolicy, AcpxProviderSession, AcpxProviderSessionConfig,
+ AcpxProviderSessionIdentity, AcpxTurnControlCapabilities,
};
use crate::acpx_sidecar_transport::AcpxSidecarTransportConfig;
#[cfg(test)]
@@ -137,6 +137,8 @@ struct AcpxProviderDescriptor {
permission_mode: AcpxPermissionMode,
permission_mode_pinned: bool,
#[serde(default)]
+ provider_policy: Option,
+ #[serde(default)]
runtime_context: Value,
}
@@ -162,6 +164,30 @@ impl AcpxProviderDescriptor {
Some("0.156.0"),
"sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3",
),
+ "pi" => (
+ "openrouter/deepseek/deepseek-v4-flash-0731",
+ "pi-acp",
+ "0.0.33",
+ Some("@earendil-works/pi-coding-agent"),
+ Some("0.84.2"),
+ "sha256:8c696f38296d53d0061fa11534570c5ddd951b63532aed30e0f1fcc676dc169f",
+ ),
+ "cursor" => (
+ self.model.as_str(),
+ "cursor-agent",
+ "2026.09.26-dd393fe",
+ None,
+ None,
+ "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899",
+ ),
+ "copilot" => (
+ self.model.as_str(),
+ "@github/copilot",
+ "1.0.88",
+ None,
+ None,
+ "sha256:b18c01603dd0169d233140709cfaa8bf5304a03cf5de78ca4f625f30013e8457",
+ ),
"grok" => (
"grok-4.7",
"builtin:grok-acp",
@@ -170,12 +196,9 @@ impl AcpxProviderDescriptor {
Some("1.0.13"),
"sha256:f0b698395a3704ed2ffaf84ea19bdb20c36c8a0a70b7c629c7b6ffe144e59e55",
),
- "pi" => return Err(DurableRunnerError::invalid(
- "ACPX agent pi is not executable through the verified runnerd provider boundary",
- )),
_ => {
return Err(DurableRunnerError::invalid(
- "ACPX agent must be a qualified claude or codex profile",
+ "ACPX agent must name a known immutable profile",
))
}
};
@@ -186,7 +209,10 @@ impl AcpxProviderDescriptor {
|| self.acpx_version != "0.13.1"
|| (self.agent != "claude" && self.agent != "grok" && self.model != expected.0)
|| self.model.trim().is_empty()
- || self.model.len() > 1024
+ || self.model.len() > 240
+ || self.model.contains('\0')
+ || (matches!(self.agent.as_str(), "pi" | "cursor" | "copilot")
+ && self.provider_policy.is_none())
|| self.agent_server_package != expected.1
|| self.agent_server_version != expected.2
|| self.agent_runtime_package.as_deref() != expected.3
@@ -281,6 +307,7 @@ impl AcpxProviderDescriptor {
working_directory: PathBuf::from(&self.cwd),
permission_mode: self.permission_mode,
permission_mode_pinned: self.permission_mode_pinned,
+ provider_policy: self.provider_policy.clone(),
system_instructions: self.instructions.clone(),
runtime_context: self.runtime_context.clone(),
tool_set: provider_tool_set,
@@ -395,17 +422,23 @@ struct AcpxDurableState {
#[serde(default)]
active_turn_id: Option,
#[serde(default)]
+ attempted_turn_controls: HashSet,
+ #[serde(default)]
provider_exit_unconfirmed: bool,
#[serde(default)]
semantic_result: Option,
#[serde(default)]
goal_projection: Value,
#[serde(default)]
+ turn_controls: AcpxTurnControlCapabilities,
+ #[serde(default)]
goal_revision: u64,
#[serde(default)]
goal_source_revision: Option,
#[serde(default)]
pending_events: VecDeque,
+ #[serde(default)]
+ pending_runtime_requests: BTreeMap,
#[serde(default = "initial_event_sequence")]
next_event_sequence: u64,
}
@@ -424,12 +457,15 @@ impl AcpxDurableState {
tool_set,
identity: None,
active_turn_id: None,
+ attempted_turn_controls: HashSet::new(),
provider_exit_unconfirmed: false,
semantic_result: None,
goal_projection: Value::Null,
+ turn_controls: AcpxTurnControlCapabilities::default(),
goal_revision: 0,
goal_source_revision: None,
pending_events: VecDeque::new(),
+ pending_runtime_requests: BTreeMap::new(),
next_event_sequence: initial_event_sequence(),
}
}
@@ -450,6 +486,7 @@ impl AcpxDurableState {
"ACPX durable launch profile digest does not match runner startup",
));
}
+ validate_pending_runtime_requests(&self.pending_runtime_requests)?;
let mut ids = HashSet::new();
if self.schema != ACPX_PROVIDER_STATE_SCHEMA
|| self.launch_profile_digest.len() != 71
@@ -464,6 +501,12 @@ impl AcpxDurableState {
| "closed"
)
|| self.next_event_sequence == 0
+ || self.attempted_turn_controls.len() > 1024
+ || self
+ .attempted_turn_controls
+ .iter()
+ .any(|id| !is_stable_id(id, 160))
+ || (!self.pending_runtime_requests.is_empty() && self.active_turn_id.is_none())
|| self.pending_events.len() > MAX_PENDING_EVENTS
|| self.pending_events.iter().any(|event| {
event_sequence(&event.executor_event_id)
@@ -501,16 +544,81 @@ impl AcpxDurableState {
Ok(())
}
+ fn expire_runtime_requests(
+ &mut self,
+ reason: &str,
+ cancelled: bool,
+ ) -> Result<(), DurableRunnerError> {
+ for request in self
+ .pending_runtime_requests
+ .values()
+ .cloned()
+ .collect::>()
+ {
+ let input = request.get("type").and_then(Value::as_str) == Some("input");
+ let mut payload = json!({
+ "provider":"acpx", "requestId":request["requestId"],
+ "requestKind":request["requestKind"], "requestType":request["type"],
+ "turnId":request["turnId"], "itemId":request["itemId"],
+ "reason":reason, "replayAllowed":false, "adapter":"acpx-runtime-sidecar",
+ });
+ if input {
+ payload["request"] = request;
+ }
+ self.push(NormalizedProviderEvent {
+ event_type: if cancelled {
+ "runtime_request.cancelled"
+ } else {
+ "runtime_request.expired"
+ }
+ .to_owned(),
+ priority: EventPriority::P0,
+ payload,
+ })?;
+ }
+ Ok(())
+ }
+
fn push(&mut self, event: NormalizedProviderEvent) -> Result<(), DurableRunnerError> {
if self.pending_events.len() >= MAX_PENDING_EVENTS {
return Err(DurableRunnerError::invalid(
"ACPX provider event backlog exceeds its durable limit",
));
}
+ // Check every fallible admission condition before changing the request
+ // ledger. A rejected settlement must leave its pending request intact.
let sequence = self.next_event_sequence;
- self.next_event_sequence = sequence
+ let next_sequence = sequence
.checked_add(1)
.ok_or_else(|| DurableRunnerError::invalid("ACPX event sequence exhausted"))?;
+ if event.event_type == "runtime_request.created" {
+ let request = event.payload.get("request").cloned().ok_or_else(|| {
+ DurableRunnerError::invalid("ACPX runtime request omitted its payload")
+ })?;
+ let request_id = request
+ .get("requestId")
+ .and_then(Value::as_str)
+ .ok_or_else(|| {
+ DurableRunnerError::invalid("ACPX runtime request omitted its identity")
+ })?
+ .to_owned();
+ let mut next = self.pending_runtime_requests.clone();
+ if next.insert(request_id, request).is_some() {
+ return Err(DurableRunnerError::invalid(
+ "ACPX runtime request reused a pending durable identity",
+ ));
+ }
+ validate_pending_runtime_requests(&next)?;
+ self.pending_runtime_requests = next;
+ } else if matches!(
+ event.event_type.as_str(),
+ "runtime_request.resolved" | "runtime_request.expired" | "runtime_request.cancelled"
+ ) {
+ if let Some(id) = event.payload.get("requestId").and_then(Value::as_str) {
+ self.pending_runtime_requests.remove(id);
+ }
+ }
+ self.next_event_sequence = next_sequence;
self.pending_events.push_back(PolledEvent {
executor_event_id: event_id(sequence),
event_type: event.event_type,
@@ -521,6 +629,53 @@ impl AcpxDurableState {
}
}
+fn validate_pending_runtime_requests(
+ requests: &BTreeMap,
+) -> Result<(), DurableRunnerError> {
+ if requests.len() > 1024
+ || serde_json::to_vec(requests).map_or(true, |bytes| bytes.len() > 8 * 1024 * 1024)
+ {
+ return Err(DurableRunnerError::invalid(
+ "ACPX durable runtime request ledger exceeds its bound",
+ ));
+ }
+ for (id, request) in requests {
+ let input = request.get("type").and_then(Value::as_str) == Some("input");
+ if !is_stable_id(id, 160)
+ || request.get("requestId").and_then(Value::as_str) != Some(id)
+ || request.get("schema").and_then(Value::as_str) != Some("paperclip.runtime_request.v2")
+ || request.get("status").and_then(Value::as_str) != Some("pending")
+ || request.get("requestKind").and_then(Value::as_str)
+ != Some(if input {
+ "runtime"
+ } else {
+ "permission_approval"
+ })
+ || (!input && request.get("type").and_then(Value::as_str) != Some("permission"))
+ || ["turnId", "itemId"].iter().any(|field| {
+ request
+ .get(field)
+ .and_then(Value::as_str)
+ .is_none_or(|value| !is_stable_id(value, DURABLE_STABLE_ID_CHARS))
+ })
+ || (input
+ && request.pointer("/input/schema").and_then(Value::as_str)
+ != Some("paperclip.question_set.v1"))
+ || (!input && request.get("input").is_some())
+ || serde_json::to_vec(request).map_or(true, |bytes| bytes.len() > 256 * 1024)
+ {
+ return Err(DurableRunnerError::invalid(
+ "ACPX durable runtime request ledger has an invalid identity or type",
+ ));
+ }
+ if input {
+ crate::acpx_event_payload::validate_question_set(&request["input"])
+ .map_err(|error| DurableRunnerError::invalid(error.to_string()))?;
+ }
+ }
+ Ok(())
+}
+
pub struct AcpxCommandExecutor {
state_dir: PathBuf,
context: AcpxEventProjectionContext,
@@ -528,6 +683,9 @@ pub struct AcpxCommandExecutor {
session: Option,
restore_checked: bool,
restore_error: Option,
+ persistence_error: Option,
+ #[cfg(test)]
+ fail_after_state_rename: bool,
launch_profile: Option,
}
@@ -546,6 +704,9 @@ impl AcpxCommandExecutor {
session: None,
restore_checked: false,
restore_error: None,
+ persistence_error: None,
+ #[cfg(test)]
+ fail_after_state_rename: false,
launch_profile: config.acpx_launch_profile.clone(),
}
}
@@ -566,6 +727,7 @@ impl AcpxCommandExecutor {
}
fn restore(&mut self) -> Result<(), DurableRunnerError> {
+ self.ensure_persistence_healthy()?;
if self.restore_checked {
return Ok(());
}
@@ -648,6 +810,7 @@ impl AcpxCommandExecutor {
.state
.as_mut()
.expect("ACPX state remains available during recovery");
+ state.expire_runtime_requests("provider_process_lost", false)?;
state.lifecycle = "closed".to_owned();
state.active_turn_id = None;
state.provider_exit_unconfirmed = true;
@@ -681,15 +844,17 @@ impl AcpxCommandExecutor {
let session = self.start_session(true)?;
let identity = session.identity().clone();
let process_id = session.process_id();
+ let turn_controls = session.turn_control_capabilities();
let state = self
.state
.as_mut()
.expect("ACPX state remains available during recovery");
state.lifecycle = "session_open".to_owned();
+ state.turn_controls = turn_controls;
state.push(NormalizedProviderEvent {
event_type: "session.resumed".to_owned(),
priority: EventPriority::P0,
- payload: session_event_payload(&state.descriptor, &identity, process_id),
+ payload: session_event_payload(&state.descriptor, &identity, process_id, turn_controls),
})?;
self.session = Some(session);
self.save_state()
@@ -718,11 +883,46 @@ impl AcpxCommandExecutor {
Ok(session)
}
- fn save_state(&self) -> Result<(), DurableRunnerError> {
- let state = self
+ fn ensure_persistence_healthy(&self) -> Result<(), DurableRunnerError> {
+ match self.persistence_error.as_ref() {
+ Some(error) => Err(error.clone()),
+ None => Ok(()),
+ }
+ }
+
+ fn record_state_write(
+ &mut self,
+ result: Result<(), DurableRunnerError>,
+ ) -> Result<(), DurableRunnerError> {
+ if let Err(error) = result.as_ref() {
+ // A rename may have succeeded before directory fsync or protection
+ // failed. Neither rolling back nor continuing from memory can prove
+ // which state survived. Stop publication and mutations until a fresh
+ // executor reloads the complete atomic snapshot; never resend input.
+ self.persistence_error = Some(error.clone());
+ }
+ result
+ }
+
+ fn save_state(&mut self) -> Result<(), DurableRunnerError> {
+ self.ensure_persistence_healthy()?;
+ let result = self
.state
.as_ref()
- .ok_or_else(|| DurableRunnerError::invalid("ACPX provider state is unavailable"))?;
+ .ok_or_else(|| DurableRunnerError::invalid("ACPX provider state is unavailable"))
+ .and_then(|state| self.write_state(state));
+ self.record_state_write(result)
+ }
+
+ fn commit_staged_state(&mut self, state: AcpxDurableState) -> Result<(), DurableRunnerError> {
+ self.ensure_persistence_healthy()?;
+ let result = self.write_state(&state);
+ self.record_state_write(result)?;
+ self.state = Some(state);
+ Ok(())
+ }
+
+ fn write_state(&self, state: &AcpxDurableState) -> Result<(), DurableRunnerError> {
let launch_profile_digest = self.launch_profile_digest()?;
state.validate(&self.context, &launch_profile_digest)?;
secure_directory(&self.state_dir, "provider state")?;
@@ -741,6 +941,10 @@ impl AcpxCommandExecutor {
file.sync_all()?;
drop(file);
fs::rename(&temporary, &path)?;
+ #[cfg(test)]
+ if self.fail_after_state_rename {
+ return Err(std::io::Error::other("injected post-rename sync failure"));
+ }
#[cfg(unix)]
File::open(&self.state_dir)?.sync_all()?;
Ok(())
@@ -901,6 +1105,7 @@ impl AcpxCommandExecutor {
.expect("ACPX session exists after successful start");
let identity = session.identity().clone();
let process_id = session.process_id();
+ let turn_controls = session.turn_control_capabilities();
let resumed = self
.state
.as_ref()
@@ -914,7 +1119,9 @@ impl AcpxCommandExecutor {
state.identity = Some(identity.clone());
state.active_turn_id = None;
state.lifecycle = "session_open".to_owned();
- let payload = session_event_payload(&state.descriptor, &identity, process_id);
+ state.turn_controls = turn_controls;
+ let payload =
+ session_event_payload(&state.descriptor, &identity, process_id, turn_controls);
let goal = self.goal_control("session.goal.get", &json!({}))?;
self.save_state()?;
Ok(CommandExecution {
@@ -1012,6 +1219,7 @@ impl AcpxCommandExecutor {
projection["requestId"] = request_id.clone();
}
state.goal_projection = projection.clone();
+ let turn_controls = state.turn_controls;
self.save_state()?;
let event_type = match command {
"session.goal.clear" => "session.goal.cleared",
@@ -1024,7 +1232,7 @@ impl AcpxCommandExecutor {
(
"session.capabilities.updated".to_owned(),
EventPriority::P0,
- json!({"sessionGoals":projection["sessionGoals"]}),
+ json!({"sessionGoals":projection["sessionGoals"], "turnControls":turn_controls}),
),
(event_type.to_owned(), EventPriority::P0, projection),
],
@@ -1065,6 +1273,7 @@ impl AcpxCommandExecutor {
));
}
state.active_turn_id = Some(provider_turn_id.clone());
+ state.attempted_turn_controls.clear();
state.semantic_result = None;
state.lifecycle = "turn_starting".to_owned();
}
@@ -1101,6 +1310,18 @@ impl AcpxCommandExecutor {
.as_mut()
.expect("ACPX state exists after turn start");
state.lifecycle = "turn_active".to_owned();
+ let previous_turn_controls = state.turn_controls;
+ state.turn_controls = self
+ .session
+ .as_ref()
+ .expect("live ACPX session")
+ .turn_control_capabilities();
+ // session.open already published these capabilities. Preserve legacy
+ // turn ordering when nothing changed, while exposing lazy discovery
+ // and capability loss after a provider process replacement.
+ let capabilities = (state.turn_controls != previous_turn_controls).then(|| {
+ json!({"sessionGoals": state.goal_projection["sessionGoals"], "turnControls":state.turn_controls})
+ });
self.save_state()?;
let mut events = Vec::with_capacity(if provider_process_will_be_replaced {
2
@@ -1123,6 +1344,13 @@ impl AcpxCommandExecutor {
),
));
}
+ if let Some(capabilities) = capabilities {
+ events.push((
+ "session.capabilities.updated".to_owned(),
+ EventPriority::P0,
+ capabilities,
+ ));
+ }
events.push((
"turn.started".to_owned(),
EventPriority::P0,
@@ -1139,6 +1367,91 @@ impl AcpxCommandExecutor {
})
}
+ fn steer_turn(
+ &mut self,
+ command_id: &str,
+ payload: &Value,
+ ) -> Result {
+ let text = payload
+ .get("text")
+ .and_then(Value::as_str)
+ .ok_or_else(|| DurableRunnerError::invalid("turn.steer payload.text is required"))?;
+ let turn_id = payload
+ .get("turnId")
+ .and_then(Value::as_str)
+ .ok_or_else(|| DurableRunnerError::invalid("turn.steer payload.turnId is required"))?;
+ let mode = match payload.get("mode") {
+ None => "steer",
+ Some(Value::String(mode)) => mode.as_str(),
+ _ => {
+ return Err(DurableRunnerError::invalid(
+ "turn.steer payload.mode must be a string",
+ ))
+ }
+ };
+ if !matches!(mode, "steer" | "follow_up")
+ || text.trim().is_empty()
+ || text.len() > 65_536
+ || text.contains('\0')
+ {
+ return Err(DurableRunnerError::invalid(
+ "turn.steer violates its bounded contract",
+ ));
+ }
+ let control_id = match payload.get("correlationId") {
+ Some(Value::String(id)) if is_stable_id(id, 160) => id.clone(),
+ None => format!("control-{:x}", Sha256::digest(command_id.as_bytes())),
+ _ => {
+ return Err(DurableRunnerError::invalid(
+ "turn.steer correlationId is invalid",
+ ))
+ }
+ };
+ let state = self
+ .state
+ .as_mut()
+ .ok_or_else(|| DurableRunnerError::invalid("ACPX provider is not prepared"))?;
+ if state.lifecycle != "turn_active"
+ || state.active_turn_id.as_deref() != Some(turn_id)
+ || self.session.is_none()
+ {
+ return Err(DurableRunnerError::invalid(
+ "turn.steer named a stale or inactive turn",
+ ));
+ }
+ if state.attempted_turn_controls.contains(&control_id)
+ || state.attempted_turn_controls.len() >= 1024
+ {
+ return Err(DurableRunnerError::invalid(
+ "turn.steer is duplicate or exceeds the turn control limit",
+ ));
+ }
+ state.attempted_turn_controls.insert(control_id.clone());
+ // Retain before the potentially mutating RPC. Controller reconnects may
+ // read its acknowledgement but must not replay an ambiguous attempt.
+ self.save_state()?;
+ self.session
+ .as_mut()
+ .expect("checked live session")
+ .steer_turn(turn_id, &control_id, mode, text)
+ .map_err(|error| {
+ DurableRunnerError::invalid(format!("ACPX turn control failed: {error}"))
+ })?;
+ Ok(CommandExecution {
+ result: json!({"status": "accepted", "mode": mode, "providerTurnId": turn_id, "correlationId": control_id}),
+ events: vec![(
+ "item.completed".to_owned(),
+ EventPriority::P0,
+ json!({
+ "provider": "acpx", "providerTurnId": turn_id,
+ "itemId": format!("acpx-control-{:x}", Sha256::digest(format!("{turn_id}:{control_id}").as_bytes())),
+ "kind": "steering_acknowledgement", "mode": mode, "status": "acknowledged",
+ "text": if mode == "steer" { "Steering acknowledged for the active turn." } else { "Follow-up queued after the active work." },
+ }),
+ )],
+ })
+ }
+
fn interrupt_turn(&mut self, reason: &str) -> Result {
let turn_id = self
.state
@@ -1202,6 +1515,7 @@ impl AcpxCommandExecutor {
.state
.as_mut()
.expect("ACPX state remains available after provider termination");
+ state.expire_runtime_requests("explicit_cancellation", true)?;
state.active_turn_id = None;
self.context.provider_turn_id = None;
// Persist a non-attachable, recoverable boundary before the fallible
@@ -1237,33 +1551,65 @@ impl AcpxCommandExecutor {
.get("requestId")
.and_then(Value::as_str)
.ok_or_else(|| DurableRunnerError::invalid("request.resolve requires requestId"))?;
- let response = payload
- .get("response")
- .ok_or_else(|| DurableRunnerError::invalid("request.resolve requires response"))?;
let turn_id = self
.state
.as_ref()
.and_then(|state| state.active_turn_id.clone())
.ok_or_else(|| DurableRunnerError::invalid("ACPX provider has no active turn"))?;
- self.session
+ if payload
+ .get("turnId")
+ .and_then(Value::as_str)
+ .is_some_and(|id| id != self.context.turn_id)
+ {
+ return Err(DurableRunnerError::invalid(
+ "ACPX runtime response belongs to a stale turn",
+ ));
+ }
+ let session = self
+ .session
.as_mut()
- .ok_or_else(|| DurableRunnerError::invalid("ACPX session is unavailable"))?
- .resolve_input(
- request_id,
- &turn_id,
- &json!({"action": "submit", "response": response}),
- )
- .map_err(|error| {
- DurableRunnerError::invalid(format!("ACPX runtime response failed: {error}"))
+ .ok_or_else(|| DurableRunnerError::invalid("ACPX session is unavailable"))?;
+ let resolution = payload
+ .get("resolution")
+ .cloned()
+ .or_else(|| {
+ payload
+ .get("response")
+ .map(|response| json!({"action":"submit","response":response}))
+ })
+ .ok_or_else(|| {
+ DurableRunnerError::invalid("request.resolve requires resolution or response")
})?;
- Ok(CommandExecution {
- result: json!({"status": "delivered", "requestId": request_id}),
- events: vec![(
- "runtime_request.resolved".to_owned(),
- EventPriority::P0,
- json!({"provider": "acpx", "requestId": request_id, "status": "delivered"}),
- )],
+ let permission = session.state().pending_permission(request_id).is_some();
+ // Admit the event before sending the response, but keep its request
+ // retirement and outbox entry private until the state write succeeds.
+ let mut staged = self
+ .state
+ .clone()
+ .expect("ACPX response has an active durable turn");
+ staged.push(NormalizedProviderEvent {
+ event_type: "runtime_request.resolved".to_owned(),
+ priority: EventPriority::P0,
+ payload: json!({"provider": "acpx", "requestId": request_id, "status": "delivered",
+ "requestKind": if permission {"permission_approval"} else {"runtime"},
+ "turnId":self.context.turn_id,"itemId":self.context.item_id,"action":resolution.get("action")}),
+ })?;
+ (if permission {
+ session.resolve_permission(request_id, &turn_id, &resolution)
+ } else {
+ session.resolve_input(request_id, &turn_id, &resolution)
})
+ .map_err(|error| {
+ DurableRunnerError::invalid(format!("ACPX runtime response failed: {error}"))
+ })?;
+ // The sidecar ACK proves delivery, not durable controller settlement.
+ // Retain that fact in the same atomic state write that retires the
+ // pending request. A crash before this write expires the old request;
+ // a crash after it replays this event, never the provider response.
+ self.commit_staged_state(staged)?;
+ Ok(CommandExecution::result(
+ json!({"status": "delivered", "requestId": request_id}),
+ ))
}
fn deliver_tool_result(
@@ -1340,6 +1686,7 @@ impl AcpxCommandExecutor {
.state
.as_mut()
.ok_or_else(|| DurableRunnerError::invalid("ACPX provider is not prepared"))?;
+ state.expire_runtime_requests("explicit_cancellation", true)?;
state.lifecycle = "closed".to_owned();
state.active_turn_id = None;
self.context.provider_turn_id = None;
@@ -1399,7 +1746,7 @@ impl AcpxCommandExecutor {
if self
.state
.as_ref()
- .is_some_and(|state| !state.pending_events.is_empty())
+ .is_some_and(|state| !state.pending_events.is_empty() || state.lifecycle == "closed")
|| self.session.is_none()
{
return Ok(());
@@ -1409,10 +1756,33 @@ impl AcpxCommandExecutor {
.session
.as_mut()
.expect("ACPX session remains available while polling")
- .poll_event(Duration::from_millis(1))
- .map_err(|error| {
- DurableRunnerError::invalid(format!("ACPX provider failed: {error}"))
- })?;
+ .poll_event(Duration::from_millis(1));
+ let events = match events {
+ Ok(events) => events,
+ Err(error) => {
+ let state = self
+ .state
+ .as_mut()
+ .expect("ACPX failed provider has durable state");
+ state.expire_runtime_requests("provider_process_lost", false)?;
+ let failed_turn = state.active_turn_id.take();
+ state.lifecycle = "closed".to_owned();
+ state.provider_exit_unconfirmed = true;
+ if let Some(turn_id) = failed_turn {
+ state.push(NormalizedProviderEvent { event_type: "turn.failed".to_owned(), priority: EventPriority::P0,
+ payload: json!({"provider":"acpx","providerTurnId":turn_id,"status":"failed","providerTerminalObserved":false,
+ "code":"acpx_provider_transport_failed","message":crate::durable::redact_text(&error.to_string())}) })?;
+ state.push(NormalizedProviderEvent { event_type: "run.terminal".to_owned(), priority: EventPriority::P0,
+ payload: json!({"schema":"paperclip.prp.terminal.v1","status":"failed","turnTerminalState":"failed","runTerminalState":"failed","reportedWorkDisposition":"unknown","provider":"acpx"}) })?;
+ }
+ self.context.provider_turn_id = None;
+ // A failed transport cannot attest escaped provider cleanup.
+ // Drop the closed process owner; later cleanup must prove the lifetime fence.
+ self.session = None;
+ self.save_state()?;
+ return Ok(());
+ }
+ };
let Some(events) = events else { break };
let mut provider_turn_settled = false;
for event in events {
@@ -1570,11 +1940,7 @@ impl CommandExecutor for AcpxCommandExecutor {
self.goal_control(&command.command_type, &command.payload)
}
"turn.start" => self.start_turn(&command.payload),
- "turn.steer" => Ok(CommandExecution::result(json!({
- "status": "rejected",
- "code": "provider_command_unavailable",
- "message": "ACPX does not support steering an active turn",
- }))),
+ "turn.steer" => self.steer_turn(&command.command_id, &command.payload),
"turn.interrupt" | "run.cancel" => self.interrupt_turn(&command.command_type),
"turn.stop" => self.stop_turn_for_suspension(&command.command_type),
"request.resolve" => self.resolve_request(&command.payload),
@@ -1618,6 +1984,7 @@ impl CommandExecutor for AcpxCommandExecutor {
}
fn retained_events(&mut self) -> Result, DurableRunnerError> {
+ self.ensure_persistence_healthy()?;
// Explicit drain runs while control traffic suppresses provider polling.
// Expose the already-retained suffix so runnerd can commit and ACK it
// before suspension, without restoring or advancing the provider.
@@ -1631,6 +1998,7 @@ impl CommandExecutor for AcpxCommandExecutor {
}
fn acknowledge_events(&mut self, count: usize) -> Result<(), DurableRunnerError> {
+ self.ensure_persistence_healthy()?;
if count == 0 {
return Ok(());
}
@@ -1648,6 +2016,20 @@ impl CommandExecutor for AcpxCommandExecutor {
}
fn shutdown(&mut self) -> Result<(), DurableRunnerError> {
+ if let Some(error) = self.persistence_error.clone() {
+ // Reap our owned process even when durable cleanup is uncertain,
+ // but do not overwrite the last atomic snapshot or claim success.
+ if let Some(mut session) = self.session.take() {
+ session
+ .shutdown("ACPX provider state persistence failed")
+ .map_err(|cleanup| {
+ DurableRunnerError::invalid(format!(
+ "{error}; failed to stop ACPX provider: {cleanup}"
+ ))
+ })?;
+ }
+ return Err(error);
+ }
// A replacement durable runner may reach terminal reconciliation
// before any provider command or event poll. Restore the persisted
// session first so cleanup cannot succeed merely because this process
@@ -1720,11 +2102,14 @@ fn session_event_payload(
descriptor: &AcpxProviderDescriptor,
identity: &AcpxProviderSessionIdentity,
process_id: u32,
+ turn_controls: AcpxTurnControlCapabilities,
) -> Value {
+ let mut public_descriptor = descriptor.public_descriptor(Some(identity));
+ public_descriptor["turnControls"] = json!(turn_controls);
json!({
"provider": "acpx",
"driver": "acpx_runtime",
- "providerDescriptor": descriptor.public_descriptor(Some(identity)),
+ "providerDescriptor": public_descriptor,
"runtimeIdentity": {
"executionKind": "local_process",
"processId": process_id,
@@ -1899,6 +2284,312 @@ mod tests {
})
}
+ fn pending_input_request(id: &str) -> Value {
+ json!({"schema":"paperclip.runtime_request.v2","requestId":id,"requestKind":"runtime","type":"input","status":"pending",
+ "turnId":"turn-1","itemId":"item-1","prompt":"Choose","input":{"schema":"paperclip.question_set.v1","questions":[{"id":"q","prompt":"Choose","answerMode":"text","required":true}]},
+ "origin":{"adapter":"acpx-runtime-sidecar","provider":"cursor","method":"cursor/ask_question"}})
+ }
+
+ #[test]
+ fn durable_runtime_ledger_retains_only_unsettled_requests_and_rejects_forged_types() {
+ let operations = Vec::new();
+ let tool_set = AuthorizedToolSet {
+ schema: TOOL_SET_SCHEMA.into(),
+ schema_version: 1,
+ catalog_digest: authorized_tool_catalog_digest(&operations).unwrap(),
+ operations,
+ };
+ let mut state = AcpxDurableState::new(
+ serde_json::from_value(descriptor("codex")).unwrap(),
+ tool_set,
+ "test".into(),
+ );
+ state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":pending_input_request("input-1")}),
+ })
+ .unwrap();
+ assert!(state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":pending_input_request("input-1")})
+ })
+ .is_err());
+ let mut forged = pending_input_request("forged");
+ forged["requestKind"] = json!("permission_approval");
+ assert!(state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":forged})
+ })
+ .is_err());
+ state.pending_events.clear();
+ let mut restored: AcpxDurableState =
+ serde_json::from_value(serde_json::to_value(&state).unwrap()).unwrap();
+ restored
+ .expire_runtime_requests("provider_process_lost", false)
+ .unwrap();
+ assert_eq!(restored.pending_events.len(), 1);
+ assert_eq!(
+ restored.pending_events[0].event_type,
+ "runtime_request.expired"
+ );
+ assert_eq!(
+ restored.pending_events[0].payload["request"],
+ pending_input_request("input-1")
+ );
+ assert_eq!(restored.pending_events[0].payload["replayAllowed"], false);
+ restored
+ .expire_runtime_requests("provider_process_lost", false)
+ .unwrap();
+ assert_eq!(restored.pending_events.len(), 1);
+ state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.resolved".into(),
+ priority: EventPriority::P0,
+ payload: json!({"requestId":"input-1"}),
+ })
+ .unwrap();
+ assert!(state.pending_runtime_requests.is_empty());
+ let mut old = serde_json::to_value(state).unwrap();
+ old.as_object_mut()
+ .unwrap()
+ .remove("pendingRuntimeRequests");
+ assert!(serde_json::from_value::(old)
+ .unwrap()
+ .pending_runtime_requests
+ .is_empty());
+ }
+
+ #[test]
+ fn rejected_runtime_settlement_preserves_the_pending_request() {
+ for event_type in [
+ "runtime_request.resolved",
+ "runtime_request.expired",
+ "runtime_request.cancelled",
+ ] {
+ for exhausted_sequence in [false, true] {
+ let operations = Vec::new();
+ let mut state = AcpxDurableState::new(
+ serde_json::from_value(descriptor("codex")).unwrap(),
+ AuthorizedToolSet {
+ schema: TOOL_SET_SCHEMA.into(),
+ schema_version: 1,
+ catalog_digest: authorized_tool_catalog_digest(&operations).unwrap(),
+ operations,
+ },
+ "test".into(),
+ );
+ state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":pending_input_request("input-1")}),
+ })
+ .unwrap();
+ if exhausted_sequence {
+ state.next_event_sequence = u64::MAX;
+ } else {
+ state
+ .pending_events
+ .resize(MAX_PENDING_EVENTS, state.pending_events[0].clone());
+ }
+ let before = state.clone();
+ assert!(state
+ .push(NormalizedProviderEvent {
+ event_type: event_type.into(),
+ priority: EventPriority::P0,
+ payload: json!({"requestId":"input-1"}),
+ })
+ .is_err());
+ assert_eq!(
+ state, before,
+ "{event_type} must not retire a request without its event"
+ );
+ }
+ }
+ }
+
+ #[test]
+ fn post_rename_failure_blocks_settlement_publication_until_fresh_recovery() {
+ for event_type in [
+ "runtime_request.resolved",
+ "runtime_request.expired",
+ "runtime_request.cancelled",
+ ] {
+ let directory = temporary_directory("post-rename-settlement");
+ let marker = directory.join("must-not-start-provider");
+ let command_path = directory.join("sidecar");
+ write_artifact(
+ &command_path,
+ format!("#!/bin/sh\ntouch '{}'\n", marker.display()).as_bytes(),
+ true,
+ );
+ let launch_profile = AcpxLaunchProfile {
+ authority_digest: format!("sha256:{}", "d".repeat(64)),
+ command: command_path.clone(),
+ args: Vec::new(),
+ artifacts: vec![artifact(&command_path)],
+ };
+ let mut value = descriptor("codex");
+ value["sidecarCommand"] = json!(command_path);
+ value["sidecarArgs"] = json!([]);
+ let descriptor: AcpxProviderDescriptor = serde_json::from_value(value).unwrap();
+ let identity = AcpxProviderSessionIdentity {
+ kind: "acpx".into(),
+ normalized_session_id: "session-1".into(),
+ acpx_record_id: "record-1".into(),
+ backend_session_id: "backend-1".into(),
+ agent_session_id: "agent-1".into(),
+ profile_digest: descriptor.command_digest.clone(),
+ workspace_digest: format!("sha256:{}", "a".repeat(64)),
+ requested_model: descriptor.model.clone(),
+ effective_model: descriptor.model.clone(),
+ permission_mode: Some(descriptor.permission_mode),
+ provider_lifetime_fence_candidates: [60_001, 60_002, 60_003],
+ };
+ let operations = Vec::new();
+ let mut state = AcpxDurableState::new(
+ descriptor,
+ AuthorizedToolSet {
+ schema: TOOL_SET_SCHEMA.into(),
+ schema_version: 1,
+ catalog_digest: authorized_tool_catalog_digest(&operations).unwrap(),
+ operations,
+ },
+ launch_profile.canonical_digest().unwrap(),
+ );
+ state.identity = Some(identity);
+ state.lifecycle = "turn_active".into();
+ state.active_turn_id = Some("turn-1".into());
+ for request_id in ["input-1", "input-2"] {
+ state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":pending_input_request(request_id)}),
+ })
+ .unwrap();
+ }
+ state.pending_events.clear();
+ let config = test_config(&directory, Some(launch_profile));
+ let mut original = AcpxCommandExecutor::with_runner_config(&directory, &config);
+ original.restore_checked = true;
+ original.state = Some(state.clone());
+ original.save_state().unwrap();
+ let mut staged = state.clone();
+ staged
+ .push(NormalizedProviderEvent {
+ event_type: event_type.into(),
+ priority: EventPriority::P0,
+ payload: json!({"requestId":"input-1"}),
+ })
+ .unwrap();
+ original.fail_after_state_rename = true;
+ let error = if event_type == "runtime_request.resolved" {
+ let error = original.commit_staged_state(staged.clone()).unwrap_err();
+ assert_eq!(original.state.as_ref(), Some(&state));
+ error
+ } else {
+ // Existing cancellation/expiry paths mutate their working
+ // state before save; the same latch must quarantine them.
+ original.state = Some(staged.clone());
+ original.save_state().unwrap_err()
+ };
+ assert!(error
+ .to_string()
+ .contains("injected post-rename sync failure"));
+ original.fail_after_state_rename = false;
+ let disk = fs::read(original.state_path()).unwrap();
+ assert_eq!(
+ serde_json::from_slice::(&disk).unwrap(),
+ staged
+ );
+ for result in [
+ original.retained_events().map(|_| ()),
+ original.poll_events().map(|_| ()),
+ original.acknowledge_events(0),
+ original.acknowledge_events(1),
+ original.restore(),
+ original.save_state(),
+ original.shutdown(),
+ ] {
+ assert_eq!(result.unwrap_err().to_string(), error.to_string());
+ }
+ for command_type in ["request.resolve", "runner.drain", "runner.suspend"] {
+ let blocked = original.execute(&Command {
+ schema: "paperclip.prp.command.v1".into(),
+ command_id: "blocked-command".into(),
+ controller_seq: 1,
+ command_type: command_type.into(),
+ issued_at: "2026-09-01T00:00:00.000Z".into(),
+ deadline_at: None,
+ precondition: None,
+ payload: json!({"requestId":"input-1", "resolution":{"action":"submit"}}),
+ });
+ assert_eq!(blocked.unwrap_err().to_string(), error.to_string());
+ }
+ assert_eq!(fs::read(original.state_path()).unwrap(), disk);
+ drop(original);
+
+ let mut recovered = AcpxCommandExecutor::with_runner_config(&directory, &config);
+ let events = recovered.poll_events().unwrap();
+ let settlements: Vec<_> = events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .collect();
+ assert_eq!(settlements.len(), 2);
+ assert_eq!(settlements[0].event_type, event_type);
+ assert_eq!(settlements[0].payload["requestId"], "input-1");
+ assert_eq!(
+ settlements[0].executor_event_id,
+ staged.pending_events[0].executor_event_id
+ );
+ assert_eq!(settlements[1].event_type, "runtime_request.expired");
+ assert_eq!(settlements[1].payload["requestId"], "input-2");
+ assert_eq!(settlements[1].payload["replayAllowed"], false);
+ assert!(
+ event_sequence(&settlements[0].executor_event_id).unwrap()
+ < event_sequence(&settlements[1].executor_event_id).unwrap()
+ );
+ assert!(recovered
+ .resolve_request(&json!({"requestId":"input-1", "resolution":{"action":"submit"}}))
+ .is_err());
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ recovered.acknowledge_events(events.len()).unwrap();
+ drop(recovered);
+ let mut recovered_again = AcpxCommandExecutor::with_runner_config(&directory, &config);
+ assert!(recovered_again.poll_events().unwrap().is_empty());
+ assert!(
+ !marker.exists(),
+ "recovery must not restart a provider or replay input"
+ );
+ fs::remove_dir_all(directory).unwrap();
+ }
+ }
+
+ #[test]
+ fn turn_control_rejects_nonstring_mode_before_provider_access() {
+ let directory = temporary_directory("control-mode");
+ let config = test_config(&directory, None);
+ let mut executor = AcpxCommandExecutor::with_runner_config(&directory, &config);
+ for mode in [Value::Null, json!(1), json!(false), json!({})] {
+ let error = executor
+ .steer_turn(
+ "command-1",
+ &json!({"text":"change direction", "turnId":"turn-1", "mode":mode}),
+ )
+ .err()
+ .unwrap();
+ assert!(error.to_string().contains("mode must be a string"));
+ }
+ fs::remove_dir_all(directory).unwrap();
+ }
+
#[test]
fn retained_events_exposes_terminal_suffix_without_restoring_provider() {
let directory = temporary_directory("retained-terminal-suffix");
@@ -2025,7 +2716,62 @@ mod tests {
}
#[test]
- fn rejects_pi_before_process_launch() {
+ fn admits_candidate_descriptors_only_with_explicit_policy_and_exact_distribution() {
+ for (agent, package, version, digest, runtime_package, runtime_version, model) in [
+ (
+ "cursor",
+ "cursor-agent",
+ "2026.09.26-dd393fe",
+ "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899",
+ None,
+ None,
+ "explicit-model",
+ ),
+ (
+ "copilot",
+ "@github/copilot",
+ "1.0.88",
+ "sha256:b18c01603dd0169d233140709cfaa8bf5304a03cf5de78ca4f625f30013e8457",
+ None,
+ None,
+ "explicit-model",
+ ),
+ (
+ "pi",
+ "pi-acp",
+ "0.0.33",
+ "sha256:8c696f38296d53d0061fa11534570c5ddd951b63532aed30e0f1fcc676dc169f",
+ Some("@earendil-works/pi-coding-agent"),
+ Some("0.84.2"),
+ "openrouter/deepseek/deepseek-v4-flash-0731",
+ ),
+ ] {
+ let mut value = descriptor("codex");
+ value["agent"] = json!(agent);
+ value["model"] = json!(model);
+ value["agentServerPackage"] = json!(package);
+ value["agentServerVersion"] = json!(version);
+ value["agentRuntimePackage"] = json!(runtime_package);
+ value["agentRuntimeVersion"] = json!(runtime_version);
+ value["commandDigest"] = json!(digest);
+ let missing: AcpxProviderDescriptor = serde_json::from_value(value.clone()).unwrap();
+ assert!(missing.validate(&context()).is_err());
+ value["providerPolicy"] = json!({"readOnly":true});
+ let valid: AcpxProviderDescriptor = serde_json::from_value(value.clone()).unwrap();
+ valid.validate(&context()).unwrap();
+ for field in ["model", "agentServerVersion", "commandDigest"] {
+ let mut wrong = value.clone();
+ wrong[field] = json!("");
+ let invalid: AcpxProviderDescriptor = serde_json::from_value(wrong).unwrap();
+ assert!(invalid.validate(&context()).is_err());
+ }
+ value["providerPolicy"] = json!({"readOnly":true, "protectedPaths":[]});
+ assert!(serde_json::from_value::(value).is_err());
+ }
+ }
+
+ #[test]
+ fn rejects_pi_with_another_profile_identity_before_process_launch() {
let mut pi = descriptor("codex");
pi["agent"] = json!("pi");
let pi: AcpxProviderDescriptor = serde_json::from_value(pi).unwrap();
@@ -2342,6 +3088,15 @@ mod tests {
state.lifecycle = "turn_active".to_owned();
state.identity = Some(identity);
state.active_turn_id = Some("turn-1".to_owned());
+ state
+ .push(NormalizedProviderEvent {
+ event_type: "runtime_request.created".into(),
+ priority: EventPriority::P0,
+ payload: json!({"request":pending_input_request("restart-input")}),
+ })
+ .unwrap();
+ state.pending_events.clear(); // The controller already acknowledged creation.
+
let config = test_config(&directory, Some(launch_profile));
let mut original = AcpxCommandExecutor::with_runner_config(&directory, &config);
original.state = Some(state);
@@ -2403,11 +3158,15 @@ mod tests {
assert_eq!(snapshot.result["status"], "closed");
assert!(!marker.exists());
let events = recovered.poll_events().unwrap();
- assert_eq!(events[0].event_type, "turn.failed");
- assert_eq!(events[0].payload["providerShutdownFailed"], true);
- assert_eq!(events[1].event_type, "run.terminal");
- assert_eq!(events[1].payload["schema"], "paperclip.prp.terminal.v1");
- assert_eq!(events[1].payload["turnTerminalState"], "failed");
+ assert_eq!(events[0].event_type, "runtime_request.expired");
+ assert_eq!(events[0].payload["requestId"], "restart-input");
+ assert_eq!(events[0].payload["replayAllowed"], false);
+ assert_eq!(events[1].event_type, "turn.failed");
+ assert_eq!(events[1].payload["providerShutdownFailed"], true);
+ assert_eq!(events[2].event_type, "run.terminal");
+ assert_eq!(events[2].payload["schema"], "paperclip.prp.terminal.v1");
+ assert_eq!(events[2].payload["turnTerminalState"], "failed");
+ assert_eq!(recovered.poll_events().unwrap(), events);
let cleanup_error = recovered
.shutdown()
.expect_err("cleanup must not succeed while the original lifetime remains active");
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs
index c64d02bc5b7..a50de43ef68 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs
@@ -51,6 +51,12 @@ pub struct AcpxProviderSessionIdentity {
pub provider_lifetime_fence_candidates: [u16; 3],
}
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+pub struct AcpxProviderRuntimePolicy {
+ pub read_only: bool,
+}
+
#[derive(Clone, Debug)]
pub struct AcpxProviderSessionConfig {
pub transport: AcpxSidecarTransportConfig,
@@ -63,6 +69,7 @@ pub struct AcpxProviderSessionConfig {
pub working_directory: PathBuf,
pub permission_mode: AcpxPermissionMode,
pub permission_mode_pinned: bool,
+ pub provider_policy: Option,
pub system_instructions: String,
pub runtime_context: Value,
pub tool_set: AuthorizedToolSet,
@@ -76,9 +83,11 @@ impl AcpxProviderSessionConfig {
"claude" => "claude-sonnet-5",
"grok" => "grok-4.7",
"codex" => "gpt-5.6-sol",
+ "pi" => "openrouter/deepseek/deepseek-v4-flash-0731",
+ "cursor" | "copilot" => self.model.as_str(),
_ => {
return Err(LocalRunnerError::invalid(
- "ACPX agent must be claude, codex, or grok",
+ "ACPX agent must name a known immutable profile",
))
}
};
@@ -89,6 +98,13 @@ impl AcpxProviderSessionConfig {
)));
}
validate_text(&self.model, MAX_MODEL_CHARS, "ACPX model")?;
+ if matches!(self.agent.as_str(), "pi" | "cursor" | "copilot")
+ && self.provider_policy.is_none()
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX candidate requires explicit provider read-only policy",
+ ));
+ }
validate_stable_id(&self.run_id, SHORT_STABLE_ID_CHARS, "ACPX run id")?;
validate_stable_id(
&self.normalized_session_id,
@@ -209,6 +225,30 @@ impl AcpxProviderSessionIdentity {
}
}
+#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, PartialEq, Eq)]
+#[serde(rename_all = "camelCase", deny_unknown_fields)]
+pub struct AcpxTurnControlCapabilities {
+ pub steering: bool,
+ pub queued_follow_up: bool,
+}
+
+fn verified_turn_controls(
+ value: Option<&Value>,
+ agent: &str,
+) -> Result {
+ let Some(value) = value else {
+ return Ok(AcpxTurnControlCapabilities::default());
+ };
+ let controls: AcpxTurnControlCapabilities = serde_json::from_value(value.clone())
+ .map_err(|_| LocalRunnerError::invalid("ACPX negotiated turn controls are malformed"))?;
+ if agent != "pi" && (controls.steering || controls.queued_follow_up) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX profile cannot advertise these turn controls",
+ ));
+ }
+ Ok(controls)
+}
+
pub struct AcpxProviderSession {
transport: AcpxSidecarTransport,
config: AcpxProviderSessionConfig,
@@ -216,6 +256,7 @@ pub struct AcpxProviderSession {
tool_bridge: ProviderToolBridge,
reserved_tool_bridge: ProviderToolBridge,
identity: AcpxProviderSessionIdentity,
+ turn_controls: AcpxTurnControlCapabilities,
catalog_revision: u64,
working_directory: PathBuf,
closed: bool,
@@ -235,7 +276,7 @@ impl AcpxProviderSession {
let mut transport =
AcpxSidecarTransport::start_for_agent(&config.transport, &config.agent)?;
let bootstrap = bootstrap(&mut transport, config);
- let (identity, state) = match bootstrap {
+ let (identity, state, turn_controls) = match bootstrap {
Ok(value) => value,
Err(error) => {
let cleanup = transport.shutdown();
@@ -249,6 +290,7 @@ impl AcpxProviderSession {
tool_bridge,
reserved_tool_bridge,
identity,
+ turn_controls,
catalog_revision: config.catalog_revision,
working_directory: config.working_directory.clone(),
closed: false,
@@ -264,6 +306,10 @@ impl AcpxProviderSession {
&self.identity
}
+ pub fn turn_control_capabilities(&self) -> AcpxTurnControlCapabilities {
+ self.turn_controls
+ }
+
pub fn state(&self) -> &AcpxProviderState {
&self.state
}
@@ -309,6 +355,11 @@ impl AcpxProviderSession {
"ACPX provider session already has an active turn",
));
}
+ if self.state.has_pending_tools() {
+ return Err(LocalRunnerError::invalid(
+ "ACPX provider session still has unsettled semantic tools",
+ ));
+ }
let rotate_turn_identity_ledger = self.state.settled_turn_identity_capacity_reached();
let identity_validation = if rotate_turn_identity_ledger {
self.state
@@ -378,6 +429,11 @@ impl AcpxProviderSession {
"ACPX sidecar did not confirm the requested turn",
)));
}
+ self.turn_controls =
+ match verified_turn_controls(response.get("turnControls"), &self.config.agent) {
+ Ok(controls) => controls,
+ Err(error) => return Err(self.fail_closed(error)),
+ };
if let Err(error) = self.state.begin_turn(turn_id) {
return Err(self.fail_closed(error));
}
@@ -386,6 +442,54 @@ impl AcpxProviderSession {
Ok(response)
}
+ pub fn steer_turn(
+ &mut self,
+ turn_id: &str,
+ control_id: &str,
+ mode: &str,
+ message: &str,
+ ) -> Result {
+ self.ensure_open()?;
+ validate_stable_id(turn_id, DURABLE_STABLE_ID_CHARS, "ACPX turn id")?;
+ validate_stable_id(control_id, SHORT_STABLE_ID_CHARS, "ACPX control id")?;
+ if !matches!(mode, "steer" | "follow_up")
+ || message.trim().is_empty()
+ || message.len() > 65_536
+ || message.contains('\0')
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX turn control violates its bounded contract",
+ ));
+ }
+ let supported = if mode == "steer" {
+ self.turn_controls.steering
+ } else {
+ self.turn_controls.queued_follow_up
+ };
+ if !supported {
+ return Err(LocalRunnerError::invalid(
+ "ACPX turn control was not negotiated",
+ ));
+ }
+ self.state.reserve_turn_control(turn_id, control_id)?;
+ // The sidecar checks the negotiated live capability. An error may follow
+ // delivery, so the reservation must never be released for automatic retry.
+ let response = self.transport.request(
+ GeneratedAcpxSidecarCommand::TurnSteer,
+ json!({"turnId": turn_id, "controlId": control_id, "mode": mode, "message": message}),
+ )?;
+ if response.get("accepted").and_then(Value::as_bool) != Some(true)
+ || response.get("turnId").and_then(Value::as_str) != Some(turn_id)
+ || response.get("controlId").and_then(Value::as_str) != Some(control_id)
+ || response.get("mode").and_then(Value::as_str) != Some(mode)
+ {
+ return Err(self.fail_closed(LocalRunnerError::invalid(
+ "ACPX sidecar did not acknowledge the exact turn control",
+ )));
+ }
+ Ok(response)
+ }
+
pub fn interrupt_turn(
&mut self,
turn_id: &str,
@@ -519,52 +623,50 @@ impl AcpxProviderSession {
}
}
AcpxProviderStateEvent::TurnTerminal { .. } => {
- let settlements = match next_bridge.settle_turn("acpx_turn_settled") {
- Ok(settlements) => settlements,
- Err(error) => {
- return Err(self.fail_closed(LocalRunnerError::invalid(format!(
+ next_bridge
+ .settle_turn("acpx_turn_settled")
+ .map_err(|error| {
+ self.fail_closed(LocalRunnerError::invalid(format!(
"ACPX provider tool settlement failed: {error}"
- ))));
- }
- };
- let reserved_settlements = match next_reserved_bridge
- .settle_turn("acpx_reserved_terminal_unsettled")
- {
- Ok(settlements) => settlements,
- Err(error) => {
- return Err(self.fail_closed(LocalRunnerError::invalid(format!(
- "ACPX reserved terminal settlement failed: {error}"
- ))));
- }
- };
- if !reserved_settlements.is_empty() {
- return Err(self.fail_closed(LocalRunnerError::invalid(
- "ACPX turn terminated before its reserved terminal invocation produced a correlated result",
- )));
- }
- // `accept_event` clears the candidate reducer's pending
- // tools while the bridge clones settle the corresponding
- // calls above. Prove both halves reached the same terminal
- // state before committing any of them to the reusable
- // session.
- if next_state.has_pending_tools()
- || next_bridge.pending_calls().next().is_some()
- || next_reserved_bridge.pending_calls().next().is_some()
+ )))
+ })?;
+ next_reserved_bridge
+ .settle_turn("acpx_turn_settled")
+ .map_err(|error| {
+ self.fail_closed(LocalRunnerError::invalid(format!(
+ "ACPX reserved tool settlement failed: {error}"
+ )))
+ })?;
+ // Both ledgers must retain exactly the same dispatched
+ // effects. Ending the provider turn cannot determine whether
+ // a server-side operation committed.
+ let pending: Vec<_> = next_bridge
+ .pending_calls()
+ .chain(next_reserved_bridge.pending_calls())
+ .collect();
+ if pending.len() != next_state.pending_tool_count()
+ || pending.iter().any(|call| {
+ next_state.pending_tool(&call.call_id).is_none_or(|other| {
+ other.operation_id != call.operation_id || other.input != call.input
+ })
+ })
{
return Err(self.fail_closed(LocalRunnerError::invalid(
"ACPX terminal settlement left provider tool state inconsistent",
)));
}
- reconciled_events.extend(
- settlements
- .into_iter()
- .map(AcpxProviderStateEvent::ToolResult),
- );
}
AcpxProviderStateEvent::PermissionRequest { .. } => {
- return Err(self.fail_closed(LocalRunnerError::invalid(
- "ACPX permission request violated the pinned runner policy",
- )));
+ if self.config.agent == "codex"
+ || matches!(
+ self.config.permission_mode,
+ AcpxPermissionMode::ApproveAll | AcpxPermissionMode::DenyAll
+ )
+ {
+ return Err(self.fail_closed(LocalRunnerError::invalid(
+ "ACPX permission request violated the pinned runner policy",
+ )));
+ }
}
_ => {}
}
@@ -579,9 +681,11 @@ impl AcpxProviderSession {
}
pub fn deliver_tool_result(&mut self, result: &ToolResult) -> Result<(), LocalRunnerError> {
- let turn_id = self.ensure_active_turn()?.to_owned();
+ self.ensure_open()?;
let mut next_state = self.state.clone();
- next_state.complete_tool(&result.call_id, &result.operation_id)?;
+ if next_state.pending_tool(&result.call_id).is_some() {
+ next_state.complete_tool(&result.call_id, &result.operation_id)?;
+ }
let mut next_bridge = self.tool_bridge.clone();
let mut next_reserved_bridge = self.reserved_tool_bridge.clone();
let bridge = if is_reserved_terminal_operation(&result.operation_id) {
@@ -589,9 +693,24 @@ impl AcpxProviderSession {
} else {
&mut next_bridge
};
+ let duplicate = bridge.has_completed_call(&result.call_id);
+ let detached = bridge.turn_closed();
bridge.apply_result(result.clone()).map_err(|error| {
- LocalRunnerError::invalid(format!("ACPX tool result is invalid: {error}"))
+ LocalRunnerError::invalid(format!(
+ "ACPX tool result for call {} operation {} is invalid: {error}",
+ result.call_id, result.operation_id
+ ))
})?;
+ if duplicate {
+ return Ok(());
+ }
+ if detached {
+ self.state = next_state;
+ self.tool_bridge = next_bridge;
+ self.reserved_tool_bridge = next_reserved_bridge;
+ return Ok(());
+ }
+ let turn_id = self.ensure_active_turn()?.to_owned();
let resolution = if result.is_error {
// The durable result remains authoritative for correlation and
// retry bookkeeping, but provider-facing failures expose only a
@@ -629,6 +748,52 @@ impl AcpxProviderSession {
Ok(())
}
+ pub fn resolve_permission(
+ &mut self,
+ request_id: &str,
+ turn_id: &str,
+ resolution: &Value,
+ ) -> Result<(), LocalRunnerError> {
+ self.ensure_bound_turn(turn_id)?;
+ let details = self.state.pending_permission(request_id).ok_or_else(|| {
+ LocalRunnerError::invalid("ACPX permission request is stale or unknown")
+ })?;
+ let object = resolution.as_object().ok_or_else(|| {
+ LocalRunnerError::invalid("ACPX permission resolution must be an object")
+ })?;
+ let action = object.get("action").and_then(Value::as_str).unwrap_or("");
+ if object.len() != 1
+ || !matches!(
+ action,
+ "accept" | "accept_for_session" | "decline" | "cancel"
+ )
+ || !details
+ .get("choices")
+ .and_then(Value::as_array)
+ .is_some_and(|choices| {
+ choices
+ .iter()
+ .any(|choice| choice.get("key").and_then(Value::as_str) == Some(action))
+ })
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX permission resolution is not an offered choice",
+ ));
+ }
+ let mut next_state = self.state.clone();
+ next_state.complete_permission(request_id)?;
+ let response = match self.transport.request(
+ GeneratedAcpxSidecarCommand::PermissionResolve,
+ json!({"requestId":request_id,"turnId":turn_id,"resolution":resolution}),
+ ) {
+ Ok(response) => response,
+ Err(error) => return Err(self.fail_closed(error)),
+ };
+ self.verify_resolution(&response, "permission")?;
+ self.state = next_state;
+ Ok(())
+ }
+
pub fn resolve_input(
&mut self,
request_id: &str,
@@ -786,12 +951,13 @@ impl AcpxProviderSession {
&restart_config.transport,
&restart_config.agent,
)?;
- let (replacement_identity, _) = match bootstrap(&mut replacement, &restart_config) {
- Ok(value) => value,
- Err(error) => {
- return Err(self.reject_replacement(replacement, error));
- }
- };
+ let (replacement_identity, _, turn_controls) =
+ match bootstrap(&mut replacement, &restart_config) {
+ Ok(value) => value,
+ Err(error) => {
+ return Err(self.reject_replacement(replacement, error));
+ }
+ };
if replacement_identity != self.identity {
return Err(self.reject_replacement(
replacement,
@@ -801,6 +967,7 @@ impl AcpxProviderSession {
));
}
self.transport = replacement;
+ self.turn_controls = turn_controls;
self.transport_terminated = false;
Ok(())
}
@@ -1037,7 +1204,14 @@ impl Drop for AcpxProviderSession {
fn bootstrap(
transport: &mut AcpxSidecarTransport,
config: &AcpxProviderSessionConfig,
-) -> Result<(AcpxProviderSessionIdentity, AcpxProviderState), LocalRunnerError> {
+) -> Result<
+ (
+ AcpxProviderSessionIdentity,
+ AcpxProviderState,
+ AcpxTurnControlCapabilities,
+ ),
+ LocalRunnerError,
+> {
let sidecar_tools = sidecar_run_tool_operations(&config.tool_set);
let initialized = transport.request(
GeneratedAcpxSidecarCommand::Initialize,
@@ -1055,6 +1229,7 @@ fn bootstrap(
"model": config.model,
"permissionMode": config.permission_mode,
"permissionModePinned": config.permission_mode_pinned,
+ "providerPolicy": config.provider_policy,
"systemInstructions": config.system_instructions,
"runtimeContext": config.runtime_context,
"tools": &sidecar_tools,
@@ -1062,6 +1237,7 @@ fn bootstrap(
}),
)?;
let identity = verify_open_response(&opened, transport.process_id(), config)?;
+ let turn_controls = verified_turn_controls(opened.get("turnControls"), &config.agent)?;
let attached = transport.request(
GeneratedAcpxSidecarCommand::RunAttach,
@@ -1078,7 +1254,11 @@ fn bootstrap(
"ACPX sidecar did not confirm the requested run attachment",
));
}
- Ok((identity, AcpxProviderState::new(&config.run_id)?))
+ Ok((
+ identity,
+ AcpxProviderState::new(&config.run_id)?,
+ turn_controls,
+ ))
}
fn verify_initialize_response(value: &Value, process_id: u32) -> Result<(), LocalRunnerError> {
@@ -1270,6 +1450,35 @@ fn with_cleanup_error(
#[cfg(test)]
mod tests {
+ #[test]
+ fn turn_controls_require_exact_live_pi_capability_fields() {
+ use super::*;
+ assert_eq!(
+ verified_turn_controls(None, "pi").unwrap(),
+ AcpxTurnControlCapabilities::default()
+ );
+ assert!(
+ verified_turn_controls(Some(&json!({"steering":true,"queuedFollowUp":true})), "pi")
+ .unwrap()
+ .steering
+ );
+ for value in [
+ Value::Null,
+ json!({}),
+ json!({"steering":1,"queuedFollowUp":false}),
+ json!({"steering":true,"queuedFollowUp":true,"extra":true}),
+ ] {
+ assert!(verified_turn_controls(Some(&value), "pi").is_err());
+ }
+ for agent in ["codex", "claude", "cursor", "copilot"] {
+ assert!(verified_turn_controls(
+ Some(&json!({"steering":true,"queuedFollowUp":false})),
+ agent
+ )
+ .is_err());
+ }
+ }
+
use super::*;
#[test]
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs
index 2a68007e99c..ceef3283952 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_state.rs
@@ -1,4 +1,4 @@
-use std::collections::BTreeMap;
+use std::collections::{BTreeMap, BTreeSet};
use serde_json::Value;
@@ -61,6 +61,12 @@ pub enum AcpxProviderStateEvent {
question_set: Value,
origin: Option,
},
+ RuntimeRequestEnded {
+ request_id: String,
+ question_set: Option,
+ origin: Option,
+ status: AcpxTurnStatus,
+ },
SemanticResult(AcpxSemanticResult),
AssistantMessage {
turn_id: String,
@@ -84,6 +90,7 @@ struct PendingInput {
runtime_request_id: String,
value_bytes: usize,
question_set: Value,
+ origin: Option,
}
/// Reduces validated sidecar events into bounded provider state.
@@ -101,10 +108,11 @@ pub struct AcpxProviderState {
assistant_message_id: Option,
pending_tools: BTreeMap,
pending_tool_input_bytes: usize,
- pending_permissions: BTreeMap,
+ pending_permissions: BTreeMap,
pending_inputs: BTreeMap,
pending_runtime_request_bytes: usize,
semantic_result: Option,
+ attempted_turn_controls: BTreeSet,
}
impl AcpxProviderState {
@@ -121,6 +129,7 @@ impl AcpxProviderState {
pending_inputs: BTreeMap::new(),
pending_runtime_request_bytes: 0,
semantic_result: None,
+ attempted_turn_controls: BTreeSet::new(),
})
}
@@ -165,6 +174,28 @@ impl AcpxProviderState {
|| !self.pending_inputs.is_empty()
}
+ pub(crate) fn reserve_turn_control(
+ &mut self,
+ turn_id: &str,
+ control_id: &str,
+ ) -> Result<(), LocalRunnerError> {
+ if self.active_turn_id() != Some(turn_id) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX turn control named a stale or inactive turn",
+ ));
+ }
+ if self.attempted_turn_controls.contains(control_id) {
+ return Err(LocalRunnerError::invalid(
+ "ACPX turn control was already attempted",
+ ));
+ }
+ if self.attempted_turn_controls.len() >= 1024 {
+ return Err(LocalRunnerError::invalid("ACPX turn control limit reached"));
+ }
+ self.attempted_turn_controls.insert(control_id.to_owned());
+ Ok(())
+ }
+
pub fn begin_turn(&mut self, turn_id: impl Into) -> Result<(), LocalRunnerError> {
if self.scope.active_turn_id().is_some()
|| !self.pending_tools.is_empty()
@@ -185,6 +216,7 @@ impl AcpxProviderState {
self.assistant_text.clear();
self.assistant_message_id = None;
self.semantic_result = None;
+ self.attempted_turn_controls.clear();
Ok(())
}
@@ -194,6 +226,16 @@ impl AcpxProviderState {
) -> Result, LocalRunnerError> {
let payload = decode_acpx_event(&self.scope, event)?;
match payload {
+ AcpxEventPayload::RichActivity {
+ event_type,
+ payload,
+ } => Ok(vec![AcpxProviderStateEvent::Activity(
+ NormalizedProviderEvent {
+ event_type,
+ priority: crate::durable::EventPriority::P1,
+ payload,
+ },
+ )]),
AcpxEventPayload::Runtime {
kind,
tool_operation,
@@ -224,7 +266,7 @@ impl AcpxProviderState {
));
}
self.pending_permissions
- .insert(request_id.clone(), value_bytes);
+ .insert(request_id.clone(), (value_bytes, details.clone()));
self.pending_runtime_request_bytes += value_bytes;
Ok(vec![AcpxProviderStateEvent::PermissionRequest {
request_id,
@@ -238,7 +280,8 @@ impl AcpxProviderState {
question_set,
origin,
} => {
- let value_bytes = value_bytes(&question_set)?;
+ let value_bytes = value_bytes(&question_set)?
+ + origin.as_ref().map(value_bytes).transpose()?.unwrap_or(0);
self.admit_runtime_request(&request_id, value_bytes)?;
let runtime_request_id = project_acpx_runtime_request_id(&request_id)
.expect("a decoded ACPX input request has a bounded identity");
@@ -260,6 +303,7 @@ impl AcpxProviderState {
runtime_request_id,
value_bytes,
question_set: question_set.clone(),
+ origin: origin.clone(),
},
)
.is_some()
@@ -320,8 +364,9 @@ impl AcpxProviderState {
.expect("a decoded terminal event has a turn binding")
.to_owned();
self.scope.clear_turn(&turn_id)?;
- self.clear_pending_requests();
- let mut events = Vec::new();
+ let mut events = self.end_pending_runtime_requests(status);
+ // Dispatched semantic effects outlive the provider turn. Their
+ // authority results, not this terminal event, retire them.
if status == AcpxTurnStatus::Completed && !self.assistant_text.is_empty() {
events.push(AcpxProviderStateEvent::AssistantMessage {
turn_id: turn_id.clone(),
@@ -379,7 +424,7 @@ impl AcpxProviderState {
}
pub fn complete_permission(&mut self, request_id: &str) -> Result<(), LocalRunnerError> {
- let value_bytes = self.pending_permissions.remove(request_id).ok_or_else(|| {
+ let (value_bytes, _) = self.pending_permissions.remove(request_id).ok_or_else(|| {
LocalRunnerError::invalid("ACPX permission result has no pending request")
})?;
self.pending_runtime_request_bytes = self
@@ -388,6 +433,12 @@ impl AcpxProviderState {
Ok(())
}
+ pub fn pending_permission(&self, request_id: &str) -> Option<&Value> {
+ self.pending_permissions
+ .get(request_id)
+ .map(|(_, details)| details)
+ }
+
pub fn complete_input(&mut self, request_id: &str) -> Result<(), LocalRunnerError> {
let provider_request_id = self
.pending_inputs
@@ -571,12 +622,33 @@ impl AcpxProviderState {
Ok(())
}
- fn clear_pending_requests(&mut self) {
- self.pending_tools.clear();
- self.pending_tool_input_bytes = 0;
- self.pending_permissions.clear();
- self.pending_inputs.clear();
+ pub(crate) fn end_pending_runtime_requests(
+ &mut self,
+ status: AcpxTurnStatus,
+ ) -> Vec {
+ let mut events = Vec::new();
+ for (request_id, _) in std::mem::take(&mut self.pending_permissions) {
+ events.push(AcpxProviderStateEvent::RuntimeRequestEnded {
+ request_id,
+ question_set: None,
+ origin: None,
+ status,
+ });
+ }
+ for (request_id, pending) in std::mem::take(&mut self.pending_inputs) {
+ events.push(AcpxProviderStateEvent::RuntimeRequestEnded {
+ request_id,
+ question_set: Some(pending.question_set),
+ origin: pending.origin,
+ status,
+ });
+ }
self.pending_runtime_request_bytes = 0;
+ events
+ }
+
+ pub(crate) fn pending_tool_count(&self) -> usize {
+ self.pending_tools.len()
}
}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs
index f524d8a2962..9bb2c3b6c0b 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_sidecar_transport.rs
@@ -99,9 +99,12 @@ impl AcpxSidecarTransport {
"claude" => &["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
"codex" => &["OPENAI_API_KEY", "CODEX_API_KEY"],
"grok" => &["XAI_API_KEY", "PAPERCLIP_ACPX_GROK_AUTH_JSON_SECRET"],
+ "pi" => &["OPENROUTER_API_KEY"],
+ "cursor" => &["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"],
+ "copilot" => &["COPILOT_GITHUB_TOKEN"],
_ => {
return Err(LocalRunnerError::invalid(
- "ACPX sidecar credentials require a qualified claude, codex, or grok agent",
+ "ACPX sidecar credentials require a known agent profile",
))
}
};
@@ -128,6 +131,11 @@ impl AcpxSidecarTransport {
"PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT",
"PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST",
];
+ if matches!(agent, "pi" | "cursor" | "copilot") {
+ // Credential values alone are not proof of an explicit task binding.
+ // The sidecar checks this controller-minted provider/session marker.
+ keys.push("PAPERCLIP_ACPX_CREDENTIAL_BINDING");
+ }
keys.extend_from_slice(credential_keys);
Self::start_with_environment_keys(config, &keys)
}
@@ -688,6 +696,9 @@ fn response_error_classification(error: &ResponseError) -> &'static str {
"AGENT_STARTUP_FAILED.OTHER" => return "agent_startup_other",
"AGENT_DISCONNECTED" => return "agent_disconnected",
"AUTH_REQUIRED" => return "authentication_required",
+ "COPILOT_AUTH_REQUIRED" => return "authentication_required",
+ "COPILOT_ENTITLEMENT_DENIED" => return "provider_entitlement_denied",
+ "COPILOT_MODEL_UNAVAILABLE" => return "requested_model_unsupported",
"SESSION_RESUME_REQUIRED" => return "session_resume_required",
"SESSION_MODE_REPLAY_FAILED" => return "session_mode_replay_failed",
"SESSION_MODEL_REPLAY_FAILED" => return "session_model_replay_failed",
@@ -798,6 +809,30 @@ mod tests {
}
}
+ #[test]
+ fn candidate_auth_diagnostics_use_only_closed_codes_and_never_provider_text() {
+ for (code, expected) in [
+ ("COPILOT_AUTH_REQUIRED", "authentication_required"),
+ ("COPILOT_ENTITLEMENT_DENIED", "provider_entitlement_denied"),
+ ("COPILOT_MODEL_UNAVAILABLE", "requested_model_unsupported"),
+ ("COPILOT_AUTH_REQUIRED_EXTRA", "unclassified"),
+ ("COPILOT_REQUEST_FAILED", "unclassified"),
+ ("UNKNOWN_CANDIDATE_FAILURE", "unclassified"),
+ ] {
+ let error = ResponseError {
+ code: code.to_owned(),
+ message:
+ "private-token-canary COPILOT_AUTH_REQUIRED https://user:secret@example.invalid"
+ .to_owned(),
+ retryable: false,
+ };
+ let classification = response_error_classification(&error);
+ assert_eq!(classification, expected);
+ assert!(!classification.contains("canary"));
+ assert!(!classification.contains("secret"));
+ }
+ }
+
#[test]
fn classifies_only_allowlisted_internal_sidecar_failures() {
let error = |code: &str, message: &str| ResponseError {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs b/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs
index 2d84a6dbe70..58e94296539 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-acpx-sidecar.rs
@@ -148,6 +148,8 @@ fn run() -> Result<(), Box> {
"url": std::env::var("PAPERCLIP_NATIVE_MCP_URL").ok(),
"hasToken": std::env::var("PAPERCLIP_NATIVE_MCP_TOKEN").is_ok(),
"hasUnrelatedSecret": std::env::var("UNRELATED_EVAL_SECRET").is_ok(),
+ "credentialBinding": std::env::var("PAPERCLIP_ACPX_CREDENTIAL_BINDING").ok(),
+ "credentialKeys": (["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "OPENAI_API_KEY", "CODEX_API_KEY", "OPENROUTER_API_KEY", "CURSOR_API_KEY", "CURSOR_AUTH_TOKEN", "COPILOT_GITHUB_TOKEN", "GITHUB_TOKEN", "GH_TOKEN"].into_iter().filter(|key| std::env::var(key).is_ok()).collect::>()),
}
}),
)?;
@@ -204,6 +206,10 @@ fn run() -> Result<(), Box> {
| "goals"
| "bootstrap-wrong-model"
| "bootstrap-wrong-run"
+ | "controls"
+ | "controls-wrong-ack"
+ | "controls-lazy"
+ | "controls-downgrade"
| "turns"
| "turns-wrong-turn"
| "turns-wrong-cancel"
@@ -226,6 +232,8 @@ fn run() -> Result<(), Box> {
| "turns-mismatched-reserved-result-terminal"
| "turns-unauthorized-tool"
| "turns-permission"
+ | "permissions-interactive"
+ | "permissions-wrong-ack"
| "resolutions"
| "resolutions-error-redaction"
| "resolutions-projected-id"
@@ -387,7 +395,12 @@ fn run() -> Result<(), Box> {
)?;
next_sequence += 1;
}
- if command == "turn.start" && mode == "turns-permission" {
+ if command == "turn.start"
+ && matches!(
+ mode,
+ "turns-permission" | "permissions-interactive" | "permissions-wrong-ack"
+ )
+ {
write_turn_event(
&mut stdout,
next_sequence,
@@ -398,6 +411,7 @@ fn run() -> Result<(), Box> {
"requestId":"permission-1",
"kind":"execute",
"title":"Run a command?",
+ "choices":[{"key":"accept","label":"Allow once"},{"key":"cancel","label":"Cancel"}],
}),
)?;
next_sequence += 1;
@@ -671,6 +685,9 @@ fn bootstrap_success(
profile_digest: &str,
) -> Value {
if command == "permission.resolve" {
+ if mode.starts_with("permissions-") {
+ return json!({"protocolVersion": GENERATED_ACPX_SIDECAR_PROTOCOL_VERSION, "id": id, "ok":true, "result":{"resolved": mode != "permissions-wrong-ack"}});
+ }
return json!({
"protocolVersion": GENERATED_ACPX_SIDECAR_PROTOCOL_VERSION,
"id": id,
@@ -717,6 +734,7 @@ fn bootstrap_success(
"providerLifetimeFenceCandidates": [60001, 60002, 60003],
},
"status": {},
+ "turnControls": {"steering": matches!(mode, "controls" | "controls-wrong-ack" | "controls-downgrade"), "queuedFollowUp":matches!(mode, "controls" | "controls-wrong-ack" | "controls-downgrade")},
})
}
"run.attach" => json!({
@@ -724,8 +742,13 @@ fn bootstrap_success(
"catalogRevision": params.get("catalogRevision"),
}),
"turn.start" => json!({
+ "turnControls": {"steering": matches!(mode, "controls" | "controls-wrong-ack" | "controls-lazy"), "queuedFollowUp":matches!(mode, "controls" | "controls-wrong-ack" | "controls-lazy")},
"turnId": if mode == "turns-wrong-turn" { "wrong-turn" } else { params.get("turnId").and_then(Value::as_str).unwrap_or("missing") },
}),
+ "turn.steer" => json!({
+ "accepted": true, "turnId": params.get("turnId"), "controlId": params.get("controlId"),
+ "mode": if mode == "controls-wrong-ack" { json!("wrong") } else { params["mode"].clone() },
+ }),
"turn.cancel" => json!({"cancelled":mode != "turns-wrong-cancel"}),
"session.suspend" => json!({
"suspended":mode != "suspend-wrong-ack",
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs b/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs
index bac103d0ff0..ce3b9e3e4b6 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/bin/fake-codex-app-server.rs
@@ -33,9 +33,9 @@ fn send(value: Value) -> io::Result<()> {
stdout.flush()
}
-fn send_split_event_burst(state: &FakeState) -> io::Result<()> {
+fn send_split_event_burst(state: &FakeState, count: usize) -> io::Result<()> {
let turn_id = state.active_turn_id.as_deref().unwrap_or("provider-turn-1");
- for index in 0..96 {
+ for index in 0..count {
send(json!({
"method": "item/agentMessage/delta",
"params": {
@@ -619,6 +619,13 @@ fn run() -> Result<(), Box> {
let emit_runtime_elicitation = args.iter().any(|value| value == "--runtime-elicitation");
let emit_structured_activity = args.iter().any(|value| value == "--structured-activity");
let emit_split_event_burst = args.iter().any(|value| value == "--split-event-burst");
+ let split_event_prefix_count = argument(&args, "--split-event-prefix-count")
+ .map(|value| value.parse::())
+ .transpose()?
+ .unwrap_or(96);
+ if !(1..=4096).contains(&split_event_prefix_count) {
+ return Err("split event prefix count must be between 1 and 4096".into());
+ }
let split_event_suffix_count = argument(&args, "--split-event-suffix-count")
.map(|value| value.parse::())
.transpose()?
@@ -1669,7 +1676,7 @@ fn run() -> Result<(), Box> {
send_structured_activity(&state)?;
finish_turn(&state_path, &mut state, "completed")?;
} else if emit_split_event_burst {
- send_split_event_burst(&state)?;
+ send_split_event_burst(&state, split_event_prefix_count)?;
} else if emit_question {
send_question(&state)?;
} else if !hold_turn {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs b/packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs
index c0742fe7f69..437e0ea01a0 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/codex_provider.rs
@@ -3787,11 +3787,17 @@ fn codex_question_set(
}
let option_id = format!("option-{}", index + 1);
labels.insert(option_id.clone(), label.chars().take(240).collect());
- Some(json!({
+ let mut canonical_option = json!({
"id": option_id,
"label": label.chars().take(240).collect::(),
- "description": option.get("description").and_then(Value::as_str).map(|value| value.chars().take(1000).collect::()),
- }))
+ });
+ // Native descriptions are optional/nullable. Canonical input
+ // permits an omitted description or a string, never null.
+ if let Some(description) = option.get("description").and_then(Value::as_str) {
+ canonical_option["description"] =
+ json!(description.chars().take(1000).collect::());
+ }
+ Some(canonical_option)
})
.collect::>();
if !options.is_empty() && canonical_options.len() != options.len() {
@@ -4628,6 +4634,44 @@ done
);
}
+ #[test]
+ fn codex_optional_option_descriptions_produce_schema_valid_resolvable_input() {
+ let (_, question_set, option_labels) = codex_question_set(
+ &json!(42),
+ &json!({"questions":[{
+ "id":"environment", "question":"Where?",
+ "options":[
+ {"label":"Staging"},
+ {"label":"Production", "description":null},
+ {"label":"Preview", "description":"Temporary deployment"}
+ ]
+ }]}),
+ )
+ .unwrap();
+ let options = question_set["questions"][0]["options"].as_array().unwrap();
+ assert!(options[0].get("description").is_none());
+ assert!(options[1].get("description").is_none());
+ assert_eq!(options[2]["description"], "Temporary deployment");
+ let pending = PendingRuntimeRequest {
+ rpc_id: json!(42),
+ turn_id: "turn-1".to_owned(),
+ method: "item/tool/requestUserInput".to_owned(),
+ params: Value::Null,
+ question_set,
+ option_labels,
+ retained_bytes: 0,
+ };
+ for (index, label) in ["Staging", "Production", "Preview"].iter().enumerate() {
+ // The canonical response validator also validates the retained
+ // question-set schema, just as durable presentation does.
+ let native = codex_question_response(&pending, &json!({
+ "schema":"paperclip.question_response.v1",
+ "answers":{"environment":{"selectedOptionIds":[format!("option-{}", index + 1)]}}
+ })).unwrap();
+ assert_eq!(native["answers"]["environment"]["answers"], json!([label]));
+ }
+ }
+
#[test]
fn converts_codex_questions_and_responses_without_provider_leakage() {
let (request_id, question_set, labels) = codex_question_set(
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 bc28290fef0..24418539af8 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
@@ -16,8 +16,8 @@ pub use runner::{
TerminalDeliveryReconciliation,
};
pub(crate) use state::{
- create_private_temporary_file, open_private_regular_file, redact_text,
- sanitize_semantic_tool_input, sanitize_value, verify_private_directory,
+ create_private_temporary_file, open_private_regular_file, redact_sensitive_text_values,
+ redact_text, sanitize_semantic_tool_input, sanitize_value, verify_private_directory,
};
pub use state::{
Command, CommandDisposition, DurableState, DurableStateStore, EventPriority,
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 8f4eab51cab..9bcb817a83e 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
@@ -251,6 +251,13 @@ pub enum TerminalDeliveryReconciliation {
pub trait CommandExecutor {
fn execute(&mut self, command: &Command) -> Result;
+ /// Opt in only when semantic result delivery validates an exact durable
+ /// call receipt and cannot dispatch the underlying business operation.
+ /// Ordinary commands and providers without this proof remain indeterminate.
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ Ok(false)
+ }
+
/// Advances provider-side event correlation after a durable `run.attach`
/// has moved runnerd to the next run-bound authority. The runner validates
/// and persists the new authority before invoking this infallible hook.
@@ -1724,6 +1731,15 @@ fn process_command(
}
}
match state.begin_command(command)? {
+ CommandDisposition::Replay(result)
+ if result.status == "indeterminate"
+ && command.command_type == "semantic_tool.result"
+ && executor.can_reconcile_result_delivery()? =>
+ {
+ // begin_command already checked the complete immutable command
+ // fingerprint. Only replay receipt delivery, never the operation.
+ state.resume_result_delivery(command)?;
+ }
CommandDisposition::Replay(result) => {
let lifecycle =
if result.status == "pending" || state.pending_provider_cleanup.is_some() {
@@ -1742,8 +1758,8 @@ fn process_command(
CommandDisposition::Execute => {}
}
// Persist the pending marker before any command effect. If the process dies
- // in the effect window, recovery returns an indeterminate result and never
- // executes the same logical command twice.
+ // in the effect window, recovery remains indeterminate unless the provider
+ // explicitly supports exact, idempotent semantic result delivery above.
store.save(state)?;
let mut execution = match executor.execute(command) {
Ok(execution) => execution,
@@ -1996,6 +2012,125 @@ mod tests {
}
}
+ #[test]
+ fn response_persistence_failure_with_blocked_drain_remains_indeterminate_on_replay() {
+ struct PersistenceFailedResponseExecutor {
+ delivered_responses: usize,
+ retained_reads: usize,
+ }
+ impl CommandExecutor for PersistenceFailedResponseExecutor {
+ fn execute(
+ &mut self,
+ command: &Command,
+ ) -> Result {
+ assert_eq!(command.command_type, "request.resolve");
+ assert_eq!(command.payload["requestId"], "input-1");
+ // Model a real pipe delivery ACK followed by an uncertain
+ // provider-state write. Its staged settlement is not durable.
+ self.delivered_responses += 1;
+ Err(DurableRunnerError::invalid(
+ "ACPX response state persistence failed after delivery",
+ ))
+ }
+
+ fn retained_events(&mut self) -> Result, DurableRunnerError> {
+ self.retained_reads += 1;
+ Err(DurableRunnerError::invalid(
+ "ACPX persistence latch blocks retained settlement",
+ ))
+ }
+
+ fn poll_events(&mut self) -> Result, DurableRunnerError> {
+ panic!("failed response settlement must not poll or restore the provider")
+ }
+
+ fn acknowledge_events(&mut self, _: usize) -> Result<(), DurableRunnerError> {
+ panic!("an uncertain settlement must not receive a journal ACK")
+ }
+ }
+
+ let directory = std::env::temp_dir().join(format!(
+ "paperclip-response-persistence-failure-{}",
+ uuid::Uuid::new_v4()
+ ));
+ let config = config(directory.clone());
+ let store = DurableStateStore::new(&directory).unwrap();
+ let (mut state, _) = store.load_or_create(&config).unwrap();
+ let mut executor = PersistenceFailedResponseExecutor {
+ delivered_responses: 0,
+ retained_reads: 0,
+ };
+ let mut resolve = command("request.resolve");
+ resolve.payload = json!({
+ "requestId": "input-1",
+ "resolution": {"action": "submit", "response": {"answer": "accepted"}},
+ });
+
+ let failure =
+ process_command(&mut state, &store, &config, &mut executor, &resolve).unwrap_err();
+ assert!(failure
+ .to_string()
+ .starts_with("ACPX response state persistence failed after delivery"));
+ assert!(failure
+ .to_string()
+ .contains("retained failure evidence remains uncommitted"));
+ assert!(failure
+ .to_string()
+ .contains("ACPX persistence latch blocks retained settlement"));
+ assert_eq!(executor.delivered_responses, 1);
+ assert_eq!(executor.retained_reads, 1);
+ assert_eq!(
+ state.processed_commands[&resolve.command_id].status,
+ "pending"
+ );
+ assert!(state.outbox.is_empty());
+ assert_eq!(state.highest_source_seq(), 0);
+
+ // Inspect the actual journal before recovery changes pending into
+ // indeterminate. Neither a failed/completed result nor a resolved event
+ // may replace the pre-effect marker while the provider snapshot is unsure.
+ let journal: DurableState =
+ serde_json::from_slice(&fs::read(store.path()).unwrap()).unwrap();
+ assert_eq!(
+ journal.processed_commands[&resolve.command_id].status,
+ "pending"
+ );
+ assert!(journal.outbox.is_empty());
+ assert_eq!(journal.highest_source_seq(), 0);
+
+ let pending = process_command(&mut state, &store, &config, &mut executor, &resolve)
+ .unwrap()
+ .0;
+ assert_eq!(pending.status, "pending");
+ assert_eq!(executor.delivered_responses, 1);
+ assert_eq!(executor.retained_reads, 1);
+
+ let (mut recovered, existed) = store.load_or_create(&config).unwrap();
+ assert!(existed);
+ assert_eq!(
+ recovered.processed_commands[&resolve.command_id].status,
+ "indeterminate"
+ );
+ let mut replacement = CountingExecutor { calls: 0 };
+ let replay = process_command(&mut recovered, &store, &config, &mut replacement, &resolve)
+ .unwrap()
+ .0;
+ assert_eq!(replay.status, "indeterminate");
+ assert_eq!(replay.result["code"], "execution_indeterminate");
+ assert_eq!(
+ replacement.calls, 0,
+ "recovery must never resend the response"
+ );
+ assert!(recovered.outbox.is_empty());
+ let (reloaded_again, _) = store.load_or_create(&config).unwrap();
+ assert_eq!(
+ reloaded_again.processed_commands[&resolve.command_id],
+ replay
+ );
+ assert!(reloaded_again.outbox.is_empty());
+ fs::remove_dir_all(directory).unwrap();
+ }
+
#[test]
fn unlimited_lifetime_keeps_attempts_bounded_after_weeks_of_work() {
let mut config = config(std::env::temp_dir());
@@ -4366,6 +4501,150 @@ mod tests {
}
}
+ #[test]
+ fn interrupted_result_delivery_reconciles_exact_receipts_without_reexecuting_operations() {
+ use crate::provider_bridge::{
+ authorized_tool_catalog_digest, AuthorizedTool, AuthorizedToolSet, ProviderToolBridge,
+ ToolResult,
+ };
+ struct ReceiptExecutor {
+ path: PathBuf,
+ deliveries: usize,
+ supported: bool,
+ }
+ impl CommandExecutor for ReceiptExecutor {
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ Ok(self.supported)
+ }
+ fn execute(
+ &mut self,
+ command: &Command,
+ ) -> Result {
+ assert_eq!(
+ command.command_type, "semantic_tool.result",
+ "must never redispatch an operation"
+ );
+ self.deliveries += 1;
+ let mut bridge: ProviderToolBridge =
+ serde_json::from_slice(&fs::read(&self.path).unwrap()).unwrap();
+ let result: ToolResult = serde_json::from_value(command.payload.clone()).unwrap();
+ bridge
+ .apply_result(result)
+ .map_err(|error| DurableRunnerError::invalid(error.to_string()))?;
+ fs::write(&self.path, serde_json::to_vec(&bridge).unwrap()).unwrap();
+ Ok(CommandExecution::result(json!({"status":"delivered"})))
+ }
+ }
+ for applied in [false, true] {
+ for supported in [false, true] {
+ let directory = std::env::temp_dir().join(format!(
+ "result-delivery-crash-{}-{applied}-{supported}",
+ std::process::id()
+ ));
+ let _ = fs::remove_dir_all(&directory);
+ let config = config(directory.clone());
+ let store = DurableStateStore::new(&directory).unwrap();
+ let (mut state, _) = store.load_or_create(&config).unwrap();
+ let operations = vec![AuthorizedTool {
+ operation_id: "write_document".into(),
+ version: 1,
+ description: "Fixture write already committed on the server".into(),
+ input_schema: json!({"type":"object"}),
+ response_schema: json!({"type":"object"}),
+ }];
+ let mut bridge = ProviderToolBridge::default();
+ bridge
+ .prepare(AuthorizedToolSet {
+ schema: "paperclip.runner.authorized-tools.v1".into(),
+ schema_version: 1,
+ catalog_digest: authorized_tool_catalog_digest(&operations).unwrap(),
+ operations,
+ })
+ .unwrap();
+ bridge
+ .begin_call(
+ "call-1".into(),
+ "write_document".into(),
+ json!({"content":"exact original"}),
+ )
+ .unwrap();
+ bridge.settle_turn("provider_turn_stopped").unwrap();
+ let path = directory.join("tool-receipts.json");
+ fs::write(&path, serde_json::to_vec(&bridge).unwrap()).unwrap();
+ let mut executor = ReceiptExecutor {
+ path: path.clone(),
+ deliveries: 0,
+ supported,
+ };
+ let mut delivery = command("semantic_tool.result");
+ delivery.payload = json!({"callId":"call-1", "operationId":"write_document", "isError":false,
+ "result":{"revisionId":"one-committed-write"}});
+ assert_eq!(
+ state.begin_command(&delivery).unwrap(),
+ CommandDisposition::Execute
+ );
+ store.save(&state).unwrap();
+ if applied {
+ executor.execute(&delivery).unwrap();
+ }
+ // Crash before receipt application, or after receipt application
+ // but before the command completion journal commits.
+ let (mut recovered, _) = store.load_or_create(&config).unwrap();
+ let before = executor.deliveries;
+ let (result, _) =
+ process_command(&mut recovered, &store, &config, &mut executor, &delivery)
+ .unwrap();
+ assert_eq!(
+ result.status,
+ if supported {
+ "completed"
+ } else {
+ "indeterminate"
+ }
+ );
+ assert_eq!(executor.deliveries, before + usize::from(supported));
+ let saved: ProviderToolBridge =
+ serde_json::from_slice(&fs::read(&path).unwrap()).unwrap();
+ assert_eq!(
+ saved.pending_calls().count(),
+ usize::from(!applied && !supported)
+ );
+ let (mut reopened, _) = store.load_or_create(&config).unwrap();
+ assert_eq!(
+ process_command(&mut reopened, &store, &config, &mut executor, &delivery)
+ .unwrap()
+ .0,
+ result
+ );
+ assert_eq!(executor.deliveries, before + usize::from(supported));
+ let mut changed = delivery.clone();
+ changed.payload["result"]["revisionId"] = json!("conflicting-write");
+ assert!(
+ process_command(&mut reopened, &store, &config, &mut executor, &changed)
+ .unwrap_err()
+ .to_string()
+ .contains("different command data")
+ );
+ assert_eq!(executor.deliveries, before + usize::from(supported));
+ let mut ordinary = command("session.open");
+ ordinary.command_id = "ordinary-effect".into();
+ ordinary.controller_seq = 2;
+ reopened.begin_command(&ordinary).unwrap();
+ store.save(&reopened).unwrap();
+ let (mut after_crash, _) = store.load_or_create(&config).unwrap();
+ assert_eq!(
+ process_command(&mut after_crash, &store, &config, &mut executor, &ordinary)
+ .unwrap()
+ .0
+ .status,
+ "indeterminate"
+ );
+ assert_eq!(executor.deliveries, before + usize::from(supported));
+ fs::remove_dir_all(directory).unwrap();
+ }
+ }
+ }
+
#[test]
fn process_death_after_journaling_remains_indeterminate_without_reexecution() {
let directory = std::env::temp_dir().join(format!(
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 e137a20af78..2a41066875c 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
@@ -532,6 +532,8 @@ impl DurableState {
"durable identity or validation semantics contain credential-shaped material",
));
}
+ let sanitized_payload =
+ preserve_bounded_display_content(event_type.as_str(), &payload, sanitized_payload)?;
let sanitized_payload =
finalize_semantic_tool_input_payload(event_type.as_str(), &payload, sanitized_payload)?;
@@ -773,6 +775,28 @@ impl DurableState {
Ok(CommandDisposition::Execute)
}
+ pub(crate) fn resume_result_delivery(
+ &mut self,
+ command: &Command,
+ ) -> Result<(), DurableRunnerError> {
+ if command.command_type != "semantic_tool.result"
+ || !matches!(self.begin_command(command)?, CommandDisposition::Replay(ref prior) if prior.status == "indeterminate")
+ {
+ return Err(DurableRunnerError::invalid(
+ "only exact indeterminate result delivery can resume",
+ ));
+ }
+ self.processed_commands
+ .get_mut(&command.command_id)
+ .expect("validated retained delivery receipt")
+ .status = "pending".to_owned();
+ self.record_diagnostic(format!(
+ "reconciling semantic result delivery command {}",
+ command.command_id
+ ));
+ Ok(())
+ }
+
pub fn complete_command(
&mut self,
command: &Command,
@@ -1592,56 +1616,132 @@ pub(crate) fn sanitize_value(value: &Value) -> Value {
}
}
+fn sanitize_bounded_display_value(value: &Value) -> Value {
+ match value {
+ Value::Object(object) => Value::Object(
+ object
+ .iter()
+ .map(|(key, value)| {
+ let value = if protocol_authorization_boundary(key, value) {
+ value.clone()
+ } else if sensitive_key(key, value) {
+ Value::String("[REDACTED]".to_owned())
+ } else {
+ sanitize_bounded_display_value(value)
+ };
+ (key.clone(), value)
+ })
+ .collect(),
+ ),
+ Value::Array(values) => {
+ Value::Array(values.iter().map(sanitize_bounded_display_value).collect())
+ }
+ Value::String(text) => Value::String(redact_sensitive_text_values(text)),
+ value => value.clone(),
+ }
+}
+
+fn preserve_bounded_display_content(
+ event_type: &str,
+ original: &Value,
+ mut sanitized: Value,
+) -> Result {
+ use crate::acpx_event_payload::{has_bounded_rich_display_shape, validate_question_set};
+
+ // Rich display payloads are already closed and byte-bounded by their exact
+ // protocol schemas. Applying a diagnostic preview cap again would silently
+ // change complete output into a truncated artifact without its metadata.
+ if has_bounded_rich_display_shape(event_type, original) {
+ let preserved = sanitize_bounded_display_value(original);
+ if !has_bounded_rich_display_shape(event_type, &preserved) {
+ return Err(DurableRunnerError::invalid(
+ "redacted display activity exceeds its schema bounds",
+ ));
+ }
+ return Ok(preserved);
+ }
+ if matches!(
+ event_type,
+ "runtime_request.created" | "runtime_request.expired" | "runtime_request.cancelled"
+ ) {
+ if let Some(input) = original.pointer("/request/input") {
+ if input.get("schema").and_then(Value::as_str) == Some("paperclip.question_set.v1") {
+ validate_question_set(input)
+ .map_err(|error| DurableRunnerError::invalid(error.to_string()))?;
+ let mut preserved = sanitize_bounded_display_value(input);
+ if &preserved != input {
+ let description = preserved
+ .get("description")
+ .and_then(Value::as_str)
+ .unwrap_or("");
+ preserved["description"] = Value::String(format!(
+ "Sensitive values were redacted from this request.\n\n{description}"
+ ));
+ }
+ validate_question_set(&preserved)
+ .map_err(|error| DurableRunnerError::invalid(error.to_string()))?;
+ if let Some(target) = sanitized.pointer_mut("/request/input") {
+ *target = preserved;
+ }
+ }
+ }
+ }
+ Ok(sanitized)
+}
+
pub(crate) fn sanitize_semantic_tool_input(
operation_id: &str,
input: &Value,
) -> Result {
- let mut sanitized = sanitize_value(input);
- // Mutation prose is the user's intended work, not a diagnostic. Preserve
- // ordinary references to a token in these declared text fields; credential
- // syntax and high-confidence secret values are still scrubbed. All other
- // fields and operations retain the strict diagnostic policy.
+ // This value is executed by the authority. Diagnostic preview limits and
+ // redaction must never turn it into a different, apparently valid write.
+ // Hex-encoded authenticated frames double JSON bytes. Reserve envelope
+ // space below the 1 MiB wire cap before any effect can start.
+ // Enforce the transport envelope before dispatch, and reject content that
+ // cannot cross its credential policy instead of silently rewriting it.
+ if serde_json::to_vec(input)
+ .map_err(|_| DurableRunnerError::invalid("semantic tool input is not serializable"))?
+ .len()
+ > 480 * 1024
+ {
+ return Err(DurableRunnerError::invalid(
+ "semantic tool input exceeds the 480 KiB encrypted transport limit",
+ ));
+ }
+ let mut checked = sanitize_bounded_display_value(input);
let prose_fields: &[&str] = match operation_id {
"create_task" => &["title", "description", "initialPlan"],
"create_project" => &["name", "description"],
"write_document" => &["title", "body", "changeSummary"],
+ "update_agent_instructions" => &["content"],
_ => &[],
};
- if let Some(sanitized_input) = sanitized.as_object_mut() {
+ if let Some(object) = checked.as_object_mut() {
for field in prose_fields {
if let Some(text) = input.get(*field).and_then(Value::as_str) {
- sanitized_input.insert(
+ object.insert(
(*field).to_owned(),
- // The tool/API schema bounds business content. A diagnostic
- // preview limit must never truncate a plan or document.
Value::String(redact_sensitive_text_values_with_context(text, true)),
);
}
}
}
- if !matches!(operation_id, "paperclip_finish" | "paperclip_block") {
- return Ok(sanitized);
- }
- let Some(summary) = input.get("summary").and_then(Value::as_str) else {
- return Ok(sanitized);
- };
- if summary.chars().count() > MAX_COMPLETION_SUMMARY_CHARS {
+ if matches!(operation_id, "paperclip_finish" | "paperclip_block")
+ && input
+ .get("summary")
+ .and_then(Value::as_str)
+ .is_some_and(|summary| summary.chars().count() > MAX_COMPLETION_SUMMARY_CHARS)
+ {
return Err(DurableRunnerError::invalid(
"semantic completion summary exceeds the 12,000 character limit",
));
}
- let Some(sanitized_input) = sanitized.as_object_mut() else {
- return Ok(sanitized);
- };
- // Completion summary is the schema-bounded user-facing answer, not an
- // untrusted diagnostic snippet. Preserve it in full while applying the
- // same credential scrubber used by every durable string. All other fields
- // retain the generic 4 KiB diagnostic bound.
- sanitized_input.insert(
- "summary".to_owned(),
- Value::String(redact_sensitive_text_values(summary)),
- );
- Ok(sanitized)
+ if checked != *input {
+ return Err(DurableRunnerError::invalid(
+ "semantic tool input contains credential material; refusing to execute altered arguments",
+ ));
+ }
+ Ok(input.clone())
}
fn finalize_semantic_tool_input_payload(
@@ -1741,7 +1841,7 @@ pub(crate) fn redact_text(input: &str) -> String {
redacted
}
-fn redact_sensitive_text_values(input: &str) -> String {
+pub(crate) fn redact_sensitive_text_values(input: &str) -> String {
redact_sensitive_text_values_with_context(input, false)
}
@@ -2869,7 +2969,7 @@ mod tests {
let config = config(PathBuf::from("unused"));
let mut state = DurableState::new(&config);
let summary = format!(
- "token=do-not-persist {} Authorization: Bearer late-provider-secret COMPLETE-DURABLE-SUMMARY",
+ "Answer: {} COMPLETE-DURABLE-SUMMARY",
"A complete paragraph for the user. ".repeat(180)
);
let input = json!({"summary": summary});
@@ -2913,11 +3013,11 @@ mod tests {
.pointer("/payload/payload/semantic_tool/input")
.unwrap();
let transmitted_summary = transmitted["summary"].as_str().unwrap();
- assert!(transmitted_summary.starts_with("token=[REDACTED] "));
+ assert!(transmitted_summary.starts_with("Answer: "));
assert!(transmitted_summary.ends_with(" COMPLETE-DURABLE-SUMMARY"));
assert!(!transmitted_summary.contains("do-not-persist"));
assert!(!transmitted_summary.contains("late-provider-secret"));
- assert!(transmitted_summary.contains("Authorization: Bearer [REDACTED]"));
+ assert_eq!(transmitted, &input);
assert!(!transmitted_summary.contains("…[truncated]"));
assert_eq!(
state.outbox[0]
@@ -2938,7 +3038,7 @@ mod tests {
let mut changed_tail = payload.clone();
changed_tail["semantic_tool"]["input"]["summary"] = Value::String(format!(
- "token=[REDACTED] {} CHANGED-DURABLE-SUMMARY",
+ "Answer: {} CHANGED-DURABLE-SUMMARY",
"A complete paragraph for the user. ".repeat(180)
));
assert!(state
@@ -3146,6 +3246,78 @@ mod tests {
assert_eq!(payload["diagnostic"], json!("token=[REDACTED]"));
}
+ #[test]
+ fn durable_display_content_preserves_complete_utf8_plans_and_tool_output() {
+ let mut config = config(PathBuf::from("unused"));
+ config.max_outbox_bytes = 512 * 1024;
+ config.max_frame_bytes = 256 * 1024;
+ let mut state = DurableState::new(&config);
+ let text = "Review 漢字\n".repeat(2_000);
+ let input = json!({
+ "schema":"paperclip.question_set.v1",
+ "description":text,
+ "questions":[{"id":"revision-123","prompt":"Approve?","required":true,"answerMode":"single_select","options":[{"id":"accept","label":"Accept"},{"id":"reject","label":"Reject"}]}]
+ });
+ state.enqueue_event(&config, "runtime_request.created", EventPriority::P0, json!({
+ "request":{"schema":"paperclip.runtime_request.v2","requestId":"request-1","type":"input","status":"pending","input":input},
+ "diagnostic":text
+ })).unwrap();
+ let stored = state.outbox[0]
+ .envelope
+ .pointer("/payload/payload")
+ .unwrap();
+ assert_eq!(
+ stored.pointer("/request/input/description"),
+ Some(&json!(text))
+ );
+ assert!(stored["diagnostic"]
+ .as_str()
+ .unwrap()
+ .ends_with("…[truncated]"));
+
+ state.enqueue_event(&config, "tool.execution.completed", EventPriority::P1, json!({
+ "schema":"paperclip.tool.execution.v1","executionId":"tool-1","transport":"builtin","operation":"read","status":"completed",
+ "output":text,"outputBytes":text.len(),"outputTruncated":false,"outputDigest":null
+ })).unwrap();
+ let stored = state.outbox[1]
+ .envelope
+ .pointer("/payload/payload")
+ .unwrap();
+ assert_eq!(stored["output"], text);
+ assert_eq!(stored["outputTruncated"], false);
+
+ for event_type in ["runtime_request.expired", "runtime_request.cancelled"] {
+ state.enqueue_event(&config, event_type, EventPriority::P0, json!({
+ "requestId":"request-1", "replayAllowed":false,
+ "request":{"schema":"paperclip.runtime_request.v2","requestId":"request-1","type":"input","status":"pending","input":input}
+ })).unwrap();
+ assert_eq!(
+ state
+ .outbox
+ .last()
+ .unwrap()
+ .envelope
+ .pointer("/payload/payload/request/input/description"),
+ Some(&json!(text))
+ );
+ }
+
+ let mut oversized = input;
+ oversized["description"] = json!("漢".repeat(70_000));
+ assert!(state
+ .enqueue_event(
+ &config,
+ "runtime_request.created",
+ EventPriority::P0,
+ json!({
+ "request":{"input":oversized}
+ })
+ )
+ .unwrap_err()
+ .to_string()
+ .contains("196 KiB"));
+ }
+
#[test]
fn credential_shaped_question_identity_and_validation_fail_closed() {
let config = config(PathBuf::from("unused"));
@@ -3284,16 +3456,31 @@ mod tests {
"{}\nAuthorization: Bearer late-credential\nFINAL-ACCEPTANCE-42",
"Document content. ".repeat(400)
);
- let safe =
- sanitize_semantic_tool_input("write_document", &json!({"body": document})).unwrap();
- let body = safe["body"].as_str().unwrap();
- assert!(body.len() > 4096);
- assert!(body.ends_with("FINAL-ACCEPTANCE-42"));
- assert!(!body.contains("late-credential"));
+ assert!(
+ sanitize_semantic_tool_input("write_document", &json!({"body": document})).is_err()
+ );
}
#[test]
- fn semantic_prose_does_not_exempt_credential_syntax_or_shapes() {
+ fn semantic_credentials_are_rejected_instead_of_executing_redacted_arguments() {
+ for input in [
+ json!({"content": "Authorization: Bearer opaque-credential"}),
+ json!({"content": "literal token=opaque-credential"}),
+ json!({"content": "ghp_secretvalue12345678901234567890"}),
+ json!({"token": "opaque-credential"}),
+ json!({"nested": {"password": "opaque-credential"}}),
+ ] {
+ let error =
+ sanitize_semantic_tool_input("update_agent_instructions", &input).unwrap_err();
+ assert!(error
+ .to_string()
+ .contains("refusing to execute altered arguments"));
+ assert!(!error.to_string().contains("opaque-credential"));
+ }
+ }
+
+ #[test]
+ fn semantic_prose_rejects_all_previously_scrubbed_credential_shapes() {
for text in [
"auth token opaque-credential",
"access token opaque-credential",
@@ -3306,56 +3493,57 @@ mod tests {
"literal access_token opaque-credential",
"literal \"token\" opaque-credential",
"literal token \"opaque-credential\"",
+ "Include the literal token sk-proj-secretvalue123456 in the document.",
+ "Include the literal token ghp_secretvalue12345678901234567890 in the document.",
+ "Include the literal token github_pat_secretvalue12345678901234567890 in the document.",
+ "Include the literal token eyJhbGciOiJIUzI1NiJ9.c2VjcmV0LWNsYWlt.signaturesecret in the document.",
] {
- assert!(!redact_text(text).contains("opaque-credential"), "{text}");
- let input = json!({"description": text, "initialPlan": text});
- assert!(
- !sanitize_semantic_tool_input("create_task", &input)
- .unwrap()
- .to_string()
- .contains("opaque-credential"),
- "{text}"
- );
+ for (operation, field) in [
+ ("create_task", "description"), ("create_task", "initialPlan"),
+ ("write_document", "body"), ("update_agent_instructions", "content"),
+ ] {
+ let input = json!({field: text});
+ assert!(sanitize_semantic_tool_input(operation, &input).is_err(), "{operation}: {text}");
+ }
}
- for secret in [
- "sk-proj-secretvalue123456",
- "ghp_secretvalue12345678901234567890",
- "github_pat_secretvalue12345678901234567890",
- "eyJhbGciOiJIUzI1NiJ9.c2VjcmV0LWNsYWlt.signaturesecret",
- ] {
- let text = format!("Include the literal token {secret} in the document.");
- assert!(!redact_text(&text).contains(secret), "{text}");
- assert!(
- !sanitize_semantic_tool_input("write_document", &json!({"body": text}))
- .unwrap()
- .to_string()
- .contains(secret)
- );
- }
- let input = json!({
- "description": "Include the literal token ACCEPTANCE-42. Authorization: Bearer opaque-credential",
- "token": "opaque-credential",
- });
- let safe = sanitize_semantic_tool_input("create_task", &input).unwrap();
- assert!(safe["description"]
- .as_str()
- .unwrap()
- .contains("ACCEPTANCE-42"));
- assert!(!safe.to_string().contains("opaque-credential"));
- let diagnostic = json!({"description": "the token opaque-credential"});
- assert!(
- !sanitize_semantic_tool_input("get_task_context", &diagnostic)
- .unwrap()
- .to_string()
- .contains("opaque-credential")
- );
- assert!(!sanitize_semantic_tool_input(
- "create_task",
- &json!({"diagnostic": "token opaque-credential"})
+ assert!(sanitize_semantic_tool_input(
+ "get_task_context",
+ &json!({
+ "description": "the token opaque-credential",
+ })
)
- .unwrap()
- .to_string()
- .contains("opaque-credential"));
+ .is_err());
+ }
+
+ #[test]
+ fn instruction_arguments_survive_the_complete_outbox_without_byte_changes() {
+ let content = format!(
+ "{}\nFINAL-TAIL-🦀",
+ "# Instructions — 日本語 🦀\n".repeat(400)
+ );
+ let input = json!({"entryFile": "AGENTS.md", "baseRevisionId": null, "content": content});
+ let config = config(PathBuf::from("unused"));
+ let mut state = DurableState::new(&config);
+ state.enqueue_executor_event(&config, "instruction-write".to_owned(), "semantic_tool.input".to_owned(), EventPriority::P0,
+ json!({"semantic_tool": {"schema":"paperclip.prp.semantic_tool.v1", "schemaVersion":1, "phase":"input", "operationId":"update_agent_instructions", "content":{"digest":semantic_value_digest(&input)}, "input": input}})).unwrap();
+ let encoded = serde_json::to_vec(&state).unwrap();
+ let recovered: DurableState = serde_json::from_slice(&encoded).unwrap();
+ let actual = recovered.outbox[0]
+ .envelope
+ .pointer("/payload/payload/semantic_tool/input")
+ .unwrap();
+ assert_eq!(actual, &input);
+ assert_eq!(
+ actual["content"].as_str().unwrap().as_bytes(),
+ content.as_bytes()
+ );
+ assert_eq!(semantic_value_digest(actual), semantic_value_digest(&input));
+ assert!(sanitize_semantic_tool_input(
+ "update_agent_instructions",
+ &json!({"content":"🦀".repeat(200_000)})
+ )
+ .is_err());
+ assert_eq!(state.outbox.len(), 1);
}
#[test]
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_sidecar_contract.rs b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_sidecar_contract.rs
index 5d6ba17aa58..367a3bb54db 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_sidecar_contract.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_sidecar_contract.rs
@@ -32,6 +32,7 @@ pub enum GeneratedAcpxSidecarCommand {
RunAttach,
TurnStart,
TurnCancel,
+ TurnSteer,
PermissionResolve,
InputResolve,
ToolResolve,
@@ -52,6 +53,7 @@ impl GeneratedAcpxSidecarCommand {
Self::RunAttach => "run.attach",
Self::TurnStart => "turn.start",
Self::TurnCancel => "turn.cancel",
+ Self::TurnSteer => "turn.steer",
Self::PermissionResolve => "permission.resolve",
Self::InputResolve => "input.resolve",
Self::ToolResolve => "tool.resolve",
@@ -70,6 +72,8 @@ impl GeneratedAcpxSidecarCommand {
pub enum GeneratedAcpxSidecarEventType {
#[serde(rename = "runtime.event")]
RuntimeEvent,
+ #[serde(rename = "runtime.rich_event")]
+ RuntimeRichEvent,
#[serde(rename = "runtime.permission_requested")]
RuntimePermissionRequested,
#[serde(rename = "runtime.input_requested")]
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 73535dc9758..7bc424c5c89 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
@@ -19,6 +19,14 @@ enum SelectedExecutor {
}
impl CommandExecutor for SelectedExecutor {
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ match self {
+ Self::LocalFacade(executor) => executor.can_reconcile_result_delivery(),
+ Self::Acpx(executor) => executor.can_reconcile_result_delivery(),
+ Self::Managed(executor) => executor.can_reconcile_result_delivery(),
+ }
+ }
+
fn retained_events(&mut self) -> Result, DurableRunnerError> {
match self {
Self::LocalFacade(executor) => executor.retained_events(),
@@ -172,6 +180,13 @@ impl NativeProviderCommandExecutor {
}
impl CommandExecutor for NativeProviderCommandExecutor {
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ self.select_recovery()?;
+ self.selected
+ .as_mut()
+ .map_or(Ok(false), CommandExecutor::can_reconcile_result_delivery)
+ }
+
fn retained_events(&mut self) -> Result, DurableRunnerError> {
self.selected
.as_mut()
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 a442643d1d6..aea835f7244 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
@@ -3070,30 +3070,31 @@ impl CodexCommandExecutor {
"reason": reason,
})));
}
- let has_pending_tools = self
+ let mut next_state = self
.state
- .as_ref()
- .is_some_and(|state| state.tool_bridge.pending_calls().next().is_some());
- if has_pending_tools {
- let identity = self.event_identity()?;
- let mut next_state = self
- .state
- .clone()
- .expect("Codex state remains available during interruption");
- let cancelled = next_state
- .tool_bridge
- .cancel_pending_calls("provider_turn_stopped")
- .map_err(|error| {
- DurableRunnerError::invalid(format!(
- "failed to cancel pending semantic tools: {error}"
- ))
- })?;
- for result in cancelled {
- next_state.push_terminal_event(semantic_result_event(&identity, &result))?;
- }
- self.persist_state(&next_state)?;
- self.state = Some(next_state);
- }
+ .clone()
+ .expect("Codex state remains available during interruption");
+ next_state
+ .tool_bridge
+ .cancel_pending_calls("provider_turn_stopped")
+ .map_err(|error| {
+ DurableRunnerError::invalid(format!(
+ "failed to stop semantic tool admission: {error}"
+ ))
+ })?;
+ next_state.push_terminal_event(NormalizedProviderEvent {
+ event_type: "harness.diagnostic".to_owned(),
+ priority: EventPriority::P0,
+ payload: json!({
+ "code": "provider_interrupt_requested",
+ "reason": reason,
+ "providerTurnId": provider_turn_id,
+ "pendingCallIds": next_state.tool_bridge.pending_calls().map(|call| call.call_id.clone()).collect::>(),
+ }),
+ })?;
+ // Record cause and pending identities before touching the provider.
+ self.persist_state(&next_state)?;
+ self.state = Some(next_state);
self.ensure_provider()?.interrupt_turn().map_err(|error| {
DurableRunnerError::invalid(format!("Codex turn interrupt failed: {error}"))
})?;
@@ -3185,6 +3186,14 @@ impl CodexCommandExecutor {
}
fn steer_turn(&mut self, payload: &Value) -> Result {
+ if payload
+ .get("mode")
+ .is_some_and(|mode| mode.as_str() != Some("steer"))
+ {
+ return Err(DurableRunnerError::invalid(
+ "Codex does not expose queued follow-up through turn.steer",
+ ));
+ }
let text = payload
.get("text")
.and_then(Value::as_str)
@@ -3703,6 +3712,13 @@ impl CodexCommandExecutor {
operation_id: String,
input: Value,
) -> Result<(), DurableRunnerError> {
+ if let Err(error) = sanitize_semantic_tool_input(&operation_id, &input) {
+ return self.reject_tool_call(
+ call_id,
+ operation_id,
+ ProviderBridgeError::invalid(error.to_string()),
+ );
+ }
let identity = self.event_identity()?;
let admission = self
.state
@@ -3755,6 +3771,7 @@ impl CodexCommandExecutor {
.state
.clone()
.ok_or_else(|| DurableRunnerError::invalid("Codex provider is not prepared"))?;
+ let delivery_detached = next_state.tool_bridge.turn_closed();
let terminal_tool_input = next_state
.tool_bridge
.pending_calls()
@@ -3764,13 +3781,24 @@ impl CodexCommandExecutor {
.tool_bridge
.apply_result(result.clone())
.map_err(|error| {
- DurableRunnerError::invalid(format!("semantic tool result was rejected: {error}"))
+ DurableRunnerError::invalid(format!(
+ "semantic tool result was rejected for call {} operation {}: {error}",
+ result.call_id, result.operation_id
+ ))
})?;
if was_completed {
- return Ok(CommandExecution::result(json!({
- "status": "duplicate",
- "callId": result.call_id,
- })));
+ return Ok(CommandExecution {
+ result: json!({ "status": "duplicate", "callId": result.call_id }),
+ events: vec![(
+ "harness.diagnostic".to_owned(),
+ EventPriority::P0,
+ json!({
+ "code": "semantic_tool_result_duplicate", "severity": "warning",
+ "callId": result.call_id, "operationId": result.operation_id,
+ "resultDigest": semantic_value_digest(&result.result),
+ }),
+ )],
+ });
}
let terminal_tool_authoritative =
terminal_tool_input
@@ -3788,6 +3816,12 @@ impl CodexCommandExecutor {
next_state.push_event(semantic_result_event(&identity, &result))?;
self.persist_state(&next_state)?;
self.state = Some(next_state);
+ if delivery_detached {
+ return Ok(CommandExecution::result(json!({
+ "status": "settled_after_turn",
+ "callId": result.call_id,
+ })));
+ }
let provider = self.ensure_provider()?;
if terminal_tool_authoritative {
provider
@@ -4393,6 +4427,12 @@ impl CodexCommandExecutor {
}
impl CommandExecutor for CodexCommandExecutor {
+ fn can_reconcile_result_delivery(&mut self) -> Result {
+ // ProviderToolBridge persists the exact call/result and rejects changed
+ // receipts. Delivery cannot execute a server-side semantic operation.
+ Ok(true)
+ }
+
fn execute(&mut self, command: &Command) -> Result {
self.startup_command = Some(ProviderStartupCommand {
command_id: command.command_id.clone(),
@@ -4449,7 +4489,13 @@ impl CommandExecutor for CodexCommandExecutor {
"session.goal.get" => self.get_goal(),
"session.goal.set" => self.set_goal(&command.payload),
"session.goal.clear" => self.clear_goal(&command.payload),
- "turn.interrupt" | "run.cancel" => self.interrupt_turn(&command.command_type),
+ "turn.interrupt" | "run.cancel" => self.interrupt_turn(
+ command
+ .payload
+ .get("reason")
+ .and_then(Value::as_str)
+ .unwrap_or(&command.command_type),
+ ),
"turn.stop" => self.stop_turn_for_suspension(&command.command_type),
"request.resolve" => self.resolve_request(&command.payload),
"semantic_tool.result" => self.deliver_semantic_result(&command.payload),
@@ -5466,7 +5512,7 @@ mod tests {
}
#[test]
- fn semantic_input_digest_covers_the_transmitted_redacted_value() {
+ fn semantic_input_rejects_credential_material_before_dispatch() {
let identity = ProviderEventIdentity {
runner_instance_id: "runner-1".to_owned(),
run_id: "run-1".to_owned(),
@@ -5479,17 +5525,14 @@ mod tests {
operation_id: "get_task_context".to_owned(),
input: json!({"password": "do-not-persist", "safe": true}),
};
- let event = semantic_input_event(&identity, &call).unwrap();
- let transmitted = &event.payload["semantic_tool"]["input"];
- assert_eq!(transmitted["password"], "[REDACTED]");
- assert_eq!(
- event.payload["semantic_tool"]["content"]["digest"],
- semantic_value_digest(transmitted)
- );
+ assert!(semantic_input_event(&identity, &call)
+ .unwrap_err()
+ .to_string()
+ .contains("refusing to execute altered arguments"));
}
#[test]
- fn semantic_finish_input_preserves_a_complete_long_redacted_summary() {
+ fn semantic_finish_input_preserves_a_complete_long_summary() {
let identity = ProviderEventIdentity {
runner_instance_id: "runner-1".to_owned(),
run_id: "run-1".to_owned(),
@@ -5498,7 +5541,7 @@ mod tests {
item_id: "item-1".to_owned(),
};
let summary = format!(
- "token=do-not-persist {} Authorization: Bearer late-provider-secret COMPLETE-LONG-SUMMARY",
+ "Answer: {} COMPLETE-LONG-SUMMARY",
"A complete paragraph for the user. ".repeat(180)
);
assert!(summary.len() > 4_096);
@@ -5511,11 +5554,11 @@ mod tests {
let event = semantic_input_event(&identity, &call).unwrap();
let transmitted = &event.payload["semantic_tool"]["input"];
let transmitted_summary = transmitted["summary"].as_str().unwrap();
- assert!(transmitted_summary.starts_with("token=[REDACTED] "));
+ assert!(transmitted_summary.starts_with("Answer: "));
assert!(transmitted_summary.ends_with(" COMPLETE-LONG-SUMMARY"));
assert!(!transmitted_summary.contains("do-not-persist"));
assert!(!transmitted_summary.contains("late-provider-secret"));
- assert!(transmitted_summary.contains("Authorization: Bearer [REDACTED]"));
+ assert_eq!(transmitted, &call.input);
assert!(!transmitted_summary.contains("…[truncated]"));
assert_eq!(
event.payload["semantic_tool"]["content"]["digest"],
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 77307873814..a1007983368 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
@@ -192,6 +192,10 @@ pub struct ProviderToolBridge {
catalog_operations: Vec,
catalog_digest: Option,
pending: BTreeMap,
+ // A provider stopping is not evidence that a dispatched server operation
+ // failed. Keep its input and identity pending until the authority replies.
+ #[serde(default)]
+ turn_closed: bool,
#[serde(deserialize_with = "deserialize_retained_results")]
completed: BTreeMap,
// Keep authoritative result bodies through the provider's replay window;
@@ -227,7 +231,7 @@ pub struct ProviderBridgeError {
}
impl ProviderBridgeError {
- fn invalid(message: impl Into) -> Self {
+ pub(crate) fn invalid(message: impl Into) -> Self {
Self {
message: message.into(),
safe_provider_message: None,
@@ -321,6 +325,7 @@ impl ProviderToolBridge {
));
}
self.prepare_internal(tool_set, true)?;
+ self.turn_closed = false;
self.completed.clear();
self.settled_results.clear();
self.retained_result_bytes = 0;
@@ -577,6 +582,7 @@ impl ProviderToolBridge {
// can replay the just-settled turn. Release that bulky data at the
// verified turn boundary, but retain every call-ID tombstone and any
// recovered legacy filter until the owning provider process is reaped.
+ self.turn_closed = false;
self.settled_results.clear();
self.retained_result_bytes = 0;
self.durable_run_receipt_limit_reached = self.replay_history_blocks_admission();
@@ -687,6 +693,11 @@ impl ProviderToolBridge {
"provider reused a completed tool call id",
));
}
+ if self.turn_closed {
+ return Err(ProviderBridgeError::invalid(
+ "cannot admit a new tool call after the provider turn stopped",
+ ));
+ }
// A durable receipt ledger may be exactly full or legacy state may
// contain only a probabilistic summary of evicted identities. Neither
// state can admit more work safely in this provider-process epoch. The
@@ -769,18 +780,14 @@ impl ProviderToolBridge {
return if existing.result == result {
Ok(existing.result.result.clone())
} else {
- Err(ProviderBridgeError::invalid(
- "conflicting duplicate tool result",
- ))
+ Err(conflicting_tool_result(&existing.result, &result))
};
}
if let Some(existing) = self.settled_results.get(&result.call_id) {
return if existing.result == result {
Ok(existing.result.result.clone())
} else {
- Err(ProviderBridgeError::invalid(
- "conflicting duplicate settled tool result",
- ))
+ Err(conflicting_tool_result(&existing.result, &result))
};
}
if self.has_settled_call_id(&result.call_id) {
@@ -848,7 +855,16 @@ impl ProviderToolBridge {
)?;
self.pending.remove(&result.call_id);
self.retained_result_bytes = next_retained_bytes;
- self.completed.insert(result.call_id.clone(), completed);
+ if self.turn_closed {
+ self.settled_call_ids.extend_recent(
+ std::iter::once(result.call_id.clone()),
+ MAX_SETTLED_CALL_IDS,
+ );
+ self.settled_results
+ .insert(result.call_id.clone(), completed);
+ } else {
+ self.completed.insert(result.call_id.clone(), completed);
+ }
Ok(result.result)
}
@@ -856,41 +872,29 @@ impl ProviderToolBridge {
self.pending.values()
}
+ /// Close provider admission/delivery, without inventing an operation outcome.
+ /// This marker is durable, including when interruption beats result delivery.
pub fn cancel_pending_calls(
&mut self,
code: &str,
) -> Result, ProviderBridgeError> {
- let mut next = self.clone();
- let results = next.cancel_pending_calls_internal(code)?;
- *self = next;
- Ok(results)
+ self.settle_turn(code)
+ }
+
+ pub fn turn_closed(&self) -> bool {
+ self.turn_closed
}
pub fn settle_turn(&mut self, code: &str) -> Result, ProviderBridgeError> {
validate_stable_id(code, "tool cancellation code")?;
- let results = self
- .pending
- .values()
- .map(|call| cancelled_tool_result(call, code))
- .collect::>();
- let mut settled_entries = self.completed.clone();
- for (call_id, call) in &self.pending {
- settled_entries.insert(
- call_id.clone(),
- CompletedToolCall {
- call: call.clone(),
- result: cancelled_tool_result(call, code),
- },
- );
+ if !self.settled_identity_capacity_allows(0) {
+ return Err(ProviderBridgeError::active_turn_receipt_limit());
}
let next_retained_bytes =
- retained_result_bytes(self.settled_results.iter().chain(settled_entries.iter()))?;
- ensure_settled_result_capacity(next_retained_bytes, std::iter::empty())?;
-
- // Byte capacity was reserved at admission. Keep every identity exact
- // for the lifetime of this provider-process epoch; prepare_turn
- // releases only the bulky result bodies.
- let new_identity_count = settled_entries
+ retained_result_bytes(self.settled_results.iter().chain(self.completed.iter()))?;
+ ensure_settled_result_capacity(next_retained_bytes, self.pending.values())?;
+ let new_identity_count = self
+ .completed
.keys()
.filter(|call_id| !self.settled_call_ids.contains(call_id))
.count();
@@ -904,28 +908,14 @@ impl ProviderToolBridge {
}
let evicted = self
.settled_call_ids
- .extend_recent(settled_entries.keys().cloned(), MAX_SETTLED_CALL_IDS);
+ .extend_recent(self.completed.keys().cloned(), MAX_SETTLED_CALL_IDS);
debug_assert!(evicted.is_empty());
- self.pending.clear();
- self.completed.clear();
- self.settled_results.append(&mut settled_entries);
+ self.settled_results.append(&mut self.completed);
self.retained_result_bytes = next_retained_bytes;
- Ok(results)
- }
-
- fn cancel_pending_calls_internal(
- &mut self,
- code: &str,
- ) -> Result, ProviderBridgeError> {
- validate_stable_id(code, "tool cancellation code")?;
- let pending = self.pending.values().cloned().collect::>();
- let mut results = Vec::with_capacity(pending.len());
- for call in pending {
- let result = cancelled_tool_result(&call, code);
- self.apply_result(result.clone())?;
- results.push(result);
- }
- Ok(results)
+ self.turn_closed = true;
+ // Pending effects survive both normal turn termination and process
+ // loss. They block the next turn/checkpoint, but accept a late result.
+ Ok(Vec::new())
}
fn retained_value_bytes(&self) -> Result {
@@ -1271,19 +1261,18 @@ where
deserializer.deserialize_map(RetainedResultsVisitor)
}
-fn cancelled_tool_result(call: &PendingToolCall, code: &str) -> ToolResult {
- ToolResult {
- call_id: call.call_id.clone(),
- operation_id: call.operation_id.clone(),
- result: serde_json::json!({
- "error": {
- "code": code,
- "message": "The provider turn stopped before this semantic tool completed",
- "retryable": false,
- },
- }),
- is_error: true,
- }
+fn conflicting_tool_result(existing: &ToolResult, incoming: &ToolResult) -> ProviderBridgeError {
+ // Correlate both receipts without leaking arguments or result content into
+ // a user-visible error or diagnostic stream.
+ let digest = |result: &ToolResult| {
+ semantic_value_digest(&serde_json::json!({
+ "operationId": result.operation_id, "isError": result.is_error, "result": result.result,
+ }))
+ };
+ ProviderBridgeError::invalid(format!(
+ "conflicting duplicate tool result: callId={} operationId={} existingDigest={} incomingDigest={}",
+ incoming.call_id, incoming.operation_id, digest(existing), digest(incoming),
+ ))
}
pub fn authorized_tool_catalog_digest(
@@ -1886,11 +1875,13 @@ mod tests {
let cancelled = pending_at_capacity
.settle_turn("semantic_tool_turn_receipt_limit")
.unwrap();
- assert_eq!(cancelled.len(), 1);
+ assert!(cancelled.is_empty());
+ assert_eq!(pending_at_capacity.pending_calls().count(), 1);
assert_eq!(
pending_at_capacity.settled_call_ids.len(),
- MAX_SETTLED_CALL_IDS
+ MAX_SETTLED_CALL_IDS - 1
);
+ assert!(pending_at_capacity.prepare_turn().is_err());
bridge
.apply_result(ToolResult {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs b/packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs
index 1e4fb43f607..e0eb95f611c 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/src/provider_events.rs
@@ -195,9 +195,47 @@ pub fn project_acpx_state_event(
AcpxProviderStateEvent::ToolResult(result) => {
Ok(vec![project_acpx_tool_result(context, result)?])
}
- AcpxProviderStateEvent::PermissionRequest { .. } => Err(LocalRunnerError::invalid(
- "ACPX permission request reached projection outside the pinned runner policy",
- )),
+ AcpxProviderStateEvent::PermissionRequest {
+ request_id,
+ title,
+ details,
+ ..
+ } => {
+ validate_projection_identity(request_id, "permission request", SHORT_STABLE_ID_CHARS)?;
+ let choices = details
+ .get("choices")
+ .and_then(Value::as_array)
+ .filter(|choices| !choices.is_empty() && choices.len() <= 4)
+ .ok_or_else(|| {
+ LocalRunnerError::invalid("ACPX permission request omitted its choices")
+ })?;
+ let mut seen = std::collections::HashSet::new();
+ for choice in choices {
+ let key = choice.get("key").and_then(Value::as_str).unwrap_or("");
+ if !matches!(key, "accept" | "accept_for_session" | "decline" | "cancel")
+ || !seen.insert(key)
+ || choice
+ .get("label")
+ .and_then(Value::as_str)
+ .is_none_or(|label| label.is_empty() || label.len() > 500)
+ {
+ return Err(LocalRunnerError::invalid(
+ "ACPX permission request contains invalid choices",
+ ));
+ }
+ }
+ one(
+ "runtime_request.created",
+ EventPriority::P0,
+ json!({"request": {
+ "schema":"paperclip.runtime_request.v2", "requestKind":"permission_approval",
+ "requestId":request_id, "turnId":context.turn_id, "itemId":context.item_id,
+ "type":"permission", "status":"pending", "prompt":title, "choices":choices,
+ "details":details,
+ "origin":{"adapter":"acpx-runtime-sidecar","provider":"acpx","method":"session/request_permission"},
+ }}),
+ )
+ }
AcpxProviderStateEvent::InputRequest {
request_id,
question_set,
@@ -216,7 +254,7 @@ pub fn project_acpx_state_event(
.and_then(Value::as_str)
})
.map(|value| bounded_text(value, MAX_TEXT_CHARS))
- .unwrap_or_else(|| "Codex needs your input".to_owned());
+ .unwrap_or_else(|| "Provider needs your input".to_owned());
let origin = project_runtime_request_origin(origin.as_ref())?;
one(
"runtime_request.created",
@@ -237,6 +275,60 @@ pub fn project_acpx_state_event(
}),
)
}
+ AcpxProviderStateEvent::RuntimeRequestEnded {
+ request_id,
+ question_set,
+ origin,
+ status,
+ } => {
+ let cancelled = matches!(
+ status,
+ AcpxTurnStatus::Cancelled | AcpxTurnStatus::Interrupted
+ );
+ let reason = match status {
+ AcpxTurnStatus::Completed => "turn_completed",
+ AcpxTurnStatus::Failed => "provider_process_lost",
+ _ => "explicit_cancellation",
+ };
+ let (request_id, request) = if let Some(question_set) = question_set {
+ let created = project_acpx_state_event(
+ context,
+ &AcpxProviderStateEvent::InputRequest {
+ request_id: request_id.clone(),
+ question_set: question_set.clone(),
+ origin: origin.clone(),
+ },
+ )?;
+ let request = created[0].payload["request"].clone();
+ (request["requestId"].clone(), Some(request))
+ } else {
+ validate_projection_identity(
+ request_id,
+ "permission request",
+ SHORT_STABLE_ID_CHARS,
+ )?;
+ (json!(request_id), None)
+ };
+ let mut payload = json!({
+ "provider":"acpx", "requestId":request_id,
+ "requestKind": if request.is_some() {"runtime"} else {"permission_approval"},
+ "requestType": if request.is_some() {"input"} else {"permission"},
+ "turnId":context.turn_id, "itemId":context.item_id,
+ "reason":reason, "replayAllowed":false, "adapter":"acpx-runtime-sidecar",
+ });
+ if let Some(request) = request {
+ payload["request"] = request;
+ }
+ one(
+ if cancelled {
+ "runtime_request.cancelled"
+ } else {
+ "runtime_request.expired"
+ },
+ EventPriority::P0,
+ payload,
+ )
+ }
AcpxProviderStateEvent::SemanticResult(result) => {
validate_semantic_projection_identity(&result.call_id, &result.operation_id)?;
if is_reserved_terminal_operation(&result.operation_id) {
@@ -1130,6 +1222,40 @@ fn normalize_acpx_status(
)]
}
+/// Matches the TypeScript ACP display-name parser. This is presentation metadata;
+/// semantic dispatch and the preclassified operation never derive authority from it.
+fn acpx_mcp_tool_identity(value: &str) -> Option<(&str, &str)> {
+ let has_line_terminator = |text: &str| text.contains(['\n', '\r', '\u{2028}', '\u{2029}']);
+ if value
+ .get(..5)
+ .is_some_and(|prefix| prefix.eq_ignore_ascii_case("mcp__"))
+ {
+ let rest = &value[5..];
+ if !has_line_terminator(rest) {
+ // The namespace is nonempty and the first eligible separator wins,
+ // including overlapping separators when the namespace starts with `_`.
+ for (index, _) in rest.char_indices().skip(1) {
+ if let Some(name) = rest[index..]
+ .strip_prefix("__")
+ .filter(|name| !name.is_empty())
+ {
+ return Some((&rest[..index], name));
+ }
+ }
+ }
+ }
+ if value
+ .get(..4)
+ .is_some_and(|prefix| prefix.eq_ignore_ascii_case("mcp."))
+ {
+ let (namespace, name) = value[4..].split_once('.')?;
+ if !namespace.is_empty() && !name.is_empty() && !has_line_terminator(name) {
+ return Some((namespace, name));
+ }
+ }
+ None
+}
+
fn normalize_acpx_tool_call(
payload: &Value,
item_id: &str,
@@ -1138,8 +1264,9 @@ fn normalize_acpx_tool_call(
let native_status = string(payload.get("status"));
let status = provider_status(native_status, native_status == "completed");
let terminal = status != "running";
- let raw_title = string(payload.get("title"));
- let title = bounded_text(raw_title, 240);
+ let raw_title = string(payload.get("title")).trim();
+ let mcp = acpx_mcp_tool_identity(raw_title);
+ let name = bounded_text(mcp.map_or(raw_title, |(_, name)| name), 240);
let output = match payload.get("rawOutput").or_else(|| payload.get("output")) {
Some(Value::String(value)) => value.clone(),
Some(value) => serde_json::to_string(value).unwrap_or_default(),
@@ -1148,11 +1275,11 @@ fn normalize_acpx_tool_call(
let mut normalized = json!({
"schema": "paperclip.tool.execution.v1",
"executionId": item_id,
- "transport": "builtin",
+ "transport": if mcp.is_some() { "mcp" } else { "builtin" },
"operation": operation,
- "name": if title.is_empty() { Value::Null } else { Value::String(title) },
+ "name": if name.is_empty() { Value::Null } else { Value::String(name) },
"target": safe_acpx_location(payload.pointer("/locations/0"), operation == "edit"),
- "namespace": Value::Null,
+ "namespace": mcp.map(|(namespace, _)| bounded_text(namespace, 240)),
"readOnly": matches!(operation, "read" | "search" | "list"),
"status": status,
"durationMs": Value::Null,
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_payload.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_payload.rs
index a82105de9b5..0dab9435c0e 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_payload.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_payload.rs
@@ -176,7 +176,7 @@ fn rejects_unclassified_and_malformed_runtime_payloads() {
#[test]
fn decodes_tool_and_permission_requests_after_scope_validation() {
let scope = active_scope();
- let tool = decode_acpx_event(
+ let rejected = decode_acpx_event(
&scope,
&event(
GeneratedAcpxSidecarEventType::RuntimeToolCalled,
@@ -187,14 +187,10 @@ fn decodes_tool_and_permission_requests_after_scope_validation() {
}),
),
)
- .unwrap();
- assert!(matches!(
- tool,
- AcpxEventPayload::ToolCalled { call_id, operation_id, input, .. }
- if call_id == "call-1"
- && operation_id == "get_issue"
- && input["apiToken"] == "[REDACTED]"
- ));
+ .unwrap_err();
+ assert!(rejected
+ .to_string()
+ .contains("refusing to execute altered arguments"));
let permission = decode_acpx_event(
&scope,
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_projection.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_projection.rs
index 221e05483a3..6e7651a95a9 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_projection.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_event_projection.rs
@@ -23,6 +23,24 @@ fn project(event: AcpxProviderStateEvent) -> Vec {
project_acpx_state_event(&context(), &event).unwrap()
}
+fn canonical_request_branch(request_kind: &str, request_type: &str) -> Value {
+ let schema: Value = serde_json::from_str(include_str!(
+ "../../../../protocol/schemas/request.schema.json"
+ ))
+ .unwrap();
+ schema["oneOf"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .find(|branch| {
+ branch["properties"]["schema"]["const"] == "paperclip.runtime_request.v2"
+ && branch["properties"]["requestKind"]["const"] == request_kind
+ && branch["properties"]["type"]["const"] == request_type
+ })
+ .expect("canonical v2 request branch")
+ .clone()
+}
+
fn reduced_semantic_result(
call_id: &str,
operation_id: &str,
@@ -366,7 +384,32 @@ fn projects_assistant_terminal_and_diagnostic_events_fail_closed() {
assert!(project_acpx_state_event(&context(), &permission)
.unwrap_err()
.to_string()
- .contains("pinned runner policy"));
+ .contains("omitted its choices"));
+}
+
+#[test]
+fn projects_only_the_permission_choices_offered_by_the_provider() {
+ let events = project(AcpxProviderStateEvent::PermissionRequest {
+ request_id: "permission-1".to_owned(),
+ kind: "write".to_owned(),
+ title: "Edit source".to_owned(),
+ details: json!({"choices":[{"key":"accept","label":"Allow once"},{"key":"cancel","label":"Cancel"}]}),
+ });
+ assert_eq!(events[0].event_type, "runtime_request.created");
+ let schema = canonical_request_branch("permission_approval", "permission");
+ let validator = jsonschema::validator_for(&schema).unwrap();
+ assert!(validator.is_valid(&events[0].payload["request"]));
+ assert_eq!(
+ events[0].payload["request"]["requestKind"],
+ "permission_approval"
+ );
+ assert_eq!(
+ events[0].payload["request"]["choices"]
+ .as_array()
+ .unwrap()
+ .len(),
+ 2
+ );
}
#[test]
@@ -506,11 +549,7 @@ fn deterministically_projects_bounded_upstream_request_ids() {
#[test]
fn runtime_request_projection_preserves_durable_identity_boundaries() {
- let canonical_request_schema: Value = serde_json::from_str(include_str!(
- "../../../../protocol/schemas/request.schema.json"
- ))
- .unwrap();
- let mut runtime_request_schema = canonical_request_schema["oneOf"][0].clone();
+ let mut runtime_request_schema = canonical_request_branch("runtime", "input");
// This test owns identity projection. The question-set validator has its
// own coverage, so replace its remote reference with an unconstrained
// local schema before compiling the canonical runtime-request branch.
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_checkpoint.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_checkpoint.rs
index 2ee2e712dcb..f00049620dc 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_checkpoint.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_checkpoint.rs
@@ -51,6 +51,7 @@ fn config(directory: &std::path::Path) -> AcpxProviderSessionConfig {
working_directory: directory.to_owned(),
permission_mode: AcpxPermissionMode::ApproveReads,
permission_mode_pinned: true,
+ provider_policy: None,
system_instructions: "Complete the supplied task.".to_owned(),
runtime_context: serde_json::Value::Null,
tool_set: AuthorizedToolSet {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_events.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_events.rs
index 2dc412039b4..12ff5078ca8 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_events.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_events.rs
@@ -336,6 +336,131 @@ fn does_not_label_non_usd_acpx_cost_as_usd() {
assert_eq!(usage[0].payload["cumulative"]["providerCostUsd"], 0.0);
}
+#[test]
+fn matches_typescript_mcp_display_identity_across_tool_lifecycle() {
+ for (title, namespace, name) in [
+ (
+ "mcp__paperclip__write_document",
+ "paperclip",
+ "write_document",
+ ),
+ (
+ "mcp.paperclip.write_document",
+ "paperclip",
+ "write_document",
+ ),
+ (
+ " MCP__Paperclip__write_document ",
+ "Paperclip",
+ "write_document",
+ ),
+ ("McP.other.read_document", "other", "read_document"),
+ ("mcp__paperclip__nested__tool", "paperclip", "nested__tool"),
+ ("mcp.paperclip.nested.tool", "paperclip", "nested.tool"),
+ ("mcp_____write_document", "_", "write_document"),
+ ("mcp__é__write_document", "é", "write_document"),
+ ] {
+ for (tag, status, event_type) in [
+ ("tool_call", "pending", "tool.execution.started"),
+ (
+ "tool_call_update",
+ "in_progress",
+ "tool.execution.progressed",
+ ),
+ ("tool_call_update", "completed", "tool.execution.completed"),
+ ] {
+ let events = normalize_acpx_runtime_event(
+ AcpxRuntimeEventKind::ToolCall,
+ &json!({
+ "type": "tool_call", "tag": tag, "status": status,
+ "toolCallId": "write-plan", "title": title,
+ "rawInput": {"private": "not-for-the-log"},
+ "operationId": "finish_task", "semantic_tool": {"phase": "result"}
+ }),
+ Some("execute"),
+ "event-7",
+ "turn-1",
+ 3,
+ );
+ assert_eq!(events.len(), 1);
+ assert_eq!(events[0].event_type, event_type);
+ let payload = &events[0].payload;
+ assert_eq!(payload["executionId"], "write-plan");
+ assert_eq!(payload["transport"], "mcp");
+ assert_eq!(payload["namespace"], namespace);
+ assert_eq!(payload["name"], name);
+ // Parsing the display title never changes preclassified operation authority.
+ assert_eq!(payload["operation"], "execute");
+ assert_eq!(payload["readOnly"], false);
+ for dropped in ["rawInput", "operationId", "semantic_tool"] {
+ assert!(payload.get(dropped).is_none());
+ }
+ assert!(!payload.to_string().contains("not-for-the-log"));
+ }
+ }
+}
+
+#[test]
+fn bounds_mcp_namespace_and_name_independently_after_parsing() {
+ let namespace = "é".repeat(300);
+ let events = normalize(
+ AcpxRuntimeEventKind::ToolCall,
+ json!({"type": "tool_call", "title": format!("mcp__{namespace}__write_document")}),
+ );
+ assert_eq!(events[0].payload["transport"], "mcp");
+ assert_eq!(events[0].payload["name"], "write_document");
+ assert_eq!(
+ events[0].payload["namespace"]
+ .as_str()
+ .unwrap()
+ .chars()
+ .count(),
+ 240
+ );
+ let events = normalize(
+ AcpxRuntimeEventKind::ToolCall,
+ json!({"type": "tool_call", "title": format!("mcp.paperclip.{}", "雪".repeat(300))}),
+ );
+ assert_eq!(events[0].payload["namespace"], "paperclip");
+ assert_eq!(
+ events[0].payload["name"].as_str().unwrap().chars().count(),
+ 240
+ );
+ for title in [
+ "mcp__Authorization: Bearer namespace-secret__write_document",
+ "mcp.paperclip.Authorization: Bearer tool-secret",
+ ] {
+ let events = normalize(
+ AcpxRuntimeEventKind::ToolCall,
+ json!({"type": "tool_call", "title": title}),
+ );
+ assert!(!events[0].payload.to_string().contains("namespace-secret"));
+ assert!(!events[0].payload.to_string().contains("tool-secret"));
+ }
+}
+
+#[test]
+fn leaves_builtin_and_malformed_mcp_titles_as_display_only_builtin_names() {
+ for title in [
+ "Read file",
+ "write_document",
+ "paperclip__write_document",
+ "mcp____write_document",
+ "mcp__paperclip__",
+ "mcp..write_document",
+ "mcp.paperclip.",
+ "mcp__paperclip__write\ndocument",
+ ] {
+ let events = normalize(
+ AcpxRuntimeEventKind::ToolCall,
+ json!({"type": "tool_call", "title": title}),
+ );
+ assert_eq!(events[0].payload["transport"], "builtin");
+ assert!(events[0].payload["namespace"].is_null());
+ assert_eq!(events[0].payload["name"], title);
+ }
+}
+
#[test]
fn maps_tool_lifecycle_and_preserves_safe_display_paths() {
let started = normalize(
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_resolutions.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_resolutions.rs
index 0f1ff03cfb7..5a61230715d 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_resolutions.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_resolutions.rs
@@ -50,6 +50,7 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
working_directory: std::env::temp_dir(),
permission_mode: AcpxPermissionMode::ApproveReads,
permission_mode_pinned: true,
+ provider_policy: None,
system_instructions: "Complete the supplied task.".to_owned(),
runtime_context: serde_json::Value::Null,
tool_set: tool_set(),
@@ -98,9 +99,9 @@ fn commits_each_resolution_only_after_sidecar_acknowledgement() {
.unwrap();
assert!(session.state().pending_tool("call-1").is_none());
assert!(session.state().pending_question_set("input-1").is_none());
- assert!(session
+ session
.deliver_tool_result(&tool_result("issues.read"))
- .is_err());
+ .expect("an identical result replay must be idempotent");
session.shutdown("test complete").unwrap();
}
@@ -199,7 +200,9 @@ fn redacts_failed_tool_payload_without_losing_correlation_or_retry() {
failed.operation_id = "issues.read".to_owned();
session.deliver_tool_result(&failed).unwrap();
assert!(session.state().pending_tool("call-1").is_none());
- assert!(session.deliver_tool_result(&failed).is_err());
+ session
+ .deliver_tool_result(&failed)
+ .expect("the failure receipt also deduplicates");
session.shutdown("test complete").unwrap();
}
@@ -260,3 +263,42 @@ fn fails_closed_when_a_resolution_is_not_acknowledged() {
assert!(error.contains("did not confirm tool resolution"), "{error}");
assert!(session.shutdown("already closed").is_ok());
}
+
+#[test]
+fn interactive_permission_requires_an_offered_action_and_acknowledgement() {
+ for mode in ["permissions-interactive", "permissions-wrong-ack"] {
+ let mut cfg = config(mode);
+ cfg.agent = "claude".to_owned();
+ cfg.model = "claude-sonnet-5".to_owned();
+ let mut session = AcpxProviderSession::start(&cfg).unwrap();
+ session
+ .start_turn("turn-1", "Run validation", &std::env::temp_dir())
+ .unwrap();
+ session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
+ assert!(session.state().pending_permission("permission-1").is_some());
+ assert!(session
+ .resolve_permission("permission-1", "old-turn", &json!({"action":"accept"}))
+ .is_err());
+ assert!(session
+ .resolve_permission(
+ "permission-1",
+ "turn-1",
+ &json!({"action":"accept_for_session"})
+ )
+ .is_err());
+ assert!(session.state().pending_permission("permission-1").is_some());
+ let result =
+ session.resolve_permission("permission-1", "turn-1", &json!({"action":"accept"}));
+ if mode == "permissions-wrong-ack" {
+ assert!(result.is_err());
+ assert!(session.state().pending_permission("permission-1").is_some());
+ } else {
+ result.unwrap();
+ assert!(session.state().pending_permission("permission-1").is_none());
+ assert!(session
+ .resolve_permission("permission-1", "turn-1", &json!({"action":"accept"}))
+ .is_err());
+ }
+ session.shutdown("verified").unwrap();
+ }
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_session.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_session.rs
index 7223ae7c5f6..c9b9ce59338 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_session.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_session.rs
@@ -45,6 +45,7 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
working_directory: std::env::temp_dir(),
permission_mode: AcpxPermissionMode::ApproveReads,
permission_mode_pinned: true,
+ provider_policy: None,
system_instructions: "Complete the supplied task.".to_owned(),
runtime_context: serde_json::Value::Null,
tool_set: tool_set(),
@@ -130,8 +131,12 @@ fn bootstraps_a_codex_session_and_confirms_run_identity() {
#[test]
fn validates_qualified_policy_and_tool_catalog_before_spawning() {
let mut invalid_agent = config("bootstrap");
- invalid_agent.agent = "pi".to_owned();
- assert!(start_error(&invalid_agent).contains("claude, codex, or grok"));
+ invalid_agent.agent = "unknown".to_owned();
+ assert!(start_error(&invalid_agent).contains("known immutable profile"));
+
+ let mut missing_policy = config("bootstrap");
+ missing_policy.agent = "copilot".to_owned();
+ assert!(start_error(&missing_policy).contains("explicit provider read-only policy"));
let mut unpinned = config("bootstrap");
unpinned.permission_mode_pinned = false;
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_state.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_state.rs
index 4c3361de93e..f4f4d231919 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_state.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_state.rs
@@ -465,7 +465,7 @@ fn accepts_global_process_and_diagnostic_events_without_an_active_turn() {
}
#[test]
-fn terminal_events_clear_pending_requests_and_reject_late_turn_events() {
+fn terminal_events_retain_dispatched_tools_and_reject_late_turn_events() {
let mut state = AcpxProviderState::new("run-1").unwrap();
state.begin_turn("turn-1").unwrap();
state
@@ -484,8 +484,10 @@ fn terminal_events_clear_pending_requests_and_reject_late_turn_events() {
json!({"status":"cancelled","error":{"message":"token=secret"}}),
))
.unwrap();
+ assert!(state.pending_tool("call-1").is_some());
+ assert!(state.begin_turn("turn-2").is_err());
+ state.complete_tool("call-1", "issues.read").unwrap();
assert!(state.pending_tool("call-1").is_none());
- assert!(state.complete_tool("call-1", "issues.read").is_err());
assert!(state
.accept_event(&event(
3,
@@ -509,10 +511,8 @@ fn mutation_prose_survives_sidecar_decode_pending_state_and_semantic_projection(
"description": "The document must contain the token CHAT8322bda781b81.",
"initialPlan": plan,
"idempotencyKey": "CHAT8322bda781b81-task",
- "apiToken": "actual-credential",
});
- let mut expected = input.clone();
- expected["apiToken"] = json!("[REDACTED]");
+ let expected = input.clone();
let emitted = state
.accept_event(&event(
1,
@@ -578,33 +578,95 @@ fn mutation_prose_survives_sidecar_decode_pending_state_and_semantic_projection(
false,
),
] {
- state
- .complete_tool(
- "call-1",
- state
- .pending_tool("call-1")
- .unwrap()
- .operation_id
- .clone()
- .as_str(),
- )
- .unwrap();
- let emitted = state
- .accept_event(&event(
- 2,
- GeneratedAcpxSidecarEventType::RuntimeToolCalled,
- Some("turn-1"),
- json!({"callId": "call-1", "operationId": operation, "input": {field: prose}}),
- ))
- .unwrap();
- let AcpxProviderStateEvent::ToolCall { input, .. } = &emitted[0] else {
+ let mut candidate = AcpxProviderState::new("run-1").unwrap();
+ candidate.begin_turn("turn-1").unwrap();
+ let emitted = candidate.accept_event(&event(
+ 1,
+ GeneratedAcpxSidecarEventType::RuntimeToolCalled,
+ Some("turn-1"),
+ json!({"callId":"call-1", "operationId":operation, "input":{field:prose}}),
+ ));
+ if !preserved {
+ assert!(emitted
+ .unwrap_err()
+ .to_string()
+ .contains("refusing to execute altered arguments"));
+ assert!(candidate.pending_tool("call-1").is_none());
+ continue;
+ }
+ let events = emitted.unwrap();
+ let AcpxProviderStateEvent::ToolCall { input, .. } = &events[0] else {
panic!("expected tool call");
};
+ assert_eq!(input[field], json!(prose));
+ }
+}
+
+#[test]
+fn terminal_requests_expire_with_their_projected_identity_before_terminal_and_never_replay() {
+ for status in ["failed", "cancelled", "interrupted", "completed"] {
+ let mut state = AcpxProviderState::new("run-1").unwrap();
+ state.begin_turn("turn-1").unwrap();
+ let long_id = format!("input-{}", "x".repeat(200));
+ let input = state.accept_event(&event(1, GeneratedAcpxSidecarEventType::RuntimeInputRequested, Some("turn-1"),
+ json!({"requestId":long_id,"questionSet":question_set(),"origin":{"adapter":"acpx-runtime-sidecar","provider":"cursor","method":"cursor/create_plan"}}))).unwrap();
+ state.accept_event(&event(2, GeneratedAcpxSidecarEventType::RuntimePermissionRequested, Some("turn-1"),
+ json!({"requestId":"permission-1","title":"Run validation","choices":[{"key":"cancel","label":"Cancel"}]}))).unwrap();
+ let context = AcpxEventProjectionContext {
+ run_id: "run-1".into(),
+ normalized_session_id: "session-1".into(),
+ turn_id: "turn-1".into(),
+ provider_turn_id: Some("turn-1".into()),
+ item_id: "item-1".into(),
+ };
+ let created = project_acpx_state_event(&context, &input[0]).unwrap();
+ let projected_id = created[0].payload["request"]["requestId"].clone();
+ let terminal = state
+ .accept_event(&event(
+ 3,
+ GeneratedAcpxSidecarEventType::RuntimeTurnTerminal,
+ Some("turn-1"),
+ json!({"status":status}),
+ ))
+ .unwrap();
+ let projected: Vec<_> = terminal
+ .iter()
+ .flat_map(|event| project_acpx_state_event(&context, event).unwrap())
+ .collect();
+ assert_eq!(projected.len(), 3);
+ assert_eq!(projected[0].payload["requestId"], "permission-1");
+ assert_eq!(projected[1].payload["requestId"], projected_id);
+ assert_eq!(projected[1].payload["request"]["input"], question_set());
assert_eq!(
- input[field] == json!(prose),
- preserved,
- "{operation}: {prose}"
+ projected[1].payload["request"]["origin"]["method"],
+ "cursor/create_plan"
);
- assert!(!input.to_string().contains("actual-credential"));
+ for ended in &projected[..2] {
+ assert_eq!(ended.payload["replayAllowed"], false);
+ assert_eq!(
+ ended.event_type,
+ if matches!(status, "cancelled" | "interrupted") {
+ "runtime_request.cancelled"
+ } else {
+ "runtime_request.expired"
+ }
+ );
+ }
+ assert!(projected[2].event_type.starts_with("turn."));
+ assert!(state
+ .pending_question_set(projected_id.as_str().unwrap())
+ .is_none());
+ assert!(state.complete_permission("permission-1").is_err());
+ assert!(state
+ .complete_input(projected_id.as_str().unwrap())
+ .is_err());
+ assert!(state
+ .accept_event(&event(
+ 4,
+ GeneratedAcpxSidecarEventType::RuntimeTurnTerminal,
+ Some("turn-1"),
+ json!({"status":status})
+ ))
+ .is_err());
}
}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_suspend.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_suspend.rs
index 92eb28ab277..eebd2e237fa 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_suspend.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_suspend.rs
@@ -26,6 +26,7 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
working_directory: std::env::temp_dir(),
permission_mode: AcpxPermissionMode::ApproveReads,
permission_mode_pinned: true,
+ provider_policy: None,
system_instructions: "Complete the supplied task.".to_owned(),
runtime_context: serde_json::Value::Null,
tool_set: AuthorizedToolSet {
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_turns.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_turns.rs
index 1436a25cd82..0f8188c6237 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_turns.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_provider_turns.rs
@@ -7,7 +7,7 @@ use paperclip_runner_core::acpx_provider_session::{
use paperclip_runner_core::acpx_provider_state::AcpxProviderStateEvent;
use paperclip_runner_core::acpx_sidecar_transport::AcpxSidecarTransportConfig;
use paperclip_runner_core::provider_bridge::{
- authorized_tool_catalog_digest, AuthorizedTool, AuthorizedToolSet,
+ authorized_tool_catalog_digest, AuthorizedTool, AuthorizedToolSet, ToolResult,
};
use serde_json::json;
@@ -36,8 +36,18 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
request_timeout: Duration::from_secs(1),
shutdown_grace: Duration::from_millis(100),
},
- agent: "codex".to_owned(),
- model: "gpt-5.6-sol".to_owned(),
+ agent: if mode.starts_with("controls") {
+ "pi"
+ } else {
+ "codex"
+ }
+ .to_owned(),
+ model: if mode.starts_with("controls") {
+ "openrouter/deepseek/deepseek-v4-flash-0731"
+ } else {
+ "gpt-5.6-sol"
+ }
+ .to_owned(),
run_id: "run-1".to_owned(),
catalog_revision: 1,
runtime_directory: std::env::temp_dir(),
@@ -45,6 +55,15 @@ fn config(mode: &str) -> AcpxProviderSessionConfig {
working_directory: std::env::temp_dir(),
permission_mode: AcpxPermissionMode::ApproveReads,
permission_mode_pinned: true,
+ provider_policy: if mode.starts_with("controls") {
+ Some(
+ paperclip_runner_core::acpx_provider_session::AcpxProviderRuntimePolicy {
+ read_only: false,
+ },
+ )
+ } else {
+ None
+ },
system_instructions: "Complete the supplied task.".to_owned(),
runtime_context: serde_json::Value::Null,
tool_set: tool_set(),
@@ -200,45 +219,51 @@ fn admits_only_catalog_authorized_tool_calls() {
session.shutdown("test complete").unwrap();
}
+fn late_result(call_id: &str) -> ToolResult {
+ ToolResult {
+ call_id: call_id.to_owned(),
+ operation_id: "issues.read".to_owned(),
+ result: json!({"id":"issue-1"}),
+ is_error: false,
+ }
+}
+
#[test]
-fn returns_pending_tool_cancellations_before_the_terminal_event() {
+fn retains_pending_tools_until_authoritative_late_results_and_deduplicates_retries() {
let mut session = AcpxProviderSession::start(&config("turns-tool-terminal")).unwrap();
- session
- .start_turn("turn-1", "Please help", &std::env::temp_dir())
- .unwrap();
- let tool = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(tool[0], AcpxProviderStateEvent::ToolCall { .. }));
-
- let terminal = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- &terminal[0],
- AcpxProviderStateEvent::ToolResult(result)
- if result.call_id == "call-1"
- && result.operation_id == "issues.read"
- && result.is_error
- && result.result["error"]["code"] == "acpx_turn_settled"
- ));
- assert!(matches!(
- terminal.last().unwrap(),
- AcpxProviderStateEvent::TurnTerminal { turn_id, .. } if turn_id == "turn-1"
- ));
-
- assert!(session.state().pending_tool("call-1").is_none());
- session
- .start_turn("turn-2", "Please continue", &std::env::temp_dir())
- .expect("terminal settlement must leave the session reusable");
- let next_tool = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- &next_tool[0],
- AcpxProviderStateEvent::ToolCall { call_id, operation_id, .. }
- if call_id == "call-2" && operation_id == "issues.read"
- ));
- let next_terminal = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- next_terminal.last().unwrap(),
- AcpxProviderStateEvent::TurnTerminal { turn_id, .. } if turn_id == "turn-2"
- ));
- assert!(session.state().pending_tool("call-2").is_none());
+ for (turn_id, call_id) in [("turn-1", "call-1"), ("turn-2", "call-2")] {
+ session
+ .start_turn(turn_id, "Please help", &std::env::temp_dir())
+ .unwrap();
+ let tool = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
+ assert!(
+ matches!(&tool[0], AcpxProviderStateEvent::ToolCall { call_id: actual, .. } if actual == call_id)
+ );
+ let terminal = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
+ assert_eq!(terminal.len(), 1, "must not invent a cancellation result");
+ assert!(
+ matches!(&terminal[0], AcpxProviderStateEvent::TurnTerminal { turn_id: actual, .. } if actual == turn_id)
+ );
+ assert!(session.state().pending_tool(call_id).is_some());
+ assert!(session
+ .start_turn("blocked-turn", "Wait for settlement", &std::env::temp_dir())
+ .is_err());
+ session.deliver_tool_result(&late_result(call_id)).unwrap();
+ session
+ .deliver_tool_result(&late_result(call_id))
+ .expect("lost acknowledgement is harmless");
+ let mut conflict = late_result(call_id);
+ conflict.result = json!({"id":"different"});
+ let error = session
+ .deliver_tool_result(&conflict)
+ .unwrap_err()
+ .to_string();
+ assert!(
+ error.contains(call_id) && error.contains("issues.read"),
+ "{error}"
+ );
+ assert!(session.state().pending_tool(call_id).is_none());
+ }
session.shutdown("test complete").unwrap();
}
@@ -257,12 +282,10 @@ fn rotates_settled_tool_receipts_between_reusable_turns() {
if call_id == "call-reused" && operation_id == "issues.read"
));
let terminal = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- &terminal[0],
- AcpxProviderStateEvent::ToolResult(result)
- if result.call_id == "call-reused"
- && result.result["error"]["code"] == "acpx_turn_settled"
- ));
+ assert_eq!(terminal.len(), 1);
+ session
+ .deliver_tool_result(&late_result("call-reused"))
+ .unwrap();
assert!(matches!(
terminal.last().unwrap(),
AcpxProviderStateEvent::TurnTerminal { turn_id: settled, .. }
@@ -313,6 +336,9 @@ fn reaps_the_old_provider_before_admitting_a_late_tool_callback() {
.unwrap();
session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
+ session
+ .deliver_tool_result(&late_result("call-reused"))
+ .unwrap();
session
.start_turn("turn-2", "Use a fresh provider", &std::env::temp_dir())
@@ -341,6 +367,9 @@ fn fails_closed_before_reusing_a_settled_turn_identity() {
.unwrap();
session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
+ session
+ .deliver_tool_result(&late_result("call-reused"))
+ .unwrap();
let reused = session
.start_turn("turn-1", "Do not alias old events", &std::env::temp_dir())
@@ -559,62 +588,28 @@ fn reserved_completion_waits_for_feedback_and_allows_correction_in_same_turn() {
}
#[test]
-fn correlates_reserved_results_by_raw_digest_without_exposing_sensitive_values() {
- let mut session =
- AcpxProviderSession::start(&config("turns-sensitive-reserved-result-terminal")).unwrap();
- session
- .start_turn("turn-1", "Please help", &std::env::temp_dir())
- .unwrap();
-
- assert!(matches!(
- &session.poll_event(Duration::from_secs(1)).unwrap().unwrap()[0],
- AcpxProviderStateEvent::ToolCall { operation_id, .. }
- if operation_id == "paperclip_finish"
- ));
- let result_events = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- &result_events[0],
- AcpxProviderStateEvent::SemanticResult(result)
- if result.result["summary"]
- .as_str()
- .is_some_and(|summary| summary.contains("REDACTED")
- && !summary.contains("matching-sensitive-value"))
- ));
-
- let terminal = session.poll_event(Duration::from_secs(1)).unwrap().unwrap();
- assert!(matches!(
- terminal.last().unwrap(),
- AcpxProviderStateEvent::TurnTerminal { turn_id, .. } if turn_id == "turn-1"
- ));
- session.shutdown("test complete").unwrap();
-}
-
-#[test]
-fn rejects_sensitive_reserved_results_that_only_match_after_redaction() {
- let mut session = AcpxProviderSession::start(&config(
+fn rejects_sensitive_reserved_input_before_dispatch_without_exposing_values() {
+ for mode in [
+ "turns-sensitive-reserved-result-terminal",
"turns-mismatched-sensitive-reserved-result-terminal",
- ))
- .unwrap();
- session
- .start_turn("turn-1", "Please help", &std::env::temp_dir())
- .unwrap();
- assert!(matches!(
- &session.poll_event(Duration::from_secs(1)).unwrap().unwrap()[0],
- AcpxProviderStateEvent::ToolCall { operation_id, .. }
- if operation_id == "paperclip_finish"
- ));
-
- let error = session
- .poll_event(Duration::from_secs(1))
- .unwrap_err()
- .to_string();
- assert!(
- error.contains("does not match its authorized invocation"),
- "{error}"
- );
- assert!(!error.contains("matching-sensitive-value"), "{error}");
- assert!(!error.contains("different-sensitive-value"), "{error}");
- assert!(session.shutdown("already closed").is_ok());
+ ] {
+ let mut session = AcpxProviderSession::start(&config(mode)).unwrap();
+ session
+ .start_turn("turn-1", "Please help", &std::env::temp_dir())
+ .unwrap();
+ let error = session
+ .poll_event(Duration::from_secs(1))
+ .unwrap_err()
+ .to_string();
+ assert!(
+ error.contains("refusing to execute altered arguments"),
+ "{error}"
+ );
+ assert!(!error.contains("matching-sensitive-value"), "{error}");
+ assert!(!error.contains("different-sensitive-value"), "{error}");
+ assert!(session.state().pending_tool("call-finish").is_none());
+ session.shutdown("already closed").unwrap();
+ }
}
#[test]
@@ -693,3 +688,69 @@ fn fails_closed_before_returning_an_unauthorized_tool_call() {
assert!(session.state().pending_tool("call-1").is_none());
assert!(session.shutdown("already closed").is_ok());
}
+
+#[test]
+fn turn_controls_preserve_mode_and_reject_stale_duplicate_and_oversized_delivery() {
+ let mut session = AcpxProviderSession::start(&config("controls")).unwrap();
+ assert!(session
+ .steer_turn("turn-1", "control-1", "steer", "message")
+ .is_err());
+ session
+ .start_turn("turn-1", "Work", &std::env::temp_dir())
+ .unwrap();
+ let first = session
+ .steer_turn("turn-1", "control-1", "steer", "Change focus")
+ .unwrap();
+ assert_eq!(first["mode"], "steer");
+ assert!(session
+ .steer_turn("turn-1", "control-1", "follow_up", "Duplicate")
+ .unwrap_err()
+ .to_string()
+ .contains("already attempted"));
+ let queued = session
+ .steer_turn("turn-1", "control-2", "follow_up", "Then validate")
+ .unwrap();
+ assert_eq!(queued["mode"], "follow_up");
+ assert!(session
+ .steer_turn("turn-2", "control-3", "steer", "Stale")
+ .is_err());
+ assert!(session
+ .steer_turn("turn-1", "control-3", "cancel", "Wrong")
+ .is_err());
+ assert!(session
+ .steer_turn("turn-1", "control-3", "steer", &"a".repeat(65_537))
+ .is_err());
+ session.shutdown("verified controls").unwrap();
+}
+
+#[test]
+fn turn_controls_fail_closed_on_mismatched_acknowledgement() {
+ let mut session = AcpxProviderSession::start(&config("controls-wrong-ack")).unwrap();
+ session
+ .start_turn("turn-1", "Work", &std::env::temp_dir())
+ .unwrap();
+ assert!(session
+ .steer_turn("turn-1", "control-1", "steer", "Change focus")
+ .unwrap_err()
+ .to_string()
+ .contains("exact turn control"));
+ assert!(session
+ .steer_turn("turn-1", "control-2", "follow_up", "Do not replay")
+ .is_err());
+}
+
+#[test]
+fn lazy_warm_handshake_updates_live_turn_control_discovery() {
+ let mut session = AcpxProviderSession::start(&config("controls-lazy")).unwrap();
+ assert!(!session.turn_control_capabilities().steering);
+ assert!(!session.turn_control_capabilities().queued_follow_up);
+ session
+ .start_turn("turn-lazy", "Work", &std::env::temp_dir())
+ .unwrap();
+ assert!(session.turn_control_capabilities().steering);
+ assert!(session.turn_control_capabilities().queued_follow_up);
+ session
+ .steer_turn("turn-lazy", "control-1", "follow_up", "Then validate")
+ .unwrap();
+ session.shutdown("verified live handshake").unwrap();
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_rich_events.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_rich_events.rs
new file mode 100644
index 00000000000..dc570b69a41
--- /dev/null
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_rich_events.rs
@@ -0,0 +1,181 @@
+use paperclip_runner_core::acpx_event_payload::{decode_acpx_event, AcpxEventPayload};
+use paperclip_runner_core::acpx_event_scope::AcpxEventScope;
+use paperclip_runner_core::acpx_provider_state::{AcpxProviderState, AcpxProviderStateEvent};
+use paperclip_runner_core::acpx_sidecar_transport::AcpxSidecarEvent;
+use paperclip_runner_core::durable::EventPriority;
+use paperclip_runner_core::generated_acpx_sidecar_contract::GeneratedAcpxSidecarEventType;
+use serde_json::{json, Value};
+
+fn scope() -> AcpxEventScope {
+ let mut scope = AcpxEventScope::new("run-1").unwrap();
+ scope.bind_turn("turn-1").unwrap();
+ scope
+}
+fn event(event_type: &str, payload: Value) -> AcpxSidecarEvent {
+ AcpxSidecarEvent {
+ sequence: 1,
+ event_type: GeneratedAcpxSidecarEventType::RuntimeRichEvent,
+ run_id: Some("run-1".to_owned()),
+ turn_id: Some("turn-1".to_owned()),
+ payload: json!({"eventType":event_type,"itemId":"display-1","payload":payload}),
+ }
+}
+fn plan() -> Value {
+ json!({"schema":"paperclip.plan.updated.v1","planId":"plan-1","revision":2,"explanation":"Changed order","steps":[{"stepId":"step-1","body":"Inspect","status":"completed"},{"stepId":"step-2","body":"Build","status":"in_progress"}],"complete":false,"syncStatus":"not_applicable","documentRevision":null})
+}
+fn artifact() -> Value {
+ json!({"schema":"paperclip.artifact.generated.v1","artifactId":"image-1","status":"completed","reference":"outputs/diagram.png","mediaType":"image/png","registered":false,"failure":null})
+}
+
+#[test]
+fn rich_activity_preserves_plans_children_and_artifact_metadata_without_mutation_authority() {
+ let mut state = AcpxProviderState::new("run-1").unwrap();
+ state.begin_turn("turn-1").unwrap();
+ for (event_type, payload) in [
+ ("plan.updated", plan()),
+ ("artifact.generated", artifact()),
+ (
+ "delegation.completed",
+ json!({"schema":"paperclip.delegation.v1","delegationId":"task-1","action":"spawn","status":"completed","children":[{"childId":"child-1","role":"explore","model":"small-model","status":"completed","summary":"Found the implementation","activitySummary":"Searched src; duration 310 ms"}]}),
+ ),
+ ] {
+ let projected = state
+ .accept_event(&event(event_type, payload.clone()))
+ .unwrap();
+ assert_eq!(projected.len(), 1);
+ let AcpxProviderStateEvent::Activity(activity) = &projected[0] else {
+ panic!("rich event became an authority-bearing event");
+ };
+ assert_eq!(activity.event_type, event_type);
+ assert_eq!(activity.priority, EventPriority::P1);
+ assert_eq!(activity.payload, payload);
+ assert!(!state.has_pending_requests());
+ assert_eq!(state.active_turn_id(), Some("turn-1"));
+ }
+}
+
+#[test]
+fn rich_activity_rejects_terminal_semantic_source_and_schema_injection() {
+ for event_type in [
+ "turn.completed",
+ "run.result",
+ "run.completed",
+ "semantic_tool.input",
+ "semantic_tool.result",
+ "runtime.input_requested",
+ "workspace.changed",
+ "harness.diagnostic",
+ "unknown.event",
+ ] {
+ assert!(
+ decode_acpx_event(&scope(), &event(event_type, plan())).is_err(),
+ "{event_type}"
+ );
+ }
+ assert!(decode_acpx_event(&scope(), &event("artifact.generated", plan())).is_err());
+ for field in ["source", "sourceRef", "runId", "priority"] {
+ let mut injected = event("plan.updated", plan());
+ injected.payload[field] = json!("forged");
+ assert!(decode_acpx_event(&scope(), &injected).is_err());
+ }
+ let mut extra = plan();
+ extra["sourceRef"] = json!("file:///private/key");
+ assert!(decode_acpx_event(&scope(), &event("plan.updated", extra)).is_err());
+ let mut registered = artifact();
+ registered["registered"] = json!(true);
+ assert!(decode_acpx_event(&scope(), &event("artifact.generated", registered)).is_err());
+ let mut synchronized = plan();
+ synchronized["syncStatus"] = json!("synchronized");
+ synchronized["documentRevision"] = json!(1);
+ assert!(decode_acpx_event(&scope(), &event("plan.updated", synchronized)).is_err());
+ for path in [
+ "/private/key",
+ "../outside",
+ "file:///private/key",
+ "C:\\private\\key",
+ "outputs/evil\u{0000}.png",
+ ] {
+ let mut escaped = artifact();
+ escaped["reference"] = json!(path);
+ assert!(
+ decode_acpx_event(&scope(), &event("artifact.generated", escaped)).is_err(),
+ "{path}"
+ );
+ }
+}
+
+#[test]
+fn rich_activity_requires_the_current_run_and_active_turn() {
+ let mut event = event("plan.updated", plan());
+ event.run_id = Some("old-run".to_owned());
+ assert!(decode_acpx_event(&scope(), &event).is_err());
+ event.run_id = None;
+ assert!(decode_acpx_event(&scope(), &event).is_err());
+ event.run_id = Some("run-1".to_owned());
+ event.turn_id = Some("old-turn".to_owned());
+ assert!(decode_acpx_event(&scope(), &event).is_err());
+ event.turn_id = None;
+ assert!(decode_acpx_event(&scope(), &event).is_err());
+ event.turn_id = Some("turn-1".to_owned());
+ let mut settled = scope();
+ settled.clear_turn("turn-1").unwrap();
+ assert!(decode_acpx_event(&settled, &event).is_err());
+}
+
+#[test]
+fn rich_activity_is_byte_bounded_and_preserves_long_schema_bounded_output() {
+ let text = "Unicode 漢字\n".repeat(1_000);
+ let payload = json!({"schema":"paperclip.tool.execution.v1","executionId":"tool-1","transport":"builtin","operation":"read","status":"completed","output":text,"outputBytes":text.len(),"outputTruncated":false,"outputDigest":null});
+ let AcpxEventPayload::RichActivity { payload, .. } =
+ decode_acpx_event(&scope(), &event("tool.execution.completed", payload)).unwrap()
+ else {
+ panic!("not rich activity");
+ };
+ assert_eq!(payload["output"], text);
+ let mut oversized = plan();
+ oversized["steps"] = json!((0..100).map(|index|json!({"stepId":format!("step-{index}"),"body":"漢".repeat(3_000),"status":"pending"})).collect::>());
+ assert!(
+ decode_acpx_event(&scope(), &event("plan.updated", oversized))
+ .unwrap_err()
+ .to_string()
+ .contains("256 KiB")
+ );
+}
+
+fn question_event(description: String) -> AcpxSidecarEvent {
+ AcpxSidecarEvent {
+ sequence: 1,
+ event_type: GeneratedAcpxSidecarEventType::RuntimeInputRequested,
+ run_id: Some("run-1".to_owned()),
+ turn_id: Some("turn-1".to_owned()),
+ payload: json!({"requestId":"plan-request","questionSet":{"schema":"paperclip.question_set.v1","description":description,"questions":[{"id":"revision-123","prompt":"Approve?","required":true,"answerMode":"single_select","options":[{"id":"accept","label":"Accept"},{"id":"reject","label":"Reject"}]}]}}),
+ }
+}
+
+#[test]
+fn full_plan_presentation_survives_utf8_redaction_without_diagnostic_truncation() {
+ let description = "Review 漢字\n".repeat(2_000);
+ let AcpxEventPayload::InputRequested { question_set, .. } =
+ decode_acpx_event(&scope(), &question_event(description.clone())).unwrap()
+ else {
+ panic!("not input");
+ };
+ assert_eq!(question_set["description"], description);
+ let secret = format!("{description}\napi_key=topsecret\nFinal action");
+ let AcpxEventPayload::InputRequested { question_set, .. } =
+ decode_acpx_event(&scope(), &question_event(secret)).unwrap()
+ else {
+ panic!("not input");
+ };
+ let displayed = question_set["description"].as_str().unwrap();
+ assert!(displayed.starts_with("Sensitive values were redacted"));
+ assert!(displayed.ends_with("Final action"));
+ assert!(!displayed.contains("topsecret"));
+ assert!(!displayed.contains("[truncated]"));
+ assert!(
+ decode_acpx_event(&scope(), &question_event("漢".repeat(70_000)))
+ .unwrap_err()
+ .to_string()
+ .contains("196 KiB")
+ );
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_sidecar_transport.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_sidecar_transport.rs
index eed42887838..59497b18795 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_sidecar_transport.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/acpx_sidecar_transport.rs
@@ -233,12 +233,32 @@ fn assigned_gateway_binding_reaches_qualified_sidecar_without_unrelated_secrets(
"fixture-token-never-returned-in-test-output",
)
.env("UNRELATED_EVAL_SECRET", "must-not-cross-boundary")
+ .env(
+ "PAPERCLIP_ACPX_CREDENTIAL_BINDING",
+ "controller-session-binding",
+ )
+ .envs(
+ [
+ "ANTHROPIC_API_KEY",
+ "CLAUDE_CODE_OAUTH_TOKEN",
+ "OPENAI_API_KEY",
+ "CODEX_API_KEY",
+ "OPENROUTER_API_KEY",
+ "CURSOR_API_KEY",
+ "CURSOR_AUTH_TOKEN",
+ "COPILOT_GITHUB_TOKEN",
+ "GITHUB_TOKEN",
+ "GH_TOKEN",
+ ]
+ .into_iter()
+ .map(|key| (key, "fixture-credential")),
+ )
.status()
.unwrap();
assert!(status.success(), "isolated gateway environment test failed");
return;
}
- for agent in ["claude", "codex"] {
+ for agent in ["claude", "codex", "pi", "cursor", "copilot"] {
let mut sidecar = AcpxSidecarTransport::start_for_agent(
&AcpxSidecarTransportConfig {
command: PathBuf::from(env!("CARGO_BIN_EXE_fake-acpx-sidecar")),
@@ -260,6 +280,23 @@ fn assigned_gateway_binding_reaches_qualified_sidecar_without_unrelated_secrets(
"assigned gateway credential was dropped"
);
assert_eq!(response["hasUnrelatedSecret"], false);
+ let expected = match agent {
+ "claude" => vec!["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
+ "codex" => vec!["OPENAI_API_KEY", "CODEX_API_KEY"],
+ "pi" => vec!["OPENROUTER_API_KEY"],
+ "cursor" => vec!["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"],
+ "copilot" => vec!["COPILOT_GITHUB_TOKEN"],
+ _ => unreachable!(),
+ };
+ assert_eq!(response["credentialKeys"], json!(expected));
+ assert_eq!(
+ response["credentialBinding"],
+ if matches!(agent, "pi" | "cursor" | "copilot") {
+ json!("controller-session-binding")
+ } else {
+ serde_json::Value::Null
+ }
+ );
sidecar.shutdown().unwrap();
}
}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/codex_provider.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/codex_provider.rs
index 51f5952365d..dac280fdf3e 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/codex_provider.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/codex_provider.rs
@@ -851,16 +851,21 @@ fn codex_rejects_replay_of_a_completed_tool_call_id_in_the_same_turn() {
.start_turn("Inspect the fake task once.", &config.cwd)
.expect("start provider turn");
- let first_call = (0..32)
- .find_map(|_| match provider.poll().expect("poll first tool call") {
- Some(CodexProviderEvent::ToolCall {
- call_id,
- operation_id,
- ..
- }) => Some((call_id, operation_id)),
- _ => None,
- })
- .expect("observe the first semantic tool call");
+ let first_call_deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
+ let first_call =
+ std::iter::from_fn(|| (std::time::Instant::now() < first_call_deadline).then_some(()))
+ .find_map(|_| match provider.poll().expect("poll first tool call") {
+ Some(CodexProviderEvent::ToolCall {
+ call_id,
+ operation_id,
+ ..
+ }) => Some((call_id, operation_id)),
+ _ => {
+ std::thread::sleep(std::time::Duration::from_millis(1));
+ None
+ }
+ })
+ .expect("observe the first semantic tool call");
provider
.deliver_tool_result(&ToolResult {
call_id: first_call.0,
@@ -870,9 +875,17 @@ fn codex_rejects_replay_of_a_completed_tool_call_id_in_the_same_turn() {
})
.expect("deliver the first semantic result");
- let replay_error = (0..32)
- .find_map(|_| provider.poll().err())
- .expect("same-turn replay of the completed call id is rejected");
+ let replay_deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
+ let replay_error =
+ std::iter::from_fn(|| (std::time::Instant::now() < replay_deadline).then_some(()))
+ .find_map(|_| {
+ let error = provider.poll().err();
+ if error.is_none() {
+ std::thread::sleep(std::time::Duration::from_millis(1));
+ }
+ error
+ })
+ .expect("same-turn replay of the completed call id is rejected");
assert!(
replay_error
.to_string()
@@ -3041,6 +3054,103 @@ fn codex_resume_advertises_the_same_authorized_tools() {
fs::remove_dir_all(directory).expect("remove Codex integration-test directory");
}
+#[test]
+fn interrupted_tool_accepts_one_authoritative_result_across_restart_and_lost_ack() {
+ for restart in [false, true] {
+ let directory = temporary_directory(if restart {
+ "interrupt-tool-restart"
+ } else {
+ "interrupt-tool-live"
+ });
+ let config = provider_config(&directory, &["--require-dynamic-tool", "--emit-tool-call"]);
+ let runner_config = durable_config(&directory);
+ let mut executor = CodexCommandExecutor::with_runner_config(&directory, &runner_config);
+ executor
+ .execute(&command(
+ "prepare",
+ 1,
+ "run.prepare",
+ json!({"provider":config,"authorizedTools":task_context_tool_set()}),
+ ))
+ .unwrap();
+ executor
+ .execute(&command("open", 2, "session.open", json!({})))
+ .unwrap();
+ executor
+ .execute(&command(
+ "turn",
+ 3,
+ "turn.start",
+ json!({"text":"Hold the actual operation until after interruption."}),
+ ))
+ .unwrap();
+ wait_for_executor_event(&mut executor, "semantic_tool.input");
+ executor
+ .execute(&command(
+ "interrupt",
+ 4,
+ "turn.interrupt",
+ json!({"reason":"test_result_delivery_barrier"}),
+ ))
+ .unwrap();
+ let saved: Value =
+ serde_json::from_slice(&fs::read(directory.join("codex-provider-state.json")).unwrap())
+ .unwrap();
+ assert_eq!(saved["toolBridge"]["pending"].as_object().unwrap().len(), 1);
+ assert!(saved["pendingEvents"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .any(|event| event["payload"]["reason"] == "test_result_delivery_barrier"));
+ if restart {
+ drop(executor);
+ executor = CodexCommandExecutor::with_runner_config(&directory, &runner_config);
+ }
+ let result = json!({"callId":"semantic-call-1", "operationId":"get_task_context", "result":{"ok":true,"savedHash":"exact-write"}, "isError":false});
+ let delivered = executor
+ .execute(&command(
+ "result",
+ 5,
+ "semantic_tool.result",
+ result.clone(),
+ ))
+ .unwrap();
+ assert_eq!(delivered.result["status"], "settled_after_turn");
+ // Lose the command ACK, restart, then deliver precisely the same result.
+ drop(executor);
+ executor = CodexCommandExecutor::with_runner_config(&directory, &runner_config);
+ let replay = executor
+ .execute(&command(
+ "retry-result",
+ 6,
+ "semantic_tool.result",
+ result.clone(),
+ ))
+ .unwrap();
+ assert_eq!(replay.result["status"], "duplicate");
+ assert!(replay
+ .events
+ .iter()
+ .any(|(kind, _, value)| kind == "harness.diagnostic"
+ && value["code"] == "semantic_tool_result_duplicate"
+ && value["callId"] == "semantic-call-1"));
+ let mut conflict = result;
+ conflict["result"]["savedHash"] = json!("different-write");
+ let error = executor
+ .execute(&command("conflict", 7, "semantic_tool.result", conflict))
+ .unwrap_err();
+ assert!(error.to_string().contains("semantic-call-1"));
+ assert!(error.to_string().contains("get_task_context"));
+ assert!(error.to_string().contains("conflicting duplicate"));
+ assert!(error.to_string().contains("existingDigest=sha256:"));
+ assert!(error.to_string().contains("incomingDigest=sha256:"));
+ assert!(!error.to_string().contains("different-write"));
+ assert_eq!(call_count(&directory, "turn/start"), 1);
+ executor.shutdown().unwrap();
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
#[test]
fn durable_backend_routes_a_semantic_tool_result_back_to_codex() {
let directory = temporary_directory("durable-dynamic-tool");
@@ -3437,33 +3547,15 @@ fn durable_backend_settles_pending_tools_when_recovery_finds_the_turn_ended() {
break;
}
}
- let semantic_result = observed
- .iter()
- .position(|event| event == "semantic_tool.result")
- .expect("recovery settles the pending semantic tool");
- let reconciled = observed
- .iter()
- .position(|event| event == "session.reconciled")
- .expect("recovery emits a reconciliation event");
- let terminal = observed
- .iter()
- .position(|event| event == "run.terminal")
- .expect("offline turn recovery terminates the run");
- assert!(semantic_result < reconciled);
- assert!(reconciled < terminal);
- assert!(recovered
- .execute(&command(
- "late-result",
- 5,
- "semantic_tool.result",
- json!({
- "callId": "semantic-call-1",
- "operationId": "get_task_context",
- "result": {"ok": true},
- "isError": false,
- }),
- ))
- .is_err());
+ assert!(
+ !observed.iter().any(|event| event == "semantic_tool.result"),
+ "recovery must not invent an effect outcome"
+ );
+ assert!(observed.iter().any(|event| event == "session.reconciled"));
+ let late = recovered.execute(&command("late-result", 5, "semantic_tool.result", json!({
+ "callId":"semantic-call-1", "operationId":"get_task_context", "result":{"ok":true}, "isError":false,
+ }))).unwrap();
+ assert_eq!(late.result["status"], "settled_after_turn");
recovered.shutdown().expect("stop recovered provider");
fs::remove_dir_all(directory).expect("remove Codex integration-test directory");
@@ -3963,28 +4055,12 @@ fn durable_backend_settles_tools_before_a_natural_terminal_event() {
break;
}
}
- let semantic_result = observed
- .iter()
- .position(|event| event == "semantic_tool.result")
- .expect("terminal settlement emits a failed semantic result");
- let terminal = observed
- .iter()
- .position(|event| event == "turn.completed")
- .expect("provider terminal event is emitted");
- assert!(semantic_result < terminal);
- assert!(executor
- .execute(&command(
- "late-result",
- 4,
- "semantic_tool.result",
- json!({
- "callId": "semantic-call-1",
- "operationId": "get_task_context",
- "result": {"ok": true},
- "isError": false,
- }),
- ))
- .is_err());
+ assert!(!observed.iter().any(|event| event == "semantic_tool.result"));
+ assert!(observed.iter().any(|event| event == "turn.completed"));
+ let late = executor.execute(&command("late-result", 4, "semantic_tool.result", json!({
+ "callId":"semantic-call-1", "operationId":"get_task_context", "result":{"ok":true}, "isError":false,
+ }))).unwrap();
+ assert_eq!(late.result["status"], "settled_after_turn");
executor.shutdown().unwrap();
fs::remove_dir_all(directory).unwrap();
@@ -4154,27 +4230,15 @@ fn durable_stop_settles_pending_semantic_tools_without_a_courtesy_interrupt() {
.execute(&command("stop", 4, "turn.stop", json!({})))
.unwrap();
assert_eq!(stopped.result["providerExitConfirmed"], true);
- let result = wait_for_executor_event(&mut executor, "semantic_tool.result");
- assert_eq!(result.payload["semantic_tool"]["outcome"], "failed");
- assert_eq!(
- result.payload["semantic_tool"]["callId"],
- input.payload["semantic_tool"]["callId"]
- );
- assert_eq!(
- result.payload["semantic_tool"]["correlation"],
- input.payload["semantic_tool"]["correlation"]
- );
- assert!(executor
- .execute(&command(
- "late-result",
- 5,
- "semantic_tool.result",
- json!({
- "callId": "semantic-call-1", "operationId": "get_task_context",
- "result": {"ok": true}, "isError": false,
- })
- ))
- .is_err());
+ assert_eq!(input.payload["semantic_tool"]["callId"], "semantic-call-1");
+ assert!(!poll_and_ack(&mut executor)
+ .unwrap()
+ .iter()
+ .any(|event| event.event_type == "semantic_tool.result"));
+ let late = executor.execute(&command("late-result", 5, "semantic_tool.result", json!({
+ "callId":"semantic-call-1", "operationId":"get_task_context", "result":{"ok":true}, "isError":false,
+ }))).unwrap();
+ assert_eq!(late.result["status"], "settled_after_turn");
assert_eq!(call_count(&directory, "turn/interrupt"), 0);
assert_eq!(call_count(&directory, "thread/start"), 1);
assert_eq!(call_count(&directory, "turn/start"), 1);
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 c23930eeffa..9699a80278c 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
@@ -16,6 +16,8 @@ use sha2::{Digest, Sha256};
const CODEX_ACPX_DIGEST: &str =
"sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3";
+const PI_ACPX_DIGEST: &str =
+ "sha256:8c696f38296d53d0061fa11534570c5ddd951b63532aed30e0f1fcc676dc169f";
fn temporary_directory(label: &str) -> PathBuf {
let nonce = SystemTime::now()
@@ -76,6 +78,18 @@ fn acpx_config(state_dir: &Path, mode: &str) -> DurableRunnerConfig {
config
}
+fn pi_acpx_config(state_dir: &Path, mode: &str) -> DurableRunnerConfig {
+ let mut config = acpx_config(state_dir, mode);
+ *config
+ .acpx_launch_profile
+ .as_mut()
+ .unwrap()
+ .args
+ .last_mut()
+ .unwrap() = PI_ACPX_DIGEST.to_owned();
+ config
+}
+
fn qualified_artifact(path: PathBuf) -> QualifiedLaunchArtifact {
QualifiedLaunchArtifact {
sha256: format!("sha256:{:x}", Sha256::digest(fs::read(&path).unwrap())),
@@ -211,6 +225,527 @@ fn prepare_payload_with_mode(directory: &Path, agent: &str, mode: &str) -> Value
})
}
+fn pi_prepare_payload(directory: &Path, mode: &str) -> Value {
+ let mut payload = prepare_payload_with_mode(directory, "pi", mode);
+ let provider = &mut payload["provider"];
+ provider["model"] = json!("openrouter/deepseek/deepseek-v4-flash-0731");
+ provider["agentServerPackage"] = json!("pi-acp");
+ provider["agentServerVersion"] = json!("0.0.33");
+ provider["agentRuntimePackage"] = json!("@earendil-works/pi-coding-agent");
+ provider["agentRuntimeVersion"] = json!("0.84.2");
+ provider["commandDigest"] = json!(PI_ACPX_DIGEST);
+ provider["sidecarArgs"][3] = json!(PI_ACPX_DIGEST);
+ provider["providerPolicy"] = json!({"readOnly":true});
+ payload
+}
+
+fn pending_acpx_runtime_request(
+ directory: &Path,
+ mode: &str,
+) -> (
+ NativeProviderCommandExecutor,
+ DurableRunnerConfig,
+ String,
+ u32,
+) {
+ let mut config = acpx_config(directory, mode);
+ let mut payload = prepare_payload_with_mode(directory, "codex", mode);
+ if mode.starts_with("permissions-") {
+ // Codex's pinned runner policy does not allow interactive ACP permissions.
+ let digest = "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a";
+ *config
+ .acpx_launch_profile
+ .as_mut()
+ .unwrap()
+ .args
+ .last_mut()
+ .unwrap() = digest.into();
+ let provider = &mut payload["provider"];
+ provider["agent"] = json!("claude");
+ provider["model"] = json!("claude-sonnet-5");
+ provider["agentServerPackage"] = json!("@agentclientprotocol/claude-agent-acp");
+ provider["agentServerVersion"] = json!("0.73.0");
+ provider["agentRuntimePackage"] = json!("@anthropic-ai/claude-agent-sdk");
+ provider["agentRuntimeVersion"] = json!("0.3.280");
+ provider["commandDigest"] = json!(digest);
+ provider["sidecarArgs"][3] = json!(digest);
+ } else {
+ let operations = vec![AuthorizedTool {
+ operation_id: "issues.read".into(),
+ version: 1,
+ description: "Read an issue.".into(),
+ input_schema: json!({"type":"object"}),
+ response_schema: json!({"type":"object"}),
+ }];
+ payload["authorizedTools"]["catalogDigest"] =
+ json!(authorized_tool_catalog_digest(&operations).unwrap());
+ payload["authorizedTools"]["operations"] = json!(operations);
+ }
+ let mut executor = NativeProviderCommandExecutor::with_runner_config(directory, &config);
+ executor
+ .execute(&command(1, "run.prepare", payload))
+ .unwrap();
+ let opened = executor
+ .execute(&command(2, "session.open", json!({})))
+ .unwrap();
+ let process_id = opened.result["processId"].as_u64().unwrap() as u32;
+ executor
+ .execute(&command(
+ 3,
+ "turn.start",
+ json!({"text":"Ask before continuing", "turnId":"turn-1"}),
+ ))
+ .unwrap();
+ let deadline = std::time::Instant::now() + Duration::from_secs(2);
+ loop {
+ let events = executor.poll_events().unwrap();
+ let request_id = events
+ .iter()
+ .find(|event| event.event_type == "runtime_request.created")
+ .and_then(|event| event.payload.pointer("/request/requestId"))
+ .and_then(Value::as_str)
+ .map(str::to_owned);
+ executor.acknowledge_events(events.len()).unwrap();
+ if let Some(request_id) = request_id {
+ return (executor, config, request_id, process_id);
+ }
+ assert!(
+ std::time::Instant::now() < deadline,
+ "request was not presented"
+ );
+ }
+}
+
+fn acpx_runtime_resolution(mode: &str, request_id: &str) -> Value {
+ json!({"requestId":request_id, "turnId":"turn-1", "resolution":
+ if mode.starts_with("permissions-") { json!({"action":"accept"}) }
+ else { json!({"action":"submit", "response":{"schema":"paperclip.question_response.v1",
+ "answers":{"target":{"selectedOptionIds":["first"]}}}}) }
+ })
+}
+
+fn shutdown_recovered_acpx_fixture(executor: &mut NativeProviderCommandExecutor, directory: &Path) {
+ // The fake sidecar advertises the same three lifetime-fence ports for all
+ // fixtures. Parallel recovered shutdowns hold a quorum through state fsync,
+ // temporarily preventing another fixture from proving cleanup. Retry only
+ // that rejection, using the real production quorum proof on every attempt.
+ // This is fixture synchronization, not a production cleanup workaround.
+ let deadline = std::time::Instant::now() + Duration::from_secs(5);
+ let mut blocked_attempts = 0;
+ loop {
+ match executor.shutdown() {
+ Ok(()) => break,
+ Err(error) => {
+ assert_eq!(
+ error.to_string(),
+ "ACPX original provider lifetime remains active; cleanup is not yet proven",
+ "unexpected recovered fixture shutdown failure"
+ );
+ let persisted: Value = serde_json::from_slice(
+ &fs::read(directory.join("acpx-provider-state.json")).unwrap(),
+ )
+ .unwrap();
+ assert_eq!(persisted["providerExitUnconfirmed"], true);
+ blocked_attempts += 1;
+ if blocked_attempts == 1 {
+ eprintln!("recovered fixture cleanup waiting for the shared lifetime quorum");
+ }
+ assert!(
+ std::time::Instant::now() < deadline,
+ "recovered fixture cleanup never acquired the lifetime quorum"
+ );
+ std::thread::sleep(Duration::from_millis(10));
+ }
+ }
+ }
+ if blocked_attempts > 0 {
+ eprintln!("recovered fixture cleanup proved after {blocked_attempts} quorum rejections");
+ }
+ let persisted: Value =
+ serde_json::from_slice(&fs::read(directory.join("acpx-provider-state.json")).unwrap())
+ .unwrap();
+ assert_eq!(persisted["providerExitUnconfirmed"], false);
+}
+
+#[test]
+fn acpx_response_delivery_survives_crash_before_journaling_without_replaying_the_response() {
+ for mode in [
+ "permissions-interactive",
+ "resolutions",
+ "resolutions-projected-id",
+ ] {
+ let directory = temporary_directory(mode);
+ let (mut executor, config, request_id, _) = pending_acpx_runtime_request(&directory, mode);
+ let resolve = command(
+ 4,
+ "request.resolve",
+ acpx_runtime_resolution(mode, &request_id),
+ );
+ let delivered = executor.execute(&resolve).unwrap();
+ assert_eq!(delivered.result["status"], "delivered");
+ assert!(
+ delivered.events.is_empty(),
+ "settlement must use the durable provider outbox"
+ );
+ let persisted: Value =
+ serde_json::from_slice(&fs::read(directory.join("acpx-provider-state.json")).unwrap())
+ .unwrap();
+ assert!(persisted["pendingRuntimeRequests"]
+ .get(&request_id)
+ .is_none());
+ let retained = executor.retained_events().unwrap();
+ assert_eq!(retained.len(), 1);
+ assert_eq!(retained[0].event_type, "runtime_request.resolved");
+ assert_eq!(retained[0].payload["requestId"], request_id);
+ assert_eq!(
+ persisted["pendingEvents"][0]["executorEventId"],
+ retained[0].executor_event_id
+ );
+ assert!(executor
+ .execute(&command(5, "request.resolve", resolve.payload.clone()))
+ .is_err());
+ assert_eq!(executor.retained_events().unwrap(), retained);
+
+ // Simulate death after the sidecar ACK/state fsync, before the runner
+ // journals this event or acknowledges the provider's retained prefix.
+ drop(executor);
+ let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ let events = recovered.poll_events().unwrap();
+ assert_eq!(events[0], retained[0]);
+ assert_eq!(
+ events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .count(),
+ 1
+ );
+ assert!(recovered
+ .execute(&command(6, "request.resolve", resolve.payload))
+ .is_err());
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ assert_eq!(
+ recovered
+ .execute(&command(7, "session.snapshot", json!({})))
+ .unwrap()
+ .result["status"],
+ "closed"
+ );
+ // Polling is not an ACK; only the journal's ACK retires the event.
+ recovered.acknowledge_events(events.len()).unwrap();
+ assert!(recovered.poll_events().unwrap().is_empty());
+ drop(recovered);
+ let mut recovered_again =
+ NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ assert!(recovered_again.poll_events().unwrap().is_empty());
+ shutdown_recovered_acpx_fixture(&mut recovered_again, &directory);
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
+#[test]
+fn acpx_delivered_response_is_acknowledged_once_before_session_close() {
+ for mode in ["permissions-interactive", "resolutions"] {
+ let directory = temporary_directory("response-ack");
+ let (mut executor, _, request_id, _) = pending_acpx_runtime_request(&directory, mode);
+ let response = acpx_runtime_resolution(mode, &request_id);
+ executor
+ .execute(&command(4, "request.resolve", response.clone()))
+ .unwrap();
+ let events = executor.poll_events().unwrap();
+ assert_eq!(events.len(), 1);
+ assert_eq!(events[0].event_type, "runtime_request.resolved");
+ assert_eq!(executor.poll_events().unwrap(), events);
+ executor.acknowledge_events(1).unwrap();
+ assert!(executor
+ .execute(&command(5, "request.resolve", response))
+ .is_err());
+ executor
+ .execute(&command(6, "session.close", json!({})))
+ .unwrap();
+ assert!(
+ executor.poll_events().unwrap().is_empty(),
+ "close must not expire a delivered request"
+ );
+ executor.shutdown().unwrap();
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
+#[test]
+fn acpx_uncommitted_delivery_expires_after_failed_state_write_without_replay() {
+ for mode in ["permissions-interactive", "resolutions"] {
+ let directory = temporary_directory("response-save-failure");
+ let (mut executor, config, request_id, process_id) =
+ pending_acpx_runtime_request(&directory, mode);
+ let state_path = directory.join("acpx-provider-state.json");
+ let previous_path = directory.join("previous-state.json");
+ let previous = fs::read(&state_path).unwrap();
+ fs::rename(&state_path, &previous_path).unwrap();
+ // Force the atomic state replacement to fail after the real sidecar
+ // has acknowledged delivery, without adding production fault hooks.
+ fs::create_dir(&state_path).unwrap();
+ let response = acpx_runtime_resolution(mode, &request_id);
+ let error = executor
+ .execute(&command(4, "request.resolve", response.clone()))
+ .unwrap_err();
+ assert!(error
+ .to_string()
+ .contains("atomically replace ACPX provider state"));
+ assert_eq!(fs::read(&previous_path).unwrap(), previous);
+ // Neither ordinary polling nor the explicit drain/ACK path may publish
+ // a delivered response whose settlement failed to persist.
+ for result in [
+ executor.retained_events().map(|_| ()),
+ executor.poll_events().map(|_| ()),
+ executor.acknowledge_events(0),
+ executor.acknowledge_events(1),
+ executor
+ .execute(&command(5, "runner.drain", json!({})))
+ .map(|_| ()),
+ executor
+ .execute(&command(6, "request.resolve", response.clone()))
+ .map(|_| ()),
+ executor.shutdown(),
+ ] {
+ assert_eq!(result.unwrap_err().to_string(), error.to_string());
+ }
+ #[cfg(unix)]
+ assert!(
+ !std::process::Command::new("kill")
+ .args(["-0", &process_id.to_string()])
+ .env_clear()
+ .stdout(std::process::Stdio::null())
+ .stderr(std::process::Stdio::null())
+ .status()
+ .unwrap()
+ .success(),
+ "failed durable cleanup must still reap the owned sidecar"
+ );
+ assert_eq!(fs::read(&previous_path).unwrap(), previous);
+ fs::remove_dir(&state_path).unwrap();
+ fs::rename(&previous_path, &state_path).unwrap();
+ // Repairing the file path does not authorize this uncertain executor
+ // to resume, retry an approval, or overwrite the recovery snapshot.
+ assert!(executor.poll_events().is_err());
+ assert!(executor.retained_events().is_err());
+ assert!(executor.shutdown().is_err());
+ assert_eq!(fs::read(&state_path).unwrap(), previous);
+ drop(executor);
+
+ let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ let events = recovered.poll_events().unwrap();
+ let requests: Vec<_> = events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .collect();
+ assert_eq!(requests.len(), 1);
+ assert_eq!(requests[0].event_type, "runtime_request.expired");
+ assert_eq!(requests[0].payload["requestId"], request_id);
+ assert_eq!(requests[0].payload["replayAllowed"], false);
+ assert!(recovered
+ .execute(&command(5, "request.resolve", response))
+ .is_err());
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ recovered.acknowledge_events(events.len()).unwrap();
+ shutdown_recovered_acpx_fixture(&mut recovered, &directory);
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
+#[test]
+fn acpx_failed_settlement_ack_replays_the_same_delivered_event_without_expiry() {
+ for mode in ["permissions-interactive", "resolutions"] {
+ let directory = temporary_directory("response-ack-save-failure");
+ let (mut executor, config, request_id, _) = pending_acpx_runtime_request(&directory, mode);
+ let response = acpx_runtime_resolution(mode, &request_id);
+ executor
+ .execute(&command(4, "request.resolve", response.clone()))
+ .unwrap();
+ let committed = executor.poll_events().unwrap();
+ assert_eq!(committed.len(), 1);
+ assert_eq!(committed[0].event_type, "runtime_request.resolved");
+ let state_path = directory.join("acpx-provider-state.json");
+ let previous_path = directory.join("previous-state.json");
+ let previous = fs::read(&state_path).unwrap();
+ fs::rename(&state_path, &previous_path).unwrap();
+ fs::create_dir(&state_path).unwrap();
+ // The journal has committed this executorEventId, but retiring the
+ // provider's retained prefix must not escape a failed state write.
+ let error = executor.acknowledge_events(1).unwrap_err();
+ assert!(error
+ .to_string()
+ .contains("atomically replace ACPX provider state"));
+ for result in [
+ executor.retained_events().map(|_| ()),
+ executor.poll_events().map(|_| ()),
+ executor.acknowledge_events(0),
+ executor
+ .execute(&command(5, "request.resolve", response.clone()))
+ .map(|_| ()),
+ executor.shutdown(),
+ ] {
+ assert_eq!(result.unwrap_err().to_string(), error.to_string());
+ }
+ assert_eq!(fs::read(&previous_path).unwrap(), previous);
+ fs::remove_dir(&state_path).unwrap();
+ fs::rename(&previous_path, &state_path).unwrap();
+ drop(executor);
+
+ let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ let events = recovered.poll_events().unwrap();
+ assert_eq!(events[0], committed[0]);
+ assert_eq!(
+ events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .count(),
+ 1
+ );
+ assert!(recovered
+ .execute(&command(6, "request.resolve", response))
+ .is_err());
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ recovered.acknowledge_events(events.len()).unwrap();
+ assert!(recovered.poll_events().unwrap().is_empty());
+ shutdown_recovered_acpx_fixture(&mut recovered, &directory);
+ drop(recovered);
+ let mut recovered_again =
+ NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ assert!(recovered_again.poll_events().unwrap().is_empty());
+ recovered_again.shutdown().unwrap();
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
+#[test]
+fn acpx_uncommitted_expiry_and_cancellation_cannot_escape_through_poll_or_drain() {
+ for (mode, close) in [
+ ("permissions-wrong-ack", false),
+ ("permissions-interactive", true),
+ ("resolutions", true),
+ ] {
+ let directory = temporary_directory("expiry-save-failure");
+ let (mut executor, config, request_id, _) = pending_acpx_runtime_request(&directory, mode);
+ let state_path = directory.join("acpx-provider-state.json");
+ let previous_path = directory.join("previous-state.json");
+ let previous = fs::read(&state_path).unwrap();
+ fs::rename(&state_path, &previous_path).unwrap();
+ fs::create_dir(&state_path).unwrap();
+ let response = acpx_runtime_resolution(mode, &request_id);
+ let error = if close {
+ executor
+ .execute(&command(4, "session.close", json!({})))
+ .unwrap_err()
+ } else {
+ assert!(executor
+ .execute(&command(4, "request.resolve", response.clone()))
+ .unwrap_err()
+ .to_string()
+ .contains("did not confirm permission resolution"));
+ executor.poll_events().unwrap_err()
+ };
+ assert!(error
+ .to_string()
+ .contains("atomically replace ACPX provider state"));
+ for result in [
+ executor.retained_events().map(|_| ()),
+ executor.poll_events().map(|_| ()),
+ executor.acknowledge_events(1),
+ executor
+ .execute(&command(5, "runner.drain", json!({})))
+ .map(|_| ()),
+ executor
+ .execute(&command(6, "request.resolve", response.clone()))
+ .map(|_| ()),
+ executor.shutdown(),
+ ] {
+ assert_eq!(result.unwrap_err().to_string(), error.to_string());
+ }
+ assert_eq!(fs::read(&previous_path).unwrap(), previous);
+ fs::remove_dir(&state_path).unwrap();
+ fs::rename(&previous_path, &state_path).unwrap();
+ assert!(executor.shutdown().is_err());
+ assert_eq!(fs::read(&state_path).unwrap(), previous);
+ drop(executor);
+
+ let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ let events = recovered.poll_events().unwrap();
+ let settlements: Vec<_> = events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .collect();
+ assert_eq!(settlements.len(), 1);
+ assert_eq!(settlements[0].event_type, "runtime_request.expired");
+ assert_eq!(settlements[0].payload["requestId"], request_id);
+ assert_eq!(settlements[0].payload["replayAllowed"], false);
+ assert!(recovered
+ .execute(&command(7, "request.resolve", response))
+ .is_err());
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ recovered.acknowledge_events(events.len()).unwrap();
+ shutdown_recovered_acpx_fixture(&mut recovered, &directory);
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
+#[test]
+fn acpx_failed_or_cancelled_responses_retain_one_durable_settlement() {
+ for (mode, close) in [
+ ("permissions-wrong-ack", false),
+ ("permissions-interactive", true),
+ ("resolutions", true),
+ ] {
+ let directory = temporary_directory("response-expiry");
+ let (mut executor, config, request_id, _) = pending_acpx_runtime_request(&directory, mode);
+ if close {
+ executor
+ .execute(&command(4, "session.close", json!({})))
+ .unwrap();
+ } else {
+ let error = executor
+ .execute(&command(
+ 4,
+ "request.resolve",
+ acpx_runtime_resolution(mode, &request_id),
+ ))
+ .unwrap_err();
+ assert!(error
+ .to_string()
+ .contains("did not confirm permission resolution"));
+ }
+ let events = executor.poll_events().unwrap();
+ let requests: Vec<_> = events
+ .iter()
+ .filter(|event| event.event_type.starts_with("runtime_request."))
+ .collect();
+ assert_eq!(requests.len(), 1);
+ assert_eq!(
+ requests[0].event_type,
+ if close {
+ "runtime_request.cancelled"
+ } else {
+ "runtime_request.expired"
+ }
+ );
+ assert_eq!(requests[0].payload["requestId"], request_id);
+ assert_eq!(requests[0].payload["replayAllowed"], false);
+ drop(executor);
+ let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ assert_eq!(recovered.poll_events().unwrap(), events);
+ assert!(recovered
+ .execute(&command(
+ 5,
+ "request.resolve",
+ acpx_runtime_resolution(mode, &request_id)
+ ))
+ .is_err());
+ recovered.acknowledge_events(events.len()).unwrap();
+ assert!(recovered.poll_events().unwrap().is_empty());
+ shutdown_recovered_acpx_fixture(&mut recovered, &directory);
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
+
#[test]
fn preserves_acpx_semantic_disposition_in_the_run_terminal() {
let directory = temporary_directory("acpx-blocked");
@@ -820,18 +1355,83 @@ fn rejects_opencode_launch_profile_drift_across_fresh_recovery() {
}
#[test]
-fn rejects_pi_before_starting_a_sidecar() {
- let directory = temporary_directory("pi");
- let config = config(&directory);
+fn rejects_pi_with_an_unqualified_model_before_starting_a_sidecar() {
+ let directory = temporary_directory("pi-model");
+ let config = pi_acpx_config(&directory, "bootstrap");
+ let mut payload = pi_prepare_payload(&directory, "bootstrap");
+ // All Pi distribution and policy fields are correct. Admission must reject
+ // the model itself, not rely on the old blanket exclusion of this harness.
+ payload["provider"]["model"] = json!("gpt-5.6-sol");
let mut executor = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
let error = executor
- .execute(&command(
- 1,
- "run.prepare",
- prepare_payload(&directory, "pi"),
- ))
+ .execute(&command(1, "run.prepare", payload))
.unwrap_err();
- assert!(error.to_string().contains("agent pi is not executable"));
+ assert!(error
+ .to_string()
+ .contains("does not match a qualified immutable profile"));
assert!(!directory.join("acpx-runtime").exists());
+ assert!(!directory.join("acpx-provider-state.json").exists());
fs::remove_dir_all(directory).unwrap();
}
+
+#[test]
+fn publishes_only_changed_pi_controls_before_the_new_turn() {
+ for (mode, initially_available, turn_available) in [
+ ("controls-lazy", false, true),
+ ("controls-downgrade", true, false),
+ ("controls", true, true),
+ ] {
+ let directory = temporary_directory(mode);
+ let config = pi_acpx_config(&directory, mode);
+ let mut executor = NativeProviderCommandExecutor::with_runner_config(&directory, &config);
+ executor
+ .execute(&command(
+ 1,
+ "run.prepare",
+ pi_prepare_payload(&directory, mode),
+ ))
+ .unwrap();
+ let opened = executor
+ .execute(&command(2, "session.open", json!({})))
+ .unwrap();
+ assert_eq!(
+ opened.events[0].2["providerDescriptor"]["turnControls"],
+ json!({"steering":initially_available, "queuedFollowUp":initially_available})
+ );
+
+ let started = executor
+ .execute(&command(
+ 3,
+ "turn.start",
+ json!({
+ "text":"Work", "turnId":"provider-turn-controls"
+ }),
+ ))
+ .unwrap();
+ assert_eq!(started.result["providerTurnId"], "provider-turn-controls");
+ let expected_types = if initially_available != turn_available {
+ vec!["session.capabilities.updated", "turn.started"]
+ } else {
+ vec!["turn.started"]
+ };
+ assert_eq!(
+ started
+ .events
+ .iter()
+ .map(|event| event.0.as_str())
+ .collect::>(),
+ expected_types
+ );
+ if initially_available != turn_available {
+ assert_eq!(
+ started.events[0].2["turnControls"],
+ json!({"steering":turn_available, "queuedFollowUp":turn_available})
+ );
+ }
+ let turn = &started.events.last().unwrap().2;
+ assert_eq!(turn["providerTurnId"], "provider-turn-controls");
+ assert_eq!(turn["turn"]["id"], "provider-turn-controls");
+ executor.shutdown().unwrap();
+ fs::remove_dir_all(directory).unwrap();
+ }
+}
diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/provider_bridge.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/provider_bridge.rs
index 2504f383ed1..61a0a022502 100644
--- a/packages/paperclip-runner/runner/crates/runner-core/tests/provider_bridge.rs
+++ b/packages/paperclip-runner/runner/crates/runner-core/tests/provider_bridge.rs
@@ -288,26 +288,62 @@ fn recovered_bridge_rejects_tampered_authorization_state() {
}
#[test]
-fn cancellation_completes_pending_calls_and_rejects_late_results() {
- let mut bridge = ProviderToolBridge::default();
- bridge.prepare(tools("computed")).unwrap();
- bridge
- .begin_call("call-1".into(), "get_task_context".into(), json!({}))
- .unwrap();
- let cancelled = bridge
- .cancel_pending_calls("provider_turn_stopped")
- .unwrap();
- assert_eq!(cancelled.len(), 1);
- assert!(cancelled[0].is_error);
- assert_eq!(bridge.pending_calls().count(), 0);
- assert!(bridge
- .apply_result(ToolResult {
- call_id: "call-1".into(),
- operation_id: "get_task_context".into(),
- result: json!({"ok": true}),
- is_error: false,
- })
- .is_err());
+fn stop_and_restart_keep_inflight_effects_pending_until_authoritative_result() {
+ for stop_before_result in [false, true] {
+ for restart in [false, true] {
+ let mut bridge = ProviderToolBridge::default();
+ bridge.prepare(tools("computed")).unwrap();
+ bridge
+ .begin_call("call-1".into(), "get_task_context".into(), json!({}))
+ .unwrap();
+ let result = ToolResult {
+ call_id: "call-1".into(),
+ operation_id: "get_task_context".into(),
+ result: json!({"written": true}),
+ is_error: false,
+ };
+ if !stop_before_result {
+ bridge.apply_result(result.clone()).unwrap();
+ }
+ assert!(bridge
+ .cancel_pending_calls("provider_turn_stopped")
+ .unwrap()
+ .is_empty());
+ if restart {
+ bridge = serde_json::from_str(&serde_json::to_string(&bridge).unwrap()).unwrap();
+ bridge.attach_existing_run().unwrap();
+ }
+ assert!(bridge
+ .begin_call("new-call".into(), "get_task_context".into(), json!({}))
+ .is_err());
+ if stop_before_result {
+ assert_eq!(bridge.pending_calls().count(), 1);
+ assert!(bridge.prepare_turn().is_err());
+ assert!(bridge.attach_run(tools("computed")).is_err());
+ }
+ bridge.apply_result(result.clone()).unwrap();
+ bridge
+ .apply_result(result.clone())
+ .expect("identical delivery is idempotent");
+ assert_eq!(bridge.pending_calls().count(), 0);
+ assert_eq!(
+ bridge
+ .replay_result("call-1", "get_task_context", &json!({}))
+ .unwrap(),
+ Some(result.clone())
+ );
+ assert!(bridge
+ .apply_result(ToolResult {
+ result: json!({"written": false}),
+ ..result
+ })
+ .is_err());
+ bridge.prepare_turn().unwrap();
+ bridge
+ .begin_call("new-call".into(), "get_task_context".into(), json!({}))
+ .unwrap();
+ }
+ }
}
#[test]
@@ -333,6 +369,7 @@ fn turn_settlement_releases_value_capacity_without_reusing_call_ids() {
assert!(bridge
.begin_call("call-1".into(), "get_task_context".into(), json!({}))
.is_err());
+ bridge.prepare_turn().unwrap();
bridge
.begin_call("call-2".into(), "get_task_context".into(), json!({}))
.expect("a new turn can use a fresh call id after releasing exact values");
@@ -405,8 +442,18 @@ fn turn_settlement_cannot_be_blocked_by_completed_value_pressure() {
}
let settled = bridge.settle_turn("provider_turn_terminated").unwrap();
- assert_eq!(settled.len(), 1);
- assert!(settled[0].is_error);
+ assert!(settled.is_empty());
+ assert_eq!(bridge.pending_calls().count(), 1);
+ assert!(bridge.prepare_turn().is_err());
+ bridge
+ .apply_result(ToolResult {
+ call_id: "call-4".into(),
+ operation_id: "get_task_context".into(),
+ result: json!({"ok": true}),
+ is_error: false,
+ })
+ .unwrap();
+ bridge.prepare_turn().unwrap();
assert!(bridge
.begin_call("call-0".into(), "get_task_context".into(), json!({}))
.is_err());
@@ -662,6 +709,7 @@ fn settles_completed_receipts_before_the_next_turn() {
.begin_call("call-next".into(), "get_task_context".into(), json!({}))
.is_err());
bridge.settle_turn("provider_turn_terminated").unwrap();
+ bridge.prepare_turn().unwrap();
assert!(bridge
.begin_call("call-next".into(), "get_task_context".into(), json!({}))
.is_ok());
@@ -704,9 +752,6 @@ fn settlement_preserves_call_ids_for_the_durable_run() {
assert!(bridge
.begin_call("call-1".into(), "get_task_context".into(), json!({}))
.is_err());
- bridge
- .begin_call("call-2".into(), "get_task_context".into(), json!({}))
- .unwrap();
let encoded = serde_json::to_string(&bridge).unwrap();
let mut recovered: ProviderToolBridge = serde_json::from_str(&encoded).unwrap();
@@ -759,16 +804,18 @@ fn exact_identity_overflow_saturates_the_durable_run() {
.expect("the controlled turn stop retains replay protection");
assert!(recovered.durable_run_receipt_limit_reached());
assert!(recovered.has_completed_call("settled-0"));
+ assert!(!recovered.has_completed_call("last-call"));
+ assert_eq!(recovered.pending_calls().count(), 1);
+ assert!(recovered.prepare_turn().is_err());
+ recovered
+ .apply_result(ToolResult {
+ call_id: "last-call".into(),
+ operation_id: "get_task_context".into(),
+ result: json!({"ok": true}),
+ is_error: false,
+ })
+ .unwrap();
assert!(recovered.has_completed_call("last-call"));
- let stopped_turn_receipt = recovered
- .replay_result("last-call", "get_task_context", &json!({}))
- .unwrap()
- .expect("the call admitted before exhaustion retains an exact terminal receipt");
- assert!(stopped_turn_receipt.is_error);
- assert_eq!(
- stopped_turn_receipt.result["error"]["code"],
- "provider_turn_terminated"
- );
assert!(recovered
.begin_call("settled-0".into(), "get_task_context".into(), json!({}))
.is_err());
@@ -831,12 +878,12 @@ fn settled_result_byte_exhaustion_recovers_after_turn_cleanup() {
json!({}),
)
.expect_err("settled byte exhaustion must stop the durable run");
- assert!(error.is_active_turn_receipt_limit());
+ assert!(error.to_string().contains("provider turn stopped"));
let encoded = serde_json::to_string(&bridge).unwrap();
let mut recovered: ProviderToolBridge = serde_json::from_str(&encoded).unwrap();
recovered.attach_existing_run().unwrap();
- assert!(recovered.durable_run_receipt_limit_reached());
+ assert!(recovered.turn_closed());
assert_eq!(
recovered
.replay_result("large-settled-0", "get_task_context", &json!({}))
@@ -868,8 +915,16 @@ fn settled_result_byte_exhaustion_recovers_after_turn_cleanup() {
.expect("releasing bulky results clears transient byte pressure");
recovered
.settle_turn("provider_turn_terminated")
- .expect("the admitted next-turn call remains settleable");
-
+ .expect("closing admission preserves the admitted next-turn call");
+ assert!(recovered.attach_run(tools("computed")).is_err());
+ recovered
+ .apply_result(ToolResult {
+ call_id: "after-turn-boundary".into(),
+ operation_id: "get_task_context".into(),
+ result: json!({"ok":true}),
+ is_error: false,
+ })
+ .unwrap();
recovered.attach_run(tools("computed")).unwrap();
recovered
.begin_call(
@@ -1003,18 +1058,19 @@ fn recovery_rejects_state_without_room_for_a_pending_result() {
}
#[test]
-fn settles_pending_receipts_with_explicit_terminal_results() {
+fn stopped_provider_does_not_prove_pending_effect_failed() {
let mut bridge = ProviderToolBridge::default();
bridge.prepare(tools("computed")).unwrap();
bridge
.begin_call("call-1".into(), "get_task_context".into(), json!({}))
.unwrap();
-
- let settled = bridge.settle_turn("provider_turn_terminated").unwrap();
- assert_eq!(settled.len(), 1);
- assert_eq!(settled[0].call_id, "call-1");
- assert!(settled[0].is_error);
- assert_eq!(bridge.pending_calls().count(), 0);
+ assert!(bridge
+ .settle_turn("provider_turn_terminated")
+ .unwrap()
+ .is_empty());
+ assert_eq!(bridge.pending_calls().count(), 1);
+ assert!(!bridge.has_completed_call("call-1"));
+ assert!(bridge.prepare_turn().is_err());
}
#[test]
diff --git a/packages/paperclip-runner/scripts/build-provider-pack.mjs b/packages/paperclip-runner/scripts/build-provider-pack.mjs
index 167051e0be8..0e6e036bf9e 100644
--- a/packages/paperclip-runner/scripts/build-provider-pack.mjs
+++ b/packages/paperclip-runner/scripts/build-provider-pack.mjs
@@ -18,10 +18,11 @@ import { tmpdir } from "node:os";
import { dirname, join, relative, resolve } from "node:path";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
+import { parseProviderPackArguments, materializeCandidateProviderPack } from "./candidate-provider-pack.mjs";
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const workspaceRoot = resolve(packageRoot, "../..");
-const outputArgument = process.argv.slice(2).find((value) => value !== "--");
+const { output: outputArgument, candidates } = parseProviderPackArguments(process.argv.slice(2));
const outputRoot = resolve(
process.cwd(),
outputArgument ?? join(packageRoot, "provider-pack"),
@@ -34,7 +35,7 @@ if (
throw new Error(`Refusing unsafe provider-pack output path: ${outputRoot}`);
}
-const temporaryParent = mkdtempSync(join(tmpdir(), "paperclip-provider-pack-"));
+const temporaryParent = realpathSync(mkdtempSync(join(tmpdir(), "paperclip-provider-pack-")));
const temporaryRoot = join(temporaryParent, "pack");
function canonicalJson(value) {
@@ -163,6 +164,24 @@ try {
mkdirSync(dirname(stableNodeCommand), { recursive: true, mode: 0o755 });
copyFileSync(process.execPath, stableNodeCommand);
chmodSync(stableNodeCommand, 0o755);
+ const relocatedNode = spawnSync(stableNodeCommand, ["--version"], {
+ cwd: temporaryRoot, env: { PATH: "/usr/bin:/bin" }, encoding: "utf8", timeout: 10_000,
+ });
+ if (relocatedNode.status !== 0 || relocatedNode.stdout.trim() !== `v${process.versions.node}`) {
+ throw new Error("Provider pack Node is not portable after relocation; build with a standalone Node distribution");
+ }
+
+ const candidateProviders = {};
+ for (const provider of candidates) {
+ const assetPath = `provider-assets/${provider}/${process.platform}-${process.arch}`;
+ const metadata = await materializeCandidateProviderPack({ provider, outputRoot: join(temporaryRoot, assetPath) });
+ if (typeof metadata?.version !== "string" || !metadata.version || metadata.version.length > 120
+ || !/^sha256:[a-f0-9]{64}$/.test(metadata.profileDigest)
+ || !/^sha256:[a-f0-9]{64}$/.test(metadata.closureDigest)) throw new Error("Candidate builder omitted its pinned identity");
+ candidateProviders[provider] = { version: metadata.version, profileDigest: metadata.profileDigest,
+ closureDigest: metadata.closureDigest, qualification: "pending", path: assetPath,
+ sha256: sha256Tree(join(temporaryRoot, assetPath)) };
+ }
// pnpm's generated .bin shims embed the temporary deployment directory in
// NODE_PATH. That makes an otherwise identical provider pack hash differ on
@@ -314,6 +333,7 @@ try {
codex:
"sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3",
},
+ ...(candidates.length ? { candidateProviders } : {}),
artifacts: {
grokLauncher: {
path: "dist/providers/grok/launcher.cjs",
diff --git a/packages/paperclip-runner/scripts/candidate-provider-pack.mjs b/packages/paperclip-runner/scripts/candidate-provider-pack.mjs
new file mode 100644
index 00000000000..083d8fbb3a4
--- /dev/null
+++ b/packages/paperclip-runner/scripts/candidate-provider-pack.mjs
@@ -0,0 +1,22 @@
+const CANDIDATES = new Set(["cursor", "copilot", "pi"]);
+
+export function parseProviderPackArguments(args) {
+ let output;
+ const candidates = [];
+ for (const value of args.filter(value => value !== "--")) {
+ if (value.startsWith("--candidate-providers=")) {
+ for (const provider of value.slice("--candidate-providers=".length).split(",").filter(Boolean)) {
+ if (!CANDIDATES.has(provider) || candidates.includes(provider)) throw new Error("Unknown or duplicate candidate provider");
+ candidates.push(provider);
+ }
+ } else if (value.startsWith("--") || output !== undefined) throw new Error("Invalid provider-pack arguments");
+ else output = value;
+ }
+ return { output, candidates };
+}
+
+/** Closed source-owned builder registry; provider branches add their exact pins. */
+export async function materializeCandidateProviderPack({ provider, outputRoot }) {
+ if (!CANDIDATES.has(provider)) throw new Error("Unknown candidate provider");
+ throw new Error(`The ${provider} candidate distribution builder is not included in this source revision`);
+}
diff --git a/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs
new file mode 100644
index 00000000000..c95cccff970
--- /dev/null
+++ b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs
@@ -0,0 +1,14 @@
+import test from "node:test";
+import assert from "node:assert/strict";
+import { parseProviderPackArguments, materializeCandidateProviderPack } from "./candidate-provider-pack.mjs";
+
+test("candidate builds are explicit and leave qualified-only builds unchanged", () => {
+ assert.deepEqual(parseProviderPackArguments(["--", "/pack"]), { output: "/pack", candidates: [] });
+ assert.deepEqual(parseProviderPackArguments(["/pack", "--candidate-providers=pi,cursor"]), { output: "/pack", candidates: ["pi", "cursor"] });
+});
+test("candidate builder cannot admit unknown providers, options or duplicate assets", async () => {
+ for (const args of [["--candidate-providers=cursor,cursor"], ["--candidate-providers=other"], ["--executable=/tmp/x"], ["/one", "/two"]]) {
+ assert.throws(() => parseProviderPackArguments(args));
+ }
+ await assert.rejects(materializeCandidateProviderPack({ provider: "arbitrary", outputRoot: "/tmp/unused" }), /Unknown candidate/);
+});
diff --git a/packages/paperclip-runner/scripts/check-capability-inventory.test.mjs b/packages/paperclip-runner/scripts/check-capability-inventory.test.mjs
index a7be44ecbf5..f81047ccf4c 100644
--- a/packages/paperclip-runner/scripts/check-capability-inventory.test.mjs
+++ b/packages/paperclip-runner/scripts/check-capability-inventory.test.mjs
@@ -42,7 +42,7 @@ function validInventories() {
schemaVersion: 2,
inventoryRole: "normative",
generatedFrom: ["skills/paperclip/SKILL.md"],
- rows: Array.from({ length: 155 }, (_, index) => row(`capability-${index}`)),
+ rows: Array.from({ length: 157 }, (_, index) => row(`capability-${index}`)),
},
evaluations: {
schemaVersion: 2,
diff --git a/packages/paperclip-runner/scripts/generate-capability-contract.mjs b/packages/paperclip-runner/scripts/generate-capability-contract.mjs
index 1e86c056642..840b94521c1 100644
--- a/packages/paperclip-runner/scripts/generate-capability-contract.mjs
+++ b/packages/paperclip-runner/scripts/generate-capability-contract.mjs
@@ -25,6 +25,7 @@ function sourceAnchor(path, line, heading) {
function classifyHeading(path, heading) {
const normalized = heading.toLowerCase();
+ if (normalized === "conversational confirmation answers") return "always_agent_tool";
if (/(authentication|identity|checkout|budget|error|wake|heartbeat|approval follow-up|activity|audit|release|terminology)/.test(normalized)) {
return "control_plane_owned";
}
@@ -39,6 +40,7 @@ function classifyHeading(path, heading) {
function semanticOperation(disposition, heading) {
const normalized = heading.toLowerCase();
+ if (normalized === "conversational confirmation answers") return "call_api";
if (disposition === "control_plane_owned") return "runtime_reconciliation";
if (normalized.includes("document") || normalized.includes("plan")) return "write_document";
if (normalized.includes("comment") || normalized.includes("report")) return "report_progress";
diff --git a/packages/paperclip-runner/scripts/lib/capability-inventory.mjs b/packages/paperclip-runner/scripts/lib/capability-inventory.mjs
index 0ddfee755ae..be9dd2ce7d9 100644
--- a/packages/paperclip-runner/scripts/lib/capability-inventory.mjs
+++ b/packages/paperclip-runner/scripts/lib/capability-inventory.mjs
@@ -247,7 +247,7 @@ export async function buildMcpInventory(repoRoot) {
export function validateInventories(inventories) {
const errors = [];
- const expectedCounts = { capabilities: 155, evaluations: 106, legacyMcpAliases: 42 };
+ const expectedCounts = { capabilities: 157, evaluations: 106, legacyMcpAliases: 42 };
const normativeNames = ["capabilities", "evaluations"];
const normativeRows = new Map();
const globalNormativeIds = new Set();
diff --git a/packages/paperclip-runner/spec/capability/capabilities.yaml b/packages/paperclip-runner/spec/capability/capabilities.yaml
index d1b0f61df17..2f8db85bd96 100644
--- a/packages/paperclip-runner/spec/capability/capabilities.yaml
+++ b/packages/paperclip-runner/spec/capability/capabilities.yaml
@@ -104,9 +104,9 @@
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:generated-artifacts-and-work-products:159",
+ "id": "skill:skills/paperclip/SKILL.md:generated-artifacts-and-work-products:195",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:159",
+ "sourceAnchor": "skills/paperclip/SKILL.md:195",
"title": "Generated Artifacts and Work Products",
"expectedSemantics": "Skill guidance headed “Generated Artifacts and Work Products”.",
"primaryDisposition": "always_agent_tool",
@@ -115,13 +115,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:159"
+ "skill:skills/paperclip/SKILL.md:195"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:status-quick-guide:207",
+ "id": "skill:skills/paperclip/SKILL.md:status-quick-guide:243",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:207",
+ "sourceAnchor": "skills/paperclip/SKILL.md:243",
"title": "Status Quick Guide",
"expectedSemantics": "Skill guidance headed “Status Quick Guide”.",
"primaryDisposition": "control_plane_owned",
@@ -130,13 +130,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:207"
+ "skill:skills/paperclip/SKILL.md:243"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:monitors-and-watchers-say-only-what-you-actually-scheduled:217",
+ "id": "skill:skills/paperclip/SKILL.md:monitors-and-watchers-say-only-what-you-actually-scheduled:253",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:217",
+ "sourceAnchor": "skills/paperclip/SKILL.md:253",
"title": "Monitors and Watchers (say only what you actually scheduled)",
"expectedSemantics": "Skill guidance headed “Monitors and Watchers (say only what you actually scheduled)”.",
"primaryDisposition": "optional_agent_tool",
@@ -145,13 +145,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:217"
+ "skill:skills/paperclip/SKILL.md:253"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:delegating-review-tasks:230",
+ "id": "skill:skills/paperclip/SKILL.md:delegating-review-tasks:266",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:230",
+ "sourceAnchor": "skills/paperclip/SKILL.md:266",
"title": "Delegating review tasks",
"expectedSemantics": "Skill guidance headed “Delegating review tasks”.",
"primaryDisposition": "always_agent_tool",
@@ -160,13 +160,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:230"
+ "skill:skills/paperclip/SKILL.md:266"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:managing-a-user-s-inbox:241",
+ "id": "skill:skills/paperclip/SKILL.md:managing-a-user-s-inbox:277",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:241",
+ "sourceAnchor": "skills/paperclip/SKILL.md:277",
"title": "Managing A User's Inbox",
"expectedSemantics": "Skill guidance headed “Managing A User's Inbox”.",
"primaryDisposition": "control_plane_owned",
@@ -175,13 +175,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:241"
+ "skill:skills/paperclip/SKILL.md:277"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:issue-dependencies-blockers:249",
+ "id": "skill:skills/paperclip/SKILL.md:issue-dependencies-blockers:285",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:249",
+ "sourceAnchor": "skills/paperclip/SKILL.md:285",
"title": "Issue Dependencies (Blockers)",
"expectedSemantics": "Skill guidance headed “Issue Dependencies (Blockers)”.",
"primaryDisposition": "control_plane_owned",
@@ -190,13 +190,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:249"
+ "skill:skills/paperclip/SKILL.md:285"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:requesting-board-approval:274",
+ "id": "skill:skills/paperclip/SKILL.md:requesting-board-approval:310",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:274",
+ "sourceAnchor": "skills/paperclip/SKILL.md:310",
"title": "Requesting Board Approval",
"expectedSemantics": "Skill guidance headed “Requesting Board Approval”.",
"primaryDisposition": "optional_agent_tool",
@@ -205,13 +205,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:274"
+ "skill:skills/paperclip/SKILL.md:310"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:issue-thread-interactions:295",
+ "id": "skill:skills/paperclip/SKILL.md:issue-thread-interactions:331",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:295",
+ "sourceAnchor": "skills/paperclip/SKILL.md:331",
"title": "Issue-Thread Interactions",
"expectedSemantics": "Skill guidance headed “Issue-Thread Interactions”.",
"primaryDisposition": "optional_agent_tool",
@@ -220,13 +220,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:295"
+ "skill:skills/paperclip/SKILL.md:331"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:standalone-decisions:324",
+ "id": "skill:skills/paperclip/SKILL.md:standalone-decisions:360",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:324",
+ "sourceAnchor": "skills/paperclip/SKILL.md:360",
"title": "Standalone Decisions",
"expectedSemantics": "Skill guidance headed “Standalone Decisions”.",
"primaryDisposition": "optional_agent_tool",
@@ -235,13 +235,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:324"
+ "skill:skills/paperclip/SKILL.md:360"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:mcp-tool-approval-gates:428",
+ "id": "skill:skills/paperclip/SKILL.md:mcp-tool-approval-gates:464",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:428",
+ "sourceAnchor": "skills/paperclip/SKILL.md:464",
"title": "MCP Tool Approval Gates",
"expectedSemantics": "Skill guidance headed “MCP Tool Approval Gates”.",
"primaryDisposition": "optional_agent_tool",
@@ -250,13 +250,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:428"
+ "skill:skills/paperclip/SKILL.md:464"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:niche-workflow-pointers:470",
+ "id": "skill:skills/paperclip/SKILL.md:niche-workflow-pointers:506",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:470",
+ "sourceAnchor": "skills/paperclip/SKILL.md:506",
"title": "Niche Workflow Pointers",
"expectedSemantics": "Skill guidance headed “Niche Workflow Pointers”.",
"primaryDisposition": "optional_agent_tool",
@@ -265,13 +265,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:470"
+ "skill:skills/paperclip/SKILL.md:506"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:cases:480",
+ "id": "skill:skills/paperclip/SKILL.md:cases:516",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:480",
+ "sourceAnchor": "skills/paperclip/SKILL.md:516",
"title": "Cases",
"expectedSemantics": "Skill guidance headed “Cases”.",
"primaryDisposition": "optional_agent_tool",
@@ -280,75 +280,15 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:480"
+ "skill:skills/paperclip/SKILL.md:516"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:company-skills-workflow:485",
- "sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:485",
- "title": "Company Skills Workflow",
- "expectedSemantics": "Skill guidance headed “Company Skills Workflow”.",
- "primaryDisposition": "optional_agent_tool",
- "requiredGrants": [],
- "assertionClasses": [
- "control_plane_invariant"
- ],
- "evidenceIds": [
- "skill:skills/paperclip/SKILL.md:485"
- ]
- },
- {
- "id": "skill:skills/paperclip/SKILL.md:routines:496",
- "sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:496",
- "title": "Routines",
- "expectedSemantics": "Skill guidance headed “Routines”.",
- "primaryDisposition": "optional_agent_tool",
- "requiredGrants": [],
- "assertionClasses": [
- "control_plane_invariant"
- ],
- "evidenceIds": [
- "skill:skills/paperclip/SKILL.md:496"
- ]
- },
- {
- "id": "skill:skills/paperclip/SKILL.md:issue-workspace-runtime-controls:507",
- "sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:507",
- "title": "Issue Workspace Runtime Controls",
- "expectedSemantics": "Skill guidance headed “Issue Workspace Runtime Controls”.",
- "primaryDisposition": "optional_agent_tool",
- "requiredGrants": [],
- "assertionClasses": [
- "control_plane_invariant"
- ],
- "evidenceIds": [
- "skill:skills/paperclip/SKILL.md:507"
- ]
- },
- {
- "id": "skill:skills/paperclip/SKILL.md:proposing-credentials-safely:514",
- "sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:514",
- "title": "Proposing Credentials Safely",
- "expectedSemantics": "Skill guidance headed “Proposing Credentials Safely”.",
- "primaryDisposition": "optional_agent_tool",
- "requiredGrants": [],
- "assertionClasses": [
- "control_plane_invariant"
- ],
- "evidenceIds": [
- "skill:skills/paperclip/SKILL.md:514"
- ]
- },
- {
- "id": "skill:skills/paperclip/SKILL.md:reading-granted-secrets:521",
+ "id": "skill:skills/paperclip/SKILL.md:company-skills-workflow:521",
"sourceKind": "skill_heading",
"sourceAnchor": "skills/paperclip/SKILL.md:521",
- "title": "Reading Granted Secrets",
- "expectedSemantics": "Skill guidance headed “Reading Granted Secrets”.",
+ "title": "Company Skills Workflow",
+ "expectedSemantics": "Skill guidance headed “Company Skills Workflow”.",
"primaryDisposition": "optional_agent_tool",
"requiredGrants": [],
"assertionClasses": [
@@ -359,9 +299,69 @@
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:critical-rules:547",
+ "id": "skill:skills/paperclip/SKILL.md:routines:532",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:547",
+ "sourceAnchor": "skills/paperclip/SKILL.md:532",
+ "title": "Routines",
+ "expectedSemantics": "Skill guidance headed “Routines”.",
+ "primaryDisposition": "optional_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/SKILL.md:532"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/SKILL.md:issue-workspace-runtime-controls:543",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md:543",
+ "title": "Issue Workspace Runtime Controls",
+ "expectedSemantics": "Skill guidance headed “Issue Workspace Runtime Controls”.",
+ "primaryDisposition": "optional_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/SKILL.md:543"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/SKILL.md:proposing-credentials-safely:550",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md:550",
+ "title": "Proposing Credentials Safely",
+ "expectedSemantics": "Skill guidance headed “Proposing Credentials Safely”.",
+ "primaryDisposition": "optional_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/SKILL.md:550"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/SKILL.md:reading-granted-secrets:557",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md:557",
+ "title": "Reading Granted Secrets",
+ "expectedSemantics": "Skill guidance headed “Reading Granted Secrets”.",
+ "primaryDisposition": "optional_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/SKILL.md:557"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/SKILL.md:critical-rules:583",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md:583",
"title": "Critical Rules",
"expectedSemantics": "Skill guidance headed “Critical Rules”.",
"primaryDisposition": "optional_agent_tool",
@@ -370,13 +370,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:547"
+ "skill:skills/paperclip/SKILL.md:583"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:comment-style-required:567",
+ "id": "skill:skills/paperclip/SKILL.md:comment-style-required:604",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:567",
+ "sourceAnchor": "skills/paperclip/SKILL.md:604",
"title": "Comment Style (Required)",
"expectedSemantics": "Skill guidance headed “Comment Style (Required)”.",
"primaryDisposition": "always_agent_tool",
@@ -385,13 +385,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:567"
+ "skill:skills/paperclip/SKILL.md:604"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:update:599",
+ "id": "skill:skills/paperclip/SKILL.md:update:636",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:599",
+ "sourceAnchor": "skills/paperclip/SKILL.md:636",
"title": "Update",
"expectedSemantics": "Skill guidance headed “Update”.",
"primaryDisposition": "optional_agent_tool",
@@ -400,13 +400,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:599"
+ "skill:skills/paperclip/SKILL.md:636"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:planning-required-when-planning-requested:609",
+ "id": "skill:skills/paperclip/SKILL.md:planning-required-when-planning-requested:646",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:609",
+ "sourceAnchor": "skills/paperclip/SKILL.md:646",
"title": "Planning (Required when planning requested)",
"expectedSemantics": "Skill guidance headed “Planning (Required when planning requested)”.",
"primaryDisposition": "optional_agent_tool",
@@ -415,13 +415,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:609"
+ "skill:skills/paperclip/SKILL.md:646"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:key-endpoints-hot-routes:642",
+ "id": "skill:skills/paperclip/SKILL.md:key-endpoints-hot-routes:679",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:642",
+ "sourceAnchor": "skills/paperclip/SKILL.md:679",
"title": "Key Endpoints (Hot Routes)",
"expectedSemantics": "Skill guidance headed “Key Endpoints (Hot Routes)”.",
"primaryDisposition": "optional_agent_tool",
@@ -430,13 +430,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:642"
+ "skill:skills/paperclip/SKILL.md:679"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:searching-issues:671",
+ "id": "skill:skills/paperclip/SKILL.md:searching-issues:708",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:671",
+ "sourceAnchor": "skills/paperclip/SKILL.md:708",
"title": "Searching Issues",
"expectedSemantics": "Skill guidance headed “Searching Issues”.",
"primaryDisposition": "optional_agent_tool",
@@ -445,13 +445,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:671"
+ "skill:skills/paperclip/SKILL.md:708"
]
},
{
- "id": "skill:skills/paperclip/SKILL.md:full-reference:681",
+ "id": "skill:skills/paperclip/SKILL.md:full-reference:718",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/SKILL.md:681",
+ "sourceAnchor": "skills/paperclip/SKILL.md:718",
"title": "Full Reference",
"expectedSemantics": "Skill guidance headed “Full Reference”.",
"primaryDisposition": "optional_agent_tool",
@@ -460,7 +460,22 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/SKILL.md:681"
+ "skill:skills/paperclip/SKILL.md:718"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/SKILL.md:conversational-confirmation-answers:722",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/SKILL.md:722",
+ "title": "Conversational confirmation answers",
+ "expectedSemantics": "Skill guidance headed “Conversational confirmation answers”.",
+ "primaryDisposition": "always_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/SKILL.md:722"
]
},
{
@@ -1874,9 +1889,9 @@
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:cross-team-work-and-delegation:677",
+ "id": "skill:skills/paperclip/references/api-reference.md:cross-team-work-and-delegation:661",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:677",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:661",
"title": "Cross-Team Work and Delegation",
"expectedSemantics": "Skill guidance headed “Cross-Team Work and Delegation”.",
"primaryDisposition": "optional_agent_tool",
@@ -1885,13 +1900,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:677"
+ "skill:skills/paperclip/references/api-reference.md:661"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:receiving-cross-team-work:681",
+ "id": "skill:skills/paperclip/references/api-reference.md:receiving-cross-team-work:665",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:681",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:665",
"title": "Receiving cross-team work",
"expectedSemantics": "Skill guidance headed “Receiving cross-team work”.",
"primaryDisposition": "optional_agent_tool",
@@ -1900,13 +1915,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:681"
+ "skill:skills/paperclip/references/api-reference.md:665"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:questions-and-dependencies:691",
+ "id": "skill:skills/paperclip/references/api-reference.md:questions-and-dependencies:675",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:691",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:675",
"title": "Questions and dependencies",
"expectedSemantics": "Skill guidance headed “Questions and dependencies”.",
"primaryDisposition": "always_agent_tool",
@@ -1915,13 +1930,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:691"
+ "skill:skills/paperclip/references/api-reference.md:675"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:company-context:703",
+ "id": "skill:skills/paperclip/references/api-reference.md:company-context:687",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:703",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:687",
"title": "Company Context",
"expectedSemantics": "Skill guidance headed “Company Context”.",
"primaryDisposition": "optional_agent_tool",
@@ -1930,13 +1945,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:703"
+ "skill:skills/paperclip/references/api-reference.md:687"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:company-branding-ceo-board:715",
+ "id": "skill:skills/paperclip/references/api-reference.md:company-branding-ceo-board:699",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:715",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:699",
"title": "Company Branding (CEO / Board)",
"expectedSemantics": "Skill guidance headed “Company Branding (CEO / Board)”.",
"primaryDisposition": "optional_agent_tool",
@@ -1945,13 +1960,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:715"
+ "skill:skills/paperclip/references/api-reference.md:699"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:openclaw-invite-prompt-ceo:735",
+ "id": "skill:skills/paperclip/references/api-reference.md:openclaw-invite-prompt-ceo:719",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:735",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:719",
"title": "OpenClaw Invite Prompt (CEO)",
"expectedSemantics": "Skill guidance headed “OpenClaw Invite Prompt (CEO)”.",
"primaryDisposition": "optional_agent_tool",
@@ -1960,13 +1975,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:735"
+ "skill:skills/paperclip/references/api-reference.md:719"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:setting-agent-instructions-path:754",
+ "id": "skill:skills/paperclip/references/api-reference.md:setting-agent-instructions-path:738",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:754",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:738",
"title": "Setting Agent Instructions Path",
"expectedSemantics": "Skill guidance headed “Setting Agent Instructions Path”.",
"primaryDisposition": "optional_agent_tool",
@@ -1975,13 +1990,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:754"
+ "skill:skills/paperclip/references/api-reference.md:738"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:project-setup-create-workspace:787",
+ "id": "skill:skills/paperclip/references/api-reference.md:project-setup-create-workspace:771",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:787",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:771",
"title": "Project Setup (Create + Workspace)",
"expectedSemantics": "Skill guidance headed “Project Setup (Create + Workspace)”.",
"primaryDisposition": "optional_agent_tool",
@@ -1990,13 +2005,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:787"
+ "skill:skills/paperclip/references/api-reference.md:771"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:option-a-one-call-create-with-workspace:811",
+ "id": "skill:skills/paperclip/references/api-reference.md:option-a-one-call-create-with-workspace:795",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:811",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:795",
"title": "Option A: One-call create with workspace",
"expectedSemantics": "Skill guidance headed “Option A: One-call create with workspace”.",
"primaryDisposition": "optional_agent_tool",
@@ -2005,13 +2020,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:811"
+ "skill:skills/paperclip/references/api-reference.md:795"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:option-b-two-calls-project-first-then-workspace:830",
+ "id": "skill:skills/paperclip/references/api-reference.md:option-b-two-calls-project-first-then-workspace:814",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:830",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:814",
"title": "Option B: Two calls (project first, then workspace)",
"expectedSemantics": "Skill guidance headed “Option B: Two calls (project first, then workspace)”.",
"primaryDisposition": "optional_agent_tool",
@@ -2020,13 +2035,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:830"
+ "skill:skills/paperclip/references/api-reference.md:814"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:governance-and-approvals:859",
+ "id": "skill:skills/paperclip/references/api-reference.md:governance-and-approvals:843",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:859",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:843",
"title": "Governance and Approvals",
"expectedSemantics": "Skill guidance headed “Governance and Approvals”.",
"primaryDisposition": "optional_agent_tool",
@@ -2035,13 +2050,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:859"
+ "skill:skills/paperclip/references/api-reference.md:843"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:requesting-a-hire-management-only:863",
+ "id": "skill:skills/paperclip/references/api-reference.md:requesting-a-hire-management-only:847",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:863",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:847",
"title": "Requesting a hire (management only)",
"expectedSemantics": "Skill guidance headed “Requesting a hire (management only)”.",
"primaryDisposition": "optional_agent_tool",
@@ -2050,13 +2065,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:863"
+ "skill:skills/paperclip/references/api-reference.md:847"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:ceo-strategy-approval:928",
+ "id": "skill:skills/paperclip/references/api-reference.md:ceo-strategy-approval:912",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:928",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:912",
"title": "CEO strategy approval",
"expectedSemantics": "Skill guidance headed “CEO strategy approval”.",
"primaryDisposition": "optional_agent_tool",
@@ -2065,13 +2080,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:928"
+ "skill:skills/paperclip/references/api-reference.md:912"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:questions-and-waiting-for-human-input:937",
+ "id": "skill:skills/paperclip/references/api-reference.md:questions-and-waiting-for-human-input:921",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:937",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:921",
"title": "Questions and waiting for human input",
"expectedSemantics": "Skill guidance headed “Questions and waiting for human input”.",
"primaryDisposition": "always_agent_tool",
@@ -2080,13 +2095,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:937"
+ "skill:skills/paperclip/references/api-reference.md:921"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:issue-thread-confirmations:1034",
+ "id": "skill:skills/paperclip/references/api-reference.md:issue-thread-confirmations:1028",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1034",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1028",
"title": "Issue-thread confirmations",
"expectedSemantics": "Skill guidance headed “Issue-thread confirmations”.",
"primaryDisposition": "always_agent_tool",
@@ -2095,7 +2110,22 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1034"
+ "skill:skills/paperclip/references/api-reference.md:1028"
+ ]
+ },
+ {
+ "id": "skill:skills/paperclip/references/api-reference.md:conversational-confirmation-answers:1086",
+ "sourceKind": "skill_heading",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1086",
+ "title": "Conversational confirmation answers",
+ "expectedSemantics": "Skill guidance headed “Conversational confirmation answers”.",
+ "primaryDisposition": "always_agent_tool",
+ "requiredGrants": [],
+ "assertionClasses": [
+ "control_plane_invariant"
+ ],
+ "evidenceIds": [
+ "skill:skills/paperclip/references/api-reference.md:1086"
]
},
{
@@ -2234,9 +2264,9 @@
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:companies-projects-goals:1448",
+ "id": "skill:skills/paperclip/references/api-reference.md:companies-projects-goals:1449",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1448",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1449",
"title": "Companies, Projects, Goals",
"expectedSemantics": "Skill guidance headed “Companies, Projects, Goals”.",
"primaryDisposition": "optional_agent_tool",
@@ -2245,13 +2275,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1448"
+ "skill:skills/paperclip/references/api-reference.md:1449"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:routines:1472",
+ "id": "skill:skills/paperclip/references/api-reference.md:routines:1473",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1472",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1473",
"title": "Routines",
"expectedSemantics": "Skill guidance headed “Routines”.",
"primaryDisposition": "optional_agent_tool",
@@ -2260,13 +2290,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1472"
+ "skill:skills/paperclip/references/api-reference.md:1473"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:approvals-costs-activity-dashboard:1488",
+ "id": "skill:skills/paperclip/references/api-reference.md:approvals-costs-activity-dashboard:1489",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1488",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1489",
"title": "Approvals, Costs, Activity, Dashboard",
"expectedSemantics": "Skill guidance headed “Approvals, Costs, Activity, Dashboard”.",
"primaryDisposition": "optional_agent_tool",
@@ -2275,13 +2305,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1488"
+ "skill:skills/paperclip/references/api-reference.md:1489"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:secrets:1510",
+ "id": "skill:skills/paperclip/references/api-reference.md:secrets:1511",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1510",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1511",
"title": "Secrets",
"expectedSemantics": "Skill guidance headed “Secrets”.",
"primaryDisposition": "optional_agent_tool",
@@ -2290,13 +2320,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1510"
+ "skill:skills/paperclip/references/api-reference.md:1511"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:agent-secret-proposals:1523",
+ "id": "skill:skills/paperclip/references/api-reference.md:agent-secret-proposals:1524",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1523",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1524",
"title": "Agent secret proposals",
"expectedSemantics": "Skill guidance headed “Agent secret proposals”.",
"primaryDisposition": "optional_agent_tool",
@@ -2305,13 +2335,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1523"
+ "skill:skills/paperclip/references/api-reference.md:1524"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:agent-secret-access:1623",
+ "id": "skill:skills/paperclip/references/api-reference.md:agent-secret-access:1624",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1623",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1624",
"title": "Agent secret access",
"expectedSemantics": "Skill guidance headed “Agent secret access”.",
"primaryDisposition": "optional_agent_tool",
@@ -2320,13 +2350,13 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1623"
+ "skill:skills/paperclip/references/api-reference.md:1624"
]
},
{
- "id": "skill:skills/paperclip/references/api-reference.md:common-mistakes:1663",
+ "id": "skill:skills/paperclip/references/api-reference.md:common-mistakes:1664",
"sourceKind": "skill_heading",
- "sourceAnchor": "skills/paperclip/references/api-reference.md:1663",
+ "sourceAnchor": "skills/paperclip/references/api-reference.md:1664",
"title": "Common Mistakes",
"expectedSemantics": "Skill guidance headed “Common Mistakes”.",
"primaryDisposition": "optional_agent_tool",
@@ -2335,7 +2365,7 @@
"control_plane_invariant"
],
"evidenceIds": [
- "skill:skills/paperclip/references/api-reference.md:1663"
+ "skill:skills/paperclip/references/api-reference.md:1664"
]
}
]
diff --git a/packages/paperclip-runner/spec/capability/protocol-coverage.json b/packages/paperclip-runner/spec/capability/protocol-coverage.json
index 8c72856beb7..2371a89f6df 100644
--- a/packages/paperclip-runner/spec/capability/protocol-coverage.json
+++ b/packages/paperclip-runner/spec/capability/protocol-coverage.json
@@ -7,10 +7,86 @@
"src/scenarios/scenario-plan.ts"
],
"counts": {
- "actions": 48,
+ "actions": 52,
"legacyRequirements": 106
},
"actions": [
+ {
+ "id": "read_agent_instructions",
+ "ownership": "always_agent_tool",
+ "surfaces": [
+ "live"
+ ],
+ "legacyAliases": [],
+ "contractCase": "protocol-action:read_agent_instructions",
+ "contractOwner": "src/catalog/protocol-action-contracts.test.ts::read_agent_instructions has a schema-valid canonical example and every declared projection",
+ "legacyBehavioralCases": [],
+ "deterministicCases": [
+ "protocol-action:read_agent_instructions"
+ ],
+ "legacyRequirementCases": [],
+ "deterministicOwners": [
+ "src/catalog/protocol-action-contracts.test.ts::read_agent_instructions 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": "update_agent_instructions",
+ "ownership": "always_agent_tool",
+ "surfaces": [
+ "live"
+ ],
+ "legacyAliases": [],
+ "contractCase": "protocol-action:update_agent_instructions",
+ "contractOwner": "src/catalog/protocol-action-contracts.test.ts::update_agent_instructions has a schema-valid canonical example and every declared projection",
+ "legacyBehavioralCases": [],
+ "deterministicCases": [
+ "protocol-action:update_agent_instructions"
+ ],
+ "legacyRequirementCases": [],
+ "deterministicOwners": [
+ "src/catalog/protocol-action-contracts.test.ts::update_agent_instructions 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": "get_agent_instruction_history",
+ "ownership": "always_agent_tool",
+ "surfaces": [
+ "live"
+ ],
+ "legacyAliases": [],
+ "contractCase": "protocol-action:get_agent_instruction_history",
+ "contractOwner": "src/catalog/protocol-action-contracts.test.ts::get_agent_instruction_history has a schema-valid canonical example and every declared projection",
+ "legacyBehavioralCases": [],
+ "deterministicCases": [
+ "protocol-action:get_agent_instruction_history"
+ ],
+ "legacyRequirementCases": [],
+ "deterministicOwners": [
+ "src/catalog/protocol-action-contracts.test.ts::get_agent_instruction_history 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": "restore_agent_instructions",
+ "ownership": "always_agent_tool",
+ "surfaces": [
+ "live"
+ ],
+ "legacyAliases": [],
+ "contractCase": "protocol-action:restore_agent_instructions",
+ "contractOwner": "src/catalog/protocol-action-contracts.test.ts::restore_agent_instructions has a schema-valid canonical example and every declared projection",
+ "legacyBehavioralCases": [],
+ "deterministicCases": [
+ "protocol-action:restore_agent_instructions"
+ ],
+ "legacyRequirementCases": [],
+ "deterministicOwners": [
+ "src/catalog/protocol-action-contracts.test.ts::restore_agent_instructions 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": "create_skill",
"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 2d1cecf0f87..6b24551b0e4 100644
--- a/packages/paperclip-runner/spec/operation-groups/source.json
+++ b/packages/paperclip-runner/spec/operation-groups/source.json
@@ -263,13 +263,13 @@
"id": "rf",
"legacyGroup": 13,
"name": "Reference files",
- "owner": "optional domain tools + test-only escape hatch",
- "operationIds": ["list_cases", "upsert_case", "list_routines", "manage_routine", "create_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"],
+ "owner": "always instruction tools + optional domain tools + test-only escape hatch",
+ "operationIds": ["list_cases", "upsert_case", "list_routines", "manage_routine", "create_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"],
"controlPlaneOperationIds": ["append_audit_record"],
- "realSurface": "project, case, routine, company-skill, secret, portability, and administration services",
+ "realSurface": "agent instruction revisions, project, case, routine, company-skill, secret, portability, and administration services",
"mockStateDomains": ["company", "cases", "routines", "skills", "secrets", "audit", "fault"],
"prpEvidence": "bounded domain projections, redacted broker receipts, company diffs, and audit references",
- "gap": "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."
+ "gap": "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."
},
{
"id": "mh",
diff --git a/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md b/packages/paperclip-runner/spec/paperclip-agent-operation-groups.md
index b6bfa691674..afadc264d7d 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**, **48 reconciled semantic operations** (14 always, 34 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**, **52 reconciled semantic operations** (18 always, 34 optional), and **106 scenarios in 16 behavior groups**.
## Axis 1: PRP v1 event and command families
@@ -83,9 +83,9 @@ Placement has exactly three outcomes:
| `schedule_blocker_wake` | Dependency-resolution wake scheduling. |
| `reconcile_run` | Work assessment, terminal status arbitration, and recovery reconciliation. |
-### Always-agent operations (14)
+### Always-agent operations (18)
-`answer_status_question`, `block_task`, `finish_task`, `get_task_context`, `get_task_history`, `inspect_operation_result`, `list_document_revisions`, `list_documents`, `read_document`, `register_deliverable`, `report_progress`, `request_human_input`, `request_review`, `write_document`.
+`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 (34) and grant groups (13)
@@ -127,6 +127,7 @@ Grant groups are documentation/exposure bundles, not additional authority. The o
| `finish_task` | `always_agent_tool` | none | `standard` `skill_test` | `task_write` | `required` | no | `semantic_command:finish_task` | `scenario` + `live` `live_codex` | `unbound` semantic-operation item event plus active-task state diff, work-assessment, and issue-status-decision events catalog PRP status: `audit_pending` |
| `generic_api_request` | `optional_agent_tool` | `test:generic_api_request` | `skill_test` | `test_escape_hatch` | `required` | yes | `mock_extension:test.generic_api` | `scenario` + `live` `test_only` | `unbound` test-only; excluded from product PRP evidence catalog PRP status: `audit_pending` |
| `get_agent` | `optional_agent_tool` | `discovery:agents:read` | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
+| `get_agent_instruction_history` | `always_agent_tool` | none | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `agentInstructionRevisionService` tool-result item event plus canonical revision receipt for writes; no scenario mock coverage catalog PRP status: `bound` |
| `get_approval` | `optional_agent_tool` | `governance:approvals:read` | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `get_approval_context` | `optional_agent_tool` | `governance:approvals:read` | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `get_task_context` | `always_agent_tool` | none | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | `context_read:active_task` | `scenario` + `live` `live_codex` | `PaperclipRunnerToolAuthority active issue/run + accepted plan revision` bound company/assignment query plus exact accepted document revision projection catalog PRP status: `bound` |
@@ -146,6 +147,7 @@ Grant groups are documentation/exposure bundles, not additional authority. The o
| `list_routines` | `optional_agent_tool` | `routines:read` | `standard` `skill_test` | `read` | `none` | no | `mock_extension:routines.list` | `scenario` `scenario_mock` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `list_secret_metadata` | `optional_agent_tool` | `secrets:metadata:read` | `standard` `skill_test` | `read` | `none` | no | `mock_extension:secrets.metadata` | `scenario` `scenario_mock` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `manage_routine` | `optional_agent_tool` | `routines:write` | `standard` `skill_test` | `admin` | `required` | no | `mock_extension:routines.manage` | `scenario` `scenario_mock` | `unbound` company admin/portability item event plus audit record catalog PRP status: `audit_pending` |
+| `read_agent_instructions` | `always_agent_tool` | none | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | inline/no mapping | `live` `live_codex` | `agentInstructionRevisionService` tool-result item event plus canonical revision receipt for writes; no scenario mock coverage catalog PRP status: `bound` |
| `read_document` | `always_agent_tool` | none | `standard` `ask` `planning` `skill_test` | `read` | `none` | no | `snapshot_read:active_task_document` | `scenario` + `live` `live_codex` | `unbound` read projection surfaced via a tool-result item event; no control-plane state diff catalog PRP status: `audit_pending` |
| `read_secret_value` | `optional_agent_tool` | `secrets:values:read` | `standard` `skill_test` | `secret_read` | `none` | yes | `mock_extension:secrets.value` | `scenario` `scenario_mock` | `unbound` redacted tool-result item event; secret value never reaches the wire catalog PRP status: `audit_pending` |
| `reassign_task` | `optional_agent_tool` | `delegation:tasks:assign` | `standard` | `company_write` | `required` | no | `semantic_command:reassign_task` | `scenario` + `live` `live_codex` | `PaperclipRunnerToolAuthority.reassign_task` semantic-operation item event plus company-entity state diff and audit record catalog PRP status: `bound` |
@@ -154,11 +156,13 @@ Grant groups are documentation/exposure bundles, not additional authority. The o
| `request_approval` | `optional_agent_tool` | `governance:approvals:request` | `standard` `skill_test` | `governance` | `required` | no | `semantic_command:request_approval` | `scenario` + `live` `live_codex` | `unbound` approval lifecycle plus governed-wait continuation and audit events catalog PRP status: `audit_pending` |
| `request_human_input` | `always_agent_tool` | none | `standard` `planning` `ask` `skill_test` | `task_write` | `required` | no | `semantic_command:request_human_input` | `scenario` + `live` `live_codex` | `unbound` semantic-operation item event plus active-task state diff, work-assessment, and issue-status-decision events catalog PRP status: `audit_pending` |
| `request_review` | `always_agent_tool` | none | `standard` `skill_test` | `task_write` | `required` | no | `semantic_command:request_review` | `scenario` + `live` `live_codex` | `unbound` semantic-operation item event plus active-task state diff, work-assessment, and issue-status-decision events catalog PRP status: `audit_pending` |
+| `restore_agent_instructions` | `always_agent_tool` | none | `standard` `planning` | `company_write` | `recommended` | no | inline/no mapping | `live` `live_codex` | `agentInstructionRevisionService` tool-result item event plus canonical revision receipt for writes; no scenario mock coverage catalog PRP status: `bound` |
| `schedule_wake` | `optional_agent_tool` | `control_plane:wakes` | `standard` `skill_test` | `task_write` | `required` | no | inline/no mapping | `live` `live_codex` | `unbound` semantic-operation item event plus active-task state diff, work-assessment, and issue-status-decision events catalog PRP status: `audit_pending` |
| `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` |
| `sync_company_skills` | `optional_agent_tool` | `company_skills:write` | `standard` `skill_test` | `admin` | `required` | no | `mock_extension:company_skills.sync` | `scenario` `scenario_mock` | `unbound` company admin/portability item event plus audit record catalog PRP status: `audit_pending` |
+| `update_agent_instructions` | `always_agent_tool` | none | `standard` `planning` | `company_write` | `recommended` | no | inline/no mapping | `live` `live_codex` | `agentInstructionRevisionService` tool-result item event plus canonical revision receipt for writes; no scenario mock coverage catalog PRP status: `bound` |
| `upsert_case` | `optional_agent_tool` | `cases:write` | `standard` `skill_test` | `company_write` | `required` | no | `mock_extension:cases.upsert` | `scenario` `scenario_mock` | `unbound` semantic-operation item event plus company-entity state diff and audit record catalog PRP status: `audit_pending` |
| `write_document` | `always_agent_tool` | none | `standard` `planning` `skill_test` | `task_write` | `required` | no | `semantic_command:write_document` | `scenario` + `live` `live_codex` | `unbound` semantic-operation item event plus active-task state diff, work-assessment, and issue-status-decision events catalog PRP status: `audit_pending` |
@@ -182,7 +186,7 @@ Behavior groups describe expected outcomes and trajectories. They do not grant t
| [`ap` — Approvals](#behavior-group-ap-approvals) | optional governance tools + governed approver | `list_approvals` `get_approval` `get_approval_context` `request_approval` `decide_approval` `comment_on_approval` | `route_wake` `append_audit_record` | company approval, decision, issue-link, comment, and governed-action services | `company` `task` `approvals` `actor` `wake` `audit` `idempotency` | 6 | governed semantic receipts, audit references, and attention/continuation linkage | Production binding and additive governed-action receipts are unbound; board-only authority stays outside grants. |
| [`ar` — Artifacts](#behavior-group-ar-artifacts) | always tools + artifact/work-product services | `register_deliverable` | `append_audit_record` | attachment upload and issue work-product routes | `task` `artifacts` `workProducts` `workspace` `audit` `idempotency` | 4 | artifact/work-product reference and durable inspectability receipt; never binary bytes | Production upload/register composite and additive durable-reference receipt are unbound. |
| [`er` — Errors and critical rules](#behavior-group-er-errors-and-critical-rules) | runner/control plane + optional workspace/wake tools | `get_workspace_runtime` `control_workspace_service` `schedule_wake` `inspect_operation_result` | `release_task` `enforce_budget` `persist_run` `replay_run` `reconcile_run` | workspace runtime, monitor/recovery, budget, run persistence/replay, release, and terminal services | `workspace` `budget` `run` `wake` `audit` `idempotency` `fault` | 9 | runtime/workspace/attention/run lifecycle, typed denials, replay facts, and terminal causality | Budget stop reasons and semantic denial/conflict receipts require additive v1 envelopes; inspect_operation_result remains scenario-only. |
-| [`rf` — Reference files](#behavior-group-rf-reference-files) | optional domain tools + test-only escape hatch | `list_cases` `upsert_case` `list_routines` `manage_routine` `create_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` | `append_audit_record` | project, case, routine, company-skill, secret, portability, and administration services | `company` `cases` `routines` `skills` `secrets` `audit` `fault` | 22 | bounded domain projections, redacted broker receipts, company diffs, and audit references | 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. |
+| [`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` `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` | `append_audit_record` | agent instruction revisions, project, case, routine, company-skill, secret, portability, and administration services | `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. |
| [`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. |
@@ -459,10 +463,10 @@ Current responsibility-based paths are normative. Numbered `phase-*` or mileston
### Catalog split and deliberate replacement
- Scenario/eval catalog: **39** operations.
-- Live dispatcher catalog: **36** operations.
-- Shared: **27**; union/canonical authority: **48**.
+- Live dispatcher catalog: **40** operations.
+- Shared: **27**; union/canonical authority: **52**.
- 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_approval`, `get_approval_context`, `hire_agent`, `list_project_repositories`, `schedule_wake`, `search_api`.
+- 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`, `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-acpx-native-backend.ts b/packages/paperclip-runner/src/backends/codex-acpx-native-backend.ts
index ee3cd71e0e1..19483fb4253 100644
--- a/packages/paperclip-runner/src/backends/codex-acpx-native-backend.ts
+++ b/packages/paperclip-runner/src/backends/codex-acpx-native-backend.ts
@@ -5,6 +5,7 @@ import {
type CodexAcpxDriverOptions,
} from "../drivers/acpx/codex-acpx-driver.js";
import { resolveQualifiedAcpxProfile } from "../drivers/acpx/qualified-profiles.js";
+import { ACPX_CAPABILITY_PROFILES } from "../drivers/acpx/capability-profiles.js";
import { HarnessDriverBackend } from "./harness-driver-backend.js";
import {
nativeSystemInstructions,
@@ -13,7 +14,7 @@ import {
export interface CodexAcpxNativeSessionBackendOptions extends Omit<
CodexAcpxDriverOptions,
- "model" | "permissionMode" | "systemInstructions"
+ "model" | "permissionMode" | "systemInstructions" | "providerPolicy"
> {}
export type AcpxNativeSessionBackendOptions =
@@ -30,11 +31,6 @@ export function createAcpxNativeSessionBackend(
if (input.provider.kind !== "acpx") {
throw new Error("ACPX backend requires provider kind acpx");
}
- if (input.provider.agent === "pi") {
- throw new Error(
- "Pi ACPX backend is unavailable until descriptor-confined verified launch is implemented",
- );
- }
const qualifiedProfile = resolveQualifiedAcpxProfile(
input.provider.agent,
input.provider.model,
@@ -58,6 +54,10 @@ export function createAcpxNativeSessionBackend(
}
}
+ if (ACPX_CAPABILITY_PROFILES[input.provider.agent].qualification !== "qualified") {
+ throw new Error("ACPX candidate direct execution requires completed qualification; use the host-controlled runnerd evaluation path");
+ }
+
const constraints = nativeTaskConstraints(input);
const systemInstructions = [
nativeSystemInstructions(input),
@@ -73,6 +73,7 @@ export function createAcpxNativeSessionBackend(
model: input.provider.model,
permissionMode: input.provider.permissionMode ?? "approve-reads",
systemInstructions,
+ providerPolicy: { readOnly: "executionMode" in input && input.executionMode === "plan" },
}),
);
}
diff --git a/packages/paperclip-runner/src/backends/codex-native-backend.ts b/packages/paperclip-runner/src/backends/codex-native-backend.ts
index d334079b787..2c4aeceee18 100644
--- a/packages/paperclip-runner/src/backends/codex-native-backend.ts
+++ b/packages/paperclip-runner/src/backends/codex-native-backend.ts
@@ -1,4 +1,5 @@
import { createCodexTaskEnvelope } from "../contracts/codex.js";
+import { ACPX_CAPABILITY_PROFILES } from "../drivers/acpx/capability-profiles.js";
import { NATIVE_EXECUTION_INPUT_SCHEMA } from "../contracts/native-execution.js";
import type { NativeExecutionInput } from "../contracts/native-execution.js";
import type { PersistedHarnessSession } from "../contracts/harness-driver.js";
@@ -85,14 +86,9 @@ function transportDriverIdentity(input: NativeExecutionInput): {
version: input.provider.agentCoreProfile.qualificationRevision,
};
case "acpx":
- if (input.provider.agent === "pi") {
- throw new Error(
- "Native ACPX backend for pi is unavailable until descriptor-confined verified launch is implemented",
- );
- }
return {
kind: "acpx_runtime",
- displayName: `${input.provider.agent === "grok" ? "Grok Build" : input.provider.agent === "claude" ? "Claude" : "Codex"} via ACPX`,
+ displayName: `${ACPX_CAPABILITY_PROFILES[input.provider.agent].displayName} via ACPX`,
version: "0.13.1",
};
default:
@@ -149,6 +145,9 @@ function createTransportBackedNativeSessionBackend(
return new HarnessDriverBackend(
new CodexAppServerDriver({
...(input.provider.model ? { model: input.provider.model } : {}),
+ ...(input.provider.kind === "codex" && "reasoningEffort" in input.provider && input.provider.reasoningEffort
+ ? { reasoningEffort: input.provider.reasoningEffort }
+ : {}),
// Runnerd owns provider permissions for non-Codex facades. Their
// Codex-compatible surface must never open a second approval channel.
approvalPolicy:
@@ -156,6 +155,7 @@ function createTransportBackedNativeSessionBackend(
? (input.provider.approvalPolicy ?? "never")
: "never",
baseInstructions: nativeSystemInstructions(input),
+ instructionWorkingCopyRoot: "runtimeContext" in input ? input.runtimeContext.instructions.workingCopy?.rootPath : undefined,
includeSkillInstructions: isCodex && "runtimeContext" in input,
skillInputs: isCodex
? nativeTaskSkillInputs(
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 317f80e5a13..d550d594d64 100644
--- a/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts
+++ b/packages/paperclip-runner/src/backends/harness-driver-backend.test.ts
@@ -97,6 +97,24 @@ const driver: HarnessDriver = {
};
describe("HarnessDriverBackend", () => {
+ it("refreshes negotiated controls after a warm handshake and separates follow-ups", async () => {
+ let controls = { steering: false, queuedFollowUp: false };
+ const steer = vi.fn(async () => {});
+ const session = Object.assign(new FakeHarnessSession(), { steer, turnControlCapabilities: () => ({ ...controls }) });
+ const backend = new HarnessDriverBackend({ ...driver, openSession: async () => session });
+ const opened = await backend.openSession({ identity: {
+ runId: "run-1", sessionId: "session-1", companyId: "company-1", issueId: "issue-1", agentId: "agent-1",
+ } });
+ expect(await opened.capabilities()).toMatchObject({ steering: false, queuedFollowUp: false });
+ controls = { steering: false, queuedFollowUp: true };
+ expect(await opened.capabilities()).toMatchObject(controls);
+ expect(() => opened.steer!({ turnId: "turn-1", message: { role: "user", text: "steer" }, correlationId: "c-1" })).toThrow();
+ await opened.steer!({ turnId: "turn-1", message: { role: "user", text: "follow" }, correlationId: "c-2", mode: "follow_up" });
+ expect(steer).toHaveBeenCalledWith(expect.objectContaining({ mode: "follow_up" }));
+ controls = { steering: true, queuedFollowUp: false };
+ expect(await opened.capabilities()).toMatchObject(controls);
+ expect(() => opened.steer!({ turnId: "turn-1", message: { role: "user", text: "follow" }, correlationId: "c-3", mode: "follow_up" })).toThrow();
+ });
it.each([false, true])("honors driver steering support even when the transport exposes a steer method (%s)", async supported => {
const steer = vi.fn(async () => { throw new Error("provider does not support steering"); });
const session = Object.assign(new FakeHarnessSession(), { steer });
diff --git a/packages/paperclip-runner/src/backends/harness-driver-backend.ts b/packages/paperclip-runner/src/backends/harness-driver-backend.ts
index ebd6ef2d3c2..fd280b5df81 100644
--- a/packages/paperclip-runner/src/backends/harness-driver-backend.ts
+++ b/packages/paperclip-runner/src/backends/harness-driver-backend.ts
@@ -450,10 +450,12 @@ class HarnessNativeSession implements NativeSession {
}
async capabilities() {
+ const negotiated = this.#session.turnControlCapabilities?.();
return {
resume: true,
typedEvents: true,
- steering: this.#steeringSupported && this.#session.steer !== undefined,
+ steering: (negotiated?.steering ?? this.#steeringSupported) && this.#session.steer !== undefined,
+ queuedFollowUp: negotiated?.queuedFollowUp === true && this.#session.steer !== undefined,
interruption: this.#session.interrupt !== undefined,
structuredResult: true,
read: this.#session.read !== undefined,
@@ -682,13 +684,15 @@ class HarnessNativeSession implements NativeSession {
}
steer(input: {
+ mode?: "steer" | "follow_up";
turnId: string;
message: { role: "user"; text: string };
correlationId?: string;
}) {
this.#assertProtocolIntegrity();
- if (!this.#steeringSupported || this.#session.steer === undefined)
- throw new Error("steering is unavailable");
+ const negotiated = this.#session.turnControlCapabilities?.();
+ const supported = input.mode === "follow_up" ? negotiated?.queuedFollowUp === true : (negotiated?.steering ?? this.#steeringSupported);
+ if (!supported || this.#session.steer === undefined) throw new Error("steering or queued follow-up is unavailable");
return this.#withProtocolIntegrity(() => this.#session.steer!(input));
}
diff --git a/packages/paperclip-runner/src/backends/native-backend-factory.test.ts b/packages/paperclip-runner/src/backends/native-backend-factory.test.ts
index 7bb8daf7e2b..33b8db8c479 100644
--- a/packages/paperclip-runner/src/backends/native-backend-factory.test.ts
+++ b/packages/paperclip-runner/src/backends/native-backend-factory.test.ts
@@ -1,3 +1,4 @@
+import { QUALIFIED_ACPX_PROFILES, resolveQualifiedAcpxProfile } from "../drivers/acpx/qualified-profiles.js";
import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
@@ -497,6 +498,16 @@ describe("native backend factory", () => {
"requires an instance runtime directory",
);
});
+ it.each(["pi", "cursor", "copilot"] as const)("constructs %s identity on the supplied runnerd transport without starting a provider", async agent => {
+ const input = acpxExecution();
+ if (input.provider.kind !== "acpx") throw new Error("invalid fixture");
+ const model = agent === "pi" ? QUALIFIED_ACPX_PROFILES.pi.qualificationModel : "explicit-fixture-model";
+ Object.assign(input.provider, { agent, model, profile: resolveQualifiedAcpxProfile(agent, model) });
+ const backend = createNativeSessionBackend(input, {
+ codexTransportFactory: () => { throw new Error("descriptor must not launch the transport"); },
+ });
+ await expect(backend.descriptor()).resolves.toMatchObject({ name: "acpx_runtime", version: "0.13.1" });
+ });
it.each(["claude" as const])(
"constructs the qualified %s ACPX backend",
@@ -512,12 +523,15 @@ describe("native backend factory", () => {
},
);
- it("rejects Pi before constructing an ACPX backend", () => {
- expect(() =>
- createNativeSessionBackend(acpxExecution("pi"), {
- acpxRuntimeDirectory: "/runtime",
- }),
- ).toThrow("descriptor-confined verified launch");
+ it.each(["pi", "cursor", "copilot"] as const)("rejects unqualified %s direct execution even with an exact persisted profile", agent => {
+ const input = acpxExecution();
+ if (input.provider.kind !== "acpx") throw new Error("invalid fixture");
+ const model = agent === "pi" ? QUALIFIED_ACPX_PROFILES.pi.qualificationModel : "explicit-fixture-model";
+ const profile = resolveQualifiedAcpxProfile(agent, model);
+ Object.assign(input.provider, { agent, model, profile });
+ expect(() => createNativeSessionBackend(input, { acpxRuntimeDirectory: "/runtime",
+ acpxEnvironment: { COPILOT_GITHUB_TOKEN: "explicit-fixture", CURSOR_API_KEY: "explicit-fixture", OPENROUTER_API_KEY: "explicit-fixture" },
+ })).toThrow("ACPX candidate direct execution requires completed qualification");
});
it("rejects a Codex ACPX snapshot that drifts from its qualified profile", () => {
diff --git a/packages/paperclip-runner/src/backends/native-backend-factory.ts b/packages/paperclip-runner/src/backends/native-backend-factory.ts
index 0e50b6d1eaa..630bfa7798f 100644
--- a/packages/paperclip-runner/src/backends/native-backend-factory.ts
+++ b/packages/paperclip-runner/src/backends/native-backend-factory.ts
@@ -77,11 +77,6 @@ export function createNativeSessionBackend(
});
}
if (input.provider.kind === "acpx") {
- if (input.provider.agent === "pi") {
- throw new Error(
- "Native ACPX backend for pi is unavailable until descriptor-confined verified launch is implemented",
- );
- }
if (!options.acpxRuntimeDirectory?.trim()) {
throw new Error("ACPX backend requires an instance runtime directory");
}
diff --git a/packages/paperclip-runner/src/backends/runtime-context.ts b/packages/paperclip-runner/src/backends/runtime-context.ts
index 203e42552a4..05f7d177c3c 100644
--- a/packages/paperclip-runner/src/backends/runtime-context.ts
+++ b/packages/paperclip-runner/src/backends/runtime-context.ts
@@ -104,6 +104,11 @@ export function nativeTaskConstraints(input: NativeExecutionInput): string[] {
}
return [
"Use only the assigned skills and provider-native tools.",
+ ...(input.runtimeContext.instructions.workingCopy ? [
+ input.runtimeContext.instructions.workingCopy.kind === "agent_files"
+ ? `For this turn, AGENT_HOME is ${input.runtimeContext.instructions.workingCopy.rootPath}. This replaces any prior turn's agent directory path. It contains your instructions and persistent personal files, separate from the task working directory. Changes save after the provider stops; check the save receipt.`
+ : `For this turn, the editable agent instruction file is ${input.runtimeContext.instructions.workingCopy.rootPath}/${input.runtimeContext.instructions.workingCopy.entryPath}. This replaces any private working-copy path from a previous turn. Ordinary edits save after the provider stops and only with a durable revision receipt. Use the agent instruction tools for immediate saves. Shared instruction assets and repository instructions are not collected.`,
+ ] : []),
"Use Paperclip semantic tools for coordination and finalization.",
"Save requested plans and Paperclip documents directly with write_document. A saved Paperclip document is already a durable deliverable. Do not create a local file, compute file hashes, or call register_deliverable for it unless the user also requests a downloadable file. Cite the saved document in your completion evidence and final response.",
"When the requested result is a file, use register_deliverable before paperclip_finish. Compute its exact byte size and SHA-256, register the workspace-relative file, cite deliverable: from the receipt as completion evidence, and include /api/attachments//content as the download link in your answer. A bare workspace filename is not a delivered result. For repository edits, cite an accessible PR or registered work product. Preserve existing work; do not upload unrelated files. If file publication fails, fix it or report the concrete blocker instead of claiming the file is delivered.",
diff --git a/packages/paperclip-runner/src/catalog/reconciliation.test.ts b/packages/paperclip-runner/src/catalog/reconciliation.test.ts
index 9ab2cdf7c8c..0f69be379c1 100644
--- a/packages/paperclip-runner/src/catalog/reconciliation.test.ts
+++ b/packages/paperclip-runner/src/catalog/reconciliation.test.ts
@@ -20,21 +20,25 @@ describe("canonical semantic-catalog reconciliation authority", () => {
it("pins the reconciled op-set relationship between the two catalogs", () => {
const summary = capabilityCatalogReconciliation();
expect(summary.scenarioCount).toBe(39);
- expect(summary.liveCount).toBe(36);
+ expect(summary.liveCount).toBe(40);
expect(summary.sharedCount).toBe(27);
- expect(summary.unionCount).toBe(48);
+ expect(summary.unionCount).toBe(52);
// 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([
"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",
+ "update_agent_instructions",
]);
expect(summary.scenarioOnly).toEqual([
"administer_company",
@@ -53,7 +57,7 @@ describe("canonical semantic-catalog reconciliation authority", () => {
});
it("is the single source both catalogs derive their operation set from", () => {
- expect(CAPABILITY_CANONICAL_OPERATIONS).toHaveLength(48);
+ expect(CAPABILITY_CANONICAL_OPERATIONS).toHaveLength(52);
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);
@@ -87,7 +91,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(48);
+ expect(CAPABILITY_CANONICAL_CATALOG).toHaveLength(52);
for (const operation of CAPABILITY_CANONICAL_CATALOG) {
expect(operation.placement).toMatch(/^(always|optional)_agent_tool$/);
expect(Array.isArray(operation.requiredClaims)).toBe(true);
@@ -113,7 +117,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: 35,
+ live_codex: 39,
scenario_mock: 12,
test_only: 1,
});
diff --git a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts
index 927631ba91c..35cfd2635ca 100644
--- a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts
+++ b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts
@@ -4,6 +4,9 @@ import { fileURLToPath } from "node:url";
import { afterEach, describe, expect, it, vi } from "vitest";
+import { normalizeAcpxPermission } from "../drivers/acpx/acp-permission-adapter.js";
+import { ACPX_CAPABILITY_PROFILES } from "../drivers/acpx/capability-profiles.js";
+import { resolveQualifiedAcpxProfile } from "../drivers/acpx/qualified-profiles.js";
import { ACPX_SIDECAR_PROTOCOL_VERSION } from "../drivers/acpx/sidecar-protocol.js";
import { canonicalProviderEventsFromAcpxRuntimeEvent } from "../provider-events.js";
import {
@@ -31,6 +34,29 @@ afterEach(async () => {
});
describe("qualified ACPX runtime sidecar", () => {
+ it.each(["pi", "copilot", "cursor", "codex", "claude"])("offers verified session permission grants only for %s", async agent => {
+ const source = readFileSync(fileURLToPath(new URL("./acpx-runtime-sidecar.ts", import.meta.url)), "utf8");
+ const start = source.indexOf(" const { signal } = context;", source.indexOf("async function waitForPermission"));
+ const end = source.indexOf("\nasync function waitForInput", start);
+ expect(start).toBeGreaterThan(0);
+ const permissions = new Map();
+ const emitted: Array<{ choices: Array<{ key: string }> }> = [];
+ const wait = new Function("permissions", "openParams", "normalizeAcpxPermission", "emit",
+ `let turnId = "turn-1", requestSequence = 0; const MAX_PENDING_INPUTS = 512;
+ const stableRequestId = () => "request-1"; const requireAcpxResponseDelivery = c => c.responseDelivery;
+ return async function(activeTurnId, request, context) { ${source.slice(start, end)}`)(
+ permissions, { agent }, normalizeAcpxPermission, (_event: string, payload: { choices: Array<{ key: string }> }) => emitted.push(payload),
+ );
+ const abort = new AbortController();
+ const pending = wait("turn-1", { sessionId: "session", inferredKind: "edit", raw: {
+ sessionId: "session", toolCall: { toolCallId: "call", title: "Edit file" },
+ options: ["allow_once", "allow_always", "reject_once"].map(kind => ({ kind, optionId: kind, name: kind })),
+ } }, { signal: abort.signal, responseDelivery: Promise.resolve() });
+ expect(emitted[0]!.choices.some(choice => choice.key === "accept_for_session")).toBe(agent === "pi" || agent === "copilot");
+ abort.abort();
+ await expect(pending).resolves.toEqual({ outcome: "cancel" });
+ expect(permissions.size).toBe(0);
+ });
it("preserves ACP input presence through the bounded sidecar handoff", () => {
const source = readFileSync(
fileURLToPath(new URL("./acpx-runtime-sidecar.ts", import.meta.url)),
@@ -528,12 +554,27 @@ describe("qualified ACPX runtime sidecar", () => {
},
);
+ it.each([
+ ["pi", "openrouter/deepseek/deepseek-v4-flash-0731"],
+ ["cursor", "explicit-cursor-model"],
+ ["copilot", "explicit-copilot-model"],
+ ] as const)("initializes the declared %s candidate without promoting its profile", async (agent, model) => {
+ const sidecar = startSidecar();
+ sidecar.write(initializeRequest(1, agent, model));
+ const frame = await sidecar.next((value) => value.id === 1);
+ expect(frame).toMatchObject({ id: 1, ok: true });
+ const result = frame.result as Record;
+ expect(result.profile).toEqual(resolveQualifiedAcpxProfile(agent, model));
+ expect(result.profile).toMatchObject({ reportedModelId: model });
+ expect(ACPX_CAPABILITY_PROFILES[agent].qualification).toBe("pending");
+ });
+
it("fails closed after an unsupported provider bootstrap", async () => {
const sidecar = startSidecar();
sidecar.write(
initializeRequest(
1,
- "pi",
+ "unknown-provider",
"openrouter/deepseek/deepseek-v4-flash-0731",
),
);
@@ -545,7 +586,7 @@ describe("qualified ACPX runtime sidecar", () => {
ok: false,
error: {
code: "acpx_sidecar_command_failed",
- message: "ACPX agent must be claude, codex, or grok",
+ message: "ACPX agent must be claude, codex, grok, cursor, copilot, or pi",
retryable: false,
},
});
@@ -681,7 +722,7 @@ function loadWaitForTool(input: {
"utf8",
);
const start = source.indexOf("async function waitForTool");
- const end = source.indexOf("\nasync function waitForInput", start);
+ const end = source.indexOf("\nasync function waitForPermission", start);
if (start < 0 || end < 0) throw new Error("waitForTool source not found");
const functionSource = source
.slice(start, end)
diff --git a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts
index ddb436cfa59..3f32d5baf85 100644
--- a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts
+++ b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.ts
@@ -1,14 +1,20 @@
#!/usr/bin/env node
import { createHash } from "node:crypto";
import { createInterface } from "node:readline";
+import { deliverAcpxResponse, requireAcpxResponseDelivery } from "../drivers/acpx/response-delivery.js";
+import { createAcpxSidecarHostEnvironment } from "../drivers/acpx/environment.js";
import type {
AcpElicitationContext,
AcpElicitationRequest,
AcpElicitationResponse,
AcpRuntimeEvent,
+ AcpPermissionRequest,
+ AcpPermissionDecision,
} from "acpx/runtime";
+import { acpxProfileClientCapabilities, bindAcpxExtensionTurn, validateAcpxRichEvent, createAcpxProfileExtensionAdapter, type AcpxExtensionInput } from "../drivers/acpx/profile-extensions.js";
+import type { PaperclipQuestionSet } from "../contracts/question-set.js";
import { createAcpxToolEventNormalizer, createGrokMessageNormalizer } from "../provider-events.js";
import { parseNativeRuntimeContext } from "../contracts/runtime-context.js";
import {
@@ -25,6 +31,7 @@ import {
} from "../drivers/acpx/acp-question-adapter.js";
import { openCodexAcpxRuntime } from "../drivers/acpx/codex-runtime-adapter.js";
import { AcpxApprovalRequiredError } from "../drivers/acpx/permission-policy.js";
+import { normalizeAcpxPermission, type NormalizedAcpxPermission } from "../drivers/acpx/acp-permission-adapter.js";
import { acpxGoalProjection } from "../drivers/acpx/session-goals.js";
import { acpxProviderSessionIdentity } from "../drivers/acpx/recovery-identity.js";
import {
@@ -56,6 +63,7 @@ import {
import { safeAcpxLocations } from "./acpx-sidecar-locations.js";
import {
persistedAcpxTurnUsage,
+ acpxUsageEstimateNotice,
qualifiedAcpxUsageBreakdown,
} from "../drivers/acpx/usage-accounting.js";
import { validatePrpStructuredRunResult } from "../protocol/replay-contract.js";
@@ -80,6 +88,9 @@ import {
verifyOpenedAcpxSidecarHost,
} from "./acpx-sidecar-lifecycle.js";
+import { AcpxTurnControlLedger, parseAcpxTurnControl } from "../drivers/acpx/turn-controls.js";
+
+const turnControls = new AcpxTurnControlLedger();
const MAX_PENDING_TOOLS = 512;
const MAX_PENDING_INPUTS = 16;
let goalSourceRevision = 0;
@@ -114,8 +125,18 @@ interface PendingTool {
interface PendingInput {
turnId: string;
- normalized: NormalizedAcpForm;
- settle(response: AcpElicitationResponse): void;
+ responseDelivery: Promise;
+ questionSet: PaperclipQuestionSet;
+ prepareResolution(resolution: HarnessRuntimeRequestResolution): () => void;
+ cancel(): void;
+ cleanup(): void;
+}
+
+interface PendingPermission {
+ turnId: string;
+ responseDelivery: Promise;
+ normalized: NormalizedAcpxPermission;
+ settle(response: AcpPermissionDecision): void;
cleanup(): void;
}
@@ -136,6 +157,7 @@ let initializedModel: string | null = null;
let inputClosed = false;
const tools = new Map();
const inputs = new Map();
+const permissions = new Map();
const lines = createInterface({
input: process.stdin,
@@ -260,11 +282,13 @@ async function dispatch(
normalizedSessionId: params.normalizedSessionId,
workingDirectory: params.workingDirectory,
agent: params.agent,
+ clientCapabilities: acpxProfileClientCapabilities(params.agent),
model: params.model,
permissionMode: params.permissionMode,
+ providerPolicy: params.providerPolicy,
systemInstructions: params.systemInstructions,
runtimeContext: params.runtimeContext,
- environment: process.env,
+ environment: createAcpxSidecarHostEnvironment(process.env, params.agent, params.normalizedSessionId),
expectedIdentity: params.expectedIdentity,
semanticTools: {
tools: params.tools,
@@ -306,6 +330,7 @@ async function dispatch(
),
sidecarPid: process.pid,
status: opened.status,
+ turnControls: openedHost.steeringCapability() ?? { steering: false, queuedFollowUp: false },
};
}
if (request.command === "run.attach") {
@@ -330,22 +355,54 @@ async function dispatch(
if (turnId) throw new Error("ACPX sidecar already has an active turn");
const currentTurnId = boundedIdentity(request.params.turnId, "turnId");
turnId = currentTurnId;
+ turnControls.begin(currentTurnId);
let runtimeTurn: AcpxRuntimeTurn;
+ const extensions = bindAcpxExtensionTurn({
+ adapter: createAcpxProfileExtensionAdapter(openParams!.agent, {
+ workspacePath: openParams!.workingDirectory, sessionId: activeHost.identity().backendSessionId, turnId: currentTurnId,
+ }),
+ active: () => turnId === currentTurnId && host === activeHost,
+ sessionId: activeHost.identity().backendSessionId,
+ waitForInput: (input, context) => waitForExtensionInput(currentTurnId, input, context),
+ emit: event => emit("runtime.rich_event", { ...event }, currentTurnId),
+ });
let usageBefore: unknown;
try {
usageBefore = await readSidecarHostStatusWithin(activeHost);
runtimeTurn = activeHost.startTurn({
requestId: `${runId}:${currentTurnId}`,
text: boundedText(request.params.message, "message", 1024 * 1024),
+ onExtensionRequest: extensions.onExtensionRequest,
+ onExtensionNotification: extensions.onExtensionNotification,
onElicitation: (providerRequest, context) =>
waitForInput(currentTurnId, providerRequest, context),
+ onPermissionRequest: (providerRequest, context) =>
+ waitForPermission(currentTurnId, providerRequest, context),
});
} catch (error) {
turnId = null;
throw error;
}
- void pumpTurn(currentTurnId, runtimeTurn, activeHost, usageBefore);
- return { turnId: currentTurnId };
+ void pumpTurn(currentTurnId, runtimeTurn, activeHost, usageBefore, extensions.drain);
+ // Warm sessions may defer initialize until their first prompt. Publish only
+ // the capabilities of that live initialized connection, never old disk state.
+ await runtimeTurn.promptStarted;
+ return { turnId: currentTurnId, turnControls: activeHost.steeringCapability() ?? { steering: false, queuedFollowUp: false } };
+ }
+ if (request.command === "turn.steer") {
+ const control = parseAcpxTurnControl(request.params);
+ const activeHost = requireHost();
+ if (!runId || control.turnId !== turnId) throw new Error("cannot control a stale ACPX turn");
+ const capability = activeHost.steeringCapability();
+ if (!(control.mode === "steer" ? capability?.steering : capability?.queuedFollowUp)) {
+ throw new Error("ACP provider did not negotiate this turn control");
+ }
+ turnControls.reserve(control, turnId);
+ const runtimeRequestId = `${runId}:${control.turnId}`;
+ if (control.mode === "steer") await activeHost.steerActiveTurn(control.message, runtimeRequestId);
+ else await activeHost.queueFollowUp(control.message, runtimeRequestId);
+ if (host !== activeHost || turnId !== control.turnId) throw new Error("ACP turn settled before control acknowledgement");
+ return { accepted: true, turnId: control.turnId, controlId: control.controlId, mode: control.mode };
}
if (request.command === "turn.cancel") {
const expected = boundedIdentity(request.params.turnId, "turnId");
@@ -360,9 +417,17 @@ async function dispatch(
return { cancelled: true };
}
if (request.command === "permission.resolve") {
- throw new Error(
- "ACPX permissions are resolved by the admitted runner policy",
- );
+ const requestId = boundedIdentity(request.params.requestId, "requestId");
+ const expectedTurnId = boundedIdentity(request.params.turnId, "turnId");
+ const pending = permissions.get(requestId);
+ if (!pending || pending.turnId !== expectedTurnId || turnId !== expectedTurnId) {
+ throw new Error("permission request is stale or unknown");
+ }
+ const resolution = parseHarnessRuntimeRequestResolution("permission_approval", request.params.resolution);
+ const decision = pending.normalized.resolve(resolution);
+ if (!permissions.delete(requestId)) throw new Error("permission request lost its settlement race");
+ pending.cleanup();
+ return await deliverAcpxResponse(pending.responseDelivery, () => pending.settle(decision));
}
if (request.command === "input.resolve") {
const requestId = boundedIdentity(request.params.requestId, "requestId");
@@ -378,17 +443,13 @@ async function dispatch(
const resolution = parseHarnessRuntimeRequestResolution(
"elicitation",
request.params.resolution,
- pending.normalized.questionSet,
- );
- const providerResponse = elicitationResponse(
- pending.normalized,
- resolution,
+ pending.questionSet,
);
+ const deliver = pending.prepareResolution(resolution);
if (!inputs.delete(requestId))
throw new Error("input request lost its settlement race");
pending.cleanup();
- pending.settle(providerResponse);
- return { resolved: true };
+ return await deliverAcpxResponse(pending.responseDelivery, deliver);
}
if (request.command === "tool.resolve") {
const callId = boundedIdentity(request.params.callId, "callId");
@@ -527,6 +588,7 @@ async function pumpTurn(
runtimeTurn: AcpxRuntimeTurn,
activeHost: AcpxRuntimeHost,
usageBefore: unknown,
+ drainExtensions: () => Promise,
): Promise {
let terminal: Record;
try {
@@ -546,13 +608,17 @@ async function pumpTurn(
);
}
const result = await runtimeTurn.result;
+ await drainExtensions();
try {
const usage = persistedAcpxTurnUsage(
usageBefore,
await readSidecarHostStatusWithin(activeHost),
runtimeTurn.requestId,
+ openParams?.agent,
);
if (usage) {
+ const estimate = acpxUsageEstimateNotice(usage, `${currentTurnId}:usage-estimate`);
+ if (estimate) { validateAcpxRichEvent(estimate); emit("runtime.rich_event", { ...estimate }, currentTurnId); }
emit(
"runtime.event",
sanitizeRuntimeEvent(usage as unknown as AcpRuntimeEvent),
@@ -670,6 +736,37 @@ async function waitForTool(call: RunnerToolCall): Promise {
});
}
+async function waitForPermission(
+ activeTurnId: string,
+ request: AcpPermissionRequest,
+ context: { signal: AbortSignal; responseDelivery?: Promise },
+): Promise {
+ const { signal } = context;
+ if (turnId !== activeTurnId || signal.aborted || permissions.size >= MAX_PENDING_INPUTS) {
+ return { outcome: "cancel" };
+ }
+ const normalized = normalizeAcpxPermission(request, ["pi", "copilot"].includes(openParams?.agent ?? "") ? { allowAlwaysScope: "session" } : {});
+ const responseDelivery = requireAcpxResponseDelivery(context);
+ const requestId = stableRequestId(activeTurnId, ++requestSequence, normalized.toolCallId);
+ return await new Promise((settle) => {
+ const abort = () => {
+ if (!permissions.delete(requestId)) return;
+ signal.removeEventListener("abort", abort);
+ settle({ outcome: "cancel" });
+ };
+ permissions.set(requestId, {
+ turnId: activeTurnId, normalized, settle, responseDelivery,
+ cleanup: () => signal.removeEventListener("abort", abort),
+ });
+ signal.addEventListener("abort", abort, { once: true });
+ if (signal.aborted) { abort(); return; }
+ emit("runtime.permission_requested", {
+ requestId, kind: normalized.kind, title: normalized.title,
+ toolCallId: normalized.toolCallId, choices: normalized.choices,
+ }, activeTurnId);
+ });
+}
+
async function waitForInput(
activeTurnId: string,
request: AcpElicitationRequest,
@@ -710,38 +807,42 @@ async function waitForInput(
);
return { action: "cancel" };
}
- const requestId = stableRequestId(
- activeTurnId,
- ++requestSequence,
- context.requestId,
- );
- emit(
- "runtime.input_requested",
- {
- requestId,
- questionSet: normalized.questionSet,
- origin: {
- adapter: "acpx-runtime-sidecar",
- provider: openParams?.agent ?? initializedAgent ?? "unknown",
- method: "elicitation/create",
- },
- },
- activeTurnId,
- );
+ return await waitForExtensionInput(activeTurnId, {
+ method: "elicitation/create", questionSet: normalized.questionSet,
+ resolve: resolution => elicitationResponse(normalized, resolution) as unknown as Record,
+ cancel: () => ({ action: "cancel" }),
+ }, context) as unknown as AcpElicitationResponse;
+}
+
+async function waitForExtensionInput(
+ activeTurnId: string,
+ input: AcpxExtensionInput,
+ context: { requestId: string | number | null; signal: AbortSignal; responseDelivery?: Promise },
+): Promise> {
+ if (turnId !== activeTurnId || context.signal.aborted || inputs.size >= MAX_PENDING_INPUTS) return input.cancel();
+ const responseDelivery = requireAcpxResponseDelivery(context);
+ const requestId = stableRequestId(activeTurnId, ++requestSequence, context.requestId);
return await new Promise((settle) => {
const abort = () => {
const pending = inputs.get(requestId);
if (!pending || !inputs.delete(requestId)) return;
pending.cleanup();
- settle({ action: "cancel" });
+ settle(input.cancel());
};
- context.signal.addEventListener("abort", abort, { once: true });
inputs.set(requestId, {
- turnId: activeTurnId,
- normalized,
- settle,
+ turnId: activeTurnId, questionSet: input.questionSet, responseDelivery,
+ prepareResolution: resolution => {
+ const response = input.resolve(resolution);
+ return () => settle(response);
+ },
+ cancel: () => settle(input.cancel()),
cleanup: () => context.signal.removeEventListener("abort", abort),
});
+ context.signal.addEventListener("abort", abort, { once: true });
+ emit("runtime.input_requested", {
+ requestId, questionSet: input.questionSet,
+ origin: { adapter: "acpx-runtime-sidecar", provider: openParams?.agent ?? initializedAgent ?? "unknown", method: input.method },
+ }, activeTurnId);
if (context.signal.aborted) abort();
});
}
@@ -763,6 +864,11 @@ function elicitationResponse(
}
function rejectTurnWaiters(terminalTurnId: string, message: string): void {
+ for (const [requestId, pending] of permissions) {
+ if (pending.turnId !== terminalTurnId || !permissions.delete(requestId)) continue;
+ pending.cleanup();
+ pending.settle({ outcome: "cancel" });
+ }
for (const [callId, pending] of tools) {
if (pending.turnId !== terminalTurnId || !tools.delete(callId)) continue;
pending.cleanup();
@@ -772,7 +878,7 @@ function rejectTurnWaiters(terminalTurnId: string, message: string): void {
if (pending.turnId !== terminalTurnId || !inputs.delete(requestId))
continue;
pending.cleanup();
- pending.settle({ action: "cancel" });
+ pending.cancel();
}
}
@@ -1054,6 +1160,7 @@ function parseOpenParams(
model,
permissionMode: requiredPermissionMode(value.permissionMode),
permissionModePinned: value.permissionModePinned === true,
+ ...(value.providerPolicy == null ? {} : { providerPolicy: parseProviderPolicy(value.providerPolicy) }),
systemInstructions: boundedText(
value.systemInstructions,
"systemInstructions",
@@ -1069,6 +1176,14 @@ function parseOpenParams(
};
}
+function parseProviderPolicy(value: unknown): { readOnly: boolean } {
+ const policy = record(value);
+ if (typeof policy.readOnly !== "boolean" || Object.keys(policy).some(key => key !== "readOnly")) {
+ throw new Error("providerPolicy requires only an explicit readOnly boolean");
+ }
+ return { readOnly: policy.readOnly };
+}
+
function parseTools(value: unknown): Readonly>[] {
if (!Array.isArray(value) || value.length > 512) {
throw new Error("tools must be an array with at most 512 entries");
@@ -1208,8 +1323,8 @@ function requireHost(
}
function requireQualifiedAgent(value: unknown): QualifiedAcpxAgent {
- if (value !== "codex" && value !== "claude" && value !== "grok") {
- throw new Error("ACPX agent must be claude, codex, or grok");
+ if (value !== "grok" && value !== "codex" && value !== "claude" && value !== "pi" && value !== "cursor" && value !== "copilot") {
+ throw new Error("ACPX agent must be claude, codex, grok, cursor, copilot, or pi");
}
return value;
}
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 361a7d002d9..7082be9ad58 100644
--- a/packages/paperclip-runner/src/cli/eval-session-contract.test.ts
+++ b/packages/paperclip-runner/src/cli/eval-session-contract.test.ts
@@ -1,8 +1,10 @@
-import { chmod, mkdtemp, readFile, rm, stat } from "node:fs/promises";
+import { createHash } from "node:crypto";
+import { chmod, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { describe, expect, it } from "vitest";
+import { describe, expect, it, vi } from "vitest";
+import { createCapabilityFixtureState } from "../mock-core/capability-control-plane-types.js";
import { parseNativeRuntimeContext } from "../contracts/runtime-context.js";
import type { CapabilityLiveSessionSnapshot } from "../live/live-session.js";
@@ -12,9 +14,11 @@ import {
} from "./eval-session-contract.js";
import {
boundedEvalSessionUsage,
+ runEvalSessionCli,
evalRuntimeSystemInstructions,
evalSessionProviderVersion,
prepareEvalRuntimeContext,
+ parseEvalSessionCliArgs,
} from "./eval-session.js";
function request(overrides: Record = {}): unknown {
@@ -62,6 +66,25 @@ function agentCoreProfile(overrides: Record = {}) {
}
describe("eval-session request contract", () => {
+ it.each(["pi", "cursor", "copilot"] as const)("admits %s only with the matching CLI diagnostic opt-in", (agent) => {
+ 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: 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");
+ });
+
+ it("accepts only known diagnostic flags and rejects ambiguous repeated arguments", () => {
+ const args = ["--request", "/tmp/request.json", "--output", "/tmp/result.json"];
+ expect(parseEvalSessionCliArgs([...args, "--candidate-profile", "pi"])).toMatchObject({ candidateProfile: "pi" });
+ expect(() => parseEvalSessionCliArgs([...args, "--candidate-profile", "codex"])).toThrow("must be pi, cursor, or copilot");
+ expect(() => parseEvalSessionCliArgs([...args, "--candidate-profile"])).toThrow("missing");
+ expect(() => parseEvalSessionCliArgs([...args, "--request", "/tmp/other.json"])).toThrow("duplicate");
+ expect(() => parseEvalSessionRequest(request(), { candidateProfile: "pi" })).toThrow("must match");
+ });
+
it("materializes a production-v3 runtime context for direct live providers", async () => {
const workspace = await mkdtemp(join(tmpdir(), "paperclip-eval-context-"));
let instructionRoot: string | null = null;
@@ -145,11 +168,11 @@ describe("eval-session request contract", () => {
})))).toBe("17");
});
- it("rejects Pi and accepts both qualified remote provider profiles", () => {
+ it("requires explicit Pi diagnosis and accepts both qualified remote provider profiles", () => {
expect(() => parseEvalSessionRequest(request({
provider: "acpx",
acpxAgent: "pi",
- }))).toThrow("Pi ACPX profile is not available");
+ }))).toThrow("--candidate-profile");
expect(parseEvalSessionRequest(request({
provider: "aws_agentcore",
driver: "aws_agentcore_harness_api",
@@ -226,7 +249,9 @@ describe("eval-session usage", () => {
it("preserves Grok's missing usage as unknown instead of manufacturing zero tokens or cost", () => {
const parsed = { ...parseEvalSessionRequest(request()), provider: "acpx" as const, acpxAgent: "grok" as const };
const turn = { turnId: "turn-1", status: "completed" as const, assistantText: "done", snapshot: { usageLedger: [] } as unknown as CapabilityLiveSessionSnapshot };
- expect(boundedEvalSessionUsage(parsed, turn)).toBeNull();
+ expect(() => boundedEvalSessionUsage(parsed, turn)).toThrow("budget cost coverage is unavailable");
+ expect(turn.status).toBe("completed");
+ expect(turn.snapshot.usageLedger).toEqual([]);
expect(() => boundedEvalSessionUsage({ ...parsed, provider: "codex", acpxAgent: undefined }, turn)).toThrow();
});
@@ -265,6 +290,60 @@ describe("eval-session usage", () => {
})).toThrow("agent turn limit exceeded");
});
+ it.each(["pi", "cursor", "copilot"] as const)("keeps %s oracle results when the current turn explicitly has unavailable usage", (agent) => {
+ const parsed = parseEvalSessionRequest(request({
+ provider: "acpx", acpxAgent: agent, model: "exact-provider-model",
+ }), { candidateProfile: agent });
+ const unavailable = {
+ turnId: "turn-candidate", attemptId: "attempt-1", agent,
+ reason: "provider_did_not_report_usage" as const,
+ tokenUsage: null, costNanodollars: null, observedAt: "2026-09-28T19:18:10.000Z",
+ };
+ const snapshot = {
+ config: { provider: "acpx", acpxAgent: agent },
+ usageLedger: [], usageUnavailable: [unavailable],
+ } as unknown as CapabilityLiveSessionSnapshot;
+ const turn = { turnId: unavailable.turnId, status: "completed" as const, assistantText: "Upgrade your plan to continue", snapshot };
+ expect(() => boundedEvalSessionUsage(parsed, turn)).toThrow("budget cost coverage is unavailable");
+ expect(turn.assistantText).toBe("Upgrade your plan to continue");
+ expect(snapshot.usageLedger).toEqual([]);
+ expect(() => boundedEvalSessionUsage(parsed, { ...turn, turnId: "other-turn" }))
+ .toThrow("omitted usage accounting");
+ expect(() => boundedEvalSessionUsage(parsed, {
+ ...turn, snapshot: { ...snapshot, usageUnavailable: [{ ...unavailable, agent: agent === "pi" ? "cursor" : "pi" }] },
+ })).toThrow("omitted usage accounting");
+ expect(() => boundedEvalSessionUsage(parsed, {
+ ...turn, snapshot: { ...snapshot, usageUnavailable: [unavailable, { ...unavailable, turnId: "second-turn" }] },
+ })).toThrow("agent turn limit exceeded");
+ });
+
+ it("counts prior unavailable candidate turns alongside a later measured turn without claiming a complete total", () => {
+ const parsed = parseEvalSessionRequest(request({
+ provider: "acpx", acpxAgent: "cursor", model: "gpt-5.6-sol",
+ }), { candidateProfile: "cursor" });
+ const unavailable = {
+ turnId: "prior-turn", attemptId: "attempt-1", agent: "cursor" as const,
+ reason: "provider_did_not_report_usage" as const,
+ tokenUsage: null, costNanodollars: null, observedAt: "2026-09-28T19:18:10.000Z",
+ };
+ const snapshot = {
+ config: { provider: "acpx", acpxAgent: "cursor" },
+ usageUnavailable: [unavailable, { ...unavailable }],
+ usageLedger: [{
+ receiptId: "measured-receipt", turnId: "measured-turn", providerCalls: 1,
+ providerRequests: 1, inputTokens: 100, outputTokens: 10,
+ cachedInputTokens: 0, reasoningTokens: 0, costNanodollars: 0,
+ }],
+ } as unknown as CapabilityLiveSessionSnapshot;
+ const turn = { turnId: "measured-turn", status: "completed" as const, assistantText: "Done", snapshot };
+ expect(() => boundedEvalSessionUsage(parsed, turn)).toThrow("agent turn limit exceeded");
+ expect(() => boundedEvalSessionUsage({ ...parsed, limits: { ...parsed.limits, maxAgentTurns: 2 } }, turn)).toThrow("budget cost coverage is unavailable");
+ expect(boundedEvalSessionUsage(parsed, {
+ ...turn,
+ snapshot: { ...snapshot, usageUnavailable: [{ ...unavailable, turnId: "measured-turn" }] },
+ })).toMatchObject({ agentTurns: 1, inputTokens: 100, outputTokens: 10 });
+ });
+
it("deduplicates receipts and applies the versioned model price", () => {
const receipt = {
receiptId: "receipt-1",
@@ -301,4 +380,94 @@ describe("eval-session usage", () => {
{ usageLedger: [] } as unknown as CapabilityLiveSessionSnapshot,
)).toThrow("omitted usage accounting");
});
+
+ it.each(["pi", "cursor", "copilot"])("retains unpriced %s usage without inventing an invoice or substituting a model", (agent) => {
+ const snapshot = {
+ config: { provider: "acpx", acpxAgent: agent },
+ usageLedger: [{
+ receiptId: "candidate-turn-receipt", providerCalls: 1, providerRequests: 2,
+ inputTokens: 1_000, outputTokens: 100, cachedInputTokens: 400,
+ reasoningTokens: 50, costNanodollars: 0,
+ }],
+ } as unknown as CapabilityLiveSessionSnapshot;
+ expect(evalSessionUsage("exact-provider-model[context=272k]", snapshot)).toMatchObject({
+ agentTurns: 1, providerRequests: 2, inputTokens: 1_000, outputTokens: 100,
+ providerReportedCostNanodollars: null,
+ providerReportedCostProvenance: "unavailable",
+ estimatedCostNanodollars: null, pricingVersion: null, ratesUsdPerMillionTokens: null,
+ costCoverage: "unpriced",
+ });
+ const parsed = parseEvalSessionRequest(request({ provider: "acpx", acpxAgent: agent, model: "exact-provider-model[context=272k]" }), { candidateProfile: agent as "pi" | "cursor" | "copilot" });
+ expect(() => boundedEvalSessionUsage(parsed, {
+ turnId: "candidate-turn", status: "completed", assistantText: "Completed provider response", snapshot,
+ })).toThrow("budget cost coverage is unavailable");
+ const priced = evalSessionUsage("openrouter/deepseek/deepseek-v4-flash-0731", snapshot);
+ expect(priced.providerReportedCostNanodollars).toBeNull();
+ expect(priced.costCoverage).toBe("estimated");
+ expect(priced.estimatedCostNanodollars).toBeGreaterThan(0);
+ expect(priced.pricingVersion).toBe("provider-list-prices-2026-09-07-openrouter");
+ expect(priced.ratesUsdPerMillionTokens).toEqual({ input: 0.14, cachedInput: 0.028, output: 0.28 });
+ expect(() => evalSessionUsage("unpriced-qualified-model", {
+ ...snapshot, config: { provider: "codex" },
+ } as unknown as CapabilityLiveSessionSnapshot)).toThrow("model pricing unavailable");
+ });
+});
+
+describe("eval-session budget settlement", () => {
+ it.each(["no_receipt", "grok_no_receipt", "unpriced", "mixed", "over_limit"] as const)("retains the completed provider outcome while failing %s accounting", async (kind) => {
+ const workspace = await mkdtemp(join(tmpdir(), "eval-budget-settlement-"));
+ try {
+ const binary = join(workspace, "runnerd");
+ await writeFile(binary, "unused fake runner");
+ const agent = kind === "grok_no_receipt" ? "grok" : "copilot";
+ const noReceipt = kind === "no_receipt" || kind === "grok_no_receipt";
+ const model = kind === "grok_no_receipt" ? "grok-4.7" : kind === "unpriced" || kind === "no_receipt" ? "exact-unpriced-candidate" : "gpt-5.6-sol";
+ const unavailable = { turnId: kind === "mixed" ? "prior-turn" : "turn-1", attemptId: "attempt-1", agent: "copilot", reason: "provider_did_not_report_usage", tokenUsage: null, costNanodollars: null, observedAt: "2026-09-28T19:00:00.000Z" };
+ const state = JSON.stringify(createCapabilityFixtureState({}));
+ const snapshot = {
+ sessionId: "session-1", revision: 1, providerThreadId: "provider-1", providerSessionId: "provider-1",
+ providerModel: { id: model, provider: agent === "grok" ? "xai" : "github" }, status: "idle", activeTurnId: null,
+ createdAt: "2026-09-28T19:00:00.000Z", updatedAt: "2026-09-28T19:00:01.000Z",
+ authority: { companyId: "company-1", actorId: "actor-1", taskId: "task-1", runId: "run-1", sessionId: "session-1", scenarioId: "budget-test" },
+ config: { provider: "acpx", acpxAgent: agent, driver: "acpx_runtime", seedState: state, workingDirectory: workspace, scenario: { id: "budget-test" }, capabilities: [], explicitClaims: [], turnTimeoutMs: 1000 },
+ mockState: state, process: null, networkEvidence: { realPaperclipRequests: 0, childPaperclipEnvironmentKeys: [] },
+ transcript: [{ id: "assistant-1", role: "assistant", text: "Retained actual provider response", turnId: "turn-1", at: "2026-09-28T19:00:01.000Z" }],
+ evidence: [], authorizationRecords: [], attempts: [], terminalTurns: [{ turnId: "turn-1", status: "completed" }],
+ usageLedger: noReceipt ? [] : [{ receiptId: "receipt-1", turnId: "turn-1", providerCalls: 1, providerRequests: 1, inputTokens: 100, outputTokens: kind === "over_limit" ? 1_000_000 : 10, cachedInputTokens: 0, reasoningTokens: 0, costNanodollars: 0 }],
+ usageUnavailable: kind === "no_receipt" || kind === "mixed" ? [unavailable] : [],
+ } as unknown as CapabilityLiveSessionSnapshot;
+ const sendMessage = vi.fn(async () => ({ turnId: "turn-1", status: "completed", assistantText: "Retained actual provider response", snapshot }));
+ const completeAttempt = vi.fn(async () => undefined);
+ const shutdown = vi.fn(async () => { snapshot.status = "closed"; });
+ const input = request({ provider: "acpx", acpxAgent: agent, model,
+ runnerd: { path: binary, sha256: createHash("sha256").update("unused fake runner").digest("hex") },
+ session: { workingDirectory: workspace }, limits: { turnTimeoutMs: 1000, maxAgentTurns: 2, maxEstimatedCostNanodollars: 100_000_000 },
+ });
+ const requestPath = join(workspace, "request.json");
+ const outputPath = join(workspace, "output.json");
+ await writeFile(requestPath, JSON.stringify(input));
+ const exitCode = await runEvalSessionCli(["--request", requestPath, "--output", outputPath, ...(agent === "grok" ? [] : ["--candidate-profile", "copilot"])], {
+ serviceFactory: () => ({ create: async () => ({ sendMessage, completeAttempt, shutdown, snapshot: () => snapshot }) }) as never,
+ });
+ const artifact = JSON.parse(await readFile(outputPath, "utf8"));
+ expect(exitCode).toBe(2);
+ expect(artifact).not.toHaveProperty("infrastructureError");
+ expect(artifact.accountingFailure).toMatchObject({ class: kind === "over_limit" ? "provider_budget_reached" : "provider_budget_coverage_unknown", retryable: false });
+ expect(artifact.turn).toMatchObject({ status: "completed", assistantText: "Retained actual provider response" });
+ expect(artifact.snapshot.status).toBe("closed");
+ expect(artifact.acpxProfile.agent).toBe(agent);
+ expect(artifact.devtools).toBeDefined();
+ expect(artifact.issueThread).toBeDefined();
+ if (noReceipt) expect(artifact).not.toHaveProperty("usage");
+ else expect(artifact.usage.providerReportedCostNanodollars).toBeNull();
+ expect(sendMessage).toHaveBeenCalledTimes(1);
+ expect(shutdown).toHaveBeenCalledTimes(1);
+ expect(completeAttempt).toHaveBeenCalledWith("failed", artifact.accountingFailure.class);
+ } finally {
+ for (const entry of await readdir(workspace)) {
+ if (entry.startsWith(".paperclip-eval-runtime-context-")) await chmod(join(workspace, entry, "instructions"), 0o700).catch(() => undefined);
+ }
+ await rm(workspace, { recursive: true, force: true });
+ }
+ });
});
diff --git a/packages/paperclip-runner/src/cli/eval-session-contract.ts b/packages/paperclip-runner/src/cli/eval-session-contract.ts
index 5e64ef43fc2..d1446cb4ac0 100644
--- a/packages/paperclip-runner/src/cli/eval-session-contract.ts
+++ b/packages/paperclip-runner/src/cli/eval-session-contract.ts
@@ -58,6 +58,8 @@ export interface EvalSessionAgentCoreProfile {
timeoutSeconds: number;
}
+export type EvalCandidateProfile = "pi" | "cursor" | "copilot";
+
export interface EvalSessionRequest {
schema: typeof EVAL_SESSION_REQUEST_SCHEMA;
attemptId: string;
@@ -66,7 +68,7 @@ export interface EvalSessionRequest {
provider?: EvalSessionProvider;
driver?: EvalSessionDriver;
opencodeVersion?: string;
- acpxAgent?: Exclude;
+ acpxAgent?: QualifiedAcpxAgent;
managedProfile?: EvalSessionManagedProfile;
agentCoreProfile?: EvalSessionAgentCoreProfile;
runnerd: { path: string; sha256: string };
@@ -81,14 +83,19 @@ export interface EvalSessionRequest {
includeCollaborationModeInstructions?: true;
}
-export interface EvalSessionUsage extends EstimatedModelCost {
+export interface EvalSessionUsage {
agentTurns: number;
providerRequests: number;
inputTokens: number;
outputTokens: number;
cachedInputTokens: number;
reasoningTokens: number;
- providerReportedCostNanodollars: number;
+ providerReportedCostNanodollars: number | null;
+ providerReportedCostProvenance: "legacy_runner_usage_ledger" | "unavailable";
+ estimatedCostNanodollars: number | null;
+ pricingVersion: EstimatedModelCost["pricingVersion"] | null;
+ ratesUsdPerMillionTokens: EstimatedModelCost["ratesUsdPerMillionTokens"] | null;
+ costCoverage: "estimated" | "unpriced" | "legacy_ledger_and_estimate";
}
function object(value: unknown, path: string): Record {
@@ -211,7 +218,10 @@ function parseAgentCoreProfile(value: unknown): EvalSessionAgentCoreProfile {
}
/** Fail-closed validation for the executable boundary. */
-export function parseEvalSessionRequest(value: unknown): EvalSessionRequest {
+export function parseEvalSessionRequest(
+ value: unknown,
+ options: { candidateProfile?: EvalCandidateProfile } = {},
+): EvalSessionRequest {
const input = object(value, "request");
if (input.schema !== EVAL_SESSION_REQUEST_SCHEMA) {
throw new Error("unsupported request schema");
@@ -237,17 +247,24 @@ export function parseEvalSessionRequest(value: unknown): EvalSessionRequest {
// options as JSON null. Preserve compatibility with those immutable request
// artifacts while continuing to reject non-null values for the wrong lane.
const acpxAgent = input.acpxAgent === null ? undefined : input.acpxAgent;
- if (acpxAgent === "pi") throw new Error("The Pi ACPX profile is not available");
if (
acpxAgent !== undefined &&
acpxAgent !== "codex" &&
- acpxAgent !== "claude" && acpxAgent !== "grok"
+ acpxAgent !== "claude" && acpxAgent !== "grok" &&
+ acpxAgent !== "pi" && acpxAgent !== "cursor" && acpxAgent !== "copilot"
) {
- throw new Error("eval-session acpxAgent must be codex, claude, or grok");
+ throw new Error("eval-session acpxAgent must be a registered ACPX profile");
}
if (provider !== "acpx" && acpxAgent !== undefined) {
throw new Error("eval-session acpxAgent requires provider acpx");
}
+ const candidate = acpxAgent === "pi" || acpxAgent === "cursor" || acpxAgent === "copilot";
+ if (options.candidateProfile !== undefined && (provider !== "acpx" || acpxAgent !== options.candidateProfile || !candidate)) {
+ throw new Error("--candidate-profile must match the request's registered candidate ACPX agent");
+ }
+ if (candidate && options.candidateProfile !== acpxAgent) {
+ throw new Error("Candidate ACPX profiles require an explicit matching --candidate-profile diagnostic flag");
+ }
const managedProfileInput = input.managedProfile === null
? undefined
: input.managedProfile;
@@ -306,8 +323,8 @@ export function parseEvalSessionRequest(value: unknown): EvalSessionRequest {
) {
throw new Error("request.session.requestedModel must match request.model");
}
- if (session.acpxAgent === "pi") {
- throw new Error("The Pi ACPX profile is not available");
+ if (session.acpxAgent !== undefined && session.acpxAgent !== acpxAgent) {
+ throw new Error("request.session.acpxAgent must match request.acpxAgent");
}
return {
@@ -376,8 +393,28 @@ export function evalSessionUsage(
if (unique.size === 0) {
throw new Error("completed turn omitted usage accounting");
}
+ const candidate = snapshot.config?.provider === "acpx"
+ && ["pi", "cursor", "copilot"].includes(snapshot.config.acpxAgent ?? "");
+ let estimate: EstimatedModelCost | null;
+ try {
+ estimate = estimateModelCostNanodollars(model, totals);
+ } catch (error) {
+ // An exact candidate model can be advertised before our pricing catalog
+ // contains it. Preserve unpriced usage for billing reconciliation instead
+ // of substituting a model or converting unknown spend into zero.
+ if (!candidate || !(error instanceof Error) || !error.message.startsWith("model pricing unavailable for ")) throw error;
+ estimate = null;
+ }
return {
...totals,
- ...estimateModelCostNanodollars(model, totals),
+ // Candidate ACP adapters do not supply authenticated USD receipts. The
+ // shared legacy ledger fills absent cost with zero, so its numeric value
+ // cannot establish an invoice amount for these profiles.
+ providerReportedCostNanodollars: candidate ? null : totals.providerReportedCostNanodollars,
+ providerReportedCostProvenance: candidate ? "unavailable" : "legacy_runner_usage_ledger",
+ estimatedCostNanodollars: estimate?.estimatedCostNanodollars ?? null,
+ pricingVersion: estimate?.pricingVersion ?? null,
+ ratesUsdPerMillionTokens: estimate?.ratesUsdPerMillionTokens ?? null,
+ costCoverage: candidate ? (estimate === null ? "unpriced" : "estimated") : "legacy_ledger_and_estimate",
};
}
diff --git a/packages/paperclip-runner/src/cli/eval-session-entrypoint.test.ts b/packages/paperclip-runner/src/cli/eval-session-entrypoint.test.ts
new file mode 100644
index 00000000000..cbc7f5dc3d5
--- /dev/null
+++ b/packages/paperclip-runner/src/cli/eval-session-entrypoint.test.ts
@@ -0,0 +1,31 @@
+import { execFile } from "node:child_process";
+import { mkdtemp, realpath, rm, symlink } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { promisify } from "node:util";
+
+import { expect, it } from "vitest";
+
+const execute = promisify(execFile);
+const tsx = fileURLToPath(new URL("../../node_modules/.bin/tsx", import.meta.url));
+
+it("runs the eval CLI parser through both canonical and symlinked paths", async () => {
+ const cli = await realpath(fileURLToPath(new URL("./eval-session.ts", import.meta.url)));
+ const root = await mkdtemp(join(tmpdir(), "paperclip-eval-cli-entrypoint-"));
+ try {
+ const alias = join(root, "cli-alias");
+ await symlink(dirname(cli), alias, "dir");
+ for (const path of [cli, join(alias, "eval-session.ts")]) {
+ // A skipped main guard silently exits zero. Rejecting the invalid option
+ // proves actual CLI execution without loading credentials or a provider.
+ await expect(execute(tsx, [path, "--unknown", "value"], { timeout: 15_000 }))
+ .rejects.toMatchObject({ code: 1, stderr: "unknown argument: --unknown\n" });
+ }
+ const imported = await execute(tsx, ["--eval", `import(${JSON.stringify(cli)}).then(() => console.log("imported"))`], { timeout: 15_000 });
+ expect(imported.stdout.trim()).toBe("imported");
+ expect(imported.stderr).toBe("");
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+}, 45_000);
diff --git a/packages/paperclip-runner/src/cli/eval-session.ts b/packages/paperclip-runner/src/cli/eval-session.ts
index 33c56f79624..19153159445 100644
--- a/packages/paperclip-runner/src/cli/eval-session.ts
+++ b/packages/paperclip-runner/src/cli/eval-session.ts
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import { createHash } from "node:crypto";
+import { realpathSync } from "node:fs";
import { chmod, mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
@@ -30,6 +31,7 @@ import {
expectedEvalSessionDriver,
parseEvalSessionRequest,
type EvalSessionRequest,
+ type EvalCandidateProfile,
type EvalSessionUsage,
} from "./eval-session-contract.js";
import { evalProviderTransportOptions } from "./eval-provider-runtime.js";
@@ -37,6 +39,7 @@ import { evalProviderTransportOptions } from "./eval-provider-runtime.js";
interface EvalSessionCliOptions {
requestPath: string;
outputPath: string;
+ candidateProfile?: EvalCandidateProfile;
}
function argument(args: string[], name: string): string {
@@ -47,14 +50,23 @@ function argument(args: string[], name: string): string {
}
export function parseEvalSessionCliArgs(args: string[]): EvalSessionCliOptions {
- const allowed = new Set(["--request", "--output"]);
+ const allowed = new Set(["--request", "--output", "--candidate-profile"]);
+ const seen = new Set();
for (let index = 0; index < args.length; index += 2) {
if (!allowed.has(args[index] ?? "")) {
throw new Error(`unknown argument: ${args[index] ?? ""}`);
}
- if (args[index + 1] === undefined) throw new Error(`missing ${args[index]}`);
+ if (seen.has(args[index]!)) throw new Error(`duplicate argument: ${args[index]}`);
+ seen.add(args[index]!);
+ if (args[index + 1] === undefined || args[index + 1]!.startsWith("--")) throw new Error(`missing ${args[index]}`);
+ }
+ const candidateIndex = args.indexOf("--candidate-profile");
+ const candidateProfile = candidateIndex < 0 ? undefined : args[candidateIndex + 1];
+ if (candidateProfile !== undefined && candidateProfile !== "pi" && candidateProfile !== "cursor" && candidateProfile !== "copilot") {
+ throw new Error("--candidate-profile must be pi, cursor, or copilot");
}
return {
+ ...(candidateProfile === undefined ? {} : { candidateProfile }),
requestPath: argument(args, "--request"),
outputPath: argument(args, "--output"),
};
@@ -180,12 +192,22 @@ export function evalSessionProviderVersion(
return null;
}
+class EvalSessionBudgetError extends Error {
+ constructor(message: string, readonly coverageUnknown = false) {
+ super(message);
+ this.name = "EvalSessionBudgetError";
+ }
+}
+
function failureClass(error: unknown): {
class: string;
category: string;
retryable: boolean;
diagnostics: Record;
} {
+ if (error instanceof EvalSessionBudgetError && error.coverageUnknown) {
+ return { class: "provider_budget_coverage_unknown", category: "provider_budget", retryable: false, diagnostics: {} };
+ }
const message = error instanceof Error ? error.message : String(error);
if (/timed? ?out|timeout/i.test(message)) {
return {
@@ -235,25 +257,48 @@ export function boundedEvalSessionUsage(
request: EvalSessionRequest,
turn: CapabilityLiveTurnResult,
): EvalSessionUsage | null {
- if (turn.status !== "completed" ||
- (request.provider === "acpx" && request.acpxAgent === "grok" && !turn.snapshot.usageLedger?.length)) {
+ if (turn.status !== "completed") {
return usageIfAvailable(request, turn.snapshot);
}
- const usage = evalSessionUsage(request.model, turn.snapshot);
- if (usage.agentTurns > request.limits.maxAgentTurns) {
- throw new Error("agent turn limit exceeded");
+ if (request.provider === "acpx" && request.acpxAgent === "grok" && !turn.snapshot.usageLedger?.length) {
+ throw new EvalSessionBudgetError("budget cost coverage is unavailable for the completed Grok turn", true);
+ }
+ const candidate = request.provider === "acpx"
+ && request.acpxAgent !== undefined
+ && ["pi", "cursor", "copilot"].includes(request.acpxAgent)
+ && turn.snapshot.config.provider === "acpx"
+ && turn.snapshot.config.acpxAgent === request.acpxAgent;
+ const measuredTurns = new Set(turn.snapshot.usageLedger?.map((entry) => entry.turnId));
+ const unavailableTurnIds = new Set(candidate
+ ? turn.snapshot.usageUnavailable?.filter((entry) => entry.agent === request.acpxAgent
+ && entry.reason === "provider_did_not_report_usage"
+ && entry.tokenUsage === null && entry.costNanodollars === null
+ && !measuredTurns.has(entry.turnId)).map((entry) => entry.turnId)
+ : []);
+ const unavailable = unavailableTurnIds.size > 0;
+ const usage = unavailable && (unavailableTurnIds.has(turn.turnId) || turn.snapshot.usageLedger?.length)
+ ? usageIfAvailable(request, turn.snapshot)
+ : evalSessionUsage(request.model, turn.snapshot);
+ const unavailableTurns = unavailableTurnIds.size;
+ if ((usage?.agentTurns ?? 0) + unavailableTurns > request.limits.maxAgentTurns) {
+ throw new EvalSessionBudgetError("agent turn limit exceeded");
}
if (
+ usage !== null && usage.estimatedCostNanodollars !== null &&
usage.estimatedCostNanodollars >
request.limits.maxEstimatedCostNanodollars
) {
- throw new Error("estimated cost limit exceeded");
+ throw new EvalSessionBudgetError("estimated cost limit exceeded");
}
if (
+ usage !== null && usage.providerReportedCostNanodollars !== null &&
usage.providerReportedCostNanodollars >
request.limits.maxEstimatedCostNanodollars
) {
- throw new Error("provider-reported cost limit exceeded");
+ throw new EvalSessionBudgetError("provider-reported cost limit exceeded");
+ }
+ if (unavailable || usage === null || (usage.estimatedCostNanodollars === null && usage.providerReportedCostNanodollars === null)) {
+ throw new EvalSessionBudgetError("budget cost coverage is unavailable for one or more completed turns", true);
}
return usage;
}
@@ -277,6 +322,7 @@ export async function runEvalSessionCli(
const cli = parseEvalSessionCliArgs(args);
const request = parseEvalSessionRequest(
JSON.parse(await readFile(cli.requestPath, "utf8")),
+ { candidateProfile: cli.candidateProfile },
);
const runnerdPath = resolve(request.runnerd.path);
const actualDigest = await sha256(runnerdPath);
@@ -300,6 +346,7 @@ export async function runEvalSessionCli(
transportOptions: {
...evalProviderTransportOptions(requestedProvider, request.limits.turnTimeoutMs),
runnerBinary: runnerdPath,
+ ...(cli.candidateProfile === undefined ? {} : { acpxCandidateProfile: cli.candidateProfile }),
runtimeContext,
baseInstructions: evalRuntimeSystemInstructions(runtimeContext),
// The transport performs the provider-specific allowlisting. Supplying
@@ -338,10 +385,21 @@ export async function runEvalSessionCli(
} as unknown as CreateCapabilityLiveSessionInput;
session = await service.create(createInput);
turn = await session.sendMessage(request.prompt);
- const usage = boundedEvalSessionUsage(request, turn);
+ let usage: EvalSessionUsage | null;
+ let accountingError: EvalSessionBudgetError | null = null;
+ try {
+ usage = boundedEvalSessionUsage(request, turn);
+ } catch (error) {
+ if (!(error instanceof EvalSessionBudgetError)) throw error;
+ // A completed provider outcome remains inspectable even when its budget
+ // cannot be verified. Never turn unknown cost into a successful CLI run.
+ accountingError = error;
+ usage = usageIfAvailable(request, turn.snapshot);
+ }
await session.completeAttempt(
- turn.status === "completed" ? "succeeded" : "failed",
- turn.status === "completed" ? null : `provider_turn_${turn.status}`,
+ accountingError === null && turn.status === "completed" ? "succeeded" : "failed",
+ accountingError !== null ? failureClass(accountingError).class
+ : turn.status === "completed" ? null : `provider_turn_${turn.status}`,
);
await closeSession(session, "eval session complete");
snapshot = session.snapshot();
@@ -352,6 +410,7 @@ export async function runEvalSessionCli(
build: PAPERCLIP_RUNNER_BUILD_METADATA,
runnerd: { path: "[withheld]", sha256: `sha256:${actualDigest}` },
requestedModel: request.model,
+ ...(cli.candidateProfile === undefined ? {} : { diagnosticCandidateProfile: cli.candidateProfile }),
provider: requestedProvider,
driver: requestedDriver,
providerVersion: requestedProviderVersion,
@@ -379,6 +438,10 @@ export async function runEvalSessionCli(
: {}),
turn,
snapshot,
+ ...(accountingError === null ? {} : {
+ accountingError: accountingError.message,
+ accountingFailure: failureClass(accountingError),
+ }),
devtools: projectCapabilityDevtools(snapshot),
issueThread: projectCapabilityIssueThread({
snapshot,
@@ -392,7 +455,7 @@ export async function runEvalSessionCli(
durationMs: Date.now() - startedAtMs,
},
}, null, 2)}\n`);
- return 0;
+ return accountingError === null ? 0 : 2;
} catch (error) {
if (session !== null) {
snapshot = session.snapshot();
@@ -425,6 +488,7 @@ export async function runEvalSessionCli(
build: PAPERCLIP_RUNNER_BUILD_METADATA,
runnerd: { path: "[withheld]", sha256: `sha256:${actualDigest}` },
requestedModel: request.model,
+ ...(cli.candidateProfile === undefined ? {} : { diagnosticCandidateProfile: cli.candidateProfile }),
provider: requestedProvider,
driver: requestedDriver,
providerVersion: requestedProviderVersion,
@@ -453,10 +517,18 @@ export async function runEvalSessionCli(
}
}
-if (
- process.argv[1] !== undefined &&
- resolve(process.argv[1]) === resolve(fileURLToPath(import.meta.url))
-) {
+function isEvalSessionEntrypoint(): boolean {
+ if (process.argv[1] === undefined) return false;
+ try {
+ // Node resolves module URLs through symlinks, including /tmp on macOS and
+ // package-manager bin links. Compare the same physical paths on both sides.
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
+ } catch {
+ return false;
+ }
+}
+
+if (isEvalSessionEntrypoint()) {
void runEvalSessionCli(process.argv.slice(2))
.then((code) => {
process.exitCode = code;
diff --git a/packages/paperclip-runner/src/contracts/harness-driver.ts b/packages/paperclip-runner/src/contracts/harness-driver.ts
index 3400b419c9c..b6bbe6103bf 100644
--- a/packages/paperclip-runner/src/contracts/harness-driver.ts
+++ b/packages/paperclip-runner/src/contracts/harness-driver.ts
@@ -2,7 +2,7 @@ import type {
PrpEvent,
PrpStructuredRunResult,
} from "../protocol/replay-contract.js";
-import type { NativeSessionCapabilities, NativeUserMessage } from "./types.js";
+import type { NativeSessionCapabilities, NativeTurnControlCapabilities, NativeUserMessage } from "./types.js";
import {
PAPERCLIP_RUNTIME_REQUEST_SCHEMA_V2,
parsePaperclipQuestionResponse,
@@ -495,6 +495,7 @@ export interface HarnessSessionRecoveryResult {
}
export interface HarnessSession {
+ turnControlCapabilities?(): NativeTurnControlCapabilities | null;
ids(): {
driverSessionId: string;
providerSessionId?: string | null;
@@ -512,6 +513,8 @@ export interface HarnessSession {
effectiveCollaborationMode?: "default" | "plan";
}>;
steer?(input: {
+ /** Queued follow-ups remain distinct from active-turn steering. */
+ mode?: "steer" | "follow_up";
turnId: string;
message: NativeUserMessage;
correlationId?: string;
diff --git a/packages/paperclip-runner/src/contracts/native-execution.test.ts b/packages/paperclip-runner/src/contracts/native-execution.test.ts
index 8d1ddee0a15..a2d3a30c8c5 100644
--- a/packages/paperclip-runner/src/contracts/native-execution.test.ts
+++ b/packages/paperclip-runner/src/contracts/native-execution.test.ts
@@ -120,6 +120,21 @@ describe("NativeExecutionInputV1", () => {
schema: "paperclip.native-execution-input.v4",
provider: { kind: "codex", approvalPolicy: "on-request" },
});
+ const withEffort = parseNativeExecutionInput({
+ ...current,
+ schema: NATIVE_EXECUTION_INPUT_SCHEMA,
+ provider: { kind: "codex", model: "gpt-6-astra", approvalPolicy: "on-request", reasoningEffort: "ultra" },
+ });
+ expect(withEffort.provider).toMatchObject({ kind: "codex", reasoningEffort: "ultra" });
+ expect(parseNativeExecutionInput(withEffort)).toEqual(withEffort);
+ expect(() => parseNativeExecutionInput({
+ ...withEffort,
+ provider: { kind: "codex", model: "gpt-6-astra", approvalPolicy: "on-request", reasoningEffort: "impossible" },
+ })).toThrow("reasoningEffort");
+ expect(() => parseNativeExecutionInput({
+ ...current,
+ provider: { kind: "codex", model: null, approvalPolicy: "on-request", reasoningEffort: "ultra" },
+ })).toThrow("input.provider");
expect(() => parseNativeExecutionInput({
...parsed,
schema: "paperclip.native-execution-input.v4",
@@ -280,7 +295,7 @@ describe("NativeExecutionInputV1", () => {
})).toThrow("eventExpiryDays");
});
- it("accepts only a closed ACPX profile matching the driver and agent", () => {
+ it.each([1, 2, 3, 4, 5] as const)("accepts only a closed ACPX profile matching the driver and agent at profile version %s", (agentProfileVersion) => {
const provider = {
kind: "acpx",
agent: "pi",
@@ -291,7 +306,7 @@ describe("NativeExecutionInputV1", () => {
protocolVersion: 1,
acpxVersion: "0.13.1",
agent: "pi",
- agentProfileVersion: 1,
+ agentProfileVersion,
agentServerPackage: "pi-acp",
agentServerVersion: "0.0.33",
agentRuntimePackage: "@earendil-works/pi-coding-agent",
@@ -312,6 +327,13 @@ describe("NativeExecutionInputV1", () => {
profile: provider.profile,
});
expect(parseNativeExecutionInput(parsed)).toEqual(parsed);
+ for (const unsupportedVersion of [0, 6, 1.5, "5", null]) {
+ expect(() => parseNativeExecutionInput({
+ ...input,
+ session: { ...input.session, driverKind: "acpx_runtime" },
+ provider: { ...provider, profile: { ...provider.profile, agentProfileVersion: unsupportedVersion } },
+ })).toThrow("qualified ACPX v1 profile");
+ }
expect(buildNativeModelEnvelope(parsed).workspace).toEqual({ cwd: "/safe/workspace" });
expect(() => parseNativeExecutionInput({
...input,
diff --git a/packages/paperclip-runner/src/contracts/native-execution.ts b/packages/paperclip-runner/src/contracts/native-execution.ts
index c4f1715f31c..9d089fde854 100644
--- a/packages/paperclip-runner/src/contracts/native-execution.ts
+++ b/packages/paperclip-runner/src/contracts/native-execution.ts
@@ -80,7 +80,7 @@ export interface NativeAwsAgentCoreProfileSnapshot {
eventExpiryDays: 90;
}
-export type NativeAcpxAgent = "pi" | "claude" | "codex" | "grok";
+export type NativeAcpxAgent = "pi" | "claude" | "codex" | "grok" | "cursor" | "copilot";
export type NativeCodexApprovalPolicy = "never" | "on-request" | "untrusted";
export type NativeOpenCodePermissionMode = "allow" | "ask" | "deny";
export type NativeAcpxPermissionMode = "approve-all" | "approve-paperclip" | "approve-reads" | "deny-all";
@@ -90,7 +90,7 @@ export interface NativeAcpxProfileSnapshot {
protocolVersion: 1;
acpxVersion: "0.13.1";
agent: NativeAcpxAgent;
- agentProfileVersion: 1;
+ agentProfileVersion: 1 | 2 | 3 | 4 | 5;
agentServerPackage: string;
agentServerVersion: string;
agentRuntimePackage: string | null;
@@ -140,6 +140,10 @@ export type NativeProviderConfigV4 =
profile: NativeAcpxProfileSnapshot;
};
+export type NativeProviderConfigV5 =
+ | Exclude
+ | (Extract & { reasoningEffort?: string });
+
export interface NativeExecutionInputV1 {
schema: typeof NATIVE_EXECUTION_INPUT_SCHEMA_V1;
binding: {
@@ -217,8 +221,9 @@ export interface NativeCompletionSources {
criteria: Array<{ id: string; source: NativeCompletionSource }>;
}
-export interface NativeExecutionInputV5 extends Omit {
+export interface NativeExecutionInputV5 extends Omit {
schema: typeof NATIVE_EXECUTION_INPUT_SCHEMA;
+ provider: NativeProviderConfigV5;
completionSources?: NativeCompletionSources;
}
@@ -447,7 +452,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
: provider.kind === "acpx"
? ["kind", "agent", "model", isV4 ? "permissionMode" : "permissionPolicy", "profile"]
: provider.kind === "codex" && isV4
- ? ["kind", "model", "approvalPolicy"]
+ ? ["kind", "model", "approvalPolicy", ...(isV5 ? ["reasoningEffort"] : [])]
: provider.kind === "opencode" && isV4
? ["kind", "model", "permissionMode"]
: ["kind", "model"],
@@ -468,7 +473,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
if (provider.kind === "opencode" && (providerModel === null || !providerModel.includes("/"))) {
throw new NativeExecutionInputError("input.provider.model is required for opencode in provider/model form");
}
- let parsedProvider: NativeProviderConfig;
+ let parsedProvider: NativeProviderConfig | NativeProviderConfigV5;
if (provider.kind === "claude_managed") {
if (providerModel === null) {
throw new NativeExecutionInputError("input.provider.model is required for claude_managed");
@@ -568,8 +573,8 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
if (providerModel === null) {
throw new NativeExecutionInputError("input.provider.model is required for acpx");
}
- if (provider.agent !== "pi" && provider.agent !== "claude" && provider.agent !== "codex" && provider.agent !== "grok") {
- throw new NativeExecutionInputError("input.provider.agent must be pi, claude, codex, or grok");
+ if (provider.agent !== "pi" && provider.agent !== "claude" && provider.agent !== "codex" && provider.agent !== "grok" && provider.agent !== "cursor" && provider.agent !== "copilot") {
+ throw new NativeExecutionInputError("input.provider.agent must be pi, claude, codex, grok, cursor, or copilot");
}
if (isV4) {
if (provider.permissionMode !== "approve-all" && provider.permissionMode !== "approve-paperclip" && provider.permissionMode !== "approve-reads" && provider.permissionMode !== "deny-all") {
@@ -596,7 +601,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
|| profile.protocolVersion !== 1
|| profile.acpxVersion !== "0.13.1"
|| profile.agent !== provider.agent
- || profile.agentProfileVersion !== 1
+ || (profile.agentProfileVersion !== 1 && profile.agentProfileVersion !== 2 && profile.agentProfileVersion !== 3 && profile.agentProfileVersion !== 4 && profile.agentProfileVersion !== 5)
) {
throw new NativeExecutionInputError("input.provider.profile does not match the qualified ACPX v1 profile");
}
@@ -617,7 +622,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
protocolVersion: 1,
acpxVersion: "0.13.1",
agent: provider.agent,
- agentProfileVersion: 1,
+ agentProfileVersion: profile.agentProfileVersion,
agentServerPackage: text(profile.agentServerPackage, "input.provider.profile.agentServerPackage"),
agentServerVersion: text(profile.agentServerVersion, "input.provider.profile.agentServerVersion"),
agentRuntimePackage: runtimePackage,
@@ -640,12 +645,18 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
if (isV4 && provider.approvalPolicy !== "never" && provider.approvalPolicy !== "on-request" && provider.approvalPolicy !== "untrusted") {
throw new NativeExecutionInputError("input.provider.approvalPolicy must be never, on-request, or untrusted");
}
+ if (isV5 && provider.reasoningEffort !== undefined && !["minimal", "low", "medium", "high", "xhigh", "max", "ultra"].includes(String(provider.reasoningEffort))) {
+ throw new NativeExecutionInputError("input.provider.reasoningEffort is unsupported");
+ }
parsedProvider = {
kind: "codex",
model: providerModel,
...(isV4
? { approvalPolicy: provider.approvalPolicy as NativeCodexApprovalPolicy }
: {}),
+ ...(isV5 && provider.reasoningEffort !== undefined
+ ? { reasoningEffort: text(provider.reasoningEffort, "input.provider.reasoningEffort") }
+ : {}),
};
}
if (!Array.isArray(contract.criteria) || contract.criteria.length === 0) {
@@ -761,6 +772,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput
return {
...withPermissions,
schema: NATIVE_EXECUTION_INPUT_SCHEMA,
+ provider: parsedProvider as NativeProviderConfigV5,
...(input.completionSources !== undefined ? { completionSources: parseCompletionSources(input.completionSources) } : {}),
};
}
diff --git a/packages/paperclip-runner/src/contracts/native-session-backend.ts b/packages/paperclip-runner/src/contracts/native-session-backend.ts
index 0bad29e1715..7a84e9577d2 100644
--- a/packages/paperclip-runner/src/contracts/native-session-backend.ts
+++ b/packages/paperclip-runner/src/contracts/native-session-backend.ts
@@ -93,11 +93,26 @@ export interface NativeSessionSnapshotOptions {
signal: AbortSignal;
}
+/** A dispatched operation may have taken effect, but has no proven result. */
+export class SemanticToolOutcomeUnknownError extends Error {
+ readonly code = "semantic_tool_outcome_unknown";
+
+ constructor(message: string, options?: ErrorOptions) {
+ super(message, options);
+ this.name = "SemanticToolOutcomeUnknownError";
+ }
+}
+
+export function isSemanticToolOutcomeUnknownError(error: unknown): error is SemanticToolOutcomeUnknownError {
+ // Match across the server's vendored and source-mode runtime boundaries.
+ return error instanceof Error && "code" in error && error.code === "semantic_tool_outcome_unknown";
+}
+
/** The exact close owner has torn down its controller without proving suspension. */
export class NativeSessionCloseUnrecoverableError extends Error {
readonly code = "native_session_close_unrecoverable";
- constructor() {
+ constructor(readonly settlement?: Record) {
super(
"provider_transport_failed: runner did not durably suspend before checkpoint",
);
@@ -154,6 +169,7 @@ export interface NativeSession {
effectiveCollaborationMode?: "default" | "plan";
}>;
steer?(input: {
+ mode?: "steer" | "follow_up";
turnId: string;
message: NativeUserMessage;
correlationId?: string;
diff --git a/packages/paperclip-runner/src/contracts/question-set.ts b/packages/paperclip-runner/src/contracts/question-set.ts
index 34156a87cfd..5021b3ef970 100644
--- a/packages/paperclip-runner/src/contracts/question-set.ts
+++ b/packages/paperclip-runner/src/contracts/question-set.ts
@@ -262,8 +262,8 @@ export function parsePaperclipQuestionSet(value: unknown): PaperclipQuestionSet
...(optionalText(candidate.title, "/input/title", 1_000) !== undefined
? { title: optionalText(candidate.title, "/input/title", 1_000) }
: {}),
- ...(optionalText(candidate.description, "/input/description") !== undefined
- ? { description: optionalText(candidate.description, "/input/description") }
+ ...(optionalText(candidate.description, "/input/description", 100_000) !== undefined
+ ? { description: optionalText(candidate.description, "/input/description", 100_000) }
: {}),
...(optionalText(candidate.submitLabel, "/input/submitLabel", 200) !== undefined
? { submitLabel: optionalText(candidate.submitLabel, "/input/submitLabel", 200) }
diff --git a/packages/paperclip-runner/src/contracts/runtime-context.ts b/packages/paperclip-runner/src/contracts/runtime-context.ts
index 948cdbc62fa..bbf7e89ab5e 100644
--- a/packages/paperclip-runner/src/contracts/runtime-context.ts
+++ b/packages/paperclip-runner/src/contracts/runtime-context.ts
@@ -15,7 +15,12 @@ export interface NativeRuntimeAssetReference {
export interface NativeRuntimeContextSnapshot {
prompt: { revision: typeof PAPERCLIP_EXECUTION_PROMPT_REVISION; text: typeof PAPERCLIP_EXECUTION_PROMPT; digest: string };
- instructions: { entryPath: string; bundle: NativeRuntimeAssetReference };
+ instructions: {
+ entryPath: string;
+ bundle: NativeRuntimeAssetReference;
+ /** Server-registered writable copy; excluded from the pinned prompt digest. */
+ workingCopy?: { rootPath: string; entryPath: string; kind?: "agent_files" };
+ };
skills: Array<{ key: string; runtimeName: string; versionId: string | null; bundle: NativeRuntimeAssetReference }>;
mcp: { assignmentSetId: string; digest: string; bindingId: string | null };
aggregateDigest: string;
@@ -103,7 +108,10 @@ export function parseNativeRuntimeContext(value: unknown): NativeRuntimeContextS
throw new NativeRuntimeContextError("input.runtimeContext.prompt.digest does not match prompt text");
}
const instructions = object(context.instructions, "input.runtimeContext.instructions");
- exact(instructions, ["entryPath", "bundle"], "input.runtimeContext.instructions");
+ exact(instructions, ["entryPath", "bundle", "workingCopy"], "input.runtimeContext.instructions");
+ const workingCopy = instructions.workingCopy === undefined ? undefined : object(instructions.workingCopy, "input.runtimeContext.instructions.workingCopy");
+ if (workingCopy) exact(workingCopy, ["rootPath", "entryPath", "kind"], "input.runtimeContext.instructions.workingCopy");
+ if (workingCopy?.kind !== undefined && workingCopy.kind !== "agent_files") throw new NativeRuntimeContextError("Unknown agent file contract");
if (!Array.isArray(context.skills)) throw new NativeRuntimeContextError("input.runtimeContext.skills must be an array");
const skills = context.skills.map((value, index) => {
const skill = object(value, `input.runtimeContext.skills[${index}]`);
@@ -122,7 +130,15 @@ export function parseNativeRuntimeContext(value: unknown): NativeRuntimeContextS
exact(mcp, ["assignmentSetId", "digest", "bindingId"], "input.runtimeContext.mcp");
const parsed = {
prompt: { revision: PAPERCLIP_EXECUTION_PROMPT_REVISION, text: PAPERCLIP_EXECUTION_PROMPT, digest: nativeRuntimePromptDigest() },
- instructions: { entryPath: safeRelativePath(instructions.entryPath, "input.runtimeContext.instructions.entryPath"), bundle: parseAsset(instructions.bundle, "input.runtimeContext.instructions.bundle") },
+ instructions: {
+ entryPath: safeRelativePath(instructions.entryPath, "input.runtimeContext.instructions.entryPath"),
+ bundle: parseAsset(instructions.bundle, "input.runtimeContext.instructions.bundle"),
+ ...(workingCopy ? { workingCopy: {
+ ...(workingCopy.kind === "agent_files" ? { kind: "agent_files" as const } : {}),
+ rootPath: text(workingCopy.rootPath, "input.runtimeContext.instructions.workingCopy.rootPath"),
+ entryPath: safeRelativePath(workingCopy.entryPath, "input.runtimeContext.instructions.workingCopy.entryPath"),
+ } } : {}),
+ },
skills,
mcp: {
assignmentSetId: text(mcp.assignmentSetId, "input.runtimeContext.mcp.assignmentSetId"),
@@ -141,6 +157,12 @@ export function composeNativeSystemInstructions(context: NativeRuntimeContextSna
return [
context.prompt.text,
entryContent.trim(),
+ context.instructions.workingCopy?.kind === "agent_files"
+ ? `Your persistent agent directory (AGENT_HOME) is ${context.instructions.workingCopy.rootPath}. Your instruction entry is ${context.instructions.workingCopy.entryPath}, relative to that directory. All supported files and subfolders there are restored across tasks and sessions, and collected after this provider stops. Write task deliverables in the task working directory. Only changed or deleted files synchronize; the last sync wins for the same file. Temporary copies are cleaned up without retaining file history. Check the save receipt before claiming persistence.`
+ : context.instructions.workingCopy
+ ? `Your editable agent instruction file is ${context.instructions.workingCopy.rootPath}/${context.instructions.workingCopy.entryPath}. Edit this registered private copy normally. After this run stops, Paperclip saves changed content as a persistent revision if your responsible user still has permission and the baseline has not changed. Check the run's instruction-save receipt before claiming persistence. Conflicts are preserved for explicit resolution. Repository instruction files, skills, and this run's loaded prompt are separate and are not collected.`
+ : null,
+ // Keep this canonical suffix intact for provider-specific asset remapping.
`Read-only instruction sibling root: ${context.instructions.bundle.rootPath}`,
].filter(Boolean).join("\n\n");
}
diff --git a/packages/paperclip-runner/src/contracts/types.ts b/packages/paperclip-runner/src/contracts/types.ts
index 811e922aa10..0363782822d 100644
--- a/packages/paperclip-runner/src/contracts/types.ts
+++ b/packages/paperclip-runner/src/contracts/types.ts
@@ -28,6 +28,7 @@ export interface NativeSessionCapabilities {
typedEvents: boolean;
typedEventFamilies?: TypedEventFamilyCapability[];
steering: boolean;
+ queuedFollowUp?: boolean;
interruption: boolean;
structuredResult: boolean;
read?: boolean;
@@ -47,3 +48,9 @@ export interface NativeUserMessage {
text: string;
}
import type { TypedEventFamilyCapability } from "../provider-events.js";
+
+/** Live provider handshake; queued follow-up is distinct from active steering. */
+export interface NativeTurnControlCapabilities {
+ steering: boolean;
+ queuedFollowUp: boolean;
+}
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 47f958febd0..f1932806069 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
@@ -20,11 +20,13 @@ import { resolve } from "node:path";
import { describe, expect, it, vi } from "vitest";
import { NativeSessionProtocolIntegrityError } from "../contracts/native-session-backend.js";
-import { createCapabilityRunnerdCodexTransport } from "../live/runnerd-codex-transport.js";
+import { createCapabilityRunnerdCodexTransport, createCapabilityRunnerdProviderEnvironment } from "../live/runnerd-codex-transport.js";
+import { ACPX_CREDENTIAL_BINDING_ENV, createAcpxSidecarHostEnvironment } from "../drivers/acpx/environment.js";
import { validatePrpEvent } from "../protocol/replay-contract.js";
import { digestPaperclipSemanticContent } from "../semantic-tools/receipts.js";
import {
DurablePrpControlPlane,
+ SemanticToolNotDispatchedError,
inspectWarmRunTransition,
spawnRunner,
type RunnerProcessLaunchSpec,
@@ -533,6 +535,53 @@ it("preserves the controller-selected ACPX provider package root", () => {
expect(launches[0]!.environment.NODE_PATH).toBeUndefined();
});
+it.each([
+ ["pi", "OPENROUTER_API_KEY"],
+ ["cursor", "CURSOR_API_KEY"],
+ ["cursor", "CURSOR_AUTH_TOKEN"],
+ ["copilot", "COPILOT_GITHUB_TOKEN"],
+] as const)("preserves explicit %s %s binding through the actual runner launch boundary", (agent, key) => {
+ const launches: RunnerProcessLaunchSpec[] = [];
+ vi.stubEnv(key, "ambient-must-not-cross");
+ vi.stubEnv(ACPX_CREDENTIAL_BINDING_ENV, "ambient-forged-marker");
+ try {
+ for (const explicit of [true, false]) {
+ const environment = createCapabilityRunnerdProviderEnvironment({
+ provider: "acpx", identity, codexHome: "/fixture/home",
+ runtimeContextPath: "/fixture/context.json", hasRuntimeContext: false,
+ options: { acpxAgent: agent,
+ environment: explicit ? { [key]: "explicit-fixture-credential", [ACPX_CREDENTIAL_BINDING_ENV]: "caller-forged-marker", DATABASE_URL: "must-not-cross" } : undefined },
+ });
+ const handle = spawnRunner({
+ connection: { mode: "connect", connectUrl: "ws://127.0.0.1:43127" },
+ stateDirectory: "/tmp/paperclip-runner-test", identity,
+ ticket: "bootstrap-ticket", maxOutboxBytes: 256 * 1024, p0ReserveBytes: 64 * 1024,
+ runnerVersion: expectedRunnerVersion, runnerDigest: expectedRunnerDigest, environment,
+ processLauncher: spec => {
+ launches.push(spec);
+ return { child: { pid: 42, exitCode: null, signalCode: null, kill: () => true },
+ completion: Promise.resolve({ code: 0, signal: null, stdout: "", stderr: "" }) };
+ },
+ });
+ handle.restart("replacement-ticket");
+ for (const launch of launches.splice(0)) {
+ expect(launch.environment[key]).toBe(explicit ? "explicit-fixture-credential" : undefined);
+ const receipt = launch.environment[ACPX_CREDENTIAL_BINDING_ENV];
+ expect(receipt).toBeDefined();
+ expect(JSON.parse(receipt!)).toEqual({ schema: "paperclip.acpx_credential_binding.v1", agent,
+ sessionId: identity.normalizedSessionId, names: explicit ? [key] : [] });
+ expect(receipt).not.toContain("fixture-credential");
+ expect(launch.environment.DATABASE_URL).toBeUndefined();
+ const provider = createAcpxSidecarHostEnvironment(launch.environment, agent, identity.normalizedSessionId);
+ expect(provider[key]).toBe(explicit ? "explicit-fixture-credential" : undefined);
+ expect(provider[ACPX_CREDENTIAL_BINDING_ENV]).toBeUndefined();
+ expect(() => createAcpxSidecarHostEnvironment(launch.environment, agent, "stale-session"))
+ .toThrow("explicit matching session binding");
+ }
+ }
+ } finally { vi.unstubAllEnvs(); }
+});
+
it("preserves file-backed AWS workload identity at the runner spawn boundary", () => {
const launches: RunnerProcessLaunchSpec[] = [];
spawnRunner({
@@ -771,7 +820,9 @@ function sendMaskedJson(socket: Socket, value: unknown): void {
} else if (payload.length <= 0xffff) {
header.push(0x80 | 126, payload.length >>> 8, payload.length & 0xff);
} else {
- throw new Error("Test client frame exceeds the supported size.");
+ const length = Buffer.alloc(8);
+ length.writeBigUInt64BE(BigInt(payload.length));
+ header.push(0x80 | 127, ...length);
}
const masked = Buffer.from(payload);
for (let index = 0; index < masked.length; index += 1) {
@@ -2168,7 +2219,74 @@ describe.sequential("DurablePrpControlPlane", () => {
}
});
- it("recovers one semantic call from the durable event after a coordinator restart", async () => {
+ it("delivers a large lossless result without copying its large input into the command", async () => {
+ const root = mkdtempSync(resolve(tmpdir(), "paperclip-large-tool-result-"));
+ const content = "日本語🦀".repeat(34_000) + "END";
+ const args = { content };
+ const handler = vi.fn(async () => ({ result: { content } }));
+ const options = { stateDirectory: root, identity, expectedRunnerVersion, expectedRunnerDigest, onSemanticToolInput: handler };
+ const core = new DurablePrpControlPlane(options);
+ try {
+ await core.start();
+ const client = (await authenticate(core, core.issueBootstrapTicket()))!;
+ const event = semanticInputEvent();
+ const semantic = ((event.payload as any).payload as any).semantic_tool;
+ semantic.input = args;
+ semantic.content.digest = digestPaperclipSemanticContent(args);
+ sendSecure(client, event);
+ const frames = [await receiveSecure(client), await receiveSecure(client)];
+ const wire = frames.find((frame) => frame?.kind === "command")!.payload as any;
+ expect(wire.payload.result.content).toBe(content);
+ expect(wire.payload.input).toBeUndefined();
+ expect(wire.payload.inputDigest).toBe(digestPaperclipSemanticContent(args).slice("sha256:".length));
+ expect(Buffer.byteLength(JSON.stringify(wire))).toBeLessThan(1024 * 1024);
+ sendSecure(client, { protocol: "paperclip.runner", version: 1, kind: "command_result", payload: {
+ commandId: wire.commandId, controllerSeq: wire.controllerSeq, commandType: wire.type,
+ status: "completed", result: { status: "delivered", callId: "call-1" },
+ } });
+ await vi.waitFor(() => expect(core.store.state.commands[0]?.status).toBe("completed"));
+ expect(core.semanticToolResultsSettled()).toBe(true);
+ const savedDigest = core.store.state.commands[0]!.payload.inputDigest;
+ core.store.state.commands[0]!.payload.inputDigest = `sha256:${"0".repeat(64)}`;
+ expect(core.semanticToolResultsSettled()).toBe(false);
+ core.store.state.commands[0]!.payload.inputDigest = savedDigest;
+ const reopened = new DurablePrpControlPlane(options);
+ expect(reopened.semanticToolResultsSettled()).toBe(true);
+ await reopened.stop();
+ expect(handler).toHaveBeenCalledTimes(1);
+ client.socket.destroy();
+ } finally { await core.stop(); rmSync(root, { recursive: true, force: true }); }
+ });
+
+ it.each(["before_dispatch", "during_effect"] as const)("settles only proven pre-dispatch cancellation (%s)", async (stage) => {
+ const root = mkdtempSync(resolve(tmpdir(), "paperclip-tool-dispatch-boundary-"));
+ const handler = vi.fn(async () => {
+ if (stage === "before_dispatch") throw new SemanticToolNotDispatchedError();
+ throw new Error("connection lost after possibly committing a write");
+ });
+ const core = new DurablePrpControlPlane({ stateDirectory: root, identity,
+ expectedRunnerVersion, expectedRunnerDigest, onSemanticToolInput: handler });
+ try {
+ await core.start();
+ const client = (await authenticate(core, core.issueBootstrapTicket()))!;
+ sendSecure(client, semanticInputEvent());
+ await receiveSecure(client);
+ await vi.waitFor(() => expect(handler).toHaveBeenCalledTimes(1));
+ if (stage === "before_dispatch") {
+ await vi.waitFor(() => expect(core.store.state.commands).toHaveLength(1));
+ expect(core.store.state.commands[0]).toMatchObject({ type: "semantic_tool.result", payload: {
+ callId: "call-1", isError: true, result: { error: { code: "semantic_tool_not_dispatched" } },
+ } });
+ } else {
+ await vi.waitFor(() => expect(core.semanticToolSettlementDiagnostics()).toMatchObject({ persistenceFailed: true }));
+ expect(core.store.state.commands).toEqual([]);
+ }
+ expect(core.semanticToolResultsSettled()).toBe(false);
+ client.socket.destroy();
+ } finally { await core.stop(); rmSync(root, { recursive: true, force: true }); }
+ });
+
+ it("retains an uncertain semantic outcome without redispatching after a coordinator restart", async () => {
const root = mkdtempSync(resolve(tmpdir(), "paperclip-prp-recovery-"));
let firstCalls = 0;
const first = new DurablePrpControlPlane({
@@ -2216,22 +2334,13 @@ describe.sequential("DurablePrpControlPlane", () => {
await recovered.start();
const client = await authenticate(recovered, leaseToken!);
sendSecure(client!, semanticInputEvent());
- const outcomes = [
- await receiveSecure(client!),
- await receiveSecure(client!),
- ];
- const command = outcomes.find((outcome) => outcome?.kind === "command");
- expect(outcomes.some((outcome) => outcome?.kind === "ack")).toBe(true);
- expect(command?.payload).toMatchObject({
- type: "semantic_tool.result",
- payload: {
- callId: "call-1",
- operationId: "get_task_context",
- result: { ok: true, operationId: "get_task_context" },
- isError: false,
- },
+ await expect(receiveSecure(client!)).resolves.toMatchObject({ kind: "ack" });
+ expect(recoveredCalls).toBe(0);
+ expect(recovered.semanticToolResultsSettled()).toBe(false);
+ expect(recovered.semanticToolSettlementDiagnostics()).toMatchObject({
+ pending: [{ callId: "call-1", operationId: "get_task_context" }], deliveries: [],
});
- expect(recoveredCalls).toBe(1);
+ expect(recovered.store.state.commands.filter((entry) => entry.type === "semantic_tool.result")).toEqual([]);
const tampered = semanticInputEvent(2);
const tamperedEvent = tampered.payload as Record;
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 5e4d9631f9a..62f1d6207b4 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
@@ -29,6 +29,7 @@ import type { Duplex } from "node:stream";
import { fileURLToPath } from "node:url";
import { NativeSessionProtocolIntegrityError } from "../contracts/native-session-backend.js";
+import { ACPX_CREDENTIAL_BINDING_ENV, ACPX_CREDENTIAL_NAMES } from "../drivers/acpx/environment.js";
import { githubCredentialEnvironment } from "../github-credential-environment.js";
import {
validatePrpEvent,
@@ -51,13 +52,14 @@ const coreStateSchema = "paperclip.runner.durable.control-plane-state.v1";
const transitionCoreStateSchema =
"paperclip.runner.durable.control-plane-state.warm-transition.v1";
const maxFrameBytes = 1024 * 1024;
-const maxCommandBytes = maxFrameBytes - 4 * 1024;
+// Secure frames hex-encode ciphertext. Reserve envelope/tag space as well.
+const maxCommandBytes = Math.floor((maxFrameBytes - 4 * 1024) / 2);
const maxCommands = 500;
// A provider can emit several 100-event runner batches before the transport's
// polling turn regains the event loop. Match the transport's explicit deferred
// event bound so a valid burst is not compacted before it can be observed.
const maxCommittedEventWindow = 4_096;
-const maxStateBytes = 192 * 1024 * 1024;
+const maxStateBytes = 256 * 1024 * 1024;
const authChallengeTtlMs = 5_000;
const stableIdPattern = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,239}$/;
const runnerDigestPattern = /^sha256:[0-9a-f]{64}$/;
@@ -223,6 +225,13 @@ interface SecureChannel {
sessionId: string;
}
+/** Only the dispatch boundary may assert that no business operation started. */
+export class SemanticToolNotDispatchedError extends Error {
+ constructor() {
+ super("semantic_tool_not_dispatched");
+ }
+}
+
export interface DurablePrpControlPlaneOptions {
stateDirectory: string;
identity: DurableRecoveryIdentity;
@@ -585,7 +594,11 @@ function unsettledSemanticInput(
command.payload.sourceEventType !== event.eventType ||
canonicalJson(command.payload.correlation) !==
canonicalJson(expectedCorrelation) ||
- canonicalJson(command.payload.input) !== canonicalJson(semantic.input)
+ (command.payload.inputDigest === undefined
+ ? canonicalJson(command.payload.input) !== canonicalJson(semantic.input)
+ : command.payload.inputDigest !== canonicalDigest(semantic.input)
+ || (command.payload.input !== undefined
+ && canonicalJson(command.payload.input) !== canonicalJson(semantic.input)))
);
} catch {
// Malformed retained evidence cannot establish settled authority, and
@@ -1621,6 +1634,35 @@ export class DurablePrpControlPlane {
);
}
+ /** Safe run-log evidence: identities and delivery state, never tool contents. */
+ semanticToolSettlementDiagnostics(): Record {
+ const pending = this.#store.state.committedEvents.filter((event) =>
+ unsettledSemanticInput(event, this.#store.state),
+ );
+ return {
+ persistenceFailed: this.#semanticResultPersistenceFailed,
+ pending: pending.map((entry) => {
+ const event = entry.envelope.payload as Record;
+ const payload = event.payload as Record;
+ const tool = payload.semantic_tool as Record;
+ return {
+ sourceEventId: entry.sourceEventId,
+ callId: tool.callId,
+ operationId: tool.operationId,
+ inputDigest: canonicalDigest(tool.input),
+ };
+ }),
+ deliveries: this.#store.state.commands
+ .filter((command) => command.type === "semantic_tool.result" && command.status !== "completed")
+ .map((command) => ({
+ commandId: command.commandId,
+ callId: command.payload.callId,
+ operationId: command.payload.operationId,
+ status: command.status,
+ })),
+ };
+ }
+
/**
* Atomically advances a settled reusable runner to a new run authority while
* retaining its existing connection lease secret. The runner performs the
@@ -3214,13 +3256,21 @@ export class DurablePrpControlPlane {
const alreadyQueued = this.#store.state.commands.some(
(command) => command.commandId === commandId,
);
- if (!alreadyQueued && !this.#pendingSemanticCalls.has(commandId)) {
+ // A committed input without a result after restart may already have
+ // changed the outside world. Never redispatch it on event replay. Only
+ // the original admitted callback may publish its result; missing outcome
+ // evidence stays pending for authoritative reconciliation.
+ if (existing === undefined && !alreadyQueued && !this.#pendingSemanticCalls.has(commandId)) {
this.#pendingSemanticCalls.add(commandId);
const queueResult = (result: unknown, isError: boolean): void => {
try {
+ // Retain the full input once in its canonical event. Copying a
+ // large write into its result command can exceed the wire bound
+ // after the write has already committed. Bind it by exact digest.
+ const { input, ...metadata } = call;
this.queueCommand(
"semantic_tool.result",
- { ...call, result, isError },
+ { ...metadata, inputDigest: canonicalDigest(input), result, isError },
commandId,
true,
);
@@ -3236,9 +3286,20 @@ export class DurablePrpControlPlane {
.then((outcome) =>
queueResult(outcome.result, outcome.isError === true),
)
- .catch(() =>
- queueResult({ code: "semantic_tool_bridge_failed" }, true),
- )
+ .catch((error: unknown) => {
+ if (error instanceof SemanticToolNotDispatchedError) {
+ queueResult({ error: {
+ code: "semantic_tool_not_dispatched",
+ retryable: false,
+ message: "The turn stopped before this operation was dispatched.",
+ } }, true);
+ return;
+ }
+ // A rejected dispatcher promise does not prove that its effect
+ // rolled back. Do not fabricate a final failure or retry the write.
+ this.#semanticResultPersistenceFailed = true;
+ this.disconnectActiveRunner();
+ })
.finally(() => this.#pendingSemanticCalls.delete(commandId));
}
}
@@ -3277,7 +3338,10 @@ const runnerPlatformEnvironmentKeys = [
] as const;
const runnerExplicitProviderEnvironmentKeys = [
- "OPENROUTER_API_KEY",
+ ...ACPX_CREDENTIAL_NAMES.pi,
+ ...ACPX_CREDENTIAL_NAMES.cursor,
+ ...ACPX_CREDENTIAL_NAMES.copilot,
+ ACPX_CREDENTIAL_BINDING_ENV,
"ANTHROPIC_API_KEY",
"CLAUDE_CODE_OAUTH_TOKEN",
"OPENAI_API_KEY",
diff --git a/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.test.ts b/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.test.ts
new file mode 100644
index 00000000000..07fdbc4c3ed
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from "vitest";
+import type { AcpPermissionRequest } from "acpx/runtime";
+import { normalizeAcpxPermission } from "./acp-permission-adapter.js";
+
+function request(kinds = ["allow_once", "allow_always", "reject_once"]): AcpPermissionRequest {
+ return { sessionId: "session", inferredKind: "edit", raw: {
+ sessionId: "session", toolCall: { toolCallId: "call", title: "Edit source" },
+ options: kinds.map((kind, i) => ({ kind, optionId: `option-${i}`, name: kind })),
+ } } as AcpPermissionRequest;
+}
+describe("ACP permission normalization", () => {
+ it("keeps requests answerable when a provider omits its operation title", () => {
+ for (const title of [undefined, "", " "]) {
+ const value = request();
+ value.raw.toolCall.title = title;
+ expect(normalizeAcpxPermission(value).title).toBe("Approve provider operation");
+ }
+ });
+ it("offers only native choices and preserves cancellation", () => {
+ const value = normalizeAcpxPermission(request(["allow_once"]));
+ expect(value.choices.map(c => c.key)).toEqual(["accept", "cancel"]);
+ expect(value.resolve({ action: "accept" })).toEqual({ outcome: "allow_once" });
+ expect(value.resolve({ action: "cancel" })).toEqual({ outcome: "cancel" });
+ expect(() => value.resolve({ action: "accept_for_session" })).toThrow("offered choice");
+ expect(() => value.resolve({ action: "submit", content: { accept: true } })).toThrow("offered choice");
+ });
+ it("maps once, session and denial distinctly", () => {
+ const value = normalizeAcpxPermission(request(), { allowAlwaysScope: "session" });
+ expect(value.resolve({ action: "accept_for_session" })).toEqual({ outcome: "allow_always" });
+ expect(value.resolve({ action: "decline" })).toEqual({ outcome: "reject_once" });
+ });
+ it("does not label an unverified persistent allowance as session-only", () => {
+ const value = normalizeAcpxPermission(request());
+ expect(value.choices.map(choice => choice.key)).toEqual(["accept", "decline", "cancel"]);
+ expect(() => value.resolve({ action: "accept_for_session" })).toThrow("offered choice");
+ });
+ it("does not turn a one-time denial into permanent rejection", () => {
+ expect(normalizeAcpxPermission(request(["reject_always"])).choices).toEqual([{ key: "cancel", label: "Cancel" }]);
+ });
+ it("rejects ambiguous provider choices before any resolution", () => {
+ expect(() => normalizeAcpxPermission(request(["allow_once", "allow_once"]))).toThrow("ambiguous");
+ const duplicate = request(); duplicate.raw.options[1]!.optionId = duplicate.raw.options[0]!.optionId;
+ expect(() => normalizeAcpxPermission(duplicate)).toThrow("ambiguous");
+ });
+});
diff --git a/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.ts b/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.ts
new file mode 100644
index 00000000000..6eac1f3c6ec
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/acp-permission-adapter.ts
@@ -0,0 +1,63 @@
+import type { AcpPermissionDecision, AcpPermissionRequest } from "acpx/runtime";
+import type { HarnessRuntimeRequestResolution } from "../../contracts/harness-driver.js";
+
+export type AcpxPermissionAction = "accept" | "accept_for_session" | "decline" | "cancel";
+export interface NormalizedAcpxPermission {
+ title: string;
+ kind: string;
+ toolCallId: string;
+ choices: Array<{ key: AcpxPermissionAction; label: string }>;
+ resolve(resolution: HarnessRuntimeRequestResolution): AcpPermissionDecision;
+}
+
+/** Provider options describe choices, never authority to execute an operation. */
+export function normalizeAcpxPermission(request: AcpPermissionRequest, options: { allowAlwaysScope?: "session" } = {}): NormalizedAcpxPermission {
+ const raw = request.raw;
+ if (!raw || !Array.isArray(raw.options) || raw.options.length > 32) {
+ throw new Error("ACP permission request has invalid options");
+ }
+ const byKind = new Map();
+ const ids = new Set();
+ for (const option of raw.options) {
+ if (!option || !["allow_once", "allow_always", "reject_once", "reject_always"].includes(option.kind)
+ || typeof option.optionId !== "string" || !option.optionId || option.optionId.length > 160
+ || typeof option.name !== "string" || !option.name || option.name.length > 500
+ || ids.has(option.optionId) || byKind.has(option.kind)) {
+ // ACPX resolves by kind. Ambiguous kinds must not select a different option.
+ throw new Error("ACP permission request has ambiguous or unsupported options");
+ }
+ ids.add(option.optionId);
+ byKind.set(option.kind, { optionId: option.optionId, name: option.name });
+ }
+ const bindings = new Map();
+ const choices: NormalizedAcpxPermission["choices"] = [];
+ for (const [key, kind, label] of [
+ ["accept", "allow_once", "Allow once"],
+ ["accept_for_session", "allow_always", "Allow for session"],
+ ["decline", "reject_once", "Deny"],
+ ] as const) {
+ if (kind === "allow_always" && options.allowAlwaysScope !== "session") continue;
+ if (byKind.has(kind)) { bindings.set(key, kind); choices.push({ key, label }); }
+ }
+ // A permanent rejection is not silently substituted for a one-time denial.
+ bindings.set("cancel", "cancel");
+ choices.push({ key: "cancel", label: "Cancel" });
+ const call = raw.toolCall;
+ if (!call || typeof call.toolCallId !== "string" || !call.toolCallId || call.toolCallId.length > 240) {
+ throw new Error("ACP permission request omitted its tool identity");
+ }
+ return {
+ title: typeof call.title === "string" && call.title.trim()
+ ? call.title.slice(0, 4_000) : "Approve provider operation",
+ kind: request.inferredKind ?? "other",
+ toolCallId: call.toolCallId,
+ choices,
+ resolve(resolution) {
+ const outcome = bindings.get(resolution.action as AcpxPermissionAction);
+ if (!outcome || "answers" in resolution || "content" in resolution || "response" in resolution) {
+ throw new Error("ACP permission resolution is not an offered choice");
+ }
+ return { outcome } as AcpPermissionDecision;
+ },
+ };
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts
new file mode 100644
index 00000000000..4a70c22e25b
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts
@@ -0,0 +1,67 @@
+import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
+
+export interface AcpxCapabilityProfile {
+ readonly displayName: string;
+ readonly qualification: "qualified" | "pending";
+ readonly models: "explicit-provider-verified" | "exact-qualified";
+ readonly permissions: "runner-policy" | "interactive";
+ readonly questions: "form" | "cursor-extension" | "not-exposed";
+ readonly plans: "native" | "cursor-decision" | "semantic-only";
+ readonly tools: "authenticated-mcp" | "owned-extension";
+ readonly recovery: "session-load" | "unverified";
+ readonly usage: "reported" | "unverified";
+ readonly steering: "unsupported" | "owned-extension-pending";
+ readonly followUp: "controller-queue" | "owned-extension-pending";
+ readonly artifacts: "policy_disabled" | "references-pending";
+ readonly extensionRequests: readonly string[];
+ readonly extensionNotifications: readonly string[];
+}
+
+/** These are runner integration claims, not a proxy for everything a harness can do. */
+export const ACPX_CAPABILITY_PROFILES: Readonly> = {
+ claude: {
+ displayName: "Claude", qualification: "qualified", models: "explicit-provider-verified",
+ permissions: "interactive", questions: "form", plans: "native", tools: "authenticated-mcp",
+ recovery: "session-load", usage: "reported", steering: "unsupported", followUp: "controller-queue",
+ artifacts: "policy_disabled", extensionRequests: [], extensionNotifications: [],
+ },
+ codex: {
+ displayName: "Codex", qualification: "qualified", models: "exact-qualified",
+ permissions: "runner-policy", questions: "form", plans: "native", tools: "authenticated-mcp",
+ recovery: "session-load", usage: "reported", steering: "unsupported", followUp: "controller-queue",
+ artifacts: "policy_disabled", extensionRequests: [], extensionNotifications: [],
+ },
+ grok: {
+ displayName: "Grok Build", qualification: "qualified", models: "explicit-provider-verified",
+ permissions: "interactive", questions: "form", plans: "native", tools: "authenticated-mcp",
+ recovery: "session-load", usage: "unverified", steering: "unsupported", followUp: "controller-queue",
+ artifacts: "policy_disabled", extensionRequests: [], extensionNotifications: [],
+ },
+ cursor: {
+ displayName: "Cursor", qualification: "pending", models: "explicit-provider-verified",
+ permissions: "interactive", questions: "cursor-extension", plans: "cursor-decision", tools: "authenticated-mcp",
+ recovery: "session-load", usage: "unverified", steering: "unsupported", followUp: "controller-queue",
+ artifacts: "references-pending",
+ extensionRequests: ["cursor/ask_question", "cursor/create_plan", "cursor/update_todos", "cursor/task", "cursor/generate_image"],
+ extensionNotifications: ["cursor/update_todos", "cursor/task", "cursor/generate_image"],
+ },
+ copilot: {
+ displayName: "GitHub Copilot", qualification: "pending", models: "explicit-provider-verified",
+ permissions: "interactive", questions: "not-exposed", plans: "native", tools: "authenticated-mcp",
+ recovery: "session-load", usage: "reported", steering: "unsupported", followUp: "controller-queue",
+ artifacts: "references-pending", extensionRequests: [],
+ extensionNotifications: ["github.com/copilot/sessionEvent"],
+ },
+ pi: {
+ displayName: "Pi", qualification: "pending", models: "exact-qualified",
+ permissions: "interactive", questions: "form", plans: "semantic-only", tools: "owned-extension",
+ recovery: "session-load", usage: "reported", steering: "owned-extension-pending", followUp: "owned-extension-pending",
+ artifacts: "references-pending", extensionRequests: [], extensionNotifications: [],
+ },
+};
+for (const profile of Object.values(ACPX_CAPABILITY_PROFILES)) {
+ Object.freeze(profile.extensionRequests);
+ Object.freeze(profile.extensionNotifications);
+ Object.freeze(profile);
+}
+Object.freeze(ACPX_CAPABILITY_PROFILES);
diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.test.ts b/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.test.ts
index 077249018b9..8bdc507d8a1 100644
--- a/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.test.ts
@@ -14,6 +14,7 @@ import {
type CodexAcpxDriverOptions,
} from "./codex-acpx-driver.js";
import type {
+ AcpxRuntimeSteeringCapability,
AcpxRuntimeTurnInput,
AcpxRuntimeTurn,
OpenAcpxRuntimeHostOptions,
@@ -21,6 +22,47 @@ import type {
import type { AcpxRecoveryWorkspaceLease } from "./runtime-sandbox.js";
describe("Codex ACPX harness driver", () => {
+ it("delivers negotiated steering and follow-up distinctly, once, for the active turn", async () => {
+ const fixture = driverFixture({ agent: "pi", model: "openrouter/deepseek/deepseek-v4-flash-0731", providerPolicy: { readOnly: true } });
+ fixture.host.steeringCapability.mockReturnValue({ steering: true, queuedFollowUp: true });
+ const session = await fixture.driver.openSession({ runId: "run-controls", normalizedSessionId: "session-1", workingDirectory: "/workspace" });
+ expect(fixture.hostOptions?.providerPolicy).toEqual({ readOnly: true });
+ expect(session.turnControlCapabilities?.()).toEqual({ steering: true, queuedFollowUp: true });
+ const { turnId } = await session.startTurn({ message: { text: "Work" } });
+ const turnInput = fixture.host.startTurn.mock.calls[0]![0];
+ const context = { requestId: 0, signal: new AbortController().signal };
+ await expect(turnInput.onExtensionRequest!("provider/request", { sessionId: "agent-1" }, context)).rejects.toThrow(/session mismatch/);
+ await expect(turnInput.onExtensionRequest!("provider/request", { sessionId: "backend-1" }, context)).rejects.toThrow(/adapter is unavailable/);
+ await session.steer!({ turnId, correlationId: "control-1", message: { text: "Change focus" } });
+ await session.steer!({ turnId, correlationId: "control-2", mode: "follow_up", message: { text: "Then validate" } });
+ expect(fixture.host.steerActiveTurn).toHaveBeenCalledExactlyOnceWith("Change focus", `run-controls:${turnId}`);
+ expect(fixture.host.queueFollowUp).toHaveBeenCalledExactlyOnceWith("Then validate", `run-controls:${turnId}`);
+ expect(fixture.host.interruptActiveTurn).not.toHaveBeenCalled();
+ await expect(session.steer!({ turnId, correlationId: "control-2", message: { text: "Duplicate" } })).rejects.toThrow(/already attempted/);
+ await expect(session.steer!({ turnId: "wrong-turn", message: { text: "Stale" } })).rejects.toThrow();
+ fixture.finishTurn({ status: "completed" });
+ const events = await collectUntil(session.events(), "turn.completed");
+ expect(events.filter(event => event.payload.kind === "steering_acknowledgement").map(event => event.payload.mode)).toEqual(["steer", "follow_up"]);
+ for (const event of events) expect(validatePrpEvent(event).ok).toBe(true);
+ await expect(session.steer!({ turnId, message: { text: "Already settled" } })).rejects.toThrow();
+ await session.close({ reason: "controls verified" });
+ });
+
+ it("rejects unnegotiated controls and retains ambiguous delivery attempts", async () => {
+ const fixture = driverFixture({ agent: "pi", model: "openrouter/deepseek/deepseek-v4-flash-0731", providerPolicy: { readOnly: true } });
+ const session = await fixture.driver.openSession({ runId: "run-controls", normalizedSessionId: "session-1", workingDirectory: "/workspace" });
+ const { turnId } = await session.startTurn({ message: { text: "Work" } });
+ await expect(session.steer!({ turnId, message: { text: "No handshake" } })).rejects.toThrow(/did not negotiate/);
+ expect(fixture.host.steerActiveTurn).not.toHaveBeenCalled();
+ fixture.host.steeringCapability.mockReturnValue({ steering: true, queuedFollowUp: false });
+ fixture.host.steerActiveTurn.mockRejectedValueOnce(new Error("delivery acknowledgement lost"));
+ const input = { turnId, correlationId: "ambiguous", message: { text: "Maybe delivered" } };
+ await expect(session.steer!(input)).rejects.toThrow(/acknowledgement lost/);
+ await expect(session.steer!(input)).rejects.toThrow(/already attempted/);
+ expect(fixture.host.steerActiveTurn).toHaveBeenCalledOnce();
+ await session.close({ reason: "ambiguous control verified" });
+ });
+
it.each([
["claude", "claude-sonnet-5"], ["codex", "gpt-5.6-sol"],
] as const)("launches %s in full auto when no mode is supplied", async (agent, model) => {
@@ -1459,6 +1501,73 @@ describe("Codex ACPX harness driver", () => {
});
});
+ it("delivers only offered permission choices and rejects stale or duplicate answers", async () => {
+ const fixture = driverFixture({ agent: "claude", model: "claude-sonnet-5" });
+ const session = await fixture.driver.openSession({
+ runId: "run-permission", normalizedSessionId: "session-1", workingDirectory: "/workspace",
+ });
+ const created = collectUntil(session.events(), "runtime_request.created");
+ const { turnId } = await session.startTurn({ message: { role: "user", text: "Run validation." } });
+ const callback = fixture.host.startTurn.mock.calls[0]![0].onPermissionRequest!;
+ const response = callback({
+ inferredKind: "execute", raw: {
+ sessionId: "agent-session-1", toolCall: { toolCallId: "tool-permission", title: "Run validation" },
+ options: [{ optionId: "once", kind: "allow_once", name: "Allow once" }],
+ },
+ } as Parameters[0], { signal: new AbortController().signal, responseDelivery: Promise.resolve() });
+ const events = await created;
+ const request = session.pendingRuntimeRequests!()[0]!;
+ expect(events.at(-1)?.payload).toMatchObject({ request: {
+ type: "permission", choices: [{ key: "accept" }, { key: "cancel" }],
+ origin: { method: "session/request_permission" },
+ } });
+ await expect(session.resolveRuntimeRequest!({ requestId: request.requestId, turnId: "old-turn",
+ resolution: { action: "accept" } })).rejects.toThrow();
+ await expect(session.resolveRuntimeRequest!({ requestId: request.requestId, turnId,
+ resolution: { action: "accept_for_session" } })).rejects.toThrow("offered choice");
+ expect(session.pendingRuntimeRequests!()).toHaveLength(1);
+ await session.resolveRuntimeRequest!({ requestId: request.requestId, turnId, resolution: { action: "accept" } });
+ await expect(response).resolves.toEqual({ outcome: "allow_once" });
+ await expect(session.resolveRuntimeRequest!({ requestId: request.requestId, turnId,
+ resolution: { action: "accept" } })).rejects.toThrow("no longer pending");
+ fixture.finishTurn({ status: "completed", stopReason: "end_turn" });
+ await collectUntil(session.events(), "turn.completed");
+ await session.close({ reason: "permission verified" });
+ });
+
+ it.each(["written", "failed"] as const)("waits for the exact provider permission reply receipt: %s", async outcome => {
+ const fixture = driverFixture({ agent: "copilot", model: "explicit-test-model", providerPolicy: { readOnly: false } });
+ const session = await fixture.driver.openSession({ runId: "run-receipt", normalizedSessionId: "session-1", workingDirectory: "/workspace" });
+ const created = collectUntil(session.events(), "runtime_request.created");
+ const { turnId } = await session.startTurn({ message: { role: "user", text: "Approve with receipt." } });
+ const callback = fixture.host.startTurn.mock.calls[0]![0].onPermissionRequest!;
+ const receipt = deferred();
+ const providerResponse = callback({ inferredKind: "execute", raw: {
+ sessionId: "agent-session-1", toolCall: { toolCallId: "receipt-tool", title: "Run validation" },
+ options: [{ optionId: "session", kind: "allow_always", name: "Allow for session" }],
+ } } as Parameters[0], { signal: new AbortController().signal, responseDelivery: receipt.promise });
+ await created;
+ const request = session.pendingRuntimeRequests!()[0]!;
+ expect(request.details).toMatchObject({ choices: [{ key: "accept_for_session" }, { key: "cancel" }] });
+ let acknowledged = false;
+ const emitted = collectUntil(session.events(), outcome === "written" ? "runtime_request.resolved" : "runtime_request.expired");
+ const resolution = session.resolveRuntimeRequest!({ requestId: request.requestId, turnId, resolution: { action: "accept_for_session" } })
+ .then(() => { acknowledged = true; });
+ await expect(providerResponse).resolves.toEqual({ outcome: "allow_always" });
+ expect(acknowledged).toBe(false);
+ if (outcome === "written") { receipt.resolve(); await resolution; }
+ else {
+ const rejected = expect(resolution).rejects.toThrow("pipe failed");
+ receipt.reject(new Error("pipe failed")); await rejected;
+ }
+ const events = await emitted;
+ expect(events.filter(event => event.eventType === "runtime_request.resolved")).toHaveLength(outcome === "written" ? 1 : 0);
+ if (outcome === "failed") expect(events.at(-1)?.payload).toMatchObject({ replayAllowed: false, reason: "response_delivery_failed" });
+ expect(session.pendingRuntimeRequests!()).toHaveLength(0);
+ if (outcome === "written") fixture.finishTurn({ status: "completed", stopReason: "end_turn" });
+ await session.close({ reason: "receipt checked" });
+ });
+
it("round-trips a provider-neutral ACP form through the runtime request boundary", async () => {
const fixture = driverFixture();
const session = await fixture.driver.openSession({
@@ -1493,7 +1602,7 @@ describe("Codex ACPX harness driver", () => {
},
},
},
- { requestId: "rpc-question-1", signal: controller.signal },
+ { requestId: "rpc-question-1", signal: controller.signal, responseDelivery: Promise.resolve() },
);
const events = await createdEvent;
const request = session.pendingRuntimeRequests!()[0]!;
@@ -1575,7 +1684,7 @@ describe("Codex ACPX harness driver", () => {
},
{
requestId: "rpc-question-created-pressure",
- signal: new AbortController().signal,
+ signal: new AbortController().signal, responseDelivery: Promise.resolve(),
},
),
).resolves.toEqual({ action: "cancel" });
@@ -1609,7 +1718,7 @@ describe("Codex ACPX harness driver", () => {
properties: { value: { type: "string" } },
},
},
- { requestId: "rpc-question-abort", signal: controller.signal },
+ { requestId: "rpc-question-abort", signal: controller.signal, responseDelivery: Promise.resolve() },
);
await createdEvent;
const cancelledEvent = collectUntil(
@@ -1658,7 +1767,7 @@ describe("Codex ACPX harness driver", () => {
},
{
requestId: "rpc-question-stream-failure",
- signal: new AbortController().signal,
+ signal: new AbortController().signal, responseDelivery: Promise.resolve(),
},
);
await vi.waitFor(() => {
@@ -1704,7 +1813,7 @@ describe("Codex ACPX harness driver", () => {
},
{
requestId: "rpc-question-handoff",
- signal: new AbortController().signal,
+ signal: new AbortController().signal, responseDelivery: Promise.resolve(),
},
);
await createdEvent;
@@ -1772,7 +1881,7 @@ describe("Codex ACPX harness driver", () => {
},
{
requestId: "rpc-question-handoff-pressure",
- signal: new AbortController().signal,
+ signal: new AbortController().signal, responseDelivery: Promise.resolve(),
},
);
await vi.waitFor(() => {
@@ -2724,6 +2833,9 @@ function fakeHost(createTurn: () => AcpxRuntimeTurn, onClose: () => void) {
},
})),
startTurn: vi.fn((_input: AcpxRuntimeTurnInput) => createTurn()),
+ steeringCapability: vi.fn<() => AcpxRuntimeSteeringCapability | null>(() => null),
+ steerActiveTurn: vi.fn(async (_text: string, _requestId?: string) => undefined),
+ queueFollowUp: vi.fn(async (_text: string, _requestId?: string) => undefined),
interruptActiveTurn: vi.fn(async () => undefined),
close: vi.fn(async () => {
onClose();
diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.ts b/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.ts
index 065b72d66d9..6647d1555ff 100644
--- a/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/codex-acpx-driver.ts
@@ -1,3 +1,5 @@
+import { requireAcpxResponseDelivery } from "./response-delivery.js";
+import { acpxProfileClientCapabilities, bindAcpxExtensionTurn, validateAcpxRichEvent, createAcpxProfileExtensionAdapter, type AcpxExtensionInput } from "./profile-extensions.js";
import { createHash, randomBytes } from "node:crypto";
import type {
@@ -5,6 +7,8 @@ import type {
AcpElicitationRequest,
AcpElicitationResponse,
AcpRuntimeEvent,
+ AcpPermissionRequest,
+ AcpPermissionDecision,
} from "acpx/runtime";
import {
@@ -52,12 +56,14 @@ import {
DEFAULT_CODEX_ACPX_RUNTIME_SHUTDOWN_BOUND_MS,
openCodexAcpxRuntime,
} from "./codex-runtime-adapter.js";
+import { normalizeAcpxPermission } from "./acp-permission-adapter.js";
import {
normalizeAcpFormElicitation,
type NormalizedAcpForm,
} from "./acp-question-adapter.js";
import {
acpxDriverDescriptor,
+ acpxCapabilities,
validateAcpxDriverConfig,
} from "./driver-profile.js";
import {
@@ -76,6 +82,9 @@ import {
type AcpxRecoveryWorkspaceLease,
} from "./runtime-sandbox.js";
+import { AcpxTurnControlLedger, parseAcpxTurnControl, type AcpxTurnControlMode } from "./turn-controls.js";
+import { acpxUsageEstimateNotice, persistedAcpxTurnUsage } from "./usage-accounting.js";
+
const MAX_BUFFERED_EVENTS = 512;
const TERMINAL_EVENT_RESERVE = 3;
const TURN_START_EVENT_COUNT = 3;
@@ -109,8 +118,9 @@ const QUARANTINED_HOST_ADMISSION_GRACE_MS =
interface PendingAcpxRuntimeRequest {
request: HarnessRuntimeRequest;
- normalized: NormalizedAcpForm;
- settle(response: AcpElicitationResponse): void;
+ responseDelivery: Promise;
+ prepareResolution(resolution: HarnessRuntimeRequestResolution): () => void;
+ cancel(): void;
cleanup(): void;
settling: boolean;
}
@@ -130,6 +140,7 @@ export interface CodexAcpxDriverOptions {
runtimeDirectory: string;
model: string;
permissionMode?: NativeAcpxPermissionMode;
+ providerPolicy?: { readOnly: boolean };
systemInstructions?: string;
environment?: NodeJS.ProcessEnv;
managedCodexCredentialSourcePath?: string;
@@ -147,6 +158,9 @@ interface CodexAcpxHost {
startTurn(
input: Parameters[0],
): AcpxRuntimeTurn;
+ steeringCapability?: AcpxRuntimeHost["steeringCapability"];
+ steerActiveTurn?: AcpxRuntimeHost["steerActiveTurn"];
+ queueFollowUp?: AcpxRuntimeHost["queueFollowUp"];
interruptActiveTurn(reason: string): Promise;
close(input: { reason: string }): Promise;
}
@@ -200,6 +214,7 @@ export async function probeQualifiedAcpxEnvironment(
agent: options.agent,
model: options.model,
permissionMode: "deny-all",
+ providerPolicy: { readOnly: true },
systemInstructions:
"Paperclip Runner environment qualification probe. Do not execute a provider turn.",
...(options.environment === undefined
@@ -259,14 +274,13 @@ export class CodexAcpxDriver implements HarnessDriver {
options: CodexAcpxDriverOptions,
dependencies: CodexAcpxDriverDependencies = {},
) {
- if (options.agent === "pi") {
- throw new Error(
- "Pi ACPX driver is unavailable until descriptor-confined verified launch is implemented",
- );
+ if (["pi", "cursor", "copilot"].includes(options.agent ?? "codex") && typeof options.providerPolicy?.readOnly !== "boolean") {
+ throw new Error("ACP candidate requires an explicit provider read-only policy");
}
this.#options = {
...options,
agent: options.agent ?? "codex",
+ ...(options.providerPolicy ? { providerPolicy: { readOnly: options.providerPolicy.readOnly } } : {}),
...(options.environment
? { environment: { ...options.environment } }
: {}),
@@ -303,7 +317,7 @@ export class CodexAcpxDriver implements HarnessDriver {
resume: true,
runtimeRequestResolution: true,
runtimeRequestHandoff: true,
- unsupported: ["steering", "goals", "threadLineage"],
+ unsupported: descriptor.capabilities.unsupported,
},
};
}
@@ -435,8 +449,10 @@ export class CodexAcpxDriver implements HarnessDriver {
normalizedSessionId: input.normalizedSessionId,
workingDirectory: input.workingDirectory,
agent: this.#options.agent ?? "codex",
+ clientCapabilities: acpxProfileClientCapabilities(this.#options.agent ?? "codex"),
model: this.#options.model,
permissionMode: this.#options.permissionMode ?? "approve-all",
+ providerPolicy: this.#options.providerPolicy,
systemInstructions: this.#options.systemInstructions,
environment: this.#options.environment,
managedCodexCredentialSourcePath:
@@ -761,6 +777,7 @@ class CodexAcpxSession implements HarnessSession {
payload: Record;
} | null = null;
#runtimeRequestSequence = 0;
+ readonly #turnControls = new AcpxTurnControlLedger();
constructor(input: {
host: CodexAcpxHost;
@@ -828,6 +845,11 @@ class CodexAcpxSession implements HarnessSession {
return this.#events;
}
+ turnControlCapabilities() {
+ const capability = acpxCapabilities(this.#agent, this.#host.steeringCapability?.());
+ return { steering: capability.steering, queuedFollowUp: capability.queuedFollowUp === true };
+ }
+
async startTurn(input: {
message: NativeUserMessage;
}): Promise<{ turnId: string }> {
@@ -853,16 +875,37 @@ class CodexAcpxSession implements HarnessSession {
}
const turnId = `turn-${randomBytes(12).toString("hex")}`;
this.#activeTurnId = turnId;
+ this.#turnControls.begin(turnId);
this.#assistantText = "";
this.#assistantMessageId = null;
this.#emit("turn.submitted", { text: input.message.text }, { turnId });
this.#emit("turn.accepted", { turnId }, { turnId });
this.#emit("turn.started", { status: "inProgress" }, { turnId });
+ const extensions = bindAcpxExtensionTurn({
+ adapter: createAcpxProfileExtensionAdapter(this.#agent, {
+ workspacePath: this.#input.workingDirectory, sessionId: this.#host.identity().backendSessionId, turnId,
+ }),
+ active: () => this.#activeTurnId === turnId && !this.#closingStarted,
+ sessionId: this.#host.identity().backendSessionId,
+ waitForInput: (input, context) => this.#handleExtensionInput(turnId, input, context),
+ emit: event => {
+ if (!this.#emit(event.eventType, event.payload, { turnId, itemId: event.itemId })) {
+ throw new Error("ACP rich activity could not be retained");
+ }
+ },
+ });
let turn: AcpxRuntimeTurn;
+ const usageBefore = await readUsageStatus(this.#host);
try {
+ this.#assertOpen();
+ if (this.#activeTurnId !== turnId) throw new HarnessStaleTurnError(turnId);
turn = this.#host.startTurn({
text: input.message.text,
requestId: `${safeId(this.#input.runId, "run")}:${turnId}`,
+ onExtensionRequest: extensions.onExtensionRequest,
+ onExtensionNotification: extensions.onExtensionNotification,
+ onPermissionRequest: (request, context) =>
+ this.#handlePermission(turnId, request, context),
onElicitation: (request, context) =>
this.#handleElicitation(turnId, request, context),
});
@@ -875,7 +918,7 @@ class CodexAcpxSession implements HarnessSession {
);
throw error;
}
- const pump = this.#pumpTurn(turnId, turn);
+ const pump = this.#pumpTurn(turnId, turn, extensions.drain, usageBefore);
this.#activePump = pump;
void pump
.finally(() => {
@@ -885,6 +928,25 @@ class CodexAcpxSession implements HarnessSession {
return { turnId };
}
+ async steer(input: { turnId: string; message: NativeUserMessage; correlationId?: string; mode?: AcpxTurnControlMode }): Promise {
+ this.#assertOpen();
+ if (input.turnId !== this.#activeTurnId || this.#pendingTerminal) throw new HarnessStaleTurnError(input.turnId);
+ const mode = input.mode ?? "steer";
+ const capability = this.turnControlCapabilities();
+ const operation = mode === "steer" ? this.#host.steerActiveTurn : this.#host.queueFollowUp;
+ if (!(mode === "steer" ? capability?.steering : capability?.queuedFollowUp) || !operation) {
+ throw new HarnessCapabilityUnavailableError(mode, "the ACP provider did not negotiate this turn control");
+ }
+ const control = parseAcpxTurnControl({ turnId: input.turnId, message: input.message.text, mode,
+ controlId: input.correlationId ?? `control-${randomBytes(12).toString("hex")}` });
+ this.#turnControls.reserve(control, this.#activeTurnId);
+ await operation.call(this.#host, control.message, `${safeId(this.#input.runId, "run")}:${control.turnId}`);
+ if (this.#activeTurnId !== control.turnId || this.#closingStarted) throw new HarnessStaleTurnError(control.turnId);
+ this.#emit("item.completed", { kind: "steering_acknowledgement", mode,
+ text: mode === "steer" ? "Steering acknowledged for the active turn." : "Follow-up queued after the active work.", status: "acknowledged" },
+ { turnId: control.turnId, itemId: stableId("acpx-control", `${control.turnId}:${control.controlId}`) });
+ }
+
async interrupt(input: { turnId?: string; reason?: string }): Promise {
this.#assertOpen();
if (input.turnId && input.turnId !== this.#activeTurnId) {
@@ -937,18 +999,19 @@ class CodexAcpxSession implements HarnessSession {
);
}
pending.settling = true;
+ let dispatched = false;
try {
const resolution = parseHarnessRuntimeRequestResolution(
pending.request.requestKind,
input.resolution,
pending.request.input,
);
- const providerResponse = acpElicitationResponse(
- pending.normalized,
- resolution,
- );
+ const deliver = pending.prepareResolution(resolution);
if (!this.#pendingRuntimeRequests.delete(input.requestId)) return;
pending.cleanup();
+ dispatched = true;
+ deliver();
+ await pending.responseDelivery;
this.#emit(
"runtime_request.resolved",
harnessRuntimeRequestOutcome(pending.request, {
@@ -959,9 +1022,14 @@ class CodexAcpxSession implements HarnessSession {
}),
{ turnId: input.turnId, itemId: pending.request.itemId },
);
- pending.settle(providerResponse);
} catch (error) {
- pending.settling = false;
+ if (!dispatched) { pending.settling = false; throw error; }
+ this.#emit("runtime_request.expired", {
+ ...harnessRuntimeRequestOutcome(pending.request, { reason: "response_delivery_failed" }),
+ replayAllowed: false,
+ }, { turnId: input.turnId, itemId: pending.request.itemId });
+ try { await this.close({ reason: "ACP response delivery failed" }); }
+ catch (cleanupError) { throw new AggregateError([error, cleanupError], "ACP response delivery and provider cleanup failed"); }
throw error;
}
}
@@ -1003,7 +1071,7 @@ class CodexAcpxSession implements HarnessSession {
);
}
pending.cleanup();
- pending.settle({ action: "cancel" });
+ pending.cancel();
const cleanup = Promise.resolve()
.then(() =>
this.#host.interruptActiveTurn(
@@ -1353,7 +1421,7 @@ class CodexAcpxSession implements HarnessSession {
.catch(() => undefined);
}
- async #pumpTurn(turnId: string, turn: AcpxRuntimeTurn): Promise {
+ async #pumpTurn(turnId: string, turn: AcpxRuntimeTurn, drainExtensions: () => Promise, usageBefore: unknown): Promise {
try {
let index = 0;
const normalizeToolEvent =
@@ -1364,6 +1432,13 @@ class CodexAcpxSession implements HarnessSession {
this.#mapRuntimeEvent(normalizeMessage(normalizeToolEvent(event)), turnId, ++index);
}
const result = await turn.result;
+ await drainExtensions();
+ const receipt = persistedAcpxTurnUsage(usageBefore, await readUsageStatus(this.#host), turn.requestId, this.#agent);
+ if (receipt) {
+ this.#mapRuntimeEvent(receipt as unknown as AcpRuntimeEvent, turnId, ++index);
+ const estimate = acpxUsageEstimateNotice(receipt, `${turnId}:usage-estimate`);
+ if (estimate) { validateAcpxRichEvent(estimate); this.#emit(estimate.eventType, estimate.payload, { turnId, itemId: estimate.itemId }); }
+ }
this.#cancelPendingRuntimeRequests("provider turn settled", turnId);
if (this.#terminalTurns.has(turnId)) return;
if (result.status === "completed") {
@@ -1587,6 +1662,96 @@ class CodexAcpxSession implements HarnessSession {
}
}
+ async #handleExtensionInput(
+ turnId: string,
+ input: AcpxExtensionInput,
+ context: { requestId: string | number; signal: AbortSignal; responseDelivery?: Promise },
+ ): Promise> {
+ if (this.#closed || this.#activeTurnId !== turnId || context.signal.aborted
+ || this.#pendingRuntimeRequests.size >= MAX_PENDING_RUNTIME_REQUESTS) return input.cancel();
+ const responseDelivery = requireAcpxResponseDelivery(context);
+ const requestId = stableId("acpx-request", `${turnId}:${++this.#runtimeRequestSequence}:${typeof context.requestId}:${context.requestId}`);
+ const request: HarnessRuntimeRequest = {
+ requestId, requestKind: "elicitation", method: input.method, turnId, itemId: requestId,
+ status: "pending", prompt: boundedText(input.questionSet.title ?? "Provider needs input", 1_000),
+ details: input.details ?? {}, input: structuredClone(input.questionSet),
+ origin: { adapter: "acpx-runtime", provider: this.#agent, method: input.method },
+ };
+ return await new Promise((settle) => {
+ const cancel = () => {
+ const pending = this.#pendingRuntimeRequests.get(requestId);
+ if (!pending || pending.settling || !this.#pendingRuntimeRequests.delete(requestId)) return;
+ pending.cleanup();
+ this.#emit("runtime_request.cancelled", harnessRuntimeRequestOutcome(request, {
+ action: "cancel", reason: "provider request aborted",
+ }), { turnId, itemId: requestId });
+ settle(input.cancel());
+ };
+ this.#pendingRuntimeRequests.set(requestId, {
+ request, responseDelivery,
+ prepareResolution: resolution => {
+ const response = input.resolve(resolution);
+ return () => settle(response);
+ },
+ cancel: () => settle(input.cancel()),
+ cleanup: () => context.signal.removeEventListener("abort", cancel),
+ settling: false,
+ });
+ context.signal.addEventListener("abort", cancel, { once: true });
+ if (!this.#emit("runtime_request.created", { request: runtimeInputProtocolPayload(request) },
+ { turnId, itemId: requestId }) || context.signal.aborted) cancel();
+ });
+ }
+
+ async #handlePermission(
+ turnId: string,
+ request: AcpPermissionRequest,
+ context: { signal: AbortSignal; responseDelivery?: Promise },
+ ): Promise {
+ const { signal } = context;
+ if (this.#closed || this.#activeTurnId !== turnId || signal.aborted
+ || this.#pendingRuntimeRequests.size >= MAX_PENDING_RUNTIME_REQUESTS) {
+ return { outcome: "cancel" };
+ }
+ const responseDelivery = requireAcpxResponseDelivery(context);
+ const normalized = normalizeAcpxPermission(request, ["pi", "copilot"].includes(this.#agent) ? { allowAlwaysScope: "session" } : {});
+ const requestId = stableId("acpx-permission", `${turnId}:${++this.#runtimeRequestSequence}:${normalized.toolCallId}`);
+ const runtimeRequest: HarnessRuntimeRequest = {
+ requestId, requestKind: "permission_approval", method: "session/request_permission",
+ turnId, itemId: requestId, status: "pending", prompt: normalized.title,
+ details: { choices: normalized.choices, toolCallId: normalized.toolCallId, kind: normalized.kind },
+ origin: { adapter: "acpx-runtime", provider: this.#agent, method: "session/request_permission" },
+ };
+ return await new Promise((settle) => {
+ const cancel = () => {
+ const pending = this.#pendingRuntimeRequests.get(requestId);
+ if (!pending || pending.settling || !this.#pendingRuntimeRequests.delete(requestId)) return;
+ pending.cleanup();
+ this.#emit("runtime_request.cancelled", harnessRuntimeRequestOutcome(runtimeRequest, {
+ action: "cancel", reason: "provider request aborted",
+ }), { turnId, itemId: requestId });
+ settle({ outcome: "cancel" });
+ };
+ this.#pendingRuntimeRequests.set(requestId, {
+ request: runtimeRequest, responseDelivery,
+ prepareResolution: (resolution) => {
+ const response = normalized.resolve(resolution);
+ return () => settle(response);
+ },
+ cancel: () => settle({ outcome: "cancel" }),
+ cleanup: () => signal.removeEventListener("abort", cancel),
+ settling: false,
+ });
+ signal.addEventListener("abort", cancel, { once: true });
+ if (!this.#emit("runtime_request.created", { request: {
+ schema: PAPERCLIP_RUNTIME_REQUEST_SCHEMA_V2, requestKind: "permission_approval",
+ requestId, type: "permission", status: "pending", prompt: normalized.title,
+ choices: normalized.choices, details: runtimeRequest.details,
+ origin: runtimeRequest.origin, turnId, itemId: requestId,
+ } }, { turnId, itemId: requestId }) || signal.aborted) cancel();
+ });
+ }
+
async #handleElicitation(
turnId: string,
request: AcpElicitationRequest,
@@ -1655,6 +1820,7 @@ class CodexAcpxSession implements HarnessSession {
);
return { action: "cancel" };
}
+ const responseDelivery = requireAcpxResponseDelivery(context);
const requestId = stableId(
"acpx-request",
`${turnId}:${++this.#runtimeRequestSequence}:${typeof context.requestId}:${String(context.requestId)}`,
@@ -1707,9 +1873,12 @@ class CodexAcpxSession implements HarnessSession {
};
context.signal.addEventListener("abort", cancel, { once: true });
this.#pendingRuntimeRequests.set(requestId, {
- request: runtimeRequest,
- normalized,
- settle,
+ request: runtimeRequest, responseDelivery,
+ prepareResolution: (resolution) => {
+ const response = acpElicitationResponse(normalized, resolution);
+ return () => settle(response);
+ },
+ cancel: () => settle({ action: "cancel" }),
cleanup: () => context.signal.removeEventListener("abort", cancel),
settling: false,
});
@@ -1733,7 +1902,7 @@ class CodexAcpxSession implements HarnessSession {
itemId: pending.request.itemId,
},
);
- pending.settle({ action: "cancel" });
+ pending.cancel();
}
}
@@ -2310,3 +2479,15 @@ async function settlesWithin(
if (timer) clearTimeout(timer);
}
}
+
+/** Accounting failure cannot replace the provider's terminal result. */
+async function readUsageStatus(host: CodexAcpxHost): Promise {
+ let timer: ReturnType | undefined;
+ try {
+ return await Promise.race([
+ Promise.resolve().then(() => host.status()),
+ new Promise(resolve => { timer = setTimeout(() => resolve(undefined), 1_000); timer.unref?.(); }),
+ ]);
+ } catch { return undefined; }
+ finally { if (timer) clearTimeout(timer); }
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts
index 2f4598c894e..f79a3e291e4 100644
--- a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.test.ts
@@ -28,6 +28,124 @@ const HANDLE: AcpRuntimeHandle = {
};
describe("Codex ACPX runtime adapter", () => {
+ it("rejects forged permission session identifiers before delegating or applying full-auto policy", async () => {
+ const pending = pendingExtensionTurn("turn-1");
+ const runtime = fakeRuntime(); vi.mocked(runtime.startTurn).mockReturnValue(pending.turn);
+ let created!: AcpRuntimeOptions;
+ const options = openOptions(fakeCommand());
+ const port = await openCodexAcpxRuntime(options, {
+ createRegistry: () => registry(), createStore: () => store(), createRuntime: (value) => { created = value; return runtime; },
+ });
+ const handler = vi.fn(async () => ({ outcome: "allow_once" as const }));
+ const turn = port.startTurn({ text: "Write", requestId: "turn-1", onPermissionRequest: handler });
+ const signal = new AbortController().signal;
+ for (const [sessionId, rawSessionId] of [["forged", "backend-1"], ["backend-1", "forged"]]) {
+ const request = { sessionId, raw: { sessionId: rawSessionId }, inferredKind: "edit" as const };
+ await expect(created.onPermissionRequest!(request as never, { signal })).resolves.toEqual({ outcome: "reject_once" });
+ }
+ expect(handler).not.toHaveBeenCalled();
+ const responseDelivery = Promise.resolve();
+ await expect(created.onPermissionRequest!({ sessionId: "backend-1", raw: { sessionId: "backend-1" }, inferredKind: "edit" } as never, { signal, responseDelivery })).resolves.toEqual({ outcome: "allow_once" });
+ expect(handler).toHaveBeenCalledOnce();
+ expect(handler).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ responseDelivery }));
+ options.permissionMode = "approve-all";
+ await expect(created.onPermissionRequest!({ sessionId: "forged", raw: {}, inferredKind: "edit" } as never, { signal })).resolves.toEqual({ outcome: "reject_once" });
+ pending.settle(); await turn.result; await port.close({ reason: "session checks complete" });
+ });
+ it("routes only profile-allowed extensions to the owning turn and expires late responses", async () => {
+ const runtime = fakeRuntime();
+ const first = pendingExtensionTurn("turn-1");
+ const second = pendingExtensionTurn("turn-2");
+ vi.mocked(runtime.startTurn).mockReturnValueOnce(first.turn).mockReturnValueOnce(second.turn);
+ let created!: AcpRuntimeOptions;
+ const options = openOptions(fakeCommand());
+ options.profile = { ...options.profile, agent: "cursor" };
+ options.clientCapabilities = { _meta: { cursor: { test: true } } };
+ const port = await openCodexAcpxRuntime(options, {
+ createRegistry: () => registry(), createStore: () => store(),
+ createRuntime: (value) => { created = value; return runtime; },
+ });
+ expect(created.clientCapabilities).toEqual(options.clientCapabilities);
+ expect(JSON.stringify(vi.mocked(runtime.ensureSession).mock.calls)).not.toContain("clientCapabilities");
+ const notification = vi.fn();
+ const request = vi.fn(async (_method, _params, context) => ({ requestId: context.requestId }));
+ const admittedFirst = port.startTurn({ text: "First", requestId: "turn-1", onExtensionRequest: request, onExtensionNotification: notification });
+ const signal = new AbortController().signal;
+ await expect(created.onExtensionRequest!("cursor/ask_question", { sessionId: "backend-1" }, { requestId: 0, signal })).resolves.toEqual({ requestId: 0 });
+ const sessionless = { toolCallId: "native-cursor-plan", plan: "Review the complete plan" };
+ const responseDelivery = Promise.resolve();
+ await expect(created.onExtensionRequest!("cursor/create_plan", sessionless, { requestId: "plan", signal, responseDelivery })).resolves.toEqual({ requestId: "plan" });
+ expect(request).toHaveBeenLastCalledWith("cursor/create_plan", { ...sessionless, sessionId: "backend-1" }, expect.objectContaining({ requestId: "plan", responseDelivery }));
+ expect(sessionless).not.toHaveProperty("sessionId");
+ await expect(created.onExtensionRequest!("pi/steer", {}, { requestId: 1, signal })).rejects.toThrow("admitted active turn");
+ await expect(created.onExtensionRequest!("cursor/ask_question", { sessionId: "other" }, { requestId: 1, signal })).rejects.toThrow("admitted active turn");
+ created.onExtensionNotification!("cursor/task", { sessionId: "backend-1", taskId: "t" });
+ created.onExtensionNotification!("cursor/task", { sessionId: "other" });
+ created.onExtensionNotification!("cursor/ask_question", { sessionId: "backend-1" });
+ expect(notification).toHaveBeenCalledExactlyOnceWith("cursor/task", { sessionId: "backend-1", taskId: "t" });
+ created.onExtensionNotification!("cursor/task", { toolCallId: "native-child" });
+ expect(notification).toHaveBeenLastCalledWith("cursor/task", { sessionId: "backend-1", toolCallId: "native-child" });
+ created.onExtensionNotification!("cursor/task", { sessionId: "agent-1" });
+ expect(notification).toHaveBeenCalledTimes(2);
+ request.mockImplementationOnce(() => new Promise(() => undefined));
+ const pending = created.onExtensionRequest!("cursor/ask_question", {}, { requestId: 2, signal });
+ const rejected = expect(pending).rejects.toThrow("expired");
+ first.settle(); await admittedFirst.result; await rejected;
+ const nextRequest = vi.fn(async () => ({ accepted: true }));
+ const admittedSecond = port.startTurn({ text: "Second", requestId: "turn-2", onExtensionRequest: nextRequest });
+ expect(nextRequest).not.toHaveBeenCalled();
+ await admittedSecond.cancel({ reason: "cancelled" });
+ await expect(created.onExtensionRequest!("cursor/ask_question", {}, { requestId: 3, signal })).rejects.toThrow("admitted active turn");
+ second.settle(); await admittedSecond.result; await port.close({ reason: "test finished" });
+ });
+
+ it("requires the Pi capability handshake and acknowledgments, preserves follow-up order, and never starts a second prompt", async () => {
+ const pending = pendingExtensionTurn("turn-1");
+ const runtime = Object.assign(fakeRuntime(), { requestExtension: vi.fn(async () => ({ accepted: true })) });
+ vi.mocked(runtime.startTurn).mockReturnValue(pending.turn);
+ let created!: AcpRuntimeOptions & { onAgentInitialize?: (result: unknown) => void };
+ const options = openOptions(fakeCommand());
+ options.profile = { ...options.profile, agent: "pi" };
+ const port = await openCodexAcpxRuntime(options, {
+ createRegistry: () => registry(), createStore: () => store(),
+ createRuntime: (value) => { created = value; return runtime; },
+ });
+ const turn = port.startTurn({ text: "Initial", requestId: "turn-1" });
+ await expect(port.steerActiveTurn!("Update", "turn-1")).rejects.toThrow("supported active turn");
+ created.onAgentInitialize!({ agentCapabilities: { _meta: { paperclipPi: { version: 1, steering: true, queuedFollowUp: true } } } });
+ expect(port.steeringCapability!()).toEqual({ steering: true, queuedFollowUp: true });
+ await expect(port.steerActiveTurn!("Update", "wrong")).rejects.toThrow("supported active turn");
+ await port.steerActiveTurn!("Update", "turn-1");
+ await Promise.all([port.queueFollowUp!("One", "turn-1"), port.queueFollowUp!("Two", "turn-1")]);
+ expect(runtime.requestExtension.mock.calls.map((call) => call[0])).toEqual([
+ { handle: HANDLE, method: "pi/steer", params: { sessionId: "backend-1", message: "Update" }, sessionMode: "persistent" },
+ { handle: HANDLE, method: "pi/follow_up", params: { sessionId: "backend-1", message: "One" }, sessionMode: "persistent" },
+ { handle: HANDLE, method: "pi/follow_up", params: { sessionId: "backend-1", message: "Two" }, sessionMode: "persistent" },
+ ]);
+ expect(runtime.startTurn).toHaveBeenCalledTimes(1);
+ runtime.requestExtension.mockResolvedValueOnce({ accepted: false });
+ await expect(port.steerActiveTurn!("Denied", "turn-1")).rejects.toThrow("not acknowledged");
+ runtime.requestExtension.mockImplementationOnce(() => new Promise(() => undefined));
+ const stale = port.queueFollowUp!("Stale", "turn-1");
+ const rejected = expect(stale).rejects.toThrow("expired");
+ pending.settle(); await turn.result; await rejected;
+ await expect(port.queueFollowUp!("Late", "turn-1")).rejects.toThrow("supported active turn");
+ await port.close({ reason: "test finished" });
+ });
+
+ it("does not grant steering to Copilot or Cursor when an untrusted initialize result claims Pi support", async () => {
+ const options = openOptions(fakeCommand()); options.profile = { ...options.profile, agent: "copilot" };
+ const runtime = fakeRuntime();
+ const port = await openCodexAcpxRuntime(options, {
+ createRegistry: () => registry(), createStore: () => store(),
+ createRuntime: (created) => {
+ (created as AcpRuntimeOptions & { onAgentInitialize: (result: unknown) => void }).onAgentInitialize({ agentCapabilities: { _meta: { paperclipPi: { version: 1, steering: true, queuedFollowUp: true } } } });
+ return runtime;
+ },
+ });
+ expect(port.steeringCapability!()).toBeNull();
+ await port.close({ reason: "test finished" });
+ });
it.each(["approve-reads", "approve-paperclip"] as const)("%s stops unassigned operations when approval has no handler", async (permissionMode) => {
const runtime = fakeRuntime();
let runtimeOptions: AcpRuntimeOptions | undefined;
@@ -1681,7 +1799,7 @@ describe("Codex ACPX runtime adapter", () => {
await expect(
runtimeOptions?.onPermissionRequest?.(
{
- sessionId: "session-1",
+ sessionId: "backend-1",
inferredKind: "write",
raw: {},
},
@@ -2828,6 +2946,17 @@ function fakeRuntime(handle: AcpRuntimeHandle = HANDLE): AcpRuntime {
};
}
+function pendingExtensionTurn(requestId: string) {
+ let settle!: () => void;
+ const result = new Promise((resolve) => { settle = resolve; });
+ return { settle, turn: {
+ requestId, promptStarted: Promise.resolve(),
+ events: (async function* () { await result; })(),
+ result: result.then(() => ({ status: "completed" as const })),
+ cancel: async () => undefined, closeStream: async () => undefined,
+ } };
+}
+
function runtimeWithProvider(
runtime: AcpRuntime,
options: AcpRuntimeOptions,
diff --git a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts
index 1444b9d4206..fcc480f74f4 100644
--- a/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/codex-runtime-adapter.ts
@@ -16,6 +16,7 @@ import {
import type {
AcpxRuntimeGoalCapability,
AcpxRuntimeGoalSnapshot,
+ AcpxRuntimeSteeringCapability,
AcpxRuntimePort,
AcpxRuntimePortIdentity,
AcpxRuntimePortOpenOptions,
@@ -28,6 +29,7 @@ import {
} from "./installation-integrity.js";
import type { AcpxModelStatus } from "./model-verification.js";
import { AcpxApprovalRequiredError, decideAcpxPermission } from "./permission-policy.js";
+import { ACPX_CAPABILITY_PROFILES } from "./capability-profiles.js";
const VERIFIED_COMMAND_SENTINEL = "paperclip-verified-acpx-command";
const DEFAULT_RUNTIME_CLOSE_TIMEOUT_MS = 2_000;
@@ -80,6 +82,22 @@ interface AcpxRuntimeGoalState {
observedSnapshot: boolean;
}
+interface AcpxRuntimeExtensionTurn {
+ requestId: string;
+ sessionId: string;
+ controller: AbortController;
+ signal: AbortSignal;
+ promptStarted: Promise;
+ onRequest?: AcpRuntimeOptions["onExtensionRequest"];
+ onNotification?: AcpRuntimeOptions["onExtensionNotification"];
+}
+
+interface AcpxRuntimeExtensionBoundary {
+ active: AcpxRuntimeExtensionTurn | null;
+ sessionIds: Set;
+ steering: AcpxRuntimeSteeringCapability | null;
+}
+
class AcpxRuntimeCloseTimeoutError extends Error {
constructor() {
super("ACPX runtime close timed out");
@@ -245,7 +263,19 @@ export async function openQualifiedAcpxRuntime(
.filter((server) => server.runnerOwned)
.map((server) => server.name),
);
- const permissionBoundary: { active: AbortController | null } = { active: null };
+ const permissionBoundary: {
+ active: AbortController | null;
+ handler?: AcpRuntimeOptions["onPermissionRequest"];
+ } = { active: null };
+ const extensionProfile = ACPX_CAPABILITY_PROFILES[options.profile.agent];
+ const extensionRequests = new Set(extensionProfile.extensionRequests);
+ const extensionNotifications = new Set(extensionProfile.extensionNotifications);
+ const extensionBoundary: AcpxRuntimeExtensionBoundary = {
+ active: null, sessionIds: new Set(), steering: null,
+ };
+ const ownsExtensionTurn = (active: AcpxRuntimeExtensionTurn, params: Record): boolean =>
+ extensionBoundary.active === active && !active.signal.aborted
+ && (params.sessionId === undefined || (typeof params.sessionId === "string" && extensionBoundary.sessionIds.has(params.sessionId)));
const goalState: AcpxRuntimeGoalState = {
capability: null,
snapshot: null,
@@ -283,6 +313,27 @@ export async function openQualifiedAcpxRuntime(
? "approve-reads"
: options.permissionMode,
elicitationModes: ["form"],
+ ...(options.clientCapabilities === undefined ? {} : { clientCapabilities: structuredClone(options.clientCapabilities) }),
+ extensionMethods: [...new Set([...extensionRequests, ...extensionNotifications])],
+ onExtensionRequest: async (method, params, context) => {
+ const active = extensionBoundary.active;
+ if (!extensionRequests.has(method) || !active?.onRequest || !ownsExtensionTurn(active, params) || context.signal.aborted) {
+ throw new Error("ACPX extension request does not own an admitted active turn");
+ }
+ const signal = AbortSignal.any([active.signal, context.signal]);
+ // Cursor's native extensions omit sessionId. Only after admission may
+ // that omission inherit this exact prompt's ACP wire session identity.
+ const boundParams = params.sessionId === undefined ? { ...params, sessionId: active.sessionId } : params;
+ const response = await abortableExtensionResult(active.onRequest(method, boundParams, { requestId: context.requestId, signal, responseDelivery: context.responseDelivery }), signal);
+ signal.throwIfAborted();
+ if (!ownsExtensionTurn(active, params)) throw new Error("ACPX extension request turn expired");
+ return response;
+ },
+ onExtensionNotification: (method, params) => {
+ const active = extensionBoundary.active;
+ if (!extensionNotifications.has(method) || !active?.onNotification || !ownsExtensionTurn(active, params)) return;
+ active.onNotification(method, params.sessionId === undefined ? { ...params, sessionId: active.sessionId } : params);
+ },
nonInteractivePermissions: "fail",
permissionPolicy: {
...options.permissionPolicy,
@@ -301,7 +352,12 @@ export async function openQualifiedAcpxRuntime(
{ name: "Authorization", value: `Bearer ${server.bearerToken}` },
],
})),
- onPermissionRequest: async (request) => {
+ onPermissionRequest: async (request, context) => {
+ const rawSessionId = objectRecord(request.raw).sessionId;
+ if (!extensionBoundary.sessionIds.has(request.sessionId)
+ || (rawSessionId !== undefined && rawSessionId !== request.sessionId)) {
+ return { outcome: "reject_once" };
+ }
const disposition = decideAcpxPermission(
options.profile.agent,
options.permissionMode,
@@ -314,6 +370,20 @@ export async function openQualifiedAcpxRuntime(
},
);
if (disposition === "delegate") {
+ const active = permissionBoundary.active;
+ const handler = permissionBoundary.handler;
+ if (active && handler && !active.signal.aborted && !context.signal.aborted) {
+ // Capture this turn's callback before awaiting. A session-lifetime
+ // callback must never acquire the next turn's approval authority.
+ const decision = await handler(request, {
+ signal: AbortSignal.any([active.signal, context.signal]),
+ responseDelivery: context.responseDelivery,
+ });
+ if (permissionBoundary.active !== active || active.signal.aborted || context.signal.aborted) {
+ return { outcome: "cancel" };
+ }
+ return decision ?? { outcome: "cancel" };
+ }
// This runtime has no interactive approval bridge. Stop the active
// turn instead of asking the model to recover from an unexplained
// denial or wait for an approval that nobody can answer.
@@ -325,6 +395,12 @@ export async function openQualifiedAcpxRuntime(
onAgentInitialize: (result) => {
const capability = goalCapabilityFromAcpMessage({ result });
if (capability) goalState.capability = capability;
+ // Only the runner-owned Pi wrapper has an admitted steering contract.
+ // Never infer it from generic ACP prompt support or native-only features.
+ const pi = objectRecord(objectRecord(objectRecord(objectRecord(result).agentCapabilities)._meta).paperclipPi);
+ extensionBoundary.steering = options.profile.agent === "pi" && pi.version === 1
+ ? { steering: pi.steering === true, queuedFollowUp: pi.queuedFollowUp === true }
+ : null;
},
onSessionNotification: acceptGoalNotification,
spawnEnvironment: () => ({
@@ -454,6 +530,7 @@ export async function openQualifiedAcpxRuntime(
goalState,
commandLaunches,
permissionBoundary,
+ extensionBoundary,
);
} catch (error) {
const cleanupReason = "ACPX runtime identity validation failed";
@@ -881,8 +958,37 @@ function runtimePort(
runtimeCloseTimeoutMs: number,
goalState: AcpxRuntimeGoalState,
commandLaunches: { count: number; refreshConsumedCommand?: () => Promise },
- permissionBoundary: { active: AbortController | null },
+ permissionBoundary: { active: AbortController | null; handler?: AcpRuntimeOptions["onPermissionRequest"] },
+ extensionBoundary: AcpxRuntimeExtensionBoundary,
): AcpxRuntimePort {
+ extensionBoundary.sessionIds = new Set([identity.backendSessionId]);
+ let extensionControls: Promise = Promise.resolve();
+ const controlActiveTurn = (method: "pi/steer" | "pi/follow_up", text: string, requestId: string): Promise => {
+ const active = extensionBoundary.active;
+ const supported = method === "pi/steer"
+ ? extensionBoundary.steering?.steering : extensionBoundary.steering?.queuedFollowUp;
+ if (!supported || !runtime.requestExtension || !active || active.requestId !== requestId || active.signal.aborted) {
+ return Promise.reject(new Error("ACPX extension control does not own a supported active turn"));
+ }
+ if (!text.trim() || Buffer.byteLength(text, "utf8") > 65_536 || text.includes("\0")) {
+ return Promise.reject(new Error("ACPX extension control message is invalid"));
+ }
+ const send = async (): Promise => {
+ await abortableExtensionResult(active.promptStarted, active.signal);
+ active.signal.throwIfAborted();
+ if (extensionBoundary.active !== active) throw new Error("ACPX extension control turn expired");
+ const response = await abortableExtensionResult(runtime.requestExtension!({
+ handle, method, params: { sessionId: identity.backendSessionId, message: text }, sessionMode: "persistent",
+ }), active.signal);
+ active.signal.throwIfAborted();
+ if (extensionBoundary.active !== active) throw new Error("ACPX extension control turn expired");
+ if (response.accepted !== true) throw new Error("ACPX extension control was not acknowledged");
+ };
+ const delivery = extensionControls.then(send);
+ // Preserve caller ordering without letting one rejection deadlock later calls.
+ extensionControls = delivery.catch(() => undefined);
+ return delivery;
+ };
type RuntimeCloseAttempt = {
readonly outcome: Promise;
readonly reconciliationGeneration: number;
@@ -1026,6 +1132,7 @@ function runtimePort(
attemptNumber: number;
};
}): Promise {
+ extensionBoundary.active?.controller.abort(new Error("ACPX runtime is closing"));
if (runtimeClosed) return;
if (
runtimeCloseAttempt?.origin.kind === "reconciliation" &&
@@ -1112,6 +1219,11 @@ function runtimePort(
async getStatus() {
return await persistedRuntimeStatus(sessionStore, handle, identity);
},
+ steeringCapability() {
+ return extensionBoundary.steering === null ? null : structuredClone(extensionBoundary.steering);
+ },
+ steerActiveTurn: (text, requestId) => controlActiveTurn("pi/steer", text, requestId),
+ queueFollowUp: (text, requestId) => controlActiveTurn("pi/follow_up", text, requestId),
goalCapability() {
return goalState.capability === null
? null
@@ -1205,8 +1317,22 @@ function runtimePort(
}
: {}),
startTurn(input) {
+ if (extensionBoundary.active) throw new Error("ACPX runtime already has an active turn");
const approval = new AbortController();
+ const controller = new AbortController();
+ const extensionTurn: AcpxRuntimeExtensionTurn = {
+ requestId: input.requestId, sessionId: identity.backendSessionId, controller,
+ signal: input.signal ? AbortSignal.any([controller.signal, input.signal, approval.signal]) : AbortSignal.any([controller.signal, approval.signal]),
+ promptStarted: Promise.resolve(),
+ onRequest: input.onExtensionRequest, onNotification: input.onExtensionNotification,
+ };
+ extensionBoundary.active = extensionTurn;
+ const releaseExtensionTurn = (): void => {
+ controller.abort(new Error("ACPX extension turn expired"));
+ if (extensionBoundary.active === extensionTurn) extensionBoundary.active = null;
+ };
permissionBoundary.active = approval;
+ permissionBoundary.handler = input.onPermissionRequest;
const finishOwnershipAdmission =
children.beginLifetimeOwnershipAdmission();
let turn: AcpxRuntimeTurn;
@@ -1224,11 +1350,13 @@ function runtimePort(
: {}),
});
} catch (error) {
- if (permissionBoundary.active === approval) permissionBoundary.active = null;
+ releaseExtensionTurn();
+ if (permissionBoundary.active === approval) { permissionBoundary.active = null; permissionBoundary.handler = undefined; }
void finishOwnershipAdmission().catch(() => undefined);
throw error;
}
const guarded = turnWithVerifiedLifetimeOwnership(turn, finishOwnershipAdmission);
+ extensionTurn.promptStarted = guarded.promptStarted;
const result = guarded.result.then(
(value) => {
approval.signal.throwIfAborted();
@@ -1241,12 +1369,21 @@ function runtimePort(
},
(error: unknown) => { approval.signal.throwIfAborted(); throw error; },
).finally(() => {
- if (permissionBoundary.active === approval) permissionBoundary.active = null;
+ releaseExtensionTurn();
+ if (permissionBoundary.active === approval) { permissionBoundary.active = null; permissionBoundary.handler = undefined; approval.abort(); }
});
void result.catch(() => undefined);
return {
...guarded,
result,
+ cancel: (input) => {
+ controller.abort(new Error("ACPX extension turn cancelled"));
+ return guarded.cancel(input);
+ },
+ closeStream: (input) => {
+ controller.abort(new Error("ACPX extension stream closed"));
+ return guarded.closeStream(input);
+ },
events: (async function* () {
try {
for await (const event of guarded.events) {
@@ -1802,6 +1939,17 @@ function objectRecord(value: unknown): Record {
: {};
}
+async function abortableExtensionResult(result: Promise, signal: AbortSignal): Promise {
+ signal.throwIfAborted();
+ let rejectAbort: (() => void) | undefined;
+ const cancellation = new Promise((_resolve, reject) => {
+ rejectAbort = () => reject(signal.reason ?? new Error("ACPX extension turn expired"));
+ signal.addEventListener("abort", rejectAbort, { once: true });
+ });
+ try { return await Promise.race([result, cancellation]); }
+ finally { if (rejectAbort) signal.removeEventListener("abort", rejectAbort); }
+}
+
function goalCapabilityFromAcpMessage(
message: unknown,
): AcpxRuntimeGoalCapability | null {
diff --git a/packages/paperclip-runner/src/drivers/acpx/driver-profile.test.ts b/packages/paperclip-runner/src/drivers/acpx/driver-profile.test.ts
index 054956788cb..a325f1e29dc 100644
--- a/packages/paperclip-runner/src/drivers/acpx/driver-profile.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/driver-profile.test.ts
@@ -7,6 +7,14 @@ import {
} from "./driver-profile.js";
describe("ACPX driver profile", () => {
+ it("enables only negotiated Pi controls and keeps the static profile conservative", () => {
+ expect(acpxCapabilities("pi")).toMatchObject({ steering: false, queuedFollowUp: false });
+ expect(acpxCapabilities("pi", { steering: true, queuedFollowUp: false })).toMatchObject({ steering: true, queuedFollowUp: false });
+ expect(acpxCapabilities("pi", { steering: false, queuedFollowUp: true })).toMatchObject({ steering: false, queuedFollowUp: true });
+ for (const agent of ["cursor", "copilot", "codex", "claude"] as const) {
+ expect(acpxCapabilities(agent, { steering: true, queuedFollowUp: true })).toMatchObject({ steering: false, queuedFollowUp: false });
+ }
+ });
it.each([
["codex", "available"],
["grok", "available"],
@@ -86,7 +94,7 @@ describe("ACPX driver profile", () => {
}),
).toMatchObject({
ok: false,
- issues: [{ path: "agent", code: "invalid_agent" }],
+ issues: [{ path: "agent", code: "qualification_pending" }],
});
expect(
validateAcpxDriverConfig({
diff --git a/packages/paperclip-runner/src/drivers/acpx/driver-profile.ts b/packages/paperclip-runner/src/drivers/acpx/driver-profile.ts
index 559be9b3494..259f547b170 100644
--- a/packages/paperclip-runner/src/drivers/acpx/driver-profile.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/driver-profile.ts
@@ -3,7 +3,7 @@ import type {
HarnessDriverDescriptor,
} from "../../contracts/harness-driver.js";
import type { NativeAcpxPermissionMode } from "../../contracts/native-execution.js";
-import type { NativeSessionCapabilities } from "../../contracts/types.js";
+import type { NativeSessionCapabilities, NativeTurnControlCapabilities } from "../../contracts/types.js";
import { providerFamilyCapabilities } from "../../provider-events.js";
import {
ACPX_DRIVER_KIND,
@@ -12,7 +12,9 @@ import {
type QualifiedAcpxAgent,
} from "./qualified-profiles.js";
-const ACPX_AGENTS = ["claude", "codex", "grok"] as const;
+import { ACPX_CAPABILITY_PROFILES } from "./capability-profiles.js";
+
+const ACPX_AGENTS = ["claude", "codex", "grok", "pi", "cursor", "copilot"] as const;
const ACPX_PERMISSION_MODES = [
"approve-all",
"approve-paperclip",
@@ -29,30 +31,34 @@ export interface ValidatedAcpxDriverConfig extends Record {
export function acpxCapabilities(
agent: QualifiedAcpxAgent,
+ negotiated?: NativeTurnControlCapabilities | null,
): NativeSessionCapabilities {
+ const controls = agent === "pi" ? negotiated : null;
+ const profile = ACPX_CAPABILITY_PROFILES[agent];
return {
- resume: true,
+ resume: profile.recovery === "session-load",
typedEvents: true,
typedEventFamilies: providerFamilyCapabilities({
- plan: agent === "pi" ? "unsupported" : "available",
+ plan: profile.plans === "semantic-only" ? "unsupported" : "available",
tool_execution: "available",
model_identity: "available",
review: agent === "grok" ? "unsupported" : "available",
provider_notice: agent === "grok" ? "unsupported" : "available",
artifact: "policy_disabled",
}),
- steering: false,
+ steering: controls?.steering === true,
+ queuedFollowUp: controls?.queuedFollowUp === true,
interruption: true,
structuredResult: true,
read: true,
reconciliation: true,
- usage: agent !== "grok",
+ usage: profile.usage === "reported",
dynamicTools: true,
- runtimeRequestResolution: true,
+ runtimeRequestResolution: profile.permissions === "interactive" || profile.questions === "form",
runtimeRequestHandoff: true,
goals: false,
threadLineage: false,
- unsupported: ["steering", "goals", "threadLineage"],
+ unsupported: [...(controls?.steering ? [] : ["steering"]), "goals", "threadLineage"],
};
}
@@ -96,9 +102,12 @@ export function validateAcpxDriverConfig(
return invalid(
"agent",
"invalid_agent",
- "ACPX agent must be claude, codex, or grok.",
+ "ACPX agent must be claude, codex, grok, cursor, copilot, or pi.",
);
}
+ if (ACPX_CAPABILITY_PROFILES[agent].qualification !== "qualified") {
+ return invalid("agent", "qualification_pending", `${ACPX_CAPABILITY_PROFILES[agent].displayName} requires local and Daytona qualification before use.`);
+ }
const model = text(config.model);
try {
resolveQualifiedAcpxProfile(agent, model);
@@ -144,10 +153,7 @@ function isPermissionMode(value: string): value is NativeAcpxPermissionMode {
}
function displayAgent(agent: QualifiedAcpxAgent): string {
- if (agent === "grok") return "Grok Build";
- if (agent === "pi") return "Pi";
- if (agent === "claude") return "Claude";
- return "Codex";
+ return ACPX_CAPABILITY_PROFILES[agent].displayName;
}
function record(value: unknown): Record | null {
diff --git a/packages/paperclip-runner/src/drivers/acpx/environment.test.ts b/packages/paperclip-runner/src/drivers/acpx/environment.test.ts
index 03e7d00aae4..d1e749a5191 100644
--- a/packages/paperclip-runner/src/drivers/acpx/environment.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/environment.test.ts
@@ -1,6 +1,8 @@
-import { describe, expect, it } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";
-import { createSanitizedAcpxSpawnInput } from "./environment.js";
+afterEach(() => vi.unstubAllEnvs());
+
+import { ACPX_CREDENTIAL_BINDING_ENV, createAcpxCredentialBinding, createAcpxSidecarHostEnvironment, createSanitizedAcpxSpawnInput } from "./environment.js";
describe("ACPX launch environment", () => {
it("projects only the selected agent's credentials and runtime allowlist", () => {
@@ -45,6 +47,64 @@ describe("ACPX launch environment", () => {
expect(Object.isFrozen(codex.env)).toBe(true);
});
+ it.each([
+ ["pi", "OPENROUTER_API_KEY"], ["cursor", "CURSOR_API_KEY"],
+ ["cursor", "CURSOR_AUTH_TOKEN"], ["copilot", "COPILOT_GITHUB_TOKEN"],
+ ] as const)("requires an explicit %s credential binding for %s", (agent, name) => {
+ vi.stubEnv(name, "ambient-secret");
+ expect(createSanitizedAcpxSpawnInput(undefined, agent).env[name]).toBeUndefined();
+ expect(createSanitizedAcpxSpawnInput({ [name]: "bound-secret" }, agent).env[name]).toBe("bound-secret");
+ });
+
+ it("drops alternate credentials, provider injection and configuration overrides", () => {
+ const source = {
+ CURSOR_API_KEY: "cursor-key", CURSOR_AUTH_TOKEN: "cursor-token", COPILOT_GITHUB_TOKEN: "copilot-key",
+ GH_TOKEN: "gh-key", GITHUB_TOKEN: "github-key", COPILOT_PROVIDER_BASE_URL: "https://unapproved.invalid",
+ COPILOT_MODEL: "ambient-model", CURSOR_CONFIG_DIR: "/ambient/cursor", PI_CODING_AGENT_DIR: "/ambient/pi",
+ PAPERCLIP_PI_ENTRYPOINT: "/unverified/pi.js", NODE_OPTIONS: "--import=/unverified/hook.js",
+ COPILOT_PKG_CACHE_HOME: "/unverified/cache", COPILOT_ALLOW_ALL: "true",
+ };
+ expect(createSanitizedAcpxSpawnInput(source, "cursor").env).toEqual({ CURSOR_API_KEY: "cursor-key", CURSOR_AUTH_TOKEN: "cursor-token" });
+ expect(createSanitizedAcpxSpawnInput(source, "copilot").env).toEqual({ COPILOT_GITHUB_TOKEN: "copilot-key" });
+ expect(createSanitizedAcpxSpawnInput(source, "pi").env).toEqual({});
+ });
+
+ it.each([
+ ["pi", "OPENROUTER_API_KEY"], ["cursor", "CURSOR_API_KEY"],
+ ["cursor", "CURSOR_AUTH_TOKEN"], ["copilot", "COPILOT_GITHUB_TOKEN"],
+ ] as const)("admits only session-bound %s sidecar credentials for %s", (agent, name) => {
+ const source = { [name]: "task-secret" };
+ const binding = createAcpxCredentialBinding(source, agent, "session-1");
+ expect(binding).not.toContain("task-secret");
+ const explicit = createAcpxSidecarHostEnvironment({ ...source, [ACPX_CREDENTIAL_BINDING_ENV]: binding }, agent, "session-1");
+ expect(createSanitizedAcpxSpawnInput(explicit, agent).env).toEqual(source);
+ expect(explicit[ACPX_CREDENTIAL_BINDING_ENV]).toBeUndefined();
+ expect(() => createAcpxSidecarHostEnvironment(source, agent, "session-1")).toThrow("explicit matching session binding");
+ expect(() => createAcpxSidecarHostEnvironment({ ...source, [ACPX_CREDENTIAL_BINDING_ENV]: binding }, agent, "stale-session")).toThrow("explicit matching session binding");
+ });
+
+ it("rejects malformed, wrong-provider, duplicate and missing sidecar credential bindings", () => {
+ const source = { CURSOR_API_KEY: "do-not-include-in-errors" };
+ const valid = JSON.parse(createAcpxCredentialBinding(source, "cursor", "session-1")!);
+ for (const binding of ["invalid-json", JSON.stringify({ ...valid, agent: "copilot" }),
+ JSON.stringify({ ...valid, names: ["COPILOT_GITHUB_TOKEN"] }),
+ JSON.stringify({ ...valid, names: ["CURSOR_API_KEY", "CURSOR_API_KEY"] }),
+ JSON.stringify({ ...valid, names: [] }), JSON.stringify({ ...valid, extra: true })]) {
+ expect(() => createAcpxSidecarHostEnvironment({ ...source, [ACPX_CREDENTIAL_BINDING_ENV]: binding }, "cursor", "session-1"))
+ .toThrow(/^Candidate ACPX credentials require an explicit matching session binding$/);
+ }
+ expect(() => createAcpxSidecarHostEnvironment({ [ACPX_CREDENTIAL_BINDING_ENV]: JSON.stringify(valid) }, "cursor", "session-1")).toThrow("explicit matching session binding");
+ expect(() => createAcpxSidecarHostEnvironment({ ...source, CURSOR_AUTH_TOKEN: "unbound", [ACPX_CREDENTIAL_BINDING_ENV]: JSON.stringify(valid) }, "cursor", "session-1")).toThrow("explicit matching session binding");
+ });
+
+ it("does not reinterpret legacy profile credential environments", () => {
+ const source = { ANTHROPIC_API_KEY: "legacy", OPENAI_API_KEY: "legacy", [ACPX_CREDENTIAL_BINDING_ENV]: "irrelevant" };
+ for (const agent of ["claude", "codex"] as const) {
+ expect(createAcpxCredentialBinding(source, agent, "session-1")).toBeUndefined();
+ expect(createAcpxSidecarHostEnvironment(source, agent, "session-1")).toBe(source);
+ }
+ });
+
it("rejects unsafe or unbounded retained values", () => {
expect(() =>
createSanitizedAcpxSpawnInput({ PATH: "bad\0path" }, "codex"),
diff --git a/packages/paperclip-runner/src/drivers/acpx/environment.ts b/packages/paperclip-runner/src/drivers/acpx/environment.ts
index 0e1ff50b80a..a78fdcbe268 100644
--- a/packages/paperclip-runner/src/drivers/acpx/environment.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/environment.ts
@@ -1,5 +1,67 @@
import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
+export const ACPX_CREDENTIAL_BINDING_ENV = "PAPERCLIP_ACPX_CREDENTIAL_BINDING";
+export const ACPX_CREDENTIAL_NAMES: Readonly> = {
+ grok: ["XAI_API_KEY"],
+ pi: ["OPENROUTER_API_KEY"],
+ cursor: ["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"],
+ copilot: ["COPILOT_GITHUB_TOKEN"],
+ claude: ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
+ codex: ["OPENAI_API_KEY", "CODEX_API_KEY"],
+};
+const isCandidate = (agent: QualifiedAcpxAgent) => agent === "pi" || agent === "cursor" || agent === "copilot";
+
+/** Mint only at the controller's explicit task-environment boundary, never by copying a marker. */
+export function createAcpxCredentialBinding(
+ environment: NodeJS.ProcessEnv | undefined,
+ agent: QualifiedAcpxAgent,
+ sessionId: string,
+): string | undefined {
+ if (!isCandidate(agent)) return undefined;
+ return JSON.stringify({
+ schema: "paperclip.acpx_credential_binding.v1", agent, sessionId,
+ names: ACPX_CREDENTIAL_NAMES[agent].filter(name => environment !== undefined
+ && Object.hasOwn(environment, name) && Boolean(environment[name]?.trim())),
+ });
+}
+
+/** process.env at the sidecar is not itself proof of a task credential binding. */
+export function createAcpxSidecarHostEnvironment(
+ environment: NodeJS.ProcessEnv,
+ agent: QualifiedAcpxAgent,
+ sessionId: string,
+): NodeJS.ProcessEnv {
+ if (!isCandidate(agent)) return environment;
+ const invalid = () => new Error("Candidate ACPX credentials require an explicit matching session binding");
+ const raw = environment[ACPX_CREDENTIAL_BINDING_ENV];
+ let names: string[] = [];
+ if (raw !== undefined) {
+ if (Buffer.byteLength(raw) > 4_096) throw invalid();
+ let binding: unknown;
+ try { binding = JSON.parse(raw); } catch { throw invalid(); }
+ if (binding === null || typeof binding !== "object" || Array.isArray(binding)) throw invalid();
+ const value = binding as Record;
+ if (Object.keys(value).sort().join(",") !== "agent,names,schema,sessionId"
+ || value.schema !== "paperclip.acpx_credential_binding.v1" || value.agent !== agent
+ || value.sessionId !== sessionId || !Array.isArray(value.names)
+ || value.names.length > ACPX_CREDENTIAL_NAMES[agent].length
+ || value.names.some(name => typeof name !== "string" || !ACPX_CREDENTIAL_NAMES[agent].includes(name))
+ || new Set(value.names).size !== value.names.length) throw invalid();
+ names = value.names as string[];
+ }
+ const result = { ...environment };
+ delete result[ACPX_CREDENTIAL_BINDING_ENV];
+ for (const name of ACPX_CREDENTIAL_NAMES[agent]) {
+ if (names.includes(name)) {
+ if (!Object.hasOwn(environment, name) || !environment[name]?.trim()) throw invalid();
+ } else {
+ if (environment[name]?.trim()) throw invalid();
+ delete result[name];
+ }
+ }
+ return result;
+}
+
declare const sanitizedAcpxSpawnInputBrand: unique symbol;
/**
@@ -23,18 +85,9 @@ export function createSanitizedAcpxSpawnInput(
agent: QualifiedAcpxAgent,
): SanitizedAcpxSpawnInput {
const source = environment ?? process.env;
+ const candidate = isCandidate(agent);
const result: NodeJS.ProcessEnv = {};
- const credentialNames =
- agent === "grok"
- ? ["XAI_API_KEY"]
- : agent === "pi"
- ? ["OPENROUTER_API_KEY"]
- : agent === "claude"
- ? ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"]
- : [
- "OPENAI_API_KEY",
- "CODEX_API_KEY",
- ];
+ const credentialNames = ACPX_CREDENTIAL_NAMES[agent];
const allowed = new Set([
"PATH",
"LANG",
@@ -62,6 +115,9 @@ export function createSanitizedAcpxSpawnInput(
let retainedBytes = 0;
for (const [key, value] of Object.entries(source)) {
if (typeof value !== "string") continue;
+ // Candidate credentials must be explicitly bound to this run. Locale and
+ // transport settings may come from the host; login state never does.
+ if (candidate && environment === undefined && credentialNames.includes(key)) continue;
if (!allowed.has(key) && !/^LC_[A-Z0-9_]{1,32}$/.test(key)) continue;
if (key.includes("\0") || value.includes("\0")) {
throw new Error("ACPX environment contains a null byte");
diff --git a/packages/paperclip-runner/src/drivers/acpx/generated-sidecar-contract.ts b/packages/paperclip-runner/src/drivers/acpx/generated-sidecar-contract.ts
index 9f7ac89235e..ed4bfbae44b 100644
--- a/packages/paperclip-runner/src/drivers/acpx/generated-sidecar-contract.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/generated-sidecar-contract.ts
@@ -7,6 +7,7 @@ export const GENERATED_ACPX_SIDECAR_COMMANDS = [
"run.attach",
"turn.start",
"turn.cancel",
+ "turn.steer",
"permission.resolve",
"input.resolve",
"tool.resolve",
@@ -23,6 +24,7 @@ export type GeneratedAcpxSidecarCommand =
export const GENERATED_ACPX_SIDECAR_EVENT_TYPES = [
"runtime.event",
+ "runtime.rich_event",
"runtime.permission_requested",
"runtime.input_requested",
"runtime.tool_called",
diff --git a/packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts b/packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts
index b4a954fb073..237de315b43 100644
--- a/packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/installation-integrity.ts
@@ -1,4 +1,6 @@
import { MAX_ACPX_RUNTIME_EXECUTABLE_BYTES, ACPX_PRIVATE_SNAPSHOT_ENV, createAcpxPrivateSnapshot, type AcpxPrivateSnapshot } from "./private-snapshot.js";
+import { createNativeAcpxDistributionSnapshot, NATIVE_ACPX_BOOTSTRAP_NAME, readNativeAcpxDistributionEntries, type NativeAcpxDistributionInput } from "./native-distribution-integrity.js";
+export type { NativeAcpxDistributionInput } from "./native-distribution-integrity.js";
import { createHash } from "node:crypto";
import {
spawn as spawnChildProcess,
@@ -407,6 +409,43 @@ export interface VerifiedAcpxInstallation {
openCommand(): Promise;
}
+/**
+ * Native candidate distribution primitive. This verifies bytes and lifetime
+ * ownership; it does not qualify or enable a provider profile. The caller must
+ * source every expected value from its trusted, versioned profile declaration.
+ */
+export async function verifyNativeAcpxInstallation(
+ input: NativeAcpxDistributionInput,
+): Promise {
+ const declaration: NativeAcpxDistributionInput = Object.freeze({
+ ...input, fixedArguments: Object.freeze([...input.fixedArguments]),
+ });
+ const entries = await readNativeAcpxDistributionEntries(declaration);
+ return Object.freeze({
+ commandDigest: `sha256:${declaration.expectedClosureSha256}`,
+ agentServerPackageJsonPath: declaration.manifestPath,
+ agentRuntimePackageJsonPath: null,
+ async openCommand(): Promise {
+ const native = await createNativeAcpxDistributionSnapshot(declaration, entries);
+ const lease = commandLease(
+ native.snapshot.roots[0]!, NATIVE_ACPX_BOOTSTRAP_NAME, "commonjs",
+ native.bootstrap, native.commandDirectory, [], 0, "commonjs", [],
+ null, null, native.snapshot,
+ );
+ return {
+ spawn(args = [], options = {}, lifetime) {
+ if (args.length !== 0) throw new Error("Native ACPX distribution accepts only its fixed profile arguments");
+ return lease.spawn([], { ...options, env: {
+ ...(options.env ?? process.env),
+ PAPERCLIP_ACPX_NATIVE_GUARDED: lifetime === undefined ? "0" : "1",
+ } }, lifetime);
+ },
+ close: () => lease.close(),
+ };
+ },
+ });
+}
+
export interface VerifiedAcpxCommandLease {
/**
* Launch with a Linux descriptor-backed entry identity. Callers must not
diff --git a/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.test.ts b/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.test.ts
new file mode 100644
index 00000000000..d140717ae31
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.test.ts
@@ -0,0 +1,233 @@
+import { createHash } from "node:crypto";
+import { once } from "node:events";
+import { chmod, copyFile, mkdtemp, open, readFile, readdir, rm, stat, symlink, writeFile, type FileHandle } from "node:fs/promises";
+import { createServer, type Server } from "node:net";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import type { ChildProcess } from "node:child_process";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { awaitVerifiedAcpxProviderExit, awaitVerifiedAcpxProviderOwnership, verifyNativeAcpxInstallation } from "./installation-integrity.js";
+import { createNativeAcpxDistributionSnapshot, readNativeAcpxDistributionEntries, parseNativeAcpxDistributionEntries, type NativeAcpxDistributionInput, type NativeAcpxDistributionEntry } from "./native-distribution-integrity.js";
+
+vi.mock("node:fs/promises", async (importOriginal) => {
+ const original = await importOriginal();
+ return { ...original, rm: vi.fn(original.rm) };
+});
+
+const roots: string[] = [];
+const hash = (value: string | Buffer) => createHash("sha256").update(value).digest("hex");
+afterEach(async () => { vi.restoreAllMocks(); await Promise.all(roots.splice(0).map(root => rm(root, { recursive: true, force: true }))); });
+
+async function fixture(options: { node?: boolean; script?: string } = {}): Promise {
+ const root = await mkdtemp(join(tmpdir(), "native-acpx-test-")); roots.push(root);
+ const entries: NativeAcpxDistributionEntry[] = [];
+ if (options.node) {
+ await copyFile(process.execPath, join(root, "runtime")); await chmod(join(root, "runtime"), 0o700);
+ const bytes = await readFile(join(root, "runtime")); entries.push({ path: "runtime", sha256: hash(bytes), size: bytes.length, executable: true });
+ // Homebrew's test-host Node uses an @rpath libnode dylib. Include that
+ // dependency in this fixture's closure instead of relying on its old path.
+ const libraryRoot = join(dirname(process.execPath), "..", "lib");
+ for (const name of (await readdir(libraryRoot).catch(() => [] as string[])).filter(name => /^libnode\..*\.dylib$/.test(name))) {
+ await copyFile(join(libraryRoot, name), join(root, name)); await chmod(join(root, name), 0o600);
+ const library = await readFile(join(root, name)); entries.push({ path: name, sha256: hash(library), size: library.length, executable: false });
+ }
+ const script = options.script ?? 'console.log("qualified-entry");';
+ await writeFile(join(root, "entry.cjs"), script, { mode: 0o600 });
+ entries.push({ path: "entry.cjs", sha256: hash(script), size: Buffer.byteLength(script), executable: false });
+ } else {
+ const script = options.script ?? '#!/bin/sh\nprintf "native:%s:%s" "$1" "${COPILOT_PKG_CACHE_HOME:-none}"\n';
+ await writeFile(join(root, "runtime"), script, { mode: 0o700 });
+ entries.push({ path: "runtime", sha256: hash(script), size: Buffer.byteLength(script), executable: true });
+ }
+ entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
+ const manifestPath = join(root, "closure.json");
+ await writeFile(manifestPath, JSON.stringify({ entries }));
+ return { distributionRoot: root, manifestPath, expectedClosureSha256: hash(JSON.stringify(entries)), executable: "runtime", ...(options.node ? { entrypoint: "entry.cjs" } : {}), fixedArguments: options.node ? [] : ["fixed"] };
+}
+async function manyFileFixture(sizes: number[]) {
+ const declaration = await fixture();
+ const entries = await readNativeAcpxDistributionEntries(declaration);
+ for (let index = 0; index < sizes.length; index++) {
+ const path = `file-${String(index).padStart(2, "0")}`;
+ const bytes = Buffer.alloc(sizes[index]!, index + 1);
+ await writeFile(join(declaration.distributionRoot, path), bytes, { mode: 0o600 });
+ entries.push({ path, sha256: hash(bytes), size: bytes.length, executable: false });
+ }
+ entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
+ await writeFile(declaration.manifestPath, JSON.stringify({ entries }));
+ return { declaration: { ...declaration, expectedClosureSha256: hash(JSON.stringify(entries)) }, entries };
+}
+async function filePrototype(path: string): Promise {
+ const probe = await open(path, "r"); const prototype = Object.getPrototypeOf(probe) as FileHandle;
+ await probe.close(); return prototype;
+}
+function gate() {
+ let release!: () => void;
+ const promise = new Promise((resolve) => { release = resolve; });
+ return { promise, release };
+}
+
+async function output(child: ChildProcess): Promise<{ text: string; error: string; code: number | null }> {
+ let text = ""; let error = "";
+ child.stdout!.on("data", value => { text += String(value); });
+ child.stderr!.on("data", value => { error += String(value); });
+ const [code] = await once(child, "close") as [number | null];
+ return { text, error, code };
+}
+
+describe("native ACPX execution closure", () => {
+ it("rejects paths, ordering, oversized files and altered manifest pins", () => {
+ const entry = { path: "runtime", sha256: "a".repeat(64), size: 10, executable: true };
+ for (const entries of [[{ ...entry, path: "../escape" }], [{ ...entry, path: "/absolute" }], [entry, entry], [{ ...entry, size: 2 ** 40 }], [{ ...entry, unknown: 1 }]]) {
+ expect(() => parseNativeAcpxDistributionEntries({ entries }, hash(JSON.stringify(entries)))).toThrow();
+ }
+ expect(() => parseNativeAcpxDistributionEntries({ entries: [entry] }, "b".repeat(64))).toThrow("manifest digest mismatch");
+ });
+ it("checks every file digest and refuses links at admission", async () => {
+ const declaration = await fixture(); const installation = await verifyNativeAcpxInstallation(declaration);
+ await writeFile(join(declaration.distributionRoot, "runtime"), "altered");
+ await expect(installation.openCommand()).rejects.toThrow();
+ await rm(join(declaration.distributionRoot, "runtime"));
+ await symlink("closure.json", join(declaration.distributionRoot, "runtime"));
+ await expect(installation.openCommand()).rejects.toThrow("symbolic link");
+ });
+ it("launches only fixed arguments from a frozen snapshot after installed files change", async () => {
+ const declaration = await fixture(); const lease = await (await verifyNativeAcpxInstallation(declaration)).openCommand();
+ expect(() => lease.spawn(["--untrusted-override"])).toThrow("fixed profile arguments");
+ await writeFile(join(declaration.distributionRoot, "runtime"), "changed after lease");
+ const result = await output(lease.spawn());
+ expect(result).toEqual({ text: "native:fixed:none", error: "", code: 0 });
+ expect(() => lease.spawn()).toThrow("closed");
+ await lease.close();
+ });
+ it("gives packaged executables a fresh private extraction cache each launch", async () => {
+ const declaration = { ...await fixture(), isolatedCacheEnvironmentName: "COPILOT_PKG_CACHE_HOME" as const };
+ const install = await verifyNativeAcpxInstallation(declaration);
+ const first = await output((await install.openCommand()).spawn([], { env: { COPILOT_PKG_CACHE_HOME: "/ambient/cache" } }));
+ const second = await output((await install.openCommand()).spawn());
+ expect(first.text).toMatch(/^native:fixed:.*paperclip-acpx-native-.*\/state$/);
+ expect(first.text).not.toBe(second.text);
+ });
+ it("loads a pinned Node entrypoint while rejecting unqualified external modules", async () => {
+ const declaration = await fixture({ node: true });
+ const result = await output((await (await verifyNativeAcpxInstallation(declaration)).openCommand()).spawn());
+ expect(result.code, result.error).toBe(0); expect(result.text).toBe("qualified-entry\n");
+ const outside = join(declaration.distributionRoot, "outside.cjs"); await writeFile(outside, "module.exports='ambient';");
+ const evil = await fixture({ node: true, script: `require(${JSON.stringify(outside)});` });
+ const denied = await output((await (await verifyNativeAcpxInstallation(evil)).openCommand()).spawn());
+ expect(denied.code).not.toBe(0); expect(denied.error).toContain("escaped its closed distribution");
+ }, 30_000);
+ it("copies concurrently within its descriptor bound and retains canonical manifest order", async () => {
+ const { declaration, entries } = await manyFileFixture(Array.from({ length: 12 }, (_, index) => 100 + index));
+ const prototype = await filePrototype(join(declaration.distributionRoot, "runtime"));
+ const originalRead = prototype.read;
+ const hold = gate(); const sizes: number[] = []; let active = 0; let peak = 0;
+ vi.spyOn(prototype, "read").mockImplementation(async function (this: FileHandle, ...args: any[]): Promise {
+ sizes.push(args[0].length); active++; peak = Math.max(peak, active);
+ try { await hold.promise; return await originalRead.apply(this, args as never); }
+ finally { active--; }
+ });
+ const creating = createNativeAcpxDistributionSnapshot(declaration, entries);
+ try {
+ await vi.waitFor(() => expect(sizes).toHaveLength(8));
+ expect(sizes.toSorted()).toEqual(Array.from({ length: 8 }, (_, index) => 100 + index));
+ } finally { hold.release(); }
+ const created = await creating;
+ try {
+ expect(peak).toBe(8);
+ expect(Object.keys(created.snapshot.digests).slice(0, entries.length)).toEqual(entries.map(entry => join(created.snapshot.roots[0]!, entry.path)));
+ for (const entry of entries) expect(hash(await readFile(join(created.snapshot.roots[0]!, entry.path)))).toBe(entry.sha256);
+ } finally { await created.commandDirectory.close(); await created.snapshot.close(); }
+ });
+ it("bounds simultaneous buffers and gives an oversized admitted file exclusive capacity", async () => {
+ const mib = 1024 * 1024;
+ const { declaration, entries } = await manyFileFixture([17 * mib, 17 * mib, 33 * mib]);
+ const prototype = await filePrototype(join(declaration.distributionRoot, "runtime"));
+ const originalRead = prototype.read;
+ const retained = new Map(); const observed: number[] = [];
+ vi.spyOn(prototype, "read").mockImplementation(async function (this: FileHandle, ...args: any[]): Promise {
+ if (!retained.has(this)) {
+ const file = this; const originalClose = file.close.bind(file);
+ file.close = async () => { try { await originalClose(); } finally { retained.delete(file); } };
+ }
+ retained.set(this, args[0].length);
+ const total = [...retained.values()].reduce((sum, size) => sum + size, 0); observed.push(total);
+ expect(total).toBeLessThanOrEqual(Math.max(32 * mib, args[0].length));
+ if (args[0].length > 32 * mib) expect(retained.size).toBe(1);
+ return originalRead.apply(this, args as never);
+ });
+ const created = await createNativeAcpxDistributionSnapshot(declaration, entries);
+ try { expect(Math.max(...observed)).toBe(33 * mib); }
+ finally { await created.commandDirectory.close(); await created.snapshot.close(); }
+ });
+ it("drains every admitted copy before failed-snapshot cleanup and schedules no later batch", async () => {
+ const { declaration, entries } = await manyFileFixture(Array.from({ length: 10 }, (_, index) => 91 + index));
+ await writeFile(join(declaration.distributionRoot, "file-00"), Buffer.alloc(91, 99));
+ const prototype = await filePrototype(join(declaration.distributionRoot, "runtime"));
+ const originalRead = prototype.read;
+ const hold = gate(); const entered = gate(); const invalidClosed = gate();
+ const readSizes: number[] = []; const removalStart = vi.mocked(rm).mock.calls.length;
+ vi.spyOn(prototype, "read").mockImplementation(async function (this: FileHandle, ...args: any[]): Promise {
+ const size = args[0].length; readSizes.push(size);
+ if (size === 91) {
+ const originalClose = this.close.bind(this);
+ this.close = async () => { await originalClose(); invalidClosed.release(); };
+ await entered.promise;
+ }
+ if (size === 92) { entered.release(); await hold.promise; }
+ return originalRead.apply(this, args as never);
+ });
+ const creating = createNativeAcpxDistributionSnapshot(declaration, entries);
+ let settled = false;
+ void creating.then(() => { settled = true; }, () => { settled = true; });
+ try {
+ await entered.promise; await invalidClosed.promise;
+ expect(settled).toBe(false);
+ } finally { hold.release(); }
+ await expect(creating).rejects.toThrow("digest mismatch: file-00");
+ expect(readSizes).not.toContain(99);
+ const removals = vi.mocked(rm).mock.calls.slice(removalStart).map(([path]) => String(path)).filter(path => /paperclip-acpx-native-/.test(path));
+ expect(removals).toHaveLength(1);
+ await new Promise(resolve => setImmediate(resolve));
+ await expect(stat(removals[0]!)).rejects.toMatchObject({ code: "ENOENT" });
+ });
+ it("rejects a source mutation while another file is being copied", async () => {
+ const { declaration, entries } = await manyFileFixture([101, 102]);
+ const prototype = await filePrototype(join(declaration.distributionRoot, "runtime"));
+ const originalRead = prototype.read; const entered = gate(); const hold = gate();
+ vi.spyOn(prototype, "read").mockImplementation(async function (this: FileHandle, ...args: any[]): Promise {
+ if (args[0].length === 101) { entered.release(); await hold.promise; }
+ return originalRead.apply(this, args as never);
+ });
+ const creating = createNativeAcpxDistributionSnapshot(declaration, entries);
+ const rejected = expect(creating).rejects.toThrow("changed while read");
+ try {
+ await entered.promise;
+ await writeFile(join(declaration.distributionRoot, "file-00"), Buffer.alloc(101, 7));
+ } finally { hold.release(); }
+ await rejected;
+ });
+ it("uses the existing guardian ownership and provider-exit proof for native children", async () => {
+ const declaration = await fixture({ script: '#!/bin/sh\nprintf "ready"\nwhile :; do sleep 1; done\n' });
+ const fences = await Promise.all([listen(), listen()]);
+ const fds = fences.map(server => (server as Server & { _handle?: { fd?: number } })._handle!.fd!);
+ const owners: number[] = [];
+ const child = (await (await verifyNativeAcpxInstallation(declaration)).openCommand()).spawn([], {}, {
+ credentialFenceFds: [fds[0]!, fds[1]!], activateCredentialFenceOwner: async pid => { owners.push(pid); },
+ });
+ let stderr = ""; child.stderr!.on("data", value => { stderr += String(value); });
+ try {
+ await awaitVerifiedAcpxProviderOwnership(child);
+ expect(owners).toEqual([child.pid]);
+ const [chunk] = await once(child.stdout!, "data"); expect(String(chunk), stderr).toBe("ready");
+ const exited = once(child, "exit"); child.kill(); await exited;
+ await awaitVerifiedAcpxProviderExit(child);
+ } finally {
+ child.kill(); await Promise.all(fences.map(server => new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve()))));
+ }
+ }, 15_000);
+});
+
+async function listen(): Promise {
+ const server = createServer(); server.listen(0, "127.0.0.1"); await once(server, "listening"); return server;
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts b/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts
new file mode 100644
index 00000000000..d8afb68cb70
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/native-distribution-integrity.ts
@@ -0,0 +1,200 @@
+import { createHash } from "node:crypto";
+import { constants } from "node:fs";
+import { chmod, lstat, mkdir, mkdtemp, open, realpath, rm, writeFile, type FileHandle } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { dirname, isAbsolute, join, relative, resolve } from "node:path";
+import type { AcpxPrivateSnapshot } from "./private-snapshot.js";
+
+export interface NativeAcpxDistributionEntry { path: string; sha256: string; size: number; executable: boolean }
+export interface NativeAcpxDistributionInput {
+ distributionRoot: string;
+ manifestPath: string;
+ /** Trusted profile pin, never taken from the installed manifest itself. */
+ expectedClosureSha256: string;
+ executable: string;
+ /** When present, execute this JS entry with the distribution's bundled Node. */
+ entrypoint?: string;
+ fixedArguments: readonly string[];
+ isolatedCacheEnvironmentName?: "COPILOT_PKG_CACHE_HOME";
+}
+export interface NativeAcpxDistributionSnapshot {
+ snapshot: AcpxPrivateSnapshot;
+ commandDirectory: FileHandle;
+ bootstrap: Buffer;
+}
+
+const MAX_NATIVE_TREE_BYTES = 1024 * 1024 * 1024;
+const MAX_NATIVE_FILE_BYTES = 384 * 1024 * 1024;
+const MAX_NATIVE_MANIFEST_BYTES = 4 * 1024 * 1024;
+// Bound both file descriptors and buffers. A single larger admitted file runs
+// alone and remains subject to MAX_NATIVE_FILE_BYTES.
+const NATIVE_COPY_CONCURRENCY = 8;
+const NATIVE_COPY_BUFFER_BYTES = 32 * 1024 * 1024;
+const BOOTSTRAP = ".paperclip-native-entry.cjs";
+const GUARD = ".paperclip-native-module-guard.cjs";
+export const NATIVE_ACPX_BOOTSTRAP_NAME = BOOTSTRAP;
+const sha256 = (value: string | Buffer) => createHash("sha256").update(value).digest("hex");
+const validPath = (value: unknown): value is string => typeof value === "string" && value.length > 0 && value.length <= 4_096 && !isAbsolute(value) && !/[\u0000-\u001f\u007f\\]/.test(value) && value.split("/").every(part => part.length > 0 && part !== "." && part !== "..");
+
+/** Parse a closed, canonical execution inventory before opening any file in it. */
+export function parseNativeAcpxDistributionEntries(value: unknown, expectedSha256: string): NativeAcpxDistributionEntry[] {
+ if (!/^[a-f0-9]{64}$/.test(expectedSha256)) throw new Error("Native ACPX closure pin is invalid");
+ const entries = value !== null && typeof value === "object" ? (value as { entries?: unknown }).entries : undefined;
+ if (!Array.isArray(entries) || entries.length === 0 || entries.length > 30_000) throw new Error("Native ACPX closure inventory is invalid");
+ let total = 0;
+ let previous = "";
+ const parsed = entries.map(raw => {
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) throw new Error("Native ACPX closure entry is invalid");
+ const entry = raw as Record;
+ if (Object.keys(entry).some(key => !["path", "sha256", "size", "executable"].includes(key)) || !validPath(entry.path) || entry.path <= previous || entry.path === BOOTSTRAP || entry.path === GUARD || entry.path === "manifest.json" || entry.path.startsWith(".paperclip-")) throw new Error("Native ACPX closure paths must be safe, unique and sorted");
+ if (typeof entry.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(entry.sha256) || !Number.isSafeInteger(entry.size) || Number(entry.size) < 0 || Number(entry.size) > MAX_NATIVE_FILE_BYTES || typeof entry.executable !== "boolean") throw new Error("Native ACPX closure file metadata is invalid");
+ previous = entry.path;
+ total += Number(entry.size);
+ if (total > MAX_NATIVE_TREE_BYTES) throw new Error("Native ACPX closure exceeds its byte bound");
+ return { path: entry.path, sha256: entry.sha256, size: Number(entry.size), executable: entry.executable };
+ });
+ if (sha256(JSON.stringify(parsed)) !== expectedSha256) throw new Error("Native ACPX closure manifest digest mismatch");
+ return parsed;
+}
+
+export async function readNativeAcpxDistributionEntries(input: NativeAcpxDistributionInput): Promise {
+ if (!validPath(input.executable) || (input.entrypoint !== undefined && !validPath(input.entrypoint)) || input.fixedArguments.length > 128 || input.fixedArguments.some(arg => typeof arg !== "string" || arg.length > 16_384 || arg.includes("\0")) || (input.isolatedCacheEnvironmentName !== undefined && input.isolatedCacheEnvironmentName !== "COPILOT_PKG_CACHE_HOME")) throw new Error("Native ACPX launch declaration is invalid");
+ const file = await open(input.manifestPath, constants.O_RDONLY | constants.O_NOFOLLOW);
+ try {
+ const before = await file.stat({ bigint: true });
+ if (!before.isFile() || before.size < 1n || before.size > BigInt(MAX_NATIVE_MANIFEST_BYTES)) throw new Error("Native ACPX manifest must be a bounded regular file");
+ const bytes = await file.readFile();
+ if (!same(before, await file.stat({ bigint: true })) || bytes.length !== Number(before.size)) throw new Error("Native ACPX manifest changed while read");
+ const entries = parseNativeAcpxDistributionEntries(JSON.parse(bytes.toString("utf8")), input.expectedClosureSha256);
+ if (!entries.some(entry => entry.path === input.executable && entry.executable && entry.size > 0) || (input.entrypoint !== undefined && !entries.some(entry => entry.path === input.entrypoint && entry.size > 0))) throw new Error("Native ACPX executable or entrypoint is absent from its closure");
+ return entries;
+ } finally { await file.close(); }
+}
+
+/**
+ * Freeze only manifest-admitted bytes. Native trees deliberately have a separate
+ * bound; the tighter JavaScript/npm snapshot limits remain unchanged.
+ */
+export async function createNativeAcpxDistributionSnapshot(input: NativeAcpxDistributionInput, entries: NativeAcpxDistributionEntry[]): Promise {
+ // Callers cannot substitute entries between manifest validation and copying.
+ entries = parseNativeAcpxDistributionEntries({ entries }, input.expectedClosureSha256);
+ if (process.platform !== "linux" && process.platform !== "darwin") throw new Error("Native ACPX snapshots require Linux or macOS");
+ const source = await realpath(input.distributionRoot);
+ const rootBefore = await lstat(source, { bigint: true });
+ if (!rootBefore.isDirectory() || rootBefore.isSymbolicLink()) throw new Error("Native ACPX distribution must be a directory");
+ const heldRoot = await open(source, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_DIRECTORY);
+ const privateRoot = await realpath(await mkdtemp(join(tmpdir(), "paperclip-acpx-native-")));
+ const packageRoot = join(privateRoot, "distribution");
+ const cacheRoot = join(privateRoot, "state");
+ const directories = new Set([privateRoot, packageRoot]);
+ const digests: Record = {};
+ const close = async () => {
+ for (const path of directories) await chmod(path, 0o700).catch(() => undefined);
+ await rm(privateRoot, { recursive: true, force: true });
+ };
+ let commandDirectory: FileHandle | undefined;
+ try {
+ if (!same(rootBefore, await heldRoot.stat({ bigint: true }))) throw new Error("Native ACPX distribution root changed before snapshot");
+ await mkdir(packageRoot, { mode: 0o700 });
+ if (input.isolatedCacheEnvironmentName) await mkdir(cacheRoot, { mode: 0o700 });
+ const copyEntry = async (entry: NativeAcpxDistributionEntry): Promise => {
+ const path = join(source, ...entry.path.split("/"));
+ if (await realpath(path) !== path) throw new Error("Native ACPX closure contains a symbolic link");
+ const before = await lstat(path, { bigint: true });
+ if (!before.isFile() || before.nlink !== 1n || before.size !== BigInt(entry.size) || Boolean(before.mode & 0o111n) !== entry.executable) throw new Error("Native ACPX closure file identity is invalid");
+ const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
+ try {
+ if (!same(before, await file.stat({ bigint: true }))) throw new Error("Native ACPX closure file changed before read");
+ const bytes = Buffer.alloc(entry.size);
+ let offset = 0;
+ while (offset < bytes.length) {
+ const read = await file.read(bytes, offset, bytes.length - offset, offset);
+ if (read.bytesRead === 0) throw new Error("Native ACPX closure file ended during snapshot");
+ offset += read.bytesRead;
+ }
+ if (!same(before, await file.stat({ bigint: true })) || !same(before, await lstat(path, { bigint: true })) || await realpath(path) !== path) throw new Error("Native ACPX closure file changed while read");
+ if (sha256(bytes) !== entry.sha256) throw new Error(`Native ACPX closure file digest mismatch: ${entry.path}`);
+ const target = join(packageRoot, ...entry.path.split("/"));
+ await mkdir(dirname(target), { recursive: true, mode: 0o700 });
+ let directory = dirname(target);
+ while (directory !== privateRoot) { directories.add(directory); directory = dirname(directory); }
+ await writeFile(target, bytes, { mode: entry.executable ? 0o500 : 0o400, flag: "wx" });
+ } finally { await file.close(); }
+ };
+ for (let start = 0; start < entries.length;) {
+ let end = start;
+ let bytes = 0;
+ while (end < entries.length && end - start < NATIVE_COPY_CONCURRENCY) {
+ const size = entries[end]!.size;
+ if (end > start && bytes + size > NATIVE_COPY_BUFFER_BYTES) break;
+ bytes += size;
+ end++;
+ }
+ const batch = entries.slice(start, end);
+ // Never clean the private root while another worker can still write or
+ // close a descriptor. Stop scheduling new batches after any rejection.
+ const copied = await Promise.allSettled(batch.map(copyEntry));
+ const failure = copied.find((result) => result.status === "rejected");
+ if (failure?.status === "rejected") throw failure.reason;
+ // Worker completion order must not change the module guard or manifest.
+ for (const entry of batch) digests[join(packageRoot, ...entry.path.split("/"))] = entry.sha256;
+ start = end;
+ }
+ if (!same(rootBefore, await heldRoot.stat({ bigint: true })) || !same(rootBefore, await lstat(source, { bigint: true }))) throw new Error("Native ACPX distribution root changed during snapshot");
+ const executable = join(packageRoot, ...input.executable.split("/"));
+ const args = [...(input.entrypoint === undefined ? [] : ["--require", join(packageRoot, GUARD), join(packageRoot, ...input.entrypoint.split("/"))]), ...input.fixedArguments];
+ if (input.entrypoint !== undefined) {
+ const guard = Buffer.from(nativeModuleGuard(digests));
+ await writeFile(join(packageRoot, GUARD), guard, { mode: 0o400, flag: "wx" });
+ digests[join(packageRoot, GUARD)] = sha256(guard);
+ }
+ const bootstrap = Buffer.from(nativeBootstrap(executable, digests[executable]!, args, input.isolatedCacheEnvironmentName ? { name: input.isolatedCacheEnvironmentName, value: cacheRoot } : undefined));
+ await writeFile(join(packageRoot, BOOTSTRAP), bootstrap, { mode: 0o400, flag: "wx" });
+ digests[join(packageRoot, BOOTSTRAP)] = sha256(bootstrap);
+ // executable is null: commandLease's separately-qualified provider runtime
+ // slot is unused; this distribution is spawned by the trusted bootstrap.
+ const manifest = Buffer.from(JSON.stringify({ roots: [packageRoot], executable: null, digests }));
+ const manifestPath = join(privateRoot, "manifest.json");
+ await writeFile(manifestPath, manifest, { mode: 0o400, flag: "wx" });
+ for (const directory of directories) await chmod(directory, 0o500);
+ commandDirectory = await open(packageRoot, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_DIRECTORY);
+ return { commandDirectory, bootstrap, snapshot: { roots: [packageRoot], executable: null, digests, handoff: { path: manifestPath, digest: sha256(manifest) }, close } };
+ } catch (error) {
+ await commandDirectory?.close(); await close(); throw error;
+ } finally { await heldRoot.close(); }
+}
+
+function nativeBootstrap(executable: string, executableDigest: string, args: string[], cache?: { name: string; value: string }): string {
+ return [
+ 'const {spawn}=require("node:child_process");',
+ 'const fs=require("node:fs");',
+ // The commandLease's guarded bootstrap owns FDs 5 (guardian), 6 (exit),
+ // 7/8 (credential fences). Keep them open in the native process too.
+ 'const guarded=process.env.PAPERCLIP_ACPX_NATIVE_GUARDED==="1";',
+ 'const env={...process.env}; delete env.PAPERCLIP_ACPX_NATIVE_GUARDED; delete env.PAPERCLIP_ACPX_PRIVATE_SNAPSHOT; delete env.PAPERCLIP_VERIFIED_RUNTIME_EXECUTABLE;',
+ 'env.NODE_DISABLE_COMPILE_CACHE="1"; delete env.NODE_COMPILE_CACHE;',
+ ...(cache ? [`env[${JSON.stringify(cache.name)}]=${JSON.stringify(cache.value)};`] : []),
+ 'if(guarded)for(const fd of [5,6,7,8])fs.fstatSync(fd);',
+ `const executable=${JSON.stringify(executable)};const fd=fs.openSync(executable,fs.constants.O_RDONLY|fs.constants.O_NOFOLLOW);`,
+ `if(require("node:crypto").createHash("sha256").update(fs.readFileSync(fd)).digest("hex")!==${JSON.stringify(executableDigest)})throw new Error("Native ACPX executable changed before spawn");`,
+ 'const stdio=guarded?[0,1,2,5,6,7,8]:[0,1,2]; const childExecutable=process.platform==="linux"?"/proc/self/fd/"+stdio.length:executable;stdio.push(fd);',
+ `const child=spawn(childExecutable,${JSON.stringify(args)},{env,cwd:process.cwd(),shell:false,detached:false,stdio});fs.closeSync(fd);`,
+ 'child.once("error",()=>process.exit(1)); child.once("exit",(code,signal)=>process.exit(signal?1:code??1));',
+ 'for(const signal of ["SIGTERM","SIGINT","SIGHUP"])process.on(signal,()=>child.kill(signal));',
+ ].join("\n");
+}
+
+function nativeModuleGuard(digests: Record): string {
+ return [
+ 'const {registerHooks,isBuiltin}=require("node:module");',
+ 'const {readFileSync,realpathSync}=require("node:fs");',
+ 'const {fileURLToPath}=require("node:url"); const {createHash}=require("node:crypto");',
+ `const digests=${JSON.stringify(digests)};`,
+ 'const verify=url=>{if(!url.startsWith("file:"))throw new Error("Native ACPX module must be a qualified file or builtin");const path=fileURLToPath(url);if(realpathSync(path)!==path||!Object.hasOwn(digests,path))throw new Error("Native ACPX module escaped its closed distribution");const bytes=readFileSync(path);if(createHash("sha256").update(bytes).digest("hex")!==digests[path])throw new Error("Native ACPX module digest mismatch");return bytes;};',
+ 'registerHooks({resolve(specifier,context,next){const result=next(specifier,context);if(!isBuiltin(specifier)&&!result.url.startsWith("node:"))verify(result.url);return result;},load(url,context,next){if(url.startsWith("node:"))return next(url,context);const bytes=verify(url);if(["module","commonjs","json"].includes(context.format))return {format:context.format,source:bytes,shortCircuit:true};return next(url,context);}});',
+ ].join("\n");
+}
+
+function same(a: { dev: bigint; ino: bigint; size: bigint; mtimeNs: bigint; ctimeNs: bigint }, b: typeof a): boolean {
+ return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-extensions.test.ts b/packages/paperclip-runner/src/drivers/acpx/profile-extensions.test.ts
new file mode 100644
index 00000000000..ac35ebed0df
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/profile-extensions.test.ts
@@ -0,0 +1,58 @@
+import { describe, expect, it, vi } from "vitest";
+import { bindAcpxExtensionTurn, validateAcpxExtensionInput, validateAcpxRichEvent } from "./profile-extensions.js";
+import type { CanonicalProviderEvent } from "../../provider-events.js";
+
+const event: CanonicalProviderEvent = { eventType: "plan.updated", itemId: "plan-1", payload: {
+ schema: "paperclip.plan.updated.v1", planId: "plan-1", revision: 1,
+ steps: [{ stepId: "one", body: "Validate", status: "pending" }], complete: false, syncStatus: "not_applicable",
+} };
+const input = { method: "cursor/create_plan", questionSet: {
+ schema: "paperclip.question_set.v1" as const, description: "complete plan".repeat(1000),
+ questions: [{ id: "plan-revision", prompt: "Approve?", answerMode: "single_select" as const, required: true,
+ options: [{ id: "accept", label: "Accept" }, { id: "cancel", label: "Cancel" }] }],
+}, resolve: () => ({ outcome: "accepted" }), cancel: () => ({ outcome: "cancelled" }) };
+
+describe("ACP extension turn binding", () => {
+ it("preserves bounded full plans and rejects oversized documents", () => {
+ expect(() => validateAcpxExtensionInput(input)).not.toThrow();
+ expect(() => validateAcpxExtensionInput({ ...input, questionSet: { ...input.questionSet, description: "a".repeat(100001) } })).toThrow();
+ });
+ it("admits canonical activity but cannot mint a terminal or semantic mutation", () => {
+ expect(() => validateAcpxRichEvent(event)).not.toThrow();
+ expect(() => validateAcpxRichEvent({ ...event, eventType: "turn.completed" } as unknown as CanonicalProviderEvent)).toThrow();
+ expect(() => validateAcpxRichEvent({ ...event, payload: { ...event.payload, extra: "unbounded" } })).toThrow();
+ });
+ it("waits for notification normalization before terminal settlement and preserves order", async () => {
+ let release!: () => void;
+ const gate = new Promise(resolve => { release = resolve; });
+ const emitted: string[] = [];
+ const binding = bindAcpxExtensionTurn({
+ adapter: { request: async () => ({ events: [event], response: {} }),
+ notification: async (method) => { if (method === "first") await gate; emitted.push(method); return [event]; } },
+ sessionId: "session", active: () => true, waitForInput: vi.fn(), emit: vi.fn(),
+ });
+ binding.onExtensionNotification("first", { sessionId: "session" });
+ binding.onExtensionNotification("second", { sessionId: "session" });
+ let drained = false;
+ const drain = binding.drain().then(() => { drained = true; });
+ await Promise.resolve();
+ expect(drained).toBe(false);
+ release(); await drain;
+ expect(emitted).toEqual(["first", "second"]);
+ });
+ it("retains request ID zero and rejects cross-session or stale events", async () => {
+ let active = true;
+ const waitForInput = vi.fn(async () => ({ outcome: "accepted" }));
+ const binding = bindAcpxExtensionTurn({
+ adapter: { request: async () => ({ input }), notification: async () => [event] },
+ sessionId: "session", active: () => active, waitForInput, emit: vi.fn(),
+ });
+ const context = { requestId: 0, signal: new AbortController().signal };
+ await binding.onExtensionRequest("cursor/create_plan", { sessionId: "session" }, context);
+ expect(waitForInput).toHaveBeenCalledWith(input, context);
+ await expect(binding.onExtensionRequest("cursor/create_plan", { sessionId: "another" }, context)).rejects.toThrow("mismatch");
+ active = false;
+ binding.onExtensionNotification("event", { sessionId: "session" });
+ await expect(binding.drain()).rejects.toThrow("stale turn");
+ });
+});
diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-extensions.ts b/packages/paperclip-runner/src/drivers/acpx/profile-extensions.ts
new file mode 100644
index 00000000000..070088aab86
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/profile-extensions.ts
@@ -0,0 +1,139 @@
+import type { HarnessRuntimeRequestResolution } from "../../contracts/harness-driver.js";
+import { parsePaperclipQuestionSet, type PaperclipQuestionSet } from "../../contracts/question-set.js";
+import { isCanonicalProviderEventType, type CanonicalProviderEvent } from "../../provider-events.js";
+import { validatePrpEvent } from "../../protocol/replay-contract.js";
+import type { QualifiedAcpxAgent } from "./qualified-profiles.js";
+
+export const ACPX_CANONICAL_INPUT_METHODS = [
+ "elicitation/create", "cursor/ask_question", "cursor/create_plan",
+] as const;
+export function isAcpxCanonicalInputMethod(method: string): boolean {
+ return (ACPX_CANONICAL_INPUT_METHODS as readonly string[]).includes(method);
+}
+
+export interface AcpxExtensionInput {
+ method: string;
+ questionSet: PaperclipQuestionSet;
+ details?: Record;
+ resolve(resolution: HarnessRuntimeRequestResolution): Record;
+ cancel(): Record;
+}
+export type AcpxExtensionRequestResult =
+ | { input: AcpxExtensionInput }
+ | { events: CanonicalProviderEvent[]; response: Record };
+export interface AcpxProfileExtensionAdapter {
+ request(method: string, params: Record): Promise;
+ notification(method: string, params: Record): Promise;
+}
+export interface AcpxProfileExtensionContext {
+ workspacePath: string;
+ sessionId: string;
+ turnId: string;
+}
+
+/** Provider branches install their closed, pinned adapters here after qualification research. */
+export function createAcpxProfileExtensionAdapter(
+ _agent: QualifiedAcpxAgent,
+ _context: AcpxProfileExtensionContext,
+): AcpxProfileExtensionAdapter | null {
+ return null;
+}
+export function acpxProfileClientCapabilities(_agent: QualifiedAcpxAgent): Record {
+ return {};
+}
+
+/** Reject an oversized approval document; never silently approve a truncated revision. */
+export function validateAcpxExtensionInput(input: AcpxExtensionInput): void {
+ if (!isAcpxCanonicalInputMethod(input.method)) throw new Error("Unsupported ACP input method");
+ parsePaperclipQuestionSet(input.questionSet);
+ if (Buffer.byteLength(JSON.stringify(input.questionSet)) > 196 * 1024) {
+ throw new Error("ACP input exceeds its complete-document byte limit");
+ }
+}
+
+/** Display-only extension channel cannot mint terminal events, tools, or approvals. */
+export function validateAcpxRichEvent(event: CanonicalProviderEvent): void {
+ if (!isCanonicalProviderEventType(event.eventType) || event.eventType === "harness.diagnostic"
+ || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/.test(event.itemId)
+ || Buffer.byteLength(JSON.stringify(event)) > 240 * 1024) {
+ throw new Error("Unsupported ACP rich activity event");
+ }
+ if ((event.eventType === "artifact.generated" && event.payload.registered !== false)
+ || (event.eventType === "plan.updated" && (event.payload.syncStatus !== "not_applicable"
+ || (event.payload.documentRevision !== undefined && event.payload.documentRevision !== null)))) {
+ throw new Error("ACP display activity cannot claim a control-plane mutation");
+ }
+ const validation = validatePrpEvent({
+ schema: "paperclip.prp.event.v1",
+ sourceEventId: "validation:1", sourceSeq: 1, sourceInstanceId: "validation",
+ sourceKind: "runner", runId: "validation", normalizedSessionId: "validation",
+ turnId: "validation", itemId: event.itemId, eventType: event.eventType,
+ schemaVersion: 1, priority: 1, emittedAt: "2026-09-28T00:00:00.000Z", payload: event.payload,
+ });
+ if (!validation.ok) throw new Error("ACP rich activity failed its canonical schema");
+}
+
+export function bindAcpxExtensionTurn(input: {
+ adapter: AcpxProfileExtensionAdapter | null;
+ active(): boolean;
+ sessionId: string;
+ waitForInput(input: AcpxExtensionInput, context: { requestId: string | number; signal: AbortSignal; responseDelivery?: Promise }): Promise>;
+ emit(event: CanonicalProviderEvent): void;
+}) {
+ let queue = Promise.resolve();
+ let pending = 0;
+ let failure: unknown;
+ const enqueue = (work: () => Promise): Promise => {
+ if (++pending > 64) {
+ --pending;
+ failure ??= new Error("ACP extension work queue exceeded its bound");
+ return Promise.reject(failure);
+ }
+ const job = queue.then(async () => {
+ if (failure) throw failure;
+ if (!input.active()) throw new Error("ACP extension belongs to a stale turn");
+ return work();
+ }).finally(() => { --pending; });
+ queue = job.then(() => {}, error => { failure ??= error; });
+ return job;
+ };
+ const emit = (events: CanonicalProviderEvent[]) => {
+ if (!Array.isArray(events) || events.length > 256) throw new Error("ACP extension event batch exceeds its bound");
+ if (!input.active()) throw new Error("ACP extension belongs to a stale turn");
+ for (const event of events) {
+ validateAcpxRichEvent(event);
+ input.emit(event);
+ }
+ };
+ const assertSession = (params: Record) => {
+ if (params.sessionId !== input.sessionId) throw new Error("ACP extension session mismatch");
+ if (!input.adapter) throw new Error("ACP extension adapter is unavailable");
+ };
+ return {
+ async onExtensionRequest(method: string, params: Record, context: { requestId: string | number; signal: AbortSignal; responseDelivery?: Promise }) {
+ assertSession(params);
+ if (context.signal.aborted) throw new Error("ACP extension was cancelled");
+ const result = await enqueue(() => input.adapter!.request(method, params));
+ if (context.signal.aborted || !input.active()) {
+ if ("input" in result) return result.input.cancel();
+ throw new Error("ACP extension was cancelled");
+ }
+ if ("input" in result) {
+ validateAcpxExtensionInput(result.input);
+ return input.waitForInput(result.input, context);
+ }
+ emit(result.events);
+ return result.response;
+ },
+ onExtensionNotification(method: string, params: Record) {
+ void enqueue(async () => {
+ assertSession(params);
+ emit(await input.adapter!.notification(method, params));
+ }).catch(() => {});
+ },
+ async drain() {
+ await queue;
+ if (failure) throw failure;
+ },
+ };
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts b/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts
new file mode 100644
index 00000000000..a78aa47c6c5
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts
@@ -0,0 +1,21 @@
+import type { QualifiedAcpxAgent, QualifiedAcpxProfile } from "./qualified-profiles.js";
+import { verifyQualifiedAcpxInstallation, type VerifiedAcpxInstallation } from "./installation-integrity.js";
+
+/** Closed build-owned registry. Provider branches add their pinned installations here. */
+export async function verifyAcpxProfileInstallation(profile: QualifiedAcpxProfile): Promise {
+ if (profile.agent !== "claude" && profile.agent !== "codex" && profile.agent !== "grok") {
+ throw new Error(`ACPX ${profile.agent} verified candidate distribution is not installed in this build`);
+ }
+ return verifyQualifiedAcpxInstallation(profile);
+}
+
+/** Provider policy admission is repeated immediately before each process launch. */
+export async function assertAcpxProfileWorkspace(_agent: QualifiedAcpxAgent, _workspace: string): Promise {}
+
+/** Candidate branches validate only explicitly bound, sanitized launch credentials. */
+export function assertAcpxProfileEnvironment(_agent: QualifiedAcpxAgent, _environment: Readonly): void {}
+
+/** Optional provider-specific classification; never changes whether admission succeeded. */
+export function classifyAcpxProfileError(_agent: QualifiedAcpxAgent, _error: unknown): Error | null {
+ return null;
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.test.ts b/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.test.ts
new file mode 100644
index 00000000000..f6c3cfeb5c3
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.test.ts
@@ -0,0 +1,47 @@
+import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { pathToFileURL } from "node:url";
+import { afterEach, expect, it, vi } from "vitest";
+import { resolveRunnerProviderAssetsRoot } from "./provider-assets-root.js";
+
+const roots: string[] = [];
+afterEach(async () => { vi.unstubAllEnvs(); await Promise.all(roots.splice(0).map(root => rm(root, { recursive: true, force: true }))); });
+async function root() { const path = await mkdtemp(join(tmpdir(), "runner-provider-assets-")); roots.push(path); return path; }
+
+it("uses one fixed provider directory for source, compiled and bundled runner layouts", async () => {
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT", undefined);
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST", undefined);
+ const path = await root();
+ for (const relative of ["src/drivers/acpx/cursor-installation.ts", "dist/drivers/acpx/cursor-installation.js", "dist/cli/acpx-runtime-sidecar.cjs"]) {
+ expect(resolveRunnerProviderAssetsRoot(pathToFileURL(join(path, relative)).href, "cursor")).toMatch(/provider-assets\/cursor$/);
+ }
+ expect(() => resolveRunnerProviderAssetsRoot(pathToFileURL(join(path, "workspace/arbitrary.ts")).href, "cursor")).toThrow("verified package layout");
+});
+
+it("resolves descriptor sidecars only through the runner-bound canonical package manifest", async () => {
+ const path = await root();
+ await writeFile(join(path, "package.json"), JSON.stringify({ name: "@paperclipai/paperclip-runner" }));
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT", path);
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST", join(path, "package.json"));
+ expect(resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "pi")).toMatch(/provider-assets\/pi$/);
+ await writeFile(join(path, "package.json"), JSON.stringify({ name: "untrusted" }));
+ expect(() => resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "pi")).toThrow("runner package");
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT", "relative");
+ expect(() => resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "pi")).toThrow("normalized absolute");
+});
+
+it("rejects external manifests, links, asset escapes and incomplete authority", async () => {
+ const path = await root(); const outside = await root();
+ await writeFile(join(outside, "package.json"), JSON.stringify({ name: "@paperclipai/paperclip-runner" }));
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT", path);
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST", join(outside, "package.json"));
+ expect(() => resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "copilot")).toThrow("escapes");
+ await writeFile(join(path, "package.json"), JSON.stringify({ name: "@paperclipai/paperclip-runner" }));
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST", join(path, "package.json"));
+ await mkdir(join(path, "provider-assets"));
+ await symlink(outside, join(path, "provider-assets/copilot"));
+ expect(() => resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "copilot")).toThrow("contained");
+ vi.stubEnv("PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT", undefined);
+ expect(() => resolveRunnerProviderAssetsRoot("file:///proc/self/fd/18", "copilot")).toThrow("no bound");
+});
diff --git a/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.ts b/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.ts
new file mode 100644
index 00000000000..326740c00c1
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/provider-assets-root.ts
@@ -0,0 +1,64 @@
+import { constants, closeSync, fstatSync, lstatSync, openSync, readFileSync, realpathSync } from "node:fs";
+import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
+import { fileURLToPath } from "node:url";
+
+type NativeProvider = "cursor" | "copilot" | "pi";
+const RUNNER_PACKAGE_NAME = "@paperclipai/paperclip-runner";
+
+/** Resolve only runner-owned package assets, including descriptor-loaded sidecars. */
+export function resolveRunnerProviderAssetsRoot(moduleUrl: string, provider: NativeProvider): string {
+ if (!["cursor", "copilot", "pi"].includes(provider)) throw new Error("Unknown native ACP provider assets");
+ const boundRoot = process.env.PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT;
+ const boundManifest = process.env.PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST;
+ let packageRoot: string;
+ if (boundRoot !== undefined) {
+ const root = normalizedAbsolute(boundRoot);
+ const manifest = normalizedAbsolute(boundManifest ?? join(root, "package.json"));
+ packageRoot = realpathSync(root);
+ const canonicalManifest = realpathSync(manifest);
+ if (!inside(packageRoot, canonicalManifest)) throw new Error("Runner provider manifest escapes its bound package root");
+ // The authority comes from runnerd's selected provider pack, never provider
+ // environment. Verify the selected manifest itself before deriving assets.
+ const fd = openSync(manifest, constants.O_RDONLY | constants.O_NOFOLLOW);
+ try {
+ const before = fstatSync(fd, { bigint: true });
+ if (!before.isFile() || before.size < 1n || before.size > 64n * 1024n) throw new Error("Runner provider manifest is not a bounded regular file");
+ const bytes = readFileSync(fd);
+ const after = fstatSync(fd, { bigint: true });
+ if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || before.mtimeNs !== after.mtimeNs || before.ctimeNs !== after.ctimeNs
+ || bytes.length !== Number(before.size) || realpathSync(manifest) !== canonicalManifest) throw new Error("Runner provider manifest changed during admission");
+ const value = JSON.parse(bytes.toString("utf8")) as { name?: unknown };
+ if (value?.name !== RUNNER_PACKAGE_NAME) throw new Error("Runner provider manifest does not name the runner package");
+ } finally { closeSync(fd); }
+ packageRoot = dirname(canonicalManifest);
+ } else {
+ if (boundManifest !== undefined) throw new Error("Runner provider manifest has no bound package root");
+ const url = new URL(moduleUrl);
+ if (url.protocol !== "file:" || url.search || url.hash) throw new Error("Provider factory is outside a verified package layout");
+ if (new RegExp(`/(?:src|dist)/drivers/acpx/${provider}-installation\\.(?:ts|js)$`).test(url.pathname)) packageRoot = fileURLToPath(new URL("../../../", url));
+ else if (/\/dist\/cli\/acpx-runtime-sidecar\.(?:cjs|js)$/.test(url.pathname)) packageRoot = fileURLToPath(new URL("../../", url));
+ else throw new Error("Provider factory is outside a verified package layout");
+ packageRoot = realpathSync(packageRoot);
+ }
+ const assets = join(packageRoot, "provider-assets", provider);
+ // Missing materialization is diagnosed by the installation verifier. Existing
+ // directory components must not redirect discovery outside this package.
+ for (const path of [join(packageRoot, "provider-assets"), assets]) {
+ try {
+ const stat = lstatSync(path);
+ if (!stat.isDirectory() || stat.isSymbolicLink() || !inside(packageRoot, realpathSync(path))) throw new Error("Runner provider asset directory is not contained by its package");
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
+ }
+ }
+ return assets;
+}
+
+function normalizedAbsolute(value: string): string {
+ if (!isAbsolute(value) || value.includes("\0") || resolve(value) !== value) throw new Error("Runner provider package authority must be a normalized absolute path");
+ return value;
+}
+function inside(root: string, path: string): boolean {
+ const rel = relative(root, path);
+ return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
+}
diff --git a/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts
index 944fe433aca..b7b5f398987 100644
--- a/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts
@@ -11,7 +11,9 @@ export interface QualifiedAcpxProfile {
readonly protocolVersion: typeof ACPX_DRIVER_PROTOCOL_VERSION;
readonly acpxVersion: typeof QUALIFIED_ACPX_VERSION;
readonly agent: QualifiedAcpxAgent;
- readonly agentProfileVersion: 1;
+ readonly agentProfileVersion: 1 | 2 | 3 | 4 | 5;
+ readonly qualificationStatus?: "pending";
+ readonly modelPolicy?: "explicit-provider-verified";
/** Wire identity: an npm package name or a runner-owned builtin: identifier. */
readonly agentServerPackage: string;
readonly agentServerVersion: string;
@@ -56,6 +58,28 @@ export const QUALIFIED_ACPX_PROFILES: Readonly<
reportedModelId: "openrouter/deepseek/deepseek-v4-flash-0731",
permissionPolicy: "interactive",
},
+ cursor: {
+ driverKind: ACPX_DRIVER_KIND, protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
+ acpxVersion: QUALIFIED_ACPX_VERSION, agent: "cursor", agentProfileVersion: 2,
+ agentServerPackage: "cursor-agent", agentServerVersion: "2026.09.26-dd393fe",
+ agentRuntimePackage: null, agentRuntimeVersion: null,
+ commandDigest: "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899",
+ // Authenticated discovery has not established a qualification model. Never
+ // turn this empty declaration into a default; callers must select an ID.
+ qualificationModel: "", reportedModelId: "", permissionPolicy: "interactive",
+ modelPolicy: "explicit-provider-verified", qualificationStatus: "pending",
+ },
+ copilot: {
+ driverKind: ACPX_DRIVER_KIND, protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
+ acpxVersion: QUALIFIED_ACPX_VERSION, agent: "copilot", agentProfileVersion: 2,
+ agentServerPackage: "@github/copilot", agentServerVersion: "1.0.88",
+ agentRuntimePackage: null, agentRuntimeVersion: null,
+ commandDigest: "sha256:b18c01603dd0169d233140709cfaa8bf5304a03cf5de78ca4f625f30013e8457",
+ // Authenticated discovery has not established a qualification model. Never
+ // turn this empty declaration into a default; callers must select an ID.
+ qualificationModel: "", reportedModelId: "", permissionPolicy: "interactive",
+ modelPolicy: "explicit-provider-verified", qualificationStatus: "pending",
+ },
claude: {
driverKind: ACPX_DRIVER_KIND,
protocolVersion: ACPX_DRIVER_PROTOCOL_VERSION,
@@ -96,7 +120,7 @@ export function resolveQualifiedAcpxProfile(
): QualifiedAcpxProfile {
const profile = QUALIFIED_ACPX_PROFILES[agent];
if (!requestedModel.trim()) throw new Error("ACPX model must not be empty");
- if (agent !== "claude" && agent !== "grok" && requestedModel !== profile.qualificationModel) {
+ if (agent !== "claude" && agent !== "grok" && profile.modelPolicy !== "explicit-provider-verified" && requestedModel !== profile.qualificationModel) {
throw new Error(
`ACPX ${agent} profile requires exact model ${profile.qualificationModel}; received ${requestedModel}`,
);
diff --git a/packages/paperclip-runner/src/drivers/acpx/recovery-identity.test.ts b/packages/paperclip-runner/src/drivers/acpx/recovery-identity.test.ts
index ca4b10e69a8..def42e6c4f5 100644
--- a/packages/paperclip-runner/src/drivers/acpx/recovery-identity.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/recovery-identity.test.ts
@@ -76,6 +76,21 @@ describe("ACPX recovery identity", () => {
).not.toThrow();
});
+ it("rejects restoration across task execution-policy changes", async () => {
+ const fixture = await recoveryFixture();
+ const readonly = await createAcpxRecoveryBinding({ ...fixture.input, providerPolicy: { readOnly: true } });
+ const writable = await createAcpxRecoveryBinding({ ...fixture.input, providerPolicy: { readOnly: false } });
+ const record = createAcpxIdentityRecord(fixture.expected, readonly);
+ expect(readonly.profileSessionKey).not.toBe(writable.profileSessionKey);
+ expect(readonly.profileDigest).not.toBe(writable.profileDigest);
+ expect(() => verifyExpectedAcpxIdentity(fixture.expected, writable, record)).toThrow("persisted runtime record");
+ const changedRoots = await createAcpxRecoveryBinding({ ...fixture.input,
+ providerPolicy: { readOnly: true, protectedPaths: ["/another-protected-root"] } });
+ expect(changedRoots.profileSessionKey).not.toBe(readonly.profileSessionKey);
+ await expect(createAcpxRecoveryBinding({ ...fixture.input,
+ providerPolicy: { readOnly: "yes" as never } })).rejects.toThrow("valid task execution policy");
+ });
+
it("uses collision-resistant roots and policy-bound provider keys", async () => {
const fixture = await recoveryFixture();
const otherSession = await createAcpxRecoveryBinding({
diff --git a/packages/paperclip-runner/src/drivers/acpx/recovery-identity.ts b/packages/paperclip-runner/src/drivers/acpx/recovery-identity.ts
index 61d65fe666a..d3cef031776 100644
--- a/packages/paperclip-runner/src/drivers/acpx/recovery-identity.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/recovery-identity.ts
@@ -43,8 +43,10 @@ export async function createAcpxRecoveryBinding(input: {
profile: QualifiedAcpxProfile;
requestedModel: string;
permissionMode: NativeAcpxPermissionMode;
+ providerPolicy?: { readOnly: boolean; readRoots?: readonly string[]; protectedPaths?: readonly string[] };
}): Promise {
validateIdentity(input.normalizedSessionId, "normalized session");
+ if (input.providerPolicy !== undefined && typeof input.providerPolicy.readOnly !== "boolean") throw new Error("ACPX recovery requires a valid task execution policy");
if (input.requestedModel !== input.profile.qualificationModel) {
throw new Error("ACPX recovery requested an unqualified model");
}
@@ -72,6 +74,11 @@ export async function createAcpxRecoveryBinding(input: {
qualificationModel: input.profile.qualificationModel,
reportedModelId: input.profile.reportedModelId,
permissionPolicy: input.profile.permissionPolicy,
+ ...(input.providerPolicy === undefined ? {} : { executionPolicy: {
+ readOnly: input.providerPolicy.readOnly,
+ readRoots: input.providerPolicy.readRoots ?? [],
+ protectedPaths: input.providerPolicy.protectedPaths ?? [],
+ } }),
}),
);
const profileSessionKey = digest(
diff --git a/packages/paperclip-runner/src/drivers/acpx/response-delivery.test.ts b/packages/paperclip-runner/src/drivers/acpx/response-delivery.test.ts
new file mode 100644
index 00000000000..8e2073ec064
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/response-delivery.test.ts
@@ -0,0 +1,29 @@
+import { describe, expect, it, vi } from "vitest";
+import { deliverAcpxResponse, requireAcpxResponseDelivery } from "./response-delivery.js";
+
+describe("ACP interaction response delivery", () => {
+ it("does not acknowledge callback settlement before the provider pipe write", async () => {
+ const written = Promise.withResolvers();
+ const settle = vi.fn();
+ let acknowledged = false;
+ const pending = deliverAcpxResponse(requireAcpxResponseDelivery({ responseDelivery: written.promise }), settle)
+ .then(value => { acknowledged = true; return value; });
+ expect(settle).toHaveBeenCalledOnce();
+ await Promise.resolve();
+ expect(acknowledged).toBe(false);
+ written.resolve();
+ await expect(pending).resolves.toEqual({ resolved: true });
+ });
+
+ it.each(["cancelled", "disconnected", "write failed"])("does not report delivery when the response is %s", async reason => {
+ const written = Promise.withResolvers();
+ const pending = deliverAcpxResponse(written.promise, () => {});
+ const failed = expect(pending).rejects.toThrow(reason);
+ written.reject(new Error(reason));
+ await failed;
+ });
+
+ it("requires a transport-owned receipt before presenting an interaction", () => {
+ expect(() => requireAcpxResponseDelivery({})).toThrow("no bound provider response");
+ });
+});
diff --git a/packages/paperclip-runner/src/drivers/acpx/response-delivery.ts b/packages/paperclip-runner/src/drivers/acpx/response-delivery.ts
new file mode 100644
index 00000000000..29a4f196609
--- /dev/null
+++ b/packages/paperclip-runner/src/drivers/acpx/response-delivery.ts
@@ -0,0 +1,17 @@
+/** A local callback result is not evidence that the provider received its reply. */
+export function requireAcpxResponseDelivery(context: { responseDelivery?: Promise }): Promise {
+ if (!context.responseDelivery || typeof context.responseDelivery.then !== "function") {
+ throw new Error("ACP interaction has no bound provider response delivery receipt");
+ }
+ return context.responseDelivery;
+}
+
+/** Settle the callback first: the SDK can only write after that callback returns. */
+export async function deliverAcpxResponse(
+ responseDelivery: Promise,
+ settle: () => void,
+): Promise<{ resolved: true }> {
+ settle();
+ await responseDelivery;
+ return { resolved: true };
+}
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 a923ba3876e..3a2dd3ece64 100644
--- a/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/runtime-host.test.ts
@@ -783,7 +783,7 @@ describe("ACPX runtime host", () => {
).rejects.toThrow();
});
- it("rejects Pi before installation or runtime launch", async () => {
+ it("rejects Pi without an explicit task policy before installation or runtime launch", async () => {
const fixture = await hostFixture();
const verifyInstallation = vi.fn();
const openRuntime = vi.fn();
@@ -801,11 +801,37 @@ describe("ACPX runtime host", () => {
reportRetainedCleanupFailure: vi.fn(),
},
),
- ).rejects.toThrow("descriptor-confined verified launch");
+ ).rejects.toThrow("explicit task execution policy");
expect(verifyInstallation).not.toHaveBeenCalled();
expect(openRuntime).not.toHaveBeenCalled();
});
+ it("binds Pi task policy independently of permissions and rejects an uninstalled candidate", async () => {
+ const fixture = await hostFixture();
+ const model = "openrouter/deepseek/deepseek-v4-flash-0731";
+ const profile = resolveQualifiedAcpxProfile("pi", model);
+ const openRuntime = vi.fn(async (options: AcpxRuntimePortOpenOptions) => {
+ expect(options.launchEnvironment.PAPERCLIP_PI_READ_ONLY).toBe("1");
+ expect(options.launchEnvironment.PAPERCLIP_PI_SYSTEM_INSTRUCTIONS).toBe("Bound instructions");
+ expect(JSON.parse(options.launchEnvironment.PAPERCLIP_PI_READ_ROOTS!)).toEqual([]);
+ expect(options.permissionMode).toBe("approve-all");
+ return runtimePort({ getStatus: async () => ({ models: { currentModelId: model } }) });
+ });
+ const options = { ...fixture.options, agent: "pi" as const, model,
+ permissionMode: "approve-all" as const, providerPolicy: { readOnly: true }, systemInstructions: "Bound instructions" };
+ await expect(AcpxRuntimeHost.open(options, { openRuntime, reportRetainedCleanupFailure: vi.fn() }))
+ .rejects.toThrow("verified candidate distribution is not installed");
+ expect(openRuntime).not.toHaveBeenCalled();
+ const host = await AcpxRuntimeHost.open(options, fixture.dependencies({
+ verifyInstallation: async () => ({ commandDigest: profile.commandDigest,
+ agentServerPackageJsonPath: join(fixture.root, "package.json"), agentRuntimePackageJsonPath: null,
+ openCommand: async () => ({ spawn: () => { throw new Error("not used"); }, close: async () => {} }),
+ }), openRuntime,
+ }));
+ await host.close({ reason: "policy verified" });
+ expect(openRuntime).toHaveBeenCalledOnce();
+ });
+
it("selects and verifies Claude's qualified reported model", async () => {
const fixture = await hostFixture();
let selected = false;
@@ -1265,6 +1291,8 @@ describe("ACPX runtime host", () => {
const turn = runtimeTurn();
const startTurn = vi.fn(() => turn);
const onElicitation = vi.fn();
+ const onExtensionRequest = vi.fn();
+ const onExtensionNotification = vi.fn();
const runtime = runtimePort({ startTurn });
const host = await AcpxRuntimeHost.open(
{
@@ -1282,12 +1310,16 @@ describe("ACPX runtime host", () => {
text: "Complete the task.",
requestId: "turn-1",
onElicitation,
+ onExtensionRequest,
+ onExtensionNotification,
}),
).toBe(turn);
expect(startTurn).toHaveBeenCalledWith({
text: "Complete the task.",
requestId: "turn-1",
onElicitation,
+ onExtensionRequest,
+ onExtensionNotification,
});
expect(() =>
host.startTurn({ text: "Concurrent", requestId: "turn-2" }),
@@ -1304,6 +1336,34 @@ describe("ACPX runtime host", () => {
);
});
+ it("clones ephemeral capabilities and fences steering controls to an acknowledged active turn", async () => {
+ const fixture = await hostFixture();
+ const turn = runtimeTurn();
+ const runtime = Object.assign(runtimePort({ startTurn: () => turn }), {
+ steeringCapability: () => ({ steering: true, queuedFollowUp: true }),
+ steerActiveTurn: vi.fn(async () => undefined),
+ queueFollowUp: vi.fn(async () => undefined),
+ });
+ const clientCapabilities = { _meta: { fixture: { enabled: true } } };
+ let observed: Record | undefined;
+ const host = await AcpxRuntimeHost.open({
+ ...fixture.options, agent: "codex", model: "gpt-5.6-sol", permissionMode: "approve-reads",
+ environment: { PAPERCLIP_ACPX_CODEX_AUTH_JSON_SECRET: "{}" }, clientCapabilities,
+ }, fixture.dependencies({ openRuntime: async (options) => { observed = options.clientCapabilities; return runtime; } }));
+ expect(observed).toEqual(clientCapabilities);
+ expect(observed).not.toBe(clientCapabilities);
+ await expect(host.steerActiveTurn("Early")).rejects.toThrow("active turn");
+ host.startTurn({ text: "Start", requestId: "turn-1" });
+ await expect(host.steerActiveTurn("Wrong turn", "turn-other")).rejects.toThrow("active turn");
+ await host.steerActiveTurn("Steer", "turn-1");
+ await host.queueFollowUp("Next", "turn-1");
+ expect(runtime.steerActiveTurn).toHaveBeenCalledExactlyOnceWith("Steer", "turn-1");
+ expect(runtime.queueFollowUp).toHaveBeenCalledExactlyOnceWith("Next", "turn-1");
+ expect(runtime.startTurn).toHaveBeenCalledOnce();
+ await host.close({ reason: "controls tested" });
+ await expect(host.queueFollowUp("Too late", "turn-1")).rejects.toThrow("active turn");
+ });
+
it("rejects oversized turn inputs before calling the runtime", async () => {
const fixture = await hostFixture();
const runtime = runtimePort();
diff --git a/packages/paperclip-runner/src/drivers/acpx/runtime-host.ts b/packages/paperclip-runner/src/drivers/acpx/runtime-host.ts
index 20de8c9aace..1f2d83919c2 100644
--- a/packages/paperclip-runner/src/drivers/acpx/runtime-host.ts
+++ b/packages/paperclip-runner/src/drivers/acpx/runtime-host.ts
@@ -1,10 +1,13 @@
+import { dirname, join } from "node:path";
+import { assertAcpxProfileEnvironment, assertAcpxProfileWorkspace, classifyAcpxProfileError, verifyAcpxProfileInstallation } from "./profile-installation.js";
+import { createAcpxRuntimeSkillLease } from "./runtime-skill-lease.js";
import { stageManagedGrokCredential } from "./grok-credentials.js";
-import { join } from "node:path";
import { claudeNativeSkillPrompt } from "./native-skill-prompt.js";
import { nativeMcpLaunchBinding } from "../native-mcp.js";
import type {
AcpElicitationHandler,
+ AcpRuntimeOptions,
AcpRuntimeEvent,
AcpRuntimeTurnResult,
} from "acpx/runtime";
@@ -26,7 +29,6 @@ import {
type AcpxProviderLifetimeLease,
} from "./codex-credentials.js";
import {
- verifyQualifiedAcpxInstallation,
type VerifiedAcpxCommandLease,
type VerifiedAcpxInstallation,
} from "./installation-integrity.js";
@@ -51,6 +53,7 @@ import {
import {
prepareAcpxRuntimeSandbox,
type AcpxRuntimeSandbox,
+ type AcpxProviderRuntimePolicy,
} from "./runtime-sandbox.js";
import type { AcpxExpectedSessionIdentity } from "./sidecar-protocol.js";
@@ -83,6 +86,11 @@ export interface AcpxRuntimeGoalCapability {
actions: Array<"set" | "pause" | "resume" | "clear">;
}
+export interface AcpxRuntimeSteeringCapability {
+ steering: boolean;
+ queuedFollowUp: boolean;
+}
+
export interface AcpxRuntimeGoalSnapshot {
objective: string;
status: "active" | "paused" | "blocked" | "limited" | "complete";
@@ -100,6 +108,9 @@ export interface AcpxRuntimeTurnInput {
requestId: string;
signal?: AbortSignal;
onElicitation?: AcpElicitationHandler;
+ onPermissionRequest?: AcpRuntimeOptions["onPermissionRequest"];
+ onExtensionRequest?: AcpRuntimeOptions["onExtensionRequest"];
+ onExtensionNotification?: AcpRuntimeOptions["onExtensionNotification"];
}
export interface AcpxRuntimeTurn {
@@ -116,6 +127,9 @@ export interface AcpxRuntimePort {
identity(): Promise;
getStatus(): Promise;
setModel?(model: string): Promise