@sentisec/sdk 0.1.0-rc.6 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -4,12 +4,105 @@ All notable changes to this package are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
  Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ Every dated heading below is a version that exists on the npm registry,
8
+ dated by its registry publish time — except the topmost heading while its
9
+ release run is still in flight, which is dated by its release tag.
10
+ Versions that were prepared but never reached npm are listed under
11
+ **Unreleased** and are not installable.
12
+
7
13
  ---
8
14
 
9
15
  ## [Unreleased]
10
16
 
11
- Closes the endpoint trap S1-FU-05 found on the Python side. A reader
12
- running a local or self-hosted control plane had no way to say so:
17
+ ## [1.0.0] — 2026-10-17
18
+
19
+ ### Changed (in the source, not yet in any published version)
20
+
21
+ - **`Monitor.wrap()`'s "no adapter matched" error tells the truth.** It
22
+ ended with "Anthropic support lands with T-152", an internal card number
23
+ promising a release — but the Anthropic adapter has shipped since
24
+ `0.1.0-rc.4` and is registered. The message now names both shapes it
25
+ accepts: OpenAI `{baseURL, defaultHeaders, chat.completions.create}` and
26
+ Anthropic `{baseURL, defaultHeaders, messages.create}`.
27
+ - **The three methods this SDK does not implement say so.**
28
+ `Monitor.session()`, `Session.wrap()` and
29
+ `Session.exportForensicBundle()` threw messages promising they would
30
+ "land with" internal cards. They still throw, now with "is not
31
+ implemented in this SDK" and, where one exists, the method to use
32
+ instead (`Monitor.wrap(client)`). No signature or export changed.
33
+
34
+ ### 0.1.0 (GA)
35
+
36
+ Not published. The GA version number has never been cut; the general
37
+ availability release is still pending. Everything described in the
38
+ release-candidate entries below shipped under an `-rc.N` version.
39
+
40
+ ### 0.1.0-rc.3
41
+
42
+ Prepared but **never published** — the release run for this version did
43
+ not complete, so npm skips from `0.1.0-rc.2` to `0.1.0-rc.4`. The work
44
+ it carried (the `sentisec` bin wrapper and the zero-dependency
45
+ postinstall CLI fetcher) first reached the registry in `0.1.0-rc.4`, and
46
+ is documented there.
47
+
48
+ ---
49
+
50
+ ## [0.1.0-rc.7] — 2026-09-10
51
+
52
+ **Documentation-only release. No runtime change since `0.1.0-rc.6`** —
53
+ every exported name, call signature, thrown error, default and dependency
54
+ is byte-for-byte what `0.1.0-rc.6` shipped. Upgrading changes nothing you
55
+ can call.
56
+
57
+ ### Changed
58
+
59
+ - **The published TypeScript declarations now describe what the code
60
+ does.** The doc comments that ship inside `dist/*.d.ts` — the text your
61
+ editor shows on hover — carried internal task identifiers, references to
62
+ files in a private repository, and parity claims about a Python package
63
+ that the TypeScript source does not implement. All of it is replaced
64
+ with a plain description of the actual behaviour: what each wrapper
65
+ wraps, what each error means, and which fields it carries.
66
+ - **`README.md`** drops a reference to a path that does not exist in
67
+ anything you can install, and its feature list now matches the source.
68
+
69
+ ### Fixed
70
+
71
+ - **The version history in this file matches the npm registry.**
72
+ `0.1.0-rc.5` had no heading; `0.1.0-rc.6` is now recorded as the
73
+ version-only release it was; `0.1.0-rc.2` had shipped with no entry at
74
+ all; and the entries for `0.1.0` and `0.1.0-rc.3` no longer read as
75
+ though those versions are installable, because neither was ever
76
+ published. An earlier entry also named a hostname the SDK stopped using
77
+ before the first release candidate.
78
+
79
+ ---
80
+
81
+ ## [0.1.0-rc.6] — 2026-08-14
82
+
83
+ **Version-only release. No source changes since `0.1.0-rc.5`** — the
84
+ published tarball is identical in substance; only the version field
85
+ differs.
86
+
87
+ It exists so the npm `latest` dist-tag could move. `latest` had been
88
+ left pointing at `0.1.0-rc.1` (2026-05-07), so `npm install
89
+ @sentisec/sdk` was serving code from before the hosted-plane host change
90
+ (rc.2), the CLI bin wrapper and postinstall fetcher (rc.4), and the
91
+ `endpoint` override (rc.5). npm refuses to re-publish an existing
92
+ version, so graduating the pointer onto current code required a new
93
+ version number to point it at.
94
+
95
+ `latest` now resolves to `0.1.0-rc.6`; the `next` dist-tag resolves to
96
+ `0.1.0-rc.5`.
97
+
98
+ If you are already on `0.1.0-rc.5`, there is nothing here for you.
99
+
100
+ ---
101
+
102
+ ## [0.1.0-rc.5] — 2026-08-02
103
+
104
+ Closes an endpoint trap first found on the Python side. A reader running
105
+ a local or self-hosted control plane had no way to say so:
13
106
  `new Monitor({...})` always resolved to `https://api.sentisec.ch`, and
