@teamscala/service-boot 0.23.345 → 0.23.346

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 (136) hide show
  1. package/package.json +1064 -1093
  2. package/src/two-phase-boot.ts +2 -1
  3. package/src/agreement-gate.d.ts +0 -19
  4. package/src/asset-cache-key.d.ts +0 -11
  5. package/src/asset-optimize.d.ts +0 -17
  6. package/src/asset-proxy.d.ts +0 -11
  7. package/src/asset-social-card.d.ts +0 -17
  8. package/src/attach-agreement-magic.d.ts +0 -20
  9. package/src/attach-portal-members.d.ts +0 -23
  10. package/src/attach-proposal-accept.d.ts +0 -26
  11. package/src/attach-proposal-magic.d.ts +0 -18
  12. package/src/attach-transfers-upload.d.ts +0 -27
  13. package/src/auth-gate.d.ts +0 -29
  14. package/src/bind-page-handler.d.ts +0 -18
  15. package/src/build-client-assets/input-hashing.d.ts +0 -25
  16. package/src/build-client-assets/source-candidates.d.ts +0 -27
  17. package/src/build-client-assets.d.ts +0 -50
  18. package/src/compose-page-title.d.ts +0 -41
  19. package/src/content-gate/access.d.ts +0 -15
  20. package/src/content-gate/config-types.d.ts +0 -99
  21. package/src/content-gate/gate.d.ts +0 -13
  22. package/src/content-gate/parse-cookie.d.ts +0 -9
  23. package/src/content-gate/token.d.ts +0 -48
  24. package/src/content-page-floor.d.ts +0 -39
  25. package/src/discover-blocks.d.ts +0 -28
  26. package/src/expand-roster.d.ts +0 -34
  27. package/src/fn-routers/agreement-completion-email.d.ts +0 -14
  28. package/src/fn-routers/agreement-send-router.d.ts +0 -82
  29. package/src/fn-routers/ai-health-router.d.ts +0 -35
  30. package/src/fn-routers/auth-router.d.ts +0 -47
  31. package/src/fn-routers/cache-admin-router.d.ts +0 -57
  32. package/src/fn-routers/chat-session-router.d.ts +0 -219
  33. package/src/fn-routers/email-defaults.d.ts +0 -1
  34. package/src/fn-routers/email-link-ttl.d.ts +0 -1
  35. package/src/fn-routers/index.d.ts +0 -18
  36. package/src/fn-routers/orchestrator-registration-router.d.ts +0 -60
  37. package/src/fn-routers/orchestrator-registration-router.ts +0 -77
  38. package/src/fn-routers/orchestrator-registration.live.test.ts +0 -70
  39. package/src/fn-routers/orchestrator-registration.test.ts +0 -23
  40. package/src/fn-routers/panel-data-router.d.ts +0 -19
  41. package/src/fn-routers/persist-chat-messages.d.ts +0 -36
  42. package/src/fn-routers/plans-router.d.ts +0 -25
  43. package/src/fn-routers/proposal-send-router.d.ts +0 -58
  44. package/src/fn-routers/public-agreement-router.d.ts +0 -289
  45. package/src/fn-routers/public-assessment-router.d.ts +0 -68
  46. package/src/fn-routers/public-gpt-session-router.d.ts +0 -143
  47. package/src/fn-routers/sign-in-flow-router.d.ts +0 -107
  48. package/src/fn-routers/task-sync-assign.d.ts +0 -307
  49. package/src/fn-routers/task-sync-brief.d.ts +0 -98
  50. package/src/fn-routers/task-sync-close.d.ts +0 -41
  51. package/src/fn-routers/task-sync-dispatch.d.ts +0 -47
  52. package/src/fn-routers/task-sync-dispatch.ts +0 -81
  53. package/src/fn-routers/task-sync-lane.d.ts +0 -49
  54. package/src/fn-routers/task-sync-lane.ts +0 -114
  55. package/src/fn-routers/task-sync-projection.d.ts +0 -144
  56. package/src/fn-routers/task-sync-rename.d.ts +0 -91
  57. package/src/fn-routers/task-sync-router.d.ts +0 -455
  58. package/src/fn-routers/task-sync-router.ts +0 -1075
  59. package/src/fn-routers/tasks-router.d.ts +0 -25
  60. package/src/fn-routers/user-preferences-router.d.ts +0 -77
  61. package/src/fn-routers/work-items-router.d.ts +0 -102
  62. package/src/gate-ttls.d.ts +0 -6
  63. package/src/gpt-gate.d.ts +0 -25
  64. package/src/handlers/bun-stable-watch.d.ts +0 -1
  65. package/src/handlers/pane-outbox-drain.d.ts +0 -1
  66. package/src/handlers/projects-digest.d.ts +0 -26
  67. package/src/handlers/prune-stale-data.d.ts +0 -30
  68. package/src/handlers/registry-stale-inactive-sweep.d.ts +0 -1
  69. package/src/handlers/scala-tools-currency-watch.d.ts +0 -1
  70. package/src/handlers/singleton-tools-currency-watch.d.ts +0 -1
  71. package/src/handlers/sweep-event-log.d.ts +0 -1
  72. package/src/handlers/sweep-host-cache.d.ts +0 -24
  73. package/src/handlers/upstream-issue-sync.d.ts +0 -1
  74. package/src/handlers/whatsapp-liveness-logic.d.ts +0 -34
  75. package/src/handlers/whatsapp-liveness.d.ts +0 -4
  76. package/src/hono-error-handler.d.ts +0 -25
  77. package/src/install-harness.d.ts +0 -45
  78. package/src/install-logging.d.ts +0 -34
  79. package/src/load-service-install-row.d.ts +0 -24
  80. package/src/load-service-prisma-client.d.ts +0 -18
  81. package/src/mount-orpc-router.d.ts +0 -15
  82. package/src/mount-server-packages.d.ts +0 -29
  83. package/src/mount.d.ts +0 -9
  84. package/src/mutable-app-ref.d.ts +0 -44
  85. package/src/page-route-shell-types.d.ts +0 -12
  86. package/src/page-server-orpc/audit-revert-router.d.ts +0 -37
  87. package/src/page-server-orpc/hub-mcp-client.d.ts +0 -12
  88. package/src/page-server-orpc/portal-diagnostics-router.d.ts +0 -49
  89. package/src/page-server-orpc/puck-pages-router.d.ts +0 -58
  90. package/src/page-server-orpc/server-client.d.ts +0 -16
  91. package/src/page-server-orpc/templates-router.d.ts +0 -34
  92. package/src/page-server-orpc/user-preferences-router.d.ts +0 -79
  93. package/src/pg-boss-handler-registry.d.ts +0 -27
  94. package/src/pg-boss-mount.d.ts +0 -42
  95. package/src/proposal-authorized-emails.d.ts +0 -28
  96. package/src/proposal-chat-inject.d.ts +0 -17
  97. package/src/proposal-gate.d.ts +0 -18
  98. package/src/read-html-template.d.ts +0 -38
  99. package/src/read-viewport-from-request.d.ts +0 -18
  100. package/src/readiness-gate.d.ts +0 -16
  101. package/src/register-api-routes.d.ts +0 -18
  102. package/src/register-crash-handlers.d.ts +0 -15
  103. package/src/register-page-routes.d.ts +0 -27
  104. package/src/register-page-server-client.d.ts +0 -11
  105. package/src/register-registry-page-route/ai-chat-prefetch.d.ts +0 -13
  106. package/src/register-registry-page-route/graph-cache.d.ts +0 -30
  107. package/src/register-registry-page-route/meta-title.d.ts +0 -2
  108. package/src/register-registry-page-route/proposal-approval-email-token.d.ts +0 -14
  109. package/src/register-registry-page-route/proposal-brand-stamping.d.ts +0 -28
  110. package/src/register-registry-page-route/resolve-page-data.d.ts +0 -1
  111. package/src/register-registry-page-route.d.ts +0 -27
  112. package/src/register-static-assets.d.ts +0 -13
  113. package/src/register-ws-routes.d.ts +0 -28
  114. package/src/resolve-app-base-url.d.ts +0 -13
  115. package/src/resolve-brand-favicon.d.ts +0 -28
  116. package/src/resolve-from-loader-config.d.ts +0 -32
  117. package/src/resolve-service-context.d.ts +0 -17
  118. package/src/resolve-service-port.d.ts +0 -75
  119. package/src/resolve-theme-mode.d.ts +0 -42
  120. package/src/resolvers/fetch-org-brand.d.ts +0 -2
  121. package/src/resolvers/portal-route-paths.d.ts +0 -39
  122. package/src/resolvers/website-by-host-map.d.ts +0 -12
  123. package/src/resource-chat-inject.d.ts +0 -46
  124. package/src/resource-not-found.d.ts +0 -60
  125. package/src/run-boot-hook-list.d.ts +0 -19
  126. package/src/run-boot-hooks.d.ts +0 -31
  127. package/src/scala-tools-currency-watchdog.d.ts +0 -10
  128. package/src/security-headers.d.ts +0 -12
  129. package/src/serve/serve.d.ts +0 -46
  130. package/src/serve/stamp-transport-identity.d.ts +0 -39
  131. package/src/server-error-page.d.ts +0 -29
  132. package/src/start-scheduled-jobs.d.ts +0 -18
  133. package/src/two-phase-boot.d.ts +0 -176
  134. package/src/types.d.ts +0 -46
  135. package/src/ui-service.d.ts +0 -46
  136. package/src/ws-boot-self-test.d.ts +0 -19
