@sema-agent/sdk 0.0.117 → 0.0.119
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 +136 -0
- package/package.json +1 -1
package/openapi.yaml
CHANGED
|
@@ -1213,6 +1213,26 @@ paths:
|
|
|
1213
1213
|
schema: { $ref: '#/components/schemas/PendingList' }
|
|
1214
1214
|
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1215
1215
|
|
|
1216
|
+
/v1/approvals/stream:
|
|
1217
|
+
parameters:
|
|
1218
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1219
|
+
get:
|
|
1220
|
+
tags: [approvals]
|
|
1221
|
+
operationId: approvalsStream
|
|
1222
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27(design/80 native push;SDK approvals.stream 消费)
|
|
1223
|
+
summary: SSE — pending-approval deltas (subscribe once instead of polling GET /v1/approvals).
|
|
1224
|
+
description: >
|
|
1225
|
+
Frames: `meta` ({type,version,mode:"approvals-delta",pollMs}) then `pending`/`resolved` deltas (each
|
|
1226
|
+
data payload mirrors its SSE event name in `data.type` — proxy-safe dispatch). Cross-replica by
|
|
1227
|
+
construction (polls the SHARED checkpoint table). 15-min cap + heartbeats; a DB blip retries, never
|
|
1228
|
+
kills the stream. Scope = the caller's principal (operator/trace token = fleet-wide).
|
|
1229
|
+
responses:
|
|
1230
|
+
'200':
|
|
1231
|
+
description: text/event-stream of meta/pending/resolved frames.
|
|
1232
|
+
content:
|
|
1233
|
+
text/event-stream:
|
|
1234
|
+
schema: { type: string }
|
|
1235
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1216
1236
|
/v1/approvals/{sessionId}/decide:
|
|
1217
1237
|
parameters:
|
|
1218
1238
|
- $ref: '#/components/parameters/PrincipalHeader'
|
|
@@ -1638,6 +1658,61 @@ paths:
|
|
|
1638
1658
|
schema: { $ref: '#/components/schemas/UsageInfo' }
|
|
1639
1659
|
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1640
1660
|
|
|
1661
|
+
/v1/usage/summary:
|
|
1662
|
+
parameters:
|
|
1663
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1664
|
+
get:
|
|
1665
|
+
tags: [usage]
|
|
1666
|
+
operationId: usageSummary
|
|
1667
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27(SDK usage.summary() 已消费)
|
|
1668
|
+
summary: Windowed usage totals (usage-analytics face).
|
|
1669
|
+
description: >
|
|
1670
|
+
READ-ONLY analytics aggregate over the caller's principal (operator/trace token = fleet-wide). Query:
|
|
1671
|
+
`from`/`to` (ISO), `owner` (fleet-wide callers only). Response is the analytics aggregate — an OPEN
|
|
1672
|
+
object (additive fields ride; consumers branch on known keys only).
|
|
1673
|
+
responses:
|
|
1674
|
+
'200':
|
|
1675
|
+
description: Aggregate totals for the window.
|
|
1676
|
+
content:
|
|
1677
|
+
application/json:
|
|
1678
|
+
schema: { type: object, additionalProperties: true }
|
|
1679
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1680
|
+
/v1/usage/series:
|
|
1681
|
+
parameters:
|
|
1682
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1683
|
+
get:
|
|
1684
|
+
tags: [usage]
|
|
1685
|
+
operationId: usageSeries
|
|
1686
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27(SDK usage.series() 已消费)
|
|
1687
|
+
summary: Usage time series (UTC buckets; empty buckets are OMITTED — consumers zero-fill).
|
|
1688
|
+
description: >
|
|
1689
|
+
Query: `metric` = tasks|tokensIn|tokensOut|costUsd, plus the summary window params. Buckets ride as an
|
|
1690
|
+
OPEN object array (additive fields ride).
|
|
1691
|
+
responses:
|
|
1692
|
+
'200':
|
|
1693
|
+
description: Time-series buckets (sparse — missing bucket = zero).
|
|
1694
|
+
content:
|
|
1695
|
+
application/json:
|
|
1696
|
+
schema: { type: object, additionalProperties: true }
|
|
1697
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1698
|
+
/v1/usage/breakdown:
|
|
1699
|
+
parameters:
|
|
1700
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1701
|
+
get:
|
|
1702
|
+
tags: [usage]
|
|
1703
|
+
operationId: usageBreakdown
|
|
1704
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27(SDK usage.breakdown() 已消费)
|
|
1705
|
+
summary: Usage broken down by dimension.
|
|
1706
|
+
description: >
|
|
1707
|
+
Query: `dimension` = principal|model (default principal), plus the summary window params. OPEN object.
|
|
1708
|
+
responses:
|
|
1709
|
+
'200':
|
|
1710
|
+
description: Per-dimension buckets.
|
|
1711
|
+
content:
|
|
1712
|
+
application/json:
|
|
1713
|
+
schema: { type: object, additionalProperties: true }
|
|
1714
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1715
|
+
|
|
1641
1716
|
/v1/policy:
|
|
1642
1717
|
parameters:
|
|
1643
1718
|
- $ref: '#/components/parameters/PrincipalHeader'
|
|
@@ -1762,6 +1837,67 @@ paths:
|
|
|
1762
1837
|
'404': { description: no pending question for this id (non-owner, answered, expired, or wrong replica) — no existence oracle. }
|
|
1763
1838
|
'501': { description: AskUserQuestion is not enabled on this worker (ASK_QUESTION_ENABLED). }
|
|
1764
1839
|
|
|
1840
|
+
/v1/tool-approvals/{id}/respond:
|
|
1841
|
+
parameters:
|
|
1842
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1843
|
+
- { name: id, in: path, required: true, schema: { type: string } }
|
|
1844
|
+
post:
|
|
1845
|
+
tags: [questions]
|
|
1846
|
+
operationId: toolApprovalRespond
|
|
1847
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27([816]/[820]② CC 三选卡;SDK toolApprovals.respond 消费)
|
|
1848
|
+
summary: Answer a live policy `ask` (the CC three-choice card). LIVE-ONLY + same-replica.
|
|
1849
|
+
description: >
|
|
1850
|
+
Body `{decision: "allow"|"allow_session"|"deny", updatedInput?}` (`allow_session` additionally arms the
|
|
1851
|
+
per-session allow-all for the fs-write family; `updatedInput` = ctrl+g edited args, server ≥1.28x G7).
|
|
1852
|
+
Owner-gated with NO existence oracle (wrong owner / wrong replica / after settle or TTL → 404); body is
|
|
1853
|
+
validated FIRST (400 is existence-independent). 501 when TOOL_APPROVAL_ENABLED is off.
|
|
1854
|
+
requestBody:
|
|
1855
|
+
required: true
|
|
1856
|
+
content:
|
|
1857
|
+
application/json:
|
|
1858
|
+
schema:
|
|
1859
|
+
type: object
|
|
1860
|
+
required: [decision]
|
|
1861
|
+
additionalProperties: true
|
|
1862
|
+
properties:
|
|
1863
|
+
decision: { type: string, enum: [allow, allow_session, deny] }
|
|
1864
|
+
updatedInput: { description: 'ctrl+g edited tool args (replaces the asked args on allow).' }
|
|
1865
|
+
responses:
|
|
1866
|
+
'200':
|
|
1867
|
+
description: Ack (`decision` echoed).
|
|
1868
|
+
content:
|
|
1869
|
+
application/json:
|
|
1870
|
+
schema: { type: object, additionalProperties: true }
|
|
1871
|
+
'400': { description: Malformed body (existence-independent). }
|
|
1872
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1873
|
+
'404': { description: Unknown/settled/expired/foreign approval (no existence oracle). }
|
|
1874
|
+
'501': { description: Live tool-approval HITL not enabled (TOOL_APPROVAL_ENABLED). }
|
|
1875
|
+
|
|
1876
|
+
/v1/side-query:
|
|
1877
|
+
parameters:
|
|
1878
|
+
- $ref: '#/components/parameters/PrincipalHeader'
|
|
1879
|
+
post:
|
|
1880
|
+
tags: [tasks]
|
|
1881
|
+
operationId: sideQuery
|
|
1882
|
+
x-status: live # spec-path-gate 首批回填 2026-07-27([1469] server 1.242;SDK sideQuery 消费)
|
|
1883
|
+
summary: One-shot brain-routed Q&A — no session side effects, no tools, no streaming (v1).
|
|
1884
|
+
description: >
|
|
1885
|
+
Utility transport for a shell-side one-off question. Probe `capabilities.sideQuery`. Body/response are
|
|
1886
|
+
OPEN objects (the brain answer rides `answer`; additive fields ride).
|
|
1887
|
+
requestBody:
|
|
1888
|
+
required: true
|
|
1889
|
+
content:
|
|
1890
|
+
application/json:
|
|
1891
|
+
schema: { type: object, additionalProperties: true }
|
|
1892
|
+
responses:
|
|
1893
|
+
'200':
|
|
1894
|
+
description: The one-shot answer.
|
|
1895
|
+
content:
|
|
1896
|
+
application/json:
|
|
1897
|
+
schema: { type: object, additionalProperties: true }
|
|
1898
|
+
'401': { $ref: '#/components/responses/Unauthorized' }
|
|
1899
|
+
'501': { description: side-query not enabled on this worker. }
|
|
1900
|
+
|
|
1765
1901
|
/v1/workflows:
|
|
1766
1902
|
parameters:
|
|
1767
1903
|
- $ref: '#/components/parameters/PrincipalHeader'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.119",
|
|
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",
|