@sema-agent/sdk 0.0.121 → 0.0.123
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.
- package/openapi.yaml +563 -1
- 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'
|
|
@@ -2468,13 +2758,285 @@ paths:
|
|
|
2468
2758
|
error: { type: string }
|
|
2469
2759
|
missing: { type: array, items: { type: string } }
|
|
2470
2760
|
|
|
2761
|
+
/v1/approvals/{approvalId}:
|
|
2762
|
+
parameters:
|
|
2763
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2764
|
+
- in: path
|
|
2765
|
+
name: approvalId
|
|
2766
|
+
required: true
|
|
2767
|
+
schema: { type: string }
|
|
2768
|
+
get:
|
|
2769
|
+
tags: [approvals]
|
|
2770
|
+
operationId: approvalsGet
|
|
2771
|
+
x-status: live # D-lane approval-store single-row read (SDK approvals.get, with an inbox fallback client-side).
|
|
2772
|
+
summary: Read ONE pending approval row by id (owner-gated — the row carries full tool-call args).
|
|
2773
|
+
description: >
|
|
2774
|
+
The approval row carries the FULL tool-call args (commands/paths/contents of a high-risk op), so the
|
|
2775
|
+
by-id read enforces the same tenant boundary as the list: operators read across tenants; everyone else
|
|
2776
|
+
reads ONLY their own scope (the guard fires at the SQL layer — no cross-tenant args even if an id
|
|
2777
|
+
leaks). Non-owner → 404 (never 403, no existence oracle). Present only on deployments with the
|
|
2778
|
+
D-lane approval store; the checkpoint-lane decide verb is `/v1/approvals/{sessionId}/decide`.
|
|
2779
|
+
responses:
|
|
2780
|
+
'200':
|
|
2781
|
+
description: The approval row (full args projection).
|
|
2782
|
+
content:
|
|
2783
|
+
application/json:
|
|
2784
|
+
schema: { type: object, additionalProperties: true }
|
|
2785
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
2786
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
2787
|
+
|
|
2788
|
+
/v1/memory/export:
|
|
2789
|
+
parameters:
|
|
2790
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2791
|
+
get:
|
|
2792
|
+
tags: [memory]
|
|
2793
|
+
operationId: memoryExport
|
|
2794
|
+
x-status: live # 142-S5 §1.4 per-scope export (DB memory plane only).
|
|
2795
|
+
summary: Per-scope memory export (transport-neutral full-entry array).
|
|
2796
|
+
description: >
|
|
2797
|
+
142-S5 §1.4 — export one scope's memory entries. The owner gate is the tenant boundary: a verified
|
|
2798
|
+
principal may export exactly its OWN user disk (`scope === user:<principal>`, core's mint) or be an
|
|
2799
|
+
explicit operator (ops/migration face); anything else → 404, never 403 (zero existence oracle).
|
|
2800
|
+
`org:*`/`userproj:*` keys are operator-only until the S3 registry; repo-backed `proj:*` keys never
|
|
2801
|
+
live in this DB (git is their authority — an owner asking gets an honestly empty set). 501 on a
|
|
2802
|
+
file memory backend (present ONLY with MEMORY_ENGINE_BACKEND=pg|tidb).
|
|
2803
|
+
parameters:
|
|
2804
|
+
- in: query
|
|
2805
|
+
name: scope
|
|
2806
|
+
required: true
|
|
2807
|
+
schema: { type: string }
|
|
2808
|
+
responses:
|
|
2809
|
+
'200':
|
|
2810
|
+
description: The export bundle.
|
|
2811
|
+
content:
|
|
2812
|
+
application/json:
|
|
2813
|
+
schema:
|
|
2814
|
+
type: object
|
|
2815
|
+
required: [scope, exportedAt, entries]
|
|
2816
|
+
properties:
|
|
2817
|
+
scope: { type: string }
|
|
2818
|
+
exportedAt: { type: string, format: date-time }
|
|
2819
|
+
entries: { type: array, items: { type: object, additionalProperties: true } }
|
|
2820
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
2821
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
2822
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
2823
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
2824
|
+
|
|
2825
|
+
/v1/memory/sync/{scope}:
|
|
2826
|
+
parameters:
|
|
2827
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2828
|
+
- in: path
|
|
2829
|
+
name: scope
|
|
2830
|
+
required: true
|
|
2831
|
+
schema: { type: string }
|
|
2832
|
+
description: 'Scope key, percent-encoded (keys carry `:`/`@`/`/`). Malformed escape → typed 400.'
|
|
2833
|
+
post:
|
|
2834
|
+
tags: [memory]
|
|
2835
|
+
operationId: memorySync
|
|
2836
|
+
x-status: live # 142-S2.5 central-side sync face (DB memory plane only).
|
|
2837
|
+
summary: Central-side memory sync (reconcile plan rides with the data).
|
|
2838
|
+
description: >
|
|
2839
|
+
142-S2.5 — the central authority half of two-way memory sync (the TOC/file side is the client). Gate
|
|
2840
|
+
order mirrors the export face verbatim: auth (401) → backend posture (501 on the file shape — a
|
|
2841
|
+
single-user file plane IS the TOC side, there is no central half to serve) → owner gate (404
|
|
2842
|
+
zero-oracle: own user disk or explicit operator) → shape validation (422 typed
|
|
2843
|
+
`memory_sync_invalid_body`). A 500 after partial application is an HONEST signal: replaying with the
|
|
2844
|
+
same baseRevs is idempotent self-healing (identical revs no-op throughout) — never silently swallowed.
|
|
2845
|
+
requestBody:
|
|
2846
|
+
required: true
|
|
2847
|
+
content:
|
|
2848
|
+
application/json:
|
|
2849
|
+
schema: { type: object, additionalProperties: true, description: 'The sync request (peer/baseRevs/patches — core reconcile contract).' }
|
|
2850
|
+
responses:
|
|
2851
|
+
'200':
|
|
2852
|
+
description: 'The sync outcome (core reconcile/nextSyncBaseline projection).'
|
|
2853
|
+
content:
|
|
2854
|
+
application/json:
|
|
2855
|
+
schema: { type: object, additionalProperties: true }
|
|
2856
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
2857
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
2858
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
2859
|
+
'422': { description: 'errorCode "memory_sync_invalid_body" — the request failed the typed shape gate.' }
|
|
2860
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
2861
|
+
|
|
2862
|
+
/v1/outcomes:
|
|
2863
|
+
parameters:
|
|
2864
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2865
|
+
get:
|
|
2866
|
+
tags: [outcomes]
|
|
2867
|
+
operationId: outcomesSummary
|
|
2868
|
+
x-status: live # design/73 §7 outcome-ledger read-only face.
|
|
2869
|
+
summary: Outcome-ledger aggregation read (mechanical signals only).
|
|
2870
|
+
description: >
|
|
2871
|
+
design/73 §7 — read-only aggregation over the outcome ledger (mechanical run signals; never a
|
|
2872
|
+
training view). Aggregations are per task-signature (×model) and would leak cross-tenant task/perf
|
|
2873
|
+
shape, so on a multi-tenant worker (REQUIRE_PRINCIPAL) the view is OPERATOR-ONLY (403 otherwise);
|
|
2874
|
+
single-user turnkey is open (the sole user IS the operator). `?signature=` filters to one aggregation
|
|
2875
|
+
key; `?includeAborted=true` adds infra-aborted rows (infra-health view). 501 on a File-sink worker
|
|
2876
|
+
(read the JSONL dataset directly).
|
|
2877
|
+
parameters:
|
|
2878
|
+
- in: query
|
|
2879
|
+
name: signature
|
|
2880
|
+
required: false
|
|
2881
|
+
schema: { type: string }
|
|
2882
|
+
- in: query
|
|
2883
|
+
name: includeAborted
|
|
2884
|
+
required: false
|
|
2885
|
+
schema: { type: boolean }
|
|
2886
|
+
responses:
|
|
2887
|
+
'200':
|
|
2888
|
+
description: Aggregation rows.
|
|
2889
|
+
content:
|
|
2890
|
+
application/json:
|
|
2891
|
+
schema: { type: object, additionalProperties: true }
|
|
2892
|
+
'403': { description: 'Multi-tenant worker: outcomes view is operator-only.' }
|
|
2893
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
2894
|
+
|
|
2895
|
+
/v1/sendfile-links:
|
|
2896
|
+
parameters:
|
|
2897
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2898
|
+
get:
|
|
2899
|
+
tags: [sendfile]
|
|
2900
|
+
operationId: sendfileLinksList
|
|
2901
|
+
x-status: live # SendUserFile ledger thin read face (multi-tenant governance).
|
|
2902
|
+
summary: List issued SendUserFile links (metadata + key only — no URLs by design).
|
|
2903
|
+
description: >
|
|
2904
|
+
The SendUserFile ledger's read face: which links has this tenant issued. Owner scope mirrors GET
|
|
2905
|
+
/v1/sessions — a principal caller is PINNED to its own scope (?scope= ignored); a fleet-wide (service
|
|
2906
|
+
token) caller may pass `?scope=` (ops view; absent = the `_` single-user sentinel). Keyset pagination:
|
|
2907
|
+
`?before=<uuidv7 id>` (time-ordered, newest first), `?limit=` 1..100 (default 50) — both strictly
|
|
2908
|
+
validated (malformed → 400, never a silent default). Returns METADATA + object key only, NO url: the
|
|
2909
|
+
ledger stores no URLs by design (public-track URLs are reconstructible from bucket+key; presigned ones
|
|
2910
|
+
would be expired — re-issuance is a future verb, not this list). 501 without a store backend + the
|
|
2911
|
+
SendUserFile issuer.
|
|
2912
|
+
parameters:
|
|
2913
|
+
- in: query
|
|
2914
|
+
name: before
|
|
2915
|
+
required: false
|
|
2916
|
+
schema: { type: string }
|
|
2917
|
+
- in: query
|
|
2918
|
+
name: limit
|
|
2919
|
+
required: false
|
|
2920
|
+
schema: { type: integer, minimum: 1, maximum: 100 }
|
|
2921
|
+
- in: query
|
|
2922
|
+
name: scope
|
|
2923
|
+
required: false
|
|
2924
|
+
schema: { type: string }
|
|
2925
|
+
description: Fleet-wide callers only; ignored for principal callers (pinned).
|
|
2926
|
+
responses:
|
|
2927
|
+
'200':
|
|
2928
|
+
description: 'One page: `{ links: [{id, filename, size, ttlSec, track, bucket, key, createdAt}], nextBefore? }`.'
|
|
2929
|
+
content:
|
|
2930
|
+
application/json:
|
|
2931
|
+
schema:
|
|
2932
|
+
type: object
|
|
2933
|
+
required: [links]
|
|
2934
|
+
properties:
|
|
2935
|
+
links: { type: array, items: { type: object, additionalProperties: true } }
|
|
2936
|
+
nextBefore: { type: string }
|
|
2937
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
2938
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
2939
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
2940
|
+
|
|
2941
|
+
/v1/workflows/{workflowRunId}/journal:
|
|
2942
|
+
parameters:
|
|
2943
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2944
|
+
- in: path
|
|
2945
|
+
name: workflowRunId
|
|
2946
|
+
required: true
|
|
2947
|
+
schema: { type: string }
|
|
2948
|
+
get:
|
|
2949
|
+
tags: [workflows]
|
|
2950
|
+
operationId: workflowsJournal
|
|
2951
|
+
x-status: live # [1402] per-agent journal read face (cloud/local isomorphic — three store backends, one contract).
|
|
2952
|
+
summary: Per-agent journal of a workflow run (bounded + redacted projection).
|
|
2953
|
+
description: >
|
|
2954
|
+
[1402] — the workflow's per-agent journal (what each agent() call returned), cloud/local isomorphic.
|
|
2955
|
+
Owner-gated via the run's scope; session-accept phase applies. Projection is bounded + redacted
|
|
2956
|
+
(`result` is LLM output — injection-surface discipline, first-line/300-char clips), stable ordinal
|
|
2957
|
+
order. Hard bounds: `?limit=` default 20 cap 50, `?offset=` cursor; SQL stores page at the DB
|
|
2958
|
+
(per-row 64KiB gate); file/in-memory stores load-then-project (single-machine shape, recorded
|
|
2959
|
+
trade-off). 501 without the journal store (SELF_ORCHESTRATION_ENABLED + a store backend).
|
|
2960
|
+
parameters:
|
|
2961
|
+
- in: query
|
|
2962
|
+
name: limit
|
|
2963
|
+
required: false
|
|
2964
|
+
schema: { type: integer, minimum: 1, maximum: 50 }
|
|
2965
|
+
- in: query
|
|
2966
|
+
name: offset
|
|
2967
|
+
required: false
|
|
2968
|
+
schema: { type: integer, minimum: 0 }
|
|
2969
|
+
responses:
|
|
2970
|
+
'200':
|
|
2971
|
+
description: 'One page: `{ runId, entries: [{callKey, ordinal, status, …}], nextOffset? }`.'
|
|
2972
|
+
content:
|
|
2973
|
+
application/json:
|
|
2974
|
+
schema:
|
|
2975
|
+
type: object
|
|
2976
|
+
required: [runId, entries]
|
|
2977
|
+
properties:
|
|
2978
|
+
runId: { type: string }
|
|
2979
|
+
entries: { type: array, items: { type: object, additionalProperties: true } }
|
|
2980
|
+
nextOffset: { type: integer }
|
|
2981
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
2982
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
2983
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
2984
|
+
|
|
2985
|
+
/v1/workflows/{workflowRunId}/agents/{label}/steer:
|
|
2986
|
+
parameters:
|
|
2987
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
2988
|
+
- in: path
|
|
2989
|
+
name: workflowRunId
|
|
2990
|
+
required: true
|
|
2991
|
+
schema: { type: string }
|
|
2992
|
+
- in: path
|
|
2993
|
+
name: label
|
|
2994
|
+
required: true
|
|
2995
|
+
schema: { type: string }
|
|
2996
|
+
description: The agent's label inside the workflow (the display label the script assigned).
|
|
2997
|
+
post:
|
|
2998
|
+
tags: [workflows]
|
|
2999
|
+
operationId: workflowsSteerAgent
|
|
3000
|
+
x-status: live # SVC-5 (design/97 CORE-5 #6) mid-flight workflow-agent steer.
|
|
3001
|
+
summary: Steer ONE running agent inside a workflow (replica-local live handle).
|
|
3002
|
+
description: >
|
|
3003
|
+
SVC-5 — unlike the RUN steer (a whole task run), this targets ONE running agent inside a workflow,
|
|
3004
|
+
addressed by runId + label. Delivery is replica-local (an in-memory bridge to the running TaskStream,
|
|
3005
|
+
like `steerableRuns`): live on THIS replica → injected, 200; running on another replica or
|
|
3006
|
+
settled/unknown → 409 `steering.not_running` (honest, never a silent drop). Content is fenced
|
|
3007
|
+
(untrusted DATA). Burns model budget — rate/quota/lease gates apply.
|
|
3008
|
+
requestBody:
|
|
3009
|
+
required: true
|
|
3010
|
+
content:
|
|
3011
|
+
application/json:
|
|
3012
|
+
schema:
|
|
3013
|
+
type: object
|
|
3014
|
+
required: [content]
|
|
3015
|
+
properties:
|
|
3016
|
+
content: { type: string, minLength: 1 }
|
|
3017
|
+
responses:
|
|
3018
|
+
'200':
|
|
3019
|
+
description: 'Injected. Body `{ runId, label, status: "running", delivery: "applied", marker }`.'
|
|
3020
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
3021
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
3022
|
+
'404': { $ref: '#/components/responses/NotFound' }
|
|
3023
|
+
'409':
|
|
3024
|
+
description: 'errorCode "steering.not_running" — agent settled/unknown, or live on another replica.'
|
|
3025
|
+
content:
|
|
3026
|
+
application/json:
|
|
3027
|
+
schema: { $ref: '#/components/schemas/ErrorResponse' }
|
|
3028
|
+
'501': { $ref: '#/components/responses/NotImplemented' }
|
|
3029
|
+
|
|
2471
3030
|
/metrics/summary:
|
|
2472
3031
|
get:
|
|
2473
3032
|
tags: [metrics]
|
|
2474
3033
|
operationId: metricsSummary
|
|
2475
3034
|
x-status: draft # ops surface; uses a metricsToken (NOT a principal). Shape loose.
|
|
3035
|
+
x-sdk: none # DELIBERATELY not in @sema-agent/sdk (2026-07-27 定性): ops/observability face, credential = metricsToken not a principal; README walks curl. Revocable — delete this key + the gate exemption to bring it in.
|
|
2476
3036
|
summary: Worker health/cost summary (ops).
|
|
2477
|
-
description:
|
|
3037
|
+
description: >
|
|
3038
|
+
Uses `metricsToken` (operator), not `x-agent-principal`. Shape is loose/ops-defined. Deliberately
|
|
3039
|
+
NOT wrapped by the SDK (see the `x-sdk` key) — ops tooling reads it with curl.
|
|
2478
3040
|
security:
|
|
2479
3041
|
- metricsToken: []
|
|
2480
3042
|
responses:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.123",
|
|
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",
|