@sema-agent/sdk 0.0.122 → 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.
Files changed (2) hide show
  1. package/openapi.yaml +273 -1
  2. package/package.json +1 -1
package/openapi.yaml CHANGED
@@ -2758,13 +2758,285 @@ paths:
2758
2758
  error: { type: string }
2759
2759
  missing: { type: array, items: { type: string } }
2760
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
+
2761
3030
  /metrics/summary:
2762
3031
  get:
2763
3032
  tags: [metrics]
2764
3033
  operationId: metricsSummary
2765
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.
2766
3036
  summary: Worker health/cost summary (ops).
2767
- description: Uses `metricsToken` (operator), not `x-agent-principal`. Shape is loose/ops-defined.
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.
2768
3040
  security:
2769
3041
  - metricsToken: []
2770
3042
  responses:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/sdk",
3
- "version": "0.0.122",
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",