mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 11:20:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People also ask agents for work in their existing chat tools. > - Each external conversation needs one task and a current authorized source. > - Retries, Stop, and provider failures must not duplicate work or expose private data. > - The first chat PR establishes the opt-in provider and data contracts. > - This PR adds experimental channel integration and its durable control plane. > - Users can request work from connected channels and inspect delivery in Paperclip. ## Linked Issues or Issue Description Refs #13100 and #13092. This is the second of exactly two chat PRs. Foundation #13100 is merged and changed 143 files. Runner prerequisite #13092 is also merged. This PR changes 400 files against master, below the 500-file review limit. It contains no wireframe images or HTML galleries. ## What Changed - Add native Slack, GitHub, Microsoft Teams, Telegram, and Discord chat connections. Keep chat disabled unless the operator enables experimental chat connectors. Preserve the production GitHub tool connection and its normal setup path. - Bind each provider bot identity to one immutable Paperclip agent. Bind each admitted external conversation to one task. Paperclip owns tasks, runs, permissions, and audit records. - Add durable admission, per-conversation queues, questions, task controls, progress, final replies, images, files, and delivery receipts. Board comments remain internal unless explicitly sent to the channel. - Check current identity, provider reach, resource access, credentials, runtime generation, and exact source before provider effects. Keep private responses private. Never send raw reasoning, private logs, credentials, or tool arguments. - Hold uncertain sends for explicit audited resolution. Make Board Send-to-channel atomic and idempotent. Keep reconnect and setup credentials in Paperclip secret storage. - Preserve current native-runner authority across retries, lost acknowledgements, and recovery. Keep immutable input and completion contracts separate from newer user input. Receipt reconciliation cannot launch a provider. - Reconcile chat close/new ordering and provider-effect lock order. Audit resource access changes in the same transaction. Submit only the selected resource from each UI toggle so stale pages cannot undo unrelated access changes. - Drain Codex stdout before certifying process exit. Bound the drain with the existing shutdown grace. Preserve observed terminal authority without treating an undrained process as successful or reusable. - Incorporate master `018ca5da` with its ACP Stop, mobile task layout, runner packaging, and official lock changes. Preserve dedicated chat-answer continuations in both directions when ordinary queued comments are adopted after Stop. - Fence late adapter readiness behind an earlier Stop for the same run. Preserve verified cleanup for registered adapters. Handle single Stop, agent pause, duplicate Stops, and failure release without creating a false cancellation receipt. - Incorporate master's `6dd48cad4` wake-queue extraction. Preserve exact failed-chat retry authorization and lineage, retired question-source suppression, and the block on generic recovery that would discard the admitted source. Fresh deferred input retains its separate promotion path. - Incorporate master `2a05b5ed3` and its queue-admission extraction, simplified transaction ports, and separate runner CI job. Preserve exact durable receipts, actor separation, and dedicated-answer isolation through the new module. A failed receipt insert rolls back the accompanying deferred-wake merge. ## Verification Current head: `afe19299d06253cb628eb398e91d1200ea9f412a`, incorporating master `2a05b5ed3457ea33efd6895520447d1d97fe98d8`. The conflicts are resolved. This successor fixes two test-harness boundaries exposed by CI: per-case route-module preparation and actual durable-save completion before intentional runner termination. Production code and all existing test/turn deadlines are unchanged. [Exact-head Greptile review](https://github.com/paperclipai/paperclip/pull/13038#issuecomment-5587250594) is **5/5**, completed September 10 at 13:20:55 UTC, with no actionable findings or open review threads. [Fresh exact-head CI](https://github.com/paperclipai/paperclip/actions/runs/34481724341) passes **all 24 jobs**, including Build and both required aggregates. Normal exact-head guarded merge was attempted and rejected by the remaining branch approval policy: CODEOWNER review is required and no human approval is present. Normal **squash auto-merge is enabled** as of September 10 at 13:36:26 UTC. Requested CODEOWNERS have been notified; no approval bypass or self-approval was used. Earlier-head results below remain historical evidence, not qualification of this successor. - Final exact-head Linux evidence: 995/995 chat integration cases; 36/36 agent-skills routes; 35/35 runner live-session cases, including real process kill/resume; 1948 runner Vitest cases with three existing benchmark/platform guards; 870/870 API-authority cases; and 104 browser cases with four existing optional skips. Rust, conformance/replay, full repository build, typecheck, canary, all server/workspace shards, and both required aggregates pass with normal CI concurrency. Earlier failed attempts remain recorded below. - Latest test-only qualification: 141/141 route/permissions/authentication cases pass in separate cold forks, with plain server types and independent review clear. The real-runner suite passes 35/35, with plain runner types and independent review clear. A controlled premature-save acknowledgement fails as expected; matching ownership/effect/process evidence, rejected saves, real turn outcome, test abort, and pre-kill liveness are covered. No local reproduction of the original CI scheduling failure is claimed. The preceding [CI run](https://github.com/paperclipai/paperclip/actions/runs/34479680858) passes 21/24 jobs, including all 995 Linux chat cases and browser aggregate (104 passed, four existing optional skips); only Build, the skills serialized shard, and the required verification aggregate fail. Its exact-head Greptile review was 5/5. Both failed job logs are retained. - Final fixture qualification: all eight focused Discord cases and all 995 chat integration cases pass. The exact modal statement/PID is observed before taking the real connection lock; the test then proves its actual blocking relationship before mutation. Original SQL execution, provider behavior, negative assertions, and 1s/15s timeouts remain unchanged. Independent review is clear and test/production hashes remain frozen. The preceding [CI attempt](https://github.com/paperclipai/paperclip/actions/runs/34477184777) passed 22 jobs, including Build/runner, typecheck, canary, all other test shards, and browser aggregate (104 passed, four existing optional skips); the two fixture failures and failed verification aggregate remain recorded, not relabeled as a pass. - Current queue-module composition: 308/308 recovery/batching/queue/Stop tests; 995/995 full chat integration; 89/89 module tests, including real PostgreSQL receipt-insert rollback; 24/24 workflow/module-boundary tests; plain server and UI types. All four actual local process/ACP browser paths pass in 1.4 minutes. Fresh databases, no skips or retries, stable reviewed source hashes. The initial boundary failure is retained; its no-op service wrapper was removed without changing recovery context or weakening the check. An exploratory standalone test-directory typecheck fails because its new upstream transformation config is not a standalone typechecking project; standard CI/build does not invoke it, and no configuration was weakened to suppress those diagnostics. - The preceding head `e02a63d462ce5d47433b0aeb632bb6fd20aab1ba` passed [all 24 CI jobs](https://github.com/paperclipai/paperclip/actions/runs/34436462958) and exact-head Greptile review at 5/5. Required CODEOWNER review prevented its normal merge before master advanced again. - Final extracted-module composition: 307/307 recovery, batching, queue and Stop-control tests; 995/995 full chat integration; 49/49 module tests including eight PostgreSQL adapter cases; and 19/19 issue-update tests. Plain server types pass. All four actual local process/ACP browser paths pass in 1.3 minutes. Fresh databases, no skips or retries in these cohorts, frozen source hashes, and independent review clear. - The preceding head `3e4e1c1c` passes [all PR CI jobs](https://github.com/paperclipai/paperclip/actions/runs/34415826820), including Build and required `ci / verify` and `ci / e2e`. Both the original Rust failure and the previously load-sensitive lineage fixture pass with unchanged Linux concurrency. Master advanced afterward and required this reconciliation. - Final master composition: 448/448 focused UI tests, 186/186 adapter tests, 24/24 queue/control tests, and 11/11 packaging tests. Plain UI, server, shared, and adapter types pass. Token gates and diff checks pass. Independent server and UI reviews are clear. - Stop-registration regression: both real-service cases fail against exact `a95` source and pass with the fix. The full corrected recovery/control suite passes 265/265. Duplicate-owner and failed-Stop controls also pass. Plain server types pass. The readiness barrier prevents provider startup without adding an acknowledgment to an already terminal run. - Final qualification strengthens terminal-field equality and repeats both affected cases successfully on a fresh database. All four actual local process/ACP browser paths pass again in 1.3 minutes, without skips or retries. The final screenshot shows Cancelled, a paused subtree, retained input, and no error toast. - Two new actual-service regressions fail before the merge fix. They prove that queued-comment adoption could consume a dedicated chat answer or add unrelated input to that answer. The fixed four-case cohort passes, including ordinary upstream continuation and adapter Stop controls. Full recovery passes 257/257. All four actual local process/ACP Stop browser flows pass in 1.4 minutes, without skips or retries, on a fresh database. - The unchanged runner artifact was qualified with 171/171 transport tests, 870/870 API-authority tests, conformance 1/1, and replay 11/11. Six controlled reader tests prove the exit/drain repair. Its local serial Rust workspace passed 546 top-level cases plus two invoked helpers; the later passing Linux CI supplies default-concurrency evidence. - Prior exact-source full chat integration passes 995/995. Settings regressions cover concurrent stale pages, 501 destinations, pending state, rejected updates, and explicit retry. These deterministic tests do not prove live provider behavior. - Retained failed attempts and their causes are in the [qualification log](https://github.com/paperclipai/paperclip/blob/afe19299d06253cb628eb398e91d1200ea9f412a/doc/plans/chat-adapters/2026-09-08-chat-queue-and-webhook-repair.md). The first merge adapter run timed out while macOS slept for 290 seconds. Its unchanged repeat passed with a temporary sleep guard. No assertion, deadline, or CI gate was weakened. Review commands include `pnpm --filter @paperclipai/server exec vitest run src/__tests__/heartbeat-process-recovery.test.ts src/__tests__/issue-queued-comments-routes.test.ts` and `pnpm exec playwright test --config tests/e2e/playwright.config.ts tests/e2e/acp-stop-continuation.spec.ts`. Database suites require fresh disposable databases. See the [browser runbook](https://github.com/paperclipai/paperclip/blob/afe19299d06253cb628eb398e91d1200ea9f412a/doc/plans/chat-adapters/2026-09-04-chat-adapters-browser-e2e-runbook.md) for provider setup and separate live acceptance steps. ## Risks - This remains experimental. Deterministic tests and bounded live evidence do not establish every provider feature, tenant, permission layout, or media shape. Teams work-tenant qualification is still open. - Failed and uncertain provider effects remain visible and can require operator action. A transport receipt does not prove recipient visibility. - Native controller and runner artifacts must remain compatible. Preserve lease ownership, terminal authority, source binding, and quarantine during future changes. - Access and audit rows commit together, but activity notifications remain best-effort. This is not a new durable event outbox. - The PR operation does not deploy a live server, replace its runner, or change provider permissions. Remaining live qualification is documented in the [temporary handoff](https://github.com/paperclipai/paperclip/blob/afe19299d06253cb628eb398e91d1200ea9f412a/doc/plans/chat-adapters/2026-09-08-open-qualification-followups.md). ## Model Used OpenAI Codex assisted with implementation, tool execution, testing, and review. The work records `gpt-6-astra` assistance. The environment does not report a context-window size. No private reasoning traces are included. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
1731 lines
52 KiB
TypeScript
1731 lines
52 KiB
TypeScript
export const COMPANY_STATUSES = ["active", "paused", "archived"] as const;
|
|
export type CompanyStatus = (typeof COMPANY_STATUSES)[number];
|
|
|
|
export const DEPLOYMENT_MODES = ["local_trusted", "authenticated"] as const;
|
|
export type DeploymentMode = (typeof DEPLOYMENT_MODES)[number];
|
|
|
|
export const DEPLOYMENT_EXPOSURES = ["private", "public"] as const;
|
|
export type DeploymentExposure = (typeof DEPLOYMENT_EXPOSURES)[number];
|
|
|
|
export const BIND_MODES = ["loopback", "lan", "tailnet", "custom"] as const;
|
|
export type BindMode = (typeof BIND_MODES)[number];
|
|
|
|
export const AUTH_BASE_URL_MODES = ["auto", "explicit"] as const;
|
|
export type AuthBaseUrlMode = (typeof AUTH_BASE_URL_MODES)[number];
|
|
|
|
export const AGENT_STATUSES = [
|
|
"active",
|
|
"paused",
|
|
"idle",
|
|
"running",
|
|
"error",
|
|
"pending_approval",
|
|
"terminated",
|
|
] as const;
|
|
export type AgentStatus = (typeof AGENT_STATUSES)[number];
|
|
|
|
export const AGENT_ADAPTER_TYPES = [
|
|
"process",
|
|
"http",
|
|
"claude_local",
|
|
"codex_local",
|
|
"paperclip_runner",
|
|
"cursor_cloud",
|
|
"gemini_local",
|
|
"grok_local",
|
|
"hermes_gateway",
|
|
"hermes_local",
|
|
"kimi_local",
|
|
"opencode_local",
|
|
"pi_local",
|
|
"cursor",
|
|
"openclaw_gateway",
|
|
] as const;
|
|
export type AgentAdapterType = (typeof AGENT_ADAPTER_TYPES)[number] | (string & {});
|
|
|
|
export const AGENT_ROLES = [
|
|
"ceo",
|
|
"cto",
|
|
"cmo",
|
|
"cfo",
|
|
"security",
|
|
"engineer",
|
|
"designer",
|
|
"pm",
|
|
"qa",
|
|
"devops",
|
|
"researcher",
|
|
"general",
|
|
] as const;
|
|
export type AgentRole = (typeof AGENT_ROLES)[number];
|
|
|
|
export const AGENT_ROLE_LABELS: Record<AgentRole, string> = {
|
|
ceo: "CEO",
|
|
cto: "CTO",
|
|
cmo: "CMO",
|
|
cfo: "CFO",
|
|
security: "Security",
|
|
engineer: "Engineer",
|
|
designer: "Designer",
|
|
pm: "PM",
|
|
qa: "QA",
|
|
devops: "DevOps",
|
|
researcher: "Researcher",
|
|
general: "General",
|
|
};
|
|
|
|
export const AGENT_DEFAULT_MAX_CONCURRENT_RUNS = 20;
|
|
export const WORKSPACE_BRANCH_ROUTINE_VARIABLE = "workspaceBranch";
|
|
|
|
// Config keys owned by Paperclip/company state rather than one concrete adapter.
|
|
// `paperclipSkillSync` is persisted in adapterConfig but must survive adapter swaps.
|
|
export const ADAPTER_AGNOSTIC_KEYS = [
|
|
"env",
|
|
"promptTemplate",
|
|
"instructionsFilePath",
|
|
"cwd",
|
|
"timeoutSec",
|
|
"graceSec",
|
|
"bootstrapPromptTemplate",
|
|
"paperclipSkillSync",
|
|
] as const;
|
|
export type AdapterAgnosticKey = (typeof ADAPTER_AGNOSTIC_KEYS)[number];
|
|
|
|
export const AGENT_ICON_NAMES = [
|
|
"bot",
|
|
"cpu",
|
|
"brain",
|
|
"zap",
|
|
"rocket",
|
|
"code",
|
|
"terminal",
|
|
"shield",
|
|
"eye",
|
|
"search",
|
|
"wrench",
|
|
"hammer",
|
|
"lightbulb",
|
|
"sparkles",
|
|
"star",
|
|
"heart",
|
|
"flame",
|
|
"bug",
|
|
"cog",
|
|
"database",
|
|
"globe",
|
|
"lock",
|
|
"mail",
|
|
"message-square",
|
|
"file-code",
|
|
"git-branch",
|
|
"package",
|
|
"puzzle",
|
|
"target",
|
|
"wand",
|
|
"atom",
|
|
"circuit-board",
|
|
"radar",
|
|
"swords",
|
|
"telescope",
|
|
"microscope",
|
|
"crown",
|
|
"gem",
|
|
"hexagon",
|
|
"pentagon",
|
|
"fingerprint",
|
|
] as const;
|
|
export type AgentIconName = (typeof AGENT_ICON_NAMES)[number];
|
|
|
|
/**
|
|
* Curated Lucide icon set for projects (PAP-68 part 3).
|
|
*
|
|
* The first entry, `"folder"`, is the default for any project without an
|
|
* explicit icon. The remaining entries reuse much of the agent icon set plus a
|
|
* handful of folder/structure icons that read well at small tile sizes.
|
|
*/
|
|
export const PROJECT_ICON_NAMES = [
|
|
"folder",
|
|
"rocket",
|
|
"code",
|
|
"terminal",
|
|
"database",
|
|
"globe",
|
|
"package",
|
|
"boxes",
|
|
"box",
|
|
"layers",
|
|
"briefcase",
|
|
"compass",
|
|
"target",
|
|
"flame",
|
|
"zap",
|
|
"star",
|
|
"bug",
|
|
"wrench",
|
|
"hammer",
|
|
"lightbulb",
|
|
"sparkles",
|
|
"shield",
|
|
"lock",
|
|
"search",
|
|
"cog",
|
|
"brain",
|
|
"cpu",
|
|
"git-branch",
|
|
"file-code",
|
|
"puzzle",
|
|
"gem",
|
|
"atom",
|
|
"heart",
|
|
"mail",
|
|
"message-square",
|
|
"crown",
|
|
"radar",
|
|
"telescope",
|
|
"hexagon",
|
|
] as const;
|
|
export type ProjectIconName = (typeof PROJECT_ICON_NAMES)[number];
|
|
|
|
export const ISSUE_STATUSES = [
|
|
"backlog",
|
|
"todo",
|
|
"in_progress",
|
|
"in_review",
|
|
"done",
|
|
"blocked",
|
|
"cancelled",
|
|
] as const;
|
|
export type IssueStatus = (typeof ISSUE_STATUSES)[number];
|
|
|
|
export const INBOX_MINE_ISSUE_STATUSES = [
|
|
"backlog",
|
|
"todo",
|
|
"in_progress",
|
|
"in_review",
|
|
"blocked",
|
|
"done",
|
|
] as const;
|
|
export const INBOX_MINE_ISSUE_STATUS_FILTER = INBOX_MINE_ISSUE_STATUSES.join(",");
|
|
|
|
export const ISSUE_PRIORITIES = ["critical", "high", "medium", "low"] as const;
|
|
export type IssuePriority = (typeof ISSUE_PRIORITIES)[number];
|
|
export const ISSUE_REVIEW_POLICIES = ["anyone", "not_creator", "human_only"] as const;
|
|
export type IssueReviewPolicy = (typeof ISSUE_REVIEW_POLICIES)[number];
|
|
export const ISSUE_WORK_MODES = ["standard", "ask", "planning", "skill_test"] as const;
|
|
export type IssueWorkMode = (typeof ISSUE_WORK_MODES)[number];
|
|
export const ISSUE_HARNESS_KINDS = ["skill_test"] as const;
|
|
export type IssueHarnessKind = (typeof ISSUE_HARNESS_KINDS)[number];
|
|
export const MAX_ISSUE_REQUEST_DEPTH = 1024;
|
|
|
|
export const SUMMARY_SLOT_SCOPE_KINDS = [
|
|
"project",
|
|
"workspaces_overview",
|
|
"project_workspace",
|
|
"execution_workspace",
|
|
] as const;
|
|
export type SummarySlotScopeKind = (typeof SUMMARY_SLOT_SCOPE_KINDS)[number];
|
|
export const SUMMARY_SLOT_KEYS = ["header"] as const;
|
|
export type SummarySlotKey = (typeof SUMMARY_SLOT_KEYS)[number];
|
|
export const SUMMARY_SLOT_STATUSES = ["idle", "generating", "failed"] as const;
|
|
export type SummarySlotStatus = (typeof SUMMARY_SLOT_STATUSES)[number];
|
|
|
|
export const ISSUE_COMMENT_AUTHOR_TYPES = ["user", "agent", "system"] as const;
|
|
export type IssueCommentAuthorType = (typeof ISSUE_COMMENT_AUTHOR_TYPES)[number];
|
|
|
|
export const ISSUE_COMMENT_PRESENTATION_KINDS = ["message", "system_notice"] as const;
|
|
export type IssueCommentPresentationKind = (typeof ISSUE_COMMENT_PRESENTATION_KINDS)[number];
|
|
|
|
export const ISSUE_COMMENT_PRESENTATION_TONES = ["neutral", "info", "success", "warning", "danger"] as const;
|
|
export type IssueCommentPresentationTone = (typeof ISSUE_COMMENT_PRESENTATION_TONES)[number];
|
|
|
|
export const ISSUE_COMMENT_PRESENTATION_DENSITIES = ["compact"] as const;
|
|
export type IssueCommentPresentationDensity = (typeof ISSUE_COMMENT_PRESENTATION_DENSITIES)[number];
|
|
|
|
export const ISSUE_COMMENT_METADATA_ROW_TYPES = [
|
|
"text",
|
|
"code",
|
|
"key_value",
|
|
"issue_link",
|
|
"agent_link",
|
|
"run_link",
|
|
] as const;
|
|
export type IssueCommentMetadataRowType = (typeof ISSUE_COMMENT_METADATA_ROW_TYPES)[number];
|
|
|
|
export function clampIssueRequestDepth(value: number | null | undefined): number {
|
|
if (typeof value !== "number" || !Number.isFinite(value)) return 0;
|
|
return Math.min(MAX_ISSUE_REQUEST_DEPTH, Math.max(0, Math.floor(value)));
|
|
}
|
|
|
|
export const ISSUE_THREAD_INTERACTION_KINDS = [
|
|
"suggest_tasks",
|
|
"ask_user_questions",
|
|
"request_confirmation",
|
|
"request_checkbox_confirmation",
|
|
"request_item_verdicts",
|
|
"connection_intent",
|
|
] as const;
|
|
export type IssueThreadInteractionKind = (typeof ISSUE_THREAD_INTERACTION_KINDS)[number];
|
|
|
|
export const ISSUE_THREAD_INTERACTION_CANONICAL_RESOLVER_POLICIES = [
|
|
"anyone",
|
|
"not_creator",
|
|
"human_only",
|
|
] as const;
|
|
export type IssueThreadInteractionCanonicalResolverPolicy =
|
|
(typeof ISSUE_THREAD_INTERACTION_CANONICAL_RESOLVER_POLICIES)[number];
|
|
|
|
export const ISSUE_THREAD_INTERACTION_LEGACY_RESOLVER_POLICY_ALIASES = [
|
|
"board_or_agents",
|
|
"board_only",
|
|
] as const;
|
|
export type IssueThreadInteractionLegacyResolverPolicyAlias =
|
|
(typeof ISSUE_THREAD_INTERACTION_LEGACY_RESOLVER_POLICY_ALIASES)[number];
|
|
|
|
/**
|
|
* Accepted resolver-policy input values. New product surfaces should use the
|
|
* canonical values; the two board-prefixed values remain write-compatible
|
|
* aliases for one migration window.
|
|
*/
|
|
export const ISSUE_THREAD_INTERACTION_RESOLVER_POLICIES = [
|
|
...ISSUE_THREAD_INTERACTION_CANONICAL_RESOLVER_POLICIES,
|
|
...ISSUE_THREAD_INTERACTION_LEGACY_RESOLVER_POLICY_ALIASES,
|
|
] as const;
|
|
export type IssueThreadInteractionResolverPolicy =
|
|
(typeof ISSUE_THREAD_INTERACTION_RESOLVER_POLICIES)[number];
|
|
|
|
export const ISSUE_THREAD_INTERACTION_RESOLVER_POLICY_PROVENANCES = [
|
|
"explicit",
|
|
"inherited",
|
|
"legacy_inherited_restriction",
|
|
] as const;
|
|
export type IssueThreadInteractionResolverPolicyProvenance =
|
|
(typeof ISSUE_THREAD_INTERACTION_RESOLVER_POLICY_PROVENANCES)[number];
|
|
|
|
export const ISSUE_THREAD_INTERACTION_EFFECTIVE_RESOLVER_POLICY_SOURCES = [
|
|
"requested",
|
|
"company_cap",
|
|
"governed_action",
|
|
] as const;
|
|
export type IssueThreadInteractionEffectiveResolverPolicySource =
|
|
(typeof ISSUE_THREAD_INTERACTION_EFFECTIVE_RESOLVER_POLICY_SOURCES)[number];
|
|
|
|
export function normalizeIssueThreadInteractionResolverPolicy(
|
|
policy: IssueThreadInteractionResolverPolicy,
|
|
): IssueThreadInteractionCanonicalResolverPolicy {
|
|
if (policy === "board_or_agents") return "anyone";
|
|
if (policy === "board_only") return "human_only";
|
|
return policy;
|
|
}
|
|
|
|
export function legacyIssueThreadInteractionResolverPolicyAlias(
|
|
policy: IssueThreadInteractionCanonicalResolverPolicy,
|
|
): IssueThreadInteractionLegacyResolverPolicyAlias | null {
|
|
if (policy === "anyone") return "board_or_agents";
|
|
if (policy === "human_only") return "board_only";
|
|
return null;
|
|
}
|
|
|
|
export const REQUEST_CHECKBOX_CONFIRMATION_OPTION_LIMIT = 200;
|
|
export const REQUEST_ITEM_VERDICTS_ITEM_LIMIT = REQUEST_CHECKBOX_CONFIRMATION_OPTION_LIMIT;
|
|
|
|
export const ISSUE_THREAD_INTERACTION_STATUSES = [
|
|
"pending",
|
|
"accepted",
|
|
"rejected",
|
|
"answered",
|
|
"cancelled",
|
|
"expired",
|
|
"failed",
|
|
] as const;
|
|
export type IssueThreadInteractionStatus = (typeof ISSUE_THREAD_INTERACTION_STATUSES)[number];
|
|
|
|
export const ISSUE_THREAD_INTERACTION_CONTINUATION_POLICIES = [
|
|
"none",
|
|
"wake_assignee",
|
|
"wake_assignee_on_accept",
|
|
] as const;
|
|
export type IssueThreadInteractionContinuationPolicy =
|
|
(typeof ISSUE_THREAD_INTERACTION_CONTINUATION_POLICIES)[number];
|
|
|
|
export const TASK_WATCHDOG_PRODUCT_BUG_ORIGIN_KIND = "task_watchdog_product_bug";
|
|
|
|
// Marks the single onboarding "first task" so surfaces can special-case it
|
|
// (e.g. suppress the seeded-description bubble and rely on a seeded greeting).
|
|
export const ONBOARDING_FIRST_TASK_ORIGIN_KIND = "onboarding_first_task";
|
|
|
|
export const ISSUE_ORIGIN_KINDS = [
|
|
"manual",
|
|
"routine_execution",
|
|
"stale_active_run_evaluation",
|
|
"harness_liveness_escalation",
|
|
"issue_productivity_review",
|
|
"stranded_issue_recovery",
|
|
"task_watchdog",
|
|
TASK_WATCHDOG_PRODUCT_BUG_ORIGIN_KIND,
|
|
ONBOARDING_FIRST_TASK_ORIGIN_KIND,
|
|
"chat_channel",
|
|
] as const;
|
|
export type BuiltInIssueOriginKind = (typeof ISSUE_ORIGIN_KINDS)[number];
|
|
export type PluginIssueOriginKind = `plugin:${string}`;
|
|
export type IssueOriginKind = BuiltInIssueOriginKind | PluginIssueOriginKind;
|
|
export const ISSUE_WATCHDOG_DISCOVERY_KINDS = ["product_bug", "platform_bug"] as const;
|
|
export type IssueWatchdogDiscoveryKind = (typeof ISSUE_WATCHDOG_DISCOVERY_KINDS)[number];
|
|
export const ISSUE_SURFACE_VISIBILITIES = ["default", "plugin_operation"] as const;
|
|
export type IssueSurfaceVisibility = (typeof ISSUE_SURFACE_VISIBILITIES)[number];
|
|
|
|
export const ISSUE_RECOVERY_ACTION_KINDS = [
|
|
"missing_disposition",
|
|
"deliberate_wait_without_target",
|
|
"stranded_assigned_issue",
|
|
"workspace_validation",
|
|
"configuration_validation",
|
|
"active_run_watchdog",
|
|
"issue_graph_liveness",
|
|
] as const;
|
|
export type IssueRecoveryActionKind = (typeof ISSUE_RECOVERY_ACTION_KINDS)[number];
|
|
|
|
export const ISSUE_DISPOSITION_REPAIR_RETRY_REASON = "issue_disposition_repair";
|
|
|
|
export const ISSUE_RECOVERY_ACTION_STATUSES = [
|
|
"active",
|
|
"escalated",
|
|
"resolved",
|
|
"cancelled",
|
|
] as const;
|
|
export type IssueRecoveryActionStatus = (typeof ISSUE_RECOVERY_ACTION_STATUSES)[number];
|
|
|
|
export const ISSUE_RECOVERY_ACTION_OWNER_TYPES = [
|
|
"agent",
|
|
"user",
|
|
"board",
|
|
"system",
|
|
] as const;
|
|
export type IssueRecoveryActionOwnerType = (typeof ISSUE_RECOVERY_ACTION_OWNER_TYPES)[number];
|
|
|
|
export const ISSUE_RECOVERY_ACTION_OUTCOMES = [
|
|
"restored",
|
|
"handed_back",
|
|
"owner_completed",
|
|
"delegated",
|
|
"false_positive",
|
|
"blocked",
|
|
"escalated",
|
|
"cancelled",
|
|
] as const;
|
|
export type IssueRecoveryActionOutcome = (typeof ISSUE_RECOVERY_ACTION_OUTCOMES)[number];
|
|
|
|
export function pluginOperationIssueOriginKind(pluginKey: string): PluginIssueOriginKind {
|
|
return `plugin:${pluginKey}:operation`;
|
|
}
|
|
|
|
export function isPluginOperationIssueOriginKind(originKind: string | null | undefined): boolean {
|
|
return typeof originKind === "string" && /^plugin:[^:]+:operation(?::|$)/.test(originKind);
|
|
}
|
|
|
|
export const ISSUE_RELATION_TYPES = ["blocks"] as const;
|
|
export type IssueRelationType = (typeof ISSUE_RELATION_TYPES)[number];
|
|
|
|
export const ISSUE_TREE_CONTROL_MODES = ["pause", "resume", "cancel", "restore"] as const;
|
|
export type IssueTreeControlMode = (typeof ISSUE_TREE_CONTROL_MODES)[number];
|
|
|
|
export const ISSUE_TREE_HOLD_STATUSES = ["active", "released"] as const;
|
|
export type IssueTreeHoldStatus = (typeof ISSUE_TREE_HOLD_STATUSES)[number];
|
|
|
|
export const ISSUE_TREE_HOLD_RELEASE_POLICY_STRATEGIES = ["manual", "after_active_runs_finish"] as const;
|
|
export type IssueTreeHoldReleasePolicyStrategy = (typeof ISSUE_TREE_HOLD_RELEASE_POLICY_STRATEGIES)[number];
|
|
|
|
export const ISSUE_CONTINUATION_SUMMARY_DOCUMENT_KEY = "continuation-summary" as const;
|
|
export const PIPELINE_CASE_BODY_DOCUMENT_KEY = "pipeline-case-body" as const;
|
|
export const PIPELINE_AUTOMATION_DEFAULT_TITLE_TEMPLATE = "{{pipeline_name}} / {{stage_name}}: {{case_title}}" as const;
|
|
export const SYSTEM_ISSUE_DOCUMENT_KEYS = [
|
|
ISSUE_CONTINUATION_SUMMARY_DOCUMENT_KEY,
|
|
PIPELINE_CASE_BODY_DOCUMENT_KEY,
|
|
] as const;
|
|
export type SystemIssueDocumentKey = (typeof SYSTEM_ISSUE_DOCUMENT_KEYS)[number];
|
|
|
|
const SYSTEM_ISSUE_DOCUMENT_KEY_SET = new Set<string>(SYSTEM_ISSUE_DOCUMENT_KEYS);
|
|
|
|
export function isSystemIssueDocumentKey(key: string): key is SystemIssueDocumentKey {
|
|
return SYSTEM_ISSUE_DOCUMENT_KEY_SET.has(key);
|
|
}
|
|
export const ISSUE_REFERENCE_SOURCE_KINDS = ["title", "description", "comment", "document"] as const;
|
|
export type IssueReferenceSourceKind = (typeof ISSUE_REFERENCE_SOURCE_KINDS)[number];
|
|
|
|
export const DOCUMENT_ANNOTATION_THREAD_STATUSES = ["open", "resolved"] as const;
|
|
export type DocumentAnnotationThreadStatus = (typeof DOCUMENT_ANNOTATION_THREAD_STATUSES)[number];
|
|
|
|
export const DOCUMENT_ANNOTATION_ANCHOR_STATES = ["active", "stale", "orphaned"] as const;
|
|
export type DocumentAnnotationAnchorState = (typeof DOCUMENT_ANNOTATION_ANCHOR_STATES)[number];
|
|
|
|
export const DOCUMENT_ANNOTATION_ANCHOR_CONFIDENCES = [
|
|
"exact",
|
|
"duplicate",
|
|
"fuzzy",
|
|
"ambiguous",
|
|
"missing",
|
|
] as const;
|
|
export type DocumentAnnotationAnchorConfidence =
|
|
(typeof DOCUMENT_ANNOTATION_ANCHOR_CONFIDENCES)[number];
|
|
|
|
export const EXTERNAL_OBJECT_STATUS_CATEGORIES = [
|
|
"unknown",
|
|
"open",
|
|
"waiting",
|
|
"running",
|
|
"succeeded",
|
|
"failed",
|
|
"blocked",
|
|
"closed",
|
|
"archived",
|
|
"auth_required",
|
|
"unreachable",
|
|
] as const;
|
|
export type ExternalObjectStatusCategory = (typeof EXTERNAL_OBJECT_STATUS_CATEGORIES)[number];
|
|
|
|
export const EXTERNAL_OBJECT_STATUS_TONES = [
|
|
"neutral",
|
|
"info",
|
|
"success",
|
|
"warning",
|
|
"danger",
|
|
"muted",
|
|
] as const;
|
|
export type ExternalObjectStatusTone = (typeof EXTERNAL_OBJECT_STATUS_TONES)[number];
|
|
|
|
export const EXTERNAL_OBJECT_LIVENESS_STATES = [
|
|
"unknown",
|
|
"fresh",
|
|
"stale",
|
|
"auth_required",
|
|
"unreachable",
|
|
] as const;
|
|
export type ExternalObjectLivenessState = (typeof EXTERNAL_OBJECT_LIVENESS_STATES)[number];
|
|
|
|
export const EXTERNAL_OBJECT_MENTION_SOURCE_KINDS = [
|
|
"title",
|
|
"description",
|
|
"comment",
|
|
"document",
|
|
"property",
|
|
"plugin",
|
|
] as const;
|
|
export type ExternalObjectMentionSourceKind = (typeof EXTERNAL_OBJECT_MENTION_SOURCE_KINDS)[number];
|
|
|
|
export const EXTERNAL_OBJECT_MENTION_CONFIDENCES = ["exact", "likely", "possible"] as const;
|
|
export type ExternalObjectMentionConfidence = (typeof EXTERNAL_OBJECT_MENTION_CONFIDENCES)[number];
|
|
|
|
export const ISSUE_EXECUTION_POLICY_MODES = ["normal", "auto"] as const;
|
|
export type IssueExecutionPolicyMode = (typeof ISSUE_EXECUTION_POLICY_MODES)[number];
|
|
|
|
export const ISSUE_EXECUTION_STAGE_TYPES = ["review", "approval"] as const;
|
|
export type IssueExecutionStageType = (typeof ISSUE_EXECUTION_STAGE_TYPES)[number];
|
|
|
|
export const ISSUE_MONITOR_SCHEDULED_BY = ["assignee", "board"] as const;
|
|
export type IssueMonitorScheduledBy = (typeof ISSUE_MONITOR_SCHEDULED_BY)[number];
|
|
|
|
export const ISSUE_EXECUTION_MONITOR_KINDS = ["external_service"] as const;
|
|
export type IssueExecutionMonitorKind = (typeof ISSUE_EXECUTION_MONITOR_KINDS)[number];
|
|
|
|
export const PROVIDER_QUOTA_MONITOR_SERVICE_NAME = "AI provider quota";
|
|
|
|
export const ISSUE_EXECUTION_MONITOR_RECOVERY_POLICIES = [
|
|
"wake_owner",
|
|
"create_recovery_issue",
|
|
"escalate_to_board",
|
|
] as const;
|
|
export type IssueExecutionMonitorRecoveryPolicy =
|
|
(typeof ISSUE_EXECUTION_MONITOR_RECOVERY_POLICIES)[number];
|
|
|
|
export const ISSUE_EXECUTION_STATE_STATUSES = ["idle", "pending", "changes_requested", "completed"] as const;
|
|
export type IssueExecutionStateStatus = (typeof ISSUE_EXECUTION_STATE_STATUSES)[number];
|
|
|
|
export const ISSUE_EXECUTION_MONITOR_STATE_STATUSES = ["scheduled", "triggered", "cleared"] as const;
|
|
export type IssueExecutionMonitorStateStatus = (typeof ISSUE_EXECUTION_MONITOR_STATE_STATUSES)[number];
|
|
|
|
export const ISSUE_EXECUTION_MONITOR_CLEAR_REASONS = [
|
|
"manual",
|
|
"triggered",
|
|
"done",
|
|
"cancelled",
|
|
"invalid_status",
|
|
"invalid_assignee",
|
|
"dispatch_skipped",
|
|
"timeout_exceeded",
|
|
"max_attempts_exhausted",
|
|
] as const;
|
|
export type IssueExecutionMonitorClearReason = (typeof ISSUE_EXECUTION_MONITOR_CLEAR_REASONS)[number];
|
|
|
|
export const ISSUE_EXECUTION_DECISION_OUTCOMES = ["approved", "changes_requested"] as const;
|
|
export type IssueExecutionDecisionOutcome = (typeof ISSUE_EXECUTION_DECISION_OUTCOMES)[number];
|
|
|
|
export const GOAL_LEVELS = ["company", "team", "agent", "task"] as const;
|
|
export type GoalLevel = (typeof GOAL_LEVELS)[number];
|
|
|
|
export const GOAL_STATUSES = ["planned", "active", "achieved", "cancelled"] as const;
|
|
export type GoalStatus = (typeof GOAL_STATUSES)[number];
|
|
|
|
export const PROJECT_STATUSES = [
|
|
"backlog",
|
|
"planned",
|
|
"in_progress",
|
|
"completed",
|
|
"cancelled",
|
|
] as const;
|
|
export type ProjectStatus = (typeof PROJECT_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_DRIVERS = ["local", "ssh", "sandbox", "plugin"] as const;
|
|
export type EnvironmentDriver = (typeof ENVIRONMENT_DRIVERS)[number];
|
|
|
|
export const ENVIRONMENT_STATUSES = ["active", "archived"] as const;
|
|
export type EnvironmentStatus = (typeof ENVIRONMENT_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_LEASE_STATUSES = ["active", "released", "expired", "failed", "retained", "pending_cleanup"] as const;
|
|
export type EnvironmentLeaseStatus = (typeof ENVIRONMENT_LEASE_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_LEASE_POLICIES = [
|
|
"ephemeral",
|
|
"reuse_by_environment",
|
|
"reuse_by_execution_workspace",
|
|
"retain_on_failure",
|
|
] as const;
|
|
export type EnvironmentLeasePolicy = (typeof ENVIRONMENT_LEASE_POLICIES)[number];
|
|
|
|
export const ENVIRONMENT_LEASE_CLEANUP_STATUSES = ["pending", "success", "failed"] as const;
|
|
export type EnvironmentLeaseCleanupStatus = (typeof ENVIRONMENT_LEASE_CLEANUP_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_CUSTOM_IMAGE_TEMPLATE_KINDS = [
|
|
"snapshot",
|
|
"image",
|
|
"provider_template",
|
|
"unknown",
|
|
] as const;
|
|
export type EnvironmentCustomImageTemplateKind = (typeof ENVIRONMENT_CUSTOM_IMAGE_TEMPLATE_KINDS)[number];
|
|
|
|
export const ENVIRONMENT_CUSTOM_IMAGE_TEMPLATE_STATUSES = [
|
|
"active",
|
|
"superseded",
|
|
"revoked",
|
|
"failed",
|
|
] as const;
|
|
export type EnvironmentCustomImageTemplateStatus = (typeof ENVIRONMENT_CUSTOM_IMAGE_TEMPLATE_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_CUSTOM_IMAGE_SETUP_SESSION_STATUSES = [
|
|
"starting",
|
|
"waiting_for_user",
|
|
"capturing",
|
|
"promoted",
|
|
"cancelled",
|
|
"timed_out",
|
|
"failed",
|
|
] as const;
|
|
export type EnvironmentCustomImageSetupSessionStatus =
|
|
(typeof ENVIRONMENT_CUSTOM_IMAGE_SETUP_SESSION_STATUSES)[number];
|
|
|
|
export const ENVIRONMENT_CUSTOM_IMAGE_SETUP_CONNECTION_TYPES = [
|
|
"ssh",
|
|
"browser_terminal",
|
|
"unknown",
|
|
] as const;
|
|
export type EnvironmentCustomImageSetupConnectionType =
|
|
(typeof ENVIRONMENT_CUSTOM_IMAGE_SETUP_CONNECTION_TYPES)[number];
|
|
|
|
export const ROUTINE_STATUSES = ["active", "paused", "archived"] as const;
|
|
export type RoutineStatus = (typeof ROUTINE_STATUSES)[number];
|
|
|
|
export const ROUTINE_CONCURRENCY_POLICIES = ["coalesce_if_active", "always_enqueue", "skip_if_active"] as const;
|
|
export type RoutineConcurrencyPolicy = (typeof ROUTINE_CONCURRENCY_POLICIES)[number];
|
|
|
|
export const ROUTINE_CATCH_UP_POLICIES = ["skip_missed", "enqueue_missed_with_cap"] as const;
|
|
export type RoutineCatchUpPolicy = (typeof ROUTINE_CATCH_UP_POLICIES)[number];
|
|
|
|
export const ROUTINE_ACTIVITY_GATE_POLICIES = ["always", "require_external_activity"] as const;
|
|
export type RoutineActivityGatePolicy = (typeof ROUTINE_ACTIVITY_GATE_POLICIES)[number];
|
|
|
|
export const ROUTINE_ACTIVITY_GATE_SCOPES = ["company", "project"] as const;
|
|
export type RoutineActivityGateScope = (typeof ROUTINE_ACTIVITY_GATE_SCOPES)[number];
|
|
|
|
export const ROUTINE_TRIGGER_KINDS = ["schedule", "webhook", "api"] as const;
|
|
export type RoutineTriggerKind = (typeof ROUTINE_TRIGGER_KINDS)[number];
|
|
|
|
export const ROUTINE_TRIGGER_SIGNING_MODES = ["bearer", "hmac_sha256", "github_hmac", "none"] as const;
|
|
export type RoutineTriggerSigningMode = (typeof ROUTINE_TRIGGER_SIGNING_MODES)[number];
|
|
|
|
export const ROUTINE_VARIABLE_TYPES = ["text", "textarea", "number", "boolean", "select", "date"] as const;
|
|
export type RoutineVariableType = (typeof ROUTINE_VARIABLE_TYPES)[number];
|
|
|
|
export const ROUTINE_RUN_STATUSES = [
|
|
"received",
|
|
"coalesced",
|
|
"skipped",
|
|
"issue_created",
|
|
"completed",
|
|
"failed",
|
|
] as const;
|
|
export type RoutineRunStatus = (typeof ROUTINE_RUN_STATUSES)[number];
|
|
|
|
export const ROUTINE_RUN_SOURCES = ["schedule", "manual", "api", "webhook"] as const;
|
|
export type RoutineRunSource = (typeof ROUTINE_RUN_SOURCES)[number];
|
|
|
|
// "import" marks agents parked by a company import (safety default) so the UI
|
|
// can explain the pause and offer a scoped bulk-resume; "system" remains the
|
|
// reason for platform-managed pauses (plugins, built-ins).
|
|
export const PAUSE_REASONS = ["manual", "budget", "system", "company_archived", "import"] as const;
|
|
export type PauseReason = (typeof PAUSE_REASONS)[number];
|
|
|
|
export const PROJECT_COLORS = [
|
|
"#6366f1", // indigo
|
|
"#8b5cf6", // violet
|
|
"#ec4899", // pink
|
|
"#ef4444", // red
|
|
"#f97316", // orange
|
|
"#eab308", // yellow
|
|
"#22c55e", // green
|
|
"#14b8a6", // teal
|
|
"#06b6d4", // cyan
|
|
"#3b82f6", // blue
|
|
] as const;
|
|
|
|
export const APPROVAL_TYPES = [
|
|
"hire_agent",
|
|
"approve_ceo_strategy",
|
|
"budget_override_required",
|
|
"request_board_approval",
|
|
] as const;
|
|
export type ApprovalType = (typeof APPROVAL_TYPES)[number];
|
|
|
|
export const APPROVAL_STATUSES = [
|
|
"pending",
|
|
"revision_requested",
|
|
"approved",
|
|
"rejected",
|
|
"cancelled",
|
|
] as const;
|
|
export type ApprovalStatus = (typeof APPROVAL_STATUSES)[number];
|
|
|
|
export const SECRET_PROVIDERS = [
|
|
"local_encrypted",
|
|
"aws_secrets_manager",
|
|
"gcp_secret_manager",
|
|
"vault",
|
|
] as const;
|
|
export type SecretProvider = (typeof SECRET_PROVIDERS)[number];
|
|
|
|
export const SECRET_PROVIDER_CONFIG_STATUSES = [
|
|
"ready",
|
|
"warning",
|
|
"coming_soon",
|
|
"disabled",
|
|
] as const;
|
|
export type SecretProviderConfigStatus = (typeof SECRET_PROVIDER_CONFIG_STATUSES)[number];
|
|
|
|
export const SECRET_PROVIDER_CONFIG_HEALTH_STATUSES = [
|
|
"ready",
|
|
"warning",
|
|
"error",
|
|
"coming_soon",
|
|
"disabled",
|
|
] as const;
|
|
export type SecretProviderConfigHealthStatus =
|
|
(typeof SECRET_PROVIDER_CONFIG_HEALTH_STATUSES)[number];
|
|
|
|
export const SECRET_STATUSES = ["active", "disabled", "archived", "deleted"] as const;
|
|
export type SecretStatus = (typeof SECRET_STATUSES)[number];
|
|
|
|
export const SECRET_SCOPES = ["company", "user"] as const;
|
|
export type SecretScope = (typeof SECRET_SCOPES)[number];
|
|
|
|
export const SECRET_MANAGED_MODES = ["paperclip_managed", "external_reference"] as const;
|
|
export type SecretManagedMode = (typeof SECRET_MANAGED_MODES)[number];
|
|
|
|
export const SECRET_VERSION_STATUSES = [
|
|
"current",
|
|
"previous",
|
|
"disabled",
|
|
"destroyed",
|
|
"failed",
|
|
] as const;
|
|
export type SecretVersionStatus = (typeof SECRET_VERSION_STATUSES)[number];
|
|
|
|
export const SECRET_BINDING_TARGET_TYPES = [
|
|
"agent",
|
|
"project",
|
|
"environment",
|
|
"routine",
|
|
"plugin",
|
|
"issue",
|
|
"run",
|
|
"tool_connection",
|
|
"system",
|
|
] as const;
|
|
export type SecretBindingTargetType = (typeof SECRET_BINDING_TARGET_TYPES)[number];
|
|
|
|
export const SECRET_ACCESS_OUTCOMES = [
|
|
"success",
|
|
"failure",
|
|
"missing",
|
|
"inactive",
|
|
"not_allowed",
|
|
"optional_omitted",
|
|
"provider_error",
|
|
] as const;
|
|
export type SecretAccessOutcome = (typeof SECRET_ACCESS_OUTCOMES)[number];
|
|
|
|
export const SECRET_PROJECTION_CLASSES = ["unclassified", "class_3_static_lease"] as const;
|
|
export type SecretProjectionClass = (typeof SECRET_PROJECTION_CLASSES)[number];
|
|
|
|
export const CLASS3_STATIC_LEASE_ALLOWLIST = [
|
|
{
|
|
key: "slack.bot_token",
|
|
label: "Slack bot token",
|
|
targetType: "agent",
|
|
configPath: "env.SLACK_BOT_TOKEN",
|
|
envKey: "SLACK_BOT_TOKEN",
|
|
},
|
|
{
|
|
key: "slack.bot_token",
|
|
label: "Slack bot token",
|
|
targetType: "routine",
|
|
configPath: "env.SLACK_BOT_TOKEN",
|
|
envKey: "SLACK_BOT_TOKEN",
|
|
},
|
|
{
|
|
key: "slack.bot_token",
|
|
label: "Slack bot token governance connection",
|
|
targetType: "tool_connection",
|
|
configPath: "credentials.bot_token",
|
|
envKey: "SLACK_BOT_TOKEN",
|
|
},
|
|
{
|
|
key: "discord.bot_token",
|
|
label: "Discord bot token",
|
|
targetType: "agent",
|
|
configPath: "env.DISCORD_BOT_TOKEN",
|
|
envKey: "DISCORD_BOT_TOKEN",
|
|
},
|
|
{
|
|
key: "discord.bot_token",
|
|
label: "Discord bot token",
|
|
targetType: "routine",
|
|
configPath: "env.DISCORD_BOT_TOKEN",
|
|
envKey: "DISCORD_BOT_TOKEN",
|
|
},
|
|
{
|
|
key: "discord.bot_token",
|
|
label: "Discord bot token governance connection",
|
|
targetType: "tool_connection",
|
|
configPath: "credentials.bot_token",
|
|
envKey: "DISCORD_BOT_TOKEN",
|
|
},
|
|
] as const;
|
|
export type Class3StaticLeaseAllowlistKey = (typeof CLASS3_STATIC_LEASE_ALLOWLIST)[number]["key"];
|
|
|
|
export const STORAGE_PROVIDERS = ["local_disk", "s3"] as const;
|
|
export type StorageProvider = (typeof STORAGE_PROVIDERS)[number];
|
|
|
|
export const BILLING_TYPES = [
|
|
"metered_api",
|
|
"subscription_included",
|
|
"subscription_overage",
|
|
"credits",
|
|
"fixed",
|
|
"unknown",
|
|
] as const;
|
|
export type BillingType = (typeof BILLING_TYPES)[number];
|
|
|
|
export const COST_STATUSES = ["reported", "unpriced"] as const;
|
|
export type CostStatus = (typeof COST_STATUSES)[number];
|
|
|
|
export const FINANCE_EVENT_KINDS = [
|
|
"inference_charge",
|
|
"platform_fee",
|
|
"credit_purchase",
|
|
"credit_refund",
|
|
"credit_expiry",
|
|
"byok_fee",
|
|
"gateway_overhead",
|
|
"log_storage_charge",
|
|
"logpush_charge",
|
|
"provisioned_capacity_charge",
|
|
"training_charge",
|
|
"custom_model_import_charge",
|
|
"custom_model_storage_charge",
|
|
"manual_adjustment",
|
|
] as const;
|
|
export type FinanceEventKind = (typeof FINANCE_EVENT_KINDS)[number];
|
|
|
|
export const FINANCE_DIRECTIONS = ["debit", "credit"] as const;
|
|
export type FinanceDirection = (typeof FINANCE_DIRECTIONS)[number];
|
|
|
|
export const FINANCE_UNITS = [
|
|
"input_token",
|
|
"output_token",
|
|
"cached_input_token",
|
|
"request",
|
|
"credit_usd",
|
|
"credit_unit",
|
|
"model_unit_minute",
|
|
"model_unit_hour",
|
|
"gb_month",
|
|
"train_token",
|
|
"unknown",
|
|
] as const;
|
|
export type FinanceUnit = (typeof FINANCE_UNITS)[number];
|
|
|
|
export const BUDGET_SCOPE_TYPES = ["company", "agent", "project"] as const;
|
|
export type BudgetScopeType = (typeof BUDGET_SCOPE_TYPES)[number];
|
|
|
|
export const BUDGET_METRICS = ["billed_cents"] as const;
|
|
export type BudgetMetric = (typeof BUDGET_METRICS)[number];
|
|
|
|
export const BUDGET_WINDOW_KINDS = ["calendar_month_utc", "lifetime"] as const;
|
|
export type BudgetWindowKind = (typeof BUDGET_WINDOW_KINDS)[number];
|
|
|
|
export const BUDGET_THRESHOLD_TYPES = ["soft", "hard"] as const;
|
|
export type BudgetThresholdType = (typeof BUDGET_THRESHOLD_TYPES)[number];
|
|
|
|
export const BUDGET_INCIDENT_STATUSES = ["open", "resolved", "dismissed"] as const;
|
|
export type BudgetIncidentStatus = (typeof BUDGET_INCIDENT_STATUSES)[number];
|
|
|
|
export const BUDGET_INCIDENT_RESOLUTION_ACTIONS = [
|
|
"keep_paused",
|
|
"raise_budget_and_resume",
|
|
] as const;
|
|
export type BudgetIncidentResolutionAction = (typeof BUDGET_INCIDENT_RESOLUTION_ACTIONS)[number];
|
|
|
|
export const HEARTBEAT_INVOCATION_SOURCES = [
|
|
"timer",
|
|
"assignment",
|
|
"on_demand",
|
|
"automation",
|
|
] as const;
|
|
export type HeartbeatInvocationSource = (typeof HEARTBEAT_INVOCATION_SOURCES)[number];
|
|
|
|
export const WAKEUP_TRIGGER_DETAILS = ["manual", "ping", "callback", "system"] as const;
|
|
export type WakeupTriggerDetail = (typeof WAKEUP_TRIGGER_DETAILS)[number];
|
|
|
|
export const WAKEUP_REQUEST_STATUSES = [
|
|
"queued",
|
|
"deferred_issue_execution",
|
|
"claimed",
|
|
"coalesced",
|
|
"skipped",
|
|
"completed",
|
|
"failed",
|
|
"cancelled",
|
|
] as const;
|
|
export type WakeupRequestStatus = (typeof WAKEUP_REQUEST_STATUSES)[number];
|
|
|
|
export const HEARTBEAT_RUN_STATUSES = [
|
|
"queued",
|
|
"scheduled_retry",
|
|
"running",
|
|
"succeeded",
|
|
"interrupted",
|
|
"failed",
|
|
"cancelled",
|
|
"timed_out",
|
|
] as const;
|
|
export type HeartbeatRunStatus = (typeof HEARTBEAT_RUN_STATUSES)[number];
|
|
|
|
export const RUN_LIVENESS_STATES = [
|
|
"completed",
|
|
"advanced",
|
|
"plan_only",
|
|
"empty_response",
|
|
"blocked",
|
|
"failed",
|
|
"needs_followup",
|
|
] as const;
|
|
export type RunLivenessState = (typeof RUN_LIVENESS_STATES)[number];
|
|
|
|
export const LIVE_EVENT_TYPES = [
|
|
"heartbeat.run.queued",
|
|
"heartbeat.run.status",
|
|
"heartbeat.run.progress",
|
|
"heartbeat.run.event",
|
|
"heartbeat.run.log",
|
|
"agent.session.goal.changed",
|
|
"agent.status",
|
|
"activity.logged",
|
|
"external_object.updated",
|
|
"plugin.ui.updated",
|
|
"plugin.worker.crashed",
|
|
"plugin.worker.restarted",
|
|
] as const;
|
|
export type LiveEventType = (typeof LIVE_EVENT_TYPES)[number];
|
|
|
|
export const PRINCIPAL_TYPES = ["user", "agent"] as const;
|
|
export type PrincipalType = (typeof PRINCIPAL_TYPES)[number];
|
|
|
|
export const MEMBERSHIP_STATUSES = ["pending", "active", "suspended", "archived"] as const;
|
|
export type MembershipStatus = (typeof MEMBERSHIP_STATUSES)[number];
|
|
|
|
export const COMPANY_MEMBERSHIP_ROLES = [
|
|
"owner",
|
|
"admin",
|
|
"operator",
|
|
"viewer",
|
|
"member",
|
|
] as const;
|
|
export type CompanyMembershipRole = (typeof COMPANY_MEMBERSHIP_ROLES)[number];
|
|
|
|
export const HUMAN_COMPANY_MEMBERSHIP_ROLES = [
|
|
"owner",
|
|
"admin",
|
|
"operator",
|
|
"viewer",
|
|
] as const;
|
|
export type HumanCompanyMembershipRole = (typeof HUMAN_COMPANY_MEMBERSHIP_ROLES)[number];
|
|
|
|
export const HUMAN_COMPANY_MEMBERSHIP_ROLE_LABELS: Record<HumanCompanyMembershipRole, string> = {
|
|
owner: "Owner",
|
|
admin: "Admin",
|
|
operator: "Operator",
|
|
viewer: "Viewer",
|
|
};
|
|
|
|
export const INSTANCE_USER_ROLES = ["instance_admin"] as const;
|
|
export type InstanceUserRole = (typeof INSTANCE_USER_ROLES)[number];
|
|
|
|
export const INVITE_TYPES = ["company_join", "bootstrap_ceo"] as const;
|
|
export type InviteType = (typeof INVITE_TYPES)[number];
|
|
|
|
export const INVITE_JOIN_TYPES = ["human", "agent", "both"] as const;
|
|
export type InviteJoinType = (typeof INVITE_JOIN_TYPES)[number];
|
|
|
|
export const JOIN_REQUEST_TYPES = ["human", "agent"] as const;
|
|
export type JoinRequestType = (typeof JOIN_REQUEST_TYPES)[number];
|
|
|
|
export const JOIN_REQUEST_STATUSES = ["pending_approval", "approved", "rejected"] as const;
|
|
export type JoinRequestStatus = (typeof JOIN_REQUEST_STATUSES)[number];
|
|
|
|
export const PERMISSION_KEYS = [
|
|
"agents:create",
|
|
"agents:configure",
|
|
"agents:suggest-changes",
|
|
"skills:create",
|
|
"skills:suggest-changes",
|
|
"environments:manage",
|
|
"tools:admin",
|
|
"tools:manage_connections",
|
|
"tools:manage_profiles",
|
|
"tools:view_audit",
|
|
"audit:view_agent_actions",
|
|
"tools:use",
|
|
"tools:manage_runtime",
|
|
"inbox:manage",
|
|
"users:invite",
|
|
"users:manage_permissions",
|
|
"tasks:assign",
|
|
"tasks:assign_scope",
|
|
"tasks:manage_active_checkouts",
|
|
"pipelines:write",
|
|
"joins:approve",
|
|
] as const;
|
|
export type PermissionKey = (typeof PERMISSION_KEYS)[number];
|
|
|
|
export const TOOL_APPLICATION_TYPES = ["mcp_http", "mcp_stdio", "paperclip_plugin", "a2a", "chat"] as const;
|
|
export type ToolApplicationType = (typeof TOOL_APPLICATION_TYPES)[number];
|
|
|
|
export const TOOL_APPLICATION_STATUSES = ["draft", "active", "disabled", "archived"] as const;
|
|
export type ToolApplicationStatus = (typeof TOOL_APPLICATION_STATUSES)[number];
|
|
|
|
export const TOOL_CONNECTION_KINDS = ["managed"] as const;
|
|
export type ToolConnectionKind = (typeof TOOL_CONNECTION_KINDS)[number];
|
|
|
|
export const TOOL_CONNECTION_HEALTH_STATUSES = [
|
|
"unknown",
|
|
"healthy",
|
|
"degraded",
|
|
"failed",
|
|
"unchecked",
|
|
"ok",
|
|
"error",
|
|
"missing_secret",
|
|
] as const;
|
|
export type ToolConnectionHealthStatus = (typeof TOOL_CONNECTION_HEALTH_STATUSES)[number];
|
|
|
|
/**
|
|
* Health states that mean an app needs the user's attention (a bad/missing key
|
|
* or a degraded connection). Single source of truth shared by the needs-
|
|
* attention aggregation and the prosumer Apps surfaces so their counts agree.
|
|
*/
|
|
export const TOOL_CONNECTION_ATTENTION_HEALTH_STATUSES: readonly ToolConnectionHealthStatus[] = [
|
|
"degraded",
|
|
"failed",
|
|
"error",
|
|
"missing_secret",
|
|
];
|
|
|
|
export function isToolConnectionAttentionHealth(status: ToolConnectionHealthStatus): boolean {
|
|
return TOOL_CONNECTION_ATTENTION_HEALTH_STATUSES.includes(status);
|
|
}
|
|
|
|
export const TOOL_CATALOG_ENTRY_KINDS = ["tool", "resource", "prompt"] as const;
|
|
export type ToolCatalogEntryKind = (typeof TOOL_CATALOG_ENTRY_KINDS)[number];
|
|
|
|
export const TOOL_CATALOG_ENTRY_STATUSES = ["active", "disabled", "quarantined", "removed"] as const;
|
|
export type ToolCatalogEntryStatus = (typeof TOOL_CATALOG_ENTRY_STATUSES)[number];
|
|
|
|
export const TOOL_RISK_LEVELS = ["low", "medium", "high", "critical", "read", "write", "destructive"] as const;
|
|
export type ToolRiskLevel = (typeof TOOL_RISK_LEVELS)[number];
|
|
|
|
export const TOOL_PROFILE_STATUSES = ["draft", "active", "disabled", "archived"] as const;
|
|
export type ToolProfileStatus = (typeof TOOL_PROFILE_STATUSES)[number];
|
|
|
|
export const TOOL_PROFILE_DEFAULT_ACTIONS = ["deny", "allow"] as const;
|
|
export type ToolProfileDefaultAction = (typeof TOOL_PROFILE_DEFAULT_ACTIONS)[number];
|
|
|
|
export const TOOL_PROFILE_ENTRY_SELECTOR_TYPES = [
|
|
"application",
|
|
"connection",
|
|
"catalog_entry",
|
|
"tool_name",
|
|
"risk_level",
|
|
] as const;
|
|
export type ToolProfileEntrySelectorType = (typeof TOOL_PROFILE_ENTRY_SELECTOR_TYPES)[number];
|
|
|
|
export const TOOL_PROFILE_ENTRY_EFFECTS = ["include", "exclude"] as const;
|
|
export type ToolProfileEntryEffect = (typeof TOOL_PROFILE_ENTRY_EFFECTS)[number];
|
|
|
|
export const TOOL_PROFILE_BINDING_TARGET_TYPES = ["company", "agent", "project", "routine", "issue", "gateway"] as const;
|
|
export type ToolProfileBindingTargetType = (typeof TOOL_PROFILE_BINDING_TARGET_TYPES)[number];
|
|
|
|
export const TOOL_MCP_GATEWAY_STATUSES = ["draft", "active", "disabled", "archived"] as const;
|
|
export type ToolMcpGatewayStatus = (typeof TOOL_MCP_GATEWAY_STATUSES)[number];
|
|
|
|
export const TOOL_MCP_GATEWAY_DEFAULT_PROFILE_MODES = [
|
|
"gateway_only",
|
|
"inherit_context_then_gateway",
|
|
"gateway_then_context",
|
|
] as const;
|
|
export type ToolMcpGatewayDefaultProfileMode = (typeof TOOL_MCP_GATEWAY_DEFAULT_PROFILE_MODES)[number];
|
|
|
|
export const TOOL_MCP_GATEWAY_CONTEXT_SCOPE_TYPES = [
|
|
"none",
|
|
"company",
|
|
"project",
|
|
"routine",
|
|
"issue",
|
|
"agent",
|
|
] as const;
|
|
export type ToolMcpGatewayContextScopeType = (typeof TOOL_MCP_GATEWAY_CONTEXT_SCOPE_TYPES)[number];
|
|
|
|
export const TOOL_MCP_GATEWAY_TOKEN_SUBJECT_TYPES = ["gateway_client", "heartbeat_run", "board_user", "agent"] as const;
|
|
export type ToolMcpGatewayTokenSubjectType = (typeof TOOL_MCP_GATEWAY_TOKEN_SUBJECT_TYPES)[number];
|
|
|
|
export const TOOL_MCP_GATEWAY_TOKEN_ACTIONS = [
|
|
"tools/list",
|
|
"tools/call",
|
|
"resources/list",
|
|
"resources/read",
|
|
"prompts/list",
|
|
"prompts/get",
|
|
] as const;
|
|
export type ToolMcpGatewayTokenAction = (typeof TOOL_MCP_GATEWAY_TOKEN_ACTIONS)[number];
|
|
|
|
export const CONNECTION_TOKEN_ISSUANCE_PATHS = ["exchange", "oauth_access", "static"] as const;
|
|
export type ConnectionTokenIssuancePath = (typeof CONNECTION_TOKEN_ISSUANCE_PATHS)[number];
|
|
|
|
export const CONNECTION_TOKEN_ISSUANCE_OUTCOMES = [
|
|
"success",
|
|
"denied",
|
|
"rate_limited",
|
|
"use_env_lease",
|
|
"upstream_error",
|
|
"failure",
|
|
] as const;
|
|
export type ConnectionTokenIssuanceOutcome = (typeof CONNECTION_TOKEN_ISSUANCE_OUTCOMES)[number];
|
|
|
|
export const TOOL_POLICY_TYPES = [
|
|
"allow",
|
|
"block",
|
|
"require_approval",
|
|
"trust_rule",
|
|
"rate_limit",
|
|
] as const;
|
|
export type ToolPolicyType = (typeof TOOL_POLICY_TYPES)[number];
|
|
|
|
export const TOOL_POLICY_DECISIONS = ["allow", "deny", "require_approval", "rate_limited", "defer_runtime"] as const;
|
|
export type ToolPolicyDecision = (typeof TOOL_POLICY_DECISIONS)[number];
|
|
|
|
export const TOOL_INVOCATION_STATUSES = [
|
|
"pending",
|
|
"authorized",
|
|
"denied",
|
|
"awaiting_approval",
|
|
"executing",
|
|
"succeeded",
|
|
"failed",
|
|
"cancelled",
|
|
"timed_out",
|
|
"rate_limited",
|
|
] as const;
|
|
export type ToolInvocationStatus = (typeof TOOL_INVOCATION_STATUSES)[number];
|
|
|
|
export const TOOL_INVOCATION_APPROVAL_STATES = [
|
|
"not_required",
|
|
"required",
|
|
"pending",
|
|
"approved",
|
|
"rejected",
|
|
"expired",
|
|
] as const;
|
|
export type ToolInvocationApprovalState = (typeof TOOL_INVOCATION_APPROVAL_STATES)[number];
|
|
|
|
export const TOOL_ACTION_REQUEST_STATUSES = [
|
|
"pending",
|
|
"approved",
|
|
"executing",
|
|
"rejected",
|
|
"expired",
|
|
"cancelled",
|
|
"executed",
|
|
"failed",
|
|
] as const;
|
|
export type ToolActionRequestStatus = (typeof TOOL_ACTION_REQUEST_STATUSES)[number];
|
|
|
|
export const TOOL_AUDIT_EVENT_TYPES = [
|
|
"discovery",
|
|
"policy_decision",
|
|
"invocation_created",
|
|
"call_started",
|
|
"call_completed",
|
|
"call_failed",
|
|
"call_denied",
|
|
"approval_requested",
|
|
"approval_resolved",
|
|
"session_revoked",
|
|
"trust_rule_created",
|
|
"trust_rule_revoked",
|
|
"trust_rule_used",
|
|
"runtime_started",
|
|
"runtime_stopped",
|
|
"rate_limited",
|
|
] as const;
|
|
export type ToolAuditEventType = (typeof TOOL_AUDIT_EVENT_TYPES)[number];
|
|
|
|
export const TOOL_AUDIT_OUTCOMES = ["pending", "success", "failure", "denied", "timeout", "cancelled"] as const;
|
|
export type ToolAuditOutcome = (typeof TOOL_AUDIT_OUTCOMES)[number];
|
|
|
|
/**
|
|
* Connection-level lifecycle events surfaced on the per-app Activity tab
|
|
* alongside tool-call events (PAP-11284). These are derived from the
|
|
* company activity log rows scoped to a single tool connection.
|
|
*/
|
|
export const TOOL_CONNECTION_LIFECYCLE_EVENT_TYPES = [
|
|
"app_connected",
|
|
"app_paused",
|
|
"app_resumed",
|
|
"allowlist_changed",
|
|
"reconnected",
|
|
"disconnected",
|
|
"actions_quarantined",
|
|
] as const;
|
|
export type ToolConnectionLifecycleEventType = (typeof TOOL_CONNECTION_LIFECYCLE_EVENT_TYPES)[number];
|
|
|
|
export const TOOL_RUNTIME_KINDS = ["remote_session", "local_stdio"] as const;
|
|
export type ToolRuntimeKind = (typeof TOOL_RUNTIME_KINDS)[number];
|
|
|
|
export const TOOL_RUNTIME_SLOT_STATUSES = ["starting", "running", "idle", "stopped", "failed", "disabled", "error"] as const;
|
|
export type ToolRuntimeSlotStatus = (typeof TOOL_RUNTIME_SLOT_STATUSES)[number];
|
|
|
|
export const TOOL_RATE_LIMIT_WINDOW_KINDS = ["minute", "hour", "day", "month"] as const;
|
|
export type ToolRateLimitWindowKind = (typeof TOOL_RATE_LIMIT_WINDOW_KINDS)[number];
|
|
|
|
export const TOOL_ACCESS_ACTIVITY_ACTIONS = [
|
|
"tool_application.created",
|
|
"tool_application.updated",
|
|
"tool_application.archived",
|
|
"tool_connection.created",
|
|
"tool_connection.updated",
|
|
"tool_connection.tested",
|
|
"tool_connection.catalog_refreshed",
|
|
"tool_profile.created",
|
|
"tool_profile.updated",
|
|
"tool_profile.duplicated",
|
|
"tool_profile.deleted",
|
|
"tool_profile.new_tools_reviewed",
|
|
"tool_profile.bound",
|
|
"tool_profile.unbound",
|
|
"tool_policy.created",
|
|
"tool_policy.updated",
|
|
"tool_policy.disabled",
|
|
"tool_trust_rule.created",
|
|
"tool_trust_rule.revoked",
|
|
"tool_runtime_slot.started",
|
|
"tool_runtime_slot.stopped",
|
|
"tool_action_request.created",
|
|
"tool_action_request.resolved",
|
|
] as const;
|
|
export type ToolAccessActivityAction = (typeof TOOL_ACCESS_ACTIVITY_ACTIONS)[number];
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Plugin System — see doc/plugins/PLUGIN_SPEC.md for the full specification
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/**
|
|
* The current version of the Plugin API contract.
|
|
*
|
|
* Increment this value whenever a breaking change is made to the plugin API
|
|
* so that the host can reject incompatible plugin manifests.
|
|
*
|
|
* @see PLUGIN_SPEC.md §4 — Versioning
|
|
*/
|
|
export const PLUGIN_API_VERSION = 1 as const;
|
|
|
|
/**
|
|
* Lifecycle statuses for an installed plugin.
|
|
*
|
|
* State machine: installed → ready | error, ready → disabled | error | upgrade_pending | uninstalled,
|
|
* disabled → ready | uninstalled, error → ready | uninstalled,
|
|
* upgrade_pending → ready | error | uninstalled, uninstalled → installed (reinstall).
|
|
*
|
|
* @see {@link PluginStatus} — inferred union type
|
|
* @see PLUGIN_SPEC.md §21.3 `plugins.status`
|
|
*/
|
|
export const PLUGIN_STATUSES = [
|
|
"installed",
|
|
"ready",
|
|
"disabled",
|
|
"error",
|
|
"upgrade_pending",
|
|
"uninstalled",
|
|
] as const;
|
|
export type PluginStatus = (typeof PLUGIN_STATUSES)[number];
|
|
|
|
/**
|
|
* Plugin classification categories. A plugin declares one or more categories
|
|
* in its manifest to describe its primary purpose.
|
|
*
|
|
* @see PLUGIN_SPEC.md §6.2
|
|
*/
|
|
export const PLUGIN_CATEGORIES = [
|
|
"connector",
|
|
"workspace",
|
|
"automation",
|
|
"ui",
|
|
] as const;
|
|
export type PluginCategory = (typeof PLUGIN_CATEGORIES)[number];
|
|
|
|
/**
|
|
* Named permissions the host grants to a plugin. Plugins declare required
|
|
* capabilities in their manifest; the host enforces them at runtime via the
|
|
* plugin capability validator.
|
|
*
|
|
* Grouped into: Data Read, Data Write, Plugin State, Runtime/Integration,
|
|
* Agent Tools, and UI.
|
|
*
|
|
* @see PLUGIN_SPEC.md §15 — Capability Model
|
|
*/
|
|
export const PLUGIN_CAPABILITIES = [
|
|
// Data Read
|
|
"companies.read",
|
|
"projects.read",
|
|
"project.workspaces.read",
|
|
"execution.workspaces.read",
|
|
"issues.read",
|
|
"issue.relations.read",
|
|
"issue.subtree.read",
|
|
"issue.comments.read",
|
|
// Read pending issue-thread interactions (decision cards) on an issue.
|
|
"issue.interactions.read",
|
|
// Read issue attachment metadata and, via the capability-scoped host
|
|
// bridge, attachment content bytes (bytes-only, company-scoped, audit-logged).
|
|
"issue.attachments.read",
|
|
// Read company approvals (list + get). The host redacts approval payloads to
|
|
// match the web app's own approval read surface.
|
|
"approvals.read",
|
|
"issue.documents.read",
|
|
"agents.read",
|
|
"goals.read",
|
|
"goals.create",
|
|
"goals.update",
|
|
"activity.read",
|
|
"costs.read",
|
|
"issues.orchestration.read",
|
|
"access.members.read",
|
|
"access.invites.read",
|
|
"authorization.grants.read",
|
|
"authorization.policies.read",
|
|
"authorization.audit.read",
|
|
"database.namespace.read",
|
|
// Data Write
|
|
"issues.create",
|
|
"issues.update",
|
|
"issue.relations.write",
|
|
"issues.checkout",
|
|
"issues.wakeup",
|
|
"issue.comments.create",
|
|
"issue.comments.create_human_attributed",
|
|
"issue.interactions.create",
|
|
// Respond to (accept/reject) an issue-thread interaction on behalf of a
|
|
// paired board user. Impersonation surface: the host independently
|
|
// re-verifies the actor is an active human member of the company at apply
|
|
// time (never trusts plugin-supplied identity), matching the web app's
|
|
// board-only interaction resolve route.
|
|
"issue.interactions.respond",
|
|
// Decide (approve/reject) a company approval on behalf of a paired board
|
|
// user. Same apply-time active-human-member re-verification as above; the
|
|
// web app's approval decision routes are board-only.
|
|
"approvals.respond",
|
|
"issue.documents.write",
|
|
"projects.managed",
|
|
"routines.managed",
|
|
"skills.managed",
|
|
"agents.pause",
|
|
"agents.resume",
|
|
"agents.invoke",
|
|
"agents.managed",
|
|
"access.members.write",
|
|
"access.invites.write",
|
|
"authorization.grants.write",
|
|
"authorization.policies.write",
|
|
"agent.sessions.create",
|
|
"agent.sessions.list",
|
|
"agent.sessions.send",
|
|
"agent.sessions.close",
|
|
"activity.log.write",
|
|
"metrics.write",
|
|
"telemetry.track",
|
|
"database.namespace.migrate",
|
|
"database.namespace.write",
|
|
"external.objects.detect",
|
|
"external.objects.read",
|
|
"external.objects.write",
|
|
"external.objects.refresh",
|
|
// Plugin State
|
|
"plugin.state.read",
|
|
"plugin.state.write",
|
|
// Runtime / Integration
|
|
"events.subscribe",
|
|
"events.emit",
|
|
"jobs.schedule",
|
|
"webhooks.receive",
|
|
"api.routes.register",
|
|
"http.outbound",
|
|
"secrets.read-ref",
|
|
"environment.drivers.register",
|
|
"local.folders",
|
|
// Agent Tools
|
|
"agent.tools.register",
|
|
// UI
|
|
"instance.settings.register",
|
|
"ui.sidebar.register",
|
|
"ui.page.register",
|
|
"ui.detailTab.register",
|
|
"ui.dashboardWidget.register",
|
|
"ui.commentAnnotation.register",
|
|
"ui.action.register",
|
|
] as const;
|
|
export type PluginCapability = (typeof PLUGIN_CAPABILITIES)[number];
|
|
|
|
export const PLUGIN_DATABASE_NAMESPACE_MODES = ["schema"] as const;
|
|
export type PluginDatabaseNamespaceMode = (typeof PLUGIN_DATABASE_NAMESPACE_MODES)[number];
|
|
|
|
export const PLUGIN_DATABASE_NAMESPACE_STATUSES = [
|
|
"active",
|
|
"migration_failed",
|
|
] as const;
|
|
export type PluginDatabaseNamespaceStatus = (typeof PLUGIN_DATABASE_NAMESPACE_STATUSES)[number];
|
|
|
|
export const PLUGIN_DATABASE_MIGRATION_STATUSES = [
|
|
"applied",
|
|
"failed",
|
|
] as const;
|
|
export type PluginDatabaseMigrationStatus = (typeof PLUGIN_DATABASE_MIGRATION_STATUSES)[number];
|
|
|
|
export const PLUGIN_DATABASE_CORE_READ_TABLES = [
|
|
"companies",
|
|
"projects",
|
|
"goals",
|
|
"agents",
|
|
"issues",
|
|
"issue_documents",
|
|
"issue_relations",
|
|
"issue_comments",
|
|
"heartbeat_runs",
|
|
"cost_events",
|
|
"approvals",
|
|
"issue_approvals",
|
|
"budget_incidents",
|
|
] as const;
|
|
export type PluginDatabaseCoreReadTable = (typeof PLUGIN_DATABASE_CORE_READ_TABLES)[number];
|
|
|
|
export const PLUGIN_API_ROUTE_METHODS = ["GET", "POST", "PATCH", "DELETE"] as const;
|
|
export type PluginApiRouteMethod = (typeof PLUGIN_API_ROUTE_METHODS)[number];
|
|
|
|
export const PLUGIN_API_ROUTE_AUTH_MODES = ["board", "agent", "board-or-agent", "webhook"] as const;
|
|
export type PluginApiRouteAuthMode = (typeof PLUGIN_API_ROUTE_AUTH_MODES)[number];
|
|
|
|
export const PLUGIN_API_ROUTE_CHECKOUT_POLICIES = [
|
|
"none",
|
|
"required-for-agent-in-progress",
|
|
"always-for-agent",
|
|
] as const;
|
|
export type PluginApiRouteCheckoutPolicy = (typeof PLUGIN_API_ROUTE_CHECKOUT_POLICIES)[number];
|
|
|
|
/**
|
|
* UI extension slot types. Each slot type corresponds to a mount point in the
|
|
* Paperclip UI where plugin components can be rendered.
|
|
*
|
|
* @see PLUGIN_SPEC.md §19 — UI Extension Model
|
|
*/
|
|
export const PLUGIN_UI_SLOT_TYPES = [
|
|
"page",
|
|
"detailTab",
|
|
"taskDetailView",
|
|
"dashboardWidget",
|
|
"sidebar",
|
|
"routeSidebar",
|
|
"sidebarPanel",
|
|
"projectSidebarItem",
|
|
"globalToolbarButton",
|
|
"toolbarButton",
|
|
"contextMenuItem",
|
|
"commentAnnotation",
|
|
"commentContextMenuItem",
|
|
"settingsPage",
|
|
"companySettingsPage",
|
|
] as const;
|
|
export type PluginUiSlotType = (typeof PLUGIN_UI_SLOT_TYPES)[number];
|
|
|
|
export const WORKSPACE_OVERVIEW_DEFAULT_LIMIT = 50;
|
|
export const WORKSPACE_OVERVIEW_MAX_LIMIT = 100;
|
|
export const WORKSPACE_OVERVIEW_LINKED_ISSUE_LIMIT = 4;
|
|
|
|
/**
|
|
* Reserved company-scoped route segments that plugin page routes may not claim.
|
|
*
|
|
* These map to first-class host pages under `/:companyPrefix/...`.
|
|
*/
|
|
export const PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS = [
|
|
"dashboard",
|
|
"onboarding",
|
|
"companies",
|
|
"company",
|
|
"settings",
|
|
"plugins",
|
|
"org",
|
|
"agents",
|
|
"projects",
|
|
"issues",
|
|
"goals",
|
|
"approvals",
|
|
"costs",
|
|
"activity",
|
|
"inbox",
|
|
"workspaces",
|
|
"design-guide",
|
|
"tests",
|
|
] as const;
|
|
export type PluginReservedCompanyRouteSegment =
|
|
(typeof PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS)[number];
|
|
|
|
/**
|
|
* Reserved route segments under `/:companyPrefix/company/settings/...` that
|
|
* plugin company settings pages may not claim.
|
|
*/
|
|
export const PLUGIN_RESERVED_COMPANY_SETTINGS_ROUTE_SEGMENTS = [
|
|
"general",
|
|
"environments",
|
|
"access",
|
|
"members",
|
|
"invites",
|
|
"secrets",
|
|
"instance",
|
|
] as const;
|
|
export type PluginReservedCompanySettingsRouteSegment =
|
|
(typeof PLUGIN_RESERVED_COMPANY_SETTINGS_ROUTE_SEGMENTS)[number];
|
|
|
|
/**
|
|
* Launcher placement zones describe where a plugin-owned launcher can appear
|
|
* in the host UI. These are intentionally aligned with current slot surfaces
|
|
* so manifest authors can describe launch intent without coupling to a single
|
|
* component implementation detail.
|
|
*/
|
|
export const PLUGIN_LAUNCHER_PLACEMENT_ZONES = [
|
|
"page",
|
|
"detailTab",
|
|
"taskDetailView",
|
|
"dashboardWidget",
|
|
"sidebar",
|
|
"sidebarPanel",
|
|
"projectSidebarItem",
|
|
"globalToolbarButton",
|
|
"toolbarButton",
|
|
"contextMenuItem",
|
|
"commentAnnotation",
|
|
"commentContextMenuItem",
|
|
"settingsPage",
|
|
] as const;
|
|
export type PluginLauncherPlacementZone = (typeof PLUGIN_LAUNCHER_PLACEMENT_ZONES)[number];
|
|
|
|
/**
|
|
* Launcher action kinds describe what the launcher does when activated.
|
|
*/
|
|
export const PLUGIN_LAUNCHER_ACTIONS = [
|
|
"navigate",
|
|
"openModal",
|
|
"openDrawer",
|
|
"openPopover",
|
|
"performAction",
|
|
"deepLink",
|
|
] as const;
|
|
export type PluginLauncherAction = (typeof PLUGIN_LAUNCHER_ACTIONS)[number];
|
|
|
|
/**
|
|
* Optional size hints the host can use when rendering plugin-owned launcher
|
|
* destinations such as overlays, drawers, or full page handoffs.
|
|
*/
|
|
export const PLUGIN_LAUNCHER_BOUNDS = [
|
|
"inline",
|
|
"compact",
|
|
"default",
|
|
"wide",
|
|
"full",
|
|
] as const;
|
|
export type PluginLauncherBounds = (typeof PLUGIN_LAUNCHER_BOUNDS)[number];
|
|
|
|
/**
|
|
* Render environments describe the container a launcher expects after it is
|
|
* activated. The current host may map these to concrete UI primitives.
|
|
*/
|
|
export const PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS = [
|
|
"hostInline",
|
|
"hostOverlay",
|
|
"hostRoute",
|
|
"external",
|
|
"iframe",
|
|
] as const;
|
|
export type PluginLauncherRenderEnvironment =
|
|
(typeof PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS)[number];
|
|
|
|
/**
|
|
* Entity types that a `detailTab` UI slot can attach to.
|
|
*
|
|
* @see PLUGIN_SPEC.md §19.3 — Detail Tabs
|
|
*/
|
|
export const PLUGIN_UI_SLOT_ENTITY_TYPES = [
|
|
"project",
|
|
"issue",
|
|
"agent",
|
|
"goal",
|
|
"run",
|
|
"comment",
|
|
"execution_workspace",
|
|
"project_workspace",
|
|
] as const;
|
|
export type PluginUiSlotEntityType = (typeof PLUGIN_UI_SLOT_ENTITY_TYPES)[number];
|
|
|
|
/**
|
|
* Scope kinds for plugin state storage. Determines the granularity at which
|
|
* a plugin stores key-value state data.
|
|
*
|
|
* @see PLUGIN_SPEC.md §21.3 `plugin_state.scope_kind`
|
|
*/
|
|
export const PLUGIN_STATE_SCOPE_KINDS = [
|
|
"instance",
|
|
"company",
|
|
"project",
|
|
"project_workspace",
|
|
"agent",
|
|
"issue",
|
|
"goal",
|
|
"run",
|
|
] as const;
|
|
export type PluginStateScopeKind = (typeof PLUGIN_STATE_SCOPE_KINDS)[number];
|
|
|
|
/** Statuses for a plugin's scheduled job definition. */
|
|
export const PLUGIN_JOB_STATUSES = [
|
|
"active",
|
|
"paused",
|
|
"failed",
|
|
] as const;
|
|
export type PluginJobStatus = (typeof PLUGIN_JOB_STATUSES)[number];
|
|
|
|
/** Statuses for individual job run executions. */
|
|
export const PLUGIN_JOB_RUN_STATUSES = [
|
|
"pending",
|
|
"queued",
|
|
"running",
|
|
"succeeded",
|
|
"failed",
|
|
"cancelled",
|
|
] as const;
|
|
export type PluginJobRunStatus = (typeof PLUGIN_JOB_RUN_STATUSES)[number];
|
|
|
|
/** What triggered a particular job run. */
|
|
export const PLUGIN_JOB_RUN_TRIGGERS = [
|
|
"schedule",
|
|
"manual",
|
|
"retry",
|
|
] as const;
|
|
export type PluginJobRunTrigger = (typeof PLUGIN_JOB_RUN_TRIGGERS)[number];
|
|
|
|
/** Statuses for inbound webhook deliveries. */
|
|
export const PLUGIN_WEBHOOK_DELIVERY_STATUSES = [
|
|
"pending",
|
|
"success",
|
|
"failed",
|
|
] as const;
|
|
export type PluginWebhookDeliveryStatus = (typeof PLUGIN_WEBHOOK_DELIVERY_STATUSES)[number];
|
|
|
|
/**
|
|
* Core domain event types that plugins can subscribe to via the
|
|
* `events.subscribe` capability.
|
|
*
|
|
* @see PLUGIN_SPEC.md §16 — Event System
|
|
*/
|
|
export const PLUGIN_EVENT_TYPES = [
|
|
"company.created",
|
|
"company.updated",
|
|
"project.created",
|
|
"project.updated",
|
|
"project.workspace_created",
|
|
"project.workspace_updated",
|
|
"project.workspace_deleted",
|
|
"issue.created",
|
|
"issue.updated",
|
|
"issue.comment.created",
|
|
"issue.document.created",
|
|
"issue.document.updated",
|
|
"issue.document.deleted",
|
|
"issue.relations.updated",
|
|
"issue.checked_out",
|
|
"issue.released",
|
|
"issue.assignment_wakeup_requested",
|
|
"agent.created",
|
|
"agent.updated",
|
|
"agent.status_changed",
|
|
"agent.error_cleared",
|
|
"agent.run.started",
|
|
"agent.run.finished",
|
|
"agent.run.failed",
|
|
"agent.run.cancelled",
|
|
"goal.created",
|
|
"goal.updated",
|
|
"approval.created",
|
|
"approval.decided",
|
|
"budget.incident.opened",
|
|
"budget.incident.resolved",
|
|
"cost_event.created",
|
|
"activity.logged",
|
|
] as const;
|
|
export type PluginEventType = (typeof PLUGIN_EVENT_TYPES)[number];
|
|
|
|
/**
|
|
* Error codes returned by the plugin bridge when a UI → worker call fails.
|
|
*
|
|
* @see PLUGIN_SPEC.md §19.7 — Error Propagation Through The Bridge
|
|
*/
|
|
export const PLUGIN_BRIDGE_ERROR_CODES = [
|
|
"WORKER_UNAVAILABLE",
|
|
"CAPABILITY_DENIED",
|
|
"INVOCATION_SCOPE_DENIED",
|
|
"WORKER_ERROR",
|
|
"TIMEOUT",
|
|
"UNKNOWN",
|
|
] as const;
|
|
export type PluginBridgeErrorCode = (typeof PLUGIN_BRIDGE_ERROR_CODES)[number];
|