@useconvoy/cli 0.114.0 → 0.123.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/marketplace/convoy/skills/convoy/SKILL.md +1 -0
  2. package/dist/marketplace/convoy/skills/convoy/references/inline-html.md +101 -0
  3. package/dist/src/agent/app/runner.d.ts +5 -1
  4. package/dist/src/agent/app/runner.js +7 -2
  5. package/dist/src/agent/app/runner.js.map +1 -1
  6. package/dist/src/agent/runtimes/agent-instructions.js +2 -1
  7. package/dist/src/agent/runtimes/agent-instructions.js.map +1 -1
  8. package/dist/src/agent/runtimes/claudeCode/runner.js +56 -1
  9. package/dist/src/agent/runtimes/claudeCode/runner.js.map +1 -1
  10. package/dist/src/agent/runtimes/contracts.d.ts +6 -1
  11. package/dist/src/agent/runtimes/cursor/detect.d.ts +5 -0
  12. package/dist/src/agent/runtimes/cursor/detect.js +20 -5
  13. package/dist/src/agent/runtimes/cursor/detect.js.map +1 -1
  14. package/dist/src/agent/runtimes/cursor/runner.d.ts +7 -2
  15. package/dist/src/agent/runtimes/cursor/runner.js +25 -4
  16. package/dist/src/agent/runtimes/cursor/runner.js.map +1 -1
  17. package/dist/src/agent/runtimes/cursor/runtime.js +1 -1
  18. package/dist/src/agent/runtimes/cursor/runtime.js.map +1 -1
  19. package/dist/src/agent/runtimes/opencode/client.d.ts +9 -0
  20. package/dist/src/agent/runtimes/opencode/client.js +5 -0
  21. package/dist/src/agent/runtimes/opencode/client.js.map +1 -1
  22. package/dist/src/agent/runtimes/opencode/detect.d.ts +10 -2
  23. package/dist/src/agent/runtimes/opencode/detect.js +8 -28
  24. package/dist/src/agent/runtimes/opencode/detect.js.map +1 -1
  25. package/dist/src/agent/runtimes/opencode/runner.d.ts +4 -1
  26. package/dist/src/agent/runtimes/opencode/runner.js +22 -2
  27. package/dist/src/agent/runtimes/opencode/runner.js.map +1 -1
  28. package/dist/src/agent/runtimes/opencode/runtime.js +2 -2
  29. package/dist/src/agent/runtimes/opencode/runtime.js.map +1 -1
  30. package/dist/src/agent/runtimes/opencode/server.d.ts +17 -2
  31. package/dist/src/agent/runtimes/opencode/server.js +92 -12
  32. package/dist/src/agent/runtimes/opencode/server.js.map +1 -1
  33. package/dist/src/agent/runtimes/registry.js +2 -1
  34. package/dist/src/agent/runtimes/registry.js.map +1 -1
  35. package/dist/src/commands/browser/workflow.js +6 -0
  36. package/dist/src/commands/browser/workflow.js.map +1 -1
  37. package/dist/src/commands/connect/workflow.d.ts +3 -1
  38. package/dist/src/commands/connect/workflow.js +6 -2
  39. package/dist/src/commands/connect/workflow.js.map +1 -1
  40. package/dist/src/commands/environment/command.js +1 -7
  41. package/dist/src/commands/environment/command.js.map +1 -1
  42. package/dist/src/commands/environment/index.d.ts +52 -0
  43. package/dist/src/commands/environment/index.js +2 -1
  44. package/dist/src/commands/environment/index.js.map +1 -1
  45. package/dist/src/commands/environment/paths.d.ts +2 -0
  46. package/dist/src/commands/environment/paths.js +4 -0
  47. package/dist/src/commands/environment/paths.js.map +1 -1
  48. package/dist/src/commands/environment/workflow.js +3 -0
  49. package/dist/src/commands/environment/workflow.js.map +1 -1
  50. package/dist/src/commands/keys/command.js +42 -19
  51. package/dist/src/commands/keys/command.js.map +1 -1
  52. package/dist/src/commands/keys/workflow.d.ts +43 -1
  53. package/dist/src/commands/keys/workflow.js +46 -18
  54. package/dist/src/commands/keys/workflow.js.map +1 -1
  55. package/dist/src/commands/project/command.js +12 -4
  56. package/dist/src/commands/project/command.js.map +1 -1
  57. package/dist/src/commands/project/formatters.js +17 -6
  58. package/dist/src/commands/project/formatters.js.map +1 -1
  59. package/dist/src/commands/project/launcher.d.ts +23 -0
  60. package/dist/src/commands/project/launcher.js +7 -5
  61. package/dist/src/commands/project/launcher.js.map +1 -1
  62. package/dist/src/commands/project/validators.d.ts +84 -1
  63. package/dist/src/commands/project/validators.js +12 -5
  64. package/dist/src/commands/project/validators.js.map +1 -1
  65. package/dist/src/commands/project/workflow.d.ts +12 -0
  66. package/dist/src/commands/project/workflow.js +10 -1
  67. package/dist/src/commands/project/workflow.js.map +1 -1
  68. package/dist/src/commands/remote/command.d.ts +1 -1
  69. package/dist/src/commands/remote/command.js +31 -8
  70. package/dist/src/commands/remote/command.js.map +1 -1
  71. package/dist/src/commands/remote/index.d.ts +1 -0
  72. package/dist/src/commands/remote/index.js +1 -0
  73. package/dist/src/commands/remote/index.js.map +1 -1
  74. package/dist/src/commands/remote/resolution.d.ts +11 -0
  75. package/dist/src/commands/remote/resolution.js +16 -0
  76. package/dist/src/commands/remote/resolution.js.map +1 -0
  77. package/dist/src/commands/remote/workflow.d.ts +52 -0
  78. package/dist/src/commands/remote/workflow.js +2 -1
  79. package/dist/src/commands/remote/workflow.js.map +1 -1
  80. package/dist/src/commands/service/resolution.js +2 -4
  81. package/dist/src/commands/service/resolution.js.map +1 -1
  82. package/dist/src/commands/service/server.js +1 -1
  83. package/dist/src/commands/service/server.js.map +1 -1
  84. package/dist/src/commands/service/validators.d.ts +136 -2
  85. package/dist/src/commands/service/workflow.js +2 -1
  86. package/dist/src/commands/service/workflow.js.map +1 -1
  87. package/dist/src/commands/threads/attach.js +8 -2
  88. package/dist/src/commands/threads/attach.js.map +1 -1
  89. package/dist/src/commands/tui/actions/app.js +8 -4
  90. package/dist/src/commands/tui/actions/app.js.map +1 -1
  91. package/dist/src/commands/tui/app.js +74 -34
  92. package/dist/src/commands/tui/app.js.map +1 -1
  93. package/dist/src/commands/tui/credentials/app.js +111 -47
  94. package/dist/src/commands/tui/credentials/app.js.map +1 -1
  95. package/dist/src/commands/tui/credentials/formatters.d.ts +2 -3
  96. package/dist/src/commands/tui/credentials/formatters.js +7 -8
  97. package/dist/src/commands/tui/credentials/formatters.js.map +1 -1
  98. package/dist/src/commands/tui/credentials/index.d.ts +1 -0
  99. package/dist/src/commands/tui/credentials/index.js +1 -0
  100. package/dist/src/commands/tui/credentials/index.js.map +1 -1
  101. package/dist/src/commands/tui/credentials/validators.d.ts +2 -4
  102. package/dist/src/commands/tui/credentials/workflow.d.ts +5 -16
  103. package/dist/src/commands/tui/credentials/workflow.js +11 -6
  104. package/dist/src/commands/tui/credentials/workflow.js.map +1 -1
  105. package/dist/src/commands/tui/dialog/app.d.ts +3 -1
  106. package/dist/src/commands/tui/dialog/app.js +5 -3
  107. package/dist/src/commands/tui/dialog/app.js.map +1 -1
  108. package/dist/src/commands/tui/environments/app.js +19 -9
  109. package/dist/src/commands/tui/environments/app.js.map +1 -1
  110. package/dist/src/commands/tui/formatters.d.ts +7 -0
  111. package/dist/src/commands/tui/formatters.js +20 -0
  112. package/dist/src/commands/tui/formatters.js.map +1 -1
  113. package/dist/src/commands/tui/onboarding/app.js +22 -9
  114. package/dist/src/commands/tui/onboarding/app.js.map +1 -1
  115. package/dist/src/commands/tui/onboarding/formatters.js +1 -1
  116. package/dist/src/commands/tui/onboarding/formatters.js.map +1 -1
  117. package/dist/src/commands/tui/onboarding/index.d.ts +1 -0
  118. package/dist/src/commands/tui/onboarding/runtime-access.d.ts +8 -0
  119. package/dist/src/commands/tui/onboarding/runtime-access.js +194 -0
  120. package/dist/src/commands/tui/onboarding/runtime-access.js.map +1 -0
  121. package/dist/src/commands/tui/onboarding/validators.d.ts +14 -0
  122. package/dist/src/commands/tui/onboarding/validators.js +2 -0
  123. package/dist/src/commands/tui/onboarding/validators.js.map +1 -0
  124. package/dist/src/commands/tui/onboarding/workflow.d.ts +11 -0
  125. package/dist/src/commands/tui/onboarding/workflow.js +4 -0
  126. package/dist/src/commands/tui/onboarding/workflow.js.map +1 -1
  127. package/dist/src/commands/tui/resolution.d.ts +2 -1
  128. package/dist/src/commands/tui/resolution.js +3 -1
  129. package/dist/src/commands/tui/resolution.js.map +1 -1
  130. package/dist/src/commands/tui/workflow.d.ts +128 -1
  131. package/dist/src/commands/tui/workflow.js +46 -1
  132. package/dist/src/commands/tui/workflow.js.map +1 -1
  133. package/dist/src/convex/_generated/ai/ai-files.state.json +5 -4
  134. package/dist/src/convex/_generated/ai/guidelines.md +185 -270
  135. package/dist/src/lib/config/credentials/resolution.d.ts +11 -3
  136. package/dist/src/lib/config/credentials/resolution.js +101 -25
  137. package/dist/src/lib/config/credentials/resolution.js.map +1 -1
  138. package/dist/src/lib/config/credentials/store.js +5 -3
  139. package/dist/src/lib/config/credentials/store.js.map +1 -1
  140. package/dist/src/lib/config/credentials/validators.d.ts +176 -2
  141. package/dist/src/lib/config/credentials/validators.js +47 -7
  142. package/dist/src/lib/config/credentials/validators.js.map +1 -1
  143. package/dist/src/lib/config/provider-keys.d.ts +6 -1
  144. package/dist/src/lib/config/provider-keys.js +20 -3
  145. package/dist/src/lib/config/provider-keys.js.map +1 -1
  146. package/dist/src/lib/content-type.js +10 -1
  147. package/dist/src/lib/content-type.js.map +1 -1
  148. package/dist/templates/devcontainer/Dockerfile +4 -0
  149. package/dist/templates/devcontainer/README.md +2 -0
  150. package/dist/templates/devcontainer/devcontainer.json +1 -1
  151. package/dist/templates/project-isolation/Dockerfile +13 -1
  152. package/dist/templates/project-isolation/README.md +31 -1
  153. package/dist/templates/project-isolation/devcontainer.json +1 -1
  154. package/dist/templates/project-isolation/environment.py +8 -0
  155. package/dist/templates/project-isolation/environment.test.py +12 -0
  156. package/dist/templates/project-isolation/install.py +1 -1
  157. package/dist/templates/project-isolation/launcher.py +119 -14
  158. package/dist/templates/project-isolation/launcher.test.py +98 -5
  159. package/package.json +2 -1
  160. package/dist/templates/project-isolation/__pycache__/install.cpython-311.pyc +0 -0
  161. package/dist/templates/project-isolation/__pycache__/launcher.cpython-311.pyc +0 -0
