@wardby/cli 0.3.0 → 0.4.1

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 (275) hide show
  1. package/.env.example +22 -3
  2. package/README.md +11 -9
  3. package/dist/cli-help.d.ts +1 -1
  4. package/dist/cli-help.js +1 -0
  5. package/dist/cli.js +68 -10
  6. package/dist/coding/base-commit.d.ts +6 -0
  7. package/dist/coding/base-commit.js +12 -0
  8. package/dist/coding/protocol.d.ts +17 -1
  9. package/dist/coding/protocol.js +17 -6
  10. package/dist/coding/provider.d.ts +6 -1
  11. package/dist/coding/provider.js +16 -9
  12. package/dist/config/providers.d.ts +25 -0
  13. package/dist/config/providers.js +71 -0
  14. package/dist/core/attribution.d.ts +101 -0
  15. package/dist/core/attribution.js +208 -0
  16. package/dist/core/budget-groups.d.ts +17 -10
  17. package/dist/core/budget-groups.js +15 -12
  18. package/dist/core/coding-queue.d.ts +3 -0
  19. package/dist/core/coding-queue.js +6 -2
  20. package/dist/core/coding-service-status.d.ts +11 -0
  21. package/dist/core/coding-service-status.js +17 -0
  22. package/dist/core/cost-report.d.ts +88 -0
  23. package/dist/core/cost-report.js +248 -0
  24. package/dist/core/dispatch.d.ts +42 -2
  25. package/dist/core/dispatch.js +144 -26
  26. package/dist/core/engine-native.js +17 -4
  27. package/dist/core/glob.d.ts +10 -0
  28. package/dist/core/glob.js +33 -0
  29. package/dist/core/host-events.d.ts +24 -1
  30. package/dist/core/host-events.js +341 -1
  31. package/dist/core/host-status.d.ts +19 -2
  32. package/dist/core/host-status.js +47 -30
  33. package/dist/core/issue-bridge.d.ts +60 -0
  34. package/dist/core/issue-bridge.js +189 -0
  35. package/dist/core/issue-dedupe.d.ts +70 -0
  36. package/dist/core/issue-dedupe.js +255 -0
  37. package/dist/core/issue-events.d.ts +42 -0
  38. package/dist/core/issue-events.js +155 -0
  39. package/dist/core/issue-status.d.ts +29 -0
  40. package/dist/core/issue-status.js +241 -0
  41. package/dist/core/issue-tracker-tools.d.ts +64 -0
  42. package/dist/core/issue-tracker-tools.js +850 -0
  43. package/dist/core/model-usage.d.ts +10 -0
  44. package/dist/core/model-usage.js +24 -0
  45. package/dist/core/reconciler.d.ts +8 -4
  46. package/dist/core/reconciler.js +15 -4
  47. package/dist/core/review-host-tools.js +10 -3
  48. package/dist/core/run-pricing.d.ts +61 -0
  49. package/dist/core/run-pricing.js +56 -0
  50. package/dist/core/runner.d.ts +5 -2
  51. package/dist/core/runner.js +178 -27
  52. package/dist/core/scheduler.d.ts +4 -1
  53. package/dist/core/scheduler.js +3 -2
  54. package/dist/core/self-defects.d.ts +80 -0
  55. package/dist/core/self-defects.js +180 -0
  56. package/dist/core/tool-names.js +3 -0
  57. package/dist/core/webhooks.d.ts +9 -1
  58. package/dist/core/webhooks.js +19 -1
  59. package/dist/env.js +6 -1
  60. package/dist/generated/prisma/browser.d.ts +66 -0
  61. package/dist/generated/prisma/client.d.ts +66 -0
  62. package/dist/generated/prisma/commonInputTypes.d.ts +122 -52
  63. package/dist/generated/prisma/enums.d.ts +7 -0
  64. package/dist/generated/prisma/enums.js +6 -0
  65. package/dist/generated/prisma/internal/class.d.ts +99 -0
  66. package/dist/generated/prisma/internal/class.js +4 -4
  67. package/dist/generated/prisma/internal/prismaNamespace.d.ts +826 -1
  68. package/dist/generated/prisma/internal/prismaNamespace.js +135 -2
  69. package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +142 -0
  70. package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +135 -2
  71. package/dist/generated/prisma/models/Agent.d.ts +389 -1
  72. package/dist/generated/prisma/models/AgentIssueProject.d.ts +1838 -0
  73. package/dist/generated/prisma/models/AgentIssueProject.js +1 -0
  74. package/dist/generated/prisma/models/AgentRepository.d.ts +1 -1
  75. package/dist/generated/prisma/models/AuthUser.d.ts +1 -1
  76. package/dist/generated/prisma/models/CodingProxySession.d.ts +73 -1
  77. package/dist/generated/prisma/models/CodingRun.d.ts +130 -1
  78. package/dist/generated/prisma/models/CodingRunServiceStatus.d.ts +1404 -0
  79. package/dist/generated/prisma/models/CodingRunServiceStatus.js +1 -0
  80. package/dist/generated/prisma/models/IssueFingerprint.d.ts +1183 -0
  81. package/dist/generated/prisma/models/IssueFingerprint.js +1 -0
  82. package/dist/generated/prisma/models/IssuePullRequest.d.ts +1255 -0
  83. package/dist/generated/prisma/models/IssuePullRequest.js +1 -0
  84. package/dist/generated/prisma/models/ModelCatalogEntry.d.ts +1322 -0
  85. package/dist/generated/prisma/models/ModelCatalogEntry.js +1 -0
  86. package/dist/generated/prisma/models/Run.d.ts +933 -1
  87. package/dist/generated/prisma/models/RunAttribution.d.ts +1259 -0
  88. package/dist/generated/prisma/models/RunAttribution.js +1 -0
  89. package/dist/generated/prisma/models/RunIssueStatus.d.ts +1199 -0
  90. package/dist/generated/prisma/models/RunIssueStatus.js +1 -0
  91. package/dist/generated/prisma/models/RunModelUsage.d.ts +1316 -0
  92. package/dist/generated/prisma/models/RunModelUsage.js +1 -0
  93. package/dist/generated/prisma/models/WorkItem.d.ts +1408 -0
  94. package/dist/generated/prisma/models/WorkItem.js +1 -0
  95. package/dist/generated/prisma/models.d.ts +9 -0
  96. package/dist/help-index.json +355 -16
  97. package/dist/import/neutral-schema.d.ts +16 -16
  98. package/dist/knowledge/check.d.ts +13 -0
  99. package/dist/knowledge/check.js +69 -0
  100. package/dist/knowledge/cli.d.ts +14 -0
  101. package/dist/knowledge/cli.js +67 -0
  102. package/dist/knowledge/concept.d.ts +54 -0
  103. package/dist/knowledge/concept.js +78 -0
  104. package/dist/knowledge/note.d.ts +11 -0
  105. package/dist/knowledge/note.js +39 -0
  106. package/dist/knowledge/relevance.d.ts +11 -0
  107. package/dist/knowledge/relevance.js +14 -0
  108. package/dist/knowledge/span-hash.d.ts +3 -0
  109. package/dist/knowledge/span-hash.js +16 -0
  110. package/dist/mcp/auth/access.d.ts +4 -2
  111. package/dist/mcp/auth/ownership.d.ts +9 -9
  112. package/dist/mcp/auth/resource-server.d.ts +3 -1
  113. package/dist/mcp/auth/resource-server.js +18 -3
  114. package/dist/mcp/auth/self-hosted/credentials.d.ts +3 -3
  115. package/dist/mcp/auth/self-hosted/session.d.ts +5 -5
  116. package/dist/mcp/context.d.ts +3 -0
  117. package/dist/mcp/host-events/deliveries.d.ts +9 -0
  118. package/dist/mcp/host-events/deliveries.js +17 -0
  119. package/dist/mcp/host-events/github-ingress.d.ts +4 -2
  120. package/dist/mcp/host-events/github-ingress.js +4 -13
  121. package/dist/mcp/host-events/jira-ingress.d.ts +29 -0
  122. package/dist/mcp/host-events/jira-ingress.js +92 -0
  123. package/dist/mcp/index.d.ts +2 -0
  124. package/dist/mcp/index.js +87 -9
  125. package/dist/mcp/server.js +5 -2
  126. package/dist/mcp/tools/agents.js +74 -3
  127. package/dist/mcp/tools/cost-report.d.ts +8 -0
  128. package/dist/mcp/tools/cost-report.js +60 -0
  129. package/dist/mcp/tools/issue-projects.d.ts +2 -0
  130. package/dist/mcp/tools/issue-projects.js +238 -0
  131. package/dist/mcp/tools/model-catalog.d.ts +22 -0
  132. package/dist/mcp/tools/model-catalog.js +423 -0
  133. package/dist/mcp/tools/repositories.js +2 -1
  134. package/dist/mcp/tools/tools.d.ts +2 -2
  135. package/dist/mcp/tools/trigger.js +33 -5
  136. package/dist/mcp/transport/streamable-http.d.ts +5 -0
  137. package/dist/mcp/transport/streamable-http.js +23 -1
  138. package/dist/mcp/webhooks/ingress.d.ts +2 -1
  139. package/dist/mcp/webhooks/ingress.js +9 -2
  140. package/dist/providers/auth/self-hosted.d.ts +8 -1
  141. package/dist/providers/auth/self-hosted.js +39 -2
  142. package/dist/providers/coding-proxy/memory-ledger.d.ts +1 -1
  143. package/dist/providers/coding-proxy/memory-ledger.js +10 -1
  144. package/dist/providers/coding-proxy/metering.d.ts +2 -1
  145. package/dist/providers/coding-proxy/metering.js +13 -2
  146. package/dist/providers/coding-proxy/prisma-ledger.js +59 -6
  147. package/dist/providers/coding-proxy/proxy.d.ts +12 -2
  148. package/dist/providers/coding-proxy/proxy.js +92 -30
  149. package/dist/providers/coding-proxy/types.d.ts +18 -1
  150. package/dist/providers/coding-proxy/types.js +12 -1
  151. package/dist/providers/engine/types.d.ts +19 -0
  152. package/dist/providers/executor/composition.js +9 -1
  153. package/dist/providers/executor/container.d.ts +30 -2
  154. package/dist/providers/executor/container.js +98 -17
  155. package/dist/providers/executor/dbos.d.ts +2 -0
  156. package/dist/providers/executor/dbos.js +7 -5
  157. package/dist/providers/executor/routing.d.ts +6 -0
  158. package/dist/providers/executor/routing.js +5 -0
  159. package/dist/providers/executor/types.d.ts +12 -0
  160. package/dist/providers/issue-tracker/adf.d.ts +31 -0
  161. package/dist/providers/issue-tracker/adf.js +181 -0
  162. package/dist/providers/issue-tracker/index.d.ts +5 -0
  163. package/dist/providers/issue-tracker/index.js +12 -0
  164. package/dist/providers/issue-tracker/jira-client.d.ts +41 -0
  165. package/dist/providers/issue-tracker/jira-client.js +151 -0
  166. package/dist/providers/issue-tracker/jira-events.d.ts +3 -0
  167. package/dist/providers/issue-tracker/jira-events.js +98 -0
  168. package/dist/providers/issue-tracker/jira.d.ts +116 -0
  169. package/dist/providers/issue-tracker/jira.js +502 -0
  170. package/dist/providers/issue-tracker/types.d.ts +269 -0
  171. package/dist/providers/issue-tracker/types.js +16 -0
  172. package/dist/providers/jobs/docker.d.ts +5 -1
  173. package/dist/providers/jobs/docker.js +61 -33
  174. package/dist/providers/jobs/kubernetes.d.ts +3 -0
  175. package/dist/providers/jobs/kubernetes.js +44 -4
  176. package/dist/providers/jobs/service-state.d.ts +22 -0
  177. package/dist/providers/jobs/service-state.js +17 -0
  178. package/dist/providers/llm/anthropic.d.ts +3 -3
  179. package/dist/providers/llm/anthropic.js +3 -9
  180. package/dist/providers/llm/bedrock.d.ts +3 -3
  181. package/dist/providers/llm/bedrock.js +3 -9
  182. package/dist/providers/llm/catalog-lookup.d.ts +10 -0
  183. package/dist/providers/llm/catalog-lookup.js +15 -0
  184. package/dist/providers/llm/catalog-shipped.d.ts +18 -0
  185. package/dist/providers/llm/catalog-shipped.js +197 -0
  186. package/dist/providers/llm/catalog-store.d.ts +58 -0
  187. package/dist/providers/llm/catalog-store.js +138 -0
  188. package/dist/providers/llm/catalog-types.d.ts +66 -0
  189. package/dist/providers/llm/catalog-types.js +64 -0
  190. package/dist/providers/llm/catalog.d.ts +61 -0
  191. package/dist/providers/llm/catalog.js +147 -0
  192. package/dist/providers/llm/claude-provider.d.ts +10 -14
  193. package/dist/providers/llm/claude-provider.js +11 -6
  194. package/dist/providers/llm/index.d.ts +9 -6
  195. package/dist/providers/llm/index.js +8 -5
  196. package/dist/providers/llm/openai.d.ts +14 -5
  197. package/dist/providers/llm/openai.js +24 -14
  198. package/dist/providers/llm/pricing-core.d.ts +5 -3
  199. package/dist/providers/llm/registration.js +8 -12
  200. package/dist/providers/llm/routing.d.ts +18 -17
  201. package/dist/providers/llm/routing.js +40 -24
  202. package/dist/providers/review-host/github-events.js +47 -1
  203. package/dist/providers/review-host/github.js +7 -6
  204. package/dist/providers/review-host/types.d.ts +25 -0
  205. package/dist/providers/vcs/git.js +2 -22
  206. package/dist/providers/vcs/github.d.ts +20 -0
  207. package/dist/providers/vcs/github.js +28 -2
  208. package/dist/providers/vcs/types.d.ts +6 -0
  209. package/dist/quickstart/index.d.ts +8 -0
  210. package/dist/quickstart/index.js +34 -34
  211. package/dist/serve.js +8 -2
  212. package/dist/viewer/api-schema.d.ts +2757 -0
  213. package/dist/viewer/api-schema.js +165 -0
  214. package/dist/viewer/build-schemas.d.ts +2 -0
  215. package/dist/viewer/build-schemas.js +18 -0
  216. package/dist/viewer/event-bus.d.ts +38 -0
  217. package/dist/viewer/event-bus.js +232 -0
  218. package/dist/viewer/graph.d.ts +40 -0
  219. package/dist/viewer/graph.js +243 -0
  220. package/dist/viewer/http.d.ts +30 -0
  221. package/dist/viewer/http.js +133 -0
  222. package/dist/viewer/run-detail.d.ts +4 -0
  223. package/dist/viewer/run-detail.js +61 -0
  224. package/dist/wardby-bin.js +5 -0
  225. package/docs/README.md +10 -0
  226. package/docs/agent-recipes.md +383 -0
  227. package/docs/code-review-agents.md +29 -2
  228. package/docs/coding-agent-setup.md +3 -0
  229. package/docs/coding-worker-isolation.md +39 -5
  230. package/docs/getting-started-gke.md +28 -11
  231. package/docs/getting-started-identity-provider.md +49 -38
  232. package/docs/getting-started.md +14 -0
  233. package/docs/jira-agents.md +649 -0
  234. package/docs/knowledge.md +387 -0
  235. package/docs/models.md +221 -0
  236. package/docs/security-deployment.md +19 -9
  237. package/docs/viewer-api.md +142 -0
  238. package/help/admin-viewer.md +39 -0
  239. package/help/agent-recipes.md +173 -0
  240. package/help/architecture-agent.md +189 -0
  241. package/help/builder-agent.md +80 -0
  242. package/help/code-review-agents.md +6 -0
  243. package/help/cost-attribution.md +67 -0
  244. package/help/creating-agents.md +22 -0
  245. package/help/deploy-gke.md +6 -0
  246. package/help/errors/model-unavailable.md +63 -0
  247. package/help/getting-started.md +1 -0
  248. package/help/github.md +18 -0
  249. package/help/identity-and-access.md +8 -3
  250. package/help/jira.md +135 -0
  251. package/help/knowledge.md +47 -0
  252. package/help/models.md +90 -0
  253. package/help/operating-agents.md +7 -1
  254. package/help/troubleshooting/budgets.md +6 -0
  255. package/package.json +5 -2
  256. package/prisma/migrations/20260930000000_jira_issue_projects/migration.sql +34 -0
  257. package/prisma/migrations/20261001000000_jira_phase2_allowlists/migration.sql +3 -0
  258. package/prisma/migrations/20261001010000_jira_link_types_allowlist/migration.sql +2 -0
  259. package/prisma/migrations/20261002000000_jira_coding_bridge/migration.sql +28 -0
  260. package/prisma/migrations/20261002010000_jira_issue_creation/migration.sql +25 -0
  261. package/prisma/migrations/20261003000000_issue_cost_attribution/migration.sql +56 -0
  262. package/prisma/migrations/20261003010000_coding_run_service_status/migration.sql +23 -0
  263. package/prisma/migrations/20261003020000_viewer_notify/migration.sql +54 -0
  264. package/prisma/migrations/20261003030000_viewer_notify_fixes/migration.sql +47 -0
  265. package/prisma/migrations/20261003040000_viewer_indexes/migration.sql +12 -0
  266. package/prisma/migrations/20261004000000_model_catalog/migration.sql +26 -0
  267. package/prisma/schema.prisma +258 -2
  268. package/dist/mcp/tools/models.d.ts +0 -8
  269. package/dist/mcp/tools/models.js +0 -15
  270. package/dist/providers/llm/pricing-anthropic.d.ts +0 -14
  271. package/dist/providers/llm/pricing-anthropic.js +0 -48
  272. package/dist/providers/llm/pricing-bedrock-claude.d.ts +0 -20
  273. package/dist/providers/llm/pricing-bedrock-claude.js +0 -46
  274. package/dist/providers/llm/pricing.d.ts +0 -30
  275. package/dist/providers/llm/pricing.js +0 -74