14
107
  `wrap()` rewrote the client's `baseURL` unconditionally — so their
15
108
  prompts left the machine. Python already had `Monitor(endpoint=...)`;
@@ -48,46 +141,40 @@ exists and the docs stop implying one is unnecessary.
48
141
 
49
142
  ## [0.1.0-rc.4] — 2026-05-17
50
143
 
51
- Routes the CLI binary fetch through the public Cloudflare R2 mirror
52
- at `https://releases.sentisec.ch/cli/` instead of the GitHub Releases
53
- URL directly. Keeps the public-facing scripts free of internal repo
54
- URLs (per `.claude/rules/02-opacity.md`).
55
-
56
- ### Changed
57
-
58
- - `scripts/install-binary.js` — `RELEASES_BASE` defaults to
59
- `https://releases.sentisec.ch/cli`; `SENTISEC_RELEASES_BASE` env
60
- var overrides. Manifest + tarball URL layout flattened to
61
- `/<tag>/<file>` to match the R2 bucket key prefix scheme.
62
-
63
- The CLI tarballs themselves are unchanged — the release-cli.yml
64
- workflow mirrors every cli-v* artifact from GitHub Releases into R2
65
- so this URL stays in sync.
66
-
67
- ---
68
-
69
- ## [0.1.0-rc.3] — 2026-05-17
70
-
71
- Adds the CLI bin wrapper + zero-dep postinstall fetcher (P-INST-04).
144
+ The first release to carry the CLI. Because `0.1.0-rc.3` never reached
145
+ npm, this version delivers **both** the bin wrapper / postinstall
146
+ fetcher prepared for rc.3 **and** the public download-mirror change made
147
+ on top of it. Upgrading from `0.1.0-rc.2` you get all of the following.
72
148
 
73
149
  ### Added
74
150
 
75
151
  - **`bin/sentisec.js`** — ESM shim that execs the platform-native
76
- CLI binary. Resolves the binary via a `PYMINOR` marker file under
77
- `node_modules/@sentisec/sdk/native/<platform>/<arch>/`. Prints
152
+ `sentisec` CLI binary. Resolves the binary via a `PYMINOR` marker file
153
+ under `node_modules/@sentisec/sdk/native/<platform>/<arch>/`. Prints
78
154
  curl / pipx recovery hints when the binary is absent.
79
- - **`scripts/install-binary.js`** — postinstall fetcher (zero deps,
80
- uses `node:https` + `node:crypto` + system `tar`). Downloads the
81
- matching `sentisec-cli-vX-<platform>-py<minor>.tar.gz` from GitHub
82
- Releases, verifies sha256, extracts under
155
+ - **`scripts/install-binary.js`** — postinstall fetcher with zero
156
+ dependencies (`node:https` + `node:crypto` + system `tar`). Downloads
157
+ the matching `sentisec-cli-vX-<platform>-py<minor>.tar.gz`, verifies
158
+ its sha256, and extracts under
83
159
  `node_modules/@sentisec/sdk/native/`. Soft-fails on every