@@ -1,12 +1,134 @@
1
1
  # Convex guidelines
2
2
 
3
- These guidelines target Convex `^1.41.0`.
3
+ These guidelines target Convex `^1.44.0`.
4
4
 
5
5
  ## Function guidelines
6
6
 
7
- ### Http endpoint syntax
7
+ ### HTTP endpoints
8
8
 
9
- - HTTP endpoints are defined in `convex/http.ts` and require an `httpAction` decorator. For example:
9
+ - Define HTTP endpoints in `convex/http.ts` with `httpRouter` and an `httpAction` handler. Routes are registered at the exact `path` supplied.
10
+ - Treat `await req.json()` as `unknown`; narrow each field (e.g. `typeof` checks) before use, and return HTTP 400 for bodies that fail validation.
11
+
12
+ ### Validators
13
+
14
+ - Use `v.array`, `v.union`, `v.object`, `v.record`, and the other validators from `convex/values` for function arguments and schemas. `v.object` supports `.pick("a", "b")`, `.omit("c")`, `.partial()`, and `.extend({ d: v.string() })`; use `.fields` when supplying a function's `args`.
15
+ - For a complete stored-document validator, default-import your authored schema using the correct relative path, e.g. `import schema from "./schema"; schema.doc("users")`. `schema.doc` includes `_id` and `_creationTime` and handles union tables. For a bare table definition, use `import { docValidator } from "convex/server"; docValidator("users", usersTable)`. `convex/server` exports `docValidator`, not `doc`; prefer `schema.doc` when the schema is available. Never import your schema from `_generated`.
16
+ - Convex values are: `v.id(tableName)` for `Id` strings, `v.null()` for `null`, `v.int64()` for `bigint`, `v.number()` for IEEE-754 numbers, `v.boolean()`, `v.string()`, `v.bytes()` for `ArrayBuffer`, `v.array(values)`, `v.object({...})`, and `v.record(keys, values)` for dynamic-key records. `undefined` is not a Convex value and is returned to clients as `null`; use `null`. Arrays have at most 8192 values, objects at most 1024 entries, and strings/bytes/documents have the platform size limits. Object and record keys must be valid nonempty names and cannot start with `$` or `_`.
17
+ - Use `v.literal` members in `v.union` validators for discriminated unions.
18
+
19
+ ### Function registration
20
+
21
+ - Register private functions with `internalQuery`, `internalMutation`, or `internalAction` from `./_generated/server`; register public API functions with `query`, `mutation`, or `action` from the same module. A function used only by your own code, such as an HTTP action's commit mutation, is internal.
22
+ - Never register a function through `api` or `internal`, and always include argument validators for every function kind.
23
+
24
+ ### Function calling
25
+
26
+ - Call queries, mutations, and actions with `ctx.runQuery`, `ctx.runMutation`, and `ctx.runAction` respectively. Pass a `FunctionReference`, never the function itself. Call actions from actions only when crossing runtimes; otherwise call shared code directly.
27
+ - Keep action-to-query/mutation calls few because transactions split across calls can race.
28
+ - Nested `ctx.runQuery` and `ctx.runMutation` calls from a mutation are subtransactions. If a nested call throws, its writes roll back independently and the caller may catch the error and continue its own writes.
29
+ - Convex 1.41+ accepts a third `transactionLimits` argument on nested queries and mutations. These limits can only tighten the caller's global limits. Supported fields are `bytesRead`, `bytesWritten`, `databaseQueries`, `documentsRead`, `documentsWritten`, `functionsScheduled`, and `scheduledFunctionArgsBytes`; a failed nested call rolls back its writes while preserving caller headroom.
30
+ - When using `ctx.runQuery`, `ctx.runMutation`, or `ctx.runAction` to call a function in the same file, specify a type annotation on the return value to work around TypeScript circularity limitations (see the example below). Annotate with what the callee returns; a handler with no return value returns `null`, not `void`.
31
+
32
+ ### Function references
33
+
34
+ - Use `api` from `convex/_generated/api.ts` for functions registered with `query`, `mutation`, or `action`, and `internal` for those registered with `internalQuery`, `internalMutation`, or `internalAction`. File routing maps `convex/example.ts` function `f` to `api.example.f` and private `g` to `internal.example.g`; nested files include every directory segment, such as `api.messages.access.h`.
35
+
36
+ ### Pagination
37
+
38
+ - Validate `paginationOpts` with `paginationOptsValidator` from `convex/server` and pass `args.paginationOpts` unchanged to `.paginate()`. Do not reconstruct it, because optional native behavior would be lost.
39
+ - The native options are `numItems`, required nullable `cursor`, optional `endCursor`, `maximumRowsRead`, `maximumBytesRead`, and client-managed `id`. Read budgets can produce a short page with `splitCursor` and `pageStatus`.
40
+ - A paginated query returns `page`, `isDone`, and `continueCursor`, with optional `splitCursor` and `pageStatus`. Use `paginationResultValidator(itemValidator)` for its return validator.
41
+
42
+ ## Schema guidelines
43
+
44
+ - Define the schema in `convex/schema.ts` and import schema functions from `convex/server`.
45
+ - `_id` and `_creationTime` are automatically added system fields (`v.id(tableName)` and `v.number()`).
46
+ - Include every index field in its name, such as `by_field1_and_field2`; query indexed fields in their declared order, creating separate indexes for another order.
47
+ - Do not put an unbounded list in one document. Use a child table with a foreign key. Keep high-churn heartbeats, online status, and typing indicators in a dedicated table instead of a stable profile document.
48
+ - An index added to a large existing table can block deploy during backfill. Use `.index("by_field", { fields: ["field"], staged: true })`; remove `staged` in a later deploy before querying it.
49
+
50
+ ## Authentication guidelines
51
+
52
+ - JWT authentication requires `convex/auth.config.ts`. Its provider `domain` is the JWT issuer, and `applicationID` is checked against the token audience; without the file, `ctx.auth.getUserIdentity()` is always `null`.
53
+ - Read identity with `ctx.auth.getUserIdentity()` in queries, mutations, and actions. It may be `null`; `tokenIdentifier` is the guaranteed canonical stable identity key, so use it for ownership and auth-linked lookups rather than `subject` alone.
54
+ - Never accept a user ID or other identity argument for authorization; derive it server-side.
55
+ - With an external auth provider, use `ConvexProviderWithAuth` from `convex/react`, whose `useAuth` returns `{ isLoading, isAuthenticated, fetchAccessToken }`. Do not use plain `ConvexProvider` for authenticated requests because it will not send tokens.
56
+
57
+ ## TypeScript guidelines
58
+
59
+ - Import `Id` and `Doc<"tableName">` from `./_generated/dataModel`; use `Id<"users">` instead of `string` for a users-table ID.
60
+ - Type contexts with `QueryCtx`, `MutationCtx`, and `ActionCtx` from `./_generated/server`; never use `any` for a context parameter.
61
+ - Give `Record` both key and value types, such as `Record<Id<"users">, string>`.
62
+ - For typed app environment variables, declare them in `convex/convex.config.ts` with `defineApp({ env: { MY_KEY: v.optional(v.string()) } })` and read `env` from `./_generated/server`, not `process.env`. `CONVEX_SITE_URL` and `CONVEX_CLOUD_URL` are already on `env`; do not redeclare them.
63
+
64
+ ## Full text search guidelines
65
+
66
+ - Use `.withSearchIndex("search_body", q => q.search("body", text).eq("channel", channel))` and then bound results with `.take(n)`.
67
+
68
+ ## Vector search guidelines
69
+
70
+ - Store embeddings as `v.array(v.float64())` and declare a vector index with `vectorField`, exact `dimensions`, and any declared `filterFields`.
71
+ - `ctx.vectorSearch` is available only in actions. Its filter supports equality on declared filter fields and `q.or(...)`, not cross-field AND or inequality; apply remaining predicates after hydration.
72
+ - Results contain only `{ _id, _score }` in descending similarity order. Since actions have no `ctx.db`, hydrate all hits through one internal query, preserve search order, and pair each score with its document ID.
73
+
74
+ ## Component guidelines
75
+
76
+ - Components are installable building blocks such as `@convex-dev/aggregate` and `@convex-dev/rate-limiter`, with isolated tables and functions. Install and mount them in `convex/convex.config.ts`, then `import { components } from "./_generated/api"` and pass e.g. `components.aggregate` to the component client (there is no `ctx.components`).
77
+ - Component functions are not client-facing. Wrap them in app queries/mutations and authorize in the app function first.
78
+ - Component reads and writes participate in the calling mutation's transaction. If a component mirrors an app table, update it in the same mutation as every insert, patch, replace, or delete.
79
+ - A local component has a directory under `convex/`, its own `convex.config.ts` using `defineComponent("myName")`, its own `schema.ts`, and functions from its own `_generated/server`. Mount with `app.use(myName)` and include the module segment in references: a function in `convex/myName/index.ts` is `components.myName.index.myFunction`, never `components.myName.myFunction`.
80
+ - For per-key quotas, cooldowns, or throttling, use `@convex-dev/rate-limiter`; hand-rolled counters and window scans race under concurrency and lose quota when a mutation fails.
81
+ - For chat or assistant features where an LLM replies inside a durable conversation - per-user resumable histories, recorded tool-call steps, several assistants sharing one conversation - use the `@convex-dev/agent` component: mount it, create one component thread per conversation, and generate/read through it (`createThread(ctx, components.agent, ...)`, `new Agent(components.agent, { name, languageModel, tools }).generateText(ctx, { threadId }, { prompt })`, `listMessages`). Do not hand-roll a messages table or call an LLM SDK directly from your functions for these.
82
+ - For async functions needing bounded parallelism, serialized mutation work, or completion callbacks, use `@convex-dev/workpool`; retry only idempotent actions.
83
+ - For ephemeral presence - who is online/viewing/typing in a room, tracked by client heartbeats with session tokens, multi-session aggregation (one entry per user across tabs), and timeout-to-offline - use `@convex-dev/presence`; hand-rolled lastSeen tables need wall-clock query filters that go stale, and per-session rows break the one-entry-per-user contract.
84
+ - A component mutation is a subtransaction. If it throws and the caller catches it, its writes roll back while the caller can continue and commit.
85
+ - To pass a function across a component boundary, mint a handle in the app with `const handle = await createFunctionHandle(internal.index.myCallback)` from `convex/server`; send it as a string, then invoke it with `await ctx.runMutation(args.handle as FunctionHandle<"mutation">, callbackArgs)`. `getFunctionHandle` and `getFunctionName` are not this API.
86
+
87
+ ## Query guidelines
88
+
89
+ - Prefer `.withIndex()` and put every index-supported predicate in the index range. `.filter()` runs after the index scan and does not make an unbounded query scalable.
90
+ - Do not read the wall clock in a query. Pass current time as an argument or materialize time state with scheduled mutations; `Date.now()` is fine in mutations and actions.
91
+ - If the user does not explicitly tell you to return all results from a query you should ALWAYS return a bounded collection instead. So that is instead of using `.collect()` you should use `.take()` or paginate on database queries. This prevents future performance issues when tables grow in an unbounded way.
92
+ - Never use `.collect().length`; Convex has no built-in count operator. A counter document suffices only for a simple total. When queries need counts, sums, ranks/positions, or offsets over many rows, whole-table or within a key range, use `@convex-dev/aggregate` (O(log n) reads), updated in the same mutation as every source-table write.
93
+ - Queries do not support `.delete()`. Read matches in batches or with async iteration and call `ctx.db.delete` for each document.
94
+ - For large mutation work, process a batch and schedule a continuation with `ctx.scheduler.runAfter(0, internal.myModule.myMutation, args)`. For variable document sizes, use async iteration and after each write `await ctx.meta.getTransactionMetrics()`, returning when a needed `.remaining` metric such as `metrics.bytesRead.remaining` reaches a safety reserve.
95
+ - Use `.unique()` for one document; it throws when multiple documents match. With async iteration, use `for await (const row of query)` rather than `.collect()` or `.take(n)`.
96
+
97
+ ### Ordering
98
+
99
+ - Queries default to ascending order over the selected index key; a plain scan uses `by_creation_time`. `.order("asc"|"desc")` selects direction. Index queries follow index columns and append `_creationTime` as a tie-breaker, so do not re-sort equal-key rows in JavaScript.
100
+
101
+ ## Mutation guidelines
102
+
103
+ - Use `ctx.db.replace(table, id, document)` to replace a whole existing document and `ctx.db.patch(table, id, fields)` for a shallow merge. Both throw when the document does not exist.
104
+
105
+ ## Action guidelines
106
+
107
+ - Put `"use node";` at the top of a file containing actions that use Node built-ins. Keep such actions separate from files exporting queries or mutations. `fetch()` works in the default runtime, so it does not require Node.
108
+ - Actions have no `ctx.db`; read and write data through function calls.
109
+
110
+ ## Scheduling guidelines
111
+
112
+ ### Cron guidelines
113
+
114
+ - Use only `crons.interval` or `crons.cron`, and pass a `FunctionReference`, never a function value. Define a top-level `cronJobs()` object and export it as default.
115
+ - Functions may be registered in `crons.ts`. For an internal target, import `internal` from `./_generated/api` even when the target is registered in the same file.
116
+
117
+ ## Testing guidelines
118
+
119
+ - Test Convex functions with `convex-test`, Vitest, and `@edge-runtime/vm`; configure Vitest with `environment: "edge-runtime"` and always install the latest versions of these packages.
120
+ - Test files belong under `convex/`. Pass an `import.meta.glob("./**/*.ts")` module map to `convexTest(schema, modules)` and call functions through generated `api` references.
121
+ - Add `/// <reference types="vite/client" />` only in test files that use `import.meta.glob`.
122
+ - Do not add uninstalled packages to `compilerOptions.types`; leave `types` unset unless the package is installed.
123
+
124
+ ## File storage guidelines
125
+
126
+ - `ctx.storage.getUrl(fileId)` returns a signed URL or `null` when absent. Do not use deprecated `ctx.storage.getMetadata`.
127
+ - Read metadata from the `_storage` system table with `ctx.db.system.get("_storage", fileId)` and an `Id<"_storage">`; storage values are `Blob` objects and must be converted to/from `Blob`.
128
+
129
+ ## Selected reference patterns
130
+
131
+ HTTP endpoints are registered with this shape:
10
132
 
