mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-05 17:40:11 +02:00
* fix(daemon): retire sessions whose history the provider refuses to replay A run killed mid-reply (machine shutdown, force-quit, SIGKILL) can leave an empty assistant message in the agent CLI's transcript. Every later resume replays it, the provider rejects the request, and the (agent, issue) pair is bricked with no self-healing and no user-facing recovery. Multica already has the mechanism for this — poisoned-session classification — but its detector paired "400" with "invalid_request_error", which is the Anthropic wire shape. The same defect reported by any other provider carried neither token, so it classified as agent_error.unknown: resume-safe by omission. GetLastTaskSession kept handing back the dead session on every follow-up, manual Rerun resolved it through the same predicate, and the in-turn fresh-session retry never fired because ResumeRejected is false here (nothing rejected the resume — the transcript loaded and the provider refused to replay it). Add taskfailure.UnresumableHistory, which recognises the defect by what the provider says is wrong — some content is empty, and here is which message in the history — rather than by status code or provider name. Both signals are required, so a tool reporting "field must not be empty" does not match. Wire it into the four places that decide whether a session survives: - classifyPoisonedError, so the task is written as api_invalid_request - shouldRetryWithFreshSession, so the turn recovers on all 17 backends instead of the subset whose adapter learned to detect it; the tools == 0 gate is unchanged, so a run that already used a tool is never re-run - ResumeUnsafeFailure, covering the manual-Rerun path - both resume queries, as defense-in-depth for hosts whose daemon predates this (self-host daemons upgrade on their own cadence) Fixes #6066. Also covers the daemon half of #5760. Co-authored-by: multica-agent <github@multica.ai> * fix(session): close the Chat and fresh-retry paths that resurrect a poisoned session Review found the previous commit stopped short in two places, both of which put the dead transcript back in play. Chat never consulted the guarded query. The claim handler reads chat_session.session_id first and only falls back to GetLastChatTaskSession when it is empty, so a poisoned pointer there bypasses every filter that query applies. The fail path merely declined to OVERWRITE the pointer, leaving it in place. It now clears it in the same transaction, matched on session and runtime so a concurrent turn's newer pointer survives. The promote guard moves to ResumeUnsafeFailure as well — the reason-only check passed an un-upgraded daemon's agent_error.unknown row and re-pinned what the clear had just removed. GetLastChatTaskSession also kept the row-level filter the issue query dropped in GH #5975: it discarded the newest poisoned row and fell back to an older completed row carrying the same dead session. It now judges each session by its latest terminal state, matching GetLastTaskSession. A recovered turn could not retire anything. A terminal report carried one session_id, and an empty one meant both "nothing to report" and "forget the old session", so a fresh-session retry that SUCCEEDED left the id it retried away from selectable — through an older completed row on the issue, or through the chat pointer. agent_task_queue.retired_session_id records the abandonment itself, reported on every terminal path including completed, and both resume lookups exclude it. This is the contract gap the previous PR deferred; the fresh-retry path now runs on all backends, so deferring it is not safe. Also narrows what the cross-backend test claims: it pins the shared decision, not that all 17 adapters surface the error into Result.Error (#5760 is the counter-example), and says so. Co-authored-by: multica-agent <github@multica.ai> * test(session): require pgx.ErrNoRows in the resume-exclusion assertions The `if err == nil && prior.SessionID.Valid` form these tests shared is false-green: any real fault — undefined column, syntax error, dead connection — makes err non-nil, so the condition is false and the test passes. Run against a database missing this branch's new column, the exclusion tests reported PASS on a SQLSTATE 42703, meaning they could not have caught a broken query. requireSessionExcluded demands pgx.ErrNoRows specifically and fails loudly on anything else, so a green run now means the filter worked rather than the query never ran. Applied to all nine sites, not just the four this branch added: the other five guard the same GetLastTaskSession exclusion behaviour that this branch changes, so leaving them false-green would leave the change under-tested. All nine pass on a correctly migrated database. Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: Bohan-J <bohan@devv.ai> Co-authored-by: multica-agent <github@multica.ai>
1185 lines
58 KiB
Go
1185 lines
58 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package db
|
|
|
|
import (
|
|
"net/netip"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type ActivityLog struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
ActorType pgtype.Text `json:"actor_type"`
|
|
ActorID pgtype.UUID `json:"actor_id"`
|
|
Action string `json:"action"`
|
|
Details []byte `json:"details"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Agent struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Name string `json:"name"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
RuntimeMode string `json:"runtime_mode"`
|
|
RuntimeConfig []byte `json:"runtime_config"`
|
|
Visibility string `json:"visibility"`
|
|
Status string `json:"status"`
|
|
MaxConcurrentTasks int32 `json:"max_concurrent_tasks"`
|
|
OwnerID pgtype.UUID `json:"owner_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Description string `json:"description"`
|
|
RuntimeID pgtype.UUID `json:"runtime_id"`
|
|
Instructions string `json:"instructions"`
|
|
ArchivedAt pgtype.Timestamptz `json:"archived_at"`
|
|
ArchivedBy pgtype.UUID `json:"archived_by"`
|
|
CustomEnv []byte `json:"custom_env"`
|
|
CustomArgs []byte `json:"custom_args"`
|
|
McpConfig []byte `json:"mcp_config"`
|
|
Model pgtype.Text `json:"model"`
|
|
ThinkingLevel pgtype.Text `json:"thinking_level"`
|
|
// Composio toolkit slugs this agent is allowed to mount as MCP. NULL or empty array = no MCP overlay. Mounted for any run that passes the agent invocation-permission gate (MUL-3963); the overlay uses the agent OWNER's active Composio connection, so sharing the agent (public_to) shares these apps with whoever may invoke it. No longer gated on originator == owner. Stored as TEXT[] so the dispatch path can intersect against the owner's active connections with a single SQL ANY() filter.
|
|
ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist"`
|
|
// Agent invocation permission mode (MUL-3963). private = owner only; public_to = allow-list in agent_invocation_target. Replaces visibility as the authorization source for triggering runs; visibility is now a derived legacy field. Default private = deny-by-default.
|
|
PermissionMode string `json:"permission_mode"`
|
|
Kind string `json:"kind"`
|
|
SystemKey pgtype.Text `json:"system_key"`
|
|
DisabledRuntimeSkills []byte `json:"disabled_runtime_skills"`
|
|
ServiceTier pgtype.Text `json:"service_tier"`
|
|
}
|
|
|
|
// Allow-list of who may invoke a public_to agent (MUL-3963). One row per (agent, target_type, target); targets stack and canInvokeAgent OR-matches. workspace rows store the agent workspace_id in target_id; member rows store the user id; team rows are reserved and inert in V1. Rows only matter when agent.permission_mode = public_to. No DB foreign keys: agent_id / created_by / member target_id relationships are maintained in the application layer (see migration comment).
|
|
type AgentInvocationTarget struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
TargetType string `json:"target_type"`
|
|
TargetID pgtype.UUID `json:"target_id"`
|
|
CreatedBy pgtype.UUID `json:"created_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type AgentRuntime struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
DaemonID pgtype.Text `json:"daemon_id"`
|
|
Name string `json:"name"`
|
|
RuntimeMode string `json:"runtime_mode"`
|
|
Provider string `json:"provider"`
|
|
Status string `json:"status"`
|
|
DeviceInfo string `json:"device_info"`
|
|
Metadata []byte `json:"metadata"`
|
|
LastSeenAt pgtype.Timestamptz `json:"last_seen_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
OwnerID pgtype.UUID `json:"owner_id"`
|
|
LegacyDaemonID pgtype.Text `json:"legacy_daemon_id"`
|
|
Visibility string `json:"visibility"`
|
|
ProfileID pgtype.UUID `json:"profile_id"`
|
|
CustomName pgtype.Text `json:"custom_name"`
|
|
}
|
|
|
|
type AgentSkill struct {
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
SkillID pgtype.UUID `json:"skill_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
type AgentTaskQueue struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
Status string `json:"status"`
|
|
Priority int32 `json:"priority"`
|
|
DispatchedAt pgtype.Timestamptz `json:"dispatched_at"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
CompletedAt pgtype.Timestamptz `json:"completed_at"`
|
|
Result []byte `json:"result"`
|
|
Error pgtype.Text `json:"error"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
Context []byte `json:"context"`
|
|
RuntimeID pgtype.UUID `json:"runtime_id"`
|
|
SessionID pgtype.Text `json:"session_id"`
|
|
WorkDir pgtype.Text `json:"work_dir"`
|
|
TriggerCommentID pgtype.UUID `json:"trigger_comment_id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
AutopilotRunID pgtype.UUID `json:"autopilot_run_id"`
|
|
Attempt int32 `json:"attempt"`
|
|
MaxAttempts int32 `json:"max_attempts"`
|
|
ParentTaskID pgtype.UUID `json:"parent_task_id"`
|
|
FailureReason pgtype.Text `json:"failure_reason"`
|
|
TriggerSummary pgtype.Text `json:"trigger_summary"`
|
|
ForceFreshSession bool `json:"force_fresh_session"`
|
|
IsLeaderTask bool `json:"is_leader_task"`
|
|
WaitReason pgtype.Text `json:"wait_reason"`
|
|
InitiatorUserID pgtype.UUID `json:"initiator_user_id"`
|
|
HandoffNote pgtype.Text `json:"handoff_note"`
|
|
PrepareLeaseExpiresAt pgtype.Timestamptz `json:"prepare_lease_expires_at"`
|
|
SquadID pgtype.UUID `json:"squad_id"`
|
|
// Per-task MCP servers computed at dispatch time, merged on top of agent.mcp_config. Currently used by Composio integration to inject the initiator user's session URL. Cleared after task completes via trg_clear_runtime_mcp_overlay.
|
|
RuntimeMcpOverlay []byte `json:"runtime_mcp_overlay"`
|
|
EscalationForTaskID pgtype.UUID `json:"escalation_for_task_id"`
|
|
FireAt pgtype.Timestamptz `json:"fire_at"`
|
|
// Top-of-chain human originator for this run. For human-triggered tasks (comment by a member, chat, quick-create) equals that member. For agent-fanout tasks inherited from the parent task's originator_user_id via comment.source_task_id. NULL when no human is in the chain (autopilot, system-driven). Used by canInvokeAgent to judge A2A by the originator; the Composio overlay now follows invocation permission and uses the agent owner's connection, so this is audit/attribution + A2A gating, NOT a Composio owner==originator gate (MUL-3963).
|
|
OriginatorUserID pgtype.UUID `json:"originator_user_id"`
|
|
// Non-secret per-task connected app metadata corresponding to runtime_mcp_overlay, used by the daemon brief to tell agents which app capabilities are mounted. Cleared with runtime_mcp_overlay after task completion.
|
|
RuntimeConnectedApps []byte `json:"runtime_connected_apps"`
|
|
CoalescedCommentIds []pgtype.UUID `json:"coalesced_comment_ids"`
|
|
DeliveredCommentIds []pgtype.UUID `json:"delivered_comment_ids"`
|
|
ChatInputTaskID pgtype.UUID `json:"chat_input_task_id"`
|
|
ChatFinalizeDeferredAt pgtype.Timestamptz `json:"chat_finalize_deferred_at"`
|
|
// Waterfall level that resolved originator_user_id for this run: direct_human | delegation | comment_source | rule_owner | owner_fallback | backfill | unattributed. Audit/visibility metadata only — never consulted for authorization. TEXT with no CHECK so new trigger paths can add a source without a migration (MUL-4302 §7). NULL on pre-migration rows.
|
|
OriginatorSource pgtype.Text `json:"originator_source"`
|
|
// For originator_source=delegation: the parent task whose accountable human was copied onto this run. Value is copied, not chained, so delegation cycles are harmless (MUL-4302 §3.2). No FK; app-layer integrity only.
|
|
DelegatedFromTaskID pgtype.UUID `json:"delegated_from_task_id"`
|
|
// System transient-failure retry lineage: the task this run re-attempts. Inherits the parent attribution unchanged. Kept distinct from rerun_of_task_id so retry vs rerun report separately (MUL-4302 §5). No FK.
|
|
RetryOfTaskID pgtype.UUID `json:"retry_of_task_id"`
|
|
// Human manual-rerun lineage: the historical task a member re-ran. The rerun itself is a NEW direct_human attribution to the rerunning member; this column preserves the link to the original (MUL-4302 §5). No FK.
|
|
RerunOfTaskID pgtype.UUID `json:"rerun_of_task_id"`
|
|
// For originator_source=rule_owner: the published autopilot rule version snapshot whose publisher is the accountable human. No FK; snapshot table wiring lands in a later Phase 1 increment (MUL-4302 §3.4/§7).
|
|
RuleVersionID pgtype.UUID `json:"rule_version_id"`
|
|
// Uniform kind tag for the direct cause of this run (comment | issue_assignment | autopilot_run | rule_version | rerun | ...), paired with trigger_evidence_ref_id. Free TEXT so new evidence kinds need no migration (MUL-4302 §2).
|
|
TriggerEvidenceKind pgtype.Text `json:"trigger_evidence_kind"`
|
|
// The row id referenced by trigger_evidence_kind (a comment id, autopilot_run id, rule_version id, source task id, ...). No FK; resolvable per-kind in the app layer (MUL-4302 §2).
|
|
TriggerEvidenceRefID pgtype.UUID `json:"trigger_evidence_ref_id"`
|
|
// The one human accountable for this run, for audit / visibility / cost only — NEVER consulted for authorization (that is originator_user_id). Invariant: when originator_user_id IS NOT NULL, this equals it; the two diverge only when originator_user_id IS NULL (autopilot rule_owner / degraded owner_fallback name an accountable human while authorization carries none). No FK, no cascade (MUL-4302 §1/§7). NULL means no accountable human was resolved: a pre-migration row, OR a NEW row whose audit source is not-yet-resolved / unattributed (e.g. run_only autopilot until rule_owner lands) — NOT pre-migration only.
|
|
AccountableUserID pgtype.UUID `json:"accountable_user_id"`
|
|
SessionRolloutMissing bool `json:"session_rollout_missing"`
|
|
RetiredSessionID pgtype.Text `json:"retired_session_id"`
|
|
}
|
|
|
|
type AgentToLabel struct {
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
LabelID pgtype.UUID `json:"label_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Attachment struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
CommentID pgtype.UUID `json:"comment_id"`
|
|
UploaderType string `json:"uploader_type"`
|
|
UploaderID pgtype.UUID `json:"uploader_id"`
|
|
Filename string `json:"filename"`
|
|
Url string `json:"url"`
|
|
ContentType string `json:"content_type"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
ChatMessageID pgtype.UUID `json:"chat_message_id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
}
|
|
|
|
type Autopilot struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Title string `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
Status string `json:"status"`
|
|
ExecutionMode string `json:"execution_mode"`
|
|
IssueTitleTemplate pgtype.Text `json:"issue_title_template"`
|
|
CreatedByType string `json:"created_by_type"`
|
|
CreatedByID pgtype.UUID `json:"created_by_id"`
|
|
LastRunAt pgtype.Timestamptz `json:"last_run_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
AssigneeType string `json:"assignee_type"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
}
|
|
|
|
type AutopilotCollaborator struct {
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
UserType string `json:"user_type"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
GrantedBy pgtype.UUID `json:"granted_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
// Append-only snapshot of autopilot rule publishes (MUL-4302 §3.4). One row per substantive publish (create / enable / resume / trigger-condition / target / instructions change), recording the publisher + effective-config summary. Dispatch resolves the latest row for an autopilot as the run's rule_owner accountable human. No FK, no cascade.
|
|
type AutopilotRuleVersion struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
PublishedByType string `json:"published_by_type"`
|
|
PublishedByID pgtype.UUID `json:"published_by_id"`
|
|
ConfigSummary []byte `json:"config_summary"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type AutopilotRun struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
TriggerID pgtype.UUID `json:"trigger_id"`
|
|
Source string `json:"source"`
|
|
Status string `json:"status"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
TriggeredAt pgtype.Timestamptz `json:"triggered_at"`
|
|
CompletedAt pgtype.Timestamptz `json:"completed_at"`
|
|
FailureReason pgtype.Text `json:"failure_reason"`
|
|
TriggerPayload []byte `json:"trigger_payload"`
|
|
Result []byte `json:"result"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
SquadID pgtype.UUID `json:"squad_id"`
|
|
PlannedAt pgtype.Timestamptz `json:"planned_at"`
|
|
WebhookDeliveryID pgtype.UUID `json:"webhook_delivery_id"`
|
|
}
|
|
|
|
type AutopilotSubscriber struct {
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
UserType string `json:"user_type"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type AutopilotTrigger struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
Kind string `json:"kind"`
|
|
Enabled bool `json:"enabled"`
|
|
CronExpression pgtype.Text `json:"cron_expression"`
|
|
Timezone pgtype.Text `json:"timezone"`
|
|
NextRunAt pgtype.Timestamptz `json:"next_run_at"`
|
|
WebhookToken pgtype.Text `json:"webhook_token"`
|
|
Label pgtype.Text `json:"label"`
|
|
LastFiredAt pgtype.Timestamptz `json:"last_fired_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Provider string `json:"provider"`
|
|
SigningSecret pgtype.Text `json:"signing_secret"`
|
|
EventFilters []byte `json:"event_filters"`
|
|
// Actor type of the trigger's current responsible publisher: member | agent. Set to the creator at creation and re-stamped to the editor on any substantive edit governing this trigger. Consumed only for attribution (source=trigger_owner) — never authorization. NULL on pre-migration triggers (MUL-4302).
|
|
PublishedByType pgtype.Text `json:"published_by_type"`
|
|
// The member/agent currently responsible for this trigger's effective config (creator, then last substantive editor). For a member this is the accountable human of runs the trigger fires (source=trigger_owner). No FK, app-layer integrity. NULL on pre-migration triggers, which degrade to rule_owner (MUL-4302).
|
|
PublishedByID pgtype.UUID `json:"published_by_id"`
|
|
}
|
|
|
|
type ChannelBindingToken struct {
|
|
TokenHash string `json:"token_hash"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
ChannelUserID string `json:"channel_user_id"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
ConsumedAt pgtype.Timestamptz `json:"consumed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChannelChatSessionBinding struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
ChannelChatID string `json:"channel_chat_id"`
|
|
ChatType string `json:"chat_type"`
|
|
LastMessageID pgtype.Text `json:"last_message_id"`
|
|
LastThreadID pgtype.Text `json:"last_thread_id"`
|
|
Config []byte `json:"config"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChannelInboundAudit struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
ChannelChatID pgtype.Text `json:"channel_chat_id"`
|
|
EventType string `json:"event_type"`
|
|
ChannelEventID pgtype.Text `json:"channel_event_id"`
|
|
ChannelMessageID pgtype.Text `json:"channel_message_id"`
|
|
DropReason string `json:"drop_reason"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
}
|
|
|
|
type ChannelInboundMessageDedup struct {
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
MessageID string `json:"message_id"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
ProcessedAt pgtype.Timestamptz `json:"processed_at"`
|
|
ClaimToken pgtype.UUID `json:"claim_token"`
|
|
}
|
|
|
|
type ChannelInstallation struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
Config []byte `json:"config"`
|
|
Status string `json:"status"`
|
|
WsLeaseToken pgtype.Text `json:"ws_lease_token"`
|
|
WsLeaseExpiresAt pgtype.Timestamptz `json:"ws_lease_expires_at"`
|
|
InstallerUserID pgtype.UUID `json:"installer_user_id"`
|
|
InstalledAt pgtype.Timestamptz `json:"installed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type ChannelMediaPendingObject struct {
|
|
StorageKey string `json:"storage_key"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ChatMessageID pgtype.UUID `json:"chat_message_id"`
|
|
StorageUrl string `json:"storage_url"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
State string `json:"state"`
|
|
LeaseToken pgtype.UUID `json:"lease_token"`
|
|
LeaseExpiresAt pgtype.Timestamptz `json:"lease_expires_at"`
|
|
Attempt int32 `json:"attempt"`
|
|
NextAttemptAt pgtype.Timestamptz `json:"next_attempt_at"`
|
|
LastError pgtype.Text `json:"last_error"`
|
|
TombstonePass int32 `json:"tombstone_pass"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChannelOutboundCardMessage struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
ChannelChatID string `json:"channel_chat_id"`
|
|
ChannelCardMessageID string `json:"channel_card_message_id"`
|
|
Status string `json:"status"`
|
|
LastPatchedAt pgtype.Timestamptz `json:"last_patched_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChannelUserBinding struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
MulticaUserID pgtype.UUID `json:"multica_user_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
ChannelType string `json:"channel_type"`
|
|
ChannelUserID string `json:"channel_user_id"`
|
|
Config []byte `json:"config"`
|
|
BoundAt pgtype.Timestamptz `json:"bound_at"`
|
|
}
|
|
|
|
type ChatDraftRestore struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
Content string `json:"content"`
|
|
AttachmentIds []pgtype.UUID `json:"attachment_ids"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChatMessage struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
Role string `json:"role"`
|
|
Content string `json:"content"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
FailureReason pgtype.Text `json:"failure_reason"`
|
|
ElapsedMs pgtype.Int8 `json:"elapsed_ms"`
|
|
MessageKind string `json:"message_kind"`
|
|
ChannelMediaPendingUntil pgtype.Timestamptz `json:"channel_media_pending_until"`
|
|
ChannelIngested bool `json:"channel_ingested"`
|
|
}
|
|
|
|
type ChatPinnedAgent struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
Position float64 `json:"position"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ChatSession struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
CreatorID pgtype.UUID `json:"creator_id"`
|
|
Title string `json:"title"`
|
|
SessionID pgtype.Text `json:"session_id"`
|
|
WorkDir pgtype.Text `json:"work_dir"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
UnreadSince pgtype.Timestamptz `json:"unread_since"`
|
|
RuntimeID pgtype.UUID `json:"runtime_id"`
|
|
LastReadAt pgtype.Timestamptz `json:"last_read_at"`
|
|
IsAgentIntro bool `json:"is_agent_intro"`
|
|
PinnedAt pgtype.Timestamptz `json:"pinned_at"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
}
|
|
|
|
type ClientUsageDaily struct {
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
ClientType string `json:"client_type"`
|
|
InstallID pgtype.UUID `json:"install_id"`
|
|
ActivityDate pgtype.Date `json:"activity_date"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ClientVersion string `json:"client_version"`
|
|
Os string `json:"os"`
|
|
FirstActiveAt pgtype.Timestamptz `json:"first_active_at"`
|
|
LastActiveAt pgtype.Timestamptz `json:"last_active_at"`
|
|
RuntimeProbedAt pgtype.Timestamptz `json:"runtime_probed_at"`
|
|
ProbeResult pgtype.Text `json:"probe_result"`
|
|
RuntimeCount pgtype.Int4 `json:"runtime_count"`
|
|
ProviderSummary []byte `json:"provider_summary"`
|
|
OnlineCount pgtype.Int4 `json:"online_count"`
|
|
OfflineCount pgtype.Int4 `json:"offline_count"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type Comment struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
AuthorType string `json:"author_type"`
|
|
AuthorID pgtype.UUID `json:"author_id"`
|
|
Content string `json:"content"`
|
|
Type string `json:"type"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
ParentID pgtype.UUID `json:"parent_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ResolvedAt pgtype.Timestamptz `json:"resolved_at"`
|
|
ResolvedByType pgtype.Text `json:"resolved_by_type"`
|
|
ResolvedByID pgtype.UUID `json:"resolved_by_id"`
|
|
SourceTaskID pgtype.UUID `json:"source_task_id"`
|
|
}
|
|
|
|
type CommentReaction struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
CommentID pgtype.UUID `json:"comment_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ActorType string `json:"actor_type"`
|
|
ActorID pgtype.UUID `json:"actor_id"`
|
|
Emoji string `json:"emoji"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type ContactSalesInquiry struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
BusinessEmail string `json:"business_email"`
|
|
CompanyName string `json:"company_name"`
|
|
CompanySize string `json:"company_size"`
|
|
CountryRegion string `json:"country_region"`
|
|
UseCase string `json:"use_case"`
|
|
Goals string `json:"goals"`
|
|
ConsentOutreach bool `json:"consent_outreach"`
|
|
ConsentUpdates bool `json:"consent_updates"`
|
|
SubmitterIp *netip.Addr `json:"submitter_ip"`
|
|
UserAgent string `json:"user_agent"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type DaemonConnection struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
DaemonID string `json:"daemon_id"`
|
|
Status string `json:"status"`
|
|
LastHeartbeatAt pgtype.Timestamptz `json:"last_heartbeat_at"`
|
|
RuntimeInfo []byte `json:"runtime_info"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type DaemonToken struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
TokenHash string `json:"token_hash"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
DaemonID string `json:"daemon_id"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Feedback struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Message string `json:"message"`
|
|
Metadata []byte `json:"metadata"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type GithubInstallation struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InstallationID int64 `json:"installation_id"`
|
|
AccountLogin string `json:"account_login"`
|
|
AccountType string `json:"account_type"`
|
|
AccountAvatarUrl pgtype.Text `json:"account_avatar_url"`
|
|
ConnectedByID pgtype.UUID `json:"connected_by_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type GithubPendingCheckSuite struct {
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InstallationID int64 `json:"installation_id"`
|
|
RepoOwner string `json:"repo_owner"`
|
|
RepoName string `json:"repo_name"`
|
|
PrNumber int32 `json:"pr_number"`
|
|
SuiteID int64 `json:"suite_id"`
|
|
HeadSha string `json:"head_sha"`
|
|
AppID int64 `json:"app_id"`
|
|
Conclusion pgtype.Text `json:"conclusion"`
|
|
Status string `json:"status"`
|
|
SuiteUpdatedAt pgtype.Timestamptz `json:"suite_updated_at"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
}
|
|
|
|
type GithubPendingInstallation struct {
|
|
InstallationID int64 `json:"installation_id"`
|
|
AccountLogin string `json:"account_login"`
|
|
AccountType string `json:"account_type"`
|
|
AccountAvatarUrl pgtype.Text `json:"account_avatar_url"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type GithubPullRequest struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InstallationID int64 `json:"installation_id"`
|
|
RepoOwner string `json:"repo_owner"`
|
|
RepoName string `json:"repo_name"`
|
|
PrNumber int32 `json:"pr_number"`
|
|
Title string `json:"title"`
|
|
State string `json:"state"`
|
|
HtmlUrl string `json:"html_url"`
|
|
Branch pgtype.Text `json:"branch"`
|
|
AuthorLogin pgtype.Text `json:"author_login"`
|
|
AuthorAvatarUrl pgtype.Text `json:"author_avatar_url"`
|
|
MergedAt pgtype.Timestamptz `json:"merged_at"`
|
|
ClosedAt pgtype.Timestamptz `json:"closed_at"`
|
|
PrCreatedAt pgtype.Timestamptz `json:"pr_created_at"`
|
|
PrUpdatedAt pgtype.Timestamptz `json:"pr_updated_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
HeadSha string `json:"head_sha"`
|
|
MergeableState pgtype.Text `json:"mergeable_state"`
|
|
Additions int32 `json:"additions"`
|
|
Deletions int32 `json:"deletions"`
|
|
ChangedFiles int32 `json:"changed_files"`
|
|
ApiMergeable pgtype.Text `json:"api_mergeable"`
|
|
ApiMergeStateStatus pgtype.Text `json:"api_merge_state_status"`
|
|
ChecksRollupState pgtype.Text `json:"checks_rollup_state"`
|
|
SnapshotHeadSha string `json:"snapshot_head_sha"`
|
|
SnapshotFetchedAt pgtype.Timestamptz `json:"snapshot_fetched_at"`
|
|
}
|
|
|
|
type GithubPullRequestCheckRun struct {
|
|
PrID pgtype.UUID `json:"pr_id"`
|
|
HeadSha string `json:"head_sha"`
|
|
Ordinal int32 `json:"ordinal"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
Conclusion pgtype.Text `json:"conclusion"`
|
|
DetailsUrl pgtype.Text `json:"details_url"`
|
|
IsStatusContext bool `json:"is_status_context"`
|
|
}
|
|
|
|
type GithubPullRequestCheckSuite struct {
|
|
PrID pgtype.UUID `json:"pr_id"`
|
|
SuiteID int64 `json:"suite_id"`
|
|
HeadSha string `json:"head_sha"`
|
|
AppID int64 `json:"app_id"`
|
|
Conclusion pgtype.Text `json:"conclusion"`
|
|
Status string `json:"status"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type InboxItem struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
RecipientType string `json:"recipient_type"`
|
|
RecipientID pgtype.UUID `json:"recipient_id"`
|
|
Type string `json:"type"`
|
|
Severity string `json:"severity"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
Title string `json:"title"`
|
|
Body pgtype.Text `json:"body"`
|
|
Read bool `json:"read"`
|
|
Archived bool `json:"archived"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
ActorType pgtype.Text `json:"actor_type"`
|
|
ActorID pgtype.UUID `json:"actor_id"`
|
|
Details []byte `json:"details"`
|
|
}
|
|
|
|
type Issue struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Title string `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
Status string `json:"status"`
|
|
Priority string `json:"priority"`
|
|
AssigneeType pgtype.Text `json:"assignee_type"`
|
|
AssigneeID pgtype.UUID `json:"assignee_id"`
|
|
CreatorType string `json:"creator_type"`
|
|
CreatorID pgtype.UUID `json:"creator_id"`
|
|
ParentIssueID pgtype.UUID `json:"parent_issue_id"`
|
|
AcceptanceCriteria []byte `json:"acceptance_criteria"`
|
|
ContextRefs []byte `json:"context_refs"`
|
|
Position float64 `json:"position"`
|
|
DueDate pgtype.Date `json:"due_date"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Number int32 `json:"number"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
OriginType pgtype.Text `json:"origin_type"`
|
|
OriginID pgtype.UUID `json:"origin_id"`
|
|
FirstExecutedAt pgtype.Timestamptz `json:"first_executed_at"`
|
|
StartDate pgtype.Date `json:"start_date"`
|
|
Metadata []byte `json:"metadata"`
|
|
Stage pgtype.Int4 `json:"stage"`
|
|
Properties []byte `json:"properties"`
|
|
}
|
|
|
|
type IssueDependency struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
DependsOnIssueID pgtype.UUID `json:"depends_on_issue_id"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
type IssueLabel struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Name string `json:"name"`
|
|
Color string `json:"color"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
ResourceType string `json:"resource_type"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
type IssueProperty struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Name string `json:"name"`
|
|
Type string `json:"type"`
|
|
Description string `json:"description"`
|
|
Config []byte `json:"config"`
|
|
Position float64 `json:"position"`
|
|
ArchivedAt pgtype.Timestamptz `json:"archived_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Icon string `json:"icon"`
|
|
}
|
|
|
|
type IssuePullRequest struct {
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
PullRequestID pgtype.UUID `json:"pull_request_id"`
|
|
LinkedByType pgtype.Text `json:"linked_by_type"`
|
|
LinkedByID pgtype.UUID `json:"linked_by_id"`
|
|
LinkedAt pgtype.Timestamptz `json:"linked_at"`
|
|
CloseIntent bool `json:"close_intent"`
|
|
ReferenceOnly bool `json:"reference_only"`
|
|
}
|
|
|
|
type IssueReaction struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ActorType string `json:"actor_type"`
|
|
ActorID pgtype.UUID `json:"actor_id"`
|
|
Emoji string `json:"emoji"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type IssueSubscriber struct {
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
UserType string `json:"user_type"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
Reason string `json:"reason"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type IssueToLabel struct {
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
LabelID pgtype.UUID `json:"label_id"`
|
|
}
|
|
|
|
type IssueVcsPullRequest struct {
|
|
IssueID pgtype.UUID `json:"issue_id"`
|
|
PullRequestID pgtype.UUID `json:"pull_request_id"`
|
|
CloseIntent bool `json:"close_intent"`
|
|
ReferenceOnly bool `json:"reference_only"`
|
|
LinkedByType pgtype.Text `json:"linked_by_type"`
|
|
LinkedByID pgtype.UUID `json:"linked_by_id"`
|
|
LinkedAt pgtype.Timestamptz `json:"linked_at"`
|
|
}
|
|
|
|
type LarkBindingToken struct {
|
|
TokenHash string `json:"token_hash"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
LarkOpenID string `json:"lark_open_id"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
ConsumedAt pgtype.Timestamptz `json:"consumed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type LarkChatSessionBinding struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
LarkChatID string `json:"lark_chat_id"`
|
|
LarkChatType string `json:"lark_chat_type"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
LastLarkMessageID pgtype.Text `json:"last_lark_message_id"`
|
|
LastLarkThreadID pgtype.Text `json:"last_lark_thread_id"`
|
|
}
|
|
|
|
type LarkInboundAudit struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
LarkChatID pgtype.Text `json:"lark_chat_id"`
|
|
EventType string `json:"event_type"`
|
|
LarkEventID pgtype.Text `json:"lark_event_id"`
|
|
LarkMessageID pgtype.Text `json:"lark_message_id"`
|
|
DropReason string `json:"drop_reason"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
}
|
|
|
|
type LarkInboundMessageDedup struct {
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
MessageID string `json:"message_id"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
ProcessedAt pgtype.Timestamptz `json:"processed_at"`
|
|
ClaimToken pgtype.UUID `json:"claim_token"`
|
|
}
|
|
|
|
type LarkInstallation struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
AppID string `json:"app_id"`
|
|
AppSecretEncrypted []byte `json:"app_secret_encrypted"`
|
|
TenantKey pgtype.Text `json:"tenant_key"`
|
|
BotOpenID string `json:"bot_open_id"`
|
|
InstallerUserID pgtype.UUID `json:"installer_user_id"`
|
|
Status string `json:"status"`
|
|
WsLeaseToken pgtype.Text `json:"ws_lease_token"`
|
|
WsLeaseExpiresAt pgtype.Timestamptz `json:"ws_lease_expires_at"`
|
|
InstalledAt pgtype.Timestamptz `json:"installed_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
BotUnionID pgtype.Text `json:"bot_union_id"`
|
|
Region string `json:"region"`
|
|
}
|
|
|
|
type LarkOutboundCardMessage struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ChatSessionID pgtype.UUID `json:"chat_session_id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
LarkChatID string `json:"lark_chat_id"`
|
|
LarkCardMessageID string `json:"lark_card_message_id"`
|
|
Status string `json:"status"`
|
|
LastPatchedAt pgtype.Timestamptz `json:"last_patched_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type LarkUserBinding struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
MulticaUserID pgtype.UUID `json:"multica_user_id"`
|
|
InstallationID pgtype.UUID `json:"installation_id"`
|
|
LarkOpenID string `json:"lark_open_id"`
|
|
UnionID pgtype.Text `json:"union_id"`
|
|
BoundAt pgtype.Timestamptz `json:"bound_at"`
|
|
}
|
|
|
|
type Member struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
Role string `json:"role"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type NotificationPreference struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
Preferences []byte `json:"preferences"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type PersonalAccessToken struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
Name string `json:"name"`
|
|
TokenHash string `json:"token_hash"`
|
|
TokenPrefix string `json:"token_prefix"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
|
|
Revoked bool `json:"revoked"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type PinnedItem struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
ItemType string `json:"item_type"`
|
|
ItemID pgtype.UUID `json:"item_id"`
|
|
Position float64 `json:"position"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Project struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Title string `json:"title"`
|
|
Description pgtype.Text `json:"description"`
|
|
Icon pgtype.Text `json:"icon"`
|
|
Status string `json:"status"`
|
|
LeadType pgtype.Text `json:"lead_type"`
|
|
LeadID pgtype.UUID `json:"lead_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Priority string `json:"priority"`
|
|
StartDate pgtype.Date `json:"start_date"`
|
|
DueDate pgtype.Date `json:"due_date"`
|
|
}
|
|
|
|
type ProjectResource struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ResourceType string `json:"resource_type"`
|
|
ResourceRef []byte `json:"resource_ref"`
|
|
Label pgtype.Text `json:"label"`
|
|
Position int32 `json:"position"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
CreatedBy pgtype.UUID `json:"created_by"`
|
|
}
|
|
|
|
type RuntimeProfile struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
DisplayName string `json:"display_name"`
|
|
ProtocolFamily string `json:"protocol_family"`
|
|
CommandName string `json:"command_name"`
|
|
Description pgtype.Text `json:"description"`
|
|
FixedArgs []byte `json:"fixed_args"`
|
|
Visibility string `json:"visibility"`
|
|
CreatedBy pgtype.UUID `json:"created_by"`
|
|
Enabled bool `json:"enabled"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type Skill struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Content string `json:"content"`
|
|
Config []byte `json:"config"`
|
|
CreatedBy pgtype.UUID `json:"created_by"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type SkillFile struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
SkillID pgtype.UUID `json:"skill_id"`
|
|
Path string `json:"path"`
|
|
Content string `json:"content"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type SkillToLabel struct {
|
|
SkillID pgtype.UUID `json:"skill_id"`
|
|
LabelID pgtype.UUID `json:"label_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Squad struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
LeaderID pgtype.UUID `json:"leader_id"`
|
|
CreatorID pgtype.UUID `json:"creator_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
ArchivedAt pgtype.Timestamptz `json:"archived_at"`
|
|
ArchivedBy pgtype.UUID `json:"archived_by"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
Instructions string `json:"instructions"`
|
|
}
|
|
|
|
type SquadMember struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
SquadID pgtype.UUID `json:"squad_id"`
|
|
MemberType string `json:"member_type"`
|
|
MemberID pgtype.UUID `json:"member_id"`
|
|
Role string `json:"role"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type SysCronExecution struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
JobName string `json:"job_name"`
|
|
ScopeKind string `json:"scope_kind"`
|
|
ScopeID string `json:"scope_id"`
|
|
PlanTime pgtype.Timestamptz `json:"plan_time"`
|
|
Status string `json:"status"`
|
|
Attempt int32 `json:"attempt"`
|
|
MaxAttempts int32 `json:"max_attempts"`
|
|
NextRetryAt pgtype.Timestamptz `json:"next_retry_at"`
|
|
RunnerID pgtype.Text `json:"runner_id"`
|
|
LeaseToken pgtype.UUID `json:"lease_token"`
|
|
HeartbeatAt pgtype.Timestamptz `json:"heartbeat_at"`
|
|
StaleAfter pgtype.Timestamptz `json:"stale_after"`
|
|
StartedAt pgtype.Timestamptz `json:"started_at"`
|
|
FinishedAt pgtype.Timestamptz `json:"finished_at"`
|
|
DurationMs pgtype.Int4 `json:"duration_ms"`
|
|
RowsAffected pgtype.Int8 `json:"rows_affected"`
|
|
Result []byte `json:"result"`
|
|
ErrorCode pgtype.Text `json:"error_code"`
|
|
ErrorMsg pgtype.Text `json:"error_msg"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type TaskMessage struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
Seq int32 `json:"seq"`
|
|
Type string `json:"type"`
|
|
Tool pgtype.Text `json:"tool"`
|
|
Content pgtype.Text `json:"content"`
|
|
Input []byte `json:"input"`
|
|
Output pgtype.Text `json:"output"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type TaskToken struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
TokenHash string `json:"token_hash"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type TaskUsage struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
TaskID pgtype.UUID `json:"task_id"`
|
|
Provider string `json:"provider"`
|
|
Model string `json:"model"`
|
|
InputTokens int64 `json:"input_tokens"`
|
|
OutputTokens int64 `json:"output_tokens"`
|
|
CacheReadTokens int64 `json:"cache_read_tokens"`
|
|
CacheWriteTokens int64 `json:"cache_write_tokens"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
// Provider-reported cost in 1e-10 USD. NULL when the provider reports none; those rows are priced client-side from the static rate table.
|
|
CostUsdTicks pgtype.Int8 `json:"cost_usd_ticks"`
|
|
}
|
|
|
|
type TaskUsageHourly struct {
|
|
BucketHour pgtype.Timestamptz `json:"bucket_hour"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
RuntimeID pgtype.UUID `json:"runtime_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
Provider string `json:"provider"`
|
|
Model string `json:"model"`
|
|
InputTokens int64 `json:"input_tokens"`
|
|
OutputTokens int64 `json:"output_tokens"`
|
|
CacheReadTokens int64 `json:"cache_read_tokens"`
|
|
CacheWriteTokens int64 `json:"cache_write_tokens"`
|
|
TaskCount int64 `json:"task_count"`
|
|
EventCount int64 `json:"event_count"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
// Sum of provider-reported cost (1e-10 USD) over the rows in this bucket that had one; 0 when none did.
|
|
CostUsdTicks int64 `json:"cost_usd_ticks"`
|
|
// Input tokens from rows with no provider-reported cost — the portion still priced from the static rate table. NULL on buckets not yet recomputed since this column existed; readers COALESCE to input_tokens.
|
|
UncostedInputTokens pgtype.Int8 `json:"uncosted_input_tokens"`
|
|
UncostedOutputTokens pgtype.Int8 `json:"uncosted_output_tokens"`
|
|
UncostedCacheReadTokens pgtype.Int8 `json:"uncosted_cache_read_tokens"`
|
|
UncostedCacheWriteTokens pgtype.Int8 `json:"uncosted_cache_write_tokens"`
|
|
}
|
|
|
|
type TaskUsageHourlyDirty struct {
|
|
BucketHour pgtype.Timestamptz `json:"bucket_hour"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
RuntimeID pgtype.UUID `json:"runtime_id"`
|
|
AgentID pgtype.UUID `json:"agent_id"`
|
|
ProjectID pgtype.UUID `json:"project_id"`
|
|
Provider string `json:"provider"`
|
|
Model string `json:"model"`
|
|
EnqueuedAt pgtype.Timestamptz `json:"enqueued_at"`
|
|
}
|
|
|
|
type TaskUsageHourlyRollupState struct {
|
|
ID int16 `json:"id"`
|
|
WatermarkAt pgtype.Timestamptz `json:"watermark_at"`
|
|
LastRunStartedAt pgtype.Timestamptz `json:"last_run_started_at"`
|
|
LastRunFinishedAt pgtype.Timestamptz `json:"last_run_finished_at"`
|
|
LastRunRows int64 `json:"last_run_rows"`
|
|
LastError pgtype.Text `json:"last_error"`
|
|
}
|
|
|
|
type User struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
Email string `json:"email"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
OnboardedAt pgtype.Timestamptz `json:"onboarded_at"`
|
|
OnboardingQuestionnaire []byte `json:"onboarding_questionnaire"`
|
|
CloudWaitlistEmail pgtype.Text `json:"cloud_waitlist_email"`
|
|
CloudWaitlistReason pgtype.Text `json:"cloud_waitlist_reason"`
|
|
StarterContentState pgtype.Text `json:"starter_content_state"`
|
|
Language pgtype.Text `json:"language"`
|
|
ProfileDescription string `json:"profile_description"`
|
|
// User-preferred IANA timezone for report rendering (Viewing tz). NULL means "use the browser-detected tz at render time". Affects dashboards, charts, and any "today" label shown to this user. Does not affect data materialisation — all rollups remain in UTC.
|
|
Timezone pgtype.Text `json:"timezone"`
|
|
}
|
|
|
|
type UserComposioConnection struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
ToolkitSlug string `json:"toolkit_slug"`
|
|
AuthConfigID string `json:"auth_config_id"`
|
|
ConnectedAccountID string `json:"connected_account_id"`
|
|
ComposioUserID string `json:"composio_user_id"`
|
|
Status string `json:"status"`
|
|
ConnectedAt pgtype.Timestamptz `json:"connected_at"`
|
|
LastUsedAt pgtype.Timestamptz `json:"last_used_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type VcsCommitStatus struct {
|
|
ConnectionID pgtype.UUID `json:"connection_id"`
|
|
Sha string `json:"sha"`
|
|
Context string `json:"context"`
|
|
State string `json:"state"`
|
|
TargetUrl pgtype.Text `json:"target_url"`
|
|
Description pgtype.Text `json:"description"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type VcsConnection struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
Provider string `json:"provider"`
|
|
InstanceUrl string `json:"instance_url"`
|
|
AccountLogin string `json:"account_login"`
|
|
AccessTokenEncrypted string `json:"access_token_encrypted"`
|
|
WebhookSecretEncrypted string `json:"webhook_secret_encrypted"`
|
|
ConnectedByID pgtype.UUID `json:"connected_by_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type VcsPullRequest struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
ConnectionID pgtype.UUID `json:"connection_id"`
|
|
Provider string `json:"provider"`
|
|
RepoOwner string `json:"repo_owner"`
|
|
RepoName string `json:"repo_name"`
|
|
PrNumber int32 `json:"pr_number"`
|
|
Title string `json:"title"`
|
|
State string `json:"state"`
|
|
HtmlUrl string `json:"html_url"`
|
|
Branch pgtype.Text `json:"branch"`
|
|
HeadSha string `json:"head_sha"`
|
|
AuthorLogin pgtype.Text `json:"author_login"`
|
|
AuthorAvatarUrl pgtype.Text `json:"author_avatar_url"`
|
|
MergedAt pgtype.Timestamptz `json:"merged_at"`
|
|
ClosedAt pgtype.Timestamptz `json:"closed_at"`
|
|
PrCreatedAt pgtype.Timestamptz `json:"pr_created_at"`
|
|
PrUpdatedAt pgtype.Timestamptz `json:"pr_updated_at"`
|
|
Additions int32 `json:"additions"`
|
|
Deletions int32 `json:"deletions"`
|
|
ChangedFiles int32 `json:"changed_files"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type VerificationCode struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Email string `json:"email"`
|
|
Code string `json:"code"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
Used bool `json:"used"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
Attempts int32 `json:"attempts"`
|
|
}
|
|
|
|
type WebhookDelivery struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
AutopilotID pgtype.UUID `json:"autopilot_id"`
|
|
TriggerID pgtype.UUID `json:"trigger_id"`
|
|
Provider string `json:"provider"`
|
|
Event string `json:"event"`
|
|
DedupeKey pgtype.Text `json:"dedupe_key"`
|
|
DedupeSource pgtype.Text `json:"dedupe_source"`
|
|
SignatureStatus string `json:"signature_status"`
|
|
Status string `json:"status"`
|
|
AttemptCount int32 `json:"attempt_count"`
|
|
SelectedHeaders []byte `json:"selected_headers"`
|
|
ContentType pgtype.Text `json:"content_type"`
|
|
RawBody []byte `json:"raw_body"`
|
|
ResponseStatus pgtype.Int4 `json:"response_status"`
|
|
ResponseBody pgtype.Text `json:"response_body"`
|
|
AutopilotRunID pgtype.UUID `json:"autopilot_run_id"`
|
|
ReplayedFromDeliveryID pgtype.UUID `json:"replayed_from_delivery_id"`
|
|
Error pgtype.Text `json:"error"`
|
|
ReceivedAt pgtype.Timestamptz `json:"received_at"`
|
|
LastAttemptAt pgtype.Timestamptz `json:"last_attempt_at"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
AvailableAt pgtype.Timestamptz `json:"available_at"`
|
|
LeaseToken pgtype.UUID `json:"lease_token"`
|
|
LeaseExpiresAt pgtype.Timestamptz `json:"lease_expires_at"`
|
|
DispatchAttempts int32 `json:"dispatch_attempts"`
|
|
}
|
|
|
|
type Workspace struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
Slug string `json:"slug"`
|
|
Description pgtype.Text `json:"description"`
|
|
Settings []byte `json:"settings"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Context pgtype.Text `json:"context"`
|
|
Repos []byte `json:"repos"`
|
|
IssuePrefix string `json:"issue_prefix"`
|
|
IssueCounter int32 `json:"issue_counter"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
// When TRUE, an agent run that resolves to no precise accountable human (would be owner_fallback) is refused at enqueue instead of degrading to the agent owner (MUL-4302 §3.5). Default FALSE = owner_fallback. Never affects authorization (originator_user_id).
|
|
AttributionFailClosed bool `json:"attribution_fail_closed"`
|
|
}
|
|
|
|
type WorkspaceInvitation struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
WorkspaceID pgtype.UUID `json:"workspace_id"`
|
|
InviterID pgtype.UUID `json:"inviter_id"`
|
|
InviteeEmail string `json:"invitee_email"`
|
|
InviteeUserID pgtype.UUID `json:"invitee_user_id"`
|
|
Role string `json:"role"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
ExpiresAt pgtype.Timestamptz `json:"expires_at"`
|
|
}
|