@maudecode/talaria-web-contracts 1.20.0 → 1.21.0

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 (59) hide show
  1. package/dist/checkpoint.d.ts +78 -0
  2. package/dist/checkpoint.js +16 -0
  3. package/dist/checkpoint.js.map +1 -0
  4. package/dist/context-detail.d.ts +1 -1
  5. package/dist/gateway-session.d.ts +160 -3
  6. package/dist/gateway-session.js +23 -1
  7. package/dist/gateway-session.js.map +1 -1
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.js +4 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/mcp-cost-policy.d.ts +110 -0
  12. package/dist/mcp-cost-policy.js +24 -0
  13. package/dist/mcp-cost-policy.js.map +1 -0
  14. package/dist/outbound-drafts.d.ts +114 -0
  15. package/dist/outbound-drafts.js +20 -0
  16. package/dist/outbound-drafts.js.map +1 -0
  17. package/dist/prompt-queue.d.ts +96 -0
  18. package/dist/prompt-queue.js +19 -0
  19. package/dist/prompt-queue.js.map +1 -0
  20. package/dist/router.d.ts +2394 -80
  21. package/dist/routes/automation.d.ts +328 -9
  22. package/dist/routes/automation.js +16 -2
  23. package/dist/routes/automation.js.map +1 -1
  24. package/dist/routes/chat.d.ts +503 -16
  25. package/dist/routes/core.d.ts +2 -2
  26. package/dist/routes/git.d.ts +50 -0
  27. package/dist/routes/git.js +3 -2
  28. package/dist/routes/git.js.map +1 -1
  29. package/dist/routes/sessions.d.ts +1369 -38
  30. package/dist/routes/sessions.js +5 -0
  31. package/dist/routes/sessions.js.map +1 -1
  32. package/dist/routes/tools.d.ts +533 -29
  33. package/dist/routes/tools.js +19 -1
  34. package/dist/routes/tools.js.map +1 -1
  35. package/dist/routes/workspaces.d.ts +45 -0
  36. package/dist/routes/workspaces.js +5 -4
  37. package/dist/routes/workspaces.js.map +1 -1
  38. package/dist/sidecar/methods.d.ts +310 -10
  39. package/dist/sidecar/namespaces.d.ts +335 -13
  40. package/dist/sidecar/namespaces.js +20 -1
  41. package/dist/sidecar/namespaces.js.map +1 -1
  42. package/dist/sidecar/runtime.d.ts +43 -0
  43. package/dist/sidecar/runtime.js +12 -2
  44. package/dist/sidecar/runtime.js.map +1 -1
  45. package/dist/sidecar/version.d.ts +1 -1
  46. package/dist/sidecar/version.js +1 -1
  47. package/dist/sse.d.ts +126 -8
  48. package/dist/sse.js +7 -2
  49. package/dist/sse.js.map +1 -1
  50. package/dist/views.d.ts +1066 -36
  51. package/dist/views.js +58 -16
  52. package/dist/views.js.map +1 -1
  53. package/fixtures/sidecar/gateway.json +45 -0
  54. package/fixtures/sidecar/kanban.json +197 -0
  55. package/fixtures/sidecar/managed-buffers.json +16 -0
  56. package/fixtures/sidecar/mcp.json +12 -0
  57. package/fixtures/sidecar/outbound-drafts.json +1 -0
  58. package/fixtures/sidecar/runtime.json +3 -3
  59. package/package.json +1 -1
package/dist/views.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { McpCostPolicySchema } from './mcp-cost-policy.js';
1
2
  /**
2
3
  * Pinned response shapes shared by every consumer (formerly the frontend's
3
4
  * hand-written `src/contracts/*` schemas). Known fields are typed; every
@@ -5,11 +6,12 @@
5
6
  * that must survive a round trip (documented passthrough).
6
7
  */
7
8
  import { z } from 'zod';
9
+ import { OutboundDraftRefSchema } from './outbound-drafts.js';
8
10
  import { RunStatusSchema } from './run-status.js';
