mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
06bad73df4
## Summary
Add the **admin-configurable advisor configuration**: database-backed storage, SDK types, and the experimental HTTP handlers that back the admin settings UI (later PRs). Follows the same "site-configs" pattern as Virtual Desktop.
## Motivation
The advisor needs runtime-tunable knobs (enable/disable, per-run cap, max output tokens, reasoning effort, optional model override) without a service restart or redeploy. Using the existing `site_configs` K/V table keeps this pattern consistent with other admin features and avoids a bespoke schema.
## Changes
### Database (`coderd/database/queries/siteconfig.sql`)
- `GetChatAdvisorConfig` returns the stored JSON blob (default `'{}'`) under key `agents_advisor_config`.
- `UpsertChatAdvisorConfig` uses the standard `INSERT ... ON CONFLICT` pattern.
- Regenerated via `make gen` (queries.sql.go + mocks).
### SDK (`codersdk/chats.go`)
- `AdvisorConfig` type with `Enabled`, `MaxUsesPerRun`, `MaxOutputTokens`, `ReasoningEffort` (`""` / `low` / `medium` / `high`), `ModelConfigID uuid.UUID`.
- Client methods: `ChatAdvisorConfig(ctx)` / `UpdateChatAdvisorConfig(ctx, cfg)`.
### API (`coderd/exp_chats.go`)
- `GET /api/experimental/chats/config/advisor`: reads current config; relies on `ActorFromContext` validation.
- `PUT /api/experimental/chats/config/advisor`: requires `policy.ActionUpdate` on `rbac.ResourceDeploymentConfig`.
- Handlers unmarshal `{}` to a typed zero value and re-marshal on upsert for schema stability.
- Tests in `exp_chats_test.go` cover empty defaults, round-trip update, unauthorized update, and invalid body.
## Stack context
This is **PR 3 of 6** in the advisor feature stack. Consumed by:
- PR 4 (`feat/advisor-04-chatd-runtime`), which reads this config on every `runChat`.
- PR 6 (`feat/advisor-06-admin-settings-ui`), which renders the admin form.
## Scope / non-goals
- No `chatd` read path (lands in PR 4).
- No UI (lands in PR 6).
- `agents_advisor_config` remains a single-row JSON blob; we intentionally do not shard per-org/per-template yet.
## Validation
- `make gen`
- `go test ./coderd/database/... -run TestChatAdvisor`
- `go test ./coderd/... -run TestChatAdvisorConfig`
- `make lint`
---
<details>
<summary>📋 Implementation Plan (shared across the advisor stack)</summary>
# Plan: Add a Mux-style advisor tool to coder agents/chatd
## Outcome
Add a first-class `advisor` tool to agent chats in `coderd/x/chatd` that feels native to Coder:
- it is a built-in server-side tool, not an MCP/dynamic-tool workaround;
- it performs a nested **tool-less** model call for strategic advice;
- it is exposed only when eligible, and the prompt mentions it only when it is actually available;
- it is treated as a **planning-only** tool so it does not run alongside action tools in the same batch;
- it tracks usage/cost separately enough for operators to reason about it;
- it has a minimally polished UI in the Agents page;
- and it ships with explicit dogfooding evidence, including screenshots and repro videos.
## Design decisions to lock before coding
1. **Primary architecture:** native built-in tool in `chattool/`, backed by a small `chatadvisor` package.
2. **Nested model execution:** reuse chatd's existing model/provider stack for a one-step, tool-less advisor call rather than inventing a new provider pathway.
3. **Execution policy:** treat `advisor` as an exclusive/planning-only tool; mixed batches must return structured policy errors and force the model to retry cleanly.
4. **Availability:** initial rollout is for root agent chats only; disable for child/sub-agent chats until recursion/cost policy is proven.
5. **Prompt sync:** use one eligibility boolean to drive both tool registration and advisor guidance injection.
6. **Persistence/cost split:** MVP should keep advisor usage visible in result metadata and server metrics; only add DB schema if product/billing explicitly needs queryable advisor-specific cost.
7. **UI scope:** generic tool rendering is an acceptable temporary milestone during backend bring-up, but the release candidate should include a dedicated lightweight advisor renderer.
## Delivery model
The work should be executed as coordinated workstreams with one integration owner and parallel contributors for low-conflict areas. The integration owner should own `coderd/x/chatd/chatd.go` because prompt assembly, tool registration, and model resolution all converge there.
## Detailed workstreams
### Repo evidence used for this plan
<details>
<summary>Mux reference and current chatd seams</summary>
**Mux reference implementation**
- `src/node/services/tools/advisor.ts` — native advisor tool implementation.
- `src/common/constants/advisor.ts` — advisor prompt/constants and truncation policy.
- `src/common/utils/tools/tools.ts` — conditional tool registration.
- `src/node/services/streamContextBuilder.ts` — injects advisor guidance only when the tool is available.
**Current chatd seams**
- `coderd/x/chatd/chatd.go`
- `processChat()` — tool assembly, prompt assembly, and chatloop invocation.
- `resolveChatModel()` — current model/provider/key resolution seam.
- `type Config struct` — server-level chatd configuration surface.
- `coderd/x/chatd/chatloop/chatloop.go`
- `Run()` — main streaming/model loop.
- `executeTools()` — built-in tool execution/batching seam.
- `coderd/x/chatd/chattool/` — built-in tool implementations.
- `site/src/pages/AgentsPage/components/ChatElements/tools/Tool.tsx` — tool renderer dispatch.
- `site/src/pages/AgentsPage/components/ChatConversation/messageParsing.ts` and `ConversationTimeline.tsx` — tool/result merge and rendering flow.
</details>
### Workstream map and ownership
| Workstream | Primary owner | Main files | Can run in parallel? | Done when |
|---|---|---|---|---|
| 0. Integration + gating | Integration lead | `coderd/x/chatd/chatd.go` | No; central merge lane | Tool registration, prompt sync, and model selection are wired together |
| 1. Advisor runtime + tool | Backend agent | new `coderd/x/chatd/chatadvisor/`, new `coderd/x/chatd/chattool/advisor.go` | Yes | Tool can perform a tool-less advisor call in memory and return structured results |
| 2. Planning-only execution policy | Chatloop agent | `coderd/x/chatd/chatloop/chatloop.go`, related tests | Yes | Mixed `advisor` + action-tool batches are rejected cleanly and deterministically |
| 3. Metrics/usage/config | Backend/telemetry agent | `chatd.go`, `chatloop/metrics.go`, optional config plumbing | Partially; coordinate with integration lead | Advisor usage is separately visible in metadata/metrics and limits are enforced |
| 4. Frontend rendering | Frontend agent | `site/.../tools/Tool.tsx`, new `AdvisorTool.tsx`, stories | Yes after result schema stabilizes | Advisor renders as a readable card and story tests pass |
| 5. Dogfood + QA evidence | QA agent | dev server, Storybook, dogfood output | After backend + UI are usable | Repro videos, screenshots, and a concise QA report exist |
### Parallelization rules
- **Do not split `coderd/x/chatd/chatd.go` across multiple execution agents without an integration lead.** That file owns prompt building, tool registration, model resolution, and cost persistence.
- Workstreams 1 and 2 can be developed in parallel and then stacked onto the integration branch.
- Workstream 4 should begin once the backend result schema is agreed on, even if the backend is still behind a feature flag.
- Any agent that needs to re-check Mux behavior should clone `coder/mux` into a temporary directory (for example, `$(mktemp -d)/mux`) and inspect it read-only; do not vendor or copy code from Mux directly.
## Phase 0 — Preflight and guardrails
### Goals
- Align the team on the smallest shippable architecture.
- Prevent scope creep into MCP/dynamic-tool/sub-agent variants.
- Decide upfront what is MVP vs. follow-up.
### Tasks
1. **Confirm the MVP boundary.**
- Ship a built-in advisor tool first.
- Do **not** make MCP, dynamic tools, or sub-agents the primary implementation.
- Do **not** add transient streaming phases in the first backend PR unless they fall out almost for free.
2. **Confirm local workflow hygiene before coding.**
- Ensure the repo is using the project git hooks from `scripts/githooks`.
- Do not bypass hooks with `--no-verify`.
- Use `./scripts/develop.sh` for the full dev server rather than manual build/run commands.
3. **Lock the model-selection policy.**
- **Recommended MVP:** advisor uses the same resolved provider/model/cost config as the current chat, with advisor-specific max-output and usage caps.
- **Follow-up only if required:** add a separate `AdvisorModelConfigID`-style override that resolves through the existing `configCache`/model-config path. Do not invent a new free-form `provider:model` parser if chatd already stores provider/model separately.
4. **Lock the persistence policy.**
- **Recommended MVP:** no DB migration. Persist advisor-visible metadata in the tool result and record separate metrics in memory/Prometheus.
- **Only if product/billing explicitly asks for queryable advisor cost:** add a later DB migration or usage table, following the normal `queries/*.sql` + `make gen` workflow.
5. **Create an execution ADR note in the work item or tracking doc.**
- Capture: built-in tool, tool-less nested call, root-chat-only rollout, exclusive execution policy, MVP no-DB-migration default.
### Quality gate
- Everyone on the team can state the same answers to these questions:
- Is advisor a built-in tool? **Yes.**
- Can advisor run with action tools in the same batch? **No.**
- Does advisor get tools of its own? **No.**
- Is a DB migration required for MVP? **No, unless billing insists.**
## Phase 1 — Build the advisor runtime and tool wrapper
### Goals
Create the core advisor implementation in a way that is easy to test and keeps `chattool/` thin.
### Files to add
- `coderd/x/chatd/chatadvisor/types.go`
- `coderd/x/chatd/chatadvisor/guidance.go`
- `coderd/x/chatd/chatadvisor/handoff.go`
- `coderd/x/chatd/chatadvisor/runtime.go`
- `coderd/x/chatd/chatadvisor/runner.go`
- `coderd/x/chatd/chattool/advisor.go`
### Responsibilities by file
1. **`types.go`**
- Define the input/result schema used by the tool and UI.
- Keep the result shape close to Mux so the UI and model both have predictable cases.
- Recommended result variants:
- `advice`
- `limit_reached`
- `error`
Recommended shape:
```go
type AdvisorArgs struct {
Question string `json:"question"`
}
type AdvisorResult struct {
Type string `json:"type"`
Advice string `json:"advice,omitempty"`
Error string `json:"error,omitempty"`
AdvisorModel string `json:"advisor_model,omitempty"`
RemainingUses int `json:"remaining_uses,omitempty"`
Usage *AdvisorUsageResult `json:"usage,omitempty"`
}
```
2. **`guidance.go`**
- Hold two strings:
- the nested advisor system prompt;
- the parent-agent guidance block to inject into the outer system prompt.
- The nested advisor prompt must say, in plain language:
- you are advising the parent agent;
- you do not address the end user directly;
- you do not claim actions happened;
- you return concise strategic guidance and tradeoffs.
3. **`runtime.go`**
- Define the per-run runtime state.
- Recommended fields:
- resolved model + model config;
- provider keys/options reused from the outer chat;
- `MaxUsesPerRun`;
- `MaxOutputTokens`;
- atomic/current call counter;
- callback(s) to obtain the current prompt snapshot and current-step snapshot;
- optional metrics/usage hook.
- Add fail-fast validation for impossible config: nil model, non-positive limits, empty prompt builders, etc.
4. **`handoff.go`**
- Build the advisor handoff message from:
- the explicit question;
- the exact prompt/messages the parent model just used;
- the current step's text/reasoning snapshot, if available;
- the most recent relevant tool outputs, if they are already in the prompt snapshot.
- **Important:** use the already-prepared outer prompt tail, not a fresh DB reload. That keeps the advisor aligned with compaction and the exact context the outer model saw.
- Apply hard truncation budgets with recent-context bias.
5. **`runner.go`**
- Execute the nested advisor call.
- **Recommended implementation:** call `chatloop.Run()` in an in-memory, one-step mode:
- `Tools: nil`
- `ProviderTools: nil`
- `MaxSteps: 1`
- `PersistStep`: capture the assistant output in memory instead of writing DB rows
- Reuse the existing provider/model/cost path instead of building a second provider runner.
- Assert that no tool definitions are passed to the nested call.
6. **`chattool/advisor.go`**
- Keep this file thin and consistent with other built-ins.
- Responsibilities:
- decode `AdvisorArgs`;
- validate `Question` is non-empty and bounded;
- call the `chatadvisor` runner;
- return a structured tool response.
### Defensive programming requirements
- Assert `Question` is non-empty after trimming.
- Assert runtime limits are positive.
- Assert the nested advisor call runs with zero tools/provider tools.
- Assert `AdvisorResult.Type` is one of the known variants before returning.
- Assert remaining uses never goes negative.
### Acceptance criteria
- A unit test can call the advisor tool with a fake model and receive a stable `advice` result.
- The nested advisor call is impossible to run with tools accidentally attached.
- The core logic lives in `chatadvisor/`, not embedded inside `chatd.go`.
## Phase 2 — Wire advisor into chatd and keep prompt/tool availability in sync
### Goals
Register the tool in the right place, expose it only when eligible, and inject system guidance only when the tool is present.
### Files to modify
- `coderd/x/chatd/chatd.go`
- optionally a small helper file if `chatd.go` becomes too crowded
### Tasks
1. **Compute one eligibility boolean in `processChat()`.**
Recommended inputs:
- server-level advisor enabled flag;
- root chat only (`chat.ParentChatID == uuid.Nil` or equivalent existing root/child check);
- a usable resolved model/provider exists;
- optional experiment/workspace/org gate if product wants staged rollout.
2. **Create the runtime once per outer chat run.**
- Use the model/config/keys resolved by `resolveChatModel()`.
- Reuse provider options from the current chat's `ChatModelCallConfig`.
- Set `MaxUsesPerRun` and `MaxOutputTokens` from advisor config defaults.
3. **Register the tool in the built-in tool block.**
- Insert after the skill tools and before MCP tools in `processChat()`.
- Record `builtinToolNames["advisor"] = true` so metrics stay bounded.
4. **Inject advisor guidance into the outer system prompt using the same boolean.**
- Use `chatprompt.InsertSystem()` in the same prompt assembly path that already injects user/system instructions.
- Place the block near the existing instruction insertion, before plan-path/skill context blocks.
- Wrap the guidance in an explicit tag like `<advisor-guidance>` so it is easy to spot in tests and future refactors.
5. **Keep advisor out of child chats for the first release.**
- That avoids recursion/cost blowups with `spawn_agent` / `wait_agent` flows.
- Document this explicitly in the rollout notes and tests.
### Acceptance criteria
- If advisor is disabled, neither the tool nor the prompt guidance appears.
- If advisor is enabled, both the tool and the prompt guidance appear.
- Root chats can use advisor; child chats cannot.
- Built-in tool names include `advisor` so metrics do not collapse it into the generic `mcp` label.
## Phase 3 — Enforce planning-only execution policy in `chatloop`
### Goals
Prevent the model from calling `advisor` and action tools in the same execution batch.
### Files to modify
- `coderd/x/chatd/chatloop/chatloop.go`
- related chatloop tests
### Recommended implementation
Keep the MVP small; do **not** build a general policy engine yet.
1. Add a minimal field to `chatloop.RunOptions`, for example:
```go
ExclusiveToolName *string
```
2. In `Run()` / `executeTools()`, detect the case where the exclusive tool appears in the same local-tool batch as any other locally executed tool.
3. When that happens, synthesize structured tool-result errors for the affected calls instead of executing anything in the batch.
- `advisor` should receive a clear error like: _advisor must be called by itself before action tools_.
- The sibling action tools should receive a paired policy error like: _this tool was skipped because advisor must run alone_.
4. Let the outer model see those tool errors and retry cleanly.
- This is simpler and safer than partial execution or hidden deferral.
- It preserves deterministic transcript history for debugging.
5. Pass the just-finished step snapshot into the tool execution context.
- The advisor runtime should be able to see the current step's text/reasoning content, because that is often the best hint about what the outer model is trying to decide.
### Why this is the right fit
- It matches the intended semantics: advisor is consulted **before** taking action.
- It avoids subtle race conditions caused by concurrent built-in tool execution.
- It keeps the behavior easy to test with fake models.
### Acceptance criteria
- A model-emitted batch containing only `advisor` succeeds.
- A model-emitted batch containing `advisor` plus any other locally executed tool returns deterministic policy errors and executes nothing.
- Non-advisor tool execution stays unchanged for normal chats.
## Phase 4 — Usage limits, metrics, and configuration
### Goals
Make advisor safe to operate without over-designing billing/storage in the first release.
### Files to modify
- `coderd/x/chatd/chatd.go`
- `coderd/x/chatd/chatloop/metrics.go` as needed
- `coderd/x/chatd/chatd.go` `Config` struct and constructor path
- optional follow-up config/db files only if a separate advisor model or persistent billing is required
### Tasks
1. **Add explicit server config knobs for MVP.**
Recommended fields on `chatd.Config` or a nested advisor config struct:
- `AdvisorEnabled bool`
- `AdvisorMaxUsesPerRun int`
- `AdvisorMaxOutputTokens int64`
2. **Track usage per outer run.**
- Reset the counter for each `processChat()` invocation.
- Return `remaining_uses` in the tool result.
- Return `limit_reached` when the cap is exhausted.
3. **Expose advisor usage metadata in the tool result.**
- Include model name and token/cost summary if available.
- Use the same `callConfig.Cost` calculation path as the outer chat for MVP if advisor reuses the same model.
4. **Record server-side metrics.**
- Count advisor invocations, failures, and latency.
- Ensure they show up under the built-in tool label `advisor`.
5. **Optional decision gate: separate advisor model.**
- If product insists on a stronger/different advisor model, add a follow-up config hook that resolves another existing chat model config through the same `configCache` path.
- Keep that out of the first landing PR unless it is required for acceptance.
6. **Optional decision gate: queryable advisor cost.**
- If this becomes required, spin a follow-up DB task:
- update `coderd/database/queries/*.sql`;
- add migration files;
- run `make gen`;
- update audit mappings if a new auditable type/field is introduced.
### Acceptance criteria
- Advisor calls are capped per outer run.
- Limit exhaustion is user-visible in the tool result.
- Metrics distinguish advisor calls from other built-in tools.
- MVP does not require a schema migration unless explicitly approved.
## Phase 5 — Frontend rendering and Storybook coverage
### Goals
Make advisor feel intentional in the Agents UI without blocking the backend on fancy streaming UI.
### Files to modify
- `site/src/pages/AgentsPage/components/ChatElements/tools/Tool.tsx`
- new `site/src/pages/AgentsPage/components/ChatElements/tools/AdvisorTool.tsx`
- Storybook story file(s) in the same tools directory
### Delivery strategy
1. **Intermediate milestone during backend bring-up:** rely on the existing generic tool renderer if needed.
- This is acceptable only as a short-lived integration checkpoint.
2. **Release milestone:** add a dedicated lightweight `AdvisorTool` renderer.
- Reuse existing primitives:
- `ToolCollapsible`
- `ToolIcon`
- `Response` for markdown/prose rendering
- `ScrollArea` if the advice can be long
- Keep styling light and consistent with the Agents page.
- Do not add unnecessary React memoization in `site/src/pages/AgentsPage/`; that area is already React-Compiler aware.
3. **Render the structured result states cleanly.**
- `advice` — readable prose/markdown with optional metadata footer.
- `limit_reached` — warning-style message.
- `error` — error state with visible fallback text.
- `running` — existing tool loading state/spinner is enough for MVP.
4. **Add Storybook coverage instead of ad-hoc component tests.**
Recommended stories:
- successful advice;
- running/loading;
- limit reached;
- error.
5. **Keep the UI contract narrow.**
- Prefer one text field like `advice` plus small metadata rather than a deeply nested schema.
- That keeps the UI resilient to prompt iteration.
### Acceptance criteria
- The advisor tool card renders readable content rather than raw quoted JSON in the final release branch.
- Running, limit, and error states are visibly distinct.
- Storybook stories and play assertions cover the new states.
- Existing tool rendering flows remain unchanged.
## Phase 6 — Automated tests and validation gates
### Backend tests to add
1. **Advisor runtime/tool tests**
- question validation;
- tool-less nested execution assertion;
- success result shaping;
- limit-reached result shaping;
- error result shaping.
2. **Prompt/gating tests in chatd**
- advisor disabled ⇒ no tool, no guidance;
- advisor enabled/root chat ⇒ tool + guidance;
- child chat ⇒ advisor absent.
3. **Chatloop policy tests**
- advisor alone runs;
- advisor + action tool mixed batch returns deterministic policy errors;
- non-advisor tools still execute normally.
4. **Usage/metrics tests**
- per-run cap resets correctly;
- builtin tool labeling includes `advisor`;
- returned metadata includes model/usage summary when available.
### Frontend tests to add
- Storybook `play()` assertions for the advisor renderer states.
- Verify expand/collapse behavior and visible fallback text.
- Verify the message timeline still renders adjacent tools correctly.
### Recommended command sequence
Run these as the implementation matures, not only at the end:
1. Backend-focused gate after phases 1–4:
- `make test RUN=TestAdvisor`
- `make test RUN=TestChatloopAdvisor`
- `make lint`
2. Frontend-focused gate after phase 5:
- `pnpm test:storybook src/pages/AgentsPage/components/ChatElements/tools/AdvisorTool.stories.tsx`
- `pnpm lint`
- `pnpm format`
3. Final repo gate before handoff:
- `make pre-commit`
- run any additional targeted `make test RUN=...` selections covering touched chatd paths
> Use the exact new test names the implementing agents create; the names above are recommended anchors, not existing tests.
## Dogfooding plan
### Principle
Dogfood the change as a real agent feature, not just a unit-tested backend. Per the dogfood and `agent-browser` skills, the reviewer should get **watchable repro videos** plus screenshots that make the behavior obvious without reading logs.
### Required setup
1. Start the full dev environment with:
- `./scripts/develop.sh`
2. If the frontend renderer changes, also start Storybook from `site/` with:
- `pnpm storybook --no-open`
3. Use `agent-browser` directly — **never `npx agent-browser`**.
4. Use named browser sessions and an output folder such as:
- `./dogfood-output/advisor/`
- with subfolders `screenshots/` and `videos/`
### Evidence protocol
For every interactive scenario below:
1. Start video recording **before** the action.
2. Capture step-by-step screenshots at human pace.
3. Capture one annotated screenshot of the final state.
4. Stop the recording.
5. Note the exact pass/fail observation in the QA report.
For static UI states (for example Storybook error/limit cards), an annotated screenshot is sufficient; video is optional but still encouraged by this project’s review preference.
### Dogfood scenarios
#### Scenario A — Happy path in the real Agents UI
**Goal:** prove that a root agent chat can invoke advisor and produce a readable recommendation before taking further action.
Steps:
1. Open the Agents page with an advisor-enabled root chat.
2. Start a repro video.
3. Send a prompt that should reasonably trigger strategic planning, such as an architecture or multi-tradeoff question.
4. Capture screenshots of:
- the prompt before send;
- the running advisor state;
- the completed advisor card and the assistant’s follow-up response.
5. Stop recording.
Pass criteria:
- advisor appears in the timeline;
- the rendered result is readable;
- the assistant can continue after consuming the advisor output.
#### Scenario B — Advisor unavailable path
**Goal:** prove the feature is truly gated.
Suggested variants (at least one is required, both are better):
- feature flag/config off;
- child/sub-agent chat.
Evidence:
- annotated screenshot of the chat/tool state showing advisor is absent;
- short video if toggling the gate live is part of the repro.
Pass criteria:
- no advisor tool is available;
- no advisor-specific prompt behavior leaks through.
#### Scenario C — UI states in Storybook
**Goal:** prove the renderer handles non-happy states cleanly.
Required story states:
- success/advice;
- running;
- limit reached;
- error.
Evidence:
- one screenshot per state;
- at least one short video showing collapse/expand behavior.
Pass criteria:
- success renders readable advice;
- limit/error have visible fallback text;
- the component behaves like the other tool cards.
#### Scenario D — Regression sweep of nearby tools
**Goal:** ensure advisor does not break the surrounding chat timeline.
Check at minimum:
- another existing built-in tool still renders correctly near advisor;
- sub-agent/tool cards still expand/collapse normally;
- no obvious console errors appear in the Agents page during the advisor flow.
Evidence:
- screenshots of adjacent tool cards;
- console/error capture if anything suspicious appears.
### `agent-browser` usage notes for the QA agent
- Prefer `agent-browser batch` for 2+ sequential commands when no intermediate parsing is needed.
- Use `snapshot -i` to discover interactive refs.
- Re-snapshot after navigation or major DOM changes.
- Avoid `wait --load networkidle` unless the page is known to go idle; prefer explicit element/text waits or short fixed waits.
- Record videos at human pace and include pauses that a reviewer can follow.
## Rollout plan
### Initial rollout
- Gate behind a server-side advisor-enabled flag.
- Enable only for selected internal/root agent chats first.
- Watch metrics for:
- invocation count;
- failure rate;
- latency;
- obvious retry loops.
### Expansion conditions
Expand beyond the initial rollout only after the following are true:
- mixed-batch policy behavior is stable;
- cost impact is understood;
- frontend UX is readable in production-like dogfood;
- no recursion surprises have appeared with sub-agent flows.
### Explicit non-goals for the first release
- advisor inside child/sub-agent chats;
- provider-agnostic streaming phase UI;
- MCP-based external advisor implementation;
- mandatory DB-backed advisor cost reporting.
## Final acceptance checklist
- [ ] `advisor` is a built-in chatd tool, not an MCP/dynamic-tool substitute.
- [ ] The nested advisor call is tool-less and bounded to one in-memory step.
- [ ] One eligibility boolean controls both tool registration and prompt guidance injection.
- [ ] Root chats can use advisor; child chats cannot in the initial rollout.
- [ ] Mixed advisor/action batches produce deterministic policy errors instead of partial execution.
- [ ] Per-run usage caps and limit-reached behavior work.
- [ ] Advisor usage is visible in metadata/metrics without forcing a DB migration for MVP.
- [ ] The Agents UI has a readable advisor card and Storybook coverage.
- [ ] Dogfooding produced screenshots and repro videos for the required scenarios.
- [ ] Validation commands (`make lint`, targeted `make test`, Storybook tests, `make pre-commit`) passed before handoff.
## Suggested PR split
1. **PR 1 — Backend foundation**
- `chatadvisor/` package
- `chattool/advisor.go`
- `chatloop` exclusive policy
- chatd gating/prompt sync
- backend tests
2. **PR 2 — Frontend + QA**
- advisor renderer
- stories/play assertions
- dogfood artifacts and QA notes
3. **PR 3 — Optional follow-ups only if demanded by stakeholders**
- separate advisor model override
- persistent advisor billing/queryability
- transient phase-stream UX
</details>
---
_Generated with [`mux`](https://github.com/coder/mux) • Model: `anthropic:claude-opus-4-7` • Thinking: `max`_
1255 lines
100 KiB
Go
1255 lines
100 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
|
|
package database
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type sqlcQuerier interface {
|
|
// Acquires up to @num_chats pending chats for processing. Uses SKIP LOCKED
|
|
// to prevent multiple replicas from acquiring the same chat.
|
|
AcquireChats(ctx context.Context, arg AcquireChatsParams) ([]Chat, error)
|
|
// Blocks until the lock is acquired.
|
|
//
|
|
// This must be called from within a transaction. The lock will be automatically
|
|
// released when the transaction ends.
|
|
AcquireLock(ctx context.Context, pgAdvisoryXactLock int64) error
|
|
// Acquires the lease for a given count of notification messages, to enable concurrent dequeuing and subsequent sending.
|
|
// Only rows that aren't already leased (or ones which are leased but have exceeded their lease period) are returned.
|
|
//
|
|
// A "lease" here refers to a notifier taking ownership of a notification_messages row. A lease survives for the duration
|
|
// of CODER_NOTIFICATIONS_LEASE_PERIOD. Once a message is delivered, its status is updated and the lease expires (set to NULL).
|
|
// If a message exceeds its lease, that implies the notifier did not shutdown cleanly, or the table update failed somehow,
|
|
// and the row will then be eligible to be dequeued by another notifier.
|
|
//
|
|
// SKIP LOCKED is used to jump over locked rows. This prevents multiple notifiers from acquiring the same messages.
|
|
// See: https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FOR-UPDATE-SHARE
|
|
//
|
|
AcquireNotificationMessages(ctx context.Context, arg AcquireNotificationMessagesParams) ([]AcquireNotificationMessagesRow, error)
|
|
// Acquires the lock for a single job that isn't started, completed,
|
|
// canceled, and that matches an array of provisioner types.
|
|
//
|
|
// SKIP LOCKED is used to jump over locked rows. This prevents
|
|
// multiple provisioners from acquiring the same jobs. See:
|
|
// https://www.postgresql.org/docs/9.5/sql-select.html#SQL-FOR-UPDATE-SHARE
|
|
AcquireProvisionerJob(ctx context.Context, arg AcquireProvisionerJobParams) (ProvisionerJob, error)
|
|
AcquireStaleChatDiffStatuses(ctx context.Context, limitVal int32) ([]AcquireStaleChatDiffStatusesRow, error)
|
|
// Bumps the workspace deadline by the template's configured "activity_bump"
|
|
// duration (default 1h). If the workspace bump will cross an autostart
|
|
// threshold, then the bump is autostart + TTL. This is the deadline behavior if
|
|
// the workspace was to autostart from a stopped state.
|
|
//
|
|
// Max deadline is respected, and the deadline will never be bumped past it.
|
|
// The deadline will never decrease.
|
|
// We only bump if the template has an activity bump duration set.
|
|
// We only bump if the raw interval is positive and non-zero.
|
|
// We only bump if workspace shutdown is manual.
|
|
// We only bump when 5% of the deadline has elapsed.
|
|
ActivityBumpWorkspace(ctx context.Context, arg ActivityBumpWorkspaceParams) error
|
|
// AllUserIDs returns all UserIDs regardless of user status or deletion.
|
|
AllUserIDs(ctx context.Context, includeSystem bool) ([]uuid.UUID, error)
|
|
ArchiveChatByID(ctx context.Context, id uuid.UUID) ([]Chat, error)
|
|
// Archiving templates is a soft delete action, so is reversible.
|
|
// Archiving prevents the version from being used and discovered
|
|
// by listing.
|
|
// Only unused template versions will be archived, which are any versions not
|
|
// referenced by the latest build of a workspace.
|
|
ArchiveUnusedTemplateVersions(ctx context.Context, arg ArchiveUnusedTemplateVersionsParams) ([]uuid.UUID, error)
|
|
// Archives inactive root chats (pinned and already-archived chats skipped),
|
|
// cascading to children via root_chat_id. Limits apply to roots, not total
|
|
// rows. Used by dbpurge.
|
|
// created_at ASC flows through to dbpurge's digest truncation; see
|
|
// buildDigestData in dbpurge.go for the tradeoff rationale.
|
|
AutoArchiveInactiveChats(ctx context.Context, arg AutoArchiveInactiveChatsParams) ([]AutoArchiveInactiveChatsRow, error)
|
|
BackoffChatDiffStatus(ctx context.Context, arg BackoffChatDiffStatusParams) error
|
|
BatchUpdateWorkspaceAgentMetadata(ctx context.Context, arg BatchUpdateWorkspaceAgentMetadataParams) error
|
|
BatchUpdateWorkspaceLastUsedAt(ctx context.Context, arg BatchUpdateWorkspaceLastUsedAtParams) error
|
|
BatchUpdateWorkspaceNextStartAt(ctx context.Context, arg BatchUpdateWorkspaceNextStartAtParams) error
|
|
BatchUpsertConnectionLogs(ctx context.Context, arg BatchUpsertConnectionLogsParams) error
|
|
BulkMarkNotificationMessagesFailed(ctx context.Context, arg BulkMarkNotificationMessagesFailedParams) (int64, error)
|
|
BulkMarkNotificationMessagesSent(ctx context.Context, arg BulkMarkNotificationMessagesSentParams) (int64, error)
|
|
// Calculates the telemetry summary for a given provider, model, and client
|
|
// combination for telemetry reporting.
|
|
CalculateAIBridgeInterceptionsTelemetrySummary(ctx context.Context, arg CalculateAIBridgeInterceptionsTelemetrySummaryParams) (CalculateAIBridgeInterceptionsTelemetrySummaryRow, error)
|
|
ClaimPrebuiltWorkspace(ctx context.Context, arg ClaimPrebuiltWorkspaceParams) (ClaimPrebuiltWorkspaceRow, error)
|
|
CleanTailnetCoordinators(ctx context.Context) error
|
|
CleanTailnetLostPeers(ctx context.Context) error
|
|
CleanTailnetTunnels(ctx context.Context) error
|
|
CleanupDeletedMCPServerIDsFromChats(ctx context.Context) error
|
|
ClearChatMessageProviderResponseIDsByChatID(ctx context.Context, chatID uuid.UUID) error
|
|
CountAIBridgeInterceptions(ctx context.Context, arg CountAIBridgeInterceptionsParams) (int64, error)
|
|
CountAIBridgeSessions(ctx context.Context, arg CountAIBridgeSessionsParams) (int64, error)
|
|
CountAuditLogs(ctx context.Context, arg CountAuditLogsParams) (int64, error)
|
|
CountConnectionLogs(ctx context.Context, arg CountConnectionLogsParams) (int64, error)
|
|
// Counts enabled, non-deleted model configs that lack both input and
|
|
// output pricing in their JSONB options.cost configuration.
|
|
CountEnabledModelsWithoutPricing(ctx context.Context) (int64, error)
|
|
// CountInProgressPrebuilds returns the number of in-progress prebuilds, grouped by preset ID and transition.
|
|
// Prebuild considered in-progress if it's in the "pending", "starting", "stopping", or "deleting" state.
|
|
CountInProgressPrebuilds(ctx context.Context) ([]CountInProgressPrebuildsRow, error)
|
|
// CountPendingNonActivePrebuilds returns the number of pending prebuilds for non-active template versions
|
|
CountPendingNonActivePrebuilds(ctx context.Context) ([]CountPendingNonActivePrebuildsRow, error)
|
|
CountUnreadInboxNotificationsByUserID(ctx context.Context, userID uuid.UUID) (int64, error)
|
|
CreateUserSecret(ctx context.Context, arg CreateUserSecretParams) (UserSecret, error)
|
|
CustomRoles(ctx context.Context, arg CustomRolesParams) ([]CustomRole, error)
|
|
DeleteAPIKeyByID(ctx context.Context, id string) error
|
|
DeleteAPIKeysByUserID(ctx context.Context, userID uuid.UUID) error
|
|
DeleteAllChatQueuedMessages(ctx context.Context, chatID uuid.UUID) error
|
|
DeleteAllTailnetTunnels(ctx context.Context, arg DeleteAllTailnetTunnelsParams) error
|
|
// Deletes all existing webpush subscriptions.
|
|
// This should be called when the VAPID keypair is regenerated, as the old
|
|
// keypair will no longer be valid and all existing subscriptions will need to
|
|
// be recreated.
|
|
DeleteAllWebpushSubscriptions(ctx context.Context) error
|
|
DeleteApplicationConnectAPIKeysByUserID(ctx context.Context, userID uuid.UUID) error
|
|
// Deletes debug runs (and their cascaded steps) whose message IDs
|
|
// exceed the cutoff. The started_before bound prevents retried
|
|
// cleanup from deleting runs created by a replacement turn that
|
|
// raced ahead of the retry window.
|
|
DeleteChatDebugDataAfterMessageID(ctx context.Context, arg DeleteChatDebugDataAfterMessageIDParams) (int64, error)
|
|
// The started_before bound prevents retried cleanup from deleting
|
|
// runs created by a replacement turn that races ahead of the retry
|
|
// window (for example, after an unarchive races with a pending
|
|
// archive-cleanup retry).
|
|
DeleteChatDebugDataByChatID(ctx context.Context, arg DeleteChatDebugDataByChatIDParams) (int64, error)
|
|
DeleteChatModelConfigByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteChatModelConfigsByProvider(ctx context.Context, provider string) error
|
|
DeleteChatProviderByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteChatQueuedMessage(ctx context.Context, arg DeleteChatQueuedMessageParams) error
|
|
DeleteChatUsageLimitGroupOverride(ctx context.Context, groupID uuid.UUID) error
|
|
DeleteChatUsageLimitUserOverride(ctx context.Context, userID uuid.UUID) error
|
|
DeleteCryptoKey(ctx context.Context, arg DeleteCryptoKeyParams) (CryptoKey, error)
|
|
DeleteCustomRole(ctx context.Context, arg DeleteCustomRoleParams) error
|
|
DeleteExpiredAPIKeys(ctx context.Context, arg DeleteExpiredAPIKeysParams) (int64, error)
|
|
DeleteExternalAuthLink(ctx context.Context, arg DeleteExternalAuthLinkParams) error
|
|
DeleteGroupByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteGroupMemberFromGroup(ctx context.Context, arg DeleteGroupMemberFromGroupParams) error
|
|
DeleteLicense(ctx context.Context, id int32) (int32, error)
|
|
DeleteMCPServerConfigByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteMCPServerUserToken(ctx context.Context, arg DeleteMCPServerUserTokenParams) error
|
|
DeleteOAuth2ProviderAppByClientID(ctx context.Context, id uuid.UUID) error
|
|
DeleteOAuth2ProviderAppByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteOAuth2ProviderAppCodeByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteOAuth2ProviderAppCodesByAppAndUserID(ctx context.Context, arg DeleteOAuth2ProviderAppCodesByAppAndUserIDParams) error
|
|
DeleteOAuth2ProviderAppSecretByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteOAuth2ProviderAppTokensByAppAndUserID(ctx context.Context, arg DeleteOAuth2ProviderAppTokensByAppAndUserIDParams) error
|
|
// Cumulative count.
|
|
DeleteOldAIBridgeRecords(ctx context.Context, beforeTime time.Time) (int64, error)
|
|
DeleteOldAuditLogConnectionEvents(ctx context.Context, arg DeleteOldAuditLogConnectionEventsParams) error
|
|
// Deletes old audit logs based on retention policy, excluding deprecated
|
|
// connection events (connect, disconnect, open, close) which are handled
|
|
// separately by DeleteOldAuditLogConnectionEvents.
|
|
DeleteOldAuditLogs(ctx context.Context, arg DeleteOldAuditLogsParams) (int64, error)
|
|
// TODO(cian): Add indexes on chats(archived, updated_at) and
|
|
// chat_files(created_at) for purge query performance.
|
|
// See: https://github.com/coder/internal/issues/1438
|
|
// Deletes chat files that are older than the given threshold and are
|
|
// not referenced by any chat that is still active or was archived
|
|
// within the same threshold window. This covers two cases:
|
|
// 1. Orphaned files not linked to any chat.
|
|
// 2. Files whose every referencing chat has been archived for longer
|
|
// than the retention period.
|
|
DeleteOldChatFiles(ctx context.Context, arg DeleteOldChatFilesParams) (int64, error)
|
|
// Deletes chats that have been archived for longer than the given
|
|
// threshold. Active (non-archived) chats are never deleted.
|
|
// Related chat_messages, chat_diff_statuses, and
|
|
// chat_queued_messages are removed via ON DELETE CASCADE.
|
|
// Parent/root references on child chats are SET NULL.
|
|
DeleteOldChats(ctx context.Context, arg DeleteOldChatsParams) (int64, error)
|
|
DeleteOldConnectionLogs(ctx context.Context, arg DeleteOldConnectionLogsParams) (int64, error)
|
|
// Delete all notification messages which have not been updated for over a week.
|
|
DeleteOldNotificationMessages(ctx context.Context) error
|
|
// Delete provisioner daemons that have been created at least a week ago
|
|
// and have not connected to coderd since a week.
|
|
// A provisioner daemon with "zeroed" last_seen_at column indicates possible
|
|
// connectivity issues (no provisioner daemon activity since registration).
|
|
DeleteOldProvisionerDaemons(ctx context.Context) error
|
|
// Deletes old telemetry locks from the telemetry_locks table.
|
|
DeleteOldTelemetryLocks(ctx context.Context, periodEndingAtBefore time.Time) error
|
|
// If an agent hasn't connected within the retention period, we purge its logs.
|
|
// Exception: if the logs are related to the latest build, we keep those around.
|
|
// Logs can take up a lot of space, so it's important we clean up frequently.
|
|
DeleteOldWorkspaceAgentLogs(ctx context.Context, threshold time.Time) (int64, error)
|
|
DeleteOldWorkspaceAgentStats(ctx context.Context) error
|
|
DeleteOrganizationMember(ctx context.Context, arg DeleteOrganizationMemberParams) error
|
|
DeleteProvisionerKey(ctx context.Context, id uuid.UUID) error
|
|
DeleteReplicasUpdatedBefore(ctx context.Context, updatedAt time.Time) error
|
|
DeleteRuntimeConfig(ctx context.Context, key string) error
|
|
DeleteTailnetPeer(ctx context.Context, arg DeleteTailnetPeerParams) (DeleteTailnetPeerRow, error)
|
|
DeleteTailnetTunnel(ctx context.Context, arg DeleteTailnetTunnelParams) (DeleteTailnetTunnelRow, error)
|
|
DeleteTask(ctx context.Context, arg DeleteTaskParams) (uuid.UUID, error)
|
|
DeleteUserChatCompactionThreshold(ctx context.Context, arg DeleteUserChatCompactionThresholdParams) error
|
|
DeleteUserChatProviderKey(ctx context.Context, arg DeleteUserChatProviderKeyParams) error
|
|
DeleteUserSecretByUserIDAndName(ctx context.Context, arg DeleteUserSecretByUserIDAndNameParams) (UserSecret, error)
|
|
DeleteWebpushSubscriptionByUserIDAndEndpoint(ctx context.Context, arg DeleteWebpushSubscriptionByUserIDAndEndpointParams) error
|
|
DeleteWebpushSubscriptions(ctx context.Context, ids []uuid.UUID) error
|
|
DeleteWorkspaceACLByID(ctx context.Context, id uuid.UUID) error
|
|
DeleteWorkspaceACLsByOrganization(ctx context.Context, arg DeleteWorkspaceACLsByOrganizationParams) error
|
|
DeleteWorkspaceAgentPortShare(ctx context.Context, arg DeleteWorkspaceAgentPortShareParams) error
|
|
DeleteWorkspaceAgentPortSharesByTemplate(ctx context.Context, templateID uuid.UUID) error
|
|
DeleteWorkspaceSubAgentByID(ctx context.Context, id uuid.UUID) error
|
|
// Disable foreign keys and triggers for all tables.
|
|
// Deprecated: disable foreign keys was created to aid in migrating off
|
|
// of the test-only in-memory database. Do not use this in new code.
|
|
DisableForeignKeysAndTriggers(ctx context.Context) error
|
|
EnqueueNotificationMessage(ctx context.Context, arg EnqueueNotificationMessageParams) error
|
|
// Firstly, collect api_keys owned by the prebuilds user that correlate
|
|
// to workspaces no longer owned by the prebuilds user.
|
|
// Next, collect api_keys that belong to the prebuilds user but have no token name.
|
|
// These were most likely created via 'coder login' as the prebuilds user.
|
|
ExpirePrebuildsAPIKeys(ctx context.Context, now time.Time) error
|
|
FavoriteWorkspace(ctx context.Context, id uuid.UUID) error
|
|
FetchMemoryResourceMonitorsByAgentID(ctx context.Context, agentID uuid.UUID) (WorkspaceAgentMemoryResourceMonitor, error)
|
|
FetchMemoryResourceMonitorsUpdatedAfter(ctx context.Context, updatedAt time.Time) ([]WorkspaceAgentMemoryResourceMonitor, error)
|
|
// This is used to build up the notification_message's JSON payload.
|
|
FetchNewMessageMetadata(ctx context.Context, arg FetchNewMessageMetadataParams) (FetchNewMessageMetadataRow, error)
|
|
FetchVolumesResourceMonitorsByAgentID(ctx context.Context, agentID uuid.UUID) ([]WorkspaceAgentVolumeResourceMonitor, error)
|
|
FetchVolumesResourceMonitorsUpdatedAfter(ctx context.Context, updatedAt time.Time) ([]WorkspaceAgentVolumeResourceMonitor, error)
|
|
// Marks orphaned in-progress rows as interrupted so they do not stay
|
|
// in a non-terminal state forever. The NOT IN list must match the
|
|
// terminal statuses defined by ChatDebugStatus in codersdk/chats.go.
|
|
//
|
|
// The steps CTE also catches steps whose parent run was just finalized
|
|
// (via run_id IN), because PostgreSQL data-modifying CTEs share the
|
|
// same snapshot and cannot see each other's row updates. Without this,
|
|
// a step with a recent updated_at would survive its run's finalization
|
|
// and remain in 'in_progress' state permanently.
|
|
//
|
|
// @now is the caller's clock timestamp so that mock-clock tests stay
|
|
// consistent with the @updated_before cutoff.
|
|
FinalizeStaleChatDebugRows(ctx context.Context, arg FinalizeStaleChatDebugRowsParams) (FinalizeStaleChatDebugRowsRow, error)
|
|
// FindMatchingPresetID finds a preset ID that is the largest exact subset of the provided parameters.
|
|
// It returns the preset ID if a match is found, or NULL if no match is found.
|
|
// The query finds presets where all preset parameters are present in the provided parameters,
|
|
// and returns the preset with the most parameters (largest subset).
|
|
FindMatchingPresetID(ctx context.Context, arg FindMatchingPresetIDParams) (uuid.UUID, error)
|
|
GetAIBridgeInterceptionByID(ctx context.Context, id uuid.UUID) (AIBridgeInterception, error)
|
|
// Look up the parent interception and the root of the thread by finding
|
|
// which interception recorded a tool usage with the given tool call ID.
|
|
// COALESCE ensures that if the parent has no thread_root_id (i.e. it IS
|
|
// the root), we return its own ID as the root.
|
|
GetAIBridgeInterceptionLineageByToolCallID(ctx context.Context, toolCallID string) (GetAIBridgeInterceptionLineageByToolCallIDRow, error)
|
|
GetAIBridgeInterceptions(ctx context.Context) ([]AIBridgeInterception, error)
|
|
GetAIBridgeTokenUsagesByInterceptionID(ctx context.Context, interceptionID uuid.UUID) ([]AIBridgeTokenUsage, error)
|
|
GetAIBridgeToolUsagesByInterceptionID(ctx context.Context, interceptionID uuid.UUID) ([]AIBridgeToolUsage, error)
|
|
GetAIBridgeUserPromptsByInterceptionID(ctx context.Context, interceptionID uuid.UUID) ([]AIBridgeUserPrompt, error)
|
|
GetAPIKeyByID(ctx context.Context, id string) (APIKey, error)
|
|
// there is no unique constraint on empty token names
|
|
GetAPIKeyByName(ctx context.Context, arg GetAPIKeyByNameParams) (APIKey, error)
|
|
GetAPIKeysByLoginType(ctx context.Context, arg GetAPIKeysByLoginTypeParams) ([]APIKey, error)
|
|
GetAPIKeysByUserID(ctx context.Context, arg GetAPIKeysByUserIDParams) ([]APIKey, error)
|
|
GetAPIKeysLastUsedAfter(ctx context.Context, lastUsed time.Time) ([]APIKey, error)
|
|
GetActiveAISeatCount(ctx context.Context) (int64, error)
|
|
GetActiveChatsByAgentID(ctx context.Context, agentID uuid.UUID) ([]Chat, error)
|
|
GetActivePresetPrebuildSchedules(ctx context.Context) ([]TemplateVersionPresetPrebuildSchedule, error)
|
|
GetActiveUserCount(ctx context.Context, includeSystem bool) (int64, error)
|
|
GetActiveWorkspaceBuildsByTemplateID(ctx context.Context, templateID uuid.UUID) ([]WorkspaceBuild, error)
|
|
// For PG Coordinator HTMLDebug
|
|
GetAllTailnetCoordinators(ctx context.Context) ([]TailnetCoordinator, error)
|
|
GetAllTailnetPeers(ctx context.Context) ([]TailnetPeer, error)
|
|
GetAllTailnetTunnels(ctx context.Context) ([]TailnetTunnel, error)
|
|
// Atomic read+delete prevents replicas that flush between a separate read and
|
|
// reset from having their data deleted before the next snapshot. Uses a common
|
|
// table expression with DELETE...RETURNING so the rows we sum are exactly the
|
|
// rows we delete. Stale rows are excluded from the sum but still deleted.
|
|
GetAndResetBoundaryUsageSummary(ctx context.Context, maxStalenessMs int64) (GetAndResetBoundaryUsageSummaryRow, error)
|
|
GetAnnouncementBanners(ctx context.Context) (string, error)
|
|
GetApplicationName(ctx context.Context) (string, error)
|
|
// GetAuditLogsBefore retrieves `row_limit` number of audit logs before the provided
|
|
// ID.
|
|
GetAuditLogsOffset(ctx context.Context, arg GetAuditLogsOffsetParams) ([]GetAuditLogsOffsetRow, error)
|
|
// GetAuthenticatedWorkspaceAgentAndBuildByAuthToken returns an authenticated
|
|
// workspace agent and its associated build. During normal operation, this is
|
|
// the latest build. During shutdown, this may be the previous START build while
|
|
// the STOP build is executing, allowing shutdown scripts to authenticate (see
|
|
// issue #19467).
|
|
GetAuthenticatedWorkspaceAgentAndBuildByAuthToken(ctx context.Context, authToken uuid.UUID) (GetAuthenticatedWorkspaceAgentAndBuildByAuthTokenRow, error)
|
|
// This function returns roles for authorization purposes. Implied member roles
|
|
// are included.
|
|
GetAuthorizationUserRoles(ctx context.Context, userID uuid.UUID) (GetAuthorizationUserRolesRow, error)
|
|
// GetChatAdvisorConfig returns the deployment-wide runtime configuration
|
|
// for the experimental chat advisor as a JSON blob. Callers unmarshal the
|
|
// result into codersdk.AdvisorConfig. Returns '{}' when unset so zero
|
|
// values apply by default.
|
|
GetChatAdvisorConfig(ctx context.Context) (string, error)
|
|
// Auto-archive window in days. 0 disables.
|
|
GetChatAutoArchiveDays(ctx context.Context, defaultAutoArchiveDays int32) (int32, error)
|
|
GetChatByID(ctx context.Context, id uuid.UUID) (Chat, error)
|
|
GetChatByIDForUpdate(ctx context.Context, id uuid.UUID) (Chat, error)
|
|
// Per-root-chat cost breakdown for a single user within a date range.
|
|
// Groups by root_chat_id so forked chats roll up under their root.
|
|
// Only counts assistant-role messages.
|
|
GetChatCostPerChat(ctx context.Context, arg GetChatCostPerChatParams) ([]GetChatCostPerChatRow, error)
|
|
// Per-model cost breakdown for a single user within a date range.
|
|
// Only counts assistant-role messages that have a model_config_id.
|
|
GetChatCostPerModel(ctx context.Context, arg GetChatCostPerModelParams) ([]GetChatCostPerModelRow, error)
|
|
// Deployment-wide per-user cost rollup within a date range.
|
|
// Only counts assistant-role messages.
|
|
GetChatCostPerUser(ctx context.Context, arg GetChatCostPerUserParams) ([]GetChatCostPerUserRow, error)
|
|
// Aggregate cost summary for a single user within a date range.
|
|
// Only counts assistant-role messages.
|
|
GetChatCostSummary(ctx context.Context, arg GetChatCostSummaryParams) (GetChatCostSummaryRow, error)
|
|
// GetChatDebugLoggingAllowUsers returns the runtime admin setting that
|
|
// allows users to opt into chat debug logging when the deployment does
|
|
// not already force debug logging on globally.
|
|
GetChatDebugLoggingAllowUsers(ctx context.Context) (bool, error)
|
|
GetChatDebugRunByID(ctx context.Context, id uuid.UUID) (ChatDebugRun, error)
|
|
// Returns the most recent debug runs for a chat, ordered newest-first.
|
|
// Callers must supply an explicit limit to avoid unbounded result sets.
|
|
GetChatDebugRunsByChatID(ctx context.Context, arg GetChatDebugRunsByChatIDParams) ([]ChatDebugRun, error)
|
|
GetChatDebugStepsByRunID(ctx context.Context, runID uuid.UUID) ([]ChatDebugStep, error)
|
|
GetChatDesktopEnabled(ctx context.Context) (bool, error)
|
|
GetChatDiffStatusByChatID(ctx context.Context, chatID uuid.UUID) (ChatDiffStatus, error)
|
|
// Returns aggregate PR counts across all agent chats for telemetry.
|
|
// Deduplicates by PR URL so forked chats referencing the same pull
|
|
// request are counted once (using the most recently refreshed state).
|
|
// Total is derived from the three recognized state buckets and
|
|
// always equals open + merged + closed; other non-NULL states are
|
|
// intentionally excluded from these aggregates.
|
|
GetChatDiffStatusSummary(ctx context.Context) (GetChatDiffStatusSummaryRow, error)
|
|
GetChatDiffStatusesByChatIDs(ctx context.Context, chatIds []uuid.UUID) ([]ChatDiffStatus, error)
|
|
GetChatExploreModelOverride(ctx context.Context) (string, error)
|
|
GetChatFileByID(ctx context.Context, id uuid.UUID) (ChatFile, error)
|
|
// GetChatFileMetadataByChatID returns lightweight file metadata for
|
|
// all files linked to a chat. The data column is excluded to avoid
|
|
// loading file content.
|
|
GetChatFileMetadataByChatID(ctx context.Context, chatID uuid.UUID) ([]GetChatFileMetadataByChatIDRow, error)
|
|
GetChatFilesByIDs(ctx context.Context, ids []uuid.UUID) ([]ChatFile, error)
|
|
GetChatGeneralModelOverride(ctx context.Context) (string, error)
|
|
// GetChatIncludeDefaultSystemPrompt preserves the legacy default
|
|
// for deployments created before the explicit include-default toggle.
|
|
// When the toggle is unset, a non-empty custom prompt implies false;
|
|
// otherwise the setting defaults to true.
|
|
GetChatIncludeDefaultSystemPrompt(ctx context.Context) (bool, error)
|
|
GetChatMessageByID(ctx context.Context, id int64) (ChatMessage, error)
|
|
// Aggregates message-level metrics per chat for messages created
|
|
// after the given timestamp. Uses message created_at so that
|
|
// ongoing activity in long-running chats is captured each window.
|
|
GetChatMessageSummariesPerChat(ctx context.Context, createdAfter time.Time) ([]GetChatMessageSummariesPerChatRow, error)
|
|
GetChatMessagesByChatID(ctx context.Context, arg GetChatMessagesByChatIDParams) ([]ChatMessage, error)
|
|
GetChatMessagesByChatIDAscPaginated(ctx context.Context, arg GetChatMessagesByChatIDAscPaginatedParams) ([]ChatMessage, error)
|
|
GetChatMessagesByChatIDDescPaginated(ctx context.Context, arg GetChatMessagesByChatIDDescPaginatedParams) ([]ChatMessage, error)
|
|
GetChatMessagesForPromptByChatID(ctx context.Context, chatID uuid.UUID) ([]ChatMessage, error)
|
|
GetChatModelConfigByID(ctx context.Context, id uuid.UUID) (ChatModelConfig, error)
|
|
GetChatModelConfigs(ctx context.Context) ([]ChatModelConfig, error)
|
|
// Returns all model configurations for telemetry snapshot collection.
|
|
GetChatModelConfigsForTelemetry(ctx context.Context) ([]GetChatModelConfigsForTelemetryRow, error)
|
|
GetChatPlanModeInstructions(ctx context.Context) (string, error)
|
|
GetChatProviderByID(ctx context.Context, id uuid.UUID) (ChatProvider, error)
|
|
GetChatProviderByIDForUpdate(ctx context.Context, id uuid.UUID) (ChatProvider, error)
|
|
GetChatProviderByProvider(ctx context.Context, provider string) (ChatProvider, error)
|
|
GetChatProviderByProviderForUpdate(ctx context.Context, provider string) (ChatProvider, error)
|
|
GetChatProviders(ctx context.Context) ([]ChatProvider, error)
|
|
GetChatQueuedMessages(ctx context.Context, chatID uuid.UUID) ([]ChatQueuedMessage, error)
|
|
// Returns the chat retention period in days. Chats archived longer
|
|
// than this and orphaned chat files older than this are purged by
|
|
// dbpurge. Returns 30 (days) when no value has been configured.
|
|
// A value of 0 disables chat purging entirely.
|
|
GetChatRetentionDays(ctx context.Context) (int32, error)
|
|
GetChatSystemPrompt(ctx context.Context) (string, error)
|
|
// GetChatSystemPromptConfig returns both chat system prompt settings in a
|
|
// single read to avoid torn reads between separate site-config lookups.
|
|
// The include-default fallback preserves the legacy behavior where a
|
|
// non-empty custom prompt implied opting out before the explicit toggle
|
|
// existed.
|
|
GetChatSystemPromptConfig(ctx context.Context) (GetChatSystemPromptConfigRow, error)
|
|
// GetChatTemplateAllowlist returns the JSON-encoded template allowlist.
|
|
// Returns an empty string when no allowlist has been configured (all templates allowed).
|
|
GetChatTemplateAllowlist(ctx context.Context) (string, error)
|
|
GetChatUsageLimitConfig(ctx context.Context) (ChatUsageLimitConfig, error)
|
|
GetChatUsageLimitGroupOverride(ctx context.Context, groupID uuid.UUID) (GetChatUsageLimitGroupOverrideRow, error)
|
|
GetChatUsageLimitUserOverride(ctx context.Context, userID uuid.UUID) (GetChatUsageLimitUserOverrideRow, error)
|
|
// Returns the global TTL for chat workspaces as a Go duration string.
|
|
// Returns "0s" (disabled) when no value has been configured.
|
|
GetChatWorkspaceTTL(ctx context.Context) (string, error)
|
|
GetChats(ctx context.Context, arg GetChatsParams) ([]GetChatsRow, error)
|
|
GetChatsByWorkspaceIDs(ctx context.Context, ids []uuid.UUID) ([]Chat, error)
|
|
// Retrieves chats updated after the given timestamp for telemetry
|
|
// snapshot collection. Uses updated_at so that long-running chats
|
|
// still appear in each snapshot window while they are active.
|
|
GetChatsUpdatedAfter(ctx context.Context, updatedAfter time.Time) ([]GetChatsUpdatedAfterRow, error)
|
|
// Fetches child chats of the given parents, optionally filtered by
|
|
// archive state (NULL = all, true/false = match). The archive
|
|
// invariant (parent archived implies child archived) is enforced
|
|
// at write time, not here.
|
|
GetChildChatsByParentIDs(ctx context.Context, arg GetChildChatsByParentIDsParams) ([]GetChildChatsByParentIDsRow, error)
|
|
GetConnectionLogsOffset(ctx context.Context, arg GetConnectionLogsOffsetParams) ([]GetConnectionLogsOffsetRow, error)
|
|
GetCryptoKeyByFeatureAndSequence(ctx context.Context, arg GetCryptoKeyByFeatureAndSequenceParams) (CryptoKey, error)
|
|
GetCryptoKeys(ctx context.Context) ([]CryptoKey, error)
|
|
GetCryptoKeysByFeature(ctx context.Context, feature CryptoKeyFeature) ([]CryptoKey, error)
|
|
GetDBCryptKeys(ctx context.Context) ([]DBCryptKey, error)
|
|
GetDERPMeshKey(ctx context.Context) (string, error)
|
|
GetDefaultChatModelConfig(ctx context.Context) (ChatModelConfig, error)
|
|
GetDefaultOrganization(ctx context.Context) (Organization, error)
|
|
GetDefaultProxyConfig(ctx context.Context) (GetDefaultProxyConfigRow, error)
|
|
GetDeploymentID(ctx context.Context) (string, error)
|
|
GetDeploymentWorkspaceAgentStats(ctx context.Context, createdAt time.Time) (GetDeploymentWorkspaceAgentStatsRow, error)
|
|
GetDeploymentWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) (GetDeploymentWorkspaceAgentUsageStatsRow, error)
|
|
GetDeploymentWorkspaceStats(ctx context.Context) (GetDeploymentWorkspaceStatsRow, error)
|
|
GetEligibleProvisionerDaemonsByProvisionerJobIDs(ctx context.Context, provisionerJobIds []uuid.UUID) ([]GetEligibleProvisionerDaemonsByProvisionerJobIDsRow, error)
|
|
// Providers can be disabled independently of their model configs.
|
|
// Check both to ensure the selected config is actually usable.
|
|
GetEnabledChatModelConfigByID(ctx context.Context, id uuid.UUID) (ChatModelConfig, error)
|
|
GetEnabledChatModelConfigs(ctx context.Context) ([]ChatModelConfig, error)
|
|
GetEnabledChatProviders(ctx context.Context) ([]ChatProvider, error)
|
|
GetEnabledMCPServerConfigs(ctx context.Context) ([]MCPServerConfig, error)
|
|
GetExternalAuthLink(ctx context.Context, arg GetExternalAuthLinkParams) (ExternalAuthLink, error)
|
|
GetExternalAuthLinksByUserID(ctx context.Context, userID uuid.UUID) ([]ExternalAuthLink, error)
|
|
GetFailedWorkspaceBuildsByTemplateID(ctx context.Context, arg GetFailedWorkspaceBuildsByTemplateIDParams) ([]GetFailedWorkspaceBuildsByTemplateIDRow, error)
|
|
GetFileByHashAndCreator(ctx context.Context, arg GetFileByHashAndCreatorParams) (File, error)
|
|
GetFileByID(ctx context.Context, id uuid.UUID) (File, error)
|
|
// Get all templates that use a file.
|
|
GetFileTemplates(ctx context.Context, fileID uuid.UUID) ([]GetFileTemplatesRow, error)
|
|
// Fetches inbox notifications for a user filtered by templates and targets
|
|
// param user_id: The user ID
|
|
// param templates: The template IDs to filter by - the template_id = ANY(@templates::UUID[]) condition checks if the template_id is in the @templates array
|
|
// param targets: The target IDs to filter by - the targets @> COALESCE(@targets, ARRAY[]::UUID[]) condition checks if the targets array (from the DB) contains all the elements in the @targets array
|
|
// param read_status: The read status to filter by - can be any of 'ALL', 'UNREAD', 'READ'
|
|
// param created_at_opt: The created_at timestamp to filter by. This parameter is usd for pagination - it fetches notifications created before the specified timestamp if it is not the zero value
|
|
// param limit_opt: The limit of notifications to fetch. If the limit is not specified, it defaults to 25
|
|
GetFilteredInboxNotificationsByUserID(ctx context.Context, arg GetFilteredInboxNotificationsByUserIDParams) ([]InboxNotification, error)
|
|
GetForcedMCPServerConfigs(ctx context.Context) ([]MCPServerConfig, error)
|
|
GetGitSSHKey(ctx context.Context, userID uuid.UUID) (GitSSHKey, error)
|
|
GetGroupByID(ctx context.Context, id uuid.UUID) (Group, error)
|
|
GetGroupByOrgAndName(ctx context.Context, arg GetGroupByOrgAndNameParams) (Group, error)
|
|
GetGroupMembers(ctx context.Context, includeSystem bool) ([]GroupMember, error)
|
|
GetGroupMembersByGroupID(ctx context.Context, arg GetGroupMembersByGroupIDParams) ([]GroupMember, error)
|
|
GetGroupMembersByGroupIDPaginated(ctx context.Context, arg GetGroupMembersByGroupIDPaginatedParams) ([]GetGroupMembersByGroupIDPaginatedRow, error)
|
|
// Returns the total count of members in a group. Shows the total
|
|
// count even if the caller does not have read access to ResourceGroupMember.
|
|
// They only need ResourceGroup read access.
|
|
GetGroupMembersCountByGroupID(ctx context.Context, arg GetGroupMembersCountByGroupIDParams) (int64, error)
|
|
GetGroups(ctx context.Context, arg GetGroupsParams) ([]GetGroupsRow, error)
|
|
GetHealthSettings(ctx context.Context) (string, error)
|
|
GetInboxNotificationByID(ctx context.Context, id uuid.UUID) (InboxNotification, error)
|
|
// Fetches inbox notifications for a user filtered by templates and targets
|
|
// param user_id: The user ID
|
|
// param read_status: The read status to filter by - can be any of 'ALL', 'UNREAD', 'READ'
|
|
// param created_at_opt: The created_at timestamp to filter by. This parameter is usd for pagination - it fetches notifications created before the specified timestamp if it is not the zero value
|
|
// param limit_opt: The limit of notifications to fetch. If the limit is not specified, it defaults to 25
|
|
GetInboxNotificationsByUserID(ctx context.Context, arg GetInboxNotificationsByUserIDParams) ([]InboxNotification, error)
|
|
GetLastChatMessageByRole(ctx context.Context, arg GetLastChatMessageByRoleParams) (ChatMessage, error)
|
|
GetLastUpdateCheck(ctx context.Context) (string, error)
|
|
GetLatestCryptoKeyByFeature(ctx context.Context, feature CryptoKeyFeature) (CryptoKey, error)
|
|
GetLatestWorkspaceAppStatusByAppID(ctx context.Context, appID uuid.UUID) (WorkspaceAppStatus, error)
|
|
GetLatestWorkspaceAppStatusesByWorkspaceIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAppStatus, error)
|
|
GetLatestWorkspaceBuildByWorkspaceID(ctx context.Context, workspaceID uuid.UUID) (WorkspaceBuild, error)
|
|
GetLatestWorkspaceBuildWithStatusByWorkspaceID(ctx context.Context, workspaceID uuid.UUID) (GetLatestWorkspaceBuildWithStatusByWorkspaceIDRow, error)
|
|
GetLatestWorkspaceBuildsByWorkspaceIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceBuild, error)
|
|
GetLicenseByID(ctx context.Context, id int32) (License, error)
|
|
GetLicenses(ctx context.Context) ([]License, error)
|
|
GetLogoURL(ctx context.Context) (string, error)
|
|
GetMCPServerConfigByID(ctx context.Context, id uuid.UUID) (MCPServerConfig, error)
|
|
GetMCPServerConfigBySlug(ctx context.Context, slug string) (MCPServerConfig, error)
|
|
GetMCPServerConfigs(ctx context.Context) ([]MCPServerConfig, error)
|
|
GetMCPServerConfigsByIDs(ctx context.Context, ids []uuid.UUID) ([]MCPServerConfig, error)
|
|
GetMCPServerUserToken(ctx context.Context, arg GetMCPServerUserTokenParams) (MCPServerUserToken, error)
|
|
GetMCPServerUserTokensByUserID(ctx context.Context, userID uuid.UUID) ([]MCPServerUserToken, error)
|
|
GetNotificationMessagesByStatus(ctx context.Context, arg GetNotificationMessagesByStatusParams) ([]NotificationMessage, error)
|
|
// Fetch the notification report generator log indicating recent activity.
|
|
GetNotificationReportGeneratorLogByTemplate(ctx context.Context, templateID uuid.UUID) (NotificationReportGeneratorLog, error)
|
|
GetNotificationTemplateByID(ctx context.Context, id uuid.UUID) (NotificationTemplate, error)
|
|
GetNotificationTemplatesByKind(ctx context.Context, kind NotificationTemplateKind) ([]NotificationTemplate, error)
|
|
GetNotificationsSettings(ctx context.Context) (string, error)
|
|
GetOAuth2GithubDefaultEligible(ctx context.Context) (bool, error)
|
|
// RFC 7591/7592 Dynamic Client Registration queries
|
|
GetOAuth2ProviderAppByClientID(ctx context.Context, id uuid.UUID) (OAuth2ProviderApp, error)
|
|
GetOAuth2ProviderAppByID(ctx context.Context, id uuid.UUID) (OAuth2ProviderApp, error)
|
|
GetOAuth2ProviderAppCodeByID(ctx context.Context, id uuid.UUID) (OAuth2ProviderAppCode, error)
|
|
GetOAuth2ProviderAppCodeByPrefix(ctx context.Context, secretPrefix []byte) (OAuth2ProviderAppCode, error)
|
|
GetOAuth2ProviderAppSecretByID(ctx context.Context, id uuid.UUID) (OAuth2ProviderAppSecret, error)
|
|
GetOAuth2ProviderAppSecretByPrefix(ctx context.Context, secretPrefix []byte) (OAuth2ProviderAppSecret, error)
|
|
GetOAuth2ProviderAppSecretsByAppID(ctx context.Context, appID uuid.UUID) ([]OAuth2ProviderAppSecret, error)
|
|
GetOAuth2ProviderAppTokenByAPIKeyID(ctx context.Context, apiKeyID string) (OAuth2ProviderAppToken, error)
|
|
GetOAuth2ProviderAppTokenByPrefix(ctx context.Context, hashPrefix []byte) (OAuth2ProviderAppToken, error)
|
|
GetOAuth2ProviderApps(ctx context.Context) ([]OAuth2ProviderApp, error)
|
|
GetOAuth2ProviderAppsByUserID(ctx context.Context, userID uuid.UUID) ([]GetOAuth2ProviderAppsByUserIDRow, error)
|
|
GetOrganizationByID(ctx context.Context, id uuid.UUID) (Organization, error)
|
|
GetOrganizationByName(ctx context.Context, arg GetOrganizationByNameParams) (Organization, error)
|
|
GetOrganizationIDsByMemberIDs(ctx context.Context, ids []uuid.UUID) ([]GetOrganizationIDsByMemberIDsRow, error)
|
|
GetOrganizationResourceCountByID(ctx context.Context, organizationID uuid.UUID) (GetOrganizationResourceCountByIDRow, error)
|
|
GetOrganizations(ctx context.Context, arg GetOrganizationsParams) ([]Organization, error)
|
|
GetOrganizationsByUserID(ctx context.Context, arg GetOrganizationsByUserIDParams) ([]Organization, error)
|
|
// GetOrganizationsWithPrebuildStatus returns organizations with prebuilds configured and their
|
|
// membership status for the prebuilds system user (org membership, group existence, group membership).
|
|
GetOrganizationsWithPrebuildStatus(ctx context.Context, arg GetOrganizationsWithPrebuildStatusParams) ([]GetOrganizationsWithPrebuildStatusRow, error)
|
|
// Returns PR metrics grouped by the model used for each chat.
|
|
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
|
// direct children (that lack their own PR), and deduped picks one row
|
|
// per PR for state/additions/deletions/model (model comes from the
|
|
// most recent chat).
|
|
GetPRInsightsPerModel(ctx context.Context, arg GetPRInsightsPerModelParams) ([]GetPRInsightsPerModelRow, error)
|
|
// Returns all individual PR rows with cost for the selected time range.
|
|
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
|
// direct children (that lack their own PR), and deduped picks one row
|
|
// per PR for metadata. A safety-cap LIMIT guards against unexpectedly
|
|
// large result sets from direct API callers.
|
|
GetPRInsightsPullRequests(ctx context.Context, arg GetPRInsightsPullRequestsParams) ([]GetPRInsightsPullRequestsRow, error)
|
|
// PR Insights queries for the /agents analytics dashboard.
|
|
// These aggregate data from chat_diff_statuses (PR metadata) joined
|
|
// with chats and chat_messages (cost) to power the PR Insights view.
|
|
//
|
|
// Cost is computed per PR by summing the PR-linked chat's own cost plus
|
|
// the costs of any direct children (subagents) it spawned that do NOT
|
|
// have their own PR association. If a child chat has its own
|
|
// chat_diff_statuses entry (with a non-NULL pull_request_state), its
|
|
// cost is attributed to that child's PR instead — preventing
|
|
// double-counting when sibling chats create different PRs.
|
|
// Subagent trees are at most 2 levels deep (enforced by the
|
|
// application layer). PR metadata (state, additions, deletions)
|
|
// comes from the most recent chat via DISTINCT ON so that each PR
|
|
// is counted exactly once.
|
|
// Returns aggregate PR metrics for the given date range.
|
|
// The handler calls this twice (current + previous period) for trends.
|
|
// Uses two CTEs: pr_costs sums cost for the PR-linked chat and its
|
|
// direct children (that lack their own PR), and deduped picks one row
|
|
// per PR for state/additions/deletions.
|
|
GetPRInsightsSummary(ctx context.Context, arg GetPRInsightsSummaryParams) (GetPRInsightsSummaryRow, error)
|
|
// Returns daily PR counts grouped by state for the chart.
|
|
// Uses a CTE to deduplicate by PR URL so that multiple chats referencing
|
|
// the same pull request are only counted once (keeping the most recent chat).
|
|
GetPRInsightsTimeSeries(ctx context.Context, arg GetPRInsightsTimeSeriesParams) ([]GetPRInsightsTimeSeriesRow, error)
|
|
GetParameterSchemasByJobID(ctx context.Context, jobID uuid.UUID) ([]ParameterSchema, error)
|
|
GetPrebuildMetrics(ctx context.Context) ([]GetPrebuildMetricsRow, error)
|
|
GetPrebuildsSettings(ctx context.Context) (string, error)
|
|
GetPresetByID(ctx context.Context, presetID uuid.UUID) (GetPresetByIDRow, error)
|
|
GetPresetByWorkspaceBuildID(ctx context.Context, workspaceBuildID uuid.UUID) (TemplateVersionPreset, error)
|
|
GetPresetParametersByPresetID(ctx context.Context, presetID uuid.UUID) ([]TemplateVersionPresetParameter, error)
|
|
GetPresetParametersByTemplateVersionID(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionPresetParameter, error)
|
|
// GetPresetsAtFailureLimit groups workspace builds by preset ID.
|
|
// Each preset is associated with exactly one template version ID.
|
|
// For each preset, the query checks the last hard_limit builds.
|
|
// If all of them failed, the preset is considered to have hit the hard failure limit.
|
|
// The query returns a list of preset IDs that have reached this failure threshold.
|
|
// Only active template versions with configured presets are considered.
|
|
// For each preset, check the last hard_limit builds.
|
|
// If all of them failed, the preset is considered to have hit the hard failure limit.
|
|
GetPresetsAtFailureLimit(ctx context.Context, hardLimit int64) ([]GetPresetsAtFailureLimitRow, error)
|
|
// GetPresetsBackoff groups workspace builds by preset ID.
|
|
// Each preset is associated with exactly one template version ID.
|
|
// For each group, the query checks up to N of the most recent jobs that occurred within the
|
|
// lookback period, where N equals the number of desired instances for the corresponding preset.
|
|
// If at least one of the job within a group has failed, we should backoff on the corresponding preset ID.
|
|
// Query returns a list of preset IDs for which we should backoff.
|
|
// Only active template versions with configured presets are considered.
|
|
// We also return the number of failed workspace builds that occurred during the lookback period.
|
|
//
|
|
// NOTE:
|
|
// - To **decide whether to back off**, we look at up to the N most recent builds (within the defined lookback period).
|
|
// - To **calculate the number of failed builds**, we consider all builds within the defined lookback period.
|
|
//
|
|
// The number of failed builds is used downstream to determine the backoff duration.
|
|
GetPresetsBackoff(ctx context.Context, lookback time.Time) ([]GetPresetsBackoffRow, error)
|
|
GetPresetsByTemplateVersionID(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionPreset, error)
|
|
GetPreviousTemplateVersion(ctx context.Context, arg GetPreviousTemplateVersionParams) (TemplateVersion, error)
|
|
GetProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, error)
|
|
GetProvisionerDaemonsByOrganization(ctx context.Context, arg GetProvisionerDaemonsByOrganizationParams) ([]ProvisionerDaemon, error)
|
|
// Current job information.
|
|
// Previous job information.
|
|
GetProvisionerDaemonsWithStatusByOrganization(ctx context.Context, arg GetProvisionerDaemonsWithStatusByOrganizationParams) ([]GetProvisionerDaemonsWithStatusByOrganizationRow, error)
|
|
GetProvisionerJobByID(ctx context.Context, id uuid.UUID) (ProvisionerJob, error)
|
|
// Gets a single provisioner job by ID for update.
|
|
// This is used to securely reap jobs that have been hung/pending for a long time.
|
|
GetProvisionerJobByIDForUpdate(ctx context.Context, id uuid.UUID) (ProvisionerJob, error)
|
|
// Gets a provisioner job by ID with exclusive lock.
|
|
// Blocks until the row is available for update.
|
|
GetProvisionerJobByIDWithLock(ctx context.Context, id uuid.UUID) (ProvisionerJob, error)
|
|
GetProvisionerJobTimingsByJobID(ctx context.Context, jobID uuid.UUID) ([]ProvisionerJobTiming, error)
|
|
GetProvisionerJobsByIDsWithQueuePosition(ctx context.Context, arg GetProvisionerJobsByIDsWithQueuePositionParams) ([]GetProvisionerJobsByIDsWithQueuePositionRow, error)
|
|
GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner(ctx context.Context, arg GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerParams) ([]GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerRow, error)
|
|
GetProvisionerJobsCreatedAfter(ctx context.Context, createdAt time.Time) ([]ProvisionerJob, error)
|
|
// To avoid repeatedly attempting to reap the same jobs, we randomly order and limit to @max_jobs.
|
|
GetProvisionerJobsToBeReaped(ctx context.Context, arg GetProvisionerJobsToBeReapedParams) ([]ProvisionerJob, error)
|
|
GetProvisionerKeyByHashedSecret(ctx context.Context, hashedSecret []byte) (ProvisionerKey, error)
|
|
GetProvisionerKeyByID(ctx context.Context, id uuid.UUID) (ProvisionerKey, error)
|
|
GetProvisionerKeyByName(ctx context.Context, arg GetProvisionerKeyByNameParams) (ProvisionerKey, error)
|
|
GetProvisionerLogsAfterID(ctx context.Context, arg GetProvisionerLogsAfterIDParams) ([]ProvisionerJobLog, error)
|
|
GetQuotaAllowanceForUser(ctx context.Context, arg GetQuotaAllowanceForUserParams) (int64, error)
|
|
GetQuotaConsumedForUser(ctx context.Context, arg GetQuotaConsumedForUserParams) (int64, error)
|
|
// Count regular workspaces: only those whose first successful 'start' build
|
|
// was not initiated by the prebuild system user.
|
|
GetRegularWorkspaceCreateMetrics(ctx context.Context) ([]GetRegularWorkspaceCreateMetricsRow, error)
|
|
GetReplicaByID(ctx context.Context, id uuid.UUID) (Replica, error)
|
|
GetReplicasUpdatedAfter(ctx context.Context, updatedAt time.Time) ([]Replica, error)
|
|
GetRunningPrebuiltWorkspaces(ctx context.Context) ([]GetRunningPrebuiltWorkspacesRow, error)
|
|
GetRuntimeConfig(ctx context.Context, key string) (string, error)
|
|
// Find chats that appear stuck and need recovery. This covers:
|
|
// 1. Running chats whose heartbeat has expired (worker crash).
|
|
// 2. Chats awaiting client action (requires_action) past the
|
|
// timeout threshold (client disappeared).
|
|
GetStaleChats(ctx context.Context, staleThreshold time.Time) ([]Chat, error)
|
|
GetTailnetPeers(ctx context.Context, id uuid.UUID) ([]TailnetPeer, error)
|
|
GetTailnetTunnelPeerBindingsBatch(ctx context.Context, ids []uuid.UUID) ([]GetTailnetTunnelPeerBindingsBatchRow, error)
|
|
GetTailnetTunnelPeerIDsBatch(ctx context.Context, ids []uuid.UUID) ([]GetTailnetTunnelPeerIDsBatchRow, error)
|
|
GetTaskByID(ctx context.Context, id uuid.UUID) (Task, error)
|
|
GetTaskByOwnerIDAndName(ctx context.Context, arg GetTaskByOwnerIDAndNameParams) (Task, error)
|
|
GetTaskByWorkspaceID(ctx context.Context, workspaceID uuid.UUID) (Task, error)
|
|
GetTaskSnapshot(ctx context.Context, taskID uuid.UUID) (TaskSnapshot, error)
|
|
GetTelemetryItem(ctx context.Context, key string) (TelemetryItem, error)
|
|
GetTelemetryItems(ctx context.Context) ([]TelemetryItem, error)
|
|
// Returns all data needed to build task lifecycle events for telemetry
|
|
// in a single round-trip. For each task whose workspace is in the
|
|
// given set, fetches:
|
|
// - the latest workspace app binding (task_workspace_apps)
|
|
// - the most recent stop and start builds (workspace_builds)
|
|
// - the last "working" app status (workspace_app_statuses)
|
|
// - the first app status after resume, for active workspaces
|
|
//
|
|
// Assumptions:
|
|
// - 1:1 relationship between tasks and workspaces. All builds on the
|
|
// workspace are considered task-related.
|
|
// - Idle duration approximation: If the agent reports "working", does
|
|
// work, then reports "done", we miss that working time.
|
|
// - lws and active_dur join across all historical app IDs for the task,
|
|
// because each resume cycle provisions a new app ID. This ensures
|
|
// pre-pause statuses contribute to idle duration and active duration.
|
|
GetTelemetryTaskEvents(ctx context.Context, arg GetTelemetryTaskEventsParams) ([]GetTelemetryTaskEventsRow, error)
|
|
// GetTemplateAppInsights returns the aggregate usage of each app in a given
|
|
// timeframe. The result can be filtered on template_ids, meaning only user data
|
|
// from workspaces based on those templates will be included.
|
|
GetTemplateAppInsights(ctx context.Context, arg GetTemplateAppInsightsParams) ([]GetTemplateAppInsightsRow, error)
|
|
// GetTemplateAppInsightsByTemplate is used for Prometheus metrics. Keep
|
|
// in sync with GetTemplateAppInsights and UpsertTemplateUsageStats.
|
|
GetTemplateAppInsightsByTemplate(ctx context.Context, arg GetTemplateAppInsightsByTemplateParams) ([]GetTemplateAppInsightsByTemplateRow, error)
|
|
GetTemplateAverageBuildTime(ctx context.Context, templateID uuid.NullUUID) (GetTemplateAverageBuildTimeRow, error)
|
|
GetTemplateByID(ctx context.Context, id uuid.UUID) (Template, error)
|
|
GetTemplateByOrganizationAndName(ctx context.Context, arg GetTemplateByOrganizationAndNameParams) (Template, error)
|
|
// GetTemplateInsights returns the aggregate user-produced usage of all
|
|
// workspaces in a given timeframe. The template IDs, active users, and
|
|
// usage_seconds all reflect any usage in the template, including apps.
|
|
//
|
|
// When combining data from multiple templates, we must make a guess at
|
|
// how the user behaved for the 30 minute interval. In this case we make
|
|
// the assumption that if the user used two workspaces for 15 minutes,
|
|
// they did so sequentially, thus we sum the usage up to a maximum of
|
|
// 30 minutes with LEAST(SUM(n), 30).
|
|
GetTemplateInsights(ctx context.Context, arg GetTemplateInsightsParams) (GetTemplateInsightsRow, error)
|
|
// GetTemplateInsightsByInterval returns all intervals between start and end
|
|
// time, if end time is a partial interval, it will be included in the results and
|
|
// that interval will be shorter than a full one. If there is no data for a selected
|
|
// interval/template, it will be included in the results with 0 active users.
|
|
GetTemplateInsightsByInterval(ctx context.Context, arg GetTemplateInsightsByIntervalParams) ([]GetTemplateInsightsByIntervalRow, error)
|
|
// GetTemplateInsightsByTemplate is used for Prometheus metrics. Keep
|
|
// in sync with GetTemplateInsights and UpsertTemplateUsageStats.
|
|
GetTemplateInsightsByTemplate(ctx context.Context, arg GetTemplateInsightsByTemplateParams) ([]GetTemplateInsightsByTemplateRow, error)
|
|
// GetTemplateParameterInsights does for each template in a given timeframe,
|
|
// look for the latest workspace build (for every workspace) that has been
|
|
// created in the timeframe and return the aggregate usage counts of parameter
|
|
// values.
|
|
GetTemplateParameterInsights(ctx context.Context, arg GetTemplateParameterInsightsParams) ([]GetTemplateParameterInsightsRow, error)
|
|
// GetTemplatePresetsWithPrebuilds retrieves template versions with configured presets and prebuilds.
|
|
// It also returns the number of desired instances for each preset.
|
|
// If template_id is specified, only template versions associated with that template will be returned.
|
|
GetTemplatePresetsWithPrebuilds(ctx context.Context, templateID uuid.NullUUID) ([]GetTemplatePresetsWithPrebuildsRow, error)
|
|
GetTemplateUsageStats(ctx context.Context, arg GetTemplateUsageStatsParams) ([]TemplateUsageStat, error)
|
|
GetTemplateVersionByID(ctx context.Context, id uuid.UUID) (TemplateVersion, error)
|
|
GetTemplateVersionByJobID(ctx context.Context, jobID uuid.UUID) (TemplateVersion, error)
|
|
GetTemplateVersionByTemplateIDAndName(ctx context.Context, arg GetTemplateVersionByTemplateIDAndNameParams) (TemplateVersion, error)
|
|
GetTemplateVersionParameters(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionParameter, error)
|
|
GetTemplateVersionTerraformValues(ctx context.Context, templateVersionID uuid.UUID) (TemplateVersionTerraformValue, error)
|
|
GetTemplateVersionVariables(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionVariable, error)
|
|
GetTemplateVersionWorkspaceTags(ctx context.Context, templateVersionID uuid.UUID) ([]TemplateVersionWorkspaceTag, error)
|
|
GetTemplateVersionsByIDs(ctx context.Context, ids []uuid.UUID) ([]TemplateVersion, error)
|
|
GetTemplateVersionsByTemplateID(ctx context.Context, arg GetTemplateVersionsByTemplateIDParams) ([]TemplateVersion, error)
|
|
GetTemplateVersionsCreatedAfter(ctx context.Context, createdAt time.Time) ([]TemplateVersion, error)
|
|
GetTemplates(ctx context.Context) ([]Template, error)
|
|
GetTemplatesWithFilter(ctx context.Context, arg GetTemplatesWithFilterParams) ([]Template, error)
|
|
// Gets the total number of managed agents created between two dates. Uses the
|
|
// aggregate table to avoid large scans or a complex index on the usage_events
|
|
// table.
|
|
//
|
|
// This has the trade off that we can't count accurately between two exact
|
|
// timestamps. The provided timestamps will be converted to UTC and truncated to
|
|
// the events that happened on and between the two dates. Both dates are
|
|
// inclusive.
|
|
GetTotalUsageDCManagedAgentsV1(ctx context.Context, arg GetTotalUsageDCManagedAgentsV1Params) (int64, error)
|
|
GetUnexpiredLicenses(ctx context.Context) ([]License, error)
|
|
// Returns user IDs from the provided list that are consuming an AI seat.
|
|
// Filters to active, non-deleted, non-system users to match the canonical
|
|
// seat count query (GetActiveAISeatCount).
|
|
GetUserAISeatStates(ctx context.Context, userIds []uuid.UUID) ([]uuid.UUID, error)
|
|
// GetUserActivityInsights returns the ranking with top active users.
|
|
// The result can be filtered on template_ids, meaning only user data
|
|
// from workspaces based on those templates will be included.
|
|
// Note: The usage_seconds and usage_seconds_cumulative differ only when
|
|
// requesting deployment-wide (or multiple template) data. Cumulative
|
|
// produces a bloated value if a user has used multiple templates
|
|
// simultaneously.
|
|
GetUserActivityInsights(ctx context.Context, arg GetUserActivityInsightsParams) ([]GetUserActivityInsightsRow, error)
|
|
GetUserByEmailOrUsername(ctx context.Context, arg GetUserByEmailOrUsernameParams) (User, error)
|
|
GetUserByID(ctx context.Context, id uuid.UUID) (User, error)
|
|
GetUserChatCompactionThreshold(ctx context.Context, arg GetUserChatCompactionThresholdParams) (string, error)
|
|
GetUserChatCustomPrompt(ctx context.Context, userID uuid.UUID) (string, error)
|
|
GetUserChatDebugLoggingEnabled(ctx context.Context, userID uuid.UUID) (bool, error)
|
|
GetUserChatProviderKeys(ctx context.Context, userID uuid.UUID) ([]UserChatProviderKey, error)
|
|
// Returns the total spend for a user in the given period.
|
|
// When organization_id is NULL, spend across all organizations is
|
|
// returned (global behavior). Otherwise only spend within the
|
|
// specified organization is included.
|
|
GetUserChatSpendInPeriod(ctx context.Context, arg GetUserChatSpendInPeriodParams) (int64, error)
|
|
GetUserCount(ctx context.Context, includeSystem bool) (int64, error)
|
|
// Returns the minimum (most restrictive) group limit for a user.
|
|
// Returns -1 if no group limits match the specified scope.
|
|
// When organization_id is NULL, groups across all organizations are
|
|
// considered (global behavior). Otherwise only groups within the
|
|
// specified organization are considered.
|
|
GetUserGroupSpendLimit(ctx context.Context, arg GetUserGroupSpendLimitParams) (int64, error)
|
|
// GetUserLatencyInsights returns the median and 95th percentile connection
|
|
// latency that users have experienced. The result can be filtered on
|
|
// template_ids, meaning only user data from workspaces based on those templates
|
|
// will be included.
|
|
GetUserLatencyInsights(ctx context.Context, arg GetUserLatencyInsightsParams) ([]GetUserLatencyInsightsRow, error)
|
|
GetUserLinkByLinkedID(ctx context.Context, linkedID string) (UserLink, error)
|
|
GetUserLinkByUserIDLoginType(ctx context.Context, arg GetUserLinkByUserIDLoginTypeParams) (UserLink, error)
|
|
GetUserLinksByUserID(ctx context.Context, userID uuid.UUID) ([]UserLink, error)
|
|
GetUserNotificationPreferences(ctx context.Context, userID uuid.UUID) ([]NotificationPreference, error)
|
|
GetUserSecretByID(ctx context.Context, id uuid.UUID) (UserSecret, error)
|
|
GetUserSecretByUserIDAndName(ctx context.Context, arg GetUserSecretByUserIDAndNameParams) (UserSecret, error)
|
|
// GetUserStatusCounts returns the count of users in each status over time.
|
|
// The time range is inclusively defined by the start_time and end_time parameters.
|
|
GetUserStatusCounts(ctx context.Context, arg GetUserStatusCountsParams) ([]GetUserStatusCountsRow, error)
|
|
GetUserTaskNotificationAlertDismissed(ctx context.Context, userID uuid.UUID) (bool, error)
|
|
GetUserTerminalFont(ctx context.Context, userID uuid.UUID) (string, error)
|
|
GetUserThemePreference(ctx context.Context, userID uuid.UUID) (string, error)
|
|
GetUserThinkingDisplayMode(ctx context.Context, userID uuid.UUID) (string, error)
|
|
GetUserWorkspaceBuildParameters(ctx context.Context, arg GetUserWorkspaceBuildParametersParams) ([]GetUserWorkspaceBuildParametersRow, error)
|
|
// This will never return deleted users.
|
|
GetUsers(ctx context.Context, arg GetUsersParams) ([]GetUsersRow, error)
|
|
// This shouldn't check for deleted, because it's frequently used
|
|
// to look up references to actions. eg. a user could build a workspace
|
|
// for another user, then be deleted... we still want them to appear!
|
|
GetUsersByIDs(ctx context.Context, ids []uuid.UUID) ([]User, error)
|
|
GetWebpushSubscriptionsByUserID(ctx context.Context, userID uuid.UUID) ([]WebpushSubscription, error)
|
|
GetWebpushVAPIDKeys(ctx context.Context) (GetWebpushVAPIDKeysRow, error)
|
|
GetWorkspaceACLByID(ctx context.Context, id uuid.UUID) (GetWorkspaceACLByIDRow, error)
|
|
GetWorkspaceAgentAndWorkspaceByID(ctx context.Context, id uuid.UUID) (GetWorkspaceAgentAndWorkspaceByIDRow, error)
|
|
GetWorkspaceAgentByID(ctx context.Context, id uuid.UUID) (WorkspaceAgent, error)
|
|
GetWorkspaceAgentDevcontainersByAgentID(ctx context.Context, workspaceAgentID uuid.UUID) ([]WorkspaceAgentDevcontainer, error)
|
|
GetWorkspaceAgentLifecycleStateByID(ctx context.Context, id uuid.UUID) (GetWorkspaceAgentLifecycleStateByIDRow, error)
|
|
GetWorkspaceAgentLogSourcesByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAgentLogSource, error)
|
|
GetWorkspaceAgentLogsAfter(ctx context.Context, arg GetWorkspaceAgentLogsAfterParams) ([]WorkspaceAgentLog, error)
|
|
GetWorkspaceAgentMetadata(ctx context.Context, arg GetWorkspaceAgentMetadataParams) ([]WorkspaceAgentMetadatum, error)
|
|
GetWorkspaceAgentPortShare(ctx context.Context, arg GetWorkspaceAgentPortShareParams) (WorkspaceAgentPortShare, error)
|
|
GetWorkspaceAgentScriptTimingsByBuildID(ctx context.Context, id uuid.UUID) ([]GetWorkspaceAgentScriptTimingsByBuildIDRow, error)
|
|
GetWorkspaceAgentScriptsByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]GetWorkspaceAgentScriptsByAgentIDsRow, error)
|
|
GetWorkspaceAgentStats(ctx context.Context, createdAt time.Time) ([]GetWorkspaceAgentStatsRow, error)
|
|
GetWorkspaceAgentStatsAndLabels(ctx context.Context, createdAt time.Time) ([]GetWorkspaceAgentStatsAndLabelsRow, error)
|
|
// `minute_buckets` could return 0 rows if there are no usage stats since `created_at`.
|
|
GetWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) ([]GetWorkspaceAgentUsageStatsRow, error)
|
|
GetWorkspaceAgentUsageStatsAndLabels(ctx context.Context, createdAt time.Time) ([]GetWorkspaceAgentUsageStatsAndLabelsRow, error)
|
|
GetWorkspaceAgentsByInstanceID(ctx context.Context, authInstanceID string) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAgentsByParentID(ctx context.Context, parentID uuid.UUID) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAgentsByResourceIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx context.Context, arg GetWorkspaceAgentsByWorkspaceAndBuildNumberParams) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAgentsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAgentsForMetrics(ctx context.Context) ([]GetWorkspaceAgentsForMetricsRow, error)
|
|
GetWorkspaceAgentsInLatestBuildByWorkspaceID(ctx context.Context, workspaceID uuid.UUID) ([]WorkspaceAgent, error)
|
|
GetWorkspaceAppByAgentIDAndSlug(ctx context.Context, arg GetWorkspaceAppByAgentIDAndSlugParams) (WorkspaceApp, error)
|
|
GetWorkspaceAppStatusesByAppIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceAppStatus, error)
|
|
GetWorkspaceAppsByAgentID(ctx context.Context, agentID uuid.UUID) ([]WorkspaceApp, error)
|
|
GetWorkspaceAppsByAgentIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceApp, error)
|
|
GetWorkspaceAppsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceApp, error)
|
|
GetWorkspaceBuildByID(ctx context.Context, id uuid.UUID) (WorkspaceBuild, error)
|
|
GetWorkspaceBuildByJobID(ctx context.Context, jobID uuid.UUID) (WorkspaceBuild, error)
|
|
GetWorkspaceBuildByWorkspaceIDAndBuildNumber(ctx context.Context, arg GetWorkspaceBuildByWorkspaceIDAndBuildNumberParams) (WorkspaceBuild, error)
|
|
// Returns build metadata for e2e workspace build duration metrics.
|
|
// Also checks if all agents are ready and returns the worst status.
|
|
GetWorkspaceBuildMetricsByResourceID(ctx context.Context, id uuid.UUID) (GetWorkspaceBuildMetricsByResourceIDRow, error)
|
|
GetWorkspaceBuildParameters(ctx context.Context, workspaceBuildID uuid.UUID) ([]WorkspaceBuildParameter, error)
|
|
// Fetches the provisioner state of a workspace build, joined through to the
|
|
// template so that dbauthz can enforce policy.ActionUpdate on the template.
|
|
// Provisioner state contains sensitive Terraform state and should only be
|
|
// accessible to template administrators.
|
|
GetWorkspaceBuildProvisionerStateByID(ctx context.Context, workspaceBuildID uuid.UUID) (GetWorkspaceBuildProvisionerStateByIDRow, error)
|
|
GetWorkspaceBuildStatsByTemplates(ctx context.Context, since time.Time) ([]GetWorkspaceBuildStatsByTemplatesRow, error)
|
|
GetWorkspaceBuildsByWorkspaceID(ctx context.Context, arg GetWorkspaceBuildsByWorkspaceIDParams) ([]WorkspaceBuild, error)
|
|
GetWorkspaceBuildsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceBuild, error)
|
|
GetWorkspaceByAgentID(ctx context.Context, agentID uuid.UUID) (Workspace, error)
|
|
GetWorkspaceByID(ctx context.Context, id uuid.UUID) (Workspace, error)
|
|
GetWorkspaceByOwnerIDAndName(ctx context.Context, arg GetWorkspaceByOwnerIDAndNameParams) (Workspace, error)
|
|
GetWorkspaceByResourceID(ctx context.Context, resourceID uuid.UUID) (Workspace, error)
|
|
GetWorkspaceByWorkspaceAppID(ctx context.Context, workspaceAppID uuid.UUID) (Workspace, error)
|
|
GetWorkspaceModulesByJobID(ctx context.Context, jobID uuid.UUID) ([]WorkspaceModule, error)
|
|
GetWorkspaceModulesCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceModule, error)
|
|
GetWorkspaceProxies(ctx context.Context) ([]WorkspaceProxy, error)
|
|
// Finds a workspace proxy that has an access URL or app hostname that matches
|
|
// the provided hostname. This is to check if a hostname matches any workspace
|
|
// proxy.
|
|
//
|
|
// The hostname must be sanitized to only contain [a-zA-Z0-9.-] before calling
|
|
// this query. The scheme, port and path should be stripped.
|
|
//
|
|
GetWorkspaceProxyByHostname(ctx context.Context, arg GetWorkspaceProxyByHostnameParams) (WorkspaceProxy, error)
|
|
GetWorkspaceProxyByID(ctx context.Context, id uuid.UUID) (WorkspaceProxy, error)
|
|
GetWorkspaceProxyByName(ctx context.Context, name string) (WorkspaceProxy, error)
|
|
GetWorkspaceResourceByID(ctx context.Context, id uuid.UUID) (WorkspaceResource, error)
|
|
GetWorkspaceResourceMetadataByResourceIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceResourceMetadatum, error)
|
|
GetWorkspaceResourceMetadataCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceResourceMetadatum, error)
|
|
GetWorkspaceResourcesByJobID(ctx context.Context, jobID uuid.UUID) ([]WorkspaceResource, error)
|
|
GetWorkspaceResourcesByJobIDs(ctx context.Context, ids []uuid.UUID) ([]WorkspaceResource, error)
|
|
GetWorkspaceResourcesCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceResource, error)
|
|
GetWorkspaceUniqueOwnerCountByTemplateIDs(ctx context.Context, templateIds []uuid.UUID) ([]GetWorkspaceUniqueOwnerCountByTemplateIDsRow, error)
|
|
// build_params is used to filter by build parameters if present.
|
|
// It has to be a CTE because the set returning function 'unnest' cannot
|
|
// be used in a WHERE clause.
|
|
GetWorkspaces(ctx context.Context, arg GetWorkspacesParams) ([]GetWorkspacesRow, error)
|
|
GetWorkspacesAndAgentsByOwnerID(ctx context.Context, ownerID uuid.UUID) ([]GetWorkspacesAndAgentsByOwnerIDRow, error)
|
|
GetWorkspacesByTemplateID(ctx context.Context, templateID uuid.UUID) ([]WorkspaceTable, error)
|
|
GetWorkspacesEligibleForTransition(ctx context.Context, now time.Time) ([]GetWorkspacesEligibleForTransitionRow, error)
|
|
GetWorkspacesForWorkspaceMetrics(ctx context.Context) ([]GetWorkspacesForWorkspaceMetricsRow, error)
|
|
InsertAIBridgeInterception(ctx context.Context, arg InsertAIBridgeInterceptionParams) (AIBridgeInterception, error)
|
|
InsertAIBridgeModelThought(ctx context.Context, arg InsertAIBridgeModelThoughtParams) (AIBridgeModelThought, error)
|
|
InsertAIBridgeTokenUsage(ctx context.Context, arg InsertAIBridgeTokenUsageParams) (AIBridgeTokenUsage, error)
|
|
InsertAIBridgeToolUsage(ctx context.Context, arg InsertAIBridgeToolUsageParams) (AIBridgeToolUsage, error)
|
|
InsertAIBridgeUserPrompt(ctx context.Context, arg InsertAIBridgeUserPromptParams) (AIBridgeUserPrompt, error)
|
|
InsertAPIKey(ctx context.Context, arg InsertAPIKeyParams) (APIKey, error)
|
|
// We use the organization_id as the id
|
|
// for simplicity since all users is
|
|
// every member of the org.
|
|
InsertAllUsersGroup(ctx context.Context, organizationID uuid.UUID) (Group, error)
|
|
InsertAuditLog(ctx context.Context, arg InsertAuditLogParams) (AuditLog, error)
|
|
InsertChat(ctx context.Context, arg InsertChatParams) (Chat, error)
|
|
InsertChatDebugRun(ctx context.Context, arg InsertChatDebugRunParams) (ChatDebugRun, error)
|
|
// The CTE atomically locks the parent run via UPDATE, bumps its
|
|
// updated_at (eliminating a separate TouchChatDebugRunUpdatedAt
|
|
// call), and enforces the finalization guard: if the run is already
|
|
// finished, the UPDATE returns zero rows, the INSERT gets no source
|
|
// rows, and sql.ErrNoRows is returned. The UPDATE also serializes
|
|
// with concurrent FinalizeStale under READ COMMITTED isolation.
|
|
InsertChatDebugStep(ctx context.Context, arg InsertChatDebugStepParams) (ChatDebugStep, error)
|
|
InsertChatFile(ctx context.Context, arg InsertChatFileParams) (InsertChatFileRow, error)
|
|
InsertChatMessages(ctx context.Context, arg InsertChatMessagesParams) ([]ChatMessage, error)
|
|
InsertChatModelConfig(ctx context.Context, arg InsertChatModelConfigParams) (ChatModelConfig, error)
|
|
InsertChatProvider(ctx context.Context, arg InsertChatProviderParams) (ChatProvider, error)
|
|
InsertChatQueuedMessage(ctx context.Context, arg InsertChatQueuedMessageParams) (ChatQueuedMessage, error)
|
|
InsertCryptoKey(ctx context.Context, arg InsertCryptoKeyParams) (CryptoKey, error)
|
|
InsertCustomRole(ctx context.Context, arg InsertCustomRoleParams) (CustomRole, error)
|
|
InsertDBCryptKey(ctx context.Context, arg InsertDBCryptKeyParams) error
|
|
InsertDERPMeshKey(ctx context.Context, value string) error
|
|
InsertDeploymentID(ctx context.Context, value string) error
|
|
InsertExternalAuthLink(ctx context.Context, arg InsertExternalAuthLinkParams) (ExternalAuthLink, error)
|
|
InsertFile(ctx context.Context, arg InsertFileParams) (File, error)
|
|
InsertGitSSHKey(ctx context.Context, arg InsertGitSSHKeyParams) (GitSSHKey, error)
|
|
InsertGroup(ctx context.Context, arg InsertGroupParams) (Group, error)
|
|
InsertGroupMember(ctx context.Context, arg InsertGroupMemberParams) error
|
|
InsertInboxNotification(ctx context.Context, arg InsertInboxNotificationParams) (InboxNotification, error)
|
|
InsertLicense(ctx context.Context, arg InsertLicenseParams) (License, error)
|
|
InsertMCPServerConfig(ctx context.Context, arg InsertMCPServerConfigParams) (MCPServerConfig, error)
|
|
InsertMemoryResourceMonitor(ctx context.Context, arg InsertMemoryResourceMonitorParams) (WorkspaceAgentMemoryResourceMonitor, error)
|
|
// Inserts any group by name that does not exist. All new groups are given
|
|
// a random uuid, are inserted into the same organization. They have the default
|
|
// values for avatar, display name, and quota allowance (all zero values).
|
|
// If the name conflicts, do nothing.
|
|
InsertMissingGroups(ctx context.Context, arg InsertMissingGroupsParams) ([]Group, error)
|
|
InsertOAuth2ProviderApp(ctx context.Context, arg InsertOAuth2ProviderAppParams) (OAuth2ProviderApp, error)
|
|
InsertOAuth2ProviderAppCode(ctx context.Context, arg InsertOAuth2ProviderAppCodeParams) (OAuth2ProviderAppCode, error)
|
|
InsertOAuth2ProviderAppSecret(ctx context.Context, arg InsertOAuth2ProviderAppSecretParams) (OAuth2ProviderAppSecret, error)
|
|
InsertOAuth2ProviderAppToken(ctx context.Context, arg InsertOAuth2ProviderAppTokenParams) (OAuth2ProviderAppToken, error)
|
|
InsertOrganization(ctx context.Context, arg InsertOrganizationParams) (Organization, error)
|
|
InsertOrganizationMember(ctx context.Context, arg InsertOrganizationMemberParams) (OrganizationMember, error)
|
|
InsertPreset(ctx context.Context, arg InsertPresetParams) (TemplateVersionPreset, error)
|
|
InsertPresetParameters(ctx context.Context, arg InsertPresetParametersParams) ([]TemplateVersionPresetParameter, error)
|
|
InsertPresetPrebuildSchedule(ctx context.Context, arg InsertPresetPrebuildScheduleParams) (TemplateVersionPresetPrebuildSchedule, error)
|
|
InsertProvisionerJob(ctx context.Context, arg InsertProvisionerJobParams) (ProvisionerJob, error)
|
|
InsertProvisionerJobLogs(ctx context.Context, arg InsertProvisionerJobLogsParams) ([]ProvisionerJobLog, error)
|
|
InsertProvisionerJobTimings(ctx context.Context, arg InsertProvisionerJobTimingsParams) ([]ProvisionerJobTiming, error)
|
|
InsertProvisionerKey(ctx context.Context, arg InsertProvisionerKeyParams) (ProvisionerKey, error)
|
|
InsertReplica(ctx context.Context, arg InsertReplicaParams) (Replica, error)
|
|
InsertTask(ctx context.Context, arg InsertTaskParams) (TaskTable, error)
|
|
InsertTelemetryItemIfNotExists(ctx context.Context, arg InsertTelemetryItemIfNotExistsParams) error
|
|
// Inserts a new lock row into the telemetry_locks table. Replicas should call
|
|
// this function prior to attempting to generate or publish a heartbeat event to
|
|
// the telemetry service.
|
|
// If the query returns a duplicate primary key error, the replica should not
|
|
// attempt to generate or publish the event to the telemetry service.
|
|
InsertTelemetryLock(ctx context.Context, arg InsertTelemetryLockParams) error
|
|
InsertTemplate(ctx context.Context, arg InsertTemplateParams) error
|
|
InsertTemplateVersion(ctx context.Context, arg InsertTemplateVersionParams) error
|
|
InsertTemplateVersionParameter(ctx context.Context, arg InsertTemplateVersionParameterParams) (TemplateVersionParameter, error)
|
|
InsertTemplateVersionTerraformValuesByJobID(ctx context.Context, arg InsertTemplateVersionTerraformValuesByJobIDParams) error
|
|
InsertTemplateVersionVariable(ctx context.Context, arg InsertTemplateVersionVariableParams) (TemplateVersionVariable, error)
|
|
InsertTemplateVersionWorkspaceTag(ctx context.Context, arg InsertTemplateVersionWorkspaceTagParams) (TemplateVersionWorkspaceTag, error)
|
|
// Duplicate events are ignored intentionally to allow for multiple replicas to
|
|
// publish heartbeat events.
|
|
InsertUsageEvent(ctx context.Context, arg InsertUsageEventParams) error
|
|
InsertUser(ctx context.Context, arg InsertUserParams) (User, error)
|
|
// InsertUserGroupsByID adds a user to all provided groups, if they exist.
|
|
// If there is a conflict, the user is already a member
|
|
InsertUserGroupsByID(ctx context.Context, arg InsertUserGroupsByIDParams) ([]uuid.UUID, error)
|
|
InsertUserLink(ctx context.Context, arg InsertUserLinkParams) (UserLink, error)
|
|
InsertVolumeResourceMonitor(ctx context.Context, arg InsertVolumeResourceMonitorParams) (WorkspaceAgentVolumeResourceMonitor, error)
|
|
// Inserts or updates a webpush subscription. The (user_id, endpoint) pair
|
|
// is unique; re-subscribing the same endpoint replaces the keys instead of
|
|
// inserting a duplicate row. This is the recovery path after a PWA reinstall
|
|
// on iOS, where the browser may keep the same endpoint with rotated keys.
|
|
InsertWebpushSubscription(ctx context.Context, arg InsertWebpushSubscriptionParams) (WebpushSubscription, error)
|
|
InsertWorkspace(ctx context.Context, arg InsertWorkspaceParams) (WorkspaceTable, error)
|
|
InsertWorkspaceAgent(ctx context.Context, arg InsertWorkspaceAgentParams) (WorkspaceAgent, error)
|
|
InsertWorkspaceAgentDevcontainers(ctx context.Context, arg InsertWorkspaceAgentDevcontainersParams) ([]WorkspaceAgentDevcontainer, error)
|
|
InsertWorkspaceAgentLogSources(ctx context.Context, arg InsertWorkspaceAgentLogSourcesParams) ([]WorkspaceAgentLogSource, error)
|
|
InsertWorkspaceAgentLogs(ctx context.Context, arg InsertWorkspaceAgentLogsParams) ([]WorkspaceAgentLog, error)
|
|
InsertWorkspaceAgentMetadata(ctx context.Context, arg InsertWorkspaceAgentMetadataParams) error
|
|
InsertWorkspaceAgentScriptTimings(ctx context.Context, arg InsertWorkspaceAgentScriptTimingsParams) (WorkspaceAgentScriptTiming, error)
|
|
InsertWorkspaceAgentScripts(ctx context.Context, arg InsertWorkspaceAgentScriptsParams) ([]WorkspaceAgentScript, error)
|
|
InsertWorkspaceAgentStats(ctx context.Context, arg InsertWorkspaceAgentStatsParams) error
|
|
InsertWorkspaceAppStats(ctx context.Context, arg InsertWorkspaceAppStatsParams) error
|
|
InsertWorkspaceAppStatus(ctx context.Context, arg InsertWorkspaceAppStatusParams) (WorkspaceAppStatus, error)
|
|
InsertWorkspaceBuild(ctx context.Context, arg InsertWorkspaceBuildParams) error
|
|
InsertWorkspaceBuildParameters(ctx context.Context, arg InsertWorkspaceBuildParametersParams) error
|
|
InsertWorkspaceModule(ctx context.Context, arg InsertWorkspaceModuleParams) (WorkspaceModule, error)
|
|
InsertWorkspaceProxy(ctx context.Context, arg InsertWorkspaceProxyParams) (WorkspaceProxy, error)
|
|
InsertWorkspaceResource(ctx context.Context, arg InsertWorkspaceResourceParams) (WorkspaceResource, error)
|
|
InsertWorkspaceResourceMetadata(ctx context.Context, arg InsertWorkspaceResourceMetadataParams) ([]WorkspaceResourceMetadatum, error)
|
|
// LinkChatFiles inserts file associations into the chat_file_links
|
|
// join table with deduplication (ON CONFLICT DO NOTHING). The INSERT
|
|
// is conditional: it only proceeds when the total number of links
|
|
// (existing + genuinely new) does not exceed max_file_links. Returns
|
|
// the number of genuinely new file IDs that were NOT inserted due to
|
|
// the cap. A return value of 0 means all files were linked (or were
|
|
// already linked). A positive value means the cap blocked that many
|
|
// new links.
|
|
LinkChatFiles(ctx context.Context, arg LinkChatFilesParams) (int32, error)
|
|
ListAIBridgeClients(ctx context.Context, arg ListAIBridgeClientsParams) ([]string, error)
|
|
ListAIBridgeInterceptions(ctx context.Context, arg ListAIBridgeInterceptionsParams) ([]ListAIBridgeInterceptionsRow, error)
|
|
// Finds all unique AI Bridge interception telemetry summaries combinations
|
|
// (provider, model, client) in the given timeframe for telemetry reporting.
|
|
ListAIBridgeInterceptionsTelemetrySummaries(ctx context.Context, arg ListAIBridgeInterceptionsTelemetrySummariesParams) ([]ListAIBridgeInterceptionsTelemetrySummariesRow, error)
|
|
ListAIBridgeModelThoughtsByInterceptionIDs(ctx context.Context, interceptionIds []uuid.UUID) ([]AIBridgeModelThought, error)
|
|
ListAIBridgeModels(ctx context.Context, arg ListAIBridgeModelsParams) ([]string, error)
|
|
// Returns all interceptions belonging to paginated threads within a session.
|
|
// Threads are paginated by (started_at, thread_id) cursor.
|
|
ListAIBridgeSessionThreads(ctx context.Context, arg ListAIBridgeSessionThreadsParams) ([]ListAIBridgeSessionThreadsRow, error)
|
|
// Returns paginated sessions with aggregated metadata, token counts, and
|
|
// the most recent user prompt. A "session" is a logical grouping of
|
|
// interceptions that share the same session_id (set by the client).
|
|
//
|
|
// Pagination-first strategy: identify the page of sessions cheaply via a
|
|
// single GROUP BY scan, then do expensive lateral joins (tokens, prompts,
|
|
// first-interception metadata) only for the ~page-size result set.
|
|
ListAIBridgeSessions(ctx context.Context, arg ListAIBridgeSessionsParams) ([]ListAIBridgeSessionsRow, error)
|
|
ListAIBridgeTokenUsagesByInterceptionIDs(ctx context.Context, interceptionIds []uuid.UUID) ([]AIBridgeTokenUsage, error)
|
|
ListAIBridgeToolUsagesByInterceptionIDs(ctx context.Context, interceptionIds []uuid.UUID) ([]AIBridgeToolUsage, error)
|
|
ListAIBridgeUserPromptsByInterceptionIDs(ctx context.Context, interceptionIds []uuid.UUID) ([]AIBridgeUserPrompt, error)
|
|
ListChatUsageLimitGroupOverrides(ctx context.Context) ([]ListChatUsageLimitGroupOverridesRow, error)
|
|
ListChatUsageLimitOverrides(ctx context.Context) ([]ListChatUsageLimitOverridesRow, error)
|
|
ListProvisionerKeysByOrganization(ctx context.Context, organizationID uuid.UUID) ([]ProvisionerKey, error)
|
|
ListProvisionerKeysByOrganizationExcludeReserved(ctx context.Context, organizationID uuid.UUID) ([]ProvisionerKey, error)
|
|
ListTasks(ctx context.Context, arg ListTasksParams) ([]Task, error)
|
|
ListUserChatCompactionThresholds(ctx context.Context, userID uuid.UUID) ([]UserConfig, error)
|
|
// Returns metadata only (no value or value_key_id) for the
|
|
// REST API list and get endpoints.
|
|
ListUserSecrets(ctx context.Context, userID uuid.UUID) ([]ListUserSecretsRow, error)
|
|
// Returns all columns including the secret value. Used by the
|
|
// provisioner (build-time injection) and the agent manifest
|
|
// (runtime injection).
|
|
ListUserSecretsWithValues(ctx context.Context, userID uuid.UUID) ([]UserSecret, error)
|
|
ListWorkspaceAgentPortShares(ctx context.Context, workspaceID uuid.UUID) ([]WorkspaceAgentPortShare, error)
|
|
MarkAllInboxNotificationsAsRead(ctx context.Context, arg MarkAllInboxNotificationsAsReadParams) error
|
|
OIDCClaimFieldValues(ctx context.Context, arg OIDCClaimFieldValuesParams) ([]string, error)
|
|
// OIDCClaimFields returns a list of distinct keys in the the merged_claims fields.
|
|
// This query is used to generate the list of available sync fields for idp sync settings.
|
|
OIDCClaimFields(ctx context.Context, organizationID uuid.UUID) ([]string, error)
|
|
// Arguments are optional with uuid.Nil to ignore.
|
|
// - Use just 'organization_id' to get all members of an org
|
|
// - Use just 'user_id' to get all orgs a user is a member of
|
|
// - Use both to get a specific org member row
|
|
OrganizationMembers(ctx context.Context, arg OrganizationMembersParams) ([]OrganizationMembersRow, error)
|
|
PaginatedOrganizationMembers(ctx context.Context, arg PaginatedOrganizationMembersParams) ([]PaginatedOrganizationMembersRow, error)
|
|
// Under READ COMMITTED, concurrent pin operations for the same
|
|
// owner may momentarily produce duplicate pin_order values because
|
|
// each CTE snapshot does not see the other's writes. The next
|
|
// pin/unpin/reorder operation's ROW_NUMBER() self-heals the
|
|
// sequence, so this is acceptable.
|
|
PinChatByID(ctx context.Context, id uuid.UUID) error
|
|
PopNextQueuedMessage(ctx context.Context, chatID uuid.UUID) (ChatQueuedMessage, error)
|
|
ReduceWorkspaceAgentShareLevelToAuthenticatedByTemplate(ctx context.Context, templateID uuid.UUID) error
|
|
RegisterWorkspaceProxy(ctx context.Context, arg RegisterWorkspaceProxyParams) (WorkspaceProxy, error)
|
|
RemoveUserFromGroups(ctx context.Context, arg RemoveUserFromGroupsParams) ([]uuid.UUID, error)
|
|
// Resolves the effective spend limit for a user using the hierarchy:
|
|
// 1. Individual user override (highest priority, applies globally across
|
|
// all organizations since it lives on the users table)
|
|
// 2. Minimum group limit across the user's groups
|
|
// 3. Global default from config
|
|
// Returns -1 if limits are not enabled.
|
|
// When organization_id is NULL, groups across all organizations are
|
|
// considered (global behavior). Otherwise only groups within the
|
|
// specified organization are considered.
|
|
// limit_source indicates which tier won: 'user', 'group', 'default',
|
|
// or 'disabled'.
|
|
ResolveUserChatSpendLimit(ctx context.Context, arg ResolveUserChatSpendLimitParams) (ResolveUserChatSpendLimitRow, error)
|
|
RevokeDBCryptKey(ctx context.Context, activeKeyDigest string) error
|
|
// Note that this selects from the CTE, not the original table. The CTE is named
|
|
// the same as the original table to trick sqlc into reusing the existing struct
|
|
// for the table.
|
|
// The CTE and the reorder is required because UPDATE doesn't guarantee order.
|
|
SelectUsageEventsForPublishing(ctx context.Context, now time.Time) ([]UsageEvent, error)
|
|
SoftDeleteChatMessageByID(ctx context.Context, id int64) error
|
|
SoftDeleteChatMessagesAfterID(ctx context.Context, arg SoftDeleteChatMessagesAfterIDParams) error
|
|
SoftDeleteContextFileMessages(ctx context.Context, chatID uuid.UUID) error
|
|
// Overrides updated_at on the parent run without touching any
|
|
// other column. Used by tests that need to stamp a run with a
|
|
// specific timestamp after the InsertChatDebugStep CTE has
|
|
// already bumped it to NOW(), so stale-row finalization paths
|
|
// can be exercised deterministically. The chatdebug service
|
|
// itself does not call this: heartbeats go through
|
|
// TouchChatDebugStepAndRun, and step creation updates the parent
|
|
// run via the InsertChatDebugStep CTE.
|
|
TouchChatDebugRunUpdatedAt(ctx context.Context, arg TouchChatDebugRunUpdatedAtParams) error
|
|
// Atomically bumps updated_at on both the step and its parent run
|
|
// in a single statement. This prevents FinalizeStale from
|
|
// interleaving between the two touches and finalizing a run whose
|
|
// step heartbeat was just written.
|
|
//
|
|
// The step UPDATE joins through touched_run (via FROM) and reads
|
|
// its RETURNING rows. Per the PostgreSQL WITH semantics, RETURNING
|
|
// is the only way to communicate values between a data-modifying
|
|
// CTE and the main query, and consuming those rows forces the run
|
|
// UPDATE to complete before the step UPDATE. That matches the
|
|
// lock order used by FinalizeStaleChatDebugRows and avoids a
|
|
// deadlock between concurrent heartbeats and stale sweeps. The
|
|
// join also constrains the step update to the specified run so a
|
|
// mismatched (run_id, step_id) pair cannot silently refresh an
|
|
// unrelated step.
|
|
TouchChatDebugStepAndRun(ctx context.Context, arg TouchChatDebugStepAndRunParams) error
|
|
// Non blocking lock. Returns true if the lock was acquired, false otherwise.
|
|
//
|
|
// This must be called from within a transaction. The lock will be automatically
|
|
// released when the transaction ends.
|
|
TryAcquireLock(ctx context.Context, pgTryAdvisoryXactLock int64) (bool, error)
|
|
// Unarchives a chat (and its children). Stale file references are
|
|
// handled automatically by FK cascades on chat_file_links: when
|
|
// dbpurge deletes a chat_files row, the corresponding
|
|
// chat_file_links rows are cascade-deleted by PostgreSQL.
|
|
UnarchiveChatByID(ctx context.Context, id uuid.UUID) ([]Chat, error)
|
|
// This will always work regardless of the current state of the template version.
|
|
UnarchiveTemplateVersion(ctx context.Context, arg UnarchiveTemplateVersionParams) error
|
|
UnfavoriteWorkspace(ctx context.Context, id uuid.UUID) error
|
|
UnpinChatByID(ctx context.Context, id uuid.UUID) error
|
|
UnsetDefaultChatModelConfigs(ctx context.Context) error
|
|
UpdateAIBridgeInterceptionEnded(ctx context.Context, arg UpdateAIBridgeInterceptionEndedParams) (AIBridgeInterception, error)
|
|
UpdateAPIKeyByID(ctx context.Context, arg UpdateAPIKeyByIDParams) error
|
|
UpdateChatBuildAgentBinding(ctx context.Context, arg UpdateChatBuildAgentBindingParams) (Chat, error)
|
|
UpdateChatByID(ctx context.Context, arg UpdateChatByIDParams) (Chat, error)
|
|
// Uses COALESCE so that passing NULL from Go means "keep the
|
|
// existing value." This is intentional: debug rows follow a
|
|
// write-once-finalize pattern where fields are set at creation
|
|
// or finalization and never cleared back to NULL. The @now
|
|
// parameter keeps updated_at under the caller's clock.
|
|
//
|
|
// finished_at is enforced as write-once at the SQL level: once
|
|
// populated it cannot be overwritten by a later call. Callers
|
|
// that issue a summary or status refresh after the run has
|
|
// already finalized therefore cannot corrupt the original
|
|
// completion timestamp, which keeps duration and ordering
|
|
// calculations stable regardless of how many times the row is
|
|
// updated.
|
|
UpdateChatDebugRun(ctx context.Context, arg UpdateChatDebugRunParams) (ChatDebugRun, error)
|
|
// Uses COALESCE so that passing NULL from Go means "keep the
|
|
// existing value." This is intentional: debug rows follow a
|
|
// write-once-finalize pattern where fields are set at creation
|
|
// or finalization and never cleared back to NULL. The @now
|
|
// parameter keeps updated_at under the caller's clock, matching
|
|
// the injectable quartz.Clock used by FinalizeStale sweeps.
|
|
UpdateChatDebugStep(ctx context.Context, arg UpdateChatDebugStepParams) (ChatDebugStep, error)
|
|
// Bumps the heartbeat timestamp for the given set of chat IDs,
|
|
// provided they are still running and owned by the specified
|
|
// worker. Returns the IDs that were actually updated so the
|
|
// caller can detect stolen or completed chats via set-difference.
|
|
UpdateChatHeartbeats(ctx context.Context, arg UpdateChatHeartbeatsParams) ([]uuid.UUID, error)
|
|
UpdateChatLabelsByID(ctx context.Context, arg UpdateChatLabelsByIDParams) (Chat, error)
|
|
// Updates the cached injected context parts (AGENTS.md +
|
|
// skills) on the chat row. Called only when context changes
|
|
// (first workspace attach or agent change). updated_at is
|
|
// intentionally not touched to avoid reordering the chat list.
|
|
UpdateChatLastInjectedContext(ctx context.Context, arg UpdateChatLastInjectedContextParams) (Chat, error)
|
|
UpdateChatLastModelConfigByID(ctx context.Context, arg UpdateChatLastModelConfigByIDParams) (Chat, error)
|
|
// Updates the last read message ID for a chat. This is used to track
|
|
// which messages the owner has seen, enabling unread indicators.
|
|
UpdateChatLastReadMessageID(ctx context.Context, arg UpdateChatLastReadMessageIDParams) error
|
|
UpdateChatMCPServerIDs(ctx context.Context, arg UpdateChatMCPServerIDsParams) (Chat, error)
|
|
UpdateChatMessageByID(ctx context.Context, arg UpdateChatMessageByIDParams) (ChatMessage, error)
|
|
UpdateChatModelConfig(ctx context.Context, arg UpdateChatModelConfigParams) (ChatModelConfig, error)
|
|
UpdateChatPinOrder(ctx context.Context, arg UpdateChatPinOrderParams) error
|
|
UpdateChatPlanModeByID(ctx context.Context, arg UpdateChatPlanModeByIDParams) (Chat, error)
|
|
UpdateChatProvider(ctx context.Context, arg UpdateChatProviderParams) (ChatProvider, error)
|
|
UpdateChatStatus(ctx context.Context, arg UpdateChatStatusParams) (Chat, error)
|
|
UpdateChatStatusPreserveUpdatedAt(ctx context.Context, arg UpdateChatStatusPreserveUpdatedAtParams) (Chat, error)
|
|
UpdateChatTitleByID(ctx context.Context, arg UpdateChatTitleByIDParams) (Chat, error)
|
|
UpdateChatWorkspaceBinding(ctx context.Context, arg UpdateChatWorkspaceBindingParams) (Chat, error)
|
|
UpdateCryptoKeyDeletesAt(ctx context.Context, arg UpdateCryptoKeyDeletesAtParams) (CryptoKey, error)
|
|
UpdateCustomRole(ctx context.Context, arg UpdateCustomRoleParams) (CustomRole, error)
|
|
UpdateExternalAuthLink(ctx context.Context, arg UpdateExternalAuthLinkParams) (ExternalAuthLink, error)
|
|
// Optimistic lock: only update the row if the refresh token in the database
|
|
// still matches the one we read before attempting the refresh. This prevents
|
|
// a concurrent caller that lost a token-refresh race from overwriting a valid
|
|
// token stored by the winner.
|
|
UpdateExternalAuthLinkRefreshToken(ctx context.Context, arg UpdateExternalAuthLinkRefreshTokenParams) error
|
|
UpdateGitSSHKey(ctx context.Context, arg UpdateGitSSHKeyParams) (GitSSHKey, error)
|
|
UpdateGroupByID(ctx context.Context, arg UpdateGroupByIDParams) (Group, error)
|
|
UpdateInactiveUsersToDormant(ctx context.Context, arg UpdateInactiveUsersToDormantParams) ([]UpdateInactiveUsersToDormantRow, error)
|
|
UpdateInboxNotificationReadStatus(ctx context.Context, arg UpdateInboxNotificationReadStatusParams) error
|
|
UpdateMCPServerConfig(ctx context.Context, arg UpdateMCPServerConfigParams) (MCPServerConfig, error)
|
|
UpdateMemberRoles(ctx context.Context, arg UpdateMemberRolesParams) (OrganizationMember, error)
|
|
UpdateMemoryResourceMonitor(ctx context.Context, arg UpdateMemoryResourceMonitorParams) error
|
|
UpdateNotificationTemplateMethodByID(ctx context.Context, arg UpdateNotificationTemplateMethodByIDParams) (NotificationTemplate, error)
|
|
UpdateOAuth2ProviderAppByClientID(ctx context.Context, arg UpdateOAuth2ProviderAppByClientIDParams) (OAuth2ProviderApp, error)
|
|
UpdateOAuth2ProviderAppByID(ctx context.Context, arg UpdateOAuth2ProviderAppByIDParams) (OAuth2ProviderApp, error)
|
|
UpdateOrganization(ctx context.Context, arg UpdateOrganizationParams) (Organization, error)
|
|
UpdateOrganizationDeletedByID(ctx context.Context, arg UpdateOrganizationDeletedByIDParams) error
|
|
UpdateOrganizationWorkspaceSharingSettings(ctx context.Context, arg UpdateOrganizationWorkspaceSharingSettingsParams) (Organization, error)
|
|
// Cancels all pending provisioner jobs for prebuilt workspaces on a specific preset from an
|
|
// inactive template version.
|
|
// This is an optimization to clean up stale pending jobs.
|
|
UpdatePrebuildProvisionerJobWithCancel(ctx context.Context, arg UpdatePrebuildProvisionerJobWithCancelParams) ([]UpdatePrebuildProvisionerJobWithCancelRow, error)
|
|
UpdatePresetPrebuildStatus(ctx context.Context, arg UpdatePresetPrebuildStatusParams) error
|
|
UpdatePresetsLastInvalidatedAt(ctx context.Context, arg UpdatePresetsLastInvalidatedAtParams) ([]UpdatePresetsLastInvalidatedAtRow, error)
|
|
UpdateProvisionerDaemonLastSeenAt(ctx context.Context, arg UpdateProvisionerDaemonLastSeenAtParams) error
|
|
UpdateProvisionerJobByID(ctx context.Context, arg UpdateProvisionerJobByIDParams) error
|
|
UpdateProvisionerJobLogsLength(ctx context.Context, arg UpdateProvisionerJobLogsLengthParams) error
|
|
UpdateProvisionerJobLogsOverflowed(ctx context.Context, arg UpdateProvisionerJobLogsOverflowedParams) error
|
|
UpdateProvisionerJobWithCancelByID(ctx context.Context, arg UpdateProvisionerJobWithCancelByIDParams) error
|
|
UpdateProvisionerJobWithCompleteByID(ctx context.Context, arg UpdateProvisionerJobWithCompleteByIDParams) error
|
|
UpdateProvisionerJobWithCompleteWithStartedAtByID(ctx context.Context, arg UpdateProvisionerJobWithCompleteWithStartedAtByIDParams) error
|
|
UpdateReplica(ctx context.Context, arg UpdateReplicaParams) (Replica, error)
|
|
UpdateTailnetPeerStatusByCoordinator(ctx context.Context, arg UpdateTailnetPeerStatusByCoordinatorParams) error
|
|
UpdateTaskPrompt(ctx context.Context, arg UpdateTaskPromptParams) (TaskTable, error)
|
|
UpdateTaskWorkspaceID(ctx context.Context, arg UpdateTaskWorkspaceIDParams) (TaskTable, error)
|
|
UpdateTemplateACLByID(ctx context.Context, arg UpdateTemplateACLByIDParams) error
|
|
UpdateTemplateAccessControlByID(ctx context.Context, arg UpdateTemplateAccessControlByIDParams) error
|
|
UpdateTemplateActiveVersionByID(ctx context.Context, arg UpdateTemplateActiveVersionByIDParams) error
|
|
UpdateTemplateDeletedByID(ctx context.Context, arg UpdateTemplateDeletedByIDParams) error
|
|
UpdateTemplateMetaByID(ctx context.Context, arg UpdateTemplateMetaByIDParams) error
|
|
UpdateTemplateScheduleByID(ctx context.Context, arg UpdateTemplateScheduleByIDParams) error
|
|
UpdateTemplateVersionByID(ctx context.Context, arg UpdateTemplateVersionByIDParams) error
|
|
UpdateTemplateVersionDescriptionByJobID(ctx context.Context, arg UpdateTemplateVersionDescriptionByJobIDParams) error
|
|
UpdateTemplateVersionExternalAuthProvidersByJobID(ctx context.Context, arg UpdateTemplateVersionExternalAuthProvidersByJobIDParams) error
|
|
UpdateTemplateVersionFlagsByJobID(ctx context.Context, arg UpdateTemplateVersionFlagsByJobIDParams) error
|
|
UpdateTemplateWorkspacesLastUsedAt(ctx context.Context, arg UpdateTemplateWorkspacesLastUsedAtParams) error
|
|
UpdateUsageEventsPostPublish(ctx context.Context, arg UpdateUsageEventsPostPublishParams) error
|
|
UpdateUserChatCompactionThreshold(ctx context.Context, arg UpdateUserChatCompactionThresholdParams) (UserConfig, error)
|
|
UpdateUserChatCustomPrompt(ctx context.Context, arg UpdateUserChatCustomPromptParams) (UserConfig, error)
|
|
UpdateUserChatProviderKey(ctx context.Context, arg UpdateUserChatProviderKeyParams) (UserChatProviderKey, error)
|
|
UpdateUserDeletedByID(ctx context.Context, id uuid.UUID) error
|
|
UpdateUserGithubComUserID(ctx context.Context, arg UpdateUserGithubComUserIDParams) error
|
|
UpdateUserHashedOneTimePasscode(ctx context.Context, arg UpdateUserHashedOneTimePasscodeParams) error
|
|
UpdateUserHashedPassword(ctx context.Context, arg UpdateUserHashedPasswordParams) error
|
|
UpdateUserLastSeenAt(ctx context.Context, arg UpdateUserLastSeenAtParams) (User, error)
|
|
UpdateUserLink(ctx context.Context, arg UpdateUserLinkParams) (UserLink, error)
|
|
UpdateUserLoginType(ctx context.Context, arg UpdateUserLoginTypeParams) (User, error)
|
|
UpdateUserNotificationPreferences(ctx context.Context, arg UpdateUserNotificationPreferencesParams) (int64, error)
|
|
UpdateUserProfile(ctx context.Context, arg UpdateUserProfileParams) (User, error)
|
|
UpdateUserQuietHoursSchedule(ctx context.Context, arg UpdateUserQuietHoursScheduleParams) (User, error)
|
|
UpdateUserRoles(ctx context.Context, arg UpdateUserRolesParams) (User, error)
|
|
UpdateUserSecretByUserIDAndName(ctx context.Context, arg UpdateUserSecretByUserIDAndNameParams) (UserSecret, error)
|
|
UpdateUserStatus(ctx context.Context, arg UpdateUserStatusParams) (User, error)
|
|
UpdateUserTaskNotificationAlertDismissed(ctx context.Context, arg UpdateUserTaskNotificationAlertDismissedParams) (bool, error)
|
|
UpdateUserTerminalFont(ctx context.Context, arg UpdateUserTerminalFontParams) (UserConfig, error)
|
|
UpdateUserThemePreference(ctx context.Context, arg UpdateUserThemePreferenceParams) (UserConfig, error)
|
|
UpdateUserThinkingDisplayMode(ctx context.Context, arg UpdateUserThinkingDisplayModeParams) (string, error)
|
|
UpdateVolumeResourceMonitor(ctx context.Context, arg UpdateVolumeResourceMonitorParams) error
|
|
UpdateWorkspace(ctx context.Context, arg UpdateWorkspaceParams) (WorkspaceTable, error)
|
|
UpdateWorkspaceACLByID(ctx context.Context, arg UpdateWorkspaceACLByIDParams) error
|
|
UpdateWorkspaceAgentConnectionByID(ctx context.Context, arg UpdateWorkspaceAgentConnectionByIDParams) error
|
|
UpdateWorkspaceAgentDirectoryByID(ctx context.Context, arg UpdateWorkspaceAgentDirectoryByIDParams) error
|
|
UpdateWorkspaceAgentDisplayAppsByID(ctx context.Context, arg UpdateWorkspaceAgentDisplayAppsByIDParams) error
|
|
UpdateWorkspaceAgentLifecycleStateByID(ctx context.Context, arg UpdateWorkspaceAgentLifecycleStateByIDParams) error
|
|
UpdateWorkspaceAgentLogOverflowByID(ctx context.Context, arg UpdateWorkspaceAgentLogOverflowByIDParams) error
|
|
UpdateWorkspaceAgentMetadata(ctx context.Context, arg UpdateWorkspaceAgentMetadataParams) error
|
|
UpdateWorkspaceAgentStartupByID(ctx context.Context, arg UpdateWorkspaceAgentStartupByIDParams) error
|
|
UpdateWorkspaceAppHealthByID(ctx context.Context, arg UpdateWorkspaceAppHealthByIDParams) error
|
|
UpdateWorkspaceAutomaticUpdates(ctx context.Context, arg UpdateWorkspaceAutomaticUpdatesParams) error
|
|
UpdateWorkspaceAutostart(ctx context.Context, arg UpdateWorkspaceAutostartParams) error
|
|
UpdateWorkspaceBuildCostByID(ctx context.Context, arg UpdateWorkspaceBuildCostByIDParams) error
|
|
UpdateWorkspaceBuildDeadlineByID(ctx context.Context, arg UpdateWorkspaceBuildDeadlineByIDParams) error
|
|
UpdateWorkspaceBuildFlagsByID(ctx context.Context, arg UpdateWorkspaceBuildFlagsByIDParams) error
|
|
UpdateWorkspaceBuildProvisionerStateByID(ctx context.Context, arg UpdateWorkspaceBuildProvisionerStateByIDParams) error
|
|
UpdateWorkspaceDeletedByID(ctx context.Context, arg UpdateWorkspaceDeletedByIDParams) error
|
|
UpdateWorkspaceDormantDeletingAt(ctx context.Context, arg UpdateWorkspaceDormantDeletingAtParams) (WorkspaceTable, error)
|
|
UpdateWorkspaceLastUsedAt(ctx context.Context, arg UpdateWorkspaceLastUsedAtParams) error
|
|
UpdateWorkspaceNextStartAt(ctx context.Context, arg UpdateWorkspaceNextStartAtParams) error
|
|
// This allows editing the properties of a workspace proxy.
|
|
UpdateWorkspaceProxy(ctx context.Context, arg UpdateWorkspaceProxyParams) (WorkspaceProxy, error)
|
|
UpdateWorkspaceProxyDeleted(ctx context.Context, arg UpdateWorkspaceProxyDeletedParams) error
|
|
UpdateWorkspaceTTL(ctx context.Context, arg UpdateWorkspaceTTLParams) error
|
|
UpdateWorkspacesDormantDeletingAtByTemplateID(ctx context.Context, arg UpdateWorkspacesDormantDeletingAtByTemplateIDParams) ([]WorkspaceTable, error)
|
|
UpdateWorkspacesTTLByTemplateID(ctx context.Context, arg UpdateWorkspacesTTLByTemplateIDParams) error
|
|
// Returns true if a new rows was inserted, false otherwise.
|
|
UpsertAISeatState(ctx context.Context, arg UpsertAISeatStateParams) (bool, error)
|
|
UpsertAnnouncementBanners(ctx context.Context, value string) error
|
|
UpsertApplicationName(ctx context.Context, value string) error
|
|
// Upserts boundary usage statistics for a replica. On INSERT (new period), uses
|
|
// delta values for unique counts (only data since last flush). On UPDATE, uses
|
|
// cumulative values for unique counts (accurate period totals). Request counts
|
|
// are always deltas, accumulated in DB. Returns true if insert, false if update.
|
|
UpsertBoundaryUsageStats(ctx context.Context, arg UpsertBoundaryUsageStatsParams) (bool, error)
|
|
// UpsertChatAdvisorConfig stores the deployment-wide runtime configuration
|
|
// for the experimental chat advisor. Callers marshal codersdk.AdvisorConfig
|
|
// to JSON before invoking this query.
|
|
UpsertChatAdvisorConfig(ctx context.Context, value string) error
|
|
UpsertChatAutoArchiveDays(ctx context.Context, autoArchiveDays int32) error
|
|
// UpsertChatDebugLoggingAllowUsers updates the runtime admin setting that
|
|
// allows users to opt into chat debug logging.
|
|
UpsertChatDebugLoggingAllowUsers(ctx context.Context, allowUsers bool) error
|
|
UpsertChatDesktopEnabled(ctx context.Context, enableDesktop bool) error
|
|
UpsertChatDiffStatus(ctx context.Context, arg UpsertChatDiffStatusParams) (ChatDiffStatus, error)
|
|
UpsertChatDiffStatusReference(ctx context.Context, arg UpsertChatDiffStatusReferenceParams) (ChatDiffStatus, error)
|
|
UpsertChatExploreModelOverride(ctx context.Context, value string) error
|
|
UpsertChatGeneralModelOverride(ctx context.Context, value string) error
|
|
UpsertChatIncludeDefaultSystemPrompt(ctx context.Context, includeDefaultSystemPrompt bool) error
|
|
UpsertChatPlanModeInstructions(ctx context.Context, value string) error
|
|
UpsertChatRetentionDays(ctx context.Context, retentionDays int32) error
|
|
UpsertChatSystemPrompt(ctx context.Context, value string) error
|
|
UpsertChatTemplateAllowlist(ctx context.Context, templateAllowlist string) error
|
|
UpsertChatUsageLimitConfig(ctx context.Context, arg UpsertChatUsageLimitConfigParams) (ChatUsageLimitConfig, error)
|
|
UpsertChatUsageLimitGroupOverride(ctx context.Context, arg UpsertChatUsageLimitGroupOverrideParams) (UpsertChatUsageLimitGroupOverrideRow, error)
|
|
UpsertChatUsageLimitUserOverride(ctx context.Context, arg UpsertChatUsageLimitUserOverrideParams) (UpsertChatUsageLimitUserOverrideRow, error)
|
|
UpsertChatWorkspaceTTL(ctx context.Context, workspaceTtl string) error
|
|
// The default proxy is implied and not actually stored in the database.
|
|
// So we need to store it's configuration here for display purposes.
|
|
// The functional values are immutable and controlled implicitly.
|
|
UpsertDefaultProxy(ctx context.Context, arg UpsertDefaultProxyParams) error
|
|
UpsertHealthSettings(ctx context.Context, value string) error
|
|
UpsertLastUpdateCheck(ctx context.Context, value string) error
|
|
UpsertLogoURL(ctx context.Context, value string) error
|
|
UpsertMCPServerUserToken(ctx context.Context, arg UpsertMCPServerUserTokenParams) (MCPServerUserToken, error)
|
|
// Insert or update notification report generator logs with recent activity.
|
|
UpsertNotificationReportGeneratorLog(ctx context.Context, arg UpsertNotificationReportGeneratorLogParams) error
|
|
UpsertNotificationsSettings(ctx context.Context, value string) error
|
|
UpsertOAuth2GithubDefaultEligible(ctx context.Context, eligible bool) error
|
|
UpsertPrebuildsSettings(ctx context.Context, value string) error
|
|
UpsertProvisionerDaemon(ctx context.Context, arg UpsertProvisionerDaemonParams) (ProvisionerDaemon, error)
|
|
UpsertRuntimeConfig(ctx context.Context, arg UpsertRuntimeConfigParams) error
|
|
UpsertTailnetCoordinator(ctx context.Context, id uuid.UUID) (TailnetCoordinator, error)
|
|
UpsertTailnetPeer(ctx context.Context, arg UpsertTailnetPeerParams) (TailnetPeer, error)
|
|
UpsertTailnetTunnel(ctx context.Context, arg UpsertTailnetTunnelParams) (TailnetTunnel, error)
|
|
UpsertTaskSnapshot(ctx context.Context, arg UpsertTaskSnapshotParams) error
|
|
UpsertTaskWorkspaceApp(ctx context.Context, arg UpsertTaskWorkspaceAppParams) (TaskWorkspaceApp, error)
|
|
UpsertTelemetryItem(ctx context.Context, arg UpsertTelemetryItemParams) error
|
|
// This query aggregates the workspace_agent_stats and workspace_app_stats data
|
|
// into a single table for efficient storage and querying. Half-hour buckets are
|
|
// used to store the data, and the minutes are summed for each user and template
|
|
// combination. The result is stored in the template_usage_stats table.
|
|
UpsertTemplateUsageStats(ctx context.Context) error
|
|
UpsertUserChatDebugLoggingEnabled(ctx context.Context, arg UpsertUserChatDebugLoggingEnabledParams) error
|
|
UpsertUserChatProviderKey(ctx context.Context, arg UpsertUserChatProviderKeyParams) (UserChatProviderKey, error)
|
|
UpsertWebpushVAPIDKeys(ctx context.Context, arg UpsertWebpushVAPIDKeysParams) error
|
|
UpsertWorkspaceAgentPortShare(ctx context.Context, arg UpsertWorkspaceAgentPortShareParams) (WorkspaceAgentPortShare, error)
|
|
UpsertWorkspaceApp(ctx context.Context, arg UpsertWorkspaceAppParams) (WorkspaceApp, error)
|
|
//
|
|
// The returned boolean, new_or_stale, can be used to deduce if a new session
|
|
// was started. This means that a new row was inserted (no previous session) or
|
|
// the updated_at is older than stale interval.
|
|
UpsertWorkspaceAppAuditSession(ctx context.Context, arg UpsertWorkspaceAppAuditSessionParams) (bool, error)
|
|
UsageEventExistsByID(ctx context.Context, id string) (bool, error)
|
|
ValidateGroupIDs(ctx context.Context, groupIds []uuid.UUID) (ValidateGroupIDsRow, error)
|
|
ValidateUserIDs(ctx context.Context, userIds []uuid.UUID) (ValidateUserIDsRow, error)
|
|
}
|
|
|
|
var _ sqlcQuerier = (*sqlQuerier)(nil)
|