11
133
  ```typescript
12
134
  import { httpRouter } from "convex/server";
@@ -22,112 +144,51 @@ http.route({
22
144
  });
23
145
  ```
24
146
 
25
- - HTTP endpoints are always registered at the exact path you specify in the `path` field. For example, if you specify `/api/someRoute`, the endpoint will be registered at `/api/someRoute`.
26
-
27
- ### Validators
28
-
29
- - Below is an example of an array validator:
147
+ An array validator is:
30
148
 
31
149
  ```typescript
32
150
  import { mutation } from "./_generated/server";
33
151
  import { v } from "convex/values";
34
-
35
- export default mutation({
36
- args: {
37
- simpleArray: v.array(v.union(v.string(), v.number())),
38
- },
39
- handler: async (ctx, args) => {
40
- //...
41
- },
152
+ export const exampleMutation = mutation({
153
+ args: { simpleArray: v.array(v.union(v.string(), v.number())) },
154
+ handler: async (ctx, args) => {},
42
155
  });
43
156
  ```
44
157
 
45
- - Below is an example of a schema with validators that codify a discriminated union type:
158
+ A discriminated union uses `v.union` with `v.literal` members, for example:
46
159
 
47
160
  ```typescript
48
- import { defineSchema, defineTable } from "convex/server";
49
- import { v } from "convex/values";
50
-
51
161
  export default defineSchema({
52
162
  results: defineTable(
53
163
  v.union(
54
- v.object({
55
- kind: v.literal("error"),
56
- errorMessage: v.string(),
57
- }),
58
- v.object({
59
- kind: v.literal("success"),
60
- value: v.number(),
61
- }),
164
+ v.object({ kind: v.literal("error"), errorMessage: v.string() }),
165
+ v.object({ kind: v.literal("success"), value: v.number() }),
62
166
  ),
63
167
  ),
64
168
  });
65
169
  ```