@@ -1,455 +0,0 @@
1
- /**
2
- * @system service-boot
3
- * @status handwritten
4
- * @edit edit directly
5
- * @indivisible-unit
6
- *
7
- * CLI-AGNOSTIC task-sync CORE — the bridge between a lane's native task list
8
- * (Claude Code TodoWrite, OpenCode todowrite, future CLIs) and the `work_items`
9
- * table, which is the single source of truth for "what work does this lane
10
- * have." Detailed contract + the per-CLI adapter split: apps/agent-fleet.md
11
- * (task-sync section).
12
- *
13
- * Design (operator requirement): work_items is the source; each CLI's task list
14
- * is a WRITE-THROUGH PROJECTION, never a peer. One source + write-through
15
- * projection cannot diverge by construction — no two-way sync, no conflict
16
- * resolution. The lane↔task binding is SYMMETRIC: a lane is a lane whether the
17
- * pane is an orchestrator or a supervised agent (both have tasks).
18
- *
19
- * Mapping: an operator request = a kind='task' work_item; the lane's todo items
20
- * = kind='subtask' rows under it via parent_id. The task carries the lane
21
- * identity in kind_data.lane = { pane, session, cli_kind, role } so any surface
22
- * (fleet UI, another lane) can resolve "who owns this work" and push changes
23
- * back. Binding is by pane identity (the stable $TMUX_PANE), not by fleet run —
24
- * so it works without any second runtime-assignment join; the canonical runtime
25
- * identity remains cli_sessions and the assignment remains work_items.
26
- *
27
- * These procedures are the ONLY CLI-agnostic surface an adapter calls:
28
- * bindLane — bind (create-or-confirm) a lane's task. SessionStart.
29
- * closeLane — reconcile a session-owned lane before its runtime releases it.
30
- * upsertFromTaskList — write a lane's current task list through to subtasks (AGENT→DB leg, OpenCode whole-list).
31
- * upsertFromTaskHook — apply a per-item Claude Code PostToolUse:TaskCreate/Update/Delete (AGENT→DB leg, Claude per-item).
32
- * readTaskList — read a lane's current subtasks as a normalized list (DB→AGENT backstop).
33
- * applyExternalChange — record an out-of-band subtask change + notify the owning lane (DB→AGENT realtime leg).
34
- * A CLI with no native task surface (Codex today — upstream_issue openai-codex-2966)
35
- * has NO adapter: it degrades to work_items-only. The work is still tracked and
36
- * visible in the projects UI; the lane simply has no live projection. That is a
37
- * legitimate end state, not a gap to paper over with a fake adapter.
38
- */
39
- import { type Context } from "./auth-router.ts";
40
- import * as v from "valibot";
41
- import { type ProgressAcceptanceEvidence } from "./task-sync-projection.ts";
42
- /** A lane's native task-list item, normalized. Every CLI adapter maps to this. */
43
- export interface TaskListItem {
44
- content: string;
45
- status: "pending" | "in_progress" | "completed";
46
- /** CLI-native stable id when the CLI provides one (TodoWrite has none; opencode todo row id). */
47
- mark?: string;
48
- }
49
- /**
50
- * Input contract for upsertFromTaskList. oRPC does NOT parse the JSON body into
51
- * `input` for a schema-less procedure (see the bindLane comment in this file) —
52
- * so without an explicit `.input()` schema, `input.lane_session` is ALWAYS
53
- * undefined and the procedure throws "requires lane_session" unconditionally.
54
- * Measured 2026-07-29: every pi/opencode whole-list `task_list` publish 400'd
55
- * for exactly this reason (the per-item upsertFromTaskHook path worked because
56
- * it unwraps `raw.json ?? raw`). Declaring the schema is the documented remedy
57
- * and the pattern every other `authed.input(...)` procedure in service-boot
58
- * already follows. The pi adapter (scala-hooks.ts syncTaskList) already sends
59
- * `{ lane_session, task_list, source }` — it was always valid; the server never
60
- * read it.
61
- */
62
- export declare const upsertFromTaskListInput: v.ObjectSchema<{
63
- readonly lane_session: v.StringSchema<undefined>;
64
- readonly task_list: v.ArraySchema<v.ObjectSchema<{
65
- readonly content: v.StringSchema<undefined>;
66
- readonly status: v.PicklistSchema<["pending", "in_progress", "completed"], undefined>;
67
- readonly mark: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
68
- }, undefined>, undefined>;
69
- readonly source: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
70
- }, undefined>;
71
- /** Who a lane IS — symmetric across orchestrator/agent roles and across CLIs. */
72
- export interface LaneIdentity {
73
- /** "tmux:%42" — authoritative pane identity ($TMUX_PANE). */
74
- pane: string;
75
- session?: string;
76
- /** pane-inventory inferCliKind: claude-code | opencode | codex | unknown. */
77
- cli_kind?: string;
78
- /** agent | orchestrator — both have tasks; the model does not assume a supervised agent. */
79
- role?: string;
80
- /**
81
- * Optional. work_items.organisation_id is NOT NULL; when the caller omits it
82
- * (auto-bind at SessionStart — an adopted or channel-dispatched lane has no
83
- * client org), bindLane defaults to the platform org via resolveBindOrg.
84
- */
85
- organisation_id?: string;
86
- }
87
- export interface WorkItem {
88
- id: string;
89
- kind: string;
90
- parent_id: string | null;
91
- organisation_id: string;
92
- title: string;
93
- status: string | null;
94
- position: string | null;
95
- completed: boolean | null;
96
- kind_data: Record<string, unknown>;
97
- }
98
- export type Prisma = {
99
- work_items: {
100
- findFirst: (a: unknown) => Promise<WorkItem | null>;
101
- findMany: (a: unknown) => Promise<WorkItem[]>;
102
- create: (a: unknown) => Promise<WorkItem>;
103
- update: (a: unknown) => Promise<WorkItem>;
104
- deleteMany: (a: unknown) => Promise<{
105
- count: number;
106
- }>;
107
- };
108
- cli_sessions: {
109
- findFirst: (a: unknown) => Promise<{
110
- id: string;
111
- label?: string | null;
112
- } | null>;
113
- };
114
- comments?: {
115
- findFirst: (a: unknown) => Promise<CommentRow | null>;
116
- findMany: (a: unknown) => Promise<Array<ProgressAcceptanceEvidence>>;
117
- };
118
- };
119
- /** A `comments` row — only the fields readAssignedBrief touches. */
120
- export interface CommentRow {
121
- content: string;
122
- created_at: Date;
123
- }
124
- /**
125
- * Resolve the org a lane's task is created under. Explicit when the lane knows
126
- * its org (a dispatched fleet lane carries one); defaults to the platform org
127
- * otherwise — an adopted or channel-dispatched pane has no client org, and the
128
- * platform org is the home for fleet/internal lane tasks (where the operator's
129
- * PM view reads), so auto-bind at SessionStart seeds the task there.
130
- */
131
- export declare function resolveBindOrg(explicit?: string): string;
132
- /**
133
- * Record a task-sync hook DISCARD to event_log so it is observable + queryable,
134
- * not silently swallowed by the hook command's `>/dev/null 2>&1 || true`. The
135
- * endpoint records it server-side regardless of what the hook does with stdout.
136
- * Fire-and-forget per event-log-is-the-only-durable-event-log. The headline
137
- * discard is "no-task-bound" (lane has no bound parent task — exactly the gap
138
- * that SessionStart auto-bind closes; once binding is automatic this becomes a
139
- * rare safety signal rather than the default outcome).
140
- */
141
- export declare function recordTaskSyncDiscard(reason: string, pane: string | null, extra?: Record<string, unknown>): void;
142
- /**
143
- * Record a discard AND return the soft {applied:false} body in one step — every
144
- * no-op path in upsertFromTaskHook goes through here so none can silently drop
145
- * an event. The returned shape matches the prior `{applied:false, reason,...}`.
146
- */
147
- export declare function discardApplied(reason: string, pane: string | null, extra?: Record<string, unknown>): {
148
- applied: false;
149
- reason: string;
150
- } & Record<string, unknown>;
151
- /**
152
- * Trim a task subject at the first tool-call marker.
153
- *
154
- * A subject arriving as `Cut judge false positives</subject>\n<parameter
155
- * name="description">Live gate blocks ~half...` is not a title with odd
156
- * punctuation — it is the raw tool call, and it renders on the dashboard as a
157
- * wall of XML where the operator expects a task name (observed live 2026-07-25,
158
- * 3 rows). The malformation happens upstream in the CLI's hook payload, which
159
- * this service does not control, so the defence belongs at the WRITE boundary:
160
- * `work_items` is the single source of truth for every surface, and once a
161
- * corrupted title lands there every reader shows it.
162
- *
163
- * Truncating rather than rejecting is deliberate: the text BEFORE the marker is
164
- * the real subject and is worth keeping. Dropping the row instead would lose a
165
- * task the lane genuinely created.
166
- */
167
- export declare function sanitizeTaskSubject(raw: string): string;
168
- export declare function classifyTaskHookEvent(evt: {
169
- hook_event_name?: unknown;
170
- task_subject?: unknown;
171
- }): "completed" | "created" | "tool";
172
- export declare const taskSyncRouter: {
173
- /**
174
- * Bind (create-or-confirm) the task a lane owns. Called from a SessionStart
175
- * adapter so the lane has a durable task row before its first todo write.
176
- * Idempotent: re-binding updates the identity (role/cli_kind can change) but
177
- * never orphans existing subtasks. After binding, links the lane's
178
- * cli_sessions is the runtime identity and work_items is the assignment.
179
- */
180
- bindLane: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
181
- headers: Headers;
182
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
183
- prisma: any;
184
- user: import("./auth-router.ts").User;
185
- orgId: string | null | undefined;
186
- }>, v.OptionalSchema<v.ObjectSchema<{
187
- readonly lane: v.OptionalSchema<v.ObjectSchema<{
188
- readonly pane: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
189
- readonly session: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
190
- readonly cli_kind: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
191
- readonly role: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
192
- readonly organisation_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
193
- }, undefined>, undefined>;
194
- readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
195
- readonly parent_id: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
196
- }, undefined>, undefined>, import("@orpc/contract").Schema<{
197
- task_id: string;
198
- created: boolean;
199
- }, {
200
- task_id: string;
201
- created: boolean;
202
- }>, Record<never, never>, Record<never, never>>;
203
- /**
204
- * AGENT→DB leg. Write a lane's CURRENT task list through to subtasks. The
205
- * list is authoritative for this lane (it's what the CLI just rendered), so
206
- * this is a full reconcile: create/update/delete to match. Matching is by
207
- * stable mark when the CLI provides one, else by content. Does NOT dispatch
208
- * a change notification — the lane that authored the list already has it.
209
- */
210
- upsertFromTaskList: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
211
- headers: Headers;
212
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
213
- prisma: any;
214
- user: import("./auth-router.ts").User;
215
- orgId: string | null | undefined;
216
- }>, v.ObjectSchema<{
217
- readonly lane_session: v.StringSchema<undefined>;
218
- readonly task_list: v.ArraySchema<v.ObjectSchema<{
219
- readonly content: v.StringSchema<undefined>;
220
- readonly status: v.PicklistSchema<["pending", "in_progress", "completed"], undefined>;
221
- readonly mark: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
222
- }, undefined>, undefined>;
223
- readonly source: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
224
- }, undefined>, import("@orpc/contract").Schema<{
225
- task_id: string;
226
- created: number;
227
- updated: number;
228
- deleted: number;
229
- total: number;
230
- }, {
231
- task_id: string;
232
- created: number;
233
- updated: number;
234
- deleted: number;
235
- total: number;
236
- }>, Record<never, never>, Record<never, never>>;
237
- /**
238
- * Claude Code PostToolUse:TaskCreate/TaskUpdate hook entry. Claude Code's
239
- * todo tool is the per-item Task* family (TaskCreate/TaskUpdate) — TodoWrite
240
- * was REMOVED in recent Claude Code; the hook matcher keys on
241
- * TaskCreate/TaskUpdate, never TodoWrite. The hook command posts the RAW hook
242
- * event (stdin) + an x-lane-pane header (tmux:$TMUX_PANE). Fired as a
243
- * PostToolUse:TaskCreate/Update hook (NOT a "TaskCreated" event — that is
244
- * not a real Claude Code hook event + never fired); this procedure
245
- * applies the per-item change (TaskCreate → new subtask keyed by the harness
246
- * task id; TaskUpdate → status/title flip on the matching subtask). Server-
247
- * side extraction keeps the hook command a trivial jq|curl. Accepts the event
248
- * raw (input.tool_name) OR oRPC-enveloped (input.json.tool_name). Session-
249
- * less: fn.taskSync is page-gate-exempt; localhost pane shell authenticates
250
- * as super-admin via resolveUser. Soft-returns on any no-op (never throws).
251
- */
252
- upsertFromTaskHook: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
253
- headers: Headers;
254
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
255
- prisma: any;
256
- user: import("./auth-router.ts").User;
257
- orgId: string | null | undefined;
258
- }>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
259
- applied: boolean;
260
- op: string;
261
- taskId: string;
262
- } | ({
263
- applied: false;
264
- reason: string;
265
- } & Record<string, unknown>), {
266
- applied: boolean;
267
- op: string;
268
- taskId: string;
269
- } | ({
270
- applied: false;
271
- reason: string;
272
- } & Record<string, unknown>)>, Record<never, never>, Record<never, never>>;
273
- /**
274
- * DB→AGENT backstop read. Returns the lane's current subtasks in the
275
- * normalized shape every CLI adapter maps to its native list. Called by the
276
- * SessionStart/UserPromptSubmit adapters so a pane never opens or continues
277
- * on stale tasks, and by a lane after it receives a "your tasks changed"
278
- * channel notification.
279
- */
280
- readTaskList: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
281
- headers: Headers;
282
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
283
- prisma: any;
284
- user: import("./auth-router.ts").User;
285
- orgId: string | null | undefined;
286
- }>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
287
- task_id: null;
288
- task_title: null;
289
- subtasks: never[];
290
- progress: {
291
- total: number;
292
- accepted: number;
293
- percentage: number;
294
- };
295
- } | {
296
- task_id: string;
297
- task_title: string;
298
- subtasks: TaskListItem[];
299
- progress: import("./task-sync-projection.ts").EvidenceProgress;
300
- }, {
301
- task_id: null;
302
- task_title: null;
303
- subtasks: never[];
304
- progress: {
305
- total: number;
306
- accepted: number;
307
- percentage: number;
308
- };
309
- } | {
310
- task_id: string;
311
- task_title: string;
312
- subtasks: TaskListItem[];
313
- progress: import("./task-sync-projection.ts").EvidenceProgress;
314
- }>, Record<never, never>, Record<never, never>>;
315
- /**
316
- * DB→AGENT self-brief leg. A spawned lane PULLS its own brief — nothing is
317
- * pasted, typed, passed as an argument or sent over a channel
318
- * (`action-emission-architecture.md` "The lane PULLS its brief"). The lane's
319
- * CLI extension reads its own session id on load, calls this procedure, and
320
- * reads the brief from the task's LATEST comment. The comment — not the
321
- * description, not a stale comment — is the brief for THIS run: every spawn
322
- * writes a NEW comment, so "what was this lane told" always has exactly one
323
- * answer (`assignment-as-dispatch`). Handler lives in task-sync-brief.ts
324
- * (router is at its line budget); mounted here so fn.taskSync surfaces it.
325
- */
326
- readAssignedBrief: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
327
- headers: Headers;
328
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
329
- prisma: any;
330
- user: import("./auth-router.ts").User;
331
- orgId: string | null | undefined;
332
- }>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
333
- work_item_id: string | null;
334
- comment_id: string | null;
335
- brief: string | null;
336
- comment_created_at: string | null;
337
- status: import("./task-sync-brief.ts").BriefReadStatus;
338
- }, {
339
- work_item_id: string | null;
340
- comment_id: string | null;
341
- brief: string | null;
342
- comment_created_at: string | null;
343
- status: import("./task-sync-brief.ts").BriefReadStatus;
344
- }>, Record<never, never>, Record<never, never>>;
345
- /** SPAWNER→DB brief mint: `spawn_agent_tab` turns an initialPrompt into the task row (brief = first comment) the lane self-briefs from; returns the work_item_id that rides the spawn payload. Handler in task-sync-assign.ts. */
346
- createBriefTask: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
347
- headers: Headers;
348
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
349
- prisma: any;
350
- user: import("./auth-router.ts").User;
351
- orgId: string | null | undefined;
352
- }>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
353
- work_item_id: string;
354
- comment_id: string;
355
- }, {
356
- work_item_id: string;
357
- comment_id: string;
358
- }>, Record<never, never>, Record<never, never>>;
359
- /** RUNTIME→DB lifecycle close: mark lane.live=false and reconcile task status before the ACP owner releases the session. */
360
- closeLane: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
361
- headers: Headers;
362
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
363
- prisma: any;
364
- user: import("./auth-router.ts").User;
365
- orgId: string | null | undefined;
366
- }>, v.ObjectSchema<{
367
- readonly lane_session: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "lane_session is required">]>;
368
- readonly disposition: v.PicklistSchema<["completed", "needs_retry", "failed", "orchestrator_closed", "orphaned"], undefined>;
369
- }, undefined>, import("@orpc/contract").Schema<{
370
- task_id: string;
371
- task_status: "archived" | "done";
372
- reconciled: boolean;
373
- }, {
374
- task_id: string;
375
- task_status: "archived" | "done";
376
- reconciled: boolean;
377
- }>, Record<never, never>, Record<never, never>>;
378
- /**
379
- * TAB→DB rename back-write: the session-picker `/rpc/rename` calls this after
380
- * renaming a tmux window to update the bound task's title BY SESSION (never
381
- * pane), so the tab bar and the project board never diverge
382
- * (`tab-rename-emits-back-to-task-title`). Handler in task-sync-rename.ts.
383
- */
384
- renameLaneTask: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
385
- headers: Headers;
386
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
387
- prisma: any;
388
- user: import("./auth-router.ts").User;
389
- orgId: string | null | undefined;
390
- }>, v.ObjectSchema<{
391
- readonly lane_session: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "lane_session is required">]>;
392
- readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, "title is required">]>;
393
- }, undefined>, import("@orpc/contract").Schema<{
394
- task_id: string | null;
395
- updated: boolean;
396
- }, {
397
- task_id: string | null;
398
- updated: boolean;
399
- }>, Record<never, never>, Record<never, never>>;
400
- /**
401
- * DB→AGENT realtime leg (explicit dispatch path). Record an out-of-band
402
- * change to a subtask's status (operator toggles it in the projects UI,
403
- * another lane edits a shared task) and notify the OWNING lane's pane that
404
- * its projection is stale. The pane's adapter re-reads (readTaskList) and
405
- * updates its native list. Symmetric counterpart to upsertFromTaskList:
406
- * there the lane is the originator (no self-echo); here the lane is the
407
- * recipient.
408
- *
409
- * Every call writes the canonical task-change comment for the active
410
- * cli_sessions row; the database comment emission is the delivery trigger.
411
- * There is no pane transport or secondary channel publisher here.
412
- */
413
- applyExternalChange: import("@orpc/server").DecoratedProcedure<import("@orpc/server").MergedInitialContext<Context & Record<never, never>, Context, Context>, import("@orpc/server").MergedCurrentContext<Context, {
414
- headers: Headers;
415
- resolveUser?: (headers: Headers, prisma: any) => Promise<import("./auth-router.ts").User | null>;
416
- prisma: any;
417
- user: import("./auth-router.ts").User;
418
- orgId: string | null | undefined;
419
- }>, import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<{
420
- task_id: string;
421
- cli_session_id: string | null;
422
- comment_id: string | null;
423
- notified: boolean;
424
- }, {
425
- task_id: string;
426
- cli_session_id: string | null;
427
- comment_id: string | null;
428
- notified: boolean;
429
- }>, Record<never, never>, Record<never, never>>;
430
- };
431
- /**
432
- * The Claude Code per-item task lifecycle applied to a lane's work_items
433
- * subtasks — the AGENT→DB leg for the Task* tool family (TaskCreate /
434
- * TaskUpdate / TaskDelete) and the dedicated TaskCreated / TaskCompleted events.
435
- *
436
- * Extracted verbatim from the upsertFromTaskHook ORPC handler so the FULL
437
- * lifecycle — created, in_progress, completed, deleted — is unit-testable with a
438
- * mock prisma (same testability split as claim-orchestrator-session, and the
439
- * router-handlers-only-execute half of planReconcile). The ORPC handler is now a
440
- * thin `authed` wrapper that delegates here; this function takes the exact
441
- * `(input, context)` the handler would have bound, so behaviour is unchanged.
442
- *
443
- * `task-projection-converges`: every state a task reaches must write through, or
444
- * the projection is an append-only log and the operator cannot see what a lane is
445
- * doing. The matcher covering TaskCreate|TaskUpdate|TaskDelete is what makes all
446
- * four states reach this handler; this body is what applies them.
447
- */
448
- export declare function upsertFromTaskHookHandler(input: unknown, context: Context): Promise<{
449
- applied: boolean;
450
- op: string;
451
- taskId: string;
452
- } | ({
453
- applied: false;
454
- reason: string;
455
- } & Record<string, unknown>)>;