@sema-agent/sdk 0.0.120 → 0.0.122

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 (2) hide show
  1. package/openapi.yaml +547 -0
  2. package/package.json +1 -1
package/openapi.yaml CHANGED
@@ -547,6 +547,296 @@ paths:
547
547
  application/json:
548
548
  schema: { $ref: '#/components/schemas/ErrorResponse' }
549
549
 
550
+ /v1/runs/{taskId}/compact:
551
+ parameters:
552
+ - $ref: '#/components/parameters/PrincipalHeader'
553
+ - $ref: '#/components/parameters/TaskIdPath'
554
+ post:
555
+ tags: [runs]
556
+ operationId: runsCompact
557
+ x-status: live # core 1.293 compact(opts); manual-compaction control leg.
558
+ summary: Request a manual compaction of a LIVE run (fires at the next safe turn boundary).
559
+ description: >
560
+ Manual compaction control. FIRE-AND-FORGET 202 — `compact()` resolves only once processed at the next
561
+ SAFE turn boundary (possibly a whole in-flight turn away), so the ack is immediate and the outcome
562
+ rides the run's OWN stream: a `compacted{trigger:"manual"}` event IF anything was summarized; the
563
+ other outcomes (failed/mooted/noop/blocked/disabled) emit NO event (a spinner must time out, not
564
+ block). `instructions` = the shell's targeted-summary directive, capped at 2048 CODE POINTS (the
565
+ engine's own cap — over-cap is a fail-loud 400 here, never a silently truncated 202). LIVE-only and
566
+ replica-local (`steerableRuns` handle): a run active on another replica or terminal → 409
567
+ `compact.not_running`. Owner-gated (operator may compact any tenant's run); burns model budget —
568
+ rate/quota/lease gates apply.
569
+ requestBody:
570
+ required: false
571
+ content:
572
+ application/json:
573
+ schema:
574
+ type: object
575
+ properties:
576
+ instructions: { type: string, minLength: 1, description: 'Targeted compaction directive; ≤2048 code points (engine cap, enforced fail-loud).' }
577
+ responses:
578
+ '202':
579
+ description: Accepted — compaction runs at the next turn boundary; watch the run stream for `compacted{trigger:"manual"}`.
580
+ content:
581
+ application/json:
582
+ schema:
583
+ type: object
584
+ required: [taskId, status, delivery]
585
+ properties:
586
+ taskId: { type: string }
587
+ status: { type: string }
588
+ delivery: { type: string, enum: [accepted] }
589
+ note: { type: string }
590
+ '400': { $ref: '#/components/responses/BadRequest' }
591
+ '401': { $ref: '#/components/responses/Unauthorized' }
592
+ '404': { $ref: '#/components/responses/NotFound' }
593
+ '409':
594
+ description: 'errorCode "compact.not_running" — run is terminal, or active on another replica (manual compact is replica-local).'
595
+ content:
596
+ application/json:
597
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
598
+ '501': { $ref: '#/components/responses/NotImplemented' }
599
+
600
+ /v1/runs/{taskId}/detach:
601
+ parameters:
602
+ - $ref: '#/components/parameters/PrincipalHeader'
603
+ - $ref: '#/components/parameters/TaskIdPath'
604
+ post:
605
+ tags: [runs]
606
+ operationId: runsDetach
607
+ x-status: live # core 1.207 design/116 (CC mid-flight ctrl+b) sync-leg detach verb.
608
+ summary: Move a RUNNING tool call of this run to the background (CC ctrl+b).
609
+ description: >
610
+ design/116 — `TaskStream.detach(toolCallId)`. Fire-and-forget by CONTRACT and race-safe core-side: a
611
+ request landing before the tool reads its signal still detaches; after it finished = no-op; unknown
612
+ toolCallId = no-op (fail-safe — but note the ≤256-char cap is load-bearing: an unknown id still
613
+ allocates a registry entry for the run's lifetime). Only a detach-capable env honors it
614
+ (`backgroundCapabilities.supportsDetach`). The outcome surfaces on the run's OWN stream: the
615
+ early-settled `tool_end` with the `detached:true` structured card, then the `b*` task notification.
616
+ LIVE-only + replica-local (like compact) → 409 `detach.not_running` otherwise. Owner-gated; mutating
617
+ but runs no model (rate-limited only, no quota gate — parity with cancel).
618
+ requestBody:
619
+ required: true
620
+ content:
621
+ application/json:
622
+ schema:
623
+ type: object
624
+ required: [toolCallId]
625
+ properties:
626
+ toolCallId: { type: string, minLength: 1, maxLength: 256 }
627
+ responses:
628
+ '202':
629
+ description: Requested — honest about carrying no confirmation (the run stream carries the outcome).
630
+ content:
631
+ application/json:
632
+ schema:
633
+ type: object
634
+ required: [taskId, toolCallId, delivery]
635
+ properties:
636
+ taskId: { type: string }
637
+ toolCallId: { type: string }
638
+ delivery: { type: string, enum: [requested] }
639
+ note: { type: string }
640
+ '400': { $ref: '#/components/responses/BadRequest' }
641
+ '401': { $ref: '#/components/responses/Unauthorized' }
642
+ '404': { $ref: '#/components/responses/NotFound' }
643
+ '409':
644
+ description: 'errorCode "detach.not_running" — run is terminal, or active on another replica.'
645
+ content:
646
+ application/json:
647
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
648
+ '501': { $ref: '#/components/responses/NotImplemented' }
649
+
650
+ /v1/runs/{taskId}/subagents/{target}/output:
651
+ parameters:
652
+ - $ref: '#/components/parameters/PrincipalHeader'
653
+ - $ref: '#/components/parameters/TaskIdPath'
654
+ - name: target
655
+ in: path
656
+ required: true
657
+ schema: { type: string }
658
+ description: 'Background-agent handle (`a*` short form) under this parent run.'
659
+ get:
660
+ tags: [runs]
661
+ operationId: runsSubagentOutput
662
+ x-status: live # [1488]③(b) background child read face (announced background_agent-ONLY contract, byte-stable).
663
+ summary: Read a BACKGROUND child's final report / current status (non-blocking).
664
+ description: >
665
+ [1488]③(b) — the background child read face. The fleet viewer gets `bg_notification` summaries only;
666
+ the child's FINAL assistant body lives in the core TaskRegistry (what the TaskOutput tool reads) and
667
+ is served here. Auth = the runs-face read pattern (verified principal → owner via the parent run row →
668
+ honest 404, no existence oracle); registry access is derived from the run row, NEVER caller-supplied.
669
+ Replica-local (in-process registry, like steer). Non-blocking: a still-running child returns its
670
+ current status honestly, no long-poll. This face is the announced `background_agent`-ONLY contract —
671
+ the generic task-handle verbs live under `/v1/runs/{taskId}/tasks/{target}/…`.
672
+ responses:
673
+ '200':
674
+ description: 'The registry projection. `content` = the child''s final assistant body (UNTRUSTED model output).'
675
+ content:
676
+ application/json:
677
+ schema:
678
+ type: object
679
+ required: [taskId, target]
680
+ properties:
681
+ taskId: { type: string }
682
+ target: { type: string }
683
+ content: { type: string }
684
+ output: { type: object, description: 'Registry details projection (status/kind/…), passed through verbatim.' }
685
+ '401': { $ref: '#/components/responses/Unauthorized' }
686
+ '404': { $ref: '#/components/responses/NotFound' }
687
+ '501': { $ref: '#/components/responses/NotImplemented' }
688
+
689
+ /v1/runs/{taskId}/subagents/{target}/resume:
690
+ parameters:
691
+ - $ref: '#/components/parameters/PrincipalHeader'
692
+ - $ref: '#/components/parameters/TaskIdPath'
693
+ - name: target
694
+ in: path
695
+ required: true
696
+ schema: { type: string }
697
+ description: 'The delegating tool call''s id (`parentToolCallId`) or the subagent''s agentName (ambiguous → 409).'
698
+ post:
699
+ tags: [runs]
700
+ operationId: runsResumeSubagent
701
+ x-status: live # design/122 ③ (CC dfe parity): revive a settled child on its retained session.
702
+ summary: REVIVE a SETTLED subagent with a new prompt (async, on its retained session).
703
+ description: >
704
+ design/122 — CC "resume the agent" parity. Always async: the revived child runs in the background on
705
+ its RETAINED session (requires the parent run to have set `retainSubagentSessions`); completion is
706
+ announced via the deployment notify sink. Resume is only legal AFTER settle (handles live until leg
707
+ end). Owner-gated via the parent run row; content is fenced (`redactSteerIn`); the child's session id
708
+ is a continuation capability and never appears in any response. BILLABLE (starts model work) —
709
+ rate/quota/lease gates apply.
710
+ requestBody:
711
+ required: true
712
+ content:
713
+ application/json:
714
+ schema:
715
+ type: object
716
+ required: [content]
717
+ properties:
718
+ content: { type: string, description: 'The revival prompt (untrusted DATA; fenced server-side).' }
719
+ responses:
720
+ '200':
721
+ description: 'Revived. Body `{ taskId, target, status, delivery, marker, note }`.'
722
+ '401': { $ref: '#/components/responses/Unauthorized' }
723
+ '404': { $ref: '#/components/responses/NotFound' }
724
+ '409':
725
+ description: 'core''s typed rejections verbatim as `errorCode`: resume.still_running / resume.retain_off / resume.evicted / resume.cap / resume.session_not_found (design/122 D2).'
726
+ content:
727
+ application/json:
728
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
729
+ '501': { $ref: '#/components/responses/NotImplemented' }
730
+
731
+ /v1/runs/{taskId}/subagents/{target}/stream:
732
+ parameters:
733
+ - $ref: '#/components/parameters/PrincipalHeader'
734
+ - $ref: '#/components/parameters/TaskIdPath'
735
+ - name: target
736
+ in: path
737
+ required: true
738
+ schema: { type: string }
739
+ description: 'Background-agent handle (`a*` short form) under this parent run.'
740
+ get:
741
+ tags: [runs]
742
+ operationId: runsSubagentStream
743
+ x-status: live # S2 [1520] per-agent live tail (core 1.370 bgAgentId).
744
+ summary: Per-agent LIVE TAIL (SSE) — content frames from connect time onward.
745
+ description: >
746
+ S2 — the "tail" half of replay+tail (replay/final report = the `/output` face). SSE frames: first an
747
+ `event: meta` frame (`{version, runId, target, status, seq?, live: "replica-local", replayFace}`),
748
+ then `event: forward` frames (text/reasoning deltas, tool_start/end, task_progress — same builder
749
+ discipline as the sync main stream's forward branch) and `event: heartbeat` keepalives (real frames,
750
+ not comment lines). Frames are produced only on the replica hosting the parent run ⇒ live frames are
751
+ replica-local (the meta declares it; a row running on another instance heartbeats only, never
752
+ fabricates). A terminal child ends the stream right after the meta (the replay face is the read
753
+ surface). Gates are byte-identical to the `/output` face (principal → owner → session, fail-closed
754
+ 404, no oracle).
755
+ responses:
756
+ '200':
757
+ description: 'SSE stream (`text/event-stream`): meta → forward*/heartbeat*.'
758
+ content:
759
+ text/event-stream:
760
+ schema: { type: string }
761
+ '401': { $ref: '#/components/responses/Unauthorized' }
762
+ '404': { $ref: '#/components/responses/NotFound' }
763
+ '501': { $ref: '#/components/responses/NotImplemented' }
764
+
765
+ /v1/runs/{taskId}/tasks/{target}/output:
766
+ parameters:
767
+ - $ref: '#/components/parameters/PrincipalHeader'
768
+ - $ref: '#/components/parameters/TaskIdPath'
769
+ - name: target
770
+ in: path
771
+ required: true
772
+ schema: { type: string }
773
+ description: 'EXACT task handle only (`b*` background bash, monitor, background agent) — agent-name / legacy-shellId resolution is deliberately not on the wire (fail-closed 404).'
774
+ get:
775
+ tags: [runs]
776
+ operationId: runsTaskOutput
777
+ x-status: live # [1499] CC TaskOutput human-side counterpart (generic task-handle verb family).
778
+ summary: Read a background task handle's output (CC TaskOutput human-side counterpart).
779
+ description: >
780
+ [1499] — the GENERIC task-handle read serving the full registry kind set (background_bash stdout,
781
+ monitor batches, background_agent final report). Whether a read consumes the output cursor depends on
782
+ the handle's shape — the top-level `cursorSemantics` key ("cursor" = new bytes per read | "full" =
783
+ re-readable) is minted server-side so consumers never parse content markers; absent on error/not_ready
784
+ shapes (no fake semantics). `workflow` handles are refused at the seam (journal face owns workflow
785
+ reads — a poll here would suppress the completion push). `?filter=` is NOT accepted (400): the wire
786
+ serves the clipped projection. Gates mirror the subagent output face (principal → owner → session).
787
+ responses:
788
+ '200':
789
+ description: 'Registry projection passed through verbatim; `content` is UNTRUSTED tool/model output.'
790
+ content:
791
+ application/json:
792
+ schema:
793
+ type: object
794
+ required: [taskId, target]
795
+ properties:
796
+ taskId: { type: string }
797
+ target: { type: string }
798
+ content: { type: string }
799
+ output: { type: object }
800
+ cursorSemantics: { type: string, enum: [cursor, full], description: 'G14: whether THIS read consumed the cursor. Absent on error/not_ready or unknown kinds.' }
801
+ '400': { $ref: '#/components/responses/BadRequest' }
802
+ '401': { $ref: '#/components/responses/Unauthorized' }
803
+ '404': { $ref: '#/components/responses/NotFound' }
804
+ '501': { $ref: '#/components/responses/NotImplemented' }
805
+
806
+ /v1/runs/{taskId}/tasks/{target}/stop:
807
+ parameters:
808
+ - $ref: '#/components/parameters/PrincipalHeader'
809
+ - $ref: '#/components/parameters/TaskIdPath'
810
+ - name: target
811
+ in: path
812
+ required: true
813
+ schema: { type: string }
814
+ description: 'EXACT task handle only (see the output verb); `workflow` handles refused.'
815
+ post:
816
+ tags: [runs]
817
+ operationId: runsTaskStop
818
+ x-status: live # [1499] CC TaskStop human-side counterpart.
819
+ summary: Stop a background task handle (CC TaskStop human-side counterpart).
820
+ description: >
821
+ [1499] — stop the handle's process. A stop whose kill did NOT land must not read as success: core
822
+ keeps the handle honest (status stays "running", error = the env failure code) and the wire surfaces
823
+ that as a 409 with a discriminated `errorCode` — stop.not_local (task attached to another instance) /
824
+ stop.park_arbiter_unreachable / stop.park_resume_won (a concurrent approval resume won the race) /
825
+ stop.parked (durably parked on a tool-approval — resolve the approval instead, nothing live to kill) /
826
+ stop.not_landed. Mutating but runs no model (rate-limited only, parity with detach). Gates mirror the
827
+ output verb.
828
+ responses:
829
+ '200':
830
+ description: 'Stopped — same projection shape as the output verb ({ taskId, target, content, output }).'
831
+ '401': { $ref: '#/components/responses/Unauthorized' }
832
+ '404': { $ref: '#/components/responses/NotFound' }
833
+ '409':
834
+ description: 'Stop did not land — discriminated `errorCode` (stop.not_local / stop.park_arbiter_unreachable / stop.park_resume_won / stop.parked / stop.not_landed); body includes the current projection.'
835
+ content:
836
+ application/json:
837
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
838
+ '501': { $ref: '#/components/responses/NotImplemented' }
839
+
550
840
  /v1/sessions:
551
841
  parameters:
552
842
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -719,6 +1009,263 @@ paths:
719
1009
  '404': { $ref: '#/components/responses/NotFound' }
720
1010
  '501': { $ref: '#/components/responses/NotImplemented' }
721
1011
 
1012
+ /v1/sessions/{sessionId}/head:
1013
+ parameters:
1014
+ - $ref: '#/components/parameters/PrincipalHeader'
1015
+ - in: path
1016
+ name: sessionId
1017
+ required: true
1018
+ schema: { type: string }
1019
+ get:
1020
+ tags: [sessions]
1021
+ operationId: sessionsHead
1022
+ x-status: live # [1075]② session-follow light probe (server >=1.225).
1023
+ summary: Light session-follow probe — the leaf pointer as a natural version number.
1024
+ description: >
1025
+ [1075]② — `leafId` is the session tree's leaf pointer; ANY append changes it, so it doubles as a
1026
+ version number. Serves an ETag (`"<leafId>"`, `"empty"` when the session has no entries); poll with
1027
+ `If-None-Match` and a hit is a zero-body 304 (idle-poll cost ≈ 0 — the deliberate alternative to a
1028
+ cross-replica session SSE fan-out; the SSE face `/events` exists separately, connection-capped).
1029
+ Owner-scoped (non-owner → 404, no existence oracle). 501 without a durable session store
1030
+ (SESSION_BACKEND=tidb|pg|local).
1031
+ parameters:
1032
+ - in: header
1033
+ name: If-None-Match
1034
+ required: false
1035
+ schema: { type: string }
1036
+ description: Previous ETag; on match the response is 304 with no body.
1037
+ responses:
1038
+ '200':
1039
+ description: The current leaf pointer (ETag header carries the same value).
1040
+ content:
1041
+ application/json:
1042
+ schema:
1043
+ type: object
1044
+ required: [sessionId, leafId]
1045
+ properties:
1046
+ sessionId: { type: string }
1047
+ leafId: { type: string, nullable: true, description: "null = session exists but has no entries yet." }
1048
+ '304': { description: 'Leaf unchanged since the presented ETag (no body).' }
1049
+ '401': { $ref: '#/components/responses/Unauthorized' }
1050
+ '404': { $ref: '#/components/responses/NotFound' }
1051
+ '501': { $ref: '#/components/responses/NotImplemented' }
1052
+
1053
+ /v1/sessions/{sessionId}/events:
1054
+ parameters:
1055
+ - $ref: '#/components/parameters/PrincipalHeader'
1056
+ - in: path
1057
+ name: sessionId
1058
+ required: true
1059
+ schema: { type: string }
1060
+ get:
1061
+ tags: [sessions]
1062
+ operationId: sessionsEvents
1063
+ x-status: live # [1196] session-level SSE head subscription.
1064
+ summary: 'Session-level SSE: `event: head` pushes (latest-wins) when the leaf pointer moves.'
1065
+ description: >
1066
+ [1196] — the true-subscription face over the same predicate as `/head`: an SSE stream that pushes
1067
+ `event: head` frames (data = the `/head` 200 body) whenever the session's leaf pointer changes,
1068
+ latest-wins (intermediate leaves may be skipped). `?lastLeafId=` is the cursor — semantically the
1069
+ ETag: when it matches the current leaf there is no initial frame; otherwise the current head is
1070
+ replayed immediately on subscribe. 25s comment-line heartbeats. Auth and store gates are exactly
1071
+ `/head`'s (owner-scoped 404; 501 without a durable session store). Connection cap exceeded →
1072
+ 503 + Retry-After — fall back to polling `/head` (advertised via `capabilities.sessionEvents`).
1073
+ parameters:
1074
+ - in: query
1075
+ name: lastLeafId
1076
+ required: false
1077
+ schema: { type: string }
1078
+ description: 'Cursor: the last seen leafId. Matching the current leaf suppresses the initial replay frame.'
1079
+ responses:
1080
+ '200':
1081
+ description: 'SSE stream (`text/event-stream`) of `event: head` frames.'
1082
+ content:
1083
+ text/event-stream:
1084
+ schema: { type: string }
1085
+ '401': { $ref: '#/components/responses/Unauthorized' }
1086
+ '404': { $ref: '#/components/responses/NotFound' }
1087
+ '501': { $ref: '#/components/responses/NotImplemented' }
1088
+ '503': { description: 'Subscription connection cap exceeded — Retry-After set; fall back to polling /head.' }
1089
+
1090
+ /v1/sessions/{sessionId}/init:
1091
+ parameters:
1092
+ - $ref: '#/components/parameters/PrincipalHeader'
1093
+ - in: path
1094
+ name: sessionId
1095
+ required: true
1096
+ schema: { type: string }
1097
+ get:
1098
+ tags: [sessions]
1099
+ operationId: sessionsInit
1100
+ x-status: live # E11 shell-host startup bundle.
1101
+ summary: One-call startup bundle for the shell banner (model + mode).
1102
+ description: >
1103
+ E11 (shell-host) — the one-call startup bundle so a shell renders its banner from ONE request instead
1104
+ of fanning out to /v1/models + /v1/policy + /v1/capabilities. Worker-global config surface (same
1105
+ posture as /v1/policy): principal OPTIONAL, enforced only under REQUIRE_PRINCIPAL. ADDITIVE contract —
1106
+ `model` and `mode` are the load-bearing fields today; `tools`/`agents`/`commands`/`cwd` are omitted
1107
+ (tolerate-absent; `cwd` is live-only E13 and never durable here).
1108
+ responses:
1109
+ '200':
1110
+ description: The startup bundle.
1111
+ content:
1112
+ application/json:
1113
+ schema:
1114
+ type: object
1115
+ required: [sessionId, model]
1116
+ properties:
1117
+ sessionId: { type: string }
1118
+ model:
1119
+ type: object
1120
+ required: [provider, modelId]
1121
+ properties:
1122
+ provider: { type: string }
1123
+ modelId: { type: string }
1124
+ mode: { type: string, description: "Worker autonomy mode; absent when unconfigured." }
1125
+ '401': { $ref: '#/components/responses/Unauthorized' }
1126
+
1127
+ /v1/sessions/{sessionId}/settings:
1128
+ parameters:
1129
+ - $ref: '#/components/parameters/PrincipalHeader'
1130
+ - in: path
1131
+ name: sessionId
1132
+ required: true
1133
+ schema: { type: string }
1134
+ get:
1135
+ tags: [sessions]
1136
+ operationId: sessionsSettings
1137
+ x-status: live # E24 read side (CC /config read). Write half needs a core seam — not advertised.
1138
+ summary: Effective merged settings view (read-only).
1139
+ description: >
1140
+ E24 (shell-host) — the effective merged settings the run obeys (CC /config read side). Worker-global
1141
+ config surface (principal optional unless REQUIRE_PRINCIPAL, same posture as /v1/policy and the E11
1142
+ init bundle). The PATCH half (runtime settings write) needs a core seam and is deliberately absent —
1143
+ no settings-write capability is advertised (honest read-only route).
1144
+ responses:
1145
+ '200':
1146
+ description: The effective view.
1147
+ content:
1148
+ application/json:
1149
+ schema:
1150
+ type: object
1151
+ required: [effective, applied]
1152
+ properties:
1153
+ effective:
1154
+ type: object
1155
+ description: 'Resolved worker config: model, mode?, approvalRequire, commandPolicy, limits {maxTaskCostUsd, maxTaskTokens}.'
1156
+ applied:
1157
+ type: object
1158
+ description: 'Echo of the resolved model ({ model }).'
1159
+ '401': { $ref: '#/components/responses/Unauthorized' }
1160
+
1161
+ /v1/sessions/{sessionId}/notify:
1162
+ parameters:
1163
+ - $ref: '#/components/parameters/PrincipalHeader'
1164
+ - in: path
1165
+ name: sessionId
1166
+ required: true
1167
+ schema: { type: string }
1168
+ post:
1169
+ tags: [sessions]
1170
+ operationId: sessionsNotify
1171
+ x-status: live # External task_notification injection (frame family = [446] bg_notification).
1172
+ summary: Inject an EXTERNAL task_notification into a session (live nudge or inbox park).
1173
+ description: >
1174
+ Inject an external completion/event notice into a session as a `task_notification` frame
1175
+ (task_type="external" is minted by core — an external caller can never impersonate an internal frame;
1176
+ sanitize/fencing/three-state delivery are core-side). Live half: the session's active stream on THIS
1177
+ replica gets a core notify verb → `delivery: "live"` (200). Idle half: parked into the session inbox
1178
+ (external key domain) and drained as a `task_notification` on the next stream open → `delivery:
1179
+ "parked"` (202). Owner-scoped fail-closed (unknown or foreign session → 404, no oracle); core contract
1180
+ rejections (`notify.*`) surface as 400 with `errorCode`, never silently parked. 501 without the
1181
+ session-ownership face or (park path) the workflow completion inbox.
1182
+ requestBody:
1183
+ required: true
1184
+ content:
1185
+ application/json:
1186
+ schema:
1187
+ type: object
1188
+ required: [task_id, status, summary]
1189
+ properties:
1190
+ task_id: { type: string, maxLength: 190 }
1191
+ status: { type: string, enum: [completed, failed, killed, cancelled, event] }
1192
+ summary: { type: string }
1193
+ result: { type: string }
1194
+ seq: { type: integer, minimum: 1 }
1195
+ source: { type: string, maxLength: 190 }
1196
+ responses:
1197
+ '200':
1198
+ description: Delivered onto the live stream.
1199
+ content:
1200
+ application/json:
1201
+ schema:
1202
+ type: object
1203
+ required: [sessionId, delivery]
1204
+ properties:
1205
+ sessionId: { type: string }
1206
+ delivery: { type: string, enum: [live] }
1207
+ '202':
1208
+ description: No live stream — parked in the session inbox, drained on the next stream open.
1209
+ content:
1210
+ application/json:
1211
+ schema:
1212
+ type: object
1213
+ required: [sessionId, delivery]
1214
+ properties:
1215
+ sessionId: { type: string }
1216
+ delivery: { type: string, enum: [parked] }
1217
+ note: { type: string }
1218
+ '400': { $ref: '#/components/responses/BadRequest' }
1219
+ '401': { $ref: '#/components/responses/Unauthorized' }
1220
+ '404': { $ref: '#/components/responses/NotFound' }
1221
+ '501': { $ref: '#/components/responses/NotImplemented' }
1222
+
1223
+ /v1/sessions/{sessionId}/wake:
1224
+ parameters:
1225
+ - $ref: '#/components/parameters/PrincipalHeader'
1226
+ - in: path
1227
+ name: sessionId
1228
+ required: true
1229
+ schema: { type: string }
1230
+ post:
1231
+ tags: [sessions]
1232
+ operationId: sessionsWake
1233
+ x-status: live # design/144 §3 wake arm.
1234
+ summary: Wake a task_done-parked session (message delivery, NOT a gate decision).
1235
+ description: >
1236
+ design/144 §3 — deliver a message (or an already-parked pendingSteer) to a session parked on a
1237
+ `task_done` checkpoint and resume it as the next turn's input. This is NOT a gate decision: it never
1238
+ allows/denies a pending action — a pending gate ⇒ 409 `wake.gate_pending` (resolve through that gate's
1239
+ own decide entry; approvals are never bypassed). Empty park + no message ⇒ nothing to deliver.
1240
+ Owner-scoped; operator principals may carry trusted (`<system-reminder>`-bearing) messages. Resume
1241
+ burns model budget — rate/quota/lease gates apply. 501 without the checkpoint store.
1242
+ requestBody:
1243
+ required: false
1244
+ content:
1245
+ application/json:
1246
+ schema:
1247
+ type: object
1248
+ properties:
1249
+ message: { type: string, minLength: 1 }
1250
+ responses:
1251
+ '202':
1252
+ description: Resumed — the woken leg is driving into the durable run log.
1253
+ content:
1254
+ application/json:
1255
+ schema:
1256
+ type: object
1257
+ required: [taskId, sessionId, status]
1258
+ properties:
1259
+ taskId: { type: string }
1260
+ sessionId: { type: string }
1261
+ status: { type: string }
1262
+ '400': { $ref: '#/components/responses/BadRequest' }
1263
+ '401': { $ref: '#/components/responses/Unauthorized' }
1264
+ '404': { description: 'No parked checkpoint for this session (nothing to wake), or session not visible to the caller.' }
1265
+ '409': { description: 'Pending gate (`wake.gate_pending` — decide it through its own entry) or resume context missing.' }
1266
+ '422': { description: '`steering.invalid_content` — the message failed the steering content gate.' }
1267
+ '501': { $ref: '#/components/responses/NotImplemented' }
1268
+
722
1269
  /v1/sessions/{sessionId}/policy:
723
1270
  parameters:
724
1271
  - $ref: '#/components/parameters/PrincipalHeader'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/sdk",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "description": "Typed, zero-runtime-dependency SDK for the Sema agent fleet usage plane. The shared substrate for all doors (CC/Codex MCP façade + web). Server-side only — tokens never enter the browser.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",