66
170
 
67
- - Here are the valid Convex types along with their respective validators:
68
- Convex Type | TS/JS type | Example Usage | Validator for argument validation and schemas | Notes |
69
- | ----------- | ------------| -----------------------| -----------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
70
- | Id | string | `doc._id` | `v.id(tableName)` | |
71
- | Null | null | `null` | `v.null()` | JavaScript's `undefined` is not a valid Convex value. Functions the return `undefined` or do not return will return `null` when called from a client. Use `null` instead. |
72
- | Int64 | bigint | `3n` | `v.int64()` | Int64s only support BigInts between -2^63 and 2^63-1. Convex supports `bigint`s in most modern browsers. |
73
- | Float64 | number | `3.1` | `v.number()` | Convex supports all IEEE-754 double-precision floating point numbers (such as NaNs). Inf and NaN are JSON serialized as strings. |
74
- | Boolean | boolean | `true` | `v.boolean()` |
75
- | String | string | `"abc"` | `v.string()` | Strings are stored as UTF-8 and must be valid Unicode sequences. Strings must be smaller than the 1MB total size limit when encoded as UTF-8. |
76
- | Bytes | ArrayBuffer | `new ArrayBuffer(8)` | `v.bytes()` | Convex supports first class bytestrings, passed in as `ArrayBuffer`s. Bytestrings must be smaller than the 1MB total size limit for Convex types. |
77
- | Array | Array | `[1, 3.2, "abc"]` | `v.array(values)` | Arrays can have at most 8192 values. |
78
- | Object | Object | `{a: "abc"}` | `v.object({property: value})` | Convex only supports "plain old JavaScript objects" (objects that do not have a custom prototype). Objects can have at most 1024 entries. Field names must be nonempty and not start with "$" or "_". |
79
- | Record | Record | `{"a": "1", "b": "2"}` | `v.record(keys, values)` | Records are objects at runtime, but can have dynamic keys. Keys must be only ASCII characters, nonempty, and not start with "$" or "\_". |
80
-
81
- ### Function registration
82
-
83
- - Use `internalQuery`, `internalMutation`, and `internalAction` to register internal functions. These functions are private and aren't part of an app's API. They can only be called by other Convex functions. These functions are always imported from `./_generated/server`.
84
- - Use `query`, `mutation`, and `action` to register public functions. These functions are part of the public API and are exposed to the public Internet. Do NOT use `query`, `mutation`, or `action` to register sensitive internal functions that should be kept private.
85
- - You CANNOT register a function through the `api` or `internal` objects.
86
- - ALWAYS include argument validators for all Convex functions. This includes all of `query`, `internalQuery`, `mutation`, `internalMutation`, `action`, and `internalAction`.
171
+ Nested limits are the optional third argument:
87
172
 