@@ -0,0 +1,67 @@
1
+ ---
2
+ id: cost-attribution
3
+ title: Attribute agent spend to issues
4
+ summary: See what agent work on a Jira card, epic, or project cost, by model and token kind, with the cost_report MCP tool.
5
+ audience: operator
6
+ tags: [cost, spend, attribution, jira, epic, reporting, cost_report, tokens]
7
+ appliesTo: >=0.2.1
8
+ ---
9
+
10
+ # Attribute agent spend to issues
11
+
12
+ Wardby records which issue each run's cost belongs to, so you can see what agent
13
+ work on a card, an epic, or a whole project cost.
14
+
15
+ A run is attributed to an issue when:
16
+
17
+ - a Jira event on that issue started it;
18
+ - it reviews, or answers an `@wardby` mention on, a pull request Wardby opened
19
+ for the issue;
20
+ - `trigger_agent` named an `issue`, or a webhook call's JSON body named a
21
+ `wardbyIssue`, as `{ "provider": "jira", "key": "PROJ-123" }`, in a project
22
+ the agent is linked to. Keys are matched without regard to case
23
+ (`proj-123` is read as `PROJ-123`). An unlinked project or a malformed key is
24
+ refused; a webhook answers `400 invalid_issue`. A webhook ignores a
25
+ top-level `issue` field, so forwarded GitHub or Jira payloads still run;
26
+ - its parent run is attributed. Sub-agents and coding runs inherit the issue
27
+ and cannot change it.
28
+
29
+ When a run starts, Wardby records the issue's parent (its epic) as it is at that
30
+ moment. Moving an issue to another epic later leaves earlier runs under the
31
+ earlier epic. Reports always show the latest known titles.
32
+
33
+ ## Read the report
34
+
35
+ Call the `cost_report` MCP tool. `groupBy` is `issue` (default), `parent`,
36
+ `scope` (project), `agent`, `model`, or `run`; filter with `scopeKey`,
37
+ `parentKey`, `issueKey`, `agentId`, `provider`, and an ISO `from`/`to` window
38
+ (default: the last 30 days). Drill down by combining them: `groupBy: "parent",
39
+ scopeKey: "PROJ"` lists epics, then `groupBy: "issue", parentKey: "PROJ-10"`
40
+ lists that epic's cards, and `groupBy: "run", issueKey: "PROJ-123"` gives run
41
+ ids for `get_run`.
42
+
43
+ - Amounts are USD. Tokens are reported by kind — fresh input, cached input,
44
+ cache write, output — because each kind is priced differently; they are never
45
+ added into one total.
46
+ - `bySource` splits each row's cost by how its runs were attributed, which
47
+ shows how much was pull-request review (`linked_pr`).
48
+ - `unattributed` is spend in the window with no issue. Only `agentId` narrows
49
+ it; the project, epic, and issue filters cannot.
50
+ - `totals` sum each run's full cost. With `groupBy: "model"`, rows add up to
51
+ less when some runs have no per-model record.
52
+ - You see the same runs as `list_runs`: runs of agents you own, plus runs you
53
+ triggered.
54
+
55
+ The Jira status comment for a run also ends with its spend: the whole run tree,
56
+ the issue's total so far (every attributed run, whichever agent ran it), and the
57
+ cost per model.
58
+
59
+ ## Setup notes
60
+
61
+ If a company-managed Jira site still uses the legacy Epic Link field, set
62
+ `WARDBY_JIRA_EPIC_LINK_FIELD` (for example `customfield_10014`) so runs are
63
+ grouped under their epic. On GKE, re-run the database grants bootstrap after
64
+ upgrading so coding runs record their per-model usage; until then they still
65
+ run and a warning is logged.
66
+
67
+ For the full guide, follow [`docs/jira-agents.md`](../docs/jira-agents.md).
@@ -44,6 +44,21 @@ the trusted coding proxy, and a narrowly installed GitHub App. The agent owner
44
44
  must have the required repository access, or an administrator must explicitly