84
- non-security error (CI guard, no python3, unsupported python-minor,
160
+ non-security error (CI guard, no `python3`, unsupported python-minor,
85
161
  manifest 404, network failure, tuple missing) so the SDK remains
86
- installable as a JS library; only sha256 mismatch hard-fails.
87
- - **`"bin": { "sentisec": "./bin/sentisec.js" }`** in package.json
88
- so `npm install -g @sentisec/sdk` puts `sentisec` on PATH.
162
+ installable as a plain JS library; only a sha256 mismatch hard-fails.
163
+ - **`"bin": { "sentisec": "./bin/sentisec.js" }`** in `package.json`, so
164
+ `npm install -g @sentisec/sdk` puts `sentisec` on `PATH`.
89
165
  - Env overrides: `SENTISEC_SKIP_POSTINSTALL`,
90
- `SENTISEC_NPM_FETCH_IN_CI`, `SENTISEC_CLI_VERSION_OVERRIDE`.
166
+ `SENTISEC_NPM_FETCH_IN_CI`, `SENTISEC_CLI_VERSION_OVERRIDE`,
167
+ `SENTISEC_RELEASES_BASE`.
168
+
169
+ ### Changed
170
+
171
+ - The CLI download now goes through the public release mirror at
172
+ `https://releases.sentisec.ch/cli` (`RELEASES_BASE` in
173
+ `scripts/install-binary.js`), overridable with
174
+ `SENTISEC_RELEASES_BASE`. Manifest and tarball URLs use a flat
175
+ `/<tag>/<file>` layout to match the mirror's key prefixes. The CLI
176
+ tarballs themselves are unchanged — every published CLI artifact is
177
+ mirrored to that host, so the URL stays in sync.
91
178
 
92
179
  ### Supports
93
180
 
@@ -96,63 +183,78 @@ Adds the CLI bin wrapper + zero-dep postinstall fetcher (P-INST-04).
96
183
 
97
184
  ---
98
185
 
99
- ## [0.1.0] — 2026-04-22
186
+ ## [0.1.0-rc.2] — 2026-05-12
100
187
 
101
- First public release of `@sentisec/sdk`. Ships the full Phase-1.5 TS SDK:
188
+ Points the SDK at the hosted plane's current address. Published
189
+ alongside the control-plane release that moved the ingress hostname.
190
+
191
+ ### Changed
192
+
193
+ - The default rewrite target for `wrap()` is now
194
+ `https://api.sentisec.ch/ws/<workspace>/v1`. `0.1.0-rc.1` shipped the
195
+ retired `ingress.sentisec.ch` host, which no longer answers — **any
196
+ installation still on `0.1.0-rc.1` must upgrade**, or pass an explicit
197
+ `wrap(client, { baseUrl })`.
198
+ - `DEFAULT_INGRESS_TEMPLATE` (exported) and the OpenAI / Anthropic wrap
199
+ docstrings updated to the same host. No API shape changed; this is a
200
+ destination change only.
201
+
202
+ ---
203
+
204
+ ## [0.1.0-rc.1] — 2026-05-07
205
+
206
+ First release of `@sentisec/sdk` on npm. Ships the full TypeScript SDK:
102
207
  Monitor + OpenAI wrap + Anthropic wrap + SSE streaming adapter.
103
208
 
209
+ > Superseded. The hosted-plane host it rewrites to was retired in
210
+ > `0.1.0-rc.2`; install `0.1.0-rc.6` (the `latest` tag) instead.
211
+
104
212
  ### Added
105
213
 
106
- - **`Monitor`** — configuration object; validates policy id against built-in
107
- registry (`research_agent`, `customer_support`, `coding_agent`) and `.yaml`
108
- path shape. Throws `UnknownPolicyError` for unrecognised ids.
109
- - **`Monitor.wrap(client)`** — polymorphic vendor-dispatch:
110
- - **OpenAI** (`wrap-openai.ts`, T-151): rewrites `baseURL` to
111
- `https://ingress.sentisec.ch/ws/<workspace>/v1`, injects
112
- `x-sentisec-session-id` header, translates proxy HALT body to
214
+ - **`Monitor`** — configuration object; validates the policy id against
215
+ the built-in registry (`research_agent`, `customer_support`,
216
+ `coding_agent`) and the `.yaml` bundle-path shape. Throws
217
+ `UnknownPolicyError` for anything else.
218
+ - **`Monitor.prototype.wrap(client)`** — polymorphic vendor dispatch:
219
+ - **OpenAI** (`wrap-openai.ts`): rewrites `baseURL` to the
220
+ workspace-scoped Sentisec path, injects an `x-sentisec-session-id`
221
+ header, and translates a HALT response body into
113
222
  `SentisecHijackError`.
114
- - **Anthropic** (`wrap-anthropic.ts`, T-152): same URL/header
115
- rewrite; translates HALT body to a synthetic `tool_use` content
116
- block (`sentisec_block`) by default. Opt-in exception surface via
223
+ - **Anthropic** (`wrap-anthropic.ts`): same URL and header rewrite;
224
+ translates a HALT body into a synthetic `tool_use` content block
225
+ (`sentisec_block`) by default. Opt-in exception surface via
117
226
  `{ onBlock: "throw" }` → `SentisecAnthropicBlockError`.
118
- - **`wrapOpenAIStream` / `wrapAnthropicStream`** — SSE streaming adapters
119
- (`streaming.ts`, T-153):
227
+ - **`wrapOpenAIStream` / `wrapAnthropicStream`** — SSE streaming
228
+ adapters (`streaming.ts`):
120
229
  - Consume `fetch` + `ReadableStream`; browser-compatible and
121
230
  Node-compatible (Node 20+ built-in fetch).
122
- - `AsyncIterator<OpenAIStreamChunk>` / `AsyncIterator<AnthropicStreamEvent>`.
123
- - Attaches `sentisec: {verdict, session_id}` to the final clean-exit chunk.
124
- - Mid-stream HALT: yields a synthetic HALT sentinel and terminates.
125
- - `AbortSignal` support: abort mid-stream yields a `session_closed`
231
+ - `AsyncIterator<OpenAIStreamChunk>` /
232
+ `AsyncIterator<AnthropicStreamEvent>`.
233
+ - Attach `sentisec: {verdict, session_id}` to the final clean-exit
234
+ chunk.
235
+ - Mid-stream HALT: yield a synthetic HALT sentinel and terminate.
236
+ - `AbortSignal` support: aborting mid-stream yields a `session_closed`
126
237
  sentinel and stops iteration.
127
238
  - **Error surface** (pinned at `sdk_error_surface_version: v1.0-phase1`):
128
- - `SentisecError` (base)
129
- - `UnknownPolicyError`
130
- - `VerifierBackendNotConfigured`
131
- - `TaskTamperError`
132
- - `SentisecHijackError` (OpenAI HALT)
133
- - `SentisecAnthropicBlockError` (Anthropic HALT opt-in)
239
+ `SentisecError` (base), `UnknownPolicyError`,
240
+ `VerifierBackendNotConfigured`, `TaskTamperError`,
241
+ `SentisecHijackError` (OpenAI HALT), `SentisecAnthropicBlockError`
242
+ (Anthropic HALT, opt-in).
134
243
  - **Type exports**: `ResponsePolicy`, `SessionStatus`, `BuiltinPolicy`,
135
244
  `MonitorConfig`, `OpenAILike`, `AnthropicLike`, `WrapOptions`,
136
245
  `OpenAIStreamChunk`, `AnthropicStreamEvent`, `Verdict`, `VerdictValue`,
137
246
  `StreamOptions`, `StreamCloseReason`, and the full Anthropic
138
247
  message-shape family.
139
- - **Apache-2.0 license** (Sentisec defensive-patent posture; ADR D-007).
140
- - **Dual CJS/ESM exports**: `dist/index.js` (ESM) + `dist/index.cjs` (CJS)
141
- + `dist/index.d.ts` types.
142
- - **SLSA provenance attestation** via `.github/workflows/publish-sdk.yml`
143
- (manual-trigger, `npm publish --provenance`).
144
-
145
- ### Implementation cards
146
-
147
- T-150 (scaffold), T-151 (OpenAI wrap), T-152 (Anthropic wrap),
148
- T-153 (streaming adapter), T-154 (publish prep + dry-run).
149
-
150
- ---
248
+ - **Apache-2.0 license.**
249
+ - **Dual CJS/ESM exports**: `dist/index.js` (ESM) + `dist/index.cjs`
250
+ (CJS) + `dist/index.d.ts` types.
151
251
 
152
- ## [0.1.0-rc.1] — 2026-04-22
252
+ ### Known limitations in this release
153
253
 
154
- Release candidate. Functionally identical to `0.1.0`; published to npm
155
- for final integration check before the GA tag.
254
+ - `Monitor.prototype.session()` and `Session.wrap()` are unimplemented
255
+ placeholders and throw when called. The supported entry point is
256
+ `Monitor.prototype.wrap(client)`. They remain unimplemented in every
257
+ version published so far and are slated for removal.
156
258
 
157
259
  ---
158
260
 
package/README.md CHANGED
@@ -44,8 +44,8 @@ Resolution order, highest first:
44
44
  export SENTISEC_ENDPOINT=http://localhost:8080
45
45
  ```
46
46
 
47
- Identical field, identical precedence, identical failure mode as the
48
- Python SDK's `Monitor(endpoint=...)`.
47
+ The Python SDK also supports `SENTISEC_ENDPOINT`, but resolves saved
48
+ credentials and uses different proxy paths; see the feature table below.
49
49
 
50
50
  **`wrap()` replaces your client's `baseURL`.** That is what the wrapper
51
51
  is for — traffic has to go through Sentisec to be gated. But if your
@@ -253,11 +253,22 @@ const monitor = new Monitor({
253
253
 
254
254
  ---
255
255
 
256
- ## Python parity
256
+ ## Features and Python SDK differences
257
257
 
258
- Every public symbol in this package has a 1:1 counterpart in
259
- `platform/sentisec/sdk/`. The error-surface is a cross-language contract
260
- pinned at `sdk_error_surface_version: v1.0-phase1`.
258
+ The TypeScript SDK and the Python package `sentisec-sdk` expose different
259
+ APIs. Choose the integration for your language; they are not drop-in
260
+ replacements for each other.
261
+
262
+ | Feature | TypeScript (`@sentisec/sdk`) | Python (`sentisec-sdk`) |
263
+ |---|---|---|
264
+ | Provider wrappers | `monitor.wrap(client)` dispatches to OpenAI or Anthropic and returns the same client. | `monitor.wrap_openai(client)` and `monitor.wrap_anthropic(client)` return the same client. |
265
+ | Proxy destination | Appends `/ws/<customerId>/v1` to the endpoint host; `wrap(client, { baseUrl })` overrides the complete URL. | Appends `/v1/proxy/openai` or `/v1/proxy/anthropic` to the endpoint host. |
266
+ | Configuration | `apiKey`, `model` and `task` are required constructor fields; `customerId` defaults to `cust_local`. Endpoint precedence is wrap override, constructor, environment, hosted default. | Resolves credentials from explicit arguments, environment and saved profiles; the endpoint falls back to the hosted default. |
267
+ | Response handling | OpenAI HALT responses raise `SentisecHijackError`. Anthropic returns a synthetic block tool-use response by default, or raises `SentisecAnthropicBlockError` with `onBlock: "throw"`. | Thin wrappers rewrite the destination and API key; response handling remains with the provider client. |
268
+ | Streaming | Separate `wrapOpenAIStream` and `wrapAnthropicStream` helpers expose verdict metadata and AbortSignal support. | Thin wrappers leave the provider client's streaming interface in place; no matching Sentisec streaming helpers are exported. |
269
+ | Session lifecycle and forensic export | `Monitor.session()`, `Session.wrap()` and `Session.exportForensicBundle()` are reserved methods that currently throw. Use `Monitor.wrap()` for provider calls. | Exports a frozen `Session` record; `Monitor` has no session lifecycle or forensic export methods. |
270
+
271
+ Matching type names do not imply feature parity between the distributions.
261
272
 
262
273
  ---
263
274
 
package/dist/index.cjs CHANGED
@@ -299,7 +299,7 @@ function installWrap(MonitorCtor) {
299
299
  }
300
300
  }
301
301
  throw new Error(
302
- `Monitor.wrap: no registered vendor adapter matched the client. Registered vendors: [${registry.map((e) => e.name).join(", ")}]. OpenAI shape requires {baseURL, defaultHeaders, chat.completions.create}; Anthropic support lands with T-152.`
302
+ `Monitor.wrap: no registered vendor adapter matched the client. Registered vendors: [${registry.map((e) => e.name).join(", ")}]. OpenAI shape requires {baseURL, defaultHeaders, chat.completions.create}; Anthropic shape requires {baseURL, defaultHeaders, messages.create}.`
303
303
  );
304
304
  };
305
305
  }
@@ -713,25 +713,19 @@ var Session = class {
713
713
  this.status = "ACTIVE";
714
714
  }
715
715
  /**
716
- * Wrap a provider SDK client so every request/response is monitored.
717
- *
718
- * T-151 (OpenAI) and T-152 (Anthropic) fill this in. Calling it at
719
- * T-150 throws so downstream code can't accidentally ship against
720
- * a silently-passthrough stub.
716
+ * Reserved provider wrapper; currently throws. Use `Monitor.wrap()`
717
+ * instead.
721
718
  */
722
719
  wrap(_client) {
723
720
  throw new Error(
724
- "Session.wrap lands with T-151 (OpenAI) and T-152 (Anthropic) in the wave-2 TS SDK cards."
721
+ "Session.wrap() is not implemented in this SDK. Use Monitor.wrap(client) for OpenAI and Anthropic clients."
725
722
  );
726
723
  }
727
724
  /**
728
- * Emit the hash-chained forensic bundle for this session. Lands with
729
- * T-153 alongside the Python `export_forensic_bundle` parity work.
725
+ * Reserved forensic export method; currently throws.
730
726
  */
731
727
  exportForensicBundle() {
732
- throw new Error(
733
- "Forensic bundle export lands with T-153: Session.exportForensicBundle lands with T-153."
734
- );
728
+ throw new Error("Session.exportForensicBundle() is not implemented in this SDK.");
735
729
  }
736
730
  };
737
731
  function isBuiltinPolicy(policy) {
@@ -764,16 +758,12 @@ var Monitor = class {
764
758
  );
765
759
  }
766
760
  /**
767
- * Start a new monitored session.
768
- *
769
- * T-153 fills in the sha256 task-hash computation + `_checkTaskIntegrity`
770
- * parity. T-150 throws a `NotImplementedError`-shaped exception so
771
- * accidental usage during wave-2 development does not silently
772
- * produce a session with an empty hash.
761
+ * Reserved session lifecycle method; currently throws.
762
+ * Use `Monitor.wrap()` to configure a provider client.
773
763
  */
774
764
  session() {
775
765
  throw new Error(
776
- "Monitor.session() lands with T-153 (Session lifecycle parity \u2014 sha256 task-hash + __enter__/__exit__ analog)."
766
+ "Monitor.session() is not implemented in this SDK. Use Monitor.wrap(client) to route a provider client through Sentisec."
777
767
  );
778
768
  }
779
769
  };