88
- ### Function calling
89
-
90
- - Use `ctx.runQuery` to call a query from a query, mutation, or action.
91
- - Use `ctx.runMutation` to call a mutation from a mutation or action.
92
- - Use `ctx.runAction` to call an action from an action.
93
- - ONLY call an action from another action if you need to cross runtimes (e.g. from V8 to Node). Otherwise, pull out the shared code into a helper async function and call that directly instead.
94
- - Try to use as few calls from actions to queries and mutations as possible. Queries and mutations are transactions, so splitting logic up into multiple calls introduces the risk of race conditions.
95
- - All of these calls take in a `FunctionReference`. Do NOT try to pass the callee function directly into one of these calls.
96
- - When using `ctx.runQuery`, `ctx.runMutation`, or `ctx.runAction` to call a function in the same file, specify a type annotation on the return value to work around TypeScript circularity limitations. For example,
97
-
98
- ```
99
- export const f = query({
100
- args: { name: v.string() },
101
- handler: async (ctx, args) => {
102
- return "Hello " + args.name;
103
- },
104
- });
105
-
106
- export const g = query({
107
- args: {},
108
- handler: async (ctx, args) => {
109
- const result: string = await ctx.runQuery(api.example.f, { name: "Bob" });
110
- return null;
111
- },
112
- });
173
+ ```ts
174
+ try {
175
+ await ctx.runMutation(internal.example.writeBatch, args, {
176
+ transactionLimits: { documentsWritten: 100, bytesWritten: 1024 * 1024 },
177
+ });
178
+ } catch (e) {
179
+ // The nested mutation's writes rolled back; this mutation can still write.
180
+ }
113
181
  ```
114
182
 
115
- ### Function references
116
-
117
- - Use the `api` object defined by the framework in `convex/_generated/api.ts` to call public functions registered with `query`, `mutation`, or `action`.
118
- - Use the `internal` object defined by the framework in `convex/_generated/api.ts` to call internal (or private) functions registered with `internalQuery`, `internalMutation`, or `internalAction`.
119
- - Convex uses file-based routing, so a public function defined in `convex/example.ts` named `f` has a function reference of `api.example.f`.
120
- - A private function defined in `convex/example.ts` named `g` has a function reference of `internal.example.g`.
121
- - Functions can also registered within directories nested within the `convex/` folder. For example, a public function `h` defined in `convex/messages/access.ts` has a function reference of `api.messages.access.h`.
183
+ Same-file calls can use an explicit result annotation:
122
184
 
123
- ### Pagination
185
+ ```ts
186
+ const result: string = await ctx.runQuery(api.example.f, { name: "Bob" });
187
+ ```
124
188
 
125
- - Define pagination using the following syntax:
189
+ Pagination passes the validator and options through unchanged:
126
190
 
127
191
  ```ts