45
45
  approve the repository.
46
46
 
47
+ ## Choosing a model
48
+
49
+ Both agent types take a `model` field naming an entry in wardby's model
50
+ catalog. Run `list_models` to see which ids this deployment knows about and
51
+ what each costs; `get_model` shows one entry in full. `create_agent` and
52
+ `update_agent` always refuse a `model` that isn't in the catalog or that an
53
+ admin has disabled. For a native agent, they also refuse a model whose
54
+ provider has no credentials configured for native runs here (such a model
55
+ shows `routable: false` in `list_models`). A coding agent's model isn't checked against
56
+ `routable` at all — a coding run uses the coding proxy's own credentials
57
+ instead, so confirm those are configured for Codex or Claude Code
58
+ separately; a missing one fails the run itself at dispatch, not
59
+ `create_agent`/`update_agent`. See [Models and pricing](models.md) and
60
+ [Model not available](errors/model-unavailable.md).
61
+
47
62
  ## Decision checklist
48
63
 
49
64
  Choose a native agent when all of these are true:
@@ -63,6 +78,13 @@ Choose a coding agent when any of these are true:
63
78
 
64
79
  Do not use a coding agent merely because a task is complex. Start with the
65
80
  least powerful execution model that can safely produce the required outcome.
81
+ A coding agent can also keep a repository's architecture knowledge current; see
82
+ [Set up an architecture agent](help://architecture-agent) and
83
+ [Architecture knowledge bundles](help://knowledge).
84
+
85
+ For an `@mention` builder with a router, see [Agent recipes](help://agent-recipes) and
86
+ [Builder and router prompts](help://builder-agent).
87
+
66
88
  Read [Connect GitHub repositories](github.md) and
67
89
  [Troubleshoot coding workers](troubleshooting/coding-workers.md) before
68
90
  enabling repository-changing work.
@@ -30,6 +30,12 @@ The deployment process is:
30
30
  4. Run `HOSTNAME=wardby.example.com deploy/gke/up.sh`, then verify DNS,
31
31
  certificate issuance, database IAM bootstrap, and service health.
32
32
 
33
+ When a release changes `deploy/gke/database-grants.sql`, re-run the database
34
+ grants bootstrap **before** deploying that release, so the proxy role can
35
+ already write the tables and columns it adds (such as per-model usage for
36
+ [cost attribution](cost-attribution.md), or a run's live turn count). Until the
37
+ grants are applied, the coding proxy's writes are refused and coding runs fail.
38
+
33
39
  Claude Code's two-container executor is currently Docker-only; Kubernetes
34
40
  coding workers use the Codex path. Configure an identity provider and GitHub
35
41
  App before allowing people to use the public endpoint.
@@ -0,0 +1,63 @@
1
+ ---
2
+ id: errors/model-unavailable
3
+ title: Model not available
4
+ summary: Wardby refused to start or configure a run because its model is not usable in this deployment right now.
5
+ audience: all
6
+ tags: [error, models, pricing, model_unavailable, refusal]
7
+ appliesTo: ">=0.4.0"
8
+ ---
9
+
10
+ # Model not available
11
+
12
+ `model_unavailable` means the model an agent names cannot be routed to in
13
+ this deployment right now. Wardby checks this before a run starts spending —
14
+ and whenever `create_agent` or `update_agent` sets or changes an agent's
15
+ model — never mid-run. A native agent's error carries one of three reasons;
16
+ a coding agent's only ever carries the first two, since a coding run uses the
17
+ coding proxy's own credentials rather than looking up a provider adapter:
18
+
19
+ - **`not_in_catalog`** — the model id is not in the catalog at all: not
20
+ shipped with this release, and no admin has added it. Run `list_models` to
21
+ see the exact ids this deployment knows about, and pick one of those, or
22
+ ask someone with `models:admin` to add it with `set_model`.
23
+ - **`disabled`** — the model is in the catalog, but an admin has disabled it
24
+ with `disable_model`. Pick a different model, or ask someone with
25
+ `models:admin` to bring it back with `reset_model` (reverts to the shipped
26
+ entry, if any) or `set_model` (re-adds it with current values).
27
+ - **`provider_not_configured`** (native agents only) — the model's provider
28
+ (`openai`, `anthropic`, or `bedrock-claude`) has no credentials configured
29
+ for native runs in this deployment, even though the model itself is in the
30
+ catalog. An operator needs to configure that provider's credentials before
31
+ any native agent can use a model under it; see
32
+ [Getting started](../getting-started.md).
33
+
34
+ Whatever the reason, the run is not lost: it ends with status `failed`, zero spend, and
35
+ the `model_unavailable` message as its error, so `list_runs` and `get_run`
36
+ show why. A coding agent's run fails at dispatch, before any worker starts,
37
+ and a scheduled agent moves on to its next window instead of retrying the
38
+ same one. A coding agent whose model now belongs to a different provider than
39
+ its coding provider drives (for example a Claude model on a Codex agent)
40
+ fails the same way, with `Model "<id>" is not supported by coding provider
41
+ "<provider>"` as its error.
42
+
43
+ A coding agent's model is checked against the catalog only
44
+ (`not_in_catalog`/`disabled`), never `provider_not_configured`: coding runs
45
+ never look up a provider adapter at all, so a model can pass this check and
46
+ still fail later for reasons `model_unavailable` never reports.
47
+
48
+ One such failure has a specific name: dispatching a Claude Code run throws
49
+ `coding_provider_not_configured:claude-code` when this deployment's
50
+ `CODING_CLAUDE_WORKER_IMAGE` or `CODING_CLAUDE_TOOL_RUNNER_IMAGE` isn't set —
51
+ it means the Claude Code worker or tool-runner image itself isn't configured,
52
+ not a missing credential, and there is no equivalent error or string for
53
+ Codex. See [Local coding-agent setup](../../docs/coding-agent-setup.md).
54
+
55
+ A missing or invalid API key behind a coding run's model-provider credential
56
+ (`CODING_OPENAI_CREDENTIAL_REF` for Codex, `CODING_ANTHROPIC_CREDENTIAL_REF`
57
+ for Claude Code) is a different problem with no dedicated error code
58
+ documented here: the run starts, then fails when it actually calls the
59
+ model — not as `model_unavailable`, and not at dispatch. Check the coding
60
+ proxy's own logs for that run.
61
+
62
+ See [Models and pricing](../models.md) for how the catalog works and who can
63
+ change it.
@@ -24,6 +24,7 @@ Read [Choose a native or coding agent](creating-agents.md) before creating your
24
24
  first agent.
25
25
  Use [MCP access](mcp.md) when connecting an MCP client. Before enabling coding
26
26
  agents against a repository, complete [GitHub integration](github.md).
27
+ For two complete example setups, see [Agent recipes](agent-recipes.md).
27
28
  For a self-hosted installation, start with [Choose a deployment target](deployment-targets.md)
28
29
  and [Configure identity and privileged access](identity-and-access.md).
29
30
 
package/help/github.md CHANGED
@@ -28,3 +28,21 @@ agent setup and [`docs/code-review-agents.md`](../docs/code-review-agents.md)
28
28
  for pull-request review agents and webhook configuration.
29
29
  Use [Run GitHub code-review agents](code-review-agents.md) for the operator
30
30
  overview of checks, mentions, and fork limitations.
31
+
32
+ ## Events and triggers
33
+
34
+ Link a native agent to a repository with `link_repository`. Each trigger needs
35
+ its GitHub App event ticked in the App's event settings; every event is a
36
+ separate checkbox.
37
+
38
+ | Trigger | Starts a run when | App event to subscribe |
39
+ | -------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
40
+ | `pull_request` | A pull request is opened or pushed to; a re-run of the review check | Pull request, Check run (re-runs of the review check) |
41
+ | `mention` | Someone with write access `@`-mentions the App | Issue comment, Issues, Pull request review comment (mentions in inline review threads) |
42
+ | `push` | A commit lands on the repository's default branch | Push |
43
+
44
+ The `push` trigger starts a merge-watcher agent; only default-branch pushes
45
+ count (tags, other branches, and deletions are ignored). See
46
+ [Keep the knowledge bundle current on merge](help://architecture-agent).
47
+
48
+ For Jira Cloud instead of GitHub, see [Run Jira agents](jira.md).
@@ -20,18 +20,23 @@ to the exact same public MCP URL. Tokens need a stable subject, expiry, issuer,
20
20
  audience, and the granted Wardby scopes in `scope` or `scp`.
21
21
 
22
22
  Scopes authorize normal operations such as managing agents, runs, tools,
23
- datastores, secrets, webhooks, budgets, packages, services, and memory. Three
24
- sensitive permissions have an additional role requirement:
23
+ datastores, secrets, webhooks, budgets, packages, services, memory, and
24
+ models. Five sensitive permissions have an additional role requirement:
25
25
 
26
26
  - `agents:admin` requires the Wardby `admin` role.
27
27
  - `packages:approve` requires the `admin` or `package-approver` role.
28
28
  - `services:manage` requires the `admin` or `service-manager` role.
29
+ - `admin:view` requires the `admin` role. It opens the read-only, deployment-wide
30
+ admin viewer API; see [Watch live runs with the admin viewer API](admin-viewer.md).
31
+ - `models:admin` requires the `admin` or `model-manager` role. It adds,
32
+ overrides, disables, and resets model catalog entries; see
33
+ [Models and pricing](models.md).
29
34
 
30
35
  Map roles only from an IdP claim that users cannot self-assign. Removing a
31
36
  role affects the next token the caller receives.
32
37
 
33
38
  When you upgrade a delegating-mode deployment, define any newly advertised
34
- scope, such as `services:manage`, in the provider before deploying. Clients
39
+ scope, such as `admin:view`, in the provider before deploying. Clients
35
40
  that request every advertised scope otherwise fail with `invalid_scope`.
36
41
 
37
42
  Read [`docs/getting-started-identity-provider.md`](../docs/getting-started-identity-provider.md)
package/help/jira.md ADDED
@@ -0,0 +1,135 @@
1
+ ---
2
+ id: jira
3
+ title: Run Jira agents
4
+ summary: Connect Wardby to Jira Cloud with a service account, add the webhook, and link agents to projects.
5
+ audience: operator
6
+ tags: [jira, issue-tracker, webhooks, service-account]
7
+ appliesTo: >=0.2.1
8
+ ---
9
+
10
+ # Run Jira agents
11
+
12
+ A native agent linked to a Jira Cloud project can be started by issue events
13
+ and can read, search and comment on issues in that project. Everything it does
14
+ is attributed to one Atlassian service account whose API token Wardby holds.
15
+ Use only a service-account token (the email-plus-token setup is refused at
16
+ startup); a personal token would attribute agent actions to that person. Check
17
+ the `Jira acting as` startup line to confirm the account.
18
+
19
+ ## Setup checklist
20
+
21
+ 1. In Atlassian Administration, create a service account (Directory, then
22
+ Service accounts). Give it a project role with Browse Projects, Add
23
+ Comments and Edit Own Comments in each project agents will use, and only
24
+ there. To let agents change issues also add Transition issues, Edit issues
25
+ Link issues and Create issues. Its permissions are the outer boundary of what any linked
26
+ agent can read or change.
27
+ 2. Create an API token for it, with an expiry, and the scopes
28
+ `read:jira-work` (read issues and comments, JQL search), `write:jira-work`
29
+ (add and edit comments, transition issues, edit fields, link issues, write
30
+ issue properties) and `read:jira-user` (read its own identity).
31
+ 3. Find your site's cloudId at `https://your-site.atlassian.net/_edge/tenant_info`.
32
+ 4. In Jira, Settings, System, WebHooks: add
33
+ `https://<your-wardby-host>/hosts/jira/events` with a secret of 20 or more
34
+ characters and the events Issue created, Issue updated, Comment created and
35
+ Comment updated.
36
+ Editing a comment that mentions the service account can trigger the agent
37
+ again when the editor is a trusted account; leave out Comment updated if you
38
+ don't want that.
39
+ 5. Set `WARDBY_JIRA_SITE_URL`, `WARDBY_JIRA_API_BASE_URL`
40
+ (`https://api.atlassian.com/ex/jira/<cloudId>`), `WARDBY_JIRA_API_TOKEN` and
41
+ `WARDBY_JIRA_WEBHOOK_SECRET`, then restart. The startup log line
42
+ `Jira acting as` shows which account Wardby uses; confirm it is the service
43
+ account. Optionally set `WARDBY_JIRA_API_TOKEN_EXPIRES_AT` to get a warning
44
+ 14 days before expiry.
45
+ 6. A Wardby administrator links the agent with `link_issue_project`, for
46
+ example `projectKey: "PROJ"`, `access: "write"`,
47
+ `triggers: ["transitioned", "mention"]`,
48
+ `triggerStatuses: ["Ready for agent"]` and
49
+ `trustedAccountIds: ["<accountId>"]`. To let the agent change issues, add
50
+ `allowedTransitions` (target status names), `writableFields` (`labels`,
51
+ `components`, `priority`, `customfield_N`) and `allowedLinkTypes` (issue
52
+ link type names such as `Duplicate`); all need `write` access and an empty
53
+ list means the tool refuses. Linking two issues also needs a `write` link to
54
+ both issues' projects, each allowlisting the type. Existing links get these
55
+ only once you set the lists. Status and link type names are matched in the
56
+ service account's Jira language (its profile language setting, which Jira
57
+ reports as its locale), so set that language to the one your team uses for
58
+ status names.
59
+
60
+ ## What agents can do
61
+
62
+ Beyond reading, searching and commenting, linked agents get
63
+ `jira_list_transitions`, `jira_transition`, `jira_update_fields`,
64
+ `jira_link_issues`, and `jira_get_property` / `jira_set_property` for
65
+ per-issue state, plus `jira_create_issue` and `jira_read_attachment`. Each authorizes against the issue's own project and the
66
+ agent's live link. Properties are not allowlisted: any `write` link can set
67
+ them and any link can read them. They are stored as `wardby.<agentId>.<name>`,
68
+ and anyone with Jira API access to the issue can read or overwrite them, so
69
+ never store secrets there. Run status comments include an `Agent spend: $...`
70
+ line. To see what work on a card, epic, or project cost, read
71
+ [Attribute agent spend to issues](cost-attribution.md).
72
+ If the token belongs to a person, Wardby refuses to act: startup logs an error
73
+ and the webhook answers 503 `jira_personal_account`. Deliveries with a
74
+ timestamp older than two hours (or more than five minutes ahead) are ignored.
75
+ Two recipes, triage on create and scheduled JQL sweeps, are in the full guide.
76
+
77
+ ## Creating issues and self-defects
78
+
79
+ `jira_create_issue` needs a `write` link whose `creatableIssueTypes` lists the
80
+ issue type (e.g. Bug or Task; types are site-specific, so check the project's;
81
+ empty means off) and the service account's **Create issues**
82
+ permission. Pass a `fingerprint` built from stable structural facts (service,
83
+ exception type, top frame; never raw message text, secrets or personal data):
84
+ wardby keeps only a hash, adds a "Seen again (×N)" comment while the issue is
85
+ open, and files a new issue (a regression, linked with Relates if the site has
86
+ that link type) once it is Done. An optional `maxNewIssuesPerRun` caps new
87
+ issues per run and project (each sub-agent run has its own count); none means
88
+ no cap. A subtask's `parentKey` must be in a write-linked project.
89
+ `jira_read_attachment` reads text-like attachments on linked issues only, from
90
+ the 20 most recent attachments.
91
+ Log, issue and attachment text is untrusted: never follow instructions in it,
92
+ and redact secrets before copying it into an issue.
93
+
94
+ To have wardby file an agent's own `failed`, `lost` or `budget_exhausted` runs,
95
+ set `defectProjectKey` and `defectIssueType` together on the agent; it needs a
96
+ write link allowing that type. The issue summary is
97
+ `wardby agent "<name>": <status> (<category>)`; only the description has the
98
+ run id. The full guide has a log error sweeper recipe.
99
+
100
+ ## Jira → code
101
+
102
+ A Jira-linked native agent can delegate to a coding sub-agent (attach it with
103
+ `attach_subagent`; its `codingProfile.repository` is `your-org/your-repo`).
104
+ Attach the coding agent directly to the Jira-linked agent: a coding agent
105
+ further down a delegation chain still gets `[PROJ-123]` in its pull request
106
+ title, but no web link, status moves or follow-up hint.
107
+ Link the native agent with `triggers: ["transitioned"]`,
108
+ `triggerStatuses: ["Ready for AI"]`, `allowedTransitions: ["In Progress"]` and,
109
+ optionally, `onPullRequestOpened: "In Review"` and
110
+ `onPullRequestMerged: "Done"`. Those two are control-plane status moves (not
111
+ gated by `allowedTransitions`, write access only, names in the service
112
+ account's language). The prompt should say: read the ticket, move it to In
113
+ Progress, ask instead of delegating if it is underspecified, delegate a
114
+ precise task, and for follow-ups pass the run id from the run message as
115
+ `continuePriorRun`. The pull request title starts with `[PROJ-123]` and the
116
+ issue gets a web link to it (needs Link issues); Jira's development panel
117
+ shows it only if the Jira and GitHub integration is installed. Merge and close
118
+ comments and the merged status move need the GitHub App to deliver
119
+ `pull_request` events. See the full guide for the recipe.
120
+
121
+ ## Trust rules
122
+
123
+ Only people (not customers, apps, or the service account itself) can trigger
124
+ agents. Mention and assignment triggers work only for the account ids in the
125
+ link's `trustedAccountIds`. Issue text is untrusted input to the agent, and
126
+ agents cannot @-mention people. Wardby confines each agent to its linked
127
+ projects, but JQL functions can still reveal facts about other projects the
128
+ service account can browse. The tool names `jira_get_issue`, `jira_search`,
129
+ `jira_comment`, `jira_edit_own_comment`, `jira_list_transitions`,
130
+ `jira_transition`, `jira_update_fields`, `jira_link_issues`,
131
+ `jira_get_property` and `jira_set_property` are reserved; rename any existing
132
+ user-defined tool with one of them before linking the agent.
133
+
134
+ For the full guide, including tools, link options, token rotation and
135
+ troubleshooting, follow [`docs/jira-agents.md`](../docs/jira-agents.md).
@@ -0,0 +1,47 @@
1
+ ---
2
+ id: knowledge
3
+ title: Architecture knowledge bundles
4
+ summary: Keep cited, non-obvious architecture knowledge in docs/knowledge/ so coding runs, reviewers, and live sessions (through the AGENTS.md pointer) use it; validate it with wardby knowledge check.
5
+ audience: operator
6
+ tags: [knowledge, architecture, coding-agents, okf, cli, drift, push]
7
+ appliesTo: >=0.4.0
8
+ ---
9
+
10
+ # Architecture knowledge bundles
11
+
12
+ A knowledge bundle is a set of markdown files in `docs/knowledge/` that records
13
+ architecture knowledge people tend to miss: pitfalls, invariants, decisions and
14
+ their reasons, and cross-module contracts. It uses the Open Knowledge Format
15
+ (OKF) v0.2 plus a `wardby:` front-matter block that lists the roles a concept is
16
+ for, the paths it affects, and citations to the code it describes. Each citation
17
+ carries a commit `sha` and a `spanHash` so staleness can be detected.
18
+
19
+ - `docs/knowledge/index.md` lists every concept in one line; `log.md` records
20
+ changes to the bundle.
21
+ - When `docs/knowledge/index.md` exists on a coding run's base branch, the run's
22
+ task includes the index automatically (up to 8 KiB). It never fails a
23
+ dispatch; an unreadable index just means no note.
24
+ - When the run's commit is known (it always is for a normal clone) and the
25
+ request leaves room, the task ends with a `Base commit: <sha>` line. The workspace
26
+ has no git metadata, so use that value for citation `sha` fields.
27
+ - Validate the bundle with `wardby knowledge check` (add `--strict` to fail on
28
+ warnings, `--json` for machine output, `--root` to point at the repository).
29
+ Errors are `concept_invalid`, `concept_secret`, `index_missing`, and
30
+ `index_link_broken`; warnings are `concept_not_indexed`,
31
+ `citation_unverifiable`, and `citation_stale`.
32
+ - Builders may edit concept prose. Citations can go stale afterward; the
33
+ architecture agent re-anchors them.
34
+
35
+ To keep the bundle current on a schedule, set up the scheduled agent described
36
+ in [Set up an architecture agent](help://architecture-agent). Code-review agents can read the bundle too.
37
+
38
+ To re-verify only the concepts a merge touched, link a small watcher agent with
39
+ the `push` trigger; it starts the architecture agent when a merge to the default
40
+ branch affects a concept. See
41
+ [Keep the knowledge bundle current on merge](help://architecture-agent) and
42
+ [Connect GitHub repositories](help://github-integration) (the GitHub App must
43
+ subscribe to the Push event).
44
+
45
+ Read [`docs/knowledge.md`](../docs/knowledge.md) for the concept format, the
46
+ span-hash definition, a full example, the issue-code table, and the reviewer
47
+ prompt section.
package/help/models.md ADDED
@@ -0,0 +1,90 @@
1
+ ---
2
+ id: models
3
+ title: Models and pricing
4
+ summary: Which models this deployment can run, what they cost, and how admins add, reprice, disable or reset them.
5
+ audience: all
6
+ tags: [models, pricing, list_models, set_model, disable_model, reset_model, get_model, models:admin, model-manager]
7
+ appliesTo: ">=0.4.0"
8
+ ---
9
+
10
+ # Models and pricing
11
+
12
+ Wardby prices and routes every model call from one catalog: the models this
13
+ release ships, overlaid with this deployment's own additions and overrides.
14
+ An agent can use a model only when it's in the catalog and its provider has
15
+ credentials configured here.
16
+
17
+ ## The five tools
18
+
19
+ | Tool | Scope | What it does |
20
+ | --------------- | -------------- | ----------------------------------------------------------------------------------------- |
21
+ | `list_models` | `agents:read` | Every active catalog entry (or, with `includeDisabled: true`, disabled ones too). |
22
+ | `get_model` | `agents:read` | One entry by `modelId`; for an override, also the shipped entry it shadows. |
23
+ | `set_model` | `models:admin` | Adds or completely replaces one entry. Every field is required. |
24
+ | `disable_model` | `models:admin` | Removes a model from routing without deleting its pricing history. |
25
+ | `reset_model` | `models:admin` | Removes every row for a model id, reverting to the shipped entry (if any) or removing it. |
26
+
27
+ Reading the catalog needs only `agents:read` — no secrets live in an entry.
28
+ Changing it needs `models:admin`, honored only for a caller whose Wardby role
29
+ grants it: `admin`, or the narrower `model-manager` role.
30
+
31
+ An entry's `origin` is `shipped` or `override`; `routable` says whether this
32
+ deployment can actually route to it right now; `shippedDiffers` (overrides of
33
+ a shipped model only) says whether your override has drifted from the
34
+ current shipped values. See [`docs/models.md`](../docs/models.md) for the
35
+ full field reference.
36
+
37
+ ## Adding or overriding a model
38
+
39
+ ```json
40
+ {
41
+ "provider": "anthropic",
42
+ "modelId": "claude-example-model",
43
+ "encoding": "o200k_base",
44
+ "inputPerMTok": 0.0,
45
+ "outputPerMTok": 0.0,
46
+ "cachedInputPerMTok": 0.0,
47
+ "cacheWritePerMTok": 0.0,
48
+ "efforts": ["low", "medium", "high"],
49
+ "thinkingMode": "adaptive",
50
+ "sourceUrl": "https://example.com/replace-with-the-providers-own-pricing-page"
51
+ }
52
+ ```
53
+
54
+ The rates above are placeholders. Copy the provider's own published rates for
55
+ that exact model — including its cache read and cache write rates — from its
56
+ pricing page, and point `sourceUrl` at that page; never compute cache rates
57
+ from `inputPerMTok` with a multiplier.
58
+
59
+ `set_model` refuses (409) a `modelId` another provider already owns. A
60
+ shipped id always belongs to its shipped provider — permanently; no other
61
+ provider can ever claim it, not even by disabling or resetting the override.
62
+ A non-shipped id already claimed by another provider (its row active or
63
+ disabled) is freed only by `reset_model` — it takes only the `modelId` and
64
+ clears every row for it, whichever provider owns it; `disable_model` alone
65
+ never frees it, since the disabled row still reserves the id.
66
+
67
+ `thinkingMode` (`adaptive`, `manual`, or `none`) must match what the exact
68
+ model accepts. Getting it wrong doesn't fail at `set_model` — it fails later,
69
+ when a run calls the model, with `unsupported_anthropic_feature`.
70
+ For Claude Code coding runs, `efforts` is also the exact set of levels a run
71
+ may send, so always include the model's default effort level.
72
+
73
+ A newly released Claude model may also need a newer Claude Code than your
74
+ Claude Code worker image has: coding runs on it then fail as
75
+ `provider_rejected` (no cost) while native runs work. Upgrade wardby and
76
+ rebuild the worker images before using the model in Claude Code agents.
77
+
78
+ Catalog changes take effect on the writing process immediately, and on every
79
+ other wardby process within `WARDBY_MODEL_CATALOG_REFRESH_SECONDS` (default
80
+ 45). A run already in progress keeps the catalog entry it started with, so
81
+ disabling or repricing a model never changes a run already under way — only
82
+ new runs.
83
+
84
+ If this deployment delegates to an identity provider, define `models:admin`
85
+ there before relying on it, and map the `model-manager` role (or `admin`) to
86
+ the people who maintain pricing — see
87
+ [Configure identity and privileged access](identity-and-access.md).
88
+
89
+ If a run can't use a model, see
90
+ [Model not available](errors/model-unavailable.md).
@@ -24,7 +24,13 @@ powerful execution model that can safely produce the desired outcome.
24
24
  Before a run starts, Wardby reserves its allowed spend. The reservation is
25
25
  constrained by the agent's own budget, any shared budget group, and any
26
26
  sub-agent run tree. See [Budget troubleshooting](troubleshooting/budgets.md)
27
- when a run is refused for lack of budget.
27
+ when a run is refused for lack of budget, and
28
+ [Attribute agent spend to issues](cost-attribution.md) to see what runs cost
29
+ per issue, epic, project, agent, or model.
30
+
31
+ A running run's cost, token counts, and turn count update after each model
32
+ call, so `get_run` and `list_runs` show spend so far rather than zero until the
33
+ run finishes.
28
34
 
29
35
  For the full lifecycle and the controls applied to every managed run, read
30
36
  [`README.md`](../README.md).
@@ -23,4 +23,10 @@ In-progress runs retain their unspent reservation, so overlapping scheduled,
23
23
  webhook, and manual runs share one cap rather than each assuming the full
24
24
  remaining balance.
25
25
 
26
+ A run's spend is recorded as it goes, not only when it finishes. A sub-agent
27
+ dispatched partway through a run therefore gets the run tree's capacity minus
28
+ what the parent (and any earlier sub-agents) have already spent, so a parent
29
+ that spends heavily before delegating can leave a sub-agent refused with
30
+ `run_tree_exhausted`.
31
+
26
32
  For a shared-group refusal, read [Budget group exhausted](../errors/budget-group-exhausted.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wardby/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Self-hosted control plane for budget-guarded AI agents.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/wardby/wardby#readme",
@@ -55,10 +55,12 @@
55
55
  "format:check": "prettier --check .",
56
56
  "build:vendor": "node scripts/build-sandbox-vendor.mjs",
57
57
  "build:help": "tsx src/help/build.ts",
58
+ "build:viewer-schemas": "tsx src/viewer/build-schemas.ts",
58
59
  "build": "npm run build:vendor && PRISMA_HIDE_UPDATE_MESSAGE=1 prisma generate && tsc -p tsconfig.build.json && npm run build:help",
59
60
  "prepare": "npm run build:vendor && PRISMA_HIDE_UPDATE_MESSAGE=1 prisma generate",
60
61
  "prepack": "npm run build",
61
62
  "cli": "tsx --conditions=wardby-source src/cli.ts",
63
+ "codex:rerecord": "tsx --conditions=wardby-source src/tools/codex-rerecord.ts",
62
64
  "capture:autopilot": "tsx --conditions=wardby-source src/tools/capture-autopilot-dry-run.ts",
63
65
  "test": "npm run build:vendor && vitest run",
64
66
  "test:package": "node scripts/npm-package-acceptance.mjs",
@@ -115,12 +117,13 @@
115
117
  "semver": "^7.8.5",
116
118
  "tar-stream": "^3.2.1",
117
119
  "undici": "^8.7.0",
120
+ "yaml": "^2.9.1",
118
121
  "zod": "^3.25.76",
119
122
  "zod-to-json-schema": "^3.25.2"
120
123
  },
121
124
  "devDependencies": {
122
125
  "@eslint/js": "^10.0.1",
123
- "@openai/codex-sdk": "0.153.4",
126
+ "@openai/codex-sdk": "0.159.2",
124
127
  "@types/node": "^24.0.0",
125
128
  "@types/papaparse": "^5.5.2",
126
129
  "@types/pg": "8.23.1",
@@ -0,0 +1,34 @@
1
+ -- Jira issue-tracker links and per-run status comments (phase 1).
2
+ CREATE TABLE "AgentIssueProject" (
3
+ "id" TEXT NOT NULL,
4
+ "agentId" TEXT NOT NULL,
5
+ "provider" TEXT NOT NULL,
6
+ "projectKey" TEXT NOT NULL,
7
+ "access" TEXT NOT NULL,
8
+ "triggers" TEXT[] DEFAULT ARRAY[]::TEXT[],
9
+ "triggerStatuses" TEXT[] DEFAULT ARRAY[]::TEXT[],
10
+ "triggerLabels" TEXT[] DEFAULT ARRAY[]::TEXT[],
11
+ "jqlFilter" TEXT,
12
+ "trustedAccountIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
13
+ "commentVisibilityRole" TEXT,
14
+ "authorizedById" TEXT NOT NULL,
15
+ "authorizedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
16
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
17
+ CONSTRAINT "AgentIssueProject_pkey" PRIMARY KEY ("id")
18
+ );
19
+ CREATE UNIQUE INDEX "AgentIssueProject_agentId_provider_projectKey_key" ON "AgentIssueProject"("agentId", "provider", "projectKey");
20
+ CREATE INDEX "AgentIssueProject_provider_projectKey_idx" ON "AgentIssueProject"("provider", "projectKey");
21
+ ALTER TABLE "AgentIssueProject" ADD CONSTRAINT "AgentIssueProject_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent"("id") ON DELETE CASCADE ON UPDATE CASCADE;
22
+
23
+ CREATE TABLE "RunIssueStatus" (
24
+ "runId" TEXT NOT NULL,
25
+ "provider" TEXT NOT NULL,
26
+ "issueKey" TEXT NOT NULL,
27
+ "commentId" TEXT,
28
+ "visibilityRole" TEXT,
29
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
30
+ "completedAt" TIMESTAMP(3),
31
+ CONSTRAINT "RunIssueStatus_pkey" PRIMARY KEY ("runId")
32
+ );
33
+ CREATE INDEX "RunIssueStatus_completedAt_idx" ON "RunIssueStatus"("completedAt");
34
+ ALTER TABLE "RunIssueStatus" ADD CONSTRAINT "RunIssueStatus_runId_fkey" FOREIGN KEY ("runId") REFERENCES "Run"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,3 @@
1
+ -- Jira phase 2: per-link allowlists for transitions and field edits.
2
+ ALTER TABLE "AgentIssueProject" ADD COLUMN "allowedTransitions" TEXT[] DEFAULT ARRAY[]::TEXT[];
3
+ ALTER TABLE "AgentIssueProject" ADD COLUMN "writableFields" TEXT[] DEFAULT ARRAY[]::TEXT[];
@@ -0,0 +1,2 @@
1
+ -- Jira phase 2: per-link allowlist of issue link types jira_link_issues may create.
2
+ ALTER TABLE "AgentIssueProject" ADD COLUMN "allowedLinkTypes" TEXT[] DEFAULT ARRAY[]::TEXT[];