9
- import { AgentRefreshConfirmationSchema } from './sidecar/runtime.js';
11
+ import { AgentRefreshConfirmationSchema, AgentUpdateOperationSchema } from './sidecar/runtime.js';
10
12
  import { SpeedTierSchema } from './speed.js';
11
- import { ExecutionModeSchema, OwnerAttachmentSchema } from './gateway-session.js';
12
- import { CanonicalBotChatSchema, GatewayModeSchema, PluginOAuthClientSchema, PluginSettingFieldSchema, SkillCatalogIdentitySchema } from './sidecar/namespaces.js';
13
+ import { ExecutionModeSchema, OwnerAttachmentSchema, MessageReactionViewSchema } from './gateway-session.js';
14
+ import { KanbanInspectionNodeSchema, KanbanInspectionSnapshotSchema, CanonicalBotChatSchema, GatewayModeSchema, PluginOAuthClientSchema, PluginSettingFieldSchema, SkillCatalogIdentitySchema } from './sidecar/namespaces.js';
13
15
  export { SpeedTierSchema } from './speed.js';
14
16
  const Json = z.unknown();
15
17
  export const NullableString = z.string().nullable();
@@ -46,14 +48,17 @@ export const ToolEditDiffSchema = z.object({ added: z.number().int(), removed: z
46
48
  /** The latest server-normalized MCP update; never stored with the transcript. */
47
49
  export const ToolProgressSchema = z.object({ percent: z.number().min(0).max(100).nullable(), message: z.string().nullable() });
48
50
  /** Shared tool display fields. Progress is ephemeral, absent on older servers and null after completion. */
49
- export const ToolDisplayFields = { progress: ToolProgressSchema.nullable().optional(), kind: ToolKindSchema.optional(), target: z.string().optional(), edit_diff: ToolEditDiffSchema.optional() };
51
+ export const ToolDisplayFields = {
52
+ progress: ToolProgressSchema.nullable().optional(), kind: ToolKindSchema.optional(), target: z.string().optional(), edit_diff: ToolEditDiffSchema.optional(),
53
+ focus_path: NullableString.optional().describe('TAL-1458: a read or write call\'s file as a workspace-relative path, the file a companion page shows; absent for any other call or an absolute, home or out-of-workspace path.'),
54
+ };
50
55
  /**
51
56
  * TAL-315: a tool result's display sections, decided by the server's one rule for live, replayed and persisted results
52
57
  * alike. Clients show `stdout`, `stderr`, a labelled `error` and a labelled `exit_code` (sent only when worth showing), or
53
58
  * `text`, in that order, and never parse result text. Each string is capped server-side; a client without the field
54
59
  * shows `preview`.
55
60
  */
56
- export const ToolResultViewSchema = z.object({ text: z.string().optional(), stdout: z.string().optional(), stderr: z.string().optional(), error: z.string().optional(), exit_code: z.number().int().optional() });
61
+ export const ToolResultViewSchema = z.object({ outbound_draft: OutboundDraftRefSchema.optional(), text: z.string().optional(), stdout: z.string().optional(), stderr: z.string().optional(), error: z.string().optional(), exit_code: z.number().int().optional() });
57
62
  /**
58
63
  * Stored transcripts carry the OpenAI shape (`function.name` / `function.arguments` JSON string); live events carry `name` / `args`.
59
64
  * On an assistant row the server resolves every call (TAL-313, `session-sse-contract-v1.md`): Anthropic `tool_use` parts and
@@ -131,6 +136,7 @@ export const BackgroundLineSchema = z.object({ kind: z.enum(['agent', 'command',
131
136
  });
132
137
  export const MessageSchema = z.looseObject({
133
138
  role: z.string(), content: MessageContentSchema.optional(), id: MessageIdSchema.optional(), message_id: MessageIdSchema.optional(), timestamp: z.number().nullable().optional(),
139
+ reaction_view: MessageReactionViewSchema.optional(),
134
140
  attachments: z.array(AttachmentSchema).optional(), tool_calls: z.array(ToolCallSchema).optional(),
135
141
  /**
136
142
  * TAL-302: an assistant row's whole reasoning as one string (its reasoning fields, typed thinking parts and inline
@@ -288,8 +294,18 @@ export const CompressionReferenceSchema = z.object({
288
294
  });
289
295
  /** TAL-454: the chat a `/branch` copied, with its redacted title. */
290
296
  export const BranchedFromSchema = z.object({ session_id: SessionIdSchema, title: z.string() });
297
+ export const MAX_SOURCE_REFERENCES = 5;
298
+ export const SourceReferenceSchema = z.object({
299
+ session_id: z.string().regex(/^[A-Za-z0-9_-]{1,128}$/).describe('Retained logical conversation identity.'),
300
+ tip_session_id: z.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
301
+ profile: z.string().min(1).max(128),
302
+ });
303
+ export const AcceptedSourceReferenceSchema = SourceReferenceSchema.extend({ title: z.string() });
291
304
  /** Full session record from `GET /api/session` and mutations returning `session`. */
305
+ export const SessionActivityPhaseSchema = z.enum(['starting', 'running', 'waiting_for_approval', 'waiting_for_input', 'completed', 'failed', 'cancelled', 'stale']);
292
306
  export const SessionSchema = z.looseObject({
307
+ activity_phase: SessionActivityPhaseSchema.optional(),
308
+ source_references: z.array(AcceptedSourceReferenceSchema).optional(),
293
309
  context_detail_key: z.string().nullable().optional().describe('Opaque identity for open-only context details; changes with owner epoch, model and context.'),
294
310
  composer_state_key: z.string().optional().describe('Opaque profile-home and owner identity for device-local composer state; never an API session id.'),
295
311
  session_id: SessionIdSchema, title: z.string(), workspace: z.string().optional(), created_workspace: z.string().nullable().optional(), model: NullableString.optional(), model_provider: NullableString.optional(),
@@ -325,6 +341,7 @@ export const SessionSchema = z.looseObject({
325
341
  assistant_name: z.string().optional(),
326
342
  workspace_name: WorkspaceNameSchema,
327
343
  compression_reference: CompressionReferenceSchema.nullable().optional(),
344
+ focus_path: NullableString.optional().describe('TAL-1458: the last non-null `focus_path` of the session\'s persisted tool calls, so a reopened chat shows its file before any stream event; null when none.'),
328
345
  branched_from: BranchedFromSchema.nullable().optional().describe('TAL-454: the chat this one was branched from while it still loads (archived included); null for a compression continuation, a deleted or missing parent, and every other chat.'),
329
346
  });
330
347
  export const SessionEnvelopeSchema = z.looseObject({ session: SessionSchema });
@@ -355,6 +372,7 @@ export const SessionsListSchema = z.looseObject({
355
372
  archived_limit: z.number().int().nullable().optional(), archived_offset: z.number().int().optional(),
356
373
  });
357
374
  export const SessionStatusSchema = z.looseObject({
375
+ activity_phase: SessionActivityPhaseSchema.optional(),
358
376
  session_id: SessionIdSchema, title: z.string().optional(), active_stream_id: ActiveStreamIdSchema, active_turn_origin: ActiveTurnOriginSchema, agent_running: IsStreamingSchema, is_streaming: IsStreamingSchema, read_only: ReadOnlySchema, read_only_reason: ReadOnlyReasonSchema, owner_attachment: OwnerAttachmentSchema.optional(), message_count: z.number().optional(), model: NullableString.optional(),
359
377
  profile: NullableString.optional(), workspace: z.string().optional(), input_tokens: z.number().optional(), output_tokens: z.number().optional(), total_tokens: z.number().optional(), estimated_cost: NullableNumber.optional(), updated_at: UnixSeconds.optional(),
360
378
  });
@@ -385,7 +403,7 @@ export const ChatStartResponseSchema = z.looseObject({
385
403
  * stream's session: this run while it unwinds after a Stop, or a successor such as a goal continuation. A session delete
386
404
  * answers 409 while it is set, so a client draining a session before deleting it waits until it is null.
387
405
  */
388
- export const StreamStatusSchema = z.looseObject({ active: z.boolean(), stream_id: z.string(), replay_available: z.boolean().optional(), journal: Json.optional(), blocking_stream_id: z.string().nullable() });
406
+ export const StreamStatusSchema = z.looseObject({ activity_phase: SessionActivityPhaseSchema.optional(), active: z.boolean(), stream_id: z.string(), replay_available: z.boolean().optional(), journal: Json.optional(), blocking_stream_id: z.string().nullable() });
389
407
  /**
390
408
  * TAL-424: a pending steer is no longer pending without the Agent taking it: Edit and Cancel by the user, `stopped` by a
391
409
  * Stop (`text` goes back to the composer), or `followup` when the server sends it as the next turn. `steer_id` is null
@@ -396,7 +414,7 @@ export const SteerWithdrawnSchema = z.object({ steer_id: z.string().nullable(),
396
414
  * `withdrawn_steers` (TAL-426): the steers this Stop withdrew, the same `steer_withdrawn` (stopped) the stream carries, so
397
415
  * a client that stops reading the stream once the Stop answers still gives its own text back.
398
416
  */
399
- export const CancelResponseSchema = z.looseObject({ ok: z.boolean(), cancelled: z.boolean(), stream_id: z.string().optional(), withdrawn_steers: z.array(SteerWithdrawnSchema).optional(), error: z.string().optional() });
417
+ export const CancelResponseSchema = z.looseObject({ activity_phase: SessionActivityPhaseSchema.optional(), ok: z.boolean(), cancelled: z.boolean(), stream_id: z.string().optional(), withdrawn_steers: z.array(SteerWithdrawnSchema).optional(), error: z.string().optional() });
400
418
  export const SteerWithdrawRequestSchema = z.object({ session_id: SessionIdSchema, steer_id: z.string().min(1), reason: z.enum(['edit', 'cancel']) });
401
419
  /** `withdrawn: false` when the steer is unknown, already taken by the Agent (it then settles as consumed), or being sent. */
402
420
  export const SteerWithdrawResponseSchema = z.object({ withdrawn: z.boolean(), text: z.string().optional() });
@@ -493,7 +511,7 @@ export const BackgroundTaskSchema = z.object({
493
511
  * result. `agents_working` (TAL-373): a delegation is running or needs attention, whatever `kind` the list is narrowed to;
494
512
  * the chat's side panel opens on Agents for it. Absent from servers before TAL-373.
495
513
  */
496
- export const BackgroundTasksResponseSchema = z.object({ session_id: z.string(), tasks: z.array(BackgroundTaskSchema), agent_available: z.boolean(), agents_working: z.boolean().optional() });
514
+ export const BackgroundTasksResponseSchema = z.object({ activity_phase: SessionActivityPhaseSchema.optional(), session_id: z.string(), tasks: z.array(BackgroundTaskSchema), agent_available: z.boolean(), agents_working: z.boolean().optional() });
497
515
  export const BackgroundTaskResultSchema = z.object({ task_id: z.string(), text: z.string() });
498
516
  export const BackgroundDismissRequestSchema = z.object({ session_id: SessionIdSchema, task_id: z.string().min(1) });
499
517
  export const BackgroundStopResponseSchema = z.object({ outcome: z.enum(['stopped', 'not_running', 'not_found']) });
@@ -502,11 +520,16 @@ export const ShareCreateResponseSchema = z.looseObject({ ok: z.literal(true), sh
502
520
  export const ShareMessageSchema = z.looseObject({ role: z.string(), content: z.union([z.string(), z.null(), z.array(Json)]).optional() });
503
521
  export const ShareSchema = z.looseObject({ title: z.string(), messages: z.array(ShareMessageSchema), message_count: z.number().int(), created_at: z.number().optional(), updated_at: z.number().optional(), model: NullableString.optional() });
504
522
  export const ShareReadSchema = z.looseObject({ share: ShareSchema });
523
+ export const SourceReferenceSearchSchema = z.object({
524
+ sessions: z.array(SessionRowSchema.extend({ source_reference: SourceReferenceSchema })),
525
+ active_profile: z.string(), max_sources: z.number().int(),
526
+ });
505
527
  export const SessionNewRequestSchema = z.looseObject({
506
528
  title: z.string().optional(), workspace: z.string().optional(), workspace_inherited_from_prev_session: z.boolean().optional(), model: z.string().nullable().optional(), model_provider: z.string().nullable().optional(),
507
529
  profile: z.string().nullable().optional(), prev_session_id: z.string().optional(), project_id: z.string().nullable().optional(), worktree: Json.optional(), enabled_toolsets: z.array(z.string()).nullable().optional(), parent_session_id: z.string().optional(),
508
530
  execution_mode: ExecutionModeSchema.optional().describe('TAL-1040: `ignore_config` and `safe` start the session through the Agent owner; omitted means normal.'),
509
- request_id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/).optional().describe('TAL-1040: stable creation identity for a diagnostic chat. Reuse it only to retry the same creation.'),
531
+ request_id: z.string().regex(/^[A-Za-z0-9_-]{1,64}$/).optional().describe('TAL-1040: stable creation identity for a diagnostic or referenced chat. Reuse it only to retry the same creation.'),
532
+ source_references: z.array(SourceReferenceSchema).max(MAX_SOURCE_REFERENCES).optional().describe('Same-profile search pointers. Nonempty selections require request_id; unavailable or changed identities refuse creation.'),
510
533
  });
511
534
  /**
512
535
  * `streaming` (TAL-802): live dictation over `TRANSCRIBE_STREAM_PATH` would open for this profile (`stt.streaming` on, a live provider wire).
@@ -688,15 +711,17 @@ export const MaxTokensSchema = z.looseObject({ max_tokens: NullableNumber, max_t
688
711
  export const WorkspaceEntrySchema = z.looseObject({ name: z.string().min(1), path: z.string() });
689
712
  export const WorkspacesSchema = z.looseObject({ workspaces: z.array(WorkspaceEntrySchema), last: NullableString.optional(), terminal_remote_backend: z.boolean().optional() });
690
713
  export const FileEntrySchema = z.looseObject({
691
- name: z.string(), path: z.string().optional(), is_dir: z.boolean().optional(), type: z.string().optional(), size: z.number().nullable().optional(), mtime: z.number().nullable().optional(), mtime_ns: z.union([z.number(), z.string()]).nullable().optional(),
714
+ read_only: z.boolean().optional(), name: z.string(), path: z.string().optional(), is_dir: z.boolean().optional(), type: z.string().optional(), size: z.number().nullable().optional(), mtime: z.number().nullable().optional(), mtime_ns: z.union([z.number(), z.string()]).nullable().optional(),
692
715
  birthtime_ns: z.union([z.number(), z.string()]).nullable().optional(), hidden: z.boolean().optional(), workspace_sort_rank: z.number().int().optional(), target: z.string().optional(), target_outside_workspace: z.boolean().optional(),
693
716
  });
694
- export const DirListingSchema = z.looseObject({ path: z.string().optional(), entries: z.array(FileEntrySchema), signature: z.string().optional(), workspace: z.string().optional(), workspace_recovered: z.boolean().optional(), is_git: z.boolean().optional() });
717
+ export const FileSourceSchema = z.enum(['workspace', 'managed']);
718
+ const ManagedFileFields = { source: FileSourceSchema.optional(), read_only: z.boolean().optional(), write_semantics: z.literal('unconditional').optional() };
719
+ export const DirListingSchema = z.looseObject({ ...ManagedFileFields, unavailable: z.boolean().optional(), path: z.string().optional(), entries: z.array(FileEntrySchema), signature: z.string().optional(), workspace: z.string().optional(), workspace_recovered: z.boolean().optional(), is_git: z.boolean().optional() });
695
720
  /** How a workspace file renders (TAL-566): media streams from `/api/file/raw`; text kinds carry `content`. */
696
721
  export const FilePreviewKindSchema = z.enum(['text', 'markdown', 'csv', 'html', 'image', 'pdf', 'audio', 'video', 'binary']);
697
722
  /** `table` is a `csv` preview's leading rows (header first); `table_truncated` says the file has more. `preview_url` is an
698
723
  * `html` preview's app-relative frame URL, under which the page's relative assets also resolve. */
699
- export const FileContentSchema = z.looseObject({
724
+ export const FileContentSchema = z.looseObject({ ...ManagedFileFields, name: z.string().optional(),
700
725
  path: z.string().optional(), content: z.string().optional(), lines: z.number().optional(), size: z.number().optional(), truncated: z.boolean().optional(), binary: z.boolean().optional(), mime: z.string().optional(),
701
726
  preview: FilePreviewKindSchema.optional(), table: z.array(z.array(z.string())).optional(), table_truncated: z.boolean().optional(),
702
727
  preview_url: z.string().optional(),
@@ -818,7 +843,7 @@ export const UpdateTargetSchema = z.looseObject({
818
843
  versions: z.array(UpdateVersionSchema).describe('TAL-946: every installable Stable release newer than the installed one, newest first; empty unless `release_ready` can apply.'),
819
844
  folded_count: z.number().int().nonnegative().describe('How many `versions` are `folded`.'),
820
845
  });
821
- export const AgentRecoveryStateSchema = z.object({ phase: z.enum(['idle', 'running', 'waiting', 'complete', 'blocked']), attempt: z.number().int().nonnegative(), detail: z.string(), retry_at: z.string().nullable() });
846
+ export const AgentRecoveryStateSchema = z.object({ phase: z.enum(['idle', 'running', 'waiting', 'complete', 'blocked']), attempt: z.number().int().nonnegative(), detail: z.string(), retry_at: z.string().nullable(), operation_id: z.uuid().optional(), operation: AgentUpdateOperationSchema.optional(), verified_revision: z.string().regex(/^[a-f0-9]{40}$/).optional(), runtime_revision: z.string().regex(/^[a-f0-9]{40}$/).optional(), verified_version: z.string().nullable().optional() });
822
847
  export const UpdatesCheckSchema = z.looseObject({ agent_recovery: AgentRecoveryStateSchema.optional(), disabled: z.boolean().optional(), cached: z.boolean().optional(), channel: z.string().optional(), agent_channel: z.enum(['stable', 'experimental']).optional(), checked_at: z.number().optional(), include_agent: z.boolean().optional(), webui: UpdateTargetSchema.nullable().optional(), agent: UpdateTargetSchema.nullable().optional() });
823
848
  export const UpdatesSummarySchema = z.object({
824
849
  ok: z.boolean(), target: z.enum(['webui', 'agent']), summary: z.string(),
@@ -830,12 +855,15 @@ export const UpdatesSummarySchema = z.object({
830
855
  cached: z.boolean(),
831
856
  });
832
857
  export const UpdateApplySchema = z.looseObject({
858
+ recovery_only: z.boolean().optional().describe('Only a retained transaction was repaired; the selected update outcome remains unverified.'),
859
+ recovery_pending: z.boolean().optional().describe('The initiating operation remains active through automatic recovery; follow its notification_id without replaying the update.'),
860
+ verified_revision: z.string().regex(/^[a-f0-9]{40}$/).optional(), verified_version: z.string().nullable().optional(),
833
861
  recovery_compatibility: z.object({ manual_execution: z.boolean(), bot_chat_delivery: z.boolean() }).optional()
834
862
  .describe('Whether the target Agent can reconcile retained manual execution and pending Bot Chat records. A false value blocks the update before any source or repair-intent change.'),
835
863
  ok: z.boolean().optional(), status: z.string().optional(), error: z.string().optional(), message: z.string().optional(), lock: Json.optional(), confirmation_required: z.boolean().optional(), refresh_confirmation: AgentRefreshConfirmationSchema.optional(), candidate_revision: z.string().optional(), supported_revision: z.string().optional(), supported_version: z.string().optional(), agent_channel: z.enum(['stable', 'experimental']).optional(), notification_id: z.uuid().optional(), channel_switch: z.boolean().optional(), backup_dir: z.string().nullable().optional(), backup_failed: z.boolean().optional(), stash_conflict: z.boolean().optional(), gateway_restart: z.string().optional().describe('TAL-953: `waiting_for_idle` when an Agent update left the gateway restart to wait for the gateway\'s running work; the update notification reports its outcome.')
836
864
  });
837
865
  /** `verifying` (TAL-1138): the gateway restarted, and the server is checking that the new gateway process and the Agent runtime answer. */
838
- export const UpdateNotificationPhaseSchema = z.enum(['applying', 'awaiting_confirmation', 'waiting_for_idle', 'restarting', 'verifying', 'succeeded', 'blocked', 'failed', 'unknown']);
866
+ export const UpdateNotificationPhaseSchema = z.enum(['applying', 'awaiting_confirmation', 'waiting_for_idle', 'restarting', 'verifying', 'recovering', 'succeeded', 'blocked', 'failed', 'unknown']);
839
867
  export const UpdateNotificationActionSchema = z.object({
840
868
  id: z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),
841
869
  label: z.string().min(1).max(80),
@@ -848,10 +876,15 @@ export const UpdateNotificationDestinationSchema = z.object({
848
876
  });
849
877
  /** TAL-1138: one step of an update as its Updating dialog lists it; the server derives every label and state. */
850
878
  export const UpdateStepSchema = z.object({
851
- id: z.enum(['install', 'web_restart', 'ready', 'gateway_wait', 'gateway_restart', 'agent_ready']),
879
+ id: z.enum(['install', 'web_restart', 'ready', 'gateway_wait', 'gateway_restart', 'agent_ready', 'recovery']),
852
880
  label: z.string().min(1).max(80),
853
881
  state: z.enum(['done', 'active', 'pending', 'failed']),
854
882
  });
883
+ export const AgentUpdateRecoverySchema = z.object({
884
+ operation: AgentUpdateOperationSchema, attempt_error: z.string().max(2000).nullable(), runtime_revision: z.string().regex(/^[a-f0-9]{40}$/).nullable(),
885
+ rollback: z.boolean().nullable().optional(),
886
+ outcome: z.enum(['recovering', 'target_installed', 'baseline_restored', 'other_revision', 'blocked', 'unknown']),
887
+ });
855
888
  export const UpdateNotificationSchema = z.object({
856
889
  id: z.uuid(),
857
890
  kind: z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/),
@@ -873,6 +906,7 @@ export const UpdateNotificationSchema = z.object({
873
906
  verified_version: z.string().min(1).max(80).nullable(),
874
907
  /** The apply's own explanation of a failed or blocked attempt, or of a success that needs attention (an Agent update that kept local edits in the git stash), line breaks kept; null otherwise. */
875
908
  detail: z.string().max(2000).nullable(),
909
+ recovery: AgentUpdateRecoverySchema.optional(),
876
910
  unread: z.boolean(),
877
911
  active: z.boolean(),
878
912
  requires_interaction: z.boolean(),
@@ -926,7 +960,7 @@ export const PluginSchema = z.looseObject({ key: z.string(), name: z.string().op
926
960
  * `in_process`, so Settings recommends `plugins.isolation: host`; Talaria never sets the mode.
927
961
  */
928
962
  export const PluginsSchema = z.looseObject({ plugins: z.array(PluginSchema), empty: z.boolean().optional(), read_only: z.boolean().optional(), supported_hooks: z.array(z.string()).optional(), unavailable: z.boolean().optional(), plugin_isolation_advisory: z.boolean().optional() });
929
- export const McpServerSchema = z.looseObject({ name: z.string(), id: z.string().optional(), transport: z.string().optional(), enabled: z.boolean().optional(), can_toggle: z.boolean().optional().describe('Whether PATCH can enable or disable this server; false for invalid config.'), active: z.boolean().optional(), status: z.string().optional(), tools: z.number().optional(), tool_count: z.number().int().nullable().optional(), health: z.string().optional(), health_detail: z.string().optional(), health_checked_at: Json.optional(), health_pending: z.boolean().optional() });
963
+ export const McpServerSchema = z.looseObject({ cost_policy: McpCostPolicySchema.nullable().optional(), name: z.string(), id: z.string().optional(), transport: z.string().optional(), enabled: z.boolean().optional(), can_toggle: z.boolean().optional().describe('Whether PATCH can enable or disable this server; false for invalid config.'), active: z.boolean().optional(), status: z.string().optional(), tools: z.number().optional(), tool_count: z.number().int().nullable().optional(), health: z.string().optional(), health_detail: z.string().optional(), health_checked_at: Json.optional(), health_pending: z.boolean().optional() });
930
964
  export const McpServersSchema = z.looseObject({ servers: z.array(McpServerSchema), health_pending: z.boolean().optional(), reload_required: z.boolean().optional(), toggle_supported: z.boolean().optional() });
931
965
  /** TAL-818: one connected account of a Nous tool-gateway app; `name` is its alias, else the vendor label. `problem` is its gateway status while it is not active, else null. */
932
966
  export const ConnectorAccountViewSchema = z.object({ connection_id: z.string(), name: z.string(), problem: z.enum(['pending', 'failed', 'expired', 'revoked', 'inactive']).nullable(), status_reason: z.string().nullable(), active: z.boolean(), created_at: z.string() });
@@ -1061,6 +1095,14 @@ export const KanbanTaskPolicyShape = { available_actions: KanbanTaskActionsSchem
1061
1095
  export const KanbanTaskViewSchema = z.looseObject({ id: z.union([z.string(), z.number()]), title: z.string().optional(), status: z.string().optional(), assignee: NullableString.optional(), priority: z.union([z.string(), z.number()]).nullable().optional(), description: z.string().optional(), tags: z.array(z.string()).optional(), session_id: NullableString.optional(), archived: z.boolean().optional(), created_at: Json.optional(), updated_at: Json.optional(), ...KanbanTaskPolicyShape });
1062
1096
  /** A board column in the Agent workflow's order (TAL-796): `name` is the status key, `label` the Agent's English label. */
1063
1097
  export const KanbanColumnSchema = z.looseObject({ name: z.string(), label: z.string(), tasks: z.array(KanbanTaskViewSchema) });
1098
+ /** One bounded profile-scoped read shared by timeline and relationship layouts. Null timing means unknown, never planned effort. */
1099
+ export const KanbanInspectionSchema = KanbanInspectionSnapshotSchema.extend({
1100
+ nodes: z.array(KanbanInspectionNodeSchema.extend({ task: KanbanTaskViewSchema,
1101
+ ancestors: z.array(z.string()), descendants: z.array(z.string()), cycle: z.boolean(), running_lineage: z.boolean(),
1102
+ timing: z.object({ start: z.number().nullable(), end: z.number().nullable(), duration_seconds: z.number().nullable(), offset: z.number().nullable(), width: z.number().nullable() }),
1103
+ })).max(500),
1104
+ window: z.object({ start: z.number().nullable(), end: z.number().nullable() }),
1105
+ });
1064
1106
  /** One profile lane (TAL-567): an assignee's tasks (`null` = unassigned) across every board column, with its task count. */
1065
1107
  export const KanbanLaneSchema = z.object({ assignee: z.string().nullable(), count: z.number().int(), columns: z.array(KanbanColumnSchema) });
1066
1108
  export const KanbanBoardViewSchema = z.looseObject({ columns: z.array(KanbanColumnSchema).optional(), assignees: z.array(Json).optional(), filters: Json.optional(), latest_event_id: z.number().optional(), read_only: z.boolean().optional(), tenants: z.array(Json).optional(), changed: z.boolean().optional(),