128
- import { v } from "convex/values";
129
- import { query, mutation } from "./_generated/server";
130
- import { paginationOptsValidator } from "convex/server";
131
192
  export const listWithExtraArg = query({
132
193
  args: { paginationOpts: paginationOptsValidator, author: v.string() },
133
194
  handler: async (ctx, args) => {
@@ -140,29 +201,7 @@ export const listWithExtraArg = query({
140
201
  });
141
202
  ```
142
203
 
143
- Note: `paginationOpts` is an object with the following properties:
144
-
145
- - `numItems`: the maximum number of documents to return (the validator is `v.number()`)
146
- - `cursor`: the cursor to use to fetch the next page of documents (the validator is `v.union(v.string(), v.null())`)
147
- - A query that ends in `.paginate()` returns an object that has the following properties:
148
- - page (contains an array of documents that you fetches)
149
- - isDone (a boolean that represents whether or not this is the last page of documents)
150
- - continueCursor (a string that represents the cursor to use to fetch the next page of documents)
151
-
152
- ## Schema guidelines
153
-
154
- - Always define your schema in `convex/schema.ts`.
155
- - Always import the schema definition functions from `convex/server`.
156
- - System fields are automatically added to all documents and are prefixed with an underscore. The two system fields that are automatically added to all documents are `_creationTime` which has the validator `v.number()` and `_id` which has the validator `v.id(tableName)`.
157
- - Always include all index fields in the index name. For example, if an index is defined as `["field1", "field2"]`, the index name should be "by_field1_and_field2".
158
- - Index fields must be queried in the same order they are defined. If you want to be able to query by "field1" then "field2" and by "field2" then "field1", you must create separate indexes.
159
- - Do not store unbounded lists as an array field inside a document (e.g. `v.array(v.object({...}))`). As the array grows it will hit the 1MB document size limit, and every update rewrites the entire document. Instead, create a separate table for the child items with a foreign key back to the parent.
160
- - Separate high-churn operational data (e.g. heartbeats, online status, typing indicators) from stable profile data. Storing frequently updated fields on a shared document forces every write to contend with reads of the entire document. Instead, create a dedicated table for the high-churn data with a foreign key back to the parent record.
161
-
162
- ## Authentication guidelines
163
-
164
- - Convex supports JWT-based authentication through `convex/auth.config.ts`. ALWAYS create this file when using authentication. Without it, `ctx.auth.getUserIdentity()` will always return `null`.
165
- - Example `convex/auth.config.ts`:
204
+ An auth provider config has this shape:
166
205
 
167
206
  ```typescript
168
207
  export default {
@@ -175,197 +214,73 @@ export default {
175
214
  };
176
215
  ```
177
216
 
178
- The `domain` must be the issuer URL of the JWT provider. Convex fetches `{domain}/.well-known/openid-configuration` to discover the JWKS endpoint. The `applicationID` is checked against the JWT `aud` (audience) claim.
179
-
180
- - Use `ctx.auth.getUserIdentity()` to get the authenticated user's identity in any query, mutation, or action. This returns `null` if the user is not authenticated, or a `UserIdentity` object with fields like `subject`, `issuer`, `name`, `email`, etc. The `subject` field is the unique user identifier.
181
- - In Convex `UserIdentity`, `tokenIdentifier` is guaranteed and is the canonical stable identifier for the authenticated identity. For any auth-linked database lookup or ownership check, prefer `identity.tokenIdentifier` over `identity.subject`. Do NOT use `identity.subject` alone as a global identity key.
182
- - NEVER accept a `userId` or any user identifier as a function argument for authorization purposes. Always derive the user identity server-side via `ctx.auth.getUserIdentity()`.
183
- - When using an external auth provider with Convex on the client, use `ConvexProviderWithAuth` instead of `ConvexProvider`:
217
+ An external auth client uses `ConvexProviderWithAuth` with `useAuth`:
184
218
 
185
219
  ```tsx
186
- import { ConvexProviderWithAuth, ConvexReactClient } from "convex/react";
187
-
188
- const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
189
-
190
- function App({ children }: { children: React.ReactNode }) {
191
- return (
192
- <ConvexProviderWithAuth client={convex} useAuth={useYourAuthHook}>
193
- {children}
194
- </ConvexProviderWithAuth>
195
- );
196
- }
220
+ <ConvexProviderWithAuth client={convex} useAuth={useYourAuthHook}>
221
+ {children}
222
+ </ConvexProviderWithAuth>
197
223
  ```
198
224
 
199
- The `useAuth` prop must return `{ isLoading, isAuthenticated, fetchAccessToken }`. Do NOT use plain `ConvexProvider` when authentication is needed — it will not send tokens with requests.
200
-
201
- ## Typescript guidelines
202
-
203
- - You can use the helper typescript type `Id` imported from './\_generated/dataModel' to get the type of the id for a given table. For example if there is a table called 'users' you can use `Id<'users'>` to get the type of the id for that table.
204
- - Use `Doc<"tableName">` from `./_generated/dataModel` to get the full document type for a table.
205
- - Use `QueryCtx`, `MutationCtx`, `ActionCtx` from `./_generated/server` for typing function contexts. NEVER use `any` for ctx parameters — always use the proper context type.
206
- - If you need to define a `Record` make sure that you correctly provide the type of the key and value in the type. For example a validator `v.record(v.id('users'), v.string())` would have the type `Record<Id<'users'>, string>`. Below is an example of using `Record` with an `Id` type in a query:
225
+ A typed ID-keyed map is:
207
226
 
208
227
  ```ts
209
- import { query } from "./_generated/server";
210
- import { Doc, Id } from "./_generated/dataModel";
211
-
212
- export const exampleQuery = query({
213
- args: { userIds: v.array(v.id("users")) },
214
- handler: async (ctx, args) => {
215
- const idToUsername: Record<Id<"users">, string> = {};
216
- for (const userId of args.userIds) {
217
- const user = await ctx.db.get("users", userId);
218
- if (user) {
219
- idToUsername[user._id] = user.username;
220
- }
221
- }
222
-
223
- return idToUsername;
224
- },
225
- });
228
+ const idToUsername: Record<Id<"users">, string> = {};
226
229
  ```
227
230
 
228
- - Be strict with types, particularly around id's of documents. For example, if a function takes in an id for a document in the 'users' table, take in `Id<'users'>` rather than `string`.
229
- - For typed app environment variables, declare them in `convex/convex.config.ts` with `defineApp({ env: { MY_KEY: v.optional(v.string()) } })` and read them with `env` from `./_generated/server` instead of `process.env`.
230
-
231
- ## Full text search guidelines
232
-
233
- - A query for "10 messages in channel '#general' that best match the query 'hello hi' in their body" would look like:
231
+ Vector indexes declare the field, dimensions, and filters:
234
232
 
235
- const messages = await ctx.db
236
- .query("messages")
237
- .withSearchIndex("search_body", (q) =>
238
- q.search("body", "hello hi").eq("channel", "#general"),
239
- )
240
- .take(10);
241
-
242
- ## Query guidelines
243
-
244
- - Do NOT use `filter` in queries. Instead, define an index in the schema and use `withIndex` instead.
245
- - If the user does not explicitly tell you to return all results from a query you should ALWAYS return a bounded collection instead. So that is instead of using `.collect()` you should use `.take()` or paginate on database queries. This prevents future performance issues when tables grow in an unbounded way.
246
- - Never use `.collect().length` to count rows. Convex has no built-in count operator, so if you need a count that stays efficient at scale, maintain a denormalized counter in a separate document and update it in your mutations.
247
- - Convex queries do NOT support `.delete()`. If you need to delete all documents matching a query, use `.take(n)` to read them in batches, iterate over each batch calling `ctx.db.delete("tasks", row._id)`, and repeat until no more results are returned.
248
- - Convex mutations are transactions with limits on the number of documents read and written. If a mutation needs to process more documents than fit in a single transaction (e.g. bulk deletion on a large table), process a batch with `.take(n)` and then call `ctx.scheduler.runAfter(0, api.myModule.myMutation, args)` to schedule itself to continue. This way each invocation stays within transaction limits.
249
- - Use `.unique()` to get a single document from a query. This method will throw an error if there are multiple documents that match the query.
250
- - When using async iteration, don't use `.collect()` or `.take(n)` on the result of a query. Instead, use the `for await (const row of query)` syntax.
251
-
252
- ### Ordering
253
-
254
- - By default Convex always returns documents in ascending `_creationTime` order.
255
- - You can use `.order('asc')` or `.order('desc')` to pick whether a query is in ascending or descending order. If the order isn't specified, it defaults to ascending.
256
- - Document queries that use indexes will be ordered based on the columns in the index and can avoid slow table scans.
257
-
258
- ## Mutation guidelines
259
-
260
- - Use `ctx.db.replace` to fully replace an existing document. This method will throw an error if the document does not exist. Syntax: `await ctx.db.replace("tasks", taskId, { name: "Buy milk", completed: false })`
261
- - Use `ctx.db.patch` to shallow merge updates into an existing document. This method will throw an error if the document does not exist. Syntax: `await ctx.db.patch("tasks", taskId, { completed: true })`
262
-
263
- ## Action guidelines
233
+ ```ts
234
+ documents: defineTable({
235
+ title: v.string(),
236
+ category: v.string(),
237
+ embedding: v.array(v.float64()),
238
+ }).vectorIndex("by_embedding", {
239
+ vectorField: "embedding",
240
+ dimensions: 1536,
241
+ filterFields: ["category"],
242
+ }),
243
+ ```
264
244
 
265
- - Always add `"use node";` to the top of files containing actions that use Node.js built-in modules.
266
- - Never add `"use node";` to a file that also exports queries or mutations. Only actions can run in the Node.js runtime; queries and mutations must stay in the default Convex runtime. If you need Node.js built-ins alongside queries or mutations, put the action in a separate file.
267
- - `fetch()` is available in the default Convex runtime. You do NOT need `"use node";` just to use `fetch()`.
268
- - Never use `ctx.db` inside of an action. Actions don't have access to the database.
269
- - Below is an example of the syntax for an action:
245
+ The vector call is action-only:
270
246
 
271
247
  ```ts
272
- import { action } from "./_generated/server";
273
-
274
- export const exampleAction = action({
275
- args: {},
276
- handler: async (ctx, args) => {
277
- console.log("This action does not return anything");
278
- return null;
279
- },
248
+ const results = await ctx.vectorSearch("documents", "by_embedding", {
249
+ vector: args.embedding,
250
+ limit: 10,
251
+ filter: (q) => q.eq("category", args.category),
280
252
  });
281
253
  ```
282
254
 
283
- ## Scheduling guidelines
284
-
285
- ### Cron guidelines
286
-
287
- - Only use the `crons.interval` or `crons.cron` methods to schedule cron jobs. Do NOT use the `crons.hourly`, `crons.daily`, or `crons.weekly` helpers.
288
- - Both cron methods take in a FunctionReference. Do NOT try to pass the function directly into one of these methods.
289
- - Define crons by declaring the top-level `crons` object, calling some methods on it, and then exporting it as default. For example,
255
+ Mounting a component follows this pattern:
290
256
 
291
257
  ```ts
292
- import { cronJobs } from "convex/server";
293
- import { internal } from "./_generated/api";
294
- import { internalAction } from "./_generated/server";
258
+ import { defineApp } from "convex/server";
259
+ import aggregate from "@convex-dev/aggregate/convex.config";
260
+ const app = defineApp();
261
+ app.use(aggregate);
262
+ export default app;
263
+ ```
295
264
 
296
- const empty = internalAction({
297
- args: {},
298
- handler: async (ctx, args) => {
299
- console.log("empty");
300
- },
301
- });
265
+ Cron wiring uses a top-level object and a reference:
302
266
 
267
+ ```ts
303
268
  const crons = cronJobs();
304
-
305
- // Run `internal.crons.empty` every two hours.
306
269
  crons.interval("delete inactive users", { hours: 2 }, internal.crons.empty, {});
307
-
308
270
  export default crons;
309
271
  ```
310
272
 
311
- - You can register Convex functions within `crons.ts` just like any other file.
312
- - If a cron calls an internal function, always import the `internal` object from '\_generated/api', even if the internal function is registered in the same file.
313
-
314
- ## Testing guidelines
315
-
316
- - Use `convex-test` with `vitest` and `@edge-runtime/vm` to test Convex functions. Always install the latest versions of these packages. Configure vitest with `environment: "edge-runtime"` in `vitest.config.ts`.
317
-
318
- Test files go inside the `convex/` directory. You must pass a module map from `import.meta.glob` to `convexTest`:
273
+ Convex tests require the module map:
319
274
 
320
275
  ```typescript
321
- /// <reference types="vite/client" />
322
276
  import { convexTest } from "convex-test";
323
- import { expect, test } from "vitest";
324
- import { api } from "./_generated/api";
325
- import schema from "./schema";
326
-
327
277
  const modules = import.meta.glob("./**/*.ts");
328
-
329
- test("some behavior", async () => {
330
- const t = convexTest(schema, modules);
331
- await t.mutation(api.messages.send, { body: "Hi!", author: "Sarah" });
332
- const messages = await t.query(api.messages.list);
333
- expect(messages).toMatchObject([{ body: "Hi!", author: "Sarah" }]);
334
- });
278
+ const t = convexTest(schema, modules);
279
+ await t.mutation(api.messages.send, { body: "Hi!", author: "Sarah" });
335
280
  ```
336
281
 
337
- The `modules` argument is required so convex-test can discover and load function files. The `/// <reference types="vite/client" />` directive is needed for TypeScript to recognize `import.meta.glob`.
338
-
339
- - Only add the `/// <reference types="vite/client" />` directive at the top of test files that call `import.meta.glob`; do NOT add it to non-test files.
340
- - Do NOT add a `compilerOptions.types` allowlist to `tsconfig.json` for type packages you have not installed (e.g. `"node"` without `@types/node`, or `"vite/client"` without vite). Any unresolved entry in `types` fails typechecking with TS2688. Leave `types` unset unless a package genuinely requires it and is installed.
341
-
342
- ## File storage guidelines
282
+ Storage metadata comes from the system table:
343
283
 
344
- - The `ctx.storage.getUrl()` method returns a signed URL for a given file. It returns `null` if the file doesn't exist.
345
- - Do NOT use the deprecated `ctx.storage.getMetadata` call for loading a file's metadata.
346
-
347
- Instead, query the `_storage` system table. For example, you can use `ctx.db.system.get` to get an `Id<"_storage">`.
348
-
349
- ```
350
- import { query } from "./_generated/server";
351
- import { Id } from "./_generated/dataModel";
352
-
353
- type FileMetadata = {
354
- _id: Id<"_storage">;
355
- _creationTime: number;
356
- contentType?: string;
357
- sha256: string;
358
- size: number;
359
- }
360
-
361
- export const exampleQuery = query({
362
- args: { fileId: v.id("_storage") },
363
- handler: async (ctx, args) => {
364
- const metadata: FileMetadata | null = await ctx.db.system.get("_storage", args.fileId);
365
- console.log(metadata);
366
- return null;
367
- },
368
- });
284
+ ```ts
285
+ const metadata = await ctx.db.system.get("_storage", fileId);
369
286
  ```
370
-
371
- - Convex storage stores items as `Blob` objects. You must convert all items to/from a `Blob` when using Convex storage.
@@ -1,12 +1,19 @@
1
1
  import { type ProjectEnvironment } from "../../../commands/project/validators.js";
2
2
  import { CredentialStore } from "./store.js";
3
- import { type CredentialData, type CredentialMutation, type AuthDescriptor, type CodexAuth, type ClaudeAuth } from "./validators.js";
4
- /** An unbound Codex reads as native when only Claude Code is bound; both deliver nothing. */
3
+ import { type CredentialData, type CredentialMutation, type AuthDescriptor, type CodexAuth, type ClaudeAuth, type CursorAuth, type OpencodeAuth } from "./validators.js";
4
+ /** An unbound Codex reads as native when only another runtime is bound; both deliver nothing. */
5
5
  export declare function authDescriptor(data: CredentialData, identity: string): AuthDescriptor | undefined;
6
- export declare function launchAuth(identity: string, expected?: AuthDescriptor, store?: CredentialStore): {
6
+ type LaunchPayload = {
7
7
  codexAuth?: CodexAuth;
8
8
  claudeAuth?: ClaudeAuth;
9
+ cursorAuth?: CursorAuth;
10
+ opencodeAuth?: OpencodeAuth;
9
11
  };
12
+ /** What a launch delivers for `current`; pure, so the service snapshot can check capabilities. */
13
+ export declare function launchPayload(data: CredentialData, current: AuthDescriptor | undefined): LaunchPayload;
14
+ /** Launcher capabilities a payload needs; direct and service launches share it. */
15
+ export declare function launchCapabilities({ codexAuth, claudeAuth, cursorAuth, opencodeAuth }: LaunchPayload): string[];
16
+ export declare function launchAuth(identity: string, expected?: AuthDescriptor, store?: CredentialStore): LaunchPayload;
10
17
  export declare function assertCredentialNames(data: CredentialData, legacy?: Record<string, {
11
18
  provider: "mantle" | "bedrock" | "anthropic";
12
19
  token?: string | undefined;
@@ -14,3 +21,4 @@ export declare function assertCredentialNames(data: CredentialData, legacy?: Rec
14
21
  }> | undefined): void;
15
22
  /** `accounted`: active identities whose running service worker holds no grant of a removed entry. */
16
23
  export declare function mutateCredentials(request: CredentialMutation, environment: ProjectEnvironment, store?: CredentialStore, accounted?: string[]): void;
24
